All Classes Functions Friends
Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
SparseMultivariatePolynomial< Ring > Class Template Reference

#include <mpolynomial.h>

The concrete class SparseMultivariatePolynomial< Ring > inherits from BPASMultivariatePolynomial and implements a multivariate polynomial ring over an arbitrary BPAS ring with a sparse representation. In other words, this is a template class, while the coefficient ring satisfies the specifications of a BPASRing. It overrides all the public member functions of BPASRing, BPASPolynomial and BPASMultivariatePolynomial. One can construct a SparseMultivariatePolynomial< Ring > object as the zero polynomial with or without specifying the number of variables. One can also construct a SparseMultivariatePolynomial< Ring > object from a variable (thus a monomial equal to that variable) or from another SparseMultivariatePolynomial< Ring > object.
Inheritance diagram for SparseMultivariatePolynomial< Ring >:
BPASMultivariatePolynomial BPASPolynomial BPASRing

Public Member Functions

 SparseMultivariatePolynomial ()
 
 SparseMultivariatePolynomial (int v)
 
 SparseMultivariatePolynomial (std::string x)
 
 SparseMultivariatePolynomial (const SparseMultivariatePolynomial< Ring > &b)
 
 SparseMultivariatePolynomial (SparseUnivariatePolynomial< SparseMultivariatePolynomial< Ring > > &s)
 
 ~SparseMultivariatePolynomial ()
 
int numberOfVariables ()
 
int numberOfTerms ()
 
int degree (std::string x)
 
std::string leadingVariable ()
 
int leadingVariableDegree ()
 
Ring leadingCoefficient ()
 
SparseMultivariatePolynomial
< Ring > 
leadingCoefficientInVariable (std::string x, int *e=NULL)
 
bool isZero ()
 
void zero ()
 
bool isOne ()
 
void one ()
 
bool isNegativeOne ()
 
void negativeOne ()
 
int isConstant ()
 
SparseMultivariatePolynomial
< Ring > & 
operator= (SparseMultivariatePolynomial< Ring > b)
 
bool operator== (SparseMultivariatePolynomial< Ring > &b)
 
bool operator!= (SparseMultivariatePolynomial< Ring > &b)
 
SparseMultivariatePolynomial
< Ring > 
operator^ (int e)
 
SparseMultivariatePolynomial
< Ring > & 
operator^= (int e)
 
SparseMultivariatePolynomial
< Ring > 
operator+ (SparseMultivariatePolynomial< Ring > b)
 
SparseMultivariatePolynomial
< Ring > & 
operator+= (SparseMultivariatePolynomial< Ring > b)
 
SparseMultivariatePolynomial
< Ring > 
operator+ (Ring c)
 
SparseMultivariatePolynomial
< Ring > & 
operator+= (Ring c)
 
SparseMultivariatePolynomial
< Ring > 
operator- (SparseMultivariatePolynomial< Ring > b)
 
SparseMultivariatePolynomial
< Ring > & 
operator-= (SparseMultivariatePolynomial< Ring > b)
 
SparseMultivariatePolynomial
< Ring > 
operator- (Ring c)
 
SparseMultivariatePolynomial
< Ring > & 
operator-= (Ring c)
 
SparseMultivariatePolynomial
< Ring > 
operator- ()
 
SparseMultivariatePolynomial
< Ring > 
operator* (SparseMultivariatePolynomial< Ring > b)
 
SparseMultivariatePolynomial
< Ring > & 
operator*= (SparseMultivariatePolynomial< Ring > b)
 
SparseMultivariatePolynomial
< Ring > 
operator* (Ring e)
 
SparseMultivariatePolynomial
< Ring > 
operator* (sfixn e)
 
SparseMultivariatePolynomial
< Ring > & 
operator*= (Ring e)
 
SparseMultivariatePolynomial
< Ring > & 
operator*= (sfixn e)
 
SparseMultivariatePolynomial
< Ring > 
operator/ (SparseMultivariatePolynomial< Ring > b)
 
SparseMultivariatePolynomial
< Ring > & 
operator/= (SparseMultivariatePolynomial< Ring > b)
 
SparseMultivariatePolynomial
< Ring > 
operator/ (Ring e)
 
SparseMultivariatePolynomial
< Ring > & 
operator/= (Ring e)
 
void setVariableNames (std::vector< std::string > xs)
 
std::vector< std::string > variables ()
 
