# Quantum algorithm and circuit design solving the Poisson equation

**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

\varepsilon. We assume we are given a supersposition 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

\varepsilon^{-1}. We present quantum circuit modules together with performance

guarantees which can be also used for other problems.

**0**Bookmarks

**·**

**128**Views

- [Show abstract] [Hide abstract]

**ABSTRACT:**The affine Weyl groups with their corresponding four types of orbit functions are considered. Two independent admissible shifts, which preserve the symmetries of the weight and the dual weight lattices, are classified. Finite subsets of the shifted weight and the shifted dual weight lattices, which serve as a sampling grid and a set of labels of the orbit functions, respectively, are introduced. The complete sets of discretely orthogonal orbit functions over the sampling grids are found and the corresponding discrete Fourier transforms are formulated. The eight standard one-dimensional discrete cosine and sine transforms form special cases of the presented transforms.Journal of Mathematical Physics 11/2014; 55(11). · 1.18 Impact Factor - SourceAvailable from: Yudong Cao[Show abstract] [Hide abstract]

**ABSTRACT:**Quantum computers have the potential of solving certain problems exponentially faster than classical computers. Recently, Harrow, Hassidim and Lloyd proposed a quantum algorithm for solving linear systems of equations: given an $N\times{N}$ matrix $A$ and a vector $\vec b$, find the vector $\vec x$ that satisfies $A\vec x = \vec b$. It has been shown that using the algorithm one could obtain the solution encoded in a quantum state $|x$ using $O(\log{N})$ quantum operations, while classical algorithms require at least O(N) steps. If one is not interested in the solution $\vec{x}$ itself but certain statistical feature of the solution ${x}|M|x$ ($M$ is some quantum mechanical operator), the quantum algorithm will be able to achieve exponential speedup over the best classical algorithm as $N$ grows. Here we report a proof-of-concept experimental demonstration of the quantum algorithm using a 4-qubit nuclear magnetic resonance (NMR) quantum information processor. For all the three sets of experiments with different choices of $\vec b$, we obtain the solutions with over 96% fidelity. This experiment is a first implementation of the algorithm. Because solving linear systems is a common problem in nearly all fields of science and engineering, we will also discuss the implication of our results on the potential of using quantum computers for solving practical linear systems.Physical Review A 02/2013; · 2.99 Impact Factor - SourceAvailable from: Martin Roetteler[Show abstract] [Hide abstract]

**ABSTRACT:**We develop a method for approximate synthesis of single--qubit rotations of the form $e^{-i f(\phi_1,\ldots,\phi_k)X}$ that is based on the Repeat-Until-Success (RUS) framework for quantum circuit synthesis. We demonstrate how smooth computable functions $f$ can be synthesized from two basic primitives. This synthesis approach constitutes a manifestly quantum form of arithmetic that differs greatly from the approaches commonly used in quantum algorithms. The key advantage of our approach is that it requires far fewer qubits than existing approaches: as a case in point, we show that using as few as $3$ ancilla qubits, one can obtain RUS circuits for approximate multiplication and reciprocals. We also analyze the costs of performing multiplication and inversion on a quantum computer using conventional approaches and find that they can require too many qubits to execute on a small quantum computer, unlike our approach.06/2014;

Page 1

This content has been downloaded from IOPscience. Please scroll down to see the full text.

Download details:

IP Address: 189.84.209.251

This content was downloaded on 10/10/2013 at 18:06

Please note that terms and conditions apply.

Quantum algorithm and circuit design solving the Poisson equation

View the table of contents for this issue, or go to the journal homepage for more

2013 New J. Phys. 15 013021

