Changeset 6af701c in git
- Timestamp:
- May 29, 2019, 5:00:57 PM (5 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 6e28b0f08c1d092c3f93c44addd2bebe61d206d0
- Parents:
- 90a512bb3f9b999e6009a39bf4c5b00651e6e5c3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/GBEngine/kstd1.cc
r90a512 r6af701c 531 531 reddeg = strat->LazyDegree+d; 532 532 h->SetShortExpVector(); 533 /* printf("new reduction\n"); */534 533 loop 535 534 { … … 539 538 if (strat->T[0].GetpFDeg() == 0 && strat->T[0].length <= 2) { 540 539 j = kFindDivisibleByInT_Z_only_first(strat, h); 541 /* printf("j %d --> ", j);542 * pWrite(pHead(strat->T[j].p)); */543 540 if (j == 0 && n_DivBy(pGetCoeff(h->p), pGetCoeff(strat->T[j].p), currRing->cf) == FALSE) { 544 /* printf("ecart h %d < %d ?\n",h->ecart, strat->T[j].ecart); */545 541 if (strat->T[j].ecart <= h->ecart) { 546 /* printf("ja\n");547 * printf("before: ");548 * pWrite(pHead(h->p)); */549 542 /* not(lc(reducer) | lc(poly)) && not(lc(poly) | lc(reducer)) 550 543 * => we try to cut down the lead coefficient at least */ … … 553 546 TObject tj = strat->T[j]; 554 547 tj.Copy(); 555 /* tj.max_exp = strat->T[j].max_exp; */556 548 /* compute division with remainder of lc(h) and lc(T[j]) */ 557 549 mult = n_QuotRem(pGetCoeff(h->p), pGetCoeff(strat->T[j].p), … … 564 556 tj.Delete(); 565 557 tj.Clear(); 566 /* printf("after: ");567 * pWrite(pHead(h->p)); */568 558 } 569 559 } 570 560 } 571 /* pWrite(pHead(h->p)); */572 561 j = kFindDivisibleByInT(strat, h); 573 562 if (j < 0) 574 563 { 575 /* printf("h goes out as: ");576 * pWrite(pHead(h->p)); */577 #if 0578 if (j >= 0)579 {580 printf("ja\n");581 /* not(lc(reducer) | lc(poly)) && not(lc(poly) | lc(reducer))582 * => we try to cut down the lead coefficient at least */583 /* first copy T[j] in order to multiply it with a coefficient later on */584 number mult, rest;585 TObject tj = strat->T[j];586 tj.Copy();587 /* tj.max_exp = strat->T[j].max_exp; */588 /* compute division with remainder of lc(h) and lc(T[j]) */589 mult = n_QuotRem(pGetCoeff(h->p), pGetCoeff(strat->T[j].p),590 &rest, currRing->cf);591 /* set corresponding new lead coefficient already. we do not592 * remove the lead term in ksReducePolyLC, but only apply593 * a lead coefficient reduction */594 tj.Mult_nn(mult);595 ksReducePolyLC(h, &tj, NULL, &rest, strat);596 tj.Delete();597 tj.Clear();598 }599 #endif600 564 // over ZZ: cleanup coefficients by complete reduction with monomials 601 565 postReduceByMon(h, strat); … … 1007 971 static poly redMoraNFRing (poly h,kStrategy strat, int flag) 1008 972 { 1009 LObject H;1010 H.p = h;1011 intj = 0;1012 int z = 10;1013 int o = H.SetpFDeg();1014 H.ecart = currRing->pLDeg(H.p,&H.length,currRing)-o;1015 if ((flag & 2) == 0) cancelunit(&H,TRUE);1016 H.sev = pGetShortExpVector(H.p);1017 unsigned long not_sev = ~ H.sev;1018 loop1019 {1020 #if 0973 LObject H; 974 H.p = h; 975 int j0, j = 0; 976 int z = 10; 977 int o = H.SetpFDeg(); 978 H.ecart = currRing->pLDeg(H.p,&H.length,currRing)-o; 979 if ((flag & 2) == 0) cancelunit(&H,TRUE); 980 H.sev = pGetShortExpVector(H.p); 981 unsigned long not_sev = ~ H.sev; 982 loop 983 { 984 #if 1 1021 985 /* cut down the lead coefficients, only possible if the degree of 1022 986 * T[0] is 0 (constant). This is only efficient if T[0] is short, thus 1023 987 * we ask for the length of T[0] to be <= 2 */ 1024 988 if (strat->T[0].GetpFDeg() == 0 && strat->T[0].length <= 2) { 1025 j = kFindDivisibleByInT_Z_only_first(strat, &H); 1026 /* printf("j %d --> ", j); 1027 * pWrite(pHead(strat->T[j].p)); */ 1028 if (j == 0 && n_DivBy(pGetCoeff(H.p), pGetCoeff(strat->T[j].p), currRing->cf) == FALSE) { 1029 /* printf("ecart h %d < %d ?\n",h->ecart, strat->T[j].ecart); */ 1030 if (strat->T[j].ecart <= H.ecart) { 1031 /* printf("ja\n"); 1032 * printf("before: "); 1033 * pWrite(pHead(h->p)); */ 989 j0 = kFindDivisibleByInT_Z_only_first(strat, &H); 990 if (j0 == 0 && n_DivBy(pGetCoeff(H.p), pGetCoeff(strat->T[j0].p), currRing->cf) == FALSE) { 991 if (strat->T[j0].ecart <= H.ecart) { 1034 992 /* not(lc(reducer) | lc(poly)) && not(lc(poly) | lc(reducer)) 1035 993 * => we try to cut down the lead coefficient at least */ 1036 /* first copy T[j ] in order to multiply it with a coefficient later on */994 /* first copy T[j0] in order to multiply it with a coefficient later on */ 1037 995 number mult, rest; 1038 TObject tj = strat->T[j ];996 TObject tj = strat->T[j0]; 1039 997 tj.Copy(); 1040 /* tj.max_exp = strat->T[j].max_exp; */1041 998 /* compute division with remainder of lc(h) and lc(T[j]) */ 1042 mult = n_QuotRem(pGetCoeff(H.p), pGetCoeff(strat->T[j ].p),999 mult = n_QuotRem(pGetCoeff(H.p), pGetCoeff(strat->T[j0].p), 1043 1000 &rest, currRing->cf); 1044 1001 /* set corresponding new lead coefficient already. we do not … … 1049 1006 tj.Delete(); 1050 1007 tj.Clear(); 1051 /* printf("after: ");1052 * pWrite(pHead(h->p)); */1053 1008 } 1054 1009 } 1055 1010 } 1056 j = 0; 1057 #endif 1058 if (j > strat->tl) 1059 { 1060 return H.p; 1061 } 1062 if (TEST_V_DEG_STOP) 1063 { 1064 if (kModDeg(H.p)>Kstd1_deg) pLmDelete(&H.p); 1065 if (H.p==NULL) return NULL; 1066 } 1067 if (p_LmShortDivisibleBy(strat->T[j].GetLmTailRing(), strat->sevT[j], H.GetLmTailRing(), not_sev, strat->tailRing) 1068 && (n_DivBy(H.p->coef, strat->T[j].p->coef,strat->tailRing->cf)) 1069 ) 1070 { 1071 /*- remember the found T-poly -*/ 1072 // poly pi = strat->T[j].p; 1073 int ei = strat->T[j].ecart; 1074 int li = strat->T[j].length; 1075 int ii = j; 1076 /* 1077 * the polynomial to reduce with (up to the moment) is; 1078 * pi with ecart ei and length li 1079 */ 1080 loop 1081 { 1082 /*- look for a better one with respect to ecart -*/ 1083 /*- stop, if the ecart is small enough (<=ecart(H)) -*/ 1084 j++; 1085 if (j > strat->tl) break; 1086 if (ei <= H.ecart) break; 1087 if (((strat->T[j].ecart < ei) 1088 || ((strat->T[j].ecart == ei) 1089 && (strat->T[j].length < li))) 1090 && pLmShortDivisibleBy(strat->T[j].p,strat->sevT[j], H.p, not_sev) 1091 && (n_DivBy(H.p->coef, strat->T[j].p->coef,strat->tailRing->cf)) 1092 ) 1093 { 1094 /* 1095 * the polynomial to reduce with is now; 1096 */ 1097 // pi = strat->T[j].p; 1098 ei = strat->T[j].ecart; 1099 li = strat->T[j].length; 1100 ii = j; 1101 } 1102 } 1103 /* 1104 * end of search: have to reduce with pi 1105 */ 1106 z++; 1107 if (z>10) 1108 { 1109 pNormalize(H.p); 1110 z=0; 1111 } 1112 if ((ei > H.ecart) && (!strat->kHEdgeFound)) 1113 { 1114 /* 1115 * It is not possible to reduce h with smaller ecart; 1116 * we have to reduce with bad ecart: H has to enter in T 1117 */ 1118 doRed(&H,&(strat->T[ii]),TRUE,strat,TRUE); 1119 if (H.p == NULL) 1120 return NULL; 1121 } 1122 else 1123 { 1124 /* 1125 * we reduce with good ecart, h need not to be put to T 1126 */ 1127 doRed(&H,&(strat->T[ii]),FALSE,strat,TRUE); 1128 if (H.p == NULL) 1129 return NULL; 1130 } 1131 /*- try to reduce the s-polynomial -*/ 1132 o = H.SetpFDeg(); 1133 if ((flag &2 ) == 0) cancelunit(&H,TRUE); 1134 H.ecart = currRing->pLDeg(H.p,&(H.length),currRing)-o; 1135 j = 0; 1136 H.sev = pGetShortExpVector(H.p); 1137 not_sev = ~ H.sev; 1138 } 1139 else 1140 { 1141 j++; 1142 } 1143 } 1011 #endif 1012 if (j > strat->tl) 1013 { 1014 return H.p; 1015 } 1016 if (TEST_V_DEG_STOP) 1017 { 1018 if (kModDeg(H.p)>Kstd1_deg) pLmDelete(&H.p); 1019 if (H.p==NULL) return NULL; 1020 } 1021 if (p_LmShortDivisibleBy(strat->T[j].GetLmTailRing(), strat->sevT[j], H.GetLmTailRing(), not_sev, strat->tailRing) 1022 && (n_DivBy(H.p->coef, strat->T[j].p->coef,strat->tailRing->cf)) 1023 ) 1024 { 1025 /*- remember the found T-poly -*/ 1026 // poly pi = strat->T[j].p; 1027 int ei = strat->T[j].ecart; 1028 int li = strat->T[j].length; 1029 int ii = j; 1030 /* 1031 * the polynomial to reduce with (up to the moment) is; 1032 * pi with ecart ei and length li 1033 */ 1034 loop 1035 { 1036 /*- look for a better one with respect to ecart -*/ 1037 /*- stop, if the ecart is small enough (<=ecart(H)) -*/ 1038 j++; 1039 if (j > strat->tl) break; 1040 if (ei <= H.ecart) break; 1041 if (((strat->T[j].ecart < ei) 1042 || ((strat->T[j].ecart == ei) 1043 && (strat->T[j].length < li))) 1044 && pLmShortDivisibleBy(strat->T[j].p,strat->sevT[j], H.p, not_sev) 1045 && (n_DivBy(H.p->coef, strat->T[j].p->coef,strat->tailRing->cf)) 1046 ) 1047 { 1048 /* 1049 * the polynomial to reduce with is now; 1050 */ 1051 // pi = strat->T[j].p; 1052 ei = strat->T[j].ecart; 1053 li = strat->T[j].length; 1054 ii = j; 1055 } 1056 } 1057 /* 1058 * end of search: have to reduce with pi 1059 */ 1060 z++; 1061 if (z>10) 1062 { 1063 pNormalize(H.p); 1064 z=0; 1065 } 1066 if ((ei > H.ecart) && (!strat->kHEdgeFound)) 1067 { 1068 /* 1069 * It is not possible to reduce h with smaller ecart; 1070 * we have to reduce with bad ecart: H has to enter in T 1071 */ 1072 doRed(&H,&(strat->T[ii]),TRUE,strat,TRUE); 1073 if (H.p == NULL) 1074 return NULL; 1075 } 1076 else 1077 { 1078 /* 1079 * we reduce with good ecart, h need not to be put to T 1080 */ 1081 doRed(&H,&(strat->T[ii]),FALSE,strat,TRUE); 1082 if (H.p == NULL) 1083 return NULL; 1084 } 1085 /*- try to reduce the s-polynomial -*/ 1086 o = H.SetpFDeg(); 1087 if ((flag &2 ) == 0) cancelunit(&H,TRUE); 1088 H.ecart = currRing->pLDeg(H.p,&(H.length),currRing)-o; 1089 j = 0; 1090 H.sev = pGetShortExpVector(H.p); 1091 not_sev = ~ H.sev; 1092 } 1093 else 1094 { 1095 j++; 1096 } 1097 } 1144 1098 } 1145 1099 #endif
Note: See TracChangeset
for help on using the changeset viewer.