![]() |
factory's main class More...
#include <canonicalform.h>
Private Attributes | |
InternalCF * | value |
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
Definition at line 75 of file canonicalform.h.
CF_INLINE CanonicalForm::CanonicalForm | ( | ) |
CF_INLINE CanonicalForm::CanonicalForm ()
CanonicalForm() - create the default canonical form.
The canonical form is initialized to zero from the current domain.
Definition at line 126 of file cf_inline.cc.
CF_INLINE CanonicalForm::CanonicalForm | ( | const CanonicalForm & | cf | ) |
CF_INLINE CanonicalForm::CanonicalForm ( const CanonicalForm & cf )
CanonicalForm() - create a copy of a canonical form.
cf: Anything
Definition at line 166 of file cf_inline.cc.
CF_INLINE CanonicalForm::CanonicalForm | ( | InternalCF * | cf | ) |
CF_INLINE CanonicalForm::CanonicalForm ( InternalCF * cf )
CanonicalForm() - create a canonical form from a pointer to an internal canonical form.
This constructor is reserved for internal usage.
The canonical form gets its value immediately from `cf'. `cf's reference counter is not incremented, so be careful with this constructor.
Definition at line 187 of file cf_inline.cc.
CF_INLINE CanonicalForm::CanonicalForm ( const int i )
CanonicalForm() - create a canonical form from an integer.
The canonical form is initialized to the "canonical image" of `i' in the current domain. This is `i' itself for characteristic zero, `i' mod p for finite fields of characteristic p, and `i' mod p^n for prime power domains with p^n elements.
Definition at line 144 of file cf_inline.cc.
Definition at line 150 of file cf_inline.cc.
CF_INLINE CanonicalForm::CanonicalForm ( const Variable & v )
CanonicalForm() - create a canonical form from a variable.
If `v' is a polynomial variable or an algebraic element the resulting polynomial (or algebraic element) is 1*`v'^1, the one being from the current domain.
Variables of level `LEVELBASE' are transformed to one from the current domain.
v: Anything
Definition at line 210 of file cf_inline.cc.
CF_INLINE CanonicalForm::CanonicalForm ( const Variable & v, int e )
CanonicalForm() - create a canonical form from a power of a variable.
If `v' is a polynomial variable or an algebraic element the resulting polynomial (or algebraic element) is 1*`v'^`e', the one being from the current domain. Algebraic elements are reduced modulo their minimal polynomial.
Variables of level `LEVELBASE' are transformed to one from the current domain.
v: Anything
Definition at line 235 of file cf_inline.cc.
CF_INLINE CanonicalForm::~CanonicalForm | ( | ) |
CF_INLINE CanonicalForm::~CanonicalForm ()
~CanonicalForm() - delete CO.
CO: Anything
Definition at line 253 of file cf_inline.cc.
CF_INLINE CanonicalForm::CanonicalForm | ( | ) |
CF_INLINE CanonicalForm::CanonicalForm | ( | const CanonicalForm & | ) |
CF_INLINE CanonicalForm::CanonicalForm | ( | InternalCF * | ) |
CF_NO_INLINE CanonicalForm::~CanonicalForm | ( | ) |
CF_INLINE CanonicalForm::CanonicalForm | ( | ) |
CF_INLINE CanonicalForm::CanonicalForm | ( | const CanonicalForm & | ) |
CF_INLINE CanonicalForm::CanonicalForm | ( | InternalCF * | ) |
CF_NO_INLINE CanonicalForm::~CanonicalForm | ( | ) |
CanonicalForm CanonicalForm::deepCopy | ( | ) | const |
Definition at line 42 of file canonicalform.cc.
CanonicalForm CanonicalForm::deepCopy | ( | ) | const |
CanonicalForm CanonicalForm::deepCopy | ( | ) | const |
int CanonicalForm::degree | ( | ) | const |
Returns -1 for the zero polynomial and 0 if CO is in a base domain.
degree() returns the degree of CO in its main variable. Elements in an algebraic extension are considered polynomials.
Definition at line 383 of file canonicalform.cc.
returns -1 for the zero polynomial and 0 if CO is in a base domain.
degree( v ) returns the degree of CO with respect to v. Elements in an algebraic extension are considered polynomials, and v may be algebraic.
Definition at line 409 of file canonicalform.cc.
int CanonicalForm::degree | ( | ) | const |
int CanonicalForm::degree | ( | ) | const |
CanonicalForm CanonicalForm::den | ( | ) | const |
den() returns the denominator of CO if CO is a rational number, 1 (from the current domain!) otherwise.
Definition at line 597 of file canonicalform.cc.
CanonicalForm CanonicalForm::den | ( | ) | const |
CanonicalForm CanonicalForm::den | ( | ) | const |
CanonicalForm CanonicalForm::deriv | ( | ) | const |
deriv() - return the formal derivation of CO.
deriv() derives CO with respect to its main variable. Returns zero from the current domain if f is in a coefficient domain.
Definition at line 1237 of file canonicalform.cc.
CanonicalForm CanonicalForm::deriv | ( | const Variable & | x | ) | const |
deriv( x ) derives CO with respect to x.
x should be a polynomial variable. Returns zero from the current domain if f is in a coefficient domain.
Definition at line 1257 of file canonicalform.cc.
CanonicalForm CanonicalForm::deriv | ( | ) | const |
CanonicalForm CanonicalForm::deriv | ( | ) | const |
CanonicalForm CanonicalForm::deriv | ( | const Variable & | x | ) | const |
CanonicalForm CanonicalForm::deriv | ( | const Variable & | x | ) | const |
CanonicalForm & CanonicalForm::div | ( | const CanonicalForm & | cf | ) |
Definition at line 799 of file canonicalform.cc.
CanonicalForm& CanonicalForm::div | ( | const CanonicalForm & | ) |
CanonicalForm& CanonicalForm::div | ( | const CanonicalForm & | ) |
CanonicalForm CanonicalForm::genOne | ( | ) | const |
Definition at line 1824 of file canonicalform.cc.
CanonicalForm CanonicalForm::genOne | ( | ) | const |
CanonicalForm CanonicalForm::genOne | ( | ) | const |
CanonicalForm CanonicalForm::genZero | ( | ) | const |
Definition at line 1810 of file canonicalform.cc.
CanonicalForm CanonicalForm::genZero | ( | ) | const |
CanonicalForm CanonicalForm::genZero | ( | ) | const |
InternalCF * CanonicalForm::getval | ( | ) | const |
Definition at line 33 of file canonicalform.cc.
InternalCF* CanonicalForm::getval | ( | ) | const |
InternalCF* CanonicalForm::getval | ( | ) | const |
int CanonicalForm::ilog2 | ( | ) | const |
int CanonicalForm::ilog2 () const
ilog2() - integer logarithm to base 2.
Returns the largest integer less or equal logarithm of CO to base 2. CO should be a positive integer.
Definition at line 1354 of file canonicalform.cc.
int CanonicalForm::ilog2 | ( | ) | const |
int CanonicalForm::ilog2 | ( | ) | const |
bool CanonicalForm::inBaseDomain | ( | ) | const |
Definition at line 103 of file canonicalform.cc.
bool CanonicalForm::inBaseDomain | ( | ) | const |
bool CanonicalForm::inBaseDomain | ( | ) | const |
bool CanonicalForm::inCoeffDomain | ( | ) | const |
Definition at line 121 of file canonicalform.cc.
bool CanonicalForm::inCoeffDomain | ( | ) | const |
bool CanonicalForm::inCoeffDomain | ( | ) | const |
bool CanonicalForm::inExtension | ( | ) | const |
Definition at line 112 of file canonicalform.cc.
bool CanonicalForm::inExtension | ( | ) | const |
bool CanonicalForm::inExtension | ( | ) | const |
bool CanonicalForm::inFF | ( | ) | const |
Definition at line 91 of file canonicalform.cc.
bool CanonicalForm::inFF | ( | ) | const |
bool CanonicalForm::inFF | ( | ) | const |
bool CanonicalForm::inGF | ( | ) | const |
Definition at line 97 of file canonicalform.cc.
bool CanonicalForm::inGF | ( | ) | const |
bool CanonicalForm::inGF | ( | ) | const |
bool CanonicalForm::inPolyDomain | ( | ) | const |
Definition at line 130 of file canonicalform.cc.
bool CanonicalForm::inPolyDomain | ( | ) | const |
bool CanonicalForm::inPolyDomain | ( | ) | const |
bool CanonicalForm::inQ | ( | ) | const |
Definition at line 79 of file canonicalform.cc.
bool CanonicalForm::inQ | ( | ) | const |
bool CanonicalForm::inQ | ( | ) | const |
bool CanonicalForm::inQuotDomain | ( | ) | const |
Definition at line 139 of file canonicalform.cc.
bool CanonicalForm::inQuotDomain | ( | ) | const |
bool CanonicalForm::inQuotDomain | ( | ) | const |
long CanonicalForm::intval | ( | ) | const |
long CanonicalForm::intval | ( | ) | const |
long CanonicalForm::intval | ( | ) | const |
bool CanonicalForm::inZ | ( | ) | const |
bool CanonicalForm::inZ | ( | ) | const |
bool CanonicalForm::inZ | ( | ) | const |
bool CanonicalForm::isFFinGF | ( | ) | const |
Definition at line 148 of file canonicalform.cc.
bool CanonicalForm::isFFinGF | ( | ) | const |
bool CanonicalForm::isFFinGF | ( | ) | const |
bool CanonicalForm::isHomogeneous | ( | ) | const |
Definition at line 164 of file canonicalform.cc.
bool CanonicalForm::isHomogeneous | ( | ) | const |
bool CanonicalForm::isHomogeneous | ( | ) | const |
|
inline |
Definition at line 103 of file canonicalform.h.
CF_INLINE bool CanonicalForm::isOne | ( | ) | const |
CF_INLINE bool CanonicalForm::isOne, isZero () const.
isOne(), isZero() - test whether a `CanonicalForm' equals one or zero, resp.
The predicates `isOne()' and `isZero()' are much faster than the comparison operators. Furthermore, a test `f.isZero()' is independent from the current domain, whereas an expression `f == 0' is not.
CO: Anything
Note that only immediate objects and objects of class `InternalPrimePower' may equal one or zero, resp.
imm_isone(), imm_iszero() Trivial.
imm_isone_p(), imm_iszero_p() Trivial.
imm_isone_gf(), imm_iszero_gf() Use `gf_isone()' and `gf_iszero()', resp., to test whether CO equals zero or one, resp.
InternalCF::isOne(), isZero() Always return false.
InternalPrimePower::isOne(), isZero() Use `mpz_cpm_ui()' resp. `mpz_sgn()' to check the underlying mpi.
Definition at line 354 of file cf_inline.cc.
CF_NO_INLINE bool CanonicalForm::isOne | ( | ) | const |
CF_NO_INLINE bool CanonicalForm::isOne | ( | ) | const |
bool CanonicalForm::isUnivariate | ( | ) | const |
Definition at line 154 of file canonicalform.cc.
bool CanonicalForm::isUnivariate | ( | ) | const |
bool CanonicalForm::isUnivariate | ( | ) | const |
CF_INLINE bool CanonicalForm::isZero | ( | ) | const |
CF_NO_INLINE bool CanonicalForm::isZero | ( | ) | const |
CF_NO_INLINE bool CanonicalForm::isZero | ( | ) | const |
CanonicalForm CanonicalForm::lc | ( | ) | const |
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
Definition at line 306 of file canonicalform.cc.
CanonicalForm CanonicalForm::Lc | ( | ) | const |
Definition at line 321 of file canonicalform.cc.
CanonicalForm CanonicalForm::LC | ( | ) | const |
Definition at line 336 of file canonicalform.cc.
CanonicalForm CanonicalForm::LC | ( | const Variable & | v | ) | const |
Definition at line 351 of file canonicalform.cc.
CanonicalForm CanonicalForm::lc | ( | ) | const |
CanonicalForm CanonicalForm::lc | ( | ) | const |
CanonicalForm CanonicalForm::Lc | ( | ) | const |
CanonicalForm CanonicalForm::Lc | ( | ) | const |
CanonicalForm CanonicalForm::LC | ( | ) | const |
CanonicalForm CanonicalForm::LC | ( | ) | const |
CanonicalForm CanonicalForm::LC | ( | const Variable & | v | ) | const |
CanonicalForm CanonicalForm::LC | ( | const Variable & | v | ) | const |
int CanonicalForm::level | ( | ) | const |
level() returns the level of CO.
For a list of the levels and their meanings, see cf_defs.h.
Definition at line 545 of file canonicalform.cc.
int CanonicalForm::level | ( | ) | const |
int CanonicalForm::level | ( | ) | const |
CanonicalForm CanonicalForm::mapinto | ( | ) | const |
Definition at line 208 of file canonicalform.cc.
CanonicalForm CanonicalForm::mapinto | ( | ) | const |
CanonicalForm CanonicalForm::mapinto | ( | ) | const |
CanonicalForm & CanonicalForm::mod | ( | const CanonicalForm & | cf | ) |
Definition at line 927 of file canonicalform.cc.
CanonicalForm& CanonicalForm::mod | ( | const CanonicalForm & | ) |
CanonicalForm& CanonicalForm::mod | ( | const CanonicalForm & | ) |
void CanonicalForm::mpzval | ( | mpz_t | val | ) | const |
Definition at line 51 of file canonicalform.cc.
void CanonicalForm::mpzval | ( | mpz_t | val | ) | const |
void CanonicalForm::mpzval | ( | mpz_t | val | ) | const |
Variable CanonicalForm::mvar | ( | ) | const |
mvar() returns the main variable of CO or Variable() if CO is in a base domain.
Definition at line 562 of file canonicalform.cc.
Variable CanonicalForm::mvar | ( | ) | const |
Variable CanonicalForm::mvar | ( | ) | const |
CanonicalForm CanonicalForm::num | ( | ) | const |
num() returns the numerator of CO if CO is a rational number, CO itself otherwise.
Definition at line 580 of file canonicalform.cc.
CanonicalForm CanonicalForm::num | ( | ) | const |
CanonicalForm CanonicalForm::num | ( | ) | const |
CanonicalForm & CanonicalForm::operator%= | ( | const CanonicalForm & | cf | ) |
Definition at line 885 of file canonicalform.cc.
CanonicalForm& CanonicalForm::operator%= | ( | const CanonicalForm & | ) |
CanonicalForm& CanonicalForm::operator%= | ( | const CanonicalForm & | ) |
CanonicalForm CanonicalForm::operator() | ( | const CanonicalForm & | f | ) | const |
operator ()() - evaluation operator.
Returns CO if CO is in a base domain.
operator () ( f ) returns CO with f inserted for the main variable. Elements in an algebraic extension are considered polynomials.
Definition at line 1106 of file canonicalform.cc.
CanonicalForm CanonicalForm::operator() | ( | const CanonicalForm & | f, |
const Variable & | v | ||
) | const |
Returns CO if CO is in a base domain.
operator () ( f, v ) returns CO with f inserted for v. Elements in an algebraic extension are considered polynomials and v may be an algebraic variable.
Definition at line 1158 of file canonicalform.cc.
CanonicalForm CanonicalForm::operator() | ( | const CanonicalForm & | f | ) | const |
CanonicalForm CanonicalForm::operator() | ( | const CanonicalForm & | f | ) | const |
CanonicalForm CanonicalForm::operator() | ( | const CanonicalForm & | f, |
const Variable & | v | ||
) | const |
CanonicalForm CanonicalForm::operator() | ( | const CanonicalForm & | f, |
const Variable & | v | ||
) | const |
CanonicalForm & CanonicalForm::operator*= | ( | const CanonicalForm & | cf | ) |
Definition at line 691 of file canonicalform.cc.
CanonicalForm& CanonicalForm::operator*= | ( | const CanonicalForm & | ) |
CanonicalForm& CanonicalForm::operator*= | ( | const CanonicalForm & | ) |
CanonicalForm & CanonicalForm::operator+= | ( | const CanonicalForm & | cf | ) |
assignment operators
Definition at line 607 of file canonicalform.cc.
CanonicalForm& CanonicalForm::operator+= | ( | const CanonicalForm & | ) |
CanonicalForm& CanonicalForm::operator+= | ( | const CanonicalForm & | ) |
CanonicalForm & CanonicalForm::operator-= | ( | const CanonicalForm & | cf | ) |
Definition at line 649 of file canonicalform.cc.
CanonicalForm& CanonicalForm::operator-= | ( | const CanonicalForm & | ) |
CanonicalForm& CanonicalForm::operator-= | ( | const CanonicalForm & | ) |
CanonicalForm & CanonicalForm::operator/= | ( | const CanonicalForm & | cf | ) |
Definition at line 745 of file canonicalform.cc.
CanonicalForm& CanonicalForm::operator/= | ( | const CanonicalForm & | ) |
CanonicalForm& CanonicalForm::operator/= | ( | const CanonicalForm & | ) |
CF_INLINE CanonicalForm & CanonicalForm::operator= | ( | const CanonicalForm & | cf | ) |
CF_INLINE CanonicalForm & CanonicalForm::operator = ( const CanonicalForm & cf )
operator =() - assign `cf' to CO.
CO, cf: Anything
Definition at line 272 of file cf_inline.cc.
CF_INLINE CanonicalForm & CanonicalForm::operator= | ( | const long | cf | ) |
operator =() - assign long `cf' to CO.
`cf' converted to a canonical form as described in the canonical form constructor which creates a canonical form from an integer.
CO: Anything
Strictly speaking, this operator is superfluous. The ordinary assignment operator together with automatic conversion from `int' to `CanonicalForm' would do the job, too. But this way the common operation of assigning an integer is faster.
Definition at line 303 of file cf_inline.cc.
CF_NO_INLINE CanonicalForm& CanonicalForm::operator= | ( | const CanonicalForm & | ) |
CF_NO_INLINE CanonicalForm& CanonicalForm::operator= | ( | const CanonicalForm & | ) |
CF_NO_INLINE CanonicalForm& CanonicalForm::operator= | ( | const long | ) |
CF_NO_INLINE CanonicalForm& CanonicalForm::operator= | ( | const long | ) |
CanonicalForm CanonicalForm::operator[] | ( | int | i | ) | const |
operator []() - return i'th coefficient from CO.
Returns CO if CO is in a base domain and i equals zero. Returns zero (from the current domain) if CO is in a base domain and i is larger than zero. Otherwise, returns the coefficient to x^i in CO (if x denotes the main variable of CO) or zero if CO does not contain x^i. Elements in an algebraic extension are considered polynomials. i should be larger or equal zero.
Note: Never use a loop like
which is much slower than
Definition at line 1214 of file canonicalform.cc.
CanonicalForm CanonicalForm::operator[] | ( | int | i | ) | const |
CanonicalForm CanonicalForm::operator[] | ( | int | i | ) | const |
void CanonicalForm::print | ( | OSTREAM & | os, |
char * | str | ||
) | const |
input/output
Definition at line 1776 of file canonicalform.cc.
void CanonicalForm::print | ( | OSTREAM & | os | ) | const |
Definition at line 1785 of file canonicalform.cc.
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.
Definition at line 1297 of file canonicalform.cc.
int CanonicalForm::sign | ( | ) | const |
int CanonicalForm::sign | ( | ) | const |
CanonicalForm CanonicalForm::sqrt | ( | ) | const |
CanonicalForm CanonicalForm::sqrt () const.
sqrt() - calculate integer square root.
CO has to be an integer greater or equal zero. Returns the largest integer less or equal sqrt(CO).
In the immediate case, we use the newton method to find the root. The algorithm is from H. Cohen - 'A Course in Computational Algebraic Number Theory', ch. 1.7.1.
Definition at line 1320 of file canonicalform.cc.
CanonicalForm CanonicalForm::sqrt | ( | ) | const |
CanonicalForm CanonicalForm::sqrt | ( | ) | const |
CanonicalForm CanonicalForm::tailcoeff | ( | ) | const |
tailcoeff() - return least coefficient
tailcoeff() returns the coefficient of the term with the least degree in CO where CO is considered an univariate polynomial in its main variable. Elements in an algebraic extension are considered coefficients.
Definition at line 467 of file canonicalform.cc.
CanonicalForm 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.
Note: If v is less than the main variable of CO we have to swap variables which may be quite expensive.
Definition at line 487 of file canonicalform.cc.
CanonicalForm CanonicalForm::tailcoeff | ( | ) | const |
CanonicalForm CanonicalForm::tailcoeff | ( | ) | const |
CanonicalForm CanonicalForm::tailcoeff | ( | const Variable & | v | ) | const |
CanonicalForm CanonicalForm::tailcoeff | ( | const Variable & | v | ) | const |
int CanonicalForm::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.
In contrast to tailcoeff(), elements in an algebraic extension are considered polynomials, not coefficients, and such may have a taildegree larger than zero.
Definition at line 521 of file canonicalform.cc.
int CanonicalForm::taildegree | ( | ) | const |
int CanonicalForm::taildegree | ( | ) | const |
CanonicalForm & CanonicalForm::tryDiv | ( | const CanonicalForm & | cf, |
const CanonicalForm & | M, | ||
bool & | fail | ||
) |
same as divremt but handles zero divisors in case we are in Z_p[x]/(f) where f is not irreducible
Definition at line 842 of file canonicalform.cc.
CanonicalForm& CanonicalForm::tryDiv | ( | const CanonicalForm & | , |
const CanonicalForm & | , | ||
bool & | |||
) |
CanonicalForm& CanonicalForm::tryDiv | ( | const CanonicalForm & | , |
const CanonicalForm & | , | ||
bool & | |||
) |
|
friend |
CanonicalForm bextgcd ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & a, CanonicalForm & b )
bextgcd() - return base coefficient extended gcd.
Definition at line 1665 of file canonicalform.cc.
|
friend |
CanonicalForm bextgcd ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & a, CanonicalForm & b )
bextgcd() - return base coefficient extended gcd.
Definition at line 1665 of file canonicalform.cc.
|
friend |
CanonicalForm bextgcd ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & a, CanonicalForm & b )
bextgcd() - return base coefficient extended gcd.
Definition at line 1665 of file canonicalform.cc.
|
friend |
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 1591 of file canonicalform.cc.
|
friend |
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 1591 of file canonicalform.cc.
|
friend |
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 1591 of file canonicalform.cc.
|
friend |
Definition at line 195 of file canonicalform.h.
|
friend |
Definition at line 969 of file canonicalform.cc.
|
friend |
Definition at line 969 of file canonicalform.cc.
|
friend |
Definition at line 969 of file canonicalform.cc.
|
friend |
Definition at line 1003 of file canonicalform.cc.
|
friend |
Definition at line 1003 of file canonicalform.cc.
|
friend |
Definition at line 1003 of file canonicalform.cc.
|
friend |
operator !=() returns true iff lhs does not equal rhs.
Definition at line 1435 of file canonicalform.cc.
|
friend |
operator !=() returns true iff lhs does not equal rhs.
Definition at line 1435 of file canonicalform.cc.
|
friend |
operator !=() returns true iff lhs does not equal rhs.
Definition at line 1435 of file canonicalform.cc.
|
friend |
CF_INLINE CanonicalForm operator - ( const CanonicalForm & cf )
operator -() - return additive inverse of `cf'.
Returns the additive inverse of `cf'. One should keep in mind that to negate a canonical form a complete (deep) copy of it has to be created.
cf: CurrentPP
In fact, the type is almost `Anything', but it is, e.g., not possible to invert an element from a finite field when the characteristic of the current domain has changed.
All internal methods check whether the reference counter equals one. If so CO is negated in-place. Otherwise, a new copy of CO is created and negated.
imm_neg() Trivial.
imm_neg_p() Use `ff_neg()' to negate CO.
imm_neg_gf() Use `gf_neg()' to negate CO.
InternalInteger::neg() Use `mpz_neg()' to negate the underlying mpi.
InternalRational::neg () Use `mpz_neg()' to negate the denominator.
InternalPrimePower::neg() Subtract CO from `primepow' using `mpz_sub'.
InternalPoly::neg() If reference counter is one use `negateTermList()' to negate the terms, otherwise create a negated copy using `copyTermList()'.
Definition at line 438 of file cf_inline.cc.
|
friend |
CF_INLINE CanonicalForm operator - ( const CanonicalForm & cf )
operator -() - return additive inverse of `cf'.
Returns the additive inverse of `cf'. One should keep in mind that to negate a canonical form a complete (deep) copy of it has to be created.
cf: CurrentPP
In fact, the type is almost `Anything', but it is, e.g., not possible to invert an element from a finite field when the characteristic of the current domain has changed.
All internal methods check whether the reference counter equals one. If so CO is negated in-place. Otherwise, a new copy of CO is created and negated.
imm_neg() Trivial.
imm_neg_p() Use `ff_neg()' to negate CO.
imm_neg_gf() Use `gf_neg()' to negate CO.
InternalInteger::neg() Use `mpz_neg()' to negate the underlying mpi.
InternalRational::neg () Use `mpz_neg()' to negate the denominator.
InternalPrimePower::neg() Subtract CO from `primepow' using `mpz_sub'.
InternalPoly::neg() If reference counter is one use `negateTermList()' to negate the terms, otherwise create a negated copy using `copyTermList()'.
Definition at line 438 of file cf_inline.cc.
|
friend |
CF_INLINE CanonicalForm operator - ( const CanonicalForm & cf )
operator -() - return additive inverse of `cf'.
Returns the additive inverse of `cf'. One should keep in mind that to negate a canonical form a complete (deep) copy of it has to be created.
cf: CurrentPP
In fact, the type is almost `Anything', but it is, e.g., not possible to invert an element from a finite field when the characteristic of the current domain has changed.
All internal methods check whether the reference counter equals one. If so CO is negated in-place. Otherwise, a new copy of CO is created and negated.
imm_neg() Trivial.
imm_neg_p() Use `ff_neg()' to negate CO.
imm_neg_gf() Use `gf_neg()' to negate CO.
InternalInteger::neg() Use `mpz_neg()' to negate the underlying mpi.
InternalRational::neg () Use `mpz_neg()' to negate the denominator.
InternalPrimePower::neg() Subtract CO from `primepow' using `mpz_sub'.
InternalPoly::neg() If reference counter is one use `negateTermList()' to negate the terms, otherwise create a negated copy using `copyTermList()'.
Definition at line 438 of file cf_inline.cc.
|
friend |
Definition at line 1529 of file canonicalform.cc.
|
friend |
Definition at line 1529 of file canonicalform.cc.
|
friend |
Definition at line 1529 of file canonicalform.cc.
|
friend |
Definition at line 1794 of file canonicalform.cc.
|
friend |
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 `CanonicalFormisZero()' or `CanonicalForm::isOne()', resp., than something like `f == 0', since the latter is quite a lot slower.
Definition at line 1410 of file canonicalform.cc.
|
friend |
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 `CanonicalFormisZero()' or `CanonicalForm::isOne()', resp., than something like `f == 0', since the latter is quite a lot slower.
Definition at line 1410 of file canonicalform.cc.
|
friend |
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 `CanonicalFormisZero()' or `CanonicalForm::isOne()', resp., than something like `f == 0', since the latter is quite a lot slower.
Definition at line 1410 of file canonicalform.cc.
|
friend |
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 `InternalPolyoperator <()'.
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.
Definition at line 1498 of file canonicalform.cc.
|
friend |
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 `InternalPolyoperator <()'.
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.
Definition at line 1498 of file canonicalform.cc.
|
friend |
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 `InternalPolyoperator <()'.
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.
Definition at line 1498 of file canonicalform.cc.
|
friend |
Definition at line 1801 of file canonicalform.cc.
|
friend |
same as divremt but handles zero divisors in case we are in Z_p[x]/(f) where f is not irreducible
Definition at line 1045 of file canonicalform.cc.
|
friend |
same as divremt but handles zero divisors in case we are in Z_p[x]/(f) where f is not irreducible
Definition at line 1045 of file canonicalform.cc.
|
friend |
same as divremt but handles zero divisors in case we are in Z_p[x]/(f) where f is not irreducible
Definition at line 1045 of file canonicalform.cc.
|
private |
Definition at line 81 of file canonicalform.h.