Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
46fbeb9
add cubic spline extrapolation
jonasBoss Nov 1, 2023
fef47a3
wip boundary conditions for cubic spline interpolation
jonasBoss Dec 4, 2023
f3c4f91
move thomas algorithm to seperate fn
jonasBoss Dec 5, 2023
88737d5
fmt
jonasBoss Dec 5, 2023
051567e
fix bugs in NotAKnot interpolation
jonasBoss Dec 5, 2023
c29088a
impl NotAKnot for arrays of len==3
jonasBoss Dec 5, 2023
93a80b8
restructure boundary conditions
jonasBoss Dec 5, 2023
2a8a4b7
clippy + fmt
jonasBoss Dec 5, 2023
f3ab9b4
make sure f32 works for CubicSpline
jonasBoss Dec 5, 2023
9722f6f
no longer use const boundary conditions
jonasBoss Dec 5, 2023
1eee9e7
documentation
jonasBoss Dec 5, 2023
e7d6989
seperate left and right not a Knot logic
jonasBoss Dec 5, 2023
631c647
seperate left and right natural logic
jonasBoss Dec 5, 2023
156c263
move not a knot/len==3 special case for better readability
jonasBoss Dec 5, 2023
8872d05
concidere derivative for SecondDeriv boundary
jonasBoss Dec 5, 2023
3249b85
impl first deriv boundary
jonasBoss Dec 5, 2023
4a03896
allow heterogene boundary conditions
jonasBoss Dec 5, 2023
6368438
update structure and documentation
jonasBoss Dec 6, 2023
ed4e76d
update changelog
jonasBoss Dec 6, 2023
bd0b275
change indent in changelog
jonasBoss Dec 6, 2023
5c5e27a
add test for heterogenious boundary conditions
jonasBoss Dec 11, 2023
95e4518
add tests for clamped, first and second derivative boundaries
jonasBoss Dec 11, 2023
22f1732
doc
jonasBoss Dec 11, 2023
63b6f4a
return Result from calc_coefficients
jonasBoss Dec 11, 2023
c6d0817
change BuilderError
jonasBoss Dec 12, 2023
0b64bd9
changelog
jonasBoss Dec 12, 2023
ec51e04
tets shape error for boundary conditions
jonasBoss Dec 12, 2023
6333abe
return result from solve_for_k and solve_for_k_individual fn's
jonasBoss Dec 12, 2023
4ecd1ff
return result from solve_for_k and solve_for_k_individual fn's
jonasBoss Dec 12, 2023
8a6e661
a bit more consistant naming
jonasBoss Dec 19, 2023
5a1f388
implement solution for periodic spline
jonasBoss Dec 19, 2023
d2ad7cd
make periodic interpolation only available to the whole dataset
jonasBoss Jan 19, 2024
795df33
add tests for periodic
jonasBoss Jan 19, 2024
ca01f59
wrap periodic values when extrapolating
jonasBoss Jan 19, 2024
5ce6ba9
changelog
jonasBoss Jan 19, 2024
9509860
fmt
jonasBoss Jan 19, 2024
1f70909
tests for periodic cubic spline interpolation
jonasBoss Feb 8, 2024
3ab5490
impl specila handling of cubic spline when len==3
jonasBoss Feb 8, 2024
6cb3383
doc
jonasBoss Feb 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 0.5.0
- update `BuilderError`
- combine variants `DimensionError` and `AxisLenght` into `ShapeError`
- add `ValueError` variant
- update `CubicSpline` stragegie
- Move `CubicSpline` interpolator to `interp1d::cubic_spline` module
- add extrapolation
- add not-a-knot boundary condition
- add clamped boundary condition
- add periodic boundary condition
- make not-a-knot boundary condition the default
- allow any first or second derivative as boundary condition
- fix typo `Biliniar` -> `Bilinear`

# 0.4.1
- major performance improvement for `interp_scalar()` methods ~-50%
- keywords and categorys in crate metadata
Expand Down Expand Up @@ -37,7 +51,7 @@ logarithmic spaced values.
- updated package structure
- replaced Interp1DStrategy enum with individual structs
- added Strategy and StrategyBuilder trait
- added QubicSpline strategy
- added CubicSpline strategy
- added traits for custom strategies

# 0.1.1
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ndarray-interp"
version = "0.4.1"
version = "0.5.0"
edition = "2021"
license = "MIT"
description = "Interpolation package for ndarray"
Expand Down
15 changes: 11 additions & 4 deletions src/interp1d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//!
//! # Strategies
//! - [`Linear`] Linear interpolation strategy
//! - [`CubicSpline`] Cubic spline interpolation strategy
//! - [`cubic_spline`] Cubic spline interpolation strategy

use std::{any::TypeId, fmt::Debug, ops::Sub};

Expand All @@ -30,7 +30,14 @@ use crate::{
mod aliases;
mod strategies;
pub use aliases::*;
pub use strategies::{CubicSpline, Interp1DStrategy, Interp1DStrategyBuilder, Linear};
pub use strategies::linear::Linear;
pub use strategies::{Interp1DStrategy, Interp1DStrategyBuilder};

pub mod cubic_spline {
pub use super::strategies::cubic_spline::{
BoundaryCondition, CubicSpline, RowBoundary, SingleBoundary,
};
}

/// One dimensional interpolator
#[derive(Debug)]
Expand Down Expand Up @@ -444,7 +451,7 @@ where
let Interp1DBuilder { x, data, strategy } = self;

if data.ndim() < 1 {
return Err(DimensionError(
return Err(ShapeError(
"data dimension is 0, needs to be at least 1".into(),
));
}
Expand All @@ -460,7 +467,7 @@ where
));
}
if x.len() != data.shape()[0] {
return Err(BuilderError::AxisLenght(format!(
return Err(BuilderError::ShapeError(format!(
"Lengths of x and data axis need to match. Got x: {:}, data: {:}",
x.len(),
data.shape()[0],
Expand Down
7 changes: 2 additions & 5 deletions src/interp1d/strategies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ use num_traits::Num;
use super::Interp1D;
use crate::{BuilderError, InterpolateError};

mod cubic_spline;
mod linear;

pub use cubic_spline::CubicSpline;
pub use linear::Linear;
pub mod cubic_spline;
pub mod linear;

pub trait Interp1DStrategyBuilder<Sd, Sx, D>
where
Expand Down
Loading