9

As you know, universal quantum computing is the ability to construct a circuit from a finite set of operations that can approximate to arbitrary accuracy any unitary operation.

There also exist some results proving that exact decompositions of particular unitary operations can be found. For instance, a method was provided here (see section V) to construct a quantum circuit for a general two-qubit gate, based on the method given by Kraus and Cirac to decompose any desired two-qubit gate.

I want to understand this method such that I learn how to find the quantum circuit implementing any $4\times4$ unitary matrix. To help with that, I devised the following challenge: You are given an unitary matrix, $U$, over two qubits and asked to follow either the previously mentioned methods or another method you know about to come up with the quantum circuit implementing this unitarity. I know what one circuit representation is because I built it myself to obtain this matrix. Our goal should be to find the decomposition with the fewer number of gates, however, other decomposition methods will also be useful to learn. Here's the matrix

$$ U\left(x\right)=\left(\begin{array}{cccc} 0 & \left(-\frac{1}{2}+\frac{i}{2}\right)e^{ix/2} & 0 & \left(\frac{1}{2}+\frac{i}{2}\right)e^{ix/2}\\ 0 & \frac{ie^{-ix/2}}{\sqrt{2}} & 0 & -\frac{e^{-ix/2}}{\sqrt{2}}\\ \left(-\frac{1}{2}-\frac{i}{2}\right)e^{-ix/2} & 0 & \left(\frac{1}{2}-\frac{i}{2}\right)e^{-ix/2} & 0\\ -\frac{e^{ix/2}}{\sqrt{2}} & 0 & \frac{ie^{ix/2}}{\sqrt{2}} & 0 \end{array}\right) $$

If you are aware of any numerical methods that can achieve this task I also encourage you to post the solution you find and the steps to find it. E.g., as answered at another question on this site, qubiter has a module which apparently can decompose any n-qubit unitary into cnots and single qubit rotations using the cosine-sine decomposition, and this is probably not the only numerical method looking into this problem.

I believe an exhaustive exploration of these methods will be a helpful reference to a big audience, but let us start simple: can you give a circuit decomposition for $U\left(x\right)$?

Universal gate set:

You may consider the following set of basic gates: hadamard ($H$), phase ($S$), $\pi/8$ rotation ($T$), $cX$, $S^{\dagger}$, $T^{\dagger}$, and rotations

$$ R_{x}\left(\theta\right)=\left(\begin{array}{cc} \cos\left(\frac{\theta}{2}\right) & -i\sin\left(\frac{\theta}{2}\right)\\ -i\sin\left(\frac{\theta}{2}\right) & \cos\left(\frac{\theta}{2}\right) \end{array}\right),\quad R_{y}\left(\theta\right)=\left(\begin{array}{cc} \cos\left(\frac{\theta}{2}\right) & -\sin\left(\frac{\theta}{2}\right)\\ \sin\left(\frac{\theta}{2}\right) & \cos\left(\frac{\theta}{2}\right) \end{array}\right),\quad R_{z}\left(\theta\right)=\left(\begin{array}{cc} e^{-\frac{i\theta}{2}} & 0\\ 0 & e^{\frac{i\theta}{2}} \end{array}\right) $$

With an eye on a real implementation, you may also consider IBM QX universal gate set made of a $cX$ together with one-qubit rotational and phase gates

$$ \begin{split}V_{1}(\lambda) & =\begin{pmatrix}1 & 0\\ 0 & e^{i\lambda} \end{pmatrix}\\ V_{2}(\phi,\lambda) & =\frac{1}{\sqrt{2}}\begin{pmatrix}1 & -e^{i\lambda}\\ e^{i\phi} & e^{i(\lambda+\phi)} \end{pmatrix}\\ V_{3}(\theta,\phi,\lambda) & =\begin{pmatrix}\cos\left(\frac{\theta}{2}\right) & -e^{i\lambda}\sin\left(\frac{\theta}{2}\right)\\ e^{i\phi}\sin\left(\frac{\theta}{2}\right) & e^{i(\lambda+\phi)}\cos\left(\frac{\theta}{2}\right) \end{pmatrix} \end{split} $$

Actually, $V_{1}$ and $V_{2}$ are just special cases of $V_{3}$, hence IBM's universal set can be reduced to just two gates.

Example:

Suppose you wanted to find the circuit implementation for an unitarity $U\left(x,y\right)$ given by the following matrix

