pub struct DokMatrix<T> { /* private fields */ }
Expand description
Dictionary of Keys (DOK) matrix
A sparse matrix format that stores elements in a dictionary (hash map), making it efficient for incremental construction.
Implementations§
Source§impl<T> DokMatrix<T>
impl<T> DokMatrix<T>
Sourcepub fn new(shape: (usize, usize)) -> Self
pub fn new(shape: (usize, usize)) -> Self
Create a new DOK matrix
§Arguments
shape
- Tuple containing the matrix dimensions (rows, cols)
§Returns
- A new empty DOK matrix
§Examples
use scirs2_sparse::dok::DokMatrix;
// Create a 3x3 sparse matrix
let mut matrix = DokMatrix::<f64>::new((3, 3));
// Set some values
matrix.set(0, 0, 1.0);
matrix.set(0, 2, 2.0);
matrix.set(1, 2, 3.0);
matrix.set(2, 0, 4.0);
matrix.set(2, 1, 5.0);
Auto Trait Implementations§
impl<T> Freeze for DokMatrix<T>
impl<T> RefUnwindSafe for DokMatrix<T>where
T: RefUnwindSafe,
impl<T> Send for DokMatrix<T>where
T: Send,
impl<T> Sync for DokMatrix<T>where
T: Sync,
impl<T> Unpin for DokMatrix<T>where
T: Unpin,
impl<T> UnwindSafe for DokMatrix<T>where
T: UnwindSafe,
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> 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