forked from M-Labs/nalgebra
fix linear indexing of matrix slices
This commit is contained in:
parent
7f236d88aa
commit
bf48e093a9
@ -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
Block a user