Merge pull request #1004 from MaxVerevkin/fix-750
fix linear indexing of matrix slices
This commit is contained in:
commit
20d8e953c5
|
@ -567,7 +567,10 @@ where
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
unsafe fn get_unchecked(self, matrix: &'a Matrix<T, R, C, S>) -> Self::Output {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,6 @@ macro_rules! slice_storage_impl(
|
||||||
S: $Storage<T, RStor, CStor>,
|
S: $Storage<T, RStor, CStor>,
|
||||||
RStride: Dim,
|
RStride: Dim,
|
||||||
CStride: Dim {
|
CStride: Dim {
|
||||||
|
|
||||||
$T::from_raw_parts(storage.$get_addr(start.0, start.1), shape, strides)
|
$T::from_raw_parts(storage.$get_addr(start.0, start.1), shape, strides)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue