|
CF_INLINE | CanonicalForm () |
| CF_INLINE CanonicalForm::CanonicalForm () More...
|
|
CF_INLINE | CanonicalForm (const CanonicalForm &) |
| CF_INLINE CanonicalForm::CanonicalForm ( const CanonicalForm & cf ) More...
|
|
CF_INLINE | CanonicalForm (InternalCF *) |
| CF_INLINE CanonicalForm::CanonicalForm ( InternalCF * cf ) More...
|
|
CF_INLINE | CanonicalForm (const int) |
| CF_INLINE CanonicalForm::CanonicalForm ( const int i ) More...
|
|
CF_INLINE | CanonicalForm (const long) |
|
CF_INLINE | CanonicalForm (const Variable &) |
| CF_INLINE CanonicalForm::CanonicalForm ( const Variable & v ) More...
|
|
CF_INLINE | CanonicalForm (const Variable &, int) |
| CF_INLINE CanonicalForm::CanonicalForm ( const Variable & v, int e ) More...
|
|
| CanonicalForm (const char *, const int base=10) |
| constructors, destructors, selectors More...
|
|
CF_NO_INLINE | ~CanonicalForm () |
|
InternalCF * | getval () const |
|
CanonicalForm | deepCopy () const |
|
void | mpzval (mpz_t val) const |
|
CF_NO_INLINE bool | isOne () const |
|
CF_NO_INLINE bool | isZero () const |
|
bool | isImm () const |
|
bool | inZ () const |
| predicates More...
|
|
bool | inQ () const |
|
bool | inFF () const |
|
bool | inGF () const |
|
bool | inBaseDomain () const |
|
bool | inExtension () const |
|
bool | inCoeffDomain () const |
|
bool | inPolyDomain () const |
|
bool | inQuotDomain () const |
|
bool | isFFinGF () const |
|
bool | isUnivariate () const |
|
bool | isHomogeneous () const |
|
long | intval () const |
| conversion functions More...
|
|
CanonicalForm | mapinto () const |
|
CanonicalForm | lc () const |
| CanonicalForm CanonicalForm::lc (), Lc (), LC (), LC ( v ) const. More...
|
|
CanonicalForm | Lc () const |
|
CanonicalForm | LC () const |
|
CanonicalForm | LC (const Variable &v) const |
|
int | degree () const |
| Returns -1 for the zero polynomial and 0 if CO is in a base domain. More...
|
|
int | degree (const Variable &v) const |
| returns -1 for the zero polynomial and 0 if CO is in a base domain. More...
|
|
CanonicalForm | tailcoeff () const |
| tailcoeff() - return least coefficient More...
|
|
CanonicalForm | tailcoeff (const Variable &v) const |
| tailcoeff( v ) returns the tail coefficient of CO where CO is considered an univariate polynomial in the polynomial variable v. More...
|
|
int | taildegree () const |
| taildegree() returns -1 for the zero polynomial, 0 if CO is in a base domain, otherwise the least degree of CO where CO is considered a univariate polynomial in its main variable. More...
|
|
int | level () const |
| level() returns the level of CO. More...
|
|
Variable | mvar () const |
| mvar() returns the main variable of CO or Variable() if CO is in a base domain. More...
|
|
CanonicalForm | num () const |
| num() returns the numerator of CO if CO is a rational number, CO itself otherwise. More...
|
|
CanonicalForm | den () const |
| den() returns the denominator of CO if CO is a rational number, 1 (from the current domain!) otherwise. More...
|
|
CF_NO_INLINE CanonicalForm & | operator= (const CanonicalForm &) |
|
CF_NO_INLINE CanonicalForm & | operator= (const long) |
|
CanonicalForm & | operator+= (const CanonicalForm &) |
| assignment operators More...
|
|
CanonicalForm & | operator-= (const CanonicalForm &) |
|
CanonicalForm & | operator*= (const CanonicalForm &) |
|
CanonicalForm & | operator/= (const CanonicalForm &) |
|
CanonicalForm & | operator%= (const CanonicalForm &) |
|
CanonicalForm & | div (const CanonicalForm &) |
|
CanonicalForm & | tryDiv (const CanonicalForm &, const CanonicalForm &, bool &) |
| same as divremt but handles zero divisors in case we are in Z_p[x]/(f) where f is not irreducible More...
|
|
CanonicalForm & | mod (const CanonicalForm &) |
|
CanonicalForm | operator() (const CanonicalForm &f) const |
| operator ()() - evaluation operator. More...
|
|
CanonicalForm | operator() (const CanonicalForm &f, const Variable &v) const |
| Returns CO if CO is in a base domain. More...
|
|
CanonicalForm | operator[] (int i) const |
| operator []() - return i'th coefficient from CO. More...
|
|
CanonicalForm | deriv () const |
| deriv() - return the formal derivation of CO. More...
|
|
CanonicalForm | deriv (const Variable &x) const |
| deriv( x ) derives CO with respect to x. More...
|
|
int | sign () const |
| int CanonicalForm::sign () const More...
|
|
CanonicalForm | sqrt () const |
| CanonicalForm CanonicalForm::sqrt () const. More...
|
|
int | ilog2 () const |
| int CanonicalForm::ilog2 () const More...
|
|
void | print (OSTREAM &, char *) const |
| input/output More...
|
|
void | print (OSTREAM &) const |
|
CanonicalForm | genZero () const |
| genOne(), genZero() More...
|
|
CanonicalForm | genOne () const |
|
CF_INLINE | CanonicalForm () |
|
CF_INLINE | CanonicalForm (const CanonicalForm &) |
|
CF_INLINE | CanonicalForm (InternalCF *) |
|
CF_INLINE | CanonicalForm (const int) |
|
CF_INLINE | CanonicalForm (const long) |
|
CF_INLINE | CanonicalForm (const Variable &) |
|
CF_INLINE | CanonicalForm (const Variable &, int) |
|
| CanonicalForm (const char *, const int base=10) |
|
CF_NO_INLINE | ~CanonicalForm () |
|
InternalCF * | getval () const |
|
CanonicalForm | deepCopy () const |
|
void | mpzval (mpz_t val) const |
|
CF_NO_INLINE bool | isOne () const |
|
CF_NO_INLINE bool | isZero () const |
|
bool | isImm () const |
|
bool | inZ () const |
|
bool | inQ () const |
|
bool | inFF () const |
|
bool | inGF () const |
|
bool | inBaseDomain () const |
|
bool | inExtension () const |
|
bool | inCoeffDomain () const |
|
bool | inPolyDomain () const |
|
bool | inQuotDomain () const |
|
bool | isFFinGF () const |
|
bool | isUnivariate () const |
|
bool | isHomogeneous () const |
|
long | intval () const |
|
CanonicalForm | mapinto () const |
|
CanonicalForm | lc () const |
|
CanonicalForm | Lc () const |
|
CanonicalForm | LC () const |
|
CanonicalForm | LC (const Variable &v) const |
|
int | degree () const |
|
int | degree (const Variable &v) const |
|
CanonicalForm | tailcoeff () const |
|
CanonicalForm | tailcoeff (const Variable &v) const |
|
int | taildegree () const |
|
int | level () const |
|
Variable | mvar () const |
|
CanonicalForm | num () const |
|
CanonicalForm | den () const |
|
CF_NO_INLINE CanonicalForm & | operator= (const CanonicalForm &) |
|
CF_NO_INLINE CanonicalForm & | operator= (const long) |
|
CanonicalForm & | operator+= (const CanonicalForm &) |
|
CanonicalForm & | operator-= (const CanonicalForm &) |
|
CanonicalForm & | operator*= (const CanonicalForm &) |
|
CanonicalForm & | operator/= (const CanonicalForm &) |
|
CanonicalForm & | operator%= (const CanonicalForm &) |
|
CanonicalForm & | div (const CanonicalForm &) |
|
CanonicalForm & | tryDiv (const CanonicalForm &, const CanonicalForm &, bool &) |
|
CanonicalForm & | mod (const CanonicalForm &) |
|
CanonicalForm | operator() (const CanonicalForm &f) const |
|
CanonicalForm | operator() (const CanonicalForm &f, const Variable &v) const |
|
CanonicalForm | operator[] (int i) const |
|
CanonicalForm | deriv () const |
|
CanonicalForm | deriv (const Variable &x) const |
|
int | sign () const |
|
CanonicalForm | sqrt () const |
|
int | ilog2 () const |
|
void | print (OSTREAM &, char *) const |
|
void | print (OSTREAM &) const |
|
CanonicalForm | genZero () const |
|
CanonicalForm | genOne () const |
|
CF_INLINE | CanonicalForm () |
|
CF_INLINE | CanonicalForm (const CanonicalForm &) |
|
CF_INLINE | CanonicalForm (InternalCF *) |
|
CF_INLINE | CanonicalForm (const int) |
|
CF_INLINE | CanonicalForm (const long) |
|
CF_INLINE | CanonicalForm (const Variable &) |
|
CF_INLINE | CanonicalForm (const Variable &, int) |
|
| CanonicalForm (const char *, const int base=10) |
|
CF_NO_INLINE | ~CanonicalForm () |
|
InternalCF * | getval () const |
|
CanonicalForm | deepCopy () const |
|
void | mpzval (mpz_t val) const |
|
CF_NO_INLINE bool | isOne () const |
|
CF_NO_INLINE bool | isZero () const |
|
bool | isImm () const |
|
bool | inZ () const |
|
bool | inQ () const |
|
bool | inFF () const |
|
bool | inGF () const |
|
bool | inBaseDomain () const |
|
bool | inExtension () const |
|
bool | inCoeffDomain () const |
|
bool | inPolyDomain () const |
|
bool | inQuotDomain () const |
|
bool | isFFinGF () const |
|
bool | isUnivariate () const |
|
bool | isHomogeneous () const |
|
long | intval () const |
|
CanonicalForm | mapinto () const |
|
CanonicalForm | lc () const |
|
CanonicalForm | Lc () const |
|
CanonicalForm | LC () const |
|
CanonicalForm | LC (const Variable &v) const |
|
int | degree () const |
|
int | degree (const Variable &v) const |
|
CanonicalForm | tailcoeff () const |
|
CanonicalForm | tailcoeff (const Variable &v) const |
|
int | taildegree () const |
|
int | level () const |
|
Variable | mvar () const |
|
CanonicalForm | num () const |
|
CanonicalForm | den () const |
|
CF_NO_INLINE CanonicalForm & | operator= (const CanonicalForm &) |
|
CF_NO_INLINE CanonicalForm & | operator= (const long) |
|
CanonicalForm & | operator+= (const CanonicalForm &) |
|
CanonicalForm & | operator-= (const CanonicalForm &) |
|
CanonicalForm & | operator*= (const CanonicalForm &) |
|
CanonicalForm & | operator/= (const CanonicalForm &) |
|
CanonicalForm & | operator%= (const CanonicalForm &) |
|
CanonicalForm & | div (const CanonicalForm &) |
|
CanonicalForm & | tryDiv (const CanonicalForm &, const CanonicalForm &, bool &) |
|
CanonicalForm & | mod (const CanonicalForm &) |
|
CanonicalForm | operator() (const CanonicalForm &f) const |
|
CanonicalForm | operator() (const CanonicalForm &f, const Variable &v) const |
|
CanonicalForm | operator[] (int i) const |
|
CanonicalForm | deriv () const |
|
CanonicalForm | deriv (const Variable &x) const |
|
int | sign () const |
|
CanonicalForm | sqrt () const |
|
int | ilog2 () const |
|
void | print (OSTREAM &, char *) const |
|
void | print (OSTREAM &) const |
|
CanonicalForm | genZero () const |
|
CanonicalForm | genOne () const |
|
void * | operator new (size_t size) throw (std::bad_alloc) |
|
void | operator delete (void *block) throw () |
|
void * | operator new[] (size_t size) throw (std::bad_alloc) |
|
void | operator delete[] (void *block) throw () |
|
void * | operator new (size_t size, const std::nothrow_t &) throw () |
|
void * | operator new[] (size_t size, const std::nothrow_t &) throw () |
|
|
class | CFIterator |
|
bool | operator== (const CanonicalForm &, const CanonicalForm &) |
| operator ==() - compare canonical forms on (in)equality. More...
|
|
bool | operator!= (const CanonicalForm &, const CanonicalForm &) |
| operator !=() returns true iff lhs does not equal rhs. More...
|
|
bool | operator> (const CanonicalForm &, const CanonicalForm &) |
| operator >() - compare canonical forms. More...
|
|
bool | operator< (const CanonicalForm &, const CanonicalForm &) |
|
CF_NO_INLINE CanonicalForm | operator- (const CanonicalForm &) |
|
void FACTORY_PUBLIC | divrem (const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm &) |
|
bool | divremt (const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm &) |
|
bool | tryDivremt (const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm &, const CanonicalForm &, bool &) |
| same as divremt but handles zero divisors in case we are in Z_p[x]/(f) where f is not irreducible More...
|
|
CanonicalForm | bgcd (const CanonicalForm &, const CanonicalForm &) |
| CanonicalForm bgcd ( const CanonicalForm & f, const CanonicalForm & g ) More...
|
|
CanonicalForm | bextgcd (const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm &) |
| CanonicalForm bextgcd ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & a, CanonicalForm & b ) More...
|
|
OSTREAM & | operator<< (OSTREAM &, const CanonicalForm &) |
|
ISTREAM & | operator>> (ISTREAM &, CanonicalForm &) |
|
bool | operator== (const CanonicalForm &, const CanonicalForm &) |
| operator ==() - compare canonical forms on (in)equality. More...
|
|
bool | operator!= (const CanonicalForm &, const CanonicalForm &) |
| operator !=() returns true iff lhs does not equal rhs. More...
|
|
bool | operator> (const CanonicalForm &, const CanonicalForm &) |
| operator >() - compare canonical forms. More...
|
|
bool | operator< (const CanonicalForm &, const CanonicalForm &) |
|
CF_NO_INLINE CanonicalForm | operator- (const CanonicalForm &) |
|
void FACTORY_PUBLIC | divrem (const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm &) |
|
bool | divremt (const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm &) |
|
bool | tryDivremt (const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm &, const CanonicalForm &, bool &) |
| same as divremt but handles zero divisors in case we are in Z_p[x]/(f) where f is not irreducible More...
|
|
CanonicalForm | bgcd (const CanonicalForm &, const CanonicalForm &) |
| CanonicalForm bgcd ( const CanonicalForm & f, const CanonicalForm & g ) More...
|
|
CanonicalForm | bextgcd (const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm &) |
| CanonicalForm bextgcd ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & a, CanonicalForm & b ) More...
|
|
OSTREAM & | operator<< (OSTREAM &, const CanonicalForm &) |
|
ISTREAM & | operator>> (ISTREAM &, CanonicalForm &) |
|
bool | operator== (const CanonicalForm &, const CanonicalForm &) |
| operator ==() - compare canonical forms on (in)equality. More...
|
|
bool | operator!= (const CanonicalForm &, const CanonicalForm &) |
| operator !=() returns true iff lhs does not equal rhs. More...
|
|
bool | operator> (const CanonicalForm &, const CanonicalForm &) |
| operator >() - compare canonical forms. More...
|
|
bool | operator< (const CanonicalForm &, const CanonicalForm &) |
|
CF_NO_INLINE CanonicalForm | operator- (const CanonicalForm &) |
|
void FACTORY_PUBLIC | divrem (const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm &) |
|
bool | divremt (const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm &) |
|
bool | tryDivremt (const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm &, const CanonicalForm &, bool &) |
| same as divremt but handles zero divisors in case we are in Z_p[x]/(f) where f is not irreducible More...
|
|
CanonicalForm | bgcd (const CanonicalForm &, const CanonicalForm &) |
| CanonicalForm bgcd ( const CanonicalForm & f, const CanonicalForm & g ) More...
|
|
CanonicalForm | bextgcd (const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm &) |
| CanonicalForm bextgcd ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & a, CanonicalForm & b ) More...
|
|
OSTREAM & | operator<< (OSTREAM &, const CanonicalForm &) |
|
ISTREAM & | operator>> (ISTREAM &, CanonicalForm &) |
|
factory's main class
a CanonicalForm can represent a polynomial over or a constant in F_p, F_p(alpha), GF (F_p[t]/(Conway polynomial)), Z, or Q
- See also
- int_poly.h, variable.h, ffops.h, gfops.h, imm.h, int_int.h, int_rat.h
Definition at line 80 of file canonicalform.h.
CanonicalForm CanonicalForm::lc (), Lc (), LC (), LC ( v ) const.
lc(), Lc(), LC() - leading coefficient functions.
All methods return CO if CO is in a base domain.
lc() returns the leading coefficient of CO with respect to lexicographic ordering. Elements in an algebraic extension are considered polynomials so lc() always returns a leading coefficient in a base domain. This method is useful to get the base domain over which CO is defined.
Lc() returns the leading coefficient of CO with respect to lexicographic ordering. In contrast to lc() elements in an algebraic extension are considered coefficients so Lc() always returns a leading coefficient in a coefficient domain.
LC() returns the leading coefficient of CO where CO is considered a univariate polynomial in its main variable. An element of an algebraic extension is considered an univariate polynomial, too.
LC( v ) returns the leading coefficient of CO where CO is considered an univariate polynomial in the polynomial variable v. Note: If v is less than the main variable of CO we have to swap variables which may be quite expensive.
Examples:
Let x < y be polynomial variables, a an algebraic variable.
(3*a*x*y^2+y+x).lc() = 3
(3*a*x*y^2+y+x).Lc() = 3*a
(3*a*x*y^2+y+x).LC() = 3*a*x
(3*a*x*y^2+y+x).LC( x ) = 3*a*y^2+1
(3*a^2+4*a).lc() = 3
(3*a^2+4*a).Lc() = 3*a^2+4*a
(3*a^2+4*a).LC() = 3
(3*a^2+4*a).LC( x ) = 3*a^2+4*a
- See also
- InternalCF::lc(), InternalCF::Lc(), InternalCF::LC(), InternalPoly::lc(), InternalPoly::Lc(), InternalPoly::LC(), lc(), Lc(), LC(), ::LC( v )
Definition at line 337 of file canonicalform.cc.
virtual CanonicalForm lc()
CanonicalForm InternalCF::lc (), Lc (), LC ()
int CanonicalForm::sign |
( |
| ) |
const |
int CanonicalForm::sign () const
sign() - return sign of CO.
If CO is an integer or a rational number, the sign is defined as usual. If CO is an element of a prime power domain or of FF(p) and SW_SYMMETRIC_FF is on, the sign of CO is the sign of the symmetric representation of CO. If CO is in GF(q) or in FF(p) and SW_SYMMETRIC_FF is off, the sign of CO is zero iff CO is zero, otherwise the sign is one.
If CO is a polynomial or in an extension of one of the base domains, the sign of CO is the sign of its leading coefficient.
- See also
- InternalCF::sign(), InternalInteger::sign(), InternalRational::sign(), InternalPoly::sign(), imm_sign(), gf_sign()
Definition at line 1360 of file canonicalform.cc.
virtual int sign() const PVIRT_INT("sign")
int imm_sign(const InternalCF *const op)
imm_sign() - return sign of immediate object.
CanonicalForm bgcd ( const CanonicalForm & f, const CanonicalForm & g )
bgcd() - return base coefficient gcd.
If both f and g are integers and ‘SW_RATIONAL’ is off the positive greatest common divisor of f and g is returned. Otherwise, if ‘SW_RATIONAL’ is on or one of f and g is not an integer, the greatest common divisor is trivial: either zero if f and g equal zero or one (both from the current domain).
f and g should come from one base domain which should be not the prime power domain.
Implementation:
CanonicalForm::bgcd() handles the immediate case with a standard euclidean algorithm. For the non-immediate cases ‘InternalCF::bgcdsame()’ or ‘InternalCF::bgcdcoeff()’, resp. are called following the usual level/levelcoeff approach.
InternalCF::bgcdsame() and InternalCF::bgcdcoeff() throw an assertion ("not implemented")
InternalInteger::bgcdsame() is a wrapper around ‘mpz_gcd()’ which takes some care about immediate results and the sign of the result InternalInteger::bgcdcoeff() is a wrapper around ‘mpz_gcd_ui()’ which takes some care about the sign of the result
InternalRational::bgcdsame() and InternalRational::bgcdcoeff() always return one
Definition at line 1648 of file canonicalform.cc.
1654 ASSERT( ! what || (what ==
is_imm(
f.value )),
"incompatible operands" );
1656 return g.value->bgcdcoeff(
f.value );
1664 if ( fInt < 0 ) fInt = -fInt;
1678 long r = fInt %
gInt;
1691 return f.value->bgcdcoeff(
g.value );
1693 int fLevel =
f.value->level();
1694 int gLevel =
g.value->level();
1697 if ( fLevel == gLevel )
1699 fLevel =
f.value->levelcoeff();
1700 gLevel =
g.value->levelcoeff();
1703 if ( fLevel == gLevel )
1704 return f.value->bgcdsame(
g.value );
1705 else if ( fLevel < gLevel )
1706 return g.value->bgcdcoeff(
f.value );
1708 return f.value->bgcdcoeff(
g.value );
1710 else if ( fLevel < gLevel )
1711 return g.value->bgcdcoeff(
f.value );
1713 return f.value->bgcdcoeff(
g.value );
CanonicalForm bgcd ( const CanonicalForm & f, const CanonicalForm & g )
bgcd() - return base coefficient gcd.
If both f and g are integers and ‘SW_RATIONAL’ is off the positive greatest common divisor of f and g is returned. Otherwise, if ‘SW_RATIONAL’ is on or one of f and g is not an integer, the greatest common divisor is trivial: either zero if f and g equal zero or one (both from the current domain).
f and g should come from one base domain which should be not the prime power domain.
Implementation:
CanonicalForm::bgcd() handles the immediate case with a standard euclidean algorithm. For the non-immediate cases ‘InternalCF::bgcdsame()’ or ‘InternalCF::bgcdcoeff()’, resp. are called following the usual level/levelcoeff approach.
InternalCF::bgcdsame() and InternalCF::bgcdcoeff() throw an assertion ("not implemented")
InternalInteger::bgcdsame() is a wrapper around ‘mpz_gcd()’ which takes some care about immediate results and the sign of the result InternalInteger::bgcdcoeff() is a wrapper around ‘mpz_gcd_ui()’ which takes some care about the sign of the result
InternalRational::bgcdsame() and InternalRational::bgcdcoeff() always return one
Definition at line 1648 of file canonicalform.cc.
1654 ASSERT( ! what || (what ==
is_imm(
f.value )),
"incompatible operands" );
1656 return g.value->bgcdcoeff(
f.value );
1664 if ( fInt < 0 ) fInt = -fInt;
1678 long r = fInt %
gInt;
1691 return f.value->bgcdcoeff(
g.value );
1693 int fLevel =
f.value->level();
1694 int gLevel =
g.value->level();
1697 if ( fLevel == gLevel )
1699 fLevel =
f.value->levelcoeff();
1700 gLevel =
g.value->levelcoeff();
1703 if ( fLevel == gLevel )
1704 return f.value->bgcdsame(
g.value );
1705 else if ( fLevel < gLevel )
1706 return g.value->bgcdcoeff(
f.value );
1708 return f.value->bgcdcoeff(
g.value );
1710 else if ( fLevel < gLevel )
1711 return g.value->bgcdcoeff(
f.value );
1713 return f.value->bgcdcoeff(
g.value );
CanonicalForm bgcd ( const CanonicalForm & f, const CanonicalForm & g )
bgcd() - return base coefficient gcd.
If both f and g are integers and ‘SW_RATIONAL’ is off the positive greatest common divisor of f and g is returned. Otherwise, if ‘SW_RATIONAL’ is on or one of f and g is not an integer, the greatest common divisor is trivial: either zero if f and g equal zero or one (both from the current domain).
f and g should come from one base domain which should be not the prime power domain.
Implementation:
CanonicalForm::bgcd() handles the immediate case with a standard euclidean algorithm. For the non-immediate cases ‘InternalCF::bgcdsame()’ or ‘InternalCF::bgcdcoeff()’, resp. are called following the usual level/levelcoeff approach.
InternalCF::bgcdsame() and InternalCF::bgcdcoeff() throw an assertion ("not implemented")
InternalInteger::bgcdsame() is a wrapper around ‘mpz_gcd()’ which takes some care about immediate results and the sign of the result InternalInteger::bgcdcoeff() is a wrapper around ‘mpz_gcd_ui()’ which takes some care about the sign of the result
InternalRational::bgcdsame() and InternalRational::bgcdcoeff() always return one
Definition at line 1648 of file canonicalform.cc.
1654 ASSERT( ! what || (what ==
is_imm(
f.value )),
"incompatible operands" );
1656 return g.value->bgcdcoeff(
f.value );
1664 if ( fInt < 0 ) fInt = -fInt;
1678 long r = fInt %
gInt;
1691 return f.value->bgcdcoeff(
g.value );
1693 int fLevel =
f.value->level();
1694 int gLevel =
g.value->level();
1697 if ( fLevel == gLevel )
1699 fLevel =
f.value->levelcoeff();
1700 gLevel =
g.value->levelcoeff();
1703 if ( fLevel == gLevel )
1704 return f.value->bgcdsame(
g.value );
1705 else if ( fLevel < gLevel )
1706 return g.value->bgcdcoeff(
f.value );
1708 return f.value->bgcdcoeff(
g.value );
1710 else if ( fLevel < gLevel )
1711 return g.value->bgcdcoeff(
f.value );
1713 return f.value->bgcdcoeff(
g.value );
operator ==() - compare canonical forms on (in)equality.
operator ==() returns true iff lhs equals rhs.
This is the point in factory where we essentially use that CanonicalForms in fact are canonical. There must not be two different representations of the same mathematical object, otherwise, such (in)equality will not be recognized by these operators. In other word, we rely on the fact that structural different factory objects in any case represent different mathematical objects.
So we use the following procedure to test on equality (and analogously on inequality). First, we check whether lhs.value equals rhs.value. If so we are ready and return true. Second, if one of the operands is immediate, but the other one not, we return false. Third, if the operand's levels differ we return false. Fourth, if the operand's levelcoeffs differ we return false. At last, we call the corresponding internal method to compare both operands.
Both operands should have coefficients from the same base domain.
Note: To compare with the zero or the unit of the current domain, you better use the methods ‘CanonicalForm::isZero()’ or ‘CanonicalForm::isOne()’, resp., than something like ‘f == 0’, since the latter is quite a lot slower.
- See also
- CanonicalForm::operator !=(), InternalCF::comparesame(), InternalInteger::comparesame(), InternalRational::comparesame(), InternalPoly::comparesame()
Definition at line 1467 of file canonicalform.cc.
1475 "incompatible operands" );
operator ==() - compare canonical forms on (in)equality.
operator ==() returns true iff lhs equals rhs.
This is the point in factory where we essentially use that CanonicalForms in fact are canonical. There must not be two different representations of the same mathematical object, otherwise, such (in)equality will not be recognized by these operators. In other word, we rely on the fact that structural different factory objects in any case represent different mathematical objects.
So we use the following procedure to test on equality (and analogously on inequality). First, we check whether lhs.value equals rhs.value. If so we are ready and return true. Second, if one of the operands is immediate, but the other one not, we return false. Third, if the operand's levels differ we return false. Fourth, if the operand's levelcoeffs differ we return false. At last, we call the corresponding internal method to compare both operands.
Both operands should have coefficients from the same base domain.
Note: To compare with the zero or the unit of the current domain, you better use the methods ‘CanonicalForm::isZero()’ or ‘CanonicalForm::isOne()’, resp., than something like ‘f == 0’, since the latter is quite a lot slower.
- See also
- CanonicalForm::operator !=(), InternalCF::comparesame(), InternalInteger::comparesame(), InternalRational::comparesame(), InternalPoly::comparesame()
Definition at line 1467 of file canonicalform.cc.
1475 "incompatible operands" );
operator ==() - compare canonical forms on (in)equality.
operator ==() returns true iff lhs equals rhs.
This is the point in factory where we essentially use that CanonicalForms in fact are canonical. There must not be two different representations of the same mathematical object, otherwise, such (in)equality will not be recognized by these operators. In other word, we rely on the fact that structural different factory objects in any case represent different mathematical objects.
So we use the following procedure to test on equality (and analogously on inequality). First, we check whether lhs.value equals rhs.value. If so we are ready and return true. Second, if one of the operands is immediate, but the other one not, we return false. Third, if the operand's levels differ we return false. Fourth, if the operand's levelcoeffs differ we return false. At last, we call the corresponding internal method to compare both operands.
Both operands should have coefficients from the same base domain.
Note: To compare with the zero or the unit of the current domain, you better use the methods ‘CanonicalForm::isZero()’ or ‘CanonicalForm::isOne()’, resp., than something like ‘f == 0’, since the latter is quite a lot slower.
- See also
- CanonicalForm::operator !=(), InternalCF::comparesame(), InternalInteger::comparesame(), InternalRational::comparesame(), InternalPoly::comparesame()
Definition at line 1467 of file canonicalform.cc.
1475 "incompatible operands" );
operator >() - compare canonical forms.
on size or level.
The most common and most useful application of these operators is to compare two integers or rationals, of course. However, these operators are defined on all other base domains and on polynomials, too. From a mathematical point of view this may seem meaningless, since there is no ordering on finite fields or on polynomials respecting the algebraic structure. Nevertheless, from a programmer's point of view it may be sensible to order these objects, e.g. to sort them.
Therefore, the ordering defined by these operators in any case is a total ordering which fulfills the law of trichotomy.
It is clear how this is done in the case of the integers and the rationals. For finite fields, all you can say is that zero is the minimal element w.r.t. the ordering, the other elements are ordered in an arbitrary (but total!) way. For polynomials, you have an ordering derived from the lexicographical ordering of monomials. E.g. if lm(f) < lm(g) w.r.t. lexicographic ordering, then f < g. For more details, refer to the documentation of ‘InternalPoly::operator <()’.
Both operands should have coefficients from the same base domain.
The scheme how both operators are implemented is allmost the same as for the assignment operators (check for immediates, then check levels, then check levelcoeffs, then call the appropriate internal comparesame()/comparecoeff() method). For more information, confer to the overview for the arithmetic operators.
- See also
- CanonicalForm::operator <(), InternalCF::comparesame(), InternalInteger::comparesame(), InternalRational::comparesame(), InternalPoly::comparesame(), InternalCF::comparecoeff(), InternalInteger::comparecoeff(), InternalRational::comparecoeff(), InternalPoly::comparecoeff(), imm_cmp(), imm_cmp_p(), imm_cmp_gf()
Definition at line 1555 of file canonicalform.cc.
1564 else if ( what ==
FFMARK )
operator >() - compare canonical forms.
on size or level.
The most common and most useful application of these operators is to compare two integers or rationals, of course. However, these operators are defined on all other base domains and on polynomials, too. From a mathematical point of view this may seem meaningless, since there is no ordering on finite fields or on polynomials respecting the algebraic structure. Nevertheless, from a programmer's point of view it may be sensible to order these objects, e.g. to sort them.
Therefore, the ordering defined by these operators in any case is a total ordering which fulfills the law of trichotomy.
It is clear how this is done in the case of the integers and the rationals. For finite fields, all you can say is that zero is the minimal element w.r.t. the ordering, the other elements are ordered in an arbitrary (but total!) way. For polynomials, you have an ordering derived from the lexicographical ordering of monomials. E.g. if lm(f) < lm(g) w.r.t. lexicographic ordering, then f < g. For more details, refer to the documentation of ‘InternalPoly::operator <()’.
Both operands should have coefficients from the same base domain.
The scheme how both operators are implemented is allmost the same as for the assignment operators (check for immediates, then check levels, then check levelcoeffs, then call the appropriate internal comparesame()/comparecoeff() method). For more information, confer to the overview for the arithmetic operators.
- See also
- CanonicalForm::operator <(), InternalCF::comparesame(), InternalInteger::comparesame(), InternalRational::comparesame(), InternalPoly::comparesame(), InternalCF::comparecoeff(), InternalInteger::comparecoeff(), InternalRational::comparecoeff(), InternalPoly::comparecoeff(), imm_cmp(), imm_cmp_p(), imm_cmp_gf()
Definition at line 1555 of file canonicalform.cc.
1564 else if ( what ==
FFMARK )
operator >() - compare canonical forms.
on size or level.
The most common and most useful application of these operators is to compare two integers or rationals, of course. However, these operators are defined on all other base domains and on polynomials, too. From a mathematical point of view this may seem meaningless, since there is no ordering on finite fields or on polynomials respecting the algebraic structure. Nevertheless, from a programmer's point of view it may be sensible to order these objects, e.g. to sort them.
Therefore, the ordering defined by these operators in any case is a total ordering which fulfills the law of trichotomy.
It is clear how this is done in the case of the integers and the rationals. For finite fields, all you can say is that zero is the minimal element w.r.t. the ordering, the other elements are ordered in an arbitrary (but total!) way. For polynomials, you have an ordering derived from the lexicographical ordering of monomials. E.g. if lm(f) < lm(g) w.r.t. lexicographic ordering, then f < g. For more details, refer to the documentation of ‘InternalPoly::operator <()’.
Both operands should have coefficients from the same base domain.
The scheme how both operators are implemented is allmost the same as for the assignment operators (check for immediates, then check levels, then check levelcoeffs, then call the appropriate internal comparesame()/comparecoeff() method). For more information, confer to the overview for the arithmetic operators.
- See also
- CanonicalForm::operator <(), InternalCF::comparesame(), InternalInteger::comparesame(), InternalRational::comparesame(), InternalPoly::comparesame(), InternalCF::comparecoeff(), InternalInteger::comparecoeff(), InternalRational::comparecoeff(), InternalPoly::comparecoeff(), imm_cmp(), imm_cmp_p(), imm_cmp_gf()
Definition at line 1555 of file canonicalform.cc.
1564 else if ( what ==
FFMARK )