Measures distance from data points to cluster centers

measure_dist(X, centers)

Arguments

X

array Data points of dimension (n,d)

centers

array Coordinates of cluster centers, dimension (k,d)

Value

array Distance from each point to each center, dimension (n,k)

Examples

X = rbind(c(0,0), c(1,1)) centers = rbind(c(0.1, 0.1), c(1.1, 1.1)) measure_dist(X, centers)
#> [,1] [,2] #> [1,] 0.1414214 1.5556349 #> [2,] 1.2727922 0.1414214