array_matrix/
vector.rs

1pub mod abs;
2pub mod dot;
3pub mod cross;
4pub mod mul;
5pub mod div;
6pub mod outer;
7pub mod add;
8pub mod sub;
9pub mod conj;
10
11use num_traits::Zero;
12
13pub use self::abs::*;
14pub use self::dot::*;
15pub use self::cross::*;
16pub use self::mul::*;
17pub use self::div::*;
18pub use self::outer::*;
19pub use self::add::*;
20pub use self::sub::*;
21pub use self::conj::*;
22
23pub trait Vector
24{
25    fn length() -> usize;
26    fn zero() -> Self;
27}
28
29impl<F: Zero, const N: usize> Vector for [F; N]
30{
31    fn length() -> usize
32    {
33        N
34    }
35
36    fn zero() -> Self
37    {
38        array_init::array_init(|_| F::zero())
39    }
40}