1 #ifndef SYZ_H
2 #define SYZ_H
3 /****************************************
4 *  Computer Algebra System SINGULAR     *
5 ****************************************/
6 /*
7 * ABSTRACT: Resolutions
8 */
9 #include "misc/mylimits.h"
10 #include "kernel/structs.h"
11 #include "polys/monomials/ring.h"
12 #include "kernel/ideals.h"
13 
14 // Logarithm of estimate of maximal number of new components
15 #define SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE 8
16 // Logarithm of "distance" between a new component and prev component
17 #define SYZ_SHIFT_BASE_LOG (BIT_SIZEOF_LONG - 1 - SYZ_SHIFT_MAX_NEW_COMP_ESTIMATE)
18 #define SYZ_SHIFT_BASE (1L << SYZ_SHIFT_BASE_LOG)
19 struct sSObject{
20                  poly  p;
21                  poly  p1,p2; /*- the pair p comes from -*/
22                  poly  lcm;   /*- the lcm of p1,p2 -*/
23                  poly  syz;   /*- the syzygy associated to p1,p2 -*/
24                  int   ind1,ind2; /*- the indeces of p1,p2 -*/
25                  poly  isNotMinimal;
26                  int   syzind;
27                  int   order;
28                  int   length;
29                  int   reference;
30                };
31 typedef struct sSObject SObject;
32 typedef SObject * SSet;
33 typedef SSet * SRes;
34 
35 class ssyStrategy;
36 typedef ssyStrategy * syStrategy;
37 class ssyStrategy{
38   public:
39   int ** truecomponents;
40   long** ShiftedComponents;
41   int ** backcomponents;
42   int ** Howmuch;
43   int ** Firstelem;
44   int ** elemLength;
45   intvec ** weights;
46   intvec ** hilb_coeffs;
47   resolvente res;              //polynomial data for internal use only
48   resolvente orderedRes;       //polynomial data for internal use only
49   SRes resPairs;               //polynomial data for internal use only
50   intvec * Tl;
51   intvec * resolution;
52   intvec * cw;
53   intvec * betti;
54   kBucket_pt bucket;
55   kBucket_pt syz_bucket;
56   ring syRing;
57   resolvente fullres;
58   resolvente minres;
59   unsigned long ** sev;
60   int length;
61   int regularity;
62   short list_length;
63   short references;
64 };
65 
66 void sySchreyersSyzygiesM(polyset F,int Fmax,polyset* Shdl,int* Smax,
67    BOOLEAN noSort);
68 
69 void sySchreyersSyzygiesB(polyset F,int Fmax,polyset* Shdl,int* Smax,
70    BOOLEAN noSort);
71 
72 resolvente sySchreyerResolvente(ideal arg, int maxlength, int * length,
73    BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE);
74 
75 syStrategy sySchreyer(ideal arg, int maxlength);
76 
77 resolvente syResolvente(ideal arg, int maxlength, int * length,
78                         intvec *** weights, BOOLEAN minim);
79 
80 syStrategy syResolution(ideal arg, int maxlength,intvec * w, BOOLEAN minim);
81 
82 void syMinimizeResolvente(resolvente res, int length, int first);
83 
84 intvec * syBetti(resolvente res,int length, int * regularity,
85          intvec* weights=NULL,BOOLEAN tomin=TRUE, int * row_shift=NULL);
86 
87 ideal syMinBase(ideal arg);
88 
89 BOOLEAN syTestOrder(ideal i);
90 
91 void syReOrderResolventFB(resolvente res,int length, int initial=1);
92 
93 resolvente syLaScala1(ideal arg,int * length);
94 syStrategy syLaScala3(ideal arg,int * length);
95 
96 syStrategy syLaScala(ideal arg, int& maxlength, intvec* weights = NULL);
97 
98 syStrategy syHilb(ideal arg,int * length);
99 syStrategy syKosz(ideal arg,int * length);
100 
101 // use_cache and use_tensor_trick are needed in PrymGreen.jl; do not delete!
102 syStrategy syFrank(const ideal arg, const int length, const char *method,
103         const bool use_cache = true, const bool use_tensor_trick = false);
104 
105 void syKillComputation(syStrategy syzstr, ring r=currRing);
106 intvec * syBettiOfComputation(syStrategy syzstr, BOOLEAN minim=TRUE,int * row_shift=NULL, intvec *weights=NULL);
107 
108 
109 int sySize(syStrategy syzstr);
110 int syDim(syStrategy syzstr);
111 syStrategy syCopy(syStrategy syzstr);
112 void syPrint(syStrategy syzstr,   const char *currRingName /* = currRingHdl->id */);
113 
114 syStrategy syMinimize(syStrategy syzstr);
115 void syKillEmptyEntres(resolvente res,int length);
116 
117 EXTERN_VAR int *  currcomponents;
118 EXTERN_VAR long *  currShiftedComponents;
119 
120 void syDeletePair(SObject * so);
121 void syInitializePair(SObject * so);
122 void syCopyPair(SObject * argso, SObject * imso);
123 void syCompactifyPairSet(SSet sPairs, int sPlength, int first);
124 void syCompactify1(SSet sPairs, int* sPlength, int first);
125 SRes syInitRes(ideal arg,int * length, intvec * Tl, intvec * cw=NULL);
126 void syResetShiftedComponents(syStrategy syzstr, int index,int hilb=0);
127 void syEnlargeFields(syStrategy syzstr,int index);
128 void syEnterPair(syStrategy syzstr, SObject * so, int * sPlength,int index);
129 SSet syChosePairs(syStrategy syzstr, int *index, int *howmuch, int * actdeg);
130 int syInitSyzMod(syStrategy syzstr, int index, int init=17);
131 long syReorderShiftedComponents(long * sc, int n);
132 void syGaussForOne(ideal arg,int gen,int ModComp,int from=-1,int till=0);
133 void syEnterPair(SSet sPairs, SObject * so, int * sPlength,int index);
134 void syEnterPair(syStrategy syzstr, SObject * so, int * sPlength,int index);
135 syStrategy syKosz(ideal arg,int * length);
136 
137 resolvente syReorder(resolvente res,int length,
138         syStrategy syzstr,BOOLEAN toCopy=TRUE,resolvente totake=NULL);
139 resolvente syReorder(resolvente res,int length,
140         syStrategy syzstr,BOOLEAN toCopy/*=TRUE*/,resolvente totake/*=NULL*/);
141 
142 #endif
143