Ring coefficient (int v, int *d)
 
void setCoefficient (int v, int *d, Ring val)
 
void negate ()
 
SparseUnivariatePolynomial
< SparseMultivariatePolynomial
< Ring > > 
convertToSUP (std::string x)
 
- Public Member Functions inherited from BPASMultivariatePolynomial
DataType leadingCoefficient ()
 
DataType coefficient (int, int *)
 
void setCoefficient (int, int *, DataType)
 
- Public Member Functions inherited from BPASPolynomial
BPASPolynomialoperator= (BPASPolynomial &)
 
BPASPolynomialoperator+ (BPASPolynomial &)
 
BPASPolynomialoperator+= (BPASPolynomial &)
 
BPASPolynomialoperator- (BPASPolynomial &)
 
BPASPolynomialoperator- ()
 
BPASPolynomialoperator-= (BPASPolynomial &)
 
BPASPolynomialoperator* (BPASPolynomial &)
 
BPASPolynomialoperator*= (BPASPolynomial &)
 
BPASPolynomialoperator/ (BPASPolynomial &)
 
BPASPolynomialoperator/= (BPASPolynomial &)
 
BPASPolynomialoperator^ (int)
 
bool operator== (BPASPolynomial &)
 
bool operator!= (BPASPolynomial &)
 

Public Attributes

int characteristic
 

Static Public Attributes

static bool isPrimeField
 
static bool isComplexField
 
- Static Public Attributes inherited from BPASRing
static int characteristic
 
static bool isPrimeField
 
static bool isComplexField
 

Friends

SparseMultivariatePolynomial
< Ring > 
operator+ (Ring c, SparseMultivariatePolynomial< Ring > p)
 
SparseMultivariatePolynomial
< Ring > 
operator- (Ring c, SparseMultivariatePolynomial< Ring > p)
 
SparseMultivariatePolynomial
< Ring > 
operator* (Ring c, SparseMultivariatePolynomial< Ring > p)
 
SparseMultivariatePolynomial
< Ring > 
operator* (sfixn c, SparseMultivariatePolynomial< Ring > p)
 
SparseMultivariatePolynomial
< Ring > 
operator/ (Ring c, SparseMultivariatePolynomial< Ring > p)
 
std::ostream & operator<< (std::ostream &out, SparseMultivariatePolynomial< Ring > b)
 

Detailed Description

template<class Ring>
class SparseMultivariatePolynomial< Ring >

Data Structure for multivariate polynomial stored in a sparse case

Constructor & Destructor Documentation

template<class Ring>
SparseMultivariatePolynomial< Ring >::SparseMultivariatePolynomial ( )
inline

Construct a multivariate polynomial

Parameters
template<class Ring>
SparseMultivariatePolynomial< Ring >::SparseMultivariatePolynomial ( int  v)
inline

Construct a multivariate polynomial with number of terms and variates

Parameters
v,:Number of variables
template<class Ring>
SparseMultivariatePolynomial< Ring >::SparseMultivariatePolynomial ( std::string  x)
inline

Construct with a variable name such that f(x) = x

Parameters
x,:The variable name
template<class Ring>
SparseMultivariatePolynomial< Ring >::SparseMultivariatePolynomial ( const SparseMultivariatePolynomial< Ring > &  b)
inline

Copy Constructor

Parameters
b,:A sparse multivariate polynomial

Construct from a SUP<SMQP> polynomial

Parameters
s,:The SUP<SMQP> polynomial
template<class Ring>
SparseMultivariatePolynomial< Ring >::~SparseMultivariatePolynomial ( )
inline

Destroy the polynomial

Parameters

Member Function Documentation

template<class Ring>
Ring SparseMultivariatePolynomial< Ring >::coefficient ( int  v,
int *  d 
)
inline

Get the coefficient of one term

Parameters
d,:The exponet of each variable
v,:Number of variables
template<class Ring>
SparseUnivariatePolynomial< SparseMultivariatePolynomial<Ring> > SparseMultivariatePolynomial< Ring >::convertToSUP ( std::string  x)
inline

Convert to SUP<SMQP>

Parameters
x,:The variable name
template<class Ring>
int SparseMultivariatePolynomial< Ring >::degree ( std::string  x)
inlinevirtual

Get the degree of a variable

Parameters
x,:The variable name

Implements BPASMultivariatePolynomial.

