Skip to content

Commit a7a9b6e

Browse files
committed
v0.2.6
1 parent f853eff commit a7a9b6e

3 files changed

Lines changed: 14 additions & 21 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ninterp"
3-
version = "0.2.5"
3+
version = "0.2.6"
44
edition = "2021"
55
description = "Numerical interpolation for N-dimensional rectilinear grids"
66
repository = "https://github.com/NREL/ninterp"

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![docs.rs](https://img.shields.io/docsrs/ninterp)](https://docs.rs/ninterp/latest/ninterp) [![Crates.io Version](https://img.shields.io/crates/v/ninterp)](https://crates.io/crates/ninterp) [![GitHub](https://img.shields.io/badge/github-NREL/ninterp-blue)](https://github.com/NREL/ninterp/)
44

5-
The `ninterp` crate provides [multivariate interpolation](https://en.wikipedia.org/wiki/Multivariate_interpolation#Regular_grid) over rectilinear grids of any dimensionality. A variety of interpolation strategies are implemented, however more are likely to be added. Linear extrapolation is implemented for all dimensionalities.
5+
The `ninterp` crate provides [multivariate interpolation](https://en.wikipedia.org/wiki/Multivariate_interpolation#Regular_grid) over rectilinear grids of any dimensionality. A variety of interpolation strategies are implemented, and more are likely to be added.
66

77
There are hard-coded interpolators for lower dimensionalities (up to N = 3) for better runtime performance.
88

@@ -15,13 +15,12 @@ cargo add ninterp
1515

1616
## Getting Started
1717
A prelude module has been defined: `use ninterp::prelude::*;`.
18-
This exposes the types necessary for usage: `Interpolator`, `Strategy`, `Extrapolate`, and the trait `InterpMethods`.
18+
This exposes the types necessary for usage: `Interpolator`, `Strategy`, and `Extrapolate`.
1919

2020
All interpolation is handled through instances of the [`Interpolator`](https://docs.rs/ninterp/latest/ninterp/enum.Interpolator.html) enum.
2121

2222
Interpolation is executed by calling [`Interpolator::interpolate`](https://docs.rs/ninterp/latest/ninterp/enum.Interpolator.html#method.interpolate).
2323
The length of the supplied point slice must be equal to the interpolator dimensionality.
24-
The interpolator dimensionality can be retrieved by calling [`Interpolator::ndim`](https://docs.rs/ninterp/latest/ninterp/enum.Interpolator.html#method.ndim).
2524

2625
### Note
2726
For interpolators of dimensionality N ≥ 1:
@@ -30,10 +29,11 @@ These methods run a validation step that catches any potential errors early, pre
3029
- To set or get field values, use the corresponding named methods (`x`, `set_x`, etc.).
3130
- An interpolation [`Strategy`](https://docs.rs/ninterp/latest/ninterp/enum.Strategy.html) (e.g. linear, left-nearest, etc.) must be specified.
3231
Not all interpolation strategies are implemented for every dimensionality.
33-
`Strategy::Linear` is implemented for all dimensionalities.
32+
`Strategy::Linear` and `Strategy::Nearest` are implemented for all dimensionalities.
3433
- An [`Extrapolate`](https://docs.rs/ninterp/latest/ninterp/enum.Extrapolate.html) setting must be specified.
3534
This controls what happens when a point is beyond the range of supplied coordinates.
3635
If you are unsure which variant to choose, `Extrapolate::Error` is likely what you want.
36+
Linear extrapolation is implemented for all dimensionalities.
3737

3838
For 0-D (constant-value) interpolators, instantiate directly, e.g. `Interpolator::Interp0D(0.5)`
3939

src/lib.rs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
11
//! The `ninterp` crate provides
22
//! [multivariate interpolation](https://en.wikipedia.org/wiki/Multivariate_interpolation#Regular_grid)
33
//! over rectilinear grids of any dimensionality.
4-
//! A variety of interpolation strategies are implemented, however more are likely to be added.
5-
//! Linear extrapolation is implemented for all dimensionalities.
4+
//! A variety of interpolation strategies are implemented, and more are likely to be added.
65
//!
76
//! There are hard-coded interpolators for lower dimensionalities (up to N = 3) for better runtime performance.
87
//!
9-
//! All interpolation is handled through instances of the [`Interpolator`] enum,
10-
//! with the selected tuple variant containing relevant data.
11-
//! Interpolation is executed by calling [`Interpolator::interpolate`].
12-
//!
138
//! # Feature Flags
149
//! - `serde`: support for [`serde`](https://crates.io/crates/serde)
1510
//!
1611
//! # Getting Started
1712
//! A prelude module has been defined: `use ninterp::prelude::*;`.
18-
//! This exposes the types necessary for usage: [`Interpolator`], [`Strategy`], [`Extrapolate`], and the trait [`InterpMethods`].
13+
//! This exposes the types necessary for usage: [`Interpolator`], [`Strategy`], and [`Extrapolate`].
1914
//!
2015
//! All interpolation is handled through instances of the [`Interpolator`] enum.
2116
//!
2217
//! Interpolation is executed by calling [`Interpolator::interpolate`].
2318
//! The length of the supplied point slice must be equal to the interpolator dimensionality.
24-
//! The interpolator dimensionality can be retrieved by calling [`Interpolator::ndim`].
2519
//!
2620
//! ## Note
2721
//! For interpolators of dimensionality N ≥ 1:
@@ -30,10 +24,11 @@
3024
//! - To set or get field values, use the corresponding named methods (`x`, `set_x`, etc.).
3125
//! - An interpolation [`Strategy`] (e.g. linear, left-nearest, etc.) must be specified.
3226
//! Not all interpolation strategies are implemented for every dimensionality.
33-
//! [`Strategy::Linear`] is implemented for all dimensionalities.
27+
//! [`Strategy::Linear`] and [`Strategy::Nearest`] are implemented for all dimensionalities.
3428
//! - An [`Extrapolate`] setting must be specified.
3529
//! This controls what happens when a point is beyond the range of supplied coordinates.
3630
//! If you are unsure which variant to choose, [`Extrapolate::Error`] is likely what you want.
31+
//! Linear extrapolation is implemented for all dimensionalities.
3732
//!
3833
//! For 0-D (constant-value) interpolators, instantiate directly, e.g. `Interpolator::Interp0D(0.5)`
3934
//!
@@ -146,7 +141,7 @@ impl Interpolator {
146141
/// - [`Strategy::Nearest`]
147142
///
148143
/// Applicable extrapolation strategies:
149-
/// - [`Extrapolate::Enable`] (for [`Strategy::Linear`])
144+
/// - [`Extrapolate::Enable`] (in combination with [`Strategy::Linear`])
150145
/// - [`Extrapolate::Clamp`]
151146
/// - [`Extrapolate::Error`]
152147
///
@@ -198,7 +193,7 @@ impl Interpolator {
198193
/// - [`Strategy::Nearest`]
199194
///
200195
/// Applicable extrapolation strategies:
201-
/// - [`Extrapolate::Enable`] (for [`Strategy::Linear`])
196+
/// - [`Extrapolate::Enable`] (in combination with [`Strategy::Linear`])
202197
/// - [`Extrapolate::Clamp`]
203198
/// - [`Extrapolate::Error`]
204199
///
@@ -252,7 +247,7 @@ impl Interpolator {
252247
/// - [`Strategy::Nearest`]
253248
///
254249
/// Applicable extrapolation strategies:
255-
/// - [`Extrapolate::Enable`] (for [`Strategy::Linear`])
250+
/// - [`Extrapolate::Enable`] (in combination with [`Strategy::Linear`])
256251
/// - [`Extrapolate::Clamp`]
257252
/// - [`Extrapolate::Error`]
258253
///
@@ -316,7 +311,7 @@ impl Interpolator {
316311
/// - [`Strategy::Nearest`]
317312
///
318313
/// Applicable extrapolation strategies:
319-
/// - [`Extrapolate::Enable`] (for [`Strategy::Linear`])
314+
/// - [`Extrapolate::Enable`] (in combination with [`Strategy::Linear`])
320315
/// - [`Extrapolate::Clamp`]
321316
/// - [`Extrapolate::Error`]
322317
///
@@ -803,9 +798,7 @@ pub enum Strategy {
803798
#[derive(Clone, Debug, PartialEq, Default)]
804799
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
805800
pub enum Extrapolate {
806-
/// If interpolant point is beyond the limits of the interpolation grid,
807-
/// find result via extrapolation using slope of nearby points.
808-
/// Currently only implemented for 1-D linear interpolation.
801+
/// Evaluate beyond the limits of the interpolation grid.
809802
Enable,
810803
/// Restrict interpolant point to the limits of the interpolation grid, using [`f64::clamp`].
811804
Clamp,

0 commit comments

Comments
 (0)