Type Definition sprs::TriMatI

source ·
pub type TriMatI<N, I> = TriMatBase<Vec<I>, Vec<N>>;

Implementations§

source§

impl<N, I: SpIndex> TriMatI<N, I>

source

pub fn new(shape: (usize, usize)) -> Self

Create a new triplet matrix of shape (nb_rows, nb_cols)

source

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

source

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.
source

pub fn add_triplet(&mut self, row: usize, col: usize, val: N)

Append a non-zero triplet to this matrix.

source

pub fn reserve(&mut self, cap: usize)

Reserve cap additional non-zeros

source

pub fn reserve_exact(&mut self, cap: usize)

Reserve exactly cap non-zeros