Add reduced Hessian operator and Newton driver#68
Open
krystophny wants to merge 40 commits into
Open
Conversation
9b589db to
b89316f
Compare
17 tasks
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.
Adds the exact reduced boundary Hessian and a second-order optimizer driver.
BoundarySensitivityProblem.reduced_hessian_vector_product: Schur complementH_BB - H_BI H_II^-1 H_IBassembled from exact Enzyme HVPs (two full-space residual JVPs plus one preconditioned interior GMRES solve per matvec). Exact reduced Hessian of the equilibrium-constrained energy at a force-balance equilibrium; the docstring states the validity limit away from one.GvecEnergyProblem.hessian_vector_product(x, v): solves the equilibrium atxand applies the reduced Hessian there, with the same failed-solve penalty contract as value and gradient.optimize_energy_newton: boundedtrust-constrNewton using analytic value, adjoint gradient, and reduced-Hessianhessp; no finite differences anywhere in the chain on Enzyme builds.Closes no new issue; extends #23/#24 machinery to second order.
Verification
Before
No reduced Hessian existed; second-order optimizers had to build
hesspby finite differences of the adjoint gradient (one extra equilibrium solve per Hessian column or matvec).After
Enzyme-on isolated build (fixed RZ, LLVM/Flang 22.1.6):
test_reduced_hessian_symmetric_and_matches_gradient_fdchecks<u, H v> = <v, H u>atrtol=1e-6and the reduced HVP against a centered difference of the adjoint boundary gradient with full equilibrium re-solves (cosine > 0.99,rtol=5e-2, limited by the interior solve floor).test_newton_optimizer_reduces_energyruns the bounded trust-region Newton end to end.Enzyme-off isolated build (FD fallback path):