circle_bundles.RP1UnitVectorMetric
- class circle_bundles.RP1UnitVectorMetric(name='RP1_unitvec', base_name='RP^1', base_name_latex='\\mathbb{RP}^1')[source]
Bases:
objectGeodesic distance on \(\mathbb{RP}^1\) using unit vectors in \(\mathbb{R}^2\).
Points are represented by unit vectors in \(\mathbb{R}^2\), but with the antipodal identification:
\[p \sim -p.\]Therefore the distance between classes
[p]and[q]is:\[d([p],[q]) = \arccos(|\langle p, q \rangle|).\]This is the correct metric when the base variable represents unoriented directions (i.e. an axis rather than an arrow).
Notes
This implementation is robust to small deviations from unit norm: it normalizes input rows internally.
Distances are in radians in the range
[0, π/2]for true unit inputs (because of antipodal identification).
- __init__(name='RP1_unitvec', base_name='RP^1', base_name_latex='\\mathbb{RP}^1')
Methods
__init__([name, base_name, base_name_latex])pairwise(X[, Y])Compute projective geodesic distances between unit-vector samples.
Attributes
- pairwise(X, Y=None)[source]
Compute projective geodesic distances between unit-vector samples.
- Parameters:
- Returns:
Distance matrix of shape
(n, m)with entries in radians.- Return type:
D
- Raises:
ValueError – If
XorYdoes not have shape(*, 2)after reshaping 1D inputs.