About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
TwoQubitBasisDecomposer
class qiskit.synthesis.TwoQubitBasisDecomposer(gate, basis_fidelity=1.0, euler_basis='U', pulse_optimize=None)
Bases: object
A class for decomposing 2-qubit unitaries into minimal number of uses of a 2-qubit basis gate.
Parameters
- gate (Gate) – Two-qubit gate to be used in the KAK decomposition.
- basis_fidelity (float) – Fidelity to be assumed for applications of KAK Gate. Defaults to
1.0
. - euler_basis (str) – Basis string to be provided to
OneQubitEulerDecomposer
for 1Q synthesis. Valid options are ['ZYZ'
,'ZXZ'
,'XYX'
,'U'
,'U3'
,'U1X'
,'PSX'
,'ZSX'
,'RR'
]. - pulse_optimize (bool | None) – If
True
, try to do decomposition which minimizes local unitaries in between entangling gates. This will raise an exception if an optimal decomposition is not implemented. Currently, only [{CX, SX, RZ}] is known. IfFalse
, don’t attempt optimization. IfNone
, attempt optimization but don’t raise if unknown.
__call__
__call__(unitary, basis_fidelity=None, approximate=True, use_dag=False, *, _num_basis_uses=None)
Decompose a two-qubit unitary
over fixed basis and using the best approximation given that each basis application has a finite basis_fidelity
.
Parameters
- unitary (Operator or ndarray) – unitary to synthesize.
- basis_fidelity (float or None) – Fidelity to be assumed for applications of KAK Gate. If given, overrides
basis_fidelity
given at init. - approximate (bool) – Approximates if basis fidelities are less than 1.0.
- use_dag (bool) – If true a
DAGCircuit
is returned instead of aQuantumCircuit
when this class is called. - _num_basis_uses (int) – force a particular approximation by passing a number in [0, 3].
Returns
Synthesized quantum circuit.
Return type
Raises
QiskitError – if pulse_optimize
is True but we don’t know how to do it.
Methods
decomp0
static decomp0(target)
Decompose target with uses of the basis gate. Result has trace:
which is optimal for all targets and bases
decomp1
decomp1(target)
Decompose target with use of the basis gate . Result has trace:
which is optimal for all targets and bases with z==0
or c==0
.
decomp2_supercontrolled
decomp2_supercontrolled(target)
Decompose target with uses of the basis gate.
For supercontrolled basis , all b, result has trace
which is the optimal approximation for basis of CNOT-class or DCNOT-class and any target. It may be sub-optimal for (i.e. there exists an exact decomposition for any target using , but it may not be this decomposition). This is an exact decomposition for supercontrolled basis and target . No guarantees for non-supercontrolled basis.
decomp3_supercontrolled
decomp3_supercontrolled(target)
Decompose target with uses of the basis. This is an exact decomposition for supercontrolled basis , all b, and any target. No guarantees for non-supercontrolled basis.
num_basis_gates
num_basis_gates(unitary)
Computes the number of basis gates needed in a decomposition of input unitary
traces
Was this page helpful?
Report a bug or request content on GitHub.