1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// ~/cartan/cartan-core/src/curvature.rs
//! The `Curvature` trait: Riemann curvature tensor and derived quantities.
//!
//! Riemannian curvature measures how much the manifold deviates from being
//! flat. It appears in:
//! - Geodesic deviation (Jacobi equation)
//! - Error bounds for optimization algorithms (convergence rates depend on
//! sectional curvature bounds)
//! - Comparison geometry (Toponogov's theorem, Bishop-Gromov volume comparison)
//!
//! ## Curvature quantities
//!
//! Starting from the Riemann curvature tensor R(X, Y)Z (a (1,3)-tensor),
//! one derives:
//!
//! - **Sectional curvature** K(sigma) for a 2-plane sigma = span{X, Y}:
//! K(sigma) = <R(X,Y)Y, X> / (<X,X><Y,Y> - <X,Y>^2).
//! Controls geodesic spreading: K > 0 makes geodesics converge (sphere),
//! K < 0 makes them diverge (hyperbolic space), K = 0 flat (Euclidean).
//!
//! - **Ricci curvature** Ric(X, Y): trace of Z -> R(Z, X)Y.
//! Appears in volume comparison and Ricci flow.
//!
//! - **Scalar curvature** s: trace of the Ricci tensor.
//!
//! ## Known values for v0.1 manifolds
//!
//! - Sphere S^{N-1}: K = 1 (constant sectional curvature)
//! - Hyperbolic H^N: K = -1 (constant sectional curvature)
//! - SO(N) (bi-invariant): K(X,Y) = (1/4)||\[X,Y\]||^2 / (||X||^2 ||Y||^2 - <X,Y>^2)
//! - SPD(N) (affine-invariant): K <= 0 (non-positive, Cartan-Hadamard manifold)
//! - Grassmann Gr(n,k): 0 <= K <= 2 (between 0 and 2)
//! - Euclidean R^N: K = 0 everywhere
//!
//! ## References
//!
//! - do Carmo. "Riemannian Geometry." Chapter 4 (curvature tensor), Chapter 5 (sectional).
//! - Milnor. "Curvatures of Left-Invariant Metrics on Lie Groups." Advances in Math, 1976.
//! - Bhatia. "Positive Definite Matrices." Princeton, 2007. Chapter 6 (curvature of SPD).
use crateReal;
use crateConnection;
/// A manifold with explicitly computable Riemannian curvature.
///
/// This trait provides the Riemann curvature tensor and derived scalar
/// quantities. It is useful for:
/// - Theoretical analysis (verifying curvature bounds for convergence proofs)
/// - Geodesic deviation simulation (Jacobi fields)
/// - Visualization (sectional curvature plots)
///
/// # Supertraiting Connection
///
/// Curvature requires Self: Connection because the curvature tensor is defined
/// via the Levi-Civita connection: R(X,Y)Z = nabla_X nabla_Y Z - nabla_Y nabla_X Z
/// - nabla_{\[X,Y\]} Z. Without the connection, curvature cannot be defined.