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

◆ syBetti()

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

Definition at line 771 of file syz.cc.

773 {
774 //#define BETTI_WITH_ZEROS
775  //tomin = FALSE;
776  int i,j=0,k=0,l,rows,cols,mr;
777  int *temp1,*temp2,*temp3;/*used to compute degrees*/
778  int *tocancel; /*(BOOLEAN)tocancel[i]=element is superfluous*/
779  int r0_len;
780 
781  /*------ compute size --------------*/
782  *regularity = -1;
783  cols = length;
784  while ((cols>0)
785  && ((res[cols-1]==NULL)
786  || (idIs0(res[cols-1]))))
787  {
788  cols--;
789  }
790  intvec * result;
791  if (idIs0(res[0]))
792  {
793  if (res[0]==NULL)
794  result = new intvec(1,1,1);
795  else
796  result = new intvec(1,1,res[0]->rank);
797  return result;
798  }
799  intvec *w=NULL;
800  if (weights!=NULL)
801  {
802  if (!idTestHomModule(res[0],currRing->qideal,weights))
803  {
804  WarnS("wrong weights given(3):");weights->show();PrintLn();
805  idHomModule(res[0],currRing->qideal,&w);
806  if (w!=NULL) { w->show();PrintLn();}
807  weights=NULL;
808  }
809  }
810 #if 0
811  if (idHomModule(res[0],currRing->qideal,&w)!=isHomog)
812  {
813  WarnS("betti-command: Input is not homogeneous!");
814  weights=NULL;
815  }
816 #endif
817  if (weights==NULL) weights=w;
818  else delete w;
819  r0_len=IDELEMS(res[0]);
820  while ((r0_len>0) && (res[0]->m[r0_len-1]==NULL)) r0_len--;
821  #ifdef SHOW_W
822  PrintS("weights:");if (weights!=NULL) weights->show(); else Print("NULL"); PrintLn();
823  #endif
824  int rkl=l = si_max(id_RankFreeModule(res[0],currRing),res[0]->rank);
825  i = 0;
826  while ((i<length) && (res[i]!=NULL))
827  {
828  if (IDELEMS(res[i])>l) l = IDELEMS(res[i]);
829  i++;
830  }
831  temp1 = (int*)omAlloc0((l+1)*sizeof(int));
832  temp2 = (int*)omAlloc((l+1)*sizeof(int));
833  rows = 1;
834  mr = 1;
835  cols++;
836  for (i=0;i<cols-1;i++)
837  {
838  if ((i==0) && (weights!=NULL)) p_SetModDeg(weights, currRing);
839  memset(temp2,0,(l+1)*sizeof(int));
840  for (j=0;j<IDELEMS(res[i]);j++)
841  {
842  if (res[i]->m[j]!=NULL)
843  {
844  if ((pGetComp(res[i]->m[j])>l)
845  // usual resolutions do not the following, but artifulal built may: (tr. #763)
846  //|| ((i>1) && (res[i-1]->m[pGetComp(res[i]->m[j])-1]==NULL))
847  )
848  {
849  WerrorS("input not a resolution");
850  omFreeSize((ADDRESS)temp1,(l+1)*sizeof(int));
851  omFreeSize((ADDRESS)temp2,(l+1)*sizeof(int));
852  return NULL;
853  }
854  temp2[j+1] = p_FDeg(res[i]->m[j],currRing)+temp1[pGetComp(res[i]->m[j])];
855  if (temp2[j+1]-i>rows) rows = temp2[j+1]-i;
856  if (temp2[j+1]-i<mr) mr = temp2[j+1]-i;
857  }
858  }
859  if ((i==0) && (weights!=NULL)) p_SetModDeg(NULL, currRing);
860  temp3 = temp1;
861  temp1 = temp2;
862  temp2 = temp3;
863  }
864  mr--;
865  if (weights!=NULL)
866  {
867  for(j=0;j<weights->length();j++)
868  {
869  if (rows <(*weights)[j]+1) rows=(-mr)+(*weights)[j]+1;
870  }
871  }
872  /*------ computation betti numbers --------------*/
873  rows -= mr;
874  result = new intvec(rows+1,cols,0);
875  if (weights!=NULL)
876  {
877  for(j=0;j<weights->length();j++)
878  {
879  IMATELEM((*result),(-mr)+(*weights)[j]+1,1) ++;
880  //Print("imat(%d,%d)++ -> %d\n",(-mr)+(*weights)[j]+1, 1, IMATELEM((*result),(-mr)+(*weights)[j]+1,1));
881  }
882  }
883  else
884  {
885  (*result)[(-mr)*cols] = /*idRankFreeModule(res[0])*/ rkl;
886  if ((!idIs0(res[0])) && ((*result)[(-mr)*cols]==0))
887  (*result)[(-mr)*cols] = 1;
888  }
889  tocancel = (int*)omAlloc0((rows+1)*sizeof(int));
890  memset(temp1,0,(l+1)*sizeof(int));
891  if (weights!=NULL)
892  {
893  memset(temp2,0,l*sizeof(int));
894  p_SetModDeg(weights, currRing);
895  }
896  else
897  memset(temp2,0,l*sizeof(int));
898  syDetect(res[0],0,TRUE,temp2,tocancel);
899  if (weights!=NULL) p_SetModDeg(NULL, currRing);
900  if (tomin)
901  {
902  //(*result)[(-mr)*cols] -= dummy;
903  for(j=0;j<=rows+mr;j++)
904  {
905  //Print("tocancel[%d]=%d imat(%d,%d)=%d\n",j,tocancel[j],(-mr)+j+1,1,IMATELEM((*result),(-mr)+j+1,1));
906  IMATELEM((*result),(-mr)+j+1,1) -= tocancel[j];
907  }
908  }
909  for (i=0;i<cols-1;i++)
910  {
911  if ((i==0) && (weights!=NULL)) p_SetModDeg(weights, currRing);
912  memset(temp2,0,l*sizeof(int));
913  for (j=0;j<IDELEMS(res[i]);j++)
914  {
915  if (res[i]->m[j]!=NULL)
916  {
917  temp2[j+1] = p_FDeg(res[i]->m[j],currRing)+temp1[pGetComp(res[i]->m[j])];
918  //(*result)[i+1+(temp2[j+1]-i-1)*cols]++;
919  //if (temp2[j+1]>i) IMATELEM((*result),temp2[j+1]-i-mr,i+2)++;
920  IMATELEM((*result),temp2[j+1]-i-mr,i+2)++;
921  }
922  else if (i==0)
923  {
924  if (j<r0_len) IMATELEM((*result),-mr,2)++;
925  }
926  }
927  /*------ computation betti numbers, if res not minimal --------------*/
928  if (tomin)
929  {
930  for (j=mr;j<rows+mr;j++)
931  {
932  //(*result)[i+1+j*cols] -= tocancel[j+1];
933  IMATELEM((*result),j+1-mr,i+2) -= tocancel[j+1];
934  }
935  if ((i<length-1) && (res[i+1]!=NULL))
936  {
937  memset(tocancel,0,(rows+1)*sizeof(int));
938  syDetect(res[i+1],i+1,TRUE,temp2,tocancel);
939  for (j=0;j<rows;j++)
940  {
941  //(*result)[i+1+j*cols] -= tocancel[j];
942  IMATELEM((*result),j+1,i+2) -= tocancel[j];
943  }
944  }
945  }
946  temp3 = temp1;
947  temp1 = temp2;
948  temp2 = temp3;
949  for (j=0;j<=rows;j++)
950  {
951  // if (((*result)[i+1+j*cols]!=0) && (j>*regularity)) *regularity = j;
952  if ((IMATELEM((*result),j+1,i+2)!=0) && (j>*regularity)) *regularity = j;
953  }
954  if ((i==0) && (weights!=NULL)) p_SetModDeg(NULL, currRing);
955  }
956  // Print("nach minim:\n"); result->show(); PrintLn();
957  /*------ clean up --------------*/
958  omFreeSize((ADDRESS)tocancel,(rows+1)*sizeof(int));
959  omFreeSize((ADDRESS)temp1,(l+1)*sizeof(int));
960  omFreeSize((ADDRESS)temp2,(l+1)*sizeof(int));
961  if ((tomin) && (mr<0)) // deletes the first (zero) line
962  {
963  for (j=1;j<=rows+mr+1;j++)
964  {
965  for (k=1;k<=cols;k++)
966  {
967  IMATELEM((*result),j,k) = IMATELEM((*result),j-mr,k);
968  }
969  }
970  for (j=rows+mr+1;j<=rows+1;j++)
971  {
972  for (k=1;k<=cols;k++)
973  {
974  IMATELEM((*result),j,k) = 0;
975  }
976  }
977  }
978  j = 0;
979  k = 0;
980  for (i=1;i<=result->rows();i++)
981  {
982  for(l=1;l<=result->cols();l++)
983  if (IMATELEM((*result),i,l) != 0)
984  {
985  j = si_max(j, i-1);
986  k = si_max(k, l-1);
987  }
988  }
989  intvec * exactresult=new intvec(j+1,k+1,0);
990  for (i=0;i<exactresult->rows();i++)
991  {
992  for (j=0;j<exactresult->cols();j++)
993  {
994  IMATELEM(*exactresult,i+1,j+1) = IMATELEM(*result,i+1,j+1);
995  }
996  }
997  if (row_shift!=NULL) *row_shift = mr;
998  delete result;
999  return exactresult;
1000 }
void p_SetModDeg(intvec *w, ring r)
Definition: p_polys.cc:3610
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:2100
int rows() const
Definition: intvec.h:94
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TRUE
Definition: auxiliary.h:98
void * ADDRESS
Definition: auxiliary.h:133
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:92
#define WarnS
Definition: emacs.cc:78
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define pGetComp(p)
Component.
Definition: polys.h:37
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
Definition: intvec.h:17
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
CanonicalForm res
Definition: facAbsFact.cc:64
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:380
int m
Definition: cfEzgcd.cc:121
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
int length() const
Definition: intvec.h:92
void show(int mat=0, int spaces=0) const
Definition: intvec.cc:149
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:267
const CanonicalForm & w
Definition: facAbsFact.cc:55
int cols() const
Definition: intvec.h:93
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int syDetect(ideal id, int index, BOOLEAN homog, int *degrees, int *tocancel)
Definition: syz.cc:702
#define IMATELEM(M, I, J)
Definition: intvec.h:83
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:93

