pub trait Array2dOps<T, const M: usize, const N: usize>: ArrayOps<[T; N], M> {
    type Array2d<I, const H: usize, const W: usize>: Array2dOps<I, H, W>;
    type Resized2d<const H: usize, const W: usize>: Array2dOps<T, H, W> = Self::Array2d<T, H, W>;
    type Transposed: Array2dOps<T, N, M> = Self::Resized2d<N, M>;

    // Required methods
    fn transpose(self) -> Self::Transposed;
    fn mul_matrix<Rhs, const P: usize>(
        &self,
        rhs: &Self::Array2d<Rhs, N, P>
    ) -> Self::Array2d<<T as Mul<Rhs>>::Output, M, P>
       where T: Mul<Rhs, Output: AddAssign + Default> + Copy,
             Rhs: Copy;
}

Required Associated Types§

source

type Array2d<I, const H: usize, const W: usize>: Array2dOps<I, H, W>

Provided Associated Types§

source

type Resized2d<const H: usize, const W: usize>: Array2dOps<T, H, W> = Self::Array2d<T, H, W>

source

type Transposed: Array2dOps<T, N, M> = Self::Resized2d<N, M>

Required Methods§

source

fn transpose(self) -> Self::Transposed

Transposes a two-dimensional array (as if it were a matrix)

Example
use array_trait::*;
 
let matrix: [[u8; 5]; 3] = [
    [1,   2,  3,  4,  5],
    [6,   7,  8,  9, 10],
    [11, 12, 13, 14, 15]
];
 
assert_eq!(matrix.transpose(), [
    [1,  6, 11],
    [2,  7, 12],
    [3,  8, 13],
    [4,  9, 14],
    [5, 10, 15]
]);
source

fn mul_matrix<Rhs, const P: usize>( &self, rhs: &Self::Array2d<Rhs, N, P> ) -> Self::Array2d<<T as Mul<Rhs>>::Output, M, P>
where T: Mul<Rhs, Output: AddAssign + Default> + Copy, Rhs: Copy,

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T, const M: usize, const N: usize> Array2dOps<T, M, N> for [[T; N]; M]

§

type Array2d<I, const H: usize, const W: usize> = [[I; W]; H]

source§

fn transpose(self) -> Self::Transposed

source§

fn mul_matrix<Rhs, const P: usize>( &self, rhs: &Self::Array2d<Rhs, N, P> ) -> Self::Array2d<<T as Mul<Rhs>>::Output, M, P>
where T: Mul<Rhs, Output: AddAssign + Default> + Copy, Rhs: Copy,

Implementors§