Quantum Encoding and Analysis on Continuous Time Stochastic Process with Financial Applications

The continuous time stochastic process is a mainstream mathematical instrument modeling the random world with a wide range of applications involving finance, statistics, physics, and time series analysis, while the simulation and analysis of the continuous time stochastic process is a challenging problem for classical computers. In this work, a general framework is established to prepare the path of a continuous time stochastic process in a quantum computer efficiently. The storage and computation resource is exponentially reduced on the key parameter of holding time, as the qubit number and the circuit depth are both optimized via our compressed state preparation method. The desired information, including the path-dependent and history-sensitive information that is essential for financial problems, can be extracted efficiently from the compressed sampling path, and admits a further quadratic speed-up. Moreover, this extraction method is more sensitive to those discontinuous jumps capturing extreme market events. Two applications of option pricing in Merton jump diffusion model and ruin probability computing in the collective risk model are given.

statistics, and biology [1][2][3][4][5].However, compared to its discrete counterpart, CTSP is considered more complex due to its continuous path.Analytic solutions or explicit formulas for the underlying stochastic differential equations and quantities are often unavailable for practical problems.Moreover, the application of numerical methods like Monte Carlo simulation can be computationally demanding, requiring unexpectedly large storage and computation resources.This is primarily due to the exponential growth of the sampling space as time slices become finer, and the intricate nature of the evolution dynamics within the process [6,7].These complexities make efficient and accurate analysis of CTSPs a challenging task in various fields of study.
The developments of quantum processors [8][9][10] and algorithms [11][12][13][14][15][16][17][18][19] have revealed that quantum computation has great potential beyond classical computers.Thus it would be one powerful tool to solve the above challenging problems.However, there are still two fundamental challenges to be overcome when implementing the storage and analysis of CTSP with a quantum computer.
The first challenge is the data-loading procedure of CTSP: As a common and primary bottleneck faced by quantum machine learning and many other algorithms [20], the state preparation problem has been studied and discussed in many works [21][22][23].Quantum analog simulators are proposed to predict the future of a specified class of CTSP named renewal process with less past information, and an unbounded memory requirement reduction is made in [24][25][26].The quantum advantage in simulating stochastic processes is further discussed in [27].Nevertheless, those works have not totally solved the CTSP preparation problem.The information is not digital-encoded, so the analysis, such as quantum-enhanced Monte Carlo method is not easy to implement.Moreover, the type of CTSP is restricted to the renewal process.Furthermore, the storage of the entire path is absent, leading to crucial practical problems for financial engineering, quantitative trading, and many other path-dependent scenarios.
The second challenging problem is the information extraction of CTSP.Quantumenhanced Monte Carlo method, which involves generating random paths and computing the expectation of desired values, has been shown to achieve quadratic quantum speedup in computing the final value of discrete sampling paths [28][29][30][31][32][33].Additionally, a weightless summation of discrete paths, targeting Asian-type option pricing, is proposed in the work by Stamatopoulos et al. [30].However, the quantum-enhanced Monte Carlo method for CTSP, which involves computing the expectation of a weighted integral over the CTSP paths and extracting history-sensitive information (such as the first-hitting time problem), remains unresolved.
In this work, we establish a framework to solve the problems of state preparation and information extraction of quantum continuous time stochastic process (QCTSP).Two representations encoding general QCTSP are introduced.The corresponding state preparation method is developed to prepare the QCTSP with less qubit number requirement, higher flexibility, and more sensitivity to discontinuous jumps that are important to model extreme market events such as flash crash.An observation of the CTSP holding time is made, inducing further reductions in the circuit depth and the gate complexity of QCTSP.Specific quantum circuits are designed for most of the often-used CTSPs with exponential reduction of both qubit number and circuit depth on the key parameter of QCTSP named holding time τ avg (as summarized in table 2).As for the information extraction problem of QCTSP, the weightless integral and the arbitrary time-weighted integral of the QCTSP can be efficiently evaluated by computing the summation of directed areas.Furthermore, this method enables the quantum-enhanced Monte Carlo framework to extend to the continuous-time regime, admitting a quadratic quantum speed up.Moreover, by introducing a sequence of flag qubits, our method can extract the history-sensitive information that is essential and indispensable for quantitative finance, path-dependent option pricing, and actuarial science, to cite but a few examples.
Applications of computing the European type option price in the Merton Jump Diffusion Model and the ruin probability in the Collective Risk Model are given.The first application of evaluating a European-type option has been studied in previous work [29][30][31]33], while our method takes the more practical situation of the discontinuous price movement into consideration, and the simulation result is consistent with the Merton formula.The second application of computing the ruin probability opens up new opportunities in the area of insurance as being the first time that quantum computing has been introduced into insurance mathematics up to known, illustrating the great potential power of QCTSP.
In addition to the theoretical importance and rich applicability of QCTSP mentioned above, our work also benefits from its low requirement of input data and circuit connectivity.It can be utilized as an input without quantum random access memory (qRAM) [34][35][36], partly mitigating the input problem that quantum machine learning and many other quantum algorithms are confronted with.Simultaneously, an indicator is given in this work to characterize not only the preparation procedure's complexity but the circuit connectivity as well.
The structure of this article is as follows: Given the mathematical notations for readability and the formal problem statement, the main framework of QCTSP is sketched in Section 2. The main results of state preparation and information extraction are organized in Section 3 and Section 4, respectively.Followed by two applications of option pricing and insurance mathematics in Section 5, the discussion, together with an introduction of future work, is given in Section 6.The detailed construction of specific modified subcircuits and proofs can be found in the Appendix.

QUANTUM CONTINUOUS TIME STOCHASTIC PROCESS
The mathematical notation is given in the first subsection, followed by the formal definition of CTSP and the two representations of QCTSP.Then the core problems of state preparation and information extraction of QCTSP are stated.A brief framework of our QCTSP is described at the end of this section.

Preliminaries
Intuitively, a continuous time stochastic process is a sequence of random variables X(t) indexed by a non-negative continuous parameter t, such as the position of a particle or the price of a financial instrument.Wherein each random variable X(t) lies in the same space named the state space S. In this article we consider the state space S with a finite size |S| = S ∈ N + , whereas the more generic continuous case can be solved via a discretization.For the current time t = t 0 , the random variable X(t 0 ) follows a distribution F(t 0 ) determined by the previous history {X(t) : 0 ≤ t < t 0 }, i.e., if an observation is made, the random variable X(t 0 ) falls into one specific state, as known as a realization, in the underlying space S. In the generic case, the distribution F(t 0 ) also varies following the evolutionary dynamics of this CTSP.More formally, given the mathematical symbols in Table 1, a CTSP can be defined as Definition 1. (Continuous Time Stochastic Process) Given a discrete space S, a continuous time stochastic process {X(t) : t ≥ 0} is a stochastic process defined on the

X j
The j th piece's value variable.x j,k j A realization of X j , taking the k j ∈ S index.
k The index vector denoting the state space indexes of the path.

Y j
The j th piece's increment.τ j The j th piece's holding time.
A realization of τ j in path.t The holding time vector of one path realization.

T j
The j th piece's cumulative time.ML(X) The memory length of X(t).continuous variable t, where for each t 0 , the state X(t 0 ) ∈ S is a stochastic variable whose possibility distribution is determined by P[X(t 0 )] = P[X(t 0 )|X(t) : 0 ≤ t < t 0 ].
For a given CTSP, the most significant distinction from the discrete case is the uncountable dimensional space of continuous sample paths denoted by Ω.As the time slices become thinner, the sample space becomes a disaster for both theoretical analysis and simulation.Henceforth, the reduced space Ωn consists of those paths that can be divided into finite n ∈ N + in-variate pieces is considered, where each {X(t) : t ≥ 0} in Ωn is a piece-wise determined random function X(t) = X j for T j−1 ≤ t < T j with T 0 = 0.
Thus the j th piece can be recorded as a pair of random variables (X j , τ j ), where X j ∈ S is a discrete random variable that denotes the j th piece's state, and τ j = T j − T j−1 ∈ N + is a strictly positive random variable that denotes lifetime length of the j th piece.In this way, the whole CTSP is encoded via a sequence of random variable pairs {(X j , τ j ) : 1 ≤ j ≤ n}, which will be called the holding time representation hereafter (as illustrated in Figure 1 (a)).More precisely, we have:

Definition 2. (Holding Time Representation of Quantum Continuous Time
Stochastic Process ) Given a continuous time stochastic process {X(t) : t ≥ 0}, the holding time representation of quantum continuous time stochastic process is a sequence of stochastic pairs (X j , τ j ) satisfying: (1) An alternative method named increment representation to encode a CTSP is to consider an equivalent sequence of random variable pairs {(Y j , T j ) : 1 ≤ j ≤ n} where Y 1 = X 1 and Y j = X j − X j−1 are the increments of the CTSP (as illustrated in Figure 1 (b)):

Definition 3. (Increment Representation of Quantum Continuous Time Stochastic Process )
Given a continuous time stochastic process {X(t) : t ≥ 0}, the increment representation of quantum continuous time stochastic process is a sequence of stochastic pairs (Y j , T j ) satisfying: (1) Instead of the uniform sampling method, these two encoding methods benefit from the reduction of qubit number (as shown in Figure 2), as well as the ability to capture randomly occurring discontinuous jumps (as circled in Figure 4 (a) and Figure 6 (a)).These two equivalent representations are proposed simultaneously to efficiently compute pathdependent and history-sensitive information, as stated later in Section 4.

Problem statement
In this paper, the QCTSP is assumed to be stored in three registers named the index register |0⟩ index , the data register |0⟩ data and the time register |0⟩ time for the storage of the index sequence{k j }, the path sequence {X j } and the holding time sequence {τ j }, respectively.Then the QCTSP state, defined as Definition 1 and encoded in either Definition 2 or where each path is stored in the state . Here the index vector k and means that the j th piece takes the k j th value in the state space S, and t = (t 1 , ..., t n ) T ∈ Z n T where 1 ≤ t j ≤ T is a realization of the sequence (τ 1 , ..., τ n ) and means that the j th piece stays for t j time slices bounded by T .According to Definition 1, for each time piece, the current pair (X j , τ j ) is derived from the past pieces {(X j ′ , τ j ′ ) : 1 ≤ j ′ ≤ j − 1} with the possibility P(k, t) satisfying The corresponding possibility amplitude p(k, t) satisfies as a direct result.Besides, the possibility amplitudes also satisfy Given a CTSP as defined in Definition 1, our first goal is to derive the corresponding QCTSP Eq. (1a) encoded by Definition 2 and 3.More formally, the problem is defined as follows: Problem 1: QCTSP Preparation (QCTSP-P) Input: A CTSP defined in Definition 1 and three registers |0⟩ index |0⟩ data |0⟩ time Question: Is there a procedure, that is, a unitary operator U acting on the registers such that with the notations described in Eq. (1a) -Eq.(1c) and summarized in Table 1, , t⟩ and the possibility amplitude p(k, t) satisfies Eq. (2b) and Eq.(3)? Supposed that a QCTSP has been prepared taking the form of Eq. (1), our second goal is to extract the information of interest, a quantity determined by the knowledge of the past path {X(t) : T > t ≥ 0}.This problem can be stated formally as: Problem 2: QCTSP Extraction (QCTSP-E) Input: A QCTSP defined as Eq.(1a)-Eq.( 3) and a quantity Q determined by it.Question: Is there a procedure, that is, a unitary operator V acting on the QCTSP such that V |ψ⟩ is the desired quantity Q({X(t) : T > t ≥ 0})?
Measurements can be implemented at the end of QCTSP-E circuit to extract the quantum information into a classical register.Despite this, it should be noticed that the information is stored in the quantum state before any measurements, and hence the QCTSP-E circuit can be utilized as a sub-module of another bigger circuit.
As there are many classes of QCTSP to be prepared, together with many quantities of interest, the detailed quantum algorithms are expounded in section 3 and section 4, respectively.And a brief framework illustrating the basic idea is as follows.

Framework
The problem of modeling and analyzing the paths of QCTSP via a quantum processor can be divided into two main steps: Encode and prepare the QCTSP, and then decode and analyze it.
There are prominent challenges to overcome when we try to solve the QCTSP-P problem.Intuitively, the complexity of the QCTSP-P problem is determined by the number of pieces n, the average holding time τ avg , and the intrinsic evolution complexity.The compressed encoding method appears to be natural and simple, and leads to reductions in the qubit number and the circuit depth (as illustrated in Figure 2).By introducing the indicator memory length to depict the evolutionary complexity of CTSP, we first study the simplest case of memory-less process.An interesting observation of the memory-less process holding time is made, and this induces a constant circuit depth.As the memory length increases, the underlying QCTSP turns to be more complicated (shown in Figure 3) while the property of the holding time still works: Specific types of QCTSP can be prepared efficiently (see Figure 4, Figure 5, and Figure 6), and the detailed construction and the corresponding proofs are given in section 3 and Appendix B, respectively.The qubit number is reduced from O(T ln S) = O(nτ avg ln S) of the uniform sampling method to O(n ln (τ avg S)) of the QCTSP method, making an exponential reduction on the parameter τ avg .And the circuit depth is optimized from O(T ln nS) = O(nτ avg ln (nSτ avg )) of the uniform sampling method to O(n ln (nS)) of the QCTSP method, also making an exponential reduction of qubit number on the parameter τ avg .The results of state preparation are summarized in Table 2.The even more challenging QCTSP-E problem is to efficiently decode and extract information from QCTSP so that the quantum speed-up on preparation will not be diminished.By a controlled rotation gate-based Riemann summation of rectangles (as illustrated in Figure 7 (a) and Figure 7 (c)), the weightless summation of a discrete path can be extended to the time integral of a continuous path.In addition, a parallel coordinate transformation can be implemented to achieve a path-dependent weighted integral (as illustrated in Figure 7 (b), Figure 7 (d) and Figure 7 (e)).Furthermore, benefited from our encoding and extracting method, the discontinuous jumps and transitions can be detected and modeled more precisely.And history-sensitive information such as first hitting time can be extracted easily as a consequence.Moreover, by introducing the amplitude estimation algorithm, the information extraction QCTSP also admits a further quadratic speed-up.The detailed construction and the corresponding proofs are given in section 4 and Appendix C.

STATE PREPARATION
To understand why the state preparation procedure of QCTSP is non-trivial, one should notice that the sequence of pairs (X j , τ j ) can be entangled with each other for 1 ≤ j ≤ n.Intuitively, the more the current state is influenced by past information, the more complicated gates and deeper circuits are needed.More precisely, the memory length of a given CTSP is defined as which means that the conditional probability distribution of the current time t 0 is totally determined by the information in the latest ML(X) time slices.Two extreme situations are compared in Figure 3: One is the worst case where the memory length ML(X) = n is as long as the number of pieces.The other is the opposite case where the memory length ML(X) = 0, and X(t) is said to be memory-less in this case.For the first case of the longest memory length, the present pair registers (X j , τ j ) should be entangled with all past time pairs of variables {(X j ′ , τ j ′ ) : 1 ≤ j ′ ≤ j − 1} together (as illustrated in Figure 3 (a)), and this surely leads to a disaster of circuit depth and gate complexity.The second case, on the contrary, turns out to be quite simple, and we have the following result: Theorem 1. (Memory-less Process' Holding Time) Supposing that {X(t) : 0 ≤ t ≤ T } is memory-less, then the holding time τ j for any state X j follows an exponential distribution P[τ j ≥ t] = e −λ j t with λ j determined by the current sate X j .Moreover, given an ϵ such that the cumulative density function(c.d.f) < ϵ, τ j can be prepared via a circuit consisting of ⌈log (− 1 λ j ln ϵ)⌉ qubits with constant circuit depth 1, and the gate complexity is ⌈log This simple result should not be surprising since, as discussed above, the memory-less condition ML(τ j ) = 0 leads to no-entanglement states and easier preparation.Following this thought, most of the often-used CTSPs have been systematically studied and efficiently prepared.The conclusion that the complexity of the state preparation of QCTSP tends to be higher as the memory length grows is further evidenced by those results summarized in table 2, leaving the detailed explanation and relevant applications given as follows.

Lévy process
The first and essential family of CTSPs is the Lévy process, which is one of the most wellknown families of continuous-time stochastic processes, including the Poisson process and the Wiener process (also known as Brownian motion), with applications in various fields (For more details, refer to [37] and the references therein).Formally, {X(t) : t ≥ 0} is said to be a Lévy process if 1) the increments {X(T j+1 ) − X(T j ) : 1 ≤ j ≤ n} are independent for any 0 < T 1 ≤ T 2 ≤ ... ≤ T n , and 2) stationary which means that X(t) − X(s) depends only on t−s and hence is equal in distribution to X(t−s)(as illustrated in Figure 4 (a) and (b)).Under these assumptions, a Lévy process for the most general case can be prepared efficiently, and we have the following result:

