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