Basic Polynomial Algebra Subprograms (BPAS)  v. 1.548
Public Member Functions | Public Attributes | 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.
 
Domain denominator () const
 Get the fraction's denominator.
 
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.
 
Fraction< Domain > & operator/= (const Fraction< Domain > &b)
 Exact division assignment.
 
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.
 
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.
 
Fraction< Domain > remainder (const Fraction< Domain > &b) const
 Get the remainder of *this and b.
 
Fraction< Domain > operator% (const Fraction< Domain > &b) const
 Get the remainder of *this and b;.
 
Fraction< Domain > & operator%= (const Fraction< Domain > &b)
 Assign *this to be the remainder of *this and b.
 
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.
 
Factors< Fraction< Domain > > squareFree () const
 Compute squarefree factorization of *this.
 
Fraction< Domain > 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
 Perofrm the extended euclidean division on *this and b. More...
 

Public Attributes

mpz_class characteristic
 

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.

◆ 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.

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

Perofrm the extended euclidean division on *this and b.

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

Implements BPASEuclideanDomain< 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 > >.

◆ 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)
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 > >.

◆ 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: