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; }

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

fn nrows(&self) -> usize[src]

Return the number of rows.

fn ncols(&self) -> usize[src]

Return the number of columns.

fn index(&self, row: usize, column: usize) -> T[src]

Return a matrix element.

Loading content...

Implementations on Foreign Types

impl<T: Copy> Matrix<T> for Vec<Vec<T>>[src]

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

Loading content...

Implementors

Loading content...