Struct vectors::sparse::heap::SparseVector
[−]
[src]
pub struct SparseVector<T> { /* fields omitted */ }
A sparse heap-allocated multi-dimensional vector.
Methods
impl<T> SparseVector<T>
[src]
pub fn len(&self) -> usize
[src]
The number of components in self
pub fn is_empty(&self) -> bool
[src]
true
if self.len() == 0
, otherwise false
ⓘImportant traits for Iter<'a, T>pub fn iter<'a>(&'a self) -> Iter<'a, T>
[src]
A borrowing iterator over self
Trait Implementations
impl<T, V> Add<V> for SparseVector<T> where
T: Copy + Zero + Add<T, Output = T>,
V: IntoIterator<Item = (usize, T)>,
<V as IntoIterator>::IntoIter: ExactSizeIterator + OrderedMapIterator<Key = usize, Val = T>,
[src]
T: Copy + Zero + Add<T, Output = T>,
V: IntoIterator<Item = (usize, T)>,
<V as IntoIterator>::IntoIter: ExactSizeIterator + OrderedMapIterator<Key = usize, Val = T>,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: V) -> Self::Output
[src]
Performs the +
operation.
impl<T, V> AddAssign<V> for SparseVector<T> where
T: Copy + Zero + Add<T, Output = T>,
V: IntoIterator<Item = (usize, T)>,
<V as IntoIterator>::IntoIter: ExactSizeIterator + OrderedMapIterator<Key = usize, Val = T>,
[src]
T: Copy + Zero + Add<T, Output = T>,
V: IntoIterator<Item = (usize, T)>,
<V as IntoIterator>::IntoIter: ExactSizeIterator + OrderedMapIterator<Key = usize, Val = T>,
fn add_assign(&mut self, rhs: V)
[src]
Performs the +=
operation.
impl<T, V> Sub<V> for SparseVector<T> where
T: Copy + Zero + Sub<T, Output = T>,
V: IntoIterator<Item = (usize, T)>,
<V as IntoIterator>::IntoIter: ExactSizeIterator + OrderedMapIterator<Key = usize, Val = T>,
[src]
T: Copy + Zero + Sub<T, Output = T>,
V: IntoIterator<Item = (usize, T)>,
<V as IntoIterator>::IntoIter: ExactSizeIterator + OrderedMapIterator<Key = usize, Val = T>,
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: V) -> Self::Output
[src]
Performs the -
operation.
impl<T, V> SubAssign<V> for SparseVector<T> where
T: Copy + Zero + Sub<T, Output = T>,
V: IntoIterator<Item = (usize, T)>,
<V as IntoIterator>::IntoIter: ExactSizeIterator + OrderedMapIterator<Key = usize, Val = T>,
[src]
T: Copy + Zero + Sub<T, Output = T>,
V: IntoIterator<Item = (usize, T)>,
<V as IntoIterator>::IntoIter: ExactSizeIterator + OrderedMapIterator<Key = usize, Val = T>,
fn sub_assign(&mut self, rhs: V)
[src]
Performs the -=
operation.
impl<T> Mul<T> for SparseVector<T> where
T: Copy + Zero + Mul<T, Output = T>,
[src]
T: Copy + Zero + Mul<T, Output = T>,
type Output = SparseVector<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: T) -> Self::Output
[src]
Performs the *
operation.
impl<T> MulAssign<T> for SparseVector<T> where
T: Copy + Zero + Mul<T, Output = T>,
[src]
T: Copy + Zero + Mul<T, Output = T>,
fn mul_assign(&mut self, rhs: T)
[src]
Performs the *=
operation.
impl<T> Div<T> for SparseVector<T> where
T: Copy + Zero + Div<T, Output = T>,
[src]
T: Copy + Zero + Div<T, Output = T>,
type Output = SparseVector<T>
The resulting type after applying the /
operator.
fn div(self, rhs: T) -> Self::Output
[src]
Performs the /
operation.
impl<T> DivAssign<T> for SparseVector<T> where
T: Copy + Zero + Div<T, Output = T>,
[src]
T: Copy + Zero + Div<T, Output = T>,
fn div_assign(&mut self, rhs: T)
[src]
Performs the /=
operation.
impl<T, V> MulAdd<T, V> for SparseVector<T> where
T: Copy + Zero + MulAdd<T, T, Output = T>,
V: IntoIterator<Item = (usize, T)>,
<V as IntoIterator>::IntoIter: ExactSizeIterator + OrderedMapIterator<Key = usize, Val = T>,
[src]
T: Copy + Zero + MulAdd<T, T, Output = T>,
V: IntoIterator<Item = (usize, T)>,
<V as IntoIterator>::IntoIter: ExactSizeIterator + OrderedMapIterator<Key = usize, Val = T>,
type Output = Self
The resulting type after applying the fused multiply-add.
fn mul_add(self, a: T, b: V) -> Self::Output
[src]
Performs the fused multiply-add operation.
impl<T, V> MulAddAssign<T, V> for SparseVector<T> where
T: Copy + Zero + MulAdd<T, T, Output = T>,
V: IntoIterator<Item = (usize, T)>,
<V as IntoIterator>::IntoIter: ExactSizeIterator + OrderedMapIterator<Key = usize, Val = T>,
[src]
T: Copy + Zero + MulAdd<T, T, Output = T>,
V: IntoIterator<Item = (usize, T)>,
<V as IntoIterator>::IntoIter: ExactSizeIterator + OrderedMapIterator<Key = usize, Val = T>,
fn mul_add_assign(&mut self, a: T, b: V)
[src]
Performs the fused multiply-add operation.
impl<T> Dot for SparseVector<T> where
T: Copy + Add<T, Output = T> + Mul<T, Output = T> + Zero,
[src]
T: Copy + Add<T, Output = T> + Mul<T, Output = T> + Zero,
type Scalar = T
The scalar type returned by self
's dot product
fn dot(&self, rhs: &Self) -> Self::Scalar
[src]
Calculates the dot-product between self
and rhs
.
impl<T> Distance for SparseVector<T> where
T: Copy + Signed,
[src]
T: Copy + Signed,
type Scalar = T
The scalar type returned by self
's distance
fn squared_distance(&self, rhs: &Self) -> Self::Scalar
[src]
Calculates the squared euclidian distance between self
and rhs
.
fn distance(&self, rhs: &Self) -> Self::Scalar where
Self::Scalar: Real,
[src]
Self::Scalar: Real,
Calculates the euclidian distance between self
and rhs
.
impl<T> Debug for SparseVector<T> where
T: Copy + Debug,
[src]
T: Copy + Debug,
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T> FromIterator<(usize, T)> for SparseVector<T>
[src]
fn from_iter<I: IntoIterator<Item = (usize, T)>>(iter: I) -> Self
[src]
Creates a value from an iterator. Read more
impl<T> IntoIterator for SparseVector<T>
[src]
type Item = <Self::IntoIter as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = IntoIter<Vec<(usize, T)>>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl<'a, T> IntoIterator for &'a SparseVector<T> where
T: 'a + Copy,
[src]
T: 'a + Copy,
type Item = <Self::IntoIter as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = Iter<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl<T: Clone> Clone for SparseVector<T>
[src]
fn clone(&self) -> SparseVector<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: PartialEq> PartialEq for SparseVector<T>
[src]
fn eq(&self, __arg_0: &SparseVector<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &SparseVector<T>) -> bool
[src]
This method tests for !=
.
impl<T> From<Vec<(usize, T)>> for SparseVector<T>
[src]
impl<V, T> VectorOps<V, T> for SparseVector<T> where
Self: Add<V, Output = Self> + Sub<V, Output = Self> + Mul<T, Output = Self> + Div<T, Output = Self> + MulAdd<T, V, Output = Self>,
T: Copy + NumAssign + MulAdd<T, T, Output = T>,
[src]
Self: Add<V, Output = Self> + Sub<V, Output = Self> + Mul<T, Output = Self> + Div<T, Output = Self> + MulAdd<T, V, Output = Self>,
T: Copy + NumAssign + MulAdd<T, T, Output = T>,
impl<V, T> VectorAssignOps<V, T> for SparseVector<T> where
Self: AddAssign<V> + SubAssign<V> + MulAssign<T> + DivAssign<T> + MulAddAssign<T, V>,
T: Copy + NumAssign + MulAddAssign,
[src]
Self: AddAssign<V> + SubAssign<V> + MulAssign<T> + DivAssign<T> + MulAddAssign<T, V>,
T: Copy + NumAssign + MulAddAssign,
impl<T> Vector<T> for SparseVector<T> where
Self: VectorOps<Self, T>,
T: Copy + PartialOrd + NumAssign + MulAdd<T, T, Output = T>,
[src]
Self: VectorOps<Self, T>,
T: Copy + PartialOrd + NumAssign + MulAdd<T, T, Output = T>,
type Scalar = T
The type of the Vector
's scalar components.
Auto Trait Implementations
impl<T> Send for SparseVector<T> where
T: Send,
T: Send,
impl<T> Sync for SparseVector<T> where
T: Sync,
T: Sync,