pub trait Vector {
type Scalar: Copy;
fn add(&self, other: &Self) -> Self;
fn subtract(&self, other: &Self) -> Self;
fn scale(&self, scalar: Self::Scalar) -> Self;
fn dot(&self, other: &Self) -> Self::Scalar;
fn cross(&self, other: &Self) -> Self;
fn length(&self) -> Self::Scalar;
fn normalize(&self) -> Self;
fn size(&self) -> usize;
fn at(&self, index: usize) -> Self::Scalar;
fn update(&mut self, index: usize, value: Self::Scalar);
}
Expand description
Generalized Vector operations that can be implemented by any vector like type.