13 #ifndef _OCRABASE_DIAGONAL_LINEAR_FUNCTION_H_ 14 #define _OCRABASE_DIAGONAL_LINEAR_FUNCTION_H_ 74 template<
class VectorBase1,
class VectorBase2>
76 const bool useDefaultValue =
false,
const double defaultDiagValue = 1.,
77 const double defaultbValue = 0.);
79 template<
class VectorBase>
81 const bool useDefaultValue =
false,
const double defaultbValue = 0.);
83 template<
class VectorBase>
85 const bool useDefaultValue =
false,
const double defaultDiagValue = 1.);
88 const bool useDefaultValue =
false);
116 void changeDiagonal(
const double diagonalElementValue,
const bool changeDefault =
true);
132 virtual void doChangeDiagonal(
const double diagonalElementValue,
const bool changeDefault =
true);
136 virtual void doChangeA(
const MatrixXd& A);
155 template <
class VectorBase1,
class VectorBase2>
156 inline DiagonalLinearFunction::DiagonalLinearFunction(
Variable&
x,
const VectorBase1& d,
const VectorBase2& b,
157 const bool useDefaultValue,
const double defaultDiagValue,
158 const double defaultbValue)
170 if (d.size() !=
_dim)
171 throw std::runtime_error(
"[ocra::DiagonalLinearFunction::DiagonalLinearFunction] Size of diagonal d doesn't match the variable size");
173 if (b.size() !=
_dim)
174 throw std::runtime_error(
"[ocra::DiagonalLinearFunction::DiagonalLinearFunction] Size of b doesn't match the variable size");
182 template <
class VectorBase>
183 inline DiagonalLinearFunction::DiagonalLinearFunction(
Variable&
x,
const double diagonalElementValue,
const VectorBase& b,
184 const bool useDefaultValue,
const double defaultbValue)
194 if (b.size() !=
_dim)
195 throw std::runtime_error(
"[ocra::DiagonalLinearFunction::DiagonalLinearFunction] Size of b doesn't match the variable size");
198 _d.setConstant(diagonalElementValue);
204 template <
class VectorBase>
205 inline DiagonalLinearFunction::DiagonalLinearFunction(
Variable&
x,
const VectorBase& d,
const double vectorElementValue,
206 const bool useDefaultValue,
const double defaultDiagValue)
216 if (d.size() !=
_dim)
217 throw std::runtime_error(
"[ocra::DiagonalLinearFunction::DiagonalLinearFunction] Size of diagonal d doesn't match the variable size");
221 _b.setConstant(vectorElementValue);
254 #endif //_OCRABASE_DIAGONAL_LINEAR_FUNCTION_H_
virtual void doChangeDefaultbValue(const double v)
void doUpdateDimensionBegin(int newDimension)
LinearFunction functionType_t
void changeDiagonal(const VectorXd &d)
double _defaultDiagonalValue
void changeb(const VectorXd &b)
void testDiagonalLinearFunction()
void changeDefaultDiagonalValue(const double v)
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
virtual void doChangeDefaultDiagonalValue(const double v)
Declaration file of the LinearFunction class.
double getDefaultbValue() const
This class represents a variable in a mathematical sense.
int computeDimensionFromInputSize() const
bool isUsingDefaultValue() const
virtual void doUpdateInputSizeEnd()
virtual void doUpdateInputSizeBegin()
const VectorXd & getDiagonal() const
virtual void doChangeA(const MatrixXd &A)
virtual void doChangeDiagonal(const VectorXd &d)
#define ocra_assert(ocra_expression)
void changeDefaultbValue(const double v)
#define OCRA_STATIC_ASSERT_VECTOR_OR_DYNAMIC_MATRIX(TYPE)
double getDefaultDiagonalValue() const
virtual void updateValue() const
DiagonalLinearFunction class.