Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

HTML conversions sometimes display errors due to content that did not convert correctly from the source. This paper uses the following packages that are not yet supported by the HTML conversion tool. Feedback on these issues are not necessary; they are known and are being worked on.

  • failed: mwe

Authors: achieve the best HTML results from your LaTeX submissions by following these best practices.

License: arXiv.org perpetual non-exclusive license
arXiv:2401.00326v1 [physics.flu-dyn] 30 Dec 2023

Two quantum algorithms for solving the one-dimensional advection-diffusion equation

Julia Ingelmann Sachin S. Bharadwaj Philipp Pfeffer Katepalli R. Sreenivasan Jörg Schumacher
Abstract

Two quantum algorithms are presented for the numerical solution of a linear one-dimensional advection-diffusion equation with periodic boundary conditions. Their accuracy and performance with increasing qubit number are compared point-by-point with each other. Specifically, we solve the linear partial differential equation with a Quantum Linear Systems Algorithms (QLSA) based on the Harrow–Hassidim–Lloyd method and a Variational Quantum Algorithm (VQA), for resolutions that can be encoded using up to 6 qubits, which corresponds to N=64𝑁64N=64italic_N = 64 grid points on the unit interval. Both algorithms are of hybrid nature, i.e., they involve a combination of classical and quantum computing building blocks. The QLSA and VQA are solved as ideal statevector simulations using the in-house solver QFlowS and open-access Qiskit software, respectively. We discuss several aspects of both algorithms which are crucial for a successful performance in both cases. These are the sizes of an additional quantum register for the quantum phase estimation for the QLSA and the choice of the algorithm of the minimization of the cost function for the VQA. The latter algorithm is also implemented in the noisy Qiskit framework including measurement and decoherence circuit noise. We reflect the current limitations and suggest some possible routes of future research for the numerical simulation of classical fluid flows on a quantum computer.

journal: Computers & Fluids\affiliation

[label1]organization=Institute of Thermodynamics and Fluid Mechanics, addressline=Technische Universität Ilmenau, P.O.Box 100565, city=Ilmenau, postcode=D-98684, country=Germany

\affiliation

[label2]organization=Tandon School of Engineering, addressline=New York University, city=New York City, postcode=11201, state=NY, country=USA

\affiliation

[label3]organization=Courant Institute of Mathematical Sciences, addressline=New York University, city=New York City, postcode=10012, state=NY, country=USA

\affiliation

[label4]organization=Department of Physics, addressline=New York University, city=New York City, postcode=10012, state=NY, country=USA

\affiliation

[label5]organization=Center for Space Science, addressline=New York University Abu Dhabi, city=Abu Dhabi, postcode=129188, country=United Arab Emirates

1 Introduction

Quantum computing has the potential to open new ways to classify, generate, and process data Preskill (2018); Deutsch (2020) thus changing paradigms in many application fields, such as material science, renewable energy technology, and finance. The reason for the expected advantage over classical algorithms is the physical foundation of quantum computing. Quantum algorithms are capable of encoding information in superposition states and of combining several such quantum states into tensorial product states which span high-dimensional spaces. They can perform unitary transformations (quantum gates) on these product states in parallel rather than on individual bits, as done in classical computers. In this way, n𝑛nitalic_n qubits—the smallest units of quantum information—span a 2nsuperscript2𝑛2^{n}2 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT-dimensional Hilbert space. This parallelism is tightly connected to the possibility of entangling qubits, representing inseparable correlations between qubits, which is absent in classical bit registers Nielsen and Chuang (2011). Already these two properties suggest faster solutions of problems with high computational complexity, as has been demonstrated for operations such as prime number factorization Shor (1997), data search Grover (1997), and data sampling Deng et al. (2023); see ref. Choi et al. (2023) for a discussion. Still open is the question of whether similar advantages survive the application of quantum algorithms to solutions of nonlinear ordinary and partial differential equations.

Fluid dynamics comprises many applications with high computational effort, for instance the modeling of flows over complex objects such as airplanes and the Direct Numerical Simulation (DNS) of turbulent flows Moin and Mahesh (1998) that resolves all physically relevant flow scales from the system size down to those dominated by viscous and diffusive effects. The nonlinear partial differential equations (PDEs) relevant to us are the Navier-Stokes equations for the flow, and (simultaneously) the advection-diffusion equation for the transport of the scalar field such as a substance concentration and temperature. The numerical effort to resolve all these spatial scales increases as N3superscript𝑁3N^{3}italic_N start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT for the three-dimensional case, which varies at least as fast as Re9/4𝑅superscript𝑒94Re^{9/4}italic_R italic_e start_POSTSUPERSCRIPT 9 / 4 end_POSTSUPERSCRIPT. Here, N𝑁Nitalic_N the number of mesh points along one spatial direction and Re𝑅𝑒Reitalic_R italic_e is the flow Reynolds number that quantifies the vigor of the fluid turbulence. In many technological applications for which the geometry of the flow domain is complex, one requires in addition adaptive refinements of the computational meshes. Consequently, resource limits are reached quickly, even on the largest state-of-the-art supercomputers. The present solution to this problem is to model the small-scale part, e.g., in the form of Reynolds-averaged Navier-Stokes equation models or large eddy simulations.

A further possible solution might be the transformation of classical fluid flow problems on a quantum computer to make use of the parallelism that originates from the quantum mechanical foundations. As one example, a single velocity component of a DNS of homogeneous isotropic turbulence in a periodic box with N3=819235.5×1011superscript𝑁3superscript819235.5superscript1011N^{3}=8192^{3}\approx 5.5\times 10^{11}italic_N start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT = 8192 start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT ≈ 5.5 × 10 start_POSTSUPERSCRIPT 11 end_POSTSUPERSCRIPT grid points Iyer et al. (2019); Buaria et al. (2019) could be encoded theoretically in less than 40 qubits, which should be eminently doable since the biggest quantum chip contains 433 qubits. This motivates our present work.

Several approaches have been suggested in the past years to study fluid flows on quantum computers. They include a transformation into a quantum computing-inspired tensor product framework with an effective mapping of the excited degrees of freedom of a three-dimensional turbulent flow Gourianov et al. (2022) or the mapping of specific classical flow problems to a Schrödinger-type quantum dynamics Meng and Yang (2023); Jin et al. (2023); Succi and Tiribocchi (2023). They include also a surrogate modeling of thermally driven flows within quantum machine learning frameworks, such as hybrid quantum-classical reservoir computing Pfeffer et al. (2022, 2023). Implementations of mostly one-dimensional flow problems on a quantum computer in the form of pure or hybrid algorithms comprise quantum linear systems algorithms for steady pipe Poiseuille, plane Couette flows and Burgers equation Bharadwaj and Sreenivasan (2020, 2023); Bharadwaj et al. (2023), quantum amplitude estimation for one-dimensional gas dynamics Gaitan (2021), Variational Quantum Algorithms for the one-dimensional nonlinear Burgers equation Lubasch et al. (2020); Pool et al. (2022), advection-diffusion problems Demirdjian et al. (2020); Leong et al. (2022, 2023), and quantum lattice Boltzmann methods Todorova and de Steijl (2020); Budinski (2021). See also ref. Succi et al. (2023) for a recent perspective.

The potential of quantum computing algorithms for solving advection-diffusion problems has been investigated in different ways recently. One approach is the decomposition of the PDE into finite differences such that the resulting system of linear equations can be solved. For sparse linear equation systems, the Harrow-Hassidim-Lloyd (HHL) algorithm can provide a exponential speed up in comparison to classical computation Harrow et al. (2009) under certain caveats Aaronson (2015); Montanaro and Pallister (2016). A further approach are variational methods. Different versions, such as the variational quantum imaginary time evolution Leong et al. (2023), the Variational Quantum Linear Solver (VQLS) Demirdjian et al. (2020), or the Variational Quantum Algorithm (VQA) Lubasch et al. (2020); Guseynov et al. (2023); Liu et al. (2023), have been used, even for two-dimensional problems, such as the heat equation Liu et al. (2023).

The present work compares these two popular hybrid quantum-classical algorithms for a standard benchmark problem in fluid mechanics, which is the one-dimensional advection-diffusion equation with a constant advection velocity U𝑈Uitalic_U, described by a linear partial differential equation. To this end, we will compare one-to-one a hybrid quantum-classical Variational Quantum Algorithm (VQA) with a Quantum Linear Systems Algorithm (QLSA). The purpose of the present study is to explore the scalability of both algorithms up to mesh grids which will be encoded in registers consisting of n6𝑛6n\leq 6italic_n ≤ 6 qubits giving resolutions of N64𝑁64N\leq 64italic_N ≤ 64 grid points. Furthermore, we identify the bottlenecks that exist in both cases for some of their main building blocks: for the VQA scheme, this turns out to be the classical optimization algorithm for the minimization of the cost function; for the QLSA it is the quantum phase estimation routine—an approximate method to find eigenvalues of a unitary matrix. Several classical optimization algorithms are therefore compared in the VQA case. Here, we also investigate the role of the depth of the parametric quantum circuit on the performance of the VQA algorithm and report the impact of measurements for data readout on the overall performance. In case of QLSA, the underlying hybrid algorithm presented here (which in itself preserves the speed-up Bharadwaj and Sreenivasan (2023)) is customized carefully for the advection-diffusion problem. We analyse the algorithm’s performance after prescribing specific strategies for accurate eigenvalue estimation. We also evaluate its dependence on the number of qubits, preconditioning and measurement. To keep our manuscript self-contained and accessible to the fluid dynamics community, we provide compact introductions to quantum computing as well as the two algorithms. Finally, we critically assess both algorithms for this simple fluid mechanical problem and thereby discuss possible limitations of quantum algorithms for (nonlinear) fluid flow problems in one red(and higher-dimensional) cases.

The article is structured as follows. First, the analytical solution for the one-dimensional advection-diffusion equation is obtained as the basis for the comparison of the quantum algorithms (Sec. 2). Second, the numerical scheme of the finite differences approach is given for forward and backward Euler stepping, which is the groundwork for the quantum algorithms considered here (Sec. 3). Then, the quantum algorithms are introduced in detail (Sec. 4). The comparison of both quantum algorithms is shown in Sec. 5 on aspects such as the time evolution of the concentration profiles, dependence on the number of qubits, dependence on parameter T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and the realisation on Noisy Intermediate Scale Quantum (NISQ) devices. The results are summarized and discussed in Sec. 6.

2 One-dimensional advection-diffusion equation

We demonstrate and compare the performance of the two quantum computing algorithms considered here for the advection-diffusion equation given by

tc=D2c𝒖c,subscript𝑡𝑐𝐷superscript2𝑐𝒖𝑐\displaystyle\partial_{t}c=D\nabla^{2}c-{\bm{u}}\cdot\nabla c,∂ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT italic_c = italic_D ∇ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_c - bold_italic_u ⋅ ∇ italic_c , (1)

where c(𝒙,t)𝑐𝒙𝑡c({\bm{x}},t)italic_c ( bold_italic_x , italic_t ) is the concentration field of the solvent, D𝐷Ditalic_D is the diffusion constant and 𝒖(𝒙,t)𝒖𝒙𝑡{\bm{u}}({\bm{x}},t)bold_italic_u ( bold_italic_x , italic_t ) is the velocity vector field that advects the solvent. This equation describes the transport of the solvent, such as a dye or a cloud of tracer particles subject to diffusion and advection with the velocity field. In this paper, we consider the simplest case of a one-dimensional linear equation, which is given by

tc(x,t)=Dx2c(x,t)Uxc(x,t).subscript𝑡𝑐𝑥𝑡𝐷subscriptsuperscript2𝑥𝑐𝑥𝑡𝑈subscript𝑥𝑐𝑥𝑡\displaystyle\partial_{t}c(x,t)=D\partial^{2}_{x}c(x,t)-U\partial_{x}c(x,t).∂ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT italic_c ( italic_x , italic_t ) = italic_D ∂ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT italic_c ( italic_x , italic_t ) - italic_U ∂ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT italic_c ( italic_x , italic_t ) . (2)

Here, the advection velocity U𝑈Uitalic_U in the x𝑥xitalic_x-direction is taken as a constant. The problem is discretized in space and time. For the spatial discretization, the interval x[L,L]𝑥𝐿𝐿x\in[-L,L]italic_x ∈ [ - italic_L , italic_L ] is divided into N𝑁Nitalic_N segments of width Δx=2L/NΔ𝑥2𝐿𝑁\Delta x=2L/Nroman_Δ italic_x = 2 italic_L / italic_N. The time evolution is also discretized uniformly, such that t=mτ𝑡𝑚𝜏t=m\tauitalic_t = italic_m italic_τ, where τ𝜏\tauitalic_τ is the time step. For the analytical solution, the wave-like ansatz c(x,t)=exp(ωt+iλx)𝑐𝑥𝑡exp𝜔𝑡𝑖𝜆𝑥c(x,t)=\text{exp}\left(\omega t+i\lambda x\right)italic_c ( italic_x , italic_t ) = exp ( italic_ω italic_t + italic_i italic_λ italic_x ) is chosen such that ω=Dλ2iUλ𝜔𝐷superscript𝜆2𝑖𝑈𝜆\omega=-D\lambda^{2}-iU\lambdaitalic_ω = - italic_D italic_λ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - italic_i italic_U italic_λ follows from eq. (2). Hence, the concentration profile takes the form of

c(x,t)=[acosλ(xUt)+bsinλ(xUt)]exp(Dλ2t).𝑐𝑥𝑡delimited-[]𝑎𝜆𝑥𝑈𝑡𝑏𝜆𝑥𝑈𝑡exp𝐷superscript𝜆2𝑡c(x,t)=\left[a\cos{\lambda(x-Ut)}+b\sin{\lambda(x-Ut)}\right]\text{exp}(-D% \lambda^{2}t)\,.italic_c ( italic_x , italic_t ) = [ italic_a roman_cos italic_λ ( italic_x - italic_U italic_t ) + italic_b roman_sin italic_λ ( italic_x - italic_U italic_t ) ] exp ( - italic_D italic_λ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_t ) . (3)

Periodic boundary conditions are imposed, such that c(x=0,t)=c(x=N,t)𝑐𝑥0𝑡𝑐𝑥𝑁𝑡c(x=0,t)=c(x=N,t)italic_c ( italic_x = 0 , italic_t ) = italic_c ( italic_x = italic_N , italic_t ). Consequently, the wavenumber λ=kπ/L𝜆𝑘𝜋𝐿\lambda=k\pi/Litalic_λ = italic_k italic_π / italic_L with k𝑘k\in\mathbb{N}italic_k ∈ blackboard_N. Thus there follows the general solution to the problem in the form of a series expansion

