Changeset 1ade96 in git
- Timestamp:
- Feb 16, 2012, 4:35:20 PM (11 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- f9bd3df575b00ad6b5b1f49bf42ebe194e4bb7b2
- Parents:
- 667ba13dd7bcac6f144c71d80aad80c7fe86c3cd
- git-author:
- Martin Lee <martinlee84@web.de>2012-02-16 16:35:20+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/facBivar.cc
r667ba1 r1ade96 24 24 #include "facHensel.h" 25 25 #include "facMul.h" 26 #include "cf_primes.h" 26 27 27 28 #ifdef HAVE_NTL 28 29 TIMING_DEFINE_PRINT(uni_factorize) 29 30 TIMING_DEFINE_PRINT(hensel_lift12) 31 32 static modpk 33 coeffBound ( const CanonicalForm & f, int p ) 34 { 35 int * degs = degrees( f ); 36 int M = 0, i, k = f.level(); 37 for ( i = 1; i <= k; i++ ) 38 M += degs[i]; 39 CanonicalForm b = 2 * maxNorm( f ) * power( CanonicalForm( 3 ), M ); 40 CanonicalForm B = p; 41 k = 1; 42 while ( B < b ) { 43 B *= p; 44 k++; 45 } 46 return modpk( p, k ); 47 } 48 49 static 50 void find_good_prime(const CanonicalForm &f, int &start) 51 { 52 if (! f.inBaseDomain() ) 53 { 54 CFIterator i = f; 55 for(;;) 56 { 57 if ( i.hasTerms() ) 58 { 59 find_good_prime(i.coeff(),start); 60 if (0==cf_getSmallPrime(start)) return; 61 if((i.exp()!=0) && ((i.exp() % cf_getSmallPrime(start))==0)) 62 { 63 start++; 64 i=f; 65 } 66 else i++; 67 } 68 else break; 69 } 70 } 71 else 72 { 73 if (f.inZ()) 74 { 75 if (0==cf_getSmallPrime(start)) return; 76 while((!f.isZero()) && (mod(f,cf_getSmallPrime(start))==0)) 77 { 78 start++; 79 if (0==cf_getSmallPrime(start)) return; 80 } 81 } 82 } 83 } 30 84 31 85 CFList conv (const CFFList& L) … … 528 582 } 529 583 530 if (!extension)531 {532 for (CFListIterator i= uniFactors; i.hasItem(); i++)533 i.getItem() /= lc (i.getItem());534 }535 536 584 A= A (y + evaluation, y); 537 585 538 586 int liftBound= degree (A, y) + 1; 587 588 modpk b= modpk(); 589 if ( !extension) 590 { 591 Off (SW_RATIONAL); 592 int i= 0; 593 do 594 { 595 find_good_prime(F,i); 596 find_good_prime(Aeval,i); 597 find_good_prime(A,i); 598 setCharacteristic (cf_getSmallPrime(i)); 599 if (gcd (Aeval.mapinto(), deriv (Aeval,x).mapinto()).inCoeffDomain()) 600 { 601 setCharacteristic (0); 602 break; 603 } 604 else 605 i++; 606 if (i > cf_getNumSmallPrimes()) 607 { 608 printf ("out of primes\n"); 609 break; 610 } 611 } while (1); 612 613 int p=cf_getSmallPrime(i); 614 b = coeffBound( A, p ); 615 modpk bb= coeffBound (Aeval, p); 616 if (bb.getk() > b.getk() ) b=bb; 617 bb= coeffBound (F, p); 618 if (bb.getk() > b.getk() ) b=bb; 619 } 539 620 540 621 ExtensionInfo dummy= ExtensionInfo (false); … … 545 626 uniFactors= henselLiftAndEarly 546 627 (A, earlySuccess, earlyFactors, degs, liftBound, 547 uniFactors, dummy, evaluation );628 uniFactors, dummy, evaluation, b); 548 629 TIMING_END_AND_PRINT (fac_hensel_lift, "time for hensel lifting: "); 549 630 DEBOUTLN (cerr, "lifted factors= " << uniFactors); … … 552 633 553 634 factors= factorRecombination (uniFactors, A, MODl, degs, 1, 554 uniFactors.length()/2); 635 uniFactors.length()/2, b); 636 637 if (!extension) 638 On (SW_RATIONAL); 555 639 556 640 if (earlySuccess)
Note: See TracChangeset
for help on using the changeset viewer.