97 return InvModStatus(
x._zz_pE__rep, a._zz_pE__rep, zz_pE::modulus());
105 for (
i = 0;
i < n;
i++)
106 x[
i].rep.SetMaxLength(
m);
112 long da, db, dq,
i,
j, LCIsOne;
123 if (db < 0) Error(
"zz_pEX: division by zero");
142 for (
i = 0;
i <= da;
i++)
143 x[
i] = rep(a.rep[
i]);
149 for (
i = dq;
i >= 0;
i--) {
155 for (
j = db-1;
j >= 0;
j--) {
156 mul(
s, rep(t), rep(bp[
j]));
162 for (
i = 0;
i < db;
i++)
170 long da, db, dq,
i,
j, LCIsOne;
182 if (db < 0) Error(
"zz_pEX: division by zero");
211 SetSize(
x, da+1, 2*zz_pE::degree());
213 for (
i = 0;
i <= da;
i++)
214 x[
i] = rep(a.rep[
i]);
219 q.rep.SetLength(dq+1);
222 for (
i = dq;
i >= 0;
i--) {
229 for (
j = db-1;
j >= 0;
j--) {
230 mul(
s, rep(t), rep(bp[
j]));
236 for (
i = 0;
i < db;
i++)
242void tryNTLGCD(zz_pEX&
x,
const zz_pEX& a,
const zz_pEX&
b,
bool& fail)
251 long n =
max(deg(a),deg(
b)) + 1;
252 zz_pEX u(INIT_SIZE, n),
v(INIT_SIZE, n);
255 SetSize(tmp, n, 2*zz_pE::degree());
270 if (
IsOne(LeadCoeff(
x)))
return;
282 const zz_pEX&
b,
bool& fail)
298 long e =
max(deg(a), deg(
b)) + 1;
300 zz_pEX temp(INIT_SIZE, e), u(INIT_SIZE, e),
v(INIT_SIZE, e),
301 u0(INIT_SIZE, e), v0(INIT_SIZE, e),
302 u1(INIT_SIZE, e), v1(INIT_SIZE, e),
303 u2(INIT_SIZE, e), v2(INIT_SIZE, e), q(INIT_SIZE, e);
332 if (
IsOne(LeadCoeff(d)))
return;
Conversion to and from NTL.
static void SetSize(vec_zz_pX &x, long n, long m)
void tryNTLGCD(zz_pEX &x, const zz_pEX &a, const zz_pEX &b, bool &fail)
compute the GCD x of a and b, fail is set to true if a zero divisor is encountered
long InvModStatus(zz_pE &x, const zz_pE &a)
void tryNTLXGCD(zz_pEX &d, zz_pEX &s, zz_pEX &t, const zz_pEX &a, const zz_pEX &b, bool &fail)
compute the extended GCD d=s*a+t*b, fail is set to true if a zero divisor is encountered
void tryPlainRem(zz_pEX &r, const zz_pEX &a, const zz_pEX &b, vec_zz_pX &x, bool &fail)
void tryPlainDivRem(zz_pEX &q, zz_pEX &r, const zz_pEX &a, const zz_pEX &b, bool &fail)
This file defines functions for univariate GCD and extended GCD over Z/p[t]/(f)[x] for reducible f.
const CanonicalForm int s
CFList conv(const CFFList &L)
convert a CFFList to a CFList by dropping the multiplicity
const Variable & v
< [in] a sqrfree bivariate poly
static int max(int a, int b)
static BOOLEAN IsOne(number a, const coeffs)
static BOOLEAN IsZero(number a, const coeffs)
STATIC_VAR unsigned add[]