ocra-recipes
Doxygen documentation for the ocra-recipes repository
Public Types | Public Member Functions | Protected Member Functions | List of all members
Function1 Class Reference
Inheritance diagram for Function1:
[legend]
Collaboration diagram for Function1:
[legend]

Public Types

typedef Function functionType_t
 

Public Member Functions

 Function1 (Variable &x)
 
- Public Member Functions inherited from ocra::Function
virtual ~Function ()
 
int getDimension () const
 
virtual void updateFdot () const
 
virtual void updateFddot () const
 
virtual void updateJdotXdot () const
 
const VariablegetVariable () const
 
VariablegetVariable ()
 
template<eFunctionAbility Ability>
void invalidate ()
 
void invalidateAll (int timestamp)
 
void invalidateAll ()
 
template<eFunctionAbility Ability>
bool isValid () const
 
template<eFunctionAbility Ability>
bool canCompute () const
 
template<eFunctionAbility Ability>
const IFunction< Ability >::return_type & get () const
 
template<eFunctionAbility Ability>
IFunction< Ability >::return_sub_type get (int index) const
 
const VectorXd & getValue () const
 
double getValue (int index) const
 
const MatrixXd & getJacobian () const
 
MatrixXdRow getJacobian (int index) const
 
- Public Member Functions inherited from ocra::ObserverSubject
 ObserverSubject ()
 
virtual ~ObserverSubject ()
 
- Public Member Functions inherited from ocra::Observer
virtual ~Observer ()
 
template<int EVT>
void bind (SubjectBase< EVT > &subject)
 Call this method to automatically propagate observed events to observers connected to the subject given in argument. More...
 
template<int EVT>
void stopPropagation ()
 
- Public Member Functions inherited from ocra::ObserverBase< EVT_RESIZE >
void bind (subject_type &subject)
 Call this method to automatically propagate observed events to observers connected to the subject given in argument. More...
 
- Public Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_DEPENDENCIES >
void bind (subject_type &subject)
 Call this method to automatically propagate observed events to observers connected to the subject given in argument. More...
 
- Public Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_VALUE >
void bind (subject_type &subject)
 Call this method to automatically propagate observed events to observers connected to the subject given in argument. More...
 
- Public Member Functions inherited from ocra::Subject
virtual ~Subject ()
 
template<int EVT, class Derived , class Base >
void connect (Derived &object, void(Base::*newCallback)(int)) const
 Call this method to register a non-static method as a callback. More...
 
template<int EVT>
void connect (void(*newCallback)(int)) const
 Call this method to register a free function as a callback. More...
 
template<int EVT, class Derived , class Base >
void disconnect (Derived &object, void(Base::*callbackToErase)(int)) const
 Disconnect non-static method. More...
 
template<int EVT>
void disconnect (void(*callbackToErase)(int)) const
 Disconnect free function. More...
 
template<int EVT>
void propagate () const
 
template<int EVT>
void propagate (int timestamp) const
 
- Public Member Functions inherited from ocra::SubjectBase< EVT_RESIZE >
void connect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type newCallback) const
 Call this method to register a non-static method as a callback. More...
 
void connect (typename SubjectBaseTraits< EVT, void >::callback_type newCallback) const
 Call this method to register a free function as a callback. More...
 
void disconnect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type callback) const
 Disconnect non-static method. More...
 
void disconnect (typename SubjectBaseTraits< EVT, void >::callback_type callbackToErase) const
 Disconnect free function. More...
 
void propagate (int timestamp) const
 
void propagate () const
 
- Public Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_DEPENDENCIES >
void connect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type newCallback) const
 Call this method to register a non-static method as a callback. More...
 
void connect (typename SubjectBaseTraits< EVT, void >::callback_type newCallback) const
 Call this method to register a free function as a callback. More...
 
void disconnect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type callback) const
 Disconnect non-static method. More...
 
void disconnect (typename SubjectBaseTraits< EVT, void >::callback_type callbackToErase) const
 Disconnect free function. More...
 
