raddy/scalar/
scalar_matrix_mul.rs1use crate::Ad;
8use na::SMatrix;
9use std::ops::Mul;
10
11impl<const N: usize, const R: usize, const C: usize> Mul<SMatrix<Ad<N>, R, C>> for Ad<N> {
12 type Output = SMatrix<Ad<N>, R, C>;
13
14 fn mul(self, rhs: SMatrix<Ad<N>, R, C>) -> Self::Output {
15 rhs * self
16 }
17}
18
19impl<const N: usize, const R: usize, const C: usize> Mul<SMatrix<Ad<N>, R, C>> for &Ad<N> {
20 type Output = SMatrix<Ad<N>, R, C>;
21
22 fn mul(self, rhs: SMatrix<Ad<N>, R, C>) -> Self::Output {
23 rhs * self.clone()
24 }
25}
26
27impl<const N: usize, const R: usize, const C: usize> Mul<&SMatrix<Ad<N>, R, C>> for Ad<N> {
28 type Output = SMatrix<Ad<N>, R, C>;
29
30 fn mul(self, rhs: &SMatrix<Ad<N>, R, C>) -> Self::Output {
31 rhs * self
32 }
33}
34
35impl<const N: usize, const R: usize, const C: usize> Mul<&SMatrix<Ad<N>, R, C>> for &Ad<N> {
36 type Output = SMatrix<Ad<N>, R, C>;
37
38 fn mul(self, rhs: &SMatrix<Ad<N>, R, C>) -> Self::Output {
39 rhs * self.clone()
40 }
41}