Fixed-point binary representation by qubits
Before we present the quantum algorithm for CVaR contribution calculation, we need some preparations. First of all, we now present the current setting for numerical calculation on a quantum computer. In this paper, we consider systems consisting of some qubits, and use the bit string on a quantum register as the real number in fixed-point binary representation. More strictly, in this paper, a quantum register, or simply a register, means a system consisting of \(N_{\mathrm{dig}}\) qubits, where \(N_{\mathrm {dig}}\) is sufficiently large, and, for every \(x\in\mathbb{R}\), \(\mathopen{\vert }x\mathclose{\rangle}\) denotes a computational basis state on such a register with a bit string corresponding to \({\mathrm{argmin}}_{a\in\mathcal{G}}|x-a|\), where \(\mathcal{G}\) is some set of fixed-point binary numbers with \(N_{\mathrm{dig}}\) digits. We assume that \(\mathcal{G}\) covers the sufficiently wide range on the real axis with the sufficiently small interval, and that therefore approximating a real numbers with an element of G yields only a small error, which we hereafter neglect. Besides, for \(\vec{v}=(v_{1},\ldots,v_{d})^{T}\in\mathbb{R}^{d}\), \(\mathopen {\vert}\vec{v}\mathclose{\rangle}\) denotes a state on d-registers system such that \(\mathopen{\vert}\vec{v}\mathclose{\rangle}:=\mathopen{\vert }v_{1}\mathclose{\rangle}\cdots\mathopen{\vert}v_{d}\mathclose {\rangle}\).
Building-block oracles
Next, we introduce some oracles, which are used as parts of the algorithm.
Definition 1
We call the following oracles on a multi-register system arithmetic circuits.
-
Addition \(U_{\mathrm{add}}\): for any \(x,y\in\mathbb{R}\), \(U_{\mathrm{add}}\mathopen{\vert}x\mathclose{\rangle}\mathopen {\vert}y\mathclose{\rangle}=\mathopen{\vert}x\mathclose{\rangle }\mathopen{\vert}x+y\mathclose{\rangle}\)
-
Multiplication \(U_{\mathrm{mul}}\): for any \(x,y\in\mathbb{R}\), \(U_{\mathrm{add}}\mathopen{\vert}x\mathclose{\rangle}\mathopen {\vert}y\mathclose{\rangle}\mathopen{\vert}0\mathclose{\rangle }=\mathopen{\vert}x\mathclose{\rangle}\mathopen{\vert}y\mathclose {\rangle}\mathopen{\vert}xy\mathclose{\rangle}\)
-
Comparison \(U_{\mathrm{comp}}\): for any \(x,y\in\mathbb{R}\), \(U_{\mathrm{comp}}\mathopen{\vert}x\mathclose{\rangle}\mathopen {\vert}y\mathclose{\rangle}\mathopen{\vert}0\mathclose{\rangle }=\mathopen{\vert}x\mathclose{\rangle}\mathopen{\vert}y\mathclose {\rangle}(1_{x\ge y}\mathopen{\vert}1\mathclose{\rangle}+1_{x< y}\mathopen{\vert}0\mathclose{\rangle})\)
-
Standard normal CDF \(U_{\Phi_{\mathrm{SN}}}\): for any \(x\in\mathbb{R}\), \(U_{\Phi_{\mathrm{SN}}}\mathopen{\vert}x\mathclose{\rangle }\mathopen{\vert}0\mathclose{\rangle}=\mathopen{\vert}x\mathclose {\rangle}\mathopen{\vert}\Phi_{\mathrm{SN}}(x)\mathclose{\rangle}\)
-
Arccos and square root \(U_{\mathrm{acsr}}\): for any \(x\in[0,1]\), \(U_{\mathrm{acsr}}\mathopen{\vert}x\mathclose{\rangle}\mathopen {\vert}0\mathclose{\rangle}=\mathopen{\vert}x\mathclose{\rangle }\mathopen{\vert}\arccos(\sqrt{x})\mathclose{\rangle}\)
In fact, many proposals on circuit implementations for addition and multiplication have been made [34–45]. Comparison of x and y is virtually a subtraction \(y-x\), since, when we use the 2’s complement method to represent a negative number, the top bit of \(y-x\) is 1 if \(y-x\le0\) and 0 otherwise. Also note that subtraction can be done as addition in the 2’s complement method. For the CDF of the standard normal distribution \(\Phi_{\mathrm{SN}}\), or, equivalently, the error function \({\mathrm{erf}}(x)=2\Phi_{\mathrm{SN}}(\sqrt{2}x)-1\), many accurate approximations with elementary functions have been proposed: for example, \({\mathrm{erf}}(x)\approx1-1/(1+a_{1}x+\cdots a_{6}x^{6})^{16}\) with \(a_{1} = 0.0705230784,a_{2} = 0.0422820123,a_{3} = 0.0092705272,a_{4} = 0.0001520143,a_{5} = 0.0002765672,a_{6} = 0.0000430638\) [46]. Therefore, \(U_{\Phi_{\mathrm{SN}}}\) can be approximately implemented with circuits for addition, multiplication and division (note that division circuits have also been proposed [47–50]). For \(U_{\mathrm{acsr}}\), we can use implementation of inverse trigonometric functions in [51], and that of square root in [52].
Definition 2
We call the following oracles \(U_{\mathrm{CRY}}\) on a system consisting of a quantum register and a qubit the angle-controlled Y rotation:
$$\begin{aligned} U_{\mathrm{CRY}}:=\sum_{\theta\in\mathcal{G}} \mathopen{\vert }\theta \mathclose{\rangle}\mathopen{\langle}\theta\mathclose {\vert} \otimes R_{Y}(\theta) \end{aligned}$$
(11)
Here, for any \(\varphi\in\mathbb{R}\).
That is, \(U_{\mathrm{CRY}}\) is the rotation on the Bloch sphere around the Y-axis, whose angle θ is specified by another register. These gates can be implemented as a series of multi-controlled rotation gates with fixed angles [18].
Definition 3
We call the following oracle on a quantum register the SN state generation oracle:
$$\begin{aligned} U^{\mathrm{SN}}\mathopen{\vert}0\mathclose{\rangle}=\mathopen {\vert} \mathrm{SN}\mathclose{\rangle}:=\sum_{i=1}^{N_{\mathrm{SN}}} \sqrt{p^{\mathrm{SN}}_{i}} \mathopen{\bigl\vert }x^{\mathrm {SN}}_{i} \mathclose{\bigr\rangle }, \end{aligned}$$
(12)
where \(N_{\mathrm{SN}}\) is an integer not less than 2,
$$\begin{aligned} p^{\mathrm{SN}}_{i}:= \textstyle\begin{cases} \int_{-\infty}^{\frac{x^{\mathrm{SN}}_{1}+x^{\mathrm{SN}}_{2}}{2}} \phi_{\mathrm{SN}}(x)\,dx ;& {\text{for }} i=1; \\ \int_{\frac{x^{\mathrm{SN}}_{i-1}+x^{\mathrm{SN}}_{i}}{2}}^{ \frac{x^{\mathrm{SN}}_{i}+x^{\mathrm{SN}}_{i+1}}{2}} \phi_{\mathrm {SN}}(x)\,dx ;& { \text{for }} i\in\{2,\ldots,N_{\mathrm{SN}}-1\}, \\ \int^{\infty}_{ \frac{x^{\mathrm{SN}}_{N_{\mathrm{SN}}-1}+x^{\mathrm {SN}}_{N_{\mathrm{SN}}}}{2}} \phi_{ \mathrm{SN}}(x)\,dx; & {\text{for }} i=N_{\mathrm{SN}}, \end{cases}\displaystyle \end{aligned}$$
(13)
\(\phi_{\mathrm{SN}}\) is the probability density function for the standard normal distribution, and, for \(i\in[N_{\mathrm{SN}}]\), \(x^{\mathrm{SN}}_{i}:=-D+2D(i-1)/(N_{\mathrm{SN}}-1)\) with \(D\in\mathbb{R}_{+}\).
This can be interpret as an oracle to generate a state in which the standard normal distribution is approximately encoded in the amplitudes. That is, with sufficiently large \(N_{\mathrm{SN}}\) and D, the random variable \(X_{\mathrm{DiscSN}}\) that takes \(x^{\mathrm{SN}}_{1},\ldots,x^{\mathrm{SN}}_{N_{\mathrm{SN}}}\) with probabilities \(p^{\mathrm{SN}}_{1},\ldots,p^{\mathrm{SN}}_{N_{\mathrm{SN}}}\), respectively, can be viewed as a discretized approximation of a standard normal random variable, and we obtain \(x^{\mathrm{SN}}_{i}\) with probability \(p_{i}\) when we measure \(\mathopen{\vert}\mathrm{SN}\mathclose{\rangle}\). We hereafter use \(X_{\mathrm{DiscSN}}\) as if it followed the standard normal distribution and neglect any errors caused by this approximation.
Some implementations for this type of oracle have been proposed. Originally, the implementation as a series of arithmetic circuits and controlled rotation was proposed in [53], and some extensions and modifications on this have been also proposed recently [54–56]. In another direction, some state preparation methods based on variational algorithms with parametric quantum circuits have been considered [57–61].
Quantum algorithm for estimating multiple expected values
We next explain the quantum algorithm for simultaneous estimation of expected values of multiple random variables, which is the core of the proposed CVaR contribution calculation method. There are some recent proposals on such a quantum algorithm [30, 31]. In this paper, we use the algorithm in [30]. Formally, we have the following theorem.
Theorem 1
(Theorem 3.4 in [30])
Let \((\Omega,2^{\Omega},\mathbb{P})\) be a probability space where the sample space Ω is finite and elements ω in Ω are associated with mutually orthogonal states \(\mathopen{\vert}\omega \mathclose{\rangle}\) on a quantum register. Let ξ⃗ be a \(\mathbb{R}^{d}\)-valued random variable on \((\Omega,2^{\Omega},\mathbb{P})\), and suppose that ξ⃗ has a mean \(\vec{\mu}=(\mu_{1},\ldots,\mu_{d})^{T}\in\mathbb{R}^{d}\) and a covariance matrix \(\Sigma\in\mathbb{R}^{d\times d}\). Suppose that we have accesses to an oracle \(U_{\mathbb{P}}\) on a quantum register, which acts as
$$\begin{aligned} U_{\mathbb{P}}\mathopen{\vert}0\mathclose{\rangle}=\sum _{\omega \in\Omega} \sqrt{\mathbb{P}( \omega)}\mathopen{\vert}\omega \mathclose{\rangle}, \end{aligned}$$
(14)
and an oracle \(U_{\vec{\xi}}\) on a \((d+1)\)-registers system, which acts as
$$\begin{aligned} U_{\vec{\xi}}\mathopen{\vert}\omega\mathclose{\rangle}\mathopen {\vert}0 \mathclose{\rangle}^{\otimes d}=U_{\vec{\xi}} \mathopen {\vert}\omega \mathclose{\rangle} \mathopen{\bigl\vert }\vec{\xi}(\omega)\mathclose{\bigr\rangle } \end{aligned}$$
(15)
for any \(\omega\in\Omega\). Then, for given \(\delta\in(0,1)\) and \(n\in\mathbb{N}\) such that \(n\ge\log(d/\delta)\), there is a quantum algorithm \(\textup {\textsf {QEstimator}}_{d}(\vec{\xi},n,\delta)\) that outputs an estimate \(\vec{\mu}^{\prime}=(\mu^{\prime}_{1},\ldots,\mu^{\prime }_{d})^{T}\) of μ⃗ such that
$$\begin{aligned} \bigl\vert \mu_{i}-\mu^{\prime}_{i} \bigr\vert \le \frac{\sqrt{{\mathrm{Tr}}\Sigma}\log(d/\delta)}{n} \end{aligned}$$
(16)
for every \(i\in[d]\) with probability at least \(1-\delta\), making \(\widetilde{O}(n)\) calls to \(U_{\mathbb{P}}\) and \(U_{\vec{\xi}}\).
On the oracles \(U_{\mathbb{P}}\) and \(U_{\vec{\xi}}\) needed for this algorithm, we will later present the concrete way to construct for CVaR contribution calculation. Note that, along with \(U_{\mathbb{P}}\) and \(U_{\vec{\xi}}\), \(\textup {\textsf {QEstimator}}_{d}(\vec{\xi},n,\delta)\) contains \(\widetilde{O}(dn)\) uses of arithmetic circuits, since we calculate the inner product \(\vec{u}\cdot\vec{\xi}\) with some \(\vec{u}\in\mathbb{R}^{d}\) in the algorithm [30]. However, we neglect them when we later count arithmetic computations in the proposed quantum method, since \(U_{\mathbb{P}}\) and \(U_{\vec{\xi}}\) in the method contain more arithmetic computations. That is, as we will see later, they use arithmetic circuits \(O(N_{\mathrm{obl}})\) times, and the total number in \(\textup {\textsf {QEstimator}}_{d}(\vec{\xi},n,\delta)\) is therefore \(O(nN_{\mathrm{obl}})\), which is larger than \(\widetilde{O}(dn)\) since \(d=N_{\mathrm{gr}}\le N_{\mathrm{obl}}\) in the current problem.
Fixed-point quantum amplitude amplification
We also explain the fixed-point QAA presented in [33], which is an important subroutine in the proposed method. This is a modified version of the original QAA algorithm in [10]. Unlike the original one, the fixed-point QAA, as an unitary operation, amplifies the squared amplitude of the marked state in a superposition state to the value arbitrarily close to 1, without the unintended amplitude decay by too much iterative operations. Formally, we have the following theorem.
Theorem 2
([33])
Let \(\mathopen{\vert}\Phi\mathclose{\rangle}=\sqrt{p}\mathopen{\vert }\phi\mathclose{\rangle}\mathopen{\vert}1\mathclose{\rangle }+\sqrt{1-p}\mathopen{\vert}\phi^{\prime}\mathclose{\rangle} \mathopen{\vert}0\mathclose{\rangle}\) be a state on a system R with a qubit A attached, where \(\mathopen{\vert}\phi\mathclose{\rangle}\) and \(\mathopen{\vert }\phi^{\prime}\mathclose{\rangle}\) are states on R and \(p\in(0,1)\). Suppose that we are given an access to the oracle U that prepares \(\mathopen{\vert}\Phi\mathclose{\rangle}\): \(U\mathopen {\vert}0\mathclose{\rangle}\mathopen{\vert}0\mathclose{\rangle }=\mathopen{\vert}\Phi\mathclose{\rangle}\). Then, for any \(\delta\in(0,1)\), there is an unitary V that prepares a state \(\mathopen{\vert}\Phi^{\prime}\mathclose{\rangle}\) in the form of \(\mathopen{\vert}\Phi^{\prime}\mathclose{\rangle}=\sqrt{1-\delta ^{\prime}}\mathopen{\vert}\phi\mathclose{\rangle}\mathopen{\vert }1\mathclose{\rangle}+ \sqrt{\delta^{\prime}}\mathopen{\vert}\phi^{\prime\prime }\mathclose{\rangle}\mathopen{\vert}0\mathclose{\rangle}\), where \(\delta^{\prime}\in[0,\delta)\) and \(\mathopen{\vert}\phi^{\prime \prime}\mathclose{\rangle}\) is some state on R, making \(O (\frac{\log(\delta^{-1})}{\sqrt{p}} )\) calls to U.
Here, we assume that the marked state and other states are distinguished by whether a specific qubit A is \(\mathopen{\vert}1\mathclose {\rangle}\) or \(\mathopen{\vert}0\mathclose{\rangle}\), which suffices for the current problem of CVaR contribution calculation. [33] assumes that we can use the oracle \(U_{T}\) such that, for the market state \(\mathopen{\vert}T\mathclose{\rangle}\) with an ancilla qubit, \(U_{T}\mathopen{\vert}T\mathclose{\rangle}\mathopen{\vert }b\mathclose{\rangle}=\mathopen{\vert}T\mathclose{\rangle }\mathopen{\vert}b\otimes1\mathclose{\rangle}\), and that, for any state \(\mathopen{\vert}T^{\prime}\mathclose{\rangle}\) orthogonal to \(\mathopen{\vert}T\mathclose{\rangle}\), \(U_{T}\mathopen{\vert}T^{\prime}\mathclose{\rangle}\mathopen {\vert}b\mathclose{\rangle}=\mathopen{\vert}T^{\prime}\mathclose {\rangle}\mathopen{\vert}b\mathclose{\rangle}\), where \(b\in\{0,1\}\). Now, this is just a CNOT gate controlled by A, and therefore we will not consider the number of calls to it hereafter.
Proposed algorithm
We finally present the quantum algorithm for calculating CVaR contributions. Formally, we have the following theorem.
Theorem 3
Suppose that \(N_{\mathrm{obl}}\in\mathbb{N}\), \(e_{1},\ldots,e_{N_{\mathrm{obl}}}\in\mathbb{R}_{+}\), \(a_{1},\ldots,a_{N_{\mathrm{obl}}}\in(0,1)\), \(z_{1},\ldots,z_{N_{\mathrm{obl}}}\in\mathbb{R}\), \(\alpha\in (0,1)\) and \(\delta\in(0,1)\) are given. Suppose that \(N_{\mathrm{gr}}\in\mathbb{N}\) and \(n_{1},\ldots,n_{N_{\mathrm{gr}}}\in\mathbb{N}\) such that \(\sum_{K=1}^{N_{\mathrm{gr}}}n_{K}=N_{\mathrm{obl}}\) are given. Let v be a positive real number such that \(p:={\mathrm{Pr}}(L\ge v)>0\), where L is given in (1). Suppose that we are given \(C_{\mathrm{max}}\in\mathbb{R}\) satisfying
$$\begin{aligned} \max \bigl\{ C^{1}_{v}(e_{1}, \ldots,e_{N_{\mathrm{obl}}}),\ldots,C^{N_{\mathrm{gr}}}_{v}(e_{1}, \ldots,e_{N_{ \mathrm{obl}}}) \bigr\} \le C_{\mathrm{max}}. \end{aligned}$$
(17)
Suppose that we are given \(\sigma_{\mathrm{max}}\in\mathbb{R}\) satisfying
$$\begin{aligned} \max\{\sigma_{1},\ldots,\sigma_{N_{\mathrm{gr}}}\}\le\sigma _{\mathrm{max}}, \end{aligned}$$
(18)
where \((\sigma_{K})^{2}\) is the conditional variance of the random variable \(L_{K}\) in (8) given that \(L\ge v\). Suppose that we have an access to the SN state generation oracle \(U^{\mathrm{SN}}\). Then, for any \(\epsilon\in\mathbb{R}_{+}\) satisfying \(\epsilon\le\sigma_{\mathrm{max}}\sqrt{N_{\mathrm{gr}}}\), there is a quantum algorithm that, with probability at least \(1-\delta\), outputs the ϵ-approximations \(c_{1},\ldots,c_{N_{\mathrm{gr}}}\in\mathbb{R}\) of \(C^{1}_{v}(e_{1},\ldots,e_{N_{\mathrm{obl}}}),\ldots,C^{N_{\mathrm {gr}}}_{v}(e_{1},\ldots,e_{N_{ \mathrm{obl}}})\), respectively, using \(U^{\mathrm{SN}}\)
$$\begin{aligned} \widetilde{O} \biggl( \frac{\sigma_{\mathrm{max}}\sqrt{N_{\mathrm {gr}}}}{\epsilon\sqrt{p}}\log \biggl(\max \biggl\{ \frac{C_{\mathrm{max}}}{\epsilon}, \frac{E_{\mathrm{max}}}{\sigma _{\mathrm{max}}} \biggr\} \biggr)\log \biggl( \frac{N_{\mathrm{gr}}}{\delta} \biggr) \biggr) \end{aligned}$$
(19)
times, and arithmetic circuits and angle-controlled Y rotations
$$\begin{aligned} \widetilde{O} \biggl( \frac{\sigma_{\mathrm{max}}N_{\mathrm {obl}}\sqrt{N_{\mathrm{gr}}}}{\epsilon\sqrt{p}} \log \biggl(\max \biggl\{ \frac{C_{\mathrm{max}}}{\epsilon}, \frac{E_{\mathrm{max}}}{\sigma _{\mathrm{max}}} \biggr\} \biggr)\log \biggl( \frac{N_{\mathrm{gr}}}{\delta} \biggr) \biggr) \end{aligned}$$
(20)
times. Here, \(E_{\mathrm{max}}:=\max\{E_{1},\ldots,E_{N_{\mathrm {gr}}}\}\), where, for \(K\in[N_{\mathrm{gr}}]\), \(E_{K}:=\sum_{k=\kappa^{K}_{1}}^{\kappa^{K}_{n_{K}}}e_{k}\).
Proof
Consider the following probability space \((\Omega,2^{\Omega},\mathbb{P})\). The sample space is
$$\begin{aligned} \Omega= [N_{\mathrm{SN}}]\times\{0,1\}^{N_{\mathrm{obl}}}. \end{aligned}$$
(21)
The probability measure \(\mathbb{P}\) takes the form that, for each \(\omega=(i,y_{1},\ldots,y_{N_{\mathrm{obl}}})\in\Omega\),
$$\begin{aligned} \mathbb{P}(\omega)= \textstyle\begin{cases} \frac{1-\epsilon^{\prime}}{p}\mathcal{P}(i;y_{1},\ldots ,y_{N_{\mathrm{obl}}}) ;& {\text{if }} \sum_{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}\ge v, \\ \frac{\epsilon^{\prime}}{1-p}\widetilde{\mathbb{P}}(i,y_{1},\ldots,y_{N_{ \mathrm{obl}}}) ;& {\text{otherwise}}. \end{cases}\displaystyle \end{aligned}$$
(22)
Here,
$$\begin{aligned} &\mathcal{P}(i;y_{1},\ldots,y_{N_{\mathrm{obl}}}) \\ &\quad:= p^{\mathrm{SN}}_{i}\prod_{k=1}^{N_{\mathrm{obl}}} \bigl(P^{\mathrm{def}}_{k} \bigl(x^{ \mathrm{SN}}_{i} \bigr) \delta_{y_{k},1}+ \bigl(1-P^{\mathrm{def}}_{k} \bigl(x^{\mathrm{SN}}_{i} \bigr) \bigr) \delta_{y_{k},0} \bigr) \end{aligned}$$
(23)
is the probability that \(X_{0}=x^{\mathrm{SN}}_{i},Y_{1}=y_{1},\ldots,Y_{N_{\mathrm {obl}}}=y_{N_{\mathrm{obl}}}\), and \(\frac{1}{p}\mathcal{P}(i;y_{1},\ldots,y_{N_{\mathrm{obl}}})\) is the conditional probability of the same event given \(\sum_{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}\ge v\). \(\epsilon^{\prime}\) is some real number satisfying
$$\begin{aligned} 0\le\epsilon^{\prime}\le\min \biggl\{ \frac{\epsilon}{2C_{\mathrm {max}}}, \biggl( \frac{\sigma_{\mathrm{max}}}{E_{\mathrm{max}}} \biggr)^{2} \biggr\} . \end{aligned}$$
(24)
\(\widetilde{\mathbb{P}}\) is some probability measure on a measurable space \((\Omega,2^{\Omega})\). Note that
$$\begin{aligned} \epsilon^{\prime}\le1 \end{aligned}$$
(25)
holds because of \((\sigma_{\mathrm{max}})^{2}\le(E_{\mathrm {max}})^{2}\), which follows from \(L_{K}\le E_{\mathrm{max}}\) for every \(K\in[N_{\mathrm {gr}}]\), and that (25) makes \(\mathbb{P}\) non-negative and therefore well-defined. Besides, consider the following random variable \(\vec{\xi}=(\xi_{1},\ldots,\xi_{N_{\mathrm{gr}}})^{T}\in\mathbb{R}^{N_{ \mathrm{gr}}}\) on \((\Omega,2^{\Omega},\mathbb{P})\): for any \(K\in[N_{\mathrm{gr}}]\) and \(\omega=(i,y_{1},\ldots,y_{N_{\mathrm{obl}}},w)\in\Omega\),
$$\begin{aligned} \xi_{K}(\omega) := \textstyle\begin{cases} \sum_{k=\kappa^{K}_{1}}^{\kappa^{K}_{n_{K}}}e_{k}y_{k}; & {\text{if }} \sum_{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}\ge v, \\ 0 ;& {\text{otherwise}}. \end{cases}\displaystyle \end{aligned}$$
(26)
Then, the expected value of \(\xi_{K}\) is
$$\begin{aligned} \mathbb{E}[\xi_{K}]= \bigl(1-\epsilon^{\prime} \bigr)C^{K}_{v}(e_{1},\ldots,e_{N_{ \mathrm{obl}}}). \end{aligned}$$
(27)
Because of (17) and (24),
$$\begin{aligned} \bigl\vert C^{K}_{v}(e_{1}, \ldots,e_{N_{\mathrm{obl}}})-\mathbb{E}[\xi_{K}] \bigr\vert \le \frac{\epsilon}{2} \end{aligned}$$
(28)
holds. Therefore, if we obtain \(\epsilon/2\)-approximations \(\bar{\xi}_{1},\ldots,\bar{\xi}_{N_{\mathrm{gr}}}\) of \(\mathbb{E}[\xi_{1}],\ldots,\mathbb{E}[\xi_{N_{\mathrm{gr}}}]\), they are also ϵ-approximations of \(C^{1}_{v},\ldots,C^{N_{\mathrm{gr}}}_{v}\).
Thus, we hereafter consider how to obtain such \(\bar{\xi}_{1},\ldots,\bar{\xi}_{N_{\mathrm{gr}}}\) by QEstimator. To use this, we need the oracles \(U_{\mathbb{P}}\) in (14) and \(U_{\vec{\xi}}\) in (15). First, let us consider \(U_{\mathbb{P}}\). Define
$$\begin{aligned} &\mathopen{\vert}\Psi_{\ge v}\mathclose{\rangle} \\ &\quad :=\frac{1}{\sqrt{p}}\sum_{i=1}^{N_{\mathrm{SN}}}\sum _{ \substack{y_{1},\ldots,y_{N_{\mathrm{obl}}}\in\{0,1\} \\ \sum _{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}\ge v}} \sqrt{\mathcal {P}(i;y_{1},\ldots ,y_{N_{\mathrm{obl}}})} \mathopen{\bigl\vert }x^{\mathrm {SN}}_{i}\mathclose{ \bigr\rangle }\mathopen{\vert}y_{1}\mathclose {\rangle} \cdots\mathopen{ \vert}y_{N_{\mathrm{obl}}}\mathclose{\rangle}, \end{aligned}$$
(29)
as a quantum state on a system S consisting of a quantum register and \(N_{\mathrm{obl}}\) qubits. On the system consisting of S and an additional qubit, we can perform the following operation:
$$\begin{aligned} & \mathopen{\vert}0\mathclose{\rangle}\mathopen{\vert }0\mathclose{ \rangle}^{\otimes N_{\mathrm{obl}}}\mathopen{\vert }0\mathclose{\rangle} \\ &\quad\rightarrow\sum_{i=1}^{N_{\mathrm{SN}}}\sqrt {p^{\mathrm{SN}}_{i}} \mathopen{\bigl\vert }x^{\mathrm{SN}}_{i} \mathclose {\bigr\rangle } \mathopen{\vert}0\mathclose{\rangle}^{\otimes N_{\mathrm {obl}}}\mathopen{ \vert}0\mathclose{\rangle} \\ &\quad\rightarrow\sum_{i=1}^{N_{\mathrm{SN}}}\sqrt {p^{\mathrm{SN}}_{i}} \mathopen{\bigl\vert }x^{\mathrm{SN}}_{i} \mathclose {\bigr\rangle } \Bigl(\sqrt{P^{\mathrm{def}}_{1} \bigl(x^{\mathrm{SN}}_{i} \bigr)} \mathopen{\vert}1\mathclose{ \rangle}+\sqrt{1-P^{\mathrm{def}}_{1} \bigl(x^{\mathrm{SN}}_{i} \bigr)}\mathopen{\vert}0\mathclose {\rangle} \Bigr) \\ &\qquad{} \otimes\cdots\otimes \Bigl(\sqrt{P^{\mathrm{def}}_{N_{ \mathrm{obl}}} \bigl(x^{\mathrm{SN}}_{i} \bigr)}\mathopen{\vert}1\mathclose { \rangle}+\sqrt{1-P^{\mathrm{def}}_{N_{\mathrm{obl}}} \bigl(x^{ \mathrm{SN}}_{i} \bigr)}\mathopen{\vert}0\mathclose{\rangle} \Bigr)\mathopen{\vert}0\mathclose{ \rangle} \\ &\quad=\sum_{i=1}^{N_{\mathrm{SN}}}\sum _{y_{1},\ldots,y_{N_{\mathrm{obl}}}\in\{0,1 \}}\sqrt{\mathcal{P}(i;y_{1},\ldots ,y_{N_{\mathrm{obl}}})} \mathopen{\bigl\vert }x^{\mathrm {SN}}_{i}\mathclose{ \bigr\rangle }\mathopen{\vert}y_{1}\mathclose {\rangle} \cdots\mathopen{ \vert}y_{N_{\mathrm{obl}}}\mathclose{\rangle }\mathopen{\vert}0\mathclose{\rangle} \\ &\quad\rightarrow \sum_{i=1}^{N_{\mathrm{SN}}}\sum _{y_{1},\ldots,y_{N_{\mathrm{obl}}} \in\{0,1\}}\sqrt{\mathcal{P}(i;y_{1},\ldots ,y_{N_{\mathrm{obl}}})} \mathopen{\bigl\vert }x^{\mathrm {SN}}_{i}\mathclose{ \bigr\rangle }\mathopen{\vert}y_{1}\mathclose {\rangle} \cdots\mathopen{ \vert}y_{N_{\mathrm{obl}}}\mathclose{\rangle} \\ &\qquad{} \otimes(1_{\sum_{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k} \ge v}\mathopen{\vert}1\mathclose{\rangle}+1_{\sum _{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}< v} \mathopen{\vert}0\mathclose {\rangle} ) \\ &\quad=\sqrt{p}\mathopen{\vert}\Psi_{\ge v}\mathclose{\rangle }\mathopen{ \vert}1\mathclose{\rangle}+\sqrt{1-p} \mathopen{\vert }\Psi _{\mathrm{gar}} \mathclose{\rangle}\mathopen{\vert }0\mathclose{\rangle}, \end{aligned}$$
(30)
where \(\mathopen{\vert}\Psi_{\mathrm{gar}}\mathclose{\rangle}\) is some state on S and some ancillary registers are not displayed. In (30), we use \(U^{\mathrm{SN}}\) at the first arrow. At the second arrows, we calculate \(\arccos (\sqrt{P^{\mathrm{def}}_{1}(x^{\mathrm{SN}}_{i})} ),\ldots, \arccos (\sqrt{P^{\mathrm{def}}_{N_{\mathrm{obl}}}(x^{\mathrm{SN}}_{i})} )\) onto undisplayed ancillary registers using arithmetic circuits, and then operate \(U_{\mathrm{CRY}}\) with the rotation angles specified by these ancillary registers. At the third arrow, we calculate \(\sum_{k=1}^{N_{\mathrm{obl}}}e_{k}y_{k}\) by \(N_{\mathrm{obl}}\) additions and multiplications, then use \(U_{\mathrm{comp}}\). We denote by \(U_{\ge v}\) the oracle that acts as (30). Then, because of Theorem 2, we can generate a state
$$\begin{aligned} \mathopen{\vert}\Phi_{\ge v}\mathclose{\rangle}:=\sqrt{1-\epsilon ^{\prime}}\mathopen{\vert}\Psi _{\ge v}\mathclose{\rangle} \mathopen{ \vert}1\mathclose{\rangle}+\sqrt{\epsilon^{\prime }}\mathopen{\bigr\vert }\Psi _{\mathrm{gar}}^{\prime}\mathclose{\bigr\rangle } \mathopen{\vert}0\mathclose{ \rangle}, \end{aligned}$$
(31)
where \(\mathopen{\vert}\Psi_{\mathrm{gar}}^{\prime}\mathclose {\rangle}\) is some state and \(\epsilon^{\prime}\) is some real number satisfying (24), making
$$\begin{aligned} O \biggl( \frac{\log (\max \{\frac{C_{\mathrm{max}}}{\epsilon },\frac{E_{\mathrm{max}}}{\sigma_{\mathrm{max}}} \} )}{\sqrt{p}} \biggr) \end{aligned}$$
(32)
calls to \(U_{\ge v}\). Note that \(\mathopen{\vert}\Phi_{\ge v}\mathclose{\rangle}\) is in fact \(\sum_{\omega\in\Omega} \sqrt{\mathbb{P}(\omega)}\mathopen {\vert}\omega\mathclose{\rangle}\) with identification that
$$\begin{aligned} \mathopen{\vert}\omega\mathclose{\rangle} = \textstyle\begin{cases} \mathopen{\vert}x^{\mathrm{SN}}_{i}\mathclose{\rangle}\mathopen {\vert}y_{1}\mathclose{\rangle}\cdots\mathopen{\vert }y_{N_{\mathrm{obl}}}\mathclose{\rangle}\mathopen{\vert }1\mathclose{\rangle}; & {\text{if }} \sum_{k=1}^{N_{\mathrm{obl}}} e_{k}y_{k}\ge v, \\ \mathopen{\vert}x^{\mathrm{SN}}_{i}\mathclose{\rangle}\mathopen {\vert}y_{1}\mathclose{\rangle}\cdots\mathopen{\vert }y_{N_{\mathrm{obl}}}\mathclose{\rangle}\mathopen{\vert }0\mathclose{\rangle}; & {\text{otherwise}}, \end{cases}\displaystyle \end{aligned}$$
(33)
for each \(\omega=(i,y_{1},\ldots,y_{N_{\mathrm{obl}}})\in\Omega\). Therefore, we hereafter denote by \(U_{\mathbb{P}}\) the oracle that generates \(\mathopen{\vert}\Phi_{\ge v}\mathclose{\rangle}\) from \(\mathopen{\vert}0\mathclose{\rangle}\mathopen{\vert}0\mathclose {\rangle}^{\otimes N_{\mathrm{obl}}}\mathopen{\vert}0\mathclose {\rangle}\).
On the other hand, constructing \(U_{\vec{\xi}}\) is more simple. Given a state \(\mathopen{\vert}\omega\mathclose{\rangle}\) in (33) for \(\omega\in\Omega\), we can add \(N_{\mathrm{gr}}\) registers and perform the operation
$$\begin{aligned} &\mathopen{\bigl\vert }x^{\mathrm{SN}}_{i}\mathclose{\bigr\rangle }\mathopen { \vert}y_{1}\mathclose{\rangle}\cdots \mathopen{\vert}y_{N_{\mathrm{obl}}} \mathclose{\rangle}\mathopen {\vert}w\mathclose{\rangle} \mathopen{\vert}0 \mathclose{\rangle }^{N_{\mathrm{gr}}} \\ &\quad\rightarrow\mathopen{\bigl\vert }x^{\mathrm{SN}}_{i}\mathclose { \bigr\rangle }\mathopen{\vert}y_{1}\mathclose{\rangle}\cdots \mathopen{ \vert}y_{N_{\mathrm{obl}}}\mathclose{\rangle}\mathopen {\vert}w\mathclose{\rangle} \bigotimes_{K=1}^{N_{\mathrm{gr}}} \mathopen{\Biggl\vert }w\sum _{k=\kappa^{K}_{1}}^{\kappa ^{K}_{n_{K}}}e_{k}y_{k} \mathclose{\Biggr\rangle }, \end{aligned}$$
(34)
where \(w\in\{0,1\}\). This can be done by \(O(N_{\mathrm{obl}})\) multiplications and additions. Note that (34) is in fact \(U_{\vec{\xi}}\) for ξ⃗ in (26), since \(w=1\) is \(\sum_{k=1}^{N_{\mathrm{obl}}} e_{k}y_{k}\ge v\) and 0 otherwise.
With \(U_{\mathbb{P}}\) and \(U_{\vec{\xi}}\) constructed as above, we perform \(\textup {\textsf {QEstimator}}_{N_{\mathrm{gr}}} (\vec{\xi},n,\delta )\) with
$$\begin{aligned} n= \biggl\lceil \frac{2\sqrt{2}\sigma_{\max}\sqrt{N_{\mathrm {gr}}}\log(N_{\mathrm{gr}}/\delta)}{\epsilon} \biggr\rceil . \end{aligned}$$
(35)
Because of (16), each of outcomes \(\bar{\xi}_{1},\ldots,\bar{\xi}_{N_{\mathrm{gr}}}\) of this satisfies
$$\begin{aligned} \bigl\vert \bar{\xi}_{K}-\mathbb{E}[\xi_{K}] \bigr\vert &\le \frac{\sqrt{{\mathrm{Tr}}\widetilde{\Sigma}}\log (N_{\mathrm{gr}}/\delta)}{n} \\ &\le \frac{\sqrt{N_{\mathrm{gr}}(\widetilde{\sigma}_{\max })^{2}}\log(N_{\mathrm{gr}}/\delta)}{n} \\ &\le \frac{\sqrt{2N_{\mathrm{gr}}(\sigma_{\max})^{2}}\log (N_{\mathrm{gr}}/\delta)}{n} \\ &\le \frac{\epsilon}{2}, \end{aligned}$$
(36)
where Σ̃ is the covariance matrix of \(\xi_{1},\ldots,\xi_{N_{\mathrm{gr}}}\), and \((\widetilde{\sigma}_{\max})^{2}\) is its largest diagonal element, that is, the maximum of the variances of \(\xi_{1},\ldots,\xi_{N_{\mathrm {gr}}}\). The third inequality in (36) holds since
$$\begin{aligned} (\widetilde{\sigma}_{\max})^{2} \le2(\sigma _{\max})^{2}, \end{aligned}$$
(37)
whose proof is postponed to Appendix 4. (36) means that \(\bar{\xi}_{1},\ldots,\bar{\xi}_{N_{\mathrm{gr}}}\) are \(\epsilon/2\)-approximations of \(\mathbb{E}[\xi_{1}],\ldots,\mathbb{E}[\xi_{N_{\mathrm {gr}}}]\), and also ϵ-approximations of \(C^{1}_{v},\ldots,C^{N_{\mathrm {gr}}}_{v}\), as discussed above.
Finally, let us count the numbers of calls to building-block circuits in this algorithm. \(\textup {\textsf {QEstimator}}_{N_{\mathrm{gr}}} (\vec{\xi},n,\delta )\) calls \(U_{\mathbb{P}}\) and \(U_{\vec{\xi}}\) \(\widetilde{O}(n)\) times, that is,
$$\begin{aligned} \widetilde{O} \biggl( \frac{\sigma_{\max}\sqrt{N_{\mathrm {gr}}}\log(N_{\mathrm{gr}}/\delta)}{\epsilon} \biggr) \end{aligned}$$
(38)
times. \(U_{\mathbb{P}}\) makes iterative calls to \(U_{\ge v}\), whose number is evaluated as (32). In \(U_{\ge v}\), \(U^{\mathrm{SN}}\) is called once, and arithmetic circuits and \(U_{\mathrm{CRY}}\) are called \(O(N_{\mathrm{obl}})\) times. On the other hand, \(U_{\vec{\xi}}\) consists of \(O(N_{\mathrm{obl}})\) arithmetic circuits. In total, for the numbers of calls to building-block circuits, we obtain evaluations (19) and (20). □
Comparison with the classical Monte Carlo method
We have seen that the proposed quantum algorithm estimates \(N_{\mathrm{gr}}\) CVaR contributions with accuracy ϵ and has query complexity scaling on \(N_{\mathrm{gr}}\) and ϵ as \(O(\sqrt{N_{\mathrm{gr}}}/\epsilon)\). Seemingly, this means so-called quadratic quantum speedup with respect to both \(N_{\mathrm{gr}}\) and ϵ. However, if we do not require the scaling on ϵ to be \(O(\epsilon^{-1})\), we can achieve the better dependence on \(N_{\mathrm{gr}}\) classically. In classical Monte Carlo integration, we generate many samples of \(X_{0}\) and \(Y_{1},\ldots,Y_{N_{\mathrm{gr}}}\), calculate \(\widetilde{L}_{1},\ldots,\widetilde{L}_{N_{\mathrm{gr}}}\) for these samples, and take averages. By this procedure, we obtain ϵ-approximations for \(N_{\mathrm{gr}}\) CVaR contributions with high probability with \(\widetilde{O}(\log N_{\mathrm{gr}}/\epsilon^{-2})\) sample complexity [30]. This implies that, depending on \(N_{\mathrm{gr}}\) and ϵ, the quantum method might not be the best way.
In order to identify the situation where the quantum or classical method is better more precisely, let us evaluate the complexity in the classical method in more detail. The sample complexity to obtain ϵ-approximations for \(C^{1}_{v},\ldots,C^{N_{\mathrm{gr}}}_{v}\) with probability at least δ in the classical method is [30]
$$\begin{aligned} \widetilde{\Theta} \biggl( \frac{(\sigma_{\mathrm{max}})^{2}\log (N_{\mathrm{gr}}/\delta)}{\epsilon^{2}p} \biggr). \end{aligned}$$
(39)
Here, the factor \(1/p\) appears since we randomly generate \(\Theta(N/p)\) samples of \(X_{0},Y_{1},\ldots, Y_{N_{\mathrm{obl}}}\) in order to obtain N samples such that \(L\ge v\). In one sample generation, one standard normal random variable is generated, \(\Theta(N_{\mathrm{obl}})\) arithmetic operations are done, and \(N_{\mathrm{obl}}\) Bernoulli random variables are generated. In total, in the classical method, the number of standard normal random variable generations is evaluated as (39), and the numbers of arithmetic operations and Bernoulli random variable generations are
$$\begin{aligned} \widetilde{\Theta} \biggl( \frac{(\sigma_{\mathrm {max}})^{2}N_{\mathrm{obl}}\log(N_{\mathrm{gr}}/\delta)}{\epsilon ^{2}p} \biggr). \end{aligned}$$
(40)
Then, let us compare these complexity estimations with those for the proposed quantum method. We see that the quantum method is advantageous in query complexity if
$$\begin{aligned} \frac{(\sigma_{\mathrm{max}})^{2}}{\epsilon^{2}p}\gg N_{\mathrm {gr}}, \end{aligned}$$
(41)
although this is a rough discussion with logarithmic factors neglected.
As an extreme case, let us assume that we want CVaR contributions for all the individual obligors. In this case, \(N_{\mathrm{gr}}\) takes the maximum \(N_{\mathrm{obl}}\), and therefore it is most disadvantageous for the quantum method. Besides, we roughly evaluate \((\sigma_{\mathrm{max}})^{2}\) as \(\bar{p}_{\mathrm{def}}(1-\bar{p}_{\mathrm{def}})\bar{e}^{2}\), where \(\bar{p}_{\mathrm{def}}\) and ē are the typical scale of conditional default probabilities of obligors given \(L\ge v\) and that of exposures, respectively. Moreover, we set the accuracy ϵ relative to \(C_{\mathrm{max}}\) and roughly evaluate \(C_{\mathrm{max}}\) as \(\bar{p}_{\mathrm{def}}\bar{e}\). With these evaluations, (41) becomes
$$\begin{aligned} \biggl(\frac{C_{\mathrm{max}}}{\epsilon} \biggr)^{2} \frac{1-\bar {p}_{\mathrm{def}}}{p\bar{p}_{\mathrm{def}}}\gg N_{\mathrm{obl}}. \end{aligned}$$
(42)
Under a plausible assumption that \(p=0.01,p_{\mathrm{def}}\sim0.01,C_{\mathrm{max}}/{\epsilon}\sim 0.01\), the left hand side of (42) is of order 108, and therefore the quantum method is promising to be advantageous when \(N_{\mathrm{obl}}\ll10^{8}\), which is usually satisfied. In the case that \(N_{\mathrm{gr}}\ll N_{\mathrm{obl}}\), which means that we need CVaR contributions not for individual obligors but for some obligor groups, the quantum method becomes more advantageous.