[][src]Trait sprs::vec::IntoSparseVecIter

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

Loading content...

Required methods

fn into_sparse_vec_iter(self) -> Self::IterType where
    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

Loading content...

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

Random access to an element in the vector.

Panics

  • if the vector is not dense
  • if the index is out of bounds
Loading content...

Implementations on Foreign Types

impl<'a, N: 'a> IntoSparseVecIter<'a, N> for &'a [N][src]

type IterType = Enumerate<Iter<'a, N>>

impl<'a, N: 'a> IntoSparseVecIter<'a, N> for &'a Vec<N>[src]

type IterType = Enumerate<Iter<'a, N>>

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

type IterType = Enumerate<Iter<'a, N, Ix1>>

Loading content...

Implementors

impl<'a, N: 'a, I: 'a> IntoSparseVecIter<'a, N> for CsVecViewI<'a, N, I> where
    I: SpIndex
[src]

type IterType = VectorIterator<'a, N, I>

fn is_dense(&self) -> bool[src]

fn index(self, idx: usize) -> &'a N where
    Self: Sized
[src]

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]

type IterType = VectorIterator<'a, N, I>

fn is_dense(&self) -> bool[src]

fn index(self, idx: usize) -> &'a N where
    Self: Sized
[src]

Loading content...