Function matrix_profile

Source
pub fn matrix_profile(
    trajectory: &[(i64, &[f32])],
    window: usize,
    exclusion_zone: f32,
) -> Result<(Vec<f32>, Vec<usize>), AnalyticsError>
Expand description

Compute the Matrix Profile for a multi-dimensional trajectory.

Returns (profile, profile_index) where:

  • profile[i] = distance to the nearest non-trivial match of subsequence i
  • profile_index[i] = index of that nearest match

Uses the STOMP-like approach: for each subsequence, compute distances to all other non-overlapping subsequences and record the minimum.

§Arguments

  • trajectory — Time-ordered (timestamp, vector) pairs
  • window — Subsequence length (number of time steps)
  • exclusion_zone — Fraction of window size to exclude around each subsequence to avoid trivial matches (default: 0.5)

§Errors

Returns AnalyticsError::InsufficientData if trajectory length < 2 * window.