pub struct CsrMatrix<F: Float> {
pub indptr: Vec<usize>,
pub indices: Vec<usize>,
pub data: Vec<F>,
pub n_rows: usize,
pub n_cols: usize,
}Fields§
§indptr: Vec<usize>§indices: Vec<usize>§data: Vec<F>§n_rows: usize§n_cols: usizeImplementations§
Source§impl<F: Float> CsrMatrix<F>
impl<F: Float> CsrMatrix<F>
Sourcepub fn from_triplets(
n_rows: usize,
n_cols: usize,
triplets: Vec<(usize, usize, F)>,
) -> Self
pub fn from_triplets( n_rows: usize, n_cols: usize, triplets: Vec<(usize, usize, F)>, ) -> Self
Build from a list of (row, col, value) triplets. Triplets do not
need to be sorted; this constructor sorts within each row by column.
Duplicate (row, col) entries are summed.
pub fn nnz(&self) -> usize
pub fn density(&self) -> f64
Sourcepub fn row_iter(&self, i: usize) -> impl Iterator<Item = (usize, F)> + '_
pub fn row_iter(&self, i: usize) -> impl Iterator<Item = (usize, F)> + '_
Iterate non-zeros of row i as (col, value) pairs.
pub fn to_dense(&self) -> Array2<F>
Trait Implementations§
Source§impl<'de, F> Deserialize<'de> for CsrMatrix<F>where
F: DeserializeOwned + Float,
impl<'de, F> Deserialize<'de> for CsrMatrix<F>where
F: DeserializeOwned + Float,
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<F> Freeze for CsrMatrix<F>
impl<F> RefUnwindSafe for CsrMatrix<F>where
F: RefUnwindSafe,
impl<F> Send for CsrMatrix<F>
impl<F> Sync for CsrMatrix<F>
impl<F> Unpin for CsrMatrix<F>where
F: Unpin,
impl<F> UnsafeUnpin for CsrMatrix<F>
impl<F> UnwindSafe for CsrMatrix<F>where
F: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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