GiNaCRA  0.6.4
GiNaCRA::MultivariateMonomial< monomialOrdering > Class Template Reference

A class for a multivariate monomial providing everything what a GiNaC expression of type power or mul is and, in addition, stores the variables of the monomial (in lexicographic order). More...

#include <MultivariateMonomial.h>

Inheritance diagram for GiNaCRA::MultivariateMonomial< monomialOrdering >:
Collaboration diagram for GiNaCRA::MultivariateMonomial< monomialOrdering >:

Public Member Functions

 MultivariateMonomial ()
 MultivariateMonomial (const MultivariatePolynomial< monomialOrdering > &p)
 Constructs a multivariate monomial as copy of the leading monomial of a MultivariatePolynomial.
 MultivariateMonomial (const ex &p, const vector< symbol > &l) throw ( invalid_argument )
 Constructs a multivariate monomial from the given expression, if possible.
const MultivariateMonomial
< monomialOrdering > & 
operator= (const MultivariateMonomial< monomialOrdering > &)
const MultivariateMonomial
< monomialOrdering > & 
operator= (const ex &)
const MultivariateMonomial
< monomialOrdering > 
mul (const MultivariateMonomial< monomialOrdering > &o) const throw ( invalid_argument )
 Multiplies two multivariate monomials and returns a reference to their sum, allocated on the heap.
int tdegree () const
 The total degree of the term is the sum of degrees of each symbol.
int tdegree (const symbol &s) const
 The total degree of the polynomial w.r.t.
const MultivariateTerm
< monomialOrdering > 
mul (const MultivariateTerm< monomialOrdering > &o) const throw ( invalid_argument )
 Multiplies two multivariate terms and returns a reference to their sum, allocated on the heap.
const MultivariatePolynomial
< monomialOrdering > 
mul (const MultivariatePolynomial< monomialOrdering > &o) const throw ( invalid_argument )
 Multiplies two multivariate polynomials and returns a reference to their product, allocated on the heap.
void print (const print_context &c, unsigned level=0) const
const vector< symbol > Variables () const
 Selects the list of variables of the polynomial (ordered lexicographicly, not by degree!).
const symbol Variable () const
const list< ex > CoefficientExs () const
 Selects the list of polynomial coefficients of this polynomial in the order by the constructor.
const list< ex > MonomialExs () const
 Selects the list of monomials of this polynomial in the order by the constructor.
const bool operator== (const MultivariatePolynomial< monomialOrdering > &) const
const bool operator!= (const MultivariatePolynomial< monomialOrdering > &) const
MultivariatePolynomial
< monomialOrdering > 
diff (const symbol &s, unsigned nth=1) const
MultivariatePolynomial
< monomialOrdering > 
diff (const vector< symbol >::const_iterator i, unsigned nth=1) const
MultivariatePolynomial
< monomialOrdering > 
trunc (const symbol &s) const
 Removes the leading term w.r.t.
MultivariatePolynomial
< monomialOrdering > 
trunc () const
 Removes the leading term.
const MultivariatePolynomial
< monomialOrdering > 
divideByLcoeff () const
 Normalizes the polynomial e.g.
int degree (const symbol &s) const
int degree () const
int ldegree (const symbol &s) const
 The low-degree is the smallest exponent at the main variable occuring.
int ldegree () const
 The low-degree is the smallest exponent at the main variable occuring.
const ex lterm () const
const ex lcoeff () const
const ex lcoeff (const symbol &s) const
const ex coeff (const symbol &s, const unsigned int &n) const
const ex coeff (const ex &monomial) const throw ( invalid_argument )
const ex lmon () const
bool isZero () const
 Returns true if the univariate polynomial is the zero polynomial, otherwise false.
bool isConstant () const
 Returns true if the polynomial is constant in the given variables, otherwise false.
const MultivariatePolynomial
< monomialOrdering > 
reduction (const MultivariatePolynomial< monomialOrdering > &g, const ex &m) const throw ( invalid_argument )
 Computes the reduction of this polynomial w.r.t.
const MultivariatePolynomial
< monomialOrdering > 
normalForm (const list< MultivariatePolynomial< monomialOrdering > > &gb) const throw ( invalid_argument )
 Computes the normalform of this polynomial modulo gb.
const MultivariatePolynomial
< monomialOrdering > 
add (const MultivariatePolynomial< monomialOrdering > &o) const throw ( invalid_argument )
 Adds two multivariate polynomials and returns a reference to their sum, allocated on the heap.
const MultivariatePolynomial
< monomialOrdering > 
minus () const
 Returns the negative value, allocated on the heap.
const MultivariatePolynomial
< monomialOrdering > 
pow (const unsigned e) const throw ( invalid_argument )
 Multiplies two multivariate polynomials and returns a reference to their product, allocated on the heap.
