Skip to contents

Computes the geodesic distance on \(H^d\) between each row of X and the point p, i.e. \(\mathrm{arccosh}(-\langle x, p \rangle_L)\) with \(\langle x, p \rangle_L = -x_0 p_0 + \sum_i x_i p_i\), evaluated as the norm of log_map_hyperbolic for numerical accuracy.

Usage

dist_hyperbolic(X, p)

Arguments

X

A matrix or data frame of points on the hyperboloid; rows are samples, with d + 1 columns.

p

Numeric vector of length ncol(X): a point on the hyperboloid.

Value

Numeric vector of length nrow(X): the hyperbolic distance from each row of X to p.

Examples

X <- exp_map_hyperbolic(matrix(rnorm(20), nrow = 10, ncol = 2))
dist_hyperbolic(X, c(1, 0, 0))
#>  [1] 3.0161559 0.1482411 1.1612379 1.3029082 2.4081951 2.7187306 1.2307295
#>  [8] 1.4024583 0.7895485 1.2993349