TriMatI

Type Alias TriMatI 

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

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