void propagate (int timestamp) const
 
void propagate () const
 
- Public Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_VALUE >
void connect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type newCallback) const
 Call this method to register a non-static method as a callback. More...
 
void connect (typename SubjectBaseTraits< EVT, void >::callback_type newCallback) const
 Call this method to register a free function as a callback. More...
 
void disconnect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type callback) const
 Disconnect non-static method. More...
 
void disconnect (typename SubjectBaseTraits< EVT, void >::callback_type callbackToErase) const
 Disconnect free function. More...
 
void propagate (int timestamp) const
 
void propagate () const
 
- Public Member Functions inherited from ocra::IFunctionProperties
bool hasSeparableTimeDependancy (void) const
 
eFunctionLinearity getType (void) const
 
eFunctionConvexity getConvexityProperty (void) const
 
int getContinuityProperty (void) const
 
const std::string & getProperty (int i) const
 
int getNumberOfProperties (void) const
 
bool hasProperty (const std::string &functionProperty) const
 
bool isExplicitlyTimeDependant (void) const
 
- Public Member Functions inherited from ocra::NamedInstance
 NamedInstance (const std::string &name)
 
const std::string & getName () const
 
virtual ~NamedInstance ()
 
- Public Member Functions inherited from ocra::AbilitySet
AbilitySetadd (eFunctionAbility prop)
 
AbilitySetremove (eFunctionAbility prop)
 

Protected Member Functions

void updateValue () const
 
void updateJacobian () const
 
void updateHessian () const
 
void doUpdateInputSizeBegin ()
 
- Protected Member Functions inherited from ocra::Function
 Function (Variable &x, int dimension, eFunctionLinearity linearity=LINEARITY_UNDEFINED, eFunctionConvexity convexity=CONVEXITY_UNDEFINED, int continuity=CONTINUITY_UNKNOWN, bool explicitlyTimeDependant=false, bool separableTimeDependancy=true)
 Function Constructor. More...
 
void disconnectVariable ()
 
void changeFunctionDimension (int newDimension)
 
void updateInputSize (int timestamp)
 
void resize ()
 
virtual int computeDimensionFromInputSize () const
 
virtual void doUpdateInputSizeEnd ()
 
virtual void doUpdateDimensionBegin (int newDimension)
 
virtual void doUpdateDimensionEnd (int oldDimension)
 
- Protected Member Functions inherited from ocra::ObserverBase< EVT_RESIZE >
void stopPropagation ()
 Call this method from your callbacks to avoid propagation to the bound subject (if any). More...
 
 ObserverBase ()
 
 ~ObserverBase ()
 
- Protected Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_DEPENDENCIES >
void stopPropagation ()
 Call this method from your callbacks to avoid propagation to the bound subject (if any). More...
 
 ObserverBase ()
 
 ~ObserverBase ()
 
- Protected Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_VALUE >
void stopPropagation ()
 Call this method from your callbacks to avoid propagation to the bound subject (if any). More...
 
 ObserverBase ()
 
 ~ObserverBase ()
 
- Protected Member Functions inherited from ocra::SubjectBase< EVT_RESIZE >
 SubjectBase ()
 
 ~SubjectBase ()
 
- Protected Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_DEPENDENCIES >
 SubjectBase ()
 
 ~SubjectBase ()
 
- Protected Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_VALUE >
 SubjectBase ()
 
 ~SubjectBase ()
 
- Protected Member Functions inherited from ocra::IFunctionProperties
 IFunctionProperties (eFunctionLinearity linearity=LINEARITY_UNDEFINED, eFunctionConvexity convexity=CONVEXITY_UNDEFINED, int continuity=CONTINUITY_UNKNOWN, bool explicitlyTimeDependant=false, bool separableTimeDependancy=true)
 IFunctionProperties Constructor. More...
 
void changeType (eFunctionLinearity newType)
 
void changeConvexityProperty (eFunctionConvexity newProperty)
 
void changeContinuityProperty (int newProperty)
 
