1 | /**************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | ****************************************/ |
---|
4 | /* $Id: f5gb.h,v 1.36 2009-04-07 13:30:01 ederc Exp $ */ |
---|
5 | /* |
---|
6 | * ABSTRACT: f5gb interface |
---|
7 | */ |
---|
8 | #ifndef F5_HEADER |
---|
9 | #define F5_HEADER |
---|
10 | |
---|
11 | #ifdef HAVE_F5 |
---|
12 | #include "f5data.h" |
---|
13 | #include "f5lists.h" |
---|
14 | |
---|
15 | |
---|
16 | /* |
---|
17 | ====================================================== |
---|
18 | sort polynomials in ideal i by decreasing total degree |
---|
19 | ====================================================== |
---|
20 | */ |
---|
21 | void qsortDegree(poly* left, poly* right); |
---|
22 | |
---|
23 | /*! |
---|
24 | * ====================================================================== |
---|
25 | * builds the sum of the entries of the exponent vectors, i.e. the degree |
---|
26 | * of the corresponding monomial |
---|
27 | * ====================================================================== |
---|
28 | */ |
---|
29 | long sumVector(int* v, int k); |
---|
30 | |
---|
31 | /** |
---|
32 | ========================================================================== |
---|
33 | compare monomials, i.e. divisibility tests for criterion 1 and criterion 2 |
---|
34 | ========================================================================== |
---|
35 | */ |
---|
36 | bool compareMonomials(int* m1, int** m2, int numberOfRules); |
---|
37 | |
---|
38 | /* |
---|
39 | ============================================== |
---|
40 | generating the list lp of ideal generators and |
---|
41 | test if 1 is in lp(return 1) or not(return 0) |
---|
42 | ============================================== |
---|
43 | */ |
---|
44 | void generate_input_list(LPoly* lp, ideal id, poly one); |
---|
45 | |
---|
46 | /* |
---|
47 | ================================================== |
---|
48 | computes incrementally gbs of subsets of the input |
---|
49 | gb{f_m} -> gb{f_m,f_(m-1)} -> gb{f_m,...,f_1} |
---|
50 | ================================================== |
---|
51 | */ |
---|
52 | inline LList* F5inc(int i, poly f_i, LList* gPrev, ideal gbPrev, poly ONE, LTagList* lTag, RList* rules, RTagList* rTag); |
---|
53 | |
---|
54 | /* |
---|
55 | ================================================================ |
---|
56 | computes a list of critical pairs for the next reduction process |
---|
57 | first element in gPrev is always the newest element which must |
---|
58 | build critical pairs with all other elements in gPrev |
---|
59 | ================================================================ |
---|
60 | */ |
---|
61 | void criticalPair(LList* gPrev, CList* critPairs, LTagList* lTag, RTagList* rTag, RList* rules); |
---|
62 | |
---|
63 | /* |
---|
64 | ======================================== |
---|
65 | Criterion 1, i.e. Faugere's F5 Criterion |
---|
66 | ======================================== |
---|
67 | */ |
---|
68 | inline bool criterion1(LList* gPrev, poly t, LNode* l, LTagList* lTag); |
---|
69 | |
---|
70 | /* |
---|
71 | ===================================== |
---|
72 | Criterion 2, i.e. Rewritten Criterion |
---|
73 | ===================================== |
---|
74 | */ |
---|
75 | inline bool criterion2(int idx, poly t, LNode* l, RList* rules, RTagList* rTag); |
---|
76 | |
---|
77 | /* |
---|
78 | ========================================================================================================== |
---|
79 | Criterion 2, i.e. Rewritten Criterion, for its second call in sPols(), with added lastRuleTested parameter |
---|
80 | ========================================================================================================== |
---|
81 | */ |
---|
82 | inline bool criterion2(poly t, LPoly* l, RList* rules, Rule* testedRule); |
---|
83 | |
---|
84 | /* |
---|
85 | ================================== |
---|
86 | Computation of S-Polynomials in F5 |
---|
87 | ================================== |
---|
88 | */ |
---|
89 | inline void computeSPols(CNode* first, RTagList* rTag, RList* rules, LList* sPolyList); |
---|
90 | |
---|
91 | /* |
---|
92 | ======================================================================== |
---|
93 | reduction including subalgorithm topReduction() using Faugere's criteria |
---|
94 | ======================================================================== |
---|
95 | */ |
---|
96 | inline void reduction(LList* sPolyList, CList* critPairs, LList* gPrev, RList* rules, LTagList* lTag, RTagList* rTag, |
---|
97 | ideal gbPrev); |
---|
98 | |
---|
99 | /* |
---|
100 | ===================================================================================== |
---|
101 | top reduction in F5, i.e. reduction of a given S-polynomial by labeled polynomials of |
---|
102 | the same index whereas the labels are taken into account |
---|
103 | ===================================================================================== |
---|
104 | */ |
---|
105 | inline void topReduction(LNode* l, LList* sPolyList, LList* gPrev, CList* critPairs, RList* rules, LTagList* lTag, RTagList* rTag, ideal gbPrev); |
---|
106 | |
---|
107 | /* |
---|
108 | ===================================================================== |
---|
109 | subalgorithm to find a possible reductor for the labeled polynomial l |
---|
110 | ===================================================================== |
---|
111 | */ |
---|
112 | inline LNode* findReductor(LNode* l, LList* sPolyList, LNode* gPrevRedCheck, LList* gPrev, RList* rules, LTagList* lTag,RTagList* rTag); |
---|
113 | |
---|
114 | /* |
---|
115 | ====================================== |
---|
116 | main function of our F5 implementation |
---|
117 | ====================================== |
---|
118 | */ |
---|
119 | ideal F5main(ideal i, ring r); |
---|
120 | |
---|
121 | #endif |
---|
122 | #endif |
---|