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

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


The following commit has been merged in the cleanedupstream branch:
commit a84045102532b19bcb80d83c1876ca008a31ff31
Author: Martin Lee <martinlee84 at web.de>
Date:   Fri Feb 17 11:12:16 2012 +0100

    chg: added conversion for univariate polys over Z/p for non word size p

diff --git a/factory/FLINTconvert.cc b/factory/FLINTconvert.cc
index f137bd9..16f6c27 100644
--- a/factory/FLINTconvert.cc
+++ b/factory/FLINTconvert.cc
@@ -15,6 +15,7 @@
 #include <config.h>
 
 #include "canonicalform.h"
+#include "fac_util.h"
 #include "cf_iter.h"
 #include "cf_factory.h"
 #include "gmpext.h"
@@ -34,6 +35,7 @@ extern "C"
 #include <fmpz.h>
 #include <fmpq.h>
 #include <fmpz_poly.h>
+#include <fmpz_mod_poly.h>
 #include <nmod_poly.h>
 #include <fmpq_poly.h>
 #ifdef __cplusplus
@@ -269,6 +271,29 @@ convertFLINTnmod_poly_factor2FacCFFList (nmod_poly_factor_t fac,
   return result;
 }
 
+void
+convertFacCF2Fmpz_mod_poly_t (fmpz_mod_poly_t result, const CanonicalForm& f,
+                              const fmpz_t p)
+{
+  fmpz_mod_poly_init2 (result, p, degree (f) + 1);
+  fmpz_poly_t buf;
+  convertFacCF2Fmpz_poly_t (buf, f);
+  fmpz_mod_poly_set_fmpz_poly (result, buf);
+  fmpz_poly_clear (buf);
+}
+
+CanonicalForm
+convertFmpz_mod_poly_t2FacCF (fmpz_mod_poly_t poly, const Variable& x,
+                              const modpk& b)
+{
+  fmpz_poly_t buf;
+  fmpz_poly_init (buf);
+  fmpz_mod_poly_get_fmpz_poly (buf, poly);
+  CanonicalForm result= convertFmpz_poly_t2FacCF (buf, x);
+  fmpz_poly_clear (buf);
+  return b (result);
+}
+
 #endif
 
 
diff --git a/factory/FLINTconvert.h b/factory/FLINTconvert.h
index 627144c..8d69aaa 100644
--- a/factory/FLINTconvert.h
+++ b/factory/FLINTconvert.h
@@ -16,6 +16,7 @@
 
 #include <config.h>
 #include "canonicalform.h"
+#include "fac_util.h"
 
 #ifdef HAVE_FLINT
 #ifdef __cplusplus
@@ -25,6 +26,7 @@ extern "C"
 #include <fmpz.h>
 #include <fmpq.h>
 #include <fmpz_poly.h>
+#include <fmpz_mod_poly.h>
 #include <fmpq_poly.h>
 #include <nmod_poly.h>
 #ifdef __cplusplus
@@ -103,5 +105,26 @@ convertFLINTnmod_poly_factor2FacCFFList (
                                            ///< have
                                         );
 
+/// conversion of a factory univariate poly over Z to a FLINT poly over
+/// Z/p (for non word size p)
+void
+convertFacCF2Fmpz_mod_poly_t (
+                          fmpz_mod_poly_t result, ///< [in,out] fmpz_mod_poly_t
+                          const CanonicalForm& f, ///< [in] univariate poly over
+                                                  ///< Z
+                          const fmpz_t p          ///< [in] some integer p
+                             );
+
+/// conversion of a FLINT poly over Z/p (for non word size p) to a CanonicalForm
+/// over Z
+CanonicalForm
+convertFmpz_mod_poly_t2FacCF (
+                          fmpz_mod_poly_t poly, ///< [in] fmpz_mod_poly_t
+                          const Variable& x,    ///< [in] variable the result
+                                                ///< should have
+                          const modpk& b        ///< [in] coeff bound to map
+                                                ///< coeffs in (-p/2,p/2)
+                             );
+
 #endif
 #endif

-- 
an open source computer algebra system



More information about the debian-science-commits mailing list