Struct matrix::compressed::Compressed
[−]
[src]
pub struct Compressed<T: Element> { pub rows: usize, pub columns: usize, pub nonzeros: usize, pub format: Format, pub values: Vec<T>, pub indices: Vec<usize>, pub offsets: Vec<usize>, }
A compressed matrix.
Fields
rows: usize
The number of rows.
columns: usize
The number of columns.
nonzeros: usize
The number of nonzero elements.
format: Format
The storage format.
values: Vec<T>
The values of the nonzero elements.
indices: Vec<usize>
The indices of rows when format = Column or columns when format = Row of the nonzero elements.
offsets: Vec<usize>
The offsets of columns when format = Column or rows when format = Row such that the values and indices of the ith column when format = Column or the ith row when format = 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.
Methods
impl<T: Element> Compressed<T>[src]
fn get<P: Position>(&self, position: P) -> T
Read an element.
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.
fn iter<'l>(&'l self) -> Iterator<'l, T>
Return an iterator over the stored elements.
fn resize<S: Size>(&mut self, size: S)
Resize the matrix.
fn retain<F>(&mut self, condition: F) where F: FnMut(usize, usize, &T) -> bool
Retain the elements that satisfy a condition and discard the rest.
Trait Implementations
impl<T: PartialEq + Element> PartialEq for Compressed<T>[src]
fn eq(&self, __arg_0: &Compressed<T>) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Compressed<T>) -> bool
This method tests for !=.
impl<T: Debug + Element> Debug for Compressed<T>[src]
impl<T: Clone + Element> Clone for Compressed<T>[src]
fn clone(&self) -> Compressed<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more
impl<T: Element> Matrix for Compressed<T>[src]
type Element = T
The element type.
impl<T: Element> Size for Compressed<T>[src]
fn rows(&self) -> usize
Return the number of rows.
fn columns(&self) -> usize
Return the number of columns.
fn dimensions(&self) -> (usize, usize)
Return the number of rows and columns.
impl<T: Element> Sparse for Compressed<T>[src]
impl<'l, T: Element> From<&'l Dense<T>> for Compressed<T>[src]
fn from(matrix: &'l Dense<T>) -> Compressed<T>
Performs the conversion.
impl<T: Element> From<Dense<T>> for Compressed<T>[src]
fn from(matrix: Dense<T>) -> Compressed<T>
Performs the conversion.
impl<'l, T: Element> From<&'l Diagonal<T>> for Compressed<T>[src]
fn from(matrix: &'l Diagonal<T>) -> Compressed<T>
Performs the conversion.
impl<T: Element> From<Diagonal<T>> for Compressed<T>[src]
fn from(matrix: Diagonal<T>) -> Compressed<T>
Performs the conversion.