https://github.com/cran/dtw
Tip revision: c8ecf75cce389c770ef823b1a4eaeef61ddeada0 authored by Toni Giorgino on 30 November 2007, 00:00:00 UTC
version 1.2-1
version 1.2-1
Tip revision: c8ecf75
distance.R
###############################################################
# #
# (c) Toni Giorgino <toni.giorgino@gmail.com> #
# Laboratory for Biomedical Informatics #
# University of Pavia - Italy #
# www.labmedinfo.org #
# #
# $Id: distance.R 51 2007-12-11 10:59:08Z tonig $
# #
###############################################################
## Euclidean squared distance.
## should work on vectors (in R^n) too
## `euclideanSquared` <-
## function(a,b) {
## z<-a-b;
## z<-drop(z %*% z); #inner dot product
## return (z);
## }
`euclideanSquared` <-
function(a,b) {
return((a-b)^2);
}
`euclideanDistance` <-
function(a,b) {
return(abs(a-b));
}