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

A simple data structure for encapsulating a collection of Factor elements. More...

#include <Factors.hpp>

Simplified semantic inheritance diagram for Factors< Ring >:
- Full inheritance diagram for Factors< Ring >:
[legend]

Public Member Functions

 Factors ()
 Default constructor. More...
 
 Factors (const Ring &r)
 Construct a Factors with a single factor. More...
 
 Factors (const std::vector< Ring > &v)
 Create a Factors from a list of Ring elements. More...
 
 Factors (const std::vector< Ring > &v, const std::vector< int > &e)
 Create a Factors from a list of Ring elements and a parallel array of integers as exponents for each ring element. More...
 
 Factors (const std::vector< Ring > &v, const std::vector< int > &e, const Ring &u)
 Create a Factors from a list of ring elements, a parallel array of integers as exponents for each ring element, and a ring element representing the invertible unit of the Ring. More...
 
 Factors (const std::vector< Factor< Ring >> &v)
 Create a Factors from a vector of Factor elements. More...
 
 Factors (const std::vector< Factor< Ring >> &v, const Ring &u)
 Create a Factors from a vector of Factor elements and an invertible Ring element. More...
 
 Factors (const Factors &f)
 Copy consturctor. More...
 
 Factors (Factors &&f)
 Move consturctor. More...
 
 ~Factors ()
 Destructor.
 
void setRingElement (const Ring &r)
 Set the invertible Ring element. More...
 
Ring ringElement () const
 Get the invertible Ring element. More...
 
void multiplyRingElement (const Ring &r)
 Multiply this Factors invertible Ring element by another Ring element. More...
 
std::vector< Factor< Ring > > factors () const
 Get the list of Factor elements. More...
 
Factor< Ring > factor (int i) const
 Get the i'th Factor. More...
 
void setFactors (const std::vector< Factor< Ring >> &v)
 Set the list of Factor elements. More...
 
void addFactor (const Factor< Ring > &f)
 A Factor to the list of Factor elements. More...
 
void addFactor (const Ring &r, int e)
 Add a Ring element and its corresponding exponent as a Factor. More...
 
void addFactor (Ring &&r, int e)
 Add a Ring element and its corresponding exponent as a Factor. More...
 
void addFactors (const Factors< Ring > f)
 Combine another Factors' list of Factor elements with this Factors. More...
 
size_t size () const
 Get the number of Factor elements in this Factors object. More...
 
Factors< Ring > & operator= (const Factors< Ring > &f)
 Copy assignment. More...
 
Factors< Ring > & operator= (Factors< Ring > &&f)
 Move assignment. More...
 
bool operator== (const Factors< Ring > &f) const
 Equality testing for Factors. More...
 
bool operator!= (const Factors< Ring > &f) const
 Inequality testing for Factors. More...
 
Factor< Ring > & operator[] (size_t idx)
 Indexing operator. More...
 
ExpressionTree convertToExpressionTree () const
 Convert the Factors object to an ExpressionTree. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const Factors< Ring > &f)
 Output operator. More...
 

Detailed Description

template<class Ring>
class Factors< Ring >

A simple data structure for encapsulating a collection of Factor elements.

Factors are encoded as a list of Factor items. That is, a pair of a Ring element and an integer representing its exponent. This list of Factor elements is augmented by an invertible element of the ring (if one such exists) as a constant multiplicative factor.

Constructor & Destructor Documentation

◆ Factors() [1/9]

template<class Ring>
Factors< Ring >::Factors ( )

Default constructor.

Constructs an empty list of factors.

◆ Factors() [2/9]

template<class Ring>
Factors< Ring >::Factors ( const Ring &  r)

Construct a Factors with a single factor.

Parameters
rthe Ring element

◆ Factors() [3/9]

template<class Ring>
Factors< Ring >::Factors ( const std::vector< Ring > &  v)

Create a Factors from a list of Ring elements.

Each factor is assumed to have an exponent of 1.

Parameters
vthe vector of Ring elements.

◆ Factors() [4/9]

template<class Ring>
Factors< Ring >::Factors ( const std::vector< Ring > &  v,
const std::vector< int > &  e 
)

Create a Factors from a list of Ring elements and a parallel array of integers as exponents for each ring element.

Parameters
vthe vector of Ring elements
ethe parallel vector of integer exponents

◆ Factors() [5/9]

template<class Ring>
Factors< Ring >::Factors ( const std::vector< Ring > &  v,
const std::vector< int > &  e,
const Ring &  u 
)

Create a Factors from a list of ring elements, a parallel array of integers as exponents for each ring element, and a ring element representing the invertible unit of the Ring.

Parameters
vthe vector of Ring elements
ethe parallel vector of integer exponents
uthe multicative factor

◆ Factors() [6/9]

template<class Ring>
Factors< Ring >::Factors ( const std::vector< Factor< Ring >> &  v)

Create a Factors from a vector of Factor elements.

Parameters
vthe vector of Factor elements.

