cisst-saw
Loading...
Searching...
No Matches
nmrPolynomialContainer< _TermInfo > Class Template Referenceabstract

#include <nmrPolynomialContainer.h>

Inheritance diagram for nmrPolynomialContainer< _TermInfo >:
nmrPolynomialBase

Classes

class  EqualityTester
class  LessOrEqualityTester

Public Types

typedef nmrPolynomialBase BaseType
typedef _TermInfo TermInfoType
typedef std::pair< nmrPolynomialTermPowerIndex, TermInfoTypeContainerElementType
typedef std::list< ContainerElementTypeTermContainerType
typedef TermContainerType::value_type TermType
typedef TermContainerType::iterator TermIteratorType
typedef TermContainerType::const_iterator TermConstIteratorType
Public Types inherited from nmrPolynomialBase
enum  InsertStatus { INSERT_FAIL = -1 , INSERT_NEW = 0 , INSERT_REPLACE = 1 }
typedef double ValueType
typedef double VariableType
typedef double CoefficientType
typedef nmrPolynomialTermPowerIndex::VariableIndexType VariableIndexType
typedef nmrPolynomialTermPowerIndex::PowerType PowerType
typedef nmrPolynomialTermPowerIndex::MultinomialCoefficientType TermCounterType

Public Member Functions

 nmrPolynomialContainer (VariableIndexType numVariables, PowerType minDegree, PowerType maxDegree)
