Function velocity

Source
pub fn velocity(
    trajectory: &[(i64, &[f32])],
    target: i64,
) -> Result<Vec<f32>, AnalyticsError>
Expand description

Compute velocity (first-order finite difference) at a target timestamp.

Uses central difference when target is between two points, forward/backward difference at boundaries.

Returns a velocity vector with the same dimensionality as the input.