My Project
partialgb.cc
Go to the documentation of this file.
1 #include "kernel/mod2.h"
2 #include "polys/prCopy.h"
3 #include "kernel/ideals.h"
5 #include "Singular/ipshell.h"
6 #include "Singular/mod_lib.h"
7 #include "Singular/ipid.h"
8 static ideal idPartialGB (ideal h1, int k)
9 {
10  ideal s_h1;
11  intvec *w=NULL;
12 
13  assume(currRing != NULL);
14  ring orig_ring=currRing;
15  ring syz_ring=rAssure_SyzComp(orig_ring,TRUE);
16  rSetSyzComp(k,syz_ring);
17  rChangeCurrRing(syz_ring);
18 
19  if (orig_ring != syz_ring)
20  {
21  s_h1=idrCopyR_NoSort(h1,orig_ring, syz_ring);
22  }
23  else
24  {
25  s_h1 = h1;
26  }
27 
28  ideal s_h3=kStd(s_h1,NULL,testHomog,&w,NULL,k);
29 
30  if (s_h3==NULL)
31  {
32  return idFreeModule(IDELEMS(h1));
33  }
34 
35  if (orig_ring != syz_ring)
36  {
37  idDelete(&s_h1);
38  idSkipZeroes(s_h3);
39  rChangeCurrRing(orig_ring);
40  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
41  rDelete(syz_ring);
42  idTest(s_h3);
43  return s_h3;
44  }
45 
46  idSkipZeroes(s_h3);
47  idTest(s_h3);
48  return s_h3;
49 }
50 
52 {
53  const short t[]={2,MODUL_CMD,INT_CMD};
54  if (iiCheckTypes(h,t,1))
55  {
56  ideal i1=(ideal)h->CopyD();
57  int i2=(int)((long)h->next->Data());
58  res->rtyp=MODUL_CMD;
59  res->data=idPartialGB(i1,i2);
60  return FALSE;
61  }
62  return TRUE;
63 }
64 //------------------------------------------------------------------------
65 // initialisation of the module
66 extern "C" int SI_MOD_INIT(partialgb)(SModulFunctions* p)
67 {
68  p->iiAddCproc("partialgb.so","partialStd",FALSE,partialStd);
69  return (MAX_TOK);
70 }
71 
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int k
Definition: cfEzgcd.cc:99
int p
Definition: cfModGcd.cc:4080
Definition: intvec.h:23
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
CanonicalForm res
Definition: facAbsFact.cc:60
const CanonicalForm & w
Definition: facAbsFact.cc:51
@ MODUL_CMD
Definition: grammar.cc:287
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define idTest(id)
Definition: ideals.h:47
ideal idFreeModule(int i)
Definition: ideals.h:111
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc:6564
STATIC_VAR Poly * h
Definition: janet.cc:971
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2419
#define assume(x)
Definition: mod2.h:387
#define NULL
Definition: omList.c:12
static ideal idPartialGB(ideal h1, int k)
Definition: partialgb.cc:8
int SI_MOD_INIT() partialgb(SModulFunctions *p)
Definition: partialgb.cc:66
static BOOLEAN partialStd(leftv res, leftv h)
Definition: partialgb.cc:51
void rChangeCurrRing(ring r)
Definition: polys.cc:15
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:260
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:204
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4426
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:449
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:5036
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define IDELEMS(i)
Definition: simpleideals.h:23
@ testHomog
Definition: structs.h:43
@ INT_CMD
Definition: tok.h:96
@ MAX_TOK
Definition: tok.h:218