| 445 | |
| 446 | #if defined(HAVE_NTL) || defined(HAVE_FLINT) |
| 447 | int |
| 448 | liftBoundAdaption (const CanonicalForm& F, const CFList& factors, bool& |
| 449 | success, const int deg, const CFList& MOD, const int bound) |
| 450 | { |
| 451 | int adaptedLiftBound= 0; |
| 452 | CanonicalForm buf= F; |
| 453 | Variable y= F.mvar(); |
| 454 | Variable x= Variable (1); |
| 455 | CanonicalForm LCBuf= LC (buf, x); |
| 456 | CanonicalForm g, quot; |
| 457 | CFList M= MOD; |
| 458 | M.append (power (y, deg)); |
| 459 | int d= bound; |
| 460 | int e= 0; |
| 461 | int nBuf; |
| 462 | for (CFListIterator i= factors; i.hasItem(); i++) |
| 463 | { |
| 464 | g= mulMod (i.getItem(), LCBuf, M); |
| 465 | g /= myContent (g); |
| 466 | if (fdivides (g, buf, quot)) |
| 467 | { |
| 468 | nBuf= degree (g, y) + degree (LC (g, 1), y); |
| 469 | d -= nBuf; |
| 470 | e= tmax (e, nBuf); |
| 471 | buf= quot; |
| 472 | LCBuf= LC (buf, x); |
| 473 | } |
| 474 | } |
| 475 | adaptedLiftBound= d; |
| 476 | |
| 477 | if (adaptedLiftBound < deg) |
| 478 | { |
| 479 | if (adaptedLiftBound < degree (F) + 1) |
| 480 | { |
| 481 | if (d == 1) |
| 482 | { |
| 483 | if (e + 1 > deg) |
| 484 | { |
| 485 | adaptedLiftBound= deg; |
| 486 | success= false; |
| 487 | } |
| 488 | else |
| 489 | { |
| 490 | success= true; |
| 491 | if (e + 1 < degree (F) + 1) |
| 492 | adaptedLiftBound= deg; |
| 493 | else |
| 494 | adaptedLiftBound= e + 1; |
| 495 | } |
| 496 | } |
| 497 | else |
| 498 | { |
| 499 | success= true; |
| 500 | adaptedLiftBound= deg; |
| 501 | } |
| 502 | } |
| 503 | else |
| 504 | { |
no test coverage detected