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

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


The following commit has been merged in the cleanedupstream branch:
commit 215c597c9e2c555e5a962975970a43b2067dd21b
Author: Martin Lee <martinlee84 at web.de>
Date:   Wed Feb 8 12:31:23 2012 +0100

    chg: use NTL multiplication in prodMod0
    chg: use a cheap test to discard wrong combinations during
         factor recombination

diff --git a/factory/facFqBivar.cc b/factory/facFqBivar.cc
index a6048ab..83d6649 100644
--- a/factory/facFqBivar.cc
+++ b/factory/facFqBivar.cc
@@ -47,7 +47,7 @@ CanonicalForm prodMod0 (const CFList& L, const CanonicalForm& M)
   else if (L.length() == 1)
     return mod (L.getFirst()(0, 1) , M);
   else if (L.length() == 2)
-    return mod (L.getFirst()(0, 1)*L.getLast()(0, 1), M);
+    return mod (mulNTL (L.getFirst()(0, 1),L.getLast()(0, 1)), M);
   else
   {
     int l= L.length()/2;
@@ -59,7 +59,7 @@ CanonicalForm prodMod0 (const CFList& L, const CanonicalForm& M)
     tmp2= Difference (L, tmp1);
     buf1= prodMod0 (tmp1, M);
     buf2= prodMod0 (tmp2, M);
-    return mod (buf1*buf2, M);
+    return mod (mulNTL (buf1,buf2), M);
   }
 }
 
