CEPS  24.01
Cardiac ElectroPhysiology Simulator
Polynomial< _ArgsDim > Class Template Reference

Detailed Description

template<CepsUInt _ArgsDim>
class Polynomial< _ArgsDim >

A class to represent polynomials, as a collection of Monomial and coefficients.

Definition at line 113 of file CepsPolynomial.hpp.

#include <CepsPolynomial.hpp>

Inheritance diagram for Polynomial< _ArgsDim >:
[legend]

Public Types

using ExponentType = typename Monomial< _ArgsDim >::ExponentType
 convenience typedef More...
 
using ArgType = typename Monomial< _ArgsDim >::ArgType
 convenience typedef More...
 
using GradientType = typename Monomial< _ArgsDim >::GradientType
 convenience typedef More...
 
using FunctionType = typename Monomial< _ArgsDim >::FunctionType
 convenience typedef More...
 
using MonomialType = Monomial< _ArgsDim >
 convenience typedef More...
 

Public Member Functions

 Polynomial ()
 Default constructor, empty polynomial. More...
 
 Polynomial (const Polynomial &that)
 Copy constructor. More...
 
Polynomialoperator= (const Polynomial &that)
 Assignment operator. More...
 
 ~Polynomial ()
 destructor More...
 
void add (CepsReal coeff, ExponentType exponent)
 Adds a new monomial to the polynomial. More...
 
void add (const CepsVector< CepsReal > &coeffs, const CepsVector< ExponentType > &exponents)
 Adds several new monomials to the polynomial. More...
 
void add (const Eigen::Matrix< CepsReal, 1, -1 > &coeffs, const CepsVector< ExponentType > &exponents)
 Adds several new monomials to the polynomial, Eigen format. More...
 
void setCoeff (CepsReal coeff, const ExponentType &exponent)
 Change the coefficient of a given monomial. More...
 
CepsBool contains (const MonomialType &other)
 Tells if polynomial contains the given monomial. More...
 
CepsBool contains (const ExponentType &other)
 Tells if polynomial contains the given monomial. More...
 
CepsRealcoeffAt (const ExponentType &other)
 Get the coefficient of the associated monomial. 0 if missing. More...
 
CepsReal eval (const ArgType &x) override
 Evaluate at x (x in $\mathbb{R}^N$) More...
 
GradientType gradient (const ArgType &x) const
 Evaluate gradient at x (x in $\mathbb{R}^N$) More...
 
CepsUInt getNumberOfMonomials () const
 Returns "size" of polynomial. More...
 
void reset ()
 Wipes the content. More...
 
void pruneZeroCoeffs (CepsReal epsilon=FLOATING_POINT_EPSILON)
 Removes monomial with 0 coefficient. More...
 
Polynomial operator* (const Polynomial &b)
 Returns this*b. More...
 

Protected Attributes

CepsVector< CepsRealm_coeffs
 Coefficients for all monomes. More...
 
CepsVector< MonomialTypem_mono
 The monomes. More...
 

Member Typedef Documentation

◆ ArgType

template<CepsUInt _ArgsDim>
using Polynomial< _ArgsDim >::ArgType = typename Monomial<_ArgsDim>::ArgType

convenience typedef

Definition at line 121 of file CepsPolynomial.hpp.

◆ ExponentType

template<CepsUInt _ArgsDim>
using Polynomial< _ArgsDim >::ExponentType = typename Monomial<_ArgsDim>::ExponentType

convenience typedef

Definition at line 119 of file CepsPolynomial.hpp.

◆ FunctionType

template<CepsUInt _ArgsDim>
using Polynomial< _ArgsDim >::FunctionType = typename Monomial<_ArgsDim>::FunctionType

convenience typedef

Definition at line 125 of file CepsPolynomial.hpp.

◆ GradientType

template<CepsUInt _ArgsDim>
using Polynomial< _ArgsDim >::GradientType = typename Monomial<_ArgsDim>::GradientType

convenience typedef

Definition at line 123 of file CepsPolynomial.hpp.

◆ MonomialType

template<CepsUInt _ArgsDim>
using Polynomial< _ArgsDim >::MonomialType = Monomial<_ArgsDim>

convenience typedef

