29#define pDeg(A) p_Deg(A,currRing)
114 for(
j=1;
j<=
k;
j++) {
130LList*
F5inc(
int i, poly
f_i,
LList*
gPrev,
LList*
reducers,
ideal gbPrev, poly
ONE,
LTagList*
lTag,
RList* rules,
RTagList*
rTag,
int plus,
int termination) {
215 newReduction(
sPolyList,
critPairs,
gPrev,
reducers, rules,
lTag,
rTag,
gbPrev,
termination,
rejectedGBList,
plus);
306 for(
int j=0;
j<=
gPrev->getLength()-1;
j++) {
370 PrintS(
"------------------\n");
475 if(!
temp->getDel()) {
616 int idx =
l->getIndex();
698 if(idx >
l->getIndex()) {
749 if(
testNode->getRuleOld() ==
l->getRuleOld()) {
758 &&
l->getIndex() ==
testNode->getRuleOldIndex()) {
832 if(!
temp->getDel()) {
881 if(
temp->getLp2Index() ==
temp->getLp1Index()) {
966 //sPolyList->insertByLabel(ppMult_qq(temp->getT1(),temp->getLp1Term()),temp->getLp1Index(),sp,rules->getFirst()->getRuleOld());
971 sp = ksOldSpolyRedNew(ppMult_qq(temp->getT1(),temp->getLp1Poly()),
972 ppMult_qq(temp->getT2(),temp->getLp2Poly()));
973 //Print("BEGIN SPOLY2\n====================\n");
976 //Print("END SPOLY2\n====================\n");
979 //rules->insert(temp->getLp1Index(),ppMult_qq(temp->getT1(),temp->getLp1Term()));
984 rules->insert(temp->getLp1Index(),ppMult_qq(temp->getT1(),temp->getLp1Term()));
986 // save the address of the rule again in a different
989 f5rules->insert(rules->getFirst()->getRuleOld());
990 f5pairs->insertWithoutSort(temp->getData());
992 //sPolyList->insertByLabel(ppMult_qq(temp->getT1(),temp->getLp1Term()),temp->getLp1Index(),sp,rules->getFirst()->getRuleOld());
997 // the following else is not needed at all as we are checking
998 // F5-critical pairs in this step
1001 if(!temp->getDel()) {
1002 rejectedGBList->insert(pHead(ppMult_qq(temp->getT1(),temp->getLp1Poly())));
1168 findReducers(
temp,
sPolyList,
gbPrev,
gPrev,
reducers,
critPairs,rules,
lTag,
rTag,
termination,
rejectedGBList,
plus);
1202void 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) {
1203 int canonicalize = 0;
1216 int idx =
l->getIndex();
1241 if(
tempRed->getIndex() != idx) {
1253 if(!(canonicalize % 50)) {
1303 if(!(canonicalize % 50)) {
1363 if(!(canonicalize % 50)) {
1394 if(
tempRed->getIndex() != idx) {
1406 if(!(canonicalize % 50)) {
1456 if(!(canonicalize % 50)) {
1531 PrintS(
"\nELEMENT ADDED TO GPREV: ");
1544 Print(
"redundant? %d\n\n",
l->getDel());
1790 if(
NULL !=
l->getPoly()) {
1823 poly t =
pHead(
l->getPoly());
1894 PrintS(
"\nComputations are done by the standard F5 Algorithm");
1897 PrintS(
"\nComputations are done by the variant F5R of the F5 Algorithm");
1900 PrintS(
"\nComputations are done by the variant F5C of the F5 Algorithm");
1903 WerrorS(
"\nThe option can only be set to \"0\", \"1\" or \"2\":\n\"0\": standard F5 Algorithm\n\"1\": variant F5R\n\"2\": variant F5C\nComputations are aborted!\n");
1981 Print(
"Iteration: %d\n\n",
i);
1982 gPrev =
F5inc(
i, id->m[
i-1],
gPrev,
reducers,
gbPrev,
ONE,
lTag, rules,
rTag,
plus,
termination);
2010 if(0 ==
temp->getDel()) {
2046 if(0 ==
temp->getDel()) {
2103 rules =
new RList();
2129 Print(
"Time for computations: %d/1000 seconds\n",
timer);
class PList of lists of PNodes
VAR int numberUsefulPairsMinDeg
bool compareMonomials(int *m1, int **m2, int numberOfRules, int k)
VAR int numberOfReductions
VAR int numberUsefulPairs
void topReduction(LNode *l, LList *sPolyList, LList *gPrev, CListOld *critPairs, RList *rules, LTagList *lTag, RTagList *rTag, ideal gbPrev, PList *rejectedGBList, int plus)
VAR int highestDegreeGBCriticalPair
LNode * findReductor(LNode *l, LList *sPolyList, LNode *gPrevRedCheck, LList *gPrev, RList *rules, LTagList *lTag, RTagList *rTag, PList *rejectedGBList)
void criticalPair2(LList *gPrev, CListOld *critPairs, LTagList *lTag, RTagList *rTag, RList *rules, PList *rejectedGBList)
long sumVector(int *v, int k)
VAR int numberRejectedF5CriticalPairs
bool checkDGB(LList *gPrev)
void newReduction(LList *sPolyList, CListOld *critPairs, LList *gPrev, LList *reducers, RList *rules, LTagList *lTag, RTagList *rTag, ideal gbPrev, int termination, PList *rejectedGBList, int plus)
void qsortDegree(poly *left, poly *right)
bool criterion2(int idx, poly t, LNode *l, RList *rules, RTagList *rTag)
void reduction(LList *sPolyList, CListOld *critPairs, LList *gPrev, RList *rules, LTagList *lTag, RTagList *rTag, ideal gbPrev, PList *rejectedGBList, int plus)
void computeSPols(CNode *first, RTagList *rTag, RList *rules, LList *sPolyList, PList *rejectedGBList)
VAR int numberUselessPairs
bool criterion1(LList *gPrev, poly t, LNode *l, LTagList *lTag)
bool arrisCheck(CNode *first, LNode *firstGCurr, long arrideg)
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)
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)
int computeUsefulMinDeg(CNode *first)
void criticalPair(LList *gPrev, CListOld *critPairs, LTagList *lTag, RTagList *rTag, RList *rules, PList *rejectedGBList, int plus)
ideal F5main(ideal id, ring r, int opt, int plus, int termination)
const Variable & v
< [in] a sqrfree bivariate poly
void WerrorS(const char *s)
ideal idAdd(ideal h1, ideal h2)
h1 + h2
KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether)
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
void kBucket_Minus_m_Mult_p(kBucket_pt bucket, poly m, poly p, int *l, poly spNoether)
Bpoly == Bpoly - m*p; where m is a monom Does not destroy p and m assume (*l <= 0 || pLength(p) == *l...
void kBucketInit(kBucket_pt bucket, poly lm, int length)
poly kBucketExtractLm(kBucket_pt bucket)
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
const poly kBucketGetLm(kBucket_pt bucket)
int kBucketCanonicalize(kBucket_pt bucket)
Canonicalizes Bpoly, i.e. converts polys of buckets into one poly in one bucket: Returns number of bu...
ideal kInterRed(ideal F, const ideal Q)
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
static int pLength(poly a)
static poly p_Merge_q(poly p, poly q, const ring r)
static long p_Totaldegree(poly p, const ring r)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Compatibility layer for legacy polynomial operations (over currRing)
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
#define pInit()
allocates a new monomial and initializes everything to 0
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
#define pCopy(p)
return a copy of the poly
#define pLmDivisibleByNoComp(a, b)
like pLmDivisibleBy, does not check components
void PrintS(const char *s)
ideal idInit(int idsize, int rank)
initialise an ideal / module