Struct rgsl::types::basis_spline::BSpLineWorkspace
source · [−]pub struct BSpLineWorkspace { /* private fields */ }
Implementations
sourceimpl BSpLineWorkspace
impl BSpLineWorkspace
sourcepub fn new(k: usize, nbreak: usize) -> Option<Self>
pub fn new(k: usize, nbreak: usize) -> Option<Self>
This function allocates a workspace for computing B-splines of order k.
The number of breakpoints is given by nbreak. This leads to n = nbreak + k - 2 basis functions.
Cubic B-splines are specified by k = 4. The size of the workspace is O(5k + nbreak).
sourcepub fn knots(&mut self, breakpts: &VectorF64) -> Value
pub fn knots(&mut self, breakpts: &VectorF64) -> Value
This function computes the knots associated with the given breakpoints and stores them internally in w->knots.
sourcepub fn knots_uniform(&mut self, a: f64, b: f64) -> Value
pub fn knots_uniform(&mut self, a: f64, b: f64) -> Value
This function assumes uniformly spaced breakpoints on [a,b] and constructs the corresponding knot vector using the previously specified nbreak parameter. The knots are stored in w->knots.
sourcepub fn eval(&mut self, x: f64, B: &mut VectorF64) -> Value
pub fn eval(&mut self, x: f64, B: &mut VectorF64) -> Value
This function evaluates all B-spline basis functions at the position x and stores them in the vector B, so that the i-th element is B_i(x).
The vector B must be of length n = nbreak + k - 2. This value may also be obtained by calling gsl_bspline_ncoeffs.
Computing all the basis functions at once is more efficient than computing them individually, due to the nature of the defining recurrence relation.
sourcepub fn eval_non_zero(
&mut self,
x: f64,
Bk: &mut VectorF64
) -> (Value, usize, usize)
pub fn eval_non_zero(
&mut self,
x: f64,
Bk: &mut VectorF64
) -> (Value, usize, usize)
This function evaluates all potentially nonzero B-spline basis functions at the position x and stores them in the vector Bk, so that the i-th element is B_(istart+i)(x).
The last element of Bk is B_(iend)(x). The vector Bk must be of length k. By returning only the nonzero basis functions, this function allows quantities involving linear combinations of the B_i(x) to be computed without unnecessary terms (such linear combinations occur, for example, when evaluating an interpolated function).
Returns (Value, istart, iend)
.
sourcepub fn ncoeffs(&mut self) -> usize
pub fn ncoeffs(&mut self) -> usize
This function returns the number of B-spline coefficients given by n = nbreak + k - 2.
sourcepub fn greville_abscissa(&mut self, i: usize) -> f64
pub fn greville_abscissa(&mut self, i: usize) -> f64
The Greville abscissae are defined to be the mean location of k-1 consecutive knots in the knot vector for each basis spline function of order k.
With the first and last knots in the gsl_bspline_workspace knot vector excluded, there are gsl_bspline_ncoeffs Greville abscissae for any given B-spline basis.
These values are often used in B-spline collocation applications and may also be called Marsden-Schoenberg points.
Returns the location of the i-th Greville abscissa for the given B-spline basis. For the ill-defined case when k=1, the implementation chooses to return breakpoint interval midpoints.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for BSpLineWorkspace
impl !Send for BSpLineWorkspace
impl !Sync for BSpLineWorkspace
impl Unpin for BSpLineWorkspace
impl UnwindSafe for BSpLineWorkspace
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more