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

Required Methods

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.

The dimension of the vector

Provided Methods

Indicator to check whether the vector is actually dense

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 Vec<N>
[src]

impl<'a, N: 'a, S> IntoSparseVecIter<'a, N> for &'a ArrayBase<S, Ix1> where
    S: Data<Elem = N>, 
[src]

Implementors