My Project
Loading...
Searching...
No Matches
Functions
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 More...
 

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.

27{
28 int p= getCharacteristic();
29 #ifdef HAVE_FLINT
30 nmod_poly_t Irredpoly;
31 nmod_poly_init(Irredpoly,p);
32 nmod_poly_randtest_monic_irreducible(Irredpoly, FLINTrandom, i+1);
33 CanonicalForm CFirredpoly=convertnmod_poly_t2FacCF(Irredpoly,x);
34 nmod_poly_clear(Irredpoly);
35 #elif defined(HAVE_NTL)
36 if (fac_NTL_char != p)
37 {
39 zz_p::init (p);
40 }
41 zz_pX NTLirredpoly;
42 BuildIrred (NTLirredpoly, i);
43 CanonicalForm CFirredpoly= convertNTLzzpX2CF (NTLirredpoly, x);
44 #else
45 factoryError("NTL/FLINT missing: randomIrredpoly");
46 #endif
47 return CFirredpoly;
48}
CanonicalForm convertnmod_poly_t2FacCF(const nmod_poly_t poly, const Variable &x)
conversion of a FLINT poly over Z/p to CanonicalForm
CanonicalForm convertNTLzzpX2CF(const zz_pX &poly, const Variable &x)
Definition: NTLconvert.cc:255
VAR long fac_NTL_char
Definition: NTLconvert.cc:46
int FACTORY_PUBLIC getCharacteristic()
Definition: cf_char.cc:70
int i
Definition: cfEzgcd.cc:132
Variable x
Definition: cfModGcd.cc:4082
int p
Definition: cfModGcd.cc:4078
GLOBAL_VAR flint_rand_t FLINTrandom
Definition: cf_random.cc:25
VAR void(* factoryError)(const char *s)
Definition: cf_util.cc:80
factory's main class
Definition: canonicalform.h:86
nmod_poly_init(FLINTmipo, getCharacteristic())
nmod_poly_clear(FLINTmipo)