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 | |
---|
20 | #ifdef HAVE_FLINT |
---|
21 | #ifdef __cplusplus |
---|
22 | extern "C" |
---|
23 | { |
---|
24 | #endif |
---|
25 | #include <fmpz.h> |
---|
26 | #include <fmpq.h> |
---|
27 | #include <fmpz_poly.h> |
---|
28 | #include <fmpq_poly.h> |
---|
29 | #include <nmod_poly.h> |
---|
30 | #ifdef __cplusplus |
---|
31 | } |
---|
32 | #endif |
---|
33 | |
---|
34 | /// conversion of a factory integer to fmpz_t |
---|
35 | void |
---|
36 | convertCF2Fmpz (fmpz_t result, ///< [in,out] an fmpz_t |
---|
37 | const CanonicalForm& f ///< [in] a CanonicalForm wrapping an |
---|
38 | ///< integer |
---|
39 | ); |
---|
40 | |
---|
41 | /// conversion of a factory univariate polynomial over Z to a fmpz_poly_t |
---|
42 | void |
---|
43 | convertFacCF2Fmpz_poly_t (fmpz_poly_t result, ///< [in,out] an fmpz_poly_t |
---|
44 | const CanonicalForm& f ///< [in] univariate poly over |
---|
45 | ///< Z |
---|
46 | ); |
---|
47 | |
---|
48 | /// conversion of a FLINT integer to CanonicalForm |
---|
49 | CanonicalForm |
---|
50 | convertFmpz2CF (fmpz_t coefficient ///< [in] a FLINT integer |
---|
51 | ); |
---|
52 | |
---|
53 | /// conversion of a FLINT poly over Z to CanonicalForm |
---|
54 | CanonicalForm |
---|
55 | convertFmpz_poly_t2FacCF (fmpz_poly_t poly, ///< [in] an fmpz_poly_t |
---|
56 | const Variable& x ///< [in] variable the result should |
---|
57 | ///< have |
---|
58 | ); |
---|
59 | |
---|
60 | /// conversion of a factory univariate polynomials over Z/p (for word size p) |
---|
61 | /// to nmod_poly_t |
---|
62 | void |
---|
63 | convertFacCF2nmod_poly_t (nmod_poly_t result, ///< [in, out] a nmod_poly_t |
---|
64 | const CanonicalForm& f ///< [in] univariate poly over |
---|
65 | ///< Z/p |
---|
66 | ); |
---|
67 | |
---|
68 | /// conversion of a FLINT poly over Z/p to CanonicalForm |
---|
69 | CanonicalForm |
---|
70 | convertnmod_poly_t2FacCF (nmod_poly_t poly, ///< [in] a nmod_poly_t |
---|
71 | const Variable& x ///< [in] variable the result should |
---|
72 | ///< have |
---|
73 | ); |
---|
74 | |
---|
75 | /// conversion of a factory rationals to fmpq_t |
---|
76 | void |
---|
77 | convertCF2Fmpq (fmpq_t result, ///< [in,out] an fmpq_t |
---|
78 | const CanonicalForm& f ///< [in] a CanonicalForm wrapping a |
---|
79 | ///< rational |
---|
80 | ); |
---|
81 | |
---|
82 | /// conversion of a factory univariate polynomials over Q to fmpq_poly_t |
---|
83 | void |
---|
84 | convertFacCF2Fmpq_poly_t (fmpq_poly_t result, ///< [in,out] an fmpq_poly_t |
---|
85 | const CanonicalForm& f ///< [in] univariate poly over |
---|
86 | ///< Q |
---|
87 | ); |
---|
88 | |
---|
89 | /// conversion of a FLINT poly over Q to CanonicalForm |
---|
90 | CanonicalForm |
---|
91 | convertFmpq_poly_t2FacCF (fmpq_poly_t p, ///< [in] an fmpq_poly_t |
---|
92 | const Variable& x ///< [in] variable the result should |
---|
93 | ///< have |
---|
94 | ); |
---|
95 | |
---|
96 | /// conversion of a FLINT factorization over Z/p (for word size p) to a |
---|
97 | /// CFFList |
---|
98 | CFFList |
---|
99 | convertFLINTnmod_poly_factor2FacCFFList ( |
---|
100 | nmod_poly_factor_t fac, ///< [in] a nmod_poly_factor_t |
---|
101 | mp_limb_t leadingCoeff, ///< [in] leading coefficient |
---|
102 | const Variable& x ///< [in] variable the result should |
---|
103 | ///< have |
---|
104 | ); |
---|
105 | |
---|
106 | #endif |
---|
107 | #endif |
---|