Basic Polynomial Algebra Subprograms (BPAS)  v. 1.791
Public Member Functions | List of all members
Fraction< Domain > Class Template Reference

A field of fractions templated by an arbitrary BPASGCDDomain. More...

#include <Fraction.hpp>

Simplified semantic inheritance diagram for Fraction< Domain >:
- Full inheritance diagram for Fraction< Domain >:
[legend]

Public Member Functions

 Fraction ()
 Construct the zero fraction function. More...
 
 Fraction (const Fraction< Domain > &b)
 Copy constructor. More...
 
 Fraction (Domain a, Domain b)
 constructor with two parameter More...
 
 ~Fraction ()
 Deconstructor for fraction. More...
 
void setNumerator (const Domain &b)
 
void setDenominator (const Domain &b)
 
void set (const Domain &a, const Domain &b)
 
Domain numerator () const
 Get the fraction's numerator. More...
 
Domain denominator () const
 Get the fraction's denominator. More...
 
bool operator!= (const Fraction< Domain > &b) const
 Inequality test,. More...
 
bool operator== (const Fraction< Domain > &b) const
 Equality test,. More...
 
Fraction< Domain > operator+ (const Fraction< Domain > &b) const
 Addition.
 
Fraction< Domain > & operator+= (const Fraction< Domain > &b)
 Addition assignment.
 
Fraction< Domain > operator- (const Fraction< Domain > &b) const
 Subtraction.
 
Fraction< Domain > & operator-= (const Fraction< Domain > &b)
 Subtraction assignment.
 
Fraction< Domain > operator* (const Fraction< Domain > &b) const
 Multiplication.
 
Fraction< Domain > & operator*= (const Fraction< Domain > &b)
 Multiplication assignment.
 
Fraction< Domain > operator/ (const Fraction< Domain > &b) const
 Exact division. More...
 
Fraction< Domain > & operator/= (const Fraction< Domain > &b)
 Exact division assignment. More...
 
Fraction< Domain > operator- () const
 Negation.
 
Fraction< Domain > operator^ (long long int e) const
 Overload operator ^ replace xor operation by exponentiation. More...
 
Fraction< Domain > & operator^= (long long int e)
 Overload operator ^= replace xor operation by exponentiation. More...
 
Fraction< Domain > inverse () const
 Get the inverse of *this. More...
 
bool isZero () const
 Determine if *this ring element is zero, that is the additive identity. More...
 
void zero ()
 Make *this ring element zero.
 
bool isOne () const
 Determine if *this ring element is one, that is the multiplication identity. More...
 
void one ()
 Make *this ring element one.
 
bool isNegativeOne () const
 
void negativeOne ()
 
int isConstant () const
 
Fraction< Domain > unitCanonical (Fraction< Domain > *u=NULL, Fraction< Domain > *v=NULL) const
 Obtain the unit normal (a.k.a canonical associate) of an element. More...
 
Fraction< Domain > & operator= (const Fraction< Domain > &b)
 Overload operator =. More...
 
void print (std::ostream &ostream) const
 Print the Ring element. More...
 
Fraction< Domain > quotient (const Fraction< Domain > &b) const
 Get the quotient of *this and b. More...
 
Fraction< Domain > remainder (const Fraction< Domain > &b) const
 Get the remainder of *this and b. More...
 
Fraction< Domain > operator% (const Fraction< Domain > &b) const
 Get the remainder of *this and b;. More...
 
Fraction< Domain > & operator%= (const Fraction< Domain > &b)
 Assign *this to be the remainder of *this and b. More...
 
void canonicalize ()
 Canonicalize this fraction, reducing terms as needed.
 
void differentiate ()
 
void normalize ()
 
ExpressionTree convertToExpressionTree () const
 Convert this to an expression tree. More...
 
Fraction< Domain > gcd (const Fraction< Domain > &b) const
 Get GCD of *this and other. More...
 
Factors< Fraction< Domain > > squareFree () const
 Compute squarefree factorization of *this. More...
 
Integer euclideanSize () const
 Get the euclidean size of *this.
 
Fraction< Domain > euclideanDivision (const Fraction< Domain > &b, Fraction< Domain > *q=NULL) const
 Perform the eucldiean division of *this and b. More...
 
