| 1 /*! |
1 /*! |
| 2 Euclidean spaces. |
2 Euclidean spaces. |
| 3 */ |
3 */ |
| 4 |
4 |
| |
5 use std::ops::{Mul, MulAssign, Div, DivAssign, Add, Sub, AddAssign, SubAssign, Neg}; |
| 5 use crate::types::*; |
6 use crate::types::*; |
| 6 use std::ops::{Mul, MulAssign, Div, DivAssign, Add, Sub, AddAssign, SubAssign, Neg}; |
7 use crate::mapping::Space; |
| 7 |
8 |
| 8 /// Space (type) with a defined dot product. |
9 /// Space (type) with a defined dot product. |
| 9 /// |
10 /// |
| 10 /// `U` is the space of the multiplier, and `F` the space of scalars. |
11 /// `U` is the space of the multiplier, and `F` the space of scalars. |
| 11 /// Since `U` ≠ `Self`, this trait can also implement dual products. |
12 /// Since `U` ≠ `Self`, this trait can also implement dual products. |
| 16 /// Space (type) with Euclidean and vector space structure |
17 /// Space (type) with Euclidean and vector space structure |
| 17 /// |
18 /// |
| 18 /// The type should implement vector space operations (addition, subtraction, scalar |
19 /// The type should implement vector space operations (addition, subtraction, scalar |
| 19 /// multiplication and scalar division) along with their assignment versions, as well |
20 /// multiplication and scalar division) along with their assignment versions, as well |
| 20 /// as the [`Dot`] product with respect to `Self`. |
21 /// as the [`Dot`] product with respect to `Self`. |
| 21 pub trait Euclidean<F : Float> : Sized + Dot<Self,F> |
22 pub trait Euclidean<F : Float> : Space + Dot<Self,F> |
| 22 + Mul<F, Output=<Self as Euclidean<F>>::Output> + MulAssign<F> |
23 + Mul<F, Output=<Self as Euclidean<F>>::Output> + MulAssign<F> |
| 23 + Div<F, Output=<Self as Euclidean<F>>::Output> + DivAssign<F> |
24 + Div<F, Output=<Self as Euclidean<F>>::Output> + DivAssign<F> |
| 24 + Add<Self, Output=<Self as Euclidean<F>>::Output> |
25 + Add<Self, Output=<Self as Euclidean<F>>::Output> |
| 25 + Sub<Self, Output=<Self as Euclidean<F>>::Output> |
26 + Sub<Self, Output=<Self as Euclidean<F>>::Output> |
| 26 + for<'b> Add<&'b Self, Output=<Self as Euclidean<F>>::Output> |
27 + for<'b> Add<&'b Self, Output=<Self as Euclidean<F>>::Output> |