Quaternion#

class qiskit.quantum_info.Quaternion(data)[código fonte]#

Bases: object

A class representing a Quaternion.

Methods

classmethod from_axis_rotation(angle, axis)[código fonte]#

Return quaternion for rotation about given axis.

Parâmetros:
  • angle (float) – Angle in radians.

  • axis (str) – Axis for rotation

Retorno:

Quaternion for axis rotation.

Tipo de retorno:

Quaternion

Levanta:

ValueError – Invalid input axis.

classmethod from_euler(angles, order='yzy')[código fonte]#

Generate a quaternion from a set of Euler angles.

Parâmetros:
  • angles (array_like) – Array of Euler angles.

  • order (str) – Order of Euler rotations. “yzy” is default.

Retorno:

Quaternion representation of Euler rotation.

Tipo de retorno:

Quaternion

norm()[código fonte]#

Norm of quaternion.

normalize(inplace=False)[código fonte]#

Normalizes a Quaternion to unit length so that it represents a valid rotation.

Parâmetros:

inplace (bool) – Do an inplace normalization.

Retorno:

Normalized quaternion.

Tipo de retorno:

Quaternion

to_matrix()[código fonte]#

Converts a unit-length quaternion to a rotation matrix.

Retorno:

Rotation matrix.

Tipo de retorno:

ndarray

to_zyz()[código fonte]#

Converts a unit-length quaternion to a sequence of ZYZ Euler angles.

Retorno:

Array of Euler angles.

Tipo de retorno:

ndarray