33#include <flint/fq_nmod_poly_factor.h>
47 if (
i.getItem() == item)
57 if ((pos > 0) && (pos <= list.
length()))
73 #if defined(HAVE_FLINT) && (__FLINT_RELEASE >= 20503)
99 #elif defined(HAVE_NTL)
136 if (
degree(F) == 0)
return F;
152 ASSERT (counter >=
bound,
"alpha is not primitive");
185 if (F.
isOne())
return 1;
232 if (F.
isOne())
return F;
244 ASSERT (d%
k == 0,
"multiple of GF degree expected");
256 if (F.
isOne())
return F;
280 ASSERT (d %
k == 0,
"multiple of GF degree expected");
304 if (
degree(F) <= 0)
return F;
320 ASSERT (counter <=
bound,
"alpha is not primitive");
358 #if defined(HAVE_FLINT) && (__FLINT_RELEASE >= 20503)
361 #elif defined(HAVE_NTL)
375 bool initialized=
false;
378 #if defined(HAVE_FLINT) && (__FLINT_RELEASE >= 20503)
381 #elif defined(HAVE_NTL)
395 #if defined(HAVE_FLINT) && (__FLINT_RELEASE >= 20503)
422 #elif defined(HAVE_NTL)
449#if defined(HAVE_NTL) || defined(HAVE_FLINT)
459 #if defined(HAVE_FLINT) && (__FLINT_RELEASE >= 20503)
485 #elif defined(HAVE_NTL)
515 #if defined(HAVE_FLINT) && (__FLINT_RELEASE >= 20503)
536 for(
int i=0;
i< fac->num;
i++)
562 #elif defined(HAVE_NTL)
590#if defined(HAVE_FLINT) && (__FLINT_RELEASE >= 20503)
611 for (
i = 0;
i < 2*d;
i++)
639#if defined(HAVE_NTL) || defined(HAVE_FLINT)
646 #if defined(HAVE_FLINT) && (__FLINT_RELEASE >= 20503)
657 #elif defined(HAVE_NTL)
669 pows.SetLength (2*d);
675 for (
int i= 0;
i < 2*d;
i++)
678 buf.rep.SetLength (d);
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...
CanonicalForm convertnmod_poly_t2FacCF(const nmod_poly_t poly, const Variable &x)
conversion of a FLINT poly over Z/p to CanonicalForm
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_t2FacCF(const fq_nmod_t poly, const Variable &alpha, const fq_nmod_ctx_t)
conversion of a FLINT element of F_q to a CanonicalForm with alg. variable alpha
This file defines functions for conversion to FLINT (www.flintlib.org) and back.
zz_pEX convertFacCF2NTLzz_pEX(const CanonicalForm &f, const zz_pX &mipo)
CanonicalForm convertNTLzzpX2CF(const zz_pX &poly, const Variable &x)
CanonicalForm convertNTLzzpE2CF(const zz_pE &coefficient, const Variable &x)
zz_pX convertFacCF2NTLzzpX(const CanonicalForm &f)
Conversion to and from NTL.
#define ASSERT(expression, message)
bool isPrimitive(const Variable &alpha, bool &fail)
checks if alpha is a primitive element, alpha is assumed to be an algebraic variable over some finite...
Compute cyclotomic polynomials and factorize integers by brute force.
Iterators for CanonicalForm's.
static CanonicalForm bound(const CFMatrix &M)
int findItem(const CFList &list, const CanonicalForm &item)
helper function
CanonicalForm mapPrimElem(const CanonicalForm &primElem, const Variable &alpha, const Variable &beta)
compute the image of a primitive element of in . We assume .
static CanonicalForm GF2FalphaHelper(const CanonicalForm &F, const Variable &alpha)
helper function
CanonicalForm GFMapDown(const CanonicalForm &F, int k)
maps a polynomial over to a polynomial over , d needs to be a multiple of k
CanonicalForm primitiveElement(const Variable &alpha, Variable &beta, bool &fail)
determine a primitive element of , is a primitive element of a field which is isomorphic to
CanonicalForm findMinPoly(const CanonicalForm &F, const Variable &alpha)
compute minimal polynomial of via NTL
static CanonicalForm mapDown(const CanonicalForm &F, const Variable &alpha, const CanonicalForm &G, CFList &source, CFList &dest)
the CanonicalForm G is the output of map_up, returns F considered as an element over ,...
CanonicalForm getItem(const CFList &list, const int &pos)
helper function
static CanonicalForm mapUp(const Variable &alpha, const Variable &beta)
and is a primitive element, returns the image of
static CanonicalForm GFPowUp(const CanonicalForm &F, int k)
GF_map_up helper.
CanonicalForm Falpha2GFRep(const CanonicalForm &F)
change representation by residue classes modulo a Conway polynomial to representation by primitive el...
CanonicalForm GFMapUp(const CanonicalForm &F, int k)
maps a polynomial over to a polynomial over , d needs to be a multiple of k
CanonicalForm GF2FalphaRep(const CanonicalForm &F, const Variable &alpha)
changes representation by primitive element to representation by residue classes modulo a Conway poly...
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
static CanonicalForm GFPowDown(const CanonicalForm &F, int k)
GFMapDown helper.
This file implements functions to map between extensions of finite fields.
GLOBAL_VAR flint_rand_t FLINTrandom
VAR void(* factoryError)(const char *s)
int ipower(int b, int m)
int ipower ( int b, int m )
class to iterate through CanonicalForm's
virtual class for internal CanonicalForm's
factory's class for variables
functions to print debug output
fq_nmod_ctx_clear(fq_con)
nmod_poly_init(FLINTmipo, getCharacteristic())
fq_nmod_ctx_init_modulus(fq_con, FLINTmipo, "Z")
convertFacCF2nmod_poly_t(FLINTmipo, M)
nmod_poly_clear(FLINTmipo)
fq_nmod_poly_clear(prod, fq_con)
CanonicalForm remainder(const CanonicalForm &f, const CanonicalForm &g, const modpk &pk)
Variable FACTORY_PUBLIC rootOf(const CanonicalForm &, char name='@')
returns a symbolic root of polynomial with name name Use it to define algebraic variables
CanonicalForm getMipo(const Variable &alpha, const Variable &x)
void FACTORY_PUBLIC prune(Variable &alpha)
void setMipo(const Variable &alpha, const CanonicalForm &mipo)
INST_VAR CanonicalForm gf_mipo
operations on immediates, that is elements of F_p, GF, Z, Q that fit into intrinsic int,...
static long imm2int(const InternalCF *const imm)
InternalCF * int2imm_gf(long i)
gmp_float exp(const gmp_float &a)
STATIC_VAR gmp_float * diff
int status int void * buf