pub fn interpn<T: Float>(
dims: &[usize],
starts: &[T],
steps: &[T],
vals: &[T],
obs: &[&[T]],
out: &mut [T],
) -> Result<(), &'static str>Expand description
Evaluate multilinear interpolation on a regular grid in up to 8 dimensions. Assumes C-style ordering of vals (z(x0, y0), z(x0, y1), …, z(x0, yn), z(x1, y0), …).
For 1-6 dimensions, a fast flattened method is used. For higher dimensions, where that flattening becomes impractical due to compile times and instruction size, evaluation defers to a run-time loop.
This is a convenience function; best performance will be achieved by using the exact right number for the N parameter, as this will slightly reduce compute and storage overhead, and the underlying method can be extended to more than this function’s limit of 8 dimensions. The limit of 8 dimensions was chosen for no more specific reason than to reduce unit test times.
While this method initializes the interpolator struct on every call, the overhead of doing this is minimal even when using it to evaluate one observation point at a time.