Riemannian optimization
Module: sci_form::riemannian (core since 2026-10-14; beta::riemannian re-export) Feature flag: none (core); beta-riemannian kept as no-op alias
Validation and limits
| Question | Answer |
|---|---|
| Compared with | NumPy + SciPy L-BFGS-B |
| Measured separation | projection 8.2e-12; Frobenius distance 2.2e-16; objective/gradient 1.2e-16 |
| Confidence region | small positive-semidefinite matrices and ETKDG objectives |
| Main limitation | psd_distance is a Frobenius proxy, not the affine-invariant geodesic; the retraction is first-order |
The raw rows and the exact tolerances are in the full validation matrix.
Overview
Replaces the Euclidean BFGS optimizer in the embedding step with Riemannian L-BFGS over the manifold of fixed-rank positive semidefinite (PSD) matrices. Negative eigenvalues are eliminated by design, reducing the retry loop failure rate to zero.
Theory
PSD Manifold
The metric matrix
Retraction
The retraction maps a tangent vector back to the manifold:
where
Riemannian Gradient
The Euclidean gradient is projected to the tangent space:
For the Stiefel manifold:
L-BFGS on the Manifold
- Store
curvature pairs in the tangent space - Two-loop recursion with vector transport along geodesics
- Line search with Armijo condition along the manifold geodesic
API
use sci_form::riemannian::*;
// PSD projection
let (projected, n_neg) = psd_projection(&matrix);
// Retraction (first-order): P₊(X + ξ)
let retracted = psd_retraction(&x, &xi);
// Full L-BFGS optimization under distance bounds
let config = RiemannianConfig {
max_iter: 500,
grad_tol: 1e-6,
..Default::default()
};
let opt = RiemannianLbfgs::new(config);
let result = opt.optimize(&x0, &constraints);
// result.metric_matrix, result.objective, result.convergedConvergence
- Primary:
- Secondary: Maximum distance violation
Å - Fallback: Reverts to Euclidean BFGS + PSD projection if not converged in 500 iterations
Validation (F94, 2026-10-14)
External gate tests/beta_riemannian_validation.rs vs scripts/validation/oracle_riemannian.py (numpy + scipy L-BFGS-B): projection 8.2e-12, Frobenius distance 2.2e-16, objective/gradient 1.2e-16, optimizer reaches the feasible set like scipy. Documented gap: psd_distance is the Frobenius proxy, NOT the affine-invariant geodesic distance (geomstats cross-check unmet). Note: the implemented retraction is first-order P₊(X+ξ), not the second-order form once sketched in Theory.
Tests
cargo test --features "beta-cpm beta-riemannian" --test experimental_gates -- test_riemannian11 integration tests (tests/experimental/test_riemannian.rs) covering: PSD projection correctness, retraction stays on manifold, Riemannian gradient orthogonality, L-BFGS convergence on Rosenbrock and distance geometry objectives.
These tests live in the experimental_gates target — see Overview for the full command matrix.