| 185 | #endif |
| 186 | |
| 187 | int ksReducePoly(LObject* PR, |
| 188 | TObject* PW, |
| 189 | poly spNoether, |
| 190 | number *coef, |
| 191 | poly *mon, |
| 192 | kStrategy strat, |
| 193 | BOOLEAN reduce) |
| 194 | { |
| 195 | #ifdef KDEBUG |
| 196 | red_count++; |
| 197 | #ifdef TEST_OPT_DEBUG_RED |
| 198 | // if (TEST_OPT_DEBUG) |
| 199 | // { |
| 200 | // Print("Red %d:", red_count); PR->wrp(); Print(" with:"); |
| 201 | // PW->wrp(); |
| 202 | // //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart); |
| 203 | // //pWrite(PR->p); |
| 204 | // } |
| 205 | #endif |
| 206 | #endif |
| 207 | int ret = 0; |
| 208 | ring tailRing = PR->tailRing; |
| 209 | if (strat!=NULL) |
| 210 | { |
| 211 | kTest_L(PR,strat); |
| 212 | kTest_T(PW,strat); |
| 213 | } |
| 214 | |
| 215 | poly p1 = PR->GetLmTailRing(); // p2 | p1 |
| 216 | poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2) |
| 217 | poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2 |
| 218 | assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special |
| 219 | p_CheckPolyRing(p1, tailRing); |
| 220 | p_CheckPolyRing(p2, tailRing); |
| 221 | |
| 222 | pAssume1(p2 != NULL && p1 != NULL && |
| 223 | p_DivisibleBy(p2, p1, tailRing)); |
| 224 | |
| 225 | pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) || |
| 226 | (p_GetComp(p2, tailRing) == 0 && |
| 227 | p_MaxComp(pNext(p2),tailRing) == 0)); |
| 228 | |
| 229 | #ifdef HAVE_PLURAL |
| 230 | if (rIsPluralRing(currRing)) |
| 231 | { |
| 232 | // for the time being: we know currRing==strat->tailRing |
| 233 | // no exp-bound checking needed |
| 234 | // (only needed if exp-bound(tailring)<exp-b(currRing)) |
| 235 | if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef,reduce); |
| 236 | else |
| 237 | { |
| 238 | poly _p = (PR->t_p != NULL ? PR->t_p : PR->p); |
| 239 | assume(_p != NULL); |
| 240 | nc_PolyPolyRed(_p, p2,coef, currRing); |
| 241 | if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p; |
| 242 | PR->pLength=0; // usually not used, GetpLength re-computes it if needed |
| 243 | } |
| 244 | return 0; |
no test coverage detected