0% found this document useful (0 votes)
23 views9 pages

Quantum Algorithm For Nonhomogeneous Linear Partial Differential Equations

Uploaded by

Jonas Araújo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views9 pages

Quantum Algorithm For Nonhomogeneous Linear Partial Differential Equations

Uploaded by

Jonas Araújo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

PHYSICAL REVIEW A 100, 032306 (2019)

Quantum algorithm for nonhomogeneous linear partial differential equations

Juan Miguel Arrazola,1,* Timjan Kalajdzievski,1 Christian Weedbrook,1 and Seth Lloyd2
1
Xanadu, 372 Richmond Street W, Toronto, Ontario, Canada M5V 1X6
2
Massachusetts Institute of Technology, Department of Mechanical Engineering, 77 Massachusetts Avenue,
Cambridge, Massachusetts 02139, USA

(Received 21 September 2018; revised manuscript received 22 February 2019; published 4 September 2019)

We describe a quantum algorithm for preparing states that encode solutions of nonhomogeneous linear partial
differential equations. The algorithm is a continuous-variable version of matrix inversion: it efficiently inverts
differential operators that are polynomials in the variables and their partial derivatives. The output is a quantum
state whose wave function is proportional to a specific solution of the nonhomogeneous differential equation,
which can be measured to reveal features of the solution. The algorithm consists of three stages: preparing fixed
resource states in ancillary systems, performing Hamiltonian simulation, and measuring the ancilla systems.
The algorithm can be carried out using standard methods for gate decompositions, but we improve this in two
ways. First, we show that for a wide class of differential operators, it is possible to derive exact decompositions
for the gates employed in Hamiltonian simulation. This avoids the need for costly commutator approximations,
reducing gate counts by orders of magnitude. Additionally, we employ methods from machine learning to find
explicit circuits that prepare the required resource states. We conclude by studying two example applications of
the algorithm: solving Poisson’s equation in electrostatics and performing one-dimensional integration.

DOI: 10.1103/PhysRevA.100.032306

I. INTRODUCTION In this work, we present a quantum algorithm for finding


solutions to nonhomogeneous linear partial differential equa-
Following the discovery of quantum algorithms for factor- tions. More specifically, we show how to solve equations of
ing, database search, and universal simulation of quantum sys- the form Aψ (x) = f (x), where A is a polynomial in the vari-
tems [1–3], decades of work have led to the uncovering of nu- ables and their partial derivatives. We describe the algorithm
merous quantum algorithms capable of outperforming exist- in the continuous-variable (CV) model of quantum computing
ing classical methods. Examples include quantum algorithms [27,28], but the algorithm can be implemented in any model
for algebraic problems such as Pell’s equation and the Jones for universal quantum computing. Similar to quantum algo-
polynomial [4–7], semidefinite programing [8,9], machine rithms for linear systems of equations, the algorithm takes
learning [10–12], and ordinary differential equations [13–21]. as input a state | f  encoding the nonhomogeneous function
Quantum computers also excel at solving linear systems of and outputs a state |ψ whose wave function is proportional
equations [22–26]. Here, given an N × N sparse matrix A to a specific solution of the partial differential equation. In
and a vector b = (b1 , . . . , bN ), the goal is to find a vector this sense, the algorithm is a continuous-variable version of
x = (x1 , . . . , xN ) satisfying the equation Ax = b. Quantum the quantum algorithm for linear systems of equations. For
algorithms
 for this problem take as input the quantum state differential equations of fixed order, the runtime is polynomial
|b = Ni=1 bi |i and efficiently perform matrix inversion to in the dimension—an exponential improvement over the best
prepare the state |x = A−1 |b encoding the solution of the known classical techniques for solving partial differential
linear system of equations. equations.
We study a continuous version of this problem where The algorithm consists of three stages: preparing fixed
the inputs are a function f (x) over RN and a differen- resource states in ancillary systems, performing Hamiltonian
tial operator A. In its most general form, A is expressed simulation, and measuring the ancilla systems. Although the
as a function of the variables and their partial derivatives: algorithm can be carried out using standard methods for gate
A = A(x1 , . . . , xN , ∂x∂ 1 , . . . , ∂x∂N ). The task is to find a func- decompositions, we improve on this in two ways. First, for
tion ψ (x) satisfying the linear partial differential equation several cases of interest, we introduce exact decomposition
Aψ (x) = f (x), which is said to be nonhomogeneous when- formulas that circumvent the use of commutator approxima-
ever f (x) = 0. In direct analogy to the case of a linear system tions for Hamiltonian simulation, leading to shorter circuits
of equations, a specific solution to the nonhomogeneous prob- by orders of magnitude. Additionally, based on recent results
on state preparation using quantum neural networks [29–31],
lem can be found by obtaining the inverse operator A−1 and
we show how short-depth quantum circuits can be directly op-
computing the function ψ (x) = A−1 f (x).
timized to prepare required resource states with high fidelity.
Finally, we validate the performance of the algorithm through
numerical simulations by studying two example applications:
solving Poisson’s equation in electrostatics and performing
*
[email protected] one-dimensional integration.

2469-9926/2019/100(3)/032306(9) 032306-1 ©2019 American Physical Society


JUAN MIGUEL ARRAZOLA et al. PHYSICAL REVIEW A 100, 032306 (2019)

II. QUANTUM ALGORITHM


