Paper The following article is Open access

Quantum algorithm and circuit design solving the Poisson equation

, , , and

Published 11 January 2013 © IOP Publishing and Deutsche Physikalische Gesellschaft
, , Citation Yudong Cao et al 2013 New J. Phys. 15 013021 DOI 10.1088/1367-2630/15/1/013021

1367-2630/15/1/013021

Abstract

The Poisson equation occurs in many areas of science and engineering. Here we focus on its numerical solution for an equation in d dimensions. In particular we present a quantum algorithm and a scalable quantum circuit design which approximates the solution of the Poisson equation on a grid with error ε. We assume we are given a superposition of function evaluations of the right-hand side of the Poisson equation. The algorithm produces a quantum state encoding the solution. The number of quantum operations and the number of qubits used by the circuit is almost linear in d and polylog in ε−1. We present quantum circuit modules together with performance guarantees which can also be used for other problems.

Export citation and abstract BibTeX RIS

Content from this work may be used under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 licence. Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI.

1. Introduction

Quantum computers take advantage of quantum mechanics to solve certain computational problems faster than classical computers. Indeed in some cases the quantum algorithm is exponentially faster than the best classical algorithm known [112].

In this paper we present a quantum algorithm and circuit solving the Poisson equation. The Poisson equation plays a fundamental role in numerous areas of science and engineering, such as computational fluid dynamics [13, 14], quantum mechanical continuum solvation [15], electrostatics [16], the theory of Markov chains [1719] and is important for density functional theory and electronic structure calculations [20].

Any classical numerical algorithm solving the Poisson equation with error ε has cost bounded from below by a function that grows as εαd, where d denotes the dimension or the number of variables, and α > 0 is a smoothness constant [21, 22]. Therefore the cost grows exponentially in d and the problem suffers from the curse of dimensionality.

We show that the Poisson equation can be solved with error ε using a quantum algorithm with a number of quantum operations which is almost linear in d and polylog in ε−1. A number of repetitions proportional to ε−4α guarantees that this algorithm succeeds with probability arbitrarily close to 1. Hence the quantum algorithm breaks the curse of dimensionality and, with respect to the dimension of the problem d, enjoys exponential speedup relative to classical algorithms.

On the other hand, we point out that the output of the algorithm is a quantum state that encodes the solution on a regular grid rather than a bit string that represents the solution. It can be useful if one is interested in computing a function of the solution rather than the solution itself. In general, the quantum circuit implementing the algorithm can be used as a module in other quantum algorithms that need the solution of the Poisson equation to achieve their main task.

In terms of the input of the algorithm, we assume that a quantum state encoding a superposition of function evaluations of the right-hand side of the Poisson equation is available to us, and we do not account for the cost of preparing this superposition. In general, preparing arbitrary quantum states is a very hard problem. Nevertheless, in certain cases one can efficiently prepare superpositions of function evaluations using the techniques in [23, 24]. We do not deal with the implementation of such superpositions in this paper.

There are many ways to solve the Poisson equation. We choose to discretize it on a regular grid in Cartesian coordinates and then solve the resulting system of linear equations. For this we use the quantum algorithm of [25] for solving linear equation systems. The solution of differential and partial differential equations (PDEs) is a natural candidate for applying that algorithm, as already stated in [25]. It has been applied to the solution of differential equations in [26, 27]. In the case of the Poisson equation that we consider in this paper there is no need, however, to assume that the matrix is given by an oracle. Indeed, a significant part of our work deals with the Hamiltonian simulation of the matrix of the Poisson equation. Moreover, it is an open problem to determine when it is possible to simulate a Hamiltonian with cost polynomial in the logarithm of the matrix size and the logarithm of ε−1 [28]. Our results show that in the case of the Hamiltonian for the Poisson equation the answer is positive.

Our analysis of the implementation includes all the numerical details and will be helpful to researchers working on other problems. All calculations are carried out in fixed precision arithmetic and we provide accuracy and cost guarantees. We account for the qubits, including ancilla qubits, needed for the different operations. We provide quantum circuit modules for the approximation of trigonometric functions, which are needed in the Hamiltonian simulation of the matrix of the Poisson equation. We show how to obtain a quantum circuit computing the reciprocal of the eigenvalues using Newton iteration and modular addition and multiplication. We show how to implement quantum mechanically the inverse trigonometric function needed for controlled rotations. As we indicated, our results are not limited to the solution of the Poisson equation but can be used in other quantum algorithms. Our simulation module can be combined with splitting methods to simulate the Hamiltonian −Δ + V , where Δ is the Laplacian and V is a potential function. The trigonometric approximations can be used by algorithms dealing with quantum walks. The reciprocal of a real number and a controlled rotation by an angle obtained by an inverse trigonometric approximation are needed for implementing the linear system's algorithm [25] regardless of the matrix involved.

2. Overview

We consider the d-dimensional Poisson equation with Dirichlet boundary conditions.

Definition 1. 

Equation (1)

where $f:I_d\rightarrow {\mathbb R}$ is a sufficiently smooth function; e.g. see [21, 29, 30] for details.

For simplicity we study this equation over the unit cube but a similar analysis applies to more general domains in ${\mathbb R}^d$ . Often one solves this equation by discretizing it and solving the resulting linear system. A finite difference discretization of the Poisson equation on a grid with mesh size h, using a (2d + 1) stencil for the Laplacian, yields the linear system

Equation (2)

where fh is the vector obtained by sampling the function f on the interior grid points [3032]. The resulting matrix is symmetric positive definite.

To solve the Poisson equation with error O(ε) both the discretization error and the error on the solution of the system should be O(ε). This implies that Δh is a matrix of size proportional to εαd × εαd, where α > 0 is a constant that depends on the smoothness of the solution which, in turn, depends on the smoothness of f [21, 30, 33]. For example, when f has uniformly bounded partial derivatives up to order four then α = 1/2.

There are different ways for solving this system using classical algorithms. Demmel [31, table 6.1] lists a number of possibilities. The conjugate gradient algorithm [34] is an example. Its cost for solving this system with error ε is proportional to

