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