cartan

Correlation Matrix Manifold

The open set of symmetric positive definite matrices with unit diagonal. is a flat submanifold of the Euclidean space Sym(N); geodesics are straight lines and exp/log are exact.

ManifoldRetractionConnectionParallelTransportCurvatureGeodesicInterp.

Geometry Summary

PropertyValue
Points: symmetric PD, unit diagonal
Tangent at $C$
MetricFrobenius: (independent of $C$)
Dimension
Sectional curvature (flat)
Injectivity radius at (Weyl perturbation bound)
GeodesicsStraight lines in Sym(N):

Formula Reference

Flat geometry: the unit-diagonal constraint defines an affine subspace of Sym(N); intersecting with the open PD cone gives as an open subset of that affine space. All curvature vanishes.

Exponential map (exact, no truncation):

Logarithmic map (exact):

Parallel transport (flat connection, identity):

Tangent projection (symmetrize, zero diagonal):

Point projection (nearest correlation matrix via Higham 2002):

Alternating projections with Dykstra's correction onto the PD cone and the unit-diagonal affine plane. Converges in $O(N^3)$ per iteration.

Code Examples

Constructing

use cartan::prelude::*;
use cartan::manifolds::Corr;
 
// Corr(3): 3x3 correlation matrices
let corr3 = Corr::<3>;
 
let mut rng = rand::rng();
let c = corr3.random_point(&mut rng);   // random correlation matrix
let v = corr3.random_tangent(&c, &mut rng);
 
// Tangent vectors have zero diagonal
assert!(v[(0,0)].abs() < 1e-12);
assert!(v[(1,1)].abs() < 1e-12);

Flat exp/log

// Exp and log are just addition and subtraction
let q = corr3.exp(&c, &v);  // = c + v
let v_back = corr3.log(&c, &q).unwrap();  // = q - c
assert!((v_back - v).norm() < 1e-14);

Curvature (identically zero)

let u = corr3.random_tangent(&c, &mut rng);
let w = corr3.random_tangent(&c, &mut rng);
 
let k = corr3.sectional_curvature(&c, &u, &w);
assert!(k.abs() < 1e-14);  // K ≡ 0
 
let scalar = corr3.scalar_curvature(&c);
assert!(scalar.abs() < 1e-14);

Point projection (nearest correlation matrix)

use nalgebra::SMatrix;
 
// An arbitrary symmetric matrix - not a valid correlation matrix
let mut m = SMatrix::<f64, 3, 3>::identity();
m[(0,1)] = 1.5; m[(1,0)] = 1.5;  // off-diagonal > 1 violates PD
 
let nearest = corr3.project_point(&m);
// nearest is the Frobenius-closest correlation matrix to m
assert!((nearest[(0,0)] - 1.0).abs() < 1e-10);  // unit diagonal restored

Numerical Notes

Injectivity radius: . The straight-line geodesic exits (hits the PD cone boundary) when . Always check that step sizes are below this threshold in optimization.

Projection convergence: project_point runs up to 500 iterations with tolerance . For well-conditioned inputs (off-diagonals ) it converges in under 20 iterations.

Flat connection: Parallel transport is the identity; no computation needed. This makes extremely cheap for optimization compared to curved manifolds.

Applications

  • Finance: correlation matrices in portfolio optimization and risk models
  • Statistics: Riemannian interpolation between sample covariances
  • fMRI connectivity: geodesic distances between brain connectivity matrices
  • Machine learning: Riemannian batch normalization on correlation features
  • Factor models: Fréchet mean of estimated correlation matrices