Learn R Programming

dtw (version 0.1-2)

euclideanSquared: Euclidean Distance between two vectors

Description

Compute Euclidean squared distance between two given vectors (default function for dtw).

Usage

euclideanSquared(a, b)

Arguments

a
The first element
b
The second element

Value

  • Local distance (float).

Details

This is a trivial distance function supplied as an example of what can be passed to the distance.function argument in dtw. Altough it makes a lot of sense for a and b to be vectors rather than numbers, direct alignment of two multivariate time series is currently not supported natively by dtw (this may change soon). The user can instead build a local distance matrix, e.g. via a custom function or distance in package analogue, and feed the result into dtw as a matrix first argument.

References

Euclid's Elements, T.L. Heath (translator), Dover (1956).

See Also

See Also distance

Examples

Run this code
## The function is currently defined as
function(a,b) {
  z<-a-b;
  z<-drop(z %*% z);                     #inner dot product
  return (z);
}

Run the code above in your browser using DataLab