#include <Function.h>
The number of output components is set as a template argument, while the number of input components may be determined at runtime.
Subclasses define particular mathematical functions. Predefined subclasses are provided for several common function types: Function::Constant, Function::Linear, and Function::Polynomial. You can define your own subclasses for other function types. The Spline class also provides a convenient way to create various types of Functions.
Public Member Functions | |
virtual | ~Function () |
virtual Vec< N > | calcValue (const Vector &x) const =0 |
Calculate the value of this function at a particular point. | |
virtual Vec< N > | calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const =0 |
Calculate a partial derivative of this function at a particular point. | |
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. | |
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... |
virtual ~Function | ( | ) | [inline, 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 Function::Constant, Function::Linear, Function::Polynomial, Spline, and SinusoidFunction.
virtual Vec<N> calcDerivative | ( | const std::vector< 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 Function::Constant, Function::Linear, Function::Polynomial, Spline, and SinusoidFunction.
virtual int getArgumentSize | ( | ) | const [pure virtual] |
Get the number of components expected in the input vector.
Implemented in Function::Constant, Function::Linear, Function::Polynomial, Spline, and SinusoidFunction.
virtual int getMaxDerivativeOrder | ( | ) | const [pure virtual] |
Get the maximum derivative order this Function object can calculate.
Implemented in Function::Constant, Function::Linear, Function::Polynomial, Spline, and SinusoidFunction.