 |
My Project
debian-1:4.1.2-p1+ds-2
|
Go to the documentation of this file.
37 #ifndef __GMP_BITS_PER_MP_LIMB
38 #define __GMP_BITS_PER_MP_LIMB GMP_LIMB_BITS
40 #include <flint/fmpz.h>
41 #include <flint/fmpq.h>
42 #include <flint/fmpz_poly.h>
43 #include <flint/fmpz_mod_poly.h>
44 #include <flint/nmod_poly.h>
45 #include <flint/fmpq_poly.h>
46 #include <flint/nmod_mat.h>
47 #include <flint/fmpz_mat.h>
48 #if ( __FLINT_RELEASE >= 20400)
50 #include <flint/fq_poly.h>
51 #include <flint/fq_nmod.h>
52 #include <flint/fq_nmod_poly.h>
53 #include <flint/fq_nmod_mat.h>
64 fmpz_set_si (
result,
f.intval());
69 fmpz_set_mpz (
result, gmp_val);
87 long coeff= fmpz_get_si (coefficient);
94 fmpz_get_mpz (gmp_val, coefficient);
105 for (
int i= 0;
i < fmpz_poly_length (poly);
i++)
107 coeff= fmpz_poly_get_coeff_ptr (poly,
i);
108 if (!fmpz_is_zero (coeff))
127 printf(
"convertCF2nmod_poly_t: coefficient not immediate!, char=%d\n",
140 for (
int i= 0;
i < nmod_poly_length (poly);
i++)
142 ulong coeff= nmod_poly_get_coeff_ui (poly,
i);
154 fmpz_set_si (fmpq_numref (
result),
f.num().intval());
155 fmpz_set_si (fmpq_denref (
result),
f.den().intval());
161 fmpz_set_mpz (fmpq_numref (
result), gmp_val);
164 fmpz_set_mpz (fmpq_denref (
result), gmp_val);
179 fmpz_get_mpz (nnum, fmpq_numref (q));
180 fmpz_get_mpz (nden, fmpq_denref (q));
209 for (
long i= 0;
i < n;
i++)
212 fmpq_poly_get_coeff_fmpq (coeff,
p,
i);
213 if (fmpq_is_zero (coeff))
248 const mp_limb_t leadingCoeff,
253 if (leadingCoeff != 1)
258 for (
i = 0;
i < fac->num;
i++)
260 (nmod_poly_t &)fac->p[
i],
x),
265 #if __FLINT_RELEASE >= 20400
269 const fq_nmod_ctx_t
fq_con
276 for (
i = 0;
i < fac->num;
i++)
291 fmpz_mod_poly_set_fmpz_poly (
result,
buf);
292 fmpz_poly_clear (
buf);
300 fmpz_poly_init (
buf);
301 fmpz_mod_poly_get_fmpz_poly (
buf, poly);
303 fmpz_poly_clear (
buf);
307 #if __FLINT_RELEASE >= 20400
310 const fq_nmod_ctx_t ctx)
321 printf(
"convertFacCF2Fq_nmod_t: coefficient not immediate!, char=%d\n",
326 STICKYASSERT (
i.exp() <= fq_nmod_ctx_degree(ctx),
"convertFacCF2Fq_nmod_t: element is not reduced");
342 fmpz_poly_init2 (
result, fq_ctx_degree(ctx));
343 ASSERT (
degree (
f) < fq_ctx_degree (ctx),
"input is not reduced");
349 _fmpz_poly_normalise (
result);
368 _fmpz_vec_scalar_mod_fmpz (
buf->coeffs,
buf->coeffs,
degree (
i.coeff()) + 1,
370 _fmpz_poly_normalise (
buf);
371 fq_poly_set_coeff (
result,
i.exp(),
buf, ctx);
372 fmpz_poly_clear (
buf);
378 const fq_nmod_ctx_t ctx)
383 fq_nmod_init2 (
buf, ctx);
387 fq_nmod_poly_set_coeff (
result,
i.exp(),
buf, ctx);
388 fq_nmod_zero (
buf, ctx);
390 fq_nmod_clear (
buf, ctx);
399 long n= fq_poly_length (
p, ctx);
400 fq_init2 (coeff, ctx);
401 for (
long i= 0;
i < n;
i++)
403 fq_poly_get_coeff (coeff,
p,
i, ctx);
404 if (fq_is_zero (coeff, ctx))
407 fq_zero (coeff, ctx);
409 fq_clear (coeff, ctx);
420 long n= fq_nmod_poly_length (
p, ctx);
421 fq_nmod_init2 (coeff, ctx);
422 for (
long i= 0;
i < n;
i++)
424 fq_nmod_poly_get_coeff (coeff,
p,
i, ctx);
425 if (fq_nmod_is_zero (coeff, ctx))
428 fq_nmod_zero (coeff, ctx);
430 fq_nmod_clear (coeff, ctx);
438 fmpz_mat_init (
M, (
long)
m.rows(), (long)
m.columns());
441 for(
i=
m.rows();
i>0;
i--)
443 for(
j=
m.columns();
j>0;
j--)
453 for(
i=
res->rows();
i>0;
i--)
455 for(
j=
res->columns();
j>0;
j--)
470 for(
i=
m.rows();
i>0;
i--)
472 for(
j=
m.columns();
j>0;
j--)
474 if(!(
m(
i,
j)).isImm()) printf(
"convertFacCFMatrix2FLINTmat_zz_p: not imm.\n");
475 nmod_mat_entry (
M,
i-1,
j-1)= (
m(
i,
j)).intval();
485 for(
i=
res->rows();
i>0;
i--)
487 for(
j=
res->columns();
j>0;
j--)
495 #if __FLINT_RELEASE >= 20400
500 fq_nmod_mat_init (
M, (
long)
m.rows(), (long)
m.columns(),
fq_con);
502 for(
i=
m.rows();
i>0;
i--)
504 for(
j=
m.columns();
j>0;
j--)
513 const fq_nmod_ctx_t&
fq_con,
517 fq_nmod_mat_ncols (
m,
fq_con));
519 for(
i=
res->rows();
i>0;
i--)
521 for(
j=
res->columns();
j>0;
j--)
void convertCF2Fmpq(fmpq_t result, const CanonicalForm &f)
conversion of a factory rationals to fmpq_t
CanonicalForm convertnmod_poly_t2FacCF(const nmod_poly_t poly, const Variable &x)
conversion of a FLINT poly over Z/p to CanonicalForm
static const int SW_RATIONAL
set to 1 for computations over Q
class to iterate through CanonicalForm's
void convertFacCF2Fmpz_array(fmpz *result, const CanonicalForm &f)
void convertCF2Fmpz(fmpz_t result, const CanonicalForm &f)
conversion of a factory integer to fmpz_t
void convertFacCF2Fq_t(fq_t result, const CanonicalForm &f, const fq_ctx_t ctx)
conversion of a factory element of F_q (for non-word size p) to a FLINT fq_t
CanonicalForm convertFq_nmod_t2FacCF(const fq_nmod_t poly, const Variable &alpha)
conversion of a FLINT element of F_q to a CanonicalForm with alg. variable alpha
CFMatrix * convertFmpz_mat_t2FacCFMatrix(const fmpz_mat_t m)
conversion of a FLINT matrix over Z to a factory matrix
CanonicalForm make_cf(const mpz_ptr n)
void convertFacCF2nmod_poly_t(nmod_poly_t result, const CanonicalForm &f)
conversion of a factory univariate polynomials over Z/p (for word size p) to nmod_poly_t
void convertFacCF2Fq_nmod_poly_t(fq_nmod_poly_t result, const CanonicalForm &f, const fq_nmod_ctx_t ctx)
conversion of a factory univariate poly over F_q to a FLINT fq_nmod_poly_t
CanonicalForm convertFq_nmod_poly_t2FacCF(const fq_nmod_poly_t p, const Variable &x, const Variable &alpha, const fq_nmod_ctx_t ctx)
conversion of a FLINT poly over Fq to a CanonicalForm with alg. variable alpha and polynomial variabl...
#define ASSERT(expression, message)
CanonicalForm convertFmpz2CF(const fmpz_t coefficient)
conversion of a FLINT integer to CanonicalForm
int status int void * buf
CFFList convertFLINTFq_nmod_poly_factor2FacCFFList(const fq_nmod_poly_factor_t fac, const Variable &x, const Variable &alpha, const fq_nmod_ctx_t fq_con)
conversion of a FLINT factorization over Fq (for word size p) to a CFFList
static InternalCF * basic(long value)
void convertFacCFMatrix2Fq_nmod_mat_t(fq_nmod_mat_t M, const fq_nmod_ctx_t fq_con, const CFMatrix &m)
conversion of a factory matrix over F_q to a fq_nmod_mat_t
void convertFacCF2Fq_nmod_t(fq_nmod_t result, const CanonicalForm &f, const fq_nmod_ctx_t ctx)
conversion of a factory element of F_q to a FLINT fq_nmod_t, does not do any memory allocation for po...
CFFList convertFLINTnmod_poly_factor2FacCFFList(const nmod_poly_factor_t fac, const mp_limb_t leadingCoeff, const Variable &x)
conversion of a FLINT factorization over Z/p (for word size p) to a CFFList
class to do operations mod p^k for int's p and k
void convertFacCF2Fmpq_poly_t(fmpq_poly_t result, const CanonicalForm &f)
conversion of a factory univariate polynomials over Q to fmpq_poly_t
#define STICKYASSERT(expression, message)
CanonicalForm convertFmpz_poly_t2FacCF(const fmpz_poly_t poly, const Variable &x)
conversion of a FLINT poly over Z to CanonicalForm
void convertFacCF2Fmpz_mod_poly_t(fmpz_mod_poly_t result, const CanonicalForm &f, const fmpz_t p)
conversion of a factory univariate poly over Z to a FLINT poly over Z/p (for non word size p)
CanonicalForm bCommonDen(const CanonicalForm &f)
CanonicalForm bCommonDen ( const CanonicalForm & f )
CFMatrix * convertFq_nmod_mat_t2FacCFMatrix(const fq_nmod_mat_t m, const fq_nmod_ctx_t &fq_con, const Variable &alpha)
conversion of a FLINT matrix over F_q to a factory matrix
CanonicalForm convertFmpq_t2CF(const fmpq_t q)
factory's class for variables
CanonicalForm convertFmpq_poly_t2FacCF(const fmpq_poly_t p, const Variable &x)
conversion of a FLINT poly over Q to CanonicalForm
static const int SW_SYMMETRIC_FF
set to 1 for symmetric representation over F_q
CanonicalForm convertFq_poly_t2FacCF(const fq_poly_t p, const Variable &x, const Variable &alpha, const fq_ctx_t ctx)
conversion of a FLINT poly over Fq (for non-word size p) to a CanonicalForm with alg....
void gmp_denominator(const CanonicalForm &f, mpz_ptr result)
void gmp_numerator(const CanonicalForm &f, mpz_ptr result)
CFMatrix * convertNmod_mat_t2FacCFMatrix(const nmod_mat_t m)
conversion of a FLINT matrix over Z/p to a factory matrix
CanonicalForm convertFq_t2FacCF(const fq_t poly, const Variable &alpha)
conversion of a FLINT element of F_q with non-word size p to a CanonicalForm with alg....
void convertFacCF2Fq_poly_t(fq_poly_t result, const CanonicalForm &f, const fq_ctx_t ctx)
conversion of a factory univariate poly over F_q (for non-word size p) to a FLINT fq_poly_t
void convertFacCF2Fmpz_poly_t(fmpz_poly_t result, const CanonicalForm &f)
conversion of a factory univariate polynomial over Z to a fmpz_poly_t
void convertFacCFMatrix2nmod_mat_t(nmod_mat_t M, const CFMatrix &m)
conversion of a factory matrix over Z/p to a nmod_mat_t
bool mpz_is_imm(const mpz_t mpi)
void convertFacCFMatrix2Fmpz_mat_t(fmpz_mat_t M, const CFMatrix &m)
conversion of a factory matrix over Z to a fmpz_mat_t
CanonicalForm convertFmpz_mod_poly_t2FacCF(const fmpz_mod_poly_t poly, const Variable &x, const modpk &b)
conversion of a FLINT poly over Z/p (for non word size p) to a CanonicalForm over Z