My Project  UNKNOWN_GIT_VERSION
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)
 
syStrategy syFrank (const ideal arg, const int length, const char *method, const bool use_cache=true, const bool use_tensor_trick=false)
 
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 36 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 771 of file syz.cc.

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

◆ syBettiOfComputation()

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

Don't change the syzstr???

Definition at line 1756 of file syz1.cc.

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

◆ syChosePairs()

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

Definition at line 1289 of file syz1.cc.

1290 {
1291  return syChosePairsPutIn(syzstr,index,howmuch,actdeg,0,syzstr->length);
1292 }
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
static SSet syChosePairsPutIn(syStrategy syzstr, int *index, int *howmuch, int *actdeg, int an, int en)
Definition: syz1.cc:1182

◆ syCompactify1()

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

Definition at line 133 of file syz1.cc.

134 {
135  int k=first,kk=0;
136 
137  while (k+kk<*sPlength)
138  {
139  if (sPairs[k+kk].lcm!=NULL)
140  {
141  if (kk>0) syCopyPair(&sPairs[k+kk],&sPairs[k]);
142  k++;
143  }
144  else
145  {
146  kk++;
147  }
148  }
149  while (k<*sPlength)
150  {
151  syInitializePair(&sPairs[k]);
152  k++;
153  }
154  *sPlength -= kk;
155 }
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:709
void syCopyPair(SObject *argso, SObject *imso)
Definition: syz1.cc:83
void syInitializePair(SObject *so)
Definition: syz1.cc:64

◆ syCompactifyPairSet()

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

Definition at line 105 of file syz1.cc.

106 {
107  int k=first,kk=0;
108 
109  while (k+kk<sPlength)
110  {
111  if (sPairs[k+kk].lcm!=NULL)
112  {
113  if (kk>0) syCopyPair(&sPairs[k+kk],&sPairs[k]);
114  k++;
115  }
116  else
117  {
118  kk++;
119  }
120  }
121  while (k<sPlength)
122  {
123  syInitializePair(&sPairs[k]);
124  k++;
125  }
126 }

◆ syCopy()

syStrategy syCopy ( syStrategy  syzstr)

Definition at line 1885 of file syz1.cc.

1886 {
1887  syStrategy result=syzstr;
1888  (result->references)++;
1889  return result;
1890 }

◆ syCopyPair()

void syCopyPair ( SObject *  argso,
SObject *  imso 
)

Definition at line 83 of file syz1.cc.

84 {
85  *imso=*argso;
86  (*argso).p = NULL;
87  (*argso).p1 = NULL;
88  (*argso).p2 = NULL;
89  (*argso).lcm = NULL;
90  (*argso).syz = NULL;
91  (*argso).ind1 = 0;
92  (*argso).ind2 = 0;
93  (*argso).syzind = -1;
94  (*argso).order = 0;
95  (*argso).isNotMinimal = NULL;
96  (*argso).length = -1;
97  (*argso).reference = -1;
98 }

◆ syDeletePair()

void syDeletePair ( SObject *  so)

Definition at line 45 of file syz1.cc.

46 {
47  pDelete(&(*so).p);
48  pDelete(&(*so).lcm);
49  pDelete(&(*so).syz);
50  (*so).p1 = NULL;
51  (*so).p2 = NULL;
52  (*so).ind1 = 0;
53  (*so).ind2 = 0;
54  (*so).syzind = -1;
55  (*so).order = 0;
56  (*so).isNotMinimal = NULL;
57  (*so).length = -1;
58  (*so).reference = -1;
59 }
#define pDelete(p_ptr)
Definition: polys.h:181

◆ syDim()

int syDim ( syStrategy  syzstr)

Definition at line 1850 of file syz1.cc.

1851 {
1852  int i,l;
1853  if (syzstr->resPairs!=NULL)
1854  {
1855  SRes rP=syzstr->resPairs;
1856 
1857  l = syzstr->length;
1858  while ((l>0) && (rP[l-1]==NULL)) l--;
1859  if (l==0) return -1;
1860  l--;
1861  while (l>=0)
1862  {
1863  i = 0;
1864  while ((i<(*syzstr->Tl)[l]) &&
1865  ((rP[l][i].lcm!=NULL) || (rP[l][i].syz!=NULL)) &&
1866  (rP[l][i].isNotMinimal!=NULL))
1867  {
1868  i++;
1869  }
1870  if ((i<(*syzstr->Tl)[l]) &&
1871  ((rP[l][i].lcm!=NULL) || (rP[l][i].syz!=NULL)) &&
1872  (rP[l][i].isNotMinimal==NULL))
1873  return l;
1874  l--;
1875  }
1876  return l;
1877  }
1878  else
1879  return sySize(syzstr);
1880 }
int sySize(syStrategy syzstr)
Definition: syz1.cc:1830
intvec * Tl
Definition: syz.h:50
SSet * SRes
Definition: syz.h:33

◆ syEnlargeFields()

void syEnlargeFields ( syStrategy  syzstr,
int  index 
)

Definition at line 735 of file syz1.cc.

736 {
737  pEnlargeSet(&(syzstr->res[index]->m),IDELEMS(syzstr->res[index]),16);
739  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
740  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
741  syzstr->ShiftedComponents[index]
742  =(long*)omRealloc0Size((ADDRESS)syzstr->ShiftedComponents[index],
743  (IDELEMS(syzstr->res[index])+1)*sizeof(long),
744  (IDELEMS(syzstr->res[index])+17)*sizeof(long));
746  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
747  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
748  syzstr->Howmuch[index]=(int*)omRealloc0Size((ADDRESS)syzstr->Howmuch[index],
749  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
750  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
751  syzstr->Firstelem[index]=(int*)omRealloc0Size((ADDRESS)syzstr->Firstelem[index],
752  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
753  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
754  syzstr->elemLength[index]=(int*)omRealloc0Size((ADDRESS)syzstr->elemLength[index],
755  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
756  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
757  syzstr->sev[index]=(unsigned long*)omRealloc0Size((ADDRESS)syzstr->sev[index],
758  (IDELEMS(syzstr->res[index])+1)*sizeof(unsigned long),
759  (IDELEMS(syzstr->res[index])+17)*sizeof(unsigned long));
760  IDELEMS(syzstr->res[index]) += 16;
761  pEnlargeSet(&(syzstr->orderedRes[index]->m),IDELEMS(syzstr->orderedRes[index]),16);
762  IDELEMS(syzstr->orderedRes[index]) += 16;
763 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3647
int ** backcomponents
Definition: syz.h:41
int ** truecomponents
Definition: syz.h:39
int ** Firstelem
Definition: syz.h:43
int ** elemLength
Definition: syz.h:44
unsigned long ** sev
Definition: syz.h:59
long ** ShiftedComponents
Definition: syz.h:40
int ** Howmuch
Definition: syz.h:42

◆ syEnterPair() [1/2]

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

Definition at line 986 of file syz1.cc.

987 {
988  int ll,k,no=(*so).order,sP=*sPlength,i;
989 
990  if ((sP==0) || (sPairs[sP-1].order<=no))
991  ll = sP;
992  else if (sP==1)
993  ll = 0;
994  else
995  {
996  int an=0,en=sP-1;
997  loop
998  {
999  if (an>=en-1)
1000  {
1001  if ((sPairs[an].order<=no) && (sPairs[an+1].order>no))
1002  {
1003  ll = an+1;
1004  break;
1005  }
1006  else if ((sPairs[en].order<=no) && (sPairs[en+1].order>no))
1007  {
1008  ll = en+1;
1009  break;
1010  }
1011  else if (sPairs[an].order>no)
1012  {
1013  ll = an;
1014  break;
1015  }
1016  else
1017  {
1018  PrintS("Hier ist was faul!\n");
1019  break;
1020  }
1021  }
1022  i=(an+en) / 2;
1023  if (sPairs[i].order <= no)
1024  an=i;
1025  else
1026  en=i;
1027  }
1028  }
1029  for (k=(*sPlength);k>ll;k--)
1030  {
1031  syCopyPair(&sPairs[k-1],&sPairs[k]);
1032  }
1033  syCopyPair(so,&sPairs[ll]);
1034  (*sPlength)++;
1035 }
#define loop
Definition: structs.h:78

◆ syEnterPair() [2/2]

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

Definition at line 1036 of file syz1.cc.

1037 {
1038  int ll;
1039 
1040  if (*sPlength>=(*syzstr->Tl)[index])
1041  {
1042  SSet temp = (SSet)omAlloc0(((*syzstr->Tl)[index]+16)*sizeof(SObject));
1043  for (ll=0;ll<(*syzstr->Tl)[index];ll++)
1044  {
1045  temp[ll].p = (syzstr->resPairs[index])[ll].p;
1046  temp[ll].p1 = (syzstr->resPairs[index])[ll].p1;
1047  temp[ll].p2 = (syzstr->resPairs[index])[ll].p2;
1048  temp[ll].syz = (syzstr->resPairs[index])[ll].syz;
1049  temp[ll].lcm = (syzstr->resPairs[index])[ll].lcm;
1050  temp[ll].ind1 = (syzstr->resPairs[index])[ll].ind1;
1051  temp[ll].ind2 = (syzstr->resPairs[index])[ll].ind2;
1052  temp[ll].syzind = (syzstr->resPairs[index])[ll].syzind;
1053  temp[ll].order = (syzstr->resPairs[index])[ll].order;
1054  temp[ll].isNotMinimal = (syzstr->resPairs[index])[ll].isNotMinimal;
1055  temp[ll].length = (syzstr->resPairs[index])[ll].length;
1056  temp[ll].reference = (syzstr->resPairs[index])[ll].reference;
1057  }
1058  if (syzstr->resPairs[index] != NULL) // OB: ?????
1059  omFreeSize((ADDRESS)syzstr->resPairs[index],(*syzstr->Tl)[index]*sizeof(SObject));
1060  (*syzstr->Tl)[index] += 16;
1061  syzstr->resPairs[index] = temp;
1062  }
1063  syEnterPair(syzstr->resPairs[index],so,sPlength,index);
1064 }
int p
Definition: cfModGcd.cc:4019
long ind2(long arg)
Definition: kutil.cc:4060
void syEnterPair(SSet sPairs, SObject *so, int *sPlength, int)
Definition: syz1.cc:986
SObject * SSet
Definition: syz.h:32

◆ syFrank()

syStrategy syFrank ( const ideal  arg,
const int  length,
const char *  method,
const bool  use_cache = true,
const bool  use_tensor_trick = false 
)

Definition at line 823 of file syz4.cc.

825 {
827  resolvente res = (resolvente)omAlloc0((length+1)*sizeof(ideal));
828  if (strcmp(method, "frame") != 0)
829  {
830  res[0] = id_Copy(arg, currRing);
831  }
832  else
833  {
834  res[0] = id_Head(arg, currRing);
835  }
836  syzHeadFunction *syzHead;
837  bool do_lifting;
838  bool single_module;
839  set_options(&syzHead, &do_lifting, &single_module, method);
840  int new_length = computeResolution(res, length-1, syzHead, do_lifting,
841  single_module, use_cache, use_tensor_trick);
842  if (new_length < length)
843  {
844  res = (resolvente)omReallocSize(res, (length+1)*sizeof(ideal),
845  (new_length+1)*sizeof(ideal));
846  }
847  if (strcmp(method, "frame") != 0)
848  {
849  insert_ext_induced_LTs(res, new_length, single_module);
850  }
851  result->fullres = res;
852  result->length = new_length;
853  result->list_length = new_length;
854  return result;
855 }
ideal id_Copy(ideal h1, const ring r)
copy an ideal
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms
static void set_options(syzHeadFunction **syzHead_ptr, bool *do_lifting_ptr, bool *single_module_ptr, const char *method)
Definition: syz4.cc:732
static int computeResolution(resolvente res, const int max_index, syzHeadFunction *syzHead, const bool do_lifting, const bool single_module, const bool use_cache, const bool use_tensor_trick)
Definition: syz4.cc:701
static void insert_ext_induced_LTs(const resolvente res, const int length, const bool single_module)
Definition: syz4.cc:789
poly syzHeadFunction(ideal, int, int)
Definition: syz4.cc:352
ssyStrategy * syStrategy
Definition: syz.h:35

◆ syGaussForOne()

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

Definition at line 219 of file syz.cc.

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

◆ syHilb()

syStrategy syHilb ( ideal  arg,
int *  length 
)

Definition at line 952 of file syz2.cc.

953 {
954  int i,j,actdeg=32000,index=0;
955  int howmuch,toSub=0;
956  int maxindex=0,maxdeg=0;
957  ideal temp=NULL;
958  SSet nextPairs;
959  ring origR = currRing;
960  syStrategy syzstr=(syStrategy)omAlloc0(sizeof(ssyStrategy));
961 
962  if ((idIs0(arg)) || (id_RankFreeModule(arg,currRing)>0))
963  {
965  syzstr->length = 1;
966  syzstr->minres[0] = idInit(1,arg->rank);
967  return syzstr;
968  }
969 
970  // Creare dp,S ring and change to it
971  syzstr->syRing = rAssure_dp_C(origR);
972  rChangeCurrRing(syzstr->syRing);
973 
974  // set initial ShiftedComps
975  currcomponents = (int*)omAlloc0((arg->rank+1)*sizeof(int));
976  currShiftedComponents = (long*)omAlloc0((arg->rank+1)*sizeof(long));
977 
978 /*--- initializes the data structures---------------*/
979 #ifdef SHOW_CRIT
980  crit = 0;
981  crit1 = 0;
982  spfl = 0;
983  cons_pairs = 0;
984  crit_fails = 0;
985 #endif
986  syzstr->length = *length = currRing->N+2;
987  syzstr->Tl = new intvec(*length+1);
988  temp = idInit(IDELEMS(arg),arg->rank);
989  for (i=0;i<IDELEMS(arg);i++)
990  {
991  if (origR != syzstr->syRing)
992  temp->m[i] = prCopyR( arg->m[i], origR, syzstr->syRing);
993  else
994  temp->m[i] = pCopy( arg->m[i]);
995  if (temp->m[i]!=NULL)
996  {
997  j = pTotaldegree(temp->m[i]);
998  if (j<actdeg) actdeg = j;
999  }
1000  }
1001  idTest(temp);
1002  idSkipZeroes(temp);
1003  syzstr->resPairs = syInitRes(temp,length,syzstr->Tl,syzstr->cw);
1004  omFreeSize((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int));
1005  omFreeSize((ADDRESS)currShiftedComponents,(arg->rank+1)*sizeof(int));
1006  syzstr->res = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
1007  syzstr->orderedRes = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
1008  syzstr->elemLength = (int**)omAlloc0((*length+1)*sizeof(int*));
1009  syzstr->truecomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
1010  syzstr->backcomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
1011  syzstr->ShiftedComponents = (long**)omAlloc0((*length+1)*sizeof(long*));
1012  syzstr->Howmuch = (int**)omAlloc0((*length+1)*sizeof(int*));
1013  syzstr->Firstelem = (int**)omAlloc0((*length+1)*sizeof(int*));
1014  syzstr->hilb_coeffs = (intvec**)omAlloc0((*length+1)*sizeof(intvec*));
1015  syzstr->sev = (unsigned long **)omAlloc0((*length+1)*sizeof(unsigned long*));
1016  syzstr->bucket = kBucketCreate(currRing);
1017  syzstr->syz_bucket = kBucketCreate(currRing);
1018  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
1019 /*--- computes the resolution ----------------------*/
1020  while (nextPairs!=NULL)
1021  {
1022 #ifdef SHOW_PROT
1023 Print("compute %d Paare im Module %d im Grad %d \n",howmuch,index,actdeg+index);
1024 #endif
1025  if (TEST_OPT_PROT) Print("%d",actdeg);
1026  if (TEST_OPT_PROT) Print("(m%d)",index);
1027  if (index==0)
1028  i = syInitSyzMod(syzstr,index,id_RankFreeModule(arg, origR)+1);
1029  else
1030  i = syInitSyzMod(syzstr,index);
1031  j = syInitSyzMod(syzstr,index+1);
1032  if (index>0)
1033  {
1034  syRedNextPairs_Hilb(nextPairs,syzstr,howmuch,index,actdeg,&toSub,&maxindex,&maxdeg);
1035  syzstr->res[index+1]->rank=id_RankFreeModule(syzstr->res[index+1],currRing);
1036  sySetNewHilb(syzstr,toSub,index,actdeg);
1037  toSub = 0;
1038  syCompactifyPairSet(syzstr->resPairs[index],(*syzstr->Tl)[index],0);
1039  }
1040  else
1041  syRedGenerOfCurrDeg_Hilb(syzstr,actdeg,&maxindex,&maxdeg);
1042 /*--- creates new pairs -----------------------------*/
1043 #ifdef SHOW_PROT
1044 Print("Bilde neue Paare in Modul %d!\n",index);
1045 #endif
1046  syCreateNewPairs_Hilb(syzstr,index,actdeg);
1047  if (index<(*length)-1)
1048  {
1049 #ifdef SHOW_PROT
1050 Print("Bilde neue Paare in Modul %d!\n",index+1);
1051 #endif
1052  syCreateNewPairs_Hilb(syzstr,index+1,actdeg-1);
1053  }
1054  index++;
1055  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
1056  }
1057  syReOrdResult_Hilb(syzstr,maxindex,maxdeg);
1058 #ifdef SHOW_RESULT
1059 PrintS("minimal resolution:\n");
1060 for (int ti=1;ti<=*length;ti++)
1061 {
1062  if (!idIs0(syzstr->orderedRes[ti])) idPrint(syzstr->orderedRes[ti]);
1063 }
1064 PrintS("full resolution:\n");
1065 for (int ti=1;ti<=*length;ti++)
1066 {
1067  if (!idIs0(syzstr->res[ti])) idPrint(syzstr->res[ti]);
1068 }
1069 #endif
1070 #ifdef SHOW_CRIT
1071 Print("Criterion %d times applied\n",crit);
1072 Print("Criterion1 %d times applied\n",crit1);
1073 Print("%d superfluous pairs\n",spfl);
1074 Print("%d pairs considered\n",cons_pairs);
1075 Print("Criterion fails %d times\n",crit_fails);
1076 crit = 0;
1077 crit1 = 0;
1078 spfl = 0;
1079 cons_pairs = 0;
1080 crit_fails = 0;
1081 #endif
1082  if (temp!=NULL) idDelete(&temp);
1083  kBucketDestroy(&(syzstr->bucket));
1084  kBucketDestroy(&(syzstr->syz_bucket));
1085  if (origR != syzstr->syRing)
1086  rChangeCurrRing(origR);
1087  else
1088  currRing = origR;
1089  if (TEST_OPT_PROT) PrintLn();
1090  return syzstr;
1091 }
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define idPrint(id)
Definition: ideals.h:46
#define idTest(id)
Definition: ideals.h:47
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:213
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:206
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define TEST_OPT_PROT
Definition: options.h:102
void rChangeCurrRing(ring r)
Definition: polys.cc:15
static long pTotaldegree(poly p)
Definition: polys.h:276
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:35
ring rAssure_dp_C(const ring r)
Definition: ring.cc:4885
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
omBin sip_sideal_bin
Definition: simpleideals.cc:29
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static void syCreateNewPairs_Hilb(syStrategy syzstr, int index, int actdeg)
Definition: syz2.cc:67
static void syRedGenerOfCurrDeg_Hilb(syStrategy syzstr, int deg, int *maxindex, int *maxdeg)
Definition: syz2.cc:843
void sySetNewHilb(syStrategy syzstr, int toSub, int index, int actord)
Definition: syz2.cc:783
static void syReOrdResult_Hilb(syStrategy syzstr, int maxindex, int maxdeg)
Definition: syz2.cc:904
static void syRedNextPairs_Hilb(SSet nextPairs, syStrategy syzstr, int howmuch, int index, int actord, int *toSub, int *maxindex, int *maxdeg)
Definition: syz2.cc:493
ring syRing
Definition: syz.h:56
void syCompactifyPairSet(SSet sPairs, int sPlength, int first)
Definition: syz1.cc:105
SRes syInitRes(ideal arg, int *length, intvec *Tl, intvec *cw=NULL)
Definition: syz1.cc:294
kBucket_pt syz_bucket
Definition: syz.h:55
intvec * cw
Definition: syz.h:52
int * currcomponents
Definition: syz1.cc:34
long * currShiftedComponents
Definition: syz1.cc:35
kBucket_pt bucket
Definition: syz.h:54
SSet syChosePairs(syStrategy syzstr, int *index, int *howmuch, int *actdeg)
Definition: syz1.cc:1289
int syInitSyzMod(syStrategy syzstr, int index, int init=17)
Definition: syz1.cc:1460

◆ syInitializePair()

void syInitializePair ( SObject *  so)

Definition at line 64 of file syz1.cc.

65 {
66  (*so).p = NULL;
67  (*so).lcm = NULL;
68  (*so).syz = NULL;
69  (*so).p1 = NULL;
70  (*so).p2 = NULL;
71  (*so).ind1 = 0;
72  (*so).ind2 = 0;
73  (*so).syzind = -1;
74  (*so).order = 0;
75  (*so).isNotMinimal = NULL;
76  (*so).length = -1;
77  (*so).reference = -1;
78 }

◆ syInitRes()

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

Definition at line 294 of file syz1.cc.

295 {
296  if (idIs0(arg)) return NULL;
297  SRes resPairs = (SRes)omAlloc0(*length*sizeof(SSet));
298  resPairs[0] = (SSet)omAlloc0(IDELEMS(arg)*sizeof(SObject));
299  intvec * iv=NULL;
300  int i,j;
301 
302  if (id_RankFreeModule(arg,currRing)==0)
303  {
304  iv = idSort(arg);
305  for (i=0;i<IDELEMS(arg);i++)
306  {
307  (resPairs[0])[i].syz = /*pCopy*/(arg->m[(*iv)[i]-1]);
308  arg->m[(*iv)[i]-1] = NULL;
309  (resPairs[0])[i].order = pTotaldegree((resPairs[0])[i].syz);
310  }
311  }
312  else
313  {
314  iv = new intvec(IDELEMS(arg),1,-1);
315  for (i=0;i<IDELEMS(arg);i++)
316  {
317  (*iv)[i] = pTotaldegree(arg->m[i])+(*cw)[pGetComp(arg->m[i])-1];
318  }
319  for (i=0;i<IDELEMS(arg);i++)
320  {
321  j = syChMin(iv);
322  if (j<0) break;
323  (resPairs[0])[i].syz = arg->m[j];
324  arg->m[j] = NULL;
325  (resPairs[0])[i].order = (*iv)[j];
326  (*iv)[j] = -1;
327  }
328  }
329  if (iv!=NULL) delete iv;
330  (*Tl)[0] = IDELEMS(arg);
331  return resPairs;
332 }
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:186
static int syChMin(intvec *iv)
Definition: syz1.cc:271

◆ syInitSyzMod()

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

Definition at line 1460 of file syz1.cc.

1461 {
1462  int result;
1463 
1464  if (syzstr->res[index]==NULL)
1465  {
1466  syzstr->res[index] = idInit(init-1,1);
1467  syzstr->truecomponents[index] = (int*)omAlloc0(init*sizeof(int));
1468  syzstr->ShiftedComponents[index] = (long*)omAlloc0(init*sizeof(long));
1469  if (index==0)
1470  {
1471  for (int i=0;i<init;i++)
1472  {
1473  syzstr->truecomponents[0][i] = i;
1474  syzstr->ShiftedComponents[0][i] = (i)*SYZ_SHIFT_BASE;
1475  }
1476  }
1477  syzstr->backcomponents[index] = (int*)omAlloc0(init*sizeof(int));
1478  syzstr->Howmuch[index] = (int*)omAlloc0(init*sizeof(int));
1479  syzstr->Firstelem[index] = (int*)omAlloc0(init*sizeof(int));
1480  syzstr->elemLength[index] = (int*)omAlloc0(init*sizeof(int));
1481  syzstr->orderedRes[index] = idInit(init-1,1);
1482  syzstr->sev[index] = (unsigned long*) omAlloc0(init*sizeof(unsigned long));
1483  result = 0;
1484  }
1485  else
1486  {
1487  result = IDELEMS(syzstr->res[index]);
1488  while ((result>0) && (syzstr->res[index]->m[result-1]==NULL)) result--;
1489  }
1490  return result;
1491 }
#define SYZ_SHIFT_BASE
Definition: syz.h:18

◆ syKillComputation()

void syKillComputation ( syStrategy  syzstr,
ring  r = currRing 
)

Definition at line 1496 of file syz1.cc.

1497 {
1498  if (syzstr->references>0)
1499  {
1500  (syzstr->references)--;
1501  }
1502  else
1503  {
1504  int i,j;
1505  if (syzstr->minres!=NULL)
1506  {
1507  for (i=0;i<syzstr->length;i++)
1508  {
1509  if (syzstr->minres[i]!=NULL)
1510  {
1511  id_Delete(&(syzstr->minres[i]),r);
1512  }
1513  }
1514  omFreeSize((ADDRESS)syzstr->minres,(syzstr->length+1)*sizeof(ideal));
1515  }
1516  if (syzstr->fullres!=NULL)
1517  {
1518  for (i=0;i<syzstr->length;i++)
1519  {
1520  if (syzstr->fullres[i]!=NULL)
1521  {
1522  id_Delete(&(syzstr->fullres[i]),r);
1523  }
1524  }
1525  omFreeSize((ADDRESS)syzstr->fullres,(syzstr->length+1)*sizeof(ideal));
1526  }
1527  if (syzstr->weights!=NULL)
1528  {
1529  for (i=0;i<syzstr->length;i++)
1530  {
1531  if (syzstr->weights[i]!=NULL)
1532  {
1533  delete syzstr->weights[i];
1534  }
1535  }
1536  omFreeSize((ADDRESS)syzstr->weights,syzstr->length*sizeof(intvec*));
1537  }
1538 
1539  ring sr=syzstr->syRing;
1540  if (sr==NULL) sr=r;
1541 
1542  if (syzstr->resPairs!=NULL)
1543  {
1544  for (i=0;i<syzstr->length;i++)
1545  {
1546  for (j=0;j<(*syzstr->Tl)[i];j++)
1547  {
1548  if ((syzstr->resPairs[i])[j].lcm!=NULL)
1549  p_Delete(&((syzstr->resPairs[i])[j].lcm),sr);
1550  if ((i>0) && ((syzstr->resPairs[i])[j].syz!=NULL))
1551  p_Delete(&((syzstr->resPairs[i])[j].syz),sr);
1552  }
1553  if (syzstr->orderedRes[i]!=NULL)
1554  {
1555  for (j=0;j<IDELEMS(syzstr->orderedRes[i]);j++)
1556  {
1557  syzstr->orderedRes[i]->m[j] = NULL;
1558  }
1559  id_Delete(&(syzstr->orderedRes[i]),sr);
1560  }
1561  if (syzstr->truecomponents[i]!=NULL)
1562  {
1563  omFreeSize((ADDRESS)syzstr->truecomponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1564  syzstr->truecomponents[i]=NULL;
1565  omFreeSize((ADDRESS)syzstr->ShiftedComponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(long));
1566  syzstr->ShiftedComponents[i]=NULL;
1567  }
1568  if (syzstr->backcomponents[i]!=NULL)
1569  {
1570  omFreeSize((ADDRESS)syzstr->backcomponents[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1571  syzstr->backcomponents[i]=NULL;
1572  }
1573  if (syzstr->Howmuch[i]!=NULL)
1574  {
1575  omFreeSize((ADDRESS)syzstr->Howmuch[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1576  syzstr->Howmuch[i]=NULL;
1577  }
1578  if (syzstr->Firstelem[i]!=NULL)
1579  {
1580  omFreeSize((ADDRESS)syzstr->Firstelem[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1581  syzstr->Firstelem[i]=NULL;
1582  }
1583  if (syzstr->elemLength[i]!=NULL)
1584  {
1585  omFreeSize((ADDRESS)syzstr->elemLength[i],(IDELEMS(syzstr->res[i])+1)*sizeof(int));
1586  syzstr->elemLength[i]=NULL;
1587  }
1588  if (syzstr->res[i]!=NULL)
1589  {
1590  for (j=0;j<IDELEMS(syzstr->res[i]);j++)
1591  {
1592  if (syzstr->res[i]->m[j]!=NULL)
1593  p_Delete(&(syzstr->res[i]->m[j]),sr);
1594  }
1595  }
1596  if ((syzstr->hilb_coeffs!=NULL)
1597  && (syzstr->hilb_coeffs[i]!=NULL))
1598  delete syzstr->hilb_coeffs[i];
1599  if (syzstr->sev[i] != NULL)
1600  omFreeSize((ADDRESS)syzstr->sev[i], (IDELEMS(syzstr->res[i])+1)*sizeof(unsigned long));
1601  id_Delete(&(syzstr->res[i]),sr);
1602  if (syzstr->resPairs[i] != NULL) // OB: ????
1603  omFreeSize((ADDRESS)syzstr->resPairs[i],(*syzstr->Tl)[i]*sizeof(SObject));
1604  }
1605  omFreeSize((ADDRESS)syzstr->resPairs,syzstr->length*sizeof(SObject*));
1606  omFreeSize((ADDRESS)syzstr->res,(syzstr->length+1)*sizeof(ideal));
1607  omFreeSize((ADDRESS)syzstr->orderedRes,(syzstr->length+1)*sizeof(ideal));
1608  omFreeSize((ADDRESS)syzstr->elemLength,(syzstr->length+1)*sizeof(int*));
1609  omFreeSize((ADDRESS)syzstr->truecomponents,(syzstr->length+1)*sizeof(int*));
1610  omFreeSize((ADDRESS)syzstr->ShiftedComponents,(syzstr->length+1)*sizeof(long*));
1611  if (syzstr->sev != NULL)
1612  omFreeSize(((ADDRESS)syzstr->sev), (syzstr->length+1)*sizeof(unsigned long*));
1613  omFreeSize((ADDRESS)syzstr->backcomponents,(syzstr->length+1)*sizeof(int*));
1614  omFreeSize((ADDRESS)syzstr->Howmuch,(syzstr->length+1)*sizeof(int*));
1615  omFreeSize((ADDRESS)syzstr->Firstelem,(syzstr->length+1)*sizeof(int*));
1616  if (syzstr->hilb_coeffs!=NULL)
1617  omFreeSize((ADDRESS)syzstr->hilb_coeffs,(syzstr->length+1)*sizeof(intvec*));
1618  }
1619  if (syzstr->cw!=NULL)
1620  delete syzstr->cw;
1621  if (syzstr->betti!=NULL)
1622  delete syzstr->betti;
1623  if (syzstr->resolution!=NULL)
1624  delete syzstr->resolution;
1625  if (syzstr->Tl!=NULL)
1626  delete syzstr->Tl;
1627  if ((syzstr->syRing != NULL) && (syzstr->syRing != r))
1628  {
1629  if(syzstr->syRing->typ[1].ord_typ == ro_syzcomp)
1630  rChangeSComps(NULL, NULL, 0, syzstr->syRing);
1631 
1632  rDelete(syzstr->syRing);
1633  }
1634  omFreeSize((ADDRESS)syzstr, sizeof(ssyStrategy));
1635  }
1636 }
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
void rChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
Definition: ring.cc:4337
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:437
@ ro_syzcomp
Definition: ring.h:60
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
short references
Definition: syz.h:63
intvec * resolution
Definition: syz.h:51

◆ syKillEmptyEntres()

void syKillEmptyEntres ( resolvente  res,
int  length 
)

Definition at line 2201 of file syz1.cc.

2202 {
2203  int i,j,jj,k,rj;
2204  intvec * changes;
2205  poly p;
2206  ideal ri;
2207 
2208  for (i=0;i<length;i++)
2209  {
2210  ri = res[i];
2211  if (ri!=NULL)
2212  {
2213  rj = IDELEMS(ri);
2214  changes = new intvec(rj+1,1,-1);
2215  while ((rj>0) && (ri->m[rj-1]==NULL)) rj--;
2216  j = k = 0;
2217  while (j+k<rj)
2218  {
2219  if (ri->m[j+k]!=NULL)
2220  {
2221  ri->m[j] = ri->m[j+k];
2222  (*changes)[j+k+1] = j+1;
2223  j++;
2224  }
2225  else
2226  {
2227  k++;
2228  }
2229  }
2230  for (jj=j;jj<rj;jj++)
2231  ri->m[jj] = NULL;
2232  if (res[i+1]!=NULL)
2233  {
2234  ri = res[i+1];
2235  for (j=IDELEMS(ri)-1;j>=0;j--)
2236  {
2237  p = ri->m[j];
2238  while (p!=NULL)
2239  {
2240  pSetComp(p,(*changes)[pGetComp(p)]);
2241  pSetm(p);
2242  pIter(p);
2243  }
2244  }
2245  }
2246  delete changes;
2247  }
2248  }
2249 }
if(yy_init)
Definition: libparse.cc:1418
#define pIter(p)
Definition: monomials.h:38
#define pSetm(p)
Definition: polys.h:265
#define pSetComp(p, v)
Definition: polys.h:38

◆ 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);
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 }
ideal idCopy(ideal A)
Definition: ideals.h:60
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:30
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2822
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define nIsOne(n)
Definition: numbers.h:26
#define pLmEqual(p1, p2)
Definition: polys.h:111
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:357
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:192
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:261
ring rAssure_C_dp(const ring r)
Definition: ring.cc:4890
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint)
Definition: simpleideals.cc:59
void id_Shift(ideal M, int s, const ring r)
static ideal syAppendSyz(ideal new_generators, syStrategy syzstr, int index, int crit_comp, resolvente totake)
Definition: syz3.cc:1688
static void syCreateRegularExtension(syStrategy syzstr, ideal old_ideal, ideal old_repr, int old_tl, poly next_generator, resolvente totake)
Definition: syz3.cc:112
void syReorder_Kosz(syStrategy syzstr)
Definition: syz3.cc:262
int discard_pairs
Definition: syz3.cc:49
int short_pairs
Definition: syz3.cc:50
static BOOLEAN syIsRegular(ideal old_ideal, ideal new_ideal, int deg)
Definition: syz3.cc:56
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition: syz0.cc:856
int regularity
Definition: syz.h:61

◆ syLaScala()

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

Definition at line 2560 of file syz1.cc.

2561 {
2562  int i,j,actdeg=32000,index=0;
2563  int howmuch;
2564  ideal temp;
2565  SSet nextPairs;
2566  syStrategy syzstr=(syStrategy)omAlloc0(sizeof(ssyStrategy));
2567  ring origR = currRing;
2568 
2569  if(weights!= NULL)
2570  syzstr->cw = new intvec(weights);
2571  else
2572  syzstr->cw = NULL;
2573 
2574  if ((idIs0(arg)) ||
2575  ((id_RankFreeModule(arg,currRing)>0) && (!idTestHomModule(arg, NULL, syzstr->cw))))
2576  {
2578  syzstr->length = 1;
2579  syzstr->minres[0] = idInit(1,arg->rank);
2580  return syzstr;
2581  }
2582 
2583 
2584  //crit = 0;
2585  //euler = -1;
2586 
2587  if( maxlength > 0 )
2588  syzstr->length = maxlength; // = (currRing->N)+2;
2589  else
2590  syzstr->length = maxlength = (currRing->N)+2;
2591 
2592  // Creare dp,S ring and change to it
2593  syzstr->syRing = rAssure_dp_S(origR);
2594  assume(syzstr->syRing != origR);
2595  assume(syzstr->syRing->typ[1].ord_typ == ro_syzcomp);
2596  rChangeCurrRing(syzstr->syRing);
2597 
2598  // set initial ShiftedComps
2599  currcomponents = (int*)omAlloc0((arg->rank+1)*sizeof(int));
2600  currShiftedComponents = (long*)omAlloc0((arg->rank+1)*sizeof(long));
2601  for (i=0;i<=arg->rank;i++)
2602  {
2604  currcomponents[i] = i;
2605  }
2607 /*--- initializes the data structures---------------*/
2608  syzstr->Tl = new intvec(maxlength);
2609  temp = idInit(IDELEMS(arg),arg->rank);
2610  for (i=0;i<IDELEMS(arg);i++)
2611  {
2612  temp->m[i] = prCopyR( arg->m[i], origR, currRing);
2613  if (temp->m[i]!=NULL)
2614  {
2615  j = pTotaldegree(temp->m[i]);
2616  if (j<actdeg) actdeg = j;
2617  }
2618  }
2619  idTest(temp);
2620  idSkipZeroes(temp);
2621  idTest(temp);
2622  syzstr->resPairs = syInitRes(temp,&maxlength,syzstr->Tl,syzstr->cw);
2623  omFreeSize((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int));
2624  omFreeSize((ADDRESS)currShiftedComponents,(arg->rank+1)*sizeof(long));
2625 
2626  syzstr->res = (resolvente)omAlloc0((maxlength+1)*sizeof(ideal));
2627  syzstr->orderedRes = (resolvente)omAlloc0((maxlength+1)*sizeof(ideal));
2628  syzstr->elemLength = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2629 
2630  syzstr->truecomponents = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2631  syzstr->ShiftedComponents = (long**)omAlloc0((maxlength+1)*sizeof(long*));
2632 
2633  syzstr->backcomponents = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2634  syzstr->Howmuch = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2635  syzstr->Firstelem = (int**)omAlloc0((maxlength+1)*sizeof(int*));
2636  syzstr->sev = (unsigned long **) omAlloc0((maxlength+1)*sizeof(unsigned long *));
2637 
2638  assume( syzstr->length == maxlength );
2639 
2640  syzstr->bucket = kBucketCreate(currRing);
2641  int len0=id_RankFreeModule(temp,currRing)+1;
2642 
2643  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
2644  //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
2645 /*--- computes the resolution ----------------------*/
2646  while (nextPairs!=NULL)
2647  {
2648  if (TEST_OPT_PROT) Print("%d",actdeg);
2649  if (TEST_OPT_PROT) Print("(m%d)",index);
2650  if (index==0)
2651  i = syInitSyzMod(syzstr,index,len0);
2652  else
2653  i = syInitSyzMod(syzstr,index);
2654  currcomponents = syzstr->truecomponents[si_max(index-1,0)];
2657  IDELEMS(syzstr->res[si_max(index-1,0)]), currRing);
2658  j = syInitSyzMod(syzstr,index+1);
2659  if (index>0)
2660  {
2661  syRedNextPairs(nextPairs,syzstr,howmuch,index);
2662  syCompactifyPairSet(syzstr->resPairs[index],(*syzstr->Tl)[index],0);
2663  }
2664  else
2665  syRedGenerOfCurrDeg(syzstr,actdeg,index+1);
2666 /*--- creates new pairs -----------------------------*/
2667  syCreateNewPairs(syzstr,index,i);
2668  if (index<(maxlength-1))
2669  {
2670  syCreateNewPairs(syzstr,index+1,j);
2671  }
2672  index++;
2673  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
2674  //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
2675  }
2676  if (temp!=NULL) idDelete(&temp);
2677  kBucketDestroy(&(syzstr->bucket));
2678  if (origR != syzstr->syRing)
2679  rChangeCurrRing(origR);
2680  if (TEST_OPT_PROT) PrintLn();
2681  return syzstr;
2682 }
#define assume(x)
Definition: mod2.h:390
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
ring rAssure_dp_S(const ring r)
Definition: ring.cc:4880
omBin char_ptr_bin
Definition: ring.cc:45
SRes syInitRes(ideal arg, int *length, intvec *Tl, intvec *cw)
Definition: syz1.cc:294
static void syCreateNewPairs(syStrategy syzstr, int index, int newEl)
Definition: syz1.cc:1070
void syCompactifyPairSet(SSet sPairs, int sPlength, int first)
Definition: syz1.cc:105
static void syRedGenerOfCurrDeg(syStrategy syzstr, int deg, int index)
Definition: syz1.cc:916
int syInitSyzMod(syStrategy syzstr, int index, int init)
Definition: syz1.cc:1460
int * currcomponents
Definition: syz1.cc:34
long * currShiftedComponents
Definition: syz1.cc:35
static void syRedNextPairs(SSet nextPairs, syStrategy syzstr, int howmuch, int index)
Definition: syz1.cc:769
SSet syChosePairs(syStrategy syzstr, int *index, int *howmuch, int *actdeg)
Definition: syz1.cc:1289

◆ 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  syzstr->length = *length = (currRing->N)+2;
2455 
2456  // Creare dp,S ring and change to it
2457  syzstr->syRing = rAssure_dp_S(origR);
2458  assume(syzstr->syRing != origR); // why?
2459  rChangeCurrRing(syzstr->syRing);
2460 
2461  // set initial ShiftedComps
2462  currcomponents = (int*)omAlloc0((arg->rank+1)*sizeof(int));
2463  currShiftedComponents = (long*)omAlloc0((arg->rank+1)*sizeof(long));
2464  for (i=0;i<=arg->rank;i++)
2465  {
2467  currcomponents[i] = i;
2468  }
2470 /*--- initializes the data structures---------------*/
2471  syzstr->Tl = new intvec(*length);
2472  temp = idInit(IDELEMS(arg),arg->rank);
2473  for (i=0;i<IDELEMS(arg);i++)
2474  {
2475  temp->m[i] = prCopyR( arg->m[i], origR, syzstr->syRing);
2476  if (temp->m[i]!=NULL)
2477  {
2478  j = pTotaldegree(temp->m[i]);
2479  if (j<actdeg) actdeg = j;
2480  }
2481  }
2482  idTest(temp);
2483  idSkipZeroes(temp);
2484  idTest(temp);
2485  syzstr->resPairs = syInitRes(temp,length,syzstr->Tl,syzstr->cw);
2486  omFreeSize((ADDRESS)currcomponents,(arg->rank+1)*sizeof(int));
2487  omFreeSize((ADDRESS)currShiftedComponents,(arg->rank+1)*sizeof(long));
2488  syzstr->res = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
2489  syzstr->orderedRes = (resolvente)omAlloc0((*length+1)*sizeof(ideal));
2490  syzstr->elemLength = (int**)omAlloc0((*length+1)*sizeof(int*));
2491  syzstr->truecomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
2492  syzstr->ShiftedComponents = (long**)omAlloc0((*length+1)*sizeof(long*));
2493  syzstr->backcomponents = (int**)omAlloc0((*length+1)*sizeof(int*));
2494  syzstr->Howmuch = (int**)omAlloc0((*length+1)*sizeof(int*));
2495  syzstr->Firstelem = (int**)omAlloc0((*length+1)*sizeof(int*));
2496  syzstr->sev = (unsigned long **) omAlloc0((*length+1)*sizeof(unsigned long *));
2497  syzstr->bucket = kBucketCreate(currRing);
2498  int len0=id_RankFreeModule(temp,currRing)+1;
2499 
2500  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
2501  //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
2502 /*--- computes the resolution ----------------------*/
2503  while (nextPairs!=NULL)
2504  {
2505  if (TEST_OPT_PROT) Print("%d",actdeg);
2506  if (TEST_OPT_PROT) Print("(m%d)",index);
2507  if (index==0)
2508  i = syInitSyzMod(syzstr,index,len0);
2509  else
2510  i = syInitSyzMod(syzstr,index);
2511  currcomponents = syzstr->truecomponents[si_max(index-1,0)];
2514  IDELEMS(syzstr->res[si_max(index-1,0)]), currRing);
2515  j = syInitSyzMod(syzstr,index+1);
2516  if (index>0)
2517  {
2518  syRedNextPairs(nextPairs,syzstr,howmuch,index);
2519  syCompactifyPairSet(syzstr->resPairs[index],(*syzstr->Tl)[index],0);
2520  }
2521  else
2522  syRedGenerOfCurrDeg(syzstr,actdeg,index+1);
2523 /*--- creates new pairs -----------------------------*/
2524  syCreateNewPairs(syzstr,index,i);
2525  if (index<(*length)-1)
2526  {
2527  syCreateNewPairs(syzstr,index+1,j);
2528  }
2529  index++;
2530  nextPairs = syChosePairs(syzstr,&index,&howmuch,&actdeg);
2531  //if (TEST_OPT_PROT) Print("(%d,%d)",howmuch,index);
2532  }
2533  if (temp!=NULL) idDelete(&temp);
2534  kBucketDestroy(&(syzstr->bucket));
2535 
2536  if (origR != syzstr->syRing)
2537  rChangeCurrRing(origR);
2538 
2539  if (TEST_OPT_PROT) PrintLn();
2540 
2541  assume(syzstr->minres==NULL); assume(syzstr->fullres ==NULL);
2542  assume(syzstr->resPairs!=NULL); assume(syzstr->hilb_coeffs==NULL);
2543  assume(syzstr->res!=NULL);
2544 
2545  if(! TEST_OPT_NO_SYZ_MINIM )
2546  syzstr->minres = syReadOutMinimalRes(syzstr);
2547  else
2548  syzstr->fullres = syReorder(syzstr->res, syzstr->length, syzstr); // buggy? (betti...?)
2549 
2550  return syzstr;
2551 }
#define TEST_OPT_NO_SYZ_MINIM
Definition: options.h:122
static resolvente syReadOutMinimalRes(syStrategy syzstr, BOOLEAN computeStd=FALSE)
Definition: syz1.cc:2314

◆ syMinBase()

ideal syMinBase ( ideal  arg)

Definition at line 1005 of file syz.cc.

1006 {
1007  intvec ** weights=NULL;
1008  int leng;
1009  if (idIs0(arg)) return idInit(1,arg->rank);
1010  resolvente res=syResolvente(arg,1,&leng,&weights,TRUE);
1011  ideal result=res[0];
1012  omFreeSize((ADDRESS)res,leng*sizeof(ideal));
1013  if (weights!=NULL)
1014  {
1015  if (*weights!=NULL)
1016  {
1017  delete (*weights);
1018  *weights=NULL;
1019  }
1020  if ((leng>=1) && (*(weights+1)!=NULL))
1021  {
1022  delete *(weights+1);
1023  *(weights+1)=NULL;
1024  }
1025  }
1027  return result;
1028 }
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
Definition: syz.cc:390

◆ syMinimize()

syStrategy syMinimize ( syStrategy  syzstr)

Definition at line 2395 of file syz1.cc.

2396 {
2397  if (syzstr->minres==NULL)
2398  {
2399  if (syzstr->resolution!=NULL)
2400  {
2401  // need to clear syzstr->resolution, as we are
2402  // now displaying the minres instead of fullres
2403  delete syzstr->resolution;
2404  syzstr->resolution=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 }
void syMinimizeResolvente(resolvente res, int length, int first)
Definition: syz.cc:356

◆ syMinimizeResolvente()

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

Definition at line 356 of file syz.cc.

357 {
358  int syzIndex=first;
359  intvec *dummy;
360 
361  if (syzIndex<1) syzIndex=1;
362  if ((syzIndex==1) && (!rIsPluralRing(currRing)) && (idHomModule(res[0],currRing->qideal,&dummy)))
363  {
365  delete dummy;
366  return;
367  }
368  while ((syzIndex<length-1) && (res[syzIndex]!=NULL) && (res[syzIndex+1]!=NULL))
369  {
370  syMinStep(res[syzIndex-1],res[syzIndex],FALSE,res[syzIndex+1]);
371  syzIndex++;
372  }
373  if (res[syzIndex]!=NULL)
374  syMinStep(res[syzIndex-1],res[syzIndex]);
375  if (!idIs0(res[0]))
376  idMinEmbedding(res[0],TRUE);
377 }
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition: ideals.cc:2565
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
static void syMinStep1(resolvente res, int length)
Definition: syz.cc:290
static void syMinStep(ideal mod, ideal &syz, BOOLEAN final=FALSE, ideal up=NULL, tHomog h=isNotHomog)
Definition: syz.cc:83

◆ syPrint()

void syPrint ( syStrategy  syzstr,
const char *  currRingName 
)

Definition at line 1935 of file syz1.cc.

1936 {
1937  if ( (syzstr->resPairs==NULL) &&
1938  (syzstr->fullres==NULL) &&
1939  (syzstr->minres==NULL) &&
1940  (syzstr->resolution == NULL) )
1941  {
1942  PrintS("No resolution defined\n");
1943  return;
1944  }
1945 
1946  intvec* resolution = syzstr->resolution;
1947 
1948  if (resolution==NULL)
1949  {
1950  if (syzstr->resPairs!=NULL)
1951  {
1952  resolution = new intvec(syzstr->length+1);
1953  SRes rP = syzstr->resPairs;
1954 // assume(idRankFreeModule(syzstr->res[1], (syzstr->syRing != NULL ? syzstr->syRing : currRing))==syzstr->res[1]->rank);
1955  (*resolution)[0] = syzstr->res[1]->rank;
1956  int k=0;
1957  while ((k<syzstr->length) && (rP[k]!=NULL))
1958  {
1959  int j = 0;
1960  while ((j<(*syzstr->Tl)[k]) &&
1961  ((rP[k][j].lcm!=NULL) || (rP[k][j].syz!=NULL)))
1962  {
1963  if (rP[k][j].isNotMinimal==NULL)
1964  ((*resolution)[k+1])++;
1965  j++;
1966  }
1967  k++;
1968  }
1969  }
1970  else
1971  {
1972  resolution = new intvec(syzstr->length+2);
1973  resolvente rr;
1974  if (syzstr->minres!=NULL)
1975  rr = syzstr->minres;
1976  else
1977  rr = syzstr->fullres;
1978  (*resolution)[0]
1979  = si_max(1,(int)id_RankFreeModule(rr[0],
1980  (syzstr->syRing != NULL ? syzstr->syRing : currRing)));
1981  int k=0;
1982  while ((k<syzstr->length) && (rr[k]!=NULL))
1983  {
1984  (*resolution)[k+1] = idElem(rr[k]);
1985  k++;
1986  }
1987  }
1988  }
1989 
1990  int sl=strlen(sn);
1991  syPrintEmptySpaces1(sl);
1992  int k = 0;
1993  loop
1994  {
1995  if ((k>=resolution->length()) || ((*resolution)[k]==0))
1996  break;
1997  Print("%d",(*resolution)[k]);
1998  syPrintEmptySpaces1(sl+5);
1999  k++;
2000  }
2001  PrintLn();
2002  k = 0;
2003  loop
2004  {
2005  if ((k>=resolution->length()) || ((*resolution)[k]==0))
2006  break;
2007  PrintS(sn);
2008  if (((k+1)>=resolution->length()) || ((*resolution)[(k+1)]==0))
2009  break;
2010  PrintS(" <-- ");
2011  syPrintEmptySpaces((*resolution)[k]);
2012  k++;
2013  }
2014  PrintLn();
2015  PrintLn();
2016  k = 0;
2017  loop
2018  {
2019  if ((k>=resolution->length()) || ((*resolution)[k]==0))
2020  break;
2021  Print("%d",k);
2022  syPrintEmptySpaces1(sl+5+syLengthInt((*resolution)[k])-
2023  syLengthInt(k));
2024  k++;
2025  }
2026  PrintLn();
2027  if (syzstr->minres==NULL)
2028  {
2029  PrintS("resolution not minimized yet\n");
2030  }
2031 
2032  if (syzstr->resolution == NULL) syzstr->resolution = resolution;
2033 }
int idElem(const ideal F)
count non-zero elements
static int syLengthInt(int i)
Definition: syz1.cc:1919
static void syPrintEmptySpaces1(int i)
Definition: syz1.cc:1907
static void syPrintEmptySpaces(int i)
Definition: syz1.cc:1895

◆ syReorder()

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

Definition at line 1642 of file syz1.cc.

1644 {
1645  int i,j,l;
1646  poly p,q,tq;
1647  polyset ri1;
1648  resolvente fullres;
1649  ring origR=syzstr->syRing;
1650  fullres = (resolvente)omAlloc0((length+1)*sizeof(ideal));
1651  if (totake==NULL)
1652  totake = res;
1653  for (i=length-1;i>0;i--)
1654  {
1655  if (res[i]!=NULL)
1656  {
1657  if (i>1)
1658  {
1659  j = IDELEMS(res[i-1]);
1660  while ((j>0) && (res[i-1]->m[j-1]==NULL)) j--;
1661  fullres[i-1] = idInit(IDELEMS(res[i]),j);
1662  ri1 = totake[i-1]->m;
1663  for (j=IDELEMS(res[i])-1;j>=0;j--)
1664  {
1665  p = res[i]->m[j];
1666  q = NULL;
1667  while (p!=NULL)
1668  {
1669  if (toCopy)
1670  {
1671  if (origR!=NULL)
1672  tq = prHeadR(p,origR, currRing);
1673  else
1674  tq = pHead(p);
1675  pIter(p);
1676  }
1677  else
1678  {
1679  res[i]->m[j] = NULL;
1680  if (origR!=NULL)
1681  {
1682  poly pp=p;
1683  pIter(p);
1684  pNext(pp)=NULL;
1685  tq = prMoveR(pp, origR, currRing);
1686  }
1687  else
1688  {
1689  tq = p;
1690  pIter(p);
1691  pNext(tq) = NULL;
1692  }
1693  }
1694 // pWrite(tq);
1695  pTest(tq);
1696  for (l=(currRing->N);l>0;l--)
1697  {
1698  if (origR!=NULL)
1699  pSubExp(tq,l, p_GetExp(ri1[pGetComp(tq)-1],l,origR));
1700  else
1701  pSubExp(tq,l, pGetExp(ri1[pGetComp(tq)-1],l));
1702  }
1703  pSetm(tq);
1704  pTest(tq);
1705  q = pAdd(q,tq);
1706  pTest(q);
1707  }
1708  fullres[i-1]->m[j] = q;
1709  }
1710  }
1711  else
1712  {
1713  if (origR!=NULL)
1714  {
1715  fullres[i-1] = idInit(IDELEMS(res[i]),res[i]->rank);
1716  for (j=IDELEMS(res[i])-1;j>=0;j--)
1717  {
1718  if (toCopy)
1719  fullres[i-1]->m[j] = prCopyR(res[i]->m[j], origR, currRing);
1720  else
1721  {
1722  fullres[i-1]->m[j] = prMoveR(res[i]->m[j], origR, currRing);
1723  res[i]->m[j] = NULL;
1724  }
1725  }
1726  }
1727  else
1728  {
1729  if (toCopy)
1730  fullres[i-1] = idCopy(res[i]);
1731  else
1732  {
1733  fullres[i-1] = res[i];
1734  res[i] = NULL;
1735  }
1736  }
1737  for (j=IDELEMS(fullres[i-1])-1;j>=0;j--)
1738  fullres[i-1]->m[j] = pSortCompCorrect(fullres[i-1]->m[j]);
1739  }
1740  if (!toCopy)
1741  {
1742  if (res[i]!=NULL) idDelete(&res[i]);
1743  }
1744  }
1745  }
1746  if (!toCopy)
1747  omFreeSize((ADDRESS)res,(length+1)*sizeof(ideal));
1748  //syzstr->length = length;
1749  return fullres;
1750 }
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
#define pNext(p)
Definition: monomials.h:37
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
#define pAdd(p, q)
Definition: polys.h:198
#define pTest(p)
Definition: polys.h:409
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
#define pSubExp(p, i, v)
Definition: polys.h:46
poly * polyset
Definition: polys.h:254
#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:222
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:90
poly prHeadR(poly p, ring src_r, ring dest_r, prCopyProc_t prproc)
Definition: prCopy.cc:126

◆ syReOrderResolventFB()

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

Definition at line 741 of file syz0.cc.

742 {
743  int syzIndex=length-1,i,j;
744  poly p;
745 
746  while ((syzIndex!=0) && (res[syzIndex]==NULL)) syzIndex--;
747  while (syzIndex>=initial)
748  {
749  for(i=0;i<IDELEMS(res[syzIndex]);i++)
750  {
751  p = res[syzIndex]->m[i];
752 
753  while (p!=NULL)
754  {
755  if (res[syzIndex-1]->m[pGetComp(p)-1]!=NULL)
756  {
757  for(j=1;j<=(currRing->N);j++)
758  {
759  pSetExp(p,j,pGetExp(p,j)
760  -pGetExp(res[syzIndex-1]->m[pGetComp(p)-1],j));
761  }
762  }
763  else
764  PrintS("error in the resolvent\n");
765  pSetm(p);
766  pIter(p);
767  }
768  }
769  syzIndex--;
770  }
771 }
#define pSetExp(p, i, v)
Definition: polys.h:42

◆ syReorderShiftedComponents()

long syReorderShiftedComponents ( long *  sc,
int  n 
)

Definition at line 335 of file syz1.cc.

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

◆ syResetShiftedComponents()

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

Definition at line 410 of file syz1.cc.

411 {
412  assume(index > 0);
413  int i;
414  if (syzstr->res[index] != NULL)
415  {
416  long * prev_s;
417  int* prev_c;
418  int p_length;
419  rGetSComps(&prev_c, &prev_s, &p_length, currRing);
420  currcomponents = syzstr->truecomponents[index-1];
424  IDELEMS(syzstr->res[index-1]), currRing);
425  if (hilb==0)
426  {
427  ideal id = syzstr->res[index];
428  for (i=0; i<IDELEMS(id); i++)
429  {
430  pResetSetm(id->m[i]);
431  }
432  }
433  else if (hilb==1)
434  {
435  assume (index>1);
436  assume (syzstr->resPairs[index-1]!=NULL);
437  SSet Pairs=syzstr->resPairs[index-1];
438  SSet Pairs1=syzstr->resPairs[index];
439  int till=(*syzstr->Tl)[index-1];
440  for (i=0;i<till;i++)
441  {
442  if (Pairs[i].syz!=NULL)
443  pResetSetm(Pairs[i].syz);
444  }
445  till=(*syzstr->Tl)[index];
446  for (i=0;i<till;i++)
447  {
448  if (Pairs1[i].p!=NULL)
449  pResetSetm(Pairs1[i].p);
450  }
451  }
452  currcomponents = prev_c;
453  currShiftedComponents = prev_s;
454  rChangeSComps(prev_c, prev_s, p_length, currRing);
455  }
456 }
void rGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
Definition: ring.cc:4346
static void pResetSetm(poly p)
Definition: syz1.cc:395

◆ syResolution()

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

Definition at line 614 of file syz.cc.

615 {
616 
617 #ifdef HAVE_PLURAL
618  const ideal idSaveCurrRingQuotient = currRing->qideal;
619  if( rIsSCA(currRing) )
620  {
622  {
623  currRing->qideal = SCAQuotient(currRing);
624  }
625  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
626  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
627  arg = id_KillSquares(arg, m_iFirstAltVar, m_iLastAltVar, currRing, false); // kill suares in input!
628  }
629 #endif
630 
632 
633  if ((w!=NULL) && (!idTestHomModule(arg,currRing->qideal,w))) // is this right in SCA case???
634  {
635  WarnS("wrong weights given(2):");w->show();PrintLn();
636  idHomModule(arg,currRing->qideal,&w);
637  w->show();PrintLn();
638  w=NULL;
639  }
640  if (w!=NULL)
641  {
642  result->weights = (intvec**)omAlloc0Bin(char_ptr_bin);
643  (result->weights)[0] = ivCopy(w);
644  result->length = 1;
645  }
646  resolvente fr = syResolvente(arg,maxlength,&(result->length),&(result->weights),minim);
647  resolvente fr1;
648  if (minim)
649  {
650  result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
651  fr1 = result->minres;
652  }
653  else
654  {
655  result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
656  fr1 = result->fullres;
657  }
658  for (int i=result->length-1;i>=0;i--)
659  {
660  if (fr[i]!=NULL)
661  fr1[i] = fr[i];
662  fr[i] = NULL;
663  }
664  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
665 
666 #ifdef HAVE_PLURAL
667  if( rIsSCA(currRing) )
668  {
670  {
671  currRing->qideal = idSaveCurrRingQuotient;
672  }
673  id_Delete(&arg, currRing);
674  }
675 #endif
676 
677  return result;
678 }
static bool rIsSCA(const ring r)
Definition: nc.h:190
bool ncExtensions(int iMask)
Definition: old.gring.cc:94
const int TESTSYZSCAMASK
Definition: nc.h:342
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1520
ideal SCAQuotient(const ring r)
Definition: sca.h:10
static short scaLastAltVar(ring r)
Definition: sca.h:25
static short scaFirstAltVar(ring r)
Definition: sca.h:18

◆ syResolvente()

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

Definition at line 390 of file syz.cc.

392 {
393  BITSET save1;
394  SI_SAVE_OPT1(save1);
395  resolvente newres;
396  tHomog hom=isNotHomog;
397  intvec *w = NULL,**tempW;
398  int i,k,syzIndex = 0,j,rk_arg=si_max(1,(int)id_RankFreeModule(arg,currRing));
399  int Kstd1_OldDeg=Kstd1_deg;
400  BOOLEAN completeMinim;
401  BOOLEAN oldDegBound=TEST_OPT_DEGBOUND;
402  BOOLEAN setRegularity=TRUE;
403  int wlength=*length;
404 
405  if (maxlength!=-1) *length = maxlength+1;
406  else *length = 5;
407  if ((wlength!=0) && (*length!=wlength))
408  {
409  intvec **wtmp = (intvec**)omAlloc0((*length)*sizeof(intvec*));
410  wtmp[0]=(*weights)[0];
411  omFreeSize((ADDRESS)*weights,wlength*sizeof(intvec*));
412  *weights=wtmp;
413  }
414  resolvente res = (resolvente)omAlloc0((*length)*sizeof(ideal));
415 
416 /*--- initialize the syzygy-ring -----------------------------*/
417  ring origR = currRing;
418  ring syz_ring = rAssure_SyzComp(origR, TRUE); // will do rChangeCurrRing if needed
419  rSetSyzComp(rk_arg, syz_ring);
420 
421  if (syz_ring != origR)
422  {
423  rChangeCurrRing(syz_ring);
424  res[0] = idrCopyR_NoSort(arg, origR, syz_ring);
425  }
426  else
427  {
428  res[0] = idCopy(arg);
429  }
430 
431 /*--- creating weights for the module components ---------------*/
432  if ((weights!=NULL) && (*weights!=NULL)&& ((*weights)[0]!=NULL))
433  {
434  if (!idTestHomModule(res[0],currRing->qideal,(*weights)[0]))
435  {
436  WarnS("wrong weights given(1):"); (*weights)[0]->show();PrintLn();
437  idHomModule(res[0],currRing->qideal,&w);
438  w->show();PrintLn();
439  *weights=NULL;
440  }
441  }
442 
443  if ((weights==NULL) || (*weights==NULL) || ((*weights)[0]==NULL))
444  {
445  hom=(tHomog)idHomModule(res[0],currRing->qideal,&w);
446  if (hom==isHomog)
447  {
448  *weights = (intvec**)omAlloc0((*length)*sizeof(intvec*));
449  if (w!=NULL) (*weights)[0] = ivCopy(w);
450  }
451  }
452  else
453  {
454  if ((weights!=NULL) && (*weights!=NULL)&& ((*weights)[0]!=NULL))
455  {
456  w = ivCopy((*weights)[0]);
457  hom = isHomog;
458  }
459  }
460 
461 #ifdef HAVE_PLURAL
463  {
464 // quick solution; need theory to apply homog GB stuff for G-Algebras
465  hom = isNotHomog;
466  }
467 #endif // HAVE_PLURAL
468 
469  if (hom==isHomog)
470  {
471  intvec *w1 = syPrepareModComp(res[0],&w);
472  if (w!=NULL) { delete w;w=NULL; }
473  w = w1;
474  j = 0;
475  while ((j<IDELEMS(res[0])) && (res[0]->m[j]==NULL)) j++;
476  if (j<IDELEMS(res[0]))
477  {
478  if (p_FDeg(res[0]->m[j],currRing)!=pTotaldegree(res[0]->m[j]))
479  setRegularity = FALSE;
480  }
481  }
482  else
483  {
484  setRegularity = FALSE;
485  }
486 
487 /*--- the main loop --------------------------------------*/
488  while ((res[syzIndex]!=NULL) && (!idIs0(res[syzIndex])) &&
489  ((maxlength==-1) || (syzIndex<=maxlength)))
490  // (syzIndex<maxlength+(int)minim)))
491 /*--- compute one step more for minimizing-----------------*/
492  {
493  if (Kstd1_deg!=0) Kstd1_deg++;
494  if (syzIndex+1==*length)
495  {
496  newres = (resolvente)omAlloc0((*length+5)*sizeof(ideal));
497  tempW = (intvec**)omAlloc0((*length+5)*sizeof(intvec*));
498  for (j=0;j<*length;j++)
499  {
500  newres[j] = res[j];
501  if (*weights!=NULL) tempW[j] = (*weights)[j];
502  /*else tempW[j] = NULL;*/
503  }
504  omFreeSize((ADDRESS)res,*length*sizeof(ideal));
505  if (*weights != NULL) omFreeSize((ADDRESS)*weights,*length*sizeof(intvec*));
506  *length += 5;
507  res=newres;
508  *weights = tempW;
509  }
510 /*--- interreducing first -----------------------------------*/
511  if (syzIndex>0)
512  {
513  int rkI=id_RankFreeModule(res[syzIndex],currRing);
514  rSetSyzComp(rkI, currRing);
515  }
516  if(! TEST_OPT_NO_SYZ_MINIM )
517  if (minim || (syzIndex!=0))
518  {
519  ideal temp = kInterRedOld(res[syzIndex],currRing->qideal);
520  idDelete(&res[syzIndex]);
521  idSkipZeroes(temp);
522  res[syzIndex] = temp;
523  }
524 /*--- computing the syzygy modules --------------------------------*/
525  if ((currRing->qideal==NULL)&&(syzIndex==0)&& (!TEST_OPT_DEGBOUND))
526  {
527  res[/*syzIndex+*/1] = idSyzygies(res[0/*syzIndex*/],hom,&w,FALSE,setRegularity,&Kstd1_deg);
528  if ((!TEST_OPT_NOTREGULARITY) && (Kstd1_deg>0)
529  && (!rField_is_Ring(currRing))
531  }
532  else
533  {
534  res[syzIndex+1] = idSyzygies(res[syzIndex],hom,&w,FALSE);
535  }
536  completeMinim=(syzIndex!=maxlength) || (maxlength ==-1) || (hom!=isHomog);
537  syzIndex++;
538  if (TEST_OPT_PROT) Print("[%d]\n",syzIndex);
539 
540  if(! TEST_OPT_NO_SYZ_MINIM )
541  {
542  if ((minim)||(syzIndex>1))
543  syMinStep(res[syzIndex-1],res[syzIndex],!completeMinim,NULL,hom);
544  if (!completeMinim)
545  /*minim is TRUE, we are in the module: maxlength, maxlength <>0*/
546  {
547  idDelete(&res[syzIndex]);
548  }
549  }
550 /*---creating the iterated weights for module components ---------*/
551  if ((hom == isHomog) && (res[syzIndex]!=NULL) && (!idIs0(res[syzIndex])))
552  {
553 //Print("die %d Modulegewichte sind:\n",w1->length());
554 //w1->show();
555 //PrintLn();
556  int max_comp = id_RankFreeModule(res[syzIndex],currRing);
557  k = max_comp - rGetCurrSyzLimit(currRing);
558  assume(w != NULL);
559  if (w != NULL)
560  w->resize(max_comp+IDELEMS(res[syzIndex]));
561  else
562  w = new intvec(max_comp+IDELEMS(res[syzIndex]));
563  (*weights)[syzIndex] = new intvec(k);
564  for (i=0;i<k;i++)
565  {
566  if (res[syzIndex-1]->m[i]!=NULL) // hs
567  {
568  (*w)[i + rGetCurrSyzLimit(currRing)] = p_FDeg(res[syzIndex-1]->m[i],currRing);
569  if (pGetComp(res[syzIndex-1]->m[i])>0)
570  (*w)[i + rGetCurrSyzLimit(currRing)]
571  += (*w)[pGetComp(res[syzIndex-1]->m[i])-1];
572  (*((*weights)[syzIndex]))[i] = (*w)[i+rGetCurrSyzLimit(currRing)];
573  }
574  }
575  for (i=k;i<k+IDELEMS(res[syzIndex]);i++)
576  {
577  if (res[syzIndex]->m[i-k]!=NULL)
578  (*w)[i+rGetCurrSyzLimit(currRing)] = p_FDeg(res[syzIndex]->m[i-k],currRing)
579  +(*w)[pGetComp(res[syzIndex]->m[i-k])-1];
580  }
581  }
582  }
583 /*--- end of the main loop --------------------------------------*/
584 /*--- deleting the temporare data structures --------------------*/
585  if ((syzIndex!=0) && (res[syzIndex]!=NULL) && (idIs0(res[syzIndex])))
586  idDelete(&res[syzIndex]);
587  if (w !=NULL) delete w;
588 
589  Kstd1_deg=Kstd1_OldDeg;
590  if (!oldDegBound)
592 
593  for (i=1; i<=syzIndex; i++)
594  {
595  if ((res[i]!=NULL) && ! idIs0(res[i]))
596  {
598  }
599  }
600 /*--- going back to the original ring -------------------------*/
601  if (origR != syz_ring)
602  {
603  rChangeCurrRing(origR); // should not be needed now?
604  for (i=0; i<=syzIndex; i++)
605  {
606  res[i] = idrMoveR_NoSort(res[i], syz_ring, origR);
607  }
608  rDelete(syz_ring);
609  }
610  SI_RESTORE_OPT1(save1);
611  return res;
612 }
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:730
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:3028
int Kstd1_deg
Definition: kstd1.h:47
unsigned si_opt_1
Definition: options.c:5
#define SI_SAVE_OPT1(A)
Definition: options.h:22
#define SI_RESTORE_OPT1(A)
Definition: options.h:25
#define Sy_bit(x)
Definition: options.h:32
#define TEST_OPT_DEGBOUND
Definition: options.h:112
#define TEST_OPT_NOTREGULARITY
Definition: options.h:118
#define OPT_DEGBOUND
Definition: options.h:89
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:205
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4367
int rGetMaxSyzComp(int i, const ring r)
return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit
Definition: ring.cc:5063
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4991
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:713
tHomog
Definition: structs.h:38
@ isNotHomog
Definition: structs.h:39
#define BITSET
Definition: structs.h:18
static intvec * syPrepareModComp(ideal arg, intvec **w)
Definition: syz.cc:26

◆ sySchreyer()

syStrategy sySchreyer ( ideal  arg,
int  maxlength 
)

Definition at line 1019 of file syz0.cc.

1020 {
1021  int rl;
1022  resolvente fr = sySchreyerResolvente(arg,maxlength,&(rl));
1023  if (fr==NULL) return NULL;
1024 
1025  // int typ0;
1027  result->length=rl;
1028  result->fullres = (resolvente)omAlloc0((rl /*result->length*/+1)*sizeof(ideal));
1029  for (int i=rl /*result->length*/-1;i>=0;i--)
1030  {
1031  if (fr[i]!=NULL)
1032  {
1033  result->fullres[i] = fr[i];
1034  fr[i] = NULL;
1035  }
1036  }
1037  if (currRing->qideal!=NULL)
1038  {
1039  for (int i=0; i<rl; i++)
1040  {
1041  if (result->fullres[i]!=NULL)
1042  {
1043  ideal t=kNF(currRing->qideal,NULL,result->fullres[i]);
1044  idDelete(&result->fullres[i]);
1045  result->fullres[i]=t;
1046  if (i<rl-1)
1047  {
1048  for(int j=IDELEMS(t)-1;j>=0; j--)
1049  {
1050  if ((t->m[j]==NULL) && (result->fullres[i+1]!=NULL))
1051  {
1052  for(int k=IDELEMS(result->fullres[i+1])-1;k>=0; k--)
1053  {
1054  if (result->fullres[i+1]->m[k]!=NULL)
1055  {
1056  pDeleteComp(&(result->fullres[i+1]->m[k]),j+1);
1057  }
1058  }
1059  }
1060  }
1061  }
1062  idSkipZeroes(result->fullres[i]);
1063  }
1064  }
1065  if ((rl>maxlength) && (result->fullres[rl-1]!=NULL))
1066  {
1067  idDelete(&result->fullres[rl-1]);
1068  }
1069  }
1070  omFreeSize((ADDRESS)fr,(rl /*result->length*/)*sizeof(ideal));
1071  return result;
1072 }
#define pDeleteComp(p, k)
Definition: polys.h:355
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial, BOOLEAN)
Definition: syz0.cc:856

◆ sySchreyerResolvente()

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

Definition at line 856 of file syz0.cc.

858 {
859  ideal mW=NULL;
860  int i,syzIndex = 0,j=0;
861  intvec * modcomp=NULL,*w=NULL;
862  // int ** wv=NULL;
863  tHomog hom=(tHomog)idHomModule(arg,NULL,&w);
864  ring origR = currRing;
865  ring syRing = NULL;
866 
867  if ((!isMonomial) && syTestOrder(arg))
868  {
869  WerrorS("sres only implemented for modules with ordering ..,c or ..,C");
870  return NULL;
871  }
872  *length = 4;
873  resolvente res = (resolvente)omAlloc0(4*sizeof(ideal)),newres;
874  res[0] = idCopy(arg);
875 
876  while ((!idIs0(res[syzIndex])) && ((maxlength==-1) || (syzIndex<maxlength)))
877  {
878  i = IDELEMS(res[syzIndex]);
879  //while ((i!=0) && (!res[syzIndex]->m[i-1])) i--;
880  if (syzIndex+1==*length)
881  {
882  newres = (resolvente)omAlloc0((*length+4)*sizeof(ideal));
883  // for (j=0;j<*length+4;j++) newres[j] = NULL;
884  for (j=0;j<*length;j++) newres[j] = res[j];
885  omFreeSize((ADDRESS)res,*length*sizeof(ideal));
886  *length += 4;
887  res=newres;
888  }
889 
890  if ((hom==isHomog)|| (rHasGlobalOrdering(origR)))
891  {
892  if (syzIndex==0) syInitSort(res[0],&modcomp);
893 
894  if ((syzIndex==0) && !rRing_has_CompLastBlock(currRing))
895  res[syzIndex+1] = sySchreyersSyzygiesFB(res[syzIndex],&modcomp,mW,FALSE);
896  else
897  res[syzIndex+1] = sySchreyersSyzygiesFB(res[syzIndex],&modcomp,mW);
898 
899  if (errorreported)
900  {
901  for (j=0;j<*length;j++) idDelete( &res[j] );
902  omFreeSize((ADDRESS)res,*length*sizeof(ideal));
903  return NULL;
904  }
905 
906  mW = res[syzIndex];
907  }
908 //idPrint(res[syzIndex+1]);
909 
910  if ( /*(*/ syzIndex==0 /*)*/ )
911  {
912  if ((hom==isHomog)|| (rHasGlobalOrdering(origR)))
913  {
914  syRing = rAssure_CompLastBlock(origR, TRUE);
915  if (syRing != origR)
916  {
917  rChangeCurrRing(syRing);
918  for (i=0; i<IDELEMS(res[1]); i++)
919  {
920  res[1]->m[i] = prMoveR( res[1]->m[i], origR, syRing);
921  }
922  }
923  idTest(res[1]);
924  }
925  else
926  {
927  syRing = rAssure_SyzComp_CompLastBlock(origR);
928  if (syRing != origR)
929  {
930  rChangeCurrRing(syRing);
931  for (i=0; i<IDELEMS(res[0]); i++)
932  {
933  res[0]->m[i] = prMoveR( res[0]->m[i], origR, syRing);
934  }
935  }
936  idTest(res[0]);
937  }
938  }
939  if ((hom!=isHomog) && (rHasLocalOrMixedOrdering(origR)))
940  {
941  if (syzIndex==0) syInitSort(res[0],&modcomp);
942  res[syzIndex+1] = sySchreyersSyzygiesFM(res[syzIndex],&modcomp);
943  if (errorreported)
944  {
945  for (j=0;j<*length;j++) idDelete( &res[j] );
946  omFreeSize((ADDRESS)res,*length*sizeof(ideal));
947  return NULL;
948  }
949  }
950  syzIndex++;
951  if (TEST_OPT_PROT) Print("[%d]\n",syzIndex);
952  }
953  //syPrintResolution(res,1,*length);
954  if ((hom!=isHomog) && (rHasLocalOrMixedOrdering(origR)))
955  {
956  syzIndex = 1;
957  while ((syzIndex < *length) && (!idIs0(res[syzIndex])))
958  {
959  id_Shift(res[syzIndex],-rGetMaxSyzComp(syzIndex, currRing),currRing);
960  syzIndex++;
961  }
962  }
963  if ((hom==isHomog) || (rHasGlobalOrdering(origR)))
964  syzIndex = 1;
965  else
966  syzIndex = 0;
967  syReOrderResolventFB(res,*length,syzIndex+1);
968  if (/*ringOrderChanged:*/ origR!=syRing && syRing != NULL)
969  {
970  rChangeCurrRing(origR);
971  // Thomas: Here I assume that all (!) polys of res live in tmpR
972  while ((syzIndex < *length) && (res[syzIndex]))
973  {
974  for (i=0;i<IDELEMS(res[syzIndex]);i++)
975  {
976  if (res[syzIndex]->m[i])
977  {
978  res[syzIndex]->m[i] = prMoveR( res[syzIndex]->m[i], syRing, origR);
979  }
980  }
981  syzIndex++;
982  }
983 // j = 0; while (currRing->order[j]!=0) j++; // What was this for???!
984  rDelete(syRing);
985  }
986  else
987  {
988  // Thomas -- are you sure that you have to "reorder" here?
989  while ((syzIndex < *length) && (res[syzIndex]))
990  {
991  for (i=0;i<IDELEMS(res[syzIndex]);i++)
992  {
993  if (res[syzIndex]->m[i])
994  res[syzIndex]->m[i] = pSortCompCorrect(res[syzIndex]->m[i]);
995  }
996  syzIndex++;
997  }
998  }
999  if ((hom==isHomog) || (rHasGlobalOrdering(origR)))
1000  {
1001  if (res[1]!=NULL)
1002  {
1004  for (i=0;i<IDELEMS(res[1]);i++)
1005  {
1006  if (res[1]->m[i])
1007  res[1]->m[i] = pSort(res[1]->m[i]);
1008  }
1009  }
1010  }
1011  //syPrintResolution(res,0,*length);
1012 
1013  //syMergeSortResolventFB(res,*length);
1014  if (modcomp!=NULL) delete modcomp;
1015  if (w!=NULL) delete w;
1016  return res;
1017 }
short errorreported
Definition: feFopen.cc:23
#define pSort(p)
Definition: polys.h:213
BOOLEAN rRing_has_CompLastBlock(ring r)
Definition: ring.cc:5112
ring rAssure_SyzComp_CompLastBlock(const ring r)
makes sure that c/C ordering is last ordering and SyzIndex is first
Definition: ring.cc:4668
ring rAssure_CompLastBlock(ring r, BOOLEAN complete)
makes sure that c/C ordering is last ordering
Definition: ring.cc:4613
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
static ideal sySchreyersSyzygiesFB(ideal arg, intvec **modcomp, ideal mW, BOOLEAN redTail=TRUE)
Definition: syz0.cc:500
static void syInitSort(ideal arg, intvec **modcomp)
Definition: syz0.cc:24
static ideal sySchreyersSyzygiesFM(ideal arg, intvec **modcomp)
Definition: syz0.cc:163
void syReOrderResolventFB(resolvente res, int length, int initial)
Definition: syz0.cc:741
BOOLEAN syTestOrder(ideal M)
Definition: syz0.cc:830

◆ 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 1830 of file syz1.cc.

1831 {
1832  resolvente r=syzstr->res;
1833  if (r==NULL)
1834  r = syzstr->fullres;
1835  if (r==NULL)
1836  r = syzstr->minres;
1837  if (r==NULL)
1838  {
1839  WerrorS("No resolution found");
1840  return 0;
1841  }
1842  int i=syzstr->length;
1843  while ((i>0) && (r[i-1]==NULL)) i--;
1844  return i;
1845 }

◆ syTestOrder()

BOOLEAN syTestOrder ( ideal  i)

Definition at line 830 of file syz0.cc.

831 {
833  if (i == 0) return FALSE;
834  int j=0;
835 
836  while ((currRing->order[j]!=ringorder_c) && (currRing->order[j]!=ringorder_C))
837  j++;
838  if (currRing->order[j+1]!=0)
839  return TRUE;
840  return FALSE;
841 }
@ ringorder_C
Definition: ring.h:74
@ ringorder_c
Definition: ring.h:73
#define M
Definition: sirandom.c:24

Variable Documentation

◆ currcomponents

int* currcomponents
extern

Definition at line 34 of file syz1.cc.

◆ currShiftedComponents

long* currShiftedComponents
extern

Definition at line 35 of file syz1.cc.