Basic Polynomial Algebra Subprograms (BPAS)  v. 1.652
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.

Domain denominator () const
Get the fraction's denominator.

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

SmartFraction< Domain > & operator+= (const SmartFraction< Domain > &b)

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.

SmartFraction< Domain > & operator/= (const SmartFraction< Domain > &b)
Exact division assignment.

SmartFraction< Domain > operator- () const
Negation.

SmartFraction< Domain > inverse () const
Get the inverse of *this.

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.

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.

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

SmartFraction< Domain > remainder (const SmartFraction< Domain > &b) const
Get the remainder of *this and b.

SmartFraction< Domain > extendedEuclidean (const SmartFraction< Domain > &b, SmartFraction< Domain > *s=NULL, SmartFraction< Domain > *t=NULL) const
Perofrm the extended euclidean division on *this and b. More...

SmartFraction< Domain > operator% (const SmartFraction< Domain > &b) const
Get the remainder of *this and b;.

SmartFraction< Domain > & operator%= (const SmartFraction< Domain > &b)
Assign *this to be the remainder of *this and b.

## Public Attributes

mpz_class characteristic

## Detailed Description

### template<class Domain> class SmartFraction< Domain >

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

## ◆ 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
 b A 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
 a the numerator b the denominator

## ◆ convertToExpressionTree()

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

Convert this to an expression tree.

returns an expression tree describing *this.

Implements ExpressionTreeConvert.

## ◆ euclideanDivision()

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

## ◆ extendedEuclidean()

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

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

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

## ◆ unitCanonical()

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