## symmetric step pattern => symmetric dissimilarity matrix;
## no problem coercing it to a dist object:
m <- matrix(0,ncol=3,nrow=4)
m <- row(m)
dtwDist(m)
as.dist(dtwDist(m))
dist(m,method="DTW");
## asymmetric step pattern: we can either disregard part of the pairs
## (as.dist), or average with the transpose
mm <- matrix(runif(12),ncol=3)
dm <- dtwDist(mm,step=asymmetric)
as.dist(dm)
as.dist((dm+t(dm))/2)
## check definition
stopifnot(dm[2,1]==dtw(mm[2,],mm[1,],step=asymmetric)$distance)
Run the code above in your browser using DataLab