jfowkes / pycutest

Python interface to CUTEst
https://jfowkes.github.io/pycutest/
GNU General Public License v3.0
28 stars 11 forks source link

Add sparse routines sobj and sgrad #78

Closed jfowkes closed 6 months ago

jfowkes commented 7 months ago

Resolves #73

The official CUTEst MATLAB interface has the sparse routines:

Tool    CUTEst function   Purpose
--------------------------------------------------------------------------
sobj    uofg / cofsg      Evaluate objective function value
                          and its sparse gradient if requested
sgrad   ugr / cisgr       Evaluate objective function or
                          constraint gradient as a sparse vector

These are the sparse equivalents of our existing obj and grad routines.

This is an attempt to implement these in a similar way as done in MATLAB: https://github.com/ralna/CUTEst/blob/master/src/matlab/mcutest.c

Major caveat: CUTEst only supports sparse gradients for constrained problems, so we return dense gradients for unconstrained problems as in the MATLAB interface and convert them to scipy.sparse.coo_matrix.

jfowkes commented 7 months ago

There is a segfault on lines 458-461 of cisgr.F90, looks like an upstream bug to me.

jfowkes commented 6 months ago

There is a segfault on lines 458-461 of cisgr.F90, looks like an upstream bug to me.

This was indeed an upstream bug, and has now been fixed in CUTEst.

jfowkes commented 6 months ago

@lindonroberts this is now ready for you to review, should be a simple one.

lindonroberts commented 6 months ago

Looks good to me!