array_matrix/vector/
mul.rs1use std::ops::Mul;
2
3use crate::Vector;
4
5pub trait VMul<Rhs>: Vector
6where Self::Output: Vector
7{
8 type Output;
9
10 fn mul(&self, rhs: Rhs) -> Self::Output;
27}
28
29impl<F, R, const N: usize> VMul<R> for [F; N]
30where
31 Self: Vector,
32 [<F as Mul<R>>::Output; N]: Vector,
33 F: Mul<R> + Clone,
34 R: Clone
35{
36 type Output = [<F as Mul<R>>::Output; N];
37 fn mul(&self, rhs: R) -> Self::Output
38 {
39 array_init::array_init(|i| self[i].clone()*rhs.clone())
40 }
41}