1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//! Basic vector structures for LLL

mod bigvector;
mod rationalvector;
mod vectorf;

pub use bigvector::BigVector;
pub use rationalvector::RationalVector;
pub use vectorf::VectorF;

/// The `Vector` trait describes the general properties of an element in a vector space.
pub trait Vector {
    /// Returns the vector's dimension
    fn dimension(&self) -> usize;

    /// Add two vectors together
    fn add(&self, other: &Self) -> Self;

    /// Substract two vectors
    fn sub(&self, other: &Self) -> Self;

    /// Initialise vector type
    fn init(dimension: usize) -> Self;

    /// Basis vector
    fn basis_vector(&self, position: usize) -> Self;
}

/// The `Dot` trait allows the computation of dot products with values in `T`
pub trait Dot<T> {
    fn dot(&self, other: &Self) -> T;
}