Skip to main content

Matrix

Trait Matrix 

Source
pub trait Matrix<F: Float, const R: usize, const C: usize, const RC: usize>:
    ArrayBasic
    + ArrayRef<F, RC>
    + ArrayIndex<F>
    + ArrayConvert<F, RC>
    + ArrayAddSubNeg<F, RC>
    + ArrayScale<F> {
    // Provided methods
    fn is_zero(&self) -> bool { ... }
    fn set_zero(&mut self) -> &mut Self { ... }
    fn transpose<M: Matrix<F, C, R, RC>>(&self) -> M { ... }
}
Expand description

The Matrix trait describes an R-by-C matrix of Float type that operates on a Vector.

Such Matrix support basic arithmetic using addition and subtraction, scaling, indexing (linearly, row major).

The ‘transform vector’ methods are tricky to put in here as type inference fails more frequently then it does for square matrices (whwre R*C is always D^2)

Provided Methods§

Source

fn is_zero(&self) -> bool

Return true if the matrix is zero

Source

fn set_zero(&mut self) -> &mut Self

Set the matrix to zero

Source

fn transpose<M: Matrix<F, C, R, RC>>(&self) -> M

Return a transpose matrix

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F: Float, const R: usize, const C: usize, const RC: usize, M> Matrix<F, R, C, RC> for M
where M: ArrayBasic + ArrayRef<F, RC> + ArrayIndex<F> + ArrayConvert<F, RC> + ArrayAddSubNeg<F, RC> + ArrayScale<F>,