void addProperty (const std::string &functionProperty)
 
void removeProperty (const std::string &functionProperty)
 
void changeExplicitTimeDependancy (bool b)
 
void changeSeparableTimeDependancy (bool b)
 
- Protected Member Functions inherited from ocra::AbilitySet
 AbilitySet (const std::vector< bool > &usageSet)
 
const std::vector< bool > & getUsageSet () const
 
 AbilitySet (eFunctionAbility prop0=FUN_VALUE, eFunctionAbility prop1=FUN_VALUE)
 
 AbilitySet (eFunctionAbility prop0, eFunctionAbility prop1, eFunctionAbility prop2, eFunctionAbility prop3=FUN_VALUE, eFunctionAbility prop4=FUN_VALUE)
 
 AbilitySet (eFunctionAbility prop0, eFunctionAbility prop1, eFunctionAbility prop2, eFunctionAbility prop3, eFunctionAbility prop4, eFunctionAbility prop5, eFunctionAbility prop6=FUN_VALUE, eFunctionAbility prop7=FUN_VALUE, eFunctionAbility prop8=FUN_VALUE, eFunctionAbility prop9=FUN_VALUE)
 
- Protected Member Functions inherited from ocra::CoupledInputOutputSize
 CoupledInputOutputSize (bool coupledInputOutputSize)
 
bool inputAndOutputSizesAreCoupled () const
 

Additional Inherited Members

- Protected Types inherited from ocra::ObserverBase< EVT_RESIZE >
typedef SubjectBase< EVT > subject_type
 
typedef InvokerBase< EVT > invoker_type
 
- Protected Types inherited from ocra::ObserverBase< EVT_CHANGE_DEPENDENCIES >
typedef SubjectBase< EVT > subject_type
 
typedef InvokerBase< EVT > invoker_type
 
- Protected Types inherited from ocra::ObserverBase< EVT_CHANGE_VALUE >
typedef SubjectBase< EVT > subject_type
 
typedef InvokerBase< EVT > invoker_type
 
- Protected Attributes inherited from ocra::Function
Variablex
 
VectorXd & _value
 
MatrixXd & _jacobian
 
const int & _dim
 

Detailed Description

The first example is a simple function $ R^3 \rightarrow R $, $ f(x,y,z) = 3x^2y+2\frac{\sqrt{z}}{x}$

We gives an implementation that computes the value, jacbian and hessian of the function.

Definition at line 12 of file TestFunction.cpp.

Member Typedef Documentation

Definition at line 15 of file TestFunction.cpp.

Constructor & Destructor Documentation

Function1::Function1 ( Variable x)
inline

Definition at line 17 of file TestFunction.cpp.

Member Function Documentation

void Function1::doUpdateInputSizeBegin ( )
inlineprotectedvirtual

as a precondition to resize, we check that the size of the variable didn't change

Reimplemented from ocra::Function.

Definition at line 60 of file TestFunction.cpp.

void Function1::updateHessian ( ) const
inlineprotected

Compute the Hessian: $ H(x,y,z) = \left(\begin{array}{lcr} 6y + 4\frac{\sqrt{z}}{x^3} & 6x & -\frac{1}{x^2 \sqrt{z}} \\ 6x & 0 & 0 \\ -\frac{1}{x^2 \sqrt{z}} & 0 & -\frac{1}{2xz \sqrt{z}} \end{array}\right) $

Definition at line 48 of file TestFunction.cpp.

void Function1::updateJacobian ( ) const
inlineprotected

Compute the jacobian: $J(x,y,z) = \begin{array}{lcr} 6xy - 2 \frac{\sqrt{z}}{x^2} & 3x^2 & \frac{1}{x \sqrt{z}} \end{array} $

Definition at line 34 of file TestFunction.cpp.

void Function1::updateValue ( ) const
inlineprotected

Compute the value of the function: $ f(x,y,z) = 3x^2y+2\frac{z}{x}$

Definition at line 28 of file TestFunction.cpp.


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