pub struct EllpackMatrix<T> {
pub nrows: usize,
pub ncols: usize,
pub max_nnz_per_row: usize,
pub col_indices: Vec<usize>,
pub values: Vec<T>,
}Expand description
ELLPACK (ITPACK) sparse matrix format.
Stores the matrix as a dense 2-D array where every row has the same width
(max_nnz_per_row). Shorter rows are padded with (invalid_col, 0.0).
§Layout
col_indices: [row0_col0, row0_col1, ..., row0_col_{max-1},
row1_col0, ..., ] -- shape (nrows, max_nnz_per_row)
values: same shapeThis layout enables coalesced GPU memory access during SpMV.
Fields§
§nrows: usizeNumber of rows.
ncols: usizeNumber of columns.
max_nnz_per_row: usizeMaximum non-zeros per row (padding width).
col_indices: Vec<usize>Column indices, row-major; length = nrows * max_nnz_per_row.
Padding entries use ELLPACK_PADDING_COL.
values: Vec<T>Values, row-major; padding entries are zero.
Implementations§
Source§impl<T> EllpackMatrix<T>
impl<T> EllpackMatrix<T>
Sourcepub fn from_csr(csr: &CsrMatrix<T>) -> SparseResult<Self>
pub fn from_csr(csr: &CsrMatrix<T>) -> SparseResult<Self>
Construct an ELLPACK matrix from a CSR matrix.
The max_nnz_per_row is determined automatically as the maximum row
length in the CSR matrix.
Sourcepub fn spmv(&self, x: &[T]) -> SparseResult<Vec<T>>
pub fn spmv(&self, x: &[T]) -> SparseResult<Vec<T>>
Perform SpMV: y = self * x.
Sourcepub fn to_csr(&self) -> SparseResult<CsrMatrix<T>>where
T: PartialEq,
pub fn to_csr(&self) -> SparseResult<CsrMatrix<T>>where
T: PartialEq,
Convert back to CSR format.
Trait Implementations§
Source§impl<T: Clone> Clone for EllpackMatrix<T>
impl<T: Clone> Clone for EllpackMatrix<T>
Source§fn clone(&self) -> EllpackMatrix<T>
fn clone(&self) -> EllpackMatrix<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 moreAuto Trait Implementations§
impl<T> Freeze for EllpackMatrix<T>
impl<T> RefUnwindSafe for EllpackMatrix<T>where
T: RefUnwindSafe,
impl<T> Send for EllpackMatrix<T>where
T: Send,
impl<T> Sync for EllpackMatrix<T>where
T: Sync,
impl<T> Unpin for EllpackMatrix<T>where
T: Unpin,
impl<T> UnsafeUnpin for EllpackMatrix<T>
impl<T> UnwindSafe for EllpackMatrix<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> 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