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

A field of fractions templated by an arbitrary BPASGCDDomain making use of factor refinement. More...

#include <SmartFraction.hpp>

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

Public Member Functions

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

Detailed Description

template<class Domain>
class SmartFraction< Domain >

A field of fractions templated by an arbitrary BPASGCDDomain making use of factor refinement.

Constructor & Destructor Documentation

◆ SmartFraction() [1/3]

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

Construct the zero fraction function.

Parameters

◆ SmartFraction() [2/3]

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

Copy constructor.

Parameters
bA rational function

◆ SmartFraction() [3/3]

template<class Domain>
SmartFraction< Domain >::SmartFraction ( std::vector< Factor< Domain >>  a,
std::vector< Factor< Domain >>  b 
)
inline

constructor with two parameter

Parameters
athe numerator
bthe denominator

Member Function Documentation

◆ convertToExpressionTree()

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

Convert this to an expression tree.

returns an expression tree describing *this.

Implements ExpressionTreeConvert.

◆ denominator()

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

Get the fraction's denominator.

Returns
the denominator

Implements BPASFieldOfFractions< Domain, SmartFraction< Domain > >.

◆ euclideanDivision()

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

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< SmartFraction< Domain > >.

◆ extendedEuclidean()

template<class Domain>
SmartFraction<Domain> SmartFraction< Domain >::extendedEuclidean ( const SmartFraction< Domain > &  b,
SmartFraction< Domain > *  s = NULL,
SmartFraction< 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< SmartFraction< Domain > >.

◆ gcd()

template<class Domain>
SmartFraction<Domain> SmartFraction< Domain >::gcd ( const SmartFraction< Domain > &  other) const
virtual

Get GCD of *this and other.

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

Implements BPASGCDDomain< SmartFraction< Domain > >.

◆ inverse()

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

Get the inverse of *this.

Returns
the inverse

Implements BPASField< SmartFraction< Domain > >.

◆ isOne()

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

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

returns true iff *this is one.

Implements BPASRing< SmartFraction< Domain > >.

◆ isZero()

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

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

returns true iff *this is zero.

Implements BPASRing< SmartFraction< Domain > >.

◆ numerator()

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

Get the fraction's numerator.

Returns
the numerator.

Implements BPASFieldOfFractions< Domain, SmartFraction< Domain > >.

◆ operator!=()

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

Inequality test,.

returns true iff not equal.

Implements BPASRing< SmartFraction< Domain > >.

◆ operator%()

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

Get the remainder of *this and b;.

Parameters
bthe divisor
Returns
the remainder

Implements BPASEuclideanDomain< SmartFraction< Domain > >.

◆ operator%=()

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

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

Parameters
bthe divisor
Returns
this after assignment.

Implements BPASEuclideanDomain< SmartFraction< Domain > >.

◆ operator/()

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

Exact division.

Parameters
dthe divisor.
Returns
the equotient.

Implements BPASIntegralDomain< SmartFraction< Domain > >.

◆ operator/=()

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

Exact division assignment.

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

Implements BPASIntegralDomain< SmartFraction< Domain > >.

◆ operator==()

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

Equality test,.

returns true iff equal

Implements BPASRing< SmartFraction< Domain > >.

◆ print()

template<class Domain>
void SmartFraction< 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< SmartFraction< Domain > >.

◆ quotient()

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

Get the quotient of *this and b.

Parameters
bthe divisor
Returns
the quotient

Implements BPASEuclideanDomain< SmartFraction< Domain > >.

◆ remainder()

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

Get the remainder of *this and b.

Parameters
bthe divisor
Returns
the remainder

Implements BPASEuclideanDomain< SmartFraction< Domain > >.

◆ squareFree()

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

Compute squarefree factorization of *this.

Returns
the square free factorization as a Factors object.

Implements BPASGCDDomain< SmartFraction< Domain > >.

◆ unitCanonical()

template<class Domain>
SmartFraction<Domain> SmartFraction< Domain >::unitCanonical ( SmartFraction< Domain > *  u = NULL,
SmartFraction< 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< SmartFraction< Domain > >.


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