Trait sprs::vec::IntoSparseVecIter [−][src]
pub trait IntoSparseVecIter<'a, N: 'a> { type IterType; fn into_sparse_vec_iter(self) -> Self::IterType
where
Self::IterType: Iterator<Item = (usize, &'a N)>; fn dim(&self) -> usize; fn is_dense(&self) -> bool { ... } fn index(self, idx: usize) -> &'a N
where
Self: Sized, { ... } }
Trait for types that can be iterated as sparse vectors
Associated Types
type IterType
Required Methods
fn into_sparse_vec_iter(self) -> Self::IterType where
Self::IterType: Iterator<Item = (usize, &'a N)>,
Self::IterType: Iterator<Item = (usize, &'a N)>,
Transform self into an iterator that yields (usize, &N) tuples where the usize is the index of the value in the sparse vector. The indices should be sorted.
fn dim(&self) -> usize
The dimension of the vector
Provided Methods
fn is_dense(&self) -> bool
Indicator to check whether the vector is actually dense
fn index(self, idx: usize) -> &'a N where
Self: Sized,
Self: Sized,
Random access to an element in the vector.
Panics
- if the vector is not dense
- if the index is out of bounds
Implementations on Foreign Types
impl<'a, N: 'a> IntoSparseVecIter<'a, N> for &'a [N]
[src]
impl<'a, N: 'a> IntoSparseVecIter<'a, N> for &'a [N]
impl<'a, N: 'a> IntoSparseVecIter<'a, N> for &'a Vec<N>
[src]
impl<'a, N: 'a> IntoSparseVecIter<'a, N> for &'a Vec<N>
impl<'a, N: 'a, S> IntoSparseVecIter<'a, N> for &'a ArrayBase<S, Ix1> where
S: Data<Elem = N>,
[src]
impl<'a, N: 'a, S> IntoSparseVecIter<'a, N> for &'a ArrayBase<S, Ix1> where
S: Data<Elem = N>,
Implementors
impl<'a, N: 'a, I: 'a> IntoSparseVecIter<'a, N> for CsVecViewI<'a, N, I> where
I: SpIndex, type IterType = VectorIterator<'a, N, I>;impl<'a, N: 'a, I: 'a, IS, DS> IntoSparseVecIter<'a, N> for &'a CsVecBase<IS, DS> where
I: SpIndex,
IS: Deref<Target = [I]>,
DS: Deref<Target = [N]>, type IterType = VectorIterator<'a, N, I>;