1 | /*****************************************************************************\ |
---|
2 | * Computer Algebra System SINGULAR |
---|
3 | \*****************************************************************************/ |
---|
4 | /** @file FLINTconvert.h |
---|
5 | * |
---|
6 | * This file defines functions for conversion to FLINT (www.flintlib.org) |
---|
7 | * and back. |
---|
8 | * |
---|
9 | * @author Martin Lee |
---|
10 | * |
---|
11 | **/ |
---|
12 | /*****************************************************************************/ |
---|
13 | |
---|
14 | #ifndef FLINT_CONVERT_H |
---|
15 | #define FLINT_CONVERT_H |
---|
16 | |
---|
17 | #include <config.h> |
---|
18 | #include "canonicalform.h" |
---|
19 | #include "fac_util.h" |
---|
20 | |
---|
21 | #ifdef HAVE_FLINT |
---|
22 | #ifdef __cplusplus |
---|
23 | extern "C" |
---|
24 | { |
---|
25 | #endif |
---|
26 | #include <fmpz.h> |
---|
27 | #include <fmpq.h> |
---|
28 | #include <fmpz_poly.h> |
---|
29 | #include <fmpz_mod_poly.h> |
---|
30 | #include <fmpq_poly.h> |
---|
31 | #include <nmod_poly.h> |
---|
32 | #ifdef __cplusplus |
---|
33 | } |
---|
34 | #endif |
---|
35 | |
---|
36 | /// conversion of a factory integer to fmpz_t |
---|
37 | void |
---|
38 | convertCF2Fmpz (fmpz_t result, ///< [in,out] an fmpz_t |
---|
39 | const CanonicalForm& f ///< [in] a CanonicalForm wrapping an |
---|
40 | ///< integer |
---|
41 | ); |
---|
42 | |
---|
43 | /// conversion of a factory univariate polynomial over Z to a fmpz_poly_t |
---|
44 | void |
---|
45 | convertFacCF2Fmpz_poly_t (fmpz_poly_t result, ///< [in,out] an fmpz_poly_t |
---|
46 | const CanonicalForm& f ///< [in] univariate poly over |
---|
47 | ///< Z |
---|
48 | ); |
---|
49 | |
---|
50 | /// conversion of a FLINT integer to CanonicalForm |
---|
51 | CanonicalForm |
---|
52 | convertFmpz2CF (fmpz_t coefficient ///< [in] a FLINT integer |
---|
53 | ); |
---|
54 | |
---|
55 | /// conversion of a FLINT poly over Z to CanonicalForm |
---|
56 | CanonicalForm |
---|
57 | convertFmpz_poly_t2FacCF (fmpz_poly_t poly, ///< [in] an fmpz_poly_t |
---|
58 | const Variable& x ///< [in] variable the result should |
---|
59 | ///< have |
---|
60 | ); |
---|
61 | |
---|
62 | /// conversion of a factory univariate polynomials over Z/p (for word size p) |
---|
63 | /// to nmod_poly_t |
---|
64 | void |
---|
65 | convertFacCF2nmod_poly_t (nmod_poly_t result, ///< [in, out] a nmod_poly_t |
---|
66 | const CanonicalForm& f ///< [in] univariate poly over |
---|
67 | ///< Z/p |
---|
68 | ); |
---|
69 | |
---|
70 | /// conversion of a FLINT poly over Z/p to CanonicalForm |
---|
71 | CanonicalForm |
---|
72 | convertnmod_poly_t2FacCF (nmod_poly_t poly, ///< [in] a nmod_poly_t |
---|
73 | const Variable& x ///< [in] variable the result should |
---|
74 | ///< have |
---|
75 | ); |
---|
76 | |
---|
77 | /// conversion of a factory rationals to fmpq_t |
---|
78 | void |
---|
79 | convertCF2Fmpq (fmpq_t result, ///< [in,out] an fmpq_t |
---|
80 | const CanonicalForm& f ///< [in] a CanonicalForm wrapping a |
---|
81 | ///< rational |
---|
82 | ); |
---|
83 | |
---|
84 | /// conversion of a factory univariate polynomials over Q to fmpq_poly_t |
---|
85 | void |
---|
86 | convertFacCF2Fmpq_poly_t (fmpq_poly_t result, ///< [in,out] an fmpq_poly_t |
---|
87 | const CanonicalForm& f ///< [in] univariate poly over |
---|
88 | ///< Q |
---|
89 | ); |
---|
90 | |
---|
91 | /// conversion of a FLINT poly over Q to CanonicalForm |
---|
92 | CanonicalForm |
---|
93 | convertFmpq_poly_t2FacCF (fmpq_poly_t p, ///< [in] an fmpq_poly_t |
---|
94 | const Variable& x ///< [in] variable the result should |
---|
95 | ///< have |
---|
96 | ); |
---|
97 | |
---|
98 | /// conversion of a FLINT factorization over Z/p (for word size p) to a |
---|
99 | /// CFFList |
---|
100 | CFFList |
---|
101 | convertFLINTnmod_poly_factor2FacCFFList ( |
---|
102 | nmod_poly_factor_t fac, ///< [in] a nmod_poly_factor_t |
---|
103 | mp_limb_t leadingCoeff, ///< [in] leading coefficient |
---|
104 | const Variable& x ///< [in] variable the result should |
---|
105 | ///< have |
---|
106 | ); |
---|
107 | |
---|
108 | /// conversion of a factory univariate poly over Z to a FLINT poly over |
---|
109 | /// Z/p (for non word size p) |
---|
110 | void |
---|
111 | convertFacCF2Fmpz_mod_poly_t ( |
---|
112 | fmpz_mod_poly_t result, ///< [in,out] fmpz_mod_poly_t |
---|
113 | const CanonicalForm& f, ///< [in] univariate poly over |
---|
114 | ///< Z |
---|
115 | const fmpz_t p ///< [in] some integer p |
---|
116 | ); |
---|
117 | |
---|
118 | /// conversion of a FLINT poly over Z/p (for non word size p) to a CanonicalForm |
---|
119 | /// over Z |
---|
120 | CanonicalForm |
---|
121 | convertFmpz_mod_poly_t2FacCF ( |
---|
122 | fmpz_mod_poly_t poly, ///< [in] fmpz_mod_poly_t |
---|
123 | const Variable& x, ///< [in] variable the result |
---|
124 | ///< should have |
---|
125 | const modpk& b ///< [in] coeff bound to map |
---|
126 | ///< coeffs in (-p/2,p/2) |
---|
127 | ); |
---|
128 | |
---|
129 | #endif |
---|
130 | #endif |
---|