Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sparse routines sobj and sgrad #78

Merged
merged 5 commits into from May 3, 2024

Conversation

jfowkes
Copy link
Owner

@jfowkes jfowkes commented Apr 9, 2024

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.

  • Add C interfaces for sobj,sgrad to c_interfaces.py
  • Add Python interfaces for sobj,sgrad to problem_class.py
  • Write comprehensive unit tests for sobj,sgrad
  • Write documentation for sobj,sgrad

@jfowkes jfowkes added the enhancement New feature or request label Apr 9, 2024
@jfowkes jfowkes added this to the PyCUTEst 1.7 milestone Apr 9, 2024
@jfowkes jfowkes self-assigned this Apr 9, 2024
@jfowkes jfowkes linked an issue Apr 9, 2024 that may be closed by this pull request
@jfowkes jfowkes force-pushed the 73-add-missing-sparse-routines-sobj-sgrad branch 3 times, most recently from c169db9 to a9aae3f Compare April 9, 2024 15:21
@jfowkes jfowkes force-pushed the 73-add-missing-sparse-routines-sobj-sgrad branch from a9aae3f to b627807 Compare April 22, 2024 12:44
@jfowkes
Copy link
Owner Author

jfowkes commented Apr 25, 2024

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

@jfowkes jfowkes force-pushed the 73-add-missing-sparse-routines-sobj-sgrad branch from 39e969d to c5d5ba3 Compare April 25, 2024 08:27
@jfowkes
Copy link
Owner Author

jfowkes commented May 1, 2024

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 jfowkes marked this pull request as ready for review May 1, 2024 09:26
@jfowkes jfowkes requested a review from lindonroberts May 1, 2024 09:26
@jfowkes
Copy link
Owner Author

jfowkes commented May 1, 2024

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

@lindonroberts
Copy link
Collaborator

Looks good to me!

@lindonroberts lindonroberts merged commit a95e94b into master May 3, 2024
8 checks passed
@jfowkes jfowkes deleted the 73-add-missing-sparse-routines-sobj-sgrad branch May 7, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add missing sparse routines (sobj, sgrad)
2 participants