From df51de0664f4ba44c6e6a5822c1b458585cf6240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sun, 31 Oct 2021 14:27:32 +0100 Subject: [PATCH] Fix unsound usize::get_unchecked_mut --- src/base/indexing.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/base/indexing.rs b/src/base/indexing.rs index c2bb48ff..2c691bd1 100644 --- a/src/base/indexing.rs +++ b/src/base/indexing.rs @@ -589,7 +589,10 @@ where where S: RawStorageMut, { - matrix.data.get_unchecked_linear_mut(self) + let nrows = matrix.shape().0; + let row = self % nrows; + let col = self / nrows; + matrix.data.get_unchecked_mut(row, col) } }