Geometry API#
Every geometry is a directly importable class. Matrix geometries include the
metric in the class name so constructors follow the same convention as
GrassmannProjection. Capability metadata distinguishes exact geodesic
operations from numerical-local candidates and retraction proxies, and marks
whether automatic Hessian conversion is mathematically exact.
Core method contract#
For an array geometry with event shape M.shape, every point or tangent has
shape batch_shape + M.shape. Leading batch dimensions may broadcast; event
dimensions never broadcast and must match exactly. Product applies the same
rule independently to every leaf of its factor pytree.
Member |
Inputs |
Result and contract |
|---|---|---|
|
ambient point candidate |
Boolean over the inferable batch shape. A malformed event shape returns |
|
ambient array with exactly |
A finite manifold point satisfying |
|
point and tangent candidate |
Boolean over broadcast batch axes. Malformed or incompatible shapes return |
|
point and ambient vector |
A tangent satisfying |
|
point and two tangent vectors |
The Riemannian inner product over broadcast batch axes. |
|
point and tangent vector |
The nonnegative metric norm. |
|
point, tangent, and scalar or batched step |
A manifold point obtained from the documented retraction. |
|
point and tangent |
Exact exponential, numerical-local operation, or retraction proxy according to |
|
base and endpoint |
Local inverse of the advertised retraction. |
|
base and endpoint |
Exact, numerical-local, or proxy displacement according to |
|
two points |
Scalar per batch element with status reported by |
|
endpoints and source tangent |
A target tangent. |
|
point and ambient gradient |
Metric-dual tangent gradient. |
|
JAX key and static shape |
Samples shaped |
|
JAX key and point |
Tangent samples matching |
Array-valued coefficients in lincomb, retraction steps t, and tangent
scales follow leading batch dimensions only. GeoJAX appends singleton event
axes before multiplication, so a coefficient shaped batch_shape scales whole
tangent samples rather than coordinates. The same rule is applied recursively
to every Product leaf.
Numerical repairs use dtype-aware interior margins. A configured eps is
never allowed to disappear through float32 rounding, and fixed-rank repairs
place active singular values above the numerical-rank threshold. These repair
conventions do not redefine exact maps at genuine cut loci or manifold
boundaries.
Capability declarations are conservative. GeometryMixin certifies no exact
or isometric operation by default; exact geometries opt into
ExactGeometryMixin, while retraction geometries use
RetractionGeometryMixin. Product metadata is certified only if every factor
provides the corresponding guarantee.
Matrix Lie groups#
- class geojax.geometry.SpecialOrthogonal(size, *, atol=1e-06, eps=1e-12)#
Bases:
ExactGeometryMixinRotation group SO(n) with the Frobenius bi-invariant metric.
A point is an
n x nmatrixRsatisfyingR.T @ R = Ianddet(R) = 1. A tangent vector atRis represented in ambient form asR @ Omegafor a skew-symmetric matrixOmega.- Parameters:
size (int)
atol (float)
eps (float)
- project(A)#
Nearest proper orthogonal factor, differentiable at unique optima.
Repeated positive singular values and regular rank-(n-1) inputs are supported. On an orientation-reversing input, a tie in the smallest singular value makes the optimum nonunique and its derivative undefined; the primal still returns a selected closest rotation.
- Parameters:
A (Any)
- Return type:
Any
- retr(R, U, t=1.0)#
Default retraction: use the exponential map.
- Parameters:
R (Any)
U (Any)
t (float | Any)
- Return type:
Any
- squared_dist(R, Q)#
Squared geodesic distance, evaluated without differentiating
sqrt.Geometries with a more direct or more stable formula should override this method. The logarithm-based default is also meaningful for retraction geometries, where it inherits the documented proxy semantics of
loganddist.- Parameters:
R (Any)
Q (Any)
- Return type:
Any
- transport(R, Q, U)#
Parallel transport along the selected shortest geodesic.
- Parameters:
R (Any)
Q (Any)
U (Any)
- Return type:
Any
- ehess_to_rhess(R, egrad, ehess_vec, U)#
Default Hessian conversion: tangent-project the ambient Hessian-vector product.
- Parameters:
R (Any)
egrad (Any)
ehess_vec (Any)
U (Any)
- Return type:
Any
- group_exp(omega)#
Lie-group exponential from a skew matrix at the identity.
- Parameters:
omega (Any)
- Return type:
Any
- group_log(R)#
Principal Lie-group logarithm, undefined at rotations by pi.
- Parameters:
R (Any)
- Return type:
Any
- class geojax.geometry.SpecialEuclidean(size, *, atol=1e-06, eps=1e-12)#
Bases:
ExactGeometryMixinRigid-motion group SE(n) with its canonical product metric.
Points use homogeneous matrices
[[R, t], [0, 1]]. The metric is the direct product of the Frobenius bi-invariant metric onSO(n)and the Euclidean metric on translations. Its Riemannian exponential is distinct from the Lie-group exponential except for special tangent directions.- Parameters:
size (int)
atol (float)
eps (float)
- retr(G, U, t=1.0)#
Default retraction: use the exponential map.
- Parameters:
G (Any)
U (Any)
t (float | Any)
- Return type:
Any
- squared_dist(G, H)#
Squared geodesic distance, evaluated without differentiating
sqrt.Geometries with a more direct or more stable formula should override this method. The logarithm-based default is also meaningful for retraction geometries, where it inherits the documented proxy semantics of
loganddist.- Parameters:
G (Any)
H (Any)
- Return type:
Any
- ehess_to_rhess(G, egrad, ehess_vec, U)#
Default Hessian conversion: tangent-project the ambient Hessian-vector product.
- Parameters:
G (Any)
egrad (Any)
ehess_vec (Any)
U (Any)
- Return type:
Any
- group_exp(tangent_at_identity)#
Lie-group exponential of a homogeneous Lie-algebra matrix.
- Parameters:
tangent_at_identity (Any)
- Return type:
Any
- group_log(G)#
Principal Lie-group logarithm, undefined at rotations by pi.
- Parameters:
G (Any)
- Return type:
Any
Positive-definite matrices#
- class geojax.geometry.SPDLogEuclidean(size, *, atol=1e-06, eps=1e-10)#
Bases:
ExactGeometryMixinLog-Euclidean geometry on SPD(size).
The logarithm map
log: SPD(n) -> Sym(n)is an isometry. Therefore distances and geodesics are Euclidean after applying the matrix logarithm. Points are represented as SPD matrices of shape(size, size). Tangent vectors are symmetric matrices of the same shape.- Parameters:
size (tuple[int, int])
atol (float)
eps (float)
- retr(P, U, t=1.0)#
Default retraction: use the exponential map.
- Parameters:
P (Any)
U (Any)
t (float | Any)
- Return type:
Any
- squared_dist(P, Q)#
Squared Euclidean distance between matrix-log coordinates.
- Parameters:
P (Any)
Q (Any)
- Return type:
Any
- lincomb(P, *terms)#
Linear combination of tangent vectors, projected back to
T_x M.- Parameters:
P (Any)
terms (Any)
- Return type:
Any
- class geojax.geometry.SPDAffineInvariant(size, *, atol=1e-06, eps=1e-10)#
Bases:
ExactGeometryMixinAffine-invariant geometry on SPD(size).
The metric is
g_P(U,V) = tr(P^{-1} U P^{-1} V).
This is the canonical symmetric-space geometry of GL(n)/O(n).
- Parameters:
size (tuple[int, int])
atol (float)
eps (float)
- retr(P, U, t=1.0)#
Default retraction: use the exponential map.
- Parameters:
P (Any)
U (Any)
t (float | Any)
- Return type:
Any
- squared_dist(P, Q)#
Squared affine-invariant distance.
- Parameters:
P (Any)
Q (Any)
- Return type:
Any
- lincomb(P, *terms)#
Linear combination of tangent vectors, projected back to
T_x M.- Parameters:
P (Any)
terms (Any)
- Return type:
Any
- class geojax.geometry.SPDBuresWasserstein(size, *, atol=1e-06, eps=1e-10)#
Bases:
ExactGeometryMixinBures-Wasserstein geometry on SPD(size).
If
P = Q diag(d) Q.TandU_tilde = Q.T @ U @ Q, the metric isg_P(U,V) = 1/2 sum_ij U_tilde_ij V_tilde_ij / (d_i + d_j).
The exponential is defined only while its horizontal square-root lift is nonsingular.
transportis an exact isometric vector transport for optimization; it is not the Levi-Civita parallel transport, whose general evaluation requires integrating a differential equation.- Parameters:
size (tuple[int, int])
atol (float)
eps (float)
- sylvester(P, U)#
Solve
P A + A P = Ufor symmetricA.- Parameters:
P (Any)
U (Any)
- Return type:
Any
- retr(P, U, t=1.0)#
Default retraction: use the exponential map.
- Parameters:
P (Any)
U (Any)
t (float | Any)
- Return type:
Any
- optimal_transport_map(P, Q)#
Return the optimal Gaussian transport map from covariance P to Q.
- Parameters:
P (Any)
Q (Any)
- Return type:
Any
- squared_dist(P, Q)#
Squared geodesic distance, evaluated without differentiating
sqrt.Geometries with a more direct or more stable formula should override this method. The logarithm-based default is also meaningful for retraction geometries, where it inherits the documented proxy semantics of
loganddist.- Parameters:
P (Any)
Q (Any)
- Return type:
Any
- transport(P, Q, U)#
Isometric vector transport between Bures-Wasserstein tangent spaces.
This transport preserves the Bures-Wasserstein metric exactly but is not claimed to be Levi-Civita parallel transport.
- Parameters:
P (Any)
Q (Any)
U (Any)
- Return type:
Any
- lincomb(P, *terms)#
Linear combination of tangent vectors, projected back to
T_x M.- Parameters:
P (Any)
terms (Any)
- Return type:
Any
Fixed-rank and semidefinite matrices#
- class geojax.geometry.FixedRank(size, *, rank, atol=1e-06, eps=1e-10)#
Bases:
RetractionGeometryMixinEmbedded manifold of real matrices with fixed rank.
The Frobenius metric is used.
retris the truncated-SVD retraction; compatibilityexp,loganddistcalls are explicitly marked as proxies byoperation_kind(). Projection and tangent derivatives use whole singular subspaces, so repeated singular values within either spectral band are supported. A tie at the truncation boundary, or repair from rank below the requested rank, has no unique smooth projection.- Parameters:
size (tuple[int, int])
rank (int)
atol (float)
eps (float)
- retr(X, U, t=1.0)#
Default retraction: use the exponential map.
- Parameters:
X (Any)
U (Any)
t (float | Any)
- Return type:
Any
- invretr(X, Y)#
Default inverse retraction: use the logarithmic map.
- Parameters:
X (Any)
Y (Any)
- Return type:
Any
- dist(x, y)#
Local inverse-retraction norm; not a geodesic distance.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- dist_batch(x, ys)#
Compatibility wrapper for natively batched
dist.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- egrad2rgrad(x, egrad)#
Compatibility alias that dispatches to
egrad_to_rgrad().- Parameters:
x (Any)
egrad (Any)
- Return type:
Any
- ehess_to_rhess(x, egrad, ehess_vec, u)#
Default Hessian conversion: tangent-project the ambient Hessian-vector product.
- Parameters:
x (Any)
egrad (Any)
ehess_vec (Any)
u (Any)
- Return type:
Any
- exp(x, u)#
Retraction proxy for the exponential map.
- Parameters:
x (Any)
u (Any)
- Return type:
Any
- exp_batch(x, us)#
Compatibility wrapper for natively batched
exp.- Parameters:
x (Any)
us (Any)
- Return type:
Any
- lincomb(x, *terms)#
Linear combination of tangent vectors, projected back to
T_x M.- Parameters:
x (Any)
terms (Any)
- Return type:
Any
- log(x, y)#
Inverse-retraction proxy for the logarithmic map.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- log_batch(x, ys)#
Compatibility wrapper for natively batched
log.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- normalize(x)#
Compatibility alias that dispatches to
project().- Parameters:
x (Any)
- Return type:
Any
- operation_kind(name)#
Describe the mathematical status of a geometric operation.
- Parameters:
name (str)
- Return type:
str
- pair_mean(x, y)#
Midpoint-like construction from the available
expandlog.This is a geodesic midpoint only when both operations are exact and the selected logarithm is the unique minimizing one.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- proj(x, u)#
Compatibility alias that dispatches to
tangent_project().- Parameters:
x (Any)
u (Any)
- Return type:
Any
- projection(x, u)#
Compatibility alias that dispatches to
tangent_project().- Parameters:
x (Any)
u (Any)
- Return type:
Any
- squared_dist(x, y)#
Squared geodesic distance, evaluated without differentiating
sqrt.Geometries with a more direct or more stable formula should override this method. The logarithm-based default is also meaningful for retraction geometries, where it inherits the documented proxy semantics of
loganddist.- Parameters:
x (Any)
y (Any)
- Return type:
Any
- to_tangent(x, u)#
Compatibility alias that dispatches to
tangent_project().- Parameters:
x (Any)
u (Any)
- Return type:
Any
- transp(x, y, u)#
Compatibility alias that dispatches to
transport().- Parameters:
x (Any)
y (Any)
u (Any)
- Return type:
Any
- transport(x, y, u)#
Projection vector transport associated with the retraction.
- Parameters:
x (Any)
y (Any)
u (Any)
- Return type:
Any
- class geojax.geometry.RankKPSD(size, *, rank, atol=1e-06, eps=1e-10)#
Bases:
_RankKPSDBaseFixed-rank positive-semidefinite matrices with embedded metric.
- Parameters:
size (tuple[int, int])
rank (int)
atol (float)
eps (float)
- dist(x, y)#
Local inverse-retraction norm; not a geodesic distance.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- dist_batch(x, ys)#
Compatibility wrapper for natively batched
dist.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- egrad2rgrad(x, egrad)#
Compatibility alias that dispatches to
egrad_to_rgrad().- Parameters:
x (Any)
egrad (Any)
- Return type:
Any
- ehess_to_rhess(x, egrad, ehess_vec, u)#
Default Hessian conversion: tangent-project the ambient Hessian-vector product.
- Parameters:
x (Any)
egrad (Any)
ehess_vec (Any)
u (Any)
- Return type:
Any
- exp(x, u)#
Retraction proxy for the exponential map.
- Parameters:
x (Any)
u (Any)
- Return type:
Any
- exp_batch(x, us)#
Compatibility wrapper for natively batched
exp.- Parameters:
x (Any)
us (Any)
- Return type:
Any
- invretr(P, Q)#
Default inverse retraction: use the logarithmic map.
- Parameters:
P (Any)
Q (Any)
- Return type:
Any
- lincomb(x, *terms)#
Linear combination of tangent vectors, projected back to
T_x M.- Parameters:
x (Any)
terms (Any)
- Return type:
Any
- log(x, y)#
Inverse-retraction proxy for the logarithmic map.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- log_batch(x, ys)#
Compatibility wrapper for natively batched
log.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- normalize(A)#
Project through the most-derived manifold constraint.
- Parameters:
A (Any)
- Return type:
Any
- operation_kind(name)#
Describe the mathematical status of a geometric operation.
- Parameters:
name (str)
- Return type:
str
- pair_mean(x, y)#
Midpoint-like construction from the available
expandlog.This is a geodesic midpoint only when both operations are exact and the selected logarithm is the unique minimizing one.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- proj(P, Z)#
Project through the most-derived tangent constraint.
- Parameters:
P (Any)
Z (Any)
- Return type:
Any
- projection(P, Z)#
Project through the most-derived tangent constraint.
- Parameters:
P (Any)
Z (Any)
- Return type:
Any
- retr(P, U, t=1.0)#
Default retraction: use the exponential map.
- Parameters:
P (Any)
U (Any)
t (float | Any)
- Return type:
Any
- squared_dist(x, y)#
Squared geodesic distance, evaluated without differentiating
sqrt.Geometries with a more direct or more stable formula should override this method. The logarithm-based default is also meaningful for retraction geometries, where it inherits the documented proxy semantics of
loganddist.- Parameters:
x (Any)
y (Any)
- Return type:
Any
- to_tangent(P, Z)#
Project through the most-derived tangent constraint.
- Parameters:
P (Any)
Z (Any)
- Return type:
Any
- transp(x, y, u)#
Compatibility alias that dispatches to
transport().- Parameters:
x (Any)
y (Any)
u (Any)
- Return type:
Any
- transport(x, y, u)#
Projection vector transport associated with the retraction.
- Parameters:
x (Any)
y (Any)
u (Any)
- Return type:
Any
- class geojax.geometry.RankKPSDBuresWasserstein(size, *, rank, atol=1e-06, eps=1e-10)#
Bases:
_RankKPSDBaseFixed-rank PSD matrices with their Bures–Wasserstein quotient metric.
Derivatives use invariant matrix equations, including at repeated positive and zero eigenvalues. Logarithms and squared distances are smooth when the factors’ cross product is invertible. At a singular cross product (the quotient cut locus),
logreturns one Procrustes-selected tangent; its derivative and the distance gradient need not exist.expfollows the entire straight horizontal factor path and rejects steps that encounter rank loss, including paths that leave and reenter the regular stratum. Its numerical rank certificate resolves separation only to roundoff precision; near-boundary paths can be rejected.- Parameters:
size (tuple[int, int])
rank (int)
atol (float)
eps (float)
- exp(P, U)#
Retraction proxy for the exponential map.
- Parameters:
P (Any)
U (Any)
- Return type:
Any
- retr(P, U, t=1.0)#
Default retraction: use the exponential map.
- Parameters:
P (Any)
U (Any)
t (float | Any)
- Return type:
Any
- log(P, Q)#
Inverse-retraction proxy for the logarithmic map.
- Parameters:
P (Any)
Q (Any)
- Return type:
Any
- invretr(P, Q)#
Default inverse retraction: use the logarithmic map.
- Parameters:
P (Any)
Q (Any)
- Return type:
Any
- dist(P, Q)#
Local inverse-retraction norm; not a geodesic distance.
- Parameters:
P (Any)
Q (Any)
- Return type:
Any
- squared_dist(P, Q)#
Squared geodesic distance, evaluated without differentiating
sqrt.Geometries with a more direct or more stable formula should override this method. The logarithm-based default is also meaningful for retraction geometries, where it inherits the documented proxy semantics of
loganddist.- Parameters:
P (Any)
Q (Any)
- Return type:
Any
- transport(P, Q, U)#
Projection vector transport associated with the retraction.
- Parameters:
P (Any)
Q (Any)
U (Any)
- Return type:
Any
- dist_batch(x, ys)#
Compatibility wrapper for natively batched
dist.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- egrad2rgrad(x, egrad)#
Compatibility alias that dispatches to
egrad_to_rgrad().- Parameters:
x (Any)
egrad (Any)
- Return type:
Any
- ehess_to_rhess(x, egrad, ehess_vec, u)#
Default Hessian conversion: tangent-project the ambient Hessian-vector product.
- Parameters:
x (Any)
egrad (Any)
ehess_vec (Any)
u (Any)
- Return type:
Any
- exp_batch(x, us)#
Compatibility wrapper for natively batched
exp.- Parameters:
x (Any)
us (Any)
- Return type:
Any
- lincomb(x, *terms)#
Linear combination of tangent vectors, projected back to
T_x M.- Parameters:
x (Any)
terms (Any)
- Return type:
Any
- log_batch(x, ys)#
Compatibility wrapper for natively batched
log.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- normalize(A)#
Project through the most-derived manifold constraint.
- Parameters:
A (Any)
- Return type:
Any
- operation_kind(name)#
Describe the mathematical status of a geometric operation.
- Parameters:
name (str)
- Return type:
str
- pair_mean(x, y)#
Midpoint-like construction from the available
expandlog.This is a geodesic midpoint only when both operations are exact and the selected logarithm is the unique minimizing one.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- proj(P, Z)#
Project through the most-derived tangent constraint.
- Parameters:
P (Any)
Z (Any)
- Return type:
Any
- projection(P, Z)#
Project through the most-derived tangent constraint.
- Parameters:
P (Any)
Z (Any)
- Return type:
Any
- to_tangent(P, Z)#
Project through the most-derived tangent constraint.
- Parameters:
P (Any)
Z (Any)
- Return type:
Any
- transp(x, y, u)#
Compatibility alias that dispatches to
transport().- Parameters:
x (Any)
y (Any)
u (Any)
- Return type:
Any
- class geojax.geometry.Elliptope(size, *, rank, atol=1e-06, eps=1e-10)#
Bases:
_RankKPSDBaseRank-
rankPSD matrices with unit diagonal.Diagonal normalization has a basis-independent derivative when all rows have positive norm. Zero-row repairs preserve a chosen factor fallback; that noncontinuous repair has no ordinary derivative.
- Parameters:
size (tuple[int, int])
rank (int)
atol (float)
eps (float)
- dist(x, y)#
Local inverse-retraction norm; not a geodesic distance.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- dist_batch(x, ys)#
Compatibility wrapper for natively batched
dist.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- egrad2rgrad(x, egrad)#
Compatibility alias that dispatches to
egrad_to_rgrad().- Parameters:
x (Any)
egrad (Any)
- Return type:
Any
- ehess_to_rhess(x, egrad, ehess_vec, u)#
Default Hessian conversion: tangent-project the ambient Hessian-vector product.
- Parameters:
x (Any)
egrad (Any)
ehess_vec (Any)
u (Any)
- Return type:
Any
- exp(x, u)#
Retraction proxy for the exponential map.
- Parameters:
x (Any)
u (Any)
- Return type:
Any
- exp_batch(x, us)#
Compatibility wrapper for natively batched
exp.- Parameters:
x (Any)
us (Any)
- Return type:
Any
- invretr(P, Q)#
Default inverse retraction: use the logarithmic map.
- Parameters:
P (Any)
Q (Any)
- Return type:
Any
- lincomb(x, *terms)#
Linear combination of tangent vectors, projected back to
T_x M.- Parameters:
x (Any)
terms (Any)
- Return type:
Any
- log(x, y)#
Inverse-retraction proxy for the logarithmic map.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- log_batch(x, ys)#
Compatibility wrapper for natively batched
log.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- normalize(A)#
Project through the most-derived manifold constraint.
- Parameters:
A (Any)
- Return type:
Any
- operation_kind(name)#
Describe the mathematical status of a geometric operation.
- Parameters:
name (str)
- Return type:
str
- pair_mean(x, y)#
Midpoint-like construction from the available
expandlog.This is a geodesic midpoint only when both operations are exact and the selected logarithm is the unique minimizing one.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- proj(P, Z)#
Project through the most-derived tangent constraint.
- Parameters:
P (Any)
Z (Any)
- Return type:
Any
- projection(P, Z)#
Project through the most-derived tangent constraint.
- Parameters:
P (Any)
Z (Any)
- Return type:
Any
- retr(P, U, t=1.0)#
Default retraction: use the exponential map.
- Parameters:
P (Any)
U (Any)
t (float | Any)
- Return type:
Any
- squared_dist(x, y)#
Squared geodesic distance, evaluated without differentiating
sqrt.Geometries with a more direct or more stable formula should override this method. The logarithm-based default is also meaningful for retraction geometries, where it inherits the documented proxy semantics of
loganddist.- Parameters:
x (Any)
y (Any)
- Return type:
Any
- to_tangent(P, Z)#
Project through the most-derived tangent constraint.
- Parameters:
P (Any)
Z (Any)
- Return type:
Any
- transp(x, y, u)#
Compatibility alias that dispatches to
transport().- Parameters:
x (Any)
y (Any)
u (Any)
- Return type:
Any
- transport(x, y, u)#
Projection vector transport associated with the retraction.
- Parameters:
x (Any)
y (Any)
u (Any)
- Return type:
Any
- class geojax.geometry.Spectrahedron(size, *, rank, atol=1e-06, eps=1e-10)#
Bases:
_RankKPSDBaseRank-
rankPSD matrices with unit trace.- Parameters:
size (tuple[int, int])
rank (int)
atol (float)
eps (float)
- dist(x, y)#
Local inverse-retraction norm; not a geodesic distance.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- dist_batch(x, ys)#
Compatibility wrapper for natively batched
dist.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- egrad2rgrad(x, egrad)#
Compatibility alias that dispatches to
egrad_to_rgrad().- Parameters:
x (Any)
egrad (Any)
- Return type:
Any
- ehess_to_rhess(x, egrad, ehess_vec, u)#
Default Hessian conversion: tangent-project the ambient Hessian-vector product.
- Parameters:
x (Any)
egrad (Any)
ehess_vec (Any)
u (Any)
- Return type:
Any
- exp(x, u)#
Retraction proxy for the exponential map.
- Parameters:
x (Any)
u (Any)
- Return type:
Any
- exp_batch(x, us)#
Compatibility wrapper for natively batched
exp.- Parameters:
x (Any)
us (Any)
- Return type:
Any
- invretr(P, Q)#
Default inverse retraction: use the logarithmic map.
- Parameters:
P (Any)
Q (Any)
- Return type:
Any
- lincomb(x, *terms)#
Linear combination of tangent vectors, projected back to
T_x M.- Parameters:
x (Any)
terms (Any)
- Return type:
Any
- log(x, y)#
Inverse-retraction proxy for the logarithmic map.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- log_batch(x, ys)#
Compatibility wrapper for natively batched
log.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- normalize(A)#
Project through the most-derived manifold constraint.
- Parameters:
A (Any)
- Return type:
Any
- operation_kind(name)#
Describe the mathematical status of a geometric operation.
- Parameters:
name (str)
- Return type:
str
- pair_mean(x, y)#
Midpoint-like construction from the available
expandlog.This is a geodesic midpoint only when both operations are exact and the selected logarithm is the unique minimizing one.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- proj(P, Z)#
Project through the most-derived tangent constraint.
- Parameters:
P (Any)
Z (Any)
- Return type:
Any
- projection(P, Z)#
Project through the most-derived tangent constraint.
- Parameters:
P (Any)
Z (Any)
- Return type:
Any
- retr(P, U, t=1.0)#
Default retraction: use the exponential map.
- Parameters:
P (Any)
U (Any)
t (float | Any)
- Return type:
Any
- squared_dist(x, y)#
Squared geodesic distance, evaluated without differentiating
sqrt.Geometries with a more direct or more stable formula should override this method. The logarithm-based default is also meaningful for retraction geometries, where it inherits the documented proxy semantics of
loganddist.- Parameters:
x (Any)
y (Any)
- Return type:
Any
- to_tangent(P, Z)#
Project through the most-derived tangent constraint.
- Parameters:
P (Any)
Z (Any)
- Return type:
Any
- transp(x, y, u)#
Compatibility alias that dispatches to
transport().- Parameters:
x (Any)
y (Any)
u (Any)
- Return type:
Any
- transport(x, y, u)#
Projection vector transport associated with the retraction.
- Parameters:
x (Any)
y (Any)
u (Any)
- Return type:
Any
Correlation matrices#
Euclidean-Cholesky metric#
- class geojax.geometry.CorrelationECM(size, *, atol=1e-06, eps=1e-10)#
Bases:
_CorrelationCholeskyBaseCorrelation manifold with the Euclidean-Cholesky metric.
ECM is the Euclidean-Cholesky metric. Its flat coordinates are the strictly lower-triangular entries of the unit-diagonal Cholesky factor.
- Parameters:
size (tuple[int, int])
atol (float)
eps (float)
Log-Euclidean-Cholesky metric#
- class geojax.geometry.CorrelationLEC(size, *, atol=1e-06, eps=1e-10)#
Bases:
_CorrelationCholeskyBaseCorrelation manifold with the log-Euclidean-Cholesky metric.
LEC is the log-Euclidean-Cholesky metric (also abbreviated LECM in the literature). Its flat coordinates are the matrix logarithm of the unit-diagonal Cholesky factor.
- Parameters:
size (tuple[int, int])
atol (float)
eps (float)
Affine-invariant quotient metric#
- class geojax.geometry.CorrelationAffineQuotient(size, *, atol=1e-06, eps=1e-10)#
Bases:
RetractionGeometryMixinFull-rank correlations with the affine-invariant quotient metric.
Correlation matrices are the quotient of SPD matrices by positive diagonal congruence. The metric is evaluated using affine-invariant horizontal lifts. Point updates use normalized-addition retractions; consequently
exp,loganddistare documented proxies.- Parameters:
size (tuple[int, int])
atol (float)
eps (float)
- horizontal_lift(C, U)#
Lift a correlation tangent horizontally to the SPD total space.
- Parameters:
C (Any)
U (Any)
- Return type:
Any
- retr(C, U, t=1.0)#
Default retraction: use the exponential map.
- Parameters:
C (Any)
U (Any)
t (float | Any)
- Return type:
Any
- invretr(C, D)#
Default inverse retraction: use the logarithmic map.
- Parameters:
C (Any)
D (Any)
- Return type:
Any
- dist(x, y)#
Local inverse-retraction norm; not a geodesic distance.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- dist_batch(x, ys)#
Compatibility wrapper for natively batched
dist.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- egrad2rgrad(x, egrad)#
Compatibility alias that dispatches to
egrad_to_rgrad().- Parameters:
x (Any)
egrad (Any)
- Return type:
Any
- ehess_to_rhess(x, egrad, ehess_vec, u)#
Default Hessian conversion: tangent-project the ambient Hessian-vector product.
- Parameters:
x (Any)
egrad (Any)
ehess_vec (Any)
u (Any)
- Return type:
Any
- exp(x, u)#
Retraction proxy for the exponential map.
- Parameters:
x (Any)
u (Any)
- Return type:
Any
- exp_batch(x, us)#
Compatibility wrapper for natively batched
exp.- Parameters:
x (Any)
us (Any)
- Return type:
Any
- lincomb(x, *terms)#
Linear combination of tangent vectors, projected back to
T_x M.- Parameters:
x (Any)
terms (Any)
- Return type:
Any
- log(x, y)#
Inverse-retraction proxy for the logarithmic map.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- log_batch(x, ys)#
Compatibility wrapper for natively batched
log.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- normalize(x)#
Compatibility alias that dispatches to
project().- Parameters:
x (Any)
- Return type:
Any
- operation_kind(name)#
Describe the mathematical status of a geometric operation.
- Parameters:
name (str)
- Return type:
str
- pair_mean(x, y)#
Midpoint-like construction from the available
expandlog.This is a geodesic midpoint only when both operations are exact and the selected logarithm is the unique minimizing one.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- proj(x, u)#
Compatibility alias that dispatches to
tangent_project().- Parameters:
x (Any)
u (Any)
- Return type:
Any
- projection(x, u)#
Compatibility alias that dispatches to
tangent_project().- Parameters:
x (Any)
u (Any)
- Return type:
Any
- squared_dist(x, y)#
Squared geodesic distance, evaluated without differentiating
sqrt.Geometries with a more direct or more stable formula should override this method. The logarithm-based default is also meaningful for retraction geometries, where it inherits the documented proxy semantics of
loganddist.- Parameters:
x (Any)
y (Any)
- Return type:
Any
- to_tangent(x, u)#
Compatibility alias that dispatches to
tangent_project().- Parameters:
x (Any)
u (Any)
- Return type:
Any
- transp(x, y, u)#
Compatibility alias that dispatches to
transport().- Parameters:
x (Any)
y (Any)
u (Any)
- Return type:
Any
- transport(x, y, u)#
Projection vector transport associated with the retraction.
- Parameters:
x (Any)
y (Any)
u (Any)
- Return type:
Any
Shape spaces#
- class geojax.geometry.KendallShape(size, *, atol=1e-06, eps=1e-10)#
Bases:
ExactGeometryMixinRegular Kendall shape space of centered, scale-normalized landmarks.
Public points are pre-shape matrices of size
landmarks x ambient_dim. Frames related by a right action ofSO(ambient_dim)represent the same shape. Tangents are represented by horizontal pre-shape vectors.- Parameters:
size (tuple[int, int])
atol (float)
eps (float)
- align(Y, X)#
Align
YtoXby orientation-preserving Procrustes rotation.- Parameters:
Y (Any)
X (Any)
- Return type:
tuple[Any, Any]
- retr(X, U, t=1.0)#
Default retraction: use the exponential map.
- Parameters:
X (Any)
U (Any)
t (float | Any)
- Return type:
Any
- squared_dist(X, Y)#
Squared geodesic distance, evaluated without differentiating
sqrt.Geometries with a more direct or more stable formula should override this method. The logarithm-based default is also meaningful for retraction geometries, where it inherits the documented proxy semantics of
loganddist.- Parameters:
X (Any)
Y (Any)
- Return type:
Any
- dist_batch(x, ys)#
Compatibility wrapper for natively batched
dist.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- egrad2rgrad(x, egrad)#
Compatibility alias that dispatches to
egrad_to_rgrad().- Parameters:
x (Any)
egrad (Any)
- Return type:
Any
- ehess_to_rhess(x, egrad, ehess_vec, u)#
Default Hessian conversion: tangent-project the ambient Hessian-vector product.
- Parameters:
x (Any)
egrad (Any)
ehess_vec (Any)
u (Any)
- Return type:
Any
- exp_batch(x, us)#
Compatibility wrapper for natively batched
exp.- Parameters:
x (Any)
us (Any)
- Return type:
Any
- invretr(x, y)#
Default inverse retraction: use the logarithmic map.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- lincomb(x, *terms)#
Linear combination of tangent vectors, projected back to
T_x M.- Parameters:
x (Any)
terms (Any)
- Return type:
Any
- log_batch(x, ys)#
Compatibility wrapper for natively batched
log.- Parameters:
x (Any)
ys (Any)
- Return type:
Any
- normalize(x)#
Compatibility alias that dispatches to
project().- Parameters:
x (Any)
- Return type:
Any
- operation_kind(name)#
Describe the mathematical status of a geometric operation.
- Parameters:
name (str)
- Return type:
str
- pair_mean(x, y)#
Midpoint-like construction from the available
expandlog.This is a geodesic midpoint only when both operations are exact and the selected logarithm is the unique minimizing one.
- Parameters:
x (Any)
y (Any)
- Return type:
Any
- proj(x, u)#
Compatibility alias that dispatches to
tangent_project().- Parameters:
x (Any)
u (Any)
- Return type:
Any
- projection(x, u)#
Compatibility alias that dispatches to
tangent_project().- Parameters:
x (Any)
u (Any)
- Return type:
Any
- to_tangent(x, u)#
Compatibility alias that dispatches to
tangent_project().- Parameters:
x (Any)
u (Any)
- Return type:
Any
- transp(x, y, u)#
Compatibility alias that dispatches to
transport().- Parameters:
x (Any)
y (Any)
u (Any)
- Return type:
Any
Utility functions#
- geojax.geometry.torus.wrap_angles(x)#
Wrap angles to
[-pi, pi).- Parameters:
x (Any)
- Return type:
Any