qiskit-documentation/docs/api/qiskit/0.40/qiskit.quantum_info.OneQubi...

99 lines
5.1 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: OneQubitEulerDecomposer
description: API reference for qiskit.quantum_info.OneQubitEulerDecomposer
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.quantum_info.OneQubitEulerDecomposer
---
# OneQubitEulerDecomposer
<Class id="qiskit.quantum_info.OneQubitEulerDecomposer" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.23/qiskit/quantum_info/synthesis/one_qubit_decompose.py" signature="OneQubitEulerDecomposer(basis='U3', use_dag=False)" modifiers="class">
Bases: `object`
A class for decomposing 1-qubit unitaries into Euler angle rotations.
The resulting decomposition is parameterized by 3 Euler rotation angle parameters $(\theta, \phi, \lambda)$, and a phase parameter $\gamma$. The value of the parameters for an input unitary depends on the decomposition basis. Allowed bases and the resulting circuits are shown in the following table. Note that for the non-Euler bases (U3, U1X, RR), the ZYZ Euler parameters are used.
| Basis | Euler Angle Basis | Decomposition Circuit |
| ------ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| ZYZ | $Z(\phi) Y(\theta) Z(\lambda)$ | $e^{i\gamma} R_Z(\phi).R_Y(\theta).R_Z(\lambda)$ |
| ZXZ | $Z(\phi) X(\theta) Z(\lambda)$ | $e^{i\gamma} R_Z(\phi).R_X(\theta).R_Z(\lambda)$ |
| XYX | $X(\phi) Y(\theta) X(\lambda)$ | $e^{i\gamma} R_X(\phi).R_Y(\theta).R_X(\lambda)$ |
| XZX | $X(\phi) Z(\theta) X(\lambda)$ | $e^{i\gamma} R_X(\phi).R_Z(\theta).R_X(\lambda)$ |
| U3 | $Z(\phi) Y(\theta) Z(\lambda)$ | $e^{i\gamma} U_3(\theta,\phi,\lambda)$ |
| U321 | $Z(\phi) Y(\theta) Z(\lambda)$ | $e^{i\gamma} U_3(\theta,\phi,\lambda)$ |
| U | $Z(\phi) Y(\theta) Z(\lambda)$ | $e^{i\gamma} U_3(\theta,\phi,\lambda)$ |
| PSX | $Z(\phi) Y(\theta) Z(\lambda)$ | $e^{i\gamma} U_1(\phi+\pi).R_X\left(\frac{\pi}{2}\right).$ $U_1(\theta+\pi).R_X\left(\frac{\pi}{2}\right).U_1(\lambda)$ |
| ZSX | $Z(\phi) Y(\theta) Z(\lambda)$ | $e^{i\gamma} R_Z(\phi+\pi).\sqrt{X}.$ $R_Z(\theta+\pi).\sqrt{X}.R_Z(\lambda)$ |
| ZSXX | $Z(\phi) Y(\theta) Z(\lambda)$ | $e^{i\gamma} R_Z(\phi+\pi).\sqrt{X}.R_Z(\theta+\pi).\sqrt{X}.R_Z(\lambda)$ or $e^{i\gamma} R_Z(\phi+\pi).X.R_Z(\lambda)$ |
| U1X | $Z(\phi) Y(\theta) Z(\lambda)$ | $e^{i\gamma} U_1(\phi+\pi).R_X\left(\frac{\pi}{2}\right).$ $U_1(\theta+\pi).R_X\left(\frac{\pi}{2}\right).U_1(\lambda)$ |
| RR | $Z(\phi) Y(\theta) Z(\lambda)$ | $e^{i\gamma} R\left(-\pi,\frac{\phi-\lambda+\pi}{2}\right).$ $R\left(\theta+\pi,\frac{\pi}{2}-\lambda\right)$ |
Initialize decomposer
Supported bases are: U, PSX, ZSXX, ZSX, U321, U3, U1X, RR, ZYZ, ZXZ, XYX, XZX.
**Parameters**
* **basis** (*str*) the decomposition basis \[Default: U3]
* **use\_dag** (*bool*) If true the output from calls to the decomposer will be a [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") object instead of [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit").
**Raises**
**QiskitError** If input basis is not recognized.
## Methods
### angles
<Function id="qiskit.quantum_info.OneQubitEulerDecomposer.angles" signature="OneQubitEulerDecomposer.angles(unitary)">
Return the Euler angles for input array.
**Parameters**
**unitary** (*np.ndarray*) 2x2 unitary matrix.
**Returns**
(theta, phi, lambda).
**Return type**
tuple
</Function>
### angles\_and\_phase
<Function id="qiskit.quantum_info.OneQubitEulerDecomposer.angles_and_phase" signature="OneQubitEulerDecomposer.angles_and_phase(unitary)">
Return the Euler angles and phase for input array.
**Parameters**
**unitary** (*np.ndarray*) 2x2 unitary matrix.
**Returns**
(theta, phi, lambda, phase).
**Return type**
tuple
</Function>
### build\_circuit
<Function id="qiskit.quantum_info.OneQubitEulerDecomposer.build_circuit" signature="OneQubitEulerDecomposer.build_circuit(gates, global_phase)">
Return the circuit or dag object from a list of gates.
</Function>
## Attributes
### basis
<Attribute id="qiskit.quantum_info.OneQubitEulerDecomposer.basis">
The decomposition basis.
</Attribute>
</Class>