18#if !defined(HAVE_FLINT) && !defined(HAVE_NTL)
21void QprintFF(
int **
Q,
int n )
23 for (
int i = 0;
i < n;
i++ ) {
24 for (
int j = 0;
j < n;
j++ )
25 std::cerr <<
Q[
i][
j] <<
" ";
26 std::cerr << std::endl;
28 std::cerr << std::endl;
33void QprintGF(
int **
Q,
int n )
35 for (
int i = 0;
i < n;
i++ ) {
36 for (
int j = 0;
j < n;
j++ ) {
37 gf_print( std::cerr,
Q[
i][
j] );
40 std::cerr << std::endl;
42 std::cerr << std::endl;
48 int n =
degree(
f ), nn = (n-1)*
p + 1;
50 int * a =
new int [n];
51 int * r =
new int [n];
54 q =
Q[0]; *q = r[0] = 1; a[0] = 0; q++;
56 for (
i = 1;
i < n;
i++, q++ )
63 for (
m = 1;
m < nn;
m++ ) {
65 for (
i = n-1;
i > 0;
i-- )
70 for (
i = 0;
i < n;
i++, q++ )
74 for (
i = 0;
i < n;
i++ )
83 int n =
degree(
f ), nn = (n-1)*
p + 1;
85 int * a =
new int [n];
86 int * r =
new int [n];
91 for (
i = 1;
i < n;
i++, q++ )
98 for (
m = 1;
m < nn;
m++ ) {
100 for (
i = n-1;
i > 0;
i-- )
105 for (
i = 0;
i < n;
i++, q++ )
109 for (
i = 0;
i < n;
i++ )
116int nullSpaceFF (
int **
Q,
int **
b,
int n )
118 int * c =
new int[n];
119 int r,
i,
j,
k,
h,
s, d;
122 for (
s = 0;
s < n;
s++ ) c[
s] = -1;
123 for (
h = 0;
h < n;
h++ ) {
125 while (
j < n && ! (
Q[
h][
j] != 0 && c[
j] < 0 ) )
j++;
128 for (
s = 0;
s < n;
s++ )
130 for (
i = 0;
i < n;
i++ ) {
133 for (
s = 0;
s < n;
s++ )
141 for (
j = 0;
j < n;
j++ ) {
146 while (
k < n && c[
k] !=
j )
k++;
160int nullSpaceGF (
int **
Q,
int **
b,
int n )
162 int * c =
new int[n];
163 int r,
i,
j,
k,
h,
s, d;
166 for (
s = 0;
s < n;
s++ ) c[
s] = -1;
167 for (
h = 0;
h < n;
h++ ) {
172 for (
s = 0;
s < n;
s++ )
174 for (
i = 0;
i < n;
i++ ) {
177 for (
s = 0;
s < n;
s++ )
185 for (
j = 0;
j < n;
j++ ) {
190 while (
k < n && c[
k] !=
j )
k++;
207 for (
int i = n-2;
i >= 0;
i-- )
216 for (
int i = n-2;
i >= 0;
i-- )
231 intptr*
Q =
new intptr [n];
232 intptr*
B =
new intptr [n];
233 for (
i = 0;
i < n;
i++ )
240 k = nullSpaceFF(
Q,
B, n );
249 ASSERT( r <
k,
"fatal fatal" );
253 for (
s = 0;
s <
p && len <
k;
s++ ) {
254 g =
gcd( cfFromIntVec(
B[r], n,
x ) -
s, u );
267 for (
i = 0;
i < n;
i++ )
269 for (
i = 0;
i < r;
i++ )
282 intptr*
Q =
new intptr [n];
283 intptr*
B =
new intptr [n];
284 for (
i = 0;
i < n;
i++ )
291 k = nullSpaceGF(
Q,
B, n );
301 ASSERT( r <
k,
"fatal fatal" );
305 for (
s.reset();
s.hasItems() && len <
k;
s++ ) {
306 g =
gcd( cfFromGFVec(
B[r], n,
x ) -
s.item(), u );
319 for (
i = 0;
i < n;
i++ )
321 for (
i = 0;
i < r;
i++ )
375 if (
LC(
f ).isOne() )
387 for (
i = F;
i.hasItem(); ++
i ) {
388 d =
i.getItem().exp();
389 fac =
i.getItem().factor();
391 G = BerlekampFactorGF( fac /
LC( fac ) );
393 G = BerlekampFactorFF( fac /
LC( fac ) );
394 for (
k =
G;
k.hasItem(); ++
k ) {
395 fac =
k.getItem().factor();
#define ASSERT(expression, message)
generate integers, elements of finite fields
Iterators for CanonicalForm's.
class to iterate through CanonicalForm's
CF_NO_INLINE int exp() const
get the current exponent
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
CF_NO_INLINE int hasTerms() const
check if iterator has reached the end of CanonicalForm
generate all elements in GF starting from 0
void remove(int moveright)
factory's class for variables
functions to print debug output
#define DEBOUTLN(stream, objects)
const CanonicalForm int s
CFFList FpFactorizeUnivariateB(const CanonicalForm &f, bool issqrfree=false)
squarefree part and factorization over Q, Q(a)
CFFList sqrFreeFp(const CanonicalForm &f)
operations in a finite prime field F_p.
int ff_add(const int a, const int b)
int ff_mul(const int a, const int b)
int ff_sub(const int a, const int b)
Operations in GF, where GF is a finite field of size less than 2^16 represented by a root of Conway p...
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)