Add Csr/CscMatrix::pattern_and_values_mut()

This commit is contained in:
Andreas Longva 2021-01-19 16:58:45 +01:00
parent c43a2b1679
commit cb0f9a5190
2 changed files with 12 additions and 0 deletions

View File

@ -257,6 +257,12 @@ impl<T> CscMatrix<T> {
self.cs.into_pattern_and_values() self.cs.into_pattern_and_values()
} }
/// Returns a reference to the sparsity pattern and a mutable reference to the values.
#[inline]
pub fn pattern_and_values_mut(&mut self) -> (&SparsityPattern, &mut [T]) {
self.cs.pattern_and_values_mut()
}
/// Returns the underlying sparsity pattern. /// Returns the underlying sparsity pattern.
/// ///
/// The sparsity pattern is stored internally inside an `Arc`. This allows users to re-use /// The sparsity pattern is stored internally inside an `Arc`. This allows users to re-use

View File

@ -259,6 +259,12 @@ impl<T> CsrMatrix<T> {
self.cs.into_pattern_and_values() self.cs.into_pattern_and_values()
} }
/// Returns a reference to the sparsity pattern and a mutable reference to the values.
#[inline]
pub fn pattern_and_values_mut(&mut self) -> (&SparsityPattern, &mut [T]) {
self.cs.pattern_and_values_mut()
}
/// Returns the underlying sparsity pattern. /// Returns the underlying sparsity pattern.
/// ///
/// The sparsity pattern is stored internally inside an `Arc`. This allows users to re-use /// The sparsity pattern is stored internally inside an `Arc`. This allows users to re-use