Skip to content

Commit

Permalink
add reference to wikipedia
Browse files Browse the repository at this point in the history
  • Loading branch information
jlogan03 committed Nov 20, 2023
1 parent a01e5fe commit 6083c46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions interpn/src/multilinear/rectilinear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
//! // Do interpolation
//! rectilinear::interpn(grids, &z, &obs, &mut out);
//! ```
//!
//! References
//! * https://en.wikipedia.org/wiki/Bilinear_interpolation#Weighted_mean
use num_traits::Float;

/// An arbitrary-dimensional multilinear interpolator / extrapolator on a rectilinear grid.
Expand Down
10 changes: 6 additions & 4 deletions interpn/src/multilinear/regular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
//! // Do interpolation
//! regular::interpn(&dims, &starts, &steps, &z, &obs, &mut out);
//! ```
//!
//! References
//! * https://en.wikipedia.org/wiki/Bilinear_interpolation#Weighted_mean
use num_traits::{Float, NumCast};

/// An arbitrary-dimensional multilinear interpolator / extrapolator on a regular grid.
Expand Down Expand Up @@ -91,8 +94,7 @@ pub struct RegularGridInterpolator<'a, T: Float, const MAXDIMS: usize> {
vals: &'a [T],
}

impl<'a, T: Float, const MAXDIMS: usize> RegularGridInterpolator<'a, T, MAXDIMS>
{
impl<'a, T: Float, const MAXDIMS: usize> RegularGridInterpolator<'a, T, MAXDIMS> {
/// Build a new interpolator, using O(MAXDIMS) calculations and storage.
///
/// This method does not handle degenerate dimensions with only a single
Expand Down Expand Up @@ -449,7 +451,7 @@ impl<'a, T: Float, const MAXDIMS: usize> RegularGridInterpolator<'a, T, MAXDIMS>
/// number for the MAXDIMS 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.
#[inline(always)]
Expand Down Expand Up @@ -547,7 +549,7 @@ mod test {
/// to traverse every combination of interpolating or extrapolating high or low on each dimension.
/// Each test evaluates at 3^ndims locations, largely extrapolated in corner regions, so it
/// rapidly becomes prohibitively slow after about ndims=9.
///
///
/// Make every other dimension have a negative step size to make sure
/// that mixing negative and positive steps works as intended.
#[test]
Expand Down

0 comments on commit 6083c46

Please sign in to comment.