◆ Factors() [7/9]

template<class Ring>
Factors< Ring >::Factors ( const std::vector< Factor< Ring >> &  v,
const Ring &  u 
)

Create a Factors from a vector of Factor elements and an invertible Ring element.

Parameters
vthe vector of Factor elements.
uthe invertible Ring element.

◆ Factors() [8/9]

template<class Ring>
Factors< Ring >::Factors ( const Factors< Ring > &  f)

Copy consturctor.

Parameters
fthe Factors to copy.

◆ Factors() [9/9]

template<class Ring>
Factors< Ring >::Factors ( Factors< Ring > &&  f)

Move consturctor.

Parameters
fthe Factors to move.

Member Function Documentation

◆ addFactor() [1/3]

template<class Ring>
void Factors< Ring >::addFactor ( const Factor< Ring > &  f)
inline

A Factor to the list of Factor elements.

Parameters
fthe Factor to add.

◆ addFactor() [2/3]

template<class Ring>
void Factors< Ring >::addFactor ( const Ring &  r,
int  e 
)
inline

Add a Ring element and its corresponding exponent as a Factor.

Parameters
rthe ring element.
ethe exponent

◆ addFactor() [3/3]

template<class Ring>
void Factors< Ring >::addFactor ( Ring &&  r,
int  e 
)
inline

Add a Ring element and its corresponding exponent as a Factor.

Parameters
rthe ring element.
ethe exponent

◆ addFactors()

template<class Ring>
void Factors< Ring >::addFactors ( const Factors< Ring >  f)
inline

Combine another Factors' list of Factor elements with this Factors.

This does not modify the invertible ring element.

Parameters
fthe Factors object

◆ convertToExpressionTree()

template<class Ring>
ExpressionTree Factors< Ring >::convertToExpressionTree ( ) const
inlinevirtual

Convert the Factors object to an ExpressionTree.

Returns
the ExpressionTree encoding the Factors.

Implements ExpressionTreeConvert.

◆ factor()

template<class Ring>
Factor<Ring> Factors< Ring >::factor ( int  i) const
inline

Get the i'th Factor.

Parameters
ithe index
Returns
the Factor at index i

◆ factors()

template<class Ring>
std::vector<Factor<Ring> > Factors< Ring >::factors ( ) const
inline

Get the list of Factor elements.

Returns
the vector of Factor elements.

◆ multiplyRingElement()

template<class Ring>
void Factors< Ring >::multiplyRingElement ( const Ring &  r)
inline

Multiply this Factors invertible Ring element by another Ring element.

Parameters
rthe other Ring element.

◆ operator!=()

template<class Ring>
bool Factors< Ring >::operator!= ( const Factors< Ring > &  f) const
inline

Inequality testing for Factors.

Does NOT check if, when factors are distributed, that the underlying elements are the same. Only if the factoirzation is the same.

Parameters
fthe Factors to test equality with.
Returns
false iff all factors are equal in both Factors.

◆ operator=() [1/2]

template<class Ring>
Factors<Ring>& Factors< Ring >::operator= ( const Factors< Ring > &  f)

Copy assignment.

Parameters
fthe Factors to copy from.

◆ operator=() [2/2]

template<class Ring>
Factors<Ring>& Factors< Ring >::operator= ( Factors< Ring > &&  f)

Move assignment.

Parameters
fthe Factors to move from.

◆ operator==()

template<class Ring>
bool Factors< Ring >::operator== ( const Factors< Ring > &  f) const

Equality testing for Factors.

Does NOT check if, when factors are distributed, that the underlying elements are the same. Only if the factoirzation is the same.

Parameters
fthe Factors to test equality with.
Returns
true iff all factors are equal in both Factors.

◆ operator[]()

template<class Ring>
Factor<Ring>& Factors< Ring >::operator[] ( size_t  idx)
inline

Indexing operator.

Parameters
idxthe index
Returns
the Factor at index idx.

◆ ringElement()

template<class Ring>
Ring Factors< Ring >::ringElement ( ) const
inline

Get the invertible Ring element.

Returns
the invertible Ring element of this Factors

◆ setFactors()

template<class Ring>
void Factors< Ring >::setFactors ( const std::vector< Factor< Ring >> &  v)
inline

Set the list of Factor elements.

Parameters
vthe vector of Factor elements.

◆ setRingElement()

template<class Ring>
void Factors< Ring >::setRingElement ( const Ring &  r)
inline

Set the invertible Ring element.

Parameters
rthe new invertible Ring element.

◆ size()

template<class Ring>
size_t Factors< Ring >::size ( ) const
inline

Get the number of Factor elements in this Factors object.

Returns
the number of Factor elements.

Friends And Related Function Documentation

◆ operator<<

template<class Ring>
std::ostream& operator<< ( std::ostream &  out,
const Factors< Ring > &  f 
)
friend

Output operator.

Defines a to string conversion.

Parameters
outthe output stream
fthe Factors to output

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