[−][src]Trait sprs::vec::IntoSparseVecIter
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]
type IterType = Enumerate<Iter<'a, N>>
fn dim(&self) -> usize
[src]
fn into_sparse_vec_iter(self) -> Enumerate<Iter<'a, N>>
[src]
fn is_dense(&self) -> bool
[src]
fn index(self, idx: usize) -> &'a N
[src]
impl<'a, N: 'a> IntoSparseVecIter<'a, N> for &'a Vec<N>
[src]
type IterType = Enumerate<Iter<'a, N>>
fn dim(&self) -> usize
[src]
fn into_sparse_vec_iter(self) -> Enumerate<Iter<'a, N>>
[src]
fn is_dense(&self) -> bool
[src]
fn index(self, idx: usize) -> &'a N
[src]
impl<'a, N: 'a, S> IntoSparseVecIter<'a, N> for &'a ArrayBase<S, Ix1> where
S: Data<Elem = N>,
[src]
S: Data<Elem = N>,
type IterType = Enumerate<Iter<'a, N, Ix1>>
fn dim(&self) -> usize
[src]
fn into_sparse_vec_iter(self) -> Enumerate<Iter<'a, N, Ix1>>
[src]
fn is_dense(&self) -> bool
[src]
fn index(self, idx: usize) -> &'a N
[src]
Implementors
impl<'a, N: 'a, I: 'a> IntoSparseVecIter<'a, N> for CsVecViewI<'a, N, I> where
I: SpIndex,
[src]
I: SpIndex,
type IterType = VectorIterator<'a, N, I>
fn dim(&self) -> usize
[src]
ⓘImportant traits for VectorIterator<'a, N, I>fn into_sparse_vec_iter(self) -> VectorIterator<'a, N, I>
[src]
ⓘImportant traits for VectorIterator<'a, N, I>
fn is_dense(&self) -> bool
[src]
fn index(self, idx: usize) -> &'a N where
Self: Sized,
[src]
Self: Sized,
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]>,
[src]
I: SpIndex,
IS: Deref<Target = [I]>,
DS: Deref<Target = [N]>,
type IterType = VectorIterator<'a, N, I>
fn dim(&self) -> usize
[src]
ⓘImportant traits for VectorIterator<'a, N, I>fn into_sparse_vec_iter(self) -> VectorIterator<'a, N, I>
[src]
ⓘImportant traits for VectorIterator<'a, N, I>
fn is_dense(&self) -> bool
[src]
fn index(self, idx: usize) -> &'a N where
Self: Sized,
[src]
Self: Sized,