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

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


The following commit has been merged in the cleanedupstream branch:
commit 735c9a8e9a9b77d2524885363b87adac5ef68c17
Author: Martin Lee <martinlee84 at web.de>
Date:   Wed Jan 25 22:29:16 2012 +0100

    chg: computation of log derivative now expects truncated input

diff --git a/factory/facFqBivar.cc b/factory/facFqBivar.cc
index 8ed83e1..400d4af 100644
--- a/factory/facFqBivar.cc
+++ b/factory/facFqBivar.cc
@@ -1400,6 +1400,8 @@ liftAndComputeLattice (const CanonicalForm& F, int* bounds, int sizeBounds, int
   CFMatrix C;
   CFArray buf;
   CFListIterator j;
+  CanonicalForm truncF;
+  Variable y= F.mvar();
   while (l <= liftBound)
   {
     if (start)
@@ -1419,12 +1421,14 @@ liftAndComputeLattice (const CanonicalForm& F, int* bounds, int sizeBounds, int
     j= factors;
     j++;
 
+    truncF= mod (F, power (y, l));
     for (int i= 0; i < factors.length() - 1; i++, j++)
     {
       if (!wasInBounds)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ[i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, bufQ[i]);
       else
-        A[i]= logarithmicDerivative (F, j.getItem(), l, oldL, bufQ[i], bufQ[i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, oldL, bufQ[i],
+                                     bufQ[i]);
     }
 
     for (int i= 0; i < sizeBounds; i++)
@@ -1516,7 +1520,7 @@ extLiftAndComputeLattice (const CanonicalForm& F, int* bounds, int sizeBounds,
   bool reduced= false;
   Variable y= F.mvar();
   Variable x= Variable (1);
-  CanonicalForm powX, imBasis;
+  CanonicalForm powX, imBasis, truncF;
   CFMatrix Mat, C;
   CFArray buf;
   CFIterator iter;
@@ -1563,12 +1567,14 @@ extLiftAndComputeLattice (const CanonicalForm& F, int* bounds, int sizeBounds,
     j= factors;
     j++;
 
+    truncF= mod (F, power (y, l));
     for (int i= 0; i < factors.length() - 1; i++, j++)
     {
       if (!wasInBounds)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ[i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, bufQ[i]);
       else
-        A[i]= logarithmicDerivative (F, j.getItem(), l, oldL, bufQ[i], bufQ[i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, oldL, bufQ[i],
+                                     bufQ[i]);
     }
 
     for (int i= 0; i < sizeBounds; i++)
@@ -1680,6 +1686,8 @@ liftAndComputeLattice (const CanonicalForm& F, int* bounds, int sizeBounds,
   mat_zz_pE* NTLC, NTLK;
   CFArray buf;
   CFMatrix C;
+  Variable y= F.mvar();
+  CanonicalForm truncF;
   while (l <= liftBound)
   {
     if (start)
@@ -1699,15 +1707,16 @@ liftAndComputeLattice (const CanonicalForm& F, int* bounds, int sizeBounds,
     j= factors;
     j++;
 
+    truncF= mod (F, power (y,l));
     for (int i= 0; i < factors.length() - 1; i++, j++)
     {
       if (l == (minBound+1)*2)
       {
-        A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ[i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, bufQ[i]);
       }
       else
       {
-        A[i]= logarithmicDerivative (F, j.getItem(), l, oldL, bufQ[i],
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, oldL, bufQ[i],
                                      bufQ[i]
                                     );
       }
@@ -1794,6 +1803,8 @@ liftAndComputeLatticeFq2Fp (const CanonicalForm& F, int* bounds, int sizeBounds,
   CFMatrix C;
   CFArray buf;
   mat_zz_p* NTLC, NTLK;
+  Variable y= F.mvar();
+  CanonicalForm truncF;
   while (l <= liftBound)
   {
     if (start)
@@ -1813,15 +1824,16 @@ liftAndComputeLatticeFq2Fp (const CanonicalForm& F, int* bounds, int sizeBounds,
     j= factors;
     j++;
 
+    truncF= mod (F, power (y,l));
     for (int i= 0; i < factors.length() - 1; i++, j++)
     {
       if (l == (minBound+1)*2)
       {
-        A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ[i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, bufQ[i]);
       }
       else
       {
-        A[i]= logarithmicDerivative (F, j.getItem(), l, oldL, bufQ[i],
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, oldL, bufQ[i],
                                      bufQ[i]
                                     );
       }
@@ -1913,20 +1925,23 @@ increasePrecision (CanonicalForm& F, CFList& factors, int factorsFound,
   CFMatrix C;
   CFArray buf;
   mat_zz_p* NTLC, NTLK;
+  Variable y= F.mvar();
+  CanonicalForm truncF;
   while (l <= precision)
   {
     j= factors;
+    truncF= mod (F, power (y,l));
     if (useOldQs)
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, oldL2, bufQ[i],
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, oldL2, bufQ[i],
                                      bufQ[i]
                                     );
     }
     else
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ [i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, bufQ [i]);
     }
     useOldQs= true;
     for (int i= 0; i < d; i++)
@@ -2040,20 +2055,23 @@ increasePrecision (CanonicalForm& F, CFList& factors, int factorsFound,
   CFMatrix C;
   mat_zz_pE* NTLC, NTLK;
   CFArray buf;
+  Variable y= F.mvar();
+  CanonicalForm truncF;
   while (l <= precision)
   {
     j= factors;
+    truncF= mod (F, power (y,l));
     if (useOldQs)
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, oldL2, bufQ[i],
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, oldL2, bufQ[i],
                                      bufQ[i]
                                     );
     }
     else
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ [i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, bufQ [i]);
     }
     useOldQs= true;
     for (int i= 0; i < d; i++)
@@ -2172,7 +2190,7 @@ extIncreasePrecision (CanonicalForm& F, CFList& factors, int factorsFound,
   CanonicalForm imPrimElemAlpha= info.getDelta();
   CFListIterator j;
   Variable y= F.mvar();
-  CanonicalForm powX, imBasis;
+  CanonicalForm powX, imBasis, truncF;
   CFMatrix Mat, C;
   CFIterator iter;
   mat_zz_p* NTLMat,*NTLC, NTLK;
@@ -2199,17 +2217,18 @@ extIncreasePrecision (CanonicalForm& F, CFList& factors, int factorsFound,
     if (GF)
       setCharacteristic (getCharacteristic(), degMipo, info.getGFName());
 
+    truncF= mod (F, power (y, l));
     if (useOldQs)
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, oldL2, bufQ[i],
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, oldL2, bufQ[i],
                                      bufQ[i]
                                     );
     }
     else
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ [i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, bufQ [i]);
     }
     useOldQs= true;
     for (int i= 0; i < d; i++)
@@ -2355,23 +2374,25 @@ increasePrecision2 (const CanonicalForm& F, CFList& factors,
   int stepSize= 2;
   bool useOldQs= false;
   bool hitBound= false;
-  Variable y= Variable (2);
   CFListIterator j;
   CFMatrix C;
   CFArray buf;
   mat_zz_pE* NTLC, NTLK;
+  Variable y= F.mvar();
+  CanonicalForm truncF;
   while (l <= precision)
   {
     j= factors;
+    truncF= mod (F, power (y, l));
     if (useOldQs)
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, oldL, bufQ[i], bufQ[i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, oldL, bufQ[i], bufQ[i]);
     }
     else
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ [i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, bufQ [i]);
     }
     useOldQs= true;
     for (int i= 0; i < d; i++)
@@ -2475,20 +2496,23 @@ increasePrecisionFq2Fp (CanonicalForm& F, CFList& factors, int factorsFound,
   CFMatrix C;
   mat_zz_p* NTLC, NTLK;
   CFArray buf;
+  Variable y= F.mvar();
+  CanonicalForm truncF;
   while (l <= precision)
   {
     j= factors;
+    truncF= mod (F, power (y, l));
     if (useOldQs)
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, oldL2, bufQ[i],
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, oldL2, bufQ[i],
                                      bufQ[i]
                                     );
     }
     else
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ [i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, bufQ [i]);
     }
     useOldQs= true;
     for (int i= 0; i < d; i++)
@@ -2592,22 +2616,24 @@ increasePrecision (CanonicalForm& F, CFList& factors, int oldL, int
   CFMatrix C;
   CFArray buf;
   mat_zz_p* NTLC, NTLK;
-  CanonicalForm bufF;
+  CanonicalForm bufF, truncF;
   CFList bufUniFactors;
+  Variable y= F.mvar();
   while (oldL <= l)
   {
     j= factors;
+    truncF= mod (F, power (y, oldL));
     if (useOldQs)
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), oldL, oldL2, bufQ[i],
+        A[i]= logarithmicDerivative (truncF, j.getItem(), oldL, oldL2, bufQ[i],
                                      bufQ[i]
                                     );
     }
     else
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), oldL, bufQ [i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), oldL, bufQ [i]);
     }
     useOldQs= true;
 
@@ -2692,22 +2718,24 @@ increasePrecision (CanonicalForm& F, CFList& factors, int oldL, int
   CFMatrix C;
   CFArray buf;
   mat_zz_pE* NTLC, NTLK;
-  CanonicalForm bufF;
+  CanonicalForm bufF, truncF;
   CFList bufUniFactors;
+  Variable y= F.mvar();
   while (oldL <= l)
   {
     j= factors;
+    truncF= mod (F, power (y, oldL));
     if (useOldQs)
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), oldL, oldL2, bufQ[i],
+        A[i]= logarithmicDerivative (truncF, j.getItem(), oldL, oldL2, bufQ[i],
                                      bufQ[i]
                                     );
     }
     else
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), oldL, bufQ [i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), oldL, bufQ [i]);
     }
     useOldQs= true;
 
@@ -2801,7 +2829,7 @@ extIncreasePrecision (CanonicalForm& F, CFList& factors, int oldL, int l, int d,
     ident (NTLN, factors.length());
   Variable y= F.mvar();
   CFListIterator j;
-  CanonicalForm powX, imBasis, bufF;
+  CanonicalForm powX, imBasis, bufF, truncF;
   CFMatrix Mat, C;
   CFIterator iter;
   mat_zz_p* NTLMat;
@@ -2831,16 +2859,17 @@ extIncreasePrecision (CanonicalForm& F, CFList& factors, int oldL, int l, int d,
     if (GF)
       setCharacteristic (getCharacteristic(), degMipo, info.getGFName());
 
+    truncF= mod (F, power (y, oldL));
     if (useOldQs)
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), oldL, oldL2, bufQ[i],
+        A[i]= logarithmicDerivative (truncF, j.getItem(), oldL, oldL2, bufQ[i],
                                      bufQ[i]);
     }
     else
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), oldL, bufQ [i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), oldL, bufQ [i]);
     }
     useOldQs= true;
 
@@ -2968,22 +2997,24 @@ increasePrecisionFq2Fp (CanonicalForm& F, CFList& factors, int oldL, int l,
   CFMatrix C;
   CFArray buf;
   mat_zz_p* NTLC, NTLK;
-  CanonicalForm bufF;
+  CanonicalForm bufF, truncF;
   CFList bufUniFactors;
+  Variable y= F.mvar();
   while (oldL <= l)
   {
     j= factors;
+    truncF= mod (F, power (y, oldL));
     if (useOldQs)
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), oldL, oldL2, bufQ[i],
+        A[i]= logarithmicDerivative (truncF, j.getItem(), oldL, oldL2, bufQ[i],
                                      bufQ[i]
                                     );
     }
     else
     {
       for (int i= 0; i < factors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), oldL, bufQ [i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), oldL, bufQ [i]);
     }
     useOldQs= true;
 
@@ -3070,7 +3101,8 @@ furtherLiftingAndIncreasePrecision (CanonicalForm& F, CFList&
   CFMatrix C;
   CFArray buf;
   mat_zz_p* NTLC, NTLK;
-  CanonicalForm bufF;
+  CanonicalForm bufF, truncF;
+  Variable y= F.mvar();
   while (l <= liftBound)
   {
     bufFactors.insert (LCF);
@@ -3078,15 +3110,17 @@ furtherLiftingAndIncreasePrecision (CanonicalForm& F, CFList&
     bufFactors.insert (LCF);
     bufFactors.removeFirst();
     j= bufFactors;
+    truncF= mod (F, power (y, l));
     if (useOldQs)
     {
       for (int i= 0; i < bufFactors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, oldL, bufQ[i],bufQ[i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, oldL, bufQ[i],
+                                     bufQ[i]);
     }
     else
     {
       for (int i= 0; i < bufFactors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ [i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, bufQ [i]);
     }
     for (int i= 0; i < d; i++)
     {
@@ -3205,21 +3239,24 @@ furtherLiftingAndIncreasePrecision (CanonicalForm& F, CFList&
   CFListIterator j;
   CFArray buf;
   mat_zz_pE* NTLC, NTLK;
-  CanonicalForm bufF;
+  CanonicalForm bufF, truncF;
+  Variable y= F.mvar();
   while (l <= liftBound)
   {
     bufFactors.insert (LCF);
     henselLiftResume12 (F, bufFactors, oldL, l, Pi, diophant, M);
     j= bufFactors;
+    truncF= mod (F, power (y, l));
     if (useOldQs)
     {
       for (int i= 0; i < bufFactors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, oldL, bufQ[i],bufQ[i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, oldL, bufQ[i],
+                                     bufQ[i]);
     }
     else
     {
       for (int i= 0; i < bufFactors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ [i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, bufQ [i]);
     }
     for (int i= 0; i < d; i++)
     {
@@ -3343,7 +3380,7 @@ extFurtherLiftingAndIncreasePrecision (CanonicalForm& F, CFList& factors, int l,
   if (NTLN.NumRows() != factors.length()) //refined factors
     ident (NTLN, factors.length());
   Variable y= F.mvar();
-  CanonicalForm powX, imBasis, bufF;
+  CanonicalForm powX, imBasis, bufF, truncF;
   CFMatrix Mat, C;
   CFIterator iter;
   mat_zz_p* NTLMat,*NTLC, NTLK;
@@ -3377,15 +3414,17 @@ extFurtherLiftingAndIncreasePrecision (CanonicalForm& F, CFList& factors, int l,
       setCharacteristic (getCharacteristic(), degMipo, info.getGFName());
 
     j= bufFactors;
+    truncF= mod (F, power (y, l));
     if (useOldQs)
     {
       for (int i= 0; i < bufFactors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, oldL, bufQ[i],bufQ[i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, oldL, bufQ[i],
+                                     bufQ[i]);
     }
     else
     {
       for (int i= 0; i < bufFactors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ [i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, bufQ [i]);
     }
     for (int i= 0; i < d; i++)
     {
@@ -3538,21 +3577,24 @@ furtherLiftingAndIncreasePrecisionFq2Fp (CanonicalForm& F, CFList& factors, int
   CFListIterator j;
   CFMatrix C;
   mat_zz_p* NTLC, NTLK;
-  CanonicalForm bufF;
+  CanonicalForm bufF, truncF;
+  Variable y= F.mvar();
   while (l <= liftBound)
   {
     bufFactors.insert (LCF);
     henselLiftResume12 (F, bufFactors, oldL, l, Pi, diophant, M);
     j= bufFactors;
+    truncF= mod (F, power (y, l));
     if (useOldQs)
     {
       for (int i= 0; i < bufFactors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, oldL, bufQ[i],bufQ[i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, oldL, bufQ[i],
+                                     bufQ[i]);
     }
     else
     {
       for (int i= 0; i < bufFactors.length(); i++, j++)
-        A[i]= logarithmicDerivative (F, j.getItem(), l, bufQ [i]);
+        A[i]= logarithmicDerivative (truncF, j.getItem(), l, bufQ [i]);
     }
     for (int i= 0; i < d; i++)
     {
diff --git a/factory/facFqBivarUtil.cc b/factory/facFqBivarUtil.cc
index 297aff0..6714672 100644
--- a/factory/facFqBivarUtil.cc
+++ b/factory/facFqBivarUtil.cc
@@ -479,7 +479,7 @@ logarithmicDerivative (const CanonicalForm& F, const CanonicalForm& G, int l,
   CanonicalForm q,r;
   CanonicalForm logDeriv;
 
-  CanonicalForm bufF= mod (F, xToL);
+  CanonicalForm bufF= F;
   CanonicalForm oldF= mulMod2 (G, oldQ, xToL);
   bufF -= oldF;
   bufF= div (bufF, xToOldL);
diff --git a/factory/facFqBivarUtil.h b/factory/facFqBivarUtil.h
index 92df788..f2bec08 100644
--- a/factory/facFqBivarUtil.h
+++ b/factory/facFqBivarUtil.h
@@ -188,7 +188,8 @@ CFArray logarithmicDerivative (const CanonicalForm& F,///<[in] a bivariate poly
 /// @return an array of coefficients of the logarithmic derivative of G mod
 ///         Variable (2)^l
 CFArray
-logarithmicDerivative (const CanonicalForm& F,   ///< [in] bivariate poly
+logarithmicDerivative (const CanonicalForm& F,   ///< [in] bivariate poly 
+                                                 ///< truncated at Variable(2)^l
                        const CanonicalForm& G,   ///< [in] a factor of F
                        int l,                    ///< [in] lifting precision
                        int oldL,                 ///< [in] old precision

-- 
an open source computer algebra system



More information about the debian-science-commits mailing list