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§
Sourcefn map_row_index(&self, r: usize) -> usize
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§
Sourcefn to_row_major_matrix<T: Clone + Send + Sync, Inner: Matrix<T>>(
&self,
inner: Inner,
) -> RowMajorMatrix<T>
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.