pub type TriMatI<N, I> = TriMatBase<Vec<I>, Vec<N>>;Aliased Type§
pub struct TriMatI<N, I> { /* private fields */ }Implementations§
Source§impl<N, I: SpIndex> TriMatI<N, I>
§Methods for creating triplet matrices that own their data.
impl<N, I: SpIndex> TriMatI<N, I>
§Methods for creating triplet matrices that own their data.
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