Rigid Body Dynamics Library
Function_< T >::Linear Class Reference

#include <Function.h>

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

Public Member Functions

 Linear (const RigidBodyDynamics::Math::VectorNd &coefficients)
 
calcValue (const RigidBodyDynamics::Math::VectorNd &x) const
 
calcDerivative (const std::vector< int > &derivComponents, const RigidBodyDynamics::Math::VectorNd &x) const
 
virtual int getArgumentSize () const
 
int getMaxDerivativeOrder () const
 
- Public Member Functions inherited from Function_< T >
virtual ~Function_ ()
 
virtual T calcValue (const RigidBodyDynamics::Math::VectorNd &x) const =0
 
virtual T calcDerivative (const std::vector< int > &derivComponents, const RigidBodyDynamics::Math::VectorNd &x) const =0
 
virtual int getArgumentSize () const =0
 
virtual int getMaxDerivativeOrder () const =0
 

Private Attributes

const RigidBodyDynamics::Math::VectorNd coefficients
 

Detailed Description

template<class T>
class RigidBodyDynamics::Addons::Geometry::Function_< T >::Linear

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

Definition at line 183 of file Function.h.

Constructor & Destructor Documentation

◆ Linear()

Linear ( const RigidBodyDynamics::Math::VectorNd coefficients)
inlineexplicit

Create a Function_::Linear object.

Parameters
coefficients
The 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.

Definition at line 195 of file Function.h.

Member Function Documentation

◆ calcDerivative()

T calcDerivative ( const std::vector< int > &  derivComponents,
const RigidBodyDynamics::Math::VectorNd 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
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 RigidBodyDynamics::Math::VectorNd 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 Function_< T >.

Definition at line 207 of file Function.h.

References MX_Xd_dynamic::size().

◆ calcValue()

T calcValue ( const RigidBodyDynamics::Math::VectorNd x) const
inlinevirtual

Calculate the value of this function at a particular point.

Parameters
xthe RigidBodyDynamics::Math::VectorNd of input arguments. Its size must equal the value returned by getArgumentSize().

Implements Function_< T >.

Definition at line 199 of file Function.h.

References MX_Xd_dynamic::size().

◆ getArgumentSize()

virtual int getArgumentSize ( ) const
inlinevirtual

This provides compatibility with std::vector without requiring any copying. Get the number of components expected in the input vector.

Implements Function_< T >.

Definition at line 215 of file Function.h.

◆ getMaxDerivativeOrder()

int getMaxDerivativeOrder ( ) const
inlinevirtual

Get the maximum derivative order this Function_ object can calculate.

Implements Function_< T >.

Definition at line 218 of file Function.h.

Field Documentation

◆ coefficients

const RigidBodyDynamics::Math::VectorNd coefficients
private

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

Definition at line 230 of file Function.h.


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