template<class Ring>
int SparseMultivariatePolynomial< Ring >::isConstant ( )
inlinevirtual

Is a constant

Parameters

Implements BPASRing.

template<class Ring>
bool SparseMultivariatePolynomial< Ring >::isNegativeOne ( )
inlinevirtual

Is polynomial a constant -1

Parameters

Implements BPASRing.

template<class Ring>
bool SparseMultivariatePolynomial< Ring >::isOne ( )
inlinevirtual

Is polynomial a constant 1

Parameters

Implements BPASRing.

template<class Ring>
bool SparseMultivariatePolynomial< Ring >::isZero ( )
inlinevirtual

Is zero polynomial

Parameters

Implements BPASRing.

template<class Ring>
Ring SparseMultivariatePolynomial< Ring >::leadingCoefficient ( )
inline

Get the leading coefficient

Parameters
template<class Ring>
SparseMultivariatePolynomial<Ring> SparseMultivariatePolynomial< Ring >::leadingCoefficientInVariable ( std::string  x,
int *  e = NULL 
)
inline

Get the leading coefficient over a variable

Parameters
x,:The name of the variable
e,:The leading exponent of the variable
template<class Ring>
std::string SparseMultivariatePolynomial< Ring >::leadingVariable ( )
inline

Get the leading variable

Parameters
template<class Ring>
int SparseMultivariatePolynomial< Ring >::leadingVariableDegree ( )
inline

Get the leading term's leading variable's degree

Parameters
template<class Ring>
void SparseMultivariatePolynomial< Ring >::negate ( )
inline

Negate all the coefficients

Parameters
template<class Ring>
void SparseMultivariatePolynomial< Ring >::negativeOne ( )
inlinevirtual

Set polynomial to -1

Parameters

Implements BPASRing.

template<class Ring>
int SparseMultivariatePolynomial< Ring >::numberOfTerms ( )
inlinevirtual

Get number of non-zero terms

Parameters

Implements BPASMultivariatePolynomial.

template<class Ring>
int SparseMultivariatePolynomial< Ring >::numberOfVariables ( )
inlinevirtual

Get number of variables

Parameters

Implements BPASMultivariatePolynomial.

template<class Ring>
void SparseMultivariatePolynomial< Ring >::one ( )
inlinevirtual

Set polynomial to 1

Parameters

Implements BPASRing.

template<class Ring>
bool SparseMultivariatePolynomial< Ring >::operator!= ( SparseMultivariatePolynomial< Ring > &  b)
inline

Overload operator !=

Parameters
b,:A multivariate rational polynomial
template<class Ring>
SparseMultivariatePolynomial<Ring> SparseMultivariatePolynomial< Ring >::operator* ( SparseMultivariatePolynomial< Ring >  b)
inline

Overload operator *

Parameters
b,:A multivariate rational polynomial
template<class Ring>
SparseMultivariatePolynomial<Ring> SparseMultivariatePolynomial< Ring >::operator* ( Ring  e)
inline

Overload operator *

Parameters
e,:A constant
template<class Ring>
SparseMultivariatePolynomial<Ring>& SparseMultivariatePolynomial< Ring >::operator*= ( SparseMultivariatePolynomial< Ring >  b)
inline

Overload operator *=

Parameters
b,:A multivariate rational polynomial
template<class Ring>
SparseMultivariatePolynomial<Ring>& SparseMultivariatePolynomial< Ring >::operator*= ( Ring  e)
inline

Overload operator *=

Parameters
e,:A constant
template<class Ring>
SparseMultivariatePolynomial<Ring>& SparseMultivariatePolynomial< Ring >::operator*= ( sfixn  e)
inline

Overload operator *=

Parameters
e,:A machine-word constant
template<class Ring>
SparseMultivariatePolynomial<Ring> SparseMultivariatePolynomial< Ring >::operator+ ( SparseMultivariatePolynomial< Ring >  b)
inline

Overload operator +

Parameters
b,:A multivariate rational polynomial
template<class Ring>
SparseMultivariatePolynomial<Ring> SparseMultivariatePolynomial< Ring >::operator+ ( Ring  c)
inline

Overload operator +

Parameters
c,:A constant
template<class Ring>
SparseMultivariatePolynomial<Ring>& SparseMultivariatePolynomial< Ring >::operator+= ( SparseMultivariatePolynomial< Ring >  b)
inline

Overload operator +=