◆ syDeleteAbove()

static void syDeleteAbove ( ideal  up,
int  k 
)
static

Definition at line 67 of file syz.cc.

68 {
69  if (up!=NULL)
70  {
71  for (int i=0;i<IDELEMS(up);i++)
72  {
73  if (up->m[i]!=NULL)
74  pDeleteComp(&(up->m[i]),k+1);
75  }
76  }
77 }
int k
Definition: cfEzgcd.cc:92
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
#define pDeleteComp(p, k)
Definition: polys.h:347

◆ syDeleteAbove1()

static void syDeleteAbove1 ( ideal  up,
int  k 
)
static

Definition at line 246 of file syz.cc.

247 {
248  poly p/*,pp*/;
249  if (up!=NULL)
250  {
251  for (int i=0;i<IDELEMS(up);i++)
252  {
253  p = up->m[i];
254  while ((p!=NULL) && (pGetComp(p)==k))
255  {
256  /*
257  pp = pNext(p);
258  pNext(p) = NULL;
259  pDelete(&p);
260  p = pp;
261  */
262  pLmDelete(&p);
263  }
264  up->m[i] = p;
265  if (p!=NULL)
266  {
267  while (pNext(p)!=NULL)
268  {
269  if (pGetComp(pNext(p))==k)
270  {
271  /*
272  pp = pNext(pNext(p));
273  pNext(pNext(p)) = NULL;
274  pDelete(&pNext(p));
275  pNext(p) = pp;
276  */
277  pLmDelete(&pNext(p));
278  }
279  else
280  pIter(p);
281  }
282  }
283  }
284  }
285 }
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
int k
Definition: cfEzgcd.cc:92
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int p
Definition: cfModGcd.cc:4019

