2013-06-02 02:50:00 +08:00
|
|
|
use std::num::Zero;
|
2013-05-20 03:45:04 +08:00
|
|
|
use traits::division_ring::DivisionRing;
|
2013-06-16 04:16:44 +08:00
|
|
|
use traits::scalar_op::{ScalarMul, ScalarDiv};
|
2013-05-20 03:45:04 +08:00
|
|
|
|
2013-05-21 23:25:01 +08:00
|
|
|
/// Trait of elements of a vector space. A vector space is an algebraic
|
|
|
|
/// 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.
|
2013-06-11 17:03:16 +08:00
|
|
|
pub trait VectorSpace<N>
|
2013-05-21 23:25:01 +08:00
|
|
|
: Sub<Self, Self> + Add<Self, Self> + Neg<Self> + Zero +
|
2013-06-10 07:36:47 +08:00
|
|
|
ScalarMul<N> + ScalarDiv<N>
|
2013-05-20 03:45:04 +08:00
|
|
|
{ }
|
2013-06-11 17:03:16 +08:00
|
|
|
|
2013-06-27 04:56:30 +08:00
|
|
|
impl<V: Sub<V, V> + Add<V, V> + Neg<V> + Zero + ScalarMul<N> + ScalarDiv<N>,
|
2013-06-11 17:03:16 +08:00
|
|
|
N: DivisionRing> VectorSpace<N> for V;
|