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

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


The following commit has been merged in the cleanedupstream branch:
commit 36625e9f3e8d41b31919f2dab4b4bc5c5b44a479
Author: Martin Lee <martinlee84 at web.de>
Date:   Mon Jan 16 13:08:04 2012 +0100

    chg: replaced Variable (1)

diff --git a/factory/facFqBivar.cc b/factory/facFqBivar.cc
index 5eb5539..d12c4f2 100644
--- a/factory/facFqBivar.cc
+++ b/factory/facFqBivar.cc
@@ -69,6 +69,7 @@ CanonicalForm evalPoint (const CanonicalForm& F, CanonicalForm & eval,
 {
   fail= false;
   Variable x= Variable(2);
+  Variable y= Variable(1);
   FFRandom genFF;
   GFRandom genGF;
   CanonicalForm random, mipo;
@@ -119,7 +120,7 @@ CanonicalForm evalPoint (const CanonicalForm& F, CanonicalForm & eval,
     }
     if (find (list, random)) continue;
     eval= F (random, x);
-    if (degree (eval) != degree (F, Variable (1)))
+    if (degree (eval) != degree (F, y))
     { //leading coeff vanishes
       if (!find (list, random))
         list.append (random);
@@ -253,6 +254,7 @@ extFactorRecombination (CFList& factors, CanonicalForm& F,
   int k= info.getGFDegree();
 
   Variable y= F.mvar();
+  Variable x= Variable (1);
   CFList source, dest;
   if (degs.getLength() <= 1 || factors.length() == 1)
   {
@@ -275,7 +277,7 @@ extFactorRecombination (CFList& factors, CanonicalForm& F,
 
   buf= F;
 
-  CanonicalForm g, LCBuf= LC (buf, Variable (1));
+  CanonicalForm g, LCBuf= LC (buf, x);
   int * v= new int [T.length()];
   for (int i= 0; i < T.length(); i++)
     v[i]= 0;
@@ -330,7 +332,7 @@ extFactorRecombination (CFList& factors, CanonicalForm& F,
           S.insert (LCBuf);
           g= prodMod (S, M);
           S.removeFirst();
-          g /= content (g, Variable (1));
+          g /= content (g, x);
           if (fdivides (g, buf, quot))
           {
             buf2= g (y - eval, y);
@@ -341,7 +343,7 @@ extFactorRecombination (CFList& factors, CanonicalForm& F,
               if (degree (buf2, alpha) < degMipoBeta)
               {
                 buf= quot;
-                LCBuf= LC (buf, Variable (1));
+                LCBuf= LC (buf, x);
                 recombination= true;
                 appendTestMapDown (result, buf2, info, source, dest);
                 trueFactor= true;
@@ -352,7 +354,7 @@ extFactorRecombination (CFList& factors, CanonicalForm& F,
               if (!isInExtension (buf2, gamma, k, delta, source, dest))
               {
                 buf= quot;
-                LCBuf= LC (buf, Variable (1));
+                LCBuf= LC (buf, x);
                 recombination= true;
                 appendTestMapDown (result, buf2, info, source, dest);
                 trueFactor= true;
@@ -457,7 +459,9 @@ factorRecombination (CFList& factors, CanonicalForm& F,
 
   T= factors;
   CFList result;
-  CanonicalForm LCBuf= LC (F, Variable (1));
+  Variable y= Variable (2);
+  Variable x= Variable (1);
+  CanonicalForm LCBuf= LC (F, x);
   CanonicalForm g, quot, buf= F;
   int * v= new int [T.length()];
   for (int i= 0; i < T.length(); i++)
@@ -481,7 +485,7 @@ factorRecombination (CFList& factors, CanonicalForm& F,
           T.insert (LCBuf);
           g= prodMod (T, M);
           T.removeFirst();
-          result.append (g/content (g, Variable (1)));
+          result.append (g/content (g, x));
           F= 1;
           return result;
         }
@@ -508,14 +512,14 @@ factorRecombination (CFList& factors, CanonicalForm& F,
           S.insert (LCBuf);
           g= prodMod (S, M);
           S.removeFirst();
-          g /= content (g, Variable (1));
+          g /= content (g, x);
 
           if (fdivides (g, buf, quot))
           {
             recombination= true;
             result.append (g);
             buf= quot;
-            LCBuf= LC (buf, Variable(1));
+            LCBuf= LC (buf, x);
             T= Difference (T, S);
 
             // compute new possible degree pattern
@@ -625,7 +629,8 @@ earlyFactorDetection (CanonicalForm& F, CFList& factors,int& adaptedLiftBound,
   CFList result;
   CFList T= factors;
   CanonicalForm buf= F;
-  CanonicalForm LCBuf= LC (buf, Variable (1));
+  Variable x= Variable (1);
+  CanonicalForm LCBuf= LC (buf, x);
   CanonicalForm g, quot;
   CanonicalForm M= power (F.mvar(), deg);
   adaptedLiftBound= 0;
@@ -642,13 +647,13 @@ earlyFactorDetection (CanonicalForm& F, CFList& factors,int& adaptedLiftBound,
       if (fdivides (LC (g), LCBuf))
       {
         g= mulMod2 (i.getItem(), LCBuf, M);
-        g /= content (g, Variable (1));
+        g /= content (g, x);
         if (fdivides (g, buf, quot))
         {
           result.append (g);
           buf= quot;
-          d -= degree (g) + degree (LC (g, Variable (1)));
-          LCBuf= LC (buf, Variable (1));
+          d -= degree (g) + degree (LC (g, x));
+          LCBuf= LC (buf, x);
           T= Difference (T, CFList (i.getItem()));
 
           // compute new possible degree pattern
@@ -692,7 +697,8 @@ extEarlyFactorDetection (CanonicalForm& F, CFList& factors,
   CFList result;
   CFList T= factors;
   Variable y= F.mvar();
-  CanonicalForm buf= F, LCBuf= LC (buf, Variable (1)), g, buf2;
+  Variable x= Variable (1);
+  CanonicalForm buf= F, LCBuf= LC (buf, x), g, buf2;
   CanonicalForm M= power (y, deg);
   adaptedLiftBound= 0;
   bool trueFactor= false;
@@ -714,20 +720,20 @@ extEarlyFactorDetection (CanonicalForm& F, CFList& factors,
       if (fdivides (LC (g), LCBuf))
       {
         g= mulMod2 (i.getItem(), LCBuf, M);
-        g /= content (g, Variable (1));
+        g /= content (g, x);
         if (fdivides (g, buf, quot))
         {
           buf2= g (y - eval, y);
           buf2 /= Lc (buf2);
 
-          if (!k && beta == Variable (1))
+          if (!k && beta == x)
           {
             if (degree (buf2, alpha) < degMipoBeta)
             {
               appendTestMapDown (result, buf2, info, source, dest);
               buf= quot;
-              d -= degree (g) + degree (LC (g, Variable (1)));
-              LCBuf= LC (buf, Variable (1));
+              d -= degree (g) + degree (LC (g, x));
+              LCBuf= LC (buf, x);
               trueFactor= true;
             }
           }
@@ -737,8 +743,8 @@ extEarlyFactorDetection (CanonicalForm& F, CFList& factors,
             {
               appendTestMapDown (result, buf2, info, source, dest);
               buf= quot;
-              d -= degree (g) + degree (LC (g, Variable (1)));
-              LCBuf= LC (buf, Variable (1));
+              d -= degree (g) + degree (LC (g, x));
+              LCBuf= LC (buf, x);
               trueFactor= true;
             }
           }
@@ -1257,7 +1263,7 @@ extReconstruction (CanonicalForm& G, CFList& factors, int* zeroOneVecs, int
     buf= mod (buf, yToL);
     buf /= content (buf, x);
     buf2= buf (y-evaluation, y);
-    if (!k && beta == Variable (1))
+    if (!k && beta == x)
     {
       if (degree (buf2, alpha) < 1)
       {
@@ -1393,7 +1399,7 @@ extReconstructionTry (CFList& reconstructedFactors, CanonicalForm& F, const
     buf= mod (buf, yToL);
     buf /= content (buf, x);
     buf2= buf (y - evaluation, y);
-    if (!k && beta == Variable (1))
+    if (!k && beta == x)
     {
       if (degree (buf2, alpha) < 1)
       {
@@ -5584,7 +5590,7 @@ biFactorize (const CanonicalForm& F, const ExtensionInfo& info)
       CFList lll= henselLiftAndLatticeRecombi (A, uniFactors, alpha, degs);
       factors= Union (lll, factors);
     }
-    else if (!extension && (alpha != Variable (1) || GF))
+    else if (!extension && (alpha != x || GF))
     {
       CFList lll= henselLiftAndLatticeRecombi (A, uniFactors, alpha, degs);
       factors= Union (lll, factors);
@@ -5757,7 +5763,7 @@ extBiFactorize (const CanonicalForm& F, const ExtensionInfo& info)
     }
     else // not able to pass to GF, pass to F_p(\alpha)
     {
-      CanonicalForm mipo= randomIrredpoly (2, Variable (1));
+      CanonicalForm mipo= randomIrredpoly (2, x);
       Variable v= rootOf (mipo);
       ExtensionInfo info2= ExtensionInfo (v);
       factors= biFactorize (A, info2);
@@ -5770,14 +5776,14 @@ extBiFactorize (const CanonicalForm& F, const ExtensionInfo& info)
     {
       int extDeg= degree (getMipo (alpha));
       extDeg++;
-      CanonicalForm mipo= randomIrredpoly (extDeg + 1, Variable (1));
+      CanonicalForm mipo= randomIrredpoly (extDeg + 1, x);
       Variable v= rootOf (mipo);
       ExtensionInfo info2= ExtensionInfo (v);
       factors= biFactorize (A, info2);
     }
     else
     {
-      if (beta == Variable (1))
+      if (beta == x)
       {
         Variable v= chooseExtension (alpha, beta, k);
         CanonicalForm primElem, imPrimElem;
diff --git a/factory/facFqFactorize.cc b/factory/facFqFactorize.cc
index bfbbebf..7a79fab 100644
--- a/factory/facFqFactorize.cc
+++ b/factory/facFqFactorize.cc
@@ -46,15 +46,16 @@ static inline
 CanonicalForm
 myContent (const CanonicalForm& F)
 {
-  CanonicalForm G= swapvar (F, F.mvar(), Variable (1));
+  Variable x= Variable (1);
+  CanonicalForm G= swapvar (F, F.mvar(), x);
   CFList L;
   for (CFIterator i= G; i.hasTerms(); i++)
     L.append (i.coeff());
   if (L.length() == 2)
-    return swapvar (gcd (L.getFirst(), L.getLast()), F.mvar(), Variable (1));
+    return swapvar (gcd (L.getFirst(), L.getLast()), F.mvar(), x);
   if (L.length() == 1)
-    return LC (F, Variable (1));
-  return swapvar (listGCD (L), F.mvar(), Variable (1));
+    return LC (F, x);
+  return swapvar (listGCD (L), F.mvar(), x);
 }
 
 static inline
@@ -211,7 +212,8 @@ extFactorRecombination (const CFList& factors, const CanonicalForm& F,
 
   buf= F;
 
-  CanonicalForm g, LCBuf= LC (buf, Variable (1));
+  Variable x= Variable (1);
+  CanonicalForm g, LCBuf= LC (buf, x);
   CanonicalForm buf2, quot;
   int * v= new int [T.length()];
   for (int i= 0; i < T.length(); i++)
@@ -257,13 +259,13 @@ extFactorRecombination (const CFList& factors, const CanonicalForm& F,
       {
         buf2= reverseShift (g, evaluation);
         buf2 /= Lc (buf2);
-        if (!k && beta == Variable (1))
+        if (!k && beta == x)
         {
           if (degree (buf2, alpha) < degMipoBeta)
           {
             appendTestMapDown (result, buf2, info, source, dest);
             buf= quot;
-            LCBuf= LC (buf, Variable (1));
+            LCBuf= LC (buf, x);
             recombination= true;
             trueFactor= true;
           }
@@ -274,7 +276,7 @@ extFactorRecombination (const CFList& factors, const CanonicalForm& F,
           {
             appendTestMapDown (result, buf2, info, source, dest);
             buf /= g;
-            LCBuf= LC (buf, Variable (1));
+            LCBuf= LC (buf, x);
             recombination= true;
             trueFactor= true;
           }
@@ -413,7 +415,8 @@ liftBoundAdaption (const CanonicalForm& F, const CFList& factors, bool&
   int adaptedLiftBound= 0;
   CanonicalForm buf= F;
   Variable y= F.mvar();
-  CanonicalForm LCBuf= LC (buf, Variable (1));
+  Variable x= Variable (1);
+  CanonicalForm LCBuf= LC (buf, x);
   CanonicalForm g, quot;
   CFList M= MOD;
   M.append (power (y, deg));
@@ -430,7 +433,7 @@ liftBoundAdaption (const CanonicalForm& F, const CFList& factors, bool&
       d -= nBuf;
       e= tmax (e, nBuf);
       buf= quot;
-      LCBuf= LC (buf, Variable (1));
+      LCBuf= LC (buf, x);
     }
   }
   adaptedLiftBound= d;
@@ -482,7 +485,8 @@ extLiftBoundAdaption (const CanonicalForm& F, const CFList& factors, bool&
   int adaptedLiftBound= 0;
   CanonicalForm buf= F;
   Variable y= F.mvar();
-  CanonicalForm LCBuf= LC (buf, Variable (1));
+  Variable x= Variable (1);
+  CanonicalForm LCBuf= LC (buf, x);
   CanonicalForm g, gg, quot;
   CFList M= MOD;
   M.append (power (y, deg));
@@ -503,15 +507,15 @@ extLiftBoundAdaption (const CanonicalForm& F, const CFList& factors, bool&
     {
       gg= reverseShift (g, eval);
       gg /= Lc (gg);
-      if (!k && beta == Variable (1))
+      if (!k && beta == x)
       {
         if (degree (gg, alpha) < degMipoBeta)
         {
           buf= quot;
-          nBuf= degree (g, y) + degree (LC (g, Variable (1)), y);
+          nBuf= degree (g, y) + degree (LC (g, x), y);
           d -= nBuf;
           e= tmax (e, nBuf);
-          LCBuf= LC (buf, Variable (1));
+          LCBuf= LC (buf, x);
         }
       }
       else
@@ -519,10 +523,10 @@ extLiftBoundAdaption (const CanonicalForm& F, const CFList& factors, bool&
         if (!isInExtension (gg, gamma, k, delta, source, dest))
         {
           buf= quot;
-          nBuf= degree (g, y) + degree (LC (g, Variable (1)), y);
+          nBuf= degree (g, y) + degree (LC (g, x), y);
           d -= nBuf;
           e= tmax (e, nBuf);
-          LCBuf= LC (buf, Variable (1));
+          LCBuf= LC (buf, x);
         }
       }
     }
@@ -573,7 +577,8 @@ earlyFactorDetect (CanonicalForm& F, CFList& factors, int& adaptedLiftBound,
   CFList T= factors;
   CanonicalForm buf= F;
   Variable y= F.mvar();
-  CanonicalForm LCBuf= LC (buf, Variable (1));
+  Variable x= Variable (1);
+  CanonicalForm LCBuf= LC (buf, x);
   CanonicalForm g, quot;
   CFList M= MOD;
   M.append (power (y, deg));
@@ -588,11 +593,11 @@ earlyFactorDetect (CanonicalForm& F, CFList& factors, int& adaptedLiftBound,
     if (fdivides (g, buf, quot))
     {
       result.append (g);
-      nBuf= degree (g, y) + degree (LC (g, Variable (1)), y);
+      nBuf= degree (g, y) + degree (LC (g, x), y);
       d -= nBuf;
       e= tmax (e, nBuf);
       buf= quot;
-      LCBuf= LC (buf, Variable (1));
+      LCBuf= LC (buf, x);
       T= Difference (T, CFList (i.getItem()));
     }
   }
@@ -628,7 +633,8 @@ extEarlyFactorDetect (CanonicalForm& F, CFList& factors, int& adaptedLiftBound,
   CFList T= factors;
   CanonicalForm buf= F;
   Variable y= F.mvar();
-  CanonicalForm LCBuf= LC (buf, Variable (1));
+  Variable x= Variable (1);
+  CanonicalForm LCBuf= LC (buf, x);
   CanonicalForm g, gg, quot;
   CFList M= MOD;
   M.append (power (y, deg));
@@ -650,16 +656,16 @@ extEarlyFactorDetect (CanonicalForm& F, CFList& factors, int& adaptedLiftBound,
     {
       gg= reverseShift (g, eval);
       gg /= Lc (gg);
-      if (!k && beta == Variable (1))
+      if (!k && beta == x)
       {
         if (degree (gg, alpha) < degMipoBeta)
         {
           appendTestMapDown (result, gg, info, source, dest);
           buf= quot;
-          nBuf= degree (g, y) + degree (LC (g, Variable (1)), y);
+          nBuf= degree (g, y) + degree (LC (g, x), y);
           d -= nBuf;
           e= tmax (e, nBuf);
-          LCBuf= LC (buf, Variable (1));
+          LCBuf= LC (buf, x);
           T= Difference (T, CFList (i.getItem()));
         }
       }
@@ -669,10 +675,10 @@ extEarlyFactorDetect (CanonicalForm& F, CFList& factors, int& adaptedLiftBound,
         {
           appendTestMapDown (result, gg, info, source, dest);
           buf= quot;
-          nBuf= degree (g, y) + degree (LC (g, Variable (1)), y);
+          nBuf= degree (g, y) + degree (LC (g, x), y);
           d -= nBuf;
           e= tmax (e, nBuf);
-          LCBuf= LC (buf, Variable (1));
+          LCBuf= LC (buf, x);
           T= Difference (T, CFList (i.getItem()));
          }
       }
@@ -707,7 +713,7 @@ evalPoints (const CanonicalForm& F, CFList & eval, const Variable& alpha,
   GFRandom genGF;
   int p= getCharacteristic ();
   double bound;
-  if (alpha != Variable (1))
+  if (alpha != x)
   {
     bound= pow ((double) p, (double) degree (getMipo(alpha)));
     bound= pow ((double) bound, (double) k);
@@ -2131,7 +2137,7 @@ extNonMonicFactorRecombination (const CFList& factors, const CanonicalForm& F,
       {
         buf2= g;
         buf2 /= Lc (buf2);
-        if (!k && beta == Variable (1))
+        if (!k && beta.level() == 1)
         {
           if (degree (buf2, alpha) < degMipoBeta)
           {
@@ -2782,7 +2788,7 @@ extFactorize (const CanonicalForm& F, const ExtensionInfo& info)
     }
     else  // not able to pass to GF, pass to F_p(\alpha)
     {
-      CanonicalForm mipo= randomIrredpoly (2, Variable (1));
+      CanonicalForm mipo= randomIrredpoly (2, w);
       Variable v= rootOf (mipo);
       ExtensionInfo info= ExtensionInfo (v);
       factors= multiFactorize (A, info);
@@ -2795,14 +2801,14 @@ extFactorize (const CanonicalForm& F, const ExtensionInfo& info)
     {
       int extDeg= degree (getMipo (alpha));
       extDeg++;
-      CanonicalForm mipo= randomIrredpoly (extDeg + 1, Variable (1));
+      CanonicalForm mipo= randomIrredpoly (extDeg + 1, w);
       Variable v= rootOf (mipo);
       ExtensionInfo info= ExtensionInfo (v);
       factors= biFactorize (A, info);
     }
     else
     {
-      if (beta == Variable (1))
+      if (beta == w)
       {
         Variable v= chooseExtension (alpha, beta, k);
         CanonicalForm primElem, imPrimElem;

-- 
an open source computer algebra system



More information about the debian-science-commits mailing list