Changeset 4a0a303 in git for factory/facHensel.cc
- Timestamp:
- Mar 6, 2012, 12:04:43 PM (12 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 54af8a51cc8091a4687fb55bf401e31a0478bc1e
- Parents:
- 5f92d88b0eec18a7d7e49c0c59e91b75d6d487ee
- git-author:
- Martin Lee <martinlee84@web.de>2012-03-06 12:04:43+01:00
- git-committer:
- Martin Lee <martinlee84@web.de>2012-04-04 14:42:26+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facHensel.cc
r5f92d8 r4a0a303 31 31 #include "cf_algorithm.h" 32 32 #include "cf_primes.h" 33 #include "facBivar.h" 33 34 34 35 #ifdef HAVE_NTL … … 452 453 453 454 CFList 455 diophantineHenselQa (const CanonicalForm & F, const CanonicalForm& G, 456 const CFList& factors, modpk& b, const Variable& alpha) 457 { 458 int p= b.getp(); 459 setCharacteristic (p); 460 bool fail= false; 461 CFList recResult; 462 CanonicalForm modMipo, mipo; 463 mipo= getMipo (alpha); 464 setReduce (alpha, false); 465 while (1) 466 { 467 setCharacteristic (p); 468 modMipo= mapinto (mipo); 469 modMipo /= lc (modMipo); 470 tryDiophantine (recResult, mapinto (F), mapinto (factors), modMipo, fail); 471 if (fail) 472 { 473 int i= 0; 474 while (cf_getBigPrime (i) < p) 475 i++; 476 findGoodPrime (F, i); 477 findGoodPrime (G, i); 478 p=cf_getBigPrime(i); 479 b = coeffBound( G, p, mipo ); 480 modpk bb= coeffBound (F, p, mipo ); 481 if (bb.getk() > b.getk() ) b=bb; 482 } 483 else 484 break; 485 } 486 setCharacteristic (0); 487 recResult= mapinto (recResult); 488 setReduce (alpha, true); 489 CanonicalForm e= 1; 490 CFList L; 491 CFArray bufFactors= CFArray (factors.length()); 492 int k= 0; 493 for (CFListIterator i= factors; i.hasItem(); i++, k++) 494 { 495 if (k == 0) 496 bufFactors[k]= i.getItem() (0); 497 else 498 bufFactors [k]= i.getItem(); 499 } 500 CanonicalForm tmp, quot; 501 for (k= 0; k < factors.length(); k++) //TODO compute b's faster 502 { 503 tmp= 1; 504 for (int l= 0; l < factors.length(); l++) 505 { 506 if (l == k) 507 continue; 508 else 509 { 510 tmp= mulNTL (tmp, bufFactors[l]); 511 } 512 } 513 L.append (tmp); 514 } 515 516 setCharacteristic (p); 517 for (k= 0; k < factors.length(); k++) 518 bufFactors [k]= bufFactors[k].mapinto(); 519 setCharacteristic(0); 520 521 CFListIterator j= L; 522 for (CFListIterator i= recResult; i.hasItem(); i++, j++) 523 e= b (e - mulNTL (i.getItem(),j.getItem(), b)); 524 525 if (e.isZero()) 526 return recResult; 527 CanonicalForm coeffE; 528 CFList s; 529 CFList result= recResult; 530 setCharacteristic (p); 531 recResult= mapinto (recResult); 532 setCharacteristic (0); 533 CanonicalForm g; 534 CanonicalForm modulus= p; 535 int d= b.getk(); 536 for (int i= 1; i < d; i++) 537 { 538 coeffE= div (e, modulus); 539 setCharacteristic (p); 540 coeffE= coeffE.mapinto(); 541 setCharacteristic (0); 542 if (!coeffE.isZero()) 543 { 544 CFListIterator k= result; 545 CFListIterator l= L; 546 int ii= 0; 547 j= recResult; 548 for (; j.hasItem(); j++, k++, l++, ii++) 549 { 550 setCharacteristic (p); 551 g= mulNTL (coeffE, j.getItem()); 552 g= modNTL (g, bufFactors[ii]); 553 setCharacteristic (0); 554 k.getItem() += g.mapinto()*modulus; 555 e -= mulNTL (g.mapinto()*modulus, l.getItem(), b); 556 e= b(e); 557 DEBOUTLN (cerr, "mod (e, power (y, i + 1))= " << 558 mod (e, power (y, i + 1))); 559 } 560 } 561 modulus *= p; 562 if (e.isZero()) 563 break; 564 } 565 566 return result; 567 } 568 569 CFList 454 570 diophantine (const CanonicalForm& F, const CanonicalForm& G, 455 571 const CFList& factors, modpk& b) … … 457 573 if (getCharacteristic() == 0) 458 574 { 459 if (b.getp() != 0)460 return diophantineHensel (F, factors, b);461 575 Variable v; 462 576 bool hasAlgVar= hasFirstAlgVar (F, v); … … 465 579 if (hasAlgVar) 466 580 { 581 if (b.getp() != 0) 582 { 583 CFList result= diophantineHenselQa (F, G, factors, b, v); 584 return result; 585 } 467 586 CFList result= modularDiophant (F, factors, getMipo (v)); 468 587 return result; 469 588 } 589 if (b.getp() != 0) 590 return diophantineHensel (F, factors, b); 470 591 } 471 592
Note: See TracChangeset
for help on using the changeset viewer.