vector-space 0.1.0

Useful traits for working with vector spaces
Documentation
use crate::VectorSpace;

/// This trait defines the outer product.
pub trait OuterProduct<T = Self>: VectorSpace {
    /// The output type of the outer product.
    type Output;
    /// Computes the outer product.
    fn outer(self, other: T) -> <Self as OuterProduct<T>>::Output;
}

/// This trait defines the dot product.
pub trait DotProduct<T = Self>: VectorSpace {
    /// The output type of the dot product.
    type Output;

    /// Computes the dot product.
    fn dot(self, other: T) -> <Self as DotProduct<T>>::Output;
}

impl DotProduct for f32 {
    type Output = f32;
    fn dot(self, other: Self) -> f32 {
        self * other
    }
}

impl DotProduct for f64 {
    type Output = f64;
    fn dot(self, other: Self) -> f64 {
        self * other
    }
}