Definition at line 127 of file CepsPolynomial.hpp.

Constructor & Destructor Documentation

◆ Polynomial() [1/2]

template<CepsUInt _ArgsDim>
Polynomial< _ArgsDim >::Polynomial ( )

Default constructor, empty polynomial.

◆ Polynomial() [2/2]

template<CepsUInt _ArgsDim>
Polynomial< _ArgsDim >::Polynomial ( const Polynomial< _ArgsDim > &  that)

Copy constructor.

◆ ~Polynomial()

template<CepsUInt _ArgsDim>
Polynomial< _ArgsDim >::~Polynomial ( )

destructor

Member Function Documentation

◆ add() [1/3]

template<CepsUInt _ArgsDim>
void Polynomial< _ArgsDim >::add ( CepsReal  coeff,
ExponentType  exponent 
)

Adds a new monomial to the polynomial.

◆ add() [2/3]

template<CepsUInt _ArgsDim>
void Polynomial< _ArgsDim >::add ( const CepsVector< CepsReal > &  coeffs,
const CepsVector< ExponentType > &  exponents 
)

Adds several new monomials to the polynomial.

◆ add() [3/3]

template<CepsUInt _ArgsDim>
void Polynomial< _ArgsDim >::add ( const Eigen::Matrix< CepsReal, 1, -1 > &  coeffs,
const CepsVector< ExponentType > &  exponents 
)

Adds several new monomials to the polynomial, Eigen format.

◆ coeffAt()

template<CepsUInt _ArgsDim>
CepsReal& Polynomial< _ArgsDim >::coeffAt ( const ExponentType other)

Get the coefficient of the associated monomial. 0 if missing.

◆ contains() [1/2]

template<CepsUInt _ArgsDim>
CepsBool Polynomial< _ArgsDim >::contains ( const ExponentType other)

Tells if polynomial contains the given monomial.

◆ contains() [2/2]

template<CepsUInt _ArgsDim>
CepsBool Polynomial< _ArgsDim >::contains ( const MonomialType other)

Tells if polynomial contains the given monomial.

◆ eval()

template<CepsUInt _ArgsDim>
CepsReal Polynomial< _ArgsDim >::eval ( const ArgType x)
override

Evaluate at x (x in $\mathbb{R}^N$)

◆ getNumberOfMonomials()

template<CepsUInt _ArgsDim>
CepsUInt Polynomial< _ArgsDim >::getNumberOfMonomials ( ) const

Returns "size" of polynomial.

◆ gradient()

template<CepsUInt _ArgsDim>
GradientType Polynomial< _ArgsDim >::gradient ( const ArgType x) const

Evaluate gradient at x (x in $\mathbb{R}^N$)

◆ operator*()

template<CepsUInt _ArgsDim>
Polynomial Polynomial< _ArgsDim >::operator* ( const Polynomial< _ArgsDim > &  b)

Returns this*b.

◆ operator=()

template<CepsUInt _ArgsDim>
Polynomial& Polynomial< _ArgsDim >::operator= ( const Polynomial< _ArgsDim > &  that)

Assignment operator.

◆ pruneZeroCoeffs()

template<CepsUInt _ArgsDim>
void Polynomial< _ArgsDim >::pruneZeroCoeffs ( CepsReal  epsilon = FLOATING_POINT_EPSILON)

Removes monomial with 0 coefficient.

◆ reset()

template<CepsUInt _ArgsDim>
void Polynomial< _ArgsDim >::reset ( )

Wipes the content.

◆ setCoeff()

template<CepsUInt _ArgsDim>
void Polynomial< _ArgsDim >::setCoeff ( CepsReal  coeff,
const ExponentType exponent 
)

Change the coefficient of a given monomial.

Field Documentation

◆ m_coeffs

template<CepsUInt _ArgsDim>
CepsVector<CepsReal> Polynomial< _ArgsDim >::m_coeffs
protected

Coefficients for all monomes.

Definition at line 196 of file CepsPolynomial.hpp.

◆ m_mono

template<CepsUInt _ArgsDim>
CepsVector<MonomialType> Polynomial< _ArgsDim >::m_mono
protected

The monomes.

Definition at line 198 of file CepsPolynomial.hpp.


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