pub type TriMatI<N, I> = TriMatBase<Vec<I>, Vec<N>>;
Implementations§
source§impl<N, I: SpIndex> TriMatI<N, I>
impl<N, I: SpIndex> TriMatI<N, I>
sourcepub fn new(shape: (usize, usize)) -> Self
pub fn new(shape: (usize, usize)) -> Self
Create a new triplet matrix of shape (nb_rows, nb_cols)
sourcepub fn with_capacity(shape: (usize, usize), cap: usize) -> Self
pub fn with_capacity(shape: (usize, usize), cap: usize) -> Self
Create a new triplet matrix of shape (nb_rows, nb_cols)
, and
pre-allocate cap
elements on the backing storage
sourcepub fn from_triplets(
shape: (usize, usize),
row_inds: Vec<I>,
col_inds: Vec<I>,
data: Vec<N>
) -> Self
pub fn from_triplets( shape: (usize, usize), row_inds: Vec<I>, col_inds: Vec<I>, data: Vec<N> ) -> Self
Create a triplet matrix from its raw components. All arrays should have the same length.
Panics
- if the arrays don’t have the same length
- if either the row or column indices are out of bounds.
sourcepub fn add_triplet(&mut self, row: usize, col: usize, val: N)
pub fn add_triplet(&mut self, row: usize, col: usize, val: N)
Append a non-zero triplet to this matrix.
sourcepub fn reserve_exact(&mut self, cap: usize)
pub fn reserve_exact(&mut self, cap: usize)
Reserve exactly cap
non-zeros