spherical_geodesic#

hypercoil.functional.sphere.spherical_geodesic(X: Tensor, Y: Tensor | None = None, r: float = 1) Tensor[source]#

Geodesic great-circle distance between two sets of spherical coordinates formatted as normal vectors.

This is not a haversine distance, although the result is identical. Please ensure that input vectors are expressed as normals and not as latitude/ longitude pairs. Because this uses a cross-product in the computation, it works only with 2-spheres.

Dimension:

X : \((*, N_X, 3)\) Y : \((*, N_Y, 3)\) Output : \((*, N_X, N_Y)\)

Parameters:
XTensor

Tensor containing coordinates on a sphere formatted as surface-normal vectors in Euclidean coordinates. Distances are computed between each coordinate in X and each coordinate in Y.

YTensor or None (default X)

As X. If a second tensor is not provided, then distances are computed between every pair of points in X.

rfloat

Radius of the sphere. We could just get this from X or Y, but we don’t.

Returns:
distTensor

Tensor containing pairwise great-circle distances between each coordinate in X and each coordinate in Y.