| 132 | } |
| 133 | |
| 134 | void PythonModel::evaluate_jacobian(const Vector<double>& x, double* jacobian_values) const { |
| 135 | if (this->user_model.jacobian.has_value()) { |
| 136 | const auto x_py = to_const_array(x.data(), this->number_variables); |
| 137 | auto jacobian_py = to_array(jacobian_values, this->number_jacobian_nonzeros()); |
| 138 | |
| 139 | // evaluate Jacobian |
| 140 | try { |
| 141 | (*this->user_model.jacobian)(x_py, jacobian_py); |
| 142 | ++this->number_model_evaluations.jacobian; |
| 143 | } |
| 144 | catch (const std::exception&) { |
| 145 | throw GradientEvaluationError(); |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | void PythonModel::evaluate_lagrangian_hessian(const Vector<double>& x, double objective_multiplier, const Vector<double>& multipliers, |
| 151 | double* hessian_values) const { |
nothing calls this directly
no test coverage detected