powered by
x
xp
Euclidean distance of x to a line of points xp
distLine(x, xp)
vector of dimension d
n points \(x_i\) of dimension d are arranged in (n x d) matrix xp. If xp is a vector, it is interpreted as (n x 1) matrix, i.e. d=1.
vector of length n, the Euclidean distances
distLine is up to 40x faster than using dist and taking only the first row or column of the distance matrix returned.
distLine
dist