Theorem 2. (Upper bound of general Lévy Process' preparation) Suppose that
∆t is the length of sample path, and S = |F| is the number of discretization intervals of the underlying distribution For each QCTSP, the circuit can be divided into two parts: the state space part and the corresponding holding time part.The state space part is recorded in a sequence of registers named X j or Y j for the j th piece, wherein Y j = X j − X j−1 denotes the increment for the increment representation of QCTSP.The corresponding holding time part is stored in the registers named τ j for the j th holding time.Intuitively, the structure and the gate complexity of a given QCTSP is closely linked to the memory length.In the most complicated case of memory length ML(X) = n, the current state is determined by all of the n − 1 pieces.Hence, the |X n ⟩ should be entangled with all past registers via 2(n − 1)-controlled operators U .Furthermore, the corresponding holding time τ n is concerned with not only the past n − 1 pieces but also the current state.This is implemented through 2n − 1-controlled operators V .By contrast, in the most simple case of memory length ML(x) = 0 (for example, the well-known compound Poisson process), the state spaces and the corresponding holding times are supposed to be independent.As a result, each register can be prepared via independent implementations of operators U and V .From a higher perspective, the structure of the quantum circuit is intimately linked to the evolutionary dynamics of the underlying CTSP.As the characterization ML(X) increases, the longrange entanglement also grows.Consequently, this expansion necessitates the introduction of more multi-control unitary operators and SWAPs (taking into account the possible topology limitations of the quantum processor).As a result, the gate complexity of the quantum circuit experiences growth.More specifically, one have: (a) The preparation circuit of the general CTSP is shown and the qubits storing X j and τ j are highly entangled.The circuit is too complicated to simulate even for the most simple case where S = {0, 1} and T = 2.For the j th step, there are 2 2j−2 U j operators and 2 2j−1 V j operators.Hence the total number of unitary operators turns to be 2 2n − 1 and increases exponentially.The preparation of the general Lévy process is shown.Intuitively, the dynamic of Lévy process is simple as the memory length is zero and hence each piece evolves independently.Furthermore, the evolution can be decomposed into two distinct parts: a continuous Brownian motion and a discontinuous jump.The discontinuous jumps J j and holding times τ j are I.I.D, and can be prepared parallel through J and V operators.The Brownian motion components B j are determined by the holding time τ j , and can be derived by parallel controlled-B operators.The increments Y j = J j +B j are then computed by parallel adder operators.It should be mentioned that operators in the grey box are implemented parallel within constant circuit depth.The alternative encoding methods can be evaluated through a sequence of adder operators on Y j and τ j registers in the two boxes, with respect to holding time representation and increment representation.

F. Then the Lévy process can be prepared on n log (nS) qubits within O(S + n log (nS)) circuit depth, and the gate complexity is thus O(n(S + log (nS))). (see proof in Appendix B.2)
It should be mentioned that the preparation procedure's complexity is mainly determined by two factors: the sampling times n = T ∆t and the preparation complexity of the underlying distribution F. In the most general case where compensated generalized Poisson process with countably many small jump discontinuities and Wiener process are taken into consideration, the sample space size S = |F| is large and the preparation procedure of the underlying distribution F may consume an enormous amount of classical computation resource.Hence it is requisite for one to study the more specific situations besides the upper bound given in Theorem 2, and some optimized preparation results are given below.The first example is the Poisson point process that plays an essential role in modeling the arrival of independent random events.More precisely, despite several equivalent definitions for different domains and applications, a CTSP is a Poisson point process on the positive half-line if the increment Y j is a constant 1 and the underlying distribution of each holding time τ j between the events is an exponential distribution that can be efficiently prepared as shown in Theorem 1.As a direct consequence, one has: ∆t is the length of sampling times, and ϵ is the truncation of the exponential distribution F(λ).Then the Poisson process can be prepared on n⌈log ( −n ln ϵ λ )⌉ qubits with O(n⌈log ( −n ln ϵ λ )⌉) control-rotation gates, and the circuit depth is ⌈log n⌉.(see proof in Appendix B.3) Another more flexible example is the compound Poisson process as a generalization, i.e., the jumps' random arrival time follows a Poisson process and the size of the jumps is also random, following an underlying distribution G.It should be noticed that each jump's sampling space size S of compound Poisson process is usually fixed in practical, apparently different from the general Lévy process discussed above.We then get the following result with some modification on the circuit(as illustrated in Figure 3 where σ is the volatility of the Brownian motion, a is the drift rate, Y t is the compound Poisson process of jumps larger than 1 in absolute value, and Z t is a pure jump process with countably (infinite) many small jump discontinuities.As Z t contains infinitely many jumps as a zero-mean martingale, it is hard and unnecessary for preparation.One can prepare a general Lévy process without compensated parts as follows: Firstly, the sequence of exponential jumps J j and holding times τ j are prepared via J and V operators, respectively.Secondly, the Brownian motions B j are derived by Grover's state preparation method through B operators controlled by holding time τ j .Thirdly, an adder operator is introduced for the sum of pure jump and Brownian parts.It should be mentioned that the drift term at has been omitted since any function on this linear term can be easily translated into a function and hence well-evaluated by Theorem 7 and Theorem 8.The circuit is shown in Figure 4 (c).

Continuous Markov process
The second and more complicated family of CTSPs is the continuous Markov process.In brief, a stochastic process is called a continuous Markov process if it satisfies the Markov condition: For all t ≥ 0, where j, k ∈ S. Intuitively speaking, given the present state X(s), the future {X(s + t) : t ≥ 0} is independent of the past history {X(u) : 0 ≤ u < s}, and the memory length of a continuous Markov process is ML(X t ) = 1 (shown in Figure 5 (a) and (b)).A continuous Markov process can be efficiently prepared mainly for two reasons: the holding time τ j only depends on the current state X j , while the state sequence {X j } is independent from {X j ′ : 1 ≤ j ′ < j −1}.As a result, the continuous Markov process can be embedded into an independent discrete Markov chain depicting the transition probability, together with a sequence of controlled exponential distributions carrying the holding time information (as illustrated in Figure 5 (c)).More precisely, we have the following result: Since the possibility of staying in the current state is p = 0.9, the continuous Markov process tends to be in-variant for a long holding time, and thus it can be compressed a lot via our encoding method.

(b)
The continuous Markov process is embedded via both holding time representation and increment representation.Due to ML(X) = 1, each piece's state space X j is controlled by the previous one X j−1 while the holding time τ j is determined by the current state X j through an exponential distribution.(c) The preparation procedure of a continuous Markov process is shown.The embedded discrete Markov process X j is prepared by a sequence of U and controlled-U operators, while the holding time τ j is then determined by X j and prepared by controlled-V operators.The increment representation is then prepared by an alternative sequence of adder and subtractor subcircuits in the box.

Cox process
As further evidence illustrating the flexibility and generalizability of our encoding method, the Cox process, a useful framework for modeling prices of financial instruments in financial mathematics [38], can be efficiently prepared.One of the most significant distinctions between the Cox process and those processes discussed above is that both the states and the evolutionary law vary randomly over time (as illustrated in Figure 6 (a) and (b)).As a direct consequence, the preparation procedure and the corresponding circuit should be dynamic and flexible to characterize this doubly stochastic property (shown in Figure 6 (c)).Precisely speaking, a Cox process is a generalization of the Poisson process where the intensity λ(t) itself is also a stochastic variable of some distribution F. The preparation procedure can be divided into two steps: First, the stochastic control sequence of λ j is prepared by some F operator for the underlying distribution W. Then the holding time sequence τ j is prepared by parallel controlled-V operators for the underlying exponential distribution.The operators of different exponential distributions can be implemented by a sequence of controlled rotation gates of different rotation angles.The increments Y j are assumed to be I.I.D. and can be prepared through some G operators (common choice of distributions can be found in the appendix, see Figure 15(a) and Figure 15(c) for reference).In summary, we have the following result: Theorem 6. (Cox Process' Preparation)Suppose that {X(t) : t ≥ 0} is a Cox process with a varying intensity variable λ(t), and λ(t) follows an underlying statistical distribution F that can be prepared on q F qubits with circuit depth d F .The increments Y j follows an I.I.D. that can be prepared on q G qubits with circuit depth d G .Also it is supposed that the minimum value of λ(t) is λ min and the error bound is ϵ, then it can be efficiently prepared on O(n(q

representation ). (see proof in Appendix B.5)
As the details of the QCTSP preparation procedure have been given above, the results are summarized in table 2. From a high-level view, the computation and storage resource of the preparation procedure is totally determined by the time length T and the memory length ML(X) of the underlying QCTSP X(t).By our compressed encoding method and the corresponding preparation procedure, the number of copies of the state space is reduced from O(T ) = O(nτ avg ) of the uniform sampling method to O(n ln τ avg ) of the QCTSP method, leading an exponential reduction of qubit number on the parameter τ avg .By the encoding method and the observation on the holding time of the memory-less QCTSP, the circuit depths can be optimized from O(T ln nS) = O(nτ avg ln (nSτ avg )) of the uniform sampling method to O(n ln (nS)) of the QCTSP method, also making an exponential reduction of qubit number on the parameter τ avg .

INFORMATION EXTRACTION
Besides the state preparation problem, another challenge of QCTSP is to decode the compressed process and rebuild the information of interest.To extract desired information from QCTSP, one needs to evaluate its continuous counterpart, i.e., the integral of random variable X on time t, instead of the discrete summation E[f (S n )] = j∈K n f (sum{x(j)})P[X = x(j)] as studied in [33].T t=0 g(t)X(t) dt can be represented as a summation of the directed area of rectangles derived from horizontal division J = W j : the yellow and green boxes both correspond to positive increments Y 1,2 and area W 1,2 , while the blue box corresponds to a negative increment Y 3 and W 3 .(c) The circuit for evaluating I(t) is shown.Supposing that X j and τ j have been prepared as the input state, n quantum multipliers are introduced to evaluate Z j = X j τ j : Rotation operators controlled by Z j are implemented on the target qubit, followed by a standard amplitude estimation subcircuit in the red box.(d) The circuit for evaluating J(t) of holding time representation is shown.Supposing that X j and τ j have been prepared as the input state, then a sequence of subtractor operators is introduced to derive the increments Y j , and another sequence of adder operators is introduced to evaluate the cumulative time from ending time ) can be evaluated through the integral operators F .Following that are the desired variables W j = Y j F (T − T j−1 ) by quantum multiplier operators: Rotation operators controlled by W j are implemented on the target qubit, followed by a standard amplitude estimation subcircuit in the red box.(e) The circuit for evaluating J(t) of increment representation is shown.Supposing that Y j and T j have been prepared as the input state, one more qubit is introduced to denote the beginning time T 0 , followed by unitary operators G act on T j to derive G(T j−1 ).Then a sequence of multiplier operators are implemented to compute the desired product W j = Y j G(T j−1 ): Rotation operators controlled by W j are implemented on the target qubit, followed by a standard amplitude estimation subcircuit in the red box.The circuit's depth is less than in subfigure (d) as a consequence of increment representation's advantage on integral calculation.
Weightless Integral.More specifically, the expectation value of an integrable function f : R → R of the random variable can be efficiently evaluated via a framework developed as follows: First of all, the integral can be divided into vertical boxes (as shown in Figure 7 (a)) as a Riemann summation Secondly, the area Z j of each box is translated into multiplication of the holding time representation encoding variables X j and τ j .Benefiting from the encoding method, this expression is quite simple (as illustrated in Figure 7 (c)).Thirdly, the expected value of the integrable function f ( n j=0 X j τ j ) can be evaluated through a Fourier approximation p x as a P − periodic function of order L: Each term E[cos ( 2πl p ( n j=0 Z j ))] and E[sin ( 2πl p ( n j=0 Z j ))] can be evaluated via rotation gates on the target qubit controlled by Z j followed by a standard amplitude estimation algorithm.Leaving the detailed proof in the appendix, one has: Theorem 7. (Evaluating I(t))Suppose that a QCTSP {X(t) : t ≥ 0} is given via holding time representation with n steps, l x , l τ qubits for each pair X j , τ j , and P circuit depth.Also, one has that f P,L (x) is the P − periodic L − order Fourier approximation of the desired integrable function of the random variable f : R → R. Then given the error ϵ, the expectation value of f (I(X, T )) = f ( T t=0 X(t) dt) can be efficiently evaluated within O(P + nl x l τ ) circuit depth and O( LP ϵ (P + nl x l τ )) time complexity.(see proof in Appendix C.1) Weighted Integral.Moreover, this framework applies to the more complicated and generalized situations where the time structure is considered and thus has no discrete correspondence.By introducing a time-dependent function g(t), we can evaluate the expectation value of an integrable function f : R → R of the random variable Since the time structure g(t) is considered, the integral is divided into horizontal directed boxes(as shown in Figure 7 (b)): Due to a trade-off on circuit depth and qubits number(see Figure 7 (d) and Figure 7 (e) for reference), this summation can be evaluated via either holding time representation or increment representation.A similar Fourier approximation and amplitude estimation are employed to compute and hence the following result is given:

