Description Usage Arguments Value Note Author(s) Examples
This fully vectorized (VERY FAST!) m-file computes the Euclidean distance between two vectors by:
||A-B|| = sqrt ( ||A||^2 + ||B||^2 - 2*A.B )
1 | L2Distance(a, b, df = 0)
|
a |
Either a matrix or a vector. |
b |
Either a matrix or a vector. |
df |
df = 1, force diagonals to be zero; 0 (default), do not force. |
For A - (DxM) matrix B - (DxN) matrix
L2Distance
returns a matrix of size (MxN).
This function was transcribed by the package maintainers from a Matlab to an R function.
Roland Bunschoten
1 2 3 4 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.