cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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,
TermInfoType
ContainerElementType
 
typedef std::list
< ContainerElementType
TermContainerType
 
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) throw (std::runtime_error)
 
virtual void SetMaxDegree (PowerType newMax) throw (std::runtime_error)
 
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
 
ValueType EvaluateTerm (const nmrPolynomialTermPowerIndex &where, const nmrMultiVariablePowerBasis &variables) const
 
ValueType EvaluateTerm (const nmrPolynomialTermPowerIndex &where, const nmrMultiVariablePowerBasis &variables, CoefficientType coefficient) const
 
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

template<class _TermInfo>
typedef nmrPolynomialBase nmrPolynomialContainer< _TermInfo >::BaseType
template<class _TermInfo>
typedef std::pair<nmrPolynomialTermPowerIndex, TermInfoType> nmrPolynomialContainer< _TermInfo >::ContainerElementType
template<class _TermInfo>
typedef TermContainerType::const_iterator nmrPolynomialContainer< _TermInfo >::TermConstIteratorType
template<class _TermInfo>
typedef std::list<ContainerElementType> nmrPolynomialContainer< _TermInfo >::TermContainerType
template<class _TermInfo>
typedef _TermInfo nmrPolynomialContainer< _TermInfo >::TermInfoType
template<class _TermInfo>
typedef TermContainerType::iterator nmrPolynomialContainer< _TermInfo >::TermIteratorType
template<class _TermInfo>
typedef TermContainerType::value_type nmrPolynomialContainer< _TermInfo >::TermType

Constructor & Destructor Documentation

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

Member Function Documentation

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 nmrBernsteinPolynomial, and nmrStandardPolynomial.

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 nmrBernsteinPolynomial, and nmrStandardPolynomial.

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

Implements nmrPolynomialBase.

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.

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 nmrBernsteinPolynomial, nmrStandardPolynomial, and nmrDynAllocPolynomialContainer.

template<class _TermInfo>
TermIteratorType nmrPolynomialContainer< _TermInfo >::EndTermIterator ( )
inline
template<class _TermInfo>
TermConstIteratorType nmrPolynomialContainer< _TermInfo >::EndTermIterator ( ) const
inline
template<class _TermInfo>
virtual ValueType nmrPolynomialContainer< _TermInfo >::Evaluate ( const nmrMultiVariablePowerBasis variables) const
inlinevirtual

Evaluate the polynomial for externally given variables

Implements nmrPolynomialBase.

template<class _TermInfo>
virtual ValueType nmrPolynomialContainer< _TermInfo >::EvaluateBasis ( const TermConstIteratorType where,
const nmrMultiVariablePowerBasis variables 
) const
pure virtual
template<class _TermInfo>
virtual ValueType nmrPolynomialContainer< _TermInfo >::EvaluateBasis ( const TermIteratorType where,
const nmrMultiVariablePowerBasis variables 
) const
pure virtual
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.

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.

template<class _TermInfo>
ValueType nmrPolynomialContainer< _TermInfo >::EvaluateTerm ( const TermConstIteratorType where) const
inline
template<class _TermInfo>
ValueType nmrPolynomialContainer< _TermInfo >::EvaluateTerm ( const TermIteratorType where) const
inline
template<class _TermInfo>
ValueType nmrPolynomialContainer< _TermInfo >::EvaluateTerm ( const TermConstIteratorType where,
const nmrMultiVariablePowerBasis variables 
) const
inline
template<class _TermInfo>
ValueType nmrPolynomialContainer< _TermInfo >::EvaluateTerm ( const TermIteratorType where,
const nmrMultiVariablePowerBasis variables 
) const
inline
template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::FillAllTerms ( )
inlinevirtual

Implements nmrPolynomialBase.

template<class _TermInfo>
TermIteratorType nmrPolynomialContainer< _TermInfo >::FindTerm ( const nmrPolynomialTermPowerIndex target)
inline
template<class _TermInfo>
TermConstIteratorType nmrPolynomialContainer< _TermInfo >::FindTerm ( const nmrPolynomialTermPowerIndex target) const
inline
template<class _TermInfo>
TermIteratorType nmrPolynomialContainer< _TermInfo >::FirstTermIterator ( )
inline
template<class _TermInfo>
TermConstIteratorType nmrPolynomialContainer< _TermInfo >::FirstTermIterator ( ) const
inline
template<class _TermInfo>
virtual CoefficientType nmrPolynomialContainer< _TermInfo >::GetCoefficient ( const TermConstIteratorType where) const
pure virtual
template<class _TermInfo>
virtual CoefficientType nmrPolynomialContainer< _TermInfo >::GetCoefficient ( const TermIteratorType where) const
pure virtual
template<class _TermInfo>
virtual TermCounterType nmrPolynomialContainer< _TermInfo >::GetIndexPosition ( const nmrPolynomialTermPowerIndex term) const
inlinevirtual

Implements nmrPolynomialBase.

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

Implements nmrPolynomialBase.

template<class _TermInfo>
const TermInfoType& nmrPolynomialContainer< _TermInfo >::GetTermInfo ( const TermConstIteratorType termIterator) const
inlineprotected
template<class _TermInfo>
TermInfoType& nmrPolynomialContainer< _TermInfo >::GetTermInfo ( const TermConstIteratorType termIterator)
inlineprotected
template<class _TermInfo>
TermIteratorType nmrPolynomialContainer< _TermInfo >::GetTermIteratorForPosition ( TermCounterType  position)
inline

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

template<class _TermInfo>
const nmrPolynomialTermPowerIndex& nmrPolynomialContainer< _TermInfo >::GetTermPowerIndex ( const TermConstIteratorType where) const
inline
template<class _TermInfo>
const nmrPolynomialTermPowerIndex& nmrPolynomialContainer< _TermInfo >::GetTermPowerIndex ( const TermIteratorType where) const
inline
template<class _TermInfo>
virtual bool nmrPolynomialContainer< _TermInfo >::IncludesIndex ( const nmrPolynomialTermPowerIndex target) const
inlinevirtual

Implements nmrPolynomialBase.

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

Implements nmrPolynomialBase.

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

Implements nmrPolynomialBase.

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

Implements nmrPolynomialBase.

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

Overloaded from nmrPolynomialBase

Implements nmrPolynomialBase.

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.

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 nmrBernsteinPolynomial, nmrStandardPolynomial, and nmrDynAllocPolynomialContainer.

template<class _TermInfo>
virtual InsertStatus nmrPolynomialContainer< _TermInfo >::SetCoefficient ( const nmrPolynomialTermPowerIndex where,
CoefficientType  coefficient 
)
pure virtual
template<class _TermInfo>
virtual InsertStatus nmrPolynomialContainer< _TermInfo >::SetCoefficient ( TermIteratorType where,
CoefficientType  coefficient 
)
pure virtual
template<class _TermInfo>
virtual void nmrPolynomialContainer< _TermInfo >::SetMaxDegree ( PowerType  newMax)
throw (std::runtime_error
)
inlinevirtual

Implements nmrPolynomialBase.

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

Implements nmrPolynomialBase.

Member Data Documentation

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

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