Fraction< Domain > extendedEuclidean (const Fraction< Domain > &b, Fraction< Domain > *s=NULL, Fraction< Domain > *t=NULL) const
 Perform the extended euclidean division on *this and b. More...
 

Detailed Description

template<class Domain>
class Fraction< Domain >

A field of fractions templated by an arbitrary BPASGCDDomain.

Constructor & Destructor Documentation

◆ Fraction() [1/3]

template<class Domain>
Fraction< Domain >::Fraction ( )
inline

Construct the zero fraction function.

Parameters

◆ Fraction() [2/3]

template<class Domain>
Fraction< Domain >::Fraction ( const Fraction< Domain > &  b)
inline

Copy constructor.

Parameters
bA rational function

◆ Fraction() [3/3]

template<class Domain>
Fraction< Domain >::Fraction ( Domain  a,
Domain  b 
)
inline

constructor with two parameter

Parameters
athe numerator
bthe denominator

◆ ~Fraction()

template<class Domain>
Fraction< Domain >::~Fraction ( )
inline

Deconstructor for fraction.

Parameters

Member Function Documentation

◆ convertToExpressionTree()

template<class Domain>
ExpressionTree Fraction< Domain >::convertToExpressionTree ( ) const
inlinevirtual

Convert this to an expression tree.

returns an expression tree describing *this.

Implements ExpressionTreeConvert.

◆ denominator()

template<class Domain>
Domain Fraction< Domain >::denominator ( ) const
virtual

Get the fraction's denominator.

Returns
the denominator

Implements BPASFieldOfFractions< Domain, Fraction< Domain > >.

◆ euclideanDivision()

template<class Domain>
Fraction<Domain> Fraction< Domain >::euclideanDivision ( const Fraction< Domain > &  b,
Fraction< Domain > *  q = NULL 
) const
inlinevirtual

Perform the eucldiean division of *this and b.

Returns the remainder. If q is not NULL, then returns the quotient in q.

Parameters
bthe divisor.
[out]qa pointer to store the quotient in.
Returns
the remainder.

Implements BPASEuclideanDomain< Fraction< Domain > >.

◆ extendedEuclidean()

template<class Domain>
Fraction<Domain> Fraction< Domain >::extendedEuclidean ( const Fraction< Domain > &  b,
Fraction< Domain > *  s = NULL,
Fraction< Domain > *  t = NULL 
) const
inlinevirtual

Perform the extended euclidean division on *this and b.

Returns the GCD. If s and t are not NULL, returns the bezout coefficients in them.

Parameters
bthe divisor.
[out]sthe bezout coefficient of this.
[out]tthe bezout coefficient of b.
Returns
the remainder.

Implements BPASEuclideanDomain< Fraction< Domain > >.

◆ gcd()

template<class Domain>
Fraction<Domain> Fraction< Domain >::gcd ( const Fraction< Domain > &  other) const
inlinevirtual

Get GCD of *this and other.

Parameters
otherthe other element to get a gcd with.
Returns
the gcd.

Implements BPASGCDDomain< Fraction< Domain > >.

◆ inverse()

template<class Domain>
Fraction<Domain> Fraction< Domain >::inverse ( ) const
virtual

Get the inverse of *this.

Returns
the inverse

Implements BPASField< Fraction< Domain > >.

◆ isOne()

template<class Domain>
bool Fraction< Domain >::isOne ( ) const
virtual

Determine if *this ring element is one, that is the multiplication identity.

returns true iff *this is one.

Implements BPASRing< Fraction< Domain > >.

◆ isZero()

template<class Domain>
bool Fraction< Domain >::isZero ( ) const
virtual

Determine if *this ring element is zero, that is the additive identity.

returns true iff *this is zero.

Implements BPASRing< Fraction< Domain > >.

◆ numerator()

template<class Domain>
Domain Fraction< Domain >::numerator ( ) const
virtual

Get the fraction's numerator.

Returns
the numerator.

Implements BPASFieldOfFractions< Domain, Fraction< Domain > >.

◆ operator!=()

template<class Domain>
bool Fraction< Domain >::operator!= ( const Fraction< Domain > &  ) const
virtual

