My Project
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

EXTERN_VAR int * currcomponents
 
EXTERN_VAR 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 770 of file syz.cc.

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

◆ syBettiOfComputation()

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

Don't change the syzstr???

Definition at line 1755 of file syz1.cc.

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

1289 {
1290  return syChosePairsPutIn(syzstr,index,howmuch,actdeg,0,syzstr->length);
1291 }
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:1181

◆ syCompactify1()

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

Definition at line 132 of file syz1.cc.

133 {
134  int k=first,kk=0;
135 
136  while (k+kk<*sPlength)
137  {
138  if (sPairs[k+kk].lcm!=NULL)
139  {
140  if (kk>0) syCopyPair(&sPairs[k+kk],&sPairs[k]);
141  k++;
142  }
143  else
144  {
145  kk++;
146  }
147  }
148  while (k<*sPlength)
149  {
150  syInitializePair(&sPairs[k]);
151  k++;
152  }
153  *sPlength -= kk;
154 }
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:82
void syInitializePair(SObject *so)
Definition: syz1.cc:63

◆ syCompactifyPairSet()

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

Definition at line 104 of file syz1.cc.

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

◆ syCopy()

syStrategy syCopy ( syStrategy  syzstr)

Definition at line 1884 of file syz1.cc.

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

◆ syCopyPair()

void syCopyPair ( SObject *  argso,
SObject *  imso 
)

Definition at line 82 of file syz1.cc.

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

◆ syDeletePair()

void syDeletePair ( SObject *  so)

Definition at line 44 of file syz1.cc.

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

◆ syDim()

int syDim ( syStrategy  syzstr)

Definition at line 1849 of file syz1.cc.

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

◆ syEnlargeFields()

void syEnlargeFields ( syStrategy  syzstr,
int  index 
)

Definition at line 734 of file syz1.cc.

