3.3.1 Preceding operations
123
Consider a system of linear equations A0x~0 = ~b0, where A0 ∈ Rm×n, ~x0 ∈ Rn×1, and ~b0 ∈ Rm×1. In the beginning, we need to transfer arbitrary matrix A0 into a Hermitian and true-dimensional matrix A. It can be done by the following transform:A =
where k = 2dlog(m+n))e− (m + n). Similarly, the vectors must be transformed too.
~
The new equation become A~x = ~b. Next, we must convert A into an unitary matrix U because a quantum gate is always unitary. The eigenvalue of an unitary matrix can be obtained by the quantum phase estimation algorithm. Besides, it must be easy to derive A’s eigenvalues from U ’s eigenvalues. Then, use A’s eigenvalues to reconstruct the inverse matrix or pseudo inverse matrix of A. This idea is used in both the HHL algorithm and the WZP algorithm.
3.3.2 Quantum Hamiltonian simulation
123
Given a Hermitian matrix with a true dimension, find a quantum circuit that performs unitary operation eiAt. This unitary operation is called quantum simulation or Hamiltonian simulation [28]. It is widely used in numerical quantum mechanics and quantum algorithm subroutines. The brute-force method is to calculate eiAt on a classical computer and design the quantum circuit by the matrix form. However, the matrix exponentiation is exponentially hard to compute as the dimension of the matrix increases. In other words, this brute-force method is not efficient. Thus, we need to use a more efficient algorithm to approximate the exact answer. The research goal is to balance the number of gates used and the accuracy. There are three quantum algorithms for simulating Hamiltonian.123
The first method is the Trotter-Suzuki method [7]. A Hermitian matrix can be written as the sum of some Hermitian matrices, e.g., A = A1+ A2, where all of them are Hermitian. Now consider the following formula. eiAt = e? iA1teiA2t. This is true only if [A1, A2] = 0. Thus, we must express the Hermitain matrix into the sum of other Hermitian matrix and they must commute to each other. The simplest expression is to divide them into diagonal term and off-diagonal term. The diago-nal term can be efficiently designed, the off-diagodiago-nal term can be express as n(n−1)2 independent terms. Aoff−diag = Σi<jAij|ii hj|. Therefore, they are Hermitian and commute with each other. U = eiAt = eiAdiagtQn(n−1)/2j=1 eiAjt.
123
The second method is the Aharonov-TaShma method, which is also known as the graph coloring method. It is an improved version of the Trotter-Suzuki method.The different thing is that the divison of the diagonal term. First, view the off-diagonal matrix as an adjacent matrix, so we can draw a undirected graph. Then, perform edge coloring to the graph. Next, divide different color edges into different groups. Then, transfer each graph back to a matrix. So we finish the division, and the quantum circuit can be designed. [7]
123
The third method is an genetic algorithm called the group leader optimization algorithm. A genetic algorithm starts with an arbitrary set of quantum circuits, andof course, none of them is the answer unless we are very lucky. We don’t find the accurate answer, instead, we compute the similarity between each quantum circuit and the true answer. Collect those members and called them leaders. Then, we do transformations such as ”crossover”, ”mutation”, etc, according to the leaders just like the interaction between organisms. After few passes of transformations, pick the best answer. The complexity of the genetic algorithm is independent of the complexity of the problem, but it is also hard to calculate the accuracy after how many times of transformation [29].
123
Despite there are many quantum simulation algorithms, the time complexity is quadratic growth with sparsity. In general, the complexity of the quantum Hamil-tonian simulation of a s-sparse matrix is O(s2) classically and O(s2log(n)) quantum mechanically.3.3.3 Quantum phase estimation
123
Before we discuss the quantum phase estimation algorithm, consider its sub-routine, quantum Fourier transform (QFT). Suppose there are n qubits that span a Hilbert space with 2n dimensions. Let j ∈ N and 0 ≤ j ≤ 2n− 1. Express j as binary digits, i.e.,j = j12n−1+ j22n−2+ · · · + jn = (j1j2· · · jn)2, (3.10)
where jk∈ {0, 1}∀k = 1 · · · n. The input and the output are
|ji ⇒ (|0i + e2πi(0.jn)2|1i)(|0i + e2πi(0.jn−1jn)2|1i) · · · (|0i + e2πi(0.j1j2···jn)2|1i)
2n/2 .
(3.11)
123
The circuit for QFT is shown in Figure 3.5 and it consists of many Hardmard gates, Phase gates and SWAP gates. The kth qubit has n − k + 1 operations, so the gate used is n + (n − 1) + · · · + 1 = O(n2), so does the time complexity. This time complexity is in contrast to O(n2n) of its classical counterpart of fast Fouriertransform (FFT).
Figure 3.5: Quantum circuit for quantum Fourier transform
123
Fourier transform has many applications such as in signal processing. However QFT cannot replace FFT since there is no efficient way to directly prepare and read out the amplitudes of quantum states. Instead, the QFT are used as a subroutines of other quantum algorithms such as quantum phase estimation.123
Given an n × n unitary matrix U with eigenvalue e2πiφj and corresponding eigenvector |uji, find the phase φj, ∀j = 1, 2, · · · n. This algorithm is called quantum phase estimation (QPE). The circuit is shown in Figure 3.6. The QF TH gate is the inverse circuit of QFT, just reversing the order of all gates and then doing Hermitian conjugate on each of the gates. The input and output of QPE are|0i⊗t|uji ⇒ φ1j
φ2j · · ·
φtj |uji =
(0.φ1jφ2j. . . φtj)2 |uji = |φji |uji , (3.12)
where φj is in binary expression so φkj ∈ {0, 1}, ∀k = 1, 2, · · · t. Note that the number of t qubits controls the accuracy of the phase that is estimated. Except for the preparation of U discussed in previous section of quantum Hamiltonian simulation, the gates used and time complexity are dominated by the inverse QFT, that is O(t2).
123
Furthermore, we don’t know the eigenvector in general. Suppose the input is an arbitrary vector |bi and it can be expressed as a linear combination of eigenvectors, that is, |bi = Σnj=1cj|uji. Then, the output of first register may be one of the eigenvectors |uji with probabilty |cj|2. Hence, it is difficult to find all the eigenvalues of a given unitary matrix.123
More details on QFT and QPE are shown in the bible textbook of quantum computation [12]. To summarize, both QFT and QPE cannot directly be used butFigure 3.6: Quantum circuit for quantum phase estimation
they are important subroutines of other quantum algorithms.
3.3.4 Controlled reciprocal rotation
123
Let |φi = |φ1i |φ2i · · · |φti be the output of QPE, so φ = (0.φ1φ2. . . φt)2 =φ1
2 + φ222 + · · · + φ2tt. A controlled reciprocal rotation is a (t + 1)-qubit gate that performs the following operation.
|0i |φi ⇒ ( s
1 − 1
(2πφ)2 |0i + 1
2πφ|1i) |φi . (3.13)
This operation can be made by several multi-controlled Pauli-Y rotation gate, recall that
Ry(θ) =
cos(θ/2) −sin(θ/2) sin(θ/2) cos(θ/2)
. (3.14)
Take t=2 case for example, i.e., 3-qubit controlled rotation gate. The inputs can be
|00i , |01i , |10i , |11i, and the corresponding outputs are q
1 − 2πφ1
00 |0i + 2πφ1
00 |1i, q1 − 2πφ1
01|0i+2πφ1
01|1i,q
1 − 2πφ1
10|0i+2πφ1
10|1i,q
1 − 2πφ1
11|0i+2πφ1
11|1i. Where φ00= (0.00)2 = 0, φ01 = (0.01)2 = 0.25, and so on. Note that the zero phase causes the denominator to be 0, so we exclude it. Then, construct the unitary matrix,
U = I ⊕ Ry(2 sin−1 1
2πφ01) ⊕ Ry(2 sin−1 1
2πφ10) ⊕ Ry(2 sin−1 1
2πφ11) (3.15)
The unitary matrix U must be a direct sum of 2 × 2 matrix since we consider all the possibilities of computational basis input (see lemma 5 in previous section). Further-more, it is a block diagonal matrix so it can be simplified by quantum multiplexer decomposition again. Hence, the complexity of (t + 1)-qubit controlled reciprocal rotation is O(2t) for both classical and quantum cases.
Figure 3.7: Quantum circuit for controlled reciprocal rotation for t = 2 case. The circuit is an exact transformation (no approximation) and can be simplified by the quantum multiplexer decomposition.
123
The circuit design is come from my idea. The different things from the other papers [30, 31, 32] are that my circuit is exact without any approximation as long as there is no zero eigenvalue. Moreover, the gate used is at the same order in our circuit. Furthermore, we don’t need to know any eigenvalue to set the parameters of the controlled rotation gates. Thus, it is more reliable.3.3.5 HHL Algorithm
123
In this section, we solve A~x = ~b by the HHL algorithm, where A and ~b have been prepared beforehand into unitary operator and state vector respectively. The idea is using quantum Hamiltonian simulation to construct quantum circuit that performs unitary operation U = eiAt with eigenvalue eiλjt. Note that λj ∈ λ(A), ∀j = 1, 2, · · · n, and U and A share the same eigenbasis. Thus, using QPE to get phase λj = 2πφj. The eigenvalue decomposition of A and A−1 areA = Σnj=1λj|uji huj| , A−1 = Σnj=1 1
λj |uji huj| . (3.16)
Express |bi as the eigenbases of A, i.e.,
|bi = Σnj=1βj|uji . (3.17)
The answer may be
|xi = A−1|bi = Σnj=1βj
λj |uji . (3.18)
Note that a quantum state must be normalized to 1, so we can not get A−1|bi in general case. But instead, we can obtain the answer without amplitude information,
A−1|bi
||A−1|bi||. The quantum circuit of the HHL algorithm is shown in Figure 3.8.
Figure 3.8: Quantum circuit for the HHL algorithm. It contains two quantum phase estimation subroutines and one controlled reciprocal rotation.
123
The quantum state evolution of the HHL algorithm is described as below. The initial state isΣnj=1|0i |0i⊗tβj|uji . (3.19)
After first stage, the quantum phase estimation, the state becomes
Σnj=1βj|0i |φji |uji . (3.20)
Notice that φj is a t-qubit number. Perform the controlled rotation on the state at the second stage, and the resultant state becomes
Σnj=1βj s
1 − 1
(2πφj)2 |0i |φji |uji + 1
2πφj |1i |φji |uji
!
(3.21)
The third stage is to apply inverse QPE, so the state becomes
Σnj=1βj s
1 − 1
(2πφj)2 |0i + 1 2πφj |1i
!
|0i⊗t|uji
= Σnj=1βj s
1 − c2
λ2j |0i + c λj
|1i
!
|0i⊗t|uji . (3.22)
Finally, measure the first register. If the measurement result is |1i, then the total state becomes
|1i |0i⊗tΣnj=1βj
λj |uji , (3.23)
and the state in the third register is the answer |xi.