|s p 0
The algorithm takes as inputs (i) a classical description
of a linear differential operator A and (ii) a quantum state |1 e−iÂX̂ Ŷ p 0
| f  of N registers with wave function x| f  = f (x), where |f  Â−1 |f 
|x = |x1  . . . |xN . For definiteness, we consider the registers
to be modes of the quantized electromagnetic field with as-
sociated position X̂ and momentum P̂ quadrature operators. FIG. 1. Schematic representation of the quantum algorithm. The
This choice is for convenience: the algorithm can in principle state | f  is given as input. Two resource states are prepared: a single
be carried out in any physical model of quantum computing. photon |1 and a step function state |s. A global unitary e−iÂX̂ Ŷ is
The quadrature operators X̂k and P̂k acting on mode k applied to all three systems, which is equivalent to evolution under
can be defined in terms the Hamiltonian ÂX̂ Ŷ for unit time. This is followed by a homodyne
 of their action on an  arbitrary state: momentum measurement on the resource modes. Postselecting on
X̂k dx N ψ (x)|x = dx N xk ψ (x)|x and P̂k dx N ψ (x)|x =
the outcome p = 0 on both modes yields the desired output state
− 2i dx N ∂x∂ k ψ (x)|x for all k = 1, . . . , N, where we have
Â−1 | f .
set h̄ = 1/2. Note that the action of the momentum operator
is equivalent to differentiation with respect to position. A
linear differential operator A can thus be equivalently cast as the output state
an operator  on the Hilbert space of an N-mode quantum  ∞
i
dx dy (x) y e−y /2 −iÂxy
2
system. The operator  is then a polynomial of the position | = √ e | f |x|y. (4)
and momentum operators. We focus on Hermitian operators, 2π −∞

in which case  can be viewed as a Hamiltonian for the Performing a momentum homodyne measurement on both
N-mode system. resource modes and postselecting on observing the outcome
We follow the Fourier decomposition technique of p = 0 on both modes, i.e., projecting onto the state |0 px |0 py ,
Ref. [25], but note that the methods proposed in Ref. [32] for yields
solving linear systems of equations using continuous-variable       
1 ⊗0 px 0 py  ⊗ 0 px 0 py  |
quantum computers could also potentially be adapted to solv-

 ∞
ing partialdifferential equations. Let g(x) be an  ∞odd function i   

satisfying 0 g(x)dx = 1. It holds that a−1 = 0 g(ax)dx for = √ dx dy (x) y e −y2 /2 −iÂxy
e | f  0 px 0 py
2π −∞
a = 0. Choosing g(x) = x e−x /2 and
2
 −1   
 ∞ writing−yg(x)
2
in terms of
/2 ixy = Â | f  0 p 0 p , (5)
its Fourier transform g(x) = √2π i
−∞ dy y e e we have x y

where we have used the relation 0 px |x = 0 py |y = 1. The


 ∞  ∞
i output is thus the desired state |ψ = Â−1 | f  with wave
a−1 = √ dy y e−y /2 −iaxy
2
dx (x) e , (1) function ψ (x) = A−1 f (x) up to normalization. The algorithm
2π −∞ −∞
is depicted in Fig. 1. An ideal step function state is unphysical
where (x) is the Heaviside step function. Let {|a} be the since its wave function is not square integrable. Instead, we
eigenbasis of  with corresponding eigenvalues a ∈ R. Since consider a step function state of finite width L given by
Â−1 and e−iÂxy are both diagonal in the basis {|a}, Eq. (1)  L
1
implies that Â−1 can be expressed as |sL  = √ dx|x. (6)
L 0
 ∞
i
Â−1 = √ dx dy (x) y e−y /2 e−iÂxy . The result of employing this state in the algorithm is an output
2
(2)
2π −∞ state
 L  ∞
i
To implement the action of Â−1 on a target state | f , consider dy y e−y /2 e−iÂxy | f .
2
|ψ = √ dx (7)
the unnormalized two-mode resource state 2π 0 −∞
 ∞  ∞ In this case, instead of the ideal inverse operator Â−1 , the
i
√ dy y e−y /2 |y.
2
|s|1 := dx (x)|x (3) operator being applied to | f  is a truncated Fourier decom-
−∞ −∞ 2π position of Â−1 . Here and henceforth we use Â−1 approx to denote
We refer to the state |s as a step function state. In its any approximation to the ideal inverse operator. The effect of
current form, |s is unnormalizable, but as we discuss shortly, a finite width is best understood by considering the action of
this can be remedied by employing a step function of finite Â−1
approx on an eigenstate |a:
length. Additionally, we recognize y e−y /2 as the unnormal-
2
 L  ∞
i
Â−1 dy y e−y /2 e−iÂxy |a
2
ized wave function of a single photon and consequently |1 as approx |a = √ dx
a single-photon state up to a global phase and normalization. 2π 0 −∞

Given an input state | f , the algorithm starts by preparing 1 e−a L
2 2

the resource states of Eq. (3). A global unitary e−iÂX̂ Ŷ is = − |a. (8)
a a
subsequently applied to all systems, where X̂ and Ŷ are
respectively the position operators of the two resource modes. The effect of a truncated step function is an exponentially
This transformation is equivalent to performing evolution small correction from the ideal result a−1 |a. The correction is
under a Hamiltonian Ĥ = ÂX̂ Ŷ for unit time. The result is only significant for small eigenvalues such that a  1/L, i.e.,

