Two quantum algorithms for solving the one-dimensional advection-diffusion equation
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 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.
[label1]organization=Institute of Thermodynamics and Fluid Mechanics, addressline=Technische Universität Ilmenau, P.O.Box 100565, city=Ilmenau, postcode=D-98684, country=Germany
[label2]organization=Tandon School of Engineering, addressline=New York University, city=New York City, postcode=11201, state=NY, country=USA
[label3]organization=Courant Institute of Mathematical Sciences, addressline=New York University, city=New York City, postcode=10012, state=NY, country=USA
[label4]organization=Department of Physics, addressline=New York University, city=New York City, postcode=10012, state=NY, country=USA
[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, qubits—the smallest units of quantum information—span a -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 for the three-dimensional case, which varies at least as fast as . Here, the number of mesh points along one spatial direction and 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 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 , 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 qubits giving resolutions of 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 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
(1) |
where is the concentration field of the solvent, is the diffusion constant and 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
(2) |
Here, the advection velocity in the -direction is taken as a constant. The problem is discretized in space and time. For the spatial discretization, the interval is divided into segments of width . The time evolution is also discretized uniformly, such that , where is the time step. For the analytical solution, the wave-like ansatz is chosen such that follows from eq. (2). Hence, the concentration profile takes the form of
(3) |
Periodic boundary conditions are imposed, such that . Consequently, the wavenumber with . Thus there follows the general solution to the problem in the form of a series expansion
(4) |
As initial condition the delta function is applied such that . The delta function is standard and defined to be for and . The initial condition specifies the expansion coefficients in the general solution as
(5) |
The Fourier coefficients are given by
(6) | ||||
(7) | ||||
(8) |
such that the initial condition can written as
(9) |
Considering these coefficients, the analytical solution can be found to be
(10) |
Equation (10) describes a Gauss-shaped pulse that diffuses while moving to the right given that . For the following, lengths are measured in units of the interval length . Times can be expressed in units of either the advection time or the diffusive time . If not stated otherwise, we will use .
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 and with and . Indices and . 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
(11) |
and thus
We define the following abbreviations
(12) |
where is the parameter of the convective part and is the stability parameter. For this explicit scheme should hold. The scheme can be expressed as a system of linear equations via
(13) | ||||
(20) |
In case of the implicit backward Euler scheme (BTCS), the system of linear equation follows such that the matrix has to be inverted to find the desired solution, since this method imposes the expression
(21) |
which can be reformulated to
In other words, the scheme can be expressed as a system of linear equations via
(22) | ||||
(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
(30) |
where . 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.
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 , a qubit is a superposition of the two basis states of the Hilbert space
(31) |
with and and basis vectors and in Dirac’s notation Nielsen and Chuang (2011). It can be combined into an -qubit system, also denoted as an -qubit quantum register, by successive tensor products of qubits. An unentangled two-qubit state vector is the tensor product of two single-qubit vectors,
(32) |
The basis of this tensor product space is given by 4 vectors, usually formulated in integer or binary bit-string notation: , , , and . The -qubit quantum state at a time is consequently defined in a -dimensional tensor product Hilbert space and given by
(33) |
In other words, when connecting this formalism to the present flow problem, the discretization of the concentration profile on grid points at time is obtained by an -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 with , 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)
Quantum algorithms which solve a linear system of equations of the form, , 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 (BTCS) or (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 () of the matrix and thereby approximate the solution . The central computational issue here is to identify the eigenvalues of and the following evaluation of their inverse. An alternative algorithm we call QLSA-2 proceeds by approximating the action of the matrix (or ) 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 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 . Since the algorithm admits only Hermitian matrices, the matrix is first extended to an Hermitian classically as
(34) |
The implementation involves the following steps.
Step 1 - Quantum State Preparation (QSP): The concentration field at every time step is loaded onto an -qubit ( from here on) state proportional to make it compatible with eq. (34) (and therefore one expects the solution state in the form ). As will be described shortly, the algorithm also requires an additional ancillary qubits. The latter are helper qubits or in short ancillas. All these qubits that are initially set to basis state , are then initialized using either the functional form type state preparation or the sparse-state preparation oracle (see Sec. 3 of SI Appendix in Bharadwaj and Sreenivasan (2023)),
(35) |
Step 2 - Quantum Phase Estimation (QPE): Given a linear operator , if is an eigenvalue, the QPE essentially estimates the phase angle as a binary representation -bit , . Using this algorithm, an -bit binary approximation to the eigenvalues of 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 , to obtain the matrix . To now invoke QPE, this matrix is exponentiated as to form a linear unitary operator, where 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 such that the eigenvalues can be represented nearly exactly using an -bit binary state with minimal truncation error. The matrix can be expanded in the eigenbasis such that
(36) |
Following this, the QPE then produces the state proportional to
(37) |
where are the binary represented eigenvalues of A rescaled by while are the coefficients of the normalized generated by rotating into the basis of A’s eigenvectors .
Step 3 - Conditional Rotation: Here we apply a relative rotation operator on the last ancilla qubit, conditioned on to compute the inverse ,
(38) |
where is a suitably chosen normalization constant.
Step 4: Finally, we perform the inverse QPE (IQPE) operation to reset to , and follow it up by a measurement of the last ancilla qubit in the computational basis, producing a state proportional to
(39) |
where 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 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 , which consists of the normalization factor and the angles of the single-qubit unitary rotation gates , is the input to the algorithm. Then, a cost function , which is parameterized with , 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 which is initialized with the parameter set . Measurements of the quantum circuits evaluate the costs. These costs are minimized with an classical optimizer. The optimal parameter set initializes the ansatz function such that the solution of the given problem can be observed Cerezo et al. (2021).
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
(40) |
with the linear operator and the identity operator . Then, the corresponding cost function can be found as
(41) |
where the minimum of the cost function corresponds to the solution . Following Lubasch et al. Lubasch et al. (2020), we define
(42) | ||||
(43) |
where is the parameter vector which initializes the quantum ansatz for the solution . The quantum states are normalized, such that , while for the concentration profile holds
(44) |
The constant is 1 for the present case due to . In order to fulfill both constraints, normalization parameters, and are introduced. In the present work we will rescale our solution to an -norm of 1 to be directly comparable to the QLSA case. Thus eq. (41) results in
(45) |
The norm is evaluated by the scalar product and gives
(46) | ||||
The last term is constant for each time step because it depends only on and , which are fixed from the previous time step. A further decomposition of the scalar product leads to
(47) |
The linear operator 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 and are defined; see A for details. Note that thereby, the periodic boundary conditions are imposed. With the definition of these shift operators and one gets
(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:
(49) |
We use that and . This leads to the final cost function
(50) |
where expresses the contribution of the identity part and the contribution of the shift parts. The contributions and 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 for any variable (see B). The measurement on the ancilla qubit delivers a measure for the manipulation on the lower qubits to . This measurement is performed such that is evaluated, where and is the probability to measure the standard basis eigenstates and at the ancilla qubit , respectively. In order to evaluate which is , the parameterized quantum ansatz for the solution and the inverse of previous time step are implemented as controlled gates. If initializes a state which is completely removed by , the probability to measure the state would be because just the Hadamard gates by themselves, cancel their effects causing no net rotation in total. For the evaluation of the which is , the shift operation is added by implementing controlled NOT gates (CNOT) and Toffoli gates which are organized in a particular way. For the case, the CNOT and Toffoli gates are organized in reverse order compared to . The structure is shown in Fig. 4. The evaluation of and requires the implementation of instead of . In order to realize the double shift operation for , the block can be either implemented twice, or more efficiently, the processing structure starts one qubit lower such that is not affected by the shift operator.
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 rotation gates and CNOT gates. The gates are parameterized with the parameter set and perform rotations by about the y axis of the qubit. CNOT gates negate the state of the target qubit whenever the control qubit is in state . 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 parameterized gates and thus, parameters (one additional parameter for normalization purpose) need to be optimized which leads to a high computational effort in circuit execution and optimization.
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.
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 is chosen. The parameters are time step width s, diffusion constant m/s, unit length m, and constant advection velocity m/s. The characteristic time scales of the problem are the advection and the diffusion times. They are given by s and s. From now on, we proceed with the dimensionless form. Characteristic scales are combined in the dimensionless Péclet number which is given by
(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.
The corresponding concentration profiles are plotted in Fig. 7 where the time interval is approximately or . 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),
(52) |
The MSE curve decreases first, but starts to increase for . 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 . 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 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 ; here the number of optimization parameters was always similar to the number of grid points .
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 ). 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 , 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 for the Quantum Phase Estimation and (b) the right choice of , see eq. (36) in Step 2. For instance, though the MSE of QLSA asymptotes closely with the MSE of VQA for large in Fig. 7 (f), these MSE values of the QLSA can, in general, be further lowered by providing a higher , 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 which corresponds to 6 qubits. In this case, 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.
5.2 Dependence on the number of qubits
With the number of qubits the resolution of the spatial discretization increases exponentially as . Apart from the spatial resolution , the total number of qubits in both algorithms is as follows:
(53) | ||||
(54) |
In case of QLSA, an additional register with qubits is required which corresponds to the QPE qubits.111In case of QLSA-2, the need for can be eliminated given the absence of QPE. They determine the accuracy of the eigenvalue estimation. The specific dependence on 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 and and the cases for grid points are analyzed. In case of the VQA, the time constant is adapted for each discretization. The cost function (see eq. (4.2)), which is derived in Sec. 4.2, includes the prefactor . In order to include the term with this prefactor, the time step width besides the Courant-Friedrichs-Lewy (CFL) condition, . Thus, the time steps are for , for , and for . 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 , it can be shown that the error decreases for cases with a higher number of qubits. The evaluation of the MSE over the time is shown in Fig. 9(a). It can be seen that a larger number of qubits lead to smaller errors. However, the error for decreases while the curves for and 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 reaches lower cost than the cases for , . 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.
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 qubits for each case for QPE module of the algorithm. This corresponds to the minimum number of qubits required for any given , such that the solutions are of comparable performance and affects every case somewhat similarly, although for increasing resolutions one would need far larger registers and therefore lack of which would still bear a weak effect. For , , and , one would therefore need to assign a total of qubits, that is, , and qubits, respectively.
More generally, one needs to assign at least , where is the condition number of (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 , 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 case performs the best followed by and which, more or less, have close time evolution trends. This behavior is purely an artifact of the assigned in each case. The provided for increasing is progressively inadequate to foster an accurate eigenvalue estimation.
This can be seen more pronounced in Figs. 8(a)-(b) which shows the case for small . 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 (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 . (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).
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 qubits. For a given value, an insufficient will naturally cause truncation errors of the order . However, given an , the eigenvalues can always be scaled by choosing an appropriate such that can be represented with the required accuracy. Unfortunately, since the eigenvalues are unknown a priori, the choice of both and 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 would be given by
(55) |
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 can be made by bounding the minimum and maximum eigenvalues, with functions of either the condition number or the trace of the matrix, they would still be rough estimates.
The optimal choice of 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 . This estimation of is described in Bharadwaj and Sreenivasan (2023). In summary, it requires one to first compute the behavior of condition number with increasing system sizes. If accurate estimation of 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 (), and . From these results an MSE is computed with respect to classical or analytical solution (available in this case) for every combination of and as shown in Fig. 11(e), for the case integrated up to . 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 operation, and also minimizes the measurement errors associated with it.
Proceeding further, the trajectory of the minimum MSE is traced for every and as shown in Fig. 11(e) (cyan dotted line) to find a for which most eigenvalues are accurately represented with qubits. Finally, using the previously computed relation, a new relation between and is determined (power-law like behavior), with which one can predict with nominal confidence a 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 we now solve the system for , with increasing —and therefore is given by eq. (54). In this case, and thus . 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 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 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 . Another reason is the following, from eq. (39) the solution is of the form . So the maximum error stems from the smallest eigenvalue. If the 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 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 value of MSE is bounded by . To accurately estimate very small values of would require a larger .
(iii) Finally, the effect of is clear from Figs. 11 (a) and (b). Increasing tends to lower MSE in general, but it is in step-like fashion as shown in Fig. 11(c) plotted for final time . This is because increasing in small steps (of ) does not lower the least count significantly (in or ). We also plot the residue, given by , as a function of as shown in Fig. 11 (d). The monotonic decay in residue symbolizes two aspects: (a) The numerical method and choice of and 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 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 , 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 close to 0 in Fig. 6(b). This can be minimized by adding another sign control qubit or by increasing and estimating more accurately.
5.4 Comparison of different ansatz functions for VQA
The quantum ansatz 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 . 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 parameterized gates to generate the next -qubit state. However with 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 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 with a different number of gates. In TN2, a row of 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 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 is initialized. The ancilla qubit is measured to obtain the probability of state . In this way we determine the match (or overlap) of the generated with the desired state. In detail, if the probability for the state is zero, the ansatz 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 is greater than zero, we obtain a measure for the deviation between both states. This measure is called identity costs .
In this work, the considered ansatz structures are evaluated for quantum registers of size and 6. For this, three concentration profiles are chosen which capture the significant shapes of the advection-diffusion problem. The corresponding identity costs are evaluated for these chosen concentration profiles and for a varying number of parameterized gates. In Fig. 13, the results for the qubits are shown. We can observe that the universal ansatz leads to low identity costs of –, such that this ansatz is suitable to construct the wanted concentration profile, but the number of used parameterized gates is . The considered tensor networks (TN1, TN2) lead to increased identity costs of –. 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 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 . 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 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 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).
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 -qubit quantum state on a quantum computer is a random projection on one of the eigenstates with respect to an observable. This observable is the 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 . This sampling error of the shots decreases with .
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 (), errors in measurement () and in resetting () of qubits are defined. We have done a study for the case with 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 , , and 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 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.
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 is advected by a constant velocity and subject to a constant molecular diffusion . The Péclet number is .
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 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 in the Quantum Phase Estimation (QPE) stage. It is demonstrated that the number of additional qubits 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 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 of the linear systems matrix , its condition number , 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
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 and is considered to be in the initial state . For a shift to the left which is defined as operation, an 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:
(56) |
For the operation, the gates are organized reversely as it is shown in Fig. 15(b). Then, the following states can be found:
(57) |
In the case of the considered cost function (see 4.2), the shift operations are applied to fixed quantum states 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 operations () equals the application of any single shift operation for this special case. For this, the two-qubit quantum state is . Then follows,
(58) | ||||
(59) | ||||
(60) | ||||
(61) |
It can be observed that . 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., , the identity will be computed because
(62) |
Furthermore, can be rewritten to ,
(63) | ||||
(64) |
Analogously, it holds .
Appendix B The Hadamard test
In general, the Hadamard test is a method which allows to find the expectation value . For this, a unitary gate acts on the qubit which is in the state . The corresponding quantum circuit is shown in Fig. 17. First, the quantum circuit is in the state
(65) |
The first Hadamard gate acts on the zeroth qubit such that
(66) |
The unitary gate is implemented on the qubit and is controlled to the ancilla qubit such that follows:
(67) |
Considering the second Hadamard gate, the state of the quantum circuit changes to the following one:
(68) | ||||
The measurement is performed in the standard basis such that
(69) | ||||
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 . 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 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 . The parameters are , , and and the computation is performed for a total time .
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 (). 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 . 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 , 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 . Thereby, the Nelder-Mead optimization cannot find the global minimum of the cost function () and hence, the optimization fails. In contrast, the combination of Bayesian optimization and L-BFGS-B algorithm shows small costs () 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 , 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 which results in high mean squared errors ().
In conclusion, the Nelder-Mead algorithm can be recommended in cases of low parameter spaces () 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.
Optimizer | Method | Accuracy | Computation time |
---|---|---|---|
NM | geometric | ||
L-BFGS-B | gradient-based | ||
BO | approximation | ||
& L-BFGS-B | gradient-based | ||
Adam | gradient-based | ||
& L-BFGS-B | gradient-based | ||
SPSA | stochastic | ||
approximation |
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).