◆ syDetect() [1/2]

int syDetect ( ideal  id,
int  index,
BOOLEAN  homog,
int *  degrees,
int *  tocancel 
)

Definition at line 702 of file syz.cc.

703 {
704  int i, j, k, subFromRank=0;
705  ideal temp;
706 
707  if (idIs0(id)) return 0;
708  temp = idInit(IDELEMS(id),id->rank);
709  for (i=0;i<IDELEMS(id);i++)
710  {
711  temp->m[i] = sypCopyConstant(id->m[i]);
712  }
713  i = IDELEMS(id);
714  while ((i>0) && (temp->m[i-1]==NULL)) i--;
715  if (i==0)
716  {
717  idDelete(&temp);
718  return 0;
719  }
720  j = 0;
721  while ((j<i) && (temp->m[j]==NULL)) j++;
722  while (j<i)
723  {
724  if (homog)
725  {
726  if (index==0) k = p_FDeg(temp->m[j],currRing)+degrees[pGetComp(temp->m[j])];
727  else k = degrees[pGetComp(temp->m[j])];
728  if (k>=index) tocancel[k-index]++;
729  if ((k>=0) && (index==0)) subFromRank++;
730  }
731  else
732  {
733  tocancel[0]--;
734  }
735  syGaussForOne(temp,j,pGetComp(temp->m[j]),j+1,i);
736  j++;
737  while ((j<i) && (temp->m[j]==NULL)) j++;
738  }
739  idDelete(&temp);
740  return subFromRank;
741 }
int j
Definition: facHensel.cc:105
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
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:92
#define pGetComp(p)
Component.
Definition: polys.h:37
static poly sypCopyConstant(poly inp)
Definition: syz.cc:680
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:380
int i
Definition: cfEzgcd.cc:125
#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:37
#define NULL
Definition: omList.c:10
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
Definition: syz.cc:219
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

