cartan

Curvature

CurvatureQuery<M> provides ergonomic access to the curvature quantities defined by the Curvature trait at a fixed point. Free functions sectional_at and scalar_at offer a more concise one-liner API.

Summary

MethodSignatureOutput
cq.riemann(u, v, w)tangent vector
cq.sectional(u, v)scalar
cq.ricci(u, v)scalar
cq.scalar()scalar
sectional_at(m, p, u, v)scalar (free function)
scalar_at(m, p)scalar (free function)

Requires M: Curvature.

Curvature Values by Manifold

ManifoldSectional Scalar Notes
Euclidean Flat
Sphere Constant positive
Bi-invariant metric
Flat submanifold
n/an/aCurvature not implemented
SPD(N)variesCartan-Hadamard

Code Examples

Struct API

use cartan::prelude::*;
use cartan::manifolds::Sphere;
use cartan_geo::CurvatureQuery;
 
let s2 = Sphere::<3>;
let mut rng = rand::rng();
let p = s2.random_point(&mut rng);
let u = s2.random_tangent(&p, &mut rng);
let v = s2.random_tangent(&p, &mut rng);
let w = s2.random_tangent(&p, &mut rng);
 
let cq = CurvatureQuery::new(&s2, p);
 
let k     = cq.sectional(&u, &v);   // K = 1 on S²
let ric   = cq.ricci(&u, &v);       // Ric(u,v) = (N-2)<u,v>
let s     = cq.scalar();            // S = (N-1)(N-2) = 2 on S²
let riem  = cq.riemann(&u, &v, &w); // R(u,v)w = <v,w>u - <u,w>v
 
assert!((k - 1.0).abs() < 1e-10);
assert!((s - 2.0).abs() < 1e-10);

Free function API

use cartan_geo::{sectional_at, scalar_at};
 
let k = sectional_at(&s2, &p, &u, &v);
let s = scalar_at(&s2, &p);

Numerical Notes

Sectional curvature of nearly parallel vectors: involves in the denominator (the area of the parallelogram). When and are nearly parallel, this approaches zero and the result is unreliable. cartan returns rather than NaN in this case.

M: Curvature bound: CurvatureQuery requires the manifold to implement Curvature. and Grassmann do not currently implement this trait; use per-manifold geometric formulas directly for those.

Applications

  • Comparison studies: curvature profiles across manifolds
  • Jacobi field initialization: curvature enters the Jacobi ODE
  • Algorithm analysis: convergence bounds for RGD/RCG depend on sectional curvature bounds