pub struct DiagonalBlockMatrixView<'a, T> { /* private fields */ }Expand description
An immutable view of a block diagonal matrix.
This provides efficient read-only access to block diagonal matrix data without allocation. Views are commonly used for matrix operations and can be easily created from block diagonal matrices.
§Examples
use algebra_sparse::DiagonalBlockMatrix;
use algebra_sparse::traits::IntoView;
let matrix = DiagonalBlockMatrix::from_block_values(vec![1.0, 2.0, 3.0, 4.0], &[2, 2]);
let view = matrix.into_view();
println!("Number of blocks: {}", view.num_blocks());
println!("Matrix shape: {}x{}", view.nrows(), view.ncols());Implementations§
Source§impl<'a, T> DiagonalBlockMatrixView<'a, T>where
T: RealField,
impl<'a, T> DiagonalBlockMatrixView<'a, T>where
T: RealField,
Sourcepub fn from_parts_unchecked(
values: &'a [T],
block_row_offsets: &'a [usize],
block_element_offsets: &'a [usize],
) -> Self
pub fn from_parts_unchecked( values: &'a [T], block_row_offsets: &'a [usize], block_element_offsets: &'a [usize], ) -> Self
Creates a block diagonal matrix view from raw parts without checking validity.
§Safety
This function does not validate that the provided parts form a valid block diagonal matrix. Invalid parts may cause undefined behavior when accessing the matrix.
§Arguments
values- All block elements stored contiguouslyblock_row_offsets- Row offset array for each blockblock_element_offsets- Element offset array for each block
pub fn values(&self) -> &[T]
pub fn num_blocks(&self) -> usize
pub fn nrows(&self) -> usize
pub fn ncols(&self) -> usize
Sourcepub fn get_block_size(&self, block_index: usize) -> usize
pub fn get_block_size(&self, block_index: usize) -> usize
pub fn get_block_row_start(&self, block_index: usize) -> usize
Sourcepub fn get_block_row_range(&self, block_index: usize) -> Range<usize>
pub fn get_block_row_range(&self, block_index: usize) -> Range<usize>
Get the range of rows for the given block index.
Sourcepub fn view_block(&self, block_index: usize) -> DMatrixView<'_, T>
pub fn view_block(&self, block_index: usize) -> DMatrixView<'_, T>
Get the block matrix at the given index as a view.
§Panics
Panics if the block_index is out of bounds.
pub fn to_dense(&self) -> DMatrix<T>
Trait Implementations§
Source§impl<'a, T: Clone> Clone for DiagonalBlockMatrixView<'a, T>
impl<'a, T: Clone> Clone for DiagonalBlockMatrixView<'a, T>
Source§fn clone(&self) -> DiagonalBlockMatrixView<'a, T>
fn clone(&self) -> DiagonalBlockMatrixView<'a, 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 moreSource§impl<'a, T: Real> Mul<DiagonalBlockMatrixView<'a, T>> for CsrMatrixView<'a, T>
impl<'a, T: Real> Mul<DiagonalBlockMatrixView<'a, T>> for CsrMatrixView<'a, T>
Source§impl<'a, T: Real> Mul<Matrix<T, Dyn, Const<1>, VecStorage<T, Dyn, Const<1>>>> for DiagonalBlockMatrixView<'a, T>
impl<'a, T: Real> Mul<Matrix<T, Dyn, Const<1>, VecStorage<T, Dyn, Const<1>>>> for DiagonalBlockMatrixView<'a, T>
Source§impl<'a, T: Real> Mul<Matrix<T, Dyn, Const<1>, ViewStorage<'a, T, Dyn, Const<1>, Const<1>, Dyn>>> for DiagonalBlockMatrixView<'a, T>
impl<'a, T: Real> Mul<Matrix<T, Dyn, Const<1>, ViewStorage<'a, T, Dyn, Const<1>, Const<1>, Dyn>>> for DiagonalBlockMatrixView<'a, T>
Source§impl<'a, T: Real> Mul<Matrix<T, Dyn, Dyn, ViewStorage<'a, T, Dyn, Dyn, Const<1>, Dyn>>> for DiagonalBlockMatrixView<'a, T>
impl<'a, T: Real> Mul<Matrix<T, Dyn, Dyn, ViewStorage<'a, T, Dyn, Dyn, Const<1>, Dyn>>> for DiagonalBlockMatrixView<'a, T>
impl<'a, T: Copy> Copy for DiagonalBlockMatrixView<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for DiagonalBlockMatrixView<'a, T>
impl<'a, T> RefUnwindSafe for DiagonalBlockMatrixView<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for DiagonalBlockMatrixView<'a, T>where
T: Sync,
impl<'a, T> Sync for DiagonalBlockMatrixView<'a, T>where
T: Sync,
impl<'a, T> Unpin for DiagonalBlockMatrixView<'a, T>
impl<'a, T> UnwindSafe for DiagonalBlockMatrixView<'a, 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<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.