125 lines
3.1 KiB
Plaintext
125 lines
3.1 KiB
Plaintext
---
|
||
title: Quaternion (v0.29)
|
||
description: API reference for qiskit.quantum_info.Quaternion in qiskit v0.29
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.quantum_info.Quaternion
|
||
---
|
||
|
||
# Quaternion
|
||
|
||
<Class id="qiskit.quantum_info.Quaternion" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.18/qiskit/quantum_info/synthesis/quaternion.py" signature="Quaternion(data)" modifiers="class">
|
||
Bases: `object`
|
||
|
||
A class representing a Quaternion.
|
||
|
||
## Methods
|
||
|
||
<span id="qiskit-quantum-info-quaternion-from-axis-rotation" />
|
||
|
||
### from\_axis\_rotation
|
||
|
||
<Function id="qiskit.quantum_info.Quaternion.from_axis_rotation" signature="Quaternion.from_axis_rotation(angle, axis)" modifiers="classmethod">
|
||
Return quaternion for rotation about given axis.
|
||
|
||
**Parameters**
|
||
|
||
* **angle** (*float*) – Angle in radians.
|
||
* **axis** (*str*) – Axis for rotation
|
||
|
||
**Returns**
|
||
|
||
Quaternion for axis rotation.
|
||
|
||
**Return type**
|
||
|
||
[Quaternion](qiskit.quantum_info.Quaternion "qiskit.quantum_info.Quaternion")
|
||
|
||
**Raises**
|
||
|
||
**ValueError** – Invalid input axis.
|
||
</Function>
|
||
|
||
<span id="qiskit-quantum-info-quaternion-from-euler" />
|
||
|
||
### from\_euler
|
||
|
||
<Function id="qiskit.quantum_info.Quaternion.from_euler" signature="Quaternion.from_euler(angles, order='yzy')" modifiers="classmethod">
|
||
Generate a quaternion from a set of Euler angles.
|
||
|
||
**Parameters**
|
||
|
||
* **angles** (*array\_like*) – Array of Euler angles.
|
||
* **order** (*str*) – Order of Euler rotations. ‘yzy’ is default.
|
||
|
||
**Returns**
|
||
|
||
Quaternion representation of Euler rotation.
|
||
|
||
**Return type**
|
||
|
||
[Quaternion](qiskit.quantum_info.Quaternion "qiskit.quantum_info.Quaternion")
|
||
</Function>
|
||
|
||
<span id="qiskit-quantum-info-quaternion-norm" />
|
||
|
||
### norm
|
||
|
||
<Function id="qiskit.quantum_info.Quaternion.norm" signature="Quaternion.norm()">
|
||
Norm of quaternion.
|
||
</Function>
|
||
|
||
<span id="qiskit-quantum-info-quaternion-normalize" />
|
||
|
||
### normalize
|
||
|
||
<Function id="qiskit.quantum_info.Quaternion.normalize" signature="Quaternion.normalize(inplace=False)">
|
||
Normalizes a Quaternion to unit length so that it represents a valid rotation.
|
||
|
||
**Parameters**
|
||
|
||
**inplace** (*bool*) – Do an inplace normalization.
|
||
|
||
**Returns**
|
||
|
||
Normalized quaternion.
|
||
|
||
**Return type**
|
||
|
||
[Quaternion](qiskit.quantum_info.Quaternion "qiskit.quantum_info.Quaternion")
|
||
</Function>
|
||
|
||
<span id="qiskit-quantum-info-quaternion-to-matrix" />
|
||
|
||
### to\_matrix
|
||
|
||
<Function id="qiskit.quantum_info.Quaternion.to_matrix" signature="Quaternion.to_matrix()">
|
||
Converts a unit-length quaternion to a rotation matrix.
|
||
|
||
**Returns**
|
||
|
||
Rotation matrix.
|
||
|
||
**Return type**
|
||
|
||
ndarray
|
||
</Function>
|
||
|
||
<span id="qiskit-quantum-info-quaternion-to-zyz" />
|
||
|
||
### to\_zyz
|
||
|
||
<Function id="qiskit.quantum_info.Quaternion.to_zyz" signature="Quaternion.to_zyz()">
|
||
Converts a unit-length quaternion to a sequence of ZYZ Euler angles.
|
||
|
||
**Returns**
|
||
|
||
Array of Euler angles.
|
||
|
||
**Return type**
|
||
|
||
ndarray
|
||
</Function>
|
||
</Class>
|
||
|