pub struct BandMatrix<T>{ /* private fields */ }
Expand description
A band matrix optimized for storage and operations
Band matrices arise naturally in B-spline interpolation problems where each basis function has local support.
Implementations§
Source§impl<T> BandMatrix<T>
impl<T> BandMatrix<T>
Sourcepub fn new(size: usize, kl: usize, ku: usize) -> Self
pub fn new(size: usize, kl: usize, ku: usize) -> Self
Create a new band matrix with specified super and sub diagonals
§Arguments
size
- Number of rows/columns (matrix is square)kl
- Number of sub-diagonals below the main diagonalku
- Number of super-diagonals above the main diagonal
§Examples
use scirs2_interpolate::structured_matrix::BandMatrix;
// Create a tridiagonal matrix (1 sub, 1 super diagonal)
let band_matrix = BandMatrix::<f64>::new(5, 1, 1);
Sourcepub fn from_dense(
dense: &ArrayView2<'_, T>,
kl: usize,
ku: usize,
) -> InterpolateResult<Self>
pub fn from_dense( dense: &ArrayView2<'_, T>, kl: usize, ku: usize, ) -> InterpolateResult<Self>
Create a band matrix from dense matrix by extracting the band
§Arguments
dense
- Dense matrix to extract band fromkl
- Number of sub-diagonals to extractku
- Number of super-diagonals to extract
Sourcepub fn subdiagonals(&self) -> usize
pub fn subdiagonals(&self) -> usize
Get the number of sub-diagonals
Sourcepub fn superdiagonals(&self) -> usize
pub fn superdiagonals(&self) -> usize
Get the number of super-diagonals
Sourcepub fn set_diagonal(&mut self, i: usize, value: T)
pub fn set_diagonal(&mut self, i: usize, value: T)
Set a value on the main diagonal
Sourcepub fn set_superdiagonal(&mut self, i: usize, value: T)
pub fn set_superdiagonal(&mut self, i: usize, value: T)
Sourcepub fn set_subdiagonal(&mut self, i: usize, value: T)
pub fn set_subdiagonal(&mut self, i: usize, value: T)
Sourcepub fn multiply_vector(
&self,
x: &ArrayView1<'_, T>,
) -> InterpolateResult<Array1<T>>
pub fn multiply_vector( &self, x: &ArrayView1<'_, T>, ) -> InterpolateResult<Array1<T>>
Sourcepub fn band_data(&self) -> &Array2<T>
pub fn band_data(&self) -> &Array2<T>
Access to the underlying band storage for advanced operations
Sourcepub fn band_data_mut(&mut self) -> &mut Array2<T>
pub fn band_data_mut(&mut self) -> &mut Array2<T>
Mutable access to the underlying band storage
Trait Implementations§
Source§impl<T> Clone for BandMatrix<T>
impl<T> Clone for BandMatrix<T>
Source§fn clone(&self) -> BandMatrix<T>
fn clone(&self) -> BandMatrix<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<T> Freeze for BandMatrix<T>
impl<T> RefUnwindSafe for BandMatrix<T>where
T: RefUnwindSafe,
impl<T> Send for BandMatrix<T>where
T: Send,
impl<T> Sync for BandMatrix<T>where
T: Sync,
impl<T> Unpin for BandMatrix<T>
impl<T> UnwindSafe for BandMatrix<T>where
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.