vector_space/outer.rs
1use crate::VectorSpace;
2
3/// This trait defines the outer product.
4pub trait OuterProduct<T = Self>: VectorSpace {
5 /// The output type of the outer product.
6 type Output;
7
8 /// The outer product.
9 fn outer(self, other: T) -> <Self as OuterProduct<T>>::Output;
10}
11
12impl OuterProduct for f32 {
13 type Output = f32;
14 fn outer(self, other: Self) -> f32 {
15 self * other
16 }
17}
18
19impl OuterProduct for f64 {
20 type Output = f64;
21 fn outer(self, other: Self) -> f64 {
22 self * other
23 }
24}