Theorem 8. (Evaluating J(t))
i) Suppose a QCTSP {X(t) : t ≥ 0} of holding time representation given with n steps, l x , l τ qubits for each pair X j , τ j , and P circuit depth.g(t) is a function whose integral can be efficiently prepared with F circuit depth.Also, one has that f P,L (x) is the P − periodic L − order Fourier approximation of the desired integrable function of the random variable f : R → R. Then given the error ϵ, the expectation value of f (J(X, T )) = f ( T t=0 g(t)X(t) dt) can be efficiently evaluated within P + F + nl x l τ + n max (l x , l τ ) circuit depth and O( LP ϵ (P + F + nl x l τ + n max (l x , l τ ))) time complexity.ii) Suppose a QCTSP {X(t) : t ≥ 0} of increment representation given with n steps, l Y , l T qubits for each pair Y j , T j , and P circuit depth.g(t) is a function whose integral can be efficiently prepared with G circuit depth.Also, one has that f P,L (x) is the P − periodic L − order Fourier approximation of the desired integrable function of the random variable f : R → R. Then given the error ϵ, the expectation value of f (J(X, History-Sensitive Information.Besides the global information defined on the whole path studied above, there is another category of history-sensitive problems that plays an essential role in statistics and finance, including the first-hitting time of Brownian motion, surviving time of ruin theory, and survival analysis, to name but a few.The most apparent difference of the first-hitting problem is that the path-dependent information needs to be extracted when knowing the whole history path.Thus it can not be derived directly by a quantum walk (as illustrated in Figure 8).Formally, a first-hitting problem can be regarded as evaluating the following The basic idea to evaluate Eq. ( 8) is to consider n flag qubits storing the comparison result of each piece in the sampling path.As a discontinuous jump representing extreme events or market hits always happens at the end of a piece, this method shall work much more precisely than the uniform sampling method.Formally speaking, supposing a given bound B, to derive the first hitting time, a bound information register and a flag register is introduced with O(log B) and n qubits, respectively.For the j th piece of QCTSP, the remained value is derived through a controlled subtraction whose control qubit is F j−1 and carry-out qubit is F j .And a CNOT gate is implemented to flip the F j qubit controlled by the F j−1 qubit.Two classes are distinguished for each piece: Before the first hit, the remaining bound is j−1 j ′ =1 Y j ′ ≤ B, and the flag register is |11...1 j−1 0...0⟩ f lag .This first class can be divided into two cases: If the hit does not happen at the j th piece, the state of the carry-out qubit F j after the subtraction remains |0⟩, and then is flipped by the CNOT gate.Hence one has: case 1

|B −
If the hit happens at the j th piece, the state of the carry-out qubit F j after the subtraction turns to be |1⟩, and then is flipped by the CNOT gate.Hence one has: case 2 For the second class where the current piece is after the first hit j ′′ j ′ =1 Y j ′ > B, the flag register is |11...1 j ′′ 0...0⟩ f lag , and the subtraction and CNOT gates will not be implemented, and thus the result is: case 3 ( j ′′ j ′ =1 Y j ′ > B for some j ′′ < j): Leaving the theoretical analysis as future work, examples of option pricing and ruin theory will be given in the next section as proof of principle.

APPLICATION
In this section, two applications of QCTSP in different financial scenes are given to illustrate the wide range of applicability of QCTSP.In subsection 5.1, the first application is focused on the option pricing problem wherein the underlying stock price is no longer continuous Brownian motion and the original Black-Scholes formula fails.By simulation of QCTSP, option pricing is solved in a different way from previous works and is consistent with the more practical Merton Jump Diffusion formula.In subsection 5.2, the problem of computing the ruin probability under the Collective Risk Model is studied, introducing quantum computation into insurance mathematics.

Option pricing in Merton Jump Diffusion Model
Since first being introduced into the field of financial engineering, CTSP has been proven to be a powerful tool for financial derivatives pricing [39,40].Among those financial derivatives, the European call option is one basic instrument that gives someone the right to buy an underlying stock S T at a given strike price K and maturity time T .The famous Black-Scholes model is proposed to evaluate a European option [41], and the simulation for Black-Scholes type option pricing has been implemented on quantum computers [29][30][31]33].However, the assumption of a constant variance log-normal distribution in the original article [41] turns out to be less realistic as the empirical studies of discontinuous returns of stock are ignored.Hence the Merton Jump Diffusion Model was proposed to incorporate more realistic assumptions from Merton's work [42].
In the Merton Jump Diffusion Model, the stock price S T is assumed to satisfy the following stochastic differential equation: )) dt where S 0 is the current stock price, T is the maturity time in years, r is the annual risk-less interest rate, σ is the annual volatility, dW (t) is the Weiner process, P oi(T ) is the Poisson point process, and J j is the j th discontinuous jump follows a log-normally distribution.
The last term on the right hand side represents the discontinuous price movements caused by such as acquisitions, mergers, corporate scandals, and fat-finger errors.Merton derives a closed form solution M JD(S, K, T, r, σ, m, v, λ) to Eq. ( 9) as an infinite summation of Black-Scholes formula BS(S, K, T, r j , σ j ) conditional on the number of the jumps and the underlying distributions of each jump: where m is the mean of the jump size, v is the volatility of the jump size, λ is the intensity of the underlying Poisson point process, and r j = r − λ(m − 1) + j ln m T and are the corresponding interest rate and volatility, respectively.Despite being in line with empirical studies of market returns, the formula Eq. (10) takes the form of an infinite summation, and thus an alternative numerical method of Monte Carlo can be employed to compute the desired option price.Instead of a Brownian motion in the Black-Scholes model, one has to simulate, in the Merton Jump Diffusion Model, the more complicated case of a Lévy process where our method can be applied to make a quadratic speed-up against the classical Monte Carlo simulation.More precisely, for a European type call option given the underlying stock price S T , its price can be defined as: where ))T is the adjusted drift term on the purpose of risk neutral preferences, B T represents the Brownian motion term and follows a normal distribution N (0, σ √ T ), and J j represents the j th discontinuous jump and follows a normal distribution N (m, v).
This Lévy process can be efficiently prepared as mentioned in subsection 3.1, and then the valuation procedure is implemented via the method given in section 4.More specifically, as illustrated in Figure 9, the quantum circuit consists of six quantum registers: the maturity time register |T ⟩, the holding time register |τ j ⟩, the flag register |F j ⟩, the jump size register |B j ⟩, the Brownian motion size register |G⟩, and the target qubit |T arget⟩.The holding time τ j can be prepared via parallel exponential distribution subcircuits J = Exp(λT ), and the jump size B j can be prepared via parallel normal distribution subcircuits B = N orm(m, v).The drift term together with the geometric Brownian motion is prepared on |G⟩ via a normal distribution subcircuit Subtractor and controlled-subtractors, together with X gate and CNOT gates, are implemented to justify the number of jumps that will be considered, and the result is output on the flag register |F j ⟩.Adders controlled by the corresponding flag registers are employed to derive the final value of the stock price.A rotation gate is then implemented on the target qubit, controlled by the signed summation on register |θ sum ⟩.Then the final value of the option price can be evaluated via measurement or an amplitude estimation.The corresponding quantum simulation result can be found in Figure 10 and Figure 11.In Figure 10, the underlying stock price is given with S 0 = 100, K = 100, r = 0.1, σ = 0.02, T = 1, and ∆t = 1  30 , and the range of m and v are 0, 0.1, 0.2, 0.3, 0.4 and 0, 0.05, 0.15, 0.2, 0.25, respectively.Due to the restriction on the qubit number, the simulation is divided into two steps: 100 groups of random rotation angles corresponding to the Brownian motion size.The jump sizes are generated by a classical random generator and then implemented on the target qubit.1024 shots of QCTSP simulated paths are repeated for each group.As shown in Figure 10, the larger the jump size (characterized by m and v) is, the farther the Merton Jump Diffusion value is away from the original Black-Scholes price as a consequence of the discontinuous jumps.Moreover, the QCTSP simulation result is consistent with the 40 terms truncated Merton Jump Diffusion formula (Eq.(10)) as well as the classical Monte Carlo simulation, characterizing the property of Lévy discontinuous jump path well.The robustness of the QCTSP method is illustrated in Figure 11, where different annual interest rates r = 0.05, 0.1, 0.15 are given in the three subfigures with varying jump sizes.The quantum simulation results are consistent with the Merton Formula for a wide range of different parameters.The holding time τ j is prepared via parallel subcircuits J = Exp(λT ), and the jump size B j is prepared via subcircuits B = N orm(m, v).The drift term, together with the geometric Brownian motion, is prepared on |G⟩ via the subcircuit Subtractor and controlled-subtractors, together with X gate and CNOT gates, are implemented to justify the number of jumps with output on the flag register |F j ⟩.Adders controlled by the flag registers are employed to derive the final value of the stock price, followed by a rotation gate on the target qubit controlled by the signed summation on register |θ sum ⟩.

