fix linear indexing of matrix slices

This commit is contained in:
Max Verevkin 2021-10-06 18:02:02 +03:00
parent 7f236d88aa
commit bf48e093a9
2 changed files with 4 additions and 2 deletions

View File

@ -567,7 +567,10 @@ where
#[doc(hidden)]
#[inline(always)]
unsafe fn get_unchecked(self, matrix: &'a Matrix<T, R, C, S>) -> Self::Output {
matrix.data.get_unchecked_linear(self)
let nrows = matrix.shape().0;
let row = self % nrows;
let col = self / nrows;
matrix.data.get_unchecked(row, col)
}
}

View File

@ -73,7 +73,6 @@ macro_rules! slice_storage_impl(
S: $Storage<T, RStor, CStor>,
RStride: Dim,
CStride: Dim {
$T::from_raw_parts(storage.$get_addr(start.0, start.1), shape, strides)
}
}