Skip to contents

Returns a full NxN matrix of Euclidean distances among the rows of X. No block-based exclusion is performed.

Usage

# S3 method for class 'euclidean'
pairwise_dist(obj, X)

Arguments

obj

A distance function object of class c("euclidean", "distfun").

X

A numeric matrix (rows = observations, columns = variables).

Value

An N x N numeric matrix of pairwise Euclidean distances.

Details

This function simply calls dist(X) internally and converts it to a matrix via as.matrix().

Examples

X <- matrix(rnorm(100), 10, 10)
dist_obj <- eucdist()
dist_matrix <- pairwise_dist(dist_obj, X)
#> Error in UseMethod("pairwise_dist"): no applicable method for 'pairwise_dist' applied to an object of class "c('euclidean', 'distfun')"