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