Skip to content

Fix OptimizationManopt Hessian on matrix-valued manifolds - #1338

Draft
SebastianM-C wants to merge 1 commit into
masterfrom
manopt-hessian-matrix-points
Draft

Fix OptimizationManopt Hessian on matrix-valued manifolds#1338
SebastianM-C wants to merge 1 commit into
masterfrom
manopt-hessian-matrix-points

Conversation

@SebastianM-C

Copy link
Copy Markdown
Member

Fixes #1036.

Problem

TrustRegionsOptimizer and AdaptiveRegularizationCubicOptimizer threw a DimensionMismatch on any manifold whose points are matrices (Stiefel, SymmetricPositiveDefinite, ...). build_hessF allocated the Euclidean gradient and Hessian-vector buffers as flat length(θ) vectors, which breaks the projection inside ManifoldDiff.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_hessF allocates with zero(θ) so buffers keep the point's shape.
  • When no hv is available the Hessian-vector product is assembled from a dense user-supplied hess; with no second-order information at all it returns nothing, so Manopt uses its own approximate Hessian instead of a closure that would throw on nothing.
  • The stale test TODOs are replaced by a Stiefel regression testset covering AD, hess-only and grad-only, plus a check of the converted Hessian against riemannian_Hessian with exact Euclidean inputs.
  • The Manopt docs gain a section on how Euclidean derivatives are converted and where second-order information is taken from.

Not addressed: requireshessian still makes OptimizationBase prepare a dense Hessian that Manopt never evaluates. That needs an allowshv-style trait in SciMLBase and is left for a follow-up.

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with OptimizationManopt initial Hessian

1 participant