Function_< T > Class Template Reference

This abstract class represents a mathematical function that calculates a value of arbitrary type based on M real arguments. More...

#include <Function.h>

Inheritance diagram for Function_< T >:
Constant Linear Polynomial Step SinusoidFunction Spline_< T > ZeroFunction

List of all members.

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, . More...
class  Polynomial
 This is a Function_ subclass whose output value is a polynomial of its argument: f(x) = ax^n+bx^(n-1)+. 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.
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.

Detailed Description

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

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.


Constructor & Destructor Documentation

virtual ~Function_ (  )  [inline, virtual]

Member Function Documentation

T calcDerivative ( const std::vector< int > &  derivComponents,
const Vector x 
) const [inline]

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

Reimplemented in Spline_< T >, Constant, Linear, Polynomial, and Step.

References Function_< T >::calcDerivative().

Referenced by Function_< T >::calcDerivative().

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

Parameters:
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().
Returns:
The value of the selected derivative, which is of type T.

Implemented in SinusoidFunction, Spline_< T >, Constant, Linear, Polynomial, and Step.

virtual T calcValue ( const Vector x  )  const [pure virtual]

Calculate the value of this function at a particular point.

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

Implemented in SinusoidFunction, Spline_< T >, Constant, Linear, Polynomial, and Step.

virtual int getArgumentSize (  )  const [pure virtual]

Get the number of components expected in the input vector.

Implemented in SinusoidFunction, Spline_< T >, Constant, Linear, Polynomial, and Step.

virtual int getMaxDerivativeOrder (  )  const [pure virtual]

Get the maximum derivative order this Function_ object can calculate.

Implemented in SinusoidFunction, Spline_< T >, Constant, Linear, Polynomial, and Step.


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

Generated on Thu Aug 12 16:38:17 2010 for SimTKcore by  doxygen 1.6.1