3.2.1 Lemma
123
Given a unitary matrix U , how to design a quantum circuit using just single-qubit and two-single-qubit gates to performs such operation or transformation? Before solving the problem, the following lemmas are useful.Lemma 1: Unitary matrix condition
Consider a matrix U. U is unitary ⇔ U’s column vectors are orthonormal
⇔ U’s row vector are orthonormal
123
This have been proved for example, in a linear algebra textbook [4]. It is an useful lemma because the statements are both sufficient and necessary. So one can determine whether a matrix is unitary at the first look by this lemma.Lemma 2: Row exchange elementary matrix
Suppose there is an identity matrix I ∈ Cn×n. Then exchange the ith row and jth row of I become a new matrix Eij, the so-called row exchange elementary matrix.
Then, EijA is a matrix that exchange ith row and jth row of A, where A ∈ Cn×p.
123
This is also proved in [4], which is a part of foundation of linear equations theory.Lemma 3: Any n × n unitary matrix can be decompose into a multiplication chain with n(n−1)2 elements, where each element has exactly 2 non-trivial bases.
123
The lemma has been mentioned in [12]. Here I take a 3 × 3 unitary matrixU =
as an example. The goal is to express the matrix as a multiplication chain of
3(3−1)
2 = 3 elements. i.e. U = U1HU2HU3H or U3U2U1U = I, where Ui’s are unitary matrix with 2-non trivial bases for all i = 1, 2, 3. First, let
U1 =
Note that we have eliminated the (2, 1) element. Next, let
U2 =
so
In this step, we eliminate the (3,1) element. Furthermore, the first column has only one element. So the element (1,1) must be 1 and other elements in the first row must be 0. This can be easily derived by lemma 1. Finally,
U3 = blkdiag
123
Now we analyze the complexity. It takes O(n) time to construct Ui, and the matrix multiplication costs O(n) time since there are only 2n elements that need to be updated. The length of the multiplication chain is O(n2). Thus, the total complexity of decomposed n × n unitary matrix on a classical computer is O(n3).Definition: Level-2 matrix
A is level-2 matrix if it satisfies: (i) A is 2c× 2c unitary matrix, where c is a positive integer, (ii) A is constructed by two non-trivial bases and other standard bases, and (iii) the index difference of the two non-trivial basis is δ = 2d, where d is an integer.
123
For example,is unitary and has 4 × 4 = 22 × 22 dimensions. There are two non-trivial bases, which are located at the first and the third row(column). Furthermore, the index difference δ = 3 − 1 = 21. Hence, it is a level-2 matrix.
Lemma 4: Gray code determines needed level-2 matrix
To decompose a n × n unitary gate, we need n-1 level-2 matrices which are generated by glog(n). Express glog(n) in decimal representation and then add 1 to get a vector V. The level-2 matrices has non-trivial bases at the ith and (i + 1)th element in V,
∀i = 1, 2, · · · , n − 1, and they are collected into a set called S.
123
For example, to decompose a 4 × 4 unitary matrix, consider the Gray code glog(4) = g2 =(00,01,11,11), and V=(1,2,4,3). Therefore, the level-2 matrices we need are in the set S = {G1,22 , G2,42 , G4,32 }, and please see Fig 3.3 for their matrix representation. The symbol ”X” in the figure indicates the places of non-trivial bases. Note that the difference between adjacent elements in Gray code is only one bit, so δ is always an integer power of 2, and Gi,j2 must be a level-2 matrix.Figure 3.3: The required two-qubit gates for preparing any 4 × 4 unitary operation.
Lemma 5: The quantum circuit of any level-2 matrix is a multi-control gate
Consider gi,jlog(n) a level-2 matrix, and δ = |i − j|. The target bit locates at [log(δ) + 1]th qubit (count from down to up), and the type of controller (white or black) is determined by the place of the non-trivial basis regularly.
123
In fact, the quantum gate of any n × n level-2 matrix can be constructed easily at the first look, see Fig 3.3. A n-bit multi-control gate also can be decomposed into O(2log(n)) = O(n) universal gates mentioned in the previous section.3.2.2 Universal gate decomposition algorithm
123
Base on the lemmas, we can decompose any 2c×2cunitary matrix into universal gates by the python pseudo code shown in Fig. 3.4.Figure 3.4: The unitary decomposition algorithm. The input of the algorithm is an unitary matrix and the output is the series of multi-controlled gates