| 116 | } |
| 117 | |
| 118 | void PythonModel::compute_hessian_sparsity(uno_int *row_indices, uno_int *column_indices, uno_int solver_indexing) const { |
| 119 | // copy the indices of the user sparsity patterns to the Uno vectors |
| 120 | const size_t number_hessian_nonzeros = this->number_hessian_nonzeros(); |
| 121 | std::copy_n(this->user_model.hessian_row_indices.data(), number_hessian_nonzeros, row_indices); |
| 122 | std::copy_n(this->user_model.hessian_column_indices.data(), number_hessian_nonzeros, column_indices); |
| 123 | |
| 124 | // handle the solver indexing |
| 125 | if (this->user_model.base_indexing != solver_indexing) { |
| 126 | const int indexing_difference = solver_indexing - this->user_model.base_indexing; |
| 127 | for (size_t index: Range(number_hessian_nonzeros)) { |
| 128 | row_indices[index] += indexing_difference; |
| 129 | column_indices[index] += indexing_difference; |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | void PythonModel::evaluate_jacobian(const Vector<double>& x, double* jacobian_values) const { |
| 135 | if (this->user_model.jacobian.has_value()) { |
nothing calls this directly
no test coverage detected