(http://iopscience.iop.org/1367-2630/15/1/013021)

HomeSearchCollectionsJournals AboutContact usMy IOPscience

Page 2

Quantum algorithm and circuit design solving the

Poisson equation

Yudong Cao1, Anargyros Papageorgiou2, Iasonas Petras2,

Joseph Traub2and Sabre Kais3,4

1Department of Mechanical Engineering, Purdue University, West Lafayette,

IN 47907, USA

2Department of Computer Science, Columbia University, New York,

NY 10027, USA

3Department of Chemistry, Physics, and Computer Science, Birck

Nanotechnology Center, Purdue University, West Lafayette, IN 47907, USA

E-mail: kais@purdue.edu

New Journal of Physics 15 (2013) 013021 (29pp)

Received 10 July 2012

Published 11 January 2013

Online at http://www.njp.org/

doi:10.1088/1367-2630/15/1/013021

Abstract.

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.

The Poisson equation occurs in many areas of science and

4Author to whom any correspondence should be addressed.

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.

New Journal of Physics 15 (2013) 013021

1367-2630/13/013021+29$33.00© IOP Publishing Ltd and Deutsche Physikalische Gesellschaft

Page 3

2

Contents

1. Introduction

2. Overview

3. Discretization

3.1. One dimension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.2. Two dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.3. d dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4. Quantum circuit

4.1. Error analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.2. Computation of λ−1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.3. Controlled rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5. Hamiltonian simulation of the Poisson matrix

5.1. One-dimensional case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5.2. Multidimensional case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5.3. Simulation cost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6. Total cost

7. Conclusion and future directions

Acknowledgments

Appendix A

Appendix B

References

2

3

5

5

5

7

8

9

11

13

15

15

19

20

21

22

23

23

23

28

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 [1–12].

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 [17–19] 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

New Journal of Physics 15 (2013) 013021 (http://www.njp.org/)

Page 4

3

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

arbitraryquantumstatesisaveryhardproblem.Nevertheless,incertaincasesonecanefficiently

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

forcontrolledrotations.Asweindicated,ourresultsarenotlimitedtothesolutionofthePoisson

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.

−?u(x) = f (x),

u(x) = 0,

x ∈ Id:= (0,1)d,

x ∈ ∂Id,

(1)

where f : Id→ R is a sufficiently smooth function; e.g. see [21, 29, 30] for details.

New Journal of Physics 15 (2013) 013021 (http://www.njp.org/)

Page 5

4

For simplicity we study this equation over the unit cube but a similar analysis applies to

more general domains in Rd. 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

−?h? v =?fh,

where fhis the vector obtained by sampling the function f on the interior grid points [30–32].

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 ?his 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

ε−αd√κ logε−1,

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 ε−αdin 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,log2ε−1}(log2d +log2ε−1)2and a number of quantum operations proportional to

max{d,log2ε−1}(log2d +log2ε−1)3. It can be shown that log2d = O(log2ε−1) and the above

expressionsaresimplifiedtomax{d,log2ε−1}(log2ε−1)2qubitsandmax{d,log2ε−1}(log2ε−1)3

quantumoperations.Ameasurementoutcomeatthefinalstatedetermineswhetherthealgorithm

hassucceededornot.Anumberofrepetitionsproportionaltothesquareoftheconditionnumber

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

oftheone-dimensionalmatrixusingKroneckerproducts.This,aswewillsee,isimportantinthe

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

(2)

New Journal of Physics 15 (2013) 013021 (http://www.njp.org/)

Page 6

5

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 Lhthat we will use later in

expressing the d-dimensional discretization of the Laplacian, using Kronecker products. We

have

−d2u(x)

dx2

= f (x),

x ∈ (0,1),

(3)

u(0) = u(1) = 0,

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,..., M. Let ui= u(xi) and fi= f (xi), i = 0,..., M.

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

−d2u(x)

dx2

????

x=xi

=2ui−ui−1−ui+1

h2

−ξi,

(4)

where ξi is the truncation error and can be shown to be O(h2?d4u

derivative uniformly bounded by a constant [31].

Ignoring the truncation error, we solve

h−2(−vi−1+2vi−vi+1) = fi,

With boundary conditions v0= 0 and vM= 0, we have M −1 equations and M −1

unknowns v1,...,vM−1:

vM−1

where Lhis the tridiagonal (M −1)×(M −1) matrix above; for the properties of this matrix,

including its eigenvalues and eigenvectors see [31, section 6.3].

dx4?∞) if f has the fourth

0 < i < M.

(5)

h−2Lh

v1

...

...

:= h−2

2

−1

...

...

0

−1

...

...

−1

−1

20

v1

...

...

vM−1

=

f1

...

...

fM−1

,

(6)

3.2. Two dimensions

In two dimensions the Poisson equation is

−∂2u(x, y)

∂x2

−∂2u(x, y)

∂y2

= f (x, y),(x, y) ∈ (0,1)2,

u(x,0) = u(0, y) = u(x,1) = u(1, y) = 0,

x, y ∈ [0,1].

(7)

New Journal of Physics 15 (2013) 013021 (http://www.njp.org/)

Page 7

6

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

nodes.

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

∂2u

∂x2(x, y) ≈u(x −h, y)−2u(x, y)+u(x +h, y)

h2

,

∂2u

∂y2(x, y) ≈u(x, y −h)−2u(x, y)+u(x, y +h)

h2

.

Omitting the truncation error, and denoting the discretized Laplacian by −?hwe are led

to solve

h−2?(−vj−1,k+2vj,k−vj+1,k)+(−vj,k−1+2vj,k−vj,k+1)?= fj,k,

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

(8)

h−2(4vi−vi−1−vi+1−vi−M+1−vi+M−1) = fi,

Equivalently, we denote this system by

i = 1,2,...,(M −1)2.

(9)

−?h? v =?fh,

where ?his the discretized Laplacian.

For example, when M = 4, as in figure 1, we have that ? v = [v1,...,v9]T. Furthermore (9)

becomes

h−2A

v1

...

v9

:= h−2

B

−I

B

−I

−I

−I

B

v1

...

v9

=

f1

...

f9

,

(10)

New Journal of Physics 15 (2013) 013021 (http://www.njp.org/)

Page 8

7

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

4

−1

4

−1

−1

−1

4

.

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

−?h= h−2A

and A can be expressed in terms of Lhas follows:

00

(11)

A =

Lh+2I

−I

0

...

...

−I

0

···

0

...

...

···

···

0

0

0

...

Lh+2I

−I

0

...

−I

...

...

−I

0

0

−I

0

Lh+2I

−I

−I

···

Lh+2I

(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:

A = Lh⊗ I + I ⊗ Lh.

(13)

3.3. d dimensions

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

? =

d

?

k=1

∂2

∂x2

k

.

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

As before, this leads to a system of linear equations

−?h? v =?fh.

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

A = Lh⊗ I ⊗···⊗ I

?

the (M −1)×(M −1) identity matrix. See [31] for details.

Observe that the matrix exponential has the form

eiAγ= eiLhγ⊗···⊗eiLhγ

?

the linear system.

(14)

???

d matrices

+I ⊗ Lh⊗ I ⊗···⊗ I +···+ I ⊗···⊗ I ⊗ Lh,

and has size (M −1)d×(M −1)d. Lhis the (M −1)×(M −1) matrix shown in (6) and I is

???

d matrices

,

(15)

for all γ ∈ R, where i =√−1. We will use this fact later to derive the quantum circuit solving

New Journal of Physics 15 (2013) 013021 (http://www.njp.org/)

Page 9

8

Anc.

|0?

|0?

Ry

˜hj|1? +

|0?

1 −˜h2

j|0?

Reg.L

/

INV

|ˆhj?

•

U†

b=3?logε−1? qubits

Reg.C

|0?

/ W

•

FT†

|kj?

/

|0?

n=O(log(E/ε)) qubits

Reg.B

fh

/

HAM-SIM

jβjuj

b

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πi?h/E. ‘INV’ is the

subroutine that computes λ−1. U†represent uncomputation, which is the adjoint

of all the operations before the controlled Ryrotation.

4. Quantum circuit

We derive a quantum circuit solving the system −?h? v =?fh, 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) Asin[25]assumetheright-handsidevector?fhhasbeenpreparedquantummechanicallyas

a quantum state | fh? and stored in the quantum register B. Note | fh? =?(M−1)d−1

(ii) Perform phase estimation using the state | fh? in the bottom register and the unitary matrix

e−2πi?h/E, where log2E = ?logd?+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?1−(Cd/λj)2|0?+

(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?(M−1)d−1

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.

j=0

βj|uj?,

where |uj? denote the eigenstates of −?hand βjare the coefficients.

(Cd/λj)|1?, where Cdis a constant.

j=0

βjλj−1|uj? up to a normalization factor, where |uj? denote

the eigenstates of −?h. This is equal to the normalized solution of the system. If the

New Journal of Physics 15 (2013) 013021 (http://www.njp.org/)

Page 10

9

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

4M2sin2(jπ/(2M)),

j = 1,..., M −1.

For d > 1, the eigenvalues of −?hare given by sums of the one-dimensional eigenvalues, i.e.

d

?

We consider them in non-decreasing order and denote them by λj, j = 1,...,(M −1)d.

Then λ1= 4dM2sin2(π/(2M)) is the minimum eigenvalue and λ(M−1)d = 4dM2sin2(π(M −

1)/(2M)) ? 4dM2is the maximum eigenvalue.

Define E by

log2E = ?log2d?+log2(4M2).

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?log2d?4M2∈ N.

Note that the implementation accuracy of the eigenvalues determines the accuracy of the

system solution.

Our algorithm uses approximationsˆλj, such that |λj−ˆλj| ?17E

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ˆ?hof matrix ?hsuch that the two matrices have the same eigenvectors while

their eigenvalues differ by at most ε.

We use phase estimation with the unitary matrix e−iˆ?ht0/Ewhose eigenvalues are

e2πiˆλjt0/(E2π). Setting t0= 2π we obtain the phases φj=ˆλj/E ∈ [0,1). The initial state of phase

estimation is (figure 2)

k=1

?4M2sin2(jkπ/(2M))?,

jk= 1,..., M −1,

k = 1,...,d.

(16)

2ν ? ε; see theorem B.2

|0?⊗n| fh? =

(M−1)d

?

j=1

βj|0?⊗n|uj?,

where |uj? is the jth eigenvector of −?hand βj=?uj| fh

φj=

Then φj2nis an integer and phase estimation succeeds with probability 1 (see [36,

section 5.2, p 221] for details).

ThestatepriortotheapplicationoftheinverseFouriertransforminthephaseestimationis

?, for j = 1,2,...,(M −1)d. Since

we are using finite bit approximations of the eigenvalues, we have

ˆλj

E=

ˆλj2ν

2n.

(M−1)d

?

j=1

βj

1

2n/2

2n−1

?

k=0

e2πiφjk|k?|uj?.

(17)

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

(M−1)d

?

j=1

βj|kj?|uj?,

New Journal of Physics 15 (2013) 013021 (http://www.njp.org/)

Page 11

10

where

kj= 2nφj= 2nˆλj/E =ˆλj2ν∈ N.

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

λ1/d = 4M2sin2(π/(2M)) = 4M2(π/(2M)+ O(M−3))2

= π2+ O(M−2) > 5,

where the last inequality holds trivially for sufficiently large M. This impliesˆλj/Cd?ˆλ1/

Cd? 4, where Cd= 2?log2d?, for sufficiently large M. We obtain kj= 2nˆλj/E ?ˆλ1? 4Cd.

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

(M−1)d

?

Note that from (18) kj,ˆλjandˆλj/Cdhave the same bit representation. The difference between

the integer kjand the other two numbers is the location of the decimal point; it is located after

the most significant log2E bit inˆλj, and after the most significant log2(E/Cd) bit inˆλj/Cd.

Therefore, we can use the labels |kj?, |ˆλj? and |ˆλj/Cd? interchangeably, and write the state

above as

(M−1)d

?

Now we need to compute hj:= h(ˆλj/Cd) = Cd/ˆλj. We do this using Newton iteration. We

explain the details in section 4.2. We obtain an approximationˆhjsuch that

???ˆhj−hj

b = 3?log2ε−1

This leads to the state

(M−1)d

?

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

(M−1)d

?

We need to perform the conditional rotation

?

For this, we will approximate the first qubit by

?

with |ω−ω?| ? ε2

approximation in section 4.3.

(18)

j=1

βj|0?⊗b|kj?|uj?.

j=1

βj|0?⊗b|ˆλj/Cd?|uj?.

??? ? ε2

0,

(19)

where ε0= min{ε, E−1}. We store this approximation in the register composed of the leftmost

0? qubits.

j=1

βj|ˆhj?|ˆλj/Cd?|uj?.

j=1

βj|0?|ˆhj?|ˆλj/Cd?|uj?.

R|0?|ω? =

ω|1?+

?

1−ω2|0?

?

|ω?,

0 < ω < 1.

ω?|1?+1−(ω?)2|0?,

1, ε1= min{ε,1/(4M2)}. We discuss the cost of implementing this

New Journal of Physics 15 (2013) 013021 (http://www.njp.org/)

Page 12

11

The result of approximating the conditional rotation is to obtain |˜hj?, where˜hj is a

q = ?(log2ε−1

|˜hj−hj| ? ε2

for each j = 1,...,(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

−?h? v =?fhhas solution?(M−1)d

C−1

d

j=1

??????

= C−1

j=1

??????

fact that

????

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.

1) bit number less than 1 satisfying |˜hj−ˆhj| ? ε2

0+ε2

1and, therefore,

1,

(20)

(M−1)d

?

j=1

βj

˜hj|1?+

?

1−˜h2

j|0?

?

|ˆhj?|ˆλj/Cd?|uj?.

|ψ? :=

(M−1)d

?

j=1

βj

˜hj|1?+

?

1−˜h2

j|0?

?

|0?⊗b|0?⊗n|uj?.

j=1

βj

1

λj|uj?. We derive the error as follows:

??????

d

(M−1)d

?

bjCd

λj

|1?|0?⊗(b+n)|uj?− P1|ψ?

??????

= C−1

(M−1)d

?

(M−1)d

?

j=1

βjCd

λj

|uj?−

(M−1)d

?

(M−1)d

?

??????

j=1

βj˜hj|uj?

??????

d

??????

βjCd

λj

|uj?−

j=1

βj(˜hj−hj+hj)|uj?

??????

?

(M−1)d

?

j=1

βj

?

1

λj

−1

ˆλj

?

|uj?

+ε2

0+ε2

1?17E

2ν+ε2

0+ε2

1,

(21)

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

1

λ−1

ˆλ

????? |λ−ˆλ|, λ,ˆλ > 1.

Setting ν = ?log2(17E/ε)? gives error ε(1+o(1)) and the number of matrix exponentials used

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 ˆ xs. The input and the output of each

iterative step are b bit numbers. All of the calculations in each step are performed in fixed

New Journal of Physics 15 (2013) 013021 (http://www.njp.org/)

Page 13

12

|ub−1= 0?

•

...

b

|ub?+1= 0?

•

...

|x0?

|ub? = 0?

...

b?=b−2−log2

E

Cd

...

|u0= 0?

...

|0?

···

X

|0?

|vn−1?

•

...

|vn−2?

•

...

|v?

n

...

|vn??

...

•

n?=n+2−log2

E

Cd

...

v0

...

Figure 3. The quantum circuit computing the initial approximation ˆ x0= 2−p

of Newton iteration for approximating v−1, 2p−1? v ? 2p. See appendix A for

definitions of the basic gates.

precision arithmetic. The initial approximation is ˆ x0= 2−p, 2p−1< v ? 2p. (We use the notation

ˆ xito emphasize that these values have been obtained by truncating a quantity xito b bits of

accuracy, i = 0,...,s.)

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

|ˆ xs−v−1| ? ε2

where we have ε0= min{ε, E−1}, s = ?log2log2(2/ε2

2?log2ε−1

Therefore, it suffices that the module of the quantum circuit that computes 1/λjcarries

each iterative step with 3?log2ε−1

The quantum circuit computing the initial approximation ˆ x0, 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ˆλj/Cd? 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? ε,

0)? and the number of bits satisfies b ?

0?+ O(log2log2log2ε−1

0).

0? qubits of accuracy.

New Journal of Physics 15 (2013) 013021 (http://www.njp.org/)

Page 14

13

|ˆ xi?

−vx2

i+ 2xi

|ˆ xi+1?

vv

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

|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 ˆ x0through the transformation |0?⊗b|v? → |ˆ x0?|v?.

Each iteration step xi+1= −vx2

shown in figure 4 that computes |ˆ xi?|v? → |ˆ xi+1?|v?. This involves quantum circuits for addition

and multiplication which have been studied in the literature [37].

The register holding |v? is n qubits long and the register holding the |ˆ xi? and |ˆ xi+1? 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ε−1

and the total number of gates is a low degree polynomial in logε−1

i+2xiis implemented using a quantum circuit of the form

0)

0.

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 Ryabout the y-axis to

implement R. We consider the binary representation of θ and have

R|0?|ω? =

ω|1?+

?

1−ω2|0?

?

|ω?,

0 < ω < 1.

θ = θ1...θq=

q

?

j=1

θj2−j,θj∈ {0,1}.

Then

Ry(2θ) = e−iθY=

??

1−sin2θ

sinθ

−sinθ

1−sin2θ

?21−j?,

?

?

=

q?

j=1

e−iYθj/2j=

q?

j=1

Rθj

y

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

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(θ)−ω| ? ε2

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

1, ε1= min{1/(4M2),ε}, using bisection and an approximation of the sine

New Journal of Physics 15 (2013) 013021 (http://www.njp.org/)

Page 15

14

|0?

Ry(1)Ry(1/2)

...

Ry(1/2q−1)

|θ1?

...

|θ2?

...

...

θb

...

Figure 5. Circuit for executing the controlled Ryrotation. See appendix A for

definitions of basic gates.

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 ε2

in section 5 and appendix B). Let sθdenote this approximation.

(iii) If sθ< ω−ε2

(iv) If sθ> ω+ε2

(v) Repeat the steps 2–4 ?log2ε−2

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θ−ω| ? ε2

and 4 are false then θ will not change its value until the end. Then, at the end, we have

|sin(θ)−ω| ? |sin(θ)−sθ|+|sθ−ω| ? ε2

other hand, if θ is updated until the very end of the algorithm the final value of theta also satisfies

|sin(θ)−w| ? ε2

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ν +9,13+ν +2log2M} 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

1/2 using our algorithm for the sine function (details

1/2, set θ to be the midpoint of the right subinterval.

1/2, set θ to be the midpoint of the left subinterval.

1?+1 times.

1/2. If at any time both the conditions of steps 3

1, since the error in computing the sine is ε2

1/2. On the

1, because in the final interval we have |sin(θ)−ω| ? |θ −sin−1(ω)| ? ε2

1.

ν = ?log2ε−2

1?+1.

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)

New Journal of Physics 15 (2013) 013021 (http://www.njp.org/)