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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'l, T: Element> From<&'l Compressed<T>> for Conventional<T>
impl<'l, T: Element> From<&'l Compressed<T>> for Conventional<T>
Source§fn from(matrix: &'l Compressed<T>) -> Self
fn from(matrix: &'l Compressed<T>) -> Self
Source§impl<'l, T: Element> From<&'l Conventional<T>> for Compressed<T>
impl<'l, T: Element> From<&'l Conventional<T>> for Compressed<T>
Source§fn from(conventional: &'l Conventional<T>) -> Self
fn from(conventional: &'l Conventional<T>) -> Self
Source§impl<T: Element> From<Compressed<T>> for Conventional<T>
impl<T: Element> From<Compressed<T>> for Conventional<T>
Source§fn from(matrix: Compressed<T>) -> Self
fn from(matrix: Compressed<T>) -> Self
Source§impl<T: Element> From<Conventional<T>> for Compressed<T>
impl<T: Element> From<Conventional<T>> for Compressed<T>
Source§fn from(matrix: Conventional<T>) -> Self
fn from(matrix: Conventional<T>) -> Self
Source§impl<T: Element> Matrix for Compressed<T>
impl<T: Element> Matrix for Compressed<T>
Source§impl<T> Multiply<Diagonal<T>, Compressed<T>> for Compressed<T>
impl<T> Multiply<Diagonal<T>, Compressed<T>> for Compressed<T>
Source§impl<'l, T> MultiplyInto<[T], [T]> for Compressed<T>
impl<'l, T> MultiplyInto<[T], [T]> for Compressed<T>
Source§fn multiply_into(&self, right: &[T], result: &mut [T])
fn multiply_into(&self, right: &[T], result: &mut [T])
Source§impl<'l, T> MultiplyInto<Compressed<T>, [T]> for Conventional<T>
impl<'l, T> MultiplyInto<Compressed<T>, [T]> for Conventional<T>
Source§fn multiply_into(&self, right: &Compressed<T>, result: &mut [T])
fn multiply_into(&self, right: &Compressed<T>, result: &mut [T])
Source§impl<T> MultiplySelf<Diagonal<T>> for Compressed<T>
impl<T> MultiplySelf<Diagonal<T>> for Compressed<T>
Source§fn multiply_self(&mut self, right: &Diagonal<T>)
fn multiply_self(&mut self, right: &Diagonal<T>)
Source§impl<T: PartialEq + Element> PartialEq for Compressed<T>
impl<T: PartialEq + Element> PartialEq for Compressed<T>
Source§fn eq(&self, other: &Compressed<T>) -> bool
fn eq(&self, other: &Compressed<T>) -> bool
self and other values to be equal, and is used by ==.