Vector

Trait Vector 

Source
pub trait Vector<'a>
where Self: Sized + Clone,
{ type Value: 'a + ValueType; type IterVal: Iterator<Item = Self::Value>;
Show 15 methods // Required methods fn iter(&'a self) -> Self::IterVal; fn with_capacity(cap: usize) -> Self; fn from_vec(vec: Vec<Self::Value>) -> Self; fn dim(&self) -> usize; fn get(&self, i: usize) -> Self::Value; fn get_mut(&mut self, i: usize) -> &mut Self::Value; fn add(&'a mut self, rhs: &Self); fn sub(&'a mut self, rhs: &Self); fn scale(&'a mut self, rhs: Self::Value); // Provided methods fn new() -> Self { ... } fn set(&mut self, i: usize, val: Self::Value) { ... } fn add_to(&mut self, i: usize, val: Self::Value) { ... } fn inner_prod<V>(&'a self, rhs: &'a V) -> Self::Value where V: Vector<'a, Value = Self::Value> { ... } fn norm_squared(&'a self) -> Self::Value { ... } fn norm(&'a self) -> f64 { ... }
}

Required Associated Types§

Source

type Value: 'a + ValueType

Source

type IterVal: Iterator<Item = Self::Value>

Required Methods§

Source

fn iter(&'a self) -> Self::IterVal

Source

fn with_capacity(cap: usize) -> Self

Source

fn from_vec(vec: Vec<Self::Value>) -> Self

Source

fn dim(&self) -> usize

Source

fn get(&self, i: usize) -> Self::Value

Source

fn get_mut(&mut self, i: usize) -> &mut Self::Value

Source

fn add(&'a mut self, rhs: &Self)

Source

fn sub(&'a mut self, rhs: &Self)

Source

fn scale(&'a mut self, rhs: Self::Value)

Provided Methods§

Source

fn new() -> Self

Source

fn set(&mut self, i: usize, val: Self::Value)

Source

fn add_to(&mut self, i: usize, val: Self::Value)

Source

fn inner_prod<V>(&'a self, rhs: &'a V) -> Self::Value
where V: Vector<'a, Value = Self::Value>,

Source

fn norm_squared(&'a self) -> Self::Value

Source

fn norm(&'a self) -> f64

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, T> Vector<'a> for DenseVec<T>
where T: 'a + ValueType,

Source§

type Value = T

Source§

type IterVal = Cloned<Iter<'a, T>>

Source§

impl<'a, T, I> Vector<'a> for SparseVec<T, I>
where T: 'a + ValueType, I: 'a + IndexType,