94 ASSERT( x.
level() > 0,
"type error: polynomial variable expected" );
105 int fDegree =
degree( F, X );
106 int gDegree =
degree( G, X );
107 if ( (fDegree < 0) || (fDegree < gDegree) )
113 return swapvar( result, x, X );
127 if (dv <= dr) {l=
LC(v,x); v = v -l*
power(x,dv);}
133 while ( ( dv <= dr ) && ( !r.
isZero()) )
135 test =
power(x,dr-dv)*v*
LC(r,x);
137 else { r= r -
LC(r,x)*
power(x,dr); }
174 ASSERT( x.
level() > 0,
"type error: polynomial variable expected" );
185 int fDegree =
degree( F, X );
186 int gDegree =
degree( G, X );
187 if ( fDegree < 0 || fDegree < gDegree )
191 return swapvar( result, x, X );
225 ASSERT( x.
level() > 0,
"type error: polynomial variable expected" );
236 int fDegree =
degree( F, X );
237 int gDegree =
degree( G, X );
238 if ( fDegree < 0 || fDegree < gDegree ) {
241 divrem(
power(
LC( G, X ), fDegree-gDegree+1 ) * F, G, q, r );
360 int fLevel = f.
level();
361 int gLevel = g.
level();
362 if ( (gLevel > 0) && (fLevel == gLevel) )
373 else if ( gLevel < fLevel )
414 int fLevel = f.
level();
415 int gLevel = g.
level();
416 if ( (gLevel > 0) && (fLevel == gLevel) )
433 else if ( gLevel < fLevel )
480 int fLevel = f.
level();
481 int gLevel = g.
level();
482 if ( (gLevel > 0) && (fLevel == gLevel) )
488 if (fail || !dividestail)
491 if (fail || !dividesLC)
494 bool divides=
tryDivremt (g, f, q, r, M, fail);
495 if (fail || !divides)
499 else if ( gLevel < fLevel )
510 bool divides=
tryDivremt (g, f, q, r, M, fail);
511 if (fail || !divides)
542 if ( coeffMaxNorm > result )
543 result = coeffMaxNorm;
566 "type error: univariate poly over Z expected" );
571 result += coeff*
coeff;
573 return sqrt( result );
void psqr(const CanonicalForm &f, const CanonicalForm &g, CanonicalForm &q, CanonicalForm &r, const Variable &x)
void psqr ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q, CanonicalForm & r...
some useful template functions.
template CanonicalForm tmax(const CanonicalForm &, const CanonicalForm &)
factory's class for variables
CF_NO_INLINE CanonicalForm coeff() const
get the current coefficient
void out_cf(const char *s1, const CanonicalForm &f, const char *s2)
cf_algorithm.cc - simple mathematical algorithms.
static CanonicalForm * retvalue
CanonicalForm psq(const CanonicalForm &f, const CanonicalForm &g, const Variable &x)
CanonicalForm psq ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ) ...
void tryInvert(const CanonicalForm &F, const CanonicalForm &M, CanonicalForm &inv, bool &fail)
Rational abs(const Rational &a)
Interface to generate InternalCF's over various domains from intrinsic types or mpz_t's.
gmp_float sqrt(const gmp_float &a)
static const int SW_RATIONAL
set to 1 for computations over Q
Iterators for CanonicalForm's.
declarations of higher level algorithms.
CanonicalForm bCommonDen(const CanonicalForm &f)
CanonicalForm bCommonDen ( const CanonicalForm & f )
CanonicalForm maxNorm(const CanonicalForm &f)
CanonicalForm maxNorm ( const CanonicalForm & f )
class to iterate through CanonicalForm's
bool fdivides(const CanonicalForm &f, const CanonicalForm &g)
bool fdivides ( const CanonicalForm & f, const CanonicalForm & g )
const Variable & v
< [in] a sqrfree bivariate poly
CanonicalForm psr(const CanonicalForm &rr, const CanonicalForm &vv, const Variable &x)
CanonicalForm psr ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ) ...
static CanonicalForm internalBCommonDen(const CanonicalForm &f)
static CanonicalForm internalBCommonDen ( const CanonicalForm & f )
CanonicalForm euclideanNorm(const CanonicalForm &f)
CanonicalForm euclideanNorm ( const CanonicalForm & f )
#define ASSERT(expression, message)
bool tryFdivides(const CanonicalForm &f, const CanonicalForm &g, const CanonicalForm &M, bool &fail)
same as fdivides but handles zero divisors in Z_p[t]/(f)[x1,...,xn] for reducible f ...