This is a very dirty way to cancel monoms whose number equals the MinPoly
| 428 | // This is a very dirty way to cancel monoms whose number equals the |
| 429 | // MinPoly |
| 430 | poly p_MinPolyNormalize(poly p, const ring r) |
| 431 | { |
| 432 | const coeffs C = r->cf; |
| 433 | number one = n_Init(1, C); |
| 434 | spolyrec rp; |
| 435 | |
| 436 | poly q = &rp; |
| 437 | |
| 438 | while (p != NULL) |
| 439 | { |
| 440 | // this returns 0, if p == MinPoly |
| 441 | number product = n_Mult(p_GetCoeff(p, r), one, C); |
| 442 | if ((product == NULL)||(n_IsZero(product, C))) |
| 443 | { |
| 444 | p_LmDelete(&p, r); |
| 445 | } |
| 446 | else |
| 447 | { |
| 448 | p_SetCoeff(p, product, r); |
| 449 | pNext(q) = p; |
| 450 | q = p; |
| 451 | p = pNext(p); |
| 452 | } |
| 453 | } |
| 454 | pNext(q) = NULL; |
| 455 | n_Delete(&one, C); |
| 456 | return rp.next; |
| 457 | } |
no test coverage detected