array_matrix/matrix/
div.rs1use std::ops::{Div};
2
3use crate::{matrix_init, Matrix};
4
5pub trait MDiv<Rhs>: Matrix
6where
7 Self::Output: Matrix
8{
9 type Output;
10
11 fn div(self, rhs: Rhs) -> Self::Output;
34}
35
36impl<F, const L: usize, const H: usize> MDiv<F> for [[F; L]; H]
37where
38 Self: Matrix,
39 [[<F as Div<F>>::Output; L]; H]: Matrix,
40 F: Clone + Div<F>
41{
42 type Output = [[<F as Div<F>>::Output; L]; H];
43 fn div(self, rhs: F) -> Self::Output
44 {
45 matrix_init(|r, c| self[r][c].clone()/rhs.clone())
46 }
47}