where κ denotes the condition number of Δh. We know κ = ε−2α, independently of d. The resulting cost is proportional to εαdαlog ε−1. For details about the solution of large linear systems see [35]. Observe that the factor εαd in the cost is the matrix size and its contribution cannot be overcome. Any direct or iterative classical algorithm solving this system has a cost of at least εαd, since the algorithm must determine all unknowns. So any algorithm solving the system has a cost exponential in d. In fact a much stronger result holds, namely, the cost of any classical algorithm solving the Poisson equation in the worst case must be exponential in d [21].

We present a scalable quantum circuit for the solution of (2) and thereby for the solution of the Poisson equation with error O(ε) that uses a number of qubits proportional to $\max \{d, \log _2\varepsilon ^{-1}\} (\log _2 d + \log _2 \varepsilon ^{-1})^2$ and a number of quantum operations proportional to $\max \{d, \log _2\varepsilon ^{-1}\} (\log _2 d + \log _2 \varepsilon ^{-1})^3$ . It can be shown that log2d = O(log2ε−1) and the above expressions are simplified to $\max \{d, \log _2\varepsilon ^{-1}\} (\log _2 \varepsilon ^{-1})^2$ qubits and $\max \{d, \log _2\varepsilon ^{-1}\} ( \log _2 \varepsilon ^{-1} )^3$ quantum operations. A measurement outcome at the final state determines whether the algorithm has succeeded or not. A number of repetitions proportional to the square of the condition number yields a success probability arbitrarily close to one.

In section 3 we deal with the discretization of the Poisson equation showing the resulting matrix. We also describe how the matrix in the multidimensional case can be expressed in terms of the one-dimensional matrix using Kronecker products. This, as we will see, is important in the simulation of the Poisson matrix. In section 4 we show the quantum circuit solving the Poisson equation. We perform the error analysis and show the quantum circuit modules computing the reciprocal of the eigenvalues and from those the controlled rotation needed at the end of the linear system's algorithm [25]. In section 5 we deal with the Hamiltonian simulation of the matrix of the Poisson equation. The exponential of the multidimensional Hamiltonian is the d-fold tensor product of the exponential of the one-dimensional Hamiltonian. It is possible to diagonalize the one-dimensional Hamiltonian using the quantum Fourier transform. Thus it suffices to approximate the eigenvalues in a way leading to the desired accuracy in the result. We show the quantum circuit modules performing the eigenvalue approximation and derive the overall simulation cost. In section 6 we derive the total cost for solving the Poisson equation. Section 7 is the conclusion. In appendix A we list a number of elementary quantum gates and in appendix B we present a series of results concerning the accuracy and the cost of the approximations we use throughout the paper.

3. Discretization

3.1. One dimension

We start with the one-dimensional case to introduce the matrix Lh that we will use later in expressing the d-dimensional discretization of the Laplacian, using Kronecker products. We have

Equation (3)

where f is a given smooth function and u is the solution we want to compute. We discretize the problem with mesh size h = 1/M and we compute an approximate solution v at M + 1 grid points xi = ih, $i=0,\ldots ,M$ . Let ui = u(xi) and fi = f(xi), $i=0,\ldots ,M$ .

Using finite differences at the grid points to approximate the second derivative (3) becomes

Equation (4)

where ξi is the truncation error and can be shown to be $O(h^2\Vert\frac {d^4u}{\mathrm {d}x^4}\Vert_{\infty })$ if f has the fourth derivative uniformly bounded by a constant [31].

Ignoring the truncation error, we solve

Equation (5)

With boundary conditions v0 = 0 and vM = 0, we have M − 1 equations and M − 1 unknowns v1,...,vM−1:

Equation (6)

where Lh is the tridiagonal (M − 1) × (M − 1) matrix above; for the properties of this matrix, including its eigenvalues and eigenvectors see [31, section 6.3].

3.2. Two dimensions

In two dimensions the Poisson equation is

Equation (7)

We discretize this equation using a grid with mesh size h = 1/M; see figure 1. Each node is indexed uj,k, j,k∈{1,2,...,M} (figures 1(a) and (b)). We approximate the second derivatives using

Figure 1.

Figure 1. Discretization of the square domain and notation for indexing the nodes.

Standard image

Omitting the truncation error, and denoting the discretized Laplacian by −Δh we are led to solve

Equation (8)

where fj,k = f(jh,kh), j,k = 1,2,...,M − 1 and vj,k = 0 if j or k∈{0,M} i.e. when we have a point that belongs to the boundary.

Using the fact that the solution is zero at the boundary, we reindex (8) to obtain

Equation (9)

Equivalently, we denote this system by

where Δh is the discretized Laplacian.

For example, when M = 4, as in figure 1, we have that $\vec {v}=[v_1,\ldots ,v_9]^{\mathrm {T}}$ . Furthermore (9) becomes

Equation (10)

where I is the 3 × 3 identity matrix, B is

A is a Hermitian matrix with a particular block structure that is independent of M.

In particular, on a square grid with mesh size h = 1/M we have

Equation (11)

and A can be expressed in terms of Lh as follows:

Equation (12)

and its size is (M − 1)2 × (M − 1)2 [31].

Recall that Lh is the (M − 1) × (M − 1) matrix shown in (6) and I is the (M − 1) × (M − 1) identity matrix. Moreover, A can be expressed using Kronecker products as follows:

Equation (13)

3.3. d dimensions

We now consider the problem in d dimensions. Consider the Laplacian

We discretize Δ on a grid with mesh size h = 1/M using divided differences.

As before, this leads to a system of linear equations

Equation (14)

Note that −Δh = h−2A is a symmetric positive definite matrix and A is given by

and has size (M − 1)d × (M − 1)d. Lh is the (M − 1) × (M − 1) matrix shown in (6) and I is the (M − 1) × (M − 1) identity matrix. See [31] for details.

Observe that the matrix exponential has the form

Equation (15)

for all $\gamma \in \mathbb {R}$ , where $\mathrm {i} = \sqrt {-1}$ . We will use this fact later to derive the quantum circuit solving the linear system.

4. Quantum circuit

We derive a quantum circuit solving the system $-\Delta _h \vec v = \vec {f_h}$ , where h = 1/M and without loss of generality we assume that M is a power of two. We obtain a solution of the system with error O(ε). The steps below are similar to those in [25].

  • (i)  
    As in [25] assume the right-hand side vector $\vec {f_h}$ has been prepared quantum mechanically as a quantum state |fh〉 and stored in the quantum register B. Note $|f_h\rangle =\sum _{j=0}^{(M-1)^d-1}\beta _j|u_j\rangle $ , where |uj〉 denote the eigenstates of −Δh and βj are the coefficients.
  • (ii)  
    Perform phase estimation using the state |fh〉 in the bottom register and the unitary matrix e−2πh/E, where log2E = ⌈log d⌉ + log(4M2). The number of qubits in the top register of phase estimation is n = O(log(E/ε)).
  • (iii)  
    Compute an approximation of the inverse of the eigenvalues λj. Store the result on a register L composed of b = 3⌈log ε−1⌉ qubits (figure 2). The approximation error of the reciprocals is at most ε.
  • (iv)  
    Introduce an ancilla qubit to the system. Apply a controlled rotation on the ancilla qubit. The rotation operation is controlled be the register L which stores the reciprocals of the eigenvalues of −Δh (figure 2). The controlled rotation results in $\sqrt {1 - (C_d/\lambda _j)^2} |{0}\rangle + (C_d/\lambda _j) |{1}\rangle $ , where Cd is a constant.
  • (v)  
    Uncompute all other qubits on the system except the qubit introduced on the previous item.
  • (vi)  
    Measure the ancilla qubit. If the outcome is 1, the bottom register of phase estimation collapses to the state $\sum _{j=0}^{(M-1)^d-1} \beta _j{\lambda _j}^{-1} |{u_j}\rangle $ up to a normalization factor, where |uj〉 denote the eigenstates of −Δh. This is equal to the normalized solution of the system. If the outcome is 0, the algorithm has failed and we have to repeat it. An alternative would be to include amplitude amplification to boost the success probability. Amplitude amplification has been considered in the literature extensively and we do not deal with it here.
Figure 2.

Figure 2. Overview of the circuit for solving the Poisson equation. Wires with '/' represent registers or groups of qubits. W denotes the Walsh–Hadamard transform which applies a Hadamard gate on every qubit of the register. FT represents the quantum Fourier transform. 'HAM-SIM' is the Hamiltonian simulation subroutine that implements the operation e−2πh/E. 'INV' is the subroutine that computes λ−1. U represent uncomputation, which is the adjoint of all the operations before the controlled Ry rotation.

Standard image

4.1. Error analysis

We carry out the error analysis to obtain the implementation details. For d = 1 the eigenvalues of the second derivative are

For d > 1, the eigenvalues of −Δh are given by sums of the one-dimensional eigenvalues, i.e.

We consider them in non-decreasing order and denote them by λj, $j=1,\ldots , (M-1)^d.$ Then λ1 = 4dM2sin2(π/(2M)) is the minimum eigenvalue and λ(M−1)d = 4dM2sin2(π(M − 1)/(2M)) ⩽ 4dM2 is the maximum eigenvalue.

Define E by

Equation (16)

Then the eigenvalues are bounded from above by E. Recall that we have already assumed that M is a power of two. Then $E=2^{\lceil {\log _2{d}}\rceil }4M^2\in \mathbb {N}$ .

Note that the implementation accuracy of the eigenvalues determines the accuracy of the system solution.

Our algorithm uses approximations $\hat \lambda _j$ , such that $|\lambda _j - \hat \lambda _j|\leqslant \frac {17 E}{2^\nu } \leqslant \varepsilon $ ; see theorem B.2 in appendix B. We use n = log2E + ν bits to represent each eigenvalue, of which the most significant log2E bits hold each integer part and the remaining bits hold each fractional part. Without loss of generality, we can assume that 2ν ≫ E. More precisely, we consider an approximation $\hat \Delta _h$ of matrix Δh such that the two matrices have the same eigenvectors while their eigenvalues differ by at most ε.

We use phase estimation with the unitary matrix $\mathrm {e}^{-\mathrm {i}\hat \Delta _h t_0 /E}$ whose eigenvalues are $\mathrm {e}^{2\pi \mathrm {i} \hat \lambda _j t_0/(E 2\pi )}$ . Setting t0 = 2π we obtain the phases $\phi _j = \hat{\lambda}_j /E \in [0,1)$ . The initial state of phase estimation is (figure 2)

where |uj〉 is the jth eigenvector of −Δh and $\beta _j = \left <u_j|f_h\right >$ , for j = 1,2,...,(M − 1)d. Since we are using finite bit approximations of the eigenvalues, we have

Then ϕj 2n is an integer and phase estimation succeeds with probability 1 (see [36, section 5.2, p 221] for details).

The state prior to the application of the inverse Fourier transform in the phase estimation is

Equation (17)

After the application of the inverse Fourier transform to the first n qubits we obtain

where

Equation (18)

Now we need to compute the reciprocals of the eigenvalues. Observe that

where the last inequality holds trivially for sufficiently large M. This implies $\hat \lambda _j / C_d \geqslant \hat \lambda _1 / C_d \geqslant 4$ , where Cd = 2⌊log2d, for sufficiently large M. We obtain $k_j = 2^n \hat \lambda _j / E \geqslant \hat \lambda _1 \geqslant 4 C_d$ .

Append b qubits initialized to |0〉 on the left (Reg. L in figure 2), to obtain

Note that from (18) kj, $\hat {\lambda }_j$ and $\hat \lambda _j / C_d$ have the same bit representation. The difference between the integer kj and the other two numbers is the location of the decimal point; it is located after the most significant log2E bit in $\hat {\lambda }_j$ , and after the most significant log2(E/Cd) bit in $\hat \lambda _j/C_d$ . Therefore, we can use the labels |kj〉, $|{\hat \lambda _j}\rangle $ and $|{\hat {\lambda }_j / C_d}\rangle $ interchangeably, and write the state above as

Now we need to compute $h_j := h (\hat \lambda _j / C_d) = C_d / \hat \lambda _j$ . We do this using Newton iteration. We explain the details in section 4.2. We obtain an approximation $\hat h_j$ such that

Equation (19)

where $\varepsilon _0 = \min \{\varepsilon , E^{-1}\}$ . We store this approximation in the register composed of the leftmost b = 3⌈log2ε−10⌉ qubits.

This leads to the state

We append, on the left, a qubit initialized at |0〉 (Anc. in figure 2). We get

We need to perform the conditional rotation

For this, we will approximate the first qubit by

with |ω − ω'| ⩽ ε21, $\varepsilon _1= \min \{ \varepsilon , 1/(4M^2)\}$ . We discuss the cost of implementing this approximation in section 4.3.

The result of approximating the conditional rotation is to obtain $|{\tilde h_j}\rangle $ , where $\tilde h_j$ is a q = Θ(log2ε−11) bit number less than 1 satisfying $|\tilde h_j - \hat h_j|\leqslant \varepsilon _1^2$ and, therefore,

Equation (20)

for each $j=1,\ldots ,(M-1)^d$ .

Ignoring the ancilla qubits needed for implementing the approximation of the conditional rotation, we have the state

Uncomputing all the qubits except the leftmost gives the state

Let P1 = |1〉〈1|⊗I be the projection acting non-trivially on the first qubit. The system $-\Delta _h \vec v = \skew6\vec f_h$ has solution $\sum _{j=1}^{(M-1)^d} \beta _j\frac {1}{{\lambda }_j} |{u_j}\rangle $ . We derive the error as follows:

Equation (21)

where the second from last inequality is obtained using (20) and the last inequality is due to the fact that

Setting ν = ⌈log2(17E/ε)⌉ gives error ε(1 + o(1)) and the number of matrix exponentials used by the algorithm is O(log2(E/ε)). Therefore, if we measure the first qubit of the state |ψ〉 and the outcome is 1 the state collapses to a normalized solution of the linear system.

4.2. Computation of λ−1

In this part we deal with the computation of the reciprocals of the eigenvalues, which is marked as the 'INV' module in figure 2. For this we use Newton iteration to approximate v−1, v > 1. We perform s iterative steps and obtain the approximation $\hat x_s$ . The input and the output of each iterative step are b bit numbers. All of the calculations in each step are performed in fixed precision arithmetic. The initial approximation is $\hat x_0 = 2^{-p}$ , 2p−1 < v ⩽ 2p. (We use the notation $\hat x_i$ to emphasize that these values have been obtained by truncating a quantity xi to b bits of accuracy, i = 0,...,s.)

Theorem B.1 of appendix B gives the error of Newton iteration which is

where we have $\varepsilon _0=\min \{ \varepsilon , E^{-1}\}$ , s = ⌈log2 log2(2/ε20)⌉ and the number of bits satisfies b ⩾ 2⌈log2ε−10⌉ + O(log2 log2 log2ε−10).

Therefore, it suffices that the module of the quantum circuit that computes 1/λj carries each iterative step with 3⌈log2ε−10⌉ qubits of accuracy.

The quantum circuit computing the initial approximation $\hat x_0$ , of the Newton iteration is given in figure 3. The second register holds |v〉 and is n qubits long, of which the first log2(E/Cd) qubits represent the integer part of v and the remaining ones its fractional part. The first register is b qubits long. Recall that $\hat {\lambda }_j / C_d \geqslant 4$ . So input values below 4 do not correspond to meaningful eigenvalue estimates and we do not need to compute their reciprocals altogether; they can be ignored. Hence the circuit implements the unitary transformation |0〉b|v〉 → |0〉b|v〉, if the first log2(E/Cd) − 2 bits of v are all zero. Otherwise, it implements the initial approximation $\hat x_0$ through the transformation $|{0}\rangle ^{\otimes b} | v\rangle \to |{\hat x_0}\rangle | v\rangle $ .

Figure 3.

Figure 3. The quantum circuit computing the initial approximation $\hat {x}_0=2^{-p}$ of Newton iteration for approximating v−1, 2p−1 ⩽ v ⩽ 2p. See appendix A for definitions of the basic gates.

Standard image

Each iteration step xi+1 = −vx2i + 2xi is implemented using a quantum circuit of the form shown in figure 4 that computes $|{\hat x_{i}}\rangle | v\rangle \to |{\hat x_{i+1}}\rangle | v\rangle $ . This involves quantum circuits for addition and multiplication which have been studied in the literature [37].

Figure 4.

Figure 4. Circuit implementing each iterative step of the Newton method.

Standard image

The register holding |v〉 is n qubits long and the register holding the $|{\hat x_i}\rangle $ and $|{\hat x_{i+1}}\rangle $ is b qubits long. Note that internally the modules performing the iteration steps may use more than b qubits, say, double precision, so that the addition and multiplication operations required in the iteration are carried out exactly and then return the most significant b qubits of the result. The total number of qubits required for the implementation of each of these modules is O(log ε−10) and the total number of gates is a low degree polynomial in log ε−10.

4.3. Controlled rotation

We now consider the implementation of the controlled rotation

Assume for a moment that we have obtained |θ〉, a q qubit state, corresponding to an angle θ such that sin θ approximates ω. Then we can use controlled rotations Ry about the y-axis to implement R. We consider the binary representation of θ and have

Then

where Y is the Pauli Y operator and θ∈[0,π/2]. The detailed circuit is shown in figure 5.

Figure 5.

Figure 5. Circuit for executing the controlled Ry rotation. See appendix A for definitions of basic gates.

Standard image

We now turn to the algorithm that calculates |θ〉 from |ω〉. Since ω corresponds to the reciprocal of an approximate eigenvalue of the discretized Laplacian, we know that sin−1(ω) belongs to the first quadrant and sin−1(ω) = Ω(1/M2). Therefore, we can find an angle θ such that |sin(θ) − ω| ⩽ ε21, $\varepsilon _1=\min \{ 1/(4M^2),\varepsilon \}$ , using bisection and an approximation of the sine function.

In appendix B we show the error in approximating the sine function using fixed precision arithmetic. In section 5 we show the details of the resulting quantum algorithm computing the approximation to the sine function. These results, with a minor adjustment in the number of bits needed can be used here. We will not deal with the details of the quantum algorithm for the sine function in this section since we present them in section 5 that deals with the simulation of Poisson's matrix. We will only describe the steps of the algorithm and its cost.

Algorithm
(i) Take as an initial approximation of θ the value π/4.
(ii) Approximate the sin(θ) with error ε21/2 using our algorithm for the sine function (details in section 5 and appendix B). Let sθ denote this approximation.
(iii) If sθ < ω − ε21/2, set θ to be the midpoint of the right subinterval.
(iv) If sθ > ω + ε21/2, set θ to be the midpoint of the left subinterval.
(v) Repeat the steps 2–4 ⌈log2ε−21⌉ + 1 times.

An evaluation at the midpoint of an interval yields a value that satisfies either the condition of step 3, or that of step 4, or |sθ − ω| ⩽ ε21/2. If at any time both the conditions of steps 3 and 4 are false then θ will not change its value until the end. Then, at the end, we have |sin(θ) − ω| ⩽ |sin(θ) − sθ| + |sθ − ω| ⩽ ε21, since the error in computing the sine is ε21/2. On the other hand, if θ is updated until the very end of the algorithm the final value of theta also satisfies |sin(θ) − w| ⩽ ε21, because in the final interval we have |sin(θ) − ω| ⩽ |θ − sin−1(ω)| ⩽ ε21.

In a way similar to that of propositions 1 and 2 of appendix B we carry out the steps of the algorithm in q bit fixed precision arithmetic, $q=\max \{ 2\nu + 9, 13 + \nu + 2\log _2 M\}$ and sufficiently large ν to satisfy the accuracy requirements. (The last expression for q is slightly different form that in proposition 2 because it accounts for the fact that in the case we are dealing with here the angle is Ω(1/M2).) This gives us an approximation to the sine with error 2−(ν−1). We set

Thus ν and q are both Θ(log2ε1).

The algorithm for the sine function is based on an approximation of the exponential function using repeated squaring. Each square requires O(q2) quantum operations and O(q) qubits. This is repeated ν times before the approximation to the sine is obtained. Thus the cost of one bisection step requires O(νq2) quantum operations and O(νq) qubits. So, in terms of ε1, the total cost of bisection is proportional to (log2ε−11)4 quantum operations and (log2ε−11)3 qubits.

5. Hamiltonian simulation of the Poisson matrix

In this section we deal with the implementation of the 'HAM-SIM' module (figure 2) which effectively applies ${\mathrm { e}}^{-\mathrm {i}\hat \Delta _h t_0}$ onto register B. In our case the eigenvectors of the discretized Laplacian are known and we use approximations of the eigenvalues. From (11) and (15) we have

Equation (22)

Thus it suffices to implement eih−2Lhγ, for certain $\gamma \in \mathbb {R}$ , γ = 2π·2t/E, t = 0,1,...,log2E − 1 that are required in phase estimation. This can be accomplished by considering the spectral decomposition SΛS of the matrix Lh, where S is the matrix of the sine transform [31, 40]. Then S can be implemented using the quantum Fourier transform. We will implement an approximation of Λ.

We remark that the quantum circuits presented here can be used in the simulation of the Hamiltonian −Δ + V using splitting formulas. For results concerning Hamiltonian simulation using splitting formulas see [9, 28, 41].

5.1. One-dimensional case

We start with the implementation of eih−2Lhγ, γ = 2π2t/E, E = 4M2 when d = 1 and t = 0,1,...,n − 1, where n is the number of qubits in register C; see (17). The form of Lh is shown in (6) and is positive definite. It is a Toeplitz matrix and it is known that this type of matrix can be diagonalized via the sine transform S [42]. We have Lh = SΛS, where Λ is an (M − 1) × (M − 1) diagonal matrix containing the eigenvalues 4sin2(jπ/(2M)), j = 1,...,M − 1, of Lh and S = {Si,j}i,j=1,2,...,M−1 is the sine transform where $S_{i,j}=\sqrt {\frac {2}{M}}$ sin $(\frac {{\pi }ij}{M})$ , i,j = 1, $\ldots $ , M − 1. Thus

Equation (23)

The relationship between the sine and cosine transforms and the Fourier transform can be found in [40, theorem 3.10].

In particular, using the notation in [40], we have

Equation (24)

where CM+1, SM−1 denote the cosine and sine transforms, and the subscripts M − 1 and M + 1 emphasize the size of the respective matrix. F2M is the 2M × 2M matrix of the Fourier transform. The matrix TM has size 2M × 2M and is given by (25)

Equation (25)

The quantum circuits for implementing the unitary transformation TM is discussed in [38]. The action of TM can be described by [38]

Equation (26)

where i2 = −1, x is an n-bit number ranging 1 ⩽ x < 2n and x' denotes its complement of 2 i.e. x' = 2n − x. The basic idea of implementing TM is to separate its operation into an operator D, which ignores the complement of 2 in TM, and a controlled permutation π, which transforms the state |bx〉 to |bx'〉 only if b is 1. Therefore the action of D and π can be written as

Equation (27)

Clearly, TM = Dπ and the overall circuit for implementing operation TM is shown in figure 8.

By (24) the sine transform S can be implemented by cascading the quantum circuits in figure 8 with the circuit for the Fourier transform [36]. An ancilla bit is added to register b. It is kept in the state |1〉 in order to select the lower-right block

Equation (28)

from the unitary operation TMF2MTM (24), $a\in \mathbb {C}$ . Considering the state |fh〉, that corresponds to the right-hand side of (6), and for $b_i = \left <i|f_h\right >$ we have

Equation (29)

then the element a in equation (28) has no effect, and the circuit in figure 6 is equivalent to applying (SM−1 e2πiΛ2t/E SM−1) onto the (M − 1) elements of |fh〉. This is also equivalent to simulating the Hamiltonian e2πih−2Λ2t/E with the state |fh〉 stored in register b.

Figure 6.

Figure 6. Quantum circuit for implementing e−iΔhγ, $\gamma \in \mathbb {R}$ for the two-dimensional discrete Poisson equation. The subroutine of eih−2Lhγ is shown in figure 7. The registers holding |j1〉, |j2〉 are m qubits each.

Standard image
Figure 7.

Figure 7. Quantum circuit for implementing eih−2Lhγ, $\gamma \in \mathbb {R}$ , where Lh is the matrix in (6). SM−1 represents the sine transform matrix of size (M − 1) × (M − 1), M = 2m. This circuit acts on m + 1 qubits.

Standard image
Figure 8.

Figure 8. Quantum circuit for implementing TM in equations (24) and (25). In (b), Pm denotes the map |x〉 → |x + 1 mod 2n〉 on n qubits. Its implementation is described in [39]. See appendix A for the definitions of basic gates. (a) Generic circuit for TM = Dπ, for details refer to [38]. (b) Implementation of B and Pm gates in (a).

Standard image

We implement ${\mathrm { e}}^{2\pi \mathrm {i} h^{-2} \hat \Lambda 2^t / E}$ where $\hat \Lambda = \{\hat {\lambda }_j\}_{j = 1,\ldots ,M-1}$ is a diagonal matrix approximating Λ = {λj}j=1,...,M−1.

We obtain each $\hat {\lambda }_j$ , j = 1,...,M − 1 by the following algorithm. The general idea is to approximate sin x = ℑ(eix) = ℑ((eix/r)r) with Wr where W = 1 − ix/r + x2/r2 is the Taylor expansion of eix/r up to the second order term. Wr is computed efficiently in fixed point arithmetic using repeated squaring. The detailed steps are the following.

Eigenvalue simulation algorithm (ESA)

  • (i)  
    Let r = 2ν+7 where ν is positive integer which is related to the accuracy of the result. The inputs and the outputs of the modules below are $s = \max \{2\nu +9, 11 + \nu + \log _2 M\}$ bit numbers. Internally the modules may carry out calculations in higher precision O(s), but the results are returned using s bits. This value of s follows from the error estimates in proposition B.2.
  • (ii)  
    We perform the transformation
    where $\hat x_j$ is the s bit truncation of $x_j = \frac {\pi j}{2M}$ . Note that yj = xj/r∈(0,1) and $\hat y_j$ is the s bit truncation of yj. Recall that r ⩾ 2 and 2M are powers of 2. Calculations are to be performed in fixed precision arithmetic, so division does not actually need to be performed. All one needs to do is multiply j by π with O(s) bits of accuracy, keeping in track the position of the decimal point and then take the most significant s bits of the result.
  • (iii)  
    We compute the real and imaginary parts of the complex number $\hat W_1$ by truncating, if necessary, the respective parts of $\hat W_0 = 1 - \hat y^2 + \mathrm {i} \hat y$ to s bits of accuracy; see (B.7) in proposition B.1. This is expressed by the transformation
    Note that since $|{\hat y_j}\rangle $ is s qubits long, $\hat W_0$ can be computed exactly using double precision and ancilla qubits and the final result can be returned in s qubits.Complex numbers are implemented using two registers, holding the real and imaginary parts. Complex arithmetic is performed by computing the real and imaginary parts of the result.
  • (iv)  
    We compute $\hat W_r$ approximating $\hat W_1^r$ using repeated squaring. Each step of this procedure is accomplished by the transformation
    which describes the steps in (B.7). The registers holding real and imaginary parts of the numbers are s qubits long.
  • (v)  
    $\Im (\hat W_r)$ approximates sin(πj/(2M)) with error 2−(ν−1). Hence $\Im ^2(\hat W_r)$ approximates the sin2(πj/(2M)). We compute the square of $\Im (\hat W_r)$ exactly and multiply it by 4M2 (this involves only shifting). We keep the most significant ν + log2(4M2) bits of the result, which we denote by ℓj. This means that the log2(4M2) bits of the binary string representing ℓj compose the integer part and the last ν bits compose the fractional parts of the approximation to λj. Then
    For details of the error estimate see proposition B.2. When d = 1, n (the number of qubits in register C) and ν are related by n = ν + log2(4M2). Moreover, in the one-dimensional case $\hat {\lambda }_j = \ell _j$ .
  • (vi)  
    Let kj be the binary string representing ℓj. For a fixed t, we implement the transformation
    Equation (30)
    This is accomplished using CNOTs with the circuit shown in figure 9, since t ⩽ n the total number of quantum operations and qubits required to implement the circuit for all the values of t is O(n2).
  • (vii)  
    Finally, we use phase kickback (see e.g. [43]) to obtain e2πiϕj2t from the |kj2t〉 state where ϕj is the phase corresponding to the eigenvalue ℓj that approximates λj; see (18).
Figure 9.

Figure 9. Quantum circuit for implementing the transformation in equation (30).

Standard image

5.2. Multidimensional case

To implement e−iΔhγ, γ = 2π2t/E, E defined in (16) and t = 0,...,n − 1 we use

Equation (31)

Therefore the quantum circuit implementing e−iΔhγ in d dimensions is obtained by the replication and parallel application of the circuit simulating eih−2Lhγ. For example, when d = 2 we have the circuit in figure 6. The register B of figure 2 contains dm qubits, m = log2M and its initial state is assumed to have the form

Equation (32)

where $b_i = \left <i|f_h\right >$ . This way we select the SM−1 block in TMF2MTM in (24) in each circuit for eih−2Lhγ. Recall that |fh〉 corresponds to the right-hand side of (14).

The eigenvalues in the d-dimensional case are given as sums of the one-dimensional eigenvalues. We do not need to form the sums explicitly for the simulation of −Δh; they are computed by the tensor products. The difference between the d-dimensional and one-dimensional cases is that the register C in figure 2 has ⌈log2d⌉ additional qubits; i.e n = ⌈log2d⌉ + log2 4M2 + ν. Accordingly, we generate the one-dimensional approximations to the eigenvalues using steps 1–5 of the eigenvalue estimation algorithm of the previous section. Then we append ⌈log2d⌉ qubits initialized to |0〉⊗⌈log2d to the left of the register holding the |ℓj〉 and carry out the remaining two steps, 6 and 7, with n = ⌈log2d⌉ + log2 4M2 + ν. The error in the approximate eigenvalues is equal to 17M2d/2ν; see theorem B.2.

5.3. Simulation cost

Simulating the sine and cosine transforms (24) requires O(m2), m = log2M quantum operations and O(m) qubits [38]. The diagonal eigenvalue matrix of the one-dimensional case (23) is simulated by ESA. Its steps 1–3 and 5 require O(s2) quantum operations and O(s) qubits. In step 4 repeated squaring is performed ν + 7 times. Each repetition or step of the procedure requires O(s2) quantum operations and O(s) qubits. The total cost of step 4 is proportional to ν·O(s2) quantum operations and ν·O(s) qubits, accounting for any ancilla qubits used in repeated squaring. Step 6 requires O(n + t) quantum operations and qubits for fixed t. Step 7 requires O(n2) quantum operations, due to the Fourier transform, and O(n) qubits.

Using theorem B.2, and requiring error ε in the approximation of the eigenvalues, we have

i.e. ν = Θ(log2d + m + log2ε−1). We also have n = Θ(ν) and s = Θ(n).

We derive the simulation cost taking the following facts into account.

  • Steps 1–5 deal with the approximation of the eigenvalues. These computations are not repeated for every $t=0,\ldots ,n-1$ . The total cost of these steps is O(n3) quantum operations and O(n2) qubits.
  • The total cost of step 6, resulting from all the values of t, is O(n2) quantum operations and qubits.
  • The total cost of step 7, that applies phase kickback for all values of t, does not exceed O(n3) quantum operations and O(n2) qubits.

Therefore the total cost to simulate eih−2Lhγ, γ = 2π2t/E, for all $t=0,\ldots ,n-1$ , is O(n3) quantum operations and O(n2) qubits. From (22) we conclude that the cost to simulate Poisson's matrix for the d-dimensional problem is d·O(n3) quantum operations and d·O(n2) qubits.

Finally, we remark that the dominant component of the cost is the one resulting from the approximation of the eigenvalues (i.e. the cost of steps 1–5).

6. Total cost

We now consider the total cost for solving the Poisson equation (1). Discretizing the second derivative operator on a grid with mesh size h = 1/M results in a system of linear equations, where the coefficient matrix is (M − 1)d × (M − 1)d, i.e. exponential in the dimension d ⩾ 1. Solving this system using classical algorithms has a cost that grows at least as fast as the number of unknowns (M − 1)d. For the case d = 2, [31, table 6.1] summarizes the cost of direct and iterative classical algorithms solving this system.

For simulating Poisson's matrix we need dO(n3) quantum operations and dO(n2) qubits, where n = O(log2d + m + log2ε−1) and m = log2M. To this we add the cost for computing the reciprocal of the eigenvalues which is O((log2ε−10)2 log2 log2ε−10) quantum operations and O((log2ε−10)log2 log2ε−10) qubits, accounting for the O(log2 log2ε−10) Newton steps, $\varepsilon _0 = \min \{\varepsilon , E^{-1}\}$ . Finally, we add the cost of the conditional rotation which is proportional to (log2ε−11)4 quantum operations and (log2ε−11)3 qubits, $\varepsilon _1=\min \{ 1/(4M)^2,\varepsilon \}$ .

From the above we conclude that the quantum circuit implementing the algorithm requires an order of dO(n3) + (log2ε−11)4 quantum operations and dO(n2) + (log2ε−11)3 qubits.

The relation between the matrix size and the accuracy is very important in assessing the performance of the quantum algorithm solving a linear system, since its cost depends on both of these quantities [25]. In particular, for the Poisson equation we have ignored, so far, the effect of the discretization error of the Laplacian Δ. If the grid is too coarse the discretization error will exceed the desired accuracy. If the grid is too fine, the matrix will be unnecessarily large. Thus the mesh size and, therefore, the matrix size should depend on ε, i.e. M = M(ε). This dependence is determined by the smoothness of the solution u, which, in turn, depends on the smoothness of the right-hand side function f. For example, if f has uniformly bounded partial derivatives up to order four, then the discretization error is O(h2) and we set M = ε−1/2; see [30, 31] for details. In general, we have M = εα, where α > 0 is a parameter depending on the smoothness of the solution. This yields n = O(log2d + log2ε−1), since m = log2M = α log2ε−1. The resulting number of the quantum operations for the circuit is proportional to

and the number of qubits is proportional to

It can be shown that log2d = O(log2ε−1) and the number of quantum operations and qubits become proportional to

and

respectively.

Observe that the condition number of the matrix is proportional to ε−2α and is independent of d. Therefore a number of repetitions proportional to ε−4α leads to a success probability arbitrarily close to one, regardless of the value of d. This follows because repeating an algorithm many times increases its probability of succeeding at least according to the Chernoff bounds [36, box 3.4, p 154]. In contrast to this, the cost of any deterministic classical algorithm solving the Poisson equation is exponential in d. Indeed, for error ε the cost is bounded from below by a quantity proportional to εd/r where r is a smoothness parameter [21].

7. Conclusion and future directions

We present a quantum algorithm and a circuit for approximating the solution of the Poisson equation in d dimensions. The algorithm breaks the curse of dimensionality and in terms of d yields an exponential speedup relative to classical algorithms. The quantum circuit is scalable and has been obtained by exploiting the structure of the Hamiltonian for the Poisson equation to diagonalize it efficiently. In addition, we provide quantum circuit modules for computing the reciprocal of eigenvalues and trigonometric approximations. These modules can be used in other problems as well.

The successful development of the quantum Poisson solver opens up entirely new horizons in solving structured systems on quantum computers, such as those involving Toeplitz matrices. Hamiltonian simulation techniques [9, 28, 41] can also be combined with our algorithm to extend its applicability to PDEs, signal processing, time series analysis and other areas.

Acknowledgments

SK and YC would like to thank the NSF CCI Center, 'Quantum Information for Quantum Chemistry (QIQC)', award number CHE-1037992 and Army Research Office (ARO) for partial support. AP, IP and JFT thank the NSF for financial support.

Appendix A

In this paper, X, Y and Z are Pauli matrices σx, σy and σz. I represents the identity matrix. H is the Hadamard gate and W, in figure 2, represents Hn where n is the number of qubits in the register. The matrix representations of other quantum gates used are the following:

Equation (A.1)

Equation (A.2)

Equation (A.3)

Appendix B

Theorem B.1. Consider the approximation $\hat x_s$ to v−1, v > 1, using s steps of Newton iteration, with initial approximation $\hat x_0 = 2^{-p}$ , 2p−1 < v ⩽ 2p. Assume that each step takes b bit numbers as inputs and produces b bit outputs and that all internal calculations are carried out in fixed precision arithmetic. Then the error is

where εN denotes the desired error of Newton iteration without considering the truncation error, εN ⩾ 2−2s . The truncation error is given by the second term and s ⩾ ⌈log2 log2ε−1N⌉, b > p.

Proof. Consider the function g(x) = 1/x − v, x > 0, where g(1/v) = 0. The Newton iteration for approximating the zero of g is given by

The error es = |xs − 1/v| satisfies es+1 = ve2s. Unfolding the recurrence we get

