qiskit.quantum_info.Quaternion¶
-
class
Quaternion
(data)[source]¶ A class representing a Quaternion.
Methods
__init__
(data)Initialize self.
from_axis_rotation
(angle, axis)Return quaternion for rotation about given axis.
from_euler
(angles[, order])Generate a quaternion from a set of Euler angles.
norm
()Norm of quaternion.
normalize
([inplace])Normalizes a Quaternion to unit length so that it represents a valid rotation.
Converts a unit-length quaternion to a rotation matrix.
to_zyz
()Converts a unit-length quaternion to a sequence of ZYZ Euler angles.
-
classmethod
from_axis_rotation
(angle, axis)[source]¶ Return quaternion for rotation about given axis.
- Paramètres
angle (float) – Angle in radians.
axis (str) – Axis for rotation
- Renvoie
Quaternion for axis rotation.
- Type renvoyé
- Lève
ValueError – Invalid input axis.
-
classmethod
from_euler
(angles, order='yzy')[source]¶ Generate a quaternion from a set of Euler angles.
- Paramètres
angles (array_like) – Array of Euler angles.
order (str) – Order of Euler rotations. “yzy” is default.
- Renvoie
Quaternion representation of Euler rotation.
- Type renvoyé
-
normalize
(inplace=False)[source]¶ Normalizes a Quaternion to unit length so that it represents a valid rotation.
- Paramètres
inplace (bool) – Do an inplace normalization.
- Renvoie
Normalized quaternion.
- Type renvoyé
-
classmethod