Trait smawk::Matrix[][src]

pub trait Matrix<T: Copy> {
    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

Return the number of rows.

Return the number of columns.

Return a matrix element.

Implementations on Foreign Types

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

Implementors