scaled_distance: Scaled distance between two vectors

View source: R/RcppExports.R

scaled_distanceR Documentation

Scaled distance between two vectors

Description

Calculates the scaled distance between two vectors, i.e. calculates the norm of matrix*(x-y) If matrix == identity matrix, this is just the Euclidean distance

Usage

scaled_distance(x, y, matrix)

Arguments

x

vector

y

vector

matrix

matrix

Value

the scaled distance between vectors x and y with matrix

Examples

x <- c(0.3, 0.2, 0.5, 1.2)
y <- c(-0.5, 0.8, 1.4, 0.9)
scaled_distance(x, y, diag(1, 4))
# should equal to the Euclidean distance:
sqrt(0.8^2 + 0.6^2 + 0.9^2 + 0.3^2)

rchan26/hierarchicalFusion documentation built on Sept. 11, 2022, 10:30 p.m.