pub struct SparseMatrix {
pub n: usize,
pub row_ptr: Vec<usize>,
pub cols: Vec<u32>,
pub vals: Vec<c64>,
}Expand description
Square complex matrix in CSR form; column indices are u32 (as on the GPU).
Fields§
§n: usizeNumber of rows and columns.
row_ptr: Vec<usize>Entries of row r are row_ptr[r]..row_ptr[r + 1].
cols: Vec<u32>Column of each stored entry, sorted within each row.
vals: Vec<c64>Value of each stored entry, aligned with cols.
Implementations§
Source§impl SparseMatrix
impl SparseMatrix
Sourcepub fn from_triplets(n: usize, entries: Vec<(usize, usize, c64)>) -> Self
pub fn from_triplets(n: usize, entries: Vec<(usize, usize, c64)>) -> Self
From (row, column, value) entries; duplicates are summed, columns sorted in each row.
Sourcepub fn row(&self, r: usize) -> impl Iterator<Item = (usize, c64)> + '_
pub fn row(&self, r: usize) -> impl Iterator<Item = (usize, c64)> + '_
Entries of row r as (column, value).
Sourcepub fn apply_block(&self, x: &[c64], y: &mut [c64], m: usize)
pub fn apply_block(&self, x: &[c64], y: &mut [c64], m: usize)
Y = A X for a block of m vectors stored interleaved (x[row·m + v]): the matrix is
read once for the whole block.
Sourcepub fn spectral_bounds(&self) -> (f64, f64)
pub fn spectral_bounds(&self) -> (f64, f64)
Gershgorin bounds (lower, upper) on the spectrum of a Hermitian matrix.
Trait Implementations§
Source§impl Clone for SparseMatrix
impl Clone for SparseMatrix
Source§fn clone(&self) -> SparseMatrix
fn clone(&self) -> SparseMatrix
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SparseMatrix
impl Debug for SparseMatrix
Source§impl PartialEq for SparseMatrix
impl PartialEq for SparseMatrix
Source§fn eq(&self, other: &SparseMatrix) -> bool
fn eq(&self, other: &SparseMatrix) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SparseMatrix
Auto Trait Implementations§
impl Freeze for SparseMatrix
impl RefUnwindSafe for SparseMatrix
impl Send for SparseMatrix
impl Sync for SparseMatrix
impl Unpin for SparseMatrix
impl UnsafeUnpin for SparseMatrix
impl UnwindSafe for SparseMatrix
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,
impl<T, U> Imply<T> for U
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