39
Quantum advantage for differential equation analysis Bobak T. Kiani, 1* Giacomo De Palma, 2,5 Dirk Englund, 1,2,3 William Kaminsky, Milad Marvian, 4 Seth Lloyd 2,5 1 Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, Cambridge, MA 02139 2 Research Laboratory of Electronics, Massachusetts Institute of Technology, Cambridge, MA 02139 3 QuEra Computing, Boston, MA 02143 4 Department of Electrical and Computer Engineering, Center for Quantum Information and Control (CQuIC),University of New Mexico, Albuquerque NM 87131 5 Department of Mechanical Engineering, Massachusetts Institute of Technology, Cambridge, MA 02139 * To whom correspondence should be addressed; E-mail: [email protected]. Quantum algorithms for both differential equation solving and for machine learning potentially offer an exponential speedup over all known classical algo- rithms. However, there also exist obstacles to obtaining this potential speedup in useful problem instances. The essential obstacle for quantum differential equation solving is that outputting useful information may require difficult post-processing, and the essential obstacle for quantum machine learning is that inputting the training set is a difficult task just by itself. In this paper, we demonstrate, when combined, these difficulties solve one another. We show how the output of quantum differential equation solving can serve as the input for quantum machine learning, allowing dynamical analysis in terms of princi- 1 arXiv:2010.15776v1 [quant-ph] 29 Oct 2020