Parameters
b,:A multivariate rational polynomial
template<class Ring>
SparseMultivariatePolynomial<Ring>& SparseMultivariatePolynomial< Ring >::operator+= ( Ring  c)
inline

Overload operator +=

Parameters
c,:A constant
template<class Ring>
SparseMultivariatePolynomial<Ring> SparseMultivariatePolynomial< Ring >::operator- ( SparseMultivariatePolynomial< Ring >  b)
inline

Overload operator -

Parameters
b,:A multivariate rational polynomial
template<class Ring>
SparseMultivariatePolynomial<Ring> SparseMultivariatePolynomial< Ring >::operator- ( Ring  c)
inline

Overload operator -

Parameters
c,:A constant
template<class Ring>
SparseMultivariatePolynomial<Ring> SparseMultivariatePolynomial< Ring >::operator- ( )
inline

Overload operator - (negate)

Parameters
template<class Ring>
SparseMultivariatePolynomial<Ring>& SparseMultivariatePolynomial< Ring >::operator-= ( SparseMultivariatePolynomial< Ring >  b)
inline

Overload operator -=

Parameters
b,:A multivariate rational polynomial
template<class Ring>
SparseMultivariatePolynomial<Ring>& SparseMultivariatePolynomial< Ring >::operator-= ( Ring  c)
inline

Overload operator -=

Parameters
c,:A constant
template<class Ring>
SparseMultivariatePolynomial<Ring> SparseMultivariatePolynomial< Ring >::operator/ ( SparseMultivariatePolynomial< Ring >  b)
inline

Overload operator /

Parameters
b,:A multivariate polynomial
template<class Ring>
SparseMultivariatePolynomial<Ring> SparseMultivariatePolynomial< Ring >::operator/ ( Ring  e)
inline

Overload operator /

Parameters
e,:A constant
template<class Ring>
SparseMultivariatePolynomial<Ring>& SparseMultivariatePolynomial< Ring >::operator/= ( SparseMultivariatePolynomial< Ring >  b)
inline

Overload operator /=

Parameters
b,:A multivariate polynomial
template<class Ring>
SparseMultivariatePolynomial<Ring>& SparseMultivariatePolynomial< Ring >::operator/= ( Ring  e)
inline

Overload operator /=

Parameters
e,:A constant
template<class Ring>
SparseMultivariatePolynomial<Ring>& SparseMultivariatePolynomial< Ring >::operator= ( SparseMultivariatePolynomial< Ring >  b)
inline

Overload operator =

Parameters
b,:A sparse multivariate polynomial
template<class Ring>
bool SparseMultivariatePolynomial< Ring >::operator== ( SparseMultivariatePolynomial< Ring > &  b)
inline

Overload operator ==

Parameters
b,:A multivariate rational polynomial
template<class Ring>
SparseMultivariatePolynomial<Ring> SparseMultivariatePolynomial< Ring >::operator^ ( int  e)
inline

Overload operator ^ replace xor operation by exponentiation

Parameters
e,:The exponentiation, e > 0
template<class Ring>
SparseMultivariatePolynomial<Ring>& SparseMultivariatePolynomial< Ring >::operator^= ( int  e)
inline

Overload operator ^= replace xor operation by exponentiation

Parameters
e,:The exponentiation, e > 0
template<class Ring>
void SparseMultivariatePolynomial< Ring >::setCoefficient ( int  v,
int *  d,
Ring  val 
)
inline

Set the coefficients of one term

Parameters
v,:Number of variables
d,:Its exponent of each variable
val,:Coefficient
template<class Ring>
void SparseMultivariatePolynomial< Ring >::setVariableNames ( std::vector< std::string >  xs)
inlinevirtual

Set variable names

Parameters
xs,:Variable names

Implements BPASMultivariatePolynomial.

template<class Ring>
std::vector<std::string> SparseMultivariatePolynomial< Ring >::variables ( )
inlinevirtual

Get variable names

Parameters

Implements BPASMultivariatePolynomial.

template<class Ring>
void SparseMultivariatePolynomial< Ring >::zero ( )
inlinevirtual

Zero polynomial

Parameters

Implements BPASRing.

Friends And Related Function Documentation

template<class Ring>
std::ostream& operator<< ( std::ostream &  out,
SparseMultivariatePolynomial< Ring >  b 
)
friend

Overload stream operator <<

Parameters
out,:Stream object
b,:A multivariate rational polynoial

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