Trait feanor_math::matrix::Matrix

source ·
pub trait Matrix<R>
where R: ?Sized + RingBase,
{ // Required methods fn row_count(&self) -> usize; fn col_count(&self) -> usize; fn entry_at(&self, i: usize, j: usize) -> &R::Element; // Provided methods fn format<'a, S>(&'a self, ring: &'a S) -> MatrixDisplayWrapper<'a, R, Self> where S: RingStore<Type = R> { ... } fn matrix_eq<M, S>(&self, other: &M, ring: S) -> bool where M: Matrix<R>, S: RingStore<Type = R> { ... } }
Expand description

A very minimalistic approach to implement matrices.

I have not yet decided on how exactly this library should “do” matrices. One problem is that efficient algorithms on matrices often need their own layout of data - e.g. sparse vs dense, column-vs row-major storage, maybe support for submatrices is needed, …

Hence, for now, we just have this trait to support writing and equality checking, which should at least vastly simplify testing matrix implementations and algorithms.

Also, note that this is not a library for numeric computations, we will never get linear algebra operations that efficiently work on floating point numbers. Use e.g. ndarray for that.

Required Methods§

source

fn row_count(&self) -> usize

source

fn col_count(&self) -> usize

source

fn entry_at(&self, i: usize, j: usize) -> &R::Element

Provided Methods§

source

fn format<'a, S>(&'a self, ring: &'a S) -> MatrixDisplayWrapper<'a, R, Self>
where S: RingStore<Type = R>,

source

fn matrix_eq<M, S>(&self, other: &M, ring: S) -> bool
where M: Matrix<R>, S: RingStore<Type = R>,

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<const N: usize, const M: usize, R> Matrix<R> for [[R::Element; N]; M]
where R: ?Sized + RingBase,

source§

fn col_count(&self) -> usize

source§

fn row_count(&self) -> usize

source§

fn entry_at(&self, i: usize, j: usize) -> &<R as RingBase>::Element

Implementors§

source§

impl<'a, V, R> Matrix<R> for Submatrix<'a, V, R::Element>
where V: 'a + AsPointerToSlice<R::Element>, R: RingBase,

source§

impl<'a, V, R> Matrix<R> for SubmatrixMut<'a, V, R::Element>
where V: 'a + AsPointerToSlice<R::Element>, R: ?Sized + RingBase,

source§

impl<R> Matrix<R> for SparseMatrixBuilder<R>
where R: ?Sized + RingBase,

source§

impl<R> Matrix<R> for DenseMatrix<R>
where R: ?Sized + RingBase,