Skip to content

Commit

Permalink
ENH: enforce contiguous layout for output array in Rotation.as_euler
Browse files Browse the repository at this point in the history
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
  • Loading branch information
marscher authored and tylerjereddy committed Mar 20, 2021
1 parent d11c4cb commit 97055c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scipy/spatial/transform/rotation.pyx
Expand Up @@ -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)
Expand Down

0 comments on commit 97055c0

Please sign in to comment.