Implementation of DTW for pattern matching two time series