sparse-vector-rs 1.1.0

A sparse vector: a mapping from integer index to arbitrary value that stores only the positions differing from a default value.
Documentation
1
2
3
4
5
6
7
8
9
10
11
/// A single stored position of a [`SparseVector`](crate::SparseVector).
///
/// This is the serialization shape: a vector serializes to its elements only, so
/// a round trip has to carry the default value alongside.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct Element<T = f64> {
    /// The position, negative or not.
    pub index: i64,
    /// The value stored there.
    pub value: T,
}