MCPcopy Create free account
hub / github.com/cvanaret/Uno / evaluate_jacobian

Method evaluate_jacobian

interfaces/Python/cpp_classes/PythonModel.cpp:134–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 5

to_const_arrayFunction · 0.85
to_arrayFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected