Learn R Programming

SACOBRA (version 1.2)

distLine: Euclidean distance of x to all xp

Description

Euclidean distance of x to a line of points xp

Usage

distLine(x, xp)

Arguments

x

vector of dimension d

xp

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.

Value

vector of length n, the Euclidean distances

Details

distLine is up to 40x faster than using dist and taking only the first row or column of the distance matrix returned.