Inequality test,.

returns true iff not equal.

Implements BPASRing< Fraction< Domain > >.

◆ operator%()

template<class Domain>
Fraction<Domain> Fraction< Domain >::operator% ( const Fraction< Domain > &  b) const
virtual

Get the remainder of *this and b;.

Parameters
bthe divisor
Returns
the remainder

Implements BPASEuclideanDomain< Fraction< Domain > >.

◆ operator%=()

template<class Domain>
Fraction<Domain>& Fraction< Domain >::operator%= ( const Fraction< Domain > &  b)
virtual

Assign *this to be the remainder of *this and b.

Parameters
bthe divisor
Returns
this after assignment.

Implements BPASEuclideanDomain< Fraction< Domain > >.

◆ operator/()

template<class Domain>
Fraction<Domain> Fraction< Domain >::operator/ ( const Fraction< Domain > &  d) const
virtual

Exact division.

Parameters
dthe divisor.
Returns
the equotient.

Implements BPASIntegralDomain< Fraction< Domain > >.

◆ operator/=()

template<class Domain>
Fraction<Domain>& Fraction< Domain >::operator/= ( const Fraction< Domain > &  d)
virtual

Exact division assignment.

Parameters
dthe divisor.
Returns
a reference to this after assignment.

Implements BPASIntegralDomain< Fraction< Domain > >.

◆ operator=()

template<class Domain>
Fraction<Domain>& Fraction< Domain >::operator= ( const Fraction< Domain > &  b)
virtual

Overload operator =.

Parameters
bA rational function

Implements BPASRing< Fraction< Domain > >.

◆ operator==()

template<class Domain>
bool Fraction< Domain >::operator== ( const Fraction< Domain > &  ) const
virtual

Equality test,.

returns true iff equal

Implements BPASRing< Fraction< Domain > >.

◆ operator^()

template<class Domain>
Fraction<Domain> Fraction< Domain >::operator^ ( long long int  e) const
virtual

Overload operator ^ replace xor operation by exponentiation.

Parameters
eThe exponentiation, e > 0

Implements BPASRing< Fraction< Domain > >.

◆ operator^=()

template<class Domain>
Fraction<Domain>& Fraction< Domain >::operator^= ( long long int  e)
virtual

Overload operator ^= replace xor operation by exponentiation.

Parameters
eThe exponentiation, e > 0

Implements BPASRing< Fraction< Domain > >.

◆ print()

template<class Domain>
void Fraction< Domain >::print ( std::ostream &  ostream) const
virtual

Print the Ring element.

Derived classes may override this to get custom printing that may be more expressive (and prettier) than expression tree printing.

Reimplemented from BPASRing< Fraction< Domain > >.

◆ quotient()

template<class Domain>
Fraction<Domain> Fraction< Domain >::quotient ( const Fraction< Domain > &  b) const
virtual

Get the quotient of *this and b.

Parameters
bthe divisor
Returns
the quotient

Implements BPASEuclideanDomain< Fraction< Domain > >.

◆ remainder()

template<class Domain>
Fraction<Domain> Fraction< Domain >::remainder ( const Fraction< Domain > &  b) const
virtual

Get the remainder of *this and b.

Parameters
bthe divisor
Returns
the remainder

Implements BPASEuclideanDomain< Fraction< Domain > >.

◆ squareFree()

template<class Domain>
Factors<Fraction<Domain> > Fraction< Domain >::squareFree ( ) const
inlinevirtual

Compute squarefree factorization of *this.

Returns
the square free factorization as a Factors object.

Implements BPASGCDDomain< Fraction< Domain > >.

◆ unitCanonical()

template<class Domain>
Fraction<Domain> Fraction< Domain >::unitCanonical ( Fraction< Domain > *  u = NULL,
Fraction< Domain > *  v = NULL 
) const
virtual

Obtain the unit normal (a.k.a canonical associate) of an element.

If either parameters u, v, are non-NULL then the units are returned such that b = ua, v = u^-1. Where b is the unit normal of a, and is the returned value.

Implements BPASRing< Fraction< Domain > >.


The documentation for this class was generated from the following file: