haar_lib/linalg/
traits.rs1pub trait TryAdd<Rhs = Self> {
5 type Output;
7 fn try_add(self, rhs: Rhs) -> Option<Self::Output>;
9}
10
11pub trait TrySub<Rhs = Self> {
13 type Output;
15 fn try_sub(self, rhs: Rhs) -> Option<Self::Output>;
17}
18
19pub trait TryMul<Rhs = Self> {
21 type Output;
23 fn try_mul(self, rhs: Rhs) -> Option<Self::Output>;
25}
26
27pub trait Matrix {
29 fn width(&self) -> usize;
31 fn height(&self) -> usize;
33 fn size(&self) -> (usize, usize) {
35 (self.height(), self.width())
36 }
37 fn is_square(&self) -> bool {
39 self.width() == self.height()
40 }
41}
42
43pub trait MatrixTranspose {
45 type Output;
47 fn transpose(self) -> Self::Output;
49}