Support dense Jacobians and Hessians#537
Conversation
| Jx = jac(nlp, x) | ||
|
|
||
| Evaluate ``J(x)``, the constraints Jacobian at `x` as a sparse matrix. | ||
| This function is only available if `nlp.meta.jac_available` is set to `true`. | ||
| This function is only available when both `nlp.meta.jac_available` and `nlp.meta.sparse_jacobian` are set to `true`. |
There was a problem hiding this comment.
why not have this return a dense matrix when sparse_jacobian is false?
There was a problem hiding this comment.
Because we don't know the format of the dense matrix.
S is the storage type of the vectors in the model, not the matrix format for the Jacobian / Hessian.
| Evaluate ``J(x)``, the constraints Jacobian at `x` in sparse coordinate format, rewriting `vals`. | ||
| Evaluate ``J(x)``, the constraints Jacobian at `x`, overwriting `vals`. | ||
| It uses a sparse coordinate format when `nlp.meta.sparse_jacobian` is set to `true`. | ||
| Otherwise, `vals` is expected to be a dense matrix. |
There was a problem hiding this comment.
I think it's slightly misleading, as the name _coord implies that the Jacobian is returned as a COO matrix, not a dense matrix
There was a problem hiding this comment.
Hum, you are right.
Maybe we go back to the original issue and we need to add a jac_dense! and hess_dense! for consistency with the sparse API.
There was a problem hiding this comment.
I updated the API for jac_dense! and hess_dense!.
|
@frapac May I ask you another review? |
close #458
cc @klamike @frapac @sshin23
Reference: #376
It can replace the PRs #378 and #512