Repository navigation
Set test for when to update a ReducedFunctionalMat - #281
Draft
JHopeCollins wants to merge 3 commits into
Draft
JHopeCollins wants to merge 3 commits into
JHopeCollins wants to merge 3 commits into
Conversation
JHopeCollins
commented
Oct 22, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For the
ReducedFunctionalMatactions to be correct theReducedFunctionalmust have been last evaluated at the correct state. To ensure this, theupdatemethod passed as a callback to TAO evaluated the forward and derivative of theReducedFunctional.However, for a standard Newton solver the Hessian matrix uses the same
ReducedFunctionalas the outer solver, so with no linesearch or a simple backtracking search (armijo) the last re-evaluation and gradient calculation before the Hessian solve is at the correct state so there is no need for the matrix to duplicate these calculations.This PR adds a PETSc option to tell the Mat when to update it's own
ReducedFunctional:-mat_rf_update_schedule always: update every time (the current behaviour and the default).-mat_rf_update_schedule never: never update, assume the RF is always at the correct state.-mat_rf_update_schedule when_changed: the Mat will calculate the difference of the ReducedFunctional's current state and the new state passed by TAO, and will only update if they are different. The threshold for updating can be specified with-mat_rf_update_eps eps