Trait RowIndexMap

Source
pub trait RowIndexMap: Send + Sync {
    // Required methods
    fn height(&self) -> usize;
    fn map_row_index(&self, r: usize) -> usize;

    // Provided method
    fn to_row_major_matrix<T: Clone + Send + Sync, Inner: Matrix<T>>(
        &self,
        inner: Inner,
    ) -> RowMajorMatrix<T> { ... }
}
Expand description

A trait for remapping row indices of a matrix.

Implementations can change the number of visible rows (height) and define how a given logical row index maps to a physical one.

Required Methods§

Source

fn height(&self) -> usize

Returns the number of rows exposed by the mapping.

Source

fn map_row_index(&self, r: usize) -> usize

Maps a visible row index r to the corresponding row index in the underlying matrix.

The input r is assumed to lie in the range 0..self.height() and the output will lie in the range 0..self.inner.height().

It is considered undefined behaviour to call map_row_index with r >= self.height().

Provided Methods§

Source

fn to_row_major_matrix<T: Clone + Send + Sync, Inner: Matrix<T>>( &self, inner: Inner, ) -> RowMajorMatrix<T>

Converts the mapped matrix into a dense row-major matrix.

This default implementation iterates over all mapped rows, collects them in order, and builds a dense representation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§