Functions
syz.cc File Reference
#include <kernel/mod2.h>
#include <misc/options.h>
#include <omalloc/omalloc.h>
#include <kernel/polys.h>
#include <kernel/GBEngine/kstd1.h>
#include <kernel/GBEngine/kutil.h>
#include <kernel/combinatorics/stairc.h>
#include <misc/intvec.h>
#include <coeffs/numbers.h>
#include <kernel/ideals.h>
#include <polys/monomials/ring.h>
#include <kernel/GBEngine/syz.h>
#include <polys/prCopy.h>
#include <polys/nc/sca.h>

Go to the source code of this file.

Functions

static intvecsyPrepareModComp (ideal arg, intvec **w)
 
static void syDeleteAbove (ideal up, int k)
 
static void syMinStep (ideal mod, ideal syz, BOOLEAN final=FALSE, ideal up=NULL, tHomog h=isNotHomog)
 
void syGaussForOne (ideal syz, int elnum, int ModComp, int from, int till)
 
static void syDeleteAbove1 (ideal up, int k)
 
static void syMinStep1 (resolvente res, int length)
 
void syMinimizeResolvente (resolvente res, int length, int first)
 
resolvente syResolvente (ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
 
syStrategy syResolution (ideal arg, int maxlength, intvec *w, BOOLEAN minim)
 
static poly sypCopyConstant (poly inp)
 
int syDetect (ideal id, int index, BOOLEAN homog, int *degrees, int *tocancel)
 
void syDetect (ideal id, int index, int rsmin, BOOLEAN homog, intvec *degrees, intvec *tocancel)
 
intvecsyBetti (resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
 
ideal syMinBase (ideal arg)
 

Function Documentation

intvec* syBetti ( resolvente  res,
int  length,
int *  regularity,
intvec weights,
BOOLEAN  tomin,
int *  row_shift 
)

Definition at line 793 of file syz.cc.

795 {
796 //#define BETTI_WITH_ZEROS
797  //tomin = FALSE;
798  int i,j=0,k=0,l,rows,cols,mr;
799  int *temp1,*temp2,*temp3;/*used to compute degrees*/
800  int *tocancel; /*(BOOLEAN)tocancel[i]=element is superfluous*/
801  int r0_len;
802 
803  /*------ compute size --------------*/
804  *regularity = -1;
805  cols = length;
806  while ((cols>0)
807  && ((res[cols-1]==NULL)
808  || (idIs0(res[cols-1]))))
809  {
810  cols--;
811  }
812  intvec * result;
813  if (idIs0(res[0]))
814  {
815  if (res[0]==NULL)
816  result = new intvec(1,1,1);
817  else
818  result = new intvec(1,1,res[0]->rank);
819  return result;
820  }
821  intvec *w=NULL;
822  if (weights!=NULL)
823  {
824  if (!idTestHomModule(res[0],currRing->qideal,weights))
825  {
826  WarnS("wrong weights given(3):");weights->show();PrintLn();
827  idHomModule(res[0],currRing->qideal,&w);
828  if (w!=NULL) { w->show();PrintLn();}
829  weights=NULL;
830  }
831  }
832 #if 0
833  if (idHomModule(res[0],currRing->qideal,&w)!=isHomog)
834  {
835  Warn("betti-command: Input is not homogeneous!");
836  weights=NULL;
837  }
838 #endif
839  if (weights==NULL) weights=w;
840  else delete w;
841  r0_len=IDELEMS(res[0]);
842  while ((r0_len>0) && (res[0]->m[r0_len-1]==NULL)) r0_len--;
843  #ifdef SHOW_W
844  PrintS("weights:");if (weights!=NULL) weights->show(); else Print("NULL"); PrintLn();
845  #endif
846  int rkl=l = si_max(id_RankFreeModule(res[0],currRing),res[0]->rank);
847  i = 0;
848  while ((i<length) && (res[i]!=NULL))
849  {
850  if (IDELEMS(res[i])>l) l = IDELEMS(res[i]);
851  i++;
852  }
853  temp1 = (int*)omAlloc0((l+1)*sizeof(int));
854  temp2 = (int*)omAlloc((l+1)*sizeof(int));
855  rows = 1;
856  mr = 1;
857  cols++;
858  for (i=0;i<cols-1;i++)
859  {
860  if ((i==0) && (weights!=NULL)) p_SetModDeg(weights, currRing);
861  memset(temp2,0,(l+1)*sizeof(int));
862  for (j=0;j<IDELEMS(res[i]);j++)
863  {
864  if (res[i]->m[j]!=NULL)
865  {
866  if ((pGetComp(res[i]->m[j])>l)
867  || ((i>1) && (res[i-1]->m[pGetComp(res[i]->m[j])-1]==NULL)))
868  {
869  WerrorS("input not a resolvent");
870  omFreeSize((ADDRESS)temp1,(l+1)*sizeof(int));
871  omFreeSize((ADDRESS)temp2,(l+1)*sizeof(int));
872  return NULL;
873  }
874  temp2[j+1] = p_FDeg(res[i]->m[j],currRing)+temp1[pGetComp(res[i]->m[j])];
875  if (temp2[j+1]-i>rows) rows = temp2[j+1]-i;
876  if (temp2[j+1]-i<mr) mr = temp2[j+1]-i;
877  }
878  }
879  if ((i==0) && (weights!=NULL)) p_SetModDeg(NULL, currRing);
880  temp3 = temp1;
881  temp1 = temp2;
882  temp2 = temp3;
883  }
884  mr--;
885  if (weights!=NULL)
886  {
887  for(j=0;j<weights->length();j++)
888  {
889  if (rows <(*weights)[j]+1) rows=(-mr)+(*weights)[j]+1;
890  }
891  }
892  /*------ computation betti numbers --------------*/
893  rows -= mr;
894  result = new intvec(rows+1,cols,0);
895  if (weights!=NULL)
896  {
897  for(j=0;j<weights->length();j++)
898  {
899  IMATELEM((*result),(-mr)+(*weights)[j]+1,1) ++;
900  //Print("imat(%d,%d)++ -> %d\n",(-mr)+(*weights)[j]+1, 1, IMATELEM((*result),(-mr)+(*weights)[j]+1,1));
901  }
902  }
903  else
904  {
905  (*result)[(-mr)*cols] = /*idRankFreeModule(res[0])*/ rkl;
906  if ((!idIs0(res[0])) && ((*result)[(-mr)*cols]==0))
907  (*result)[(-mr)*cols] = 1;
908  }
909  tocancel = (int*)omAlloc0((rows+1)*sizeof(int));
910  memset(temp1,0,(l+1)*sizeof(int));
911  if (weights!=NULL)
912  {
913  memset(temp2,0,l*sizeof(int));
914  p_SetModDeg(weights, currRing);
915  }
916  else
917  memset(temp2,0,l*sizeof(int));
918  syDetect(res[0],0,TRUE,temp2,tocancel);
919  if (weights!=NULL) p_SetModDeg(NULL, currRing);
920  if (tomin)
921  {
922  //(*result)[(-mr)*cols] -= dummy;
923  for(j=0;j<=rows+mr;j++)
924  {
925  //Print("tocancel[%d]=%d imat(%d,%d)=%d\n",j,tocancel[j],(-mr)+j+1,1,IMATELEM((*result),(-mr)+j+1,1));
926  IMATELEM((*result),(-mr)+j+1,1) -= tocancel[j];
927  }
928  }
929  for (i=0;i<cols-1;i++)
930  {
931  if ((i==0) && (weights!=NULL)) p_SetModDeg(weights, currRing);
932  memset(temp2,0,l*sizeof(int));
933  for (j=0;j<IDELEMS(res[i]);j++)
934  {
935  if (res[i]->m[j]!=NULL)
936  {
937  temp2[j+1] = p_FDeg(res[i]->m[j],currRing)+temp1[pGetComp(res[i]->m[j])];
938  //(*result)[i+1+(temp2[j+1]-i-1)*cols]++;
939  //if (temp2[j+1]>i) IMATELEM((*result),temp2[j+1]-i-mr,i+2)++;
940  IMATELEM((*result),temp2[j+1]-i-mr,i+2)++;
941  }
942  else if (i==0)
943  {
944  if (j<r0_len) IMATELEM((*result),-mr,2)++;
945  }
946  }
947  /*------ computation betti numbers, if res not minimal --------------*/
948  if (tomin)
949  {
950  for (j=mr;j<rows+mr;j++)
951  {
952  //(*result)[i+1+j*cols] -= tocancel[j+1];
953  IMATELEM((*result),j+1-mr,i+2) -= tocancel[j+1];
954  }
955  if ((i<length-1) && (res[i+1]!=NULL))
956  {
957  memset(tocancel,0,(rows+1)*sizeof(int));
958  syDetect(res[i+1],i+1,TRUE,temp2,tocancel);
959  for (j=0;j<rows;j++)
960  {
961  //(*result)[i+1+j*cols] -= tocancel[j];
962  IMATELEM((*result),j+1,i+2) -= tocancel[j];
963  }
964  }
965  }
966  temp3 = temp1;
967  temp1 = temp2;
968  temp2 = temp3;
969  for (j=0;j<=rows;j++)
970  {
971  // if (((*result)[i+1+j*cols]!=0) && (j>*regularity)) *regularity = j;
972  if ((IMATELEM((*result),j+1,i+2)!=0) && (j>*regularity)) *regularity = j;
973  }
974  if ((i==0) && (weights!=NULL)) p_SetModDeg(NULL, currRing);
975  }
976  // Print("nach minim:\n"); result->show(); PrintLn();
977  /*------ clean up --------------*/
978  omFreeSize((ADDRESS)tocancel,(rows+1)*sizeof(int));
979  omFreeSize((ADDRESS)temp1,(l+1)*sizeof(int));
980  omFreeSize((ADDRESS)temp2,(l+1)*sizeof(int));
981  if ((tomin) && (mr<0)) // deletes the first (zero) line
982  {
983  for (j=1;j<=rows+mr+1;j++)
984  {
985  for (k=1;k<=cols;k++)
986  {
987  IMATELEM((*result),j,k) = IMATELEM((*result),j-mr,k);
988  }
989  }
990  for (j=rows+mr+1;j<=rows+1;j++)
991  {
992  for (k=1;k<=cols;k++)
993  {
994  IMATELEM((*result),j,k) = 0;
995  }
996  }
997  }
998  j = 0;
999  k = 0;
1000  for (i=1;i<=result->rows();i++)
1001  {
1002  for(l=1;l<=result->cols();l++)
1003  if (IMATELEM((*result),i,l) != 0)
1004  {
1005  j = si_max(j, i-1);
1006  k = si_max(k, l-1);
1007  }
1008  }
1009  intvec * exactresult=new intvec(j+1,k+1,0);
1010  for (i=0;i<exactresult->rows();i++)
1011  {
1012  for (j=0;j<exactresult->cols();j++)
1013  {
1014  IMATELEM(*exactresult,i+1,j+1) = IMATELEM(*result,i+1,j+1);
1015  }
1016  }
1017  if (row_shift!=NULL) *row_shift = mr;
1018  delete result;
1019  return exactresult;
1020 }
void p_SetModDeg(intvec *w, ring r)
Definition: p_polys.cc:3528
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:1881
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TRUE
Definition: auxiliary.h:144
int length() const
Definition: intvec.h:86
void * ADDRESS
Definition: auxiliary.h:161
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:93
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define pGetComp(p)
Component.
Definition: polys.h:37
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int j
Definition: myNF.cc:70
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:375
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:87
int rows() const
Definition: intvec.h:88
const CanonicalForm & w
Definition: facAbsFact.cc:55
void show(int mat=0, int spaces=0) const
Definition: intvec.cc:150
int syDetect(ideal id, int index, BOOLEAN homog, int *degrees, int *tocancel)
Definition: syz.cc:724
#define IMATELEM(M, I, J)
Definition: intvec.h:77
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:108
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
#define Warn
Definition: emacs.cc:80
static void syDeleteAbove ( ideal  up,
int  k 
)
static

Definition at line 71 of file syz.cc.

72 {
73  if (up!=NULL)
74  {
75  for (int i=0;i<IDELEMS(up);i++)
76  {
77  if (up->m[i]!=NULL)
78  pDeleteComp(&(up->m[i]),k+1);
79  }
80  }
81 }
int k
Definition: cfEzgcd.cc:93
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
#define pDeleteComp(p, k)
Definition: polys.h:332
static void syDeleteAbove1 ( ideal  up,
int  k 
)
static

Definition at line 250 of file syz.cc.

251 {
252  poly p/*,pp*/;
253  if (up!=NULL)
254  {
255  for (int i=0;i<IDELEMS(up);i++)
256  {
257  p = up->m[i];
258  while ((p!=NULL) && (pGetComp(p)==k))
259  {
260  /*
261  pp = pNext(p);
262  pNext(p) = NULL;
263  pDelete(&p);
264  p = pp;
265  */
266  pLmDelete(&p);
267  }
268  up->m[i] = p;
269  if (p!=NULL)
270  {
271  while (pNext(p)!=NULL)
272  {
273  if (pGetComp(pNext(p))==k)
274  {
275  /*
276  pp = pNext(pNext(p));
277  pNext(pNext(p)) = NULL;
278  pDelete(&pNext(p));
279  pNext(p) = pp;
280  */
281  pLmDelete(&pNext(p));
282  }
283  else
284  pIter(p);
285  }
286  }
287  }
288  }
289 }
return P p
Definition: myNF.cc:203
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
int syDetect ( ideal  id,
int  index,
BOOLEAN  homog,
int *  degrees,
int *  tocancel 
)

Definition at line 724 of file syz.cc.

725 {
726  int i, j, k, subFromRank=0;
727  ideal temp;
728 
729  if (idIs0(id)) return 0;
730  temp = idInit(IDELEMS(id),id->rank);
731  for (i=0;i<IDELEMS(id);i++)
732  {
733  temp->m[i] = sypCopyConstant(id->m[i]);
734  }
735  i = IDELEMS(id);
736  while ((i>0) && (temp->m[i-1]==NULL)) i--;
737  if (i==0)
738  {
739  idDelete(&temp);
740  return 0;
741  }
742  j = 0;
743  while ((j<i) && (temp->m[j]==NULL)) j++;
744  while (j<i)
745  {
746  if (homog)
747  {
748  if (index==0) k = p_FDeg(temp->m[j],currRing)+degrees[pGetComp(temp->m[j])];
749  else k = degrees[pGetComp(temp->m[j])];
750  if (k>=index) tocancel[k-index]++;
751  if ((k>=0) && (index==0)) subFromRank++;
752  }
753  else
754  {
755  tocancel[0]--;
756  }
757  syGaussForOne(temp,j,pGetComp(temp->m[j]),j+1,i);
758  j++;
759  while ((j<i) && (temp->m[j]==NULL)) j++;
760  }
761  idDelete(&temp);
762  return subFromRank;
763 }
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
int * degrees(const CanonicalForm &f, int *degs=0)
int * degrees ( const CanonicalForm & f, int * degs )
Definition: cf_ops.cc:493
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
static poly sypCopyConstant(poly inp)
Definition: syz.cc:702
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:375
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
Definition: syz.cc:223
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void syDetect ( ideal  id,
int  index,
int  rsmin,
BOOLEAN  homog,
intvec degrees,
intvec tocancel 
)

Definition at line 765 of file syz.cc.

767 {
768  int * deg=NULL;
769  int * tocan=(int*) omAlloc0(tocancel->length()*sizeof(int));
770  int i;
771 
772  if (homog)
773  {
774  deg = (int*) omAlloc0(degrees->length()*sizeof(int));
775  for (i=degrees->length();i>0;i--)
776  deg[i-1] = (*degrees)[i-1]-rsmin;
777  }
778  syDetect(id,index,homog,deg,tocan);
779  for (i=tocancel->length();i>0;i--)
780  (*tocancel)[i-1] = tocan[i-1];
781  if (homog)
782  omFreeSize((ADDRESS)deg,degrees->length()*sizeof(int));
783  omFreeSize((ADDRESS)tocan,tocancel->length()*sizeof(int));
784 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int length() const
Definition: intvec.h:86
void * ADDRESS
Definition: auxiliary.h:161
int i
Definition: cfEzgcd.cc:123
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
#define NULL
Definition: omList.c:10
int syDetect(ideal id, int index, BOOLEAN homog, int *degrees, int *tocancel)
Definition: syz.cc:724
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void syGaussForOne ( ideal  syz,
int  elnum,
int  ModComp,
int  from,
int  till 
)

Definition at line 223 of file syz.cc.

224 {
225  int /*k,j,i,*/lu;
226  poly unit1,unit2;
227  poly actWith=syz->m[elnum];
228 
229  if (from<0) from = 0;
230  if ((till<=0) || (till>IDELEMS(syz))) till = IDELEMS(syz);
231  syz->m[elnum] = NULL;
233 /*--makes Gauss alg. for the column ModComp--*/
234  pTakeOutComp(&(actWith), ModComp, &unit1, &lu);
235  while (from<till)
236  {
237  poly tmp=syz->m[from];
238  if (/*syz->m[from]*/ tmp!=NULL)
239  {
240  pTakeOutComp(&(tmp), ModComp, &unit2, &lu);
241  tmp = pMult(pCopy(unit1),tmp);
242  syz->m[from] = pSub(tmp,
243  pMult(unit2,pCopy(actWith)));
244  }
245  from++;
246  }
247  pDelete(&actWith);
248  pDelete(&unit1);
249 }
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:494
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pSub(a, b)
Definition: polys.h:258
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
void pTakeOutComp(poly *p, long comp, poly *q, int *lq, const ring R=currRing)
Splits *p into two polys: *q which consists of all monoms with component == comp and *p of all other ...
Definition: polys.h:310
#define pMult(p, q)
Definition: polys.h:178
#define pDelete(p_ptr)
Definition: polys.h:157
polyrec * poly
Definition: hilb.h:10
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2707
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
ideal syMinBase ( ideal  arg)

Definition at line 1025 of file syz.cc.

1026 {
1027  intvec ** weights=NULL;
1028  int leng;
1029  if (idIs0(arg)) return idInit(1,arg->rank);
1030  resolvente res=syResolvente(arg,1,&leng,&weights,TRUE);
1031  ideal result=res[0];
1032  omFreeSize((ADDRESS)res,leng*sizeof(ideal));
1033  if (weights!=NULL)
1034  {
1035  if (*weights!=NULL)
1036  {
1037  delete (*weights);
1038  *weights=NULL;
1039  }
1040  if ((leng>=1) && (*(weights+1)!=NULL))
1041  {
1042  delete *(weights+1);
1043  *(weights+1)=NULL;
1044  }
1045  }
1046  idSkipZeroes(result);
1047  return result;
1048 }
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
Definition: syz.cc:394
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
poly res
Definition: myNF.cc:322
Definition: intvec.h:14
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
ideal * resolvente
Definition: ideals.h:20
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
return result
Definition: facAbsBiFact.cc:76
void syMinimizeResolvente ( resolvente  res,
int  length,
int  first 
)

Definition at line 360 of file syz.cc.

361 {
362  int syzIndex=first;
363  intvec *dummy;
364 
365  if (syzIndex<1) syzIndex=1;
366  if ((syzIndex==1) && (idHomModule(res[0],currRing->qideal,&dummy)) && (!rIsPluralRing(currRing)))
367  {
368  syMinStep1(res,length);
369  delete dummy;
370  return;
371  }
372  while ((syzIndex<length-1) && (res[syzIndex]!=NULL) && (res[syzIndex+1]!=NULL))
373  {
374  syMinStep(res[syzIndex-1],res[syzIndex],FALSE,res[syzIndex+1]);
375  syzIndex++;
376  }
377  if (res[syzIndex]!=NULL)
378  syMinStep(res[syzIndex-1],res[syzIndex]);
379  if (!idIs0(res[0]))
380  idMinEmbedding(res[0],TRUE);
381 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
static void syMinStep1(resolvente res, int length)
Definition: syz.cc:294
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition: ideals.cc:2344
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:14
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
static void syMinStep(ideal mod, ideal syz, BOOLEAN final=FALSE, ideal up=NULL, tHomog h=isNotHomog)
Definition: syz.cc:87
#define NULL
Definition: omList.c:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:108
static void syMinStep ( ideal  mod,
ideal  syz,
BOOLEAN  final = FALSE,
ideal  up = NULL,
tHomog  h = isNotHomog 
)
static

Definition at line 87 of file syz.cc.

89 {
90  ideal deg0=NULL;
91  poly Unit1,Unit2,actWith;
92  int len,i,j,ModComp,m,k,l;
93  BOOLEAN searchUnit,existsUnit;
94 
95  if (TEST_OPT_PROT) PrintS("m");
96  if ((final) && (h==isHomog))
97  /*minim is TRUE, we are in the module: maxlength, maxlength <>0*/
98  {
99  deg0=id_Jet(syz,0,currRing);
100  idSkipZeroes(deg0);
101  syz=deg0;
102  }
103 /*--cancels empty entees and their related components above--*/
104  j = IDELEMS(syz);
105  while ((j>0) && (!syz->m[j-1])) j--;
106  k = 0;
107  while (k<j)
108  {
109  if (syz->m[k]!=NULL)
110  k++;
111  else
112  {
113  if (TEST_OPT_PROT) PrintS(".");
114  for (l=k;l<j-1;l++) syz->m[l] = syz->m[l+1];
115  syz->m[j-1] = NULL;
116  syDeleteAbove(up,k);
117  j--;
118  }
119  }
120 /*--searches for syzygies coming from superfluous elements
121 * in the module below--*/
122  searchUnit = TRUE;
123  int curr_syz_limit = rGetCurrSyzLimit(currRing);
124  while (searchUnit)
125  {
126  i=0;
127  j=IDELEMS(syz);
128  while ((j>0) && (syz->m[j-1]==NULL)) j--;
129  existsUnit = FALSE;
131  {
132  while ((i<j) && (!existsUnit))
133  {
134  existsUnit = pVectorHasUnitB(syz->m[i],&ModComp);
135  i++;
136  }
137  }
138  else
139  {
140  int I=0;
141  l = 0;
142  len=0;
143  for (i=0;i<IDELEMS(syz);i++)
144  {
145  if (syz->m[i]!=NULL)
146  {
147  pVectorHasUnit(syz->m[i],&m, &l);
148  if ((len==0) ||((l>0) && (l<len)))
149  {
150  len = l;
151  ModComp = m;
152  I = i;
153  }
154  }
155  }
156 //Print("Laenge ist: %d\n",len);
157  if (len>0) existsUnit = TRUE;
158  i = I+1;
159  }
160  if (existsUnit)
161  {
162  i--;
163 //--takes out the founded syzygy--
164  if (TEST_OPT_PROT) PrintS("f");
165  actWith = syz->m[i];
167 //Print("actWith: ");pWrite(actWith);
168  syz->m[i] = NULL;
169  for (k=i;k<j-1;k++) syz->m[k] = syz->m[k+1];
170  syz->m[j-1] = NULL;
171  syDeleteAbove(up,i);
172  j--;
173 //--makes Gauss alg. for the column ModComp--
174  Unit1 = pTakeOutComp(&(actWith), ModComp);
175 //PrintS("actWith now: ");pWrite(actWith);
176 //Print("Unit1: ");pWrite(Unit1);
177  k=0;
178 //Print("j= %d",j);
179  while (k<j)
180  {
181  if (syz->m[k]!=NULL)
182  {
183  Unit2 = pTakeOutComp(&(syz->m[k]), ModComp);
184 //Print("element %d: ",k);pWrite(syz->m[k]);
185 //PrintS("Unit2: ");pWrite(Unit2);
186  syz->m[k] = pMult(pCopy(Unit1),syz->m[k]);
187  syz->m[k] = pSub(syz->m[k],
188  pMult(Unit2,pCopy(actWith)));
189  if (syz->m[k]==NULL)
190  {
191  for (l=k;l<j-1;l++)
192  syz->m[l] = syz->m[l+1];
193  syz->m[j-1] = NULL;
194  j--;
195  syDeleteAbove(up,k);
196  k--;
197  }
198  }
199  k++;
200  }
201  pDelete(&actWith);
202  pDelete(&Unit1);
203 //--deletes superfluous elements from the module below---
204  pDelete(&(mod->m[ModComp-1 - curr_syz_limit]));
205  for (k=ModComp-1 - curr_syz_limit;k<IDELEMS(mod)-1;k++)
206  mod->m[k] = mod->m[k+1];
207  mod->m[IDELEMS(mod)-1] = NULL;
208  }
209  else
210  searchUnit = FALSE;
211  }
212  if (TEST_OPT_PROT) PrintLn();
213  idSkipZeroes(mod);
214  idSkipZeroes(syz);
215  if (deg0!=NULL)
216  idDelete(&deg0);
217 }
void PrintLn()
Definition: reporter.cc:327
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
#define pVectorHasUnitB(p, k)
Definition: polys.h:303
#define TRUE
Definition: auxiliary.h:144
#define rHasGlobalOrdering_currRing()
Definition: ring.h:756
int k
Definition: cfEzgcd.cc:93
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:494
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pVectorHasUnit(p, k, l)
Definition: polys.h:304
#define pSub(a, b)
Definition: polys.h:258
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
static void syDeleteAbove(ideal up, int k)
Definition: syz.cc:71
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal id_Jet(ideal i, int d, const ring R)
#define NULL
Definition: omList.c:10
void pTakeOutComp(poly *p, long comp, poly *q, int *lq, const ring R=currRing)
Splits *p into two polys: *q which consists of all monoms with component == comp and *p of all other ...
Definition: polys.h:310
#define pMult(p, q)
Definition: polys.h:178
#define pDelete(p_ptr)
Definition: polys.h:157
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2707
int l
Definition: cfEzgcd.cc:94
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
static void syMinStep1 ( resolvente  res,
int  length 
)
static

Definition at line 294 of file syz.cc.

295 {
296  int i,j,k,index=0;
297  poly p;
298  ideal deg0=NULL,reddeg0=NULL;
299  intvec *have_del=NULL,*to_del=NULL;
300 
301  while ((index<length) && (res[index]!=NULL))
302  {
303 /*---we take out dependend elements from syz---------------------*/
304  if (res[index+1]!=NULL)
305  {
306  deg0 = id_Jet(res[index+1],0,currRing);
307  reddeg0 = kInterRedOld(deg0);
308  idDelete(&deg0);
309  have_del = new intvec(IDELEMS(res[index]));
310  for (i=0;i<IDELEMS(reddeg0);i++)
311  {
312  if (reddeg0->m[i]!=NULL)
313  {
314  j = pGetComp(reddeg0->m[i]);
315  pDelete(&(res[index]->m[j-1]));
316  /*res[index]->m[j-1] = NULL;*/
317  (*have_del)[j-1] = 1;
318  }
319  }
320  idDelete(&reddeg0);
321  }
322  if (index>0)
323  {
324 /*--- we search for units and perform Gaussian elimination------*/
325  j = to_del->length();
326  while (j>0)
327  {
328  if ((*to_del)[j-1]==1)
329  {
330  k = 0;
331  while (k<IDELEMS(res[index]))
332  {
333  p = res[index]->m[k];
334  while ((p!=NULL) && ((!pLmIsConstantComp(p)) || (pGetComp(p)!=j)))
335  pIter(p);
336  if ((p!=NULL) && (pLmIsConstantComp(p)) && (pGetComp(p)==j)) break;
337  k++;
338  }
339  if (k>=IDELEMS(res[index]))
340  {
341  PrintS("out of range\n");
342  }
343  syGaussForOne(res[index],k,j);
344  if (res[index+1]!=NULL)
345  syDeleteAbove1(res[index+1],k+1);
346  (*to_del)[j-1] = 0;
347  }
348  j--;
349  }
350  }
351  if (to_del!=NULL) delete to_del;
352  to_del = have_del;
353  have_del = NULL;
354  index++;
355  }
356  if (TEST_OPT_PROT) PrintLn();
357  syKillEmptyEntres(res,length);
358 }
void PrintLn()
Definition: reporter.cc:327
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define TEST_OPT_PROT
Definition: options.h:98
return P p
Definition: myNF.cc:203
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:14
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
static void syDeleteAbove1(ideal up, int k)
Definition: syz.cc:250
#define pLmIsConstantComp(p)
like above, except that p must be != NULL
Definition: polys.h:213
int i
Definition: cfEzgcd.cc:123
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:2932
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:24
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
ideal id_Jet(ideal i, int d, const ring R)
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
Definition: syz.cc:223
polyrec * poly
Definition: hilb.h:10
void syKillEmptyEntres(resolvente res, int length)
Definition: syz1.cc:2209
static poly sypCopyConstant ( poly  inp)
static

Definition at line 702 of file syz.cc.

703 {
704  poly outp=NULL,q;
705 
706  while (inp!=NULL)
707  {
708  if (pLmIsConstantComp(inp))
709  {
710  if (outp==NULL)
711  {
712  q = outp = pHead(inp);
713  }
714  else
715  {
716  pNext(q) = pHead(inp);
717  pIter(q);
718  }
719  }
720  pIter(inp);
721  }
722  return outp;
723 }
#define pIter(p)
Definition: monomials.h:44
#define pLmIsConstantComp(p)
like above, except that p must be != NULL
Definition: polys.h:213
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static intvec* syPrepareModComp ( ideal  arg,
intvec **  w 
)
static

Definition at line 30 of file syz.cc.

31 {
32  intvec *w1 = NULL;
33  int i;
34  BOOLEAN isIdeal=FALSE;
35 
36  if ((w==NULL) || (*w==NULL)) return w1;
37  int maxxx = (*w)->length();
38  if (maxxx==1)
39  {
40  maxxx = 2;
41  isIdeal = TRUE;
42  }
43  w1 = new intvec(maxxx+IDELEMS(arg));
44  if (!isIdeal)
45  {
46  for (i=0;i<maxxx;i++)
47  {
48  (*w1)[i] = (**w)[i];
49  }
50  }
51  for (i=maxxx;i<maxxx+IDELEMS(arg);i++)
52  {
53  if (arg->m[i-maxxx]!=NULL)
54  {
55  (*w1)[i] = p_FDeg(arg->m[i-maxxx],currRing);
56  if (pGetComp(arg->m[i-maxxx])!=0)
57  {
58  (*w1)[i]+=(**w)[pGetComp(arg->m[i-maxxx])-1];
59  }
60  }
61  }
62  delete (*w);
63  *w = new intvec(IDELEMS(arg)+1);
64  for (i=0;i<IDELEMS(arg);i++)
65  {
66  (**w)[i+1] = (*w1)[i+maxxx];
67  }
68  return w1;
69 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int length() const
Definition: intvec.h:86
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:14
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:375
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
int BOOLEAN
Definition: auxiliary.h:131
syStrategy syResolution ( ideal  arg,
int  maxlength,
intvec w,
BOOLEAN  minim 
)

Definition at line 623 of file syz.cc.

624 {
625 
626 #ifdef HAVE_PLURAL
627 
628  const ideal idSaveCurrRingQuotient = currRing->qideal;
629 
630  if( rIsSCA(currRing) )
631  {
632 
633 #ifdef RDEBUG
634 // rWrite(currRing);
635 // rDebugPrint(currRing);
636 #endif
637 
639  {
640  currRing->qideal = SCAQuotient(currRing);
641  }
642 
643  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
644  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
645 
646  arg = id_KillSquares(arg, m_iFirstAltVar, m_iLastAltVar, currRing, false); // kill suares in input!
647  }
648 #endif
649 
651 
652  if ((w!=NULL) && (!idTestHomModule(arg,currRing->qideal,w))) // is this right in SCA case???
653  {
654  WarnS("wrong weights given(2):");w->show();PrintLn();
655  idHomModule(arg,currRing->qideal,&w);
656  w->show();PrintLn();
657  w=NULL;
658  }
659  if (w!=NULL)
660  {
661  result->weights = (intvec**)omAlloc0Bin(char_ptr_bin);
662  (result->weights)[0] = ivCopy(w);
663  result->length = 1;
664  }
665  resolvente fr = syResolvente(arg,maxlength,&(result->length),&(result->weights),minim),fr1;
666  if (minim)
667  {
668  result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
669  fr1 = result->minres;
670  }
671  else
672  {
673  result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
674  fr1 = result->fullres;
675  }
676  for (int i=result->length-1;i>=0;i--)
677  {
678  if (fr[i]!=NULL)
679  fr1[i] = fr[i];
680  fr[i] = NULL;
681  }
682  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
683 
684 
685 #ifdef HAVE_PLURAL
686  if( rIsSCA(currRing) )
687  {
688 
690  {
691  currRing->qideal = idSaveCurrRingQuotient;
692  }
693 
695  }
696 #endif
697 
698 
699  return result;
700 }
int length
Definition: syz.h:60
intvec ** weights
Definition: syz.h:45
ideal SCAQuotient(const ring r)
Definition: sca.h:10
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
Definition: syz.cc:394
void PrintLn()
Definition: reporter.cc:327
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:1881
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
intvec * ivCopy(const intvec *o)
Definition: intvec.h:126
void * ADDRESS
Definition: auxiliary.h:161
#define WarnS
Definition: emacs.cc:81
omBin char_ptr_bin
Definition: ring.cc:55
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:14
bool ncExtensions(int iMask)
Definition: old.gring.cc:100
int i
Definition: cfEzgcd.cc:123
static short scaFirstAltVar(ring r)
Definition: sca.h:18
resolvente fullres
Definition: syz.h:57
resolvente minres
Definition: syz.h:58
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
const int TESTSYZSCAMASK
Definition: nc.h:373
#define NULL
Definition: omList.c:10
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1534
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206
void show(int mat=0, int spaces=0) const
Definition: intvec.cc:150
ideal * resolvente
Definition: ideals.h:20
BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:108
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
ssyStrategy * syStrategy
Definition: syz.h:35
resolvente syResolvente ( ideal  arg,
int  maxlength,
int *  length,
intvec ***  weights,
BOOLEAN  minim 
)

Definition at line 394 of file syz.cc.

396 {
397  BITSET save1;
398  SI_SAVE_OPT1(save1);
399  resolvente res;
400  resolvente newres;
401  tHomog hom=isNotHomog;
402  ideal temp=NULL;
403  intvec *w = NULL,**tempW;
404  int i,k,syzIndex = 0,j,rk_arg=si_max(1,(int)id_RankFreeModule(arg,currRing));
405  int Kstd1_OldDeg=Kstd1_deg;
406  BOOLEAN completeMinim;
407  BOOLEAN oldDegBound=TEST_OPT_DEGBOUND;
408  BOOLEAN setRegularity=TRUE;
409  int wlength=*length;
410 
411  if (maxlength!=-1) *length = maxlength+1;
412  else *length = 5;
413  if ((wlength!=0) && (*length!=wlength))
414  {
415  intvec **wtmp = (intvec**)omAlloc0((*length)*sizeof(intvec*));
416  wtmp[0]=(*weights)[0];
417  omFreeSize((ADDRESS)*weights,wlength*sizeof(intvec*));
418  *weights=wtmp;
419  }
420  res = (resolvente)omAlloc0((*length)*sizeof(ideal));
421 
422 /*--- initialize the syzygy-ring -----------------------------*/
423  ring origR = currRing;
424  ring syz_ring = rAssure_SyzComp(origR, TRUE); // will do rChangeCurrRing if needed
425  rSetSyzComp(rk_arg, syz_ring);
426 
427  if (syz_ring != origR)
428  {
429  rChangeCurrRing(syz_ring);
430  res[0] = idrCopyR_NoSort(arg, origR, syz_ring);
431  }
432  else
433  {
434  res[0] = idCopy(arg);
435  }
436 
437 /*--- creating weights for the module components ---------------*/
438  if ((weights!=NULL) && (*weights!=NULL)&& ((*weights)[0]!=NULL))
439  {
440  if (!idTestHomModule(res[0],currRing->qideal,(*weights)[0]))
441  {
442  WarnS("wrong weights given(1):"); (*weights)[0]->show();PrintLn();
443  idHomModule(res[0],currRing->qideal,&w);
444  w->show();PrintLn();
445  *weights=NULL;
446  }
447  }
448 
449  if ((weights==NULL) || (*weights==NULL) || ((*weights)[0]==NULL))
450  {
451  hom=(tHomog)idHomModule(res[0],currRing->qideal,&w);
452  if (hom==isHomog)
453  {
454  *weights = (intvec**)omAlloc0((*length)*sizeof(intvec*));
455  if (w!=NULL) (*weights)[0] = ivCopy(w);
456  }
457  }
458  else
459  {
460  if ((weights!=NULL) && (*weights!=NULL)&& ((*weights)[0]!=NULL))
461  {
462  w = ivCopy((*weights)[0]);
463  hom = isHomog;
464  }
465  }
466 
467 #ifdef HAVE_PLURAL
469  {
470 // quick solution; need theory to apply homog GB stuff for G-Algebras
471  hom = isNotHomog;
472  }
473 #endif // HAVE_PLURAL
474 
475  if (hom==isHomog)
476  {
477  intvec *w1 = syPrepareModComp(res[0],&w);
478  if (w!=NULL) { delete w;w=NULL; }
479  w = w1;
480  j = 0;
481  while ((j<IDELEMS(res[0])) && (res[0]->m[j]==NULL)) j++;
482  if (j<IDELEMS(res[0]))
483  {
484  if (p_FDeg(res[0]->m[j],currRing)!=pTotaldegree(res[0]->m[j]))
485  setRegularity = FALSE;
486  }
487  }
488  else
489  {
490  setRegularity = FALSE;
491  }
492 
493 /*--- the main loop --------------------------------------*/
494  while ((res[syzIndex]!=NULL) && (!idIs0(res[syzIndex])) &&
495  ((maxlength==-1) || (syzIndex<=maxlength)))
496  // (syzIndex<maxlength+(int)minim)))
497 /*--- compute one step more for minimizing-----------------*/
498  {
499  if (Kstd1_deg!=0) Kstd1_deg++;
500  if (syzIndex+1==*length)
501  {
502  newres = (resolvente)omAlloc0((*length+5)*sizeof(ideal));
503  tempW = (intvec**)omAlloc0((*length+5)*sizeof(intvec*));
504  for (j=0;j<*length;j++)
505  {
506  newres[j] = res[j];
507  if (*weights!=NULL) tempW[j] = (*weights)[j];
508  /*else tempW[j] = NULL;*/
509  }
510  omFreeSize((ADDRESS)res,*length*sizeof(ideal));
511  if (*weights != NULL) omFreeSize((ADDRESS)*weights,*length*sizeof(intvec*));
512  *length += 5;
513  res=newres;
514  *weights = tempW;
515  }
516 /*--- interreducing first -----------------------------------*/
517  if (syzIndex>0)
518  {
519  int rkI=id_RankFreeModule(res[syzIndex],currRing);
520  rSetSyzComp(rkI, currRing);
521  }
522  if(! TEST_OPT_NO_SYZ_MINIM )
523  if (minim || (syzIndex!=0))
524  {
525  temp = kInterRedOld(res[syzIndex],currRing->qideal);
526  idDelete(&res[syzIndex]);
527  idSkipZeroes(temp);
528  res[syzIndex] = temp;
529  }
530  temp = NULL;
531 /*--- computing the syzygy modules --------------------------------*/
532  if ((currRing->qideal==NULL)&&(syzIndex==0)&& (!TEST_OPT_DEGBOUND))
533  {
534  res[/*syzIndex+*/1] = idSyzygies(res[0/*syzIndex*/],hom,&w,FALSE,setRegularity,&Kstd1_deg);
535  if ((!TEST_OPT_NOTREGULARITY) && (Kstd1_deg>0)
536  #ifdef HAVE_RINGS
537  && (!rField_is_Ring(currRing))
538  #endif
540  }
541  else
542  {
543  res[syzIndex+1] = idSyzygies(res[syzIndex],hom,&w,FALSE);
544  }
545  completeMinim=(syzIndex!=maxlength) || (maxlength ==-1) || (hom!=isHomog);
546  syzIndex++;
547  if (TEST_OPT_PROT) Print("[%d]\n",syzIndex);
548 
549  if(! TEST_OPT_NO_SYZ_MINIM )
550  {
551  if ((minim)||(syzIndex>1))
552  syMinStep(res[syzIndex-1],res[syzIndex],!completeMinim,NULL,hom);
553  if (!completeMinim)
554  /*minim is TRUE, we are in the module: maxlength, maxlength <>0*/
555  {
556  idDelete(&res[syzIndex]);
557  }
558  }
559 /*---creating the iterated weights for module components ---------*/
560  if ((hom == isHomog) && (res[syzIndex]!=NULL) && (!idIs0(res[syzIndex])))
561  {
562 //Print("die %d Modulegewichte sind:\n",w1->length());
563 //w1->show();
564 //PrintLn();
565  int max_comp = id_RankFreeModule(res[syzIndex],currRing);
566  k = max_comp - rGetCurrSyzLimit(currRing);
567  assume(w != NULL);
568  if (w != NULL)
569  w->resize(max_comp+IDELEMS(res[syzIndex]));
570  else
571  w = new intvec(max_comp+IDELEMS(res[syzIndex]));
572  (*weights)[syzIndex] = new intvec(k);
573  for (i=0;i<k;i++)
574  {
575  if (res[syzIndex-1]->m[i]!=NULL) // hs
576  {
577  (*w)[i + rGetCurrSyzLimit(currRing)] = p_FDeg(res[syzIndex-1]->m[i],currRing);
578  if (pGetComp(res[syzIndex-1]->m[i])>0)
579  (*w)[i + rGetCurrSyzLimit(currRing)]
580  += (*w)[pGetComp(res[syzIndex-1]->m[i])-1];
581  (*((*weights)[syzIndex]))[i] = (*w)[i+rGetCurrSyzLimit(currRing)];
582  }
583  }
584  for (i=k;i<k+IDELEMS(res[syzIndex]);i++)
585  {
586  if (res[syzIndex]->m[i-k]!=NULL)
587  (*w)[i+rGetCurrSyzLimit(currRing)] = p_FDeg(res[syzIndex]->m[i-k],currRing)
588  +(*w)[pGetComp(res[syzIndex]->m[i-k])-1];
589  }
590  }
591  }
592 /*--- end of the main loop --------------------------------------*/
593 /*--- deleting the temporare data structures --------------------*/
594  if ((syzIndex!=0) && (res[syzIndex]!=NULL) && (idIs0(res[syzIndex])))
595  idDelete(&res[syzIndex]);
596  if (w !=NULL) delete w;
597 
598  Kstd1_deg=Kstd1_OldDeg;
599  if (!oldDegBound)
601 
602  for (i=1; i<=syzIndex; i++)
603  {
604  if ((res[i]!=NULL) && ! idIs0(res[i]))
605  {
607  }
608  }
609 /*--- going back to the original ring -------------------------*/
610  if (origR != syz_ring)
611  {
612  rChangeCurrRing(origR); // should not be needed now?
613  for (i=0; i<=syzIndex; i++)
614  {
615  res[i] = idrMoveR_NoSort(res[i], syz_ring, origR);
616  }
617  rDelete(syz_ring);
618  }
619  SI_RESTORE_OPT1(save1);
620  return res;
621 }
#define TEST_OPT_NOTREGULARITY
Definition: options.h:114
unsigned si_opt_1
Definition: options.c:5
void resize(int new_length)
Definition: intvec.cc:107
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
#define TEST_OPT_DEGBOUND
Definition: options.h:108
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:1881
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
intvec * ivCopy(const intvec *o)
Definition: intvec.h:126
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
#define SI_SAVE_OPT1(A)
Definition: options.h:20
int k
Definition: cfEzgcd.cc:93
#define WarnS
Definition: emacs.cc:81
#define BITSET
Definition: structs.h:17
#define Sy_bit(x)
Definition: options.h:30
#define pGetComp(p)
Component.
Definition: polys.h:37
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void id_Shift(ideal M, int s, const ring r)
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define TEST_OPT_NO_SYZ_MINIM
Definition: options.h:118
tHomog
Definition: structs.h:37
int j
Definition: myNF.cc:70
static long pTotaldegree(poly p)
Definition: polys.h:253
#define assume(x)
Definition: mod2.h:405
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
int rGetMaxSyzComp(int i, const ring r)
return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit
Definition: ring.cc:5059
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4386
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:375
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:2932
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:73
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4991
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void syMinStep(ideal mod, ideal syz, BOOLEAN final=FALSE, ideal up=NULL, tHomog h=isNotHomog)
Definition: syz.cc:87
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:434
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const CanonicalForm & w
Definition: facAbsFact.cc:55
static bool rIsSCA(const ring r)
Definition: nc.h:206
void show(int mat=0, int spaces=0) const
Definition: intvec.cc:150
ideal * resolvente
Definition: ideals.h:20
#define OPT_DEGBOUND
Definition: options.h:85
int Kstd1_deg
Definition: kutil.cc:228
int BOOLEAN
Definition: auxiliary.h:131
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg)
Definition: ideals.cc:557
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:206
BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:108
static intvec * syPrepareModComp(ideal arg, intvec **w)
Definition: syz.cc:30
#define omAlloc0(size)
Definition: omAllocDecl.h:211
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262