diff --git a/CHANGELOG.md b/CHANGELOG.md index eb6a740..bfad977 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,12 +18,12 @@ logarithmic spaced values. - added type aliases for common interpolators - make the `VectorExtensions` trait public - add `Interp1D::new_unchecked` and `Interp2D::new_unchecked` methods - - add biliniar extrapolation + - add bilinear extrapolation - impl `Default` for interpolation strategies # 0.3.0 - add 2d interpolation - - add biliniar interpolation strategy + - add bilinear interpolation strategy - rename `Strategy` to `Interp1DStrategy` and `StrategyBuilder` to `Interp1DStrategyBuilder` - make extrapolate filed of `Linear` private add `extrapolate(bool)` method instead. diff --git a/Cargo.toml b/Cargo.toml index 5a390e7..63c0ccc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ license = "MIT" description = "Interpolation package for ndarray" repository = "https://github.com/jonasBoss/ndarray-interp" -keywords = ["interpolation", "multidimensional", "liniar", "biliniar", "cubic-spline"] +keywords = ["interpolation", "multidimensional", "linear", "bilinear", "cubic-spline"] categories = ["science", "algorithms", "mathematics"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/README.md b/README.md index 11130fe..5c0a52c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A Interpolation crate for usage with the rust [ndarray](https://crates.io/crates ## Interpolation strategies - Linear interpolation with, and without extrapolation - Cubic spline interpolation [Wikipedia](https://en.wikipedia.org/wiki/Spline_interpolation) - - Biliniar interpolation with, and without extrapolation [Wikipedia](https://en.wikipedia.org/wiki/Bilinear_interpolation) + - Bilinear interpolation with, and without extrapolation [Wikipedia](https://en.wikipedia.org/wiki/Bilinear_interpolation) ## Planned Features - More interpolation strategies diff --git a/benches/bench_interp2d_query_dim.rs b/benches/bench_interp2d_query_dim.rs index 2e0e397..95442f4 100644 --- a/benches/bench_interp2d_query_dim.rs +++ b/benches/bench_interp2d_query_dim.rs @@ -1,12 +1,12 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion}; use ndarray::{Array, Array1, Axis}; -use ndarray_interp::interp2d::{Biliniar, Interp2D, Interp2DScalar}; +use ndarray_interp::interp2d::{Bilinear, Interp2D, Interp2DScalar}; use rand_extensions::RandArray; mod rand_extensions; -fn setup() -> (Interp2DScalar, Array1, Array1) { +fn setup() -> (Interp2DScalar, Array1, Array1) { let data = Array::from_rand(10_000, (0.0, 1.0), 42) .into_shape((100, 100)) .unwrap(); diff --git a/src/interp2d.rs b/src/interp2d.rs index 78eda50..62bf309 100644 --- a/src/interp2d.rs +++ b/src/interp2d.rs @@ -9,7 +9,7 @@ //! - [`Interp2DStrategyBuilder`] The trait used to specialize [`Interp2DBuilder`] to initialize the correct strategy //! //! # Strategies -//! - [`Biliniar`] Linear interpolation strategy +//! - [`Bilinear`] Linear interpolation strategy use std::{any::TypeId, fmt::Debug, ops::Sub}; @@ -29,7 +29,7 @@ use crate::{ mod aliases; mod strategies; pub use aliases::*; -pub use strategies::{Biliniar, Interp2DStrategy, Interp2DStrategyBuilder}; +pub use strategies::{Bilinear, Interp2DStrategy, Interp2DStrategyBuilder}; /// Two dimensional interpolator #[derive(Debug)] @@ -47,7 +47,7 @@ where strategy: Strat, } -impl Interp2D, OwnedRepr, D, Biliniar> +impl Interp2D, OwnedRepr, D, Bilinear> where Sd: Data, Sd::Elem: Num + PartialOrd + NumCast + Copy + Debug + Sub + Send, @@ -56,7 +56,7 @@ where /// Get the [Interp2DBuilder] pub fn builder( data: ArrayBase, - ) -> Interp2DBuilder, OwnedRepr, D, Biliniar> { + ) -> Interp2DBuilder, OwnedRepr, D, Bilinear> { Interp2DBuilder::new(data) } } @@ -379,7 +379,7 @@ where strategy: Strat, } -impl Interp2DBuilder, OwnedRepr, D, Biliniar> +impl Interp2DBuilder, OwnedRepr, D, Bilinear> where Sd: Data, Sd::Elem: Num + PartialOrd + NumCast + Copy + Debug + Sub, @@ -400,7 +400,7 @@ where x, y, data, - strategy: Biliniar::new(), + strategy: Bilinear::new(), } } } @@ -416,7 +416,7 @@ where Strat: Interp2DStrategyBuilder, { /// Set the interpolation strategy by provideing a [`Interp2DStrategyBuilder`]. - /// By default [`Biliniar`] is used. + /// By default [`Bilinear`] is used. pub fn strategy>( self, strategy: NewStrat, diff --git a/src/interp2d/strategies.rs b/src/interp2d/strategies.rs index 05df9cc..44f1f30 100644 --- a/src/interp2d/strategies.rs +++ b/src/interp2d/strategies.rs @@ -7,9 +7,9 @@ use crate::{BuilderError, InterpolateError}; use super::Interp2D; -mod biliniar; +mod bilinear; -pub use biliniar::Biliniar; +pub use bilinear::Bilinear; pub trait Interp2DStrategyBuilder where diff --git a/src/interp2d/strategies/biliniar.rs b/src/interp2d/strategies/bilinear.rs similarity index 93% rename from src/interp2d/strategies/biliniar.rs rename to src/interp2d/strategies/bilinear.rs index d114016..0883994 100644 --- a/src/interp2d/strategies/biliniar.rs +++ b/src/interp2d/strategies/bilinear.rs @@ -8,11 +8,11 @@ use crate::{interp1d::Linear, InterpolateError}; use super::{Interp2DStrategy, Interp2DStrategyBuilder}; #[derive(Debug)] -pub struct Biliniar { +pub struct Bilinear { extrapolate: bool, } -impl Interp2DStrategyBuilder for Biliniar +impl Interp2DStrategyBuilder for Bilinear where Sd: Data, Sd::Elem: Num + PartialOrd + NumCast + Copy + Debug + Sub + Send, @@ -35,7 +35,7 @@ where } } -impl Interp2DStrategy for Biliniar +impl Interp2DStrategy for Bilinear where Sd: Data, Sd::Elem: Num + PartialOrd + NumCast + Copy + Debug + Sub + Send, @@ -82,9 +82,9 @@ where } } -impl Biliniar { +impl Bilinear { pub fn new() -> Self { - Biliniar { extrapolate: false } + Bilinear { extrapolate: false } } pub fn extrapolate(mut self, yes: bool) -> Self { @@ -93,7 +93,7 @@ impl Biliniar { } } -impl Default for Biliniar { +impl Default for Bilinear { fn default() -> Self { Self::new() }