ocra-recipes
Doxygen documentation for the ocra-recipes repository
|
DiagonalLinearFunction class. More...
#include <DiagonalLinearFunction.h>
Public Types | |
typedef LinearFunction | functionType_t |
Public Types inherited from ocra::LinearFunction | |
typedef Function | functionType_t |
Public Member Functions | |
void | changeDiagonal (const VectorXd &d) |
void | changeDiagonal (const double diagonalElementValue, const bool changeDefault=true) |
void | changeDefaultDiagonalValue (const double v) |
void | changeDefaultbValue (const double v) |
template<class VectorBase1 , class VectorBase2 > | |
DiagonalLinearFunction (Variable &x, const VectorBase1 &d, const VectorBase2 &b, const bool useDefaultValue=false, const double defaultDiagValue=1., const double defaultbValue=0.) | |
template<class VectorBase > | |
DiagonalLinearFunction (Variable &x, const double diagonalElementValue, const VectorBase &b, const bool useDefaultValue=false, const double defaultbValue=0.) | |
template<class VectorBase > | |
DiagonalLinearFunction (Variable &x, const VectorBase &d, const double vectorElementValue, const bool useDefaultValue=false, const double defaultDiagValue=1.) | |
DiagonalLinearFunction (Variable &x, const double diagonalElementValue, const double vectorElementValue, const bool useDefaultValue=false) | |
const VectorXd & | getDiagonal () const |
double | getDefaultDiagonalValue () const |
double | getDefaultbValue () const |
bool | isUsingDefaultValue () const |
Public Member Functions inherited from ocra::LinearFunction | |
template<class Derived , class VectorBase > | |
LinearFunction (Variable &x, const MatrixBase< Derived > &A, const VectorBase &b) | |
~LinearFunction () | |
void | invalidateb (int timestamp) |
const MatrixXd & | getA () const |
const VectorXd & | getb () const |
void | changeA (const MatrixXd &A) |
void | changeb (const VectorXd &b) |
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 Variable & | getVariable () const |
Variable & | getVariable () |
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 | |
AbilitySet & | add (eFunctionAbility prop) |
AbilitySet & | remove (eFunctionAbility prop) |
Protected Member Functions | |
DiagonalLinearFunction (Variable &x) | |
virtual void | updateValue () const |
virtual void | doUpdateInputSizeBegin () |
virtual void | doUpdateInputSizeEnd () |
virtual void | doChangeDiagonal (const VectorXd &d) |
virtual void | doChangeDiagonal (const double diagonalElementValue, const bool changeDefault=true) |
virtual void | doChangeDefaultDiagonalValue (const double v) |
virtual void | doChangeDefaultbValue (const double v) |
virtual void | doChangeA (const MatrixXd &A) |
int | computeDimensionFromInputSize () const |
void | doUpdateDimensionBegin (int newDimension) |
Protected Member Functions inherited from ocra::LinearFunction | |
LinearFunction (Variable &x, int dimension) | |
virtual void | updateb () const |
virtual void | updateJacobian () const |
virtual void | doChangeb (const VectorXd &b) |
void | inhibitPropagationFromb () const |
void | desinhibitPropagationFromb () const |
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 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 |
Protected Attributes | |
VectorXd | _d |
double | _defaultDiagonalValue |
double | _defaultbValue |
bool | _useDefaultValue |
Protected Attributes inherited from ocra::LinearFunction | |
VectorXd | _b |
bool | _bIsUpToDate |
Protected Attributes inherited from ocra::Function | |
Variable & | x |
VectorXd & | _value |
MatrixXd & | _jacobian |
const int & | _dim |
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 |
DiagonalLinearFunction class.
Implements a function of the type with a diagonal matrix whose diagonal is given by the vector . It is possible to specify a default value for the new diagonal elements in case the size of the variable, and thus the dimension of the function, change. Note that the values of the last diagonal elements are lost when the dimension decreases. Thus going from dimension n to dimension n'<n then back to n will set the last n-n' diagonal elements to the default value.
Definition at line 40 of file DiagonalLinearFunction.h.
Definition at line 44 of file DiagonalLinearFunction.h.
|
inline |
A set of constructors where d and b are specified either by a vector or by a double.
[in] | x | The variable on which to build the function. |
[in] | d | The value of d. |
[in] | b | The value of b. |
[in] | diagonalElementValue | The value of each element of d. |
[in] | vectorElementValue | The value of each element of b. |
[in] | useDefaultValue | true if the function can use a default value when resizing to a bigger dimension. Note that if useDefaultValue is false, the function can still be downsized. |
[in] | defaultDiagValue | The default value for the last value of d when resizing to a bigger dimension. |
[in] | defaultbValue | The default value for the last value of b when resizing to a bigger dimension. |
Definition at line 156 of file DiagonalLinearFunction.h.
|
inline |
Definition at line 183 of file DiagonalLinearFunction.h.
|
inline |
Definition at line 205 of file DiagonalLinearFunction.h.
ocra::DiagonalLinearFunction::DiagonalLinearFunction | ( | Variable & | x, |
const double | diagonalElementValue, | ||
const double | vectorElementValue, | ||
const bool | useDefaultValue = false |
||
) |
Definition at line 7 of file DiagonalLinearFunction.cpp.
|
protected |
A light constructor for derived class
Definition at line 25 of file DiagonalLinearFunction.cpp.
void ocra::DiagonalLinearFunction::changeDefaultbValue | ( | const double | v | ) |
Set the default value for b to v. (To change b, a method is directly accessible on LinearFunction)
Definition at line 58 of file DiagonalLinearFunction.cpp.
void ocra::DiagonalLinearFunction::changeDefaultDiagonalValue | ( | const double | v | ) |
Change only the diagonal default value
Definition at line 52 of file DiagonalLinearFunction.cpp.
void ocra::DiagonalLinearFunction::changeDiagonal | ( | const VectorXd & | d | ) |
Set the diagonal to d
Definition at line 37 of file DiagonalLinearFunction.cpp.
void ocra::DiagonalLinearFunction::changeDiagonal | ( | const double | diagonalElementValue, |
const bool | changeDefault = true |
||
) |
Set the diagonal to diagonalElementValue and the default diagonal value to the same value if changeDefault is true. Calls buildA which triggers a EVT_CHANGE_VALUE event.
Definition at line 45 of file DiagonalLinearFunction.cpp.
|
protectedvirtual |
Does what it tells...
Reimplemented from ocra::Function.
Definition at line 150 of file DiagonalLinearFunction.cpp.
|
protectedvirtual |
Methods to be called in ChangeA and Change b
Reimplemented from ocra::LinearFunction.
Reimplemented in ocra::IdentityFunction.
Definition at line 91 of file DiagonalLinearFunction.cpp.
|
protectedvirtual |
Reimplemented in ocra::BoundFunction, and ocra::IdentityFunction.
Definition at line 84 of file DiagonalLinearFunction.cpp.
|
protectedvirtual |
Reimplemented in ocra::BoundFunction, and ocra::IdentityFunction.
Definition at line 78 of file DiagonalLinearFunction.cpp.
|
protectedvirtual |
Reimplemented in ocra::BoundFunction, and ocra::IdentityFunction.
Definition at line 64 of file DiagonalLinearFunction.cpp.
|
protectedvirtual |
Reimplemented in ocra::BoundFunction, and ocra::IdentityFunction.
Definition at line 70 of file DiagonalLinearFunction.cpp.
|
protectedvirtual |
Methods for pre and post update in case the dimension of the function has changed. Default implementation of doUpdateDimensionEnd does nothing, doUpdateDimensionBegin throws an exception. These methods might throw exceptions when overloaded. Furthermore, doUpdateDimensionEnd()
must comply with the post condition of updateDimension()
, i.e. let the values of each ability invalidated.
Reimplemented from ocra::Function.
Definition at line 155 of file DiagonalLinearFunction.cpp.
|
protectedvirtual |
Methods for pre and post update in case the variable size has changed. Default implementation of doUpdateInputSizeEnd does nothing, doUpdateInputSizeBegin throws an exception. These methods might throw exceptions when overloaded. Furthermore, doUpdateInputSizeEnd()
must comply with the post condition of updateInputSize()
, i.e. let the values of each ability invalidated.
Reimplemented from ocra::Function.
Reimplemented in ocra::IdentityFunction.
Definition at line 105 of file DiagonalLinearFunction.cpp.
|
protectedvirtual |
This methods ensures _b has the good size at the end of a resize, yet it will not be called in LinearFunction itself because the class does not overload doUpdateInputSizeBegin() which throws an runtime_error by default.
Reimplemented from ocra::LinearFunction.
Reimplemented in ocra::IdentityFunction.
Definition at line 136 of file DiagonalLinearFunction.cpp.
|
inline |
Definition at line 239 of file DiagonalLinearFunction.h.
|
inline |
Definition at line 233 of file DiagonalLinearFunction.h.
|
inline |
Trivial getters.
Definition at line 227 of file DiagonalLinearFunction.h.
|
inline |
Definition at line 245 of file DiagonalLinearFunction.h.
|
protectedvirtual |
Overloads of the Function methods
Reimplemented from ocra::LinearFunction.
Reimplemented in ocra::IdentityFunction.
Definition at line 99 of file DiagonalLinearFunction.cpp.
|
protected |
Definition at line 148 of file DiagonalLinearFunction.h.
|
protected |
Definition at line 150 of file DiagonalLinearFunction.h.
|
protected |
Definition at line 149 of file DiagonalLinearFunction.h.
|
protected |
Definition at line 151 of file DiagonalLinearFunction.h.