Skip to main contentIBM Quantum Documentation

TwoQubitBasisDecomposer

qiskit.synthesis.TwoQubitBasisDecomposer(gate, basis_fidelity=1.0, euler_basis='U', pulse_optimize=None)GitHub(opens in a new tab)

Bases: object(opens in a new tab)

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(opens in a new tab)) – Fidelity to be assumed for applications of KAK Gate. Defaults to 1.0.
  • euler_basis (str(opens in a new tab)) – 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(opens in a new tab) | 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. If False, don’t attempt optimization. If None, attempt optimization but don’t raise if unknown.

Methods

decomp0

static decomp0(target)

Decompose target Ud(x,y,z)\sim U_d(x, y, z) with 00 uses of the basis gate. Result UrU_r has trace:

Tr(UrUtarget)=4(cos(x)cos(y)cos(z)+jsin(x)sin(y)sin(z)\Big\vert\text{Tr}(U_r\cdot U_\text{target}^{\dag})\Big\vert = 4\Big\vert (\cos(x)\cos(y)\cos(z)+ j \sin(x)\sin(y)\sin(z)\Big\vert

which is optimal for all targets and bases

decomp1

decomp1(target)

Decompose target Ud(x,y,z)\sim U_d(x, y, z) with 11 use of the basis gate Ud(a,b,c)\sim U_d(a, b, c). Result UrU_r has trace:

Tr(UrUtarget)=4cos(xa)cos(yb)cos(zc)+jsin(xa)sin(yb)sin(zc)\Big\vert\text{Tr}(U_r \cdot U_\text{target}^{\dag})\Big\vert = 4\Big\vert \cos(x-a)\cos(y-b)\cos(z-c) + j \sin(x-a)\sin(y-b)\sin(z-c)\Big\vert

which is optimal for all targets and bases with z==0 or c==0.

decomp2_supercontrolled

decomp2_supercontrolled(target)

Decompose target Ud(x,y,z)\sim U_d(x, y, z) with 22 uses of the basis gate.

For supercontrolled basis Ud(π/4,b,0)\sim U_d(\pi/4, b, 0), all b, result UrU_r has trace

Tr(UrUtarget)=4cos(z)\Big\vert\text{Tr}(U_r \cdot U_\text{target}^\dag) \Big\vert = 4\cos(z)

which is the optimal approximation for basis of CNOT-class Ud(π/4,0,0)\sim U_d(\pi/4, 0, 0) or DCNOT-class Ud(π/4,π/4,0)\sim U_d(\pi/4, \pi/4, 0) and any target. It may be sub-optimal for b0b \neq 0 (i.e. there exists an exact decomposition for any target using BUd(π/4,π/8,0)B \sim U_d(\pi/4, \pi/8, 0), but it may not be this decomposition). This is an exact decomposition for supercontrolled basis and target Ud(x,y,0)\sim U_d(x, y, 0). No guarantees for non-supercontrolled basis.

decomp3_supercontrolled

decomp3_supercontrolled(target)

Decompose target with 33 uses of the basis. This is an exact decomposition for supercontrolled basis Ud(π/4,b,0)\sim U_d(\pi/4, b, 0), 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

traces(target)

Give the expected traces Tr(UUtarget)\Big\vert\text{Tr}(U \cdot U_\text{target}^{\dag})\Big\vert for a different number of basis gates.

Was this page helpful?