cartan_core/lib.rs
1// ~/cartan/cartan-core/src/lib.rs
2
3//! # cartan-core
4//!
5//! Core trait definitions for Riemannian geometry.
6//!
7//! This crate defines the foundational traits that all cartan manifolds,
8//! optimizers, and tools depend on. It has minimal dependencies (only `rand`
9//! for the Rng trait bound) and can be used standalone by downstream crates
10//! that want to implement custom manifolds against the cartan trait system.
11//!
12//! ## Trait hierarchy
13//!
14//! ```text
15//! Manifold (base: exp, log, inner, project, validate)
16//! |
17//! +-- Retraction (cheaper exp approximation)
18//! +-- ParallelTransport -> VectorTransport (blanket impl)
19//! +-- Connection (Riemannian Hessian)
20//! | |
21//! | +-- Curvature (Riemann tensor, Ricci, scalar)
22//! +-- GeodesicInterpolation (gamma(t) sampling)
23//! ```
24//!
25//! ## The `Real` type alias
26//!
27//! All floating-point computation uses `Real`, currently aliased to `f64`.
28//! This exists so that a future version can generify over `T: Scalar`
29//! with a mechanical find-and-replace refactor.
30
31#![cfg_attr(not(feature = "std"), no_std)]
32
33#[cfg(feature = "alloc")]
34extern crate alloc;
35
36pub mod connection;
37pub mod curvature;
38pub mod error;
39pub mod geodesic;
40pub mod manifold;
41pub mod retraction;
42pub mod transport;
43
44/// The floating-point type used throughout cartan.
45///
46/// Currently f64. Designed so that replacing this alias with a generic
47/// type parameter `T: Scalar` is a mechanical refactor when f32 support
48/// is needed. All structs and functions use `Real` instead of `f64` directly.
49pub type Real = f64;
50
51// Re-exports for convenience.
52pub use connection::Connection;
53pub use curvature::Curvature;
54pub use error::CartanError;
55pub use geodesic::GeodesicInterpolation;
56pub use manifold::Manifold;
57pub use retraction::Retraction;
58pub use transport::{ParallelTransport, VectorTransport};