# Two qubit gate decomposition using Qiskit

I am writing some python code to be able to optimise the total error in two qubit gate decomposition.

I am using the Qiskit module qiskit.quantum_info.synthesis.two_qubit_decompose

My question relates to the difference between the two classes given in this code. One is TwoQubitWeylDecomposition and seems to decompose using the KAK1 method detailed on page two here.

The other, TwoQubitBasisDecomposer() allows you to input which specific two-qubit gate you want to use in the decomposition of an arbitrary SU(4) (e.g. CNOT, Molmer-Sorensen etc).

One of the methods of this class allows you to find the fidelity of a target unitary, using $$0$$, $$1$$, $$2$$ or $$3$$ implementations of the basis gate of your choice (higher fidelity with more basis gate usage). However, you have to turn the target unitary into the TwoQubitWeylDecomposition class, otherwise, you get errors (target doesn't have the attribute .a).

I'm uncertain why the target unitary needs to be a TwoQubitWeylDecomposition class. The documentation isn't very helpful either.

I think I found why the target unitary needs to be a TwoQubitWeylDecomposition class as the .a, .b, and .c attributes allow for the access of the second np.mod((d[:3]+d[3])/2, 2*np.pi). This argument is needed for the TwoQubitBasisDecomposer(), and so the target unitary needs to be a TwoQubitWeylDecomposition. I hope this helps. :)