◆ syDetect() [2/2]

void syDetect ( ideal  id,
int  index,
int  rsmin,
BOOLEAN  homog,
intvec degrees,
intvec tocancel 
)

Definition at line 743 of file syz.cc.

745 {
746  int * deg=NULL;
747  int * tocan=(int*) omAlloc0(tocancel->length()*sizeof(int));
748  int i;
749 
750  if (homog)
751  {
752  deg = (int*) omAlloc0(degrees->length()*sizeof(int));
753  for (i=degrees->length();i>0;i--)
754  deg[i-1] = (*degrees)[i-1]-rsmin;
755  }
756  syDetect(id,index,homog,deg,tocan);
757  for (i=tocancel->length();i>0;i--)
758  (*tocancel)[i-1] = tocan[i-1];
759  if (homog)
760  omFreeSize((ADDRESS)deg,degrees->length()*sizeof(int));
761  omFreeSize((ADDRESS)tocan,tocancel->length()*sizeof(int));
762 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:133
int i
Definition: cfEzgcd.cc:125
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
#define NULL
Definition: omList.c:10
int length() const
Definition: intvec.h:92
int syDetect(ideal id, int index, BOOLEAN homog, int *degrees, int *tocancel)
Definition: syz.cc:702
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ syGaussForOne()

void syGaussForOne ( ideal  syz,
int  elnum,
int  ModComp,
int  from,
int  till 
)

Definition at line 219 of file syz.cc.

220 {
221  int /*k,j,i,*/lu;
222  poly unit1,unit2;
223  poly actWith=syz->m[elnum];
224 
225  if (from<0) from = 0;
226  if ((till<=0) || (till>IDELEMS(syz))) till = IDELEMS(syz);
227  syz->m[elnum] = NULL;
229 /*--makes Gauss alg. for the column ModComp--*/
230  pTakeOutComp(&(actWith), ModComp, &unit1, &lu);
231  while (from<till)
232  {
233  poly tmp=syz->m[from];
234  if (/*syz->m[from]*/ tmp!=NULL)
235  {
236  pTakeOutComp(&(tmp), ModComp, &unit2, &lu);
237  tmp = pMult(pCopy(unit1),tmp);
238  syz->m[from] = pSub(tmp,
239  pMult(unit2,pCopy(actWith)));
240  }
241  from++;
242  }
243  pDelete(&actWith);
244  pDelete(&unit1);
245 }
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:540
#define pSub(a, b)
Definition: polys.h:273
#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:325
#define pMult(p, q)
Definition: polys.h:194
#define pDelete(p_ptr)
Definition: polys.h:173
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2782
#define pCopy(p)
return a copy of the poly
Definition: polys.h:172

◆ syMinBase()

ideal syMinBase ( ideal  arg)

Definition at line 1005 of file syz.cc.

1006 {
1007  intvec ** weights=NULL;
1008  int leng;
1009  if (idIs0(arg)) return idInit(1,arg->rank);
1010  resolvente res=syResolvente(arg,1,&leng,&weights,TRUE);
1011  ideal result=res[0];
1012  omFreeSize((ADDRESS)res,leng*sizeof(ideal));
1013  if (weights!=NULL)
1014  {
1015  if (*weights!=NULL)
1016  {
1017  delete (*weights);
1018  *weights=NULL;
1019  }
1020  if ((leng>=1) && (*(weights+1)!=NULL))
1021  {
1022  delete *(weights+1);
1023  *(weights+1)=NULL;
1024  }
1025  }
1026  idSkipZeroes(result);
1027  return result;
1028 }
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
Definition: syz.cc:390
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TRUE
Definition: auxiliary.h:98
void * ADDRESS
Definition: auxiliary.h:133
Definition: intvec.h:17
CanonicalForm res
Definition: facAbsFact.cc:64
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:37
#define NULL
Definition: omList.c:10
ideal * resolvente
Definition: ideals.h:18
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
return result
Definition: facAbsBiFact.cc:76

◆ syMinimizeResolvente()

void syMinimizeResolvente ( resolvente  res,
int  length,
int  first 
)

Definition at line 356 of file syz.cc.

357 {
358  int syzIndex=first;
359  intvec *dummy;
360 
361  if (syzIndex<1) syzIndex=1;
362  if ((syzIndex==1) && (!rIsPluralRing(currRing)) && (idHomModule(res[0],currRing->qideal,&dummy)))
363  {
365  delete dummy;
366  return;
367  }
368  while ((syzIndex<length-1) && (res[syzIndex]!=NULL) && (res[syzIndex+1]!=NULL))
369  {
370  syMinStep(res[syzIndex-1],res[syzIndex],FALSE,res[syzIndex+1]);
371  syzIndex++;
372  }
373  if (res[syzIndex]!=NULL)
374  syMinStep(res[syzIndex-1],res[syzIndex]);
375  if (!idIs0(res[0]))
376  idMinEmbedding(res[0],TRUE);
377 }
static void syMinStep(ideal mod, ideal &syz, BOOLEAN final=FALSE, ideal up=NULL, tHomog h=isNotHomog)
Definition: syz.cc:83
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
static void syMinStep1(resolvente res, int length)
Definition: syz.cc:290
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition: ideals.cc:2565
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
Definition: intvec.h:17
CanonicalForm res
Definition: facAbsFact.cc:64
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
#define NULL
Definition: omList.c:10
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:267
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

◆ syMinStep()

static void syMinStep ( ideal  mod,
ideal &  syz,
BOOLEAN  final = FALSE,
ideal  up = NULL,
tHomog  h = isNotHomog 
)
static

Definition at line 83 of file syz.cc.

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

◆ syMinStep1()

static void syMinStep1 ( resolvente  res,
int  length 
)
static

Definition at line 290 of file syz.cc.

291 {
292  int i,j,k,index=0;
293  poly p;
294  intvec *have_del=NULL,*to_del=NULL;
295 
296  while ((index<length) && (res[index]!=NULL))
297  {
298 /*---we take out dependend elements from syz---------------------*/
299  if (res[index+1]!=NULL)
300  {
301  ideal deg0 = id_Jet(res[index+1],0,currRing);
302  ideal reddeg0 = kInterRedOld(deg0);
303  idDelete(&deg0);
304  have_del = new intvec(IDELEMS(res[index]));
305  for (i=0;i<IDELEMS(reddeg0);i++)
306  {
307  if (reddeg0->m[i]!=NULL)
308  {
309  j = pGetComp(reddeg0->m[i]);
310  pDelete(&(res[index]->m[j-1]));
311  /*res[index]->m[j-1] = NULL;*/
312  (*have_del)[j-1] = 1;
313  }
314  }
315  idDelete(&reddeg0);
316  }
317  if (index>0)
318  {
319 /*--- we search for units and perform Gaussian elimination------*/
320  j = to_del->length();
321  while (j>0)
322  {
323  if ((*to_del)[j-1]==1)
324  {
325  k = 0;
326  while (k<IDELEMS(res[index]))
327  {
328  p = res[index]->m[k];
329  while ((p!=NULL) && ((!pLmIsConstantComp(p)) || (pGetComp(p)!=j)))
330  pIter(p);
331  if ((p!=NULL) && (pLmIsConstantComp(p)) && (pGetComp(p)==j)) break;
332  k++;
333  }
334  if (k>=IDELEMS(res[index]))
335  {
336  PrintS("out of range\n");
337  }
338  syGaussForOne(res[index],k,j);
339  if (res[index+1]!=NULL)
340  syDeleteAbove1(res[index+1],k+1);
341  (*to_del)[j-1] = 0;
342  }
343  j--;
344  }
345  }
346  if (to_del!=NULL) delete to_del;
347  to_del = have_del;
348  have_del = NULL;
349  index++;
350  }
351  if (TEST_OPT_PROT) PrintLn();
353  if (to_del!=NULL) delete to_del;
354 }
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:102
int k
Definition: cfEzgcd.cc:92
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
Definition: intvec.h:17
CanonicalForm res
Definition: facAbsFact.cc:64
int m
Definition: cfEzgcd.cc:121
static void syDeleteAbove1(ideal up, int k)
Definition: syz.cc:246
ideal id_Jet(const ideal i, int d, const ring R)
#define pLmIsConstantComp(p)
like above, except that p must be != NULL
Definition: polys.h:229
int i
Definition: cfEzgcd.cc:125
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:3019
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
#define NULL
Definition: omList.c:10
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:267
#define pDelete(p_ptr)
Definition: polys.h:173
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
Definition: syz.cc:219
int p
Definition: cfModGcd.cc:4019
void syKillEmptyEntres(resolvente res, int length)
Definition: syz1.cc:2201

◆ sypCopyConstant()

static poly sypCopyConstant ( poly  inp)
static

Definition at line 680 of file syz.cc.

681 {
682  poly outp=NULL,q;
683 
684  while (inp!=NULL)
685  {
686  if (pLmIsConstantComp(inp))
687  {
688  if (outp==NULL)
689  {
690  q = outp = pHead(inp);
691  }
692  else
693  {
694  pNext(q) = pHead(inp);
695  pIter(q);
696  }
697  }
698  pIter(inp);
699  }
700  return outp;
701 }
#define pIter(p)
Definition: monomials.h:44
#define pLmIsConstantComp(p)
like above, except that p must be != NULL
Definition: polys.h:229
#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

◆ syPrepareModComp()

static intvec* syPrepareModComp ( ideal  arg,
intvec **  w 
)
static

Definition at line 26 of file syz.cc.

27 {
28  intvec *w1 = NULL;
29  int i;
30  BOOLEAN isIdeal=FALSE;
31 
32  if ((w==NULL) || (*w==NULL)) return w1;
33  int maxxx = (*w)->length();
34  if (maxxx==1)
35  {
36  maxxx = 2;
37  isIdeal = TRUE;
38  }
39  w1 = new intvec(maxxx+IDELEMS(arg));
40  if (!isIdeal)
41  {
42  for (i=0;i<maxxx;i++)
43  {
44  (*w1)[i] = (**w)[i];
45  }
46  }
47  for (i=maxxx;i<maxxx+IDELEMS(arg);i++)
48  {
49  if (arg->m[i-maxxx]!=NULL)
50  {
51  (*w1)[i] = p_FDeg(arg->m[i-maxxx],currRing);
52  if (pGetComp(arg->m[i-maxxx])!=0)
53  {
54  (*w1)[i]+=(**w)[pGetComp(arg->m[i-maxxx])-1];
55  }
56  }
57  }
58  delete (*w);
59  *w = new intvec(IDELEMS(arg)+1);
60  for (i=0;i<IDELEMS(arg);i++)
61  {
62  (**w)[i+1] = (*w1)[i+maxxx];
63  }
64  return w1;
65 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define pGetComp(p)
Component.
Definition: polys.h:37
Definition: intvec.h:17
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:380
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
int length() const
Definition: intvec.h:92
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int BOOLEAN
Definition: auxiliary.h:85

◆ syResolution()

syStrategy syResolution ( ideal  arg,
int  maxlength,
intvec w,
BOOLEAN  minim 
)

Definition at line 614 of file syz.cc.

615 {
616 
617 #ifdef HAVE_PLURAL
618  const ideal idSaveCurrRingQuotient = currRing->qideal;
619  if( rIsSCA(currRing) )
620  {
622  {
623  currRing->qideal = SCAQuotient(currRing);
624  }
625  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
626  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
627  arg = id_KillSquares(arg, m_iFirstAltVar, m_iLastAltVar, currRing, false); // kill suares in input!
628  }
629 #endif
630 
632 
633  if ((w!=NULL) && (!idTestHomModule(arg,currRing->qideal,w))) // is this right in SCA case???
634  {
635  WarnS("wrong weights given(2):");w->show();PrintLn();
636  idHomModule(arg,currRing->qideal,&w);
637  w->show();PrintLn();
638  w=NULL;
639  }
640  if (w!=NULL)
641  {
642  result->weights = (intvec**)omAlloc0Bin(char_ptr_bin);
643  (result->weights)[0] = ivCopy(w);
644  result->length = 1;
645  }
646  resolvente fr = syResolvente(arg,maxlength,&(result->length),&(result->weights),minim);
647  resolvente fr1;
648  if (minim)
649  {
650  result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
651  fr1 = result->minres;
652  }
653  else
654  {
655  result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
656  fr1 = result->fullres;
657  }
658  for (int i=result->length-1;i>=0;i--)
659  {
660  if (fr[i]!=NULL)
661  fr1[i] = fr[i];
662  fr[i] = NULL;
663  }
664  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
665 
666 #ifdef HAVE_PLURAL
667  if( rIsSCA(currRing) )
668  {
670  {
671  currRing->qideal = idSaveCurrRingQuotient;
672  }
674  }
675 #endif
676 
677  return result;
678 }
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:390
void PrintLn()
Definition: reporter.cc:310
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:2100
#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:133
void * ADDRESS
Definition: auxiliary.h:133
#define WarnS
Definition: emacs.cc:78
omBin char_ptr_bin
Definition: ring.cc:45
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
Definition: intvec.h:17
bool ncExtensions(int iMask)
Definition: old.gring.cc:94
int i
Definition: cfEzgcd.cc:125
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:351
#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:1520
void show(int mat=0, int spaces=0) const
Definition: intvec.cc:149
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:198
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
ideal * resolvente
Definition: ideals.h:18
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
ssyStrategy * syStrategy
Definition: syz.h:35

◆ syResolvente()

resolvente syResolvente ( ideal  arg,
int  maxlength,
int *  length,
intvec ***  weights,
BOOLEAN  minim 
)

Definition at line 390 of file syz.cc.

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