5 DoubleDiagonalLinearFunction::DoubleDiagonalLinearFunction(
Variable& x,
6 const double diagonalElementValue1,
const double diagonalElementValue2,
const double vectorElementValue,
7 const bool useDefaultValue)
12 , _useDefaultValue(useDefaultValue)
13 , _defaultDiagonalValue1(diagonalElementValue1)
14 , _defaultDiagonalValue2(diagonalElementValue2)
15 , _defaultbValue(vectorElementValue)
18 _d1.setConstant(diagonalElementValue1);
20 _d2.setConstant(diagonalElementValue2);
23 _b.setConstant(vectorElementValue);
30 throw std::runtime_error(
"[ocra::DoubleDiagonalLinearFunction::changeDiagonal1] Size of diagonal d doesn't match the function dimension");
38 throw std::runtime_error(
"[ocra::DoubleDiagonalLinearFunction::changeDiagonal2] Size of diagonal d doesn't match the function dimension");
45 _d1.setConstant(diagonalElementValue);
53 _d2.setConstant(diagonalElementValue);
94 throw std::runtime_error(
"[ocra::DoubleDiagonalLinearFunction::doUpdateSize] No default value to increase the size of A");
103 _b.head(oldDim) = tmpb;
108 _d1.head(oldDim) =
_jacobian.block(0,0,oldDim,oldDim).diagonal();
109 _d2.head(oldDim) =
_jacobian.block(0,oldDim,oldDim,oldDim).diagonal();
121 _d1 =
_jacobian.block(0,0,oldDim,oldDim).diagonal().head(dim);
122 _d2 =
_jacobian.block(0,oldDim,oldDim,oldDim).diagonal().head(dim);
133 ocra_assert(2*(
x.
getSize()/2) ==
x.
getSize() &&
"double diagonal linear function can only work with variables whose size is even.");
142 void DoubleDiagonalLinearFunction::buildA()
147 propagate<EVT_CHANGE_VALUE>();
const VectorXd & getValue() const
void changeA(const MatrixXd &A)
virtual void doUpdateInputSizeBegin()
virtual void doUpdateInputSizeEnd()
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
Declaration file of the DoubleDiagonalLinearFunction class.
virtual void changeDefaultDiagonalValue1(const double v)
void doUpdateDimensionBegin(int newDimension)
virtual void changeDiagonal1(const VectorXd &d)
virtual void doChangeA(const MatrixXd &A)
This class represents a variable in a mathematical sense.
double _defaultDiagonalValue2
virtual void updateValue() const
virtual void changeDefaultDiagonalValue2(const double v)
virtual void changeDiagonal2(const VectorXd &d)
#define ocra_assert(ocra_expression)
double _defaultDiagonalValue1
int computeDimensionFromInputSize() const
virtual void changeDefaultbValue(const double v)