pub struct SparseMatrix {
pub num_rows: usize,
pub num_cols: usize,
/* private fields */
}Expand description
A sparse matrix with interned field elements.
Uses delta encoding for column indices during serialization to reduce size. Within each row, the first column index is stored as absolute, and subsequent columns are stored as deltas from the previous column.
Fields§
§num_rows: usizeThe number of rows in the matrix.
num_cols: usizeThe number of columns in the matrix.
Implementations§
Source§impl SparseMatrix
impl SparseMatrix
pub fn new(rows: usize, cols: usize) -> Self
pub const fn hydrate<'a>( &'a self, interner: &'a Interner, ) -> HydratedSparseMatrix<'a>
pub fn num_entries(&self) -> usize
pub fn delta_encoding_stats(&self) -> DeltaEncodingStats
pub fn grow(&mut self, rows: usize, cols: usize)
Sourcepub fn set(&mut self, row: usize, col: usize, value: InternedFieldElement)
pub fn set(&mut self, row: usize, col: usize, value: InternedFieldElement)
Set the value at the given row and column.
Sourcepub fn iter_row(
&self,
row: usize,
) -> impl Iterator<Item = (usize, InternedFieldElement)> + use<'_>
pub fn iter_row( &self, row: usize, ) -> impl Iterator<Item = (usize, InternedFieldElement)> + use<'_>
Iterate over the non-default entries of a row of the matrix.
Sourcepub fn iter(
&self,
) -> impl Iterator<Item = ((usize, usize), InternedFieldElement)> + use<'_>
pub fn iter( &self, ) -> impl Iterator<Item = ((usize, usize), InternedFieldElement)> + use<'_>
Iterate over the non-default entries of the matrix.
Sourcepub fn transpose(&self) -> SparseMatrix
pub fn transpose(&self) -> SparseMatrix
Transpose the matrix, swapping rows and columns.
Returns a new SparseMatrix where entry (i, j) in the original
becomes (j, i) in the result. The interned values are preserved
and remain valid for the same Interner.
Trait Implementations§
Source§impl Clone for SparseMatrix
impl Clone for SparseMatrix
Source§fn clone(&self) -> SparseMatrix
fn clone(&self) -> SparseMatrix
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SparseMatrix
impl Debug for SparseMatrix
Source§impl<'de> Deserialize<'de> for SparseMatrix
impl<'de> Deserialize<'de> for SparseMatrix
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SparseMatrix
Source§impl PartialEq for SparseMatrix
impl PartialEq for SparseMatrix
Source§impl Serialize for SparseMatrix
impl Serialize for SparseMatrix
impl StructuralPartialEq for SparseMatrix
Auto Trait Implementations§
impl Freeze for SparseMatrix
impl RefUnwindSafe for SparseMatrix
impl Send for SparseMatrix
impl Sync for SparseMatrix
impl Unpin for SparseMatrix
impl UnsafeUnpin for SparseMatrix
impl UnwindSafe for SparseMatrix
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more