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: usize

The number of rows.

§columns: usize

The number of columns.

§nonzeros: usize

The number of nonzero elements.

§variant: Variant

The 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§

Create a zero matrix.

Create a zero matrix with a specific capacity.

Read an element.

Assign a value to an element.

Note that the function treats zero values as any other.

Return a sparse iterator.

Return a sparse iterator allowing mutation.

Resize the matrix.

Retain the elements that satisfy a condition and discard the rest.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
The element type.
Count nonzero elements.
Create a zero matrix.
Perform the multiplication.
Perform the multiplication.
Perform the multiplication.
Perform the multiplication.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Return the number of rows.
Return the number of columns.
Return the number of rows and columns.
Perform the transpose.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.