Skip to content

Dynamic Time Warping (DTW)

Source: src/dtw.rs

Internal Functions

These are internal Rust functions not directly callable from Python.

dtw_distance

Standard unconstrained DTW using O(m) memory (two-row approach).

dtw_sakoe_chiba

DTW with Sakoe-Chiba band constraint.

dtw_itakura

DTW with Itakura parallelogram constraint.

reduce_by_half

Reduce a time series by averaging consecutive pairs.

fast_dtw

FastDTW: approximate DTW in O(N) time using multi-resolution coarsening. Uses HashSet for O(path_len * radius^2) memory instead of O(n*m).

dtw_with_window

Compute DTW restricted to a HashSet window mask.

fast_dtw_path

FastDTW helper that returns the warping path (used for recursive projection).

dtw_full_path

Compute the full DTW cost matrix and extract the optimal warping path.

dtw_path_with_window

Compute DTW path restricted to a HashSet window mask.

compute_dtw

Dispatch to the appropriate DTW variant.