Learn R Programming

qkerntool (version 1.19)

Eucdist: Computes the Euclidean(square Euclidean) distance matrix

Description

Eucdist Computes the Euclidean(square Euclidean) distance matrix.

Arguments

x

(NxD) matrix (N samples, D features)

y

(MxD) matrix (M samples, D features)

sEuclidean

can be TRUE or FALSE, FALSE to Compute the Euclidean distance matrix.

Value

E - (MxN) Euclidean (square Euclidean) distances between vectors in x and y

Examples

Run this code
# NOT RUN {
###
data(iris)
testset <- sample(1:150,20)
x <- as.matrix(iris[-testset,-5])
y <- as.matrix(iris[testset,-5])

##
res0 <- Eucdist(x)
res1 <- Eucdist(x, x, sEuclidean = FALSE)
res2 <- Eucdist(x, y = NULL, sEuclidean = FALSE)
res3 <- Eucdist(x, x, sEuclidean = TRUE)
res4 <- Eucdist(x, y = NULL)
res5 <- Eucdist(x, sEuclidean = FALSE)
# }

Run the code above in your browser using DataLab