virtual ~nmrPolynomialContainer ()
virtual TermCounterType GetNumberOfTerms () const
virtual bool IsEmpty () const
virtual void SetMinDegree (PowerType newMin) CISST_THROW(std
virtual void SetMaxDegree (PowerType newMax) CISST_THROW(std
virtual void FillAllTerms ()
virtual bool IncludesIndex (const nmrPolynomialTermPowerIndex &target) const
virtual TermCounterType GetIndexPosition (const nmrPolynomialTermPowerIndex &term) const
TermIteratorType GetTermIteratorForPosition (TermCounterType position)
TermIteratorType FirstTermIterator ()
TermConstIteratorType FirstTermIterator () const
TermIteratorType EndTermIterator ()
TermConstIteratorType EndTermIterator () const
TermIteratorType FindTerm (const nmrPolynomialTermPowerIndex &target)
TermConstIteratorType FindTerm (const nmrPolynomialTermPowerIndex &target) const
virtual void RemoveTerm (const nmrPolynomialTermPowerIndex &where)
virtual void RemoveTerm (TermIteratorType &where)
virtual void Clear ()
virtual InsertStatus SetCoefficient (const nmrPolynomialTermPowerIndex &where, CoefficientType coefficient)=0
virtual InsertStatus SetCoefficient (TermIteratorType &where, CoefficientType coefficient)=0
virtual CoefficientType GetCoefficient (const TermConstIteratorType &where) const =0
virtual CoefficientType GetCoefficient (const TermIteratorType &where) const =0
virtual void CollectCoefficients (CoefficientType target[]) const
virtual void RestoreCoefficients (const CoefficientType source[])
const nmrPolynomialTermPowerIndexGetTermPowerIndex (const TermConstIteratorType &where) const
const nmrPolynomialTermPowerIndexGetTermPowerIndex (const TermIteratorType &where) const
virtual ValueType EvaluateBasis (const TermConstIteratorType &where, const nmrMultiVariablePowerBasis &variables) const =0
virtual ValueType EvaluateBasis (const TermIteratorType &where, const nmrMultiVariablePowerBasis &variables) const =0
ValueType EvaluateTerm (const TermConstIteratorType &where) const
ValueType EvaluateTerm (const TermIteratorType &where) const
ValueType EvaluateTerm (const TermConstIteratorType &where, const nmrMultiVariablePowerBasis &variables) const
ValueType EvaluateTerm (const TermIteratorType &where, const nmrMultiVariablePowerBasis &variables) const
virtual ValueType Evaluate (const nmrMultiVariablePowerBasis &variables) const
virtual void EvaluateBasisVector (const nmrMultiVariablePowerBasis &variables, ValueType termBaseValues[]) const
virtual ValueType EvaluateForCoefficients (const nmrMultiVariablePowerBasis &variables, const CoefficientType coefficients[]) const
virtual void Scale (CoefficientType scaleFactor)
virtual void AddConstant (CoefficientType shiftAmount)=0
virtual void AddConstantToCoefficients (CoefficientType coefficients[], CoefficientType shiftAmount) const =0
virtual void SerializeTermInfo (std::ostream &output, const TermConstIteratorType &termIterator) const =0
virtual void DeserializeTermInfo (std::istream &input, TermIteratorType &termIterator)=0
virtual void SerializeRaw (std::ostream &output) const
virtual void DeserializeRaw (std::istream &input)
Public Member Functions inherited from nmrPolynomialBase
 nmrPolynomialBase (VariableIndexType numVariables, PowerType minDegree, PowerType maxDegree)
virtual ~nmrPolynomialBase ()
VariableIndexType GetNumVariables () const
PowerType GetMinDegree () const
PowerType GetMaxDegree () const
TermCounterType GetMaxNumberOfTerms () const
bool CanIncludeIndex (const nmrPolynomialTermPowerIndex &term) const
virtual CoefficientType GetCoefficient (const nmrPolynomialTermPowerIndex &CMN_UNUSED(where)) const
virtual ValueType EvaluateBasis (const nmrPolynomialTermPowerIndex &where, const nmrMultiVariablePowerBasis &variables) const =0
void CISST_DEPRECATED ScaleCoefficients (CoefficientType coefficients[], CoefficientType scaleFactor) const

Protected Member Functions

const TermInfoTypeGetTermInfo (const TermConstIteratorType &termIterator) const
TermInfoTypeGetTermInfo (const TermConstIteratorType &termIterator)

Protected Attributes

TermContainerType Terms
Protected Attributes inherited from nmrPolynomialBase
VariableIndexType NumVariables
PowerType MinDegree
PowerType MaxDegree

Member Typedef Documentation

◆ BaseType

template<class _TermInfo>
typedef nmrPolynomialBase nmrPolynomialContainer< _TermInfo >::BaseType

◆ ContainerElementType

template<class _TermInfo>
typedef std::pair<nmrPolynomialTermPowerIndex, TermInfoType> nmrPolynomialContainer< _TermInfo >::ContainerElementType

◆ TermConstIteratorType

template<class _TermInfo>
typedef TermContainerType::const_iterator nmrPolynomialContainer< _TermInfo >::TermConstIteratorType

◆ TermContainerType

template<class _TermInfo>
typedef std::list<ContainerElementType> nmrPolynomialContainer< _TermInfo >::TermContainerType

◆ TermInfoType

template<class _TermInfo>
typedef _TermInfo nmrPolynomialContainer< _TermInfo >::TermInfoType

◆ TermIteratorType

template<class _TermInfo>
typedef TermContainerType::iterator nmrPolynomialContainer< _TermInfo >::TermIteratorType

◆ TermType

template<class _TermInfo>
typedef TermContainerType::value_type nmrPolynomialContainer< _TermInfo >::TermType

Constructor & Destructor Documentation

◆ nmrPolynomialContainer()

template<class _TermInfo>
nmrPolynomialContainer< _TermInfo >::nmrPolynomialContainer ( VariableIndexType numVariables,
PowerType minDegree,
PowerType maxDegree )
inline

◆ ~nmrPolynomialContainer()

template<class _TermInfo>
virtual nmrPolynomialContainer< _TermInfo >::~nmrPolynomialContainer ( )
inlinevirtual

Member Function Documentation

◆ AddConstant()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::AddConstant ( CoefficientType shiftAmount)
pure virtual

Overloaded from nmrPolynomialBase and declared abstract as the implementation varies in subtypes. See subtype implementations

Implements nmrPolynomialBase.

Implemented in nmrStandardPolynomial.

◆ AddConstantToCoefficients()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::AddConstantToCoefficients ( CoefficientType coefficients[],
CoefficientType shiftAmount ) const
pure virtual

Overloaded from nmrPolynomialBase. See subtype implementations

Implements nmrPolynomialBase.

Implemented in nmrStandardPolynomial.

◆ Clear()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::Clear ( )
inlinevirtual

Implements nmrPolynomialBase.

Reimplemented in nmrStandardPolynomial.

◆ CollectCoefficients()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::CollectCoefficients ( CoefficientType target[]) const
inlinevirtual

Implements nmrPolynomialBase.

◆ DeserializeRaw()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::DeserializeRaw ( std::istream & input)
inlinevirtual

nmrPolynomialBase::DeserializeRaw() plus deserialize all the terms. For each term we use nmrPolynomialTermPowerIndex::DeserializeIndexRaw() and then call the abstract DeserializeTermInfo() to complete the rest of the term information.

Reimplemented from nmrPolynomialBase.

◆ DeserializeTermInfo()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::DeserializeTermInfo ( std::istream & input,
TermIteratorType & termIterator )
pure virtual

Deserialize and do other necessary initializations for the TermInfoMember associated with the power index of a term. This function should be complementart to SerializeTermInfo.

Parameters
inputthe input deserialization stream
termIteratoran iterator referreing to the term whose contents are being deserialized.

Implemented in nmrDynAllocPolynomialContainer, and nmrStandardPolynomial.

◆ EndTermIterator() [1/2]

template<class _TermInfo>
TermIteratorType nmrPolynomialContainer< _TermInfo >::EndTermIterator ( )
inline

◆ EndTermIterator() [2/2]

template<class _TermInfo>
TermConstIteratorType nmrPolynomialContainer< _TermInfo >::EndTermIterator ( ) const
inline

◆ Evaluate()

template<class _TermInfo>
virtual ValueType nmrPolynomialContainer< _TermInfo >::Evaluate ( const nmrMultiVariablePowerBasis & variables) const
inlinevirtual

Evaluate the polynomial for externally given variables

Implements nmrPolynomialBase.

◆ EvaluateBasis() [1/2]

template<class _TermInfo>
virtual ValueType nmrPolynomialContainer< _TermInfo >::EvaluateBasis ( const TermConstIteratorType & where,
const nmrMultiVariablePowerBasis & variables ) const
pure virtual

Implemented in nmrStandardPolynomial.

◆ EvaluateBasis() [2/2]

template<class _TermInfo>
virtual ValueType nmrPolynomialContainer< _TermInfo >::EvaluateBasis ( const TermIteratorType & where,
const nmrMultiVariablePowerBasis & variables ) const
pure virtual

Implemented in nmrStandardPolynomial.

◆ EvaluateBasisVector()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::EvaluateBasisVector ( const nmrMultiVariablePowerBasis & variables,
ValueType termBaseValues[] ) const
inlinevirtual

Evaluate the basis functions of the terms as a vector of values.

Implements nmrPolynomialBase.

◆ EvaluateForCoefficients()

template<class _TermInfo>
virtual ValueType nmrPolynomialContainer< _TermInfo >::EvaluateForCoefficients ( const nmrMultiVariablePowerBasis & variables,
const CoefficientType coefficients[] ) const
inlinevirtual

Evaluate the polynomial at the currently specified point, using externally defined coefficients. This lets the user create many polynomials over the same set of basis functions without having to duplicate the terms. The input coefficients must be ordered the same way as the terms in this object. It is best to order them using CollectCoefficients()

Implements nmrPolynomialBase.

◆ EvaluateTerm() [1/4]

template<class _TermInfo>
ValueType nmrPolynomialContainer< _TermInfo >::EvaluateTerm ( const TermConstIteratorType & where) const
inline

◆ EvaluateTerm() [2/4]

template<class _TermInfo>
ValueType nmrPolynomialContainer< _TermInfo >::EvaluateTerm ( const TermConstIteratorType & where,
const nmrMultiVariablePowerBasis & variables ) const
inline

◆ EvaluateTerm() [3/4]

template<class _TermInfo>
ValueType nmrPolynomialContainer< _TermInfo >::EvaluateTerm ( const TermIteratorType & where) const
inline

◆ EvaluateTerm() [4/4]

template<class _TermInfo>
ValueType nmrPolynomialContainer< _TermInfo >::EvaluateTerm ( const TermIteratorType & where,
const nmrMultiVariablePowerBasis & variables ) const
inline

◆ FillAllTerms()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::FillAllTerms ( )
inlinevirtual

Implements nmrPolynomialBase.

◆ FindTerm() [1/2]

template<class _TermInfo>
TermIteratorType nmrPolynomialContainer< _TermInfo >::FindTerm ( const nmrPolynomialTermPowerIndex & target)
inline

◆ FindTerm() [2/2]

template<class _TermInfo>
TermConstIteratorType nmrPolynomialContainer< _TermInfo >::FindTerm ( const nmrPolynomialTermPowerIndex & target) const
inline

◆ FirstTermIterator() [1/2]

template<class _TermInfo>
TermIteratorType nmrPolynomialContainer< _TermInfo >::FirstTermIterator ( )
inline

◆ FirstTermIterator() [2/2]

template<class _TermInfo>
TermConstIteratorType nmrPolynomialContainer< _TermInfo >::FirstTermIterator ( ) const
inline

◆ GetCoefficient() [1/2]

template<class _TermInfo>
virtual CoefficientType nmrPolynomialContainer< _TermInfo >::GetCoefficient ( const TermConstIteratorType & where) const
pure virtual

Implemented in nmrStandardPolynomial.

◆ GetCoefficient() [2/2]

template<class _TermInfo>
virtual CoefficientType nmrPolynomialContainer< _TermInfo >::GetCoefficient ( const TermIteratorType & where) const
pure virtual

Implemented in nmrStandardPolynomial.

◆ GetIndexPosition()

template<class _TermInfo>
virtual TermCounterType nmrPolynomialContainer< _TermInfo >::GetIndexPosition ( const nmrPolynomialTermPowerIndex & term) const
inlinevirtual

Implements nmrPolynomialBase.

◆ GetNumberOfTerms()

template<class _TermInfo>
virtual TermCounterType nmrPolynomialContainer< _TermInfo >::GetNumberOfTerms ( ) const
inlinevirtual

Implements nmrPolynomialBase.

◆ GetTermInfo() [1/2]

template<class _TermInfo>
TermInfoType & nmrPolynomialContainer< _TermInfo >::GetTermInfo ( const TermConstIteratorType & termIterator)
inlineprotected

◆ GetTermInfo() [2/2]

template<class _TermInfo>
const TermInfoType & nmrPolynomialContainer< _TermInfo >::GetTermInfo ( const TermConstIteratorType & termIterator) const
inlineprotected

◆ GetTermIteratorForPosition()

template<class _TermInfo>
TermIteratorType nmrPolynomialContainer< _TermInfo >::GetTermIteratorForPosition ( TermCounterType position)
inline

Return the iterator for a term identified by its sequential number (as in GetIndexPosition).

◆ GetTermPowerIndex() [1/2]

template<class _TermInfo>
const nmrPolynomialTermPowerIndex & nmrPolynomialContainer< _TermInfo >::GetTermPowerIndex ( const TermConstIteratorType & where) const
inline

◆ GetTermPowerIndex() [2/2]

template<class _TermInfo>
const nmrPolynomialTermPowerIndex & nmrPolynomialContainer< _TermInfo >::GetTermPowerIndex ( const TermIteratorType & where) const
inline

◆ IncludesIndex()

template<class _TermInfo>
virtual bool nmrPolynomialContainer< _TermInfo >::IncludesIndex ( const nmrPolynomialTermPowerIndex & target) const
inlinevirtual

Implements nmrPolynomialBase.

◆ IsEmpty()

template<class _TermInfo>
virtual bool nmrPolynomialContainer< _TermInfo >::IsEmpty ( ) const
inlinevirtual

Implements nmrPolynomialBase.

◆ RemoveTerm() [1/2]

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::RemoveTerm ( const nmrPolynomialTermPowerIndex & where)
inlinevirtual

Implements nmrPolynomialBase.

◆ RemoveTerm() [2/2]

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::RemoveTerm ( TermIteratorType & where)
inlinevirtual

Reimplemented in nmrStandardPolynomial.

◆ RestoreCoefficients()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::RestoreCoefficients ( const CoefficientType source[])
inlinevirtual

Implements nmrPolynomialBase.

◆ Scale()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::Scale ( CoefficientType scaleFactor)
inlinevirtual

Overloaded from nmrPolynomialBase

Implements nmrPolynomialBase.

◆ SerializeRaw()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::SerializeRaw ( std::ostream & output) const
inlinevirtual

nmrPolynomialBase::SerializeRaw() plus serialize for each term the power index in nmrPolynomialTermPowerIndex::SerializeIndexRaw() format, and the specific term information by calling the abstract SerializeTermInfo for that term.

Reimplemented from nmrPolynomialBase.

◆ SerializeTermInfo()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::SerializeTermInfo ( std::ostream & output,
const TermConstIteratorType & termIterator ) const
pure virtual

Serialize the TermInfo member associated with the power index of a term. The implementation of this function is to be specific per TermInfo concrete type, and so it should be overridden in the derived classes. This function is called from SerializeRaw().

Parameters
outputthe output serializetion stream
termIteratoran iterator referring to the term whose contents are being serialized.

Implemented in nmrDynAllocPolynomialContainer, and nmrStandardPolynomial.

◆ SetCoefficient() [1/2]

template<class _TermInfo>
virtual InsertStatus nmrPolynomialContainer< _TermInfo >::SetCoefficient ( const nmrPolynomialTermPowerIndex & where,
CoefficientType coefficient )
pure virtual

Implements nmrPolynomialBase.

Implemented in nmrStandardPolynomial.

◆ SetCoefficient() [2/2]

template<class _TermInfo>
virtual InsertStatus nmrPolynomialContainer< _TermInfo >::SetCoefficient ( TermIteratorType & where,
CoefficientType coefficient )
pure virtual

Implemented in nmrStandardPolynomial.

◆ SetMaxDegree()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::SetMaxDegree ( PowerType newMax)
inlinevirtual

◆ SetMinDegree()

template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::SetMinDegree ( PowerType newMin)
inlinevirtual

Member Data Documentation

◆ Terms

template<class _TermInfo>
TermContainerType nmrPolynomialContainer< _TermInfo >::Terms
protected

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