13 #ifndef _OCRABASE_DOUBLE_DIAGONAL_LINEAR_FUNCTION_H_ 14 #define _OCRABASE_DOUBLE_DIAGONAL_LINEAR_FUNCTION_H_ 44 template<
class VectorBase1,
class VectorBase2,
class VectorBase3>
46 const bool useDefaultValue =
false,
const double defaultDiagValue1 = 1.,
const double defaultDiagValue2 = 1.,
47 const double defaultbValue = 0.);
49 template<
class VectorBase>
51 const bool useDefaultValue =
false,
const double defaultbValue = 0.);
53 template<
class VectorBase1,
class VectorBase2>
55 const bool useDefaultValue =
false,
const double defaultValue1 = 1.,
const double defaultValue2 = 1.);
58 const bool useDefaultValue =
false);
71 virtual void changeDiagonal1(
const double diagonalElementValue,
const bool changeDefault =
true);
72 virtual void changeDiagonal2(
const double diagonalElementValue,
const bool changeDefault =
true);
85 virtual void doChangeA(
const MatrixXd& A);
106 template<
class VectorBase1,
class VectorBase2,
class VectorBase3>
107 inline DoubleDiagonalLinearFunction::DoubleDiagonalLinearFunction(
Variable&
x,
108 const VectorBase1& d1,
const VectorBase2& d2,
const VectorBase3& b,
109 const bool useDefaultValue,
const double defaultDiagValue1,
const double defaultDiagValue2,
110 const double defaultbValue)
127 if (d1.size() !=
_dim)
128 throw std::runtime_error(
"[ocra::DoubleDiagonalLinearFunction::DoubleDiagonalLinearFunction] Size of diagonal d1 doesn't match the function dimension");
130 if (d2.size() !=
_dim)
131 throw std::runtime_error(
"[ocra::DoubleDiagonalLinearFunction::DoubleDiagonalLinearFunction] Size of diagonal d2 doesn't match the function dimension");
133 if (b.size() !=
_dim)
134 throw std::runtime_error(
"[ocra::DoubleDiagonalLinearFunction::DoubleDiagonalLinearFunction] Size of b doesn't match the function dimension");
143 template<
class VectorBase>
144 inline DoubleDiagonalLinearFunction::DoubleDiagonalLinearFunction(
Variable&
x,
145 const double diagonalElementValue1,
const double diagonalElementValue2,
const VectorBase& b,
146 const bool useDefaultValue,
const double defaultbValue)
159 if (b.size() !=
_dim)
160 throw std::runtime_error(
"[ocra::DiagonalLinearFunction::DiagonalLinearFunction] Size of b doesn't match the function dimension");
163 _d1.setConstant(diagonalElementValue1);
165 _d2.setConstant(diagonalElementValue2);
171 template<
class VectorBase1,
class VectorBase2>
172 inline DoubleDiagonalLinearFunction::DoubleDiagonalLinearFunction(
Variable&
x,
173 const VectorBase1& d1 ,
const VectorBase2& d2,
const double vectorElementValue,
174 const bool useDefaultValue,
const double defaultValue1,
const double defaultValue2)
189 if (d1.size() !=
_dim)
190 throw std::runtime_error(
"[ocra::DoubleDiagonalLinearFunction::DoubleDiagonalLinearFunction] Size of diagonal d1 doesn't match the function dimension");
192 if (d2.size() !=
_dim)
193 throw std::runtime_error(
"[ocra::DoubleDiagonalLinearFunction::DoubleDiagonalLinearFunction] Size of diagonal d2 doesn't match the function dimension");
199 _b.setConstant(vectorElementValue);
233 #endif //_OCRABASE_DOUBLE_DIAGONAL_LINEAR_FUNCTION_H_
virtual void doUpdateInputSizeBegin()
virtual void doUpdateInputSizeEnd()
DoubleDiagonalLinearFunction class.
void changeb(const VectorXd &b)
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
double getDefaultbValue() const
virtual void changeDefaultDiagonalValue1(const double v)
const VectorXd & getDiagonal2() const
void doUpdateDimensionBegin(int newDimension)
Declaration file of the LinearFunction class.
virtual void changeDiagonal1(const VectorXd &d)
bool isUsingDefaultValue() const
virtual void doChangeA(const MatrixXd &A)
This class represents a variable in a mathematical sense.
double _defaultDiagonalValue2
double getDefaultDiagonalValue1() const
virtual void updateValue() const
virtual void changeDefaultDiagonalValue2(const double v)
LinearFunction functionType_t
virtual void changeDiagonal2(const VectorXd &d)
#define ocra_assert(ocra_expression)
double _defaultDiagonalValue1
double getDefaultDiagonalValue2() const
#define OCRA_STATIC_ASSERT_VECTOR_OR_DYNAMIC_MATRIX(TYPE)
int computeDimensionFromInputSize() const
virtual void changeDefaultbValue(const double v)
const VectorXd & getDiagonal1() const