Ruin probability in Collective Risk Model
Since being a fundamental means to model the stochastic world, there is no surprise that the QCTSP framework developed in this work has great potential power applied to various fields, especially ruin theory.The ruin theory plays a central role in insurance mathematics, high-frequency trading's market micro-structure theory, and option pricing [43][44][45][46].In ruin theory, the risk of an insurance company is assumed to be caused by random claims arriving at time T j = j j ′ =1 τ j ′ , wherein the j th claim size ξ j and inter-claim time τ j are both assumed to follow some independent and identically distributions.Hence the aggregate asset of the insurance company is a continuous time stochastic process where the initial surplus is X(0) = u, and the premiums are received at a constant rate c.In the Collective Risk Model, also known as the Cramér Lundberg model, the claim number process P oi(t) is assumed to be a Poisson process with intensity λ, and the underlying distribution of τ j is an exponential distribution.In the Sparre Andersen model, P oi(t) can be extended to a renewal process with the arbitrary underlying distribution.Despite the detailed differences between them, both of the two stochastic processes X(t) in these models are Lévy processes with drift term ct, and hence can be prepared easily via our method.
To go one step further, one has a great variety of ruin-related quantities fall into the category of the expected discounted penalty function, also known as the time value of ruin.And those can be easily derived through a quantum-enhanced Monte Carlo modified by us.More precisely, following the notation of Gerber and Shiu [43], the time value of ruin is defined as where τ (u) = inf {t : U (t) < 0|U (0) = u} denotes the time of ruin, and X(τ j=1 X j are the surplus prior to ruin and the deficit at ruin, respectively.The expectation is taken over the probability distribution of the ruin samples, taking an interest discounting factor e −δτ into consideration.The ultimate ruin probability ψ(u) = P[X(τ ) < 0|X(0) = u, τ < ∞] is exactly a special case of Eq. ( 14) given δ = 0 and w(x, y) = 1.Since ruin always happens after a claim, where the indicator function I Y (t)<u+ct can be easily derived through a sequence of controlled adder and modified subtractor on the prepared states.The detailed construction of circuits and corresponding simulation result are given in Figure 12 and Figure 13.The receiving rate is assumed to be 1 so that the premium can be summed directly, removing the qubits requirement and the circuit depth from function cT .For each piece of QCTSP, an adder is followed by a controlled-subtracor whose carry-out qubit is on the flag qubit together with a controlled flip, as discussed in subsection 4.

DISCUSSION
In this study, we have focused on the efficient state preparation and quantum-enhanced analysis of continuous time stochastic processes (QCTSP).We have successfully established a robust procedure for QCTSP preparation, allowing the state to be sensitized to discontinuous jumps, which are crucial in modeling extreme market emergencies.Notably, we have achieved significant reductions in both qubit number and circuit depth, particularly concerning the key parameter of holding time.Furthermore, we are excited to present our novel Monte Carlo simulation method tailored for QCTSP.This groundbreaking approach has led to a remarkable quadratic speedup compared to the classical counterpart, the continuous time stochastic process (CTSP), making QCTSP a formidable tool in studying the continuous time stochastic world.
A significant contribution of our work lies in the development of techniques for extracting weighted integral and history-sensitive information.These methods are of paramount importance in various fields, such as quantitative trading, time series analysis, and actuarial mathematics.By eliminating the need for additional n copies of random paths and relaxing the implied restriction of the independent and identically distributed (I.I.D.) condition, our techniques open new avenues for accurate analysis and computation.
In the context of practical applications, we have successfully demonstrated two scenarios: European option pricing under the Merton Jump Diffusion Model and the evaluation of ruin probability in the Collective Risk Model.These applications serve as compelling evidence of QCTSP's potential and versatility in addressing real-world challenges.
There are four main reasons why QCTSP stands as a suitable candidate for practical applications in the noisy intermediate-scale quantum era: Firstly, QCTSP does not impose input restrictions and can be implemented without assuming the need for a quantum oracle or quantum Random Access Memory (qRAM).This property enhances its versatility and applicability in various quantum algorithms, including quantum machine learning, thereby breaking through the input bottleneck often encountered in quantum computations.
Secondly, QCTSP allows for parallel preparation, thanks to a communicative equivalence class decomposition of the sample space.This decomposition results in a reduction in the number of required qubits, contributing to more efficient and resource-effective implementations.
Thirdly, our QCTSP preparation method imposes less requirements on the topological structure of the quantum processor.In many cases, the connectivity requirement, which concerns memory length, can be set at a low level.Consequently, most qubits only need to be entangled with their immediate neighbors, easing the burden of implementation and enhancing scalability.
Lastly, considering the fundamental and critical role that Continuous Time Stochastic Process (CTSP) plays in stochastic analysis, QCTSP holds immense potential for theoretical generalizability and applied flexibility.Its relevance in a wide range of stochastic processes further solidifies its status as a promising candidate for practical applications.
QCTSP exhibits remarkable advantages in terms of input flexibility, parallel preparation, compatibility with quantum algorithms, and potential for theoretical and applied advancements.These features position QCTSP as a promising tool for practical utilization in the emerging era of noisy intermediate-scale quantum computing.
While our work showcases the promising potential of QCTSP, it is essential to acknowledge certain limitations that warrant further investigation and exploration.We outline some of these limitations below: Firstly, while QCTSP is believed to be hardware-efficient due to its low requirements on the topological structure, a more detailed and quantitative analysis is lacking in this article.We acknowledge this as an avenue for future research and plan to address it through experimental demonstrations.
Secondly, we have not explored the preparation of many other CTSPs with financial relevance, such as Hawkes processes, which may exhibit rich structures and evolutionary laws that could potentially lead to further quantum speed-up.These CTSPs warrant further investigation to understand their quantum computational implications.
Thirdly, while we have demonstrated the applications of QCTSP in European option pricing and ruin probability evaluation, many other relevant applications in fields such as high-frequency trading, actuarial science, and option pricing have not been explored in this work.We recognize the significance of studying these facets and plan to investigate them in future research while maintaining the thematic focus of this current work.
Furthermore, future research should focus on developing more techniques for the efficient extraction of path-dependent information.This aspect is crucial for enhancing the versatility and practicality of QCTSP in various financial analyses.
Additionally, there are intriguing topics related to the intrinsic relation of continuous quantum walk and finance, as discussed in [47][48][49].While discrete and continuous quantum walk methods have shown promise as powerful tools for financial data state preparation and stochastic simulation in finance, we have not delved into this area in the current work.One of the challenges lies in finding suitable ways to store the history information of continuous quantum walks.We leave the exploration of this relationship as a promising avenue for future research.
In conclusion, while our work has made significant strides in the efficient state preparation and quantum-enhanced analysis of continuous time stochastic processes, there are various areas that warrant further investigation and study.We are committed to exploring these limitations and expanding the scope of our research in future endeavors.

A Basic Circuits for Arithmetic and Distribution Preparation
Some basic arithmetic circuits and statistics distribution preparation circuits are given in this appendix.

A.1 Modified Quantum Subtractor
Although adder and subtractor circuits have been studied in many works(see [50] for reference), some modification is needed in our work as we wish to map |a⟩ |b⟩ to |a⟩ |a − b⟩, i.e., store the result in the second register while leave the first register unchanged.The basic idea is as follows: since (a ′ + b) ′ = a − b, X gates are introduced to calculate the complement of a as |a ′ ⟩ |b⟩.Then a ripple-carry addition circuit is implemented to output the summation result on the first register |a ′ + b⟩ |b⟩.Finally, another sequence of X gates are put on the first register |a − b⟩ b.

A.2 Quantum Multiplier for Amplitude Estimation and Quantum-Enhanced Monte Carlo
In this subsection, a quantum multiplier for quantum estimation, and hence quantum Monte Carlo is given as follows: x i y j 2 i+j−2 .
Hence the term x i y j 2 i+j−2 can be implemented by a rotation gate on the target qubit e iM θ 0 controlled by the i th and j th qubits of register |a⟩ and |b⟩, where the rotation angle θ i,j = 2 i+j−2 θ 0 is determined by the index i, j only.The final state is: If |a⟩ and |b⟩ are signed integers, the rotation gates of two different directions should be controlled by the two sign qubits as well.The total number of controlled rotation gates is l a l b as claimed.

A.3 State preparation for Statistical Distributions
The exponential distribution is implemented by parallel rotation gates as illustrated in Figure 15(a).Detailed computation of rotation angles is given in Appendix B.1.The Erlang distribution is a summation of several exponential distributions and hence can be prepared via copies of exponential distribution preparation subcircuits together with a sequence of adder operators as shown in Figure 15 Proof.By the definition of memory-less process, one has and hence the c.d.f.f (t) = P[τ l ≤ t] satisfies: Differentiating with respect to t and setting t = 0 leads to Noticing that −f ′ (0) is a constant, the integrals of the two sides turn to be where the constant C is supposed to be exactly 1 to satisfy f (∞) = 1.Thus the holding time τ l follows an exponential distribution P[τ l ≥ t] = e −λ l t with λ l = f ′ (0) determined by X l .As ϵ is given, without loss of generality, T is supposed to be 2 where ε = e −λ l T < ϵ (16) is a more strictly error bound which is easier to compute.On the truncated support set [0, T ), simple computation shows that Assuming that the preparation circuit consists of m = log T qubits initialized to be |0⟩, the j th qubit is then aligned with the rotation gate R Y (θ j ) with θ j = arctan ε1/2 j+1 : 1 ≤ Here the binary number and the corresponding summation (k 1 k 2 ...k m ) 2 = m j=1 k j 2 m−j in Eq. ( 18) are both substituted by the decimal number t varying from 0 to T = 2 m in Eq. (19).Then Eq. ( 20) and Eq. ( 21) are derived by Eq. ( 16) and Eq. ( 17), respectively.Hence, with m = ⌈log (− 1 λ l ln ϵ)⌉ qubits and the same number of rotation gates, the desired truncated state is successfully prepared((as illustrated in Figure 15

B.2 Proof of Theorem 2
Proof.Given a time interval T , it can be uniformly divided into n pieces [T j−1 , T j ) with T j = j n T (0 ≤ j ≤ n) and τ j = T n : 1 ≤ j ≤ n, and the corresponding discrete random variables are denoted by X j = X(T j ).Then the increments Y 1 = X 1 and Y j = X j − X j−1 : 2 ≤ j ≤ n are independent and identically distributed random variables.The underlying distribution F can be prepared by Grover's method |0⟩ s → |F⟩ j = S k=1 p j (k) |k⟩, where s = log S is the number of qubits of the approximation Fj and p j (k) is the probability amplitude that the random variable X j lies in the k th interval of F with S k=1 p 2 j (k) = 1 (see [21] for reference).The circuit depth of the preparation of F is at most s utilizing S control-rotation gates.Then the increments sequence Y j : 1 ≤ j ≤ n can be derived by repeating this procedure on n parallel subcircuits:

B.3 Proof of Corollary 3 and Corollary 4
Proof.By definition of Poisson Point Process, the distinct increments Y j : 1 ≤ j ≤ n are constant 1, and the X j varies exactly from 1 to n so that the adder subcircuit introduced in Theorem 2 can be omitted.As a consequent, each X j can be prepared parallel on at most log n qubits via log n rotation gates.And meanwhile the holding times τ j : 1 ≤ j ≤ n are assumed to follow an exponential distribution F(λ), and can thus be prepared parallel, by Theorem1, on − ln ϵ λ qubits via − ln ϵ λ rotation gates with circuit depth 1.In summary, the qubit number, circuit depth and gate complexity are respectively n log n+n − ln ϵ λ = n⌈log ( −n ln ϵ λ )⌉, max {⌈log n⌉, 1} = ⌈log n⌉, and n log − ln ϵ λ + n j=1 log j = O(n⌈log ( −n ln ϵ λ )⌉).As for the case of Compound Poisson Process, the only difference is the I.I.D. state space of jumps.Another n⌈log S⌉ qubits are introduced to record these jumps, and hence the qubits number turn to be n⌈log ( −nS ln ϵ λ )⌉.Instead of copies of Hadamard gates in Poisson point process, a sequence of n − 1 adder operators are needed, asking for (n − 1)(2⌈log (nS)⌉ − 1) Toffoli gates and (n − 1)(5⌈log (nS)⌉ − 3) C-NOT gates.Thus the total gate complexity is O(n⌈log (− nS ln ϵ λ )⌉), and the circuit depth is S + n⌈log (nS)⌉.

B.4 Proof of Theorem 5
Proof.Assuming that the n pieces of the continuous Markov process are (X j , τ j ), and the j th transition time are T j = j j ′ =1 τ j ′ , a direct computation shows that This reveals that X j+1 is totally determined by the previous state X j with the transition probabilities P kl = P (X j+1 = k|X j = l), and thus the embedded sequence {X j : 1 ≤ j ≤ n} is a discrete Markov chain as claimed above.By the Markov condition again, the holding time τ j satisfies P[τ j > t + s|τ j > t] = P[τ j > s].(23) Noticing that Eq. ( 23) is exactly the memory-less condition in Theorem1, and therefore τ j follows an exponential distribution with the λ j determined by the current state X j .As a consequence of the embedded discrete Markov chain and the exponential distribution holding time, a quantum continuous Markov process state can be prepared as follows: n⌈log S⌉ qubits are introduced for the storage of the discrete Markov chain, and another n⌈log (− 1 λ min ln ϵ)⌉ qubits are introduced for the holding time τ j .The initial state |X 1 ⟩ = S k=1 p(k) |k⟩ is derived by S control-rotation gates via Grover's state preparation method.Following that, n − 1 successive transition matrix operators, each of which consists of S 2 multi-controlled rotation gates, are applied to generate |X j ⟩ : 2 ≤ j ≤ n.The n holding times can be prepared parallel, and each τ j needs at most s different exponential distribution with S⌈log (− 1 λ min ln ϵ)⌉ gates and S circuit depth.In summary, the total

Figure 1 :
Figure 1: Embed a Continuous Time Stochastic Process to a pair of Discrete Stochastic Processes.In this figure, a continuous time stochastic process is embedded into discrete stochastic processes via two different representations.(a) As shown in the left subfigure, the j th in-variant piece of CTSP can be compressed into a discrete random variable X j (denoted by the point) in the state space, together with a holding time variable τ j follows a given probability distribution (Illustrated by a picture of the probability density function).(b) As shown in the right subfigure, the j th in-variant piece of CTSP can be compressed into a discrete random variable of increment Y j = X j − X j−1 (denoted by the vertical arrow) in the state space, together with an ending time variable T j (denoted by the horizontal arrow).

Figure 2 :
Figure 2: Embed a Continuous Time Stochastic Process to a pair of Discrete Stochastic Processes.In this figure, a continuous time stochastic process is embedded into a sequence of stochastic pairs.Both the qubit number and the circuit depth is reduced as shown.

Figure 3 :
Figure 3: Quantum Circuits for General CTSP and compound Poisson Process In this figure, the circuits of QCTSPs with different memory lengths are given for comparison.For each QCTSP, the circuit can be divided into two parts: the state space part and the corresponding holding time part.The state space part is recorded in a sequence of registers named X j or Y j for the j th piece, wherein Y j = X j − X j−1 denotes the increment for the increment representation of QCTSP.The corresponding holding time part is stored in the registers named τ j for the j th holding time.Intuitively, the structure and the gate complexity of a given QCTSP is closely linked to the memory length.In the most complicated case of memory length ML(X) = n, the current state is determined by all of the n − 1 pieces.Hence, the |X n ⟩ should be entangled with all past registers via 2(n − 1)-controlled operators U .Furthermore, the corresponding holding time τ n is concerned with not only the past n − 1 pieces but also the current state.This is implemented through 2n − 1-controlled operators V .By contrast, in the most simple case of memory length ML(x) = 0 (for example, the well-known compound Poisson process), the state spaces and the corresponding holding times are supposed to be independent.As a result, each register can be prepared via independent implementations of operators U and V .From a higher perspective, the structure of the quantum circuit is intimately linked to the evolutionary dynamics of the underlying CTSP.As the characterization ML(X) increases, the longrange entanglement also grows.Consequently, this expansion necessitates the introduction of more multi-control unitary operators and SWAPs (taking into account the possible topology limitations of the quantum processor).As a result, the gate complexity of the quantum circuit experiences growth.More specifically, one have: (a) The preparation circuit of the general CTSP is shown and the qubits storing X j and τ j are highly entangled.The circuit is too complicated to simulate even for the most simple case where S = {0, 1} and T = 2.For the j th step, there are 2 2j−2 U j operators and 2 2j−1 V j operators.Hence the total number of unitary operators turns to be 2 2n − 1 and increases exponentially.Besides, the growth of the operator size leads to enormous challenges of gate decomposition and longterm entanglement.(b) The preparation of the Poisson process and compound Poisson process is shown.The increments Y j and holding time τ j are I.I.D and can be prepared parallel through U and V operators.The alternative encoding methods can be evaluated through a sequence of add operators on Y j and τ j registers in the two boxes, with respect to holding time representation and increment representation.
Figure 3: Quantum Circuits for General CTSP and compound Poisson Process In this figure, the circuits of QCTSPs with different memory lengths are given for comparison.For each QCTSP, the circuit can be divided into two parts: the state space part and the corresponding holding time part.The state space part is recorded in a sequence of registers named X j or Y j for the j th piece, wherein Y j = X j − X j−1 denotes the increment for the increment representation of QCTSP.The corresponding holding time part is stored in the registers named τ j for the j th holding time.Intuitively, the structure and the gate complexity of a given QCTSP is closely linked to the memory length.In the most complicated case of memory length ML(X) = n, the current state is determined by all of the n − 1 pieces.Hence, the |X n ⟩ should be entangled with all past registers via 2(n − 1)-controlled operators U .Furthermore, the corresponding holding time τ n is concerned with not only the past n − 1 pieces but also the current state.This is implemented through 2n − 1-controlled operators V .By contrast, in the most simple case of memory length ML(x) = 0 (for example, the well-known compound Poisson process), the state spaces and the corresponding holding times are supposed to be independent.As a result, each register can be prepared via independent implementations of operators U and V .From a higher perspective, the structure of the quantum circuit is intimately linked to the evolutionary dynamics of the underlying CTSP.As the characterization ML(X) increases, the longrange entanglement also grows.Consequently, this expansion necessitates the introduction of more multi-control unitary operators and SWAPs (taking into account the possible topology limitations of the quantum processor).As a result, the gate complexity of the quantum circuit experiences growth.More specifically, one have: (a) The preparation circuit of the general CTSP is shown and the qubits storing X j and τ j are highly entangled.The circuit is too complicated to simulate even for the most simple case where S = {0, 1} and T = 2.For the j th step, there are 2 2j−2 U j operators and 2 2j−1 V j operators.Hence the total number of unitary operators turns to be 2 2n − 1 and increases exponentially.Besides, the growth of the operator size leads to enormous challenges of gate decomposition and longterm entanglement.(b) The preparation of the Poisson process and compound Poisson process is shown.The increments Y j and holding time τ j are I.I.D and can be prepared parallel through U and V operators.The alternative encoding methods can be evaluated through a sequence of add operators on Y j and τ j registers in the two boxes, with respect to holding time representation and increment representation.

Figure 4 :
Figure 4: Prepare a Lévy Process.In this figure, the preparation of a general Lévy Process is given: (a) 10 simulated Lévy process paths of 1000 steps: The intensity of discontinuous jump is λ = 1, and the standard deviation of jump size is v = 0.3.The standard deviation and the drift rate of the Brownian part are σ = 0.2 and a = 0.02, respectively.As circled in the picture, discontinuous jumps happen at random timestamps that are hard for a uniform sampling method to capture.(b) A Lévy Process is embedded into discrete stochastic processes via holding time representation and increment representation encoding methods.As ML(X) = 0, the corresponding stochastic pairs (Y j , τ j ) are I.I.D. variables.(c)The preparation of the general Lévy process is shown.Intuitively, the dynamic of Lévy process is simple as the memory length is zero and hence each piece evolves independently.Furthermore, the evolution can be decomposed into two distinct parts: a continuous Brownian motion and a discontinuous jump.The discontinuous jumps J j and holding times τ j are I.I.D, and can be prepared parallel through J and V operators.The Brownian motion components B j are determined by the holding time τ j , and can be derived by parallel controlled-B operators.The increments Y j = J j +B j are then computed by parallel adder operators.It should be mentioned that operators in the grey box are implemented parallel within constant circuit depth.The alternative encoding methods can be evaluated through a sequence of adder operators on Y j and τ j registers in the two boxes, with respect to holding time representation and increment representation.

Figure 5 :
Figure 5: Prepare a Continuous Markov Process.In this figure, the preparation of a continuous Markov Process is given: (a) 10 simulated continuous Markov process paths of 100 steps: The transition rates from |n⟩ to |n − 1⟩ and |n + 1⟩ are both 0.05, and the state |0⟩ and |10⟩ are absorbing states.Since the possibility of staying in the current state is p = 0.9, the continuous Markov process tends to be in-variant for a long holding time, and thus it can be compressed a lot via our encoding method.(b) The continuous Markov process is embedded via both holding time representation and increment representation.Due to ML(X) = 1, each piece's state space X j is controlled by the previous one X j−1 while the holding time τ j is determined by the current state X j through an exponential distribution.(c) The preparation procedure of a continuous Markov process is shown.The embedded discrete Markov process X j is prepared by a sequence of U and controlled-U operators, while the holding time τ j is then determined by X j and prepared by controlled-V operators.The increment representation is then prepared by an alternative sequence of adder and subtractor subcircuits in the box.

Figure 6 :
Figure 6: Prepare a Cox Process.In this figure, the preparation of a continuous Markov Process is given: (a) 10 simulated Cox process paths of length 10 and 10000 steps: The varying intensity follows an exponential distribution with λ = 0.1, and the size of the discontinuous jump is assumed to be a constant 1.As circled in the picture, the intensity changes with time and the jump rate varies from high to low randomly.(b) A Cox Process is again embedded via holding time representation and increment representation encoding methods.The process is more complicated as the holding time Y j of interest is controlled by another stochastic variable λ j and the increment Y j and the control variable λ j are independent identical distribution variables, respectively.(c) The preparation of a Cox process is shown.Firstly, the stochastic control sequence λ j is prepared by F operators, and then the holding time sequence τ j is prepared by parallel controlled-V operators.The increments Y j are I.I.D. and can be prepared through G operators.Alternative subcircuits of holding time and increment representations follow as shown in the two boxes.

Figure 7 :
Figure 7: Information Extraction for Quantum Continuous Time Stochastic Process.(a) The integral I(X, T ) = T t=0 X(t) dt is represented as a summation of the area of rectangles derived from vertical division I = Z j .(b) By a coordinate transformation t → g(t), the integral J(X, T ) =

Figure 8 :
Figure 8: As shown in this figure, the point A represents the first hitting event with the desired first hitting time, while the points B, C, D should not be captured.This information is determined by the knowledge of the whole past path, hence being history-sensitive, and can not be extracted by a quantum walk.

Figure 9 :
Figure 9: QCTSP Circuit of the Simulation of Merton Jump Diffusion Model.In this figure, the circuit of the simulation of the European call option price in Merton Jump Diffusion Model is presented.The holding time τ j is prepared via parallel subcircuits J = Exp(λT ), and the jump size B j is prepared via subcircuits B = N orm(m, v).The drift term, together with the geometric Brownian motion, is prepared on |G⟩ via the subcircuit D + B ′ = N orm((r − σ 2 2 − λ(m + v 2 2 ))T, σ

Figure 10 :
Figure 10: Comparison of QCTSP Simulation of European Call Option Price in Merton Jump Diffusion Model with Different Jump Size.The simulation of European call option price in Merton Jump Diffusion Model is presented in this figure.The parameters for the underlying stock price are set as S 0 = 100, K = 100, r = 0.1, σ = 0.02, T = 1, and ∆t = 1 30 , and the range of m and v are 0, 0.1, 0.2, 0.3, 0.4 and 0, 0.05, 0.1, 0.15, 0.2, 0.25, respectively.As shown in the figure, the simulated prices are consistent with the Merton formula Eq. (10), and the option price deviates from the Black Scholes formula as the jump size tends to be large.

Figure 11 :
Figure 11: Comparison of QCTSP Simulation of European Call Option Price in Merton Jump Diffusion Model under Different Annual Interest.The simulation of European call option price in Merton Jump Diffusion Model is presented in this figure.The underlying stock prices of annual interest rate r = 0.05, 0.1, 0.15 are given with S 0 = 100, K = 100, σ = 0.02, T = 1, and ∆t = 1 30 , and the range of m and v are 0, 0.1, 0.2, 0.3, 0.4 and 0, 0.1, 0.2, respectively.As shown in the figure, the simulation results are consistent with the Merton formula Eq. (10) while the interest rate, the average jump size, and the volatility of jump size vary, showing robustness with wide ranges of parameters.

Figure 12 :
Figure 12: Quantum Circuit of Computing Ruin Probability.The ultimate probability of the Collective Risk Model is simulated via this quantum circuit.The receiving rate is assumed to be 1 so that the premium can be summed directly, removing the qubits requirement and the circuit depth from function cT .For each piece of QCTSP, an adder is followed by a controlled-subtracor whose carry-out qubit is on the flag qubit together with a controlled flip, as discussed in subsection 4.

Figure 13 :
Figure 13: Simulation of Ultimate Ruin Probability.The ultimate probability of the Collective Risk Model is simulated for varying initial surplus with sample paths of different lengths.The intensities of inter-claim time and claim size are λ t = 0.6, and λ ξ = 1, respectively.The sample precision is ϵ = 0.001, and the premiums' receiving rate is c = 1.The shot number is set to be 1000 for each simulation point.As depicted in the figure, the simulated ruin probabilities for varying surpluses align well with the theoretical benchmark.Furthermore, we notice that as the length of the sample paths increases, the deviation from the theoretical curve diminishes, indicating improved accuracy in our estimations.It should be noticed that the ultimate ruin probability represents the probability of ruin after an infinitely long time, and it can be approximated through simulation for large values of time T .The advantage of the QCTSP method lies in its ability to simulate over much longer time intervals, allowing for a remarkably close approximation of this ultimate ruin probability.

Lemma 9 .
Suppose that |a⟩ and |b⟩ are l a -bit and l b -bit strings, respectively, and e iM θ 0 is an analog-encoded qubit, then the multiplication of |a⟩ and |b⟩ can be added to e iM θ 0 as |a⟩ |b⟩ e iM θ 0 → |a⟩ |b⟩ e i(M +ab)θ 0 , within l a l b controlled-rotation gates.Proof.The proof is directly: Given two bit strings |a⟩ = |x la ...x 2 x 1 ⟩ and |b⟩ = |y l b ...y 2 y 1 ⟩, their product can be computed as ab =( (c).Corresponding simulation results are given in Figure 15(b) and 15(d), respectively.B Proofs for QCTSP State Preparation Problem B.1 Proof of Theorem 1

Figure 14 :
Figure 14: Modified Subtractor Circuit.In this figure, a subtractor circuit of two 3-qubits integers that maps |a⟩ |b⟩ to |a − b⟩ |b⟩ is given.The basic idea is from[50] with some modification so that the result can be stored in the first register leaving the second register unchanged.
(a) Exponential Distribution Circuit (b) Exponential Distribution Approximation (c) Erlang Distribution Circuit (d) Erlang Distribution Approximation

Table 2 : Comparison of QCTSP and Uniform Sampling In
this table, most often-used CTSP' s preparation procedure is summarized: the memory length, qubit number and circuit depth of each CTSP type, which have been given in section 3 and proved in Appendix B, are listed in the second, third, and fifth columns, respectively.

(Compound Poisson Process' preparation)
(b)): Suppose that {X(t) : 0 < t < T } is a compound Poisson process with n = T ∆t being the length of sample path, S denoting the sampling space size of each point, and ϵ being the truncation of the exponential distribution F(λ), then the compound Poisson process can be prepared on n⌈log ( −nS ln ϵ According to the Lévy-Itô decomposition, a general Lévy process can be decomposed into three components: a Brownian motion with drift σB t +at, a compound Poisson process Y t , and a compensated generalized Poisson process Z t as follows: 4)n is the minimum of λ j , and ϵ is the truncation error bound for time.(seeproof in Appendix B.4) Theorem 5. (Continuous Markov Process' Preparation)Supposing a stochastic process {X(t) : t ≥ 0} with discrete state space S ⊆ Z to be a continuous-time Markov chain.Then it can be prepared on n⌈log (− S λ min ln ϵ)⌉ qubits via a quantum circuit consisting of O(nS⌈S + log (− ln ϵ λ min )⌉) gates and nS 2 circuit depth, where S = |S|, λ dt) can be efficiently evaluated within O(P +G +nl Y l T ) circuit depth and O( LP ϵ (P +G +nl Y l T )) time complexity.(see proof in Appendix C.2) Therefore our algorithms would enable the quantum-enhanced Monte Carlo method to apply to path-dependent and continuous stochastic processes, including the time-weighted expectation E[f ( 1 t=0 e −αt X(t) dt)] that are usually used in mathematical finance and quantitative trading.