CsrMatrixViewMethods

Trait CsrMatrixViewMethods 

Source
pub trait CsrMatrixViewMethods<'a, T> {
    // Required methods
    fn nrows(self) -> usize;
    fn ncols(self) -> usize;
    fn get_row(self, row_index: usize) -> CsVecRef<'a, T>;

    // Provided method
    fn to_dense(self) -> DMatrix<T>
       where Self: Sized + Copy,
             T: Real { ... }
}
Expand description

Trait providing methods for CSR matrix view operations.

This trait extends types that can be converted to CSR views with convenient methods for matrix operations and introspection.

Required Methods§

Source

fn nrows(self) -> usize

Returns the number of rows in the matrix.

Source

fn ncols(self) -> usize

Returns the number of columns in the matrix.

Source

fn get_row(self, row_index: usize) -> CsVecRef<'a, T>

Gets a row as a sparse vector.

§Arguments
  • row_index - Index of the row to retrieve
§Returns

A CsVecRef representing the sparse vector for this row

Provided Methods§

Source

fn to_dense(self) -> DMatrix<T>
where Self: Sized + Copy, T: Real,

Converts to a dense matrix.

This allocates a new dense matrix and copies all non-zero elements.

§Returns

A dense DMatrix containing the same data

Implementations on Foreign Types§

Source§

impl<'a, T, V> CsrMatrixViewMethods<'a, V> for &'a T
where V: Real, &'a T: IntoView<View = CsrMatrixView<'a, V>>,

Source§

fn nrows(self) -> usize

Get the number of rows.

Source§

fn ncols(self) -> usize

Get the number of columns.

Source§

fn get_row(self, row_index: usize) -> CsVecRef<'a, V>

Get a row as a sparse vector.

Implementors§