|
| nmrBernsteinPolynomial (VariableIndexType numVariables, PowerType degree) |
|
virtual InsertStatus | SetCoefficient (const nmrPolynomialTermPowerIndex &where, CoefficientType coefficient) |
|
virtual InsertStatus | SetCoefficient (TermIteratorType &where, CoefficientType coefficient) |
|
virtual CoefficientType | GetCoefficient (const nmrPolynomialTermPowerIndex &where) const |
|
virtual CoefficientType | GetCoefficient (const TermConstIteratorType &where) const |
|
virtual CoefficientType | GetCoefficient (const TermIteratorType &where) const |
|
virtual void | RemoveTerm (TermIteratorType &where) |
|
virtual void | Clear () |
|
virtual ValueType | EvaluateBasis (const nmrPolynomialTermPowerIndex &where, const nmrMultiVariablePowerBasis &variables) const |
|
virtual ValueType | EvaluateBasis (const TermConstIteratorType &where, const nmrMultiVariablePowerBasis &variables) const |
|
virtual ValueType | EvaluateBasis (const TermIteratorType &where, const nmrMultiVariablePowerBasis &variables) const |
|
virtual void | SerializeTermInfo (std::ostream &output, const TermConstIteratorType &termIterator) const |
|
virtual void | DeserializeTermInfo (std::istream &input, TermIteratorType &termIterator) |
|
virtual void | AddConstant (CoefficientType shiftAmount) |
|
virtual void | AddConstantToCoefficients (CoefficientType coefficients[], CoefficientType shiftAmount) const |
|
const
nmrPolynomialTermPowerIndex::MultinomialCoefficientType & | GetMultinomialCoefficient (const TermIteratorType &where) const |
|
const
nmrPolynomialTermPowerIndex::MultinomialCoefficientType & | GetMultinomialCoefficient (const TermConstIteratorType &where) const |
|
| nmrDynAllocPolynomialContainer (unsigned int numVariables, unsigned int minDegree, unsigned int maxDegree) |
|
| 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 | CollectCoefficients (CoefficientType target[]) const |
|
virtual void | RestoreCoefficients (const CoefficientType source[]) |
|
const nmrPolynomialTermPowerIndex & | GetTermPowerIndex (const TermConstIteratorType &where) const |
|
const nmrPolynomialTermPowerIndex & | GetTermPowerIndex (const TermIteratorType &where) const |
|
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 | SerializeRaw (std::ostream &output) const |
|
virtual void | DeserializeRaw (std::istream &input) |
|
| 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 |
|
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 |
|
class nmrBernsteinPolynomial defines a polynomial in Bernstein basis. In a Bernstein polynomial, all the terms are of equal degree (that is, the sum of powers is a constant), and the variables sum up to a unity. Each term is associated with a scalar coefficient and with a multinomial factor, which reflects the relative weight of the term in the expression:

To make repeated evaluations quicker, we cache the multinomial factor along with the coefficient of the term in a BernsteinTermInfo object. Appropriate accessors are defined.
Since the sum of the variables is 1, one of the variables depends on the others. Typically, it is either the last or the first, but the user can choose any variable to be the ``implicit'' variable. Once the implicit variable has been determined, its value cannot be updated directly, and instead it is reassigned every time one of the other variables is set. However, the user of the class still has the flexibility to replace the choice of the implicit variable at any time. The only thing that matters is that the variables sum to 1.
Note: We use dynamic allocation for the term information (BernsteinTermInfo), which is separate from the STL provided dynamic allocation for the container elements. We store the pointer to the dynamically allocated term info in the container. Therefore:
- We had to override the base-class's RemoveTerm() and Clear() methods.
- Do not even try to make a copy of a nmrBernsteinPolynomial using copy-ctor or operator= (yeah, like you would). Just for safety, we declare these operations protected, and do not provide implementation.
- A better solution may be to define a common base type for TermInfo, and have it declare a virtual dtor. Go for it, if you have time.