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