scaled_distance | R Documentation |
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
scaled_distance(x, y, matrix)
x |
vector |
y |
vector |
matrix |
matrix |
the scaled distance between vectors x and y with matrix
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.