ocra-recipes
Doxygen documentation for the ocra-recipes repository
IdentityFunction.cpp
Go to the documentation of this file.
2 
3 
4 namespace ocra
5 {
6  IdentityFunction::IdentityFunction(Variable& x, bool resizable)
7  : NamedInstance("identity function")
9  , CoupledInputOutputSize(resizable)
11  , _resizable(resizable)
12  {
13  buildIdentity();
14  }
15 
16 
18  {
19  return _resizable;
20  }
21 
23  {
24  _value = x.getValue();
25  }
26 
28  {
29  if (!_resizable)
30  throw std::runtime_error("[ocra::IdentityFunction::doUpdateInputSizeBegin] Function was set to non-resizable");
31  }
32 
34  {
35  buildIdentity();
36  }
37 
38  void IdentityFunction::doChangeDiagonal(const VectorXd& d)
39  {
40  throw std::runtime_error("[ocra::IdentityFunction::changeDiagonal] invalid operation on IdentityFunction");
41  }
42 
43 
44  void IdentityFunction::doChangeDiagonal(const double diagonalElementValue, const bool changeDefault)
45  {
46  throw std::runtime_error("[ocra::IdentityFunction::changeDiagonal] invalid operation on IdentityFunction");
47  }
48 
49 
51  {
52  throw std::runtime_error("[ocra::IdentityFunction::changeDefaultDiagonalValue] invalid operation on IdentityFunction");
53  }
54 
55 
57  {
58  throw std::runtime_error("[ocra::IdentityFunction::changeDefaultbValue] invalid operation on IdentityFunction");
59  }
60 
61 
62  void IdentityFunction::doChangeA(const MatrixXd& A)
63  {
64  ocra_assert(A.isIdentity());
65 
67  }
68 
69 
70  void IdentityFunction::buildIdentity()
71  {
72  _jacobian.setIdentity();
73  _b.resize(_dim);
74  _b.setZero();
75  }
76 }
77 
78 // cmake:sourcegroup=Function
virtual void doChangeDefaultDiagonalValue(const double v)
Declaration file of the IdentityFunction class.
VectorXd & _value
Definition: Function.h:312
const VectorXd & getValue() const
Definition: Variable.cpp:94
virtual void doUpdateInputSizeEnd()
virtual void doChangeA(const MatrixXd &A)
virtual void doChangeDefaultbValue(const double v)
Variable & x
Definition: Function.h:309
virtual void doChangeDiagonal(const VectorXd &d)
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
MatrixXd & _jacobian
Definition: Function.h:313
virtual void doChangeA(const MatrixXd &A)
This class represents a variable in a mathematical sense.
Definition: Variable.h:105
virtual void doUpdateInputSizeBegin()
#define ocra_assert(ocra_expression)
Definition: ocra_assert.h:45
const int & _dim
Definition: Function.h:320
DiagonalLinearFunction class.
virtual void updateValue() const