From 52039ee51bf62ac91fd29e2cc24520f2129cde81 Mon Sep 17 00:00:00 2001 From: Thomas Lynn <32374143+lynntf@users.noreply.github.com> Date: Mon, 1 Apr 2024 16:12:24 +0200 Subject: [PATCH] Add clarity to jacobian/hessianstructure methods Original tutorial is not entirely clear on what the jacobian/hessian jacobian/hessianstructure methods should return when providing them as sparse matrices. --- docs/source/tutorial.rst | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst index c0a06729..fe0a8300 100644 --- a/docs/source/tutorial.rst +++ b/docs/source/tutorial.rst @@ -253,15 +253,18 @@ methods should return the non-zero values of the respective matrices as flattened arrays. The hessian should return a flattened lower triangular matrix. -The Jacobian and Hessian can be dense or sparse. If sparse, you must also -define: +The Jacobian and Hessian can be dense or sparse. If sparse, +:func:`cyipopt.Problem.jacobian` and :func:`cyipopt.Problem.hessian` methods +should return only the non-zero values of the respective matrices and you must +also define: - :func:`cyipopt.Problem.jacobianstructure` - :func:`cyipopt.Problem.hessianstructure` -which should return a tuple of indices that indicate the location of the -non-zero values of the Jacobian and Hessian matrices, respectively. If not -defined then these matrices are assumed to be dense. +which should return a tuple of indices (row indices, column indices) that +indicate the location of the non-zero values of the Jacobian and Hessian +matrices, respectively. If not defined then these matrices are assumed to be +dense. The :func:`cyipopt.Problem.intermediate` method is called every Ipopt iteration algorithm and can be used to perform any needed computation at each iteration.