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

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


The following commit has been merged in the cleanedupstream branch:
commit 55edfb4972bed05c321c5243d56e4becba35cdfa
Author: Martin Lee <martinlee84 at web.de>
Date:   Mon Mar 5 22:05:50 2012 +0100

    chg: conversion to NTL ZZ_pX now allows non-word size p
    chg: added conversion of NTL ZZ_pEX to CanonicalForm and back

diff --git a/factory/NTLconvert.cc b/factory/NTLconvert.cc
index 7d3ddb6..406b815 100644
--- a/factory/NTLconvert.cc
+++ b/factory/NTLconvert.cc
@@ -89,24 +89,7 @@ ZZ_pX convertFacCF2NTLZZpX(CanonicalForm f)
     }
     NTLcurrentExp=i.exp();
 
-    CanonicalForm c=i.coeff();
-    if (!c.isImm()) c=c.mapinto(); //c%= getCharacteristic();
-    if (!c.isImm())
-    {  //This case will never happen if the characteristic is in fact a prime
-       // number, since all coefficients are represented as immediates
-       #ifndef NOSTREAMIO
-       cout<<"convertFacCF2NTLZZ_pX: coefficient not immediate! : "<<f<<"\n";
-       #else
-       //NTL_SNS
-       printf("convertFacCF2NTLZZ_pX: coefficient not immediate!, char=%d\n",
-              getCharacteristic());
-       #endif
-       NTL_SNS exit(1);
-    }
-    else
-    {
-      SetCoeff(ntl_poly,NTLcurrentExp,c.intval());
-    }
+    SetCoeff(ntl_poly,NTLcurrentExp,to_ZZ_p (convertFacCF2NTLZZ (i.coeff())));
     NTLcurrentExp--;
   }
 
@@ -270,32 +253,7 @@ GF2X convertFacCF2NTLGF2X(CanonicalForm f)
 
 CanonicalForm convertNTLZZpX2CF(ZZ_pX poly,Variable x)
 {
-  //printf("convertNTLZZpX2CF\n");
-  CanonicalForm bigone;
-
-
-  if (deg(poly)>0)
-  {
-    // poly is non-constant
-    bigone=0;
-    bigone.mapinto();
-    // Compute the canonicalform coefficient by coefficient,
-    // bigone summarizes the result.
-    for (int j=0;j<=deg(poly);j++)
-    {
-      if (coeff(poly,j)!=0)
-      {
-        bigone+=(power(x,j)*CanonicalForm(to_long(rep(coeff(poly,j)))));
-      }
-    }
-  }
-  else
-  {
-    // poly is immediate
-    bigone=CanonicalForm(to_long(rep(coeff(poly,0))));
-    bigone.mapinto();
-  }
-  return bigone;
+  return convertNTLZZX2CF (to_ZZX (poly), x);
 }
 
 CanonicalForm convertNTLzzpX2CF(zz_pX poly,Variable x)
@@ -1149,6 +1107,29 @@ CanonicalForm convertNTLzz_pEX2CF (zz_pEX f, Variable x, Variable alpha)
   }
   return bigone;
 }
+
+CanonicalForm convertNTLZZ_pEX2CF (ZZ_pEX f, Variable x, Variable alpha)
+{
+  CanonicalForm bigone;
+  if (deg (f) > 0)
+  {
+    bigone= 0;
+    bigone.mapinto();
+    for (int j=0;j<deg(f)+1;j++)
+    {
+      if (coeff(f,j)!=0)
+      {
+        bigone+=(power(x,j)*convertNTLZZpE2CF(coeff(f,j),alpha));
+      }
+    }
+  }
+  else
+  {
+    bigone= convertNTLZZpE2CF(coeff(f,0),alpha);
+    bigone.mapinto();
+  }
+  return bigone;
+}
 //----------------------------------------------------------------------
 mat_ZZ* convertFacCFMatrix2NTLmat_ZZ(CFMatrix &m)
 {
diff --git a/factory/NTLconvert.h b/factory/NTLconvert.h
index 52c0dcd..795c227 100644
--- a/factory/NTLconvert.h
+++ b/factory/NTLconvert.h
@@ -62,6 +62,7 @@ zz_pEX convertFacCF2NTLzz_pEX(CanonicalForm f,zz_pX mipo);
 CanonicalForm convertNTLzzpE2CF(zz_pE f, Variable x);
 CFFList convertNTLvec_pair_zzpEX_long2FacCFFList(vec_pair_zz_pEX_long e,zz_pE multi,Variable x,Variable alpha);
 CanonicalForm convertNTLzz_pEX2CF(zz_pEX f, Variable x, Variable alpha);
+CanonicalForm convertNTLZZ_pEX2CF(ZZ_pEX f, Variable x, Variable alpha);
 
 mat_ZZ* convertFacCFMatrix2NTLmat_ZZ(CFMatrix &m);
 CFMatrix* convertNTLmat_ZZ2FacCFMatrix(mat_ZZ &m);

-- 
an open source computer algebra system



More information about the debian-science-commits mailing list