 |
My Project
debian-1:4.1.1-p2+ds-4build2
|
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);
157 fmpz_set_si (
tmp1,
f.num().intval());
158 fmpz_set_si (
tmp2,
f.den().intval());
164 fmpz_set_mpz (
tmp1, gmp_val);
167 fmpz_set_mpz (
tmp2, gmp_val);
187 fmpz_get_mpz (nnum, fmpq_numref (q));
188 fmpz_get_mpz (nden, fmpq_denref (q));
217 for (
long i= 0;
i < n;
i++)
220 fmpq_poly_get_coeff_fmpq (coeff,
p,
i);
221 if (fmpq_is_zero (coeff))
256 const mp_limb_t leadingCoeff,
261 if (leadingCoeff != 1)
266 for (
i = 0;
i < fac->num;
i++)
268 (nmod_poly_t &)fac->p[
i],
x),
273 #if __FLINT_RELEASE >= 20400
277 const fq_nmod_ctx_t
fq_con
284 for (
i = 0;
i < fac->num;
i++)
299 fmpz_mod_poly_set_fmpz_poly (
result,
buf);
300 fmpz_poly_clear (
buf);
308 fmpz_poly_init (
buf);
309 fmpz_mod_poly_get_fmpz_poly (
buf, poly);
311 fmpz_poly_clear (
buf);
315 #if __FLINT_RELEASE >= 20400
318 const fq_nmod_ctx_t ctx)
329 printf(
"convertFacCF2Fq_nmod_t: coefficient not immediate!, char=%d\n",
334 STICKYASSERT (
i.exp() <= fq_nmod_ctx_degree(ctx),
"convertFacCF2Fq_nmod_t: element is not reduced");
350 fmpz_poly_init2 (
result, fq_ctx_degree(ctx));
351 ASSERT (
degree (
f) < fq_ctx_degree (ctx),
"input is not reduced");
357 _fmpz_poly_normalise (
result);
376 _fmpz_vec_scalar_mod_fmpz (
buf->coeffs,
buf->coeffs,
degree (
i.coeff()) + 1,
378 _fmpz_poly_normalise (
buf);
379 fq_poly_set_coeff (
result,
i.exp(),
buf, ctx);
380 fmpz_poly_clear (
buf);
386 const fq_nmod_ctx_t ctx)
391 fq_nmod_init2 (
buf, ctx);
395 fq_nmod_poly_set_coeff (
result,
i.exp(),
buf, ctx);
396 fq_nmod_zero (
buf, ctx);
398 fq_nmod_clear (
buf, ctx);
407 long n= fq_poly_length (
p, ctx);
408 fq_init2 (coeff, ctx);
409 for (
long i= 0;
i < n;
i++)
411 fq_poly_get_coeff (coeff,
p,
i, ctx);
412 if (fq_is_zero (coeff, ctx))
415 fq_zero (coeff, ctx);
417 fq_clear (coeff, ctx);
428 long n= fq_nmod_poly_length (
p, ctx);
429 fq_nmod_init2 (coeff, ctx);
430 for (
long i= 0;
i < n;
i++)
432 fq_nmod_poly_get_coeff (coeff,
p,
i, ctx);
433 if (fq_nmod_is_zero (coeff, ctx))
436 fq_nmod_zero (coeff, ctx);
438 fq_nmod_clear (coeff, ctx);
446 fmpz_mat_init (
M, (
long)
m.rows(), (
long)
m.columns());
449 for(
i=
m.rows();
i>0;
i--)
451 for(
j=
m.columns();
j>0;
j--)
461 for(
i=
res->rows();
i>0;
i--)
463 for(
j=
res->columns();
j>0;
j--)
478 for(
i=
m.rows();
i>0;
i--)
480 for(
j=
m.columns();
j>0;
j--)
482 if(!(
m(
i,
j)).isImm()) printf(
"convertFacCFMatrix2FLINTmat_zz_p: not imm.\n");
483 nmod_mat_entry (
M,
i-1,
j-1)= (
m(
i,
j)).intval();
493 for(
i=
res->rows();
i>0;
i--)
495 for(
j=
res->columns();
j>0;
j--)
503 #if __FLINT_RELEASE >= 20400
508 fq_nmod_mat_init (
M, (
long)
m.rows(), (
long)
m.columns(),
fq_con);
510 for(
i=
m.rows();
i>0;
i--)
512 for(
j=
m.columns();
j>0;
j--)
521 const fq_nmod_ctx_t&
fq_con,
525 fq_nmod_mat_ncols (
m,
fq_con));
527 for(
i=
res->rows();
i>0;
i--)
529 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