032306-2
QUANTUM ALGORITHM FOR NONHOMOGENEOUS LINEAR … PHYSICAL REVIEW A 100, 032306 (2019)

the value of L determines the smallest eigenvalue a for which Up to normalization, this state is equal to the desired state
the approximation is adequate. This result can then be used to a−1 |a except for a correction O(3 /a3 ) that is only relevant
analyze the effect of the approximation on an arbitrary state when a  .
| f  whenever
 it is possible to express it in the eigenbasis of Â: Comparing to Eq. (8), the dominant error for small values
| f  = da φ(a)|a. of a arises from the finite width of the step function state,
Even a step function of finite width is an idealization since whose effect is exponential in a for a  1/L.
it is not continuous at either x = 0 or x = L: any physical By expressing the state | f  in terms of the eigenbasis {|a}
wave function will exhibit a smooth transition around these of Â, we note that the action of Â−1 approx on | f  introduces an

points. The effect of this finite rise time can be modeled by overall constant factor 2 π  and therefore the probability of
approximating the ideal step function in terms of a continuous successfully projecting onto the desired output state satisfies
function. Here we consider the error function 21 (1 + erf[kx]) Pr(success) = Â−1 approx | f  = O( ). In the Appendixes, we
2 2
as an approximate step function, where the approximation discuss how coarse-graining measurement outputs can also be
improves with larger k > 0. We then have used to increase the probability of success at the cost of an
 ∞  ∞ increase in the approximation error.
i
Â−1 dy y e−y /2 e−iÂxy |a
2
approx |a = √ dx(1+erf[kx]) Combining the effects of a finite-width step function and a
8π 0 −∞ finite-precision measurement leads to an approximation
⎛ √ ⎞

4   L  ∞
1 2 ⎠ 1 a2 a i
= ⎝ |a = 1 − 2 + O 4 |a. Â−1
approx |a = √ dx dy y e−y /2 e−iÂxy g(x, y, )|a
2

a a2
2+ k 2 a 2k k 2π 0 −∞

2a π (1 − eL (a + + )/2(1+ ) )
2 2 2 4 2
(9)
= √ |a
This induces another correction from the ideal scenario, but in 1 + 2 (a2 + 2 + 4 )

this case the effect is significant only for large eigenvalues a = 2 π F (a)|a, (13)
such that a  k. Thus approximations to an ideal step function
state lead to deviations that are relevant only for very small or where
very large eigenvalues.
a(1 − e−L (a + + )/2(1+ ) )
2 2 2 4 2

Finally, physical homodyne measurements have finite pre- F (a) := √ |a, (14)
cision, whose effect on the resulting output state must be 1 + 2 (a2 + 2 + 4 )
taken into account. We model the finite-precision homodyne
measurement as a projection onto finitely squeezed states, which is an approximation to a−1 .
as opposed to momentum eigenstates which are infinitely The imprecision of the algorithm arises due to the differ-
squeezed. This is the same strategy employed, for example, ence between the ideal inverse operator Â−1 and the resulting
in classical simulators [33]. The state corresponding to the approximation Â−1 . We can express  in its eigenbasis
 m(a)approx
p = 0 outcome of measurement with precision  as  = a k=1 a|a, ka, k|, where Â|a, k = a|a, k and
 a homodyne
is | = π 1/41√ d p e−p /2 |p. The resulting output state is
2 2
m(a) is the multiplicity of eigenvalue a. We then have
given by 
m(a)
1
Â−1 = |a, ka, k|, (15)
(1 ⊗|| ⊗ ||)| a
 ∞  ∞ ak=1

=√
i
dx dy y e−y /2 e−iÂxy g(x, y, )| f ||
2 
m(a)

2π 0 −∞
Â−1
approx = F (a)|a, ka, k|. (16)
  a k=1
−1
= Âapprox | f  ||, (10)
The relationship between F (a) and a−1 is illustrated in Fig. 2
where for L = 7 and  = 0.1.
 ∞ Finally, the error in the approximation can be quantified in
1
d p dq e−p /2 −ipx −q2 /22 −iqy
2 2
g(x, y, ) = √ e terms of the distance between the resulting output states. More
π −∞ precisely, let
= e−(x +y2 )2 /2
2
. (11) 
m(a)
1
|ψ = Â−1 | f  = ca,k |a, k, (17)
As before, the approximation of the inverse operator is best a
a
k=1
expressed in terms of its action on the eigenstate |a:
 ∞  ∞ 
m(a)

i |ψ̃ = Â−1
approx | f  = F (a)ca,k |a, k (18)
Â−1 dy y e−y /2 e−iÂxy g(x, y, )|a
2
approx |a = √ dx a k=1
2π 0 −∞
√ be unnormalized output states. Defining the error as ε :=
2a π 
=√ |a |ψ − |ψ̃ 1 we obtain
1 +  (a2 + 2 + 4 )
2
 √
3    
2 π 
m(a)
1 
= +O 3 |a. (12) ε= |ca,k | − F (a). (19)
a a a
a
k=1

032306-3
JUAN MIGUEL ARRAZOLA et al. PHYSICAL REVIEW A 100, 032306 (2019)

the Hamiltonian  can be expressed as


N
 = λ 1 + a j X̂ j + b j P̂j + α j X̂ j2 + β j P̂j2 , (22)
j=1

where λ, a j , b j , α j , and β j are real constants. This form en-


