pub struct CSCStorage {
pub values: Vec<Precision>,
pub row_indices: Vec<IndexType>,
pub col_ptr: Vec<IndexType>,
}Expand description
Compressed Sparse Column (CSC) storage format.
Efficient for column-wise operations.
Fields§
§values: Vec<Precision>Non-zero values in column-major order
row_indices: Vec<IndexType>Row indices corresponding to values
col_ptr: Vec<IndexType>Column pointers: col_ptr[j] is the start of column j in values/row_indices
Implementations§
Source§impl CSCStorage
impl CSCStorage
Sourcepub fn from_coo(
coo: &COOStorage,
rows: DimensionType,
cols: DimensionType,
) -> Result<Self>
pub fn from_coo( coo: &COOStorage, rows: DimensionType, cols: DimensionType, ) -> Result<Self>
Create CSC storage from COO format.
Sourcepub fn from_csr(
csr: &CSRStorage,
rows: DimensionType,
cols: DimensionType,
) -> Result<Self>
pub fn from_csr( csr: &CSRStorage, rows: DimensionType, cols: DimensionType, ) -> Result<Self>
Create CSC storage from CSR format.
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).
Sourcepub fn row_iter(&self, row: usize) -> CSCRowIter<'_> ⓘ
pub fn row_iter(&self, row: usize) -> CSCRowIter<'_> ⓘ
Iterate over non-zero elements in a row (slow for CSC).
Sourcepub fn col_iter(&self, col: usize) -> CSCColIter<'_> ⓘ
pub fn col_iter(&self, col: usize) -> CSCColIter<'_> ⓘ
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 to_triplets(&self) -> Result<Vec<(usize, usize, Precision)>>
pub fn to_triplets(&self) -> Result<Vec<(usize, usize, Precision)>>
Extract as coordinate triplets.
Sourcepub fn add_diagonal(&mut self, alpha: Precision)
pub fn add_diagonal(&mut self, alpha: Precision)
Add a value to the diagonal.
Trait Implementations§
Source§impl Clone for CSCStorage
impl Clone for CSCStorage
Source§fn clone(&self) -> CSCStorage
fn clone(&self) -> CSCStorage
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 CSCStorage
impl Debug for CSCStorage
Source§impl<'de> Deserialize<'de> for CSCStorage
impl<'de> Deserialize<'de> for CSCStorage
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 CSCStorage
impl RefUnwindSafe for CSCStorage
impl Send for CSCStorage
impl Sync for CSCStorage
impl Unpin for CSCStorage
impl UnwindSafe for CSCStorage
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