Coprimality Check. f and g are assumed to have the same level. If swap is true, the main variables of f and g are swapped with Variable(1). If the result is false, d is set to the degree of the gcd of f and g evaluated at a random point in K^n-1. This gcd is a gcd of univariate polynomials.
26{
27 d= 0;
29
30
35 {
38 }
39 else
40 {
43 }
44
47 {
50 }
51 else
52 {
55 }
56
57 #define TEST_ONE_MAX 50
59 bool passToGF= false;
61 bool extOfExt= false;
64 {
69 else if (
p == 5 ||
p == 7)
71 else
73 passToGF= true;
74 }
76 {
80 else
86 }
88 {
89#if defined(HAVE_NTL) || defined(HAVE_FLINT)
94 #if defined(HAVE_NTL) && !defined(HAVE_FLINT)
96 {
99 }
100 #endif
102 {
103 bool primFail= false;
106 ASSERT (!primFail,
"failure in integer factorizer");
107 if (d < 3)
108 {
109 #ifdef HAVE_FLINT
110 nmod_poly_t Irredpoly;
112 nmod_poly_randtest_monic_irreducible(Irredpoly,
FLINTrandom, 3*d+1);
115 #elif defined(HAVE_NTL)
116 zz_pX NTLIrredpoly;
117 BuildIrred (NTLIrredpoly, d*3);
119 #else
121 #endif
123 }
124 else
125 {
126 #ifdef HAVE_FLINT
127 nmod_poly_t Irredpoly;
129 nmod_poly_randtest_monic_irreducible(Irredpoly,
FLINTrandom, 3*d+1);
132 #elif defined(HAVE_NTL)
133 zz_pX NTLIrredpoly;
134 BuildIrred (NTLIrredpoly, d*2);
136 #else
138 #endif
140 }
142 extOfExt= true;
143 }
144 else if ((
p == 3 && d < 4) || ((
p == 5 ||
p == 7) && d < 3))
145 {
146 bool primFail= false;
149 ASSERT (!primFail,
"failure in integer factorizer");
150 #ifdef HAVE_FLINT
151 nmod_poly_t Irredpoly;
153 nmod_poly_randtest_monic_irreducible(Irredpoly,
FLINTrandom, 2*d+1);
156 #elif defined(HAVE_NTL)
157 zz_pX NTLIrredpoly;
158 BuildIrred (NTLIrredpoly, d*2);
160 #else
162 #endif
165 extOfExt= true;
166 }
167 if (extOfExt)
168 {
170 F=
mapUp (F,
v, v2, primElem, imPrimElem, source, dest);
171 G=
mapUp (
G,
v, v2, primElem, imPrimElem, source, dest);
172 lcf=
mapUp (
lcf,
v, v2, primElem, imPrimElem, source, dest);
173 lcg=
mapUp (
lcg,
v, v2, primElem, imPrimElem, source, dest);
175 }
176#endif
177 }
178
180 if ((!algExtension &&
p > 0) ||
p == 0)
182 else
184
186 delete sample;
187
188 if (passToGF)
189 {
192 }
193
195 if (passToGF)
196 {
199 }
200 else
201 {
204 }
205
207 {
208 e.nextpoint();
212 }
214 {
215 if (passToGF)
219 if (extOfExt)
221 return false;
222 }
223
224
225 if (passToGF)
226 {
229 eval1= e (F);
231 }
232 else
233 {
234 eval1= e (F);
236 }
237
241 if (d < 0)
242 d= 0;
243
244 if (passToGF)
248 if (extOfExt)
251}
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)
#define ASSERT(expression, message)
#define GaloisFieldDomain
CanonicalForm mapPrimElem(const CanonicalForm &primElem, const Variable &alpha, const Variable &beta)
compute the image of a primitive element of in . We assume .
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
static CanonicalForm mapUp(const Variable &alpha, const Variable &beta)
and is a primitive element, returns the image of
CanonicalForm GFMapUp(const CanonicalForm &F, int k)
maps a polynomial over to a polynomial over , d needs to be a multiple of k
GLOBAL_VAR flint_rand_t FLINTrandom
VAR void(* factoryError)(const char *s)
int ipower(int b, int m)
int ipower ( int b, int m )
generate random elements in F_p(alpha)
static CFRandom * generate()
virtual class for random element generation
class to generate random evaluation points
const Variable & v
< [in] a sqrfree bivariate poly
nmod_poly_init(FLINTmipo, getCharacteristic())
nmod_poly_clear(FLINTmipo)
Variable FACTORY_PUBLIC rootOf(const CanonicalForm &, char name='@')
returns a symbolic root of polynomial with name name Use it to define algebraic variables
void prune1(const Variable &alpha)
CanonicalForm getMipo(const Variable &alpha, const Variable &x)
template CanonicalForm tmax(const CanonicalForm &, const CanonicalForm &)
int status int void size_t count