c(x,t)𝑐𝑥𝑡\displaystyle c(x,t)italic_c ( italic_x , italic_t ) =k=0[akcos(kπL(xUt))+bksin(kπL(xUt))]absentsuperscriptsubscript𝑘0delimited-[]subscript𝑎𝑘𝑘𝜋𝐿𝑥𝑈𝑡subscript𝑏𝑘𝑘𝜋𝐿𝑥𝑈𝑡\displaystyle=\sum_{k=0}^{\infty}\left[a_{k}\cos{\left(\frac{k\pi}{L}(x-Ut)% \right)}+b_{k}\sin{\left(\frac{k\pi}{L}(x-Ut)\right)}\right]= ∑ start_POSTSUBSCRIPT italic_k = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT [ italic_a start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT roman_cos ( divide start_ARG italic_k italic_π end_ARG start_ARG italic_L end_ARG ( italic_x - italic_U italic_t ) ) + italic_b start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT roman_sin ( divide start_ARG italic_k italic_π end_ARG start_ARG italic_L end_ARG ( italic_x - italic_U italic_t ) ) ]
×exp(D(kπL)2t)absentexp𝐷superscript𝑘𝜋𝐿2𝑡\displaystyle\times\text{exp}\left(-D\left(\frac{k\pi}{L}\right)^{2}t\right)× exp ( - italic_D ( divide start_ARG italic_k italic_π end_ARG start_ARG italic_L end_ARG ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_t ) (4)

As initial condition the delta function is applied such that c(x,0)=δ(x)𝑐𝑥0𝛿𝑥c(x,0)=\delta(x)italic_c ( italic_x , 0 ) = italic_δ ( italic_x ). The delta function is standard and defined to be δ(x)=0𝛿𝑥0\delta(x)=0italic_δ ( italic_x ) = 0 for x0𝑥0x\neq 0italic_x ≠ 0 and δ(x)dx=1superscriptsubscript𝛿𝑥d𝑥1\int_{-\infty}^{\infty}\delta(x)\text{d}x=1∫ start_POSTSUBSCRIPT - ∞ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT italic_δ ( italic_x ) d italic_x = 1. The initial condition specifies the expansion coefficients in the general solution as

c(x,0)=a02+k=1akcos(kπLx)+bksin(kπLx).𝑐𝑥0subscript𝑎02superscriptsubscript𝑘1subscript𝑎𝑘𝑘𝜋𝐿𝑥subscript𝑏𝑘𝑘𝜋𝐿𝑥\displaystyle c(x,0)=\frac{a_{0}}{2}+\sum_{k=1}^{\infty}a_{k}\cos\left(\frac{k% \pi}{L}x\right)+b_{k}\sin\left(\frac{k\pi}{L}x\right).italic_c ( italic_x , 0 ) = divide start_ARG italic_a start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT end_ARG start_ARG 2 end_ARG + ∑ start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT italic_a start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT roman_cos ( divide start_ARG italic_k italic_π end_ARG start_ARG italic_L end_ARG italic_x ) + italic_b start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT roman_sin ( divide start_ARG italic_k italic_π end_ARG start_ARG italic_L end_ARG italic_x ) . (5)

The Fourier coefficients are given by

a0subscript𝑎0\displaystyle a_{0}italic_a start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT =1LLLδ(x)dx=1L,absent1𝐿superscriptsubscript𝐿𝐿𝛿𝑥d𝑥1𝐿\displaystyle=\frac{1}{L}\int_{-L}^{L}\delta(x)\text{d}x=\frac{1}{L},= divide start_ARG 1 end_ARG start_ARG italic_L end_ARG ∫ start_POSTSUBSCRIPT - italic_L end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT italic_δ ( italic_x ) d italic_x = divide start_ARG 1 end_ARG start_ARG italic_L end_ARG , (6)
aksubscript𝑎𝑘\displaystyle a_{k}italic_a start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT =1LLLδ(x)cos(kπLx)dx=1L andabsent1𝐿superscriptsubscript𝐿𝐿𝛿𝑥𝑘𝜋𝐿𝑥d𝑥1𝐿 and\displaystyle=\frac{1}{L}\int_{-L}^{L}\delta(x)\cos\left(\frac{k\pi}{L}x\right% )\text{d}x=\frac{1}{L}\text{ and}= divide start_ARG 1 end_ARG start_ARG italic_L end_ARG ∫ start_POSTSUBSCRIPT - italic_L end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT italic_δ ( italic_x ) roman_cos ( divide start_ARG italic_k italic_π end_ARG start_ARG italic_L end_ARG italic_x ) d italic_x = divide start_ARG 1 end_ARG start_ARG italic_L end_ARG and (7)
bksubscript𝑏𝑘\displaystyle b_{k}italic_b start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT =1LLLδ(x)sin(kπLx)dx=0,absent1𝐿superscriptsubscript𝐿𝐿𝛿𝑥𝑘𝜋𝐿𝑥d𝑥0\displaystyle=\frac{1}{L}\int_{-L}^{L}\delta(x)\sin\left(\frac{k\pi}{L}x\right% )\text{d}x=0,= divide start_ARG 1 end_ARG start_ARG italic_L end_ARG ∫ start_POSTSUBSCRIPT - italic_L end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT italic_δ ( italic_x ) roman_sin ( divide start_ARG italic_k italic_π end_ARG start_ARG italic_L end_ARG italic_x ) d italic_x = 0 , (8)

such that the initial condition can written as

c(x,0)=12L+k=11Lcos(kπLx).𝑐𝑥012𝐿superscriptsubscript𝑘11𝐿𝑘𝜋𝐿𝑥\displaystyle c(x,0)=\frac{1}{2L}+\sum_{k=1}^{\infty}\frac{1}{L}\cos\left(% \frac{k\pi}{L}x\right).italic_c ( italic_x , 0 ) = divide start_ARG 1 end_ARG start_ARG 2 italic_L end_ARG + ∑ start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT divide start_ARG 1 end_ARG start_ARG italic_L end_ARG roman_cos ( divide start_ARG italic_k italic_π end_ARG start_ARG italic_L end_ARG italic_x ) . (9)

Considering these coefficients, the analytical solution can be found to be

c(x,t)𝑐𝑥𝑡\displaystyle c(x,t)italic_c ( italic_x , italic_t ) =12L+k=1[1Lcos(kπL(xUt))]exp(D(kπL)2t).absent12𝐿superscriptsubscript𝑘1delimited-[]1𝐿𝑘𝜋𝐿𝑥𝑈𝑡exp𝐷superscript𝑘𝜋𝐿2𝑡\displaystyle=\frac{1}{2L}+\sum_{k=1}^{\infty}\left[\frac{1}{L}\cos{\left(% \frac{k\pi}{L}(x-Ut)\right)}\right]\text{exp}\left(-D\left(\frac{k\pi}{L}% \right)^{2}t\right)\,.= divide start_ARG 1 end_ARG start_ARG 2 italic_L end_ARG + ∑ start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT [ divide start_ARG 1 end_ARG start_ARG italic_L end_ARG roman_cos ( divide start_ARG italic_k italic_π end_ARG start_ARG italic_L end_ARG ( italic_x - italic_U italic_t ) ) ] exp ( - italic_D ( divide start_ARG italic_k italic_π end_ARG start_ARG italic_L end_ARG ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_t ) . (10)

Equation (10) describes a Gauss-shaped pulse that diffuses while moving to the right given that U>0𝑈0U>0italic_U > 0. For the following, lengths are measured in units of the interval length 2L2𝐿2L2 italic_L. Times can be expressed in units of either the advection time τa=2L/Usubscript𝜏𝑎2𝐿𝑈\tau_{a}=2L/Uitalic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT = 2 italic_L / italic_U or the diffusive time τd=(2L)2/Dsubscript𝜏𝑑superscript2𝐿2𝐷\tau_{d}=(2L)^{2}/Ditalic_τ start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT = ( 2 italic_L ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT / italic_D. If not stated otherwise, we will use τasubscript𝜏𝑎\tau_{a}italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT.

3 Finite difference methods with Euler time stepping

The numerical solution of the advection-diffusion equation (2) can be obtained by a finite difference method (FDM). In the simplest case, these are Euler methods, either an explicit forward or an implicit backward Euler time step method. For this method, the partial differential equation is approximated by a system of algebraic discretization equations. Furthermore, the problem is discretized in space and time uniformly, such that xi=x0+iΔxsubscript𝑥𝑖subscript𝑥0𝑖Δ𝑥x_{i}=x_{0}+i\Delta xitalic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + italic_i roman_Δ italic_x and tm=t0+mτsubscript𝑡𝑚subscript𝑡0𝑚𝜏t_{m}=t_{0}+m\tauitalic_t start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT = italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + italic_m italic_τ with x0=0subscript𝑥00x_{0}=0italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 0 and t0=0subscript𝑡00t_{0}=0italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 0. Indices i=0,,N1𝑖0𝑁1i=0,\dots,N-1italic_i = 0 , … , italic_N - 1 and m=0,,M𝑚0𝑀m=0,\dots,Mitalic_m = 0 , … , italic_M. When the forward difference in time and the centered difference in space is taken, one gets the forward in time and centered in space (FCTS) method. It is of 1st order accuracy in time, of 2nd order accuracy in space, and given by

cim+1cimτ=Dci+1m2cim+ci1m(Δx)2Uci+1mci1m2Δx,superscriptsubscript𝑐𝑖𝑚1superscriptsubscript𝑐𝑖𝑚𝜏𝐷superscriptsubscript𝑐𝑖1𝑚2superscriptsubscript𝑐𝑖𝑚superscriptsubscript𝑐𝑖1𝑚superscriptΔ𝑥2𝑈superscriptsubscript𝑐𝑖1𝑚superscriptsubscript𝑐𝑖1𝑚2Δ𝑥\displaystyle\frac{c_{i}^{m+1}-c_{i}^{m}}{\tau}=D\frac{c_{i+1}^{m}-2c_{i}^{m}+% c_{i-1}^{m}}{(\Delta x)^{2}}-U\frac{c_{i+1}^{m}-c_{i-1}^{m}}{2\Delta x}\,,divide start_ARG italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT - italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT end_ARG start_ARG italic_τ end_ARG = italic_D divide start_ARG italic_c start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT - 2 italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT + italic_c start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT end_ARG start_ARG ( roman_Δ italic_x ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG - italic_U divide start_ARG italic_c start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT - italic_c start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT end_ARG start_ARG 2 roman_Δ italic_x end_ARG , (11)

and thus

cim+1=(Dτ(Δx)2Uτ2Δx)ci+1m+(12Dτ(Δx)2)cim+(Dτ(Δx)2+Uτ2Δx)ci1m.superscriptsubscript𝑐𝑖𝑚1𝐷𝜏superscriptΔ𝑥2𝑈𝜏2Δ𝑥superscriptsubscript𝑐𝑖1𝑚12𝐷𝜏superscriptΔ𝑥2superscriptsubscript𝑐𝑖𝑚𝐷𝜏superscriptΔ𝑥2𝑈𝜏2Δ𝑥superscriptsubscript𝑐𝑖1𝑚c_{i}^{m+1}=\left(\frac{D\tau}{(\Delta x)^{2}}-\frac{U\tau}{2\Delta x}\right)c% _{i+1}^{m}+\left(1-2\frac{D\tau}{(\Delta x)^{2}}\right)c_{i}^{m}+\left(\frac{D% \tau}{(\Delta x)^{2}}+\frac{U\tau}{2\Delta x}\right)c_{i-1}^{m}\,.italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT = ( divide start_ARG italic_D italic_τ end_ARG start_ARG ( roman_Δ italic_x ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG - divide start_ARG italic_U italic_τ end_ARG start_ARG 2 roman_Δ italic_x end_ARG ) italic_c start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT + ( 1 - 2 divide start_ARG italic_D italic_τ end_ARG start_ARG ( roman_Δ italic_x ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG ) italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT + ( divide start_ARG italic_D italic_τ end_ARG start_ARG ( roman_Δ italic_x ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG + divide start_ARG italic_U italic_τ end_ARG start_ARG 2 roman_Δ italic_x end_ARG ) italic_c start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT .

We define the following abbreviations

r=Dτ(Δx)2ands=Uτ2Δx,formulae-sequence𝑟𝐷𝜏superscriptΔ𝑥2and𝑠𝑈𝜏2Δ𝑥r=\frac{D\tau}{(\Delta x)^{2}}\quad\mbox{and}\quad s=\frac{U\tau}{2\Delta x}\,,italic_r = divide start_ARG italic_D italic_τ end_ARG start_ARG ( roman_Δ italic_x ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG and italic_s = divide start_ARG italic_U italic_τ end_ARG start_ARG 2 roman_Δ italic_x end_ARG , (12)

where s𝑠sitalic_s is the parameter of the convective part and r𝑟ritalic_r is the stability parameter. For this explicit scheme r1/2𝑟12r\leq 1/2italic_r ≤ 1 / 2 should hold. The scheme can be expressed as a system of linear equations via

A𝒄m𝐴superscript𝒄𝑚\displaystyle A{\bm{c}}^{m}italic_A bold_italic_c start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT =𝒄m+1absentsuperscript𝒄𝑚1\displaystyle={\bm{c}}^{m+1}= bold_italic_c start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT (13)
withAwith𝐴\displaystyle\text{with}\ \ Awith italic_A =[12rrs00s+rs+r12rrs00s+r12rrs00s+r12rrsrs00s+r12r].absentdelimited-[]12𝑟𝑟𝑠00𝑠𝑟𝑠𝑟12𝑟𝑟𝑠missing-subexpressionmissing-subexpression00𝑠𝑟12𝑟𝑟𝑠missing-subexpression0missing-subexpression0missing-subexpressionmissing-subexpression𝑠𝑟12𝑟𝑟𝑠𝑟𝑠00𝑠𝑟12𝑟\displaystyle=\left[\begin{array}[]{cccccc}1-2r&r-s&0&\ldots&0&s+r\\ s+r&1-2r&r-s&&&0\\ 0&s+r&1-2r&r-s&&0\\ \vdots&&\ddots&\ddots&\ddots&\vdots\\ 0&&&s+r&1-2r&r-s\\ r-s&0&\ldots&0&s+r&1-2r\\ \end{array}\right].= [ start_ARRAY start_ROW start_CELL 1 - 2 italic_r end_CELL start_CELL italic_r - italic_s end_CELL start_CELL 0 end_CELL start_CELL … end_CELL start_CELL 0 end_CELL start_CELL italic_s + italic_r end_CELL end_ROW start_ROW start_CELL italic_s + italic_r end_CELL start_CELL 1 - 2 italic_r end_CELL start_CELL italic_r - italic_s end_CELL start_CELL end_CELL start_CELL end_CELL start_CELL 0 end_CELL end_ROW start_ROW start_CELL 0 end_CELL start_CELL italic_s + italic_r end_CELL start_CELL 1 - 2 italic_r end_CELL start_CELL italic_r - italic_s end_CELL start_CELL end_CELL start_CELL 0 end_CELL end_ROW start_ROW start_CELL ⋮ end_CELL start_CELL end_CELL start_CELL ⋱ end_CELL start_CELL ⋱ end_CELL start_CELL ⋱ end_CELL start_CELL ⋮ end_CELL end_ROW start_ROW start_CELL 0 end_CELL start_CELL end_CELL start_CELL end_CELL start_CELL italic_s + italic_r end_CELL start_CELL 1 - 2 italic_r end_CELL start_CELL italic_r - italic_s end_CELL end_ROW start_ROW start_CELL italic_r - italic_s end_CELL start_CELL 0 end_CELL start_CELL … end_CELL start_CELL 0 end_CELL start_CELL italic_s + italic_r end_CELL start_CELL 1 - 2 italic_r end_CELL end_ROW end_ARRAY ] . (20)

In case of the implicit backward Euler scheme (BTCS), the system of linear equation follows such that the matrix A𝐴Aitalic_A has to be inverted to find the desired solution, since this method imposes the expression

cim+1cimτ=Dci+1m+12cim+1+ci1m+1(Δx)2Uci+1m+1ci1m+12Δx,superscriptsubscript𝑐𝑖𝑚1superscriptsubscript𝑐𝑖𝑚𝜏𝐷superscriptsubscript𝑐𝑖1𝑚12superscriptsubscript𝑐𝑖𝑚1superscriptsubscript𝑐𝑖1𝑚1superscriptΔ𝑥2𝑈superscriptsubscript𝑐𝑖1𝑚1superscriptsubscript𝑐𝑖1𝑚12Δ𝑥\displaystyle\frac{c_{i}^{m+1}-c_{i}^{m}}{\tau}=D\frac{c_{i+1}^{m+1}-2c_{i}^{m% +1}+c_{i-1}^{m+1}}{(\Delta x)^{2}}-U\frac{c_{i+1}^{m+1}-c_{i-1}^{m+1}}{2\Delta x% }\,,divide start_ARG italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT - italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT end_ARG start_ARG italic_τ end_ARG = italic_D divide start_ARG italic_c start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT - 2 italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT + italic_c start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT end_ARG start_ARG ( roman_Δ italic_x ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG - italic_U divide start_ARG italic_c start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT - italic_c start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT end_ARG start_ARG 2 roman_Δ italic_x end_ARG , (21)

which can be reformulated to

cim=(Dτ(Δx)2+Uτ2Δx)ci+1m+1+(1+2Dτ(Δx)2)cim+1+(Dτ(Δx)2Uτ2Δx)ci1m+1.superscriptsubscript𝑐𝑖𝑚𝐷𝜏superscriptΔ𝑥2𝑈𝜏2Δ𝑥superscriptsubscript𝑐𝑖1𝑚112𝐷𝜏superscriptΔ𝑥2superscriptsubscript𝑐𝑖𝑚1𝐷𝜏superscriptΔ𝑥2𝑈𝜏2Δ𝑥superscriptsubscript𝑐𝑖1𝑚1c_{i}^{m}=\left(-\frac{D\tau}{(\Delta x)^{2}}+\frac{U\tau}{2\Delta x}\right)c_% {i+1}^{m+1}+\left(1+2\frac{D\tau}{(\Delta x)^{2}}\right)c_{i}^{m+1}+\left(-% \frac{D\tau}{(\Delta x)^{2}}-\frac{U\tau}{2\Delta x}\right)c_{i-1}^{m+1}\,.italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT = ( - divide start_ARG italic_D italic_τ end_ARG start_ARG ( roman_Δ italic_x ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG + divide start_ARG italic_U italic_τ end_ARG start_ARG 2 roman_Δ italic_x end_ARG ) italic_c start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT + ( 1 + 2 divide start_ARG italic_D italic_τ end_ARG start_ARG ( roman_Δ italic_x ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG ) italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT + ( - divide start_ARG italic_D italic_τ end_ARG start_ARG ( roman_Δ italic_x ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG - divide start_ARG italic_U italic_τ end_ARG start_ARG 2 roman_Δ italic_x end_ARG ) italic_c start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT .

In other words, the scheme can be expressed as a system of linear equations via

A𝒄m+1𝐴superscript𝒄𝑚1\displaystyle A{\bm{c}}^{m+1}italic_A bold_italic_c start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT =𝒄mabsentsuperscript𝒄𝑚\displaystyle={\bm{c}}^{m}= bold_italic_c start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT (22)
withAwith𝐴\displaystyle\text{with}\ \ Awith italic_A =[1+2rr+s00rsrs1+2rr+s00rs1+2rr+s00rs1+2rr+sr+s00rs1+2r]absentdelimited-[]12𝑟𝑟𝑠00𝑟𝑠𝑟𝑠12𝑟𝑟𝑠missing-subexpressionmissing-subexpression00𝑟𝑠12𝑟𝑟𝑠missing-subexpression0missing-subexpression0missing-subexpressionmissing-subexpression𝑟𝑠12𝑟𝑟𝑠𝑟𝑠00𝑟𝑠12𝑟\displaystyle=\left[\begin{array}[]{cccccc}1+2r&-r+s&0&\cdots&0&-r-s\\ -r-s&1+2r&-r+s&&&0\\ 0&-r-s&1+2r&-r+s&&0\\ \vdots&&\ddots&\ddots&\ddots&\vdots\\ 0&&&-r-s&1+2r&-r+s\\ -r+s&0&\cdots&0&-r-s&1+2r\\ \end{array}\right]= [ start_ARRAY start_ROW start_CELL 1 + 2 italic_r end_CELL start_CELL - italic_r + italic_s end_CELL start_CELL 0 end_CELL start_CELL ⋯ end_CELL start_CELL 0 end_CELL start_CELL - italic_r - italic_s end_CELL end_ROW start_ROW start_CELL - italic_r - italic_s end_CELL start_CELL 1 + 2 italic_r end_CELL start_CELL - italic_r + italic_s end_CELL start_CELL end_CELL start_CELL end_CELL start_CELL 0 end_CELL end_ROW start_ROW start_CELL 0 end_CELL start_CELL - italic_r - italic_s end_CELL start_CELL 1 + 2 italic_r end_CELL start_CELL - italic_r + italic_s end_CELL start_CELL end_CELL start_CELL 0 end_CELL end_ROW start_ROW start_CELL ⋮ end_CELL start_CELL end_CELL start_CELL ⋱ end_CELL start_CELL ⋱ end_CELL start_CELL ⋱ end_CELL start_CELL ⋮ end_CELL end_ROW start_ROW start_CELL 0 end_CELL start_CELL end_CELL start_CELL end_CELL start_CELL - italic_r - italic_s end_CELL start_CELL 1 + 2 italic_r end_CELL start_CELL - italic_r + italic_s end_CELL end_ROW start_ROW start_CELL - italic_r + italic_s end_CELL start_CELL 0 end_CELL start_CELL ⋯ end_CELL start_CELL 0 end_CELL start_CELL - italic_r - italic_s end_CELL start_CELL 1 + 2 italic_r end_CELL end_ROW end_ARRAY ] (29)

The comparison of the analytical solution (ANA) with those of FCTS and BCTS is shown in Fig. 1. The comparison is made via the mean squared error (MSE) defined as

MSE(tm)=1Ni=0N1[ciANA(tm)ciFDM(tm)]2,MSEsubscript𝑡𝑚1𝑁superscriptsubscript𝑖0𝑁1superscriptdelimited-[]superscriptsubscript𝑐𝑖ANAsubscript𝑡𝑚superscriptsubscript𝑐𝑖FDMsubscript𝑡𝑚2\displaystyle{\rm MSE}(t_{m})=\frac{1}{N}\sum_{i=0}^{N-1}\left[c_{i}^{\text{% ANA}}(t_{m})-c_{i}^{\text{FDM}}(t_{m})\right]^{2}\,,roman_MSE ( italic_t start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT ) = divide start_ARG 1 end_ARG start_ARG italic_N end_ARG ∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_N - 1 end_POSTSUPERSCRIPT [ italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ANA end_POSTSUPERSCRIPT ( italic_t start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT ) - italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT FDM end_POSTSUPERSCRIPT ( italic_t start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT ) ] start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT , (30)

where ci=c(xi,t)subscript𝑐𝑖𝑐subscript𝑥𝑖𝑡c_{i}=c(x_{i},t)italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = italic_c ( italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_t ). In Figs. 1(a) and 1(b), it can be seen that the numerical methods approximate the analytical solution sufficiently well. This could be different when nonlinear equations have to be solved with VQA.

Refer to caption
Figure 1: Time evolution of the concentration profiles of the analytical solution (ANA) and the results of the classical numerical methods, namely the explicit method (FTCS), the implicit method (BTCS) and the midpoint method (MP) for N=32𝑁32N=32italic_N = 32, D=1𝐷1D=1italic_D = 1, U=10𝑈10U=10italic_U = 10. Panels (a) and (b) compare the concentration profiles of the methods at two time instants. The corresponding mean squared error (MSE) of the results of the classical numerical methods to the analytical solution is shown in panel (c).

4 Quantum algorithms

This section describes both quantum algorithms, namely the VQA and the QLSA. The quantum part of the VQA is implemented in the quantum simulation environment Qiskit Qis (2023). The QLSA is done with QFlowS, a C++ based simulation package Bharadwaj and Sreenivasan (2023). For the direct comparison of both algorithms, an ideal statevector simulation will be used. In the following, we will briefly introduce the basics of both quantum algorithms. The building block of both algorithms are the qubits, the smallest information units in a quantum algorithm. While a single classical bit can take two discrete values only, namely {0,1}01\{0,1\}{ 0 , 1 }, a qubit is a superposition of the two basis states of the Hilbert space 2superscript2\mathbb{C}^{2}blackboard_C start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT

|q1=α1|0+α2|1=α1(10)+α2(01),ketsubscript𝑞1subscript𝛼1ket0subscript𝛼2ket1subscript𝛼110subscript𝛼201|q_{1}\rangle=\alpha_{1}|0\rangle+\alpha_{2}|1\rangle=\alpha_{1}\left(\begin{% array}[]{c}1\\ 0\\ \end{array}\right)+\alpha_{2}\left(\begin{array}[]{c}0\\ 1\\ \end{array}\right)\,,| italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ⟩ = italic_α start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT | 0 ⟩ + italic_α start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT | 1 ⟩ = italic_α start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ( start_ARRAY start_ROW start_CELL 1 end_CELL end_ROW start_ROW start_CELL 0 end_CELL end_ROW end_ARRAY ) + italic_α start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( start_ARRAY start_ROW start_CELL 0 end_CELL end_ROW start_ROW start_CELL 1 end_CELL end_ROW end_ARRAY ) , (31)

with α1,α2subscript𝛼1subscript𝛼2\alpha_{1},\alpha_{2}\in\mathbb{C}italic_α start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_α start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ∈ blackboard_C and q12=|α1|2+|α2|2=1subscriptnormsubscript𝑞12superscriptsubscript𝛼12superscriptsubscript𝛼221\|q_{1}\|_{2}=\sqrt{|\alpha_{1}|^{2}+|\alpha_{2}|^{2}}=1∥ italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∥ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = square-root start_ARG | italic_α start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT | start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + | italic_α start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT | start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG = 1 and basis vectors |0ket0|0\rangle| 0 ⟩ and |1ket1|1\rangle| 1 ⟩ in Dirac’s notation Nielsen and Chuang (2011). It can be combined into an n𝑛nitalic_n-qubit system, also denoted as an n𝑛nitalic_n-qubit quantum register, by successive tensor products of qubits. An unentangled two-qubit state vector is the tensor product of two single-qubit vectors,

|q1|q122.tensor-productketsubscript𝑞1ketsuperscriptsubscript𝑞1tensor-productsuperscript2superscript2|q_{1}\rangle\otimes|q_{1}^{\prime}\rangle\in\mathbb{C}^{2}\otimes\mathbb{C}^{% 2}\,.| italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ⟩ ⊗ | italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ⟩ ∈ blackboard_C start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ⊗ blackboard_C start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT . (32)

The basis of this tensor product space is given by 4 vectors, usually formulated in integer or binary bit-string notation: |j1=|0|0=|00ketsubscript𝑗1tensor-productket0ket0ket00|j_{1}\rangle=|0\rangle\otimes|0\rangle=|00\rangle| italic_j start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ⟩ = | 0 ⟩ ⊗ | 0 ⟩ = | 00 ⟩, |j2=|01ketsubscript𝑗2ket01|j_{2}\rangle=|01\rangle| italic_j start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ⟩ = | 01 ⟩, |j3=|10ketsubscript𝑗3ket10|j_{3}\rangle=|10\rangle| italic_j start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT ⟩ = | 10 ⟩, and |j4=|11ketsubscript𝑗4ket11|j_{4}\rangle=|11\rangle| italic_j start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT ⟩ = | 11 ⟩. The n𝑛nitalic_n-qubit quantum state |c(t)ket𝑐𝑡|c(t)\rangle| italic_c ( italic_t ) ⟩ at a time t𝑡titalic_t is consequently defined in a 2nsuperscript2𝑛2^{n}2 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT-dimensional tensor product Hilbert space =(2)nsuperscriptsuperscript2tensor-productabsent𝑛{\cal H}=(\mathbb{C}^{2})^{\otimes n}caligraphic_H = ( blackboard_C start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT ⊗ italic_n end_POSTSUPERSCRIPT and given by

|c(t)=k=12nck(t)|jkwithk=12n|ck(t)|2=1.\lvert c(t)\rangle=\sum\limits_{k=1}^{2^{n}}c_{k}(t)\lvert j_{k}\rangle\hskip 1% 0.00002pt\text{with}\hskip 10.00002pt\sum\limits_{k=1}^{2^{n}}|c_{k}(t)|^{2}=1\,.| italic_c ( italic_t ) ⟩ = ∑ start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT italic_c start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ( italic_t ) | italic_j start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ⟩ with ∑ start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT | italic_c start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ( italic_t ) | start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT = 1 . (33)

In other words, when connecting this formalism to the present flow problem, the discretization of the concentration profile c(x,t)𝑐𝑥𝑡c(x,t)italic_c ( italic_x , italic_t ) on N=2n𝑁superscript2𝑛N=2^{n}italic_N = 2 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT grid points at time t𝑡titalic_t is obtained by an n𝑛nitalic_n-qubit quantum state vector. In eq. (33), the quantum state vector is normalized to 1. Technically, the square magnitude of each coefficient represents the probability of measuring the respective basis state. Thereby, they naturally have to sum up to 1. For a classical concentration profile this does not have to be the case; see subsection 4.2. The time evolution of the state vector in quantum algorithms is established by unitary transformations or operators U^^𝑈\hat{U}over^ start_ARG italic_U end_ARG with U^1=U^superscript^𝑈1superscript^𝑈\hat{U}^{-1}=\hat{U}^{\dagger}over^ start_ARG italic_U end_ARG start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT = over^ start_ARG italic_U end_ARG start_POSTSUPERSCRIPT † end_POSTSUPERSCRIPT, realized on a quantum computer by a sequence of quantum gates. These gates can be viewed as rotation operators on quantum state vectors that can also generate entanglement between qubit states Nielsen and Chuang (2011).

Note that the accuracy of the quantum algorithms depends on the accuracy of the numerical input data described in Sec. 3. For the comparison of the quantum algorithms, the analytical solution, which we derived in Sec. 2, is also considered.

4.1 Quantum Linear Systems Algorithm (QLSA)

Refer to caption
(a)
Refer to caption
(b)
Figure 2: (a) A sketch of the quantum circuit depicting the QLSA-1 architecture. The horizontal lines in the diagram stand either for individual qubits or collections of several qubits, so-called quantum registers. Boxes across qubits stand for parametric circuits, collections of multiple unitary transformations on a single or multiple qubits. These are from left to right Quantum State Preparation (QSP), Quantum Phase Estimation (QPE), Conditional Rotation and inverse Quantum Phase Estimation (IQPE). (b) A sketch depicting the hybrid workflow of the QLSA algorithm. The classical preparation of the matrix elements and pre-conditioning is done classically. Then, on the quantum simulator the quantum states are prepared and processed with quantum state preparation (QSP) and QLSA, respectively. The solutions are measured or post processed at the quantum level and read into the classical machine. The residue and convergence checks are made classically and the solutions are post-processed when the iterations have finished or converged.

Quantum algorithms which solve a linear system of equations of the form, A𝐱=𝐛𝐴𝐱𝐛A\mathbf{x}=\mathbf{b}italic_A bold_x = bold_b, belong to the category of Quantum Linear Systems Algorithm (QLSA). All such algorithms Harrow et al. (2009); Childs et al. (2017, 2021) (excluding variational methods, which will be described subsequently in Sec. 4.2) can be broadly categorized into two approaches which compute a quantum-numerical approximation to A1𝐛superscript𝐴1𝐛A^{-1}\mathbf{b}italic_A start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT bold_b (BTCS) or A𝐱𝐴𝐱A\mathbf{x}italic_A bold_x (FTCS). The approach presented here, which we call QLSA-1, is a modified version of the original HHL algorithm Harrow et al. (2009). Here, we compute the eigenvalues (σjsubscript𝜎𝑗\sigma_{j}italic_σ start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT) of the matrix A𝐴Aitalic_A and thereby approximate the solution A1𝐛superscript𝐴1𝐛A^{-1}\mathbf{b}italic_A start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT bold_b. The central computational issue here is to identify the eigenvalues of A𝐴Aitalic_A and the following evaluation of their inverse. An alternative algorithm we call QLSA-2 proceeds by approximating the action of the matrix A𝐴Aitalic_A (or A1superscript𝐴1A^{-1}italic_A start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT) as purely a matrix-vector multiplication operation, implemented by decomposing the matrix into a Linear Combination of Unitary (LCU) quantum gates Childs et al. (2017), acting on a suitably prepared quantum state. The central goal in that case is to find the best unitary basis to produce a probabilistic implementation of the matrix. Both methods have been implemented on QFlowS in Bharadwaj and Sreenivasan (2023) to solve laminar Poiseuille and Couette flows. The solution c(t)𝑐𝑡c(t)italic_c ( italic_t ) can be obtained either iteratively at every time-step or by one-shot QLSA algorithms that would offer higher quantum advantage Liu et al. (2021); Bharadwaj and Sreenivasan (2023). However, the latter strategy can be computationally expensive to simulate large system sizes over long integration times. For our present purposes, we present results for QLSA-1 using the former approach.

The QLSA-1 algorithm is implemented as a full gate-level circuit simulation with at most single qubit or (double) controlled NOT gates Nielsen and Chuang (2011) to integrate eq. (2) using the BTCS method. The outline of the algorithm’s work flow and its circuit is shown in Fig. 2. It comprises the steps or quantum sub-routines briefly outlined below (whose details can be found in Bharadwaj and Sreenivasan (2023)). The herein flow problem has the matrix A of eq. (29), which is not Hermitian if advection is present, namely U0(s0)U\neq 0\ (\Rightarrow s\neq 0)italic_U ≠ 0 ( ⇒ italic_s ≠ 0 ). Since the algorithm admits only Hermitian matrices, the matrix A𝐴Aitalic_A is first extended to an Hermitian classically as

A~=(0AA0).~𝐴matrix0𝐴superscript𝐴0\tilde{A}=\begin{pmatrix}0&A\\ A^{{\dagger}}&0\end{pmatrix}.over~ start_ARG italic_A end_ARG = ( start_ARG start_ROW start_CELL 0 end_CELL start_CELL italic_A end_CELL end_ROW start_ROW start_CELL italic_A start_POSTSUPERSCRIPT † end_POSTSUPERSCRIPT end_CELL start_CELL 0 end_CELL end_ROW end_ARG ) . (34)

The implementation involves the following steps.

Step 1 - Quantum State Preparation (QSP): The concentration field at every time step m𝑚mitalic_m is loaded onto an (n+1)𝑛1(n+1)( italic_n + 1 )-qubit (=nbabsentsubscript𝑛𝑏=n_{b}= italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT from here on) state proportional 𝐜~m=[𝐜m;0]𝐜m21superscript~𝐜𝑚superscript𝐜𝑚0superscriptsubscriptnormsuperscript𝐜𝑚21\tilde{\mathbf{c}}^{m}=[\mathbf{c}^{m};0]\,\|\mathbf{c}^{m}\|_{2}^{-1}over~ start_ARG bold_c end_ARG start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT = [ bold_c start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT ; 0 ] ∥ bold_c start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT ∥ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT to make it compatible with eq. (34) (and therefore one expects the solution state in the form 𝐱=[0;𝐜m+1]𝐱0superscript𝐜𝑚1\mathbf{x}=[0;\mathbf{c}^{m+1}]bold_x = [ 0 ; bold_c start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT ]). As will be described shortly, the algorithm also requires an additional nq+1subscript𝑛𝑞1n_{q}+1italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT + 1 ancillary qubits. The latter are helper qubits or in short ancillas. All these qubits that are initially set to basis state |0ket0|0\rangle| 0 ⟩, are then initialized using either the functional form type state preparation or the sparse-state preparation oracle U^QSPsubscript^𝑈QSP\hat{U}_{\rm QSP}over^ start_ARG italic_U end_ARG start_POSTSUBSCRIPT roman_QSP end_POSTSUBSCRIPT (see Sec. 3 of SI Appendix in Bharadwaj and Sreenivasan (2023)),

|ψSTEP1=U^QSP|0nb+nq+1=|c~(t)nb|0nq|0.ketsubscript𝜓STEP1subscript^𝑈QSPsubscriptket0subscript𝑛𝑏subscript𝑛𝑞1tensor-productsubscriptket~𝑐𝑡subscript𝑛𝑏subscriptket0subscript𝑛𝑞ket0|\psi_{\text{STEP1}}\rangle=\ \hat{U}_{\rm QSP}|0\rangle_{n_{b}+n_{q}+1}=\ |% \tilde{c}(t)\rangle_{n_{b}}\otimes|0\rangle_{n_{q}}\otimes|0\rangle.| italic_ψ start_POSTSUBSCRIPT STEP1 end_POSTSUBSCRIPT ⟩ = over^ start_ARG italic_U end_ARG start_POSTSUBSCRIPT roman_QSP end_POSTSUBSCRIPT | 0 ⟩ start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT + italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT + 1 end_POSTSUBSCRIPT = | over~ start_ARG italic_c end_ARG ( italic_t ) ⟩ start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUBSCRIPT ⊗ | 0 ⟩ start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT end_POSTSUBSCRIPT ⊗ | 0 ⟩ . (35)

Step 2 - Quantum Phase Estimation (QPE): Given a linear operator U𝑈Uitalic_U, if eiπσsuperscript𝑒𝑖𝜋𝜎e^{i\pi\sigma}italic_e start_POSTSUPERSCRIPT italic_i italic_π italic_σ end_POSTSUPERSCRIPT is an eigenvalue, the QPE essentially estimates the phase angle σ𝜎\sigmaitalic_σ as a binary representation nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT-bit |φ1φ2φnqketsubscript𝜑1subscript𝜑2subscript𝜑subscript𝑛𝑞|\varphi_{1}\varphi_{2}\cdots\varphi_{n_{q}}\rangle| italic_φ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT italic_φ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ⋯ italic_φ start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT end_POSTSUBSCRIPT ⟩, φk{0,1}for-allsubscript𝜑𝑘01\forall\varphi_{k}\in\{0,1\}∀ italic_φ start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∈ { 0 , 1 }. Using this algorithm, an nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT-bit binary approximation to the eigenvalues σ~jsubscript~𝜎𝑗\tilde{\sigma}_{j}over~ start_ARG italic_σ end_ARG start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT of A~~𝐴\tilde{A}over~ start_ARG italic_A end_ARG is computed. For this purpose, we first rescale the matrix by a suitable value so that its eigenvalues lie in a range that is optimal for the algorithm’s performance Bharadwaj and Sreenivasan (2023); Childs et al. (2021), and, in addition, is a subset of [0.5,0.5]0.50.5[-0.5,0.5][ - 0.5 , 0.5 ], to obtain the matrix A¯¯𝐴\bar{A}over¯ start_ARG italic_A end_ARG. To now invoke QPE, this matrix is exponentiated as eiA¯T0superscript𝑒𝑖¯𝐴subscript𝑇0e^{i\bar{A}T_{0}}italic_e start_POSTSUPERSCRIPT italic_i over¯ start_ARG italic_A end_ARG italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT end_POSTSUPERSCRIPT to form a linear unitary operator, where T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT is the Hamiltonian simulation time Harrow et al. (2009); Nielsen and Chuang (2011). This parameter can be regarded as a scaling parameter that rescales the eigenvalues of A¯¯𝐴\bar{A}over¯ start_ARG italic_A end_ARG such that the eigenvalues σ¯jsubscript¯𝜎𝑗\bar{\sigma}_{j}over¯ start_ARG italic_σ end_ARG start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT can be represented nearly exactly using an nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT-bit binary state with minimal truncation error. The matrix A¯¯𝐴\bar{A}over¯ start_ARG italic_A end_ARG can be expanded in the eigenbasis |vjvj|ketsubscript𝑣𝑗brasubscript𝑣𝑗|v_{j}\rangle\langle v_{j}|| italic_v start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ⟩ ⟨ italic_v start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT | such that

eiA¯T0:=j=12nbeiσ¯jT0|vjvj|.assignsuperscript𝑒𝑖¯𝐴subscript𝑇0superscriptsubscript𝑗1superscript2subscript𝑛𝑏superscript𝑒𝑖subscript¯𝜎𝑗subscript𝑇0ketsubscript𝑣𝑗brasubscript𝑣𝑗e^{i\bar{A}T_{0}}:=\sum\limits_{j=1}^{2^{n_{b}}}e^{i\bar{\sigma}_{j}T_{0}}|{v_% {j}}\rangle\langle{v_{j}}|.italic_e start_POSTSUPERSCRIPT italic_i over¯ start_ARG italic_A end_ARG italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT end_POSTSUPERSCRIPT := ∑ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT italic_e start_POSTSUPERSCRIPT italic_i over¯ start_ARG italic_σ end_ARG start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT end_POSTSUPERSCRIPT | italic_v start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ⟩ ⟨ italic_v start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT | . (36)

Following this, the QPE then produces the state proportional to

|ψSTEP2=j=12nb𝐜^jm|vjnb|σ¯j0nq|0,ketsubscript𝜓STEP2superscriptsubscript𝑗1superscript2subscript𝑛𝑏tensor-productsuperscriptsubscript^𝐜𝑗𝑚subscriptketsubscript𝑣𝑗subscript𝑛𝑏subscriptketsubscript¯𝜎𝑗0subscript𝑛𝑞ket0|\psi_{\text{STEP2}}\rangle=\sum\limits_{j=1}^{2^{n_{b}}}\hat{\mathbf{c}}_{j}^% {m}|v_{j}\rangle_{n_{b}}\otimes|\bar{\sigma}_{j0}\rangle_{n_{q}}\otimes|0\rangle,| italic_ψ start_POSTSUBSCRIPT STEP2 end_POSTSUBSCRIPT ⟩ = ∑ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT over^ start_ARG bold_c end_ARG start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT | italic_v start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ⟩ start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUBSCRIPT ⊗ | over¯ start_ARG italic_σ end_ARG start_POSTSUBSCRIPT italic_j 0 end_POSTSUBSCRIPT ⟩ start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT end_POSTSUBSCRIPT ⊗ | 0 ⟩ , (37)

where σ¯j0=σ¯jT0subscript¯𝜎𝑗0subscript¯𝜎𝑗subscript𝑇0\bar{\sigma}_{j0}=\bar{\sigma}_{j}T_{0}over¯ start_ARG italic_σ end_ARG start_POSTSUBSCRIPT italic_j 0 end_POSTSUBSCRIPT = over¯ start_ARG italic_σ end_ARG start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT are the binary represented eigenvalues of A rescaled by T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT while 𝐜^jmsuperscriptsubscript^𝐜𝑗𝑚\hat{\mathbf{c}}_{j}^{m}over^ start_ARG bold_c end_ARG start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT are the coefficients of the normalized 𝐜~msuperscript~𝐜𝑚\tilde{\mathbf{c}}^{m}over~ start_ARG bold_c end_ARG start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT generated by rotating into the basis of A’s eigenvectors |vjketsubscript𝑣𝑗|v_{j}\rangle| italic_v start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ⟩.

Step 3 - Conditional Rotation: Here we apply a relative rotation operator on the last ancilla qubit, conditioned on σ¯jsubscript¯𝜎𝑗\bar{\sigma}_{j}over¯ start_ARG italic_σ end_ARG start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT to compute the inverse 1/σ¯1¯𝜎1/\bar{\sigma}1 / over¯ start_ARG italic_σ end_ARG,

|ψSTEP3=j=12nb𝐜^jm|vjnb|σ¯j0nq(1K2σ¯j02|0+Kσ¯j0|1)ketsubscript𝜓STEP3superscriptsubscript𝑗1superscript2subscript𝑛𝑏tensor-productsuperscriptsubscript^𝐜𝑗𝑚subscriptketsubscript𝑣𝑗subscript𝑛𝑏subscriptketsubscript¯𝜎𝑗0subscript𝑛𝑞1superscript𝐾2superscriptsubscript¯𝜎𝑗02ket0𝐾subscript¯𝜎𝑗0ket1|\psi_{\text{STEP3}}\rangle=\sum\limits_{j=1}^{2^{n_{b}}}\hat{\mathbf{c}}_{j}^% {m}|v_{j}\rangle_{n_{b}}\otimes|\bar{\sigma}_{j0}\rangle_{n_{q}}\otimes\Bigg{(% }\sqrt{1-\frac{K^{2}}{\bar{\sigma}_{j0}^{2}}}|0\rangle+\frac{K}{\bar{\sigma}_{% j0}}|1\rangle\Bigg{)}| italic_ψ start_POSTSUBSCRIPT STEP3 end_POSTSUBSCRIPT ⟩ = ∑ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT over^ start_ARG bold_c end_ARG start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT | italic_v start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ⟩ start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUBSCRIPT ⊗ | over¯ start_ARG italic_σ end_ARG start_POSTSUBSCRIPT italic_j 0 end_POSTSUBSCRIPT ⟩ start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT end_POSTSUBSCRIPT ⊗ ( square-root start_ARG 1 - divide start_ARG italic_K start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG over¯ start_ARG italic_σ end_ARG start_POSTSUBSCRIPT italic_j 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG end_ARG | 0 ⟩ + divide start_ARG italic_K end_ARG start_ARG over¯ start_ARG italic_σ end_ARG start_POSTSUBSCRIPT italic_j 0 end_POSTSUBSCRIPT end_ARG | 1 ⟩ ) (38)

where K𝐾Kitalic_K is a suitably chosen normalization constant.
Step 4: Finally, we perform the inverse QPE (IQPE) operation to reset nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT to |0ket0|0\rangle| 0 ⟩, and follow it up by a measurement of the last ancilla qubit in the computational basis, producing a state proportional to

|𝐜m+1R×1j=02nb1|bj|2/|σ¯j0|2j=12nb𝐜^jmσ¯j0|vjnb|0nq|1,similar-toketsuperscript𝐜𝑚1𝑅1superscriptsubscript𝑗0superscript2subscript𝑛𝑏1superscriptsubscript𝑏𝑗2superscriptsubscript¯𝜎𝑗02superscriptsubscript𝑗1superscript2subscript𝑛𝑏tensor-productsubscriptsuperscript^𝐜𝑚𝑗subscript¯𝜎𝑗0subscriptketsubscript𝑣𝑗subscript𝑛𝑏subscriptket0subscript𝑛𝑞ket1{|\mathbf{c}^{m+1}\rangle}\sim R\times\sqrt{\dfrac{1}{\sum\limits_{j=0}^{2^{n_% {b}-1}}|b_{j}|^{2}/|\bar{\sigma}_{j0}|^{2}}}\,\sum\limits_{j=1}^{2^{n_{b}}}% \frac{\hat{\textbf{c}}^{m}_{j}}{\bar{\sigma}_{j0}}|v_{j}\rangle_{n_{b}}\otimes% |0\rangle_{n_{q}}\otimes|1\rangle\,,| bold_c start_POSTSUPERSCRIPT italic_m + 1 end_POSTSUPERSCRIPT ⟩ ∼ italic_R × square-root start_ARG divide start_ARG 1 end_ARG start_ARG ∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT - 1 end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT | italic_b start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT | start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT / | over¯ start_ARG italic_σ end_ARG start_POSTSUBSCRIPT italic_j 0 end_POSTSUBSCRIPT | start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG end_ARG ∑ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT divide start_ARG over^ start_ARG c end_ARG start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT end_ARG start_ARG over¯ start_ARG italic_σ end_ARG start_POSTSUBSCRIPT italic_j 0 end_POSTSUBSCRIPT end_ARG | italic_v start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ⟩ start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUBSCRIPT ⊗ | 0 ⟩ start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT end_POSTSUBSCRIPT ⊗ | 1 ⟩ , (39)

where R𝑅Ritalic_R is the corresponding rescaling constant to extract the solution appropriately. The solution can now either be read into classical formats by sampling every component of the wavefunction from performing multiple runs of the circuit (so-called shots), or the state can also be post-processed within the quantum simulator to estimate linear and nonlinear functions of the concentration field as shown in Bharadwaj and Sreenivasan (2023). This would help conserve a certain degree of quantum advantage. In any case, the results are then finally assimilated in the classical device for post processing and output.

4.2 Variational Quantum Algorithm (VQA)

The variational quantum algorithm (VQA) is a hybrid quantum-classical algorithm where a parameterized cost function C𝐶Citalic_C is minimized by an optimizer Cerezo et al. (2021). While the cost function is evaluated by a quantum circuit composed of single- and two-qubit gates, the optimization is performed classically. This defines the hybrid character of the algorithm. The general principle of the VQA is shown in Fig. 3. The initial parameter set (λ0,𝝀)initsubscriptsubscript𝜆0𝝀init(\lambda_{0},{\bm{\lambda}})_{\text{init}}( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ) start_POSTSUBSCRIPT init end_POSTSUBSCRIPT, which consists of the normalization factor λ0subscript𝜆0\lambda_{0}italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and the angles of the single-qubit unitary rotation gates 𝝀=(λ1,λ2,)𝝀subscript𝜆1subscript𝜆2{\bm{\lambda}}=(\lambda_{1},\lambda_{2},\dots)bold_italic_λ = ( italic_λ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_λ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … ), is the input to the algorithm. Then, a cost function C(λ0,𝝀)𝐶subscript𝜆0𝝀C(\lambda_{0},{\bm{\lambda}})italic_C ( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ), which is parameterized with (λ0,𝝀)subscript𝜆0𝝀(\lambda_{0},{\bm{\lambda}})( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ), is evaluated on a quantum device. For our approach, a classical device adds results of multiple quantum circuits together to generate the final cost. The minimum of the cost function corresponds to the solution of the considered problem. This solution is modeled by a quantum ansatz function U^(𝝀)^𝑈𝝀\hat{U}({\bm{\lambda}})over^ start_ARG italic_U end_ARG ( bold_italic_λ ) which is initialized with the parameter set 𝝀𝝀{\bm{\lambda}}bold_italic_λ. Measurements of the quantum circuits evaluate the costs. These costs are minimized with an classical optimizer. The optimal parameter set (λ0*,𝝀*)superscriptsubscript𝜆0superscript𝝀(\lambda_{0}^{*},{\bm{\lambda}}^{*})( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT * end_POSTSUPERSCRIPT , bold_italic_λ start_POSTSUPERSCRIPT * end_POSTSUPERSCRIPT ) initializes the ansatz function such that the solution of the given problem can be observed Cerezo et al. (2021).

Refer to caption
Figure 3: Principal sketch of the Variational Quantum Algorithm (VQA) which interacts between a quantum computational cost evaluation and a classical supervised parameter update. Here, (λ0,𝝀)subscript𝜆0𝝀(\lambda_{0},{\bm{\lambda}})( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ) is the parameter vector which is optimized, C(λ0,𝝀)𝐶subscript𝜆0𝝀C(\lambda_{0},{\bm{\lambda}})italic_C ( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ) is the cost function, U^(𝝀)^𝑈𝝀\hat{U}({\bm{\lambda}})over^ start_ARG italic_U end_ARG ( bold_italic_λ ) is the quantum ansatz function and (λ0*,𝝀*)superscriptsubscript𝜆0superscript𝝀(\lambda_{0}^{*},{\bm{\lambda}}^{*})( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT * end_POSTSUPERSCRIPT , bold_italic_λ start_POSTSUPERSCRIPT * end_POSTSUPERSCRIPT ) is the optimal parameter vector, which corresponds with the minimum of the cost function, hence with the solution of the considered problem. The output of the quantum simulator results from measurements of the quantum Hadamard test circuit which is indicated in the quantum simulator block.

Note that VQA can also straightforwardly be applied to nonlinear equations Lubasch et al. (2020); Pool et al. (2022). In order to derive the cost function for the present advection-diffusion problem, the discrete concentration profile is transformed in vector notation such that eq. (2) can be written explicitly as in Euler type FTCS methods by

|c(t+τ)=(𝟙+τO^)|c(t),ket𝑐𝑡𝜏1𝜏^𝑂ket𝑐𝑡\displaystyle|c(t+\tau)\rangle=(\mathds{1}+\tau\hat{O})|c(t)\rangle,| italic_c ( italic_t + italic_τ ) ⟩ = ( blackboard_1 + italic_τ over^ start_ARG italic_O end_ARG ) | italic_c ( italic_t ) ⟩ , (40)

with the linear operator O^=Dx2Ux^𝑂𝐷subscriptsuperscript2𝑥𝑈subscript𝑥\hat{O}=D\partial^{2}_{x}-U\partial_{x}over^ start_ARG italic_O end_ARG = italic_D ∂ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT - italic_U ∂ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT and the identity operator 𝟙1\mathds{1}blackboard_1. Then, the corresponding cost function C𝐶Citalic_C can be found as

C(|c(t+τ))=|c(t+τ)(𝟙+τO^)|c(t)22,𝐶ket𝑐𝑡𝜏superscriptsubscriptnormket𝑐𝑡𝜏1𝜏^𝑂ket𝑐𝑡22\displaystyle C(|c(t+\tau)\rangle)=\||c(t+\tau)\rangle-(\mathds{1}+\tau\hat{O}% )|c(t)\rangle\|_{2}^{2},italic_C ( | italic_c ( italic_t + italic_τ ) ⟩ ) = ∥ | italic_c ( italic_t + italic_τ ) ⟩ - ( blackboard_1 + italic_τ over^ start_ARG italic_O end_ARG ) | italic_c ( italic_t ) ⟩ ∥ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT , (41)

where the minimum of the cost function C𝐶Citalic_C corresponds to the solution |c(t+τ)ket𝑐𝑡𝜏|c(t+\tau)\rangle| italic_c ( italic_t + italic_τ ) ⟩. Following Lubasch et al. Lubasch et al. (2020), we define

|c(t+τ)ket𝑐𝑡𝜏\displaystyle|c(t+\tau)\rangle| italic_c ( italic_t + italic_τ ) ⟩ =λ0|ψ(𝝀)=λ0U^(𝝀)|0,absentsubscript𝜆0ket𝜓𝝀subscript𝜆0^𝑈𝝀ket0\displaystyle=\lambda_{0}|\psi({\bm{\lambda}})\rangle=\lambda_{0}\hat{U}({\bm{% \lambda}})|0\rangle,= italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT | italic_ψ ( bold_italic_λ ) ⟩ = italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT over^ start_ARG italic_U end_ARG ( bold_italic_λ ) | 0 ⟩ , (42)
|c(t)ket𝑐𝑡\displaystyle|c(t)\rangle| italic_c ( italic_t ) ⟩ =λ~0|ψ~=λ~0U~^|0,absentsubscript~𝜆0ket~𝜓subscript~𝜆0^~𝑈ket0\displaystyle=\tilde{\lambda}_{0}|\tilde{\psi}\rangle=\tilde{\lambda}_{0}\hat{% \tilde{U}}|0\rangle,= over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT | over~ start_ARG italic_ψ end_ARG ⟩ = over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT over^ start_ARG over~ start_ARG italic_U end_ARG end_ARG | 0 ⟩ , (43)

where 𝝀𝝀{\bm{\lambda}}bold_italic_λ is the parameter vector which initializes the quantum ansatz for the solution |c(t+τ)ket𝑐𝑡𝜏|c(t+\tau)\rangle| italic_c ( italic_t + italic_τ ) ⟩. The quantum states |ψket𝜓|\psi\rangle| italic_ψ ⟩ are normalized, such that ψ22=1superscriptsubscriptnorm𝜓221\|\psi\|_{2}^{2}=1∥ italic_ψ ∥ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT = 1, while for the concentration profile holds

LLc(x,t)dx=constk=12nck=1.\int_{-L}^{L}c(x,t)dx=\mbox{const}\quad\Rightarrow\sum_{k=1}^{2^{n}}c_{k}=1\,.∫ start_POSTSUBSCRIPT - italic_L end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT italic_c ( italic_x , italic_t ) italic_d italic_x = const ⇒ ∑ start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT italic_c start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT = 1 . (44)

The constant is 1 for the present case due to c(x,0)=δ(x)𝑐𝑥0𝛿𝑥c(x,0)=\delta(x)italic_c ( italic_x , 0 ) = italic_δ ( italic_x ). In order to fulfill both constraints, normalization parameters, λ0subscript𝜆0\lambda_{0}italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and λ~0subscript~𝜆0\tilde{\lambda}_{0}over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT are introduced. In the present work we will rescale our solution to an L2subscript𝐿2L_{2}italic_L start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT-norm of 1 to be directly comparable to the QLSA case. Thus eq. (41) results in

C(λ0,𝝀)=λ0|ψ(𝝀)λ~0(𝟙+τO^)|ψ~22.𝐶subscript𝜆0𝝀superscriptsubscriptnormsubscript𝜆0ket𝜓𝝀subscript~𝜆01𝜏^𝑂ket~𝜓22\displaystyle C(\lambda_{0},{\bm{\lambda}})=\|\lambda_{0}|\psi({\bm{\lambda}})% \rangle-\tilde{\lambda}_{0}(\mathds{1}+\tau\hat{O})|\tilde{\psi}\rangle\|_{2}^% {2}.italic_C ( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ) = ∥ italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT | italic_ψ ( bold_italic_λ ) ⟩ - over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ( blackboard_1 + italic_τ over^ start_ARG italic_O end_ARG ) | over~ start_ARG italic_ψ end_ARG ⟩ ∥ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT . (45)

The norm is evaluated by the scalar product and gives

C(λ0,𝝀)𝐶subscript𝜆0𝝀\displaystyle C(\lambda_{0},{\bm{\lambda}})italic_C ( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ) =λ02ψ(𝝀)|ψ(𝝀)=12λ0λ~0ψ(𝝀)|(𝟙+τO^)ψ~absentsuperscriptsubscript𝜆02subscriptinner-product𝜓𝝀𝜓𝝀absent12subscript𝜆0subscript~𝜆0inner-product𝜓𝝀1𝜏^𝑂~𝜓\displaystyle=\lambda_{0}^{2}\underbrace{\langle\psi({\bm{\lambda}})|\psi({\bm% {\lambda}})\rangle}_{=1}-2\lambda_{0}\tilde{\lambda}_{0}\langle\psi({\bm{% \lambda}})|(\mathds{1}+\tau\hat{O})\tilde{\psi}\rangle= italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT under⏟ start_ARG ⟨ italic_ψ ( bold_italic_λ ) | italic_ψ ( bold_italic_λ ) ⟩ end_ARG start_POSTSUBSCRIPT = 1 end_POSTSUBSCRIPT - 2 italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ⟨ italic_ψ ( bold_italic_λ ) | ( blackboard_1 + italic_τ over^ start_ARG italic_O end_ARG ) over~ start_ARG italic_ψ end_ARG ⟩ (46)
+λ~02ψ~|(𝟙+τO^)(𝟙+τO^)|ψ~=const.subscriptsuperscriptsubscript~𝜆02quantum-operator-product~𝜓superscript1𝜏^𝑂1𝜏^𝑂~𝜓absentconst.\displaystyle+\underbrace{\tilde{\lambda}_{0}^{2}\langle\tilde{\psi}|(\mathds{% 1}+\tau\hat{O})^{\dagger}(\mathds{1}+\tau\hat{O})|\tilde{\psi}\rangle}_{=\text% {const.}}+ under⏟ start_ARG over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ⟨ over~ start_ARG italic_ψ end_ARG | ( blackboard_1 + italic_τ over^ start_ARG italic_O end_ARG ) start_POSTSUPERSCRIPT † end_POSTSUPERSCRIPT ( blackboard_1 + italic_τ over^ start_ARG italic_O end_ARG ) | over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = const. end_POSTSUBSCRIPT

The last term is constant for each time step because it depends only on |ψ~ket~𝜓|\tilde{\psi}\rangle| over~ start_ARG italic_ψ end_ARG ⟩ and λ~02superscriptsubscript~𝜆02\tilde{\lambda}_{0}^{2}over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT, which are fixed from the previous time step. A further decomposition of the scalar product leads to

C(λ0,𝝀)𝐶subscript𝜆0𝝀\displaystyle C(\lambda_{0},{\bm{\lambda}})italic_C ( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ) =λ022λ0λ~0[ψ(𝝀)|ψ~+τψ(𝝀)|O^ψ~]absentsuperscriptsubscript𝜆022subscript𝜆0subscript~𝜆0delimited-[]inner-product𝜓𝝀~𝜓𝜏inner-product𝜓𝝀^𝑂~𝜓\displaystyle=\lambda_{0}^{2}-2\lambda_{0}\tilde{\lambda}_{0}\left[\langle\psi% ({\bm{\lambda}})|\tilde{\psi}\rangle+\tau\langle\psi({\bm{\lambda}})|\hat{O}% \tilde{\psi}\rangle\right]= italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - 2 italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT [ ⟨ italic_ψ ( bold_italic_λ ) | over~ start_ARG italic_ψ end_ARG ⟩ + italic_τ ⟨ italic_ψ ( bold_italic_λ ) | over^ start_ARG italic_O end_ARG over~ start_ARG italic_ψ end_ARG ⟩ ]
+λ~02[1+2τψ~|O^ψ~+τ2ψ~|O^O^ψ~].superscriptsubscript~𝜆02delimited-[]12𝜏inner-product~𝜓^𝑂~𝜓superscript𝜏2inner-product~𝜓superscript^𝑂^𝑂~𝜓\displaystyle+\tilde{\lambda}_{0}^{2}\left[1+2\tau\langle\tilde{\psi}|\hat{O}% \tilde{\psi}\rangle+\tau^{2}\langle\tilde{\psi}|\hat{O}^{\dagger}\hat{O}\tilde% {\psi}\rangle\right]\,.+ over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT [ 1 + 2 italic_τ ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_O end_ARG over~ start_ARG italic_ψ end_ARG ⟩ + italic_τ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_O end_ARG start_POSTSUPERSCRIPT † end_POSTSUPERSCRIPT over^ start_ARG italic_O end_ARG over~ start_ARG italic_ψ end_ARG ⟩ ] . (47)

The linear operator O^^𝑂\hat{O}over^ start_ARG italic_O end_ARG consists of 2 terms, the diffusion term and the advection term. Rather than implementing these terms directly, a 2nd-order finite difference discretization of both operators is used, which is in line with the discussion in Sec. 3. For this, the unitary shift operators ψi+1=S^+ψisubscript𝜓𝑖1subscript^𝑆subscript𝜓𝑖\psi_{i+1}=\hat{S}_{+}\psi_{i}italic_ψ start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT = over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT italic_ψ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and ψi1=S^ψisubscript𝜓𝑖1subscript^𝑆subscript𝜓𝑖\psi_{i-1}=\hat{S}_{-}\psi_{i}italic_ψ start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT = over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT italic_ψ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT are defined; see A for details. Note that thereby, the periodic boundary conditions are imposed. With the definition of these shift operators and 2l/Δx=N2𝑙Δ𝑥𝑁2l/\Delta x=N2 italic_l / roman_Δ italic_x = italic_N one gets

O^^𝑂\displaystyle\hat{O}over^ start_ARG italic_O end_ARG =DN2(S^+2𝟙+S^)UN2(S^+S^)absent𝐷superscript𝑁2subscript^𝑆21subscript^𝑆𝑈𝑁2subscript^𝑆subscript^𝑆\displaystyle=DN^{2}(\hat{S}_{+}-2\mathds{1}+\hat{S}_{-})-U\frac{N}{2}(\hat{S}% _{+}-\hat{S}_{-})= italic_D italic_N start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ( over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT - 2 blackboard_1 + over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT ) - italic_U divide start_ARG italic_N end_ARG start_ARG 2 end_ARG ( over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT - over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT )
=(DN2UN2=α)S^+2DN2=β𝟙+(DN2+UN2=γ)S^.absentsubscript𝐷superscript𝑁2𝑈𝑁2absent𝛼subscript^𝑆subscript2𝐷superscript𝑁2absent𝛽1subscript𝐷superscript𝑁2𝑈𝑁2absent𝛾subscript^𝑆\displaystyle=(\underbrace{DN^{2}-U\frac{N}{2}}_{=\alpha})\hat{S}_{+}-% \underbrace{2DN^{2}}_{=\beta}\mathds{1}+(\underbrace{DN^{2}+U\frac{N}{2}}_{=% \gamma})\hat{S}_{-}\,.= ( under⏟ start_ARG italic_D italic_N start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - italic_U divide start_ARG italic_N end_ARG start_ARG 2 end_ARG end_ARG start_POSTSUBSCRIPT = italic_α end_POSTSUBSCRIPT ) over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT - under⏟ start_ARG 2 italic_D italic_N start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_POSTSUBSCRIPT = italic_β end_POSTSUBSCRIPT blackboard_1 + ( under⏟ start_ARG italic_D italic_N start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_U divide start_ARG italic_N end_ARG start_ARG 2 end_ARG end_ARG start_POSTSUBSCRIPT = italic_γ end_POSTSUBSCRIPT ) over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT . (48)

Consequently, the cost function can be written as a further decomposition of the scalar products, leading to the following summary of the cost function:

C(λ0,𝝀)=λ02𝐶subscript𝜆0𝝀superscriptsubscript𝜆02\displaystyle C(\lambda_{0},{\bm{\lambda}})=\lambda_{0}^{2}italic_C ( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ) = italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT 2λ0λ~0[(1τβ)ψ(𝝀)|ψ~+ταψ(𝝀)|S^+ψ~+τγψ(𝝀)|S^ψ~]2subscript𝜆0subscript~𝜆0delimited-[]1𝜏𝛽inner-product𝜓𝝀~𝜓𝜏𝛼inner-product𝜓𝝀subscript^𝑆~𝜓𝜏𝛾inner-product𝜓𝝀subscript^𝑆~𝜓\displaystyle-2\lambda_{0}\tilde{\lambda}_{0}\bigg{[}(1-\tau\beta)\langle\psi(% {\bm{\lambda}})|\tilde{\psi}\rangle+\tau\alpha\langle\psi({\bm{\lambda}})|\hat% {S}_{+}\tilde{\psi}\rangle+\tau\gamma\langle\psi({\bm{\lambda}})|\hat{S}_{-}% \tilde{\psi}\rangle\bigg{]}- 2 italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT [ ( 1 - italic_τ italic_β ) ⟨ italic_ψ ( bold_italic_λ ) | over~ start_ARG italic_ψ end_ARG ⟩ + italic_τ italic_α ⟨ italic_ψ ( bold_italic_λ ) | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ + italic_τ italic_γ ⟨ italic_ψ ( bold_italic_λ ) | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ ]
+λ~02[1+2ταψ~|S^+ψ~2τβ+2τγψ~|S^ψ~=ψ~|S^+ψ~]superscriptsubscript~𝜆02delimited-[]12𝜏𝛼inner-product~𝜓subscript^𝑆~𝜓2𝜏𝛽2𝜏𝛾subscriptinner-product~𝜓subscript^𝑆~𝜓absentinner-product~𝜓subscript^𝑆~𝜓\displaystyle+\tilde{\lambda}_{0}^{2}\bigg{[}1+2\tau\alpha\langle\tilde{\psi}|% \hat{S}_{+}\tilde{\psi}\rangle-2\tau\beta+2\tau\gamma\underbrace{\langle\tilde% {\psi}|\hat{S}_{-}\tilde{\psi}\rangle}_{=\langle\tilde{\psi}|\hat{S}_{+}\tilde% {\psi}\rangle}\bigg{]}+ over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT [ 1 + 2 italic_τ italic_α ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ - 2 italic_τ italic_β + 2 italic_τ italic_γ under⏟ start_ARG ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_POSTSUBSCRIPT ]
+λ~02τ2[α2S^+ψ~|S^+ψ~=1αβS^+ψ~|ψ~=ψ~|S^+ψ~+αγS^+ψ~|S^ψ~=ψ~|S^++ψ~]superscriptsubscript~𝜆02superscript𝜏2delimited-[]superscript𝛼2subscriptinner-productsubscript^𝑆~𝜓subscript^𝑆~𝜓absent1𝛼𝛽subscriptinner-productsubscript^𝑆~𝜓~𝜓absentinner-product~𝜓subscript^𝑆~𝜓𝛼𝛾subscriptinner-productsubscript^𝑆~𝜓subscript^𝑆~𝜓absentinner-product~𝜓subscript^𝑆absent~𝜓\displaystyle+\tilde{\lambda}_{0}^{2}\tau^{2}\bigg{[}\alpha^{2}\underbrace{% \langle\hat{S}_{+}\tilde{\psi}|\hat{S}_{+}\tilde{\psi}\rangle}_{=1}-\alpha% \beta\underbrace{\langle\hat{S}_{+}\tilde{\psi}|\tilde{\psi}\rangle}_{=\langle% \tilde{\psi}|\hat{S}_{+}\tilde{\psi}\rangle}+\alpha\gamma\underbrace{\langle% \hat{S}_{+}\tilde{\psi}|\hat{S}_{-}\tilde{\psi}\rangle}_{=\langle\tilde{\psi}|% \hat{S}_{++}\tilde{\psi}\rangle}\bigg{]}+ over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_τ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT [ italic_α start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT under⏟ start_ARG ⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = 1 end_POSTSUBSCRIPT - italic_α italic_β under⏟ start_ARG ⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_POSTSUBSCRIPT + italic_α italic_γ under⏟ start_ARG ⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_POSTSUBSCRIPT ]
+λ~02τ2[βαψ~|S^+ψ~+β2ψ~|ψ~=𝟙βγψ~|S^ψ~=ψ~|S^+ψ~]superscriptsubscript~𝜆02superscript𝜏2delimited-[]𝛽𝛼inner-product~𝜓subscript^𝑆~𝜓superscript𝛽2subscriptinner-product~𝜓~𝜓absent1𝛽𝛾subscriptinner-product~𝜓subscript^𝑆~𝜓absentinner-product~𝜓subscript^𝑆~𝜓\displaystyle+\tilde{\lambda}_{0}^{2}\tau^{2}\bigg{[}-\beta\alpha\langle\tilde% {\psi}|\hat{S}_{+}\tilde{\psi}\rangle+\beta^{2}\underbrace{\langle\tilde{\psi}% |\tilde{\psi}\rangle}_{=\mathds{1}}-\beta\gamma\underbrace{\langle\tilde{\psi}% |\hat{S}_{-}\tilde{\psi}\rangle}_{=\langle\tilde{\psi}|\hat{S}_{+}\tilde{\psi}% \rangle}\bigg{]}+ over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_τ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT [ - italic_β italic_α ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ + italic_β start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT under⏟ start_ARG ⟨ over~ start_ARG italic_ψ end_ARG | over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = blackboard_1 end_POSTSUBSCRIPT - italic_β italic_γ under⏟ start_ARG ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_POSTSUBSCRIPT ]
+λ~02τ2[γαS^ψ~|S^+ψ~=ψ~|S^++ψ~γβS^ψ~|ψ~=ψ~|S^+ψ~+γ2S^ψ~|S^ψ~=1].superscriptsubscript~𝜆02superscript𝜏2delimited-[]𝛾𝛼subscriptinner-productsubscript^𝑆~𝜓subscript^𝑆~𝜓absentinner-product~𝜓subscript^𝑆absent~𝜓𝛾𝛽subscriptinner-productsubscript^𝑆~𝜓~𝜓absentinner-product~𝜓subscript^𝑆~𝜓superscript𝛾2subscriptinner-productsubscript^𝑆~𝜓subscript^𝑆~𝜓absent1\displaystyle+\tilde{\lambda}_{0}^{2}\tau^{2}\bigg{[}\gamma\alpha\underbrace{% \langle\hat{S}_{-}\tilde{\psi}|\hat{S}_{+}\tilde{\psi}\rangle}_{=\langle\tilde% {\psi}|\hat{S}_{++}\tilde{\psi}\rangle}-\gamma\beta\underbrace{\langle\hat{S}_% {-}\tilde{\psi}|\tilde{\psi}\rangle}_{=\langle\tilde{\psi}|\hat{S}_{+}\tilde{% \psi}\rangle}+\gamma^{2}\underbrace{\langle\hat{S}_{-}\tilde{\psi}|\hat{S}_{-}% \tilde{\psi}\rangle}_{=1}\bigg{]}\,.+ over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_τ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT [ italic_γ italic_α under⏟ start_ARG ⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_POSTSUBSCRIPT - italic_γ italic_β under⏟ start_ARG ⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_POSTSUBSCRIPT + italic_γ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT under⏟ start_ARG ⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = 1 end_POSTSUBSCRIPT ] . (49)

We use that S^+=S^1=S^subscript^𝑆superscriptsubscript^𝑆1superscriptsubscript^𝑆\hat{S}_{+}=\hat{S}_{-}^{-1}=\hat{S}_{-}^{\dagger}over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT = over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT = over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT start_POSTSUPERSCRIPT † end_POSTSUPERSCRIPT and S^=S^+subscript^𝑆superscriptsubscript^𝑆\hat{S}_{-}=\hat{S}_{+}^{\dagger}over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT = over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT start_POSTSUPERSCRIPT † end_POSTSUPERSCRIPT. This leads to the final cost function

C(λ0,𝝀)𝐶subscript𝜆0𝝀\displaystyle C(\lambda_{0},{\bm{\lambda}})italic_C ( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ) =λ022λ0λ~0[(1τβ)ψ(𝝀)|ψ~=C𝟙+ταψ(𝝀)|S^+ψ~=CS++τγψ(𝝀)|S^ψ~=CS]absentsuperscriptsubscript𝜆022subscript𝜆0subscript~𝜆0delimited-[]1𝜏𝛽subscriptinner-product𝜓𝝀~𝜓absentsubscript𝐶1𝜏𝛼subscriptinner-product𝜓𝝀subscript^𝑆~𝜓absentsubscript𝐶subscript𝑆𝜏𝛾subscriptinner-product𝜓𝝀subscript^𝑆~𝜓absentsubscript𝐶subscript𝑆\displaystyle=\lambda_{0}^{2}-2\lambda_{0}\tilde{\lambda}_{0}\bigg{[}(1-\tau% \beta)\underbrace{\langle\psi({\bm{\lambda}})|\tilde{\psi}\rangle}_{=C_{% \mathds{1}}}+\tau\alpha\underbrace{\langle\psi({\bm{\lambda}})|\hat{S}_{+}% \tilde{\psi}\rangle}_{=C_{S_{+}}}+\tau\gamma\underbrace{\langle\psi({\bm{% \lambda}})|\hat{S}_{-}\tilde{\psi}\rangle}_{=C_{S_{-}}}\bigg{]}= italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - 2 italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT [ ( 1 - italic_τ italic_β ) under⏟ start_ARG ⟨ italic_ψ ( bold_italic_λ ) | over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = italic_C start_POSTSUBSCRIPT blackboard_1 end_POSTSUBSCRIPT end_POSTSUBSCRIPT + italic_τ italic_α under⏟ start_ARG ⟨ italic_ψ ( bold_italic_λ ) | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = italic_C start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT + end_POSTSUBSCRIPT end_POSTSUBSCRIPT end_POSTSUBSCRIPT + italic_τ italic_γ under⏟ start_ARG ⟨ italic_ψ ( bold_italic_λ ) | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = italic_C start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT - end_POSTSUBSCRIPT end_POSTSUBSCRIPT end_POSTSUBSCRIPT ]
+λ~02[12τβ+2τ(α+γ)ψ~|S^+ψ~=C~S+]superscriptsubscript~𝜆02delimited-[]12𝜏𝛽2𝜏𝛼𝛾subscriptinner-product~𝜓subscript^𝑆~𝜓absentsubscript~𝐶subscript𝑆\displaystyle+\tilde{\lambda}_{0}^{2}\bigg{[}1-2\tau\beta+2\tau(\alpha+\gamma)% \underbrace{\langle\tilde{\psi}|\hat{S}_{+}\tilde{\psi}\rangle}_{=\tilde{C}_{S% _{+}}}\bigg{]}+ over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT [ 1 - 2 italic_τ italic_β + 2 italic_τ ( italic_α + italic_γ ) under⏟ start_ARG ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = over~ start_ARG italic_C end_ARG start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT + end_POSTSUBSCRIPT end_POSTSUBSCRIPT end_POSTSUBSCRIPT ]
+λ~02τ2[α2+β2+γ22β(α+γ)ψ~|S^+ψ~=C~S++2αγψ~|S^++ψ~=C~S++],superscriptsubscript~𝜆02superscript𝜏2delimited-[]superscript𝛼2superscript𝛽2superscript𝛾22𝛽𝛼𝛾subscriptinner-product~𝜓subscript^𝑆~𝜓absentsubscript~𝐶subscript𝑆2𝛼𝛾subscriptinner-product~𝜓subscript^𝑆absent~𝜓absentsubscript~𝐶subscript𝑆absent\displaystyle+\tilde{\lambda}_{0}^{2}\tau^{2}\bigg{[}\alpha^{2}+\beta^{2}+% \gamma^{2}-2\beta(\alpha+\gamma)\underbrace{\langle\tilde{\psi}|\hat{S}_{+}% \tilde{\psi}\rangle}_{=\tilde{C}_{S_{+}}}+2\alpha\gamma\underbrace{\langle% \tilde{\psi}|\hat{S}_{++}\tilde{\psi}\rangle}_{=\tilde{C}_{S_{++}}}\bigg{]},+ over~ start_ARG italic_λ end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_τ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT [ italic_α start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_β start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_γ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - 2 italic_β ( italic_α + italic_γ ) under⏟ start_ARG ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = over~ start_ARG italic_C end_ARG start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT + end_POSTSUBSCRIPT end_POSTSUBSCRIPT end_POSTSUBSCRIPT + 2 italic_α italic_γ under⏟ start_ARG ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ end_ARG start_POSTSUBSCRIPT = over~ start_ARG italic_C end_ARG start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT + + end_POSTSUBSCRIPT end_POSTSUBSCRIPT end_POSTSUBSCRIPT ] , (50)

where C𝟙subscript𝐶1C_{\mathds{1}}italic_C start_POSTSUBSCRIPT blackboard_1 end_POSTSUBSCRIPT expresses the contribution of the identity part and CS+/subscript𝐶subscript𝑆absentC_{S_{+/-}}italic_C start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT + / - end_POSTSUBSCRIPT end_POSTSUBSCRIPT the contribution of the shift parts. The contributions C~S+subscript~𝐶subscript𝑆\tilde{C}_{S_{+}}over~ start_ARG italic_C end_ARG start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT + end_POSTSUBSCRIPT end_POSTSUBSCRIPT and C~S++subscript~𝐶subscript𝑆absent\tilde{C}_{S_{++}}over~ start_ARG italic_C end_ARG start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT + + end_POSTSUBSCRIPT end_POSTSUBSCRIPT to the cost function depend on the solution of the previous time step only, and are hence constants. Note that these different terms are evaluated separately and summed classically to give the cost function. This means that one re-prepares the parametrized state a few times every integration time step.

The cost function is evaluated by an adaption of a fundamental quantum circuit, the so-called Hadamard test. In general, the Hadamard test provides an expectation value ψ|U^ψconditional𝜓^𝑈𝜓\Re\langle\psi|\hat{U}|\psi\rangleroman_ℜ ⟨ italic_ψ | over^ start_ARG italic_U end_ARG | italic_ψ ⟩ for any variable U^|ψ^𝑈ket𝜓\hat{U}|\psi\rangleover^ start_ARG italic_U end_ARG | italic_ψ ⟩ (see B). The measurement on the ancilla qubit q0subscript𝑞0q_{0}italic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT delivers a measure for the manipulation on the lower qubits q1subscript𝑞1q_{1}italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT to qn1subscript𝑞𝑛1q_{n-1}italic_q start_POSTSUBSCRIPT italic_n - 1 end_POSTSUBSCRIPT. This measurement is performed such that p0p1subscript𝑝0subscript𝑝1p_{0}-p_{1}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT - italic_p start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT is evaluated, where p0subscript𝑝0p_{0}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and p1subscript𝑝1p_{1}italic_p start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT is the probability to measure the standard basis eigenstates |0ket0|0\rangle| 0 ⟩ and |1ket1|1\rangle| 1 ⟩ at the ancilla qubit q0subscript𝑞0q_{0}italic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, respectively. In order to evaluate C𝟙subscript𝐶1C_{\mathds{1}}italic_C start_POSTSUBSCRIPT blackboard_1 end_POSTSUBSCRIPT which is ψ(𝝀)|ψ~inner-product𝜓𝝀~𝜓\langle\psi({\bm{\lambda}})|\tilde{\psi}\rangle⟨ italic_ψ ( bold_italic_λ ) | over~ start_ARG italic_ψ end_ARG ⟩, the parameterized quantum ansatz for the solution U^(𝝀)^𝑈𝝀\hat{U}({\bm{\lambda}})over^ start_ARG italic_U end_ARG ( bold_italic_λ ) and the inverse of previous time step U~superscript~𝑈\tilde{U}^{\dagger}over~ start_ARG italic_U end_ARG start_POSTSUPERSCRIPT † end_POSTSUPERSCRIPT are implemented as controlled gates. If U^(𝝀)^𝑈𝝀\hat{U}({\bm{\lambda}})over^ start_ARG italic_U end_ARG ( bold_italic_λ ) initializes a state which is completely removed by U~superscript~𝑈\tilde{U}^{\dagger}over~ start_ARG italic_U end_ARG start_POSTSUPERSCRIPT † end_POSTSUPERSCRIPT, the probability to measure the |0ket0|0\rangle| 0 ⟩ state would be p0=1subscript𝑝01p_{0}=1italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 1 because just the Hadamard gates by themselves, cancel their effects causing no net rotation in total. For the evaluation of the CS+/subscript𝐶limit-from𝑆absentC_{S+/-}italic_C start_POSTSUBSCRIPT italic_S + / - end_POSTSUBSCRIPT which is ψ(𝝀)|S^+/ψ~inner-product𝜓𝝀subscript^𝑆absent~𝜓\langle\psi({\bm{\lambda}})|\hat{S}_{+/-}\tilde{\psi}\rangle⟨ italic_ψ ( bold_italic_λ ) | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + / - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩, the shift operation is added by implementing controlled NOT gates (CNOT) and Toffoli gates which are organized in a particular way. For the CS+subscript𝐶limit-from𝑆C_{S+}italic_C start_POSTSUBSCRIPT italic_S + end_POSTSUBSCRIPT case, the CNOT and Toffoli gates are organized in reverse order compared to CSsubscript𝐶limit-from𝑆C_{S-}italic_C start_POSTSUBSCRIPT italic_S - end_POSTSUBSCRIPT. The structure is shown in Fig. 4. The evaluation of C~S+subscript~𝐶subscript𝑆\tilde{C}_{S_{+}}over~ start_ARG italic_C end_ARG start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT + end_POSTSUBSCRIPT end_POSTSUBSCRIPT and C~S++subscript~𝐶subscript𝑆absent\tilde{C}_{S_{++}}over~ start_ARG italic_C end_ARG start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT + + end_POSTSUBSCRIPT end_POSTSUBSCRIPT requires the implementation of U~^^~𝑈\hat{\tilde{U}}over^ start_ARG over~ start_ARG italic_U end_ARG end_ARG instead of U^(𝝀)^𝑈𝝀\hat{U}({\bm{\lambda}})over^ start_ARG italic_U end_ARG ( bold_italic_λ ). In order to realize the double shift operation for C~S++subscript~𝐶subscript𝑆absent\tilde{C}_{S_{++}}over~ start_ARG italic_C end_ARG start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT + + end_POSTSUBSCRIPT end_POSTSUBSCRIPT, the S^+subscript^𝑆\hat{S}_{+}over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT block can be either implemented twice, or more efficiently, the processing structure starts one qubit lower such that q1subscript𝑞1q_{1}italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT is not affected by the shift operator.


q0subscript𝑞0q_{0}italic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPTq1subscript𝑞1q_{1}italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT\vdotsqnsubscript𝑞𝑛q_{n}italic_q start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPTH𝐻Hitalic_HH𝐻Hitalic_HU^(𝝀)^𝑈𝝀\hat{U}({\bm{\lambda}})over^ start_ARG italic_U end_ARG ( bold_italic_λ )S^subscript^𝑆\hat{S}_{-}over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT\ddotsS^+subscript^𝑆\hat{S}_{+}over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT\iddotsU~^superscript^~𝑈\hat{\tilde{U}}^{\dagger}over^ start_ARG over~ start_ARG italic_U end_ARG end_ARG start_POSTSUPERSCRIPT † end_POSTSUPERSCRIPT
Figure 4: Quantum circuits for the evaluation of the main cost contributions C𝟙subscript𝐶1C_{\mathds{1}}italic_C start_POSTSUBSCRIPT blackboard_1 end_POSTSUBSCRIPT, CS+subscript𝐶subscript𝑆C_{S_{+}}italic_C start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT + end_POSTSUBSCRIPT end_POSTSUBSCRIPT and CSsubscript𝐶subscript𝑆C_{S_{-}}italic_C start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT - end_POSTSUBSCRIPT end_POSTSUBSCRIPT. For the evaluation of C𝟙subscript𝐶1C_{\mathds{1}}italic_C start_POSTSUBSCRIPT blackboard_1 end_POSTSUBSCRIPT, the both shift blocks are neglected, while the evaluation of CS/+subscript𝐶subscript𝑆absentC_{S_{-/+}}italic_C start_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT - / + end_POSTSUBSCRIPT end_POSTSUBSCRIPT requires the S^/+subscript^𝑆absent\hat{S}_{-/+}over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - / + end_POSTSUBSCRIPT block. Qubit q0subscript𝑞0q_{0}italic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT is an ancillary (in short ancilla) qubit which collects the information for the measurement to the right.

The quantum ansatz function can be designed problem-specific or generic without any knowledge about the form of the solution. In this work, a quantum ansatz with an universal function is used which is shown in Fig. 5. The ansatz is defined by a special structure of Rysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT rotation gates and CNOT gates. The Rysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT gates are parameterized with the parameter set and perform rotations by λi/2subscript𝜆𝑖2\lambda_{i}/2italic_λ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT / 2 about the y axis of the qubit. CNOT gates negate the state of the target qubit whenever the control qubit is in state |1ket1|1\rangle| 1 ⟩. This ansatz allows to implement all possible quantum states. The trade-off is, that the solution can always be found, but the optimization has as many parameters to tune as reasonably possible. The usage of other ansatz functions showed no improvement in performance, as discussed in Sec. 5.4. However, the inherent disadvantage of the considered universal ansatz function is the circuit depth which would diminish a possible quantum advantage. This ansatz requires 2n1superscript2𝑛12^{n}-12 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT - 1 parameterized gates and thus, 2nsuperscript2𝑛2^{n}2 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT parameters (one additional parameter λ0subscript𝜆0\lambda_{0}italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT for normalization purpose) need to be optimized which leads to a high computational effort in circuit execution and optimization.


q0subscript𝑞0q_{0}italic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPTq1subscript𝑞1q_{1}italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPTq2subscript𝑞2q_{2}italic_q start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPTλ1subscript𝜆1\lambda_{1}italic_λ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPTRysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPTλ2subscript𝜆2\lambda_{2}italic_λ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPTRysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPTλ3subscript𝜆3\lambda_{3}italic_λ start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPTRysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPTλ4subscript𝜆4\lambda_{4}italic_λ start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPTRysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPTλ5subscript𝜆5\lambda_{5}italic_λ start_POSTSUBSCRIPT 5 end_POSTSUBSCRIPTRysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPTλ6subscript𝜆6\lambda_{6}italic_λ start_POSTSUBSCRIPT 6 end_POSTSUBSCRIPTRysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPTλ7subscript𝜆7\lambda_{7}italic_λ start_POSTSUBSCRIPT 7 end_POSTSUBSCRIPTRysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT
Figure 5: Example of a universal quantum ansatz function U^(𝝀)^𝑈𝝀\hat{U}({\bm{\lambda}})over^ start_ARG italic_U end_ARG ( bold_italic_λ ) for a qubit amount of n=3𝑛3n=3italic_n = 3 with parameterized Ry(λi)subscript𝑅𝑦subscript𝜆𝑖R_{y}(\lambda_{i})italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT ( italic_λ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) and CNOT gates.

The Nelder-Mead algorithm Nelder and Mead (1965) is chosen as the classical optimization algorithm. This algorithm is designed to solve unconstrained optimization problems by a geometric method. For this, the function values of the cost function are evaluated at some points. These points define the so-called simplex. For a two-dimensional data space, a simplex would correspond with a triangle. In the optimization process, the simplex is transformed by reflections and expansions or contractions of the sides of the triangle.

We also tested other classical optimization algorithms and found that the the Nelder-Mead algorithm is most suitable for the present problem in low-dimensional data spaces. Thus, it is used mainly. The comparison of our results with the other popular classical optimization algorithms is reported in detail in C.

Refer to caption
Figure 6: Comparison of the analytical solution to the results of the quantum algorithms. The results are shown as contour plots in x𝑥xitalic_x direction over the time t𝑡titalic_t for (a) the analytical solution (ANA), (b) the QLSA results and (c) the VQA results. The mean squared error (MSE) is evaluated to determine the deviation to the analytical solution. For this, the MSE is evaluated with respect (d) to the classical backward (red) and forward (blue) Euler method, (e) to the QLSA results and (f) to the VQA results. Times are given in units of τa=2L/Usubscript𝜏𝑎2𝐿𝑈\tau_{a}=2L/Uitalic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT = 2 italic_L / italic_U and length in units of 2L2𝐿2L2 italic_L. The x𝑥xitalic_x-axis was resolved with 4 qubits in both cases.

5 Comparison of quantum algorithms

5.1 Time evolution of concentration profile

In this section, the time evolution of the concentration profiles of the QLSA and the VQA is shown and compared to the analytical solution, cf. eq. (10). For this comparison, the 4-qubit case with N=16𝑁16N=16italic_N = 16 is chosen. The parameters are time step width τ=0.001𝜏0.001\tau=0.001italic_τ = 0.001 s, diffusion constant D=1𝐷1D=1italic_D = 1 m22{}^{2}start_FLOATSUPERSCRIPT 2 end_FLOATSUPERSCRIPT/s, unit length 2L=12𝐿12L=12 italic_L = 1 m, and constant advection velocity U=10𝑈10U=10italic_U = 10 m/s. The characteristic time scales of the problem are the advection and the diffusion times. They are given by τa=0.1subscript𝜏𝑎0.1\tau_{a}=0.1italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT = 0.1 s and τd=1subscript𝜏𝑑1\tau_{d}=1italic_τ start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT = 1 s. From now on, we proceed with the dimensionless form. Characteristic scales are combined in the dimensionless Péclet number which is given by

Pe=2ULD=τdτa=10.Pe2𝑈𝐿𝐷subscript𝜏𝑑subscript𝜏𝑎10{\rm Pe}=\frac{2UL}{D}=\frac{\tau_{d}}{\tau_{a}}=10\,.roman_Pe = divide start_ARG 2 italic_U italic_L end_ARG start_ARG italic_D end_ARG = divide start_ARG italic_τ start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT end_ARG start_ARG italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT end_ARG = 10 . (51)

Figure 6 provides a first impression of the dynamical evolution of the concentration profile in the form of a contour plot. We provide the analytical solution together with those obtained from QLSA and VQA. The bottom row shows the time evolution of the corresponding mean squared errors which will be detailed below.

Refer to caption
Figure 7: Comparison of the concentration profiles of the analytical solution (ANA) and the results of the VQA and the QLSA for N=16𝑁16N=16italic_N = 16 and a time step width τ=0.01τa𝜏0.01subscript𝜏𝑎\tau=0.01\tau_{a}italic_τ = 0.01 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT. (a)–(e) illustrate the time evolution of the concentration profiles for increasing time. In panel (f), the corresponding MSE is shown where the results of the quantum methods are compared to the analytical solution. The VQA algorithm used 4 qubits for the spatial discretization plus 1 ancilla qubit for the Hadamard tests which gives ntot=5subscript𝑛tot5n_{\rm tot}=5italic_n start_POSTSUBSCRIPT roman_tot end_POSTSUBSCRIPT = 5. The QLSA algorithm used 4 qubits for the spatial discretization plus 1 ancilla qubit for converting the matrix A𝐴Aitalic_A into a hermitian matrix. A further ancilla qubit is used together with 8 additional qubits for the register of the QPE. Thus, a total of ntot=14subscript𝑛tot14n_{\rm tot}=14italic_n start_POSTSUBSCRIPT roman_tot end_POSTSUBSCRIPT = 14 qubits are used in QLSA.

The corresponding concentration profiles are plotted in Fig. 7 where the time interval is approximately 1/30τd130subscript𝜏𝑑1/30\tau_{d}1 / 30 italic_τ start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT or 1/3τa13subscript𝜏𝑎1/3\tau_{a}1 / 3 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT. The concentration profiles of the VQA reproduce the advection and diffusion process as expected but the accuracy is limited by the Euler method used in the cost function considered; see subsection 4.2. Especially for the early time steps, the performance of the VQA is excellent (see Figs. 7a and 7b). In the course of the time evolution, the advection-diffusion process starts to depart slightly in comparison to the analytical solution: see Figs. 7(c)-(e).

This behaviour can also be seen in the time evolution of the mean squared error (MSE) in Fig. 7(f) where the VQA result is compared to the analytical solution. The MSE is given by, cf. eq. (30),

MSE(tm)=1Ni=1N[cimciANA(tm)]2.MSEsubscript𝑡𝑚1𝑁superscriptsubscript𝑖1𝑁superscriptdelimited-[]superscriptsubscript𝑐𝑖𝑚superscriptsubscript𝑐𝑖ANAsubscript𝑡𝑚2{\rm MSE}(t_{m})=\frac{1}{N}\sum_{i=1}^{N}\left[c_{i}^{m}-c_{i}^{\rm ANA}(t_{m% })\right]^{2}\,.roman_MSE ( italic_t start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT ) = divide start_ARG 1 end_ARG start_ARG italic_N end_ARG ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_N end_POSTSUPERSCRIPT [ italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT - italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_ANA end_POSTSUPERSCRIPT ( italic_t start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT ) ] start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT . (52)

The MSE curve decreases first, but starts to increase for t0.1greater-than-or-equivalent-to𝑡0.1t\gtrsim 0.1italic_t ≳ 0.1 L/U𝐿𝑈L/Uitalic_L / italic_U. The reason for this behaviour can be assigned to the phase when the largest fraction of the concentration profile crosses the periodic boundary for the first time. This is connected with stronger changes in the parameterized vector components (λ0,𝝀)subscript𝜆0𝝀(\lambda_{0},{\bm{\lambda}})( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ). In more detail, comparing the iterative update of the parameter set, for a time step where the maximum concentration is away from the periodic boundaries, the components (λ0,𝝀)subscript𝜆0𝝀(\lambda_{0},{\bm{\lambda}})( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ) instead change rapidly when the boundary is crossed by the bulk of distribution. This is a specific property of the geometric Nelder-Mead algorithm. We continued with this algorithm since it still gave the lowest MSE amplitudes for the present problem, boundary conditions, and qubit number range. See also Appendix C for more discussion. With progressing time evolution, the problem fades out and the MSE curve decreases again. This non-monotoneous behaviour was observed for system sizes N16𝑁16N\geq 16italic_N ≥ 16; here the number of optimization parameters was always similar to the number of grid points N𝑁Nitalic_N.

The concentration profiles computed with the QLSA using the implicit Euler method (BTCS) also capture the physics of the advection-diffusion process very well, both qualitatively and quantitatively. It should be reiterated here that the error in the QLSA solutions (or from any algorithm for that matter) with respect to the analytical solution is bounded from below by the error of the classical solutions from the same underlying numerical scheme, in this case the implicit Euler method. With this in mind, we can now observe from Figs. 7(a) and (b) that the QLSA, in contrast to the VQA, deviates from the analytical solution only during the initial few time steps (for small t𝑡titalic_t). However, this is natural since the classical implicit Euler solution also deviates almost exactly in the same manner the QLSA solution does. In fact, the QLSA performs excellently when compared to the classical BTCS solution alone, which we shall discuss more closely in the next subsection. This behaviour is anticipated from Fig. 1(c) where, for the problem under discussion, the MSE of the BTCS is in general higher than the FTCS scheme which forms the basis to the VQA solutions. Proceeding further, the QLSA performs progressively better for increasing t𝑡titalic_t, as can be seen in Figs. 7(c)-(e), when it begins to closely follow the analytical solution. This is quantified by observing the monotonic decay in the MSE of QLSA with evolving time, as shown in Fig. 7(f).

In contrast to the VQA, the performance of QLSA improves with increasing system size as one would naturally expect from higher degrees of resolution. On the other hand, similar to the blockades posed by the parametric optimization in the VQA, the accuracy of QLSA critically depends on (a) large enough registers nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT for the Quantum Phase Estimation and (b) the right choice of T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, see eq. (36) in Step 2. For instance, though the MSE of QLSA asymptotes closely with the MSE of VQA for large t𝑡titalic_t in Fig. 7 (f), these MSE values of the QLSA can, in general, be further lowered by providing a higher nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT, without any increase in the finite difference resolution. We investigate all such dependencies more closely in the following sections.

The maximum number of grid points is N=64𝑁64N=64italic_N = 64 which corresponds to 6 qubits. In this case, 64646464 parameters have to be optimized, as described in C for a detailed explanation of the classical optimization. The corresponding concentration profiles are shown in Fig. 8. Within the short time interval considered, the advection-diffusion dynamics can be reproduced very well by the VQA.

Refer to caption
Figure 8: Concentration profiles for N=64𝑁64N=64italic_N = 64 of the analytical solution (ANA), the VQA and QLSA results for (a) t=6.1×103τa𝑡6.1superscript103subscript𝜏𝑎t=6.1\times 10^{-3}\tau_{a}italic_t = 6.1 × 10 start_POSTSUPERSCRIPT - 3 end_POSTSUPERSCRIPT italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT and (b) t=1.22×102τa𝑡1.22superscript102subscript𝜏𝑎t=1.22\times 10^{-2}\tau_{a}italic_t = 1.22 × 10 start_POSTSUPERSCRIPT - 2 end_POSTSUPERSCRIPT italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT where the time step width is τ=6.1×104τa𝜏6.1superscript104subscript𝜏𝑎\tau=6.1\times 10^{-4}\tau_{a}italic_τ = 6.1 × 10 start_POSTSUPERSCRIPT - 4 end_POSTSUPERSCRIPT italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT. The VQA algorithm used 6 qubits for the spatial discretization plus 1 ancilla qubit which gives ntot=7subscript𝑛tot7n_{\rm tot}=7italic_n start_POSTSUBSCRIPT roman_tot end_POSTSUBSCRIPT = 7. The QLSA algorithm used 6 qubits for the spatial discretization plus 1 ancilla qubit for the converting the matrix A𝐴Aitalic_A into a hermitian matrix. A further ancilla qubit is used together with 6 additional qubits for the register of the QPE. This results to ntot=14subscript𝑛tot14n_{\rm tot}=14italic_n start_POSTSUBSCRIPT roman_tot end_POSTSUBSCRIPT = 14 qubits for QLSA.

5.2 Dependence on the number of qubits

With the number of qubits the resolution of the spatial discretization N𝑁Nitalic_N increases exponentially as N=2n𝑁superscript2𝑛N=2^{n}italic_N = 2 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT. Apart from the spatial resolution N𝑁Nitalic_N, the total number of qubits ntotsubscript𝑛totn_{\rm tot}italic_n start_POSTSUBSCRIPT roman_tot end_POSTSUBSCRIPT in both algorithms is as follows:

ntotVQAsuperscriptsubscript𝑛totVQA\displaystyle n_{\rm tot}^{\rm VQA}italic_n start_POSTSUBSCRIPT roman_tot end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_VQA end_POSTSUPERSCRIPT =log2(N)+1,absentsubscript2𝑁1\displaystyle=\log_{2}(N)+1\,,= roman_log start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_N ) + 1 , (53)
ntotQLSAsuperscriptsubscript𝑛totQLSA\displaystyle n_{\rm tot}^{\rm QLSA}italic_n start_POSTSUBSCRIPT roman_tot end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_QLSA end_POSTSUPERSCRIPT =log2(N)+2+nq.absentsubscript2𝑁2subscript𝑛𝑞\displaystyle=\log_{2}(N)+2+n_{q}\,.= roman_log start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_N ) + 2 + italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT . (54)

In case of QLSA, an additional register with nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT qubits is required which corresponds to the QPE qubits.111In case of QLSA-2, the need for nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT can be eliminated given the absence of QPE. They determine the accuracy of the eigenvalue estimation. The specific dependence on nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT will be dealt with in subsection 5.3. The discussion in this section focuses on the dependence on the number of qubits associated with resolution alone.

For this investigation, the diffusion constant and the velocity are fixed to D=1𝐷1D=1italic_D = 1 and U=10𝑈10U=10italic_U = 10 and the cases for N=8,16,32𝑁81632N=8,16,32italic_N = 8 , 16 , 32 grid points are analyzed. In case of the VQA, the time constant τ𝜏\tauitalic_τ is adapted for each discretization. The cost function (see eq. (4.2)), which is derived in Sec. 4.2, includes the prefactor (12DN2τ)12𝐷superscript𝑁2𝜏(1-2DN^{2}\tau)( 1 - 2 italic_D italic_N start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_τ ). In order to include the term with this prefactor, the time step width τ<1/2DN2𝜏12𝐷superscript𝑁2\tau<1/2DN^{2}italic_τ < 1 / 2 italic_D italic_N start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT besides the Courant-Friedrichs-Lewy (CFL) condition, τ<1/(NU)𝜏1𝑁𝑈\tau<1/(NU)italic_τ < 1 / ( italic_N italic_U ). Thus, the time steps are τ=4×103𝜏4superscript103\tau=4\times 10^{-3}italic_τ = 4 × 10 start_POSTSUPERSCRIPT - 3 end_POSTSUPERSCRIPT for N=8𝑁8N=8italic_N = 8, τ=103𝜏superscript103\tau=10^{-3}italic_τ = 10 start_POSTSUPERSCRIPT - 3 end_POSTSUPERSCRIPT for N=16𝑁16N=16italic_N = 16, and τ=2.4×104𝜏2.4superscript104\tau=2.4\times 10^{-4}italic_τ = 2.4 × 10 start_POSTSUPERSCRIPT - 4 end_POSTSUPERSCRIPT for N=32𝑁32N=32italic_N = 32. If we take a CFL number of 0.5, the time steps are smaller by about a factor of 1.5, 3, and 7 than would be classically possible for the first-order scheme.

For fair comparison, the same set of system parameters is prescribed for the QLSA simulations as well. In the classical finite difference method, which is the basis for the cost function of the VQA, a finer resolution results in a decreased error. For the VQA, this means a finer resolution increases the number of states, hence an increase of the qubit amount. For a time t0.12τa𝑡0.12subscript𝜏𝑎t\leq 0.12\tau_{a}italic_t ≤ 0.12 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT, it can be shown that the error decreases for cases with a higher number of qubits. The evaluation of the MSE over the time t=0.040.24τa𝑡0.040.24subscript𝜏𝑎t=0.04-0.24\tau_{a}italic_t = 0.04 - 0.24 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT is shown in Fig. 9(a). It can be seen that a larger number of qubits lead to smaller errors. However, the error for N=8𝑁8N=8italic_N = 8 decreases while the curves for N=16𝑁16N=16italic_N = 16 and 32323232 show a rapid increase. The reason for these inaccuracies in the concentration profiles, which lead to the increased MSE, is the crossing of the periodic boundary of the bulk of the concentration profile as discussed above. This is also shown in Fig. 9(b). Here, it can be seen that the case for N=8𝑁8N=8italic_N = 8 reaches lower cost than the cases for N=16𝑁16N=16italic_N = 16, 32323232. Thus, it can be assumed that the global minimum in the higher-dimensional parameter space of the optimization is harder to find and hence, the concentration profiles differ slightly from the analytical solution. This can be seen in Figs. 9(c)–(h). It can also be seen that problems in reproducing the analytical solution appear especially after crossing the boundary.

Refer to caption
Figure 9: Comparison of VQA results for N=8,16,32𝑁81632N=8,16,32italic_N = 8 , 16 , 32 to the analytical solution (ANA) with (a) the Mean Squared Error (MSE) over time and (b) the cost function over time. Panels (c) and (d) show the concentration profiles for N=8𝑁8N=8italic_N = 8, panels (e) and (f) for N=16𝑁16N=16italic_N = 16 and panels (g) and (h) for N=32𝑁32N=32italic_N = 32 where t=0.12τa𝑡0.12subscript𝜏𝑎t=0.12\tau_{a}italic_t = 0.12 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT and t=0.24τa𝑡0.24subscript𝜏𝑎t=0.24\tau_{a}italic_t = 0.24 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT are considered for each discretization case.

In the case of QLSA, we compare its performance with respect to both the analytical solution and the classical BTCS solution. It should be noted here that, in order to study the effect of resolution alone, we assign a fixed, sufficient number of nq=log2(N)+2subscript𝑛𝑞subscript2𝑁2n_{q}=\log_{2}(N)+2italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT = roman_log start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_N ) + 2 qubits for each case for QPE module of the algorithm. This corresponds to the minimum number of qubits required for any given N𝑁Nitalic_N, such that the solutions are of comparable performance and nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT affects every case somewhat similarly, although for increasing resolutions one would need far larger nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT registers and therefore lack of which would still bear a weak effect. For N=8𝑁8N=8italic_N = 8, 16161616, and 32323232, one would therefore need to assign a total of ntot=2log2(N)+3subscript𝑛tot2subscript2𝑁3n_{\rm tot}=2\log_{2}(N)+3italic_n start_POSTSUBSCRIPT roman_tot end_POSTSUBSCRIPT = 2 roman_log start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_N ) + 3 qubits, that is, ntot=10subscript𝑛tot10n_{\rm tot}=10italic_n start_POSTSUBSCRIPT roman_tot end_POSTSUBSCRIPT = 10, 12121212 and 14141414 qubits, respectively.

More generally, one needs to assign at least nq=max{log2(N)+1,log2(κ)}subscript𝑛𝑞subscript2𝑁1subscript2𝜅n_{q}=\max\{\log_{2}(N)+1,\log_{2}(\kappa)\}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT = roman_max { roman_log start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_N ) + 1 , roman_log start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_κ ) }, where κ𝜅\kappaitalic_κ is the condition number of A~~𝐴\tilde{A}over~ start_ARG italic_A end_ARG (see eq. (34)). That said, the effect of increasing resolution has a clear consequence of lowering the MSE with respect to the analytical solution for all t𝑡titalic_t, which is shown in Fig. 10(b). This can also be qualitatively observed from Figs. 10(c)–(h). It can also be seen that in all those figures that QLSA follows the BTCS very closely; however, when quantified by computing the MSE with respect to classical BTCS solution as shown in Fig. 10(a), we observe a rather non-trivial trend with increasing resolution. Firstly, this MSE in this case is overall lower than the MSE in Fig. 10 (b), suggesting that QLSA solutions are performing extremely well in closely reproducing the classical BTCS, which forms the basis of QLSA discretization. However, one can see that, overall, the N=8𝑁8N=8italic_N = 8 case performs the best followed by N=32𝑁32N=32italic_N = 32 and N=16𝑁16N=16italic_N = 16 which, more or less, have close time evolution trends. This behavior is purely an artifact of the nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT assigned in each case. The nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT provided for increasing N𝑁Nitalic_N is progressively inadequate to foster an accurate eigenvalue estimation.

This can be seen more pronounced in Figs. 8(a)-(b) which shows the N=64𝑁64N=64italic_N = 64 case for small t𝑡titalic_t. The QLSA solution though effectively reproduces the analytical solution barring a modest quantitative error which is seen as spurious oscillations around zero. This quantitative deviation can again be attributed to two factors – (1) Inadequate nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT (which also causes sign flips around zero for small values of the solution field) which in turn causes improper sign handling and evaluation of negative eigenvalues. The seemingly small and negative concentration values, are not essentially non-physical, but are just values with the wrong sign, which once measured can readily be flipped to positive values classically. However, we still show this to highlight that the sign handling quantum subroutines also suffer with insufficient nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT. (3) The expected errors of solutions from BTCS based schemes in the initial few time steps. The consequence of such insufficient resource allocation and its remedy is further detailed in subsection 5.3. In essence, we can summarize from the above that the performance and accuracy of QLSA when compared to the analytical solution clearly increases with increasing resolution, when provided with adequate algorithmic resources performs very well as already seen in Figs. (6) and (10).

Refer to caption
Figure 10: Comparison of QLSA results for N=8,16,32𝑁81632N=8,16,32italic_N = 8 , 16 , 32 and their MSE over time with respect to (a) implicit time stepping (BTCS) classical solution and (b) the analytical solution (ANA). Panels (c) and (d) show the concentration profiles for N=8𝑁8N=8italic_N = 8 at times t=0.08τa𝑡0.08subscript𝜏𝑎t=0.08\tau_{a}italic_t = 0.08 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT and t=0.16τa𝑡0.16subscript𝜏𝑎t=0.16\tau_{a}italic_t = 0.16 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT, panels (e) and (f) for N=16𝑁16N=16italic_N = 16 at times t=0.08τa𝑡0.08subscript𝜏𝑎t=0.08\tau_{a}italic_t = 0.08 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT and t=0.15τa𝑡0.15subscript𝜏𝑎t=0.15\tau_{a}italic_t = 0.15 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT and panels (g) and (h) for N=32𝑁32N=32italic_N = 32 at times t=0.0768τa𝑡0.0768subscript𝜏𝑎t=0.0768\tau_{a}italic_t = 0.0768 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT and t=0.1488τa𝑡0.1488subscript𝜏𝑎t=0.1488\tau_{a}italic_t = 0.1488 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT, respectively.

5.3 Accurate eigenvalue estimation with QLSA

QLSA, specifically the QLSA-1 discussed in this work, relies heavily on accurate estimation by QPE of the eigenvalues of the matrices under discussion. The errors in this module occur from two primary sources:

(1) Numerical truncation: We recall from expression (37), that the process of estimating eigenvalues in the QPE module requires an intermediate encoding of those values into a binary format using nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT qubits. For a given value, an insufficient nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT will naturally cause truncation errors of the order O(2(nq+1))𝑂superscript2subscript𝑛𝑞1O(2^{-(n_{q}+1)})italic_O ( 2 start_POSTSUPERSCRIPT - ( italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT + 1 ) end_POSTSUPERSCRIPT ). However, given an nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT, the eigenvalues can always be scaled by choosing an appropriate T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT such that σjT0subscript𝜎𝑗subscript𝑇0\sigma_{j}T_{0}italic_σ start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT can be represented with the required accuracy. Unfortunately, since the eigenvalues are unknown a priori, the choice of both nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT and T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT becomes elusive. Figure 11(e) depicts the intricate connection between the two quantities and their effect on the MSE. A similar contour can be made for the fidelity of the solution as well. The fidelity F𝐹Fitalic_F would be given by

F=i=1N|ciQLSAciBTCS|cQLSA2cBTCS2.𝐹superscriptsubscript𝑖1𝑁superscriptsubscript𝑐𝑖QLSAsuperscriptsubscript𝑐𝑖BTCSsubscriptnormsuperscript𝑐QLSA2subscriptnormsuperscript𝑐BTCS2F=\dfrac{\sum_{i=1}^{N}|c_{i}^{\rm QLSA}c_{i}^{\rm BTCS}|}{\|c^{\rm QLSA}\|_{2% }\,\|c^{\rm BTCS}\|_{2}}\,.italic_F = divide start_ARG ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_N end_POSTSUPERSCRIPT | italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_QLSA end_POSTSUPERSCRIPT italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_BTCS end_POSTSUPERSCRIPT | end_ARG start_ARG ∥ italic_c start_POSTSUPERSCRIPT roman_QLSA end_POSTSUPERSCRIPT ∥ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ∥ italic_c start_POSTSUPERSCRIPT roman_BTCS end_POSTSUPERSCRIPT ∥ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT end_ARG . (55)

F𝐹Fitalic_F is a measure of overlap instead of the difference. However, as noted in Bharadwaj and Sreenivasan (2023), it would provide only a rough indication of the QLSA performance. So, for brevity of discussion, we limit ourselves to the computing of MSE only. Though some recommendations for the choice of T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT can be made by bounding the minimum and maximum eigenvalues, with functions of either the condition number κ𝜅\kappaitalic_κ or the trace of the matrix, they would still be rough estimates.

The optimal choice of T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT would be such that (a) all eigenvalues are almost exactly represented, and (b) the MSE (with respect to analytical solution) of the concentration field, should neither diverge nor oscillate with time, and decrease with increasing nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT. This estimation of T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT is described in Bharadwaj and Sreenivasan (2023). In summary, it requires one to first compute the behavior of condition number κ𝜅\kappaitalic_κ with increasing system sizes. If accurate estimation of κ𝜅\kappaitalic_κ turns out to be expensive, they can also be estimated by tight, theoretical upper bounds (which, of course, would give less accurate results). With this relation in hand, the system of equations is then solved with QLSA for a smaller range of system sizes (N,t𝑁𝑡N,titalic_N , italic_t), nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT and T0[0,2κ(12nq,max)]subscript𝑇002𝜅1superscript2subscript𝑛𝑞𝑚𝑎𝑥T_{0}\in[0,2\kappa(1-2^{-n_{q,max}})]italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∈ [ 0 , 2 italic_κ ( 1 - 2 start_POSTSUPERSCRIPT - italic_n start_POSTSUBSCRIPT italic_q , italic_m italic_a italic_x end_POSTSUBSCRIPT end_POSTSUPERSCRIPT ) ]. From these results an MSE is computed with respect to classical or analytical solution (available in this case) for every combination of nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT and T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT as shown in Fig. 11(e), for the N=8𝑁8N=8italic_N = 8 case integrated up to t=0.1τa𝑡0.1subscript𝜏𝑎t=0.1\tau_{a}italic_t = 0.1 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT. The MSE could be of either the entire concentration field (as is the case here), or of a function of the concentration field, such as the scalar dissipation computed using the by Quantum Post Processing (QPP) protocol Bharadwaj and Sreenivasan (2023), as denoted in Fig. 2(b). Computing the latter is more efficient and speed-up preserving since it avoids measuring the entire field – which is a 𝒪(N)𝒪𝑁\mathcal{O}(N)caligraphic_O ( italic_N ) operation, and also minimizes the measurement errors associated with it.

Proceeding further, the trajectory of the minimum MSE is traced for every nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT and T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT as shown in Fig. 11(e) (cyan dotted line) to find a T0*subscriptsuperscript𝑇0T^{*}_{0}italic_T start_POSTSUPERSCRIPT * end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT for which most eigenvalues are accurately represented with nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT qubits. Finally, using the previously computed κN𝜅𝑁\kappa-Nitalic_κ - italic_N relation, a new relation between N𝑁Nitalic_N and T0*subscriptsuperscript𝑇0T^{*}_{0}italic_T start_POSTSUPERSCRIPT * end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT is determined (power-law like behavior), with which one can predict with nominal confidence a T0*subscriptsuperscript𝑇0T^{*}_{0}italic_T start_POSTSUPERSCRIPT * end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT for all large system sizes. Note that, for a given problem, this exercise needs to be performed only once and larger system sizes can thereafter be solved with minimal classical precomputing. With the right choice of T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT we now solve the system for N=16𝑁16N=16italic_N = 16, τ=0.001𝜏0.001\tau=0.001italic_τ = 0.001 with increasing nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT—and therefore n𝑛nitalic_n is given by eq. (54). In this case, nq[4,8]subscript𝑛𝑞48n_{q}\in[4,8]italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT ∈ [ 4 , 8 ] and thus n[10,14]𝑛1014n\in[10,14]italic_n ∈ [ 10 , 14 ]. The MSE is computed with respect to analytical and BTCS solution as shown in Figs. 11(a)–(c). Three observations are possible:

(i) The overall magnitudes of MSE between QLSA and BTCS is lower than with QLSA and the analytical solution. This is expected since QLSA is based on the BTCS scheme and thus follows the classical solution closely.

(ii) The MSE seems to exhibit a non-monotonic trend with time. The error is initially high as expected when estimating a delta peak, consistent with Fig. 1(c). It decreases as the field tends to become more uniform due to diffusion. On the other hand, the initial few time steps pose a beneficial setting to QLSA, since many values of c(t)𝑐𝑡c(t)italic_c ( italic_t ) are close to 0, and therefore errors in eigenvalue estimation are somewhat diminished (except sign issues, which can be corrected easily).

As the concentration field becomes more uniform and mixed, inaccuracies in T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT estimation manifest as a slight increase in MSE. It has to be emphasized here that these errors and their trends also have contributions from errors due to finite differences that are of the order O(τ,(Δx)2)𝑂𝜏superscriptΔ𝑥2O(\tau,(\Delta x)^{2})italic_O ( italic_τ , ( roman_Δ italic_x ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ). Another reason is the following, from eq. (39) the solution is of the form bj/σjsubscript𝑏𝑗subscript𝜎𝑗b_{j}/\sigma_{j}italic_b start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT / italic_σ start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT. So the maximum error stems from the smallest eigenvalue. If the bjsubscript𝑏𝑗b_{j}italic_b start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT associated with the smallest eigenvalue is negligible, then the error from that is also relatively smaller. However, as the concentration peak is advected in space and more bjsubscript𝑏𝑗b_{j}italic_b start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT become finite, the error from the smallest eigenvalue becomes magnified. Further as the field tends to diffuse, again the inaccuracy in eigenvalue estimation is smaller. However, the final large t𝑡titalic_t value of MSE is bounded by 2nqsuperscript2subscript𝑛𝑞2^{-n_{q}}2 start_POSTSUPERSCRIPT - italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT end_POSTSUPERSCRIPT. To accurately estimate very small values of c(t)𝑐𝑡c(t)italic_c ( italic_t ) would require a larger nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT.

(iii) Finally, the effect of nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT is clear from Figs. 11 (a) and (b). Increasing nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT tends to lower MSE in general, but it is in step-like fashion as shown in Fig. 11(c) plotted for final time t=0.4τa𝑡0.4subscript𝜏𝑎t=0.4\tau_{a}italic_t = 0.4 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT. This is because increasing nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT in small steps (of 𝒪(1)𝒪1\mathcal{O}(1)caligraphic_O ( 1 )) does not lower the least count significantly (in log10subscript10\log_{10}roman_log start_POSTSUBSCRIPT 10 end_POSTSUBSCRIPT or logesubscript𝑒\log_{e}roman_log start_POSTSUBSCRIPT italic_e end_POSTSUBSCRIPT). We also plot the residue, given by RES=|c(t)c(tτ)|𝑅𝐸𝑆𝑐𝑡𝑐𝑡𝜏RES=|c(t)-c(t-\tau)|italic_R italic_E italic_S = | italic_c ( italic_t ) - italic_c ( italic_t - italic_τ ) |, as a function of t𝑡titalic_t as shown in Fig. 11 (d). The monotonic decay in residue symbolizes two aspects: (a) The numerical method and choice of τ𝜏\tauitalic_τ and ΔxΔ𝑥\Delta xroman_Δ italic_x produces stable non-diverging solutions. (b) When the residue falls below a threshold (which can be set arbitrarily small), a steady-state of the solution is reached. The overall residue also decreases with increasing refinement as expected.

(2) Sign flips: Finally, a finer observation is that of the somewhat erratic behavior in MSE in the initial few time steps as shown Fig. 11 (b) for the ntot=14subscript𝑛tot14n_{\rm tot}=14italic_n start_POSTSUBSCRIPT roman_tot end_POSTSUBSCRIPT = 14 case. This is because of improper handling of very small negative eigenvalues. The eigenvalues are generally mirrored about 0, to lie in the range [-0.5,0.5]. If the eigenvalues get too close to 0 or when improperly scaled with T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, the signs might flip causing a rough MSE profile. This also manifests physically in the concentration field, as depicted by the tiny dark peaks for t𝑡titalic_t close to 0 in Fig. 6(b). This can be minimized by adding another sign control qubit or by increasing nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT and estimating T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT more accurately.

Refer to caption
(a)
Refer to caption
(b)
Refer to caption
(c)
Refer to caption
(d)
Refer to caption
(e)
Figure 11: (a) and (b) depict the evolution in time of the MSE from QLSA computed with respect to the analytical and BTCS solutions respectively, plotted for increasing number of qubits. (c) compares the MSE at t=0.4𝑡0.4t=0.4italic_t = 0.4 (in τasubscript𝜏𝑎\tau_{a}italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT) with respect to analytical and BTCS solutions as function of n𝑛nitalic_n. (d) shows the time-decay of residue for N=8,16𝑁816N=8,16italic_N = 8 , 16 and 32323232. (e) Shows the contour of MSE of QLSA with respect to analytical solution as function of both nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT and T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT. The dotted line (cyan) plots the trajectory of minimum MSE for every combination of (T0,nq(T_{0},n_{q}( italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT). The color bar shows MSE in logarithmic scale (of base 10).

5.4 Comparison of different ansatz functions for VQA

The quantum ansatz U^(𝝀)^𝑈𝝀\hat{U}({\bm{\lambda}})over^ start_ARG italic_U end_ARG ( bold_italic_λ ) has to meet several requirements. The ansatz should be able to construct the unknown solution for the next time step in the given problem. Secondly, the amount of rotation and entanglement gates should be reduced to a minimum in order to get an efficient and shallow parametric circuit U^(𝝀)^𝑈𝝀\hat{U}({\bm{\lambda}})over^ start_ARG italic_U end_ARG ( bold_italic_λ ). The efficiency of the ansatz is a key factor in determining whether a quantum advantage can be achieved at all or not. The currently applied universal ansatz (see Fig. 5) contains 2n1superscript2𝑛12^{n}-12 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT - 1 parameterized gates to generate the next n𝑛nitalic_n-qubit state. However with 𝒪(N)𝒪𝑁{\cal O}(N)caligraphic_O ( italic_N ) parameterized gates, one cannot obtain a quantum advantage. In order to improve the efficiency of the algorithm, further ansatz functions are now tested. To this end, we analyse the performance of shallow tensor networks (TNs) where Rysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT and CNOT gates are structured in a staggered way, see e.g. ref. Barratt et al. (2021). These TNs are visualized in Fig. 12. The TN1 ansatz shows a generic structure where the marked code block can be repeated as often as desired in order to build U^(𝝀)^𝑈𝝀\hat{U}({\bm{\lambda}})over^ start_ARG italic_U end_ARG ( bold_italic_λ ) with a different number of gates. In TN2, a row of Rysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT gates is added which is inspired by the universal ansatz and should enable an easier generation.

The quality of an ansatz is quantified by a Hadamard test-like quantum circuit which is shown in Fig. 4. In the U^(𝝀)^𝑈𝝀\hat{U}({\bm{\lambda}})over^ start_ARG italic_U end_ARG ( bold_italic_λ ) code block, the parameterized ansatz is initialized. Then, the inverse of the wanted solution which is given as the classical FTCS solution of a certain time step t𝑡titalic_t is initialized. The ancilla qubit is measured to obtain the probability of state |1ket1|1\rangle| 1 ⟩. In this way we determine the match (or overlap) of the generated with the desired state. In detail, if the probability for the state |1ket1|1\rangle| 1 ⟩ is zero, the ansatz U^(𝝀)^𝑈𝝀\hat{U}({\bm{\lambda}})over^ start_ARG italic_U end_ARG ( bold_italic_λ ) generates a state which is perfectly uncomputed by the inverse of the wanted FTCS solution. In other words, the ansatz allows to reconstruct the considered quantum state exactly. If the probability for the state |1ket1|1\rangle| 1 ⟩ is greater than zero, we obtain a measure for the deviation between both states. This measure is called identity costs Cidsubscript𝐶idC_{\text{id}}italic_C start_POSTSUBSCRIPT id end_POSTSUBSCRIPT.

In this work, the considered ansatz structures are evaluated for quantum registers of size n=4𝑛4n=4italic_n = 4 and 6. For this, three concentration profiles are chosen which capture the significant shapes of the advection-diffusion problem. The corresponding identity costs Cidsubscript𝐶idC_{\text{id}}italic_C start_POSTSUBSCRIPT id end_POSTSUBSCRIPT are evaluated for these chosen concentration profiles and for a varying number of parameterized Rysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT gates. In Fig. 13, the results for the n=4𝑛4n=4italic_n = 4 qubits are shown. We can observe that the universal ansatz leads to low identity costs of 1011absentsuperscript1011\approx 10^{-11}≈ 10 start_POSTSUPERSCRIPT - 11 end_POSTSUPERSCRIPT105superscript10510^{-5}10 start_POSTSUPERSCRIPT - 5 end_POSTSUPERSCRIPT, such that this ansatz is suitable to construct the wanted concentration profile, but the number of used parameterized gates is 𝒪(2n)𝒪superscript2𝑛{\cal O}(2^{n})caligraphic_O ( 2 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT ). The considered tensor networks (TN1, TN2) lead to increased identity costs of 104absentsuperscript104\approx 10^{-4}≈ 10 start_POSTSUPERSCRIPT - 4 end_POSTSUPERSCRIPT102superscript10210^{-2}10 start_POSTSUPERSCRIPT - 2 end_POSTSUPERSCRIPT. The identity costs decrease slowly for a higher number of parameterized gates, but the costs cannot reach the level of the universal ansatz. Thus, one observes that the investigated TNs are less suitable as an ansatz function for the considered advection-diffusion problem.

Interestingly, even if the number of gates is similar to the universal ansatz, the tensor networks cannot reproduce the given concentration profiles well. The evaluation of both investigated TNs results in similar identity costs, whereby TN1 tends to be more suitable for sharp Gaussian shaped concentration profiles and TN2 seems to be more appropriate for concentration profiles which are further decayed. Similar results are obtained for the n=6𝑛6n=6italic_n = 6 qubit case (see Fig. 14). The identity costs for TN1 and TN2 differ marginally. The evaluation of the universal ansatz results in significantly lower costs for No. of λiNsubscript𝜆𝑖𝑁\lambda_{i}\to Nitalic_λ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT → italic_N. Furthermore, a reduction of the parameter space is not possible, particularly for the reconstruction of the concentration profiles in early times a high amount of parameterized gates is necessary (see Fig. 14(d)).

To conclude, the investigated TN structures for n=4𝑛4n=4italic_n = 4 and 6 qubits could not achieve the required accuracy for the state vector generation. Thus, we proceed with the universal ansatz for this investigation. It is also worth noting here that, in contrast to the ansatz used here, the general quantum state preparation (QSP) on the other hand (as used in QLSA), prepares a state exactly, however preparing arbitrary states requires O(N)𝑂𝑁O(N)italic_O ( italic_N ) depth as well. Nevertheless efficient state preparation algorithms exist that prepare states which either have functional forms (such as Gaussian-like or wave-like forms as encountered in the current problem under discussion) or when they are sparse states Bharadwaj and Sreenivasan (2023).

(a) TN1q0subscript𝑞0q_{0}italic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPTq1subscript𝑞1q_{1}italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPTq2subscript𝑞2q_{2}italic_q start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPTq3subscript𝑞3q_{3}italic_q start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPTλ1subscript𝜆1\lambda_{1}italic_λ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPTRysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPTλ2subscript𝜆2\lambda_{2}italic_λ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPTλ3subscript𝜆3\lambda_{3}italic_λ start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT\circlearrowright(b) TN2q0subscript𝑞0q_{0}italic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPTq1subscript𝑞1q_{1}italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPTq2subscript𝑞2q_{2}italic_q start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPTq3subscript𝑞3q_{3}italic_q start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPTλ1subscript𝜆1\lambda_{1}italic_λ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPTRysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPTλ2subscript𝜆2\lambda_{2}italic_λ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPTRysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPTλ3subscript𝜆3\lambda_{3}italic_λ start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPTRysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPTλ4subscript𝜆4\lambda_{4}italic_λ start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPTRysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPTλ5subscript𝜆5\lambda_{5}italic_λ start_POSTSUBSCRIPT 5 end_POSTSUBSCRIPTRysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPTλ6subscript𝜆6\lambda_{6}italic_λ start_POSTSUBSCRIPT 6 end_POSTSUBSCRIPTλ7subscript𝜆7\lambda_{7}italic_λ start_POSTSUBSCRIPT 7 end_POSTSUBSCRIPT\circlearrowright
Figure 12: Example of tensor networks (TN) as generic quantum ansatz functions U^(𝝀)^𝑈𝝀\hat{U}({\bm{\lambda}})over^ start_ARG italic_U end_ARG ( bold_italic_λ ) for n=4𝑛4n=4italic_n = 4 qubits with parameterized Ry(λi)subscript𝑅𝑦subscript𝜆𝑖R_{y}(\lambda_{i})italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT ( italic_λ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) and CNOT gates. The parameters are continuously indexed for repeated blocks (\circlearrowright). (a) Full generic ansatz TN1 and (b) Ansatz TN2 which includes an additional row of Rysubscript𝑅𝑦R_{y}italic_R start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT gates.
Refer to caption
Figure 13: Comparison of the performance of the different investigated ansatz structures for n=4𝑛4n=4italic_n = 4 qubits. The upper panel shows the concentration profiles of the FTCS solution for the time steps (a) t=0.01τa𝑡0.01subscript𝜏𝑎t=0.01\tau_{a}italic_t = 0.01 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT, (b) t=0.1τa𝑡0.1subscript𝜏𝑎t=0.1\tau_{a}italic_t = 0.1 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT and (c) t=0.4τa𝑡0.4subscript𝜏𝑎t=0.4\tau_{a}italic_t = 0.4 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT with τa=2L/Usubscript𝜏𝑎2𝐿𝑈\tau_{a}=2L/Uitalic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT = 2 italic_L / italic_U. In the lower panel, the corresponding identity costs Cidsubscript𝐶idC_{\text{id}}italic_C start_POSTSUBSCRIPT id end_POSTSUBSCRIPT of the investigated ansatz structures are shown for a varying number of parameters #λ#𝜆\#\lambda# italic_λ.
Refer to caption
Figure 14: Comparison of the performance of the different investigated ansatz structures for n=6𝑛6n=6italic_n = 6 qubits. The upper panel shows again the concentration profiles of the FTCS solution for the time steps (a) t=6.1×104τa𝑡6.1superscript104subscript𝜏𝑎t=6.1\times 10^{-4}\tau_{a}italic_t = 6.1 × 10 start_POSTSUPERSCRIPT - 4 end_POSTSUPERSCRIPT italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT, (b) t=5.54×102τa𝑡5.54superscript102subscript𝜏𝑎t=5.54\times 10^{-2}\tau_{a}italic_t = 5.54 × 10 start_POSTSUPERSCRIPT - 2 end_POSTSUPERSCRIPT italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT and (c) t=1.7×101τa𝑡1.7superscript101subscript𝜏𝑎t=1.7\times 10^{-1}\tau_{a}italic_t = 1.7 × 10 start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT. In the lower panel, the corresponding identity costs Cidsubscript𝐶idC_{\text{id}}italic_C start_POSTSUBSCRIPT id end_POSTSUBSCRIPT of the investigated ansatz structures are shown for a varying number of parameters #λ#𝜆\#\lambda# italic_λ. We do not show the individual grid points in (a)–(c) which sum to N=64𝑁64N=64italic_N = 64.

5.5 Qiskit implementation of VQA with circuit noise

In this section, the VQA implementation is performed with a noisy quantum back end, which is close to a real noisy intermediate scale quantum device. The difference from the ideal state vector (SV) simulation is that it includes a measurement process with sampling noise and error rates of the gates, such as bit flips or phase flips. For this, the QASM simulator environment in Qiskit is used which is a noisy quantum circuit back end. A single measurement of an n𝑛nitalic_n-qubit quantum state on a quantum computer is a random projection on one of the 2nsuperscript2𝑛2^{n}2 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT eigenstates with respect to an observable. This observable is the Z𝑍Zitalic_Z matrix on each qubit. In order to obtain the full quantum state vector, such measurements have to be repeated many times to sample all eigenstates sufficiently well. These repetitions of identically prepared quantum simulations of each integration time step of the advection-diffusion equation are termed shots. In this investigation, the number of shots is fixed to NS=220subscript𝑁𝑆superscript220N_{S}=2^{20}italic_N start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT = 2 start_POSTSUPERSCRIPT 20 end_POSTSUPERSCRIPT. This sampling error of the shots decreases with 1/NS1subscript𝑁𝑆1/\sqrt{N_{S}}1 / square-root start_ARG italic_N start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT end_ARG.

Real quantum computers are never perfectly isolated from the environment; thus many different types of decoherence errors appear at each of the individual gates. They are smaller for single qubit gates than for entanglement gates. In the simulation software Qiskit, the decoherence noise model implemented is such that customized quantum errors can be set. Thereby, the probabilities for the appearance of quantum gate errors (pgatesubscript𝑝gatep_{\text{gate}}italic_p start_POSTSUBSCRIPT gate end_POSTSUBSCRIPT), errors in measurement (pmeassubscript𝑝measp_{\text{meas}}italic_p start_POSTSUBSCRIPT meas end_POSTSUBSCRIPT) and in resetting (presetsubscript𝑝resetp_{\text{reset}}italic_p start_POSTSUBSCRIPT reset end_POSTSUBSCRIPT) of qubits are defined. We have done a study for the case with N=8𝑁8N=8italic_N = 8 and compared the results to the corresponding ideal SV simulations reported earlier. To this end, the noise model is implemented as follows. We choose the probabilities pgate=0.008subscript𝑝gate0.008p_{\text{gate}}=0.008italic_p start_POSTSUBSCRIPT gate end_POSTSUBSCRIPT = 0.008, pmeas=0.03subscript𝑝meas0.03p_{\text{meas}}=0.03italic_p start_POSTSUBSCRIPT meas end_POSTSUBSCRIPT = 0.03, and preset=0.0003subscript𝑝reset0.0003p_{\text{reset}}=0.0003italic_p start_POSTSUBSCRIPT reset end_POSTSUBSCRIPT = 0.0003 that a gate error, a measurement error, and a qubit reset error appear in the course of the quantum simulation.

Furthermore, the evaluation of the cost function is simplified to reduce the appearance of decoherence noise in the quantum circuits. As discussed in subsection 4.2, the costs are calculated on the basis of eq. (46). When the last term is dropped, which is always a constant term, the number of quantum circuits for the evaluation of the overlap terms can be reduced from 5 to 3. Thus, the minimum of C(λ0,𝝀)𝐶subscript𝜆0𝝀C(\lambda_{0},{\bm{\lambda}})italic_C ( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ) is technically no longer at zero, but at a negative constant value.

The direct comparison with the ideal state vector simulation is shown in Figs. 15(a)–(b). It can be seen that the concentration profile with the QASM simulator can reproduce advection and diffusion, but the profile differs slightly from the those of the ideal simulation and the analytical solution. The MSE is evaluated again as a measure of the deviation from the analytical solution and shown in Fig. 15(c). As expected, the MSE for the QASM simulation case is higher than that of the ideal simulation. Furthermore, it increases with respect to time. This can be explained by the error propagation from the previous step, which is included in this iterative framework. The cost function of the QASM simulation case is increased in comparison with the state vector simulation case, see Fig. 15(d), because the additional noise complicates the optimization procedure.

Refer to caption
Figure 15: Comparison between the shot based simulator (QASM) with statistical noise where shot number is 220superscript2202^{20}2 start_POSTSUPERSCRIPT 20 end_POSTSUPERSCRIPT and the ideal state vector (SV) simulator results and the analytical solution (ANA) with the concentration profiles for (a) t=0.04τa𝑡0.04subscript𝜏𝑎t=0.04\tau_{a}italic_t = 0.04 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT and (b) t=0.2τa𝑡0.2subscript𝜏𝑎t=0.2\tau_{a}italic_t = 0.2 italic_τ start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT for the the advection-diffusion case. In (c), the mean squared errors (MSE) of the different simulation methods are compared from which the deviation from the analytical solution is evaluated; in (d) the corresponding cost functions are shown.

6 Final discussion and outlook

The goal of the present work has been to present a one-to-one comparison of two quantum algorithms to simulate a simple linear flow problem numerically. In the present work we considered a time-dependent linear and one-dimensional advection-diffusion problem on the unit interval with periodic boundary conditions. The time evolution of this fluid mechanical problem is not unitary and hence requires specific steps to be taken in both algorithms. A passive scalar or concentration profile c(x,t)𝑐𝑥𝑡c(x,t)italic_c ( italic_x , italic_t ) is advected by a constant velocity U>0𝑈0U>0italic_U > 0 and subject to a constant molecular diffusion D𝐷Ditalic_D. The Péclet number is Pe=10𝑃𝑒10Pe=10italic_P italic_e = 10.

The two algorithms chosen were a Quantum Linear Systems Algorithm (QLSA) and a Variational Quantum Algorithm (VQA), both of which are hybrid quantum-classical in nature. We have investigated their performance on computational grids varying between N=8𝑁8N=8italic_N = 8 and 64, which correspond to 3 and 6 qubits, respectively. We were able to show that both algorithms perform well for the numerical solution of the fluid mechanical problem with a first order time integration scheme, using either a backward or a forward Euler integration scheme. The accuracy of the time evolution in both quantum algorithms, i.e., the forward Euler (FTCS) for VQA and backward Euler (BTCS) for QLSA is bounded from below by the round-off errors of the corresponding classical integration schemes. Accuracy was quantified by a mean squared error (MSE).

We have shown that both algorithms involved detailed pre-conditioning with respect to specific aspects; this was the major part of this work and could, in our view, be of interest to other users of these specific quantum algorithms. In QLSA, the central point that required comprehensive investigations is related to the approximate determination of eigenvalues of the unitary matrix U^(t)=exp(iA~t)^𝑈𝑡𝑖~𝐴𝑡\hat{U}(t)=\exp(i\tilde{A}t)over^ start_ARG italic_U end_ARG ( italic_t ) = roman_exp ( italic_i over~ start_ARG italic_A end_ARG italic_t ) in the Quantum Phase Estimation (QPE) stage. It is demonstrated that the number of additional qubits nqsubscript𝑛𝑞n_{q}italic_n start_POSTSUBSCRIPT italic_q end_POSTSUBSCRIPT needed for this task and appropriate pre-conditioning is key to the accuracy of the QLSA method. In case of the VQA, the classical optimization algorithm to determine the minimum of the cost function C(λ0,𝝀)𝐶subscript𝜆0𝝀C(\lambda_{0},{\bm{\lambda}})italic_C ( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ) turns out to be the bottleneck. In the present work, we found that the geometric Nelder-Mead algorithm gave the best results, despite a non-monotonic time evolution of the MSE; see also Appendix C. This result holds for the present benchmark task and the chosen boundary conditions. For example, Dirichlet boundary conditions of the concentration profile at the wall might eliminate this behaviour.

Our results suggest immediate directions for future research for both algorithms. For QLSA, the ongoing and upcoming work focuses on developing algorithms, which are mainly based on the concept of Linear Combination of Unitaries (LCU) Childs et al. (2017); Bharadwaj and Sreenivasan (2023) (QLSA-2) and eliminate the need for QPE. This ameliorates the higher circuit depths and gate count encountered in QLSA-1, making it more suitable for implementation on NISQ devices. Extending these tools to solve nonlinear flow problems by new embedding techniques such as Homotopy Analysis forms a major part of the future work Bharadwaj et al. (2023). In the case of VQA, surrogate algorithms for the global minimum search of the cost function have been suggested recently Shaffer et al. (2023). Finding minima in high-dimensional parameter spaces is a general problem of quantum algorithms. This includes quantum machine learning where barren plateaus limit the efficiency of implementation Cerezo et al. (2021). The strength of the VQA might become better visible for nonlinear problems already attempted, e.g. in Lubasch et al. Lubasch et al. (2020). These problems will, however, require higher-order time integration scheme to avoid numerical instabilities, e.g. when time-dependent nonlinear Schrödinger equations have to be solved. These equations describe also nonlinear wave phenomena in fluid mechanics Dudley et al. (2019).

In the end, we wish to provide a few more general comments on the subject as a whole. The numerical implementations of the classical fluid flow problems as a quantum algorithm have so far not gone beyond the proof-of-concept level. We discuss mostly one-dimensional linear and nonlinear problems while the realistic flows are two- and three-dimensional. Many studies, including most of the existing ones, are implemented in ideal quantum simulation frameworks, thus avoiding the decoherence problems of real and noisy quantum devices that are state-of-the art today. These considerations appear to hinder demonstration of true quantum advantage. In case of the variational methods, most algorithms do not come with theoretical guarantees of quantum advantage (or complexity). The advantage is contingent on problem-specific implementation of the ansatz as well as the parametrization and the optimization methods. On the other hand, QLSA algorithms come with theoretical guarantees of quantum complexity and advantage. However, these algorithms tend to be very sensitive to parameters such as sparsity S𝑆Sitalic_S of the linear systems matrix A~~𝐴\tilde{A}over~ start_ARG italic_A end_ARG, its condition number κ𝜅\kappaitalic_κ, or the choice of unitary bases in case of methods of LCU, making it hard to project their performance on real quantum devices. In both approaches, one also needs to account for the number of shots needed to sample the final quantum state. Therefore careful implementation of Quantum Amplitude Amplification Brassard et al. (2002) is necessary such that one obtains the solution while maintaining quantum advantage.

A desired quantum advantage will most possibly require us to rethink the solution of classical flow problems even more as a quantum mechanical problem. This might be obtained by transforming a nonlinear problem, which is numerically formulated in a finite-dimensional space (for example by a Galerkin method), to a corresponding linear problem in a much higher-dimensional (theoretically infinite-dimensional) Hilbert space. In the latter, the encoding capacity of quantum algorithms would fully unfold. One possible pathway in this respect can be provided by the quantum mechanical implementation of Carleman embeddings Liu et al. (2021); Engel et al. (2021), the Koopman operator formalism Joseph (2020); Giannakis et al. (2022); Lin et al. (2022) or the Homotopy analysis method. Apart from these, the quantum volume222Representing the combined measure of the size of quantum circuits (qubits and depth) that can be reliably used Cross et al. (2019). of the current and near-term quantum devices is an important consideration while designing algorithms in the hope of harnessing any quantum advantage. Future investigations will probably show us if these routes are indeed successful, and leave us with new scenarios in this research field.

Acknowledgements
We wish to thank Georgy Zinchenko for insightful discussions. The work of J.I. is funded by the European Union (ERC, MesoComp, 101052786). Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Research Council. Neither the European Union nor the granting authority can be held responsible for them. P.P. is supported by the project no. P2018-02-001 ”DeepTurb – Deep Learning in and of Turbulence” of the Carl Zeiss Foundation, Germany.

Appendix A Shift operations for cost function C(λ0,𝝀)𝐶subscript𝜆0𝝀C(\lambda_{0},{\bm{\lambda}})italic_C ( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ )

In the following, the shift operations are explained by a two-qubit example. These operations have been used in the evaluation of the cost function in the VQA. For this, a quantum register with the qubits q1subscript𝑞1q_{1}italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT and q2subscript𝑞2q_{2}italic_q start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT is considered to be in the initial state |01ket01|01\rangle| 01 ⟩. For a shift to the left which is defined as S^subscript^𝑆\hat{S}_{-}over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT operation, an X𝑋Xitalic_X gate is implemented on the first qubit and afterwards, a controlled NOT gate (CNOT) acts on the register as it is shown in Fig. 15(a). Consequently, the register is in the following state:

|10\xlongrightarrow[]B|11\xlongrightarrow[]B|01ket10\xlongrightarrowsuperscript𝐵ket11\xlongrightarrow𝐵ket01\displaystyle|10\rangle\xlongrightarrow[]{B^{\prime}}|11\rangle% \xlongrightarrow[]{B}|01\rangle| 10 ⟩ [ ] italic_B start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT | 11 ⟩ [ ] italic_B | 01 ⟩ (56)

For the S^+subscript^𝑆\hat{S}_{+}over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT operation, the gates are organized reversely as it is shown in Fig. 15(b). Then, the following states can be found:

|10\xlongrightarrow[]C|10\xlongrightarrow[]C|11ket10\xlongrightarrowsuperscript𝐶ket10\xlongrightarrow𝐶ket11\displaystyle|10\rangle\xlongrightarrow[]{C^{\prime}}|10\rangle% \xlongrightarrow[]{C}|11\rangle| 10 ⟩ [ ] italic_C start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT | 10 ⟩ [ ] italic_C | 11 ⟩ (57)

In the case of the considered cost function (see 4.2), the shift operations are applied to fixed quantum states |ψ~ket~𝜓|\tilde{\psi}\rangle| over~ start_ARG italic_ψ end_ARG ⟩ within a Hadamard test which is analogous to the evaluation of a scalar product in classical computation. Now we want to show by an example that an application of a S^+subscript^𝑆\hat{S}_{+}over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT operations (ψ~|S^+ψ~inner-product~𝜓subscript^𝑆~𝜓\langle\tilde{\psi}|\hat{S}_{+}\tilde{\psi}\rangle⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩) equals the application of any single shift operation for this special case. For this, the two-qubit quantum state is |ψ~=(a,b,c,d)Tket~𝜓superscript𝑎𝑏𝑐𝑑𝑇|\tilde{\psi}\rangle=(a,b,c,d)^{T}| over~ start_ARG italic_ψ end_ARG ⟩ = ( italic_a , italic_b , italic_c , italic_d ) start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT. Then follows,

ψ~|S^+ψ~inner-product~𝜓subscript^𝑆~𝜓\displaystyle\langle\tilde{\psi}|\hat{S}_{+}\tilde{\psi}\rangle⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ =(a,b,c,d)(d,a,b,c)T=ad+ba+cb+dcabsent𝑎𝑏𝑐𝑑superscript𝑑𝑎𝑏𝑐𝑇𝑎𝑑𝑏𝑎𝑐𝑏𝑑𝑐\displaystyle=(a,b,c,d)\cdot(d,a,b,c)^{T}=ad+ba+cb+dc= ( italic_a , italic_b , italic_c , italic_d ) ⋅ ( italic_d , italic_a , italic_b , italic_c ) start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT = italic_a italic_d + italic_b italic_a + italic_c italic_b + italic_d italic_c (58)
ψ~|S^ψ~inner-product~𝜓subscript^𝑆~𝜓\displaystyle\langle\tilde{\psi}|\hat{S}_{-}\tilde{\psi}\rangle⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ =(a,b,c,d)(b,c,d,a)T=ab+bc+cd+daabsent𝑎𝑏𝑐𝑑superscript𝑏𝑐𝑑𝑎𝑇𝑎𝑏𝑏𝑐𝑐𝑑𝑑𝑎\displaystyle=(a,b,c,d)\cdot(b,c,d,a)^{T}=ab+bc+cd+da= ( italic_a , italic_b , italic_c , italic_d ) ⋅ ( italic_b , italic_c , italic_d , italic_a ) start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT = italic_a italic_b + italic_b italic_c + italic_c italic_d + italic_d italic_a (59)
S^+ψ~|ψ~inner-productsubscript^𝑆~𝜓~𝜓\displaystyle\langle\hat{S}_{+}\tilde{\psi}|\tilde{\psi}\rangle⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over~ start_ARG italic_ψ end_ARG ⟩ =(d,a,b,c)(a,b,c,d)T=da+ab+bc+cdabsent𝑑𝑎𝑏𝑐superscript𝑎𝑏𝑐𝑑𝑇𝑑𝑎𝑎𝑏𝑏𝑐𝑐𝑑\displaystyle=(d,a,b,c)\cdot(a,b,c,d)^{T}=da+ab+bc+cd= ( italic_d , italic_a , italic_b , italic_c ) ⋅ ( italic_a , italic_b , italic_c , italic_d ) start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT = italic_d italic_a + italic_a italic_b + italic_b italic_c + italic_c italic_d (60)
S^ψ~|ψ~inner-productsubscript^𝑆~𝜓~𝜓\displaystyle\langle\hat{S}_{-}\tilde{\psi}|\tilde{\psi}\rangle⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over~ start_ARG italic_ψ end_ARG ⟩ =(b,c,d,a)(a,b,c,d)T=ba+cb+dc+adabsent𝑏𝑐𝑑𝑎superscript𝑎𝑏𝑐𝑑𝑇𝑏𝑎𝑐𝑏𝑑𝑐𝑎𝑑\displaystyle=(b,c,d,a)\cdot(a,b,c,d)^{T}=ba+cb+dc+ad= ( italic_b , italic_c , italic_d , italic_a ) ⋅ ( italic_a , italic_b , italic_c , italic_d ) start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT = italic_b italic_a + italic_c italic_b + italic_d italic_c + italic_a italic_d (61)

It can be observed that ψ~|S^+ψ~=ψ~|S^ψ~=S^+ψ~|ψ~=S^ψ~|ψ~inner-product~𝜓subscript^𝑆~𝜓inner-product~𝜓subscript^𝑆~𝜓inner-productsubscript^𝑆~𝜓~𝜓inner-productsubscript^𝑆~𝜓~𝜓\langle\tilde{\psi}|\hat{S}_{+}\tilde{\psi}\rangle=\langle\tilde{\psi}|\hat{S}% _{-}\tilde{\psi}\rangle=\langle\hat{S}_{+}\tilde{\psi}|\tilde{\psi}\rangle=% \langle\hat{S}_{-}\tilde{\psi}|\tilde{\psi}\rangle⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ = ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ = ⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over~ start_ARG italic_ψ end_ARG ⟩ = ⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over~ start_ARG italic_ψ end_ARG ⟩. Furthermore, these shift operations can be applied to both factors of the scalar product. If the same shift operation is applied to both scalar product entries, e.g., S^+ψ~|S^+ψ~inner-productsubscript^𝑆~𝜓subscript^𝑆~𝜓\langle\hat{S}_{+}\tilde{\psi}|\hat{S}_{+}\tilde{\psi}\rangle⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩, the identity will be computed because

S^(+/)ψ~|S^(+/)ψ~=ψ~|ψ~=iψ~i2=1.\displaystyle\langle\hat{S}_{(+/-)}\tilde{\psi}|\hat{S}_{(+/-)}\tilde{\psi}% \rangle=\langle\tilde{\psi}|\tilde{\psi}\rangle=\sum_{i}\tilde{\psi}_{i}^{2}=1.⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT ( + / - ) end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT ( + / - ) end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ = ⟨ over~ start_ARG italic_ψ end_ARG | over~ start_ARG italic_ψ end_ARG ⟩ = ∑ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT = 1 . (62)

Furthermore, S^ψ~|S^+ψ~inner-productsubscript^𝑆~𝜓subscript^𝑆~𝜓\langle\hat{S}_{-}\tilde{\psi}|\hat{S}_{+}\tilde{\psi}\rangle⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ can be rewritten to ψ~|S^+S^+ψ~=ψ~|S^++ψ~inner-product~𝜓subscript^𝑆subscript^𝑆~𝜓inner-product~𝜓subscript^𝑆absent~𝜓\langle\tilde{\psi}|\hat{S}_{+}\hat{S}_{+}\tilde{\psi}\rangle=\langle\tilde{% \psi}|\hat{S}_{++}\tilde{\psi}\rangle⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ = ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩,

S^ψ~|S^+ψ~inner-productsubscript^𝑆~𝜓subscript^𝑆~𝜓\displaystyle\langle\hat{S}_{-}\tilde{\psi}|\hat{S}_{+}\tilde{\psi}\rangle⟨ over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ =(b,c,d,a)(d,a,b,c)T=bd+ca+db+acabsent𝑏𝑐𝑑𝑎superscript𝑑𝑎𝑏𝑐𝑇𝑏𝑑𝑐𝑎𝑑𝑏𝑎𝑐\displaystyle=(b,c,d,a)\cdot(d,a,b,c)^{T}=bd+ca+db+ac= ( italic_b , italic_c , italic_d , italic_a ) ⋅ ( italic_d , italic_a , italic_b , italic_c ) start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT = italic_b italic_d + italic_c italic_a + italic_d italic_b + italic_a italic_c (63)
ψ~|S^++ψ~inner-product~𝜓subscript^𝑆absent~𝜓\displaystyle\langle\tilde{\psi}|\hat{S}_{++}\tilde{\psi}\rangle⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ =(a,b,c,d)(c,d,a,b)T=ac+bd+ca+dbabsent𝑎𝑏𝑐𝑑superscript𝑐𝑑𝑎𝑏𝑇𝑎𝑐𝑏𝑑𝑐𝑎𝑑𝑏\displaystyle=(a,b,c,d)\cdot(c,d,a,b)^{T}=ac+bd+ca+db= ( italic_a , italic_b , italic_c , italic_d ) ⋅ ( italic_c , italic_d , italic_a , italic_b ) start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT = italic_a italic_c + italic_b italic_d + italic_c italic_a + italic_d italic_b (64)

Analogously, it holds ψ~|S^ψ~=ψ~|S^++ψ~inner-product~𝜓subscript^𝑆absent~𝜓inner-product~𝜓subscript^𝑆absent~𝜓\langle\tilde{\psi}|\hat{S}_{--}\tilde{\psi}\rangle=\langle\tilde{\psi}|\hat{S% }_{++}\tilde{\psi}\rangle⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - - end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩ = ⟨ over~ start_ARG italic_ψ end_ARG | over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + + end_POSTSUBSCRIPT over~ start_ARG italic_ψ end_ARG ⟩.


q1=|0subscript𝑞1ket0q_{1}=|0\rangleitalic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = | 0 ⟩q2=|1subscript𝑞2ket1q_{2}=|1\rangleitalic_q start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = | 1 ⟩A𝐴Aitalic_AX𝑋Xitalic_XBsuperscript𝐵B^{\prime}italic_B start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPTB𝐵Bitalic_B
(a) S^subscript^𝑆\hat{S}_{-}over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT - end_POSTSUBSCRIPT operation.
q1=|0subscript𝑞1ket0q_{1}=|0\rangleitalic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = | 0 ⟩q2=|1subscript𝑞2ket1q_{2}=|1\rangleitalic_q start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = | 1 ⟩A𝐴Aitalic_AX𝑋Xitalic_XCsuperscript𝐶C^{\prime}italic_C start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPTC𝐶Citalic_C
(b) S^+subscript^𝑆\hat{S}_{+}over^ start_ARG italic_S end_ARG start_POSTSUBSCRIPT + end_POSTSUBSCRIPT operation.
Figure 16: Definition of the shift operations for two qubits with X𝑋Xitalic_X and CNOT gates.

Appendix B The Hadamard test

In general, the Hadamard test is a method which allows to find the expectation value φ|U^φconditional𝜑^𝑈𝜑\Re\langle\varphi|\hat{U}|\varphi\rangleroman_ℜ ⟨ italic_φ | over^ start_ARG italic_U end_ARG | italic_φ ⟩. For this, a unitary gate U^^𝑈\hat{U}over^ start_ARG italic_U end_ARG acts on the qubit q1subscript𝑞1q_{1}italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT which is in the state |φket𝜑|\varphi\rangle| italic_φ ⟩. The corresponding quantum circuit is shown in Fig. 17. First, the quantum circuit is in the state

|q1q0A=|φ|0.subscriptketsubscript𝑞1subscript𝑞0𝐴tensor-productket𝜑ket0\displaystyle|q_{1}q_{0}\rangle_{A}=|\varphi\rangle\otimes|0\rangle.| italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT italic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ⟩ start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT = | italic_φ ⟩ ⊗ | 0 ⟩ . (65)

The first Hadamard gate acts on the zeroth qubit such that

|q1q0Bsubscriptketsubscript𝑞1subscript𝑞0𝐵\displaystyle|q_{1}q_{0}\rangle_{B}| italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT italic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ⟩ start_POSTSUBSCRIPT italic_B end_POSTSUBSCRIPT =|φ12(|0+|1)=12(|φ|0+|φ|1).absenttensor-productket𝜑12ket0ket112tensor-productket𝜑ket0tensor-productket𝜑ket1\displaystyle=|\varphi\rangle\otimes\frac{1}{\sqrt{2}}\left(|0\rangle+|1% \rangle\right)=\frac{1}{\sqrt{2}}\left(|\varphi\rangle\otimes|0\rangle+|% \varphi\rangle\otimes|1\rangle\right).= | italic_φ ⟩ ⊗ divide start_ARG 1 end_ARG start_ARG square-root start_ARG 2 end_ARG end_ARG ( | 0 ⟩ + | 1 ⟩ ) = divide start_ARG 1 end_ARG start_ARG square-root start_ARG 2 end_ARG end_ARG ( | italic_φ ⟩ ⊗ | 0 ⟩ + | italic_φ ⟩ ⊗ | 1 ⟩ ) . (66)

The unitary gate is implemented on the qubit q1subscript𝑞1q_{1}italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT and is controlled to the ancilla qubit q0subscript𝑞0q_{0}italic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT such that follows:

|q1q0Csubscriptketsubscript𝑞1subscript𝑞0𝐶\displaystyle|q_{1}q_{0}\rangle_{C}| italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT italic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ⟩ start_POSTSUBSCRIPT italic_C end_POSTSUBSCRIPT =12(|φ|0+U^|φ|1).absent12tensor-productket𝜑ket0tensor-product^𝑈ket𝜑ket1\displaystyle=\frac{1}{\sqrt{2}}\left(|\varphi\rangle\otimes|0\rangle+\hat{U}|% \varphi\rangle\otimes|1\rangle\right).= divide start_ARG 1 end_ARG start_ARG square-root start_ARG 2 end_ARG end_ARG ( | italic_φ ⟩ ⊗ | 0 ⟩ + over^ start_ARG italic_U end_ARG | italic_φ ⟩ ⊗ | 1 ⟩ ) . (67)

Considering the second Hadamard gate, the state of the quantum circuit changes to the following one:

|q1q0Dsubscriptketsubscript𝑞1subscript𝑞0𝐷\displaystyle|q_{1}q_{0}\rangle_{D}| italic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT italic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ⟩ start_POSTSUBSCRIPT italic_D end_POSTSUBSCRIPT =12(|φ(|0+|1)+U^|φ(|0|1)\displaystyle=\frac{1}{2}\left(|\varphi\rangle\otimes(|0\rangle+|1\rangle)+% \hat{U}|\varphi\rangle\otimes(|0\rangle-|1\rangle\right)= divide start_ARG 1 end_ARG start_ARG 2 end_ARG ( | italic_φ ⟩ ⊗ ( | 0 ⟩ + | 1 ⟩ ) + over^ start_ARG italic_U end_ARG | italic_φ ⟩ ⊗ ( | 0 ⟩ - | 1 ⟩ ) (68)
=12((𝟙+U^)|φ|0+(𝟙U^)|φ|1)absent12tensor-product1^𝑈ket𝜑ket0tensor-product1^𝑈ket𝜑ket1\displaystyle=\frac{1}{2}\left((\mathds{1}+\hat{U})|\varphi\rangle\otimes|0% \rangle+(\mathds{1}-\hat{U})|\varphi\rangle\otimes|1\rangle\right)= divide start_ARG 1 end_ARG start_ARG 2 end_ARG ( ( blackboard_1 + over^ start_ARG italic_U end_ARG ) | italic_φ ⟩ ⊗ | 0 ⟩ + ( blackboard_1 - over^ start_ARG italic_U end_ARG ) | italic_φ ⟩ ⊗ | 1 ⟩ )

The measurement is performed in the standard Z𝑍Zitalic_Z basis such that

p0p1subscript𝑝0subscript𝑝1\displaystyle p_{0}-p_{1}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT - italic_p start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT =14φ|(𝟙+U^)(𝟙+U^)|φ14φ|(𝟙U^)(𝟙U^)|φabsent14quantum-operator-product𝜑superscript1^𝑈1^𝑈𝜑14quantum-operator-product𝜑superscript1^𝑈1^𝑈𝜑\displaystyle=\frac{1}{4}\langle\varphi|(\mathds{1}+\hat{U})^{\dagger}(\mathds% {1}+\hat{U})|\varphi\rangle-\frac{1}{4}\langle\varphi|(\mathds{1}-\hat{U})^{% \dagger}(\mathds{1}-\hat{U})|\varphi\rangle= divide start_ARG 1 end_ARG start_ARG 4 end_ARG ⟨ italic_φ | ( blackboard_1 + over^ start_ARG italic_U end_ARG ) start_POSTSUPERSCRIPT † end_POSTSUPERSCRIPT ( blackboard_1 + over^ start_ARG italic_U end_ARG ) | italic_φ ⟩ - divide start_ARG 1 end_ARG start_ARG 4 end_ARG ⟨ italic_φ | ( blackboard_1 - over^ start_ARG italic_U end_ARG ) start_POSTSUPERSCRIPT † end_POSTSUPERSCRIPT ( blackboard_1 - over^ start_ARG italic_U end_ARG ) | italic_φ ⟩ (69)
=12φ|U^+U^|φ=φ|U^φ.absent12quantum-operator-product𝜑superscript^𝑈^𝑈𝜑conditional𝜑^𝑈𝜑\displaystyle=\frac{1}{2}\langle\varphi|\hat{U}^{\dagger}+\hat{U}|\varphi% \rangle=\Re\langle\varphi|\hat{U}|\varphi\rangle\,.= divide start_ARG 1 end_ARG start_ARG 2 end_ARG ⟨ italic_φ | over^ start_ARG italic_U end_ARG start_POSTSUPERSCRIPT † end_POSTSUPERSCRIPT + over^ start_ARG italic_U end_ARG | italic_φ ⟩ = roman_ℜ ⟨ italic_φ | over^ start_ARG italic_U end_ARG | italic_φ ⟩ .
q0=|0subscript𝑞0ket0q_{0}=|0\rangleitalic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = | 0 ⟩q1=|φsubscript𝑞1ket𝜑q_{1}=|\varphi\rangleitalic_q start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = | italic_φ ⟩A𝐴Aitalic_AH𝐻Hitalic_HU^^𝑈\hat{U}over^ start_ARG italic_U end_ARGH𝐻Hitalic_HB𝐵Bitalic_BC𝐶Citalic_CD𝐷Ditalic_D
Figure 17: Two qubit quantum circuit which defines the general Hadamard test. Two Hadamard gates are applied on the ancilla qubit q0subscript𝑞0q_{0}italic_q start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and a controlled unitary transformation U^^𝑈\hat{U}over^ start_ARG italic_U end_ARG is applied between these Hadamard gates. The measurement of the ancilla qubit returns the expectation value φ|U^φconditional𝜑^𝑈𝜑\Re\langle\varphi|\hat{U}|\varphi\rangleroman_ℜ ⟨ italic_φ | over^ start_ARG italic_U end_ARG | italic_φ ⟩ for the variable U^|φ^𝑈ket𝜑\hat{U}|\varphi\rangleover^ start_ARG italic_U end_ARG | italic_φ ⟩. This Hadamard test principle is used in the VQA to evaluate the cost function.

Appendix C Classical optimization methods for the VQA

In this appendix, the classical optimization methods for the VQA are introduced and compared. The optimization in the considered advection-diffusion problem is challenging due to different aspects. First, the number of parameters which are optimized and hence, the complexity of the optimization problem, scales with the qubit number. Consequently, a fine discretization with a large number of qubits and the chosen ansatz function lead to a high-dimensional parameter space and a complex-shaped cost function for the classical optimization. Secondly, vanishing gradients which drive the search in a local minimum, also known as barren plateaus Uvarov and Biamonte (2021), complicate the search for the global minimum.

Furthermore, the imposed periodic boundary conditions can induce rapidly changing parameter sets at the boundaries. This aspect is visualized by the simple example of a triangle function which is moving by one cell per time step in Fig. 18. The movement far away from the boundaries results in small changes of the parameter set (λ0,𝝀)subscript𝜆0𝝀(\lambda_{0},{\bm{\lambda}})( italic_λ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_italic_λ ). If the periodic boundary is crossed and entries at the other boundary appear, the state vector which models the concentration profile changes strongly and hence, the corresponding parameter set 𝝀𝝀{\bm{\lambda}}bold_italic_λ shows major modifications. This aspect is specific to geometric optimization algorithms. Lastly, the existence of noise in the evaluation of quantum circuits contributes to the challenges of the classical optimization. In this work, ideal simulations were considered and hence, the impact of noise is neglected in the selection of the optimization algorithm. For the comparison of the classical optimization algorithms, the VQA is applied to the one-dimensional advection-diffusion equation for the case with N=16𝑁16N=16italic_N = 16. The parameters are D=1𝐷1D=1italic_D = 1, u=10𝑢10u=10italic_u = 10, and τ=0.001𝜏0.001\tau=0.001italic_τ = 0.001 and the computation is performed for a total time T=30τ𝑇30𝜏T=30\tauitalic_T = 30 italic_τ.

Refer to caption
Figure 18: Comparison of the changing parameter set 𝝀𝝀{\bm{\lambda}}bold_italic_λ for an advection crossing the periodic boundary by the example of a simple advection of a hat signal for N=8𝑁8N=8italic_N = 8. For advection far from the boundaries, the concentration profile for a time (a) t1subscript𝑡1t_{1}italic_t start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT and (b) t2subscript𝑡2t_{2}italic_t start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT is shown with (c) the corresponding distribution of the parameter set 𝝀=(λ1,,λ7)𝝀subscript𝜆1subscript𝜆7{\bm{\lambda}}=(\lambda_{1},\dots,\lambda_{7})bold_italic_λ = ( italic_λ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_λ start_POSTSUBSCRIPT 7 end_POSTSUBSCRIPT ). The concentration profiles for a time (d) t3subscript𝑡3t_{3}italic_t start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT and (e) t4subscript𝑡4t_{4}italic_t start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT show the case where the periodic boundaries are crossed and the corresponding distribution of the parameters 𝝀𝝀{\bm{\lambda}}bold_italic_λ can be found in panel (f). The comparison between the panels (c) and (f) show that crossing the boundary layer results in larger changes of the parameter vector which can be problematic for the optimization routine.

The Nelder-Mead algorithm (NM) Nelder and Mead (1965) or downhill-simplex algorithm is designed to solve classical unconstrained optimization problems without any gradient approximation. The algorithm only uses the function values at some points which construct the simplex in the hyperplane. This simplex is transformed by geometric operations such as reflection, expansion, contraction and shrinking. The Nelder-Mead algorithm uses a geometric method in order to find the minimum of the given cost function. The application of the Nelder-Mead algorithm in the considered advection-diffusion problem showed that this algorithm is robust for small search spaces (N16𝑁16N\leq 16italic_N ≤ 16). Moreover, the mean computation time per time step is small in comparison to other methods. However, problems appear if the qubit amount is increased or there are entries at the elements at the boundary. Reasonable for this might be the fact that the parameter set changes rapidly at the periodic boundary in comparison to the changes far away from the boundary, see again Fig. 18. Consequently, other optimization algorithms need to be considered for an increased qubit amount.

The Broyden-Fletcher-Goldfarb-Shanno algorithm (BFGS) applies a quasi-Newton method for solving unconstrained, nonlinear optimization problems. Thereby, the Hessian matrix of the cost function is approximated by the evaluation of the gradients (or the approximated gradients) in order to find the descent direction in the hyperparameter landscape. In this work, an adaption of the BFGS algorithm is used. The Limited memory-BFGS algorithm for bound constraints (L-BFGS-B) Liu and Nocedal (1989) uses a limited amount of computer memory which makes the algorithm suitable for large search spaces. Furthermore, it can handle bound constraints. In this investigation, the L-BFGS-B algorithm cannot find the global minimum such that the mean MSE is approximately 104superscript10410^{-4}10 start_POSTSUPERSCRIPT - 4 end_POSTSUPERSCRIPT. A possible reason for this is the disadvantageous initial parameter set. In order to improve the performance, the L-BFGS-B method is combined with other preceding optimization methods which aim at finding an appropriate region for further optimization.

The first one is the combination of the Bayesian optimization and L-BFGS-B algorithm (BO+L-BFGS). Bayesian optimization Mockus et al. (1978) is suitable for optimization problems where the costs are given as black box functions, are expensive to evaluate or include noise. This method approximates the cost function by a Gaussian process regression based on previous observations. An acquisition function determines the next samples for the observations whereby random exploration steps can be added in order to include a wide range of observations for the fitting of the cost landscape. This aims at finding a promising region for further optimization with the L-BFGS-B algorithm. With this preceding Bayesian optimization, the results of L-BFGS-B algorithm could be improved such that the mean MSE is approximate 105superscript10510^{-5}10 start_POSTSUPERSCRIPT - 5 end_POSTSUPERSCRIPT, but the computation time is increased. However, the application of this combination of methods is reasonable if the system size is increased. For this, the test case was expanded to N=64𝑁64N=64italic_N = 64. Thereby, the Nelder-Mead optimization cannot find the global minimum of the cost function (C102𝐶superscript102C\approx 10^{-2}italic_C ≈ 10 start_POSTSUPERSCRIPT - 2 end_POSTSUPERSCRIPT) and hence, the optimization fails. In contrast, the combination of Bayesian optimization and L-BFGS-B algorithm shows small costs (C1010,,105𝐶superscript1010superscript105C\approx 10^{-10},\dots,10^{-5}italic_C ≈ 10 start_POSTSUPERSCRIPT - 10 end_POSTSUPERSCRIPT , … , 10 start_POSTSUPERSCRIPT - 5 end_POSTSUPERSCRIPT) and good results in accuracy. This is shown qualitatively with the concentration profiles in Fig. 19a and 19b and with the comparison of the cost functions (Fig. 19c).

Secondly, the Adaptive moments algorithm (Adam) Kingma and Ba (2015) is combined with the L-BFGS-B algorithm. The Adam algorithm uses a gradient-based method to determine the descent direction in the hyperparameter landscape. It includes an adaptive learning rate and momentum for each update step of the parameter which improves the performance in cases of sparse gradients and non-stationary problems. Furthermore, it is suitable for the optimization of large parameter sets. In this investigation, the combination of Adam and L-BFGS-B algorithm can process the test case with an accuracy 105absentsuperscript105\approx 10^{-5}≈ 10 start_POSTSUPERSCRIPT - 5 end_POSTSUPERSCRIPT, but the computational effort is too high to use this method for increased system sizes. Reasonable for this high computation time is the large amount of required iteration steps which all include the calculation of the gradients.

The Simultaneous Perturbation Stochastic Approximation (SPSA) Spall (1998) is an optimization algorithm which uses a stochastic method to approximate the gradient of the cost function. Thereby, the cost function is evaluated twice with completely perturbed parameter sets. The parameters are chosen randomly using a zero-mean distribution. This algorithm is robust to noise. In this work, the SPSA optimization could not find the minimum such that the costs were found to be 102absentsuperscript102\approx 10^{-2}≈ 10 start_POSTSUPERSCRIPT - 2 end_POSTSUPERSCRIPT which results in high mean squared errors (103absentsuperscript103\approx 10^{-3}≈ 10 start_POSTSUPERSCRIPT - 3 end_POSTSUPERSCRIPT).

In conclusion, the Nelder-Mead algorithm can be recommended in cases of low parameter spaces (N16𝑁16N\leq 16italic_N ≤ 16) due to its accuracy and the computation time. If the system is increased it is advisable to chose the combination of Bayesian optimization and L-BFGS-B algorithm. The comparison of the mean squared errors and the cost functions of the VQA with the presented optimization algorithms are shown in Fig. 20. Furthermore, an overview of the used optimization algorithms, the corresponding methods, accuracy and computation efforts is presented in table 1.

Refer to caption
Figure 19: Comparison of the concentration profiles of the analytical solution (ANA) and the VQA results with the Nelder-Mead optimization (NM) and the combined Bayesian and Broyden-Fletcher-Goldfarb-Shanno algorithm optimization (BO+BFGS-L) for N=64𝑁64N=64italic_N = 64. In (a) the concentration profile of the for t=2τ𝑡2𝜏t=2\tauitalic_t = 2 italic_τ is shown and in (b) for t=4τ𝑡4𝜏t=4\tauitalic_t = 4 italic_τ. Here, the parameters are chosen to be D=1𝐷1D=1italic_D = 1, U=10𝑈10U=10italic_U = 10, τ=6.1×105𝜏6.1superscript105\tau=6.1\times 10^{-5}italic_τ = 6.1 × 10 start_POSTSUPERSCRIPT - 5 end_POSTSUPERSCRIPT. In (c) the corresponding cost function is shown.
Refer to caption
Figure 20: Comparison of investigated optimization methods with (a) the mean squared error (MSE) and (b) the cost function over time. Overall the combined optimization with Adam and L-BFGS algorithm shows the best performance for the considered test case with N=16𝑁16N=16italic_N = 16, D=1𝐷1D=1italic_D = 1, U=10𝑈10U=10italic_U = 10 and τ=0.001𝜏0.001\tau=0.001italic_τ = 0.001.
Optimizer Method Accuracy Computation time
NM geometric 105similar-toabsentsuperscript105\sim 10^{-5}∼ 10 start_POSTSUPERSCRIPT - 5 end_POSTSUPERSCRIPT 0.75h0.750.75h0.75 italic_h
L-BFGS-B gradient-based 104similar-toabsentsuperscript104\sim 10^{-4}∼ 10 start_POSTSUPERSCRIPT - 4 end_POSTSUPERSCRIPT 0.75h0.750.75h0.75 italic_h
BO approximation 105similar-toabsentsuperscript105\sim 10^{-5}∼ 10 start_POSTSUPERSCRIPT - 5 end_POSTSUPERSCRIPT 2.25h2.252.25h2.25 italic_h
& L-BFGS-B gradient-based
Adam gradient-based 105similar-toabsentsuperscript105\sim 10^{-5}∼ 10 start_POSTSUPERSCRIPT - 5 end_POSTSUPERSCRIPT 7.5h7.57.5h7.5 italic_h
& L-BFGS-B gradient-based
SPSA stochastic 103similar-toabsentsuperscript103\sim 10^{-3}∼ 10 start_POSTSUPERSCRIPT - 3 end_POSTSUPERSCRIPT 6.25h6.256.25h6.25 italic_h
approximation
Table 1: Comparison of classical optimization methods for VQA. The accuracy is given as the magnitude of the MSE, see eq. (52) and the computation time is the mean value for the computation of one time step.

References

  • Preskill (2018) J. Preskill, Quantum computing in the NISQ era and beyond, Quantum 2 (2018) 79.
  • Deutsch (2020) I. H. Deutsch, Harnessing the power of the second quantum revolution, PRX Quantum 1 (2020) 020101.
  • Nielsen and Chuang (2011) M. Nielsen, I. Chuang, Quantum Computation and Quantum Information: 10th Anniversary Edition, Cambridge University Press, 2011.
  • Shor (1997) P. W. Shor, Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer, SIAM J. Comput. 26 (1997) 1484–1509.
  • Grover (1997) L. K. Grover, Quantum mechanics helps in searching for a needle in a haystack, Phys. Rev. Lett. 79 (1997) 325–328.
  • Deng et al. (2023) Y.-H. Deng, Y.-C. Gu, H.-L. Liu, S.-Q. Gong, H. Su, Z.-J. Zhang, H.-Y. Tang, M.-H. Jia, J.-M. Xu, M.-C. Chen, J. Qin, L.-C. Peng, J. Yan, Y. Hu, J. Huang, H. Li, Y. Li, Y. Chen, X. Jiang, L. Gan, G. Yang, L. You, L. Li, H.-S. Zhong, H. Wang, N.-L. Liu, J. J. Renema, C.-Y. Lu, J.-W. Pan, Gaussian boson sampling with pseudo-photon-number-resolving detectors and quantum computational advantage, Phys. Rev. Lett. 131 (2023) 150601.
  • Choi et al. (2023) S. Choi, W. S. Moses, N. Thompson, The Quantum Tortoise and the Classical Hare: A simple framework for understanding which problems quantum computing will accelerate (and which it won’t), 2023. arXiv:2310.15505.
  • Moin and Mahesh (1998) P. Moin, K. Mahesh, Direct Numerical Simulation: A tool in turbulence research, Annu. Rev. Fluid Mech. 30 (1998) 539–578.
  • Iyer et al. (2019) K. P. Iyer, J. Schumacher, K. R. Sreenivasan, P. K. Yeung, Scaling of locally averaged energy dissipation and enstrophy density in isotropic turbulence, New J. Phys. 21 (2019) 033016.
  • Buaria et al. (2019) D. Buaria, A. Pumir, E. Bodenschatz, P. K. Yeung, Extreme velocity gradients in turbulent flows, New J. Phys. 21 (2019) 043004.
  • Gourianov et al. (2022) N. Gourianov, M. Lubasch, S. Dolgov, Q. Y. van den Berg, H. Babaee, P. Givi, M. Kiffner, D. Jaksch, A quantum-inspired approach to exploit turbulence structures, Nat. Comput. Sci. 2 (2022) 30–37.
  • Meng and Yang (2023) Z. Meng, Y. Yang, Quantum computing of fluid dynamics using the hydrodynamic Schrödinger equation, Phys. Rev. Research 5 (2023) 033182.
  • Jin et al. (2023) S. Jin, N. Liu, Y. Yu, Quantum simulation of partial differential equations: Applications and detailed analysis, Phys. Rev. A 108 (2023) 032603.
  • Succi and Tiribocchi (2023) S. Succi, A. Tiribocchi, Navier-Stokes-Schrödinger equation for dissipative fluids, 2023. arXiv:2308.05879.
  • Pfeffer et al. (2022) P. Pfeffer, F. Heyder, J. Schumacher, Hybrid quantum-classical reservoir computing of thermal convection flow, Phys. Rev. Research 4 (2022) 033176.
  • Pfeffer et al. (2023) P. Pfeffer, F. Heyder, J. Schumacher, Reduced-order modeling of two-dimensional turbulent Rayleigh-Bénard flow by hybrid quantum-classical reservoir computing, Phys. Rev. Research 5 (2023) 043242.
  • Bharadwaj and Sreenivasan (2020) S. S. Bharadwaj, K. R. Sreenivasan, Quantum computation of fluid dynamics, Indian Academy of Sciences Conference Series 3 (2020) 77–96.
  • Bharadwaj and Sreenivasan (2023) S. S. Bharadwaj, K. R. Sreenivasan, Hybrid quantum algorithms for flow problems, Proc. Natl. Acad. Sci. USA 120 (2023) e2311014120.
  • Bharadwaj et al. (2023) S. S. Bharadwaj, B. Nadiga, S. Eidenbenz, K. R. Sreenivasan, Quantum computing of nonlinear flow problems with a homotopy analysis algorithm, Bull. Am. Phys. Soc. ZC17 (2023) 002.
  • Gaitan (2021) F. Gaitan, Finding flows in a Navier-Stokes fluid through quantum computing, npj Quantum Inf. 6 (2021) 61.
  • Lubasch et al. (2020) M. Lubasch, J. Joo, P. Moinier, M. Kiffner, D. Jaksch, Variational quantum algorithms for nonlinear problems, Phys. Rev. A 101 (2020) 010301. doi:10.1103/PhysRevA.101.010301.
  • Pool et al. (2022) A. J. Pool, A. D. Somoza, M. Lubasch, B. Horstmann, Solving partial differential equations using a quantum computer, 2022 IEEE International Conference on Quantum Computing and Engineering (2022) 864–866.
  • Demirdjian et al. (2020) R. Demirdjian, D. Gunlycke, C. A. Reynolds, J. D. Doyle, S. Tafur, Variational quantum solutions to the advection–diffusion equation for applications in fluid dynamics, Quantum Inf. Process. 21 (2020) 322.
  • Leong et al. (2022) F. Y. Leong, W.-B. Ewe, D. E. Koh, Variational quantum evolution equation solver, Sci. Rep. 12 (2022) 10817.
  • Leong et al. (2023) F. Y. Leong, D. E. Koh, W.-B. Ewe, J. F. Kong, Variational quantum simulation of partial differential equations: Applications in colloidal transport, Int. J. Numer. Method H. 33 (2023) 3669–3690.
  • Todorova and de Steijl (2020) B. N. Todorova, R. de Steijl, Quantum algorithm for the collisionless Boltzmann equation, J. Comp. Phys. 409 (2020) 109347.
  • Budinski (2021) L. Budinski, Quantum algorithm for the advection–diffusion equation simulated with the Lattice Boltzmann method, Quantum Inf. Process. 20 (2021) 57.
  • Succi et al. (2023) S. Succi, W. Itani, K. R. Sreenivasan, R. Steijl, Quantum computing for fluids: Where do we stand?, Europhys. Lett. 144 (2023) 10001.
  • Harrow et al. (2009) A. H. Harrow, A. Hassidim, S. Lloyd, Quantum algorithm for linear systems of equations, Phys. Rev. Lett. 103 (2009) 150502. doi:10.1103/PhysRevLett.103.150502.
  • Aaronson (2015) S. Aaronson, Read the fine print, Nature Physics 11 (2015) 291–293.
  • Montanaro and Pallister (2016) A. Montanaro, S. Pallister, Quantum algorithms and the finite element method, Phys. Rev. A 93 (2016) 032324.
  • Guseynov et al. (2023) N. M. Guseynov, A. A. Zhukov, W. V. Pogosov, A. V. Lebedev, Depth analysis of variational quantum algorithms for the heat equation, Phys. Rev. A 107 (2023) 052422. doi:10.1103/PhysRevA.107.052422.
  • Liu et al. (2023) Y. Y. Liu, Z. Chen, C. Shu, S. C. Chew, B. C. Khoo, X. Zhao, Y. D. Cui, Application of a variational hybrid quantum-classical algorithm to heat conduction equation and analysis of time complexity, Phys. Fluids 34 (2023) 117121.
  • Qis (2023) Qiskit version 0.23.2 (2023).
  • Childs et al. (2017) A. M. Childs, R. Kothari, R. D. Somma, Quantum algorithm for systems of linear equations with exponentially improved dependence on precision, SIAM J. Comput. 46 (2017) 1920–1950.
  • Childs et al. (2021) A. M. Childs, J.-P. Liu, A. Ostrander, High-precision quantum algorithms for partial differential equations, Quantum 5 (2021) 574.
  • Liu et al. (2021) J.-P. Liu, H. Ø. Kolden, H. K. Krovi, N. F. Loureiro, K. Trivisa, A. M. Childs, Efficient quantum algorithm for dissipative nonlinear differential equations, Proc. Natl. Acad. Sci. USA 118 (2021) e2026805118.
  • Cerezo et al. (2021) M. Cerezo, A. Arrasmith, R. Babbush, S. C. Benjamin, S. Endo, K. Fujii, J. R. McClean, K. Mitarai, X. Yuan, L. Cincio, P. J. Coles, Variational quantum algorithms, Nat. Rev. Phys. 3 (2021) 625–644.
  • Nelder and Mead (1965) J. Nelder, R. Mead, A simplex method for function minimization, The Computer Journal 7 (1965) 308–313. doi:10.1093/comjnl/7.4.308.
  • Barratt et al. (2021) F. Barratt, J. Dborin, M. Bal, V. Stojevic, F. Pollmann, A. G. Green, Parallel quantum simulation of large systems on small NISQ computers, npj Quantum Inf. 7 (2021) 79.
  • Shaffer et al. (2023) R. Shaffer, L. Kocia, M. Sarovar, Surrogate-based optimization for variational quantum algorithms, Phys. Rev. A 107 (2023) 032415.
  • Dudley et al. (2019) J. M. Dudley, G. Genty, A. Mussot, A. Chabchoub, F. Dias, Rogue waves and analogies in optics and oceanography, Nat. Rev. Phys. 1 (2019) 675–689.
  • Brassard et al. (2002) G. Brassard, P. Hoyer, M. Mosca, A. Tapp, Quantum amplitude amplification and estimation, Contemp. Math. 305 (2002) 53–74.
  • Engel et al. (2021) A. Engel, G. Smith, S. E. Parker, Linear embedding of nonlinear dynamical systems and prospects for efficient quantum algorithms, Phys. Plasmas 28 (2021) 062305.
  • Joseph (2020) I. Joseph, Koopman–von Neumann approach to quantum simulation of nonlinear classical dynamics, Phys. Rev. Research 2 (2020) 043102.
  • Giannakis et al. (2022) D. Giannakis, A. Ourmazd, P. Pfeffer, J. Schumacher, J. Slawinska, Embedding classical dynamics in a quantum computer, Phys. Rev. A 105 (2022) 052404.
  • Lin et al. (2022) Y. T. Lin, R. B. Lowrie, D. Aslangil, Y. Subaşi, A. T. Sornborger, Koopman von Neumann mechanics and the Koopman representation: A perspective on solving nonlinear dynamical systems with quantum computers, 2022. arXiv:2202.02188.
  • Cross et al. (2019) A. W. Cross, L. S. Bishop, S. Sheldon, P. D. Nation, J. M. Gambetta, Validating quantum computers using randomized model circuits, Phys. Rev. A 100 (2019) 032328.
  • Uvarov and Biamonte (2021) A. V. Uvarov, J. D. Biamonte, On barren plateaus and cost function locality in variational quantum algorithms, Journal of Physics A: Mathematical and Theoretical 54 (2021). doi:10.1088/1751-8121/abfac7.
  • Liu and Nocedal (1989) D. Liu, J. Nocedal, On the limited memory BFGS method for large scale optimization, Mathematical Programming 45 (1989) 503–528. doi:10.1007/BF01589116.
  • Mockus et al. (1978) J. Mockus, V. Tiesis, A. Zilinskas, The application of Bayesian methods for seeking the extremum, Towards Global Optimization 2 (1978) 117–129.
  • Kingma and Ba (2015) D. K. Kingma, J. L. Ba, Adam: A method for stochastic optimization, 3rd International Conference for Learning Representations (2015). doi:10.48550/arXiv.1412.6980.
  • Spall (1998) J. C. Spall, An overview of the simultaneous perturbation method for efficient optimization, Johns Hopkins Apl Technical Digest 19 (1998).