R/euclid.R
do_euclid.Rd
Compute the Euclidean distance between each consecutive pair of rows in a matrix — typically a trajectory through PC space.
do_euclid(x)
Numeric matrix [n_points × n_dims].
Numeric vector of length nrow(x). The first element is always 0 (no previous point).
nrow(x)
set.seed(1) pcs <- matrix(rnorm(50 * 3), nrow = 50, ncol = 3) d <- do_euclid(pcs) length(d) # 50 #> [1] 50