pub trait Matrix<T: Copy> {
// Required methods
fn nrows(&self) -> usize;
fn ncols(&self) -> usize;
fn index(&self, row: usize, column: usize) -> T;
}
Expand description
Minimal matrix trait for two-dimensional arrays.
This provides the functionality needed to represent a read-only
numeric matrix. You can query the size of the matrix and access
elements. Modeled after [ndarray::Array2
] from the ndarray
crate.
Enable the ndarray
Cargo feature if you want to use it with
ndarray::Array2
.
Required Methods§
Implementations on Foreign Types§
source§impl<T: Copy> Matrix<T> for Vec<Vec<T>>
impl<T: Copy> Matrix<T> for Vec<Vec<T>>
Simple and inefficient matrix representation used for doctest examples and simple unit tests.
You should prefer implementing it yourself, or you can enable the
ndarray
Cargo feature and use the provided implementation for
[ndarray::Array2
].