1 | #ifndef KUTIL_H |
---|
2 | #define KUTIL_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id: kutil.h,v 1.13 1998-12-15 10:08:50 pohl Exp $ */ |
---|
7 | /* |
---|
8 | * ABSTRACT: kernel: utils for kStd |
---|
9 | */ |
---|
10 | #include "structs.h" |
---|
11 | #include "mmemory.h" |
---|
12 | #include "ring.h" |
---|
13 | #include <string.h> |
---|
14 | |
---|
15 | #define setmax 16 |
---|
16 | |
---|
17 | typedef int* intset; |
---|
18 | |
---|
19 | struct sTObject{ |
---|
20 | poly p; |
---|
21 | int ecart,length; |
---|
22 | }; |
---|
23 | struct sLObject{ |
---|
24 | poly p; |
---|
25 | poly p1,p2; /*- the pair p comes from -*/ |
---|
26 | poly lcm; /*- the lcm of p1,p2 -*/ |
---|
27 | int ecart,length; |
---|
28 | }; |
---|
29 | typedef struct sTObject TObject; |
---|
30 | typedef struct sLObject LObject; |
---|
31 | typedef TObject * TSet; |
---|
32 | typedef LObject * LSet; |
---|
33 | |
---|
34 | extern int HCord; |
---|
35 | |
---|
36 | class skStrategy; |
---|
37 | typedef skStrategy * kStrategy; |
---|
38 | class skStrategy |
---|
39 | { |
---|
40 | public: |
---|
41 | kStrategy next; |
---|
42 | void (*red)(LObject * L,kStrategy strat); |
---|
43 | void (*initEcart)(LObject * L); |
---|
44 | int (*posInT)(const TSet T,const int tl,const LObject &h); |
---|
45 | int (*posInL)(const LSet set, const int length, |
---|
46 | const LObject &L,const kStrategy strat); |
---|
47 | void (*enterS)(LObject h, int pos,kStrategy strat); |
---|
48 | void (*initEcartPair)(LObject * h, poly f, poly g, int ecartF, int ecartG); |
---|
49 | int (*posInLOld)(const LSet Ls,const int Ll, |
---|
50 | const LObject &Lo,const kStrategy strat); |
---|
51 | void (*spSpolyLoop)(poly p1, poly p2, poly m, poly spNoether); |
---|
52 | pFDegProc pOldFDeg; |
---|
53 | ideal Shdl; |
---|
54 | ideal D; /*V(S) is in D(D)*/ |
---|
55 | ideal M; /*set of minimal generators*/ |
---|
56 | polyset S; |
---|
57 | intset ecartS; |
---|
58 | intset fromQ; |
---|
59 | TSet T; |
---|
60 | LSet L; |
---|
61 | LSet B; |
---|
62 | poly kHEdge; |
---|
63 | poly kNoether; |
---|
64 | BOOLEAN * NotUsedAxis; |
---|
65 | LObject P; |
---|
66 | poly tail; |
---|
67 | leftv kIdeal; |
---|
68 | intvec * kModW; |
---|
69 | intvec * kHomW; |
---|
70 | BOOLEAN *pairtest;/*used for enterOnePair*/ |
---|
71 | int cp,c3; |
---|
72 | int sl,mu; |
---|
73 | int tl,tmax; |
---|
74 | int Ll,Lmax; |
---|
75 | int Bl,Bmax; |
---|
76 | int ak,LazyDegree,LazyPass; |
---|
77 | int syzComp; |
---|
78 | int HCord; |
---|
79 | int lastAxis; |
---|
80 | int newIdeal; |
---|
81 | int minim; |
---|
82 | BOOLEAN interpt; |
---|
83 | BOOLEAN homog; |
---|
84 | BOOLEAN kHEdgeFound; |
---|
85 | BOOLEAN honey,sugarCrit; |
---|
86 | BOOLEAN Gebauer,noTailReduction; |
---|
87 | BOOLEAN fromT; |
---|
88 | BOOLEAN noetherSet; |
---|
89 | BOOLEAN update; |
---|
90 | BOOLEAN posInLOldFlag; |
---|
91 | /*FALSE, if posInL == posInL10*/ |
---|
92 | char redTailChange; |
---|
93 | char news; |
---|
94 | char newt;/*used for messageSets*/ |
---|
95 | }; |
---|
96 | |
---|
97 | void deleteHC(poly *p, int *e, int *l, kStrategy strat); |
---|
98 | void deleteInS (int i,kStrategy strat); |
---|
99 | void cleanT (kStrategy strat); |
---|
100 | LSet initL (); |
---|
101 | void deleteInL(LSet set, int *length, int j,kStrategy strat); |
---|
102 | void enterL (LSet *set,int *length, int *LSetmax, LObject p,int at); |
---|
103 | void initEcartPairBba (LObject* Lp,poly f,poly g,int ecartF,int ecartG); |
---|
104 | void initEcartPairMora (LObject* Lp,poly f,poly g,int ecartF,int ecartG); |
---|
105 | int posInS (polyset set,int length,poly p); |
---|
106 | int posInT0 (const TSet set,const int length,const LObject &p); |
---|
107 | int posInT1 (const TSet set,const int length,const LObject &p); |
---|
108 | int posInT2 (const TSet set,const int length,const LObject &p); |
---|
109 | int posInT11 (const TSet set,const int length,const LObject &p); |
---|
110 | int posInT13 (const TSet set,const int length,const LObject &p); |
---|
111 | int posInT15 (const TSet set,const int length,const LObject &p); |
---|
112 | int posInT17 (const TSet set,const int length,const LObject &p); |
---|
113 | int posInT19 (const TSet set,const int length,const LObject &p); |
---|
114 | void reorderS (int* suc,kStrategy strat); |
---|
115 | int posInL0 (const LSet set, const int length, |
---|
116 | const LObject &L,const kStrategy strat); |
---|
117 | int posInL11 (const LSet set, const int length, |
---|
118 | const LObject &L,const kStrategy strat); |
---|
119 | int posInL13 (const LSet set, const int length, |
---|
120 | const LObject &L,const kStrategy strat); |
---|
121 | int posInL15 (const LSet set, const int length, |
---|
122 | const LObject &L,const kStrategy strat); |
---|
123 | int posInL17 (const LSet set, const int length, |
---|
124 | const LObject &L,const kStrategy strat); |
---|
125 | poly redtailBba (poly p,int pos,kStrategy strat); |
---|
126 | poly redtailSyz (poly p,int pos,kStrategy strat); |
---|
127 | poly redtail (poly p,int pos,kStrategy strat); |
---|
128 | void enterpairs (poly h, int k, int ec, int pos,kStrategy strat); |
---|
129 | void entersets (LObject h); |
---|
130 | void pairs (); |
---|
131 | void message (int i,int* reduc,int* olddeg,kStrategy strat); |
---|
132 | void messageStat (int srmax,int lrmax,int hilbcount,kStrategy strat); |
---|
133 | void messageSets (kStrategy strat); |
---|
134 | void initEcartNormal (LObject* h); |
---|
135 | void initEcartBBA (LObject* h); |
---|
136 | void initS (ideal F, ideal Q,kStrategy strat); |
---|
137 | void initSL (ideal F, ideal Q,kStrategy strat); |
---|
138 | void updateS(BOOLEAN toT,kStrategy strat); |
---|
139 | void enterSBba (LObject p, int pos,kStrategy strat); |
---|
140 | void enterT (LObject p,kStrategy strat); |
---|
141 | void enterTBba (LObject p, int pos,kStrategy strat); |
---|
142 | void cancelunit (LObject* p); |
---|
143 | void HEckeTest (poly pp,kStrategy strat); |
---|
144 | void redtailS (poly* h,int maxIndex); |
---|
145 | void redtailMora (poly* h,int maxIndex); |
---|
146 | void initBuchMoraCrit(kStrategy strat); |
---|
147 | void initHilbCrit(ideal F, ideal Q, intvec **hilb,kStrategy strat); |
---|
148 | void initBuchMoraPos(kStrategy strat); |
---|
149 | void initBuchMora (ideal F, ideal Q,kStrategy strat); |
---|
150 | void exitBuchMora (kStrategy strat); |
---|
151 | void updateResult(ideal r,ideal Q,kStrategy strat); |
---|
152 | void completeReduce (kStrategy strat); |
---|
153 | BOOLEAN homogTest(polyset F, int Fmax); |
---|
154 | BOOLEAN newHEdge(polyset S, int ak,kStrategy strat); |
---|
155 | |
---|
156 | rOrderType_t spGetOrderType(ring r, int modrank, int syzcomp); |
---|
157 | |
---|
158 | inline TSet initT () { return (TSet)Alloc0(setmax*sizeof(TObject)); } |
---|
159 | #ifdef KDEBUG |
---|
160 | #define kTest(A) K_Test(__FILE__,__LINE__,A) |
---|
161 | void K_Test(char *f, int i,kStrategy strat); |
---|
162 | #else |
---|
163 | #define kTest(A) |
---|
164 | #endif |
---|
165 | #endif |
---|