1 | // emacs edit mode for this file is -*- C++ -*- |
---|
2 | // $Id: fglm.h,v 1.3 1997-03-27 16:11:40 Singular Exp $ |
---|
3 | |
---|
4 | /**************************************** |
---|
5 | * Computer Algebra System SINGULAR * |
---|
6 | ****************************************/ |
---|
7 | /* |
---|
8 | * ABSTRACT - The FGLM-Algorithm |
---|
9 | * The main header file for the fglm algorithm |
---|
10 | * (See fglm.cc for details) |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef FGLM_H |
---|
14 | #define FGLM_H |
---|
15 | |
---|
16 | #define PROT(msg) |
---|
17 | #define STICKYPROT(msg) if (BTEST1(OPT_PROT)) Print(msg) |
---|
18 | #define PROT2(msg,arg) |
---|
19 | #define STICKYPROT2(msg,arg) if (BTEST1(OPT_PROT)) Print(msg,arg) |
---|
20 | #define fglmASSERT(ignore1,ignore2) |
---|
21 | |
---|
22 | #include "polys.h" |
---|
23 | #include "fglmvec.h" |
---|
24 | #ifndef NOSTREAMIO |
---|
25 | #include <iostream.h> |
---|
26 | #endif |
---|
27 | |
---|
28 | // Some data types needed by the fglm algorithm. claptmpl.cc has to know them. |
---|
29 | class fglmSelem |
---|
30 | { |
---|
31 | public: |
---|
32 | int numVars; |
---|
33 | poly monom; |
---|
34 | int * divisors; |
---|
35 | fglmSelem( poly p, int var ); |
---|
36 | |
---|
37 | void cleanup(); |
---|
38 | BOOLEAN isBasisOrEdge() const { return ( (divisors[0] == numVars) ? TRUE : FALSE ); } |
---|
39 | void newDivisor( int var ) { divisors[ ++divisors[0] ]= var; } |
---|
40 | }; |
---|
41 | #ifndef NOSTREAMIO |
---|
42 | ostream & operator << ( ostream &, const fglmSelem & ); |
---|
43 | #endif |
---|
44 | |
---|
45 | class fglmDelem |
---|
46 | { |
---|
47 | public: |
---|
48 | int insertions; |
---|
49 | poly monom; |
---|
50 | fglmVector v; |
---|
51 | int var; |
---|
52 | fglmDelem( poly & m, fglmVector mv, int v ); |
---|
53 | |
---|
54 | void cleanup(); |
---|
55 | BOOLEAN isBasisOrEdge() const { return ( (insertions == 0) ? TRUE : FALSE ); } |
---|
56 | void newDivisor() { insertions--; } |
---|
57 | }; |
---|
58 | #ifndef NOSTREAMIO |
---|
59 | ostream & operator << ( ostream &, const fglmDelem & ); |
---|
60 | #endif |
---|
61 | |
---|
62 | // fglmzero(...): |
---|
63 | // The fglm algorithm for 0-dimensional ideals. ( fglmzero is defined in fglmzero.cc ) |
---|
64 | // Calculates the reduced groebner basis of sourceIdeal in destRing. |
---|
65 | // The sourceIdeal has to be a reduced, 0-dimensional groebner basis in sourceRing. |
---|
66 | // Warning: There is no check, if the ideal is really 0-dimensional and minimal. |
---|
67 | // If it is minimal but not reduced, then it returns FALSE, otherwise TRUE. |
---|
68 | // Warning: There is no check, if the rings are compatible for fglm (see |
---|
69 | // fglm.cc for functions to check this) |
---|
70 | // if switchBack==TRUE, then the procedure sets the ring as currentRing which was |
---|
71 | // current when it was called ( When called there may be currRing != sourceRing ). |
---|
72 | // if switchBack==FALSE, then currRing==destRing at the end. |
---|
73 | // if deleteIdeal==TRUE then sourceIdeal is deleted (in any case, even if the |
---|
74 | // procedure fails) |
---|
75 | // if deleteIdeal==FALSE, then nothing happens to sourceIdeal |
---|
76 | BOOLEAN |
---|
77 | fglmzero( idhdl sourceRingHdl, ideal & sourceIdeal, idhdl destRingHdl, ideal & destideal, BOOLEAN switchBack = TRUE, BOOLEAN deleteIdeal = FALSE ); |
---|
78 | |
---|
79 | // fglmproc(...): |
---|
80 | // The procedure which has to be called from the interpreter. |
---|
81 | // first is the sourceRing, second is the given ideal in sourceRing. |
---|
82 | // Returns the groebnerbasis of the sourceIdeal in the currentRing. |
---|
83 | // Checks, if the ideal is really a reduced groebner basis of a |
---|
84 | // 0-dimensional Ideal. Returns TRUE if an error occoured. |
---|
85 | BOOLEAN |
---|
86 | fglmProc( leftv result, leftv first, leftv second ); |
---|
87 | #endif |
---|