pub struct Compressed<T: Element> {
pub rows: usize,
pub columns: usize,
pub nonzeros: usize,
pub variant: Variant,
pub values: Vec<T>,
pub indices: Vec<usize>,
pub offsets: Vec<usize>,
}Expand description
A compressed matrix.
Fields§
§rows: usizeThe number of rows.
columns: usizeThe number of columns.
nonzeros: usizeThe number of nonzero elements.
variant: VariantThe format variant.
values: Vec<T>The values of the nonzero elements.
indices: Vec<usize>The indices of rows when variant = Column or columns when variant = Row of the nonzero elements.
offsets: Vec<usize>The offsets of columns when variant = Column or rows when variant = Row such that the values and indices of the ith column when variant = Column or the ith row when variant = Row are stored starting from
values[j] and indices[j], respectively, where j = offsets[i]. The
vector has one additional element, which is always equal to nonzeros.
Implementations§
Source§impl<T: Element> Compressed<T>
impl<T: Element> Compressed<T>
Sourcepub fn with_capacity<S: Size>(
size: S,
variant: Variant,
capacity: usize,
) -> Self
pub fn with_capacity<S: Size>( size: S, variant: Variant, capacity: usize, ) -> Self
Create a zero matrix with a specific capacity.
Sourcepub fn set<P: Position>(&mut self, position: P, value: T)
pub fn set<P: Position>(&mut self, position: P, value: T)
Assign a value to an element.
Note that the function treats zero values as any other.
Sourcepub fn iter_mut<'l>(&'l mut self) -> IteratorMut<'l, T> ⓘ
pub fn iter_mut<'l>(&'l mut self) -> IteratorMut<'l, T> ⓘ
Return a sparse iterator allowing mutation.
Trait Implementations§
Source§impl<T: Clone + Element> Clone for Compressed<T>
impl<T: Clone + Element> Clone for Compressed<T>
Source§fn clone(&self) -> Compressed<T>
fn clone(&self) -> Compressed<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more