@@ -292,6 +292,8 @@ extFactorRecombination (CFList& factors, CanonicalForm& F,
   bool nosubset= false;
   bool recombination= false;
   bool trueFactor= false;
+  CanonicalForm test;
+  CanonicalForm buf0= buf (0, x)*LCBuf;
   while (T.length() >= 2*s && s <= thres)
   {
     while (nosubset == false)
@@ -326,69 +328,76 @@ extFactorRecombination (CFList& factors, CanonicalForm& F,
         continue;
       else
       {
-        S.insert (LCBuf);
-        g= prodMod (S, M);
-        S.removeFirst();
-        g /= content (g, x);
-        if (fdivides (g, buf, quot))
+        test= prodMod0 (S, M);
+        test *= LCBuf;
+        test = mod (test, M);
+        if (fdivides (test, buf0))
         {
-          buf2= g (y - eval, y);
-          buf2 /= Lc (buf2);
-
-          if (!k && beta.level() == 1)
+          S.insert (LCBuf);
+          g= prodMod (S, M);
+          S.removeFirst();
+          g /= content (g, x);
+          if (fdivides (g, buf, quot))
           {
-            if (degree (buf2, alpha) < degMipoBeta)
-            {
-              buf= quot;
-              LCBuf= LC (buf, x);
-              recombination= true;
-              appendTestMapDown (result, buf2, info, source, dest);
-              trueFactor= true;
-            }
-          }
-          else
-          {
-            if (!isInExtension (buf2, gamma, k, delta, source, dest))
+            buf2= g (y - eval, y);
+            buf2 /= Lc (buf2);
+
+            if (!k && beta.level() == 1)
             {
-              buf= quot;
-              LCBuf= LC (buf, x);
-              recombination= true;
-              appendTestMapDown (result, buf2, info, source, dest);
-              trueFactor= true;
+              if (degree (buf2, alpha) < degMipoBeta)
+              {
+                buf= quot;
+                LCBuf= LC (buf, x);
+                recombination= true;
+                appendTestMapDown (result, buf2, info, source, dest);
+                trueFactor= true;
+              }
             }
-          }
-          if (trueFactor)
-          {
-            T= Difference (T, S);
-            l -= degree (g);
-            M= power (y, l);
-
-            // compute new possible degree pattern
-            bufDegs2= DegreePattern (T);
-            bufDegs1.intersect (bufDegs2);
-            bufDegs1.refine ();
-            if (T.length() < 2*s || T.length() == s ||
-                bufDegs1.getLength() == 1)
+            else
             {
-              delete [] v;
-              if (recombination)
+              if (!isInExtension (buf2, gamma, k, delta, source, dest))
               {
-                appendTestMapDown (result, buf (y - eval, y), info, source,
-                                    dest);
-                F= 1;
-                return result;
+                buf= quot;
+                LCBuf= LC (buf, x);
+                recombination= true;
+                appendTestMapDown (result, buf2, info, source, dest);
+                trueFactor= true;
               }
-              else
+            }
+            if (trueFactor)
+            {
+              T= Difference (T, S);
+              l -= degree (g);
+              M= power (y, l);
+              buf0= buf (0, x)*LCBuf;
+
+              // compute new possible degree pattern
+              bufDegs2= DegreePattern (T);
+              bufDegs1.intersect (bufDegs2);
+              bufDegs1.refine ();
+              if (T.length() < 2*s || T.length() == s ||
+                  bufDegs1.getLength() == 1)
               {
-                appendMapDown (result, F (y - eval, y), info, source, dest);
-                F= 1;
-                return result;
+                delete [] v;
+                if (recombination)
+                {
+                  appendTestMapDown (result, buf (y - eval, y), info, source,
+                                      dest);
+                  F= 1;
+                  return result;
+                }
+                else
+                {
+                  appendMapDown (result, F (y - eval, y), info, source, dest);
+                  F= 1;
+                  return result;
+                }
               }
+              trueFactor= false;
+              TT= copy (T);
+              indexUpdate (v, s, T.length(), nosubset);
+              if (nosubset) break;
             }
-            trueFactor= false;
-            TT= copy (T);
-            indexUpdate (v, s, T.length(), nosubset);
-            if (nosubset) break;
           }
         }
       }
@@ -474,6 +483,8 @@ factorRecombination (CFList& factors, CanonicalForm& F,
   int subsetDeg;
   TT= copy (factors);
   bool recombination= false;
+  CanonicalForm test;
+  CanonicalForm buf0= buf (0, x)*LCBuf;
   while (T.length() >= 2*s && s <= thres)
   {
     while (nosubset == false)
@@ -505,45 +516,50 @@ factorRecombination (CFList& factors, CanonicalForm& F,
         continue;
       else
       {
-        S.insert (LCBuf);
-        g= prodMod (S, M);
-        S.removeFirst();
-        g /= content (g, x);
-
-        if (fdivides (g, buf, quot))
+        test= prodMod0 (S, M);
+        test *= LCBuf;
+        test = mod (test, M);
+        if (fdivides (test, buf0))
         {
-          recombination= true;
-          result.append (g);
-          buf= quot;
-          LCBuf= LC (buf, x);
-          T= Difference (T, S);
-          l -= degree (g);
-          M= power (y, l);
-
-          // compute new possible degree pattern
-          bufDegs2= DegreePattern (T);
-          bufDegs1.intersect (bufDegs2);
-          bufDegs1.refine ();
-          if (T.length() < 2*s || T.length() == s ||
-              bufDegs1.getLength() == 1)
+          S.insert (LCBuf);
+          g= prodMod (S, M);
+          S.removeFirst();
+          g /= content (g, x);
+          if (fdivides (g, buf, quot))
           {
-            delete [] v;
-            if (recombination)
-            {
-              result.append (buf);
-              F= 1;
-              return result;
-            }
-            else
+            recombination= true;
+            result.append (g);
+            buf= quot;
+            LCBuf= LC (buf, x);
+            T= Difference (T, S);
+            l -= degree (g);
+            M= power (y, l);
+            buf0= buf (0, x)*LCBuf;
+            // compute new possible degree pattern
+            bufDegs2= DegreePattern (T);
+            bufDegs1.intersect (bufDegs2);
+            bufDegs1.refine ();
+            if (T.length() < 2*s || T.length() == s ||
+                bufDegs1.getLength() == 1)
             {
-              result= CFList (F);
-              F= 1;
-              return result;
+              delete [] v;
+              if (recombination)
+              {
+                result.append (buf);
+                F= 1;
+                return result;
+              }
+              else
+              {
+                result= CFList (F);
+                F= 1;
+                return result;
+              }
             }
+            TT= copy (T);
+            indexUpdate (v, s, T.length(), nosubset);
+            if (nosubset) break;
           }
-          TT= copy (T);
-          indexUpdate (v, s, T.length(), nosubset);
-          if (nosubset) break;
         }
       }
     }

-- 
an open source computer algebra system



More information about the debian-science-commits mailing list