[936551] | 1 | /**************************************** |
---|
| 2 | * Computer Algebra System SINGULAR * |
---|
| 3 | ****************************************/ |
---|
| 4 | /* |
---|
[d0f98e] | 5 | * ABSTRACT: f5gb interface |
---|
[936551] | 6 | */ |
---|
| 7 | #ifndef F5_HEADER |
---|
| 8 | #define F5_HEADER |
---|
| 9 | |
---|
| 10 | #ifdef HAVE_F5 |
---|
[599326] | 11 | #include <kernel/f5data.h> |
---|
| 12 | #include <kernel/f5lists.h> |
---|
[d0f98e] | 13 | |
---|
| 14 | |
---|
[199ae7] | 15 | /* |
---|
| 16 | ====================================================== |
---|
| 17 | sort polynomials in ideal i by decreasing total degree |
---|
| 18 | ====================================================== |
---|
| 19 | */ |
---|
[61944d0] | 20 | void qsortDegree(poly* left, poly* right); |
---|
[199ae7] | 21 | |
---|
[2ae96e] | 22 | /*! |
---|
| 23 | * ====================================================================== |
---|
| 24 | * builds the sum of the entries of the exponent vectors, i.e. the degree |
---|
| 25 | * of the corresponding monomial |
---|
| 26 | * ====================================================================== |
---|
| 27 | */ |
---|
| 28 | long sumVector(int* v, int k); |
---|
| 29 | |
---|
[bb02ea] | 30 | /** |
---|
| 31 | ========================================================================== |
---|
| 32 | compare monomials, i.e. divisibility tests for criterion 1 and criterion 2 |
---|
| 33 | ========================================================================== |
---|
| 34 | */ |
---|
[a05c71] | 35 | bool compareMonomials(int* m1, int** m2, int numberOfRuleOlds); |
---|
[bb02ea] | 36 | |
---|
[8627ad] | 37 | |
---|
[199ae7] | 38 | /* |
---|
| 39 | ================================================== |
---|
[a9c298] | 40 | computes incrementally gbs of subsets of the input |
---|
| 41 | gb{f_m} -> gb{f_m,f_(m-1)} -> gb{f_m,...,f_1} |
---|
[199ae7] | 42 | ================================================== |
---|
[948192] | 43 | */ |
---|
[ab76b4] | 44 | LList* F5inc(int i, poly f_i, LList* gPrev,LList* reducers, ideal gbPrev, poly ONE, LTagList* lTag, RList* rules, RTagList* rTag, int plus ,int termination); |
---|
[8627ad] | 45 | |
---|
[cce6ed3] | 46 | /* |
---|
| 47 | ================================================================ |
---|
| 48 | computes a list of critical pairs for the next reduction process |
---|
[a9c298] | 49 | the first element is always "useful" thus the critical pair |
---|
| 50 | computed is either "useful" or "useless" depending on the second |
---|
[418bd6] | 51 | element which generates the critical pair. |
---|
[cce6ed3] | 52 | first element in gPrev is always the newest element which must |
---|
| 53 | build critical pairs with all other elements in gPrev |
---|
| 54 | ================================================================ |
---|
| 55 | */ |
---|
[ab76b4] | 56 | void criticalPair(LList* gPrev, CListOld* critPairs, LTagList* lTag, RTagList* rTag, RList* RuleOlds, PList* rejectedGBList, int plus); |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | bool checkDGB(LList* gPrev); |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | /* |
---|
| 63 | * Arris Check if we are finished after the current degree step: |
---|
| 64 | * Checks all remaining critical pairs, i.e. those of higher degree, |
---|
| 65 | * by the two Buchberger criteria. |
---|
[a9c298] | 66 | * return value: 0, if all remaining critical pairs are deleted by |
---|
[ab76b4] | 67 | * Buchberger's criteria |
---|
| 68 | * 1, otherwise |
---|
| 69 | */ |
---|
[a9c298] | 70 | bool arrisCheck(CNode* first,LNode* firstGCurr, long arrisdeg); |
---|
[418bd6] | 71 | |
---|
| 72 | /* |
---|
| 73 | ================================================================ |
---|
| 74 | computes a list of critical pairs for the next reduction process |
---|
[a9c298] | 75 | the first element is always "useless" thus the critical pair |
---|
[418bd6] | 76 | computed is "useless". |
---|
| 77 | first element in gPrev is always the newest element which must |
---|
| 78 | build critical pairs with all other elements in gPrev |
---|
| 79 | ================================================================ |
---|
| 80 | */ |
---|
[ab76b4] | 81 | void criticalPair2(LList* gPrev, CListOld* critPairs, LTagList* lTag, RTagList* rTag, RList* RuleOlds, PList* rejectedGBList); |
---|
[d51339] | 82 | |
---|
[cce6ed3] | 83 | /* |
---|
| 84 | ======================================== |
---|
| 85 | Criterion 1, i.e. Faugere's F5 Criterion |
---|
| 86 | ======================================== |
---|
| 87 | */ |
---|
[9cb4078] | 88 | inline bool criterion1(LList* gPrev, poly t, LNode* l, LTagList* lTag); |
---|
[66e7b5] | 89 | |
---|
| 90 | /* |
---|
| 91 | ===================================== |
---|
| 92 | Criterion 2, i.e. Rewritten Criterion |
---|
| 93 | ===================================== |
---|
| 94 | */ |
---|
[a05c71] | 95 | inline bool criterion2(int idx, poly t, LNode* l, RList* RuleOlds, RTagList* rTag); |
---|
[66e7b5] | 96 | |
---|
[8978fd] | 97 | /* |
---|
| 98 | ========================================================================================================== |
---|
[a05c71] | 99 | Criterion 2, i.e. Rewritten Criterion, for its second call in sPols(), with added lastRuleOldTested parameter |
---|
[8978fd] | 100 | ========================================================================================================== |
---|
| 101 | */ |
---|
[a05c71] | 102 | inline bool criterion2(poly t, LPolyOld* l, RList* RuleOlds, RuleOld* testedRuleOld); |
---|
[9bb97e] | 103 | |
---|
[ab76b4] | 104 | /* |
---|
| 105 | * check for useful pairs in the given subset of critical pairs |
---|
| 106 | */ |
---|
| 107 | int computeUsefulMinDeg(CNode* first); |
---|
| 108 | |
---|
[9bb97e] | 109 | /* |
---|
| 110 | ================================== |
---|
| 111 | Computation of S-Polynomials in F5 |
---|
| 112 | ================================== |
---|
| 113 | */ |
---|
[ab76b4] | 114 | inline void computeSPols(CNode* first, RTagList* rTag, RList* RuleOlds, LList* sPolyList, PList* rejectedGBList); |
---|
[9bb97e] | 115 | |
---|
| 116 | /* |
---|
| 117 | ======================================================================== |
---|
| 118 | reduction including subalgorithm topReduction() using Faugere's criteria |
---|
| 119 | ======================================================================== |
---|
| 120 | */ |
---|
[a05c71] | 121 | inline void reduction(LList* sPolyList, CListOld* critPairs, LList* gPrev, RList* RuleOlds, LTagList* lTag, RTagList* rTag, |
---|
[ab76b4] | 122 | ideal gbPrev, PList* rejectedGBList, int plus); |
---|
[9bb97e] | 123 | |
---|
[6b0aa2] | 124 | /* |
---|
| 125 | ======================================================================== |
---|
| 126 | reduction including subalgorithm topReduction() using Faugere's criteria |
---|
| 127 | ======================================================================== |
---|
| 128 | */ |
---|
[ab76b4] | 129 | inline void newReduction(LList* sPolyList, CListOld* critPairs, LList* gPrev, LList* reducers, RList* rules, LTagList* lTag, RTagList* rTag, ideal gbPrev, int termination, PList* rejectedGBList, int plus); |
---|
[6b0aa2] | 130 | |
---|
| 131 | /*! |
---|
| 132 | * ================================================================================ |
---|
[a9c298] | 133 | * searches for reducers of temp similar to the symbolic preprocessing of F4 and |
---|
[6b0aa2] | 134 | * divides them into a "good" and "bad" part: |
---|
[a9c298] | 135 | * |
---|
[6b0aa2] | 136 | * the "good" ones are the reducers which do not corrupt the label of temp, with |
---|
| 137 | * these the normal form of temp is computed |
---|
| 138 | * |
---|
[a9c298] | 139 | * the "bad" ones are the reducers which corrupt the label of temp, they are tested |
---|
[a05c71] | 140 | * later on for possible new RuleOlds and S-polynomials to be added to the algorithm |
---|
[6b0aa2] | 141 | * ================================================================================ |
---|
| 142 | */ |
---|
[a9c298] | 143 | void findReducers(LNode* l, LList* sPolyList, ideal gbPrev, LList* gPrev, LList* reducers, CListOld* critPairs, RList* rules, LTagList* lTag, RTagList* rTag, int termination, PList* rejectedGBList, int plus); |
---|
[6b0aa2] | 144 | |
---|
[9bb97e] | 145 | /* |
---|
| 146 | ===================================================================================== |
---|
| 147 | top reduction in F5, i.e. reduction of a given S-polynomial by labeled polynomials of |
---|
| 148 | the same index whereas the labels are taken into account |
---|
| 149 | ===================================================================================== |
---|
| 150 | */ |
---|
[a9c298] | 151 | inline void topReduction(LNode* l, LList* sPolyList, LList* gPrev, CListOld* critPairs, RList* RuleOlds, LTagList* lTag, RTagList* rTag, ideal gbPrev, PList* rejectedGBList, int plus); |
---|
[9bb97e] | 152 | |
---|
[c3efd3b] | 153 | /* |
---|
| 154 | ======================================================================================= |
---|
| 155 | merging 2 polynomials p & q without requiring that all monomials of p & q are different |
---|
| 156 | if there are equal monomials in p & q only one of these monomials (always that of p!) |
---|
| 157 | is taken into account |
---|
| 158 | ======================================================================================= |
---|
| 159 | |
---|
| 160 | poly p_MergeEq_q(poly p, poly q, const ring r); |
---|
[a9c298] | 161 | */ |
---|
[9bb97e] | 162 | /* |
---|
| 163 | ===================================================================== |
---|
| 164 | subalgorithm to find a possible reductor for the labeled polynomial l |
---|
| 165 | ===================================================================== |
---|
| 166 | */ |
---|
[a05c71] | 167 | inline LNode* findReductor(LNode* l, LList* sPolyList, LNode* gPrevRedCheck, LList* gPrev, RList* RuleOlds, LTagList* lTag,RTagList* rTag); |
---|
[9bb97e] | 168 | |
---|
[199ae7] | 169 | /* |
---|
| 170 | ====================================== |
---|
[87beab7] | 171 | main function of our F5 implementation |
---|
[199ae7] | 172 | ====================================== |
---|
| 173 | */ |
---|
[ab76b4] | 174 | ideal F5main(ideal i, ring r, int opt, int plus, int termination); |
---|
[199ae7] | 175 | |
---|
[936551] | 176 | #endif |
---|
| 177 | #endif |
---|