Let x0 = 2p. Now consider the lowest power of 2 that is greater than or equal to v, i.e. 2p−1 < v ⩽ 2p. Clearly p > 1 since v > 1 and ve0 < 1/2. For error εN we have 2−2s  ⩽ εN, which implies s ⩾ ⌈log2 log2ε−1N⌉.

The derivative of the iteration function is decreasing and we have |φ'| ⩽ 2(1 − ax0) ⩽ 1. We will implement the iteration using fixed precision arithmetic. We first calculate the round off error. We have

where the ξi denotes truncation error at the respective steps. Thus

and using the fact |φ'| ⩽ 1 we obtain

assuming that we truncate the intermediate results to b bits of accuracy.   □

Lemma B.1. Let x∈[π/(2M),π/2) and $W = 1+\mathrm {i} \frac {x}{r} - \frac {x^2}{r^2}$ . Then

Proof. ${\mathrm { e}}^{\mathrm {i}x} = ( \mathrm {e}^{\mathrm {i}x/r} )^r = ( W+E(x/r) )^r$ , where for y = x/r, $E(y) = \sum _{k \geqslant {3}} \frac {(\mathrm {i}y)^k}{k!} $ and

Equation (B.1)

where the last inequality holds for $|y|=|\frac {x}{r}|<1$ , which is true due to our assumptions. Hence $\left |E(\frac {x}{r})\right |\leqslant |\frac {x}{r}|^3$ for |x| < r.

We then turn our attention to the powers of W,

Equation (B.2)

For all k∈{1,2,...,r} we have

Equation (B.3)

where we have used the fact that $\frac {k}{r}<1$ . The second inequality is due to (1 + a)k ⩽ eka, $a\in \mathbb {R}$ , $k\in \mathbb {Z}^+$ . Indeed,

Equation (B.4)

Finally we look at the approximation error. Note that

Equation (B.5)

Consider the kth term in the error series. According to (B.1) we have

where C = eπ and we use Stirling's formula $k ! = \sqrt {2\pi } k^{k+1/2} \exp \left ( -k + \frac {\theta }{12 k }\right )$ , θ∈(0,1), [44, p 257] to obtain |x|k/k! ⩽ 5kxk ek ⩽ 1 for k ⩾ 5, since $|x|\leqslant \frac {\pi }{2}$ . So the total approximation error is bounded by

Equation (B.6)

   □

Lemma B.2. Under the assumptions of lemma B.1

and

The proof is trivial and we omit it.

Proposition B.1. Let r = 2ν+7 for ν ⩾ 1 and consider the procedure computing Wr, as defined in lemma B.1 using repeated squaring. Assume each step computing a square carries out the calculation using fixed precision arithmetic and that its inputs and outputs are s bit numbers. Let $\hat W_r$ be the final result. Then the error is

for s ⩾ 11 + ν + log2M, where 1/M is the mesh size in the discretization of the Poisson equation.

Proof. We are interested in estimating sin(jπ/(2M)), for j = 1,2,...,M − 1. We consider x∈[π/(2M),π/2). We approximate eix and from this sin x, which is the imaginary part of eix. Let $y = \frac {x}{r}\leqslant 2^{-7}$ . We truncate it to s bits of accuracy to obtain $\hat y$ . Note that W = 1 − y2 + iy satisfies |W|2 = 1 − y2 + y4 < 1. Let $\hat W_0 = 1 - \hat y^2 + \mathrm {i} \hat y$ , $y - \hat y \leqslant 2^{-s}$ . Then $|\hat W_0|^2 \leqslant |W|^2 + 4 y 2^{-s} < 1$ , for s ⩾ 11 + ν + log2M. This value of s follows by solving

which ensures that $\hat W_0^2 \leqslant 1$ . In addition,

and

Define the sequence of approximations

Equation (B.7)

where r = 2ν+7 and the error terms e1,e2,...,er are complex numbers denoting that the real and imaginary parts of the results are truncated to s bits of accuracy.

Observe that if $|\hat W_{2^{j-1}}| < 1$ then $|\hat W_{2^{j}}| < 1$ , since $|\hat W_{2^{j-1}}|^2 < 1$ and truncation of real and imaginary parts does not increase the magnitude of a complex number. Since $|\hat W_0| < 1$ , all the numbers in the sequence (B.7) belong to the unit disc S in the complex plane.

Let z = a + bi. Then the function that computes z2 can be understood as a vector valued function of two variables, h:S → S, such that h(a,b) = (a2 − b2,2ab). The Jacobian of h is

and its Euclidean norm satisfies ∥J∥ ⩽ 2, since a2 + b2 ⩽ 1. Using this bound we obtain

Equation (B.8)

where the last inequality follows since 2y + 2s ⩽ 2−6 + 2−11.   □

Proposition B.2. Under the assumptions of proposition B.1 we approximate sin x by $\Im (\hat W_r)$ , x∈[π/(2M),π/2), with $s = \max \{2\nu +9, 11 + \nu + \log _2 M\}$ bits and r = 2ν+7. Then the error is

Moreover, we note the following.

  • Denoting by $\hat W_{r,j}$ the approximations to sin(πj/(2M)), j = 1,2,...,M − 1, we have the following error bound:
    j = 1,2,...,M − 1, for the eigenvalues of the matrix h−2Lh that approximates the second derivative operator, using mesh size h = 1/M.
  • Letting ℓj be the truncation of $4 M^2 (\Im (\hat W_{r,j}) )^2$ to ν bits after the decimal point (the length of ℓj is ν + log2(4M2) bits, and ν is sufficiently large to satisfy the accuracy requirements) we have
    for j = 1,2,...,M − 1.

Proof. We have

Equation (B.9)

for $s = \max \{2\nu +9, 11 + \nu + \log _2 M\}$ , which completes the proof of the first part. The proof of the second and third parts follows immediately.   □

Theorem B.2. Consider the eigenvalues

jk = 1,2,...,M − 1, k = 1,2,...,d of −Δh, h = 1/M. Let

where ℓjk are defined in proposition B.2, jk = 1,2,...,M − 1, k = 1,2,...,d. Then

The proof follows from proposition B.2 and the fact that the d-dimensional eigenvalues are sums of the one-dimensional eigenvalues.

Please wait… references are loading.