Quantum advantage for differential equation analysisQuantum advantage for differential equation analysis Bobak T. Kiani, 1Giacomo De Palma, 2;5 Dirk Englund, 3 William Kaminsky, Milad

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

  • Quantum advantage for differential equation analysis

    Bobak T. Kiani,1∗ Giacomo De Palma,2,5 Dirk Englund,1,2,3

    William Kaminsky, Milad Marvian,4 Seth Lloyd2,5

    1Department of Electrical Engineering and Computer Science, Massachusetts Instituteof Technology, Cambridge, MA 02139

    2Research Laboratory of Electronics, Massachusetts Institute of Technology,Cambridge, MA 02139

    3QuEra Computing, Boston, MA 021434Department of Electrical and Computer Engineering, Center for Quantum

    Information and Control (CQuIC),University of New Mexico, Albuquerque NM 871315Department of Mechanical Engineering, Massachusetts Institute of Technology,

    Cambridge, MA 02139

    ∗To whom correspondence should be addressed; E-mail: [email protected].

    Quantum algorithms for both differential equation solving and for machine

    learning potentially offer an exponential speedup over all known classical algo-

    rithms. However, there also exist obstacles to obtaining this potential speedup

    in useful problem instances. The essential obstacle for quantum differential

    equation solving is that outputting useful information may require difficult

    post-processing, and the essential obstacle for quantum machine learning is

    that inputting the training set is a difficult task just by itself. In this paper,

    we demonstrate, when combined, these difficulties solve one another. We show

    how the output of quantum differential equation solving can serve as the input

    for quantum machine learning, allowing dynamical analysis in terms of princi-

    1

    arX

    iv:2

    010.

    1577

    6v1

    [qu

    ant-

    ph]

    29

    Oct

    202

    0

  • pal components, power spectra, and wavelet decompositions. To illustrate this,

    we consider continuous time Markov processes on epidemiological and social

    networks. These quantum algorithms provide an exponential advantage over

    existing classical Monte Carlo methods.

    Introduction

    One of the primary proposed applications of quantum computers is the solution of linear dif-

    ferential equations on high-dimensional spaces. The ability of quantum computers to represent

    N -dimensional vectors as the state of log2N qubits, and to perform linear algebraic transfor-

    mations of those states in time poly(logN), then translates into a potential exponential speedup

    over classical algorithms for solving such high-dimensional differential equations. The output

    of the quantum computer presents the solution to the equation as a quantum ‘history state’ that

    is a superposition of the solution at different points in time. The problem then arises: How do

    we extract useful information from that quantum solution state? We can measure the expecta-

    tion value of different quantities of interest: however, in the example of Markov chains, such

    expectation values can often be evaluated efficiently classically via Monte Carlo techniques. To

    obtain a quantum advantage that reveals essential features of the solution to the linear differen-

    tial equations, we need to perform quantum post-processing on the history state.

    Quantum machine learning algorithms for the analysis of data provide potential exponen-

    tial speedups over classical machine learning algorithms for methods such as high-dimensional

    regression, principal component analysis, and support vector machines [1–4]. A basic problem

    with such quantum machine learning algorithms is that the input to the algorithm is a quantum

    state that encodes the classical data, and to construct such a state requires the implementation

    of a large-scale quantum random access memory (qRAM), a difficult technological task. The

    central observation of this paper is that the problem with quantum linear equation solvers –

    2

  • they give quantum states as output – and the problem with quantum machine learning algo-

    rithms – they require quantum states as input – effectively solve each other: the output from

    the quantum linear equation solver can be used as the input to the quantum machine learning

    algorithm. In particular, we show that the history-state quantum solution to high-dimensional

    linear differential equations takes exactly the form needed to perform quantum analysis of the

    solution via quantum machine learning and data analysis. We show how to produce the singular

    values and singular vectors of the solution via quantum principal component analysis, and how

    to extract the power spectrum of the solution by performing quantum Fourier transforms. The

    singular value decomposition and the Fourier analysis reveal the dominant components of the

    time evolution, corresponding to large singular values, and to eigenvalues of the transition ma-

    trix with small negative real part. Finally we show how to perform quantum wavelet analysis

    to reveal rapid transitions and emergent features in the solution at different time scales. These

    quantum algorithms for post-processing the solution of linear differential equations can yield an

    exponential speedup over classical methods, and could potentially be performed on near term

    intermediate scale quantum computers.

    The quantum post-processing of the history state to reveal salient features of the history can

    be applied to any linear differential equation. To show how quantum post-processing reveals

    such features, we focus here on the case of continuous time Markov chains on high-dimensional

    spaces, with an emphasis on the spread of disease and opinion in complex social networks. We

    have chosen to investigate Markov processes because Monte Carlo methods represent a power-

    ful classical method for revealing the features of such processes. Previous quantum algorithms

    for Monte Carlo yielded a square root speedup over classical algorithms [5]. By contrast, the

    quantum algorithms presented here for analyzing linear dynamics in terms of singular values,

    power spectra, and wavelets represent an exponential speedup over existing classical Monte

    Carlo methods.

    3

  • Results

    Quantum algorithms for linear differential equations Quantum numerical algorithms solve

    differential equations by quantizing classical numerical procedures and performing matrix op-

    erations on finite, high-dimensional state spaces. We write a general linear differential equation

    for a vector in RN with N � 1 in the form

    d~x(t)

    dt=M~x(t) + ~c (1)

    where x(t) represents the state of the system at time t,M is the N × N differential equation

    matrix, and c is a forcing term. For example, in the case of Markov models, the state space

    is represented by a probability vector x(t) with entries xi(t) indicating the probability of the

    system existing in state i at time t, andM is the transition matrix.

    Well-known quantum algorithms [6,7] can solve linear differential equations of the form of

    Eq. 1, whereM is a sparse matrix, by applying the quantum algorithm for linear systems of

    equations [8,9]. The algorithms of Refs. [6,7] are based on a simple underlying idea, but require

    highly nontrivial technical improvements in order to achieve a low computational complexity.

    For the sake of a clearer exposition, we present here only the basic idea, and refer the reader to

    Refs. [6, 7] for a complete presentation of the algorithms. We consider the differential equation

    (Eq. 1) for 0 ≤ t ≤ tmax. The idea is based on the standard classical methods for discretizing

    Eq. 1 in T time steps each of size h = tmax/T and re-framing it as the solution to an equation

    of the form

    A~x = ~b (2)

    4

  • where

    ~x =

    ~x0~x1~x2...~xT

    =~x(0)~x(h)~x(2h)

    ...~x(Th)

    (3)is a ‘vector of vectors’ that contains the values of the state vectors for the system, ~x` = ~x(t`), at

    different moments of discretized time t` = `h. A is a matrix that represents the updating action

    of the discretized differential operator. The form of A and ~b depends on which discretization

    method one employs for the differential equation (e.g., Euler forward, Euler backward, Crank-

    Nicolson, etc.). The simplest method is Euler forward, where

    A =

    I 0 . . . 0 0 0

    −(I +M∆t) I . . . 0 0 0. . .

    0 0 . . . −(I +M∆t) I 00 0 . . . 0 −(I +M∆t) I

    (4)

    and

    ~b =

    ~x0~c...~c

    (5)The solution to the differential equation is then obtained by inverting the matrix in Eq. 2:

    ~x = A−1~b (6)

    Roughly speaking, the quantum algorithms of [6,7] map the classical states onto quantum states,

    ~x → |x〉, ~b → |b〉, and solve the problem using quantum matrix inversion to construct the nor-

    malized version of the unnormalized quantum state |x〉 = A−1|b〉, which represents a quantum

    superposition of the solutions of Eq. 1 at different points in time.

    We will base our results on the algorithm of Ref. [6], which has the lowest computational

    complexity. This algorithm sets T = dtmax ‖M‖e, employs the Taylor expansion of the matrix

    5

  • exponential to solve the differential Eq. 1, and produces a coherent superposition of the quantum

    state |x〉 with some garbage state associated to the terms of the Taylor series. We show in the

    Methods section that the normalized version |x̄〉 = |x〉/‖|x〉‖ of |x〉 can be recovered from the

    quantum state produced by the algorithm of Ref. [6] with O(1) success probability.

    Form of the quantum solution The (unnormalized) quantum state |x〉 contains registers for

    the states and time-steps:

    |x〉 =T∑i=0

    |xi〉 |i〉 (7)

    where the entries of |xi〉 are the values of the state for timestep |i〉. |x〉 is a quantum ‘history

    state’: a superposition of the different timesteps |i〉, correlated/entangled with the corresponding

    state vectors |xi〉 at that timestep.

    The quantum state in Eq. 7 can now be post-processed using efficient quantum algorithms

    such as those for wavelet transforms or quantum machine learning. Such algorithms can pro-

    vide useful information about the solution which cannot be obtained efficiently using classical

    computation, and we overview these algorithms in later sections.

    Alternatively, history states encoding the evolution of an arbitrary quantum circuit at dif-

    ferent times can be created by preparing the ground state of a local Hamiltonian [10, 11]. The

    quantum post-processing techniques that we apply here to history states of linear differential

    equations can also be applied to the history state of the ground state of a local Hamiltonian.

    Scaling of the error The computational complexity of the quantum algorithm of Ref. [6] is

    linear in the condition number and the time, and logarithmic in the error. We show in the Meth-

    ods section that, by running this algorithm and by suitably projecting the generated quantum

    state, we can obtain a quantum state that is �-close to the state |x̄〉 in 2-norm with

    O

    (κ tmax ‖M‖ s poly log

    ((1 +

    tmax ‖~c‖‖~x(0)‖

    )κ tmax ‖M‖ sN

    ))(8)

    6

  • elementary quantum gates. Here κ is the condition number of the matrix that is used to diago-

    nalizeM and s is the sparsity ofM.

    Application to the Schrödinger equation In the case whereM is anti-Hermitian, then Eq.

    1 is the Schrödinger equation [10]. In this case, the Fourier analysis of the history state reveals

    the eigenvalues and eigenvectors ofM. For example, whenM is the Feynman Hamiltonian,

    the history state encodes the history of quantum computation and the Fourier analysis reveals

    its eigenstates. Finding the eigenstates of the Feynman Hamiltonian is at least as hard as per-

    forming the quantum computation [12].

    Continuous time Markov chains To illustrate the power of our methodology, in this paper,

    we focus on differential equations for continuous time Markov chains. Markov chains are a

    primary tool in mathematics and statistics for modeling the transitions over time of a system

    which can exist in one of a set of states. Markov models update probability distributions over

    state space by assuming that the probability of making a transition to the next state only depends

    on the current state of the Markov chain. Markov chains have applications in many fields

    including bioinformatics, population dynamics, and statistical controls [13].

    Here, we focus on Markov chains that represent dynamics of complex networks, particularly

    those modeling the spread of opinion and disease in social networks. The dynamics of complex

    networks are modeled via Markovian techniques by assuming that each node in a network exists

    in one of q states. A central challenge in this setup is in handling the dimension of the Markov

    state which grows exponentially with the number of nodes in a graph, often rendering the prob-

    lem intractable for classical computers. For example, in epidemiology, modeling the dynamics

    of infection and recovery for a system of individuals whose interactions make up a complex

    network of n nodes is a hard computational problem that involves predicting the behavior of a

    very large qn dimensional continuous time probabilistic dynamics [14, 15]. The exact solution

    7

  • for the dynamics of such epidemiological models lies beyond the realm of capability of even the

    most powerful classical computers. Consequently, classical approaches to modeling the spread

    of epidemics via complex networks of interactions typically rely on various approximations,

    such as mean field theory [14].

    Continuous time Markov chains are defined by differential equations of the form

    d~x(t)

    dt=M~x(t) (9)

    where ~x(t) is the vector of probabilities for the underlying state of the system at time t, andM

    is a matrix of transition rates [16, 17].

    Eq. 9 is precisely of the form required in Eq. 1 for efficiently solving differential equations

    using quantum algorithms. As shown in the Methods section, the quantum algorithm of Ref. [6]

    can be employed to produce a normalized version of the quantum state |x〉 =∑T

    i=0 |xi〉 |i〉

    storing the state probabilities at discretized times. Note that the quantum algorithm represents

    the vector of probabilities as quantum vector of probability amplitudes. Since |x〉 contains the

    complete information of the Markov state at different points in time, post-processing algorithms,

    which we now outline, can be used to extract useful information from the state.

    Generalization to non-Markovian models We can generalize our algorithms to incorporate

    prior histories in a “non-Markovian” model. The Markovian nature to the methods for solving

    differential equations is reflected in the form of the matrix A in Eq. 4 above. The fact that the

    Euler forward method for discretizing a differential equation depends only on the current and

    previous state of the system implies that A only has entries on the diagonal and directly below

    the diagonal. If we wish to include influences on the present from further in the past (including

    the distant past), then we can simply add additional entries to each row: adding a matrix entry

    Aij , j < i to the i’th row of A allows the state of the system at time j < i to influence the

    updating at time i. This change cannot be directly incorporated in the algorithm of Ref. [6],

    8

  • which relies on the Taylor expansion of the matrix exponential, but it can easily be incorporated

    in the previous algorithm of Ref. [7], which directly solves Eq. 2.

    Quantum post-processing The solution of our quantum differential equation solver |x〉 exists

    in a very high dimensional Hilbert space, and here, we discuss methods to obtain useful infor-

    mation from |x〉 using various quantum algorithms that can offer exponential speedups over

    classical counterparts. In this study, we focus on the particular case of post-processing out-

    puts from continuous time Markov chain models. The algorithms we list here are by no means

    comprehensive of the full catalog of algorithms available to quantum computer scientists for

    extracting information from these states.

    Post-processing: expectation values of quantities The most basic information that can be

    extracted from a Markov chain is the expectation value at a given time of a real-valued ob-

    servable on the state space. Classically, such expectation values can be estimated efficiently by

    Monte Carlo sampling of the Markov chain up to the required time. In the quantum case, ex-

    pectation values of quantities can be obtained by estimating the overlap of the history state with

    a state encoding the values of the quantity we wish to calculate. In the Supplementary Material,

    we consider two quantum algorithms to compute such expectation values. The first is based on

    a post-processing of the quantum history state of the Markov chain, and the second is based on

    the coherent version of the classical Monte Carlo simulation of the Markov chain. As shown in

    the Supplementary Material, one can obtain a quadratic speedup in the error of estimating an

    observable using quantum techniques for Monte Carlo sampling.

    Post-processing: principal component analysis of data matrix In contrast to the expecta-

    tion values of observables, features of the solution such as the singular value decomposition,

    the power spectrum, and wavelet analysis cannot be reconstructed efficiently by sampling from

    9

  • the Monte Carlo solution. Here, the power of quantum computation for performing linear alge-

    bra on high dimensional spaces provides an exponential speedup over the best known classical

    methods.

    Principal component analysis of the history state of the differential equation yields useful

    information about the solution. First of all, if the history state is effectively low rank, i.e., there

    are only a few large singular values, then the description of the time evolution of the Markov

    process can be compressed by expressing it in terms of the corresponding singular vectors,

    which the quantum principal component analysis also reveals. The history state will be effec-

    tively low rank, for example, when the Markov transition matrix has only a few eigenvalues

    with small negative parts, so that the dynamics is dominated over longer times by the corre-

    sponding eigenvectors. The space spanned by these eigenvectors in turn has high overlap with

    the space spanned by the dominant singular vectors.

    In the case of continuous time Markov chains, the quantum state in Eq. 7 can be interpreted

    as a qn × T data matrix X where each column j corresponds to |xj〉, the probabilities of the

    Markov state at timestep j. The dominant singular values and corresponding singular vectors

    of this matrix can be extracted from |x〉 by performing quantum principal component analysis

    (qPCA) on the |xj〉 and |j〉 registers which runs in O(Rn log q) time where R is the rank of

    X [2]. Note, that qPCA in this setting is equivalent to performing a Schmidt decomposition on

    the Hilbert spaces spanned by registers |xj〉 and |j〉. The qPCA performs this decomposition

    via density matrix exponentiation [2]. It is often the case that the effective rank R (the number

    of large singular values) of X is small with respect to the number of states qn, and later, we

    show that the effective rank is in fact very small for the example models we consider. Note that

    because our method acts directly on a quantum state, quantum inspired algorithms for PCA do

    not have access to the data structure for extracting the singular vectors and singular values of

    the history state [18–20]. Specifically, in the Supplementary Material, we show that classical

    10

  • Monte Carlo methods cannot efficiently extract the singular vectors and the singular values of

    the history state (Eq. 7) whenever the support of the probability distribution is exponentially

    large in the number of nodes of the network.

    After performing qPCA via density matrix exponentiation on copies of |x〉, we have a de-

    composition of the data matrix into left and right singular vectors:

    qPCA : |x〉 →T∑j=0

    |lj〉 |rj〉 |σ̃j〉 , (10)

    where |lj〉 are the left singular vectors corresponding to the Markov states, |rj〉 are the right

    singular vectors corresponding to the temporal states, and |σ̃j〉 are estimates of the singular val-

    ues. The singular values |σ̃j〉 represent the weight of the left (Markov state) and right (temporal

    state) singular vectors in the solution. It is conventional to take the ordering in j in Eq. 10 to be

    from the largest to smallest singular values.

    The left singular vectors |lj〉 can be interpreted as the most common profile of Markov

    states. The first left singular vector corresponds to the profile with the greatest contribution to

    the data matrix, often the steady state of the Markov process. The next few singular vectors

    typically correspond to the profile of states in the early progression of the Markov simulation

    before steady state is achieved (see simulations later for examples).

    The right singular vectors |rj〉 detail the progression of the corresponding left singular vec-

    tors over time. For example, the first singular vector is typically weak during the early progres-

    sion and grows to a constant value as the steady state arises. The next few right singular vectors

    show when the corresponding left singular vectors take prominence, often highest in magnitude

    at early points in time (see simulations later for examples).

    Decomposing the data into singular vectors also allows one to apply efficient transforma-

    tions to the singular vectors using quantum post-processing methods. For example, if one is

    interested in analyzing the Markov states in the frequency domain, a quantum Fourier trans-

    11

  • form can be applied to the right singular vectors. Later, in our example, we show that the

    dominant singular vectors correspond to slowly varying dynamics at low frequencies and the

    later singular vectors correspond to more rapidly varying dynamics at higher frequencies.

    We noted above that when the Markov transition matrix has only a few eigenvalues with

    small negative parts, the history state will be effectively low-rank, with only a few large sin-

    gular values. The quantum singular value analysis can be used to probe other aspects of the

    history as well. For example, we can perform quantum principal component analysis on a slid-

    ing window within the history: as this window moves forward, a fundamental change in the

    dynamics of the process can have a signature in changes in the singular values, and in the form

    of the corresponding singular vectors. These changes can be revealed by performing swap tests

    between the dominant singular vectors at different points during the evolution.

    Post-processing: efficient quantum transformations Fourier transforms and wavelet trans-

    forms are commonly used in the analysis of large datasets, especially time series [21–24]. Dis-

    crete wavelet transforms, for example, can be used to identify statistical patterns in a time series.

    With a quantum computer, Fourier transforms and certain discrete wavelet transforms can be

    performed exponentially faster than their classical counterparts [25–27]. These transforms can

    be applied to the data contained in our output quantum state (Eq. 7). For example, a Fourier

    transform or wavelet transform can be applied to the time register, e.g. to observe the data in the

    frequency domain or to compress the data in terms of the dominant wavelets. Let Ujk = 〈k|j〉

    be the element of the unitary matrix U that maps the states |j〉 to the transform states |k〉 (fre-

    quency states in the case of the quantum Fourier transform; wavelets in the case of the discrete

    wavelet transform). Applying U to the temporal register, we obtain the state

    T∑j=0

    |xj〉U |j〉 =T∑

    j,k=0

    |xj〉Ujk |k〉 =T∑k=0

    |yk〉 |k〉 , (11)

    12

  • where |yk〉 =∑T

    j=0 Ujk |xj〉, is the state of the system correlated with the kth frequency or

    wavelet state in the temporal register. Sampling from the temporal register then yields the dom-

    inant frequencies/wavelets, and the spatial register yields the state of the system correlated with

    those frequencies/wavelets. For example, as noted above in the discussion of the Schrödinger

    equation, in Eq. 1, if ~c is 0 and the matrixM is anti-Hermitian, performing a quantum Fourier

    transform on the temporal register yields the purely complex eigenvalues ofM and the output

    contains the corresponding eigenvectors [28]. More generally, when the eigenvalues ofM have

    both real and imaginary components, performing the quantum Fourier transform reveals the

    power spectrum of the solution: a complex eigenvalue a + ib manifests itself as a Lorentzian

    peaked at the natural frequency√a2 + b2.

    By contrast, classical Monte Carlo sampling does not obviously extract the proper informa-

    tion for performing Fourier or wavelet transforms on the quantum state (see section on classical

    algorithms for principal component analysis in the Supplementary Material).

    Post-processing: quantum machine learning In the past few years, many quantum algo-

    rithms for machine learning have been proposed that can be performed exponentially faster

    than classical counterparts in cases where data is input as a quantum state [1, 3, 4, 29–33]. Us-

    ing quantum algorithms for continuous time Markov chain models proposed here, input states

    for these algorithms are generated efficiently thus preserving the exponential speedup of these

    algorithms even in the construction of input states.

    When data in the form given by Eq. 7 is input into machine learning algorithms, applications

    of machine learning algorithms are numerous. Here we list some of these applications, grouped

    based on the type of model that can be used. First, quantum models have been proposed for

    compression of data or efficient readout. These models include quantum auto-encoders [33,34]

    and qPCA as discussed before [2]. Second, a wide range of algorithms implementing kernel

    13

  • methods can be used to classify data, identify key features in the data, or measure similarity

    between different datasets [4, 35–37]. Indeed, if we trace out the temporal register in Eq. 7,

    the state register is described by the (unnormalized) density matrix∑

    j |xj〉 〈xj|, which is the

    covariance matrix for the synthetically generated data; similarly, if we trace out the state register,

    the temporal register is described by the density matrix∑

    ij〈xi|xj〉 |j〉 〈i|, which is the kernel

    matrix for the data. That is, the quantum differential equation solver gives us direct access to the

    states required to attain the potential exponential speedups of quantum kernel methods. Third,

    output states can be inputted into parameterized quantum circuits or quantum neural networks

    to identify key features or perform machine learning tasks [31, 38, 39].

    Example simulation for epidemic processes The analysis of epidemic spreading – viral or

    social – is often modeled as a dynamical process on a complex network [14]. Theoretical

    approaches to epidemic processes typically assume transitions (e.g. rates of infection) occur

    as Poisson processes which correspond to models of continuous time Markov chains [14, 40].

    Classically, numerical simulation of continuous time Markov processes is intractable for large

    networks as the dimension of the Markov state grows exponentially with the number of nodes

    in the network or graph.

    To demonstrate the applicability of our quantum algorithm, we simulate continuous time

    Markov chain models on simple seven node networks. We choose a relatively small network

    so that we can still visually represent the full solution to the continuous time Markov chain.

    Here, we present models both for analyzing viral and social epidemics. Also, for the sake

    of brevity and ease of graphical presentation, we implement susceptible-infected-susceptible

    (SIS) epidemiological models which have only two states per node: susceptible and infected.

    Nodes can become infected multiple times in this model – i.e., there is no recovered state as in

    a susceptible-infected-recovered (SIR) model. For contagion on social networks, we consider

    14

  • models where nodes can exist in one of three states labeled liberal, conservative, and undecided.

    Epidemic simulations of viral contagion We present analysis of a Markov simulation for

    a susceptible-infected-susceptible (SIS) model on a single network shown in Fig. 1A. Our

    simple model features many common properties of continuous time Markov chain simulations.

    Notably, it is common that Markov transition matrices have only a small number of dominant

    eigenvalues (i.e., those whose values are close to zero) thus rendering them suitable for analysis

    similar to that performed here for small networks. Of course, network models with more nodes

    will likely have emergent phenomena that will not appear in this small network – phenomena

    that one may hope to analyze using quantum computers [14, 40].

    For an SIS model, the full state is described by a vector ~x of length 2n (n = 7 for our

    example). All transitions are modeled as Poisson processes with transition matrix Q.

    d~x

    dt= Q~x (12)

    We begin in an initial state where any node has a 35% probability of being infected and con-

    duct analysis over the intermediate phase of the epidemic, between days one and two. Specif-

    ically, during that period, we numerically construct the history state of the Markov simulation

    using a Forward Euler method that begins at the state of the epidemic on day one and ends at

    day two over T = 1027 timesteps (step size h ≈ 0.001 days):

    ~xt+1 = ~xt + hQ~xt (13)

    From day one to day two, the epidemic has spread sufficiently that multiple individuals are

    likely to be infected, and the probability distribution has spread throughout the space. As noted

    above, this is the regime where the quantum algorithm provides an exponential advantage over

    existing classical Monte Carlo techniques.

    15

  • 0

    1

    2

    3

    4

    5

    6

    A

    states 0.0 0.2 0.4 0.6 0.8 1.0time (in days)

    Bprobabilities of states

    10 3

    10 2

    10 1

    100

    Figure 1: (A) The 7 node network used for simulation of the continuous time Markovchain. Line widths correspond to the rate of infection from infected neighbor nodes (rSI ={0.4, 0.8, 1.6} from thinnest to thickest lines). Network has the feature that some nodes (e.g.,node 2 and 3) are strongly connected to neighboring nodes and others (e.g., node 5) are not.(B) Probabilities of Markov states over time shown as a colorbar chart (logarithmically scaled).States are enumerated as rows on the left hand side, each denominated by a 7 node colorbarnumbered node 0 on the left to node 6 on the right. Dark/light color indicates a node in thatstate is infected/susceptible respectively.

    16

  • Fully simulating the above for T steps constructs a data matrix X where column i is equal

    to xi−1 (we assume initial state x0 is included in this matrix as well).

    X =

    | | |~x0 ~x1 . . . ~xT| | |

    (14)where we note that this data matrix can be interpreted as a classical version of the quantum

    output state shown in Eq. 7.

    To construct the matrix Q, we use the method detailed in [41]. We assume transitions from

    infected to susceptible (i.e., recovery rate) occur at rate rIS = 0.33 indicating that it takes about

    three days on average to recover from infection. Transitions from susceptible to infected occur

    at a rate rSI ∈ {0.4, 0.8, 1.6} depending on a node’s connection strength to a neighboring node

    (see Fig. 1A caption).

    In Fig. 1B, we plot the probabilities of states of the Markov process over time providing

    a visualization of the data matrix X . For larger networks, visualization of this data matrix

    cannot be efficiently performed and we now turn our attention to efficient quantum algorithms

    for extracting salient features from this data matrix.

    Simulations: quantum principal component analysis (qPCA) The output of our contin-

    uous time Markov chain algorithm is stored in a data matrix, visualized in Fig. 1B. In the

    quantum setting, this data matrix is a quantum state which we can subsequently post-process

    using various efficient quantum algorithms. One available post-processing algorithm is quan-

    tum Principal Component Analysis (qPCA) as in Eq. 10, which can compress the data into its

    singular vectors [2]. If the matrix is low rank, as in our example with exponentially decaying

    singular values (see Fig. 2A), qPCA can be performed in time logarithmic in the dimension of

    the full Markov state [2]. The principal components can be subsequently transformed or even

    measured.

    17

  • 0 20 40 60 80 100 120singular value index

    10 14

    10 11

    10 8

    10 5

    10 2

    101

    singu

    lar v

    alue

    A

    states 1.0 0.5 0.0 0.5singular vector value (scaled)

    B

    Vector 1Vector 2Vector 3Vector 4

    0.0 0.2 0.4 0.6 0.8 1.0time (in days)

    0.08

    0.06

    0.04

    0.02

    0.00

    0.02

    0.04

    singu

    lar v

    ecto

    r val

    ue

    C

    Vector 1Vector 2Vector 3Vector 4

    Figure 2: (A) Singular values of data matrix X decay exponentially fast. (B) First four leftsingular vectors scaled by the square root of their corresponding singular values show that muchof the disease progression can be understood by just observing the first few vectors. States areenumerated as rows on the left hand side, each denominated by a 7 node colorbar numberednode 0 on the left to node 6 on the right. Dark/light colors indicate a node in that state isinfected/susceptible respectively. (C) Values of the right singular vectors scaled by the squareroot of their corresponding singular values show the progression of the epidemic over time.The first singular vector depicts the steady state and the next few singular vectors detail theintermediate course of the Markov process.

    18

  • The most dominant left (Fig. 2B) and right (Fig. 2C) singular vectors can be interpreted

    as the most common profile of states (left vectors) and their corresponding trajectories in time

    (right vectors). In our example, the first singular vector corresponds to the steady state of our

    epidemic. Note that it takes prominence almost completely throughout the course of the simula-

    tion (see right singular vector in Fig. 2C). The second singular vector plots important changes in

    the epidemic as more nodes become infected. The corresponding right singular vector plots the

    steady, almost linear, transition over time as this singular vector takes prominence. Similarly,

    the third and fourth singular vectors plot trends in the progression of the epidemic, especially

    in early phases where nodes transition to recovery or infection.

    Simulations: Fourier and wavelet analysis For small networks such as the one studied here,

    the data in the Fourier domain is dominated by the steady state contributions as shown in Fig.

    3A. With quantum algorithms, one also has the option of transforming the individual singular

    vectors into their frequency components as shown in Fig. 3B. The second to fourth singular

    vectors all have strong contributions from low frequencies, whose values provide an indication

    of the rate of change in the progression of the Markov chain. Given the small network size, this

    dominance of low frequency components is perhaps not altogether surprising. Larger networks

    encounter phenomena not observed in small networks, and may potentially reveal interesting

    features in the Fourier domain [14, 40] if they are analyzed with a quantum computer.

    Quantum computers offer the advantage of efficient post-processing via wavelet transforms.

    Here, we transform the time dimension of our data matrix using a Haar wavelet transform, which

    can be performed efficiently on a quantum computer [25]. When viewed in the Haar wavelet

    basis (form of wavelets shown in Fig. 4A), one can analyze the characteristic timescales over

    which differences in the Markov state probabilities become apparent. Perhaps unsurprisingly,

    as shown in Fig. 4B, the zeroth Haar vector is most prominent as this corresponds to the steady

    19

  • 10 5 0 5 10Frequency (1/days)

    10 6

    10 4

    10 2

    100pr

    obab

    ility

    of m

    easu

    rem

    ent A

    10 5 0 5 10Frequency (1/days)

    10 4

    10 3

    10 2

    10 1

    100

    singu

    lar v

    ecto

    r val

    ue

    B

    Vector 1Vector 2Vector 3Vector 4

    Figure 3: (A) Measurements made in the Fourier domain (plotted only for low frequency com-ponents) have high probability in the zero frequency (steady state) and low frequency compo-nents. (B) The first singular vector, plotted in the Fourier domain, is dominated by the zerofrequency component corresponding to the steady state. Later singular vectors take prominencein low frequency components which indicate the rate of change during the intermediate pro-gression of the Markov chain.

    20

  • state of the Markov chain. More interesting results are observed in analysis of the singular

    vectors, which can also be transformed into the Haar domain as shown in Fig. 4C. Here, clear

    differences can be observed in the Haar basis of the steady state singular vector (first singular

    vector) and later vectors. The first singular vector is dominated by the zeroth Haar wavelet

    (constant wavelet) since that singular vector corresponds to the steady state. The next few

    singular vectors corresponding to changes in the intermediate progression of the epidemic are

    dominated by Haar vectors with support over various phases. For example, the third and fourth

    singular vectors take large values over Haar vectors with support in the early phases of the

    simulation (e.g., fourth and eighth Haar vectors).

    Epidemic simulations of social opinion Continuous time Markov chains can also be imple-

    mented to simulate the spread of social opinion. Here, we consider a model where nodes can

    exist in one of three states: conservative, liberal, or undecided. As in our analysis on viral epi-

    demics, we perform simulations on the same 7-node network (see figure 1A). Similar to before,

    transitions from undecided to liberal or conservative occur at rates dependent on the strength

    of connection to other liberal or conservative nodes respectively. The data matrix is analyzed

    between days one and two of the ”social epidemic”, where at day zero, all states are equally

    likely.

    As shown in figure 5A, the data matrix in this case is similarly low rank. Furthermore, we

    see similar progressions over time in the right singular vectors as shown in figure 5B. The first

    singular vector corresponds to steady state contributions, whereas later singular vectors chart

    the most prominent changes in the data matrix over time.

    21

  • 0 21 22 23 24 25 26Haar wavelet number

    10 9

    10 7

    10 5

    10 3

    10 1

    prob

    . of m

    easu

    rem

    ent (

    log

    axis) B

    0 21 22 23 24 25 26Haar wavelet number

    1.00

    0.75

    0.50

    0.25

    0.00

    0.25

    0.50

    singu

    lar v

    ecto

    r val

    ue

    C

    Vector 1Vector 2Vector 3Vector 4

    0th

    4th

    8th

    12th

    1st

    5th

    9th

    13th

    2nd

    6th

    10th

    14th

    3rd A

    7th

    11th

    15th

    Figure 4: (A) Each Haar wavelet has support over a characteristic timescale indicated by thewavelet number. Haar wavelet numbers between powers of 2 take the same form and are offsetfrom each other in the time dimension. As a visual aid, we show here the first 16 discrete Haarwavelets. (B) Quantum state has high probability in the zeroth Haar wavelet (steady state).(C) Wavelet transform of singular vectors shows that the first singular vector is strongest in thezeroth Haar vector (steady state). Later singular vectors take prominence in Haar vectors withsupport in the early stages of epidemic.

    22

  • 0 200 400 600 800 1000singular value index

    10 15

    10 12

    10 9

    10 6

    10 3

    100

    singu

    lar v

    alue

    A

    0.0 0.2 0.4 0.6 0.8 1.0time (in days)

    0.04

    0.03

    0.02

    0.01

    0.00

    0.01

    0.02

    singu

    lar v

    ecto

    r val

    ue

    B

    Vector 1Vector 2Vector 3Vector 4

    Figure 5: Quantum principal component analysis of the spread of social opinion. (A) Singularvalues of data matrix X decay exponentially fast. (B) Values of the right singular vectors scaledby the square root of their corresponding singular values show the progression of social opinionover time. The results are consistent with prior results for the analysis of viral epidemics on thesame network.

    23

  • Discussion

    Common quantum algorithms for solving linear differential equations output quantum states

    corresponding to solutions of physical models in high dimensional vector spaces. These out-

    put states store the complete history of the solution to a differential equation, allowing one to

    perform efficient quantum post-processing on these solution states. Our approach avoids a com-

    monly cited drawback of many quantum machine learning and signals processing algorithms –

    that classical inputs must be mapped into quantum states or stored in qRAM. The quantum

    linear differential equation solver efficiently produces as outputs states of exactly the form re-

    quired for quantum machine learning and signals processing algorithms. We focus here on the

    case of Markov models and propose efficient quantum algorithms for evaluating continuous

    time Markovian and non-Markovian models. Our algorithms allow for efficient simulation of

    Markov models on the complete state of a Markov chain. Outputs of our models are quantum

    states which can be efficiently generated and then passed as inputs for other efficient quantum

    post-processing algorithms (e.g., quantum signal analysis and machine learning). The quantum

    post-processing reveals features of the data such as the singular value decomposition, the power

    spectrum, and wavelet decompositions, which cannot be reconstructed efficiently using classi-

    cal sampling algorithms. When applied to complex networks, the quantum algorithms may be

    used to reveal such fundamental features of the dynamics of epidemics potentially exponentially

    faster than classical algorithms.

    Materials and Methods

    Generation of the quantum history state

    Let T = dtmax ‖M‖e, let δ > 0 and let k ∈ N with k ≥ 5 and (k + 1)! ≥ 2T . The quantum

    algorithm of Ref. [6] discretizes the differential equation (Eq. 1) in T time steps of size h =

    24

  • tmax/T , truncates the Taylor expansion of the matrix exponential at the k-th order and produces

    an approximate normalized version |φ〉 of the quantum state

    |y〉 =T−1∑i=0

    k∑j=0

    |i, j〉|yi,j〉+ |T, 0〉|yT,0〉 . (15)

    For sufficiently large k, the vectors |yi,0〉 are close to the solution of the linear differential

    equation (Eq. 1) at the i-th time step [6, Theorem 6]:

    ‖~x(ih)− |yi,0〉‖ ≤ 2.8κ i‖~x(0)‖+ tmax ‖~c‖

    (k + 1)!, (16)

    and the vectors |yi,j〉 for j ≥ 1 are some garbage vectors associated to the terms of the Taylor

    expansion of the matrix exponential, of which we do not need the exact form. Their norms are

    upper bounded by [6, eqs. (99), (100)]

    ‖|yi,j〉‖ ≤‖|yi+1,0〉‖+ ‖|yi,0〉‖

    (3− e) j!. (17)

    Let

    |ȳ〉 = |y〉‖|y〉‖

    (18)

    be the normalized version of |y〉. The quantum state |φ〉 satisfies

    ‖|φ〉 − |ȳ〉‖ ≤ δ (19)

    and the algorithm requires

    O

    (κ k2 tmax ‖M‖ s poly log

    κ k tmax ‖M‖ sNδ

    )(20)

    elementary quantum gates [6, eq. (128)].

    An approximation of the quantum history state |x〉 of Eq. 7 can be obtained by projecting

    the second register of the quantum state |φ〉 on the 0 value. Let 〈0|φ〉 be the unnormalized

    projection. In the following, we show that its success probability is O(1), and that choosing

    δ = O(�) , k = O

    (log

    ((1 +

    tmax ‖~c‖‖~x(0)‖

    )κ tmax ‖M‖

    ))(21)

    25

  • we can achieve ∥∥∥∥ 〈0|φ〉‖〈0|φ〉‖ − |x̄〉∥∥∥∥ ≤ � . (22)

    From Eq. 20, this modification of the algorithm of Ref. [6] requires

    O

    (κ tmax ‖M‖ s poly log

    ((1 +

    tmax ‖~c‖‖~x(0)‖

    )κ tmax ‖M‖ sN

    ))(23)

    elementary quantum gates.

    Success probability

    We assume that

    δ ≤ 12√

    66. (24)

    We have from Eq. 17

    k∑j=1

    ‖|yi,j〉‖2 ≤(‖|yi+1,0〉‖+ ‖|yi,0〉‖)2

    (3− e)2∞∑j=1

    1

    j!2≤ 1.28 ∗ 2 ‖|yi+1,0〉‖

    2 + ‖|yi,0〉‖2

    (3− e)2, (25)

    andT−1∑i=0

    k∑j=1

    ‖|yi,j〉‖2 ≤1.28 ∗ 4(3− e)2

    T∑i=0

    ‖|yi,0〉‖2 ≤ 65T∑i=0

    ‖|yi,0〉‖2 . (26)

    Let 〈0|y〉 be the projection of |y〉 onto the 0 value of the second register. The success probability

    of such projection is

    ‖〈0|ȳ〉‖2 =∑T

    i=0 ‖|yi,0〉‖2∑T

    i=0 ‖|yi,0〉‖2 +

    ∑T−1i=0

    ∑kj=1 ‖|yi,j〉‖

    2≥ 1

    66. (27)

    Let 〈0|φ〉 be the projection of |φ〉 onto the 0 value of the second register. We have from Eq. 19,

    27 and 24

    ‖〈0|φ〉‖ ≥ ‖〈0|ȳ〉‖ − ‖〈0|ȳ〉 − 〈0|φ〉‖ ≥ ‖〈0|ȳ〉‖ − δ ≥ 12√

    66, (28)

    therefore the success probability of the projection satisfies

    p = ‖〈0|φ〉‖2 ≥ 1264

    . (29)

    26

  • Error analysis

    From Eq. 16, the distance between the quantum history state |x〉 and the projection 〈0|y〉

    satisfies

    ‖|x〉 − 〈0|y〉‖2 =T∑i=0

    ‖~x(ih)− |yi,0〉‖2 ≤ 2.82 κ2(‖~x(0)‖+ tmax ‖~c‖)2

    (k + 1)!2T (T + 1) (2T + 1)

    6,

    (30)

    then

    ‖|x〉 − 〈0|y〉‖ ≤ κ‖~x(0)‖+ tmax ‖~c‖2k+4

    √3T (T + 1) . (31)

    We have from Lemma 1∥∥∥∥|x̄〉 − 〈0|y〉‖〈0|y〉‖∥∥∥∥ ≤ ‖~x(0)‖+ tmax ‖~c‖‖|x〉‖ κ

    √3T (T + 1)

    2k+3≤(

    1 +tmax ‖~c‖‖~x(0)‖

    )κ√

    3T (T + 1)

    2k+3.

    (32)

    We choose

    k =

    ⌈log2

    ((1 +

    tmax ‖~c‖‖~x(0)‖

    )κ√

    3T (T + 1)

    4�

    )⌉

    = O

    (log

    ((1 +

    tmax ‖~c‖‖~x(0)‖

    )κ tmax ‖M‖

    )), (33)

    such that ∥∥∥∥|x̄〉 − 〈0|y〉‖〈0|y〉‖∥∥∥∥ ≤ �2 . (34)

    We have from Eq. 19, 27 and Lemma 1 again∥∥∥∥ 〈0|φ〉‖〈0|φ〉‖ − 〈0|ȳ〉‖〈0|ȳ〉‖∥∥∥∥ ≤ 2 ‖〈0|φ〉 − 〈0|ȳ〉‖‖〈0|ȳ〉‖ ≤ 2√66 δ , (35)

    such that choosing

    δ =�

    4√

    66(36)

    we have ∥∥∥∥ 〈0|φ〉‖〈0|φ〉‖ − 〈0|ȳ〉‖〈0|ȳ〉‖∥∥∥∥ ≤ �2 (37)

    27

  • and ∥∥∥∥ 〈0|φ〉‖〈0|φ〉‖ − |x̄〉∥∥∥∥ ≤ ∥∥∥∥ 〈0|φ〉‖〈0|φ〉‖ − 〈0|ȳ〉‖〈0|ȳ〉‖

    ∥∥∥∥+ ∥∥∥∥ 〈0|y〉‖〈0|y〉‖ − |x̄〉∥∥∥∥ ≤ � (38)

    as required.

    Lemma 1. Let v, w be vectors in a normed vector space. Then,∥∥∥∥ v‖v‖ − w‖w‖∥∥∥∥ ≤ 2 ‖v − w‖‖v‖ . (39)

    Proof. We have ∥∥∥∥ v‖v‖ − w‖w‖∥∥∥∥ ≤ ‖v − w‖+ |‖w‖ − ‖v‖|‖v‖ ≤ 2 ‖v − w‖‖v‖ . (40)

    References

    1. J. Biamonte, P. Wittek, N. Pancotti, P. Rebentrost, N. Wiebe, S. Lloyd, Quantum machine

    learning. Nature 549, 195–202 (2017).

    2. S. Lloyd, M. Mohseni, P. Rebentrost, Quantum principal component analysis. Nature

    Physics 10, 631–633 (2014).

    3. M. Schuld, I. Sinayskiy, F. Petruccione, Prediction by linear regression on a quantum com-

    puter. Physical Review A 94, 022342 (2016).

    4. P. Rebentrost, M. Mohseni, S. Lloyd, Quantum support vector machine for big data classi-

    fication. Physical review letters 113, 130503 (2014).

    5. A. Montanaro, Quantum speedup of Monte Carlo methods. Proceedings of the Royal Soci-

    ety A: Mathematical, Physical and Engineering Sciences 471, 20150301 (2015).

    28

  • 6. D. W. Berry, A. M. Childs, A. Ostrander, G. Wang, Quantum algorithm for linear differen-

    tial equations with exponentially improved dependence on precision. Communications in

    Mathematical Physics 356, 1057–1081 (2017).

    7. D. W. Berry, High-order quantum algorithm for solving linear differential equations. Jour-

    nal of Physics A: Mathematical and Theoretical 47, 105301 (2014).

    8. A. W. Harrow, A. Hassidim, S. Lloyd, Quantum algorithm for linear systems of equations.

    Physical review letters 103, 150502 (2009).

    9. A. M. Childs, R. Kothari, R. D. Somma, Quantum linear systems algorithm with exponen-

    tially improved dependence on precision. arXiv preprint arXiv:1511.02306 83 (2015).

    10. R. P. Feynman, Quantum mechanical computers. Optics news 11, 11–20 (1985).

    11. A. Y. Kitaev, A. Shen, M. N. Vyalyi, M. N. Vyalyi, Classical and quantum computation

    (American Mathematical Soc., 2002).

    12. S. Lloyd, Robustness of adiabatic quantum computing. arXiv preprint arXiv:0805.2757

    (2008).

    13. P. A. Gagniuc, Markov chains: from theory to implementation and experimentation (John

    Wiley & Sons, 2017).

    14. R. Pastor-Satorras, C. Castellano, P. Van Mieghem, A. Vespignani, Epidemic processes in

    complex networks. Reviews of modern physics 87, 925 (2015).

    15. F. D. Sahneh, C. Scoglio, P. Van Mieghem, Generalized epidemic mean-field model for

    spreading processes over multilayer complex networks. IEEE/ACM Transactions on Net-

    working 21, 1609–1620 (2013).

    29

  • 16. W. J. Anderson, Continuous-time Markov chains: An applications-oriented approach

    (Springer Science & Business Media, 2012).

    17. A. Kolmogoroff, Über die analytischen methoden in der wahrscheinlichkeitsrechnung.

    Mathematische Annalen 104, 415–458 (1931).

    18. E. Tang, Quantum-inspired classical algorithms for principal component analysis and su-

    pervised clustering. arXiv preprint arXiv:1811.00414 (2018).

    19. N.-H. Chia, A. Gilyén, T. Li, H.-H. Lin, E. Tang, C. Wang, Proceedings of the 52nd Annual

    ACM SIGACT Symposium on Theory of Computing (2020), pp. 387–400.

    20. M. Rudelson, R. Vershynin, Sampling from large matrices: An approach through geometric

    functional analysis. Journal of the ACM (JACM) 54, 21–es (2007).

    21. K.-M. Lau, H. Weng, Climate signal detection using wavelet transform: How to make a

    time series sing. Bulletin of the American meteorological society 76, 2391–2402 (1995).

    22. D. B. Percival, A. T. Walden, Wavelet methods for time series analysis, vol. 4 (Cambridge

    university press, 2000).

    23. B. Cazelles, M. Chavez, G. C. d. Magny, J.-F. Guégan, S. Hales, Time-dependent spec-

    tral analysis of epidemiological time-series with wavelets. Journal of the Royal Society

    Interface 4, 625–636 (2007).

    24. A. Grinsted, J. C. Moore, S. Jevrejeva, Application of the cross wavelet transform and

    wavelet coherence to geophysical time series. Nonlinear Processes in Geophysics (2004).

    25. P. Hoyer, Efficient quantum transforms. arXiv preprint quant-ph/9702028 (1997).

    30

  • 26. A. Fijany, C. P. Williams, NASA International Conference on Quantum Computing and

    Quantum Communications (Springer, 1998), pp. 10–33.

    27. A. Klappenecker, M. Rotteler, ISPA 2001. Proceedings of the 2nd International Sympo-

    sium on Image and Signal Processing and Analysis. In conjunction with 23rd International

    Conference on Information Technology Interfaces (IEEE Cat. (IEEE, 2001), pp. 464–468.

    28. C. Shao, Computing eigenvalues of matrices in a quantum computer. arXiv preprint

    arXiv:1912.08015 (2019).

    29. Z. Li, X. Liu, N. Xu, J. Du, Experimental realization of a quantum support vector machine.

    Physical review letters 114, 140504 (2015).

    30. G. Wang, Quantum algorithm for linear regression. Physical review A 96, 012335 (2017).

    31. E. Farhi, H. Neven, Classification with quantum neural networks on near term processors.

    arXiv preprint arXiv:1802.06002 (2018).

    32. A. B. Grilo, I. Kerenidis, T. Zijlstra, Learning-with-errors problem is easy with quantum

    samples. Physical Review A 99, 032314 (2019).

    33. J. Romero, J. P. Olson, A. Aspuru-Guzik, Quantum autoencoders for efficient compression

    of quantum data. Quantum Science and Technology 2, 045001 (2017).

    34. A. Khoshaman, W. Vinci, B. Denis, E. Andriyash, H. Sadeghi, M. H. Amin, Quantum

    variational autoencoder. Quantum Science and Technology 4, 014001 (2018).

    35. M. Schuld, N. Killoran, Quantum machine learning in feature hilbert spaces. Physical

    review letters 122, 040504 (2019).

    31

  • 36. V. Havlı́ček, A. D. Córcoles, K. Temme, A. W. Harrow, A. Kandala, J. M. Chow, J. M.

    Gambetta, Supervised learning with quantum-enhanced feature spaces. Nature 567, 209–

    212 (2019).

    37. S. Lloyd, M. Schuld, A. Ijaz, J. Izaac, N. Killoran, Quantum embeddings for machine

    learning. arXiv preprint arXiv:2001.03622 (2020).

    38. I. Cong, S. Choi, M. D. Lukin, Quantum convolutional neural networks. Nature Physics

    15, 1273–1278 (2019).

    39. M. Schuld, A. Bocharov, K. M. Svore, N. Wiebe, Circuit-centric quantum classifiers. Phys-

    ical Review A 101, 032308 (2020).

    40. P. Van Mieghem, E. Cator, Epidemics in networks with nodal self-infection and the epi-

    demic threshold. Physical Review E 86, 016116 (2012).

    41. P. L. Simon, M. Taylor, I. Z. Kiss, Exact epidemic models on graphs using graph-

    automorphism driven lumping. Journal of mathematical biology 62, 479–508 (2011).

    42. L. Grover, T. Rudolph, Creating superpositions that correspond to efficiently integrable

    probability distributions. arXiv preprint quant-ph/0208112 (2002).

    Acknowledgments

    This work was supported by ARO, DOE, AFOSR, and IARPA. The authors thank Peter Love

    and Clemens Wittenbecher for helpful discussions.

    32

  • Supplementary Material

    Sampling and calculating observables of Markov states

    To determine the Tqn individual probabilities of a Markov state xj(k), for j = 0 to T , k = 1 to

    N = qn stored in a quantum state, one would have to make an exponentially large number of

    measurements. However, one can use quantum measurements to reveal a wide variety of desired

    properties of the quantum system at time j. To extract the expectation value of some desired

    quantity Q (total number infected, variance of the infection rate across the graph, existence of

    hot spots, etc.) we need to make a quantum measurement to estimate the expectation value

    〈Q〉 =N∑k=1

    xj(k)Q(k) (41)

    where Q(k) is the value of Q on the k’th state of the vertices of the graph.

    First, we have to make sure that we obtain the state |~xj〉 with high probability. In the

    formulation given above, this state only occurs in the overall superposition |x〉 with amplitude

    O(1/√T ). The standard way to amplify the probability of finding the answer at the desired

    time j [7] is to pad out the matrix A following the j’th row with O(T ) rows of the form

    (0 . . . 0 − I I 0 . . . 0) (42)

    where the I term in each −I I 0 sequence lies on the diagonal. These rows induce a trivial

    dynamics in which all the states in the solution following the j’th state also contain the state

    |~xj〉. This technique allows us to obtain the state |~xj〉 with probability O(1).

    To obtain 〈Q〉 =∑N

    k=1 xj(k)Q(k), we use standard techniques of quantum state preparation

    [42]. We assume that we are given access in quantum superposition to the individual values of

    the variable Q(k) together with its partial sums over ranges of k; The techniques of [42] then

    33

  • allow us to construct the (unnormalized) state

    |Q〉 =N∑k=1

    Q(k)|k〉 (43)

    in time O(logN) = O(n log q). Define ZQ =∑N

    k=1Q(k)2. Even if ZQ is not known before-

    hand, its value is revealed during the state preparation process [42]. The normalized version of

    |Q〉 is then

    |Q̃〉 = Z−1/2Q |Q〉 (44)

    We can now use a swap test between |Q̃〉 and |x̃j〉 to measure the overlap 〈Q̃|x̃j〉. This

    overlap in turn allows us to measure

    〈Q〉 =N∑k=1

    xj(k)Q(k) = 〈Q|xj〉 = Z1/2j Z1/2Q 〈Q̃|x̃j〉 (45)

    In conclusion, even though we don’t have access to the individual probabilities for states, the

    quantum algorithm allows us to measure expectation values for a wide variety of observables

    efficiently. This method allows us to use the quantum algorithm to extract expectation values of

    the desired quantities.

    Comparison to classical complexity Extracting expectation values could also be done clas-

    sically using classical Monte Carlo to sample from the probabilistic dynamics. Because of the

    local form of the probabilistic updating rule, the number of computational steps required to

    draw one sample of the Markov chain at time t scales as

    O(n(t/h) log q) . (46)

    The average of Q over O(

    log 1δ

    /�2)

    samples is �-close to 〈Q〉 with probability at least 1 − δ,

    and its computation has complexity

    O

    (n(t/h) log 1

    δlog q

    �2

    ). (47)

    34

  • Quantum speedup of Monte Carlo sampling The quantum algorithm of Ref. [5] provides a

    quadratic improvement in the dependence of the complexity Eq. 47 of Monte Carlo sampling on

    the precision �. More precisely, let us assume that 0 ≤ Q(k) ≤ 1 for any k = 1, . . . , N (this can

    always be achieved by a suitable linear redefinition of Q). Let U be a quantum unitary operator

    that implements a unitary dilation of the classical algorithm for the Monte Carlo sampling of

    the Markov chain. We can assume that the complexity of U has at worst a constant overhead

    with respect to the classical algorithm, and therefore has the same scaling Eq. b46. Then,

    Theorem 2.3 of [5] implies that, for any 0 < � < 1 and any 0 < δ < 1 there exists a quantum

    algorithm that, with O(

    log 1δ

    /�)

    applications of U , outputs µ ∈ R such that |µ− 〈Q〉| < �

    with probability at least 1− δ. The complexity of the algorithm is therefore

    O

    (n(t/h) log 1

    δlog q

    ), (48)

    with the promised quadratic improvement in the �-dependence with respect to Eq. 47.

    Classical algorithms for Principal Component Analysis

    Here we show that the singular vectors and singular values of the data matrix X cannot be effi-

    ciently estimated with classical methods whenever ‖|xj〉‖2 is exponentially small in the number

    of nodes for any time step, i.e., if the size of the support of the probability distribution is al-

    ways exponential. More precisely, we show that none of the entries of X†X can be estimated

    efficiently. Indeed, if xj(k) is the probability of the k-th state at the time step j, the jj′ entry of

    X†X is (X†X

    )jj′

    =∑k

    xj(k)xj′(k) , (49)

    and is equal to the probability that, in a couple of independent Monte Carlo simulations of

    the Markov chain, the state of the first simulation at the step j is equal to the state of the

    second simulation at the step j′. This probability can be estimated by running many couples

    35

  • of simulations of the Markov chain. However, the estimate will be zero until a couple with the

    state of the first simulation at the step j equal to the state of the second simulation at the step j′

    is found. This event will typically happen after

    O

    (1

    (X†X)jj′

    )≥ O

    (1

    maxi ‖|xi〉‖2

    )(50)

    runs, which is exponentially large in the number of nodes if ‖|xj〉‖2 is exponentially small for

    any time step.

    Additional figures and simulations

    Supplementary to the main text, we show results here for a simulation of a Markov chain which

    incorporates effects of ”social distancing” in the Markov model. Specifically, we simulate a

    viral epidemic on the same network as in the main text where transitions from susceptible to

    infected and vice-versa occur with rates rSI = 1.5 and rIS = 0.33 respectively as long as

    three or fewer nodes are infected. When four or more nodes are infected, ”social distancing” is

    enacted and transitions from susceptible to infected occur at a fifth of the original rate (rSI =

    0.3). As expected, this shifts the steady state away from situations where all nodes are infected

    to those where four nodes are infected.

    The complete progression of this model is plotted in Fig. 6B. Note, that the state where

    all nodes are infected is now unlikely; instead, the states where four or five nodes are infected

    become very likely (i.e., the social distancing works).

    As with the original model, singular values decay exponentially rapidly (see Fig. 7A). The

    first four left singular vectors are plotted in Fig. 7B scaled by their corresponding singular

    value. The steady state singular vector has clearly changed with respect to the original model.

    Analysis of the first singular vector shows that the dominant states are those where no node is

    infected and four nodes are infected (i.e., the transition point of social distancing).

    36

  • 0

    1

    2

    3

    4

    5

    6

    A

    states 0.0 0.2 0.4 0.6 0.8 1.0time (in days)

    Bprobabilities of states

    10 3

    10 2

    10 1

    100

    Figure 6: (A) The 7 node network used for simulation of continuous time Markov chain wheretransitions from susceptible to infected and vice-versa occur with rates rSI = 1.5, reduced bya factor of five when four or more nodes are infected. (B) Probabilities of Markov states overtime shown as colorbar chart (logarithmically scaled). States are enumerated as rows on the lefthand side, each denominated by a 7 node colorbar numbered node 0 on the left to node 6 on theright. Dark/light color indicates a node in that state is infected/susceptible respectively.

    37

  • 0 20 40 60 80 100 120singular value index

    10 14

    10 11

    10 8

    10 5

    10 2

    101

    singu

    lar v

    alue

    A

    states 1.00 0.75 0.50 0.25 0.00singular vector value (scaled)

    B Vector 1Vector 2Vector 3Vector 4

    0.0 0.2 0.4 0.6 0.8 1.0time (in days)

    0.06

    0.04

    0.02

    0.00

    0.02

    singu

    lar v

    ecto

    r val

    ue

    C

    Vector 1Vector 2Vector 3Vector 4

    Figure 7: (A) Singular values of data matrix X decay exponentially fast. (B) First four leftsingular vectors scaled by the square root of their corresponding singular value show that stateswhere four nodes are infected become prominent as this is the inflection point for social dis-tancing. States are enumerated as rows on the left hand side, each denominated by a 7 nodecolorbar numbered node 0 on the left to node 6 on the right. Dark/light colors indicate a node inthat state is infected/susceptible respectively. (C) Values of the right singular vectors scaled bythe square root of their corresponding singular value show the progression of the epidemic overtime. The first singular vector depicts the steady state and the next few singular vectors detailthe intermediate course of the Markov process.

    38

  • base model with people nodes

    state: ۧȁ𝑃

    model with variable connection nodes

    In SIS model, each node either susceptible or infected

    state: ۧȁ𝑃 ۧȁ𝐶

    Connection nodes mediate Markov process and are part of state (e.g., can be on/off as two states)

    model with testing/treatment nodes

    state: ۧȁ𝑃 ۧȁ𝐻

    treatment nodes can e.g., have on/off state where on state has faster recovery for connected nodes

    model with different population segments

    state: ൿห𝑃1 ൿห𝑃2

    e.g., can have a separate segment for older vs. younger population, each with different recovery time

    Figure 8: By customizing the properties of nodes in a network, Markov states can model variousdifferent phenomenon. Here, we show some of the options available to expand the function-ality of a Markov state. In these cases, states are stored in a tensor product structure whereinformation corresponding nodes of different types can be stored in separate registers.

    Markov states incorporating more than just simple nodes

    Markov models can incorporate nodes of different types which interact in a customized fash-

    ion. Fig. 8 outlines some of the different options available to one modeling epidemiological

    processes. Utilizing quantum algorithms, nodes of different types can be stored in separate

    registers. Analysis and post-processing of the Markov states using a quantum state can take

    advantage of the structure inherent in these expanded models.

    Computational details

    All simulations were performed in Python. Code is available upon request.

    39