Add automatic implementation of VectorSpace.
This commit is contained in:
parent
53486fe614
commit
fb20ffdf8b
|
@ -6,7 +6,11 @@ use traits::workarounds::scalar_op::{ScalarMul, ScalarDiv};
|
||||||
/// structure, the elements of which have addition, substraction, negation,
|
/// structure, the elements of which have addition, substraction, negation,
|
||||||
/// scalar multiplication (the scalar being a element of a `DivisionRing`), and
|
/// scalar multiplication (the scalar being a element of a `DivisionRing`), and
|
||||||
/// has a distinct element (`Zero`) neutral wrt the addition.
|
/// has a distinct element (`Zero`) neutral wrt the addition.
|
||||||
pub trait VectorSpace<N: DivisionRing>
|
pub trait VectorSpace<N>
|
||||||
: Sub<Self, Self> + Add<Self, Self> + Neg<Self> + Zero +
|
: Sub<Self, Self> + Add<Self, Self> + Neg<Self> + Zero +
|
||||||
ScalarMul<N> + ScalarDiv<N>
|
ScalarMul<N> + ScalarDiv<N>
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
impl<V: Sub<V, V> + Add<V, V> + Neg<V> + Zero +
|
||||||
|
ScalarMul<N> + ScalarDiv<N>,
|
||||||
|
N: DivisionRing> VectorSpace<N> for V;
|
||||||
|
|
Loading…
Reference in New Issue