Crates.io | libreda-interp |
lib.rs | libreda-interp |
version | 0.0.3 |
source | src |
created_at | 2024-06-04 18:02:27.843049 |
updated_at | 2024-06-04 18:02:27.843049 |
description | Interpolation of one and two dimensional arrays. |
homepage | https://codeberg.org/libreda/interp |
repository | https://codeberg.org/libreda/interp |
max_upload_size | |
id | 1261867 |
size | 82,646 |
interp
provides functions for interpolation of one dimensional and two dimensional array.
use interp::interp2d::Interp2D;
// Create 2D array of values.
let grid = ndarray::array![
[0.0f64, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 0.0]
];
// Create grid coordinates.
let xs = vec![0.0, 1.0, 2.0];
let ys = vec![3.0, 4.0, 5.0];
// Create interpolator struct.
let interp = Interp2D::new(xs, ys, grid);
// Evaluate the interpolated data at some point.
assert!((interp.eval_no_extrapolation((1.0, 4.0)).unwrap() - 1.0).abs() < 1e-6);