735 {
736  pEnlargeSet(&(syzstr->res[index]->m),IDELEMS(syzstr->res[index]),16);
738  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
739  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
740  syzstr->ShiftedComponents[index]
741  =(long*)omRealloc0Size((ADDRESS)syzstr->ShiftedComponents[index],
742  (IDELEMS(syzstr->res[index])+1)*sizeof(long),
743  (IDELEMS(syzstr->res[index])+17)*sizeof(long));
745  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
746  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
747  syzstr->Howmuch[index]=(int*)omRealloc0Size((ADDRESS)syzstr->Howmuch[index],
748  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
749  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
750  syzstr->Firstelem[index]=(int*)omRealloc0Size((ADDRESS)syzstr->Firstelem[index],
751  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
752  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
753  syzstr->elemLength[index]=(int*)omRealloc0Size((ADDRESS)syzstr->elemLength[index],
754  (IDELEMS(syzstr->res[index])+1)*sizeof(int),
755  (IDELEMS(syzstr->res[index])+17)*sizeof(int));
756  syzstr->sev[index]=(unsigned long*)omRealloc0Size((ADDRESS)syzstr->sev[index],
757  (IDELEMS(syzstr->res[index])+1)*sizeof(unsigned long),
758  (IDELEMS(syzstr->res[index])+17)*sizeof(unsigned long));
759  IDELEMS(syzstr->res[index]) += 16;
760  pEnlargeSet(&(syzstr->orderedRes[index]->m),IDELEMS(syzstr->orderedRes[index]),16);
761  IDELEMS(syzstr->orderedRes[index]) += 16;
762 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3774
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 985 of file syz1.cc.

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

◆ syEnterPair() [2/2]

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

Definition at line 1035 of file syz1.cc.

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

824 {
826  resolvente res = (resolvente)omAlloc0((length+1)*sizeof(ideal));
827  if (strcmp(method, "frame") != 0)
828  {
829  res[0] = id_Copy(arg, currRing);
830  }
831  else
832  {
833  res[0] = id_Head(arg, currRing);
834  }
835  syzHeadFunction *syzHead;
836  bool do_lifting;
837  bool single_module;
838  set_options(&syzHead, &do_lifting, &single_module, method);
839  int new_length = computeResolution(res, length-1, syzHead, do_lifting,
840  single_module, use_cache, use_tensor_trick);
841  if (new_length < length)
842  {
843  res = (resolvente)omReallocSize(res, (length+1)*sizeof(ideal),
844  (new_length+1)*sizeof(ideal));
845  }
846  if (strcmp(method, "frame") != 0)
847  {
848  insert_ext_induced_LTs(res, new_length, single_module);
849  }
850  result->fullres = res;
851  result->length = new_length;
852  result->list_length = new_length;
853  return result;
854 }
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:731
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:700
static void insert_ext_induced_LTs(const resolvente res, const int length, const bool single_module)
Definition: syz4.cc:788
poly syzHeadFunction(ideal, int, int)
Definition: syz4.cc:351
ssyStrategy * syStrategy
Definition: syz.h:35

◆ syGaussForOne()

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

Definition at line 218 of file syz.cc.

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

◆ syHilb()

syStrategy syHilb ( ideal  arg,
int *  length 
)

Definition at line 950 of file syz2.cc.

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

◆ syInitializePair()

void syInitializePair ( SObject *  so)

Definition at line 63 of file syz1.cc.

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

◆ syInitRes()

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

Definition at line 293 of file syz1.cc.

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

◆ syInitSyzMod()

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

Definition at line 1459 of file syz1.cc.

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

◆ syKillComputation()

void syKillComputation ( syStrategy  syzstr,
ring  r = currRing 
)

Definition at line 1495 of file syz1.cc.

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

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

◆ syKosz()

syStrategy syKosz ( ideal  arg,
int *  length 
)

Definition at line 1763 of file syz3.cc.

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

◆ syLaScala()

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

Definition at line 2558 of file syz1.cc.

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

◆ syLaScala1()

resolvente syLaScala1 ( ideal  arg,
int *  length 
)

◆ syLaScala3()

syStrategy syLaScala3 ( ideal  arg,
int *  length 
)

Definition at line 2432 of file syz1.cc.

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

◆ syMinBase()

ideal syMinBase ( ideal  arg)

Definition at line 1004 of file syz.cc.

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

◆ syMinimize()

syStrategy syMinimize ( syStrategy  syzstr)

Definition at line 2393 of file syz1.cc.

2394 {
2395  if (syzstr->minres==NULL)
2396  {
2397  if (syzstr->resolution!=NULL)
2398  {
2399  // need to clear syzstr->resolution, as we are
2400  // now displaying the minres instead of fullres
2401  delete syzstr->resolution;
2402  syzstr->resolution=NULL;
2403  }
2404  if (syzstr->resPairs!=NULL)
2405  {
2406  if (syzstr->hilb_coeffs==NULL)
2407  {
2408  // La Scala Resolution
2409  syzstr->minres = syReadOutMinimalRes(syzstr);
2410  }
2411  else
2412  { // HRES
2413  syzstr->minres = syReorder(syzstr->orderedRes,syzstr->length,syzstr);
2414  }
2415  }
2416  else if (syzstr->fullres!=NULL)
2417  {
2418  syMinimizeResolvente(syzstr->fullres,syzstr->length,1);
2419  syzstr->minres = syzstr->fullres;
2420  syzstr->fullres = NULL;
2421  }
2422  }
2423  (syzstr->references)++;
2424  return syzstr;
2425 }
void syMinimizeResolvente(resolvente res, int length, int first)
Definition: syz.cc:355

◆ syMinimizeResolvente()

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

Definition at line 355 of file syz.cc.

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

◆ syPrint()

void syPrint ( syStrategy  syzstr,
const char *  currRingName 
)

Definition at line 1934 of file syz1.cc.

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

◆ syReorder()

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

Definition at line 1641 of file syz1.cc.

1643 {
1644  int i,j,l;
1645  poly p,q,tq;
1646  polyset ri1;
1647  resolvente fullres;
1648  ring origR=syzstr->syRing;
1649  fullres = (resolvente)omAlloc0((length+1)*sizeof(ideal));
1650  if (totake==NULL)
1651  totake = res;
1652  for (i=length-1;i>0;i--)
1653  {
1654  if (res[i]!=NULL)
1655  {
1656  if (i>1)
1657  {
1658  j = IDELEMS(res[i-1]);
1659  while ((j>0) && (res[i-1]->m[j-1]==NULL)) j--;
1660  fullres[i-1] = idInit(IDELEMS(res[i]),j);
1661  ri1 = totake[i-1]->m;
1662  for (j=IDELEMS(res[i])-1;j>=0;j--)
1663  {
1664  p = res[i]->m[j];
1665  q = NULL;
1666  while (p!=NULL)
1667  {
1668  if (toCopy)
1669  {
1670  if (origR!=NULL)
1671  tq = prHeadR(p,origR, currRing);
1672  else
1673  tq = pHead(p);
1674  pIter(p);
1675  }
1676  else
1677  {
1678  res[i]->m[j] = NULL;
1679  if (origR!=NULL)
1680  {
1681  poly pp=p;
1682  pIter(p);
1683  pNext(pp)=NULL;
1684  tq = prMoveR(pp, origR, currRing);
1685  }
1686  else
1687  {
1688  tq = p;
1689  pIter(p);
1690  pNext(tq) = NULL;
1691  }
1692  }
1693 // pWrite(tq);
1694  pTest(tq);
1695  for (l=(currRing->N);l>0;l--)
1696  {
1697  if (origR!=NULL)
1698  pSubExp(tq,l, p_GetExp(ri1[pGetComp(tq)-1],l,origR));
1699  else
1700  pSubExp(tq,l, pGetExp(ri1[pGetComp(tq)-1],l));
1701  }
1702  pSetm(tq);
1703  pTest(tq);
1704  q = pAdd(q,tq);
1705  pTest(q);
1706  }
1707  fullres[i-1]->m[j] = q;
1708  }
1709  }
1710  else
1711  {
1712  if (origR!=NULL)
1713  {
1714  fullres[i-1] = idInit(IDELEMS(res[i]),res[i]->rank);
1715  for (j=IDELEMS(res[i])-1;j>=0;j--)
1716  {
1717  if (toCopy)
1718  fullres[i-1]->m[j] = prCopyR(res[i]->m[j], origR, currRing);
1719  else
1720  {
1721  fullres[i-1]->m[j] = prMoveR(res[i]->m[j], origR, currRing);
1722  res[i]->m[j] = NULL;
1723  }
1724  }
1725  }
1726  else
1727  {
1728  if (toCopy)
1729  fullres[i-1] = idCopy(res[i]);
1730  else
1731  {
1732  fullres[i-1] = res[i];
1733  res[i] = NULL;
1734  }
1735  }
1736  for (j=IDELEMS(fullres[i-1])-1;j>=0;j--)
1737  fullres[i-1]->m[j] = pSortCompCorrect(fullres[i-1]->m[j]);
1738  }
1739  if (!toCopy)
1740  {
1741  if (res[i]!=NULL) idDelete(&res[i]);
1742  }
1743  }
1744  }
1745  if (!toCopy)
1746  omFreeSize((ADDRESS)res,(length+1)*sizeof(ideal));
1747  //syzstr->length = length;
1748  return fullres;
1749 }
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:676
#define pNext(p)
Definition: monomials.h:36
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:469
#define pAdd(p, q)
Definition: polys.h:203
#define pTest(p)
Definition: polys.h:415
#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:259
#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:227
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 740 of file syz0.cc.

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

◆ syReorderShiftedComponents()

long syReorderShiftedComponents ( long *  sc,
int  n 
)

Definition at line 334 of file syz1.cc.

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

◆ syResetShiftedComponents()

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

Definition at line 409 of file syz1.cc.

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

◆ syResolution()

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

Definition at line 613 of file syz.cc.

614 {
615 
616 #ifdef HAVE_PLURAL
617  const ideal idSaveCurrRingQuotient = currRing->qideal;
618  if( rIsSCA(currRing) )
619  {
621  {
622  currRing->qideal = SCAQuotient(currRing);
623  }
624  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
625  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
626  arg = id_KillSquares(arg, m_iFirstAltVar, m_iLastAltVar, currRing, false); // kill suares in input!
627  }
628 #endif
629 
631 
632  if ((w!=NULL) && (!idTestHomModule(arg,currRing->qideal,w))) // is this right in SCA case???
633  {
634  WarnS("wrong weights given(2):");w->show();PrintLn();
635  idHomModule(arg,currRing->qideal,&w);
636  w->show();PrintLn();
637  w=NULL;
638  }
639  if (w!=NULL)
640  {
641  result->weights = (intvec**)omAlloc0Bin(char_ptr_bin);
642  (result->weights)[0] = ivCopy(w);
643  result->length = 1;
644  }
645  resolvente fr = syResolvente(arg,maxlength,&(result->length),&(result->weights),minim);
646  resolvente fr1;
647  if (minim)
648  {
649  result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
650  fr1 = result->minres;
651  }
652  else
653  {
654  result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
655  fr1 = result->fullres;
656  }
657  for (int i=result->length-1;i>=0;i--)
658  {
659  if (fr[i]!=NULL)
660  fr1[i] = fr[i];
661  fr[i] = NULL;
662  }
663  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
664 
665 #ifdef HAVE_PLURAL
666  if( rIsSCA(currRing) )
667  {
669  {
670  currRing->qideal = idSaveCurrRingQuotient;
671  }
672  id_Delete(&arg, currRing);
673  }
674 #endif
675 
676  return result;
677 }
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 389 of file syz.cc.

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

◆ sySchreyer()

syStrategy sySchreyer ( ideal  arg,
int  maxlength 
)

Definition at line 1018 of file syz0.cc.

1019 {
1020  int rl;
1021  resolvente fr = sySchreyerResolvente(arg,maxlength,&(rl));
1022  if (fr==NULL) return NULL;
1023 
1024  // int typ0;
1026  result->length=rl;
1027  result->fullres = (resolvente)omAlloc0((rl /*result->length*/+1)*sizeof(ideal));
1028  for (int i=rl /*result->length*/-1;i>=0;i--)
1029  {
1030  if (fr[i]!=NULL)
1031  {
1032  idSkipZeroes(fr[i]);
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:361
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial, BOOLEAN)
Definition: syz0.cc:855

◆ sySchreyerResolvente()

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

Definition at line 855 of file syz0.cc.

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

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

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

◆ syTestOrder()

BOOLEAN syTestOrder ( ideal  i)

Definition at line 829 of file syz0.cc.

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

Variable Documentation

◆ currcomponents

EXTERN_VAR int* currcomponents

Definition at line 117 of file syz.h.

◆ currShiftedComponents

EXTERN_VAR long* currShiftedComponents

Definition at line 118 of file syz.h.