pub struct BlockSparsityPattern {
pub nblock_rows: usize,
pub nblock_cols: usize,
pub pattern: Vec<Vec<bool>>,
}Expand description
Binary pattern showing which blocks of a BSR tensor are non-zero.
This is useful for structural analysis (symmetry detection, diagonal coverage, bandwidth estimation) without loading the actual block data.
Fields§
§nblock_rows: usizeNumber of block-rows.
nblock_cols: usizeNumber of block-columns.
pattern: Vec<Vec<bool>>pattern[br][bc] is true iff block (br, bc) is stored.
Implementations§
Source§impl BlockSparsityPattern
impl BlockSparsityPattern
Sourcepub fn from_tensor(tensor: &BlockedSparseTensor) -> Self
pub fn from_tensor(tensor: &BlockedSparseTensor) -> Self
Derive the sparsity pattern from a BSR tensor.
Sourcepub fn is_symmetric(&self) -> bool
pub fn is_symmetric(&self) -> bool
Returns true if the block pattern is square and symmetric, i.e.
pattern[i][j] == pattern[j][i] for all valid (i, j).
Sourcepub fn has_diagonal_blocks(&self) -> bool
pub fn has_diagonal_blocks(&self) -> bool
Returns true if every diagonal block (i, i) is present.
Only meaningful for square block patterns.
Trait Implementations§
Source§impl Clone for BlockSparsityPattern
impl Clone for BlockSparsityPattern
Source§fn clone(&self) -> BlockSparsityPattern
fn clone(&self) -> BlockSparsityPattern
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 Freeze for BlockSparsityPattern
impl RefUnwindSafe for BlockSparsityPattern
impl Send for BlockSparsityPattern
impl Sync for BlockSparsityPattern
impl Unpin for BlockSparsityPattern
impl UnsafeUnpin for BlockSparsityPattern
impl UnwindSafe for BlockSparsityPattern
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 more