Loading...
Searching...
No Matches
cf_irred.cc File Reference
`#include "config.h"`
`#include "cf_assert.h"`
`#include "cf_defs.h"`
`#include "canonicalform.h"`
`#include "cf_algorithm.h"`
`#include "cf_random.h"`
`#include "NTLconvert.h"`
`#include "FLINTconvert.h"`

Go to the source code of this file.

## Functions

CanonicalForm | randomIrredpoly (int i, const Variable &x)
| computes a random monic irreducible univariate polynomial in x over Fp of degree i via NTL/FLINT

## Function Documentation

## randomIrredpoly()

CanonicalForm randomIrredpoly | ( | int | i,
|  | const Variable & | x )

computes a random monic irreducible univariate polynomial in x over Fp of degree i via NTL/FLINT

Definition at line 26 of file cf_irred.cc.

{
int p= getCharacteristic();
#ifdef HAVE_FLINT
nmod_poly_t Irredpoly;
nmod_poly_init(Irredpoly,p);
nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, i+1);
CanonicalForm CFirredpoly=convertnmod_poly_t2FacCF(Irredpoly,x);
nmod_poly_clear(Irredpoly);
#elif defined(HAVE_NTL)
if (fac_NTL_char != p)
{
fac_NTL_char= p;
zz_p::init (p);
}
zz_pX NTLirredpoly;
BuildIrred (NTLirredpoly, i);
CanonicalForm CFirredpoly= convertNTLzzpX2CF (NTLirredpoly, x);
#else
factoryError("NTL/FLINT missing: randomIrredpoly");
#endif
return CFirredpoly;
}
convertnmod_poly_t2FacCF
CanonicalForm convertnmod_poly_t2FacCF(const nmod_poly_t poly, const Variable &x)
conversion of a FLINT poly over Z/p to CanonicalForm
Definition FLINTconvert.cc:208
convertNTLzzpX2CF
CanonicalForm convertNTLzzpX2CF(const zz_pX &poly, const Variable &x)
Definition NTLconvert.cc:255
fac_NTL_char
VAR long fac_NTL_char
Definition NTLconvert.cc:46
getCharacteristic
int FACTORY_PUBLIC getCharacteristic()
Definition cf_char.cc:70
i
int i
Definition cfEzgcd.cc:132
x
Variable x
Definition cfModGcd.cc:4090
p
int p
Definition cfModGcd.cc:4086
FLINTrandom
GLOBAL_VAR flint_rand_t FLINTrandom
Definition cf_random.cc:23
factoryError
VAR void(* factoryError)(const char *s)
Definition cf_util.cc:80
CanonicalForm
factory's main class
Definition canonicalform.h:86
nmod_poly_init
nmod_poly_init(FLINTmipo, getCharacteristic())
nmod_poly_clear
nmod_poly_clear(FLINTmipo)