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
use crate::VectorSpace;
pub trait OuterProduct<T = Self>: VectorSpace {
type Output;
fn outer(self, other: T) -> <Self as OuterProduct<T>>::Output;
}
pub trait DotProduct<T = Self>: VectorSpace {
type Output;
fn dot(self, other: T) -> <Self as DotProduct<T>>::Output;
}
impl DotProduct for f32 {
type Output = f32;
fn dot(self, other: Self) -> f32 {
self * other
}
}
impl DotProduct for f64 {
type Output = f64;
fn dot(self, other: Self) -> f64 {
self * other
}
}