| AGDTW_Search | | Input: A, B: two series | | istep, jstep: n-step for series A and B, default 1 | | oba, obb, oea, oeb: boundary-free switcher | | Return: dtw: cumulative DTW value | | iend, jend: end index pair of matched scheme | | D, K: cumulative distance & traceback index matrix | (1) | D, K = Init_cumulative_and_trace_mat (A, B, oba, obb) | (2) | for i in 1 … A.length-1 | (3) | for j in 1… B.length-1 | (4) | imin, jmin = find min in D[i-istep…i, j-jstep…j] | (5) | D[i, j] = D[imin, jmin] + local_distance(A[i],B[j]) | (6) | K[i, j] = (imin, jmin) | (7) | iend, jend = A.length-1, B.length-1 | (8) | if oea | (9) | iend, jend = index of minimal in D’s last column | (10) | if oeb | (11) | iend, jend = A.length-1, index of minimal in D’s last row | (12) | dtw = D[iend, jend] | (13) | return dtw, iend, jend, D, K |
|