source: git/Singular/kutil.h @ d14712

spielwiese
Last change on this file since d14712 was d14712, checked in by Olaf Bachmann <obachman@…>, 25 years ago
* got rid off STDTRACE, FAST_AND_DIRTY, (most) DRING, SRING, SDRING * got rid of spoly*.* stuff git-svn-id: file:///usr/local/Singular/svn/trunk@3694 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 8.8 KB
Line 
1#ifndef KUTIL_H
2#define KUTIL_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: kutil.h,v 1.16 1999-09-29 10:59:32 obachman Exp $ */
7/*
8* ABSTRACT: kernel: utils for kStd
9*/
10#include "mod2.h"
11#include "structs.h"
12#include "mmemory.h"
13#include "ring.h"
14#include <string.h>
15
16#define setmax 16
17
18// define to enable divisiblity tests bawsed on short exponent vectors
19// #define HAVE_SHORT_EVECTORS
20// define to enable debugging of this business (needs PDEBUG, as well)
21// #define DEBUG_SHORT_EVECTORS
22
23typedef int* intset;
24
25class sTObject
26{
27public:
28  poly  p;
29  int ecart,length, pLength;
30  memHeap heap;
31#ifdef HAVE_SHORT_EVECTORS
32  unsigned long sev;
33#endif
34  sTObject() { memset((void*) this, 0, sizeof(sTObject));}
35};
36
37class sLObject
38{
39public:
40  poly  p;
41  poly  p1,p2; /*- the pair p comes from -*/
42  poly  lcm;   /*- the lcm of p1,p2 -*/
43  int ecart,length, pLength;
44  memHeap heap;
45  sLObject() { memset((void*) this, 0, sizeof(sLObject));}
46};
47
48typedef class sTObject TObject;
49typedef class sLObject LObject;
50typedef TObject * TSet;
51typedef LObject * LSet;
52
53extern int HCord;
54
55class skStrategy;
56typedef skStrategy * kStrategy;
57class skStrategy
58{
59  public:
60    kStrategy next;
61    void (*red)(LObject * L,kStrategy strat);
62    void (*initEcart)(LObject * L);
63    int (*posInT)(const TSet T,const int tl,const LObject &h);
64    int (*posInL)(const LSet set, const int length,
65                  const LObject &L,const kStrategy strat);
66    void (*enterS)(LObject h, int pos,kStrategy strat);
67    void (*initEcartPair)(LObject * h, poly f, poly g, int ecartF, int ecartG);
68    int (*posInLOld)(const LSet Ls,const int Ll,
69                     const LObject &Lo,const kStrategy strat);
70    pFDegProc pOldFDeg;
71    ideal Shdl;
72    ideal D; /*V(S) is in D(D)*/
73    ideal M; /*set of minimal generators*/
74    polyset S;
75    intset ecartS;
76    intset fromQ;
77    TSet T;
78    LSet L;
79    LSet    B;
80    poly    kHEdge;
81    poly    kNoether;
82    BOOLEAN * NotUsedAxis;
83    LObject P;
84    poly tail;
85    leftv kIdeal;
86    intvec * kModW;
87    intvec * kHomW;
88    BOOLEAN *pairtest;/*used for enterOnePair*/
89    int cp,c3;
90    int sl,mu;
91    int tl,tmax;
92    int Ll,Lmax;
93    int Bl,Bmax;
94    int ak,LazyDegree,LazyPass;
95    int syzComp;
96    int HCord;
97    int lastAxis;
98    int newIdeal;
99    int minim;
100    BOOLEAN interpt;
101    BOOLEAN homog;
102    BOOLEAN kHEdgeFound;
103    BOOLEAN honey,sugarCrit;
104    BOOLEAN Gebauer,noTailReduction;
105    BOOLEAN fromT;
106    BOOLEAN noetherSet;
107    BOOLEAN update;
108    BOOLEAN posInLOldFlag;
109           /*FALSE, if posInL == posInL10*/
110    char    redTailChange;
111    char    news;
112    char    newt;/*used for messageSets*/
113};
114
115void deleteHC(poly *p, int *e, int *l, kStrategy strat);
116void deleteInS (int i,kStrategy strat);
117void cleanT (kStrategy strat);
118LSet initL ();
119void deleteInL(LSet set, int *length, int j,kStrategy strat);
120void enterL (LSet *set,int *length, int *LSetmax, LObject p,int at);
121void initEcartPairBba (LObject* Lp,poly f,poly g,int ecartF,int ecartG);
122void initEcartPairMora (LObject* Lp,poly f,poly g,int ecartF,int ecartG);
123int posInS (polyset set,int length,poly p);
124int posInT0 (const TSet set,const int length,const LObject &p);
125int posInT1 (const TSet set,const int length,const LObject &p);
126int posInT2 (const TSet set,const int length,const LObject &p);
127int posInT11 (const TSet set,const int length,const LObject &p);
128int posInT13 (const TSet set,const int length,const LObject &p);
129int posInT15 (const TSet set,const int length,const LObject &p);
130int posInT17 (const TSet set,const int length,const LObject &p);
131int posInT19 (const TSet set,const int length,const LObject &p);
132void reorderS (int* suc,kStrategy strat);
133int posInL0 (const LSet set, const int length,
134             const LObject &L,const kStrategy strat);
135int posInL11 (const LSet set, const int length,
136             const LObject &L,const kStrategy strat);
137int posInL13 (const LSet set, const int length,
138             const LObject &L,const kStrategy strat);
139int posInL15 (const LSet set, const int length,
140             const LObject &L,const kStrategy strat);
141int posInL17 (const LSet set, const int length,
142             const LObject &L,const kStrategy strat);
143poly redtailBba (poly p,int pos,kStrategy strat);
144poly redtailSyz (poly p,int pos,kStrategy strat);
145poly redtail (poly p,int pos,kStrategy strat);
146void enterpairs (poly h, int k, int ec, int pos,kStrategy strat);
147void entersets (LObject h);
148void pairs ();
149void message (int i,int* reduc,int* olddeg,kStrategy strat);
150void messageStat (int srmax,int lrmax,int hilbcount,kStrategy strat);
151void messageSets (kStrategy strat);
152void initEcartNormal (LObject* h);
153void initEcartBBA (LObject* h);
154void initS (ideal F, ideal Q,kStrategy strat);
155void initSL (ideal F, ideal Q,kStrategy strat);
156void updateS(BOOLEAN toT,kStrategy strat);
157void enterSBba (LObject p, int pos,kStrategy strat);
158void enterT (LObject p,kStrategy strat);
159void enterTBba (LObject p, int pos,kStrategy strat);
160void cancelunit (LObject* p);
161void HEckeTest (poly pp,kStrategy strat);
162void redtailS (poly* h,int maxIndex);
163void redtailMora (poly* h,int maxIndex);
164void initBuchMoraCrit(kStrategy strat);
165void initHilbCrit(ideal F, ideal Q, intvec **hilb,kStrategy strat);
166void initBuchMoraPos(kStrategy strat);
167void initBuchMora (ideal F, ideal Q,kStrategy strat);
168void exitBuchMora (kStrategy strat);
169void updateResult(ideal r,ideal Q,kStrategy strat);
170void completeReduce (kStrategy strat);
171BOOLEAN homogTest(polyset F, int Fmax);
172BOOLEAN newHEdge(polyset S, int ak,kStrategy strat);
173
174inline TSet initT () { return (TSet)Alloc0(setmax*sizeof(TObject)); }
175
176#ifdef KDEBUG
177#define kTest(A) K_Test(__FILE__,__LINE__,A)
178#define kTest_TS(A) K_Test(__FILE__,__LINE__,A)
179#define kTest_T(T) K_Test_T(__FILE__,__LINE__,T)
180#define kTest_L(L) K_Test_L(__FILE__,__LINE__,L)
181BOOLEAN K_Test(char *f, int l,kStrategy strat);
182BOOLEAN K_Test_TS(char *f, int l,kStrategy strat);
183BOOLEAN K_Test_T(char *f, int l, TObject* T, int tpos = -1);
184BOOLEAN K_Test_L(char* f, int l, LObject* L, 
185                 BOOLEAN testp = FALSE, int lpos = -1, 
186                 TSet T = NULL, int tlength = -1);
187#else
188#define kTest(A)    (TRUE)
189#define kTest_TS(A) (TRUE)
190#define kTest_T(T)  (TRUE)
191#define kTest_L(T)  (TRUE)
192#endif
193#endif
194
195/***************************************************************
196 *
197 * From kstd2.cc
198 *
199 ***************************************************************/
200ideal bba (ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat);
201poly kNF2 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce);
202ideal kNF2 (ideal F,ideal Q,ideal q, kStrategy strat, int lazyReduce);
203void initBba(ideal F,kStrategy strat);
204
205/***************************************************************
206 *
207 * From kSpolys.cc
208 *
209 ***************************************************************/
210// Reduces PR with PW
211// Assumes PR != NULL, PW != NULL, Lm(PW) divides Lm(PR)
212// Changes: PR
213// Const:   PW
214// If coef != NULL, then *coef is a/gcd(a,b), where a = LC(PR), b = LC(PW)
215void ksReducePoly(LObject* PR,
216                  TObject* PW,
217                  poly spNoether = NULL,
218                  number *coef = NULL);
219
220// Reduces PR at Current->next with PW
221// Assumes PR != NULL, Current contained in PR
222//         Current->next != NULL, LM(PW) devides LM(Current->next)
223// Changes: PR
224// Const:   PW
225void ksReducePolyTail(LObject* PR,
226                      TObject* PW,
227                      poly Current,
228                      poly spNoether = NULL);
229
230// Creates S-Poly of Pair
231// Const:   Pair->p1, Pair->p2
232// Changes: Pair->p == S-Poly of p1, p2
233// Assume:  Pair->p1 != NULL && Pair->p2
234void ksCreateSpoly(LObject* Pair, 
235                   poly spNoether = NULL);
236
237
238/*2
239* creates the leading term of the S-polynomial of p1 and p2
240* do not destroy p1 and p2
241* remarks:
242*   1. the coefficient is 0 (nNew)
243*   2. pNext is undefined
244*/
245poly ksCreateShortSpoly(poly p1, poly p2);
246
247
248/*
249* input - output: a, b
250* returns:
251*   a := a/gcd(a,b), b := b/gcd(a,b)
252*   and return value
253*       0  ->  a != 1,  b != 1
254*       1  ->  a == 1,  b != 1
255*       2  ->  a != 1,  b == 1
256*       3  ->  a == 1,  b == 1
257*   this value is used to control the spolys
258*/
259int ksCheckCoeff(number *a, number *b);
260
261// old stuff
262poly ksOldSpolyRed(poly p1, poly p2, poly spNoether = NULL);
263poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether = NULL);
264poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether = NULL);
265void ksOldSpolyTail(poly p1, poly q, poly q2, poly spNoether);
266
267#ifdef HAVE_SHORT_EVECTORS
268
269#define K_INIT_SHORT_EVECTOR(p) unsigned long __sev = ~ pGetShortExpVector(p);
270
271#if defined(DEBUG_SHORT_EVECTORS) && defined(PDEBUG)
272#define K_DIVISIBLE_BY(T, p2) \
273  (pDBShortDivisibleBy(T.p, T.sev, p2, __sev, __FILE__, __LINE__))
274#else
275#define K_DIVISIBLE_BY(T, p2) \
276  (pShortDivisibleBy(T.p, T.sev, p2, __sev))
277#endif
278
279#else
280#define K_INIT_SHORT_EVECTOR(p)
281#define K_DIVISIBLE_BY(T, p2) pDivisibleBy(T.p, p2)
282#endif // HAVE_SHORT_EVECTORS
283
Note: See TracBrowser for help on using the repository browser.