compasses a large class of differential operators, including for
instance those defining Poisson’s equation, the heat equation,
and the wave equation.
In the quantum algorithm, we perform evolution under the
Hamiltonian ÂX̂ Ŷ for unit time. When  is of the form of
Eq. (22), after performing a Trotter-Suzuki decomposition,
each term in the product will correspond—up to Fourier trans-
forms exchanging X̂ and P̂—to unitaries of the form eit X̂ j X̂k ,
FIG. 2. Function a−1 (solid green) and the approximation F (a) 2
eit X̂ j X̂k X̂l , or eit X̂ j X̂k X̂l , where the subindices denote which mode
(dashed red) for L = 7 and  = 0.1. The inset shows a closeup of the the operators act on. We now show how exact decompositions
two functions for larger values of a. The approximation is excellent
can be found for each of these transformations. An extension
except for small values of a.
of this technique for more general gates can be found in
Ref. [39].
This error is significant if there are terms in the sum for First, note that the transformation eit X̂ j X̂k is already part of
which both |ca,k | and |1/a − F (a)| are large. For a
1, the universal set. For the unitary eit X̂ j X̂k X̂l , it can be shown
it holds that |1/a − F (a)| ≈ (a2 + 2)2 /(2a3 ) + O(4 ) = (see the Appendixes for details) that the following exact
O(2 /a). This error is bounded even for large a. For a 1/L decomposition holds:
we have F (a) ≈ 0 and therefore |1/a − F (a)| ≈ 1/a, which
can be very large for small a. This is the dominant source of ei2t X̂ j X̂k X̂l = ei2P̂j X̂k ei2P̂j X̂l e 3 X̂ j e−i2P̂j X̂l e−i2P̂j X̂k
it 3

error arising from the approximation of the inverse operator.


−it −it
To choose L, for a given δ > 0, we define the ef- × ei2P̂k X̂l e 3 X̂k3 −i2P̂k X̂l i2P̂l X̂ j
e e e 3 X̂l3 −i2P̂l X̂ j
e
fective eigenvalue support of state | f  as suppδ ( f ) = {a : −it
X̂ j3 −i2P̂j X̂k it 3 it 3 it 3
∃k such that |ca,k | > δ}. Normalizing the differential operator × ei2P̂j X̂k e 3 e e 3 X̂ j e 3 X̂k e 3 X̂l . (23)
as  ∞ = 1, we define
κδ := max (1/a) (20) Note that gates of the form e−i2P̂j X̂k are equivalent to a
a∈suppδ ( f ) controlled-phase gate up to Fourier transforms on the first
2
mode. Finally, as shown in the Appendix, for the gate eit X̂ j X̂k X̂l ,
as the condition number of  when restricted to the effective
it is possible to derive an exact decomposition
support of | f . Then, we can set the resulting error in the
output state to sufficiently low values by choosing L = O(κδ2 ).
= e2iαX̂ j X̂k X̂l e−iαX̂ j P̂k e−2iαX̂ j X̂k X̂l eiαX̂ j P̂k e−2iα
2
X̂ j2 P̂k P̂l 2 2 2 2 3
X̂ j2 P̂l
Overall, the algorithm is valid for any Hermitian differential e2iα .
operator Â, but special care needs to be taken for input states (24)
that have a large support over the smallest eigenvalues of Â.
Here, unitaries of the form eiαX̂ j P̂k and e−2iα X̂ j P̂l are not part of
2 2 3 2

