Trait Matrix

Source
pub trait Matrix: Sized {
    // Required methods
    fn height(&self) -> usize;
    fn length(&self) -> usize;
    fn empty() -> Self;
}

Required Methods§

Source

fn height(&self) -> usize

Returns the height of the given matrix

§Examples
let a = [
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0]
];
assert_eq!(a.height(), 2);
Source

fn length(&self) -> usize

Returns the length of the given matrix

§Examples
let a = [
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0]
];
assert_eq!(a.length(), 3);
Source

fn empty() -> Self

Returns an empty matrix with the given dimensions

§Examples
let a = [
    [0.0, 0.0],
    [0.0, 0.0]
]
assert_eq!(a, Matrix::empty())

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<F: Zero, const L: usize, const H: usize> Matrix for [[F; L]; H]
where [[F; { _ }]; { _ }]:,

Source§

fn height(&self) -> usize

Source§

fn length(&self) -> usize

Source§

fn empty() -> Self

Implementors§