pub enum BoundaryCondition<T, D: Dimension> {
NotAKnot,
Natural,
Clamped,
Periodic,
Individual(Array<RowBoundary<T>, D>),
}
Expand description
Boundary conditions for the whole dataset
The boundary condition is structured in three hirarchic enum’s:
BoundaryCondition
The toplevel boundary applys to the whole datasetRowBoundary
applys to a single row in the datasetSingleBoundary
applys to an individual boundary of a single row
the default is the NotAKnot
boundary in each level
There are different possibilities for the boundary condition in each level:
NotAKnot
- all levelsNatural
- all levels (same asSecondDeriv(0.0)
)Clamped
- all levels (same asFirstDeriv(0.0)
)Periodic
- not inSingleBoundary
FirstDeriv
- only inSingleBoundary
SecondDeriv
- only inSingleBoundary
§Example
In a complex case all boundaries can be set individually:
let y = array![
[0.5, 1.0],
[0.0, 1.5],
[3.0, 0.5],
];
let x = array![-1.0, 0.0, 3.0];
// first data column: natural
// second data column top: NotAKnot
// second data column bottom: first derivative == 0.5
let boundaries = array![
[
RowBoundary::Natural,
RowBoundary::Mixed { left: SingleBoundary::NotAKnot, right: SingleBoundary::FirstDeriv(0.5)}
],
];
let strat = CubicSpline::new().boundary(BoundaryCondition::Individual(boundaries));
let interpolator = Interp1DBuilder::new(y)
.x(x)
.strategy(strat)
.build().unwrap();
Variants§
NotAKnot
Not a knot boundary. The first and second segment at a curve end are the same polynomial.
Natural
Natural boundary. The second derivative at the curve end is 0
Clamped
Clamped boundary. The first derivative at the curve end is 0
Periodic
Periodic spline. The interpolated functions is assumed to be periodic. The first and last element in the data must be equal.
Individual(Array<RowBoundary<T>, D>)
Set individual boundary conditions for each row in the data and/or individual conditions for the left and right boundary
Trait Implementations§
Source§impl<T, D: Dimension> Default for BoundaryCondition<T, D>
impl<T, D: Dimension> Default for BoundaryCondition<T, D>
impl<T: Eq, D: Eq + Dimension> Eq for BoundaryCondition<T, D>
impl<T, D: Dimension> StructuralPartialEq for BoundaryCondition<T, D>
Auto Trait Implementations§
impl<T, D> Freeze for BoundaryCondition<T, D>where
D: Freeze,
impl<T, D> RefUnwindSafe for BoundaryCondition<T, D>where
D: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, D> Send for BoundaryCondition<T, D>where
T: Send,
impl<T, D> Sync for BoundaryCondition<T, D>where
T: Sync,
impl<T, D> Unpin for BoundaryCondition<T, D>where
D: Unpin,
impl<T, D> UnwindSafe for BoundaryCondition<T, D>where
D: UnwindSafe,
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more