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

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


The following commit has been merged in the cleanedupstream branch:
commit f6518814895e9b03c8e7d4fd63ec7a7b2d85b3c7
Author: Martin Lee <martinlee84 at web.de>
Date:   Tue Jan 24 12:40:45 2012 +0100

    chg: use shape of Newton polygon also in lattice recombination

diff --git a/factory/facFqBivar.cc b/factory/facFqBivar.cc
index 7b2a810..96bae26 100644
--- a/factory/facFqBivar.cc
+++ b/factory/facFqBivar.cc
@@ -3879,11 +3879,14 @@ earlyReconstructionAndLifting (const CanonicalForm& F, const mat_zz_p& N,
                                CFArray& Pi, CFList& diophant
                               )
 {
-  bufF= F;
+  int sizeOfLiftPre;
+  int * liftPre= getLiftPrecisions (F, sizeOfLiftPre, degree (LC (F, 1), 2));
+
+  Variable y= F.mvar();
   factorsFound= 0;
   CanonicalForm LCF= LC (F, 1);
   CFList result;
-  int smallFactorDeg= 11;
+  int smallFactorDeg= tmin (11, liftPre [sizeOfLiftPre- 1] + 1);
   mat_zz_p NTLN= N;
   int * factorsFoundIndex= new int [NTLN.NumCols()];
   for (long i= 0; i < NTLN.NumCols(); i++)
@@ -3902,40 +3905,76 @@ earlyReconstructionAndLifting (const CanonicalForm& F, const mat_zz_p& N,
                       );
     if (result.length() == NTLN.NumCols())
     {
+      delete [] liftPre;
       delete [] factorsFoundIndex;
       return result;
     }
   }
 
-  if (l < degree (bufF)/2+2)
+  int i= sizeOfLiftPre - 1;
+  int dummy= 1;
+  if (sizeOfLiftPre > 1 && sizeOfLiftPre < 30)
   {
-    factors.insert (LCF);
-    henselLiftResume12 (F, factors, l, degree (bufF)/2 + 2, Pi, diophant, M);
-    l= degree (bufF)/2 + 2;
+    while (i > 0)
+    {
+      if (l < liftPre[i-1] + 1)
+      {
+        factors.insert (LCF);
+        henselLiftResume12 (F, factors, l, liftPre[i-1] + 1, Pi, diophant, M);
+        l= liftPre[i-1] + 1;
+      }
+      else
+      {
+        i--;
+        if (i != 0)
+          continue;
+      }
+      reconstructionTry (result, bufF, factors, l, factorsFound,
+                         factorsFoundIndex, NTLN, beenInThres
+                        );
+      if (result.length() == NTLN.NumCols())
+      {
+        delete [] liftPre;
+        delete [] factorsFoundIndex;
+        return result;
+      }
+      i--;
+    }
   }
-  reconstructionTry (result, bufF, factors, degree (bufF)/2 + 2,
-                     factorsFound, factorsFoundIndex, NTLN, beenInThres
-                    );
-  if (result.length() == NTLN.NumCols())
+  else
   {
-    delete [] factorsFoundIndex;
-    return result;
+    i= 1;
+    while ((degree (F,y)/4)*i + 4 <= smallFactorDeg)
+      i++;
+    while (i < 4)
+    {
+      dummy= tmin (degree (F,y)+1, (degree (F,y)/4)*(i+1)+4);
+      if (l < dummy)
+      {
+        factors.insert (LCF);
+        henselLiftResume12 (F, factors, l, dummy, Pi, diophant, M);
+        l= dummy;
+      }
+      else
+      {
+        i++;
+        if (i < 4)
+          continue;
+      }
+      reconstructionTry (result, bufF, factors, l, factorsFound,
+                         factorsFoundIndex, NTLN, beenInThres
+                        );
+      if (result.length() == NTLN.NumCols())
+      {
+        delete [] liftPre;
+        delete [] factorsFoundIndex;
+        return result;
+      }
+      i++;
+    }
   }
 
-  if (l < degree (F) + 1)
-  {
-    factors.insert (LCF);
-    henselLiftResume12 (F, factors, l, degree (bufF) + 1, Pi, diophant, M);
-    l= degree (bufF) + 1;
-  }
-  reconstructionTry (result, bufF, factors, degree (bufF) + 1, factorsFound,
-                     factorsFoundIndex, NTLN, beenInThres
-                    );
-  if (result.length() == NTLN.NumCols())
-  {
-    delete [] factorsFoundIndex;
-    return result;
-  }
+  delete [] liftPre;
   delete [] factorsFoundIndex;
   return result;
 }
@@ -3947,7 +3986,9 @@ earlyReconstructionAndLifting (const CanonicalForm& F, const mat_zz_pE& N,
                                CFArray& Pi, CFList& diophant
                               )
 {
-  bufF= F;
+  int sizeOfLiftPre;
+  int * liftPre= getLiftPrecisions (F, sizeOfLiftPre, degree (LC (F, 1), 2));
+  Variable y= F.mvar();
   factorsFound= 0;
   CanonicalForm LCF= LC (F, 1);
   CFList result;
@@ -3956,6 +3997,7 @@ earlyReconstructionAndLifting (const CanonicalForm& F, const mat_zz_pE& N,
   int * factorsFoundIndex= new int [NTLN.NumCols()];
   for (long i= 0; i < NTLN.NumCols(); i++)
     factorsFoundIndex [i]= 0;
+
   if (degree (F) + 1 > smallFactorDeg)
   {
     if (l < smallFactorDeg)
@@ -3969,40 +4011,76 @@ earlyReconstructionAndLifting (const CanonicalForm& F, const mat_zz_pE& N,
                       );
     if (result.length() == NTLN.NumCols())
     {
+      delete [] liftPre;
       delete [] factorsFoundIndex;
       return result;
     }
   }
 
-  if (l < degree (bufF)/2+2)
+  int i= sizeOfLiftPre - 1;
+  int dummy= 1;
+  if (sizeOfLiftPre > 1 && sizeOfLiftPre < 30)
   {
-    factors.insert (LCF);
-    henselLiftResume12 (F, factors, l, degree (bufF)/2 + 2, Pi, diophant, M);
-    l= degree (bufF)/2 + 2;
+    while (i > 0)
+    {
+      if (l < liftPre[i-1] + 1)
+      {
+        factors.insert (LCF);
+        henselLiftResume12 (F, factors, l, liftPre[i-1] + 1, Pi, diophant, M);
+        l= liftPre[i-1] + 1;
+      }
+      else
+      {
+        i--;
+        if (i != 0)
+          continue;
+      }
+      reconstructionTry (result, bufF, factors, l, factorsFound,
+                         factorsFoundIndex, NTLN, beenInThres
+                        );
+      if (result.length() == NTLN.NumCols())
+      {
+        delete [] liftPre;
+        delete [] factorsFoundIndex;
+        return result;
+      }
+      i--;
+    }
   }
-  reconstructionTry (result, bufF, factors, degree (bufF)/2 + 2,
-                     factorsFound, factorsFoundIndex, NTLN, beenInThres
-                    );
-  if (result.length() == NTLN.NumCols())
+  else
   {
-    delete [] factorsFoundIndex;
-    return result;
+    i= 1;
+    while ((degree (F,y)/4)*i + 4 <= smallFactorDeg)
+      i++;
+    while (i < 4)
+    {
+      dummy= tmin (degree (F,y)+1, (degree (F,y)/4)*(i+1)+4);
+      if (l < dummy)
+      {
+        factors.insert (LCF);
+        henselLiftResume12 (F, factors, l, dummy, Pi, diophant, M);
+        l= dummy;
+      }
+      else
+      {
+        i++;
+        if (i < 4)
+          continue;
+      }
+      reconstructionTry (result, bufF, factors, l, factorsFound,
+                         factorsFoundIndex, NTLN, beenInThres
+                        );
+      if (result.length() == NTLN.NumCols())
+      {
+        delete [] liftPre;
+        delete [] factorsFoundIndex;
+        return result;
+      }
+      i++;
+    }
   }
 
-  if (l < degree (F) + 1)
-  {
-    factors.insert (LCF);
-    henselLiftResume12 (F, factors, l, degree (bufF) + 1, Pi, diophant, M);
-    l= degree (bufF) + 1;
-  }
-  reconstructionTry (result, bufF, factors, degree (bufF) + 1, factorsFound,
-                     factorsFoundIndex, NTLN, beenInThres
-                    );
-  if (result.length() == NTLN.NumCols())
-  {
-    delete [] factorsFoundIndex;
-    return result;
-  }
+  delete [] liftPre;
   delete [] factorsFoundIndex;
   return result;
 }
@@ -4017,7 +4095,9 @@ extEarlyReconstructionAndLifting (const CanonicalForm& F, const mat_zz_p& N,
                                   evaluation
                                  )
 {
-  bufF= F;
+  int sizeOfLiftPre;
+  int * liftPre= getLiftPrecisions (F, sizeOfLiftPre, degree (LC (F, 1), 2));
+  Variable y= F.mvar();
   factorsFound= 0;
   CanonicalForm LCF= LC (F, 1);
   CFList result;
@@ -4038,45 +4118,81 @@ extEarlyReconstructionAndLifting (const CanonicalForm& F, const mat_zz_p& N,
     extReconstructionTry (result, bufF, factors, smallFactorDeg, factorsFound,
                           factorsFoundIndex, NTLN, beenInThres, info,
                           evaluation
-                         );
+                      );
     if (result.length() == NTLN.NumCols())
     {
+      delete [] liftPre;
       delete [] factorsFoundIndex;
       return result;
     }
   }
 
-  if (l < degree (bufF)/2+2)
+  int i= sizeOfLiftPre - 1;
+  int dummy= 1;
+  if (sizeOfLiftPre > 1 && sizeOfLiftPre < 30)
   {
-    factors.insert (LCF);
-    henselLiftResume12 (F, factors, l, degree (bufF)/2 + 2, Pi, diophant, M);
-    l= degree (bufF)/2 + 2;
-  }
-  extReconstructionTry (result, bufF, factors, degree (bufF)/2 + 2,
-                       factorsFound, factorsFoundIndex, NTLN, beenInThres, info,
-                       evaluation
-                       );
-  if (result.length() == NTLN.NumCols())
-  {
-    delete [] factorsFoundIndex;
-    return result;
+    while (i > 0)
+    {
+      if (l < liftPre[i-1] + 1)
+      {
+        factors.insert (LCF);
+        henselLiftResume12 (F, factors, l, liftPre[i-1] + 1, Pi, diophant, M);
+        l= liftPre[i-1] + 1;
+      }
+      else
+      {
+        i--;
+        if (i != 0)
+          continue;
+      }
+      extReconstructionTry (result, bufF, factors, l, factorsFound,
+                            factorsFoundIndex, NTLN, beenInThres, info,
+                            evaluation
+                           );
+      if (result.length() == NTLN.NumCols())
+      {
+        delete [] liftPre;
+        delete [] factorsFoundIndex;
+        return result;
+      }
+      i--;
+    }
   }
-
-  if (l < degree (bufF) + 1)
+  else
   {
-    factors.insert (LCF);
-    henselLiftResume12 (F, factors, l, degree (bufF) + 1, Pi, diophant, M);
-    l= degree (bufF) + 1;
+    i= 1;
+    while ((degree (F,y)/4)*i + 4 <= smallFactorDeg)
+      i++;
+    while (i < 4)
+    {
+      dummy= tmin (degree (F,y)+1, (degree (F,y)/4)*(i+1)+4);
+      if (l < dummy)
+      {
+        factors.insert (LCF);
+        henselLiftResume12 (F, factors, l, dummy, Pi, diophant, M);
+        l= dummy;
+      }
+      else
+      {
+        i++;
+        if (i < 4)
+          continue;
+      }
+      extReconstructionTry (result, bufF, factors, l, factorsFound,
+                            factorsFoundIndex, NTLN, beenInThres, info,
+                            evaluation
+                           );
+      if (result.length() == NTLN.NumCols())
+      {
+        delete [] liftPre;
+        delete [] factorsFoundIndex;
+        return result;
+      }
+      i++;
+    }
   }
 
-  extReconstructionTry (result, bufF, factors, degree (bufF) + 1, factorsFound,
-                        factorsFoundIndex, NTLN, beenInThres, info, evaluation
-                       );
-  if (result.length() == NTLN.NumCols())
-  {
-    delete [] factorsFoundIndex;
-    return result;
-  }
+  delete [] liftPre;
   delete [] factorsFoundIndex;
   return result;
 }

-- 
an open source computer algebra system



More information about the debian-science-commits mailing list