[SCM] an open source computer algebra system branch, cleanedupstream, updated. 6125e540ca6d66c307958938a9d53b245507c323

Bernhard R. Link brlink at debian.org
Tue Apr 24 15:55:15 UTC 2012


The following commit has been merged in the cleanedupstream branch:
commit 345f850adfd38bff17f357e7b118da8f70c628f1
Author: Martin Lee <martinlee84 at web.de>
Date:   Tue Mar 6 12:03:45 2012 +0100

    chg: added coeff bound for polys over Q(a)
    chg: renamed find_good_prime to findGoodPrime
    chg: added coeffBound and findGoodPrime to facBivar.h

diff --git a/factory/facBivar.cc b/factory/facBivar.cc
index e5e4f60..ccd9ffb 100644
--- a/factory/facBivar.cc
+++ b/factory/facBivar.cc
@@ -27,14 +27,22 @@ TIMING_DEFINE_PRINT(fac_uni_factorizer)
 TIMING_DEFINE_PRINT(fac_hensel_lift)
 TIMING_DEFINE_PRINT(fac_factor_recombination)
 
-static modpk
+// bound on coeffs of f (cf. Musser: Multivariate Polynomial Factorization,
+//                          Gelfond: Transcendental and Algebraic Numbers)
+modpk
 coeffBound ( const CanonicalForm & f, int p )
 {
     int * degs = degrees( f );
     int M = 0, i, k = f.level();
+    CanonicalForm b= 1;
     for ( i = 1; i <= k; i++ )
-        M += degs[i];
-    CanonicalForm b = 2 * maxNorm( f ) * power( CanonicalForm( 3 ), M );
+    {
+      M += degs[i];
+      b *= degs[i] + 1;
+    }
+    b /= power (CanonicalForm (2), k);
+    b= b.sqrt() + 1;
+    b *= 2 * maxNorm( f ) * power( CanonicalForm( 2 ), M );
     CanonicalForm B = p;
     k = 1;
     while ( B < b ) {
@@ -44,8 +52,7 @@ coeffBound ( const CanonicalForm & f, int p )
     return modpk( p, k );
 }
 
-static
-void find_good_prime(const CanonicalForm &f, int &start)
+void findGoodPrime(const CanonicalForm &f, int &start)
 {
   if (! f.inBaseDomain() )
   {
@@ -54,7 +61,7 @@ void find_good_prime(const CanonicalForm &f, int &start)
     {
       if  ( i.hasTerms() )
       {
-        find_good_prime(i.coeff(),start);
+        findGoodPrime(i.coeff(),start);
         if (0==cf_getBigPrime(start)) return;
         if((i.exp()!=0) && ((i.exp() % cf_getBigPrime(start))==0))
         {
@@ -80,6 +87,40 @@ void find_good_prime(const CanonicalForm &f, int &start)
   }
 }
 
+modpk
+coeffBound ( const CanonicalForm & f, int p, const CanonicalForm& mipo )
+{
+    int * degs = degrees( f );
+    int M = 0, i, k = f.level();
+    CanonicalForm K= 1;
+    for ( i = 1; i <= k; i++ )
+    {
+        M += degs[i];
+        K *= degs[i] + 1;
+    }
+    K /= power (CanonicalForm (2), k);
+    K= K.sqrt()+1;
+    K *= power (CanonicalForm (2), M);
+    int N= degree (mipo);
+    CanonicalForm b;
+    b= 2*power (maxNorm (f), N)*power (maxNorm (mipo), 4*N)*K*power (CanonicalForm (2), N)*(CanonicalForm (M+1).sqrt()+1)*power (CanonicalForm (N+1).sqrt()+1, 7*N);
+    b /= power (abs (lc (mipo)), N);
+
+    ZZX NTLmipo= convertFacCF2NTLZZX (mipo);
+    ZZX NTLLcf= convertFacCF2NTLZZX (Lc (f));
+    ZZ NTLf= resultant (NTLmipo, NTLLcf);
+    ZZ NTLD= discriminant (NTLmipo);
+    b /= abs (convertZZ2CF (NTLf))*abs (convertZZ2CF (NTLD));
+
+    CanonicalForm B = p;
+    k = 1;
+    while ( B < b ) {
+        B *= p;
+        k++;
+    }
+    return modpk( p, k );
+}
+
 CFList conv (const CFFList& L)
 {
   CFList result;
@@ -588,9 +629,9 @@ CFList biFactorize (const CanonicalForm& F, const Variable& v)
   {
     Off (SW_RATIONAL);
     int i= 0;
-    find_good_prime(F,i);
-    find_good_prime(Aeval,i);
-    find_good_prime(A,i);
+    findGoodPrime(F,i);
+    findGoodPrime(Aeval,i);
+    findGoodPrime(A,i);
     if (i >= cf_getNumBigPrimes())
       printf ("out of primes\n"); //TODO exit
 
diff --git a/factory/facBivar.h b/factory/facBivar.h
index de47dc7..e363f23 100644
--- a/factory/facBivar.h
+++ b/factory/facBivar.h
@@ -270,6 +270,14 @@ ratBiFactorize (const CanonicalForm & G,         ///< [in] a bivariate poly
 CFList conv (const CFFList& L ///< [in] a CFFList
             );
 
+modpk
+coeffBound ( const CanonicalForm & f, int p, const CanonicalForm& mipo );
+
+void findGoodPrime(const CanonicalForm &f, int &start);
+
+modpk
+coeffBound ( const CanonicalForm & f, int p );
+
 #endif
 
 #endif

-- 
an open source computer algebra system



More information about the debian-science-commits mailing list