diff --git a/nalgebra-sparse/src/csc.rs b/nalgebra-sparse/src/csc.rs index bbb8cd08..c48697a8 100644 --- a/nalgebra-sparse/src/csc.rs +++ b/nalgebra-sparse/src/csc.rs @@ -257,6 +257,12 @@ impl CscMatrix { 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. /// /// The sparsity pattern is stored internally inside an `Arc`. This allows users to re-use diff --git a/nalgebra-sparse/src/csr.rs b/nalgebra-sparse/src/csr.rs index f42b56f9..acf12e33 100644 --- a/nalgebra-sparse/src/csr.rs +++ b/nalgebra-sparse/src/csr.rs @@ -259,6 +259,12 @@ impl CsrMatrix { 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. /// /// The sparsity pattern is stored internally inside an `Arc`. This allows users to re-use