IntoSparseVecIter

Trait IntoSparseVecIter 

Source
pub trait IntoSparseVecIter<'a, N: 'a> {
    type IterType;

    // Required methods
    fn into_sparse_vec_iter(
        self,
    ) -> <Self as IntoSparseVecIter<'a, N>>::IterType
       where <Self as IntoSparseVecIter<'a, N>>::IterType: Iterator<Item = (usize, &'a N)>;
    fn dim(&self) -> usize;

    // Provided methods
    fn is_dense(&self) -> bool { ... }
    fn index(self, idx: usize) -> &'a N
       where Self: Sized { ... }
}
Expand description

Trait for types that can be iterated as sparse vectors

Required Associated Types§

Required Methods§

Source

fn into_sparse_vec_iter(self) -> <Self as IntoSparseVecIter<'a, N>>::IterType
where <Self as IntoSparseVecIter<'a, N>>::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.

Source

fn dim(&self) -> usize

The dimension of the vector

Provided Methods§

Source

fn is_dense(&self) -> bool

Indicator to check whether the vector is actually dense

Source

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

Implementations on Foreign Types§

Source§

impl<'a, N: 'a, V> IntoSparseVecIter<'a, N> for &'a V
where V: DenseVector<Scalar = N> + ?Sized,

Implementors§

Source§

impl<'a, N: 'a, I> IntoSparseVecIter<'a, N> for CsVecViewI<'a, N, I>
where I: SpIndex + 'a,

Source§

impl<'a, N: 'a, I, IS, DS> IntoSparseVecIter<'a, N> for &'a CsVecBase<IS, DS, N, I>
where I: SpIndex + 'a, IS: Deref<Target = [I]>, DS: Deref<Target = [N]>,