bundles / scipy 1.17.1 / scipy / spatial / transform / _rotation / Rotation / as_matrix
function
scipy.spatial.transform._rotation:Rotation.as_matrix
Signature
def as_matrix ( self ) → Array Summary
Represent as rotation matrix.
Extended Summary
3D rotations can be represented using rotation matrices, which are 3 x 3 real orthogonal matrices with determinant equal to +1 [1].
Returns
matrix: ndarray, shape (..., 3)Shape depends on shape of inputs used for initialization.
Notes
This function was called as_dcm before.
Array API Standard Support
as_matrix has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.
==================== ==================== ==================== Library CPU GPU ==================== ==================== ==================== NumPy ✅ n/a CuPy n/a ✅ PyTorch ✅ ✅ JAX ✅ ✅ Dask ⛔ n/a ==================== ==================== ====================
See
dev-arrayapifor more information.
Examples
from scipy.spatial.transform import Rotation as R import numpy as np✓
r = R.from_rotvec([0, 0, np.pi/2])
✓r.as_matrix()
✗r.as_matrix().shape
✓r = R.from_quat([[1, 1, 0, 0]]) r.as_matrix() r.as_matrix().shape✓
r = R.from_rotvec([[np.pi/2, 0, 0], [0, 0, np.pi/2]])
✓r.as_matrix()
✗r.as_matrix().shape
✓Aliases
-
scipy.spatial.transform.Rotation.as_matrix