Skip to main content

BSpLineWorkspace

Struct BSpLineWorkspace 

Source
pub struct BSpLineWorkspace { /* private fields */ }

Implementations§

Source§

impl BSpLineWorkspace

Source

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).

Source

pub fn knots(&mut self, breakpts: &VectorF64) -> Result<(), Value>

This function computes the knots associated with the given breakpoints and stores them internally in w->knots.

Source

pub fn knots_uniform(&mut self, a: f64, b: f64) -> Result<(), 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.

Source

pub fn eval(&mut self, x: f64, B: &mut VectorF64) -> Result<(), 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.

Source

pub fn eval_non_zero( &mut self, x: f64, Bk: &mut VectorF64, ) -> Result<(usize, usize), Value>

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).

Source

pub fn ncoeffs(&mut self) -> usize

This function returns the number of B-spline coefficients given by n = nbreak + k - 2.

Source

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§

Source§

impl Drop for BSpLineWorkspace

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.