40 for (
j = 1;
j < r;
j++ )
47 for (
j = 1;
j <= r;
j++ )
55 for (
int i = 1;
i <= r;
i++ )
57 sum += pprod *
A[
i] *
Q[
i];
68 else if (
f.degree(
x ) < n )
80 for (
j =
i.exp();
j >
min;
j-- )
97 for (
i = 2;
i <
k;
i++ )
98 for (
j = 2;
j <= e[
i];
j++ )
109 for (
int i =
k-1;
i > 1;
i-- )
128static bool check_e(
const IteratedFor & e,
int k,
int m,
int * n )
131 for (
int i = 2;
i <
k;
i++ )
143 for (
int i = 2;
i <
k;
i++ )
151findCorrCoeffs (
const CFArray & P,
const CFArray &
Q,
const CFArray & P0,
const CFArray &
Q0,
const CFArray & S,
const CFArray &
T,
const CanonicalForm & C,
const Evaluation & I,
const modpk & pk,
int r,
int k,
int h,
int * n )
159 C0 = pk( I( C, 2,
k-1 ),
true );
160 solveF( P0,
Q0, S,
T, 1, pk, r, a );
163 DEBOUTLN( cerr,
"trying to find correction coefficients for " << C );
164 DEBOUTLN( cerr,
"which evaluates to " << C0 );
166 for (
i = 1;
i <= r;
i++ )
168 DEBOUTLN( cerr,
"the first approximation of the correction coefficients is " <<
A );
170 if ( check_dummy(
A, P,
Q ) - C != 0 )
172 DEBOUTLN( cerr,
"there is an error detected, the correction coefficients do not" );
173 DEBOUTLN( cerr,
"fulfill equation F(A)" );
174 DEBOUTLN( cerr,
"corresponding P " << P );
178 for (
m = 0;
m <=
h && (
m == 0 || Dm != 0 );
m++ )
180 Dm = pk( evalF( P,
Q,
A, r ) - C );
186 solveF( P0,
Q0, S,
T, Dm, pk, r, a );
188 for (
i = 1;
i <= r;
i++ )
196 if ( check_e( e,
k,
m, n ) )
198 g = pk( checkCombination( Dm, I, e,
k ) );
199 if ( !
g.isZero() && ! (
g.mvar() >
Variable(1)) )
201 prodcomb = prodCombination( I, e,
k );
204 solveF( P0,
Q0, S,
T,
g, pk, r, a );
206 for (
i = 1;
i <= r;
i++ )
209 A[
i] = pk(
A[
i] - a[
i] * prodcomb );
217 DEBOUTLN( cerr,
"the correction coefficients at step " <<
m );
220 if ( check_dummy(
A, P,
Q ) - C != 0 ) {
221 DEBOUTLN( cerr,
"there is an error detected, the correction coefficients do not" );
222 DEBOUTLN( cerr,
"fulfill equation F(A)" );
223 DEBOUTLN( cerr,
"corresponding P " << P );
237 CFArray K( 1, r ),
Q( 1, r ),
Q0( 1, r ), P0( 1, r ), S( 1, r ),
T( 1, r ),
alpha( 1, r );
244 DEBOUTLN( cerr,
"the factors so far are " << P );
245 DEBOUTLN( cerr,
"modulus p^k= " <<
b.getpk() <<
"=" <<
b.getp() <<
"^"<<
b.getk() );
247 for (
i = 1;
i <= r;
i++ )
252 P[
i] =
A( K[
i],
k, t );
260 for (
i = r;
i > 1;
i-- )
262 Q[
i-1] =
Q[
i] * P[
i];
263 P0[
i] =
A( P[
i], 2,
k-1 );
267 P0[1] =
A( P[1], 2,
k-1 );
268 Q0[1] =
A(
Q[1], 2,
k-1 );
272 for (
m = 1;
m <= n[
k]+1;
m++ )
275 Rm = modDeltak(
prod( K ) - Uk,
A,
k, n );
278 if (
mod( Rm, xa1 ) != 0 )
280 DEBOUTLN( cerr,
"something seems not to be ok with Rm which is " << Rm );
281 DEBOUTLN( cerr,
"and should reduce to zero modulo " << xa1 );
284 if (
mod( Rm, xa2 ) != 0 )
288 for (
i = 2;
i <=
m;
i++ )
D *=
i;
292 alpha = findCorrCoeffs( P,
Q, P0,
Q0, S,
T, C,
A,
b, r,
k,
h, n );
303 for (
i = 1;
i <= r;
i++ )
305 DEBOUTLN( cerr,
"the corrected K's are now " << K );
310 for (
i = 1;
i <= r;
i++ )
312 if (
prod( K ) - Uk != 0 )
314 DEBOUTLN( cerr,
"the liftstep produced the wrong result" );
315 DEBOUTLN( cerr,
"the product of the factors calculated so far is " <<
prod(K) );
316 DEBOUTLN( cerr,
"and the Uk that should have been reached is " << Uk );
320 DEBOUTLN( cerr,
"the lift seems ok so far" );
329 int k,
i,
h, t =
A.max();
330 bool goodeval =
true;
332 int * n =
new int[t+1];
335 for (
k = t-1;
k > 1;
k-- )
340 for (
k =
A.min(); goodeval && (
k <= t);
k++ )
343 for (
i =
A.min();
i <=
k;
i++ )
345 goodeval = liftStep(
G,
k,
G.max(), t,
bound,
A, lcG, Uk[
k], n,
h );
346 DEBOUTLN( cerr,
"Factorization so far: " <<
G );
static int Hensel(const CanonicalForm &UU, CFArray &G, const Evaluation &AA, const CFArray &LeadCoeffs)
void tau(int **points, int sizePoints, int k)
CanonicalForm extgcd(const CanonicalForm &f, const CanonicalForm &g, CanonicalForm &a, CanonicalForm &b)
CanonicalForm extgcd ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & a,...
CanonicalForm binomialpower(const Variable &, const CanonicalForm &, int)
evaluate polynomials at points
Iterators for CanonicalForm's.
static CanonicalForm bound(const CFMatrix &M)
class to iterate through CanonicalForm's
class to evaluate a polynomial at points
bool iterations_left() const
factory's class for variables
class to do operations mod p^k for int's p and k
functions to print debug output
#define DEBINCLEVEL(stream, msg)
#define DEBOUTLN(stream, objects)
#define DEBDECLEVEL(stream, msg)
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
CanonicalForm remainder(const CanonicalForm &f, const CanonicalForm &g, const modpk &pk)
CanonicalForm replaceLc(const CanonicalForm &f, const CanonicalForm &c)
operations mod p^k and some other useful functions for factorization
static int min(int a, int b)
#define TIMING_DEFINE_PRINT(t)