9 #include <Eigen/StdVector> 23 template <
int IN_DIM,
int OUT_DIM,
typename SCALAR =
double>
27 typedef Eigen::Matrix<double, IN_DIM, 1>
IN_TYPE;
28 typedef Eigen::Matrix<double, OUT_DIM, 1>
OUT_TYPE;
29 typedef Eigen::Matrix<double, OUT_DIM, IN_DIM>
JAC_TYPE;
30 typedef Eigen::Matrix<double, IN_DIM, IN_DIM>
HES_TYPE;
49 throw std::runtime_error(
"FUNCTION EVALUATION NOT IMPLEMENTED FOR THIS TYPE OF DERIVATIVE");
59 virtual JAC_TYPE
jacobian(
const Eigen::VectorXd& x)
61 throw std::runtime_error(
"JACOBIAN EVALUATION NOT IMPLEMENTED FOR THIS TYPE OF DERIVATIVE");
74 Eigen::VectorXi& iRow,
75 Eigen::VectorXi& jCol)
77 throw std::runtime_error(
"SPARSE JACOBIAN EVALUATION NOT IMPLEMENTED FOR THIS TYPE OF DERIVATIVE");
89 throw std::runtime_error(
"SPARSE JACOBIAN EVALUATION NOT IMPLEMENTED FOR THIS TYPE OF DERIVATIVE");
103 virtual HES_TYPE
hessian(
const Eigen::VectorXd& x,
const Eigen::VectorXd& lambda)
105 throw std::runtime_error(
"HESSIAN EVALUATION NOT IMPLEMENTED FOR THIS TYPE OF DERIVATIVE");
119 const Eigen::VectorXd& lambda,
120 Eigen::VectorXd& hes,
121 Eigen::VectorXi& iRow,
122 Eigen::VectorXi& jCol)
124 throw std::runtime_error(
"SPARSE HESSIAN NOT IMPLEMENTED FOR THIS TYPE OF DERIVATIVE");
137 throw std::runtime_error(
"SPARSE HESSIAN EVALUATION NOT IMPLEMENTED FOR THIS TYPE OF DERIVATIVE");
virtual Eigen::VectorXd sparseHessianValues(const Eigen::VectorXd &x, const Eigen::VectorXd &lambda)
Returns the non zero elements of the hessian of the problem.
Definition: Derivatives.h:135
virtual Eigen::VectorXd sparseJacobianValues(const Eigen::VectorXd &x)
Returns the non zero values of the jacobian.
Definition: Derivatives.h:87
virtual Derivatives< IN_DIM, OUT_DIM, SCALAR > * clone() const =0
deep copy for derived classes
Derivatives()
Definition: Derivatives.h:32
Eigen::Matrix< double, IN_DIM, 1 > IN_TYPE
function input vector type
Definition: Derivatives.h:27
virtual OUT_TYPE forwardZero(const Eigen::VectorXd &x)
Evaluates the method itself.
Definition: Derivatives.h:47
virtual void sparseJacobian(const Eigen::VectorXd &x, Eigen::VectorXd &jac, Eigen::VectorXi &iRow, Eigen::VectorXi &jCol)
Returns the evaluated jacobian in sparse format.
Definition: Derivatives.h:72
Eigen::Matrix< double, OUT_DIM, 1 > OUT_TYPE
function output vector type
Definition: Derivatives.h:28
virtual void sparseHessian(const Eigen::VectorXd &x, const Eigen::VectorXd &lambda, Eigen::VectorXd &hes, Eigen::VectorXi &iRow, Eigen::VectorXi &jCol)
Returns the weighted sum of hessian of the problem in sparse format.
Definition: Derivatives.h:118
General interface class for a Derivatives.
Definition: Derivatives.h:24
Eigen::Matrix< double, IN_DIM, IN_DIM > HES_TYPE
Definition: Derivatives.h:30
virtual ~Derivatives()
default destructor
Definition: Derivatives.h:35
Eigen::Matrix< double, OUT_DIM, IN_DIM > JAC_TYPE
Definition: Derivatives.h:29
virtual JAC_TYPE jacobian(const Eigen::VectorXd &x)
Evaluates the jacobian with respect to the input.
Definition: Derivatives.h:59
virtual HES_TYPE hessian(const Eigen::VectorXd &x, const Eigen::VectorXd &lambda)
Evaluates the hessian (2nd order derivatives with respect to input) of the method. In case of a vector valued function, the method returns the weighted sum of the hessians with weights w.
Definition: Derivatives.h:103