III. HAMILTONIAN SIMULATION the universal set, but exact decompositions can also be derived
The goal of Hamiltonian simulation is to find a quantum for them (see the Appendixes for details). The resulting exact
2
circuit that performs the transformation eiĤt for some Hamil- decomposition for the gate eit X̂ j X̂k X̂l contains 281 gates from
tonian Ĥ and time t > 0. The circuit is specified in terms of a the universal set. It is important to contrast this with the
universal gate set, which in this work we take to be the set commutator approximation method [38], which requires 28
gates to decompose eit X̂ j X̂k X̂l , but for a precision of 10−3 , it
2
π
+P̂2 )
, eit1 X̂ , eit2 X̂ , eit3 X̂ , eiτ X̂1 ⊗X̂2 },
2 2 3
{ei 2 (X̂ (21) needs about 10 repetitions for a total of roughly 107 gates.
6

where t1 , t2 , t3 , and τ are adjustable real parameters. The For any sparse Hamiltonian that is a polynomial of con-
π
Fourier transform gate F̂ := ei 2 (X̂ +P̂ ) has the effect of map-
2 2 stant degree over the quadrature operators, universal simu-
ping between the quadrature operators: F̂ † X̂ F̂ = −P̂ and lation theorems [27,28] state that poly(N ) time is required
F̂ † P̂F̂ = X̂ . The standard approach for performing Hamilto- to perform Hamiltonian simulation and therefore to run our
nian simulation is to employ a Trotter-Suzuki decomposition quantum algorithm for partial differential equations. This is
M an exponential improvement over classical algorithms for
[34–37] to express the transformation eit Ĥ = eit j=1 Ĥ j in solving PDEs, which scale exponentially with dimension
 t K
terms of the product eit Ĥ = Mj=1 (ei K Ĥ j ) + O(t 2 /K ). Fol- [40–42]. The runtime of Hamiltonian simulation also scales
lowing this, a sequence of commutator approximations are polynomially on the operator norm  ∞ [3], so care must be
t
typically employed to decompose each term ei K Ĥ j into ele- taken to ensure that this norm is well behaved over the support
ments from the universal set [38]. We focus on the case where of the input state | f .

032306-4
QUANTUM ALGORITHM FOR NONHOMOGENEOUS LINEAR … PHYSICAL REVIEW A 100, 032306 (2019)

FIG. 3. (Top) Wave functions of the target step function state


with cutoff d = 41 and width L = 7. (Bottom) The state prepared
by the quantum neural network, with fidelity of 99.36% to the target
state. The network consists of 30 layers for a total of 150 gates.

IV. RESOURCE STATE PREPARATION


We employ results from Refs. [29,30] to find circuits for FIG. 4. Function a−1 (solid green) and the approximation G(a)
(dashed red) arising from the use of the step function state prepared
preparing the single photon and step function resource states
by the quantum neural network.
required in the algorithm. The strategy is to optimize a quan-
tum neural network which takes a single-mode vacuum state
as input and prepares a desired target state as output. A layer L
V. EXAMPLES
of the quantum neural network is composed of the sequence of
gates [29]: L := K (κ )D(α)R(φ2 )S(r, θ )R(φ1 ), where R(θ ) is In this section, we test the correctness and applicability
a rotation gate, D(α) is a displacement gate, S(r) is a squeez- of the algorithm by analyzing its performance on two low-
ing gate, and K (κ ) is a Kerr gate. The rotation, squeezing, and dimensional problems where full classical simulation is pos-
displacement gates are Gaussian and can be straightforwardly sible.
decomposed in terms of the universal set of Eq. (21). The Kerr
gate can be decomposed using results from [38].
We perform optimization of the gate parameters by em- A. Poisson equation
ploying the TensorFlow [43] backend of the Strawberry Fields Poisson’s equation is the nonhomogeneous partial differ-
software platform for photonic quantum computing [33]. This ential equation
approach has been pursued in Ref. [30], where it was shown
that a single photon state can be prepared using a quantum 
n
∂ 2 ψ (x)
neural network of eight layers, i.e., 40 gates, with fidelity ∇ 2 ψ (x) = = f (x), (26)
99.998%. For the target step function state, we consider the i=1
∂xi2
L 
truncated state |sL  = √1L 0 dx|x = ∞ n=0 cn,L |n, where |n
is the Fock state of n photons and cn,L = n|sL . For numerical which has applications across several areas of physics and
simulations, we introduce a cutoff dimension d, yielding the engineering. Here we consider its relevance to electrostatics,
 where it establishes a relationship between a charge distribu-
truncated state |sd,L  = dn=0 cn,L |n. As an example, we set a
tion ρ(x) and the electric potential φ(x), namely ∇ 2 φ(x) =
width of L = 7 and a cutoff d = 41, fixing a quantum neural
− ρ(x)
ε
, where ε is the permittivity of the medium, whose
network with 30 layers (150 gates) to prepare this state. The
value we fix to ε = 1. To apply our quantum algorithm to
result is a network that can prepare a state with 99.36% fidelity
this problem, note that under the convention h̄ = 1/2, it holds
to the target state |s41,7 . This is shown in Fig. 3, where we plot ∂2 
the wave function of both states. that ∂x 2 = −4P̂
2
and thus we can set  = −4 ni=1 P̂i2 . We
i
As in Sec. II, we evaluate the resulting approximation to consider a two-dimensional problem where the charge distri-
y2
the inverse operator Â−1 by computing the function x2
bution is given by ρ(x, y) = xy e− 2 e− 2 , as shown in Fig. 5.
  This charge distribution is equivalent, up to normalization, to
i ∞ 
d ∞
the wave function of the two-mode input state | f  = |1|1
dy y e−y /2 −iaxy
2
G(a) = √ dx γn ψn (x) e ,
2π −∞ −∞ consisting of a single photon in each mode. We compute the
n=0
output state by constructing the operator Â−1
approx as in Eq. (13)
(25) with L = 20 and  = 0.01, then applying it to the input state
d | f . The wave function of the output state is proportional to
where  p (x) = n=0 γn ψn (x) is the wave function of the the electric potential φ(x, y), which can be used to compute

state |s p  = dn=0 γn |n prepared by the network. As shown the electric field E (x, y) = −∇φ(x, y). The fidelity between
in Fig. 4, G(a) is also an approximation to the ideal case a−1 . the output state of the algorithm and the ideal solution state is
However, here the approximation deviates more significantly 99.9%. To illustrate the validity of the solution, the charge
from the ideal case for large values of a. As discussed pre- distribution and the electric field are shown in Fig. 5. In a
viously, this can be understood from the fact that the wave physical implementation of the algorithm, repeated quadra-
function of the output state is itself an approximation of an ture measurements of the output state would reveal regions of
ideal step function state of finite width. large electrostatic potential.

032306-5
JUAN MIGUEL ARRAZOLA et al. PHYSICAL REVIEW A 100, 032306 (2019)

This is equal to the desired solution up to a global phase.


In short, the quantum algorithm performs one-dimensional
integration. To calculate the output state of the algorithm, we
numerically compute the operator
 L  ∞
−1 i
dy y e−y /2 e−iÂxy g(x, y, ) (29)
2
Âapprox = √ dx
2π 0 −∞

as in Eq. (13) and consequently calculate Â−1


approx | f .
This computation is performed by expressing P̂ in the
Fock basis, truncating to a finite photon number, and approx-
imating the integral by a Riemann sum. The operator Â−1 approx
includes the effects of a finite-width step function state and
limited precision measurement, but not of approximations to
the step function state. We choose f (x) = sin(ωx)e−x /(2σ )
2 2

as the  function to integrate. The corresponding input state


| f  = n cn |n can be obtained by computing the coefficients
∞
cn = −∞ dx f (x)ψn (x), where ψn (x) is the wave function of
the Fock state with n photons.
The results are shown in Fig. 6 where we plot f (x) =
sin(ωx)e−x /(2σ ) and the wave function of the output state.
2 2

The output wave function closely reproduces the integral of


f (x), even when considering a finite-width step function state
with parameter L = 7 and measurements with finite precision
 = 0.1.

VI. CONCLUSION
We have presented a quantum algorithm for preparing
quantum states that encode the solution to nonhomoge-
neous linear partial differential equations. The algorithm is
a continuous-variable version of the quantum algorithm for
linear systems of equations. For differential operators of fixed
degree, the runtime is polynomial in the dimension N: an
exponential improvement compared to classical algorithms
x2 y2
FIG. 5. (Top) Charge distribution ρ(x, y) = xy e− 2 e− 2 . The that compute the full solution of partial differential equa-
top-right and bottom-left quadrants are regions of positive charge, tions. However, there are important differences between this
while the remaining quadrants are negatively charged. (Bottom) quantum algorithm and classical approaches: the quantum
Electric-field lines reconstructed from the output state of the quantum algorithm assumes that the input state | f  encoding the non-
algorithm. There are regions of zero electric field in each quadrant homogeneous term of the equation can be efficiently prepared
that arise from interfering contributions of the charge clouds sur- and the output is not an explicit specification of the solu-
rounding these points. The electric field is also zero at the origin, tion, but instead a state whose wave function is proportional
as expected from the symmetry of the charge distribution. to the solution. It is crucial to identify applications where
input states can be efficiently prepared and where sampling
from the output state—for example to compute expectation
B. One-dimensional integration
values—is enough for the task at hand. Note also that recent
The simplest nonhomogeneous differential equation is the breakthroughs in classical algorithms for linear systems of
one-dimensional equation Aψ (x) := dψdt(x) = f (x). A solution equations [44,45] apply only to low-rank operators, which do
to the equation is not appear in practice in solving partial differential equations.
 Finally, the quantum algorithm provides a specific solu-
−1 tion to the nonhomogeneous equation, but to solve general
A f (x) = dx f (x), (27) boundary problems it is necessary to also incorporate solu-
tions to the homogeneous equation. The solution ψ (x) of
i.e., the solution is the indefinite integral of f (x). To apply the a nonhomogeneous partial differential equation can always
quantum algorithm to this problem we set  = P̂, in which be written as ψ (x) = ψH (x) + ψNH (x), where ψH (x) is a
case the output of the algorithm is the state |ψ = P̂−1 | f  general solution to the homogeneous equation and ψNH (x) is
whose wave function is proportional to a specific solution to the nonhomogeneous equation. The cor-
 responding boundary problem can be solved by first finding an
arbitrary solution ψNH (x) to the nonhomogeneous differential
ψ (x) = 2i dx f (x). (28) equation, then finding a solution to the homogeneous problem

032306-6
QUANTUM ALGORITHM FOR NONHOMOGENEOUS LINEAR … PHYSICAL REVIEW A 100, 032306 (2019)

APPENDIX A: EXACT DECOMPOSITIONS


We use the convention [X̂ , P̂] = i/2 and begin with the
decomposition below:
−iδ 3
ei2δX̂ j X̂k X̂l = ei2P̂j X̂k ei2P̂j X̂l e 3 X̂ j e−i2P̂j X̂l e−i2P̂j X̂k ei2P̂k X̂l e e−i2P̂k X̂l
iδ 3
3 X̂k

−iδ 3 −iδ 3
e−i2P̂l X̂ j ei2P̂j X̂k e e−i2P̂j X̂k e 3 X̂ j
iδ 3
× ei2P̂l X̂ j e 3 X̂l 3 X̂ j

iδ 3 iδ 3
× e 3 X̂k e 3 X̂l . (A1)
This equation can be best understood by looking at the right
hand and building each term in sequence. To begin, note
that the first four cubic operators in the decomposition are
surrounded by operators of the form ei2P̂j X̂k which can be
expanded with unitary conjugation:
3
ei2P̂j X̂k eiδX̂ j e−i2P̂j X̂k = eiδ (X̂ j +X̂k ) .
3
(A2)
The first one in mode j is translated by the k and l modes,
3
leading to an exponent (X̂ j + X̂k + X̂l ) . Similarly, the other
3 3
three cubic gates lead to the exponents (X̂k + X̂l ) , (X̂l + X̂ j ) ,
3
and (X̂ j + X̂k ) . Expanding these polynomials gives a series of
operators which can be simplified to give the cubic gate on the
left-hand side.
The second decomposition we use is

= e2iαX̂ j X̂k X̂l e−iαX̂ j P̂k e−2iαX̂ j X̂k X̂l eiαX̂ j P̂k e−2iα
2
X̂ j2 P̂k P̂l 2 2 2 2 3
X̂ j2 P̂l
e2iα .
(A3)
iα X̂ j2 P̂k2
For this decomposition we use operations e and
e−2iα X̂ j P̂l , which are not in the universal set. For these, we
3 2

require the decompositions

= ei2αX̂ j X̂k eik P̂k e−iαX̂ j X̂k e−ik P̂k e−i2αX̂ j X̂k
2
k P̂k X̂ j2 3 3
ei3α
FIG. 6. (Top) Function f (x) = sin(ωx)e−x /(2σ ) (solid green)
2 2

with ω = 5 and σ = 1.8. The wave function of the output state of × eik P̂k eiαX̂ j X̂k e−ik P̂k eiα k 34 X̂ j3
3 3 3
(A4)
the algorithm is also shown (dashed red). (Bottom) Function f (x) =
sin(ωx)e−x /(2σ ) with ω = 5 (solid green) and its integral (dashed
2 2
and
red), which can be computed analytically. The wave function of the α α α α
eiαX̂ j X̂k = ei2P̂j X̂k ei 12 X̂ j e−i4P̂j X̂k ei 12 X̂ j ei2P̂j X̂k e−i 6 X̂ j e−i 6 X̂k ,
2 2 4 4 4 4

output state of the algorithm is almost identical to integral, as desired.


In both cases we consider an approximate inverse operator Â−1 approx (A5)
with parameters L = 7 and  = 0.1, demonstrating that the effect
of a finite-width step function state and finite measurement precision which requires a decomposition for the terms of the form
4
does not significantly affect the correctness of the algorithm. eiαX̂ j . This can be achieved via the expression

eiαX̂k = e2iP̂j X̂k eiαX̂ j e−2iP̂j X̂k e−iαX̂ j e−2iαX̂ j X̂k .


4 2 2 2 2 2
(A6)
satisfying the boundary conditions. Through sampling from The total gate count for Eq. (A3) in terms of universal gates
the solution state, the quantum algorithm can provide infor- is 281, but it is exact. If we wish to express all operations in
mation that aids in solving the nonhomogeneous problem, terms of X̂ operators only, we can use unitary conjugation with
which is usually the most challenging part. Once this has the Fourier transform gate. This will bring the total number of
been achieved, the full solution can be obtained by solving gates from the universal set to 373. On the other hand, the
the corresponding homogeneous boundary problem. standard commutator approximation method requires about
28 gates, but for a precision of 10−3 will need 106 repetitions
for a total of roughly 2.8 × 107 gates to decompose the
ACKNOWLEDGMENTS original operation.

We thank A. Ignjatovic, N. Killoran, T. Bromley, and N.


APPENDIX B: COARSE-GRAINING MEASUREMENT
Quesada for helpful discussions. S.L. was funded by AFOSR
OUTPUTS
under a MURI on Optimal Quantum Measurements and State
Verification, by IARPA under the QEO program, by ARO, and Here we consider the effect of postselecting on states other
by NSF. than p = 0 momentum eigenstates. Starting with the output

032306-7
JUAN MIGUEL ARRAZOLA et al. PHYSICAL REVIEW A 100, 032306 (2019)


 ∞
i −y2 /2 −iÂxy
= √ dx dy (x) y e e g(x, y)| f  |p1 |p2 
2π −∞
 
= Â−1
approx | f  |p1 |p2 , (B1)

where

g(x, y) = e−ip1 x e−ip2 y . (B2)

Expressing the inverse operator in terms of its action on the


eigenstate |a
FIG. 7. Relative error aδ(a) due to coarse graining of measure-
ment outputs. Here we have selected p1 = −p2 =  = 0.1. As a
approaches zero, the error becomes significant but decreases for Â−1
approx |a
larger a.  ∞  ∞
i
dy y e−y /2 −iÂxy
2
=√ dx e g(x, y)|a. (B3)
2π 0 −∞
state as in Eq. (4) and performing a momentum homodyne
measurement, projecting onto the general state |p1 |p2  yields
Solving this integral gives the function F (p1 , p2 , a), which
(1 ⊗|p1 p2 | ⊗ |p1 p2 |)| deviates away from the desired function 1/a and is given by

√ √ √  
2a e(p1 −iap2 ) /2a2
− ip1 π − p1 π Erfi p1√−iap
2
2
2a
F (p1 , p2 , a) = e−p1 (p1 −2iap2 )/2a
2
√ , (B4)
2a2

where Erfi(·) is the imaginary error function. Outputs can error δ(a) for the worst case values of p1 and p2 , which
be coarse grained by selecting a parameter p that when occur when p1 = −p2 = p. Figure 7 shows the relative
p1 and p2 are both in the interval [−p, p] the algorithm error δ(a)/(1/a) = aδ(a) as a function of a for fixed p. As
has succeeded. Let δ(a) = | a1 − F (p1 , p2 , a)|. We study the before, the error is largest for small a.

[1] P. W. Shor, in Foundations of Computer Science, 1994 Pro- [12] J. Biamonte, P. Wittek, N. Pancotti, P. Rebentrost, N. Wiebe,
ceedings, 35th Annual Symposium (IEEE, New York, 1994), pp. and S. Lloyd, Nature (London) 549, 195 (2017).
124–134. [13] D. W. Berry, G. Ahokas, R. Cleve, and B. C. Sanders, Commun.
[2] L. K. Grover, in Proceedings of the Twenty-eighth Annual ACM Math. Phys. 270, 359 (2007).
Symposium on Theory of Computing (ACM, Providence, RI, [14] D. W. Berry, A. M. Childs, and R. Kothari, in Foundations of
1996), pp. 212–219. Computer Science (FOCS), 2015 IEEE 56th Annual Symposium
[3] S. Lloyd, Science 273, 1073 (1996). (IEEE, New York, 2015), pp. 792–809.
[4] S. Hallgren, J. ACM (JACM) 54, 4 (2007). [15] D. W. Berry, A. M. Childs, R. Cleve, R. Kothari, and R. D.
[5] M. H. Freedman, A. Kitaev, and Z. Wang, Commun. Math. Somma, in Forum of Mathematics, Sigma (Cambridge Univer-
Phys. 227, 587 (2002). sity Press, Cambridge, UK, 2017), Vol. 5.
[6] D. Aharonov, V. Jones, and Z. Landau, Algorithmica 55, 395 [16] D. W. Berry, J. Phys. A: Math. Theor. 47, 105301 (2014).
(2009). [17] D. W. Berry, A. M. Childs, A. Ostrander, and G. Wang,
[7] A. M. Childs and W. van Dam, Rev. Mod. Phys. 82, 1 Commun. Math. Phys. 356, 1057 (2017).
(2010). [18] T. Xin, S. Wei, J. Cui, J. Xiao, I. Arrazola, L. Lamata, X. Kong,
[8] F. G. Brandao and K. M. Svore, in Foundations of Computer D. Lu, E. Solano, and G. Long, arXiv:1807.04553.
Science (FOCS), 2017 IEEE 58th Annual Symposium (IEEE, [19] S. K. Leyton and T. J. Osborne, arXiv:0812.4423.
New York, 2017), pp. 415–426. [20] Y. Cao, A. Papageorgiou, I. Petras, J. Traub, and S. Kais, New
[9] Fernando G. S. L. Brandão, A. Kalev, T. Li, C. Y.-Y. Lin, K. J. Phys. 15, 013021 (2013).
M. Svore, X. Wu et al., Leibniz Int. Proc. Info. (2019), https: [21] A. Montanaro and S. Pallister, Phys. Rev. A 93, 032324
//par.nsf.gov/biblio/10106371. (2016).
[10] S. Lloyd, M. Mohseni, and P. Rebentrost, Nat. Phys. 10, 631 [22] A. W. Harrow, A. Hassidim, and S. Lloyd, Phys. Rev. Lett. 103,
(2014). 150502 (2009).
[11] P. Rebentrost, M. Mohseni, and S. Lloyd, Phys. Rev. Lett. 113, [23] N. Wiebe, D. Braun, and S. Lloyd, Phys. Rev. Lett. 109, 050505
130503 (2014). (2012).

032306-8
QUANTUM ALGORITHM FOR NONHOMOGENEOUS LINEAR … PHYSICAL REVIEW A 100, 032306 (2019)

[24] B. D. Clader, B. C. Jacobs, and C. R. Sprouse, Phys. Rev. Lett. [35] M. Suzuki, Proc. Jpn. Acad., Ser. B 69, 161 (1993).
110, 250504 (2013). [36] I. Dhand and B. C. Sanders, J. Phys. A 47, 265206 (2014).
[25] A. Childs, R. Kothari, and R. Somma, SIAM J. Comput. 46, [37] T. Kalajdzievski, C. Weedbrook, and P. Rebentrost, Phys. Rev.
1920 (2017). A 97, 062311 (2018).
[26] L. Wossnig, Z. Zhao, and A. Prakash, Phys. Rev. Lett. 120, [38] S. Sefi and P. van Loock, Phys. Rev. Lett. 107, 170501 (2011).
050502 (2018). [39] T. Kalajdzievski and J. M. Arrazola, Phys. Rev. A 99, 022341
[27] S. Lloyd and S. L. Braunstein, Phys. Rev. Lett. 82, 1784 (1999). (2019).
[28] S. L. Braunstein and P. van Loock, Rev. Mod. Phys. 77, 513 [40] J. W. Thomas, Numerical Partial Differential Equations: Finite
(2005). Difference Methods (Springer Science & Business Media, New
[29] N. Killoran, T. R. Bromley, J. M. Arrazola, M. Schuld, N. York, 2013), Vol. 22.
Quesada, and S. Lloyd, arXiv:1806.06871. [41] A. G. Werschulz, The Computational Complexity of Differential
[30] J. M. Arrazola, T. R. Bromley, J. Izaac, C. R. Myers, K. Brádler, and Integral Equations: An Information-based Approach (Ox-
and N. Killoran, Quantum Science and Technology 4 (2018). ford University Press, Oxford, 1991).
[31] L. O’Driscoll, R. Nichols, and P. A. Knott, Quantum Mach. [42] K. Ritter and G. W. Wasilkowski, Lect. Appl. Math. 32, 677
Intel. 1, 5 (2019). (1996).
[32] H.-K. Lau, R. Pooser, G. Siopsis, and C. Weedbrook, Phys. Rev. [43] M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C.
Lett. 118, 080501 (2017). Citro, G. S. Corrado, A. Davis, J. Dean, M. Devin et al.,
[33] N. Killoran, J. Izaac, N. Quesada, V. Bergholm, M. Amy, and arXiv:1603.04467.
C. Weedbrook, Quantum 3, 129 (2019). [44] A. Gilyén, S. Lloyd, and E. Tang, arXiv:1811.04909.
[34] H. F. Trotter, Proc. Am. Math. Soc. 10, 545 (1959). [45] N.-H. Chia, H.-H. Lin, and C. Wang, arXiv:1811.04852.

032306-9

You might also like