Data Structures | Macros | Typedefs | Functions | Variables
syz.h File Reference
#include <misc/mylimits.h>
#include <kernel/structs.h>
#include <polys/monomials/ring.h>
#include <kernel/ideals.h>

Go to the source code of this file.

Data Structures

struct  SObject
 
class  ssyStrategy
 

Macros

#define SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE   8
 
#define SYZ_SHIFT_BASE_LOG   (BIT_SIZEOF_LONG - 1 - SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE)
 
#define SYZ_SHIFT_BASE   (1L << SYZ_SHIFT_BASE_LOG)
 

Typedefs

typedef SObject * SSet
 
typedef SSetSRes
 
typedef ssyStrategysyStrategy
 

Functions

void sySchreyersSyzygiesM (polyset F, int Fmax, polyset *Shdl, int *Smax, BOOLEAN noSort)
 
void sySchreyersSyzygiesB (polyset F, int Fmax, polyset *Shdl, int *Smax, BOOLEAN noSort)
 
resolvente sySchreyerResolvente (ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
 
syStrategy sySchreyer (ideal arg, int maxlength)
 
resolvente syResolvente (ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
 
syStrategy syResolution (ideal arg, int maxlength, intvec *w, BOOLEAN minim)
 
void syMinimizeResolvente (resolvente res, int length, int first)
 
intvecsyBetti (resolvente res, int length, int *regularity, intvec *weights=NULL, BOOLEAN tomin=TRUE, int *row_shift=NULL)
 
ideal syMinBase (ideal arg)
 
BOOLEAN syTestOrder (ideal i)
 
void syReOrderResolventFB (resolvente res, int length, int initial=1)
 
resolvente syLaScala1 (ideal arg, int *length)
 
syStrategy syLaScala3 (ideal arg, int *length)
 
syStrategy syLaScala (ideal arg, int &maxlength, intvec *weights=NULL)
 
syStrategy syHilb (ideal arg, int *length)
 
syStrategy syKosz (ideal arg, int *length)
 
void syKillComputation (syStrategy syzstr, ring r=currRing)
 
intvecsyBettiOfComputation (syStrategy syzstr, BOOLEAN minim=TRUE, int *row_shift=NULL, intvec *weights=NULL)
 
int sySize (syStrategy syzstr)
 
int syDim (syStrategy syzstr)
 
syStrategy syCopy (syStrategy syzstr)
 
void syPrint (syStrategy syzstr, const char *currRingName)
 
syStrategy syMinimize (syStrategy syzstr)
 
void syKillEmptyEntres (resolvente res, int length)
 
void syDeletePair (SObject *so)
 
void syInitializePair (SObject *so)
 
void syCopyPair (SObject *argso, SObject *imso)
 
void syCompactifyPairSet (SSet sPairs, int sPlength, int first)
 
void syCompactify1 (SSet sPairs, int *sPlength, int first)
 
SRes syInitRes (ideal arg, int *length, intvec *Tl, intvec *cw=NULL)
 
void syResetShiftedComponents (syStrategy syzstr, int index, int hilb=0)
 
void syEnlargeFields (syStrategy syzstr, int index)
 
void syEnterPair (syStrategy syzstr, SObject *so, int *sPlength, int index)
 
SSet syChosePairs (syStrategy syzstr, int *index, int *howmuch, int *actdeg)
 
int syInitSyzMod (syStrategy syzstr, int index, int init=17)
 
long syReorderShiftedComponents (long *sc, int n)
 
void syGaussForOne (ideal arg, int gen, int ModComp, int from=-1, int till=0)
 
void syEnterPair (SSet sPairs, SObject *so, int *sPlength, int index)
 
resolvente syReorder (resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy=TRUE, resolvente totake=NULL)
 

Variables

int * currcomponents
 
long * currShiftedComponents
 

Data Structure Documentation

◆ sSObject

struct sSObject

Definition at line 19 of file syz.h.

Data Fields
int ind1
int ind2
poly isNotMinimal
poly lcm
int length
int order
poly p
poly p1
poly p2
int reference
poly syz
int syzind

◆ ssyStrategy

class ssyStrategy

Definition at line 37 of file syz.h.

Data Fields
int ** backcomponents
intvec * betti
kBucket_pt bucket
intvec * cw
int ** elemLength
int ** Firstelem
resolvente fullres
intvec ** hilb_coeffs
int ** Howmuch
int length
short list_length
resolvente minres
resolvente orderedRes
short references
int regularity
resolvente res
intvec * resolution
SRes resPairs
unsigned long ** sev
long ** ShiftedComponents
ring syRing
kBucket_pt syz_bucket
intvec * Tl
int ** truecomponents
intvec ** weights

Macro Definition Documentation

◆ SYZ_SHIFT_BASE

#define SYZ_SHIFT_BASE   (1L << SYZ_SHIFT_BASE_LOG)

Definition at line 18 of file syz.h.

◆ SYZ_SHIFT_BASE_LOG

#define SYZ_SHIFT_BASE_LOG   (BIT_SIZEOF_LONG - 1 - SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE)

Definition at line 17 of file syz.h.

◆ SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE

#define SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE   8

Definition at line 15 of file syz.h.

Typedef Documentation

◆ SRes

typedef SSet* SRes

Definition at line 33 of file syz.h.

◆ SSet

typedef SObject* SSet

Definition at line 32 of file syz.h.

◆ syStrategy

Definition at line 35 of file syz.h.

Function Documentation

◆ syBetti()

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

Definition at line 791 of file syz.cc.

793 {
794 //#define BETTI_WITH_ZEROS
795  //tomin = FALSE;
796  int i,j=0,k=0,l,rows,cols,mr;
797  int *temp1,*temp2,*temp3;/*used to compute degrees*/
798  int *tocancel; /*(BOOLEAN)tocancel[i]=element is superfluous*/
799  int r0_len;
800 
801  /*------ compute size --------------*/
802  *regularity = -1;
803  cols = length;
804  while ((cols>0)
805  && ((res[cols-1]==NULL)
806  || (idIs0(res[cols-1]))))
807  {
808  cols--;
809  }
810  intvec * result;
811  if (idIs0(res[0]))
812  {
813  if (res[0]==NULL)
814  result = new intvec(1,1,1);
815  else
816  result = new intvec(1,1,res[0]->rank);
817  return result;
818  }
819  intvec *w=NULL;
820  if (weights!=NULL)
821  {
822  if (!idTestHomModule(res[0],currRing->qideal,weights))
823  {
824  WarnS("wrong weights given(3):");weights->show();PrintLn();
825  idHomModule(res[0],currRing->qideal,&w);
826  if (w!=NULL) { w->show();PrintLn();}
827  weights=NULL;
828  }
829  }
830 #if 0
831  if (idHomModule(res[0],currRing->qideal,&w)!=isHomog)
832  {
833  Warn("betti-command: Input is not homogeneous!");
834  weights=NULL;
835  }
836 #endif
837  if (weights==NULL) weights=w;
838  else delete w;
839  r0_len=IDELEMS(res[0]);
840  while ((r0_len>0) && (res[0]->m[r0_len-1]==NULL)) r0_len--;
841  #ifdef SHOW_W
842  PrintS("weights:");if (weights!=NULL) weights->show(); else Print("NULL"); PrintLn();
843  #endif
844  int rkl=l = si_max(id_RankFreeModule(res[0],currRing),res[0]->rank);
845  i = 0;
846  while ((i<length) && (res[i]!=NULL))
847  {
848  if (IDELEMS(res[i])>l) l = IDELEMS(res[i]);
849  i++;
850  }
851  temp1 = (int*)omAlloc0((l+1)*sizeof(int));
852  temp2 = (int*)omAlloc((l+1)*sizeof(int));
853  rows = 1;
854  mr = 1;
855  cols++;
856  for (i=0;i<cols-1;i++)
857  {
858  if ((i==0) && (weights!=NULL)) p_SetModDeg(weights, currRing);
859  memset(temp2,0,(l+1)*sizeof(int));
860  for (j=0;j<IDELEMS(res[i]);j++)
861  {
862  if (res[i]->m[j]!=NULL)
863  {
864  if ((pGetComp(res[i]->m[j])>l)
865  // usual resolutions do not the following, but artifulal built may: (tr. #763)
866  //|| ((i>1) && (res[i-1]->m[pGetComp(res[i]->m[j])-1]==NULL))
867  )
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:3579
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:1884
int rows() const
Definition: intvec.h:88
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TRUE
Definition: auxiliary.h:98
void * ADDRESS
Definition: auxiliary.h:115
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
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
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:120
int i
Definition: cfEzgcd.cc:123
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:86
void show(int mat=0, int spaces=0) const
Definition: intvec.cc:150
const CanonicalForm & w
Definition: facAbsFact.cc:55
int cols() const
Definition: intvec.h:87
int syDetect(ideal id, int index, BOOLEAN homog, int *degrees, int *tocancel)
Definition: syz.cc:722
#define IMATELEM(M, I, J)
Definition: intvec.h:77
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:94
#define Warn
Definition: emacs.cc:80

◆ syBettiOfComputation()

intvec* syBettiOfComputation ( syStrategy  syzstr,
BOOLEAN  minim = TRUE,
int *  row_shift = NULL,
intvec weights = NULL 
)

Don't change the syzstr???

Definition at line 1763 of file syz1.cc.

1765 {
1766  int dummy;
1767  BOOLEAN std_weights=TRUE;
1768  if ((weights!=NULL)
1769  && (syzstr->betti!=NULL)
1770  && (syzstr->weights!=NULL) && (syzstr->weights[0]!=NULL))
1771  {
1772  int i;
1773  for(i=weights->length()-1; i>=0; i--)
1774  {
1775  //Print("test %d: %d - %d\n",i,(*weights)[i], (*(syzstr->weights[0]))[i]);
1776  if ((*weights)[i]!=(*(syzstr->weights[0]))[i])
1777  {
1778  std_weights=FALSE;
1779  break;
1780  }
1781  }
1782  }
1783  if ((syzstr->betti!=NULL)
1784  && (std_weights))
1785  {
1786  if (minim || (syzstr->resPairs!=NULL))
1787  return ivCopy(syzstr->betti);
1788  }
1789 
1790  resolvente fullres = syzstr->fullres;
1791  resolvente minres = syzstr->minres;
1792  const int length = syzstr->length;
1793 
1794  if ((fullres==NULL) && (minres==NULL))
1795  {
1796  if (syzstr->hilb_coeffs==NULL)
1797  { // LA SCALA
1798  fullres = syReorder(syzstr->res, length, syzstr);
1799  }
1800  else
1801  { // HRES
1802  minres = syReorder(syzstr->orderedRes, length, syzstr);
1803  syKillEmptyEntres(minres, length);
1804  }
1805  }
1806 
1807  intvec *result=NULL;
1808 
1809  if (fullres!=NULL)
1810  result = syBetti(fullres,length,&dummy,weights,minim,row_shift);
1811  else
1812  result = syBetti(minres,length,&dummy,weights,minim,row_shift);
1813 
1814 
1815  return result; /// Don't change the syzstr???
1816 
1817  // TODO: cleanup thses!
1818  if( fullres != NULL && syzstr->fullres == NULL )
1819  syzstr->fullres = fullres;
1820  if( minres != NULL && syzstr->minres == NULL )
1821  syzstr->minres = minres;
1822 
1823  if ((result!=NULL)
1824  && ((minim) || (syzstr->resPairs!=NULL))
1825  && std_weights
1826  && (syzstr->betti==NULL))
1827  {
1828  syzstr->betti = ivCopy(result); // cache the result...
1829  }
1830 
1831  return result;
1832 }
int length
Definition: syz.h:60
intvec ** weights
Definition: syz.h:45
void syKillEmptyEntres(resolvente res, int length)
Definition: syz1.cc:2208
#define FALSE
Definition: auxiliary.h:94
intvec * betti
Definition: syz.h:53
intvec * ivCopy(const intvec *o)
Definition: intvec.h:126
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy, resolvente totake)
Definition: syz1.cc:1649
resolvente res
Definition: syz.h:47
#define TRUE
Definition: auxiliary.h:98
intvec ** hilb_coeffs
Definition: syz.h:46
resolvente orderedRes
Definition: syz.h:48
Definition: intvec.h:14
int i
Definition: cfEzgcd.cc:123
resolvente fullres
Definition: syz.h:57
resolvente minres
Definition: syz.h:58
#define NULL
Definition: omList.c:10
SRes resPairs
Definition: syz.h:49
int length() const
Definition: intvec.h:86
ideal * resolvente
Definition: ideals.h:18
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:791
int BOOLEAN
Definition: auxiliary.h:85
return result
Definition: facAbsBiFact.cc:76

◆ syChosePairs()

SSet syChosePairs ( syStrategy  syzstr,
int *  index,
int *  howmuch,
int *  actdeg 
)

Definition at line 1296 of file syz1.cc.

1297 {
1298  return syChosePairsPutIn(syzstr,index,howmuch,actdeg,0,syzstr->length);
1299 }
int length
Definition: syz.h:60
static SSet syChosePairsPutIn(syStrategy syzstr, int *index, int *howmuch, int *actdeg, int an, int en)
Definition: syz1.cc:1189
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592

◆ syCompactify1()

void syCompactify1 ( SSet  sPairs,
int *  sPlength,
int  first 
)

Definition at line 140 of file syz1.cc.

141 {
142  int k=first,kk=0;
143 
144  while (k+kk<*sPlength)
145  {
146  if (sPairs[k+kk].lcm!=NULL)
147  {
148  if (kk>0) syCopyPair(&sPairs[k+kk],&sPairs[k]);
149  k++;
150  }
151  else
152  {
153  kk++;
154  }
155  }
156  while (k<*sPlength)
157  {
158  syInitializePair(&sPairs[k]);
159  k++;
160  }
161  *sPlength -= kk;
162 }
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:711
void syInitializePair(SObject *so)
Definition: syz1.cc:71
int k
Definition: cfEzgcd.cc:93
void syCopyPair(SObject *argso, SObject *imso)
Definition: syz1.cc:90
#define NULL
Definition: omList.c:10

◆ syCompactifyPairSet()

void syCompactifyPairSet ( SSet  sPairs,
int  sPlength,
int  first 
)

Definition at line 112 of file syz1.cc.

113 {
114  int k=first,kk=0;
115 
116  while (k+kk<sPlength)
117  {
118  if (sPairs[k+kk].lcm!=NULL)
119  {
120  if (kk>0) syCopyPair(&sPairs[k+kk],&sPairs[k]);
121  k++;
122  }
123  else
124  {
125  kk++;
126  }
127  }
128  while (k<sPlength)
129  {
130  syInitializePair(&sPairs[k]);
131  k++;
132  }
133 }
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:711
void syInitializePair(SObject *so)
Definition: syz1.cc:71
int k
Definition: cfEzgcd.cc:93
void syCopyPair(SObject *argso, SObject *imso)
Definition: syz1.cc:90
#define NULL
Definition: omList.c:10

◆ syCopy()

syStrategy syCopy ( syStrategy  syzstr)

Definition at line 1892 of file syz1.cc.

1893 {
1894  syStrategy result=syzstr;
1895  (result->references)++;
1896  return result;
1897 }
short references
Definition: syz.h:63
return result
Definition: facAbsBiFact.cc:76

◆ syCopyPair()

void syCopyPair ( SObject *  argso,
SObject *  imso 
)

Definition at line 90 of file syz1.cc.

91 {
92  *imso=*argso;
93  (*argso).p = NULL;
94  (*argso).p1 = NULL;
95  (*argso).p2 = NULL;
96  (*argso).lcm = NULL;
97  (*argso).syz = NULL;
98  (*argso).ind1 = 0;
99  (*argso).ind2 = 0;
100  (*argso).syzind = -1;
101  (*argso).order = 0;
102  (*argso).isNotMinimal = NULL;
103  (*argso).length = -1;
104  (*argso).reference = -1;
105 }
#define NULL
Definition: omList.c:10

◆ syDeletePair()

void syDeletePair ( SObject *  so)

Definition at line 52 of file syz1.cc.

53 {
54  pDelete(&(*so).p);
55  pDelete(&(*so).lcm);
56  pDelete(&(*so).syz);
57  (*so).p1 = NULL;
58  (*so).p2 = NULL;
59  (*so).ind1 = 0;
60  (*so).ind2 = 0;
61  (*so).syzind = -1;
62  (*so).order = 0;
63  (*so).isNotMinimal = NULL;
64  (*so).length = -1;
65  (*so).reference = -1;
66 }
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:169

◆ syDim()

int syDim ( syStrategy  syzstr)

Definition at line 1857 of file syz1.cc.

1858 {
1859  int i,l;
1860  if (syzstr->resPairs!=NULL)
1861  {
1862  SRes rP=syzstr->resPairs;
1863 
1864  l = syzstr->length;
1865  while ((l>0) && (rP[l-1]==NULL)) l--;
1866  if (l==0) return -1;
1867  l--;
1868  while (l>=0)
1869  {
1870  i = 0;
1871  while ((i<(*syzstr->Tl)[l]) &&
1872  ((rP[l][i].lcm!=NULL) || (rP[l][i].syz!=NULL)) &&
1873  (rP[l][i].isNotMinimal!=NULL))
1874  {
1875  i++;
1876  }
1877  if ((i<(*syzstr->Tl)[l]) &&
1878  ((rP[l][i].lcm!=NULL) || (rP[l][i].syz!=NULL)) &&
1879  (rP[l][i].isNotMinimal==NULL))
1880  return l;
1881  l--;
1882  }
1883  return l;
1884  }
1885  else
1886  return sySize(syzstr);
1887 }
int length
Definition: syz.h:60
intvec * Tl
Definition: syz.h:50
int sySize(syStrategy syzstr)
Definition: syz1.cc:1837
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
SRes resPairs
Definition: syz.h:49
SSet * SRes
Definition: syz.h:33
int l
Definition: cfEzgcd.cc:94

◆ syEnlargeFields()

void syEnlargeFields ( syStrategy  syzstr,
int  index 
)

Definition at line 742 of file syz1.cc.

743 {
744  pEnlargeSet(&(syzstr->res[index]->m),IDELEMS(syzstr->res[index]),16);
746  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
747  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
748  syzstr->ShiftedComponents[index]
749  =(long*)omRealloc0Size((ADDRESS)syzstr->ShiftedComponents[index],
750  (IDELEMS(syzstr->res[index])+1)*sizeof(long),
751  (IDELEMS(syzstr->res[index])+17)*sizeof(long));
753  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
754  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
755  syzstr->Howmuch[index]=(int*)omRealloc0Size((ADDRESS)syzstr->Howmuch[index],
756  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
757  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
758  syzstr->Firstelem[index]=(int*)omRealloc0Size((ADDRESS)syzstr->Firstelem[index],
759  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
760  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
761  syzstr->elemLength[index]=(int*)omRealloc0Size((ADDRESS)syzstr->elemLength[index],
762  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
763  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
764  syzstr->sev[index]=(unsigned long*)omRealloc0Size((ADDRESS)syzstr->sev[index],
765  (IDELEMS(syzstr->res[index])+1)*sizeof(unsigned long),
766  (IDELEMS(syzstr->res[index])+17)*sizeof(unsigned long));
767  IDELEMS(syzstr->res[index]) += 16;
768  pEnlargeSet(&(syzstr->orderedRes[index]->m),IDELEMS(syzstr->orderedRes[index]),16);
769  IDELEMS(syzstr->orderedRes[index]) += 16;
770 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
resolvente res
Definition: syz.h:47
void * ADDRESS
Definition: auxiliary.h:115
resolvente orderedRes
Definition: syz.h:48
int ** backcomponents
Definition: syz.h:41
int ** Howmuch
Definition: syz.h:42
#define IDELEMS(i)
Definition: simpleideals.h:24
int ** Firstelem
Definition: syz.h:43
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
int ** elemLength
Definition: syz.h:44
int ** truecomponents
Definition: syz.h:39
long ** ShiftedComponents
Definition: syz.h:40
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3602
unsigned long ** sev
Definition: syz.h:59

◆ syEnterPair() [1/2]

void syEnterPair ( syStrategy  syzstr,
SObject *  so,
int *  sPlength,
int  index 
)

Definition at line 1043 of file syz1.cc.

1044 {
1045  int ll;
1046 
1047  if (*sPlength>=(*syzstr->Tl)[index])
1048  {
1049  SSet temp = (SSet)omAlloc0(((*syzstr->Tl)[index]+16)*sizeof(SObject));
1050  for (ll=0;ll<(*syzstr->Tl)[index];ll++)
1051  {
1052  temp[ll].p = (syzstr->resPairs[index])[ll].p;
1053  temp[ll].p1 = (syzstr->resPairs[index])[ll].p1;
1054  temp[ll].p2 = (syzstr->resPairs[index])[ll].p2;
1055  temp[ll].syz = (syzstr->resPairs[index])[ll].syz;
1056  temp[ll].lcm = (syzstr->resPairs[index])[ll].lcm;
1057  temp[ll].ind1 = (syzstr->resPairs[index])[ll].ind1;
1058  temp[ll].ind2 = (syzstr->resPairs[index])[ll].ind2;
1059  temp[ll].syzind = (syzstr->resPairs[index])[ll].syzind;
1060  temp[ll].order = (syzstr->resPairs[index])[ll].order;
1061  temp[ll].isNotMinimal = (syzstr->resPairs[index])[ll].isNotMinimal;
1062  temp[ll].length = (syzstr->resPairs[index])[ll].length;
1063  temp[ll].reference = (syzstr->resPairs[index])[ll].reference;
1064  }
1065  if (syzstr->resPairs[index] != NULL) // OB: ?????
1066  omFreeSize((ADDRESS)syzstr->resPairs[index],(*syzstr->Tl)[index]*sizeof(SObject));
1067  (*syzstr->Tl)[index] += 16;
1068  syzstr->resPairs[index] = temp;
1069  }
1070  syEnterPair(syzstr->resPairs[index],so,sPlength,index);
1071 }
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:711
return P p
Definition: myNF.cc:203
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:115
intvec * Tl
Definition: syz.h:50
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
#define NULL
Definition: omList.c:10
SRes resPairs
Definition: syz.h:49
void syEnterPair(SSet sPairs, SObject *so, int *sPlength, int)
Definition: syz1.cc:993
SObject * SSet
Definition: syz.h:32
long ind2(long arg)
Definition: kutil.cc:4190
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ syEnterPair() [2/2]

void syEnterPair ( SSet  sPairs,
SObject *  so,
int *  sPlength,
int  index 
)

Definition at line 993 of file syz1.cc.

994 {
995  int ll,k,no=(*so).order,sP=*sPlength,i;
996 
997  if ((sP==0) || (sPairs[sP-1].order<=no))
998  ll = sP;
999  else if (sP==1)
1000  ll = 0;
1001  else
1002  {
1003  int an=0,en=sP-1;
1004  loop
1005  {
1006  if (an>=en-1)
1007  {
1008  if ((sPairs[an].order<=no) && (sPairs[an+1].order>no))
1009  {
1010  ll = an+1;
1011  break;
1012  }
1013  else if ((sPairs[en].order<=no) && (sPairs[en+1].order>no))
1014  {
1015  ll = en+1;
1016  break;
1017  }
1018  else if (sPairs[an].order>no)
1019  {
1020  ll = an;
1021  break;
1022  }
1023  else
1024  {
1025  PrintS("Hier ist was faul!\n");
1026  break;
1027  }
1028  }
1029  i=(an+en) / 2;
1030  if (sPairs[i].order <= no)
1031  an=i;
1032  else
1033  en=i;
1034  }
1035  }
1036  for (k=(*sPlength);k>ll;k--)
1037  {
1038  syCopyPair(&sPairs[k-1],&sPairs[k]);
1039  }
1040  syCopyPair(so,&sPairs[ll]);
1041  (*sPlength)++;
1042 }
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
void syCopyPair(SObject *argso, SObject *imso)
Definition: syz1.cc:90
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284

◆ syGaussForOne()

void syGaussForOne ( ideal  arg,
int  gen,
int  ModComp,
int  from = -1,
int  till = 0 
)

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:540
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pSub(a, b)
Definition: polys.h:269
#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:321
#define pMult(p, q)
Definition: polys.h:190
#define pDelete(p_ptr)
Definition: polys.h:169
polyrec * poly
Definition: hilb.h:10
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2755
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ syHilb()

syStrategy syHilb ( ideal  arg,
int *  length 
)

Definition at line 956 of file syz2.cc.

957 {
958  int i,j,actdeg=32000,index=0;
959  int howmuch,toSub=0;
960  int maxindex=0,maxdeg=0;
961  ideal temp=NULL;
962  SSet nextPairs;
963  ring origR = currRing;
964  syStrategy syzstr=(syStrategy)omAlloc0(sizeof(ssyStrategy));
965 
966  if ((idIs0(arg)) || (id_RankFreeModule(arg,currRing)>0))
967  {
969  syzstr->length = 1;
970  syzstr->minres[0] = idInit(1,arg->rank);
971  return syzstr;
972  }
973 
974  // Creare dp,S ring and change to it
975  syzstr->syRing = rAssure_dp_C(origR);
976  rChangeCurrRing(syzstr->syRing);
977 
978  // set initial ShiftedComps
979  currcomponents = (int*)omAlloc0((arg->rank+1)*sizeof(int));
980  currShiftedComponents = (long*)omAlloc0((arg->rank+1)*sizeof(long));
981 
982 /*--- initializes the data structures---------------*/
983 #ifdef SHOW_CRIT
984  crit = 0;
985  crit1 = 0;
986  spfl = 0;
987  cons_pairs = 0;
988  crit_fails = 0;
989 #endif
990  syzstr->length = *length = currRing->N+2;
991  syzstr->Tl = new intvec(*length+1);
992  temp = idInit(IDELEMS(arg),arg->rank);
993  for (i=0;i<IDELEMS(arg);i++)
994  {
995  if (origR != syzstr->syRing)
996  temp->m[i] = prCopyR( arg->m[i], origR, syzstr->syRing);
997  else
998  temp->m[i] = pCopy( arg->m[i]);
999  if (temp->m[i]!=NULL)
1000  {
1001  j = pTotaldegree(temp->m[i]);
1002  if (j<actdeg) actdeg = j;
1003  }
1004  }
1005  idTest(temp);
1006  idSkipZeroes(temp);
1007  syzstr->resPairs = syInitRes(temp,length,syzstr->Tl,syzstr->cw);
1008  omFreeSize((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int));
1009  omFreeSize((ADDRESS)currShiftedComponents,(arg->rank+1)*sizeof(int));
1010  syzstr->res = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
1011  syzstr->orderedRes = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
1012  syzstr->elemLength = (int**)omAlloc0((*length+1)*sizeof(int*));
1013  syzstr->truecomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
1014  syzstr->backcomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
1015  syzstr->ShiftedComponents = (long**)omAlloc0((*length+1)*sizeof(long*));
1016  syzstr->Howmuch = (int**)omAlloc0((*length+1)*sizeof(int*));
1017  syzstr->Firstelem = (int**)omAlloc0((*length+1)*sizeof(int*));
1018  syzstr->hilb_coeffs = (intvec**)omAlloc0((*length+1)*sizeof(intvec*));
1019  syzstr->sev = (unsigned long **)omAlloc0((*length+1)*sizeof(unsigned long*));
1020  syzstr->bucket = kBucketCreate(currRing);
1021  syzstr->syz_bucket = kBucketCreate(currRing);
1022  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
1023 /*--- computes the resolution ----------------------*/
1024  while (nextPairs!=NULL)
1025  {
1026 #ifdef SHOW_PROT
1027 Print("compute %d Paare im Module %d im Grad %d \n",howmuch,index,actdeg+index);
1028 #endif
1029  if (TEST_OPT_PROT) Print("%d",actdeg);
1030  if (TEST_OPT_PROT) Print("(m%d)",index);
1031  if (index==0)
1032  i = syInitSyzMod(syzstr,index,id_RankFreeModule(arg, origR)+1);
1033  else
1034  i = syInitSyzMod(syzstr,index);
1035  j = syInitSyzMod(syzstr,index+1);
1036  if (index>0)
1037  {
1038  syRedNextPairs_Hilb(nextPairs,syzstr,howmuch,index,actdeg,&toSub,&maxindex,&maxdeg);
1039  syzstr->res[index+1]->rank=id_RankFreeModule(syzstr->res[index+1],currRing);
1040  sySetNewHilb(syzstr,toSub,index,actdeg);
1041  toSub = 0;
1042  syCompactifyPairSet(syzstr->resPairs[index],(*syzstr->Tl)[index],0);
1043  }
1044  else
1045  syRedGenerOfCurrDeg_Hilb(syzstr,actdeg,&maxindex,&maxdeg);
1046 /*--- creates new pairs -----------------------------*/
1047 #ifdef SHOW_PROT
1048 Print("Bilde neue Paare in Modul %d!\n",index);
1049 #endif
1050  syCreateNewPairs_Hilb(syzstr,index,actdeg);
1051  if (index<(*length)-1)
1052  {
1053 #ifdef SHOW_PROT
1054 Print("Bilde neue Paare in Modul %d!\n",index+1);
1055 #endif
1056  syCreateNewPairs_Hilb(syzstr,index+1,actdeg-1);
1057  }
1058  index++;
1059  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
1060  }
1061  syReOrdResult_Hilb(syzstr,maxindex,maxdeg);
1062 #ifdef SHOW_RESULT
1063 PrintS("minimal resolution:\n");
1064 for (int ti=1;ti<=*length;ti++)
1065 {
1066  if (!idIs0(syzstr->orderedRes[ti])) idPrint(syzstr->orderedRes[ti]);
1067 }
1068 PrintS("full resolution:\n");
1069 for (int ti=1;ti<=*length;ti++)
1070 {
1071  if (!idIs0(syzstr->res[ti])) idPrint(syzstr->res[ti]);
1072 }
1073 #endif
1074 #ifdef SHOW_CRIT
1075 Print("Criterion %d times applied\n",crit);
1076 Print("Criterion1 %d times applied\n",crit1);
1077 Print("%d superfluous pairs\n",spfl);
1078 Print("%d pairs considered\n",cons_pairs);
1079 Print("Criterion fails %d times\n",crit_fails);
1080 crit = 0;
1081 crit1 = 0;
1082 spfl = 0;
1083 cons_pairs = 0;
1084 crit_fails = 0;
1085 #endif
1086  if (temp!=NULL) idDelete(&temp);
1087  kBucketDestroy(&(syzstr->bucket));
1088  kBucketDestroy(&(syzstr->syz_bucket));
1089  if (origR != syzstr->syRing)
1090  rChangeCurrRing(origR);
1091  else
1092  currRing = origR;
1093  if (TEST_OPT_PROT) PrintLn();
1094  return syzstr;
1095 }
int length
Definition: syz.h:60
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
SRes syInitRes(ideal arg, int *length, intvec *Tl, intvec *cw=NULL)
Definition: syz1.cc:301
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
kBucket_pt bucket
Definition: syz.h:54
#define TEST_OPT_PROT
Definition: options.h:98
omBin sip_sideal_bin
Definition: simpleideals.cc:30
void syCompactifyPairSet(SSet sPairs, int sPlength, int first)
Definition: syz1.cc:112
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
resolvente res
Definition: syz.h:47
SSet syChosePairs(syStrategy syzstr, int *index, int *howmuch, int *actdeg)
Definition: syz1.cc:1296
static void syReOrdResult_Hilb(syStrategy syzstr, int maxindex, int maxdeg)
Definition: syz2.cc:908
void * ADDRESS
Definition: auxiliary.h:115
long * currShiftedComponents
Definition: syz1.cc:40
intvec ** hilb_coeffs
Definition: syz.h:46
intvec * Tl
Definition: syz.h:50
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static void syRedNextPairs_Hilb(SSet nextPairs, syStrategy syzstr, int howmuch, int index, int actord, int *toSub, int *maxindex, int *maxdeg)
Definition: syz2.cc:497
#define idPrint(id)
Definition: ideals.h:46
resolvente orderedRes
Definition: syz.h:48
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:200
Definition: intvec.h:14
int syInitSyzMod(syStrategy syzstr, int index, int init=17)
Definition: syz1.cc:1467
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 pTotaldegree(poly p)
Definition: polys.h:264
ring rAssure_dp_C(const ring r)
Definition: ring.cc:4883
int ** backcomponents
Definition: syz.h:41
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
int ** Howmuch
Definition: syz.h:42
static void syCreateNewPairs_Hilb(syStrategy syzstr, int index, int actdeg)
Definition: syz2.cc:71
kBucket_pt syz_bucket
Definition: syz.h:55
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
int ** Firstelem
Definition: syz.h:43
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
void rChangeCurrRing(ring r)
Definition: polys.cc:12
resolvente minres
Definition: syz.h:58
int ** elemLength
Definition: syz.h:44
intvec * cw
Definition: syz.h:52
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
int ** truecomponents
Definition: syz.h:39
long ** ShiftedComponents
Definition: syz.h:40
#define NULL
Definition: omList.c:10
int * currcomponents
Definition: syz1.cc:39
ring syRing
Definition: syz.h:56
SRes resPairs
Definition: syz.h:49
void sySetNewHilb(syStrategy syzstr, int toSub, int index, int actord)
Definition: syz2.cc:787
unsigned long ** sev
Definition: syz.h:59
SObject * SSet
Definition: syz.h:32
ideal * resolvente
Definition: ideals.h:18
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:193
static void syRedGenerOfCurrDeg_Hilb(syStrategy syzstr, int deg, int *maxindex, int *maxdeg)
Definition: syz2.cc:847
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
#define idTest(id)
Definition: ideals.h:47
ssyStrategy * syStrategy
Definition: syz.h:35

◆ syInitializePair()

void syInitializePair ( SObject *  so)

Definition at line 71 of file syz1.cc.

72 {
73  (*so).p = NULL;
74  (*so).lcm = NULL;
75  (*so).syz = NULL;
76  (*so).p1 = NULL;
77  (*so).p2 = NULL;
78  (*so).ind1 = 0;
79  (*so).ind2 = 0;
80  (*so).syzind = -1;
81  (*so).order = 0;
82  (*so).isNotMinimal = NULL;
83  (*so).length = -1;
84  (*so).reference = -1;
85 }
#define NULL
Definition: omList.c:10

◆ syInitRes()

SRes syInitRes ( ideal  arg,
int *  length,
intvec Tl,
intvec cw = NULL 
)

Definition at line 301 of file syz1.cc.

302 {
303  if (idIs0(arg)) return NULL;
304  SRes resPairs = (SRes)omAlloc0(*length*sizeof(SSet));
305  resPairs[0] = (SSet)omAlloc0(IDELEMS(arg)*sizeof(SObject));
306  intvec * iv=NULL;
307  int i,j;
308 
309  if (id_RankFreeModule(arg,currRing)==0)
310  {
311  iv = idSort(arg);
312  for (i=0;i<IDELEMS(arg);i++)
313  {
314  (resPairs[0])[i].syz = /*pCopy*/(arg->m[(*iv)[i]-1]);
315  arg->m[(*iv)[i]-1] = NULL;
316  (resPairs[0])[i].order = pTotaldegree((resPairs[0])[i].syz);
317  }
318  }
319  else
320  {
321  iv = new intvec(IDELEMS(arg),1,-1);
322  for (i=0;i<IDELEMS(arg);i++)
323  {
324  (*iv)[i] = pTotaldegree(arg->m[i])+(*cw)[pGetComp(arg->m[i])-1];
325  }
326  for (i=0;i<IDELEMS(arg);i++)
327  {
328  j = syChMin(iv);
329  if (j<0) break;
330  (resPairs[0])[i].syz = arg->m[j];
331  arg->m[j] = NULL;
332  (resPairs[0])[i].order = (*iv)[j];
333  (*iv)[j] = -1;
334  }
335  }
336  if (iv!=NULL) delete iv;
337  (*Tl)[0] = IDELEMS(arg);
338  return resPairs;
339 }
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:185
#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:10
Definition: intvec.h:14
static int syChMin(intvec *iv)
Definition: syz1.cc:278
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 pTotaldegree(poly p)
Definition: polys.h:264
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
SObject * SSet
Definition: syz.h:32
SSet * SRes
Definition: syz.h:33
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ syInitSyzMod()

int syInitSyzMod ( syStrategy  syzstr,
int  index,
int  init = 17 
)

Definition at line 1467 of file syz1.cc.

1468 {
1469  int result;
1470 
1471  if (syzstr->res[index]==NULL)
1472  {
1473  syzstr->res[index] = idInit(init-1,1);
1474  syzstr->truecomponents[index] = (int*)omAlloc0(init*sizeof(int));
1475  syzstr->ShiftedComponents[index] = (long*)omAlloc0(init*sizeof(long));
1476  if (index==0)
1477  {
1478  for (int i=0;i<init;i++)
1479  {
1480  syzstr->truecomponents[0][i] = i;
1481  syzstr->ShiftedComponents[0][i] = (i)*SYZ_SHIFT_BASE;
1482  }
1483  }
1484  syzstr->backcomponents[index] = (int*)omAlloc0(init*sizeof(int));
1485  syzstr->Howmuch[index] = (int*)omAlloc0(init*sizeof(int));
1486  syzstr->Firstelem[index] = (int*)omAlloc0(init*sizeof(int));
1487  syzstr->elemLength[index] = (int*)omAlloc0(init*sizeof(int));
1488  syzstr->orderedRes[index] = idInit(init-1,1);
1489  syzstr->sev[index] = (unsigned long*) omAlloc0(init*sizeof(unsigned long));
1490  result = 0;
1491  }
1492  else
1493  {
1494  result = IDELEMS(syzstr->res[index]);
1495  while ((result>0) && (syzstr->res[index]->m[result-1]==NULL)) result--;
1496  }
1497  return result;
1498 }
resolvente res
Definition: syz.h:47
resolvente orderedRes
Definition: syz.h:48
#define SYZ_SHIFT_BASE
Definition: syz.h:18
int ** backcomponents
Definition: syz.h:41
int i
Definition: cfEzgcd.cc:123
int ** Howmuch
Definition: syz.h:42
#define IDELEMS(i)
Definition: simpleideals.h:24
int ** Firstelem
Definition: syz.h:43
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
int ** elemLength
Definition: syz.h:44
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
int ** truecomponents
Definition: syz.h:39
long ** ShiftedComponents
Definition: syz.h:40
#define NULL
Definition: omList.c:10
unsigned long ** sev
Definition: syz.h:59
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76

◆ syKillComputation()

void syKillComputation ( syStrategy  syzstr,
ring  r = currRing 
)

Definition at line 1503 of file syz1.cc.

1504 {
1505  if (syzstr->references>0)
1506  {
1507  (syzstr->references)--;
1508  }
1509  else
1510  {
1511  int i,j;
1512  if (syzstr->minres!=NULL)
1513  {
1514  for (i=0;i<syzstr->length;i++)
1515  {
1516  if (syzstr->minres[i]!=NULL)
1517  {
1518  id_Delete(&(syzstr->minres[i]),r);
1519  }
1520  }
1521  omFreeSize((ADDRESS)syzstr->minres,(syzstr->length+1)*sizeof(ideal));
1522  }
1523  if (syzstr->fullres!=NULL)
1524  {
1525  for (i=0;i<syzstr->length;i++)
1526  {
1527  if (syzstr->fullres[i]!=NULL)
1528  {
1529  id_Delete(&(syzstr->fullres[i]),r);
1530  }
1531  }
1532  omFreeSize((ADDRESS)syzstr->fullres,(syzstr->length+1)*sizeof(ideal));
1533  }
1534  if (syzstr->weights!=0)
1535  {
1536  for (i=0;i<syzstr->length;i++)
1537  {
1538  if (syzstr->weights[i]!=NULL)
1539  {
1540  delete syzstr->weights[i];
1541  }
1542  }
1543  omFreeSize((ADDRESS)syzstr->weights,syzstr->length*sizeof(intvec*));
1544  }
1545 
1546  ring sr=syzstr->syRing;
1547  if (sr==NULL) sr=r;
1548 
1549  if (syzstr->resPairs!=NULL)
1550  {
1551  for (i=0;i<syzstr->length;i++)
1552  {
1553  for (j=0;j<(*syzstr->Tl)[i];j++)
1554  {
1555  if ((syzstr->resPairs[i])[j].lcm!=NULL)
1556  p_Delete(&((syzstr->resPairs[i])[j].lcm),sr);
1557  if ((i>0) && ((syzstr->resPairs[i])[j].syz!=NULL))
1558  p_Delete(&((syzstr->resPairs[i])[j].syz),sr);
1559  }
1560  if (syzstr->orderedRes[i]!=NULL)
1561  {
1562  for (j=0;j<IDELEMS(syzstr->orderedRes[i]);j++)
1563  {
1564  syzstr->orderedRes[i]->m[j] = NULL;
1565  }
1566  id_Delete(&(syzstr->orderedRes[i]),sr);
1567  }
1568  if (syzstr->truecomponents[i]!=NULL)
1569  {
1570  omFreeSize((ADDRESS)syzstr->truecomponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1571  syzstr->truecomponents[i]=NULL;
1572  omFreeSize((ADDRESS)syzstr->ShiftedComponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(long));
1573  syzstr->ShiftedComponents[i]=NULL;
1574  }
1575  if (syzstr->backcomponents[i]!=NULL)
1576  {
1577  omFreeSize((ADDRESS)syzstr->backcomponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1578  syzstr->backcomponents[i]=NULL;
1579  }
1580  if (syzstr->Howmuch[i]!=NULL)
1581  {
1582  omFreeSize((ADDRESS)syzstr->Howmuch[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1583  syzstr->Howmuch[i]=NULL;
1584  }
1585  if (syzstr->Firstelem[i]!=NULL)
1586  {
1587  omFreeSize((ADDRESS)syzstr->Firstelem[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1588  syzstr->Firstelem[i]=NULL;
1589  }
1590  if (syzstr->elemLength[i]!=NULL)
1591  {
1592  omFreeSize((ADDRESS)syzstr->elemLength[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1593  syzstr->elemLength[i]=NULL;
1594  }
1595  if (syzstr->res[i]!=NULL)
1596  {
1597  for (j=0;j<IDELEMS(syzstr->res[i]);j++)
1598  {
1599  if (syzstr->res[i]->m[j]!=NULL)
1600  p_Delete(&(syzstr->res[i]->m[j]),sr);
1601  }
1602  }
1603  if ((syzstr->hilb_coeffs!=NULL)
1604  && (syzstr->hilb_coeffs[i]!=NULL))
1605  delete syzstr->hilb_coeffs[i];
1606  if (syzstr->sev[i] != NULL)
1607  omFreeSize((ADDRESS)syzstr->sev[i], (IDELEMS(syzstr->res[i])+1)*sizeof(unsigned long));
1608  id_Delete(&(syzstr->res[i]),sr);
1609  if (syzstr->resPairs[i] != NULL) // OB: ????
1610  omFreeSize((ADDRESS)syzstr->resPairs[i],(*syzstr->Tl)[i]*sizeof(SObject));
1611  }
1612  omFreeSize((ADDRESS)syzstr->resPairs,syzstr->length*sizeof(SObject*));
1613  omFreeSize((ADDRESS)syzstr->res,(syzstr->length+1)*sizeof(ideal));
1614  omFreeSize((ADDRESS)syzstr->orderedRes,(syzstr->length+1)*sizeof(ideal));
1615  omFreeSize((ADDRESS)syzstr->elemLength,(syzstr->length+1)*sizeof(int*));
1616  omFreeSize((ADDRESS)syzstr->truecomponents,(syzstr->length+1)*sizeof(int*));
1617  omFreeSize((ADDRESS)syzstr->ShiftedComponents,(syzstr->length+1)*sizeof(long*));
1618  if (syzstr->sev != NULL)
1619  omFreeSize(((ADDRESS)syzstr->sev), (syzstr->length+1)*sizeof(unsigned long*));
1620  omFreeSize((ADDRESS)syzstr->backcomponents,(syzstr->length+1)*sizeof(int*));
1621  omFreeSize((ADDRESS)syzstr->Howmuch,(syzstr->length+1)*sizeof(int*));
1622  omFreeSize((ADDRESS)syzstr->Firstelem,(syzstr->length+1)*sizeof(int*));
1623  if (syzstr->hilb_coeffs!=NULL)
1624  omFreeSize((ADDRESS)syzstr->hilb_coeffs,(syzstr->length+1)*sizeof(intvec*));
1625  }
1626  if (syzstr->cw!=NULL)
1627  delete syzstr->cw;
1628  if (syzstr->betti!=NULL)
1629  delete syzstr->betti;
1630  if (syzstr->resolution!=NULL)
1631  delete syzstr->resolution;
1632  if (syzstr->Tl!=NULL)
1633  delete syzstr->Tl;
1634  if ((syzstr->syRing != NULL) && (syzstr->syRing != r))
1635  {
1636  if(syzstr->syRing->typ[1].ord_typ == ro_syzcomp)
1637  rChangeSComps(NULL, NULL, 0, syzstr->syRing);
1638 
1639  rDelete(syzstr->syRing);
1640  }
1641  omFreeSize((ADDRESS)syzstr, sizeof(ssyStrategy));
1642  }
1643 }
int length
Definition: syz.h:60
intvec ** weights
Definition: syz.h:45
short references
Definition: syz.h:63
intvec * betti
Definition: syz.h:53
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
resolvente res
Definition: syz.h:47
void * ADDRESS
Definition: auxiliary.h:115
intvec ** hilb_coeffs
Definition: syz.h:46
intvec * Tl
Definition: syz.h:50
const ring r
Definition: syzextra.cc:208
resolvente orderedRes
Definition: syz.h:48
Definition: intvec.h:14
int j
Definition: myNF.cc:70
int ** backcomponents
Definition: syz.h:41
int i
Definition: cfEzgcd.cc:123
int ** Howmuch
Definition: syz.h:42
#define IDELEMS(i)
Definition: simpleideals.h:24
resolvente fullres
Definition: syz.h:57
int ** Firstelem
Definition: syz.h:43
resolvente minres
Definition: syz.h:58
int ** elemLength
Definition: syz.h:44
intvec * cw
Definition: syz.h:52
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
int ** truecomponents
Definition: syz.h:39
long ** ShiftedComponents
Definition: syz.h:40
#define NULL
Definition: omList.c:10
ring syRing
Definition: syz.h:56
SRes resPairs
Definition: syz.h:49
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
unsigned long ** sev
Definition: syz.h:59
void rChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
Definition: ring.cc:4333
intvec * resolution
Definition: syz.h:51

◆ syKillEmptyEntres()

void syKillEmptyEntres ( resolvente  res,
int  length 
)

Definition at line 2208 of file syz1.cc.

2209 {
2210  int i,j,jj,k,rj;
2211  intvec * changes;
2212  poly p;
2213  ideal ri;
2214 
2215  for (i=0;i<length;i++)
2216  {
2217  ri = res[i];
2218  if (ri!=NULL)
2219  {
2220  rj = IDELEMS(ri);
2221  changes = new intvec(rj+1,1,-1);
2222  while ((rj>0) && (ri->m[rj-1]==NULL)) rj--;
2223  j = k = 0;
2224  while (j+k<rj)
2225  {
2226  if (ri->m[j+k]!=NULL)
2227  {
2228  ri->m[j] = ri->m[j+k];
2229  (*changes)[j+k+1] = j+1;
2230  j++;
2231  }
2232  else
2233  {
2234  k++;
2235  }
2236  }
2237  for (jj=j;jj<rj;jj++)
2238  ri->m[jj] = NULL;
2239  if (res[i+1]!=NULL)
2240  {
2241  ri = res[i+1];
2242  for (j=IDELEMS(ri)-1;j>=0;j--)
2243  {
2244  p = ri->m[j];
2245  while (p!=NULL)
2246  {
2247  pSetComp(p,(*changes)[pGetComp(p)]);
2248  pSetm(p);
2249  pIter(p);
2250  }
2251  }
2252  }
2253  delete changes;
2254  }
2255  }
2256 }
#define pSetm(p)
Definition: polys.h:253
if(0 > strat->sl)
Definition: myNF.cc:73
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
Definition: intvec.h:14
int j
Definition: myNF.cc:70
#define pSetComp(p, v)
Definition: polys.h:38
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10

◆ syKosz()

syStrategy syKosz ( ideal  arg,
int *  length 
)

Definition at line 1764 of file syz3.cc.

1765 {
1766  int i,j,jj,k=0,index=0,rk_arg/*,next_syz=0*/;
1767  int crit_comp,t_comp,next_deg,old_tl;
1768  ideal temp=NULL,old_ideal,old_repr;
1769  ring origR = currRing;
1770  poly next_gen;
1771  BOOLEAN isRegular;
1772 
1773  discard_pairs = 0;
1774  short_pairs = 0;
1775  if (idIs0(arg)) return NULL;
1776  rk_arg = id_RankFreeModule(arg,currRing);
1777  syStrategy syzstr=(syStrategy)omAlloc0(sizeof(ssyStrategy));
1778 /*--- changes to a Cdp-ring ----------------------------*/
1779  syzstr->syRing = rAssure_C_dp(origR); rChangeCurrRing(syzstr->syRing);
1780 /*--- initializes the data structures---------------*/
1781  syzstr->length = *length = (syzstr->syRing->N)+2;
1782  syzstr->regularity = -1;
1783  if (origR!=syzstr->syRing)
1784  temp = idrCopyR(arg, origR, syzstr->syRing);
1785  else
1786  temp = idCopy(arg);
1787  if (rk_arg==0)
1788  {
1789  id_Shift(temp,1,currRing);
1790  }
1791  idSkipZeroes(temp);
1792 #ifdef WITH_SORT
1793  if (temp->m[0]!=NULL)
1794  {
1795  int md;
1796  int maxdeg=p_FDeg(temp->m[IDELEMS(temp)-1],currRing);
1797  ideal temp1=idInit(IDELEMS(temp),temp->rank);
1798  for (j=IDELEMS(temp)-2;j>=0;j--)
1799  {
1800  jj = p_FDeg(temp->m[j],currRing);
1801  if (jj>maxdeg) maxdeg = jj;
1802  }
1803  while (!idIs0(temp))
1804  {
1805  md = maxdeg;
1806  for (j=IDELEMS(temp)-1;j>=0;j--)
1807  {
1808  if (temp->m[j]!=NULL)
1809  {
1810  jj = p_FDeg(temp->m[j],currRing);
1811  if (jj<md) md = jj;
1812  }
1813  }
1814  for (j=0;j<IDELEMS(temp);j++)
1815  {
1816  if ((temp->m[j]!=NULL) && (p_FDeg(temp->m[j],currRing)==md))
1817  {
1818  temp1->m[k] = temp->m[j];
1819  temp->m[j] = NULL;
1820  k++;
1821  }
1822  }
1823  }
1824  idDelete(&temp);
1825  temp = temp1;
1826  temp1 = NULL;
1827  }
1828 #endif
1829 #ifdef USE_REGULARITY
1830  int last_generator=IDELEMS(temp)-1;
1831  while ((last_generator>=0) && (temp->m[last_generator]==NULL))
1832  last_generator--;
1833 #endif
1834  syzstr->res = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
1835  syzstr->orderedRes = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
1836  resolvente totake=(resolvente)omAlloc0((*length+1)*sizeof(ideal));
1837  syzstr->Tl = new intvec(*length+1);
1838  syzstr->bucket = kBucketCreate(currRing);
1839  syzstr->syz_bucket = kBucketCreate(currRing);
1840  ideal new_generators=idInit(1,si_max(rk_arg,1));
1841  ideal temp_gens,old_std;
1842  syzstr->res[0] = idInit(1,1);
1843  if (rk_arg>1) syzstr->res[0]->rank = rk_arg;
1844  syzstr->orderedRes[0] = idInit(1,1);
1845 /*--- computes the resolution ----------------------*/
1846  i = 0;
1847  while (i<IDELEMS(temp))
1848  {
1849  if (temp->m[i]!=NULL)
1850  {
1851  new_generators->m[0] = kNF(syzstr->res[0],currRing->qideal,temp->m[i]);
1852  if (!nIsOne(pGetCoeff(new_generators->m[0])))
1853  pNorm(new_generators->m[0]);
1854  next_deg = p_FDeg(new_generators->m[0],currRing);
1855  next_gen = pCopy(new_generators->m[0]);
1856  }
1857  if (!idIs0(new_generators))
1858  {
1859  index = 0;
1860  while (index<=*length)
1861  {
1862  if (index==0)
1863  {
1864  old_ideal = idCopy(syzstr->res[0]);
1865  old_repr = idCopy(syzstr->orderedRes[0]);
1866  old_tl = (*syzstr->Tl)[0];
1867  old_std = id_Head(syzstr->res[0],currRing);
1868  }
1869  t_comp = (*syzstr->Tl)[index];
1870  if (index==0) crit_comp = t_comp;
1871  temp_gens = syAppendSyz(new_generators,syzstr, index,crit_comp,totake);
1872  crit_comp = t_comp;
1873  if (index==0)
1874  {
1875  isRegular = syIsRegular(old_std,syzstr->res[0],next_deg);
1876 #ifndef ONLY_STD
1877  if (isRegular)
1878  syCreateRegularExtension(syzstr,old_ideal,old_repr,old_tl,next_gen,
1879  totake);
1880 #ifdef USE_REGULARITY
1881  if ((index==0) && (!isRegular) && (i==last_generator))
1882  {
1883 /*----------- we are computing the regularity -----------------------*/
1884  ideal initial=id_Head(syzstr->res[0],currRing);
1885  int len=0,reg=0;
1886  intvec *w=NULL;
1887  ring dp_C_ring = rAssure_dp_C(currRing); rChangeCurrRing(dp_C_ring);
1888  initial = idrMoveR_NoSort(initial, syzstr->syRing, dp_C_ring);
1889  resolvente res = sySchreyerResolvente(initial,-1,&len,TRUE, TRUE);
1890  intvec * dummy = syBetti(res,len,&reg, w);
1891  syzstr->regularity = reg+2;
1892  delete dummy;
1893  delete w;
1894  for (j=0;j<len;j++)
1895  {
1896  if (res[j]!=NULL) idDelete(&(res[j]));
1897  }
1898  omFreeSize((ADDRESS)res,len*sizeof(ideal));
1899  idDelete(&initial);
1900  rChangeCurrRing(syzstr->syRing);
1901  rDelete(dp_C_ring);
1902  }
1903 #endif
1904 #endif
1905  idDelete(&old_ideal);
1906  idDelete(&old_repr);
1907  idDelete(&old_std);
1908  if (TEST_OPT_PROT)
1909  {
1910  if (isRegular)
1911  PrintS("\n regular\n");
1912  else
1913  PrintS("\n not regular\n");
1914  }
1915  if (next_gen!=NULL)
1916  pDelete(&next_gen);
1917  if (isRegular)
1918  {
1919  idDelete(&temp_gens);
1920  break;
1921  }
1922  }
1923  idDelete(&new_generators);
1924  new_generators = temp_gens;
1925 #ifdef ONLY_STD
1926  break;
1927 #endif
1928  if (idIs0(new_generators)) break;
1929  index++;
1930  }
1931  if (!idIs0(new_generators))
1932  {
1933  for (j=0;j<IDELEMS(new_generators);j++)
1934  {
1935  if (new_generators->m[j]!=NULL)
1936  {
1937  pDelete(&new_generators->m[j]);
1938  new_generators->m[j] = NULL;
1939  }
1940  }
1941  }
1942  }
1943  i++;
1944  }
1945  if (idIs0(new_generators) && new_generators!=NULL) idDelete(&new_generators);
1946  if (temp!=NULL) idDelete(&temp);
1947  kBucketDestroy(&(syzstr->bucket));
1948  kBucketDestroy(&(syzstr->syz_bucket));
1949  index = 0;
1950  syzstr->fullres = syzstr->res;
1951  syzstr->res = NULL;
1952  index = 0;
1953  while ((index<=*length) && (syzstr->fullres[index]!=NULL))
1954  {
1955 #ifdef SHOW_RESULT
1956  Print("The %d-th syzygy-module is now:\n",index);
1957  ideal ttt=id_Head(syzstr->fullres[index],currRing);
1958  idShow(ttt);
1959  idDelete(&ttt);
1960  //if (index>0)
1961  //{
1962  //Print("The related module is: \n");
1963  //idPrint(totake[index-1]);
1964  //}
1965  //Print("The %d-th module of the minimal resolution is:\n",index);
1966  if (!idIs0(totake[index]))
1967  idShow(totake[index]);
1968  //Print("with standard basis:\n");
1969  //idPrint(syzstr->fullres[index]);
1970  //if ((index<*length) && (totake[index+1]!=NULL))
1971  //{
1972  //Print("The %d-th syzygy-module is now:\n",index+1);
1973  //idPrint(totake[index+1]);
1974  //matrix m1=idModule2Matrix(totake[index]);
1975  //matrix m2=idModule2Matrix(totake[index+1]);
1976  //matrix m3=mpMult(m1,m2);
1977  //idPrint((ideal)m3);
1978  //}
1979 #endif
1980  if (!idIs0(totake[index]))
1981  {
1982  for(i=0;i<IDELEMS(totake[index]);i++)
1983  {
1984  if (totake[index]->m[i]!=NULL)
1985  {
1986  j=0;
1987  while ((j<IDELEMS(syzstr->fullres[index])) &&
1988  ((syzstr->fullres[index]->m[j]==NULL) ||
1989  (!pLmEqual(syzstr->fullres[index]->m[j],totake[index]->m[i])))) j++;
1990  if (j<IDELEMS(syzstr->fullres[index]))
1991  {
1992  pDelete(&totake[index]->m[i]);
1993  totake[index]->m[i] = syzstr->fullres[index]->m[j];
1994  syzstr->fullres[index]->m[j] = NULL;
1995  }
1996  else
1997  {
1998  PrintS("Da ist was faul!!!\n");
1999  Print("Aber: Regularitaet %d, Grad %ld\n",
2000  syzstr->regularity,p_FDeg(totake[index]->m[i],currRing));
2001  }
2002  }
2003  }
2004  idDelete(&syzstr->fullres[index]);
2005  syzstr->fullres[index] = totake[index];
2006  }
2007 #ifdef SHOW_RESULT
2008  idShow(syzstr->fullres[index]);
2009 #endif
2010  index++;
2011  }
2012  syReorder_Kosz(syzstr);
2013  index = 0;
2014  while ((index<=*length) && (syzstr->orderedRes[index]!=NULL))
2015  {
2016  idDelete(&(syzstr->orderedRes[index]));
2017  index++;
2018  }
2019  if (origR!=syzstr->syRing)
2020  {
2021  rChangeCurrRing(origR);
2022  index = 0;
2023  while ((index<=*length) && (syzstr->fullres[index]!=NULL))
2024  {
2025  syzstr->fullres[index] = idrMoveR(syzstr->fullres[index],syzstr->syRing, origR);
2026  index++;
2027  }
2028  }
2029  delete syzstr->Tl;
2030  syzstr->Tl = NULL;
2031  rDelete(syzstr->syRing);
2032  syzstr->syRing = NULL;
2033  omFreeSize((ADDRESS)totake,(*length+1)*sizeof(ideal));
2034  omFreeSize((ADDRESS)syzstr->orderedRes,(*length+1)*sizeof(ideal));
2035 //Print("Pairs to discard: %d\n",discard_pairs);
2036 //Print("Pairs shorter reduced: %d\n",short_pairs);
2037 //discard_pairs = 0;
2038 //short_pairs = 0;
2039  return syzstr;
2040 }
int length
Definition: syz.h:60
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
#define Print
Definition: emacs.cc:83
static ideal syAppendSyz(ideal new_generators, syStrategy syzstr, int index, int crit_comp, resolvente totake)
Definition: syz3.cc:1688
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
kBucket_pt bucket
Definition: syz.h:54
#define TEST_OPT_PROT
Definition: options.h:98
void syReorder_Kosz(syStrategy syzstr)
Definition: syz3.cc:262
static void syCreateRegularExtension(syStrategy syzstr, ideal old_ideal, ideal old_repr, int old_tl, poly next_generator, resolvente totake)
Definition: syz3.cc:112
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
resolvente res
Definition: syz.h:47
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
void * ADDRESS
Definition: auxiliary.h:115
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint)
Definition: simpleideals.cc:60
int regularity
Definition: syz.h:61
intvec * Tl
Definition: syz.h:50
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:10
poly initial(const poly p, const ring r, const gfan::ZVector &w)
Returns the initial form of p with respect to w.
Definition: initial.cc:32
void id_Shift(ideal M, int s, const ring r)
resolvente orderedRes
Definition: syz.h:48
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:200
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
ring rAssure_dp_C(const ring r)
Definition: ring.cc:4883
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:375
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
kBucket_pt syz_bucket
Definition: syz.h:55
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition: syz0.cc:861
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
resolvente fullres
Definition: syz.h:57
ideal idCopy(ideal A)
Definition: ideals.h:60
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
void rChangeCurrRing(ring r)
Definition: polys.cc:12
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
int discard_pairs
Definition: syz3.cc:49
#define NULL
Definition: omList.c:10
static BOOLEAN syIsRegular(ideal old_ideal, ideal new_ideal, int deg)
Definition: syz3.cc:56
ring syRing
Definition: syz.h:56
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
ring rAssure_C_dp(const ring r)
Definition: ring.cc:4888
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pDelete(p_ptr)
Definition: polys.h:169
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:193
int short_pairs
Definition: syz3.cc:50
ideal * resolvente
Definition: ideals.h:18
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:791
polyrec * poly
Definition: hilb.h:10
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:193
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define pLmEqual(p1, p2)
Definition: polys.h:111
#define omAlloc0(size)
Definition: omAllocDecl.h:211
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
ssyStrategy * syStrategy
Definition: syz.h:35

◆ syLaScala()

syStrategy syLaScala ( ideal  arg,
int &  maxlength,
intvec weights = NULL 
)

Definition at line 2562 of file syz1.cc.

2563 {
2564  int i,j,actdeg=32000,index=0;
2565  int howmuch;
2566  ideal temp;
2567  SSet nextPairs;
2568  syStrategy syzstr=(syStrategy)omAlloc0(sizeof(ssyStrategy));
2569  ring origR = currRing;
2570 
2571  if(weights!= NULL)
2572  syzstr->cw = new intvec(weights);
2573  else
2574  syzstr->cw = NULL;
2575 
2576  if ((idIs0(arg)) ||
2577  ((id_RankFreeModule(arg,currRing)>0) && (!idTestHomModule(arg, NULL, syzstr->cw))))
2578  {
2580  syzstr->length = 1;
2581  syzstr->minres[0] = idInit(1,arg->rank);
2582  return syzstr;
2583  }
2584 
2585 
2586  //crit = 0;
2587  //euler = -1;
2588  redpol = pInit();
2589 
2590  if( maxlength > 0 )
2591  syzstr->length = maxlength; // = (currRing->N)+2;
2592  else
2593  syzstr->length = maxlength = (currRing->N)+2;
2594 
2595  // Creare dp,S ring and change to it
2596  syzstr->syRing = rAssure_dp_S(origR);
2597  assume(syzstr->syRing != origR);
2598  assume(syzstr->syRing->typ[1].ord_typ == ro_syzcomp);
2599  rChangeCurrRing(syzstr->syRing);
2600 
2601  // set initial ShiftedComps
2602  currcomponents = (int*)omAlloc0((arg->rank+1)*sizeof(int));
2603  currShiftedComponents = (long*)omAlloc0((arg->rank+1)*sizeof(long));
2604  for (i=0;i<=arg->rank;i++)
2605  {
2607  currcomponents[i] = i;
2608  }
2610 /*--- initializes the data structures---------------*/
2611  syzstr->Tl = new intvec(maxlength);
2612  temp = idInit(IDELEMS(arg),arg->rank);
2613  for (i=0;i<IDELEMS(arg);i++)
2614  {
2615  temp->m[i] = prCopyR( arg->m[i], origR, currRing);
2616  if (temp->m[i]!=NULL)
2617  {
2618  j = pTotaldegree(temp->m[i]);
2619  if (j<actdeg) actdeg = j;
2620  }
2621  }
2622  idTest(temp);
2623  idSkipZeroes(temp);
2624  idTest(temp);
2625  syzstr->resPairs = syInitRes(temp,&maxlength,syzstr->Tl,syzstr->cw);
2626  omFreeSize((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int));
2627  omFreeSize((ADDRESS)currShiftedComponents,(arg->rank+1)*sizeof(long));
2628 
2629  syzstr->res = (resolvente)omAlloc0((maxlength+1)*sizeof(ideal));
2630  syzstr->orderedRes = (resolvente)omAlloc0((maxlength+1)*sizeof(ideal));
2631  syzstr->elemLength = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2632 
2633  syzstr->truecomponents = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2634  syzstr->ShiftedComponents = (long**)omAlloc0((maxlength+1)*sizeof(long*));
2635 
2636  syzstr->backcomponents = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2637  syzstr->Howmuch = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2638  syzstr->Firstelem = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2639  syzstr->sev = (unsigned long **) omAlloc0((maxlength+1)*sizeof(unsigned long *));
2640 
2641  assume( syzstr->length == maxlength );
2642 
2643  syzstr->bucket = kBucketCreate(currRing);
2644  int len0=id_RankFreeModule(temp,currRing)+1;
2645 
2646  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
2647  //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
2648 /*--- computes the resolution ----------------------*/
2649  while (nextPairs!=NULL)
2650  {
2651  if (TEST_OPT_PROT) Print("%d",actdeg);
2652  if (TEST_OPT_PROT) Print("(m%d)",index);
2653  if (index==0)
2654  i = syInitSyzMod(syzstr,index,len0);
2655  else
2656  i = syInitSyzMod(syzstr,index);
2657  currcomponents = syzstr->truecomponents[si_max(index-1,0)];
2658  currShiftedComponents = syzstr->ShiftedComponents[si_max(index-1,0)];
2659  rChangeSComps(currcomponents, currShiftedComponents,
2660  IDELEMS(syzstr->res[si_max(index-1,0)]), currRing);
2661  j = syInitSyzMod(syzstr,index+1);
2662  if (index>0)
2663  {
2664  syRedNextPairs(nextPairs,syzstr,howmuch,index);
2665  syCompactifyPairSet(syzstr->resPairs[index],(*syzstr->Tl)[index],0);
2666  }
2667  else
2668  syRedGenerOfCurrDeg(syzstr,actdeg,index+1);
2669 /*--- creates new pairs -----------------------------*/
2670  syCreateNewPairs(syzstr,index,i);
2671  if (index<(maxlength-1))
2672  {
2673  syCreateNewPairs(syzstr,index+1,j);
2674  }
2675  index++;
2676  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
2677  //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
2678  }
2679  if (temp!=NULL) idDelete(&temp);
2680  kBucketDestroy(&(syzstr->bucket));
2681  if (origR != syzstr->syRing)
2682  rChangeCurrRing(origR);
2683  pLmDelete(&redpol);
2684  if (TEST_OPT_PROT) PrintLn();
2685  return syzstr;
2686 }
int length
Definition: syz.h:60
static void syCreateNewPairs(syStrategy syzstr, int index, int newEl)
Definition: syz1.cc:1077
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
kBucket_pt bucket
Definition: syz.h:54
#define TEST_OPT_PROT
Definition: options.h:98
int * currcomponents
Definition: syz1.cc:39
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:1884
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static void syRedNextPairs(SSet nextPairs, syStrategy syzstr, int howmuch, int index)
Definition: syz1.cc:776
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
resolvente res
Definition: syz.h:47
void * ADDRESS
Definition: auxiliary.h:115
omBin char_ptr_bin
Definition: ring.cc:55
void syCompactifyPairSet(SSet sPairs, int sPlength, int first)
Definition: syz1.cc:112
intvec * Tl
Definition: syz.h:50
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
resolvente orderedRes
Definition: syz.h:48
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:200
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 pTotaldegree(poly p)
Definition: polys.h:264
#define assume(x)
Definition: mod2.h:394
#define SYZ_SHIFT_BASE
Definition: syz.h:18
int syInitSyzMod(syStrategy syzstr, int index, int init)
Definition: syz1.cc:1467
int ** backcomponents
Definition: syz.h:41
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
int ** Howmuch
Definition: syz.h:42
SSet syChosePairs(syStrategy syzstr, int *index, int *howmuch, int *actdeg)
Definition: syz1.cc:1296
#define IDELEMS(i)
Definition: simpleideals.h:24
static void syRedGenerOfCurrDeg(syStrategy syzstr, int deg, int index)
Definition: syz1.cc:923
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
int ** Firstelem
Definition: syz.h:43
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
void rChangeCurrRing(ring r)
Definition: polys.cc:12
resolvente minres
Definition: syz.h:58
int ** elemLength
Definition: syz.h:44
intvec * cw
Definition: syz.h:52
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
int ** truecomponents
Definition: syz.h:39
long ** ShiftedComponents
Definition: syz.h:40
#define NULL
Definition: omList.c:10
ring rAssure_dp_S(const ring r)
Definition: ring.cc:4878
ring syRing
Definition: syz.h:56
SRes resPairs
Definition: syz.h:49
unsigned long ** sev
Definition: syz.h:59
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
long * currShiftedComponents
Definition: syz1.cc:40
SObject * SSet
Definition: syz.h:32
SRes syInitRes(ideal arg, int *length, intvec *Tl, intvec *cw)
Definition: syz1.cc:301
ideal * resolvente
Definition: ideals.h:18
static poly redpol
Definition: syz1.cc:44
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:193
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void rChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
Definition: ring.cc:4333
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define idTest(id)
Definition: ideals.h:47
ssyStrategy * syStrategy
Definition: syz.h:35

◆ syLaScala1()

resolvente syLaScala1 ( ideal  arg,
int *  length 
)

◆ syLaScala3()

syStrategy syLaScala3 ( ideal  arg,
int *  length 
)

Definition at line 2434 of file syz1.cc.

2435 {
2436  int i,j,actdeg=32000,index=0;
2437  int howmuch;
2438  ideal temp;
2439  SSet nextPairs;
2440  syStrategy syzstr=(syStrategy)omAlloc0(sizeof(ssyStrategy));
2441  ring origR = currRing;
2442 
2443  if ((idIs0(arg)) ||
2444  ((id_RankFreeModule(arg,currRing)>0) && (!idHomModule(arg,NULL,&(syzstr->cw)))))
2445  {
2447  syzstr->length = 1;
2448  syzstr->minres[0] = idInit(1,arg->rank);
2449  return syzstr;
2450  }
2451 
2452  //crit = 0;
2453  //euler = -1;
2454  redpol = pInit();
2455  syzstr->length = *length = (currRing->N)+2;
2456 
2457  // Creare dp,S ring and change to it
2458  syzstr->syRing = rAssure_dp_S(origR);
2459  assume(syzstr->syRing != origR); // why?
2460  rChangeCurrRing(syzstr->syRing);
2461 
2462  // set initial ShiftedComps
2463  currcomponents = (int*)omAlloc0((arg->rank+1)*sizeof(int));
2464  currShiftedComponents = (long*)omAlloc0((arg->rank+1)*sizeof(long));
2465  for (i=0;i<=arg->rank;i++)
2466  {
2468  currcomponents[i] = i;
2469  }
2471 /*--- initializes the data structures---------------*/
2472  syzstr->Tl = new intvec(*length);
2473  temp = idInit(IDELEMS(arg),arg->rank);
2474  for (i=0;i<IDELEMS(arg);i++)
2475  {
2476  temp->m[i] = prCopyR( arg->m[i], origR, syzstr->syRing);
2477  if (temp->m[i]!=NULL)
2478  {
2479  j = pTotaldegree(temp->m[i]);
2480  if (j<actdeg) actdeg = j;
2481  }
2482  }
2483  idTest(temp);
2484  idSkipZeroes(temp);
2485  idTest(temp);
2486  syzstr->resPairs = syInitRes(temp,length,syzstr->Tl,syzstr->cw);
2487  omFreeSize((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int));
2488  omFreeSize((ADDRESS)currShiftedComponents,(arg->rank+1)*sizeof(long));
2489  syzstr->res = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
2490  syzstr->orderedRes = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
2491  syzstr->elemLength = (int**)omAlloc0((*length+1)*sizeof(int*));
2492  syzstr->truecomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
2493  syzstr->ShiftedComponents = (long**)omAlloc0((*length+1)*sizeof(long*));
2494  syzstr->backcomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
2495  syzstr->Howmuch = (int**)omAlloc0((*length+1)*sizeof(int*));
2496  syzstr->Firstelem = (int**)omAlloc0((*length+1)*sizeof(int*));
2497  syzstr->sev = (unsigned long **) omAlloc0((*length+1)*sizeof(unsigned long *));
2498  syzstr->bucket = kBucketCreate(currRing);
2499  int len0=id_RankFreeModule(temp,currRing)+1;
2500 
2501  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
2502  //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
2503 /*--- computes the resolution ----------------------*/
2504  while (nextPairs!=NULL)
2505  {
2506  if (TEST_OPT_PROT) Print("%d",actdeg);
2507  if (TEST_OPT_PROT) Print("(m%d)",index);
2508  if (index==0)
2509  i = syInitSyzMod(syzstr,index,len0);
2510  else
2511  i = syInitSyzMod(syzstr,index);
2512  currcomponents = syzstr->truecomponents[si_max(index-1,0)];
2513  currShiftedComponents = syzstr->ShiftedComponents[si_max(index-1,0)];
2514  rChangeSComps(currcomponents, currShiftedComponents,
2515  IDELEMS(syzstr->res[si_max(index-1,0)]), currRing);
2516  j = syInitSyzMod(syzstr,index+1);
2517  if (index>0)
2518  {
2519  syRedNextPairs(nextPairs,syzstr,howmuch,index);
2520  syCompactifyPairSet(syzstr->resPairs[index],(*syzstr->Tl)[index],0);
2521  }
2522  else
2523  syRedGenerOfCurrDeg(syzstr,actdeg,index+1);
2524 /*--- creates new pairs -----------------------------*/
2525  syCreateNewPairs(syzstr,index,i);
2526  if (index<(*length)-1)
2527  {
2528  syCreateNewPairs(syzstr,index+1,j);
2529  }
2530  index++;
2531  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
2532  //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
2533  }
2534  if (temp!=NULL) idDelete(&temp);
2535  kBucketDestroy(&(syzstr->bucket));
2536 
2537  if (origR != syzstr->syRing)
2538  rChangeCurrRing(origR);
2539  pLmDelete(&redpol);
2540 
2541  if (TEST_OPT_PROT) PrintLn();
2542 
2543  assume(syzstr->minres==NULL); assume(syzstr->fullres ==NULL);
2544  assume(syzstr->resPairs!=NULL); assume(syzstr->hilb_coeffs==NULL);
2545  assume(syzstr->res!=NULL);
2546 
2547  if(! TEST_OPT_NO_SYZ_MINIM )
2548  syzstr->minres = syReadOutMinimalRes(syzstr);
2549  else
2550  syzstr->fullres = syReorder(syzstr->res, syzstr->length, syzstr); // buggy? (betti...?)
2551 
2552  return syzstr;
2553 }
int length
Definition: syz.h:60
static void syCreateNewPairs(syStrategy syzstr, int index, int newEl)
Definition: syz1.cc:1077
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
kBucket_pt bucket
Definition: syz.h:54
#define TEST_OPT_PROT
Definition: options.h:98
int * currcomponents
Definition: syz1.cc:39
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static void syRedNextPairs(SSet nextPairs, syStrategy syzstr, int howmuch, int index)
Definition: syz1.cc:776
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy, resolvente totake)
Definition: syz1.cc:1649
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
resolvente res
Definition: syz.h:47
void * ADDRESS
Definition: auxiliary.h:115
static resolvente syReadOutMinimalRes(syStrategy syzstr, BOOLEAN computeStd=FALSE)
Definition: syz1.cc:2321
omBin char_ptr_bin
Definition: ring.cc:55
intvec ** hilb_coeffs
Definition: syz.h:46
void syCompactifyPairSet(SSet sPairs, int sPlength, int first)
Definition: syz1.cc:112
intvec * Tl
Definition: syz.h:50
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
resolvente orderedRes
Definition: syz.h:48
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:200
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
int j
Definition: myNF.cc:70
static long pTotaldegree(poly p)
Definition: polys.h:264
#define assume(x)
Definition: mod2.h:394
#define SYZ_SHIFT_BASE
Definition: syz.h:18
int syInitSyzMod(syStrategy syzstr, int index, int init)
Definition: syz1.cc:1467
int ** backcomponents
Definition: syz.h:41
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
int ** Howmuch
Definition: syz.h:42
SSet syChosePairs(syStrategy syzstr, int *index, int *howmuch, int *actdeg)
Definition: syz1.cc:1296
#define IDELEMS(i)
Definition: simpleideals.h:24
static void syRedGenerOfCurrDeg(syStrategy syzstr, int deg, int index)
Definition: syz1.cc:923
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
resolvente fullres
Definition: syz.h:57
int ** Firstelem
Definition: syz.h:43
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
void rChangeCurrRing(ring r)
Definition: polys.cc:12
resolvente minres
Definition: syz.h:58
int ** elemLength
Definition: syz.h:44
intvec * cw
Definition: syz.h:52
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
int ** truecomponents
Definition: syz.h:39
long ** ShiftedComponents
Definition: syz.h:40
#define NULL
Definition: omList.c:10
ring rAssure_dp_S(const ring r)
Definition: ring.cc:4878
ring syRing
Definition: syz.h:56
SRes resPairs
Definition: syz.h:49
unsigned long ** sev
Definition: syz.h:59
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
long * currShiftedComponents
Definition: syz1.cc:40
SObject * SSet
Definition: syz.h:32
SRes syInitRes(ideal arg, int *length, intvec *Tl, intvec *cw)
Definition: syz1.cc:301
ideal * resolvente
Definition: ideals.h:18
static poly redpol
Definition: syz1.cc:44
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:193
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void rChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
Definition: ring.cc:4333
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define idTest(id)
Definition: ideals.h:47
ssyStrategy * syStrategy
Definition: syz.h:35

◆ syMinBase()

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:98
void * ADDRESS
Definition: auxiliary.h:115
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:18
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
return result
Definition: facAbsBiFact.cc:76

◆ syMinimize()

syStrategy syMinimize ( syStrategy  syzstr)

Definition at line 2402 of file syz1.cc.

2403 {
2404  if (syzstr->minres==NULL)
2405  {
2406  if (syzstr->resPairs!=NULL)
2407  {
2408  if (syzstr->hilb_coeffs==NULL)
2409  {
2410  // La Scala Resolution
2411  syzstr->minres = syReadOutMinimalRes(syzstr);
2412  }
2413  else
2414  { // HRES
2415  syzstr->minres = syReorder(syzstr->orderedRes,syzstr->length,syzstr);
2416  }
2417  }
2418  else if (syzstr->fullres!=NULL)
2419  {
2420  syMinimizeResolvente(syzstr->fullres,syzstr->length,1);
2421  syzstr->minres = syzstr->fullres;
2422  syzstr->fullres = NULL;
2423  }
2424  }
2425  (syzstr->references)++;
2426  return syzstr;
2427 }
int length
Definition: syz.h:60
void syMinimizeResolvente(resolvente res, int length, int first)
Definition: syz.cc:360
short references
Definition: syz.h:63
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy, resolvente totake)
Definition: syz1.cc:1649
static resolvente syReadOutMinimalRes(syStrategy syzstr, BOOLEAN computeStd=FALSE)
Definition: syz1.cc:2321
intvec ** hilb_coeffs
Definition: syz.h:46
resolvente orderedRes
Definition: syz.h:48
resolvente fullres
Definition: syz.h:57
resolvente minres
Definition: syz.h:58
#define NULL
Definition: omList.c:10
SRes resPairs
Definition: syz.h:49

◆ syMinimizeResolvente()

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:94
#define TRUE
Definition: auxiliary.h:98
static void syMinStep1(resolvente res, int length)
Definition: syz.cc:294
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition: ideals.cc:2349
poly res
Definition: myNF.cc:322
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
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

◆ syPrint()

void syPrint ( syStrategy  syzstr,
const char *  currRingName 
)

Definition at line 1942 of file syz1.cc.

1943 {
1944  if ( (syzstr->resPairs==NULL) &&
1945  (syzstr->fullres==NULL) &&
1946  (syzstr->minres==NULL) &&
1947  (syzstr->resolution == NULL) )
1948  {
1949  PrintS("No resolution defined\n");
1950  return;
1951  }
1952 
1953  intvec* resolution = syzstr->resolution;
1954 
1955  if (resolution==NULL)
1956  {
1957  if (syzstr->resPairs!=NULL)
1958  {
1959  resolution = new intvec(syzstr->length+1);
1960  SRes rP = syzstr->resPairs;
1961 // assume(idRankFreeModule(syzstr->res[1], (syzstr->syRing != NULL ? syzstr->syRing : currRing))==syzstr->res[1]->rank);
1962  (*resolution)[0] = syzstr->res[1]->rank;
1963  int k=0;
1964  while ((k<syzstr->length) && (rP[k]!=NULL))
1965  {
1966  int j = 0;
1967  while ((j<(*syzstr->Tl)[k]) &&
1968  ((rP[k][j].lcm!=NULL) || (rP[k][j].syz!=NULL)))
1969  {
1970  if (rP[k][j].isNotMinimal==NULL)
1971  ((*resolution)[k+1])++;
1972  j++;
1973  }
1974  k++;
1975  }
1976  }
1977  else
1978  {
1979  resolution = new intvec(syzstr->length+2);
1980  resolvente rr;
1981  if (syzstr->minres!=NULL)
1982  rr = syzstr->minres;
1983  else
1984  rr = syzstr->fullres;
1985  (*resolution)[0]
1986  = si_max(1,(int)id_RankFreeModule(rr[0],
1987  (syzstr->syRing != NULL ? syzstr->syRing : currRing)));
1988  int k=0;
1989  while ((k<syzstr->length) && (rr[k]!=NULL))
1990  {
1991  (*resolution)[k+1] = idElem(rr[k]);
1992  k++;
1993  }
1994  }
1995  }
1996 
1997  int sl=strlen(sn);
1998  syPrintEmptySpaces1(sl);
1999  int k = 0;
2000  loop
2001  {
2002  if ((k>=resolution->length()) || ((*resolution)[k]==0))
2003  break;
2004  Print("%d",(*resolution)[k]);
2005  syPrintEmptySpaces1(sl+5);
2006  k++;
2007  }
2008  PrintLn();
2009  k = 0;
2010  loop
2011  {
2012  if ((k>=resolution->length()) || ((*resolution)[k]==0))
2013  break;
2014  PrintS(sn);
2015  if (((k+1)>=resolution->length()) || ((*resolution)[(k+1)]==0))
2016  break;
2017  PrintS(" <-- ");
2018  syPrintEmptySpaces((*resolution)[k]);
2019  k++;
2020  }
2021  PrintLn();
2022  PrintLn();
2023  k = 0;
2024  loop
2025  {
2026  if ((k>=resolution->length()) || ((*resolution)[k]==0))
2027  break;
2028  Print("%d",k);
2029  syPrintEmptySpaces1(sl+5+syLengthInt((*resolution)[k])-
2030  syLengthInt(k));
2031  k++;
2032  }
2033  PrintLn();
2034  if (syzstr->minres==NULL)
2035  {
2036  PrintS("resolution not minimized yet\n");
2037  }
2038 
2039  if (syzstr->resolution == NULL) syzstr->resolution = resolution;
2040 }
int length
Definition: syz.h:60
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
resolvente res
Definition: syz.h:47
int k
Definition: cfEzgcd.cc:93
intvec * Tl
Definition: syz.h:50
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
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 int si_max(const int a, const int b)
Definition: auxiliary.h:120
void PrintS(const char *s)
Definition: reporter.cc:284
static void syPrintEmptySpaces(int i)
Definition: syz1.cc:1902
static int syLengthInt(int i)
Definition: syz1.cc:1926
static void syPrintEmptySpaces1(int i)
Definition: syz1.cc:1914
resolvente fullres
Definition: syz.h:57
resolvente minres
Definition: syz.h:58
#define NULL
Definition: omList.c:10
ring syRing
Definition: syz.h:56
SRes resPairs
Definition: syz.h:49
int length() const
Definition: intvec.h:86
SSet * SRes
Definition: syz.h:33
ideal * resolvente
Definition: ideals.h:18
int idElem(const ideal F)
count non-zero elements
intvec * resolution
Definition: syz.h:51

◆ syReorder()

resolvente syReorder ( resolvente  res,
int  length,
syStrategy  syzstr,
BOOLEAN  toCopy = TRUE,
resolvente  totake = NULL 
)

Definition at line 1649 of file syz1.cc.

1651 {
1652  int i,j,l;
1653  poly p,q,tq;
1654  polyset ri1;
1655  resolvente fullres;
1656  ring origR=syzstr->syRing;
1657  fullres = (resolvente)omAlloc0((length+1)*sizeof(ideal));
1658  if (totake==NULL)
1659  totake = res;
1660  for (i=length-1;i>0;i--)
1661  {
1662  if (res[i]!=NULL)
1663  {
1664  if (i>1)
1665  {
1666  j = IDELEMS(res[i-1]);
1667  while ((j>0) && (res[i-1]->m[j-1]==NULL)) j--;
1668  fullres[i-1] = idInit(IDELEMS(res[i]),j);
1669  ri1 = totake[i-1]->m;
1670  for (j=IDELEMS(res[i])-1;j>=0;j--)
1671  {
1672  p = res[i]->m[j];
1673  q = NULL;
1674  while (p!=NULL)
1675  {
1676  if (toCopy)
1677  {
1678  if (origR!=NULL)
1679  tq = prHeadR(p,origR, currRing);
1680  else
1681  tq = pHead(p);
1682  pIter(p);
1683  }
1684  else
1685  {
1686  res[i]->m[j] = NULL;
1687  if (origR!=NULL)
1688  {
1689  poly pp=p;
1690  pIter(p);
1691  pNext(pp)=NULL;
1692  tq = prMoveR(pp, origR, currRing);
1693  }
1694  else
1695  {
1696  tq = p;
1697  pIter(p);
1698  pNext(tq) = NULL;
1699  }
1700  }
1701 // pWrite(tq);
1702  pTest(tq);
1703  for (l=(currRing->N);l>0;l--)
1704  {
1705  if (origR!=NULL)
1706  pSubExp(tq,l, p_GetExp(ri1[pGetComp(tq)-1],l,origR));
1707  else
1708  pSubExp(tq,l, pGetExp(ri1[pGetComp(tq)-1],l));
1709  }
1710  pSetm(tq);
1711  pTest(tq);
1712  q = pAdd(q,tq);
1713  pTest(q);
1714  }
1715  fullres[i-1]->m[j] = q;
1716  }
1717  }
1718  else
1719  {
1720  if (origR!=NULL)
1721  {
1722  fullres[i-1] = idInit(IDELEMS(res[i]),res[i]->rank);
1723  for (j=IDELEMS(res[i])-1;j>=0;j--)
1724  {
1725  if (toCopy)
1726  fullres[i-1]->m[j] = prCopyR(res[i]->m[j], origR, currRing);
1727  else
1728  {
1729  fullres[i-1]->m[j] = prMoveR(res[i]->m[j], origR, currRing);
1730  res[i]->m[j] = NULL;
1731  }
1732  }
1733  }
1734  else
1735  {
1736  if (toCopy)
1737  fullres[i-1] = idCopy(res[i]);
1738  else
1739  {
1740  fullres[i-1] = res[i];
1741  res[i] = NULL;
1742  }
1743  }
1744  for (j=IDELEMS(fullres[i-1])-1;j>=0;j--)
1745  fullres[i-1]->m[j] = pSortCompCorrect(fullres[i-1]->m[j]);
1746  }
1747  if (!toCopy)
1748  {
1749  if (res[i]!=NULL) idDelete(&res[i]);
1750  }
1751  }
1752  }
1753  if (!toCopy)
1754  omFreeSize((ADDRESS)res,(length+1)*sizeof(ideal));
1755  //syzstr->length = length;
1756  return fullres;
1757 }
poly prHeadR(poly p, ring src_r, ring dest_r, prCopyProc_t prproc)
Definition: prCopy.cc:127
#define pSetm(p)
Definition: polys.h:253
#define pAdd(p, q)
Definition: polys.h:186
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
#define pTest(p)
Definition: polys.h:398
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define pSubExp(p, i, v)
Definition: polys.h:46
void * ADDRESS
Definition: auxiliary.h:115
#define pGetComp(p)
Component.
Definition: polys.h:37
poly pp
Definition: myNF.cc:296
#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:10
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
#define pSortCompCorrect(p)
Assume: If considerd only as poly in any component of p (say, monomials of other components of p are ...
Definition: polys.h:210
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idCopy(ideal A)
Definition: ideals.h:60
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
poly * polyset
Definition: hutil.h:15
ring syRing
Definition: syz.h:56
#define pNext(p)
Definition: monomials.h:43
ideal * resolvente
Definition: ideals.h:18
polyrec * poly
Definition: hilb.h:10
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94

◆ syReOrderResolventFB()

void syReOrderResolventFB ( resolvente  res,
int  length,
int  initial = 1 
)

Definition at line 746 of file syz0.cc.

747 {
748  int syzIndex=length-1,i,j;
749  poly p;
750 
751  while ((syzIndex!=0) && (res[syzIndex]==NULL)) syzIndex--;
752  while (syzIndex>=initial)
753  {
754  for(i=0;i<IDELEMS(res[syzIndex]);i++)
755  {
756  p = res[syzIndex]->m[i];
757 
758  while (p!=NULL)
759  {
760  if (res[syzIndex-1]->m[pGetComp(p)-1]!=NULL)
761  {
762  for(j=1;j<=(currRing->N);j++)
763  {
764  pSetExp(p,j,pGetExp(p,j)
765  -pGetExp(res[syzIndex-1]->m[pGetComp(p)-1],j));
766  }
767  }
768  else
769  PrintS("error in the resolvent\n");
770  pSetm(p);
771  pIter(p);
772  }
773  }
774  syzIndex--;
775  }
776 }
#define pSetm(p)
Definition: polys.h:253
#define pSetExp(p, i, v)
Definition: polys.h:42
return P p
Definition: myNF.cc:203
#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:10
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
poly initial(const poly p, const ring r, const gfan::ZVector &w)
Returns the initial form of p with respect to w.
Definition: initial.cc:32
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:284
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10

◆ syReorderShiftedComponents()

long syReorderShiftedComponents ( long *  sc,
int  n 
)

Definition at line 342 of file syz1.cc.

343 {
344  long holes = 0;
345  int i;
346  long new_comps = 0, new_space, max;
347 
348  // count number of holes
349  for (i=1; i<n; i++)
350  {
351  if (sc[i-1] + 1 < sc[i]) holes++;
352  }
353 
354  if (LONG_MAX - SYZ_SHIFT_BASE <= sc[n-1])
355  {
356  // need new components
357  new_comps = (((long) 1) << SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE) - 1;
358  max = LONG_MAX;
359  }
360  else
361  {
362  max = sc[n-1] + SYZ_SHIFT_BASE;
363  }
364 
365  // no we arrange things such that
366  // (n - holes) + holes*new_space + new_comps*SYZ_SHIFT_BASE= LONG_MAX
367  new_space = (max - n + holes - new_comps*SYZ_SHIFT_BASE) / holes;
368 
369  assume(new_space < SYZ_SHIFT_BASE && new_space >= 4);
370 
371  long* tc = ( long*) omAlloc(n*sizeof(long));
372  tc[0] = sc[0];
373  // rearrange things
374  for (i=1; i<n; i++)
375  {
376  if (sc[i-1] + 1 < sc[i])
377  {
378  tc[i] = tc[i-1] + new_space;
379  }
380  else
381  {
382  tc[i] = tc[i-1] + 1;
383  }
384  assume(tc[i] > tc[i-1]);
385  }
386 
387  assume(LONG_MAX - SYZ_SHIFT_BASE > tc[n-1]);
388 #ifdef HAVE_ASSUME
389  for (i=1; i<n; i++)
390  {
391  assume(tc[i] >= 0);
392  assume(tc[i-1] + 1 <= tc[i]);
393  }
394 #endif
395 
396  omMemcpyW(sc, tc, n);
397  omFreeSize(tc, n*sizeof(long));
398  return new_space;
399 }
#define omMemcpyW(p1, p2, l)
Definition: omMemOps.h:29
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE
Definition: syz.h:15
#define omAlloc(size)
Definition: omAllocDecl.h:210
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:394
#define SYZ_SHIFT_BASE
Definition: syz.h:18
int i
Definition: cfEzgcd.cc:123

◆ syResetShiftedComponents()

void syResetShiftedComponents ( syStrategy  syzstr,
int  index,
int  hilb = 0 
)

Definition at line 417 of file syz1.cc.

418 {
419  assume(index > 0);
420  int i;
421  if (syzstr->res[index] != NULL)
422  {
423  long * prev_s;
424  int* prev_c;
425  int p_length;
426  rGetSComps(&prev_c, &prev_s, &p_length, currRing);
427  currcomponents = syzstr->truecomponents[index-1];
431  IDELEMS(syzstr->res[index-1]), currRing);
432  if (hilb==0)
433  {
434  ideal id = syzstr->res[index];
435  for (i=0; i<IDELEMS(id); i++)
436  {
437  pResetSetm(id->m[i]);
438  }
439  }
440  else if (hilb==1)
441  {
442  assume (index>1);
443  assume (syzstr->resPairs[index-1]!=NULL);
444  SSet Pairs=syzstr->resPairs[index-1];
445  SSet Pairs1=syzstr->resPairs[index];
446  int till=(*syzstr->Tl)[index-1];
447  for (i=0;i<till;i++)
448  {
449  if (Pairs[i].syz!=NULL)
450  pResetSetm(Pairs[i].syz);
451  }
452  till=(*syzstr->Tl)[index];
453  for (i=0;i<till;i++)
454  {
455  if (Pairs1[i].p!=NULL)
456  pResetSetm(Pairs1[i].p);
457  }
458  }
459  currcomponents = prev_c;
460  currShiftedComponents = prev_s;
461  rChangeSComps(prev_c, prev_s, p_length, currRing);
462  }
463 }
return P p
Definition: myNF.cc:203
int * currcomponents
Definition: syz1.cc:39
resolvente res
Definition: syz.h:47
intvec * Tl
Definition: syz.h:50
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void rGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
Definition: ring.cc:4342
#define assume(x)
Definition: mod2.h:394
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
int ** truecomponents
Definition: syz.h:39
long ** ShiftedComponents
Definition: syz.h:40
#define NULL
Definition: omList.c:10
SRes resPairs
Definition: syz.h:49
static void pResetSetm(poly p)
Definition: syz1.cc:402
long * currShiftedComponents
Definition: syz1.cc:40
SObject * SSet
Definition: syz.h:32
void rChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
Definition: ring.cc:4333

◆ syResolution()

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

Definition at line 621 of file syz.cc.

622 {
623 
624 #ifdef HAVE_PLURAL
625 
626  const ideal idSaveCurrRingQuotient = currRing->qideal;
627 
628  if( rIsSCA(currRing) )
629  {
630 
631 #ifdef RDEBUG
632 // rWrite(currRing);
633 // rDebugPrint(currRing);
634 #endif
635 
637  {
638  currRing->qideal = SCAQuotient(currRing);
639  }
640 
641  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
642  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
643 
644  arg = id_KillSquares(arg, m_iFirstAltVar, m_iLastAltVar, currRing, false); // kill suares in input!
645  }
646 #endif
647 
649 
650  if ((w!=NULL) && (!idTestHomModule(arg,currRing->qideal,w))) // is this right in SCA case???
651  {
652  WarnS("wrong weights given(2):");w->show();PrintLn();
653  idHomModule(arg,currRing->qideal,&w);
654  w->show();PrintLn();
655  w=NULL;
656  }
657  if (w!=NULL)
658  {
659  result->weights = (intvec**)omAlloc0Bin(char_ptr_bin);
660  (result->weights)[0] = ivCopy(w);
661  result->length = 1;
662  }
663  resolvente fr = syResolvente(arg,maxlength,&(result->length),&(result->weights),minim),fr1;
664  if (minim)
665  {
666  result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
667  fr1 = result->minres;
668  }
669  else
670  {
671  result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
672  fr1 = result->fullres;
673  }
674  for (int i=result->length-1;i>=0;i--)
675  {
676  if (fr[i]!=NULL)
677  fr1[i] = fr[i];
678  fr[i] = NULL;
679  }
680  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
681 
682 
683 #ifdef HAVE_PLURAL
684  if( rIsSCA(currRing) )
685  {
686 
688  {
689  currRing->qideal = idSaveCurrRingQuotient;
690  }
691 
692  id_Delete(&arg, currRing);
693  }
694 #endif
695 
696 
697  return result;
698 }
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:310
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:1884
#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:115
#define WarnS
Definition: emacs.cc:81
omBin char_ptr_bin
Definition: ring.cc:55
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
bool ncExtensions(int iMask)
Definition: old.gring.cc:99
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:359
#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:1533
void show(int mat=0, int spaces=0) const
Definition: intvec.cc:150
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206
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 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  && (!rField_is_Ring(currRing))
538  }
539  else
540  {
541  res[syzIndex+1] = idSyzygies(res[syzIndex],hom,&w,FALSE);
542  }
543  completeMinim=(syzIndex!=maxlength) || (maxlength ==-1) || (hom!=isHomog);
544  syzIndex++;
545  if (TEST_OPT_PROT) Print("[%d]\n",syzIndex);
546 
547  if(! TEST_OPT_NO_SYZ_MINIM )
548  {
549  if ((minim)||(syzIndex>1))
550  syMinStep(res[syzIndex-1],res[syzIndex],!completeMinim,NULL,hom);
551  if (!completeMinim)
552  /*minim is TRUE, we are in the module: maxlength, maxlength <>0*/
553  {
554  idDelete(&res[syzIndex]);
555  }
556  }
557 /*---creating the iterated weights for module components ---------*/
558  if ((hom == isHomog) && (res[syzIndex]!=NULL) && (!idIs0(res[syzIndex])))
559  {
560 //Print("die %d Modulegewichte sind:\n",w1->length());
561 //w1->show();
562 //PrintLn();
563  int max_comp = id_RankFreeModule(res[syzIndex],currRing);
564  k = max_comp - rGetCurrSyzLimit(currRing);
565  assume(w != NULL);
566  if (w != NULL)
567  w->resize(max_comp+IDELEMS(res[syzIndex]));
568  else
569  w = new intvec(max_comp+IDELEMS(res[syzIndex]));
570  (*weights)[syzIndex] = new intvec(k);
571  for (i=0;i<k;i++)
572  {
573  if (res[syzIndex-1]->m[i]!=NULL) // hs
574  {
575  (*w)[i + rGetCurrSyzLimit(currRing)] = p_FDeg(res[syzIndex-1]->m[i],currRing);
576  if (pGetComp(res[syzIndex-1]->m[i])>0)
577  (*w)[i + rGetCurrSyzLimit(currRing)]
578  += (*w)[pGetComp(res[syzIndex-1]->m[i])-1];
579  (*((*weights)[syzIndex]))[i] = (*w)[i+rGetCurrSyzLimit(currRing)];
580  }
581  }
582  for (i=k;i<k+IDELEMS(res[syzIndex]);i++)
583  {
584  if (res[syzIndex]->m[i-k]!=NULL)
585  (*w)[i+rGetCurrSyzLimit(currRing)] = p_FDeg(res[syzIndex]->m[i-k],currRing)
586  +(*w)[pGetComp(res[syzIndex]->m[i-k])-1];
587  }
588  }
589  }
590 /*--- end of the main loop --------------------------------------*/
591 /*--- deleting the temporare data structures --------------------*/
592  if ((syzIndex!=0) && (res[syzIndex]!=NULL) && (idIs0(res[syzIndex])))
593  idDelete(&res[syzIndex]);
594  if (w !=NULL) delete w;
595 
596  Kstd1_deg=Kstd1_OldDeg;
597  if (!oldDegBound)
599 
600  for (i=1; i<=syzIndex; i++)
601  {
602  if ((res[i]!=NULL) && ! idIs0(res[i]))
603  {
605  }
606  }
607 /*--- going back to the original ring -------------------------*/
608  if (origR != syz_ring)
609  {
610  rChangeCurrRing(origR); // should not be needed now?
611  for (i=0; i<=syzIndex; i++)
612  {
613  res[i] = idrMoveR_NoSort(res[i], syz_ring, origR);
614  }
615  rDelete(syz_ring);
616  }
617  SI_RESTORE_OPT1(save1);
618  return res;
619 }
#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:310
#define Print
Definition: emacs.cc:83
#define TEST_OPT_DEGBOUND
Definition: options.h:108
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:1884
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:98
void * ADDRESS
Definition: auxiliary.h:115
#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:18
#define Sy_bit(x)
Definition: options.h:30
#define pGetComp(p)
Component.
Definition: polys.h:37
poly res
Definition: myNF.cc:322
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
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:264
#define assume(x)
Definition: mod2.h:394
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:5061
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4363
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:120
int i
Definition: cfEzgcd.cc:123
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:3177
#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:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:562
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:477
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
void show(int mat=0, int spaces=0) const
Definition: intvec.cc:150
const CanonicalForm & w
Definition: facAbsFact.cc:55
static bool rIsSCA(const ring r)
Definition: nc.h:206
ideal * resolvente
Definition: ideals.h:18
#define OPT_DEGBOUND
Definition: options.h:85
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:23
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:206
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

◆ sySchreyer()

syStrategy sySchreyer ( ideal  arg,
int  maxlength 
)

Definition at line 1024 of file syz0.cc.

1025 {
1026  int rl;
1027  resolvente fr = sySchreyerResolvente(arg,maxlength,&(rl));
1028  if (fr==NULL) return NULL;
1029 
1030  // int typ0;
1032  result->length=rl;
1033  result->fullres = (resolvente)omAlloc0((rl /*result->length*/+1)*sizeof(ideal));
1034  for (int i=rl /*result->length*/-1;i>=0;i--)
1035  {
1036  if (fr[i]!=NULL)
1037  {
1038  result->fullres[i] = fr[i];
1039  fr[i] = NULL;
1040  }
1041  }
1042  if (currRing->qideal!=NULL)
1043  {
1044  for (int i=0; i<rl; i++)
1045  {
1046  if (result->fullres[i]!=NULL)
1047  {
1048  ideal t=kNF(currRing->qideal,NULL,result->fullres[i]);
1049  idDelete(&result->fullres[i]);
1050  result->fullres[i]=t;
1051  if (i<rl-1)
1052  {
1053  for(int j=IDELEMS(t)-1;j>=0; j--)
1054  {
1055  if ((t->m[j]==NULL) && (result->fullres[i+1]!=NULL))
1056  {
1057  for(int k=IDELEMS(result->fullres[i+1])-1;k>=0; k--)
1058  {
1059  if (result->fullres[i+1]->m[k]!=NULL)
1060  {
1061  pDeleteComp(&(result->fullres[i+1]->m[k]),j+1);
1062  }
1063  }
1064  }
1065  }
1066  }
1067  idSkipZeroes(result->fullres[i]);
1068  }
1069  }
1070  if ((rl>maxlength) && (result->fullres[rl-1]!=NULL))
1071  {
1072  idDelete(&result->fullres[rl-1]);
1073  }
1074  }
1075  omFreeSize((ADDRESS)fr,(rl /*result->length*/)*sizeof(ideal));
1076  return result;
1077 }
int length
Definition: syz.h:60
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial, BOOLEAN)
Definition: syz0.cc:861
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:115
int k
Definition: cfEzgcd.cc:93
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
resolvente fullres
Definition: syz.h:57
#define NULL
Definition: omList.c:10
ideal * resolvente
Definition: ideals.h:18
#define pDeleteComp(p, k)
Definition: polys.h:343
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
ssyStrategy * syStrategy
Definition: syz.h:35

◆ sySchreyerResolvente()

resolvente sySchreyerResolvente ( ideal  arg,
int  maxlength,
int *  length,
BOOLEAN  isMonomial = FALSE,
BOOLEAN  notReplace = FALSE 
)

Definition at line 861 of file syz0.cc.

863 {
864  ideal mW=NULL;
865  int i,syzIndex = 0,j=0;
866  intvec * modcomp=NULL,*w=NULL;
867  // int ** wv=NULL;
868  tHomog hom=(tHomog)idHomModule(arg,NULL,&w);
869  ring origR = currRing;
870  ring syRing = NULL;
871 
872  if ((!isMonomial) && syTestOrder(arg))
873  {
874  WerrorS("sres only implemented for modules with ordering ..,c or ..,C");
875  return NULL;
876  }
877  *length = 4;
878  resolvente res = (resolvente)omAlloc0(4*sizeof(ideal)),newres;
879  res[0] = idCopy(arg);
880 
881  while ((!idIs0(res[syzIndex])) && ((maxlength==-1) || (syzIndex<maxlength)))
882  {
883  i = IDELEMS(res[syzIndex]);
884  //while ((i!=0) && (!res[syzIndex]->m[i-1])) i--;
885  if (syzIndex+1==*length)
886  {
887  newres = (resolvente)omAlloc0((*length+4)*sizeof(ideal));
888  // for (j=0;j<*length+4;j++) newres[j] = NULL;
889  for (j=0;j<*length;j++) newres[j] = res[j];
890  omFreeSize((ADDRESS)res,*length*sizeof(ideal));
891  *length += 4;
892  res=newres;
893  }
894 
895  if ((hom==isHomog)|| (rHasGlobalOrdering(origR)))
896  {
897  if (syzIndex==0) syInitSort(res[0],&modcomp);
898 
899  if ((syzIndex==0) && !rRing_has_CompLastBlock(currRing))
900  res[syzIndex+1] = sySchreyersSyzygiesFB(res[syzIndex],&modcomp,mW,FALSE);
901  else
902  res[syzIndex+1] = sySchreyersSyzygiesFB(res[syzIndex],&modcomp,mW);
903 
904  if (errorreported)
905  {
906  for (j=0;j<*length;j++) idDelete( &res[j] );
907  omFreeSize((ADDRESS)res,*length*sizeof(ideal));
908  return NULL;
909  }
910 
911  mW = res[syzIndex];
912  }
913 //idPrint(res[syzIndex+1]);
914 
915  if ( /*(*/ syzIndex==0 /*)*/ )
916  {
917  if ((hom==isHomog)|| (rHasGlobalOrdering(origR)))
918  {
919  syRing = rAssure_CompLastBlock(origR, TRUE);
920  if (syRing != origR)
921  {
922  rChangeCurrRing(syRing);
923  for (i=0; i<IDELEMS(res[1]); i++)
924  {
925  res[1]->m[i] = prMoveR( res[1]->m[i], origR, syRing);
926  }
927  }
928  idTest(res[1]);
929  }
930  else
931  {
932  syRing = rAssure_SyzComp_CompLastBlock(origR);
933  if (syRing != origR)
934  {
935  rChangeCurrRing(syRing);
936  for (i=0; i<IDELEMS(res[0]); i++)
937  {
938  res[0]->m[i] = prMoveR( res[0]->m[i], origR, syRing);
939  }
940  }
941  idTest(res[0]);
942  }
943  }
944  if ((hom!=isHomog) && (rHasLocalOrMixedOrdering(origR)))
945  {
946  if (syzIndex==0) syInitSort(res[0],&modcomp);
947  res[syzIndex+1] = sySchreyersSyzygiesFM(res[syzIndex],&modcomp);
948  if (errorreported)
949  {
950  for (j=0;j<*length;j++) idDelete( &res[j] );
951  omFreeSize((ADDRESS)res,*length*sizeof(ideal));
952  return NULL;
953  }
954  }
955  syzIndex++;
956  if (TEST_OPT_PROT) Print("[%d]\n",syzIndex);
957  }
958  //syPrintResolution(res,1,*length);
959  if ((hom!=isHomog) && (rHasLocalOrMixedOrdering(origR)))
960  {
961  syzIndex = 1;
962  while ((syzIndex < *length) && (!idIs0(res[syzIndex])))
963  {
964  id_Shift(res[syzIndex],-rGetMaxSyzComp(syzIndex, currRing),currRing);
965  syzIndex++;
966  }
967  }
968  if ((hom==isHomog) || (rHasGlobalOrdering(origR)))
969  syzIndex = 1;
970  else
971  syzIndex = 0;
972  syReOrderResolventFB(res,*length,syzIndex+1);
973  if (/*ringOrderChanged:*/ origR!=syRing && syRing != NULL)
974  {
975  rChangeCurrRing(origR);
976  // Thomas: Here I assume that all (!) polys of res live in tmpR
977  while ((syzIndex < *length) && (res[syzIndex]))
978  {
979  for (i=0;i<IDELEMS(res[syzIndex]);i++)
980  {
981  if (res[syzIndex]->m[i])
982  {
983  res[syzIndex]->m[i] = prMoveR( res[syzIndex]->m[i], syRing, origR);
984  }
985  }
986  syzIndex++;
987  }
988 // j = 0; while (currRing->order[j]!=0) j++; // What was this for???!
989  rDelete(syRing);
990  }
991  else
992  {
993  // Thomas -- are you sure that you have to "reorder" here?
994  while ((syzIndex < *length) && (res[syzIndex]))
995  {
996  for (i=0;i<IDELEMS(res[syzIndex]);i++)
997  {
998  if (res[syzIndex]->m[i])
999  res[syzIndex]->m[i] = pSortCompCorrect(res[syzIndex]->m[i]);
1000  }
1001  syzIndex++;
1002  }
1003  }
1004  if ((hom==isHomog) || (rHasGlobalOrdering(origR)))
1005  {
1006  if (res[1]!=NULL)
1007  {
1008  syReOrderResolventFB(res,2,1);
1009  for (i=0;i<IDELEMS(res[1]);i++)
1010  {
1011  if (res[1]->m[i])
1012  res[1]->m[i] = pSort(res[1]->m[i]);
1013  }
1014  }
1015  }
1016  //syPrintResolution(res,0,*length);
1017 
1018  //syMergeSortResolventFB(res,*length);
1019  if (modcomp!=NULL) delete modcomp;
1020  if (w!=NULL) delete w;
1021  return res;
1022 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
void syReOrderResolventFB(resolvente res, int length, int initial)
Definition: syz0.cc:746
#define Print
Definition: emacs.cc:83
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:94
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define pSort(p)
Definition: polys.h:201
#define TRUE
Definition: auxiliary.h:98
void * ADDRESS
Definition: auxiliary.h:115
void WerrorS(const char *s)
Definition: feFopen.cc:24
static ideal sySchreyersSyzygiesFM(ideal arg, intvec **modcomp)
Definition: syz0.cc:168
ring rAssure_SyzComp_CompLastBlock(const ring r)
makes sure that c/C ordering is last ordering and SyzIndex is first
Definition: ring.cc:4667
poly res
Definition: myNF.cc:322
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void id_Shift(ideal M, int s, const ring r)
#define pSortCompCorrect(p)
Assume: If considerd only as poly in any component of p (say, monomials of other components of p are ...
Definition: polys.h:210
Definition: intvec.h:14
tHomog
Definition: structs.h:37
int j
Definition: myNF.cc:70
int rGetMaxSyzComp(int i, const ring r)
return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit
Definition: ring.cc:5061
static void syInitSort(ideal arg, intvec **modcomp)
Definition: syz0.cc:29
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
ring rAssure_CompLastBlock(ring r, BOOLEAN complete)
makes sure that c/C ordering is last ordering
Definition: ring.cc:4612
#define IDELEMS(i)
Definition: simpleideals.h:24
BOOLEAN syTestOrder(ideal M)
Definition: syz0.cc:835
ideal idCopy(ideal A)
Definition: ideals.h:60
short errorreported
Definition: feFopen.cc:23
void rChangeCurrRing(ring r)
Definition: polys.cc:12
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const CanonicalForm & w
Definition: facAbsFact.cc:55
ideal * resolvente
Definition: ideals.h:18
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
BOOLEAN rRing_has_CompLastBlock(ring r)
Definition: ring.cc:5107
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define idTest(id)
Definition: ideals.h:47
static ideal sySchreyersSyzygiesFB(ideal arg, intvec **modcomp, ideal mW, BOOLEAN redTail=TRUE)
Definition: syz0.cc:505

◆ sySchreyersSyzygiesB()

void sySchreyersSyzygiesB ( polyset  F,
int  Fmax,
polyset Shdl,
int *  Smax,
BOOLEAN  noSort 
)

◆ sySchreyersSyzygiesM()

void sySchreyersSyzygiesM ( polyset  F,
int  Fmax,
polyset Shdl,
int *  Smax,
BOOLEAN  noSort 
)

◆ sySize()

int sySize ( syStrategy  syzstr)

Definition at line 1837 of file syz1.cc.

1838 {
1839  resolvente r=syzstr->res;
1840  if (r==NULL)
1841  r = syzstr->fullres;
1842  if (r==NULL)
1843  r = syzstr->minres;
1844  if (r==NULL)
1845  {
1846  WerrorS("No resolution found");
1847  return 0;
1848  }
1849  int i=syzstr->length;
1850  while ((i>0) && (r[i-1]==NULL)) i--;
1851  return i;
1852 }
int length
Definition: syz.h:60
resolvente res
Definition: syz.h:47
void WerrorS(const char *s)
Definition: feFopen.cc:24
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
resolvente fullres
Definition: syz.h:57
resolvente minres
Definition: syz.h:58
#define NULL
Definition: omList.c:10
ideal * resolvente
Definition: ideals.h:18

◆ syTestOrder()

BOOLEAN syTestOrder ( ideal  i)

Definition at line 835 of file syz0.cc.

836 {
838  if (i == 0) return FALSE;
839  int j=0;
840 
841  while ((currRing->order[j]!=ringorder_c) && (currRing->order[j]!=ringorder_C))
842  j++;
843  if (currRing->order[j+1]!=0)
844  return TRUE;
845  return FALSE;
846 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
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
int i
Definition: cfEzgcd.cc:123

Variable Documentation

◆ currcomponents

int* currcomponents

Definition at line 39 of file syz1.cc.

◆ currShiftedComponents

long* currShiftedComponents

Definition at line 40 of file syz1.cc.