Simbody
|
This abstract class represents a mathematical function that calculates a value of arbitrary type based on M real arguments. More...
#include <Function.h>
Classes | |
class | Constant |
This is a Function_ subclass which simply returns a fixed value, independent of its arguments. More... | |
class | Linear |
This is a Function_ subclass whose output value is a linear function of its arguments: f(x, y, ...) = ax+by+...+c. More... | |
class | Polynomial |
This is a Function_ subclass whose output value is a polynomial of its argument: f(x) = ax^n+bx^(n-1)+...+c. More... | |
class | Step |
This is a Function_ subclass whose output value y=f(x) is smoothly stepped from y=y0 to y1 as its input argument goes from x=x0 to x1. More... | |
Public Member Functions | |
virtual | ~Function_ () |
virtual T | calcValue (const Vector &x) const =0 |
Calculate the value of this function at a particular point. | |
virtual T | calcDerivative (const Array_< int > &derivComponents, const Vector &x) const =0 |
Calculate a partial derivative of this function at a particular point. | |
T | calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const |
This provides compatibility with std::vector without requiring any copying. | |
virtual int | getArgumentSize () const =0 |
Get the number of components expected in the input vector. | |
virtual int | getMaxDerivativeOrder () const =0 |
Get the maximum derivative order this Function_ object can calculate. |
This abstract class represents a mathematical function that calculates a value of arbitrary type based on M real arguments.
The output type is set as a template argument, while the number of input components may be determined at runtime. The name "Function" (with no trailing _) may be used as a synonym for Function_<Real>.
Subclasses define particular mathematical functions. Predefined subclasses are provided for several common function types: Function_<T>::Constant, Function_<T>::Linear, Function_<T>::Polynomial, and Function_<T>::Step. You can define your own subclasses for other function types. The Spline_ class also provides a convenient way to create various types of Functions.
virtual SimTK::Function_< T >::~Function_ | ( | ) | [inline, virtual] |
virtual T SimTK::Function_< T >::calcValue | ( | const Vector & | x | ) | const [pure virtual] |
Calculate the value of this function at a particular point.
x | the Vector of input arguments. Its size must equal the value returned by getArgumentSize(). |
Implemented in SimTK::Function_< T >::Constant, SimTK::Function_< T >::Linear, SimTK::Function_< T >::Polynomial, SimTK::Function_< T >::Step, and SimTK::Spline_< T >.
virtual T SimTK::Function_< T >::calcDerivative | ( | const Array_< int > & | derivComponents, |
const Vector & | x | ||
) | const [pure virtual] |
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.
derivComponents | The 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(). |
x | The Vector of input arguments. Its size must equal the value returned by getArgumentSize(). |
Implemented in SimTK::Function_< T >::Constant, SimTK::Function_< T >::Linear, SimTK::Function_< T >::Polynomial, SimTK::Function_< T >::Step, and SimTK::Spline_< T >.
T SimTK::Function_< T >::calcDerivative | ( | const std::vector< int > & | derivComponents, |
const Vector & | x | ||
) | const [inline] |
This provides compatibility with std::vector without requiring any copying.
Reimplemented in SimTK::Function_< T >::Constant, SimTK::Function_< T >::Linear, SimTK::Function_< T >::Polynomial, SimTK::Function_< T >::Step, and SimTK::Spline_< T >.
virtual int SimTK::Function_< T >::getArgumentSize | ( | ) | const [pure virtual] |
Get the number of components expected in the input vector.
Implemented in SimTK::Function_< T >::Constant, SimTK::Function_< T >::Linear, SimTK::Function_< T >::Polynomial, SimTK::Function_< T >::Step, and SimTK::Spline_< T >.
virtual int SimTK::Function_< T >::getMaxDerivativeOrder | ( | ) | const [pure virtual] |
Get the maximum derivative order this Function_ object can calculate.
Implemented in SimTK::Function_< T >::Constant, SimTK::Function_< T >::Linear, SimTK::Function_< T >::Polynomial, SimTK::Function_< T >::Step, and SimTK::Spline_< T >.