Add automatic implementation of VectorSpace.

This commit is contained in:
Sébastien Crozet 2013-06-11 11:03:16 +02:00
parent 53486fe614
commit fb20ffdf8b

View File

@ -6,7 +6,11 @@ use traits::workarounds::scalar_op::{ScalarMul, ScalarDiv};
/// structure, the elements of which have addition, substraction, negation,
/// scalar multiplication (the scalar being a element of a `DivisionRing`), and
/// 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 +
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;