$$ \left(\begin{array}{cccc} e^{-\frac{1}{2}i\pi y}\cos\frac{x}{2} & 0 & 0 & -e^{-\frac{1}{2}i\pi y}\sin\frac{x}{2}\\ 0 & -ie^{\frac{i\pi y}{2}}\sin\frac{x}{2} & -ie^{\frac{i\pi y}{2}}\cos\frac{x}{2} & 0\\ \sqrt[4]{-1}e^{-\frac{1}{2}i\pi y}\sin\frac{x}{2} & 0 & 0 & \sqrt[4]{-1}e^{-\frac{1}{2}i\pi y}\cos\frac{x}{2}\\ 0 & -(-1)^{3/4}e^{\frac{i\pi y}{2}}\cos\frac{x}{2} & (-1)^{3/4}e^{\frac{i\pi y}{2}}\sin\frac{x}{2} & 0 \end{array}\right) $$

You can check $U\left(x,y\right)$ can be decomposed into the following product of operations

$$ U\left(x,y\right)=\left(T\otimes S^{\dagger}\right)\cdot CNOT_{01}\cdot\left(R_{y}\left(x\right)\otimes R_{z}\left(y\pi\right)\right)\cdot CNOT_{10} $$

and the circuit representation is

decomposition

PDRX
  • 201
  • 1
  • 4
  • 2
    What's your universal gate set? If it is from one of the links, could you copy it into the question itself? – AHusain Sep 15 '18 at 04:16
  • 1
    @AHusain Please check if my edit is enough. – PDRX Sep 15 '18 at 14:56
  • 1
    Good. Now the question is better specified. – AHusain Sep 15 '18 at 16:00
  • 1
    Can you show us the decompositions of your challenge matrix using {H,cX,S,T}, {S',T',Rx,Ry,Rz}, {cX,V3} ? – user1271772 No more free time Sep 15 '18 at 17:51
  • 1
    @user1271772 I can, but isn't it better if I don't? Just to clarify, I gave two sets of elementary gates, the first one was $S_1=\left{H,S,T,S',T',cX,Rx,Ry,Rz \right}$ and the second one $S_2=\left{cX,V1,V2,V3 \right}$, which can be reduced to $S_2=\left{cX, V3 \right}$ and from which $S_1$ can be obtained. – PDRX Sep 15 '18 at 18:39
  • Ok it wasn't clear whether or not the first one was 1 set or 2 sets. Because {H,cX,T} is already universal. Also as you said, {cX,V1,V2,V3} = {cX,V3}. Finally, I suggest you give the gate compositions for the things that you suggested, so that people know exactly what to do. – user1271772 No more free time Sep 15 '18 at 18:42
  • @user1271772 Or could leave the given U(x) as the challenge and something else (maybe easier) to serve as the example. – AHusain Sep 15 '18 at 18:48
  • @user1271772 Sure $\left{ H,T,cX\right} $ is already universal, it's just that if you have the other gates available in your toolbox you can apply them directly and it counts as a single gate, which is easier to implement in practice. Also, the method I said I wanted to learn, which gives the optimal decomposition, assumes rotational gates are available. – PDRX Sep 15 '18 at 19:01
  • @AHusain: ok, that's true too! Some example of what PDRX is looking for would be nice in order to encourage participation from more people (who might not have done gate decompositions before) to see exactly what they'e expected to do. It can be a simpler example than U, if the user wishes. – user1271772 No more free time Sep 15 '18 at 19:34
  • @PDRX, I fully understand that you want the whole set including the rotations and the S and the S' and T', but I'm just saying that this wasn't clear to me in the comment where I suggested {H,S,T,cX} as one gate set. So, what is the decomposition of U, in terms of your set S1 ? – user1271772 No more free time Sep 15 '18 at 19:36
  • Please check the example I added. – PDRX Sep 15 '18 at 22:37

1 Answers1

4

The circuit that I came up with is: enter image description here up to a global phase factor of $-e^{i x/2 + i \pi/4}$. The phase gate "x" that I used is essentially $R_z(x/2)=V_1(x)$ up to a global phase factor, so this is directly applicable to the first gates set. There's some possibility to move around some of the single-qubit gates, but I think this option minimises the depth of the circuit, which may be a more relevant number than the absolute number of gates, as it's more related to the time a circuit would take to implement (and hence how susceptible to noise it might be). Of course, I don't pretend that all gates would take the same length of time, and that's a completely different set of rules that one would be optimising over.

This same circuit can be rewritten using the other gate setenter image description here

To come up with this decomposition, I didn't use any particular method beyond the standard "I stared at it for a long time" technique. I then wrote down a circuit which was always going to be sub-optimal (including a swap gate, and a two-qubit diagonal gate with arbitrary phases on the diagonal), but then rearranged the circuit to bring some elements together so that they cancelled.

DaftWullie
  • 57,689
  • 3
  • 46
  • 124
  • 1
    Thanks for contributing! To be clear, I suggest you add the matrix of the unitarity you found with each of your circuits. You can simply add their expression in terms of the given $U\left(x\right)$. – PDRX Sep 18 '18 at 11:42