Simbody  3.6
SimTK::Function_< T >::Polynomial Class Reference

This is a Function_ subclass whose output value is a polynomial of its argument: f(x) = ax^n+bx^(n-1)+...+c. More...

+ Inheritance diagram for SimTK::Function_< T >::Polynomial:

Public Member Functions

 Polynomial (const Vector_< T > &coefficients)
 Create a Function_::Polynomial object. More...
 
calcValue (const Vector &x) const override
 Calculate the value of this function at a particular point. More...
 
calcDerivative (const Array_< int > &derivComponents, const Vector &x) const override
 Calculate a partial derivative of this function at a particular point. More...
 
int getArgumentSize () const override
 Get the number of components expected in the input vector. More...
 
int getMaxDerivativeOrder () const override
 Get the maximum derivative order this Function_ object can calculate. More...
 
Polynomialclone () const override
 Create a new heap-allocated copy of this concrete Function. More...
 
calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const
 This provides compatibility with std::vector without requiring any copying. More...
 
- Public Member Functions inherited from SimTK::Function_< T >
virtual ~Function_ ()
 
calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const
 This provides compatibility with std::vector without requiring any copying. More...
 

Detailed Description

template<class T>
class SimTK::Function_< T >::Polynomial

This is a Function_ subclass whose output value is a polynomial of its argument: f(x) = ax^n+bx^(n-1)+...+c.

Constructor & Destructor Documentation

◆ Polynomial()

template<class T>
SimTK::Function_< T >::Polynomial::Polynomial ( const Vector_< T > &  coefficients)
inline

Create a Function_::Polynomial object.

Parameters
coefficientsthe polynomial coefficients in order of decreasing powers

Member Function Documentation

◆ calcValue()

template<class T>
T SimTK::Function_< T >::Polynomial::calcValue ( const Vector x) const
inlineoverridevirtual

Calculate the value of this function at a particular point.

Parameters
xthe Vector of input arguments. Its size must equal the value returned by getArgumentSize().

Implements SimTK::Function_< T >.

◆ calcDerivative() [1/2]

template<class T>
T SimTK::Function_< T >::Polynomial::calcDerivative ( const Array_< int > &  derivComponents,
const Vector x 
) const
inlineoverridevirtual

Calculate a partial derivative of this function at a particular point.

Which derivative to take is specified by listing the input components with which to take it. For example, if derivComponents=={0}, that indicates a first derivative with respective to component 0. If derivComponents=={0, 0, 0}, that indicates a third derivative with respective to component 0. If derivComponents=={4, 7}, that indicates a partial second derivative with respect to components 4 and 7.

Parameters
derivComponentsThe input components with respect to which the derivative should be taken. Its size must be less than or equal to the value returned by getMaxDerivativeOrder().
xThe Vector of input arguments. Its size must equal the value returned by getArgumentSize().
Returns
The value of the selected derivative, which is of type T.

Implements SimTK::Function_< T >.

◆ getArgumentSize()

template<class T>
int SimTK::Function_< T >::Polynomial::getArgumentSize ( ) const
inlineoverridevirtual

Get the number of components expected in the input vector.

Implements SimTK::Function_< T >.

◆ getMaxDerivativeOrder()

template<class T>
int SimTK::Function_< T >::Polynomial::getMaxDerivativeOrder ( ) const
inlineoverridevirtual

Get the maximum derivative order this Function_ object can calculate.

Implements SimTK::Function_< T >.

◆ clone()

template<class T>
Polynomial* SimTK::Function_< T >::Polynomial::clone ( ) const
inlineoverridevirtual

Create a new heap-allocated copy of this concrete Function.

For backwards compatibility this is not pure virtual; it has a default implementation that throws an exception if called. However, it should always be implemented.

Reimplemented from SimTK::Function_< T >.

◆ calcDerivative() [2/2]

template<class T>
T SimTK::Function_< T >::Polynomial::calcDerivative ( const std::vector< int > &  derivComponents,
const Vector x 
) const
inline

This provides compatibility with std::vector without requiring any copying.


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