From 97055c0e2f6861c782644a3b373ec9a667783adf Mon Sep 17 00:00:00 2001 From: "Martin K. Scherer" Date: Mon, 22 Feb 2021 09:52:52 +0100 Subject: [PATCH] ENH: enforce contiguous layout for output array in Rotation.as_euler The output array (or memoryview) used to have a negative stride, which may cause problems later on when trying to wrap it in an ndarray again. This is only the case for extrinsic rotations. Closes #13584 --- scipy/spatial/transform/rotation.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scipy/spatial/transform/rotation.pyx b/scipy/spatial/transform/rotation.pyx index 747f818ba218..fe640762f396 100644 --- a/scipy/spatial/transform/rotation.pyx +++ b/scipy/spatial/transform/rotation.pyx @@ -216,9 +216,9 @@ cdef double[:, :] _compute_euler_from_matrix( "all angles.") # Reverse role of extrinsic and intrinsic rotations, but let third angle be - # zero for gimbal locked cases + # zero for gimbal locked cases. Take a copy, to enforce contiguous memory layout. if extrinsic: - angles = angles[:, ::-1] + angles = angles[:, ::-1].copy() return angles @cython.boundscheck(False)