circle_bundles.S1UnitVectorMetric

class circle_bundles.S1UnitVectorMetric(name='S1_unitvec', base_name='S^1', base_name_latex='\\mathbb{S}^1')[source]

Bases: object

Geodesic distance on \(\mathbb{S}^1\) using unit vectors in \(\mathbb{R}^2\).

Points are represented as (approximately) unit vectors p, q R^2 lying on the unit circle. The geodesic distance is the angle between the vectors:

\[d(p, q) = \arccos(\langle p, q \rangle),\]

where the dot product is clamped to [-1, 1] for numerical stability.

Use this metric when your base points are stored as 2D unit vectors (e.g. (cos θ, sin θ)) rather than angles.

Parameters:
  • name (str)

  • base_name (str)

  • base_name_latex (str)

name

Metric identifier (default "S1_unitvec").

Type:

str

base_name

Short name of the base space for plots/UI.

Type:

str

base_name_latex

LaTeX symbol used in summaries and tables.

Type:

str

Notes

  • This metric assumes inputs are unit vectors. If your vectors are not normalized, you should normalize them before calling pairwise(), or use a different metric.

  • Values are in radians in the range [0, π].

__init__(name='S1_unitvec', base_name='S^1', base_name_latex='\\mathbb{S}^1')
Parameters:
  • name (str)

  • base_name (str)

  • base_name_latex (str)

Return type:

None

Methods

__init__([name, base_name, base_name_latex])

pairwise(X[, Y])

Compute geodesic distances on \(\mathbb{S}^1\) between unit-vector samples.

Attributes

base_name

base_name_latex

name

pairwise(X, Y=None)[source]

Compute geodesic distances on \(\mathbb{S}^1\) between unit-vector samples.

Parameters:
  • X (ndarray) – Array of shape (n, 2) containing unit vectors in \(\mathbb{R}^2\).

  • Y (ndarray | None) – Optional array of shape (m, 2). If omitted, uses X.

Returns:

Distance matrix of shape (n, m) with entries in radians.

Return type:

D