OneQubitEulerDecomposer
class qiskit.synthesis.OneQubitEulerDecomposer(basis='U3', use_dag=False)
Bases: object
A class for decomposing 1-qubit unitaries into Euler angle rotations.
The resulting decomposition is parameterized by 3 Euler rotation angle parameters , and a phase parameter . 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 (, , ), the Euler parameters are used.
Basis | Euler Angle Basis | Decomposition Circuit |
---|---|---|
‘ZYZ’ | ||
‘ZXZ’ | ||
‘XYX’ | ||
‘XZX’ | ||
‘U3’ | ||
‘U321’ | ||
‘U’ | ||
‘PSX’ | ||
‘ZSX’ | ||
‘ZSXX’ | or | |
‘U1X’ | ||
‘RR’ |
__call__
__call__(unitary, simplify=True, atol=1e-12)
Decompose single qubit gate into a circuit.
Parameters
- unitary (Operator |Gate | np.ndarray) – 1-qubit unitary matrix
- simplify (bool) – reduce gate count in decomposition [Default: True].
- atol (float) – absolute tolerance for checking angles when simplifying returned circuit [Default: 1e-12].
Returns
the decomposed single-qubit gate circuit
Return type
Raises
QiskitError – if input is invalid or synthesis fails.
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
object instead ofQuantumCircuit
.
Raises
QiskitError – If input basis is not recognized.
Attributes
basis
The decomposition basis.
Methods
angles
angles(unitary)
Return the Euler angles for input array.
Parameters
unitary (ndarray) – unitary matrix.
Returns
(theta, phi, lambda)
.
Return type
angles_and_phase
angles_and_phase(unitary)
Return the Euler angles and phase for input array.
Parameters
unitary (ndarray) –
Returns
(theta, phi, lambda, phase)
.
Return type
build_circuit
build_circuit(gates, global_phase)
Return the circuit or dag object from a list of gates.
Return type