Simbody  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SimTK::Function_< T >::Linear Class Reference

This is a Function_ subclass whose output value is a linear function of its arguments: f(x, y, ...) = ax+by+...+c. More...

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

Public Member Functions

 Linear (const Vector_< T > &coefficients)
 Create a Function_::Linear object. More...
 
calcValue (const Vector &x) const
 Calculate the value of this function at a particular point. More...
 
calcDerivative (const Array_< int > &derivComponents, const Vector &x) const
 Calculate a partial derivative of this function at a particular point. More...
 
virtual int getArgumentSize () const
 Get the number of components expected in the input vector. More...
 
int getMaxDerivativeOrder () const
 Get the maximum derivative order this Function_ object can calculate. 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 >::Linear

This is a Function_ subclass whose output value is a linear function of its arguments: f(x, y, ...) = ax+by+...+c.

Constructor & Destructor Documentation

template<class T>
SimTK::Function_< T >::Linear::Linear ( const Vector_< T > &  coefficients)
inlineexplicit

Create a Function_::Linear object.

Parameters
coefficientsThe coefficients of the linear function. The number of arguments expected by the function is equal to coefficients.size()-1. coefficients[0] is the coefficient for the first argument, coefficients[1] is the coefficient for the second argument, etc. The final element of coefficients contains the constant term.

Member Function Documentation

template<class T>
T SimTK::Function_< T >::Linear::calcValue ( const Vector x) const
inlinevirtual

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 >.

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

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 >.

template<class T>
virtual int SimTK::Function_< T >::Linear::getArgumentSize ( ) const
inlinevirtual

Get the number of components expected in the input vector.

Implements SimTK::Function_< T >.

template<class T>
int SimTK::Function_< T >::Linear::getMaxDerivativeOrder ( ) const
inlinevirtual

Get the maximum derivative order this Function_ object can calculate.

Implements SimTK::Function_< T >.

template<class T>
T SimTK::Function_< T >::Linear::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: