10
$\begingroup$

In Qiskit's extension package we have the UnitaryGate module that you can initialize using a unitary matrix and then add it to your circuit. How efficiently is this decomposition done under the hood?

Also, if I wanted to do the decomposition myself, what's the best way of doing so?

$\endgroup$
3
  • $\begingroup$ Some basic information might be useful: Nielsen's chap 4(the part of general gates), and Solovay-Kitaev's algorithm. There is also some reinforce-learning way for gate decomposition, such as this paper. While I am also curious about the complexity lower bound of the problem. $\endgroup$
    – narip
    Commented Jun 28, 2021 at 4:51
  • $\begingroup$ @narip Solovay-Kitaev is largely irrelevant here. There, you're trying to decompose a gate from a finite gate set. In Qiskit, the rotations have a continuous parameter available to them. $\endgroup$
    – DaftWullie
    Commented Jun 28, 2021 at 8:34
  • $\begingroup$ @DaftWullie But does the problem mean that UnitaryGate(A) can add any unitary matrix $A$ into the circuit? So with the help of the UnitaryGate() function, we may have any unitary matrix at hand? $\endgroup$
    – narip
    Commented Jun 28, 2021 at 10:34

1 Answer 1

9
$\begingroup$

For 2x2 unitary, it is just a U3-gate.

For 4x4 unitary, TwoQubitBasisDecomposer is used. TwoQubitBasisDecomposer implements KAK decomposition method described in arXiv:0806.4015 by Drury and Love. This method uses optimal number of CNOT gates.

For larger unitaries, Isometry class is used. This class implements the method introduced by Iten et al. in arXiv:1501.06911. This method achieves the theoretical lower bound on the number of used CNOT gates.


Update: In Qiskit version 0.37 a new module qiskit.quantum_info.synthesis.qsd is added to apply Quantum Shannon Decomposition of arbitrary unitaries. This functionality replaces the previous isometry-based approach.

The Quantum Shannon Decomposition (arXiv:quant-ph/0406176) uses about half the CNOT gates as the isometry implementation when decomposing unitary matrices of greater than two qubits.

$\endgroup$
4
  • $\begingroup$ Thanks, this is very helpful! Do you think there is a detailed overview of the Qiskit comilation/transpilation process somewhere? Here is one qiskit.org/documentation/apidoc/transpiler.html but it is quite brief. Currently the bits and pieces that I pick from scattered posts on QC.SE are my main sources. $\endgroup$ Commented Jun 28, 2021 at 10:35
  • $\begingroup$ Glad to help. My main source is the code, including this answer. $\endgroup$ Commented Jun 28, 2021 at 14:59
  • $\begingroup$ Do you know which method the Isometry class in Qiskit uses? The cited paper by Iten et al. presents 3 methods: Knill, Column-by-column (CCD), Cosine-Sine (CSD). By the source code it looks to me like they use CCD, but I am not sure. $\endgroup$ Commented Aug 22, 2022 at 0:57
  • $\begingroup$ Hi @Egretta.Thula. I am using qiskit==0.46.0. Which paper I have to cite if I use the 'circuit.unitary method? Is it the Isometry paper or Quantum Shannon Decomposition paper? Also, some of the link in this answer now do not work. It would be great help if you can update your answer if possible. $\endgroup$
    – Manu
    Commented Jul 14 at 5:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.