implemented algorithm without having to build distance and warped matrices separately by using extra border rows of infinities, origin a 0 (from Wikipedia article on DTW)