const vector< symbol > mergeVariables (vector< symbol > l) const
 Merges this with the given symbol list into a new symbol list.

Protected Member Functions

const bool isEqual (const MultivariatePolynomial< monomialOrdering > &o) const

Detailed Description

template<class monomialOrdering>
class GiNaCRA::MultivariateMonomial< monomialOrdering >

A class for a multivariate monomial providing everything what a GiNaC expression of type power or mul is and, in addition, stores the variables of the monomial (in lexicographic order).

It holds: MultivariateCoefficient(vars) * MultivariateMonomial(vars) = MultivariateTerm(vars)

Author:
Ulrich Loup
Since:
2010-11-26
Version:
2011-05-30
See also:
ISBN 0-387-94090-1 and ISBN-13: 978-3642069642

Notation is following http://www.possibility.com/Cpp/CppCodingStandard.html.

Definition at line 42 of file MultivariateMonomial.h.


Constructor & Destructor Documentation

template<class monomialOrdering>
GiNaCRA::MultivariateMonomial< monomialOrdering >::MultivariateMonomial ( )
template<class monomialOrdering>
GiNaCRA::MultivariateMonomial< monomialOrdering >::MultivariateMonomial ( const MultivariatePolynomial< monomialOrdering > &  p)

Constructs a multivariate monomial as copy of the leading monomial of a MultivariatePolynomial.

Parameters:
pmultivariate polynomial
template<class monomialOrdering>
GiNaCRA::MultivariateMonomial< monomialOrdering >::MultivariateMonomial ( const ex &  p,
const vector< symbol > &  l 
) throw ( invalid_argument )

Constructs a multivariate monomial from the given expression, if possible.

Parameters:
pmonomial
llist of the variables of the monomial p

Member Function Documentation

template<class monomialOrdering>
const MultivariatePolynomial<monomialOrdering> GiNaCRA::MultivariatePolynomial< monomialOrdering >::add ( const MultivariatePolynomial< monomialOrdering > &  o) const throw ( invalid_argument ) [inherited]

Adds two multivariate polynomials and returns a reference to their sum, allocated on the heap.

Parameters:
o
Returns:
sum allocated on the heap
template<class monomialOrdering>
const ex GiNaCRA::MultivariatePolynomial< monomialOrdering >::coeff ( const symbol &  s,
const unsigned int &  n 
) const [inherited]
Parameters:
nthe exponent
sthe main symbol
Returns:
coefficient in front of s^n
template<class monomialOrdering>
const ex GiNaCRA::MultivariatePolynomial< monomialOrdering >::coeff ( const ex &  monomial) const throw ( invalid_argument ) [inherited]
Returns:
coefficient in front of the given monomial w.r.t. the given monomial ordering
Exceptions:
invalid_argumentin case the given monomial is not a monomial of this polynomial
template<class monomialOrdering>
const list<ex> GiNaCRA::MultivariatePolynomial< monomialOrdering >::CoefficientExs ( ) const [inherited]

Selects the list of polynomial coefficients of this polynomial in the order by the constructor.

Returns:
list of polynomial coefficients of this polynomial
template<class monomialOrdering>
int GiNaCRA::MultivariatePolynomial< monomialOrdering >::degree ( const symbol &  s) const [inherited]
Parameters:
s
Returns:
degree of the univariate polynomial in the given symbol

Referenced by GiNaCRA::MultivariatePolynomialFactory::searchMonomialsUnderTheStaircase().

template<class monomialOrdering>
int GiNaCRA::MultivariatePolynomial< monomialOrdering >::degree ( ) const [inherited]
Returns:
degree of the univariate polynomial in the main symbol
template<class monomialOrdering>
MultivariatePolynomial<monomialOrdering> GiNaCRA::MultivariatePolynomial< monomialOrdering >::diff ( const symbol &  s,
unsigned  nth = 1 
) const [inherited]
Parameters:
ssymbol
nth
Returns:
nth derivative of the univariate polynomial in the given symbol

Referenced by GiNaCRA::MultivariatePolynomialFactory::specialGroebnerBasis().

template<class monomialOrdering>
MultivariatePolynomial<monomialOrdering> GiNaCRA::MultivariatePolynomial< monomialOrdering >::diff ( const vector< symbol >::const_iterator  i,
unsigned  nth = 1 
) const [inherited]
Parameters:
iiterator pointing to the symbol (in the list of symbols of this MultivariatePolynomial)
nth
Returns:
nth derivative of the univariate polynomial in the given symbol
template<class monomialOrdering>
const MultivariatePolynomial<monomialOrdering> GiNaCRA::MultivariatePolynomial< monomialOrdering >::divideByLcoeff ( ) const [inherited]

