# A constant vector
z<-numeric(10);
# dtw between two constant vectors with a squared euclidean distance
# this should be 2^2 times 10 elements = 40
d2<-dtw(z,z+2);
stopifnot(d2$distance==40);
# dtw between two constant vectors with a root squared euclidean distance
# this should be 2 times 10 elements = 20
d1<-dtw(z,z+2,
distance.function=function(a,b){return(abs(a-b));})
stopifnot(d1$distance==20);
Run the code above in your browser using DataLab