interp
An implementation of 1-dimensional linear interpolation in Rust, similar to MATLAB's interp1 or
NumPy's numpy.interp.
API documentation is available on docs.rs.
Usage
Add interp to your Cargo.toml file:
[]
= "2.1"
Example
use ;
let x = vec!;
let y = vec!;
// Interpolate at a single point
assert_eq!;
// Interpolate a slice - alloces a new results Vec<T>
let xp = vec!;
assert_eq!;
// Interpolate an array
let xp = ;
assert_eq!;
[!WARNING]
xis expected to be strictly increasing, but this is not explicitly enforced. However, if the sequencexis not strictly increasing, interpolation results are meaningless.
Full API documentation is available on docs.rs.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
You can install the pre-commit hook (which checks formatting, etc) by running:
Licence
Licensed under either of
- Apache License, Version 2.0 (LICENCE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENCE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.