pub struct COOStorage {
pub row_indices: Vec<IndexType>,
pub col_indices: Vec<IndexType>,
pub values: Vec<Precision>,
}Expand description
Coordinate (COO) storage format.
Efficient for construction and random access patterns.
Fields§
§row_indices: Vec<IndexType>Row indices
col_indices: Vec<IndexType>Column indices
values: Vec<Precision>Values
Implementations§
Source§impl COOStorage
impl COOStorage
Sourcepub fn from_triplets(triplets: Vec<(usize, usize, Precision)>) -> Result<Self>
pub fn from_triplets(triplets: Vec<(usize, usize, Precision)>) -> Result<Self>
Create COO storage from triplets.
Sourcepub fn get(&self, row: usize, col: usize) -> Option<Precision>
pub fn get(&self, row: usize, col: usize) -> Option<Precision>
Get matrix element at (row, col) - O(n) search.
Sourcepub fn row_iter(&self, row: usize) -> COORowIter<'_> ⓘ
pub fn row_iter(&self, row: usize) -> COORowIter<'_> ⓘ
Iterate over non-zero elements in a row.
Sourcepub fn col_iter(&self, col: usize) -> COOColIter<'_> ⓘ
pub fn col_iter(&self, col: usize) -> COOColIter<'_> ⓘ
Iterate over non-zero elements in a column.
Sourcepub fn multiply_vector(&self, x: &[Precision], result: &mut [Precision])
pub fn multiply_vector(&self, x: &[Precision], result: &mut [Precision])
Matrix-vector multiplication: result = A * x
Sourcepub fn multiply_vector_add(&self, x: &[Precision], result: &mut [Precision])
pub fn multiply_vector_add(&self, x: &[Precision], result: &mut [Precision])
Matrix-vector multiplication with accumulation: result += A * x
Sourcepub fn add_diagonal(&mut self, alpha: Precision, rows: DimensionType)
pub fn add_diagonal(&mut self, alpha: Precision, rows: DimensionType)
Add a value to the diagonal.
Trait Implementations§
Source§impl Clone for COOStorage
impl Clone for COOStorage
Source§fn clone(&self) -> COOStorage
fn clone(&self) -> COOStorage
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 Debug for COOStorage
impl Debug for COOStorage
Source§impl<'de> Deserialize<'de> for COOStorage
impl<'de> Deserialize<'de> for COOStorage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for COOStorage
impl RefUnwindSafe for COOStorage
impl Send for COOStorage
impl Sync for COOStorage
impl Unpin for COOStorage
impl UnwindSafe for COOStorage
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