Fix OptimizationManopt Hessian on matrix-valued manifolds - #1338
Draft
SebastianM-C wants to merge 1 commit into
Draft
Fix OptimizationManopt Hessian on matrix-valued manifolds#1338SebastianM-C wants to merge 1 commit into
SebastianM-C wants to merge 1 commit into
Conversation
build_hessF allocated the Euclidean gradient and Hessian-vector buffers as flat length(θ) vectors, so riemannian_Hessian! failed with a DimensionMismatch for any manifold whose points are matrices (Stiefel, SPD, ...). Allocate them with zero(θ) instead, assemble the Hessian-vector product from a dense user `hess` when no `hv` is available, and return `nothing` when there is no second-order information so Manopt falls back to its approximate Hessian. Replace the stale test TODOs with a matrix-manifold regression test and document how Euclidean derivatives are converted for Manopt. Fixes #1036 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Fixes #1036.
Problem
TrustRegionsOptimizerandAdaptiveRegularizationCubicOptimizerthrew aDimensionMismatchon any manifold whose points are matrices (Stiefel,SymmetricPositiveDefinite, ...).build_hessFallocated the Euclidean gradient and Hessian-vector buffers as flatlength(θ)vectors, which breaks the projection insideManifoldDiff.riemannian_Hessian!. The Euclidean tests carrying the TODO from #1009 pass and produce the correct Hessian-vector product, so the failure only shows once points stop being vectors, which nothing in the test suite exercised.Changes
build_hessFallocates withzero(θ)so buffers keep the point's shape.hvis available the Hessian-vector product is assembled from a dense user-suppliedhess; with no second-order information at all it returnsnothing, so Manopt uses its own approximate Hessian instead of a closure that would throw onnothing.hess-only andgrad-only, plus a check of the converted Hessian againstriemannian_Hessianwith exact Euclidean inputs.Not addressed:
requireshessianstill makes OptimizationBase prepare a dense Hessian that Manopt never evaluates. That needs anallowshv-style trait in SciMLBase and is left for a follow-up.🤖 Generated with Claude Code