1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use std::ops::{Div};
use crate::{matrix_init, Matrix};
pub trait MDiv<Rhs>: Matrix
where
Self::Output: Matrix
{
type Output;
fn div(self, rhs: Rhs) -> Self::Output;
}
impl<F, const L: usize, const H: usize> MDiv<F> for [[F; L]; H]
where
Self: Matrix,
[[<F as Div<F>>::Output; L]; H]: Matrix,
F: Copy + Div<F>
{
type Output = [[<F as Div<F>>::Output; L]; H];
fn div(self, rhs: F) -> Self::Output
{
matrix_init(|r, c| self[r][c]/rhs)
}
}