Normalizes the polynomial e.g.

if P = c*(x^2+y^2) in D[x,y] it returns 1*(x^2+y^2).

Returns:
normalized polynomial
template<class monomialOrdering>
bool GiNaCRA::MultivariatePolynomial< monomialOrdering >::isConstant ( ) const [inherited]

Returns true if the polynomial is constant in the given variables, otherwise false.

Returns:
true if the polynomial is constant, otherwise false
template<class monomialOrdering>
const bool GiNaCRA::MultivariatePolynomial< monomialOrdering >::isEqual ( const MultivariatePolynomial< monomialOrdering > &  o) const [inline, protected, inherited]
Parameters:
o
Returns:
true in case the other multivariate polynomial equals this
template<class monomialOrdering>
bool GiNaCRA::MultivariatePolynomial< monomialOrdering >::isZero ( ) const [inherited]

Returns true if the univariate polynomial is the zero polynomial, otherwise false.

Returns:
true if the univariate polynomial is the zero polynomial, otherwise false.
template<class monomialOrdering>
const ex GiNaCRA::MultivariatePolynomial< monomialOrdering >::lcoeff ( ) const [inherited]
Returns:
coefficient in front of the monomial at the highest position in the given monomial ordering
template<class monomialOrdering>
const ex GiNaCRA::MultivariatePolynomial< monomialOrdering >::lcoeff ( const symbol &  s) const [inherited]
Parameters:
sthe variable
Returns:
the leading coefficient with respect to a variable x
template<class monomialOrdering>
int GiNaCRA::MultivariatePolynomial< monomialOrdering >::ldegree ( const symbol &  s) const [inherited]

The low-degree is the smallest exponent at the main variable occuring.

Parameters:
s
Returns:
low-degree of the univariate polynomial in the given symbol
template<class monomialOrdering>
int GiNaCRA::MultivariatePolynomial< monomialOrdering >::ldegree ( ) const [inherited]

The low-degree is the smallest exponent at the main variable occuring.

Returns:
low-degree of the univariate polynomial in the main symbol
template<class monomialOrdering>
const ex GiNaCRA::MultivariatePolynomial< monomialOrdering >::lmon ( ) const [inherited]
Returns:
monomial at the highest position according to the monomial ordering
template<class monomialOrdering>
const ex GiNaCRA::MultivariatePolynomial< monomialOrdering >::lterm ( ) const [inherited]
Returns:
lcoeff * lmon
template<class monomialOrdering>
const vector<symbol> GiNaCRA::MultivariatePolynomial< monomialOrdering >::mergeVariables ( vector< symbol >  l) const [inherited]

Merges this with the given symbol list into a new symbol list.

Returns:
new symbol list containing both this and the other symbols
template<class monomialOrdering>
const MultivariatePolynomial<monomialOrdering> GiNaCRA::MultivariatePolynomial< monomialOrdering >::minus ( ) const [inherited]

Returns the negative value, allocated on the heap.

Returns:
negative value allocated on the heap
template<class monomialOrdering>
const list<ex> GiNaCRA::MultivariatePolynomial< monomialOrdering >::MonomialExs ( ) const [inherited]

Selects the list of monomials of this polynomial in the order by the constructor.

Returns:
list of monomials of this polynomial
template<class monomialOrdering>
const MultivariateMonomial<monomialOrdering> GiNaCRA::MultivariateMonomial< monomialOrdering >::mul ( const MultivariateMonomial< monomialOrdering > &  o) const throw ( invalid_argument )

Multiplies two multivariate monomials and returns a reference to their sum, allocated on the heap.

Parameters:
o
Returns:
product allocated on the heap

Referenced by GiNaCRA::MultivariatePolynomialFactory::searchMonomialsUnderTheStaircase().

template<class monomialOrdering>
const MultivariateTerm<monomialOrdering> GiNaCRA::MultivariateTerm< monomialOrdering >::mul ( const MultivariateTerm< monomialOrdering > &  o) const throw ( invalid_argument ) [inherited]

Multiplies two multivariate terms and returns a reference to their sum, allocated on the heap.

Parameters:
o
Returns:
product allocated on the heap
template<class monomialOrdering>
const MultivariatePolynomial<monomialOrdering> GiNaCRA::MultivariatePolynomial< monomialOrdering >::mul ( const MultivariatePolynomial< monomialOrdering > &  o) const throw ( invalid_argument ) [inherited]

Multiplies two multivariate polynomials and returns a reference to their product, allocated on the heap.

Parameters:
o
Returns:
product allocated on the heap
template<class monomialOrdering>
const MultivariatePolynomial<monomialOrdering> GiNaCRA::MultivariatePolynomial< monomialOrdering >::normalForm ( const list< MultivariatePolynomial< monomialOrdering > > &  gb) const throw ( invalid_argument ) [inherited]

Computes the normalform of this polynomial modulo gb.

Parameters:
gbspecial Groebner basis of the respective ideal
Returns:
normalform of this polynomial modulo gb
See also:
Algorithm 12.2 in ISBN-13: 978-3642069642
template<class monomialOrdering>
const bool GiNaCRA::MultivariatePolynomial< monomialOrdering >::operator!= ( const MultivariatePolynomial< monomialOrdering > &  ) const [inherited]
template<class monomialOrdering>
const MultivariateMonomial<monomialOrdering>& GiNaCRA::MultivariateMonomial< monomialOrdering >::operator= ( const MultivariateMonomial< monomialOrdering > &  )
template<class monomialOrdering>
const MultivariateMonomial<monomialOrdering>& GiNaCRA::MultivariateMonomial< monomialOrdering >::operator= ( const ex &  )
template<class monomialOrdering>
const bool GiNaCRA::MultivariatePolynomial< monomialOrdering >::operator== ( const MultivariatePolynomial< monomialOrdering > &  ) const [inherited]
template<class monomialOrdering>
const MultivariatePolynomial<monomialOrdering> GiNaCRA::MultivariatePolynomial< monomialOrdering >::pow ( const unsigned  e) const throw ( invalid_argument ) [inherited]

Multiplies two multivariate polynomials and returns a reference to their product, allocated on the heap.

Parameters:
eexponent
Returns:
power of this polynomial to e
template<class monomialOrdering>
void GiNaCRA::MultivariateTerm< monomialOrdering >::print ( const print_context &  c,
unsigned  level = 0 
) const [inherited]
template<class monomialOrdering>
const MultivariatePolynomial<monomialOrdering> GiNaCRA::MultivariatePolynomial< monomialOrdering >::reduction ( const MultivariatePolynomial< monomialOrdering > &  g,
const ex &  m 
) const throw ( invalid_argument ) [inherited]

Computes the reduction of this polynomial w.r.t.

its monomial m by another polynomial q. This method performs a basic reduction step in computing normal forms modulo a given Groebner basis.

Parameters:
gbasis polynomial
mmonomial of this polynomial w.r.t. which the reduction should take place
Returns:
reduction modulo q w.r.t. m
Exceptions:
invalid_argumentin case m is not a monomial of this polynomial
See also:
Definition 4.64 in ISBN-13: 978-3642069642

Referenced by GiNaCRA::MultivariatePolynomialFactory::specialGroebnerBasis().

template<class monomialOrdering>
int GiNaCRA::MultivariateTerm< monomialOrdering >::tdegree ( ) const [inherited]

The total degree of the term is the sum of degrees of each symbol.

Returns:
total degree of the MultivariateTerm

Reimplemented from GiNaCRA::MultivariatePolynomial< monomialOrdering >.

Referenced by GiNaCRA::MultivariatePolynomialFactory::checkForSpecialGroebnerBasis().

template<class monomialOrdering>
int GiNaCRA::MultivariatePolynomial< monomialOrdering >::tdegree ( const symbol &  s) const [inherited]

The total degree of the polynomial w.r.t.

the variable s is the maximum sum of degrees of each monomial containing the variable s.

Parameters:
svariable
Returns:
total degree of the MultivariatePolynomial
See also:
page 485 in ISBN 0-387-94090-1 and ISBN-13: 978-3642069642
template<class monomialOrdering>
MultivariatePolynomial<monomialOrdering> GiNaCRA::MultivariatePolynomial< monomialOrdering >::trunc ( const symbol &  s) const [inherited]

Removes the leading term w.r.t.

one variable.

Parameters:
sthe variable
Returns:
the polynomial without leading term
template<class monomialOrdering>
MultivariatePolynomial<monomialOrdering> GiNaCRA::MultivariatePolynomial< monomialOrdering >::trunc ( ) const [inherited]

Removes the leading term.

Returns:
the polynomial without leading term
template<class monomialOrdering>
const symbol GiNaCRA::MultivariatePolynomial< monomialOrdering >::Variable ( ) const [inherited]
Returns:
the (or one of the) symbols of the polynomial with maximal degree
template<class monomialOrdering>
const vector<symbol> GiNaCRA::MultivariatePolynomial< monomialOrdering >::Variables ( ) const [inherited]

Selects the list of variables of the polynomial (ordered lexicographicly, not by degree!).

Returns:
list of symbols

Referenced by GiNaCRA::MultivariatePolynomialFactory::searchMonomialsUnderTheStaircase(), and GiNaCRA::MultivariatePolynomialFactory::synthesizeSpecialGroebnerBasisDegrees().


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