source: git/Singular/kutil.h @ ed6e65

spielwiese
Last change on this file since ed6e65 was ed6e65, checked in by Hans Schönemann <hannes@…>, 24 years ago
*hannes: mod2.h fomr .h files removed git-svn-id: file:///usr/local/Singular/svn/trunk@4109 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 8.7 KB
Line 
1#ifndef KUTIL_H
2#define KUTIL_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: kutil.h,v 1.24 2000-02-01 15:30:24 Singular Exp $ */
7/*
8* ABSTRACT: kernel: utils for kStd
9*/
10#include <string.h>
11#include "structs.h"
12#include "mmemory.h"
13#include "ring.h"
14#if HAVE_ASO == 1
15#include "kutil.aso"
16#endif
17
18#define setmax 16
19
20typedef int* intset;
21
22class sTObject
23{
24public:
25  poly  p;
26  int ecart,length, pLength;
27  memHeap heap;
28  unsigned long sev;
29  sTObject() { memset((void*) this, 0, sizeof(sTObject)); heap = mm_specHeap;}
30  inline poly SetP(poly p_new);
31};
32
33class sLObject
34{
35public:
36  poly  p;
37  poly  p1,p2; /*- the pair p comes from -*/
38  poly  lcm;   /*- the lcm of p1,p2 -*/
39  memHeap heap;
40  int ecart,length, pLength;
41  unsigned long sev;
42  sLObject() { memset((void*) this, 0, sizeof(sLObject));}
43};
44
45typedef class sTObject TObject;
46typedef class sLObject LObject;
47typedef TObject * TSet;
48typedef LObject * LSet;
49
50extern int HCord;
51
52class skStrategy;
53typedef skStrategy * kStrategy;
54class skStrategy
55{
56public:
57  kStrategy next;
58  int (*red)(LObject * L,kStrategy strat);
59  void (*initEcart)(LObject * L);
60  int (*posInT)(const TSet T,const int tl,const LObject &h);
61  int (*posInL)(const LSet set, const int length,
62                const LObject &L,const kStrategy strat);
63  void (*enterS)(LObject h, int pos,kStrategy strat);
64  void (*initEcartPair)(LObject * h, poly f, poly g, int ecartF, int ecartG);
65  int (*posInLOld)(const LSet Ls,const int Ll,
66                   const LObject &Lo,const kStrategy strat);
67  pFDegProc pOldFDeg;
68  ideal Shdl;
69  ideal D; /*V(S) is in D(D)*/
70  ideal M; /*set of minimal generators*/
71  polyset S;
72  intset ecartS;
73  intset fromQ;
74  unsigned long* sevS;
75  TSet T;
76  LSet L;
77  LSet    B;
78  poly    kHEdge;
79  poly    kNoether;
80  BOOLEAN * NotUsedAxis;
81  LObject P;
82  poly tail;
83  leftv kIdeal;
84  intvec * kModW;
85  intvec * kHomW;
86  memHeap THeap;       // if != NULL, heap for monoms of T
87  BOOLEAN use_redheap; // if TRUE, use extra heap for reductions
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 kinitBbaHeaps(kStrategy heap);
165void initBuchMoraCrit(kStrategy strat);
166void initHilbCrit(ideal F, ideal Q, intvec **hilb,kStrategy strat);
167void initBuchMoraPos(kStrategy strat);
168void initBuchMora (ideal F, ideal Q,kStrategy strat);
169void exitBuchMora (kStrategy strat);
170void updateResult(ideal r,ideal Q,kStrategy strat);
171void completeReduce (kStrategy strat);
172void kFreeStrat(kStrategy strat);
173BOOLEAN homogTest(polyset F, int Fmax);
174BOOLEAN newHEdge(polyset S, int ak,kStrategy strat);
175
176inline TSet initT () { return (TSet)Alloc0(setmax*sizeof(TObject)); }
177
178#ifdef KDEBUG
179#define kTest(A) K_Test(__FILE__,__LINE__,A)
180#define kTest_TS(A) K_Test_TS(__FILE__,__LINE__,A)
181#define kTest_T(T) K_Test_T(__FILE__,__LINE__,T)
182#define kTest_L(L) K_Test_L(__FILE__,__LINE__,L)
183#define kTest_S(strat) K_Test_S(__FILE__,__LINE__,strat)
184#define kTest_Pref(L) K_Test(__FILE__,__LINE__,L, 2)
185BOOLEAN K_Test(char *f, int l,kStrategy strat, int pref=0);
186BOOLEAN K_Test_TS(char *f, int l,kStrategy strat);
187BOOLEAN K_Test_T(char *f, int l, TObject* T, int tpos = -1);
188BOOLEAN K_Test_L(char* f, int l, LObject* L,
189                 BOOLEAN testp = FALSE, int lpos = -1,
190                 TSet T = NULL, int tlength = -1);
191BOOLEAN K_Test_S(char* f, int l, kStrategy strat);
192#else
193#define kTest(A)    (TRUE)
194#define kTest_Pref(A) (TRUE)
195#define kTest_TS(A) (TRUE)
196#define kTest_T(T)  (TRUE)
197#define kTest_S(T)  (TRUE)
198#define kTest_L(T)  (TRUE)
199#endif
200#endif
201
202/***************************************************************
203 *
204 * From kstd2.cc
205 *
206 ***************************************************************/
207ideal bba (ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat);
208poly kNF2 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce);
209ideal kNF2 (ideal F,ideal Q,ideal q, kStrategy strat, int lazyReduce);
210void initBba(ideal F,kStrategy strat);
211
212/***************************************************************
213 *
214 * From kSpolys.cc
215 *
216 ***************************************************************/
217// Reduces PR with PW
218// Assumes PR != NULL, PW != NULL, Lm(PW) divides Lm(PR)
219// Changes: PR
220// Const:   PW
221// If coef != NULL, then *coef is a/gcd(a,b), where a = LC(PR), b = LC(PW)
222void ksReducePoly(LObject* PR,
223                  TObject* PW,
224                  poly spNoether = NULL,
225                  number *coef = NULL);
226
227// Reduces PR at Current->next with PW
228// Assumes PR != NULL, Current contained in PR
229//         Current->next != NULL, LM(PW) devides LM(Current->next)
230// Changes: PR
231// Const:   PW
232void ksReducePolyTail(LObject* PR,
233                      TObject* PW,
234                      poly Current,
235                      poly spNoether = NULL);
236
237// Creates S-Poly of Pair
238// Const:   Pair->p1, Pair->p2
239// Changes: Pair->p == S-Poly of p1, p2
240// Assume:  Pair->p1 != NULL && Pair->p2
241void ksCreateSpoly(LObject* Pair,
242                   poly spNoether = NULL);
243
244
245/*2
246* creates the leading term of the S-polynomial of p1 and p2
247* do not destroy p1 and p2
248* remarks:
249*   1. the coefficient is 0 (nNew)
250*   2. pNext is undefined
251*/
252poly ksCreateShortSpoly(poly p1, poly p2);
253
254
255/*
256* input - output: a, b
257* returns:
258*   a := a/gcd(a,b), b := b/gcd(a,b)
259*   and return value
260*       0  ->  a != 1,  b != 1
261*       1  ->  a == 1,  b != 1
262*       2  ->  a != 1,  b == 1
263*       3  ->  a == 1,  b == 1
264*   this value is used to control the spolys
265*/
266int ksCheckCoeff(number *a, number *b);
267
268// old stuff
269poly ksOldSpolyRed(poly p1, poly p2, poly spNoether = NULL);
270poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether = NULL);
271poly ksOldCreateSpoly(poly p1, poly p2, poly spNoether = NULL);
272void ksOldSpolyTail(poly p1, poly q, poly q2, poly spNoether);
273
274
275#include "polys.h"
276// Methods for tobjects
277inline poly sTObject::SetP(poly new_p)
278{
279  poly old_p = p;
280  memset((void*) this, 0, sizeof(sTObject));
281  p = new_p;
282  sev = pGetShortExpVector(p);
283  return p;
284}
285
Note: See TracBrowser for help on using the repository browser.