Introduction
Partial differential equations (PDEs) are the most universal descriptions of the natural physical laws and capture various problems in science and engineering. This makes them an ideal case to probe the potential utility of quantum computers for various applications. Many quantum algorithms have therefore been developed for differential equations over the years [1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] . However, these algorithms mainly remain at an abstract level. Specifically, quantum PDE solvers typically assume access to certain oracles that specify a discretized version of the PDE, such as an oracle for preparing an appropriate initial state and an oracle for encoding the discretized PDE operator. The cost of the algorithm is then assessed in terms of the number of queries to these oracles. However, implementing these oracles from a classical specification of the PDE can introduce substantial gate costs that are not captured by the query cost.
Furthermore, unlike classical algorithms that explicitly return the solution vector of the discretized PDE, quantum PDE solvers generate a quantum state that encodes an approximation of the solution. It is therefore assumed that physically relevant properties of the solution vector can be extracted from this state, although the cost of such post-processing of the quantum solution can be significant. Moreover, quantum PDE solvers assume that the discretized PDE operator is well conditioned to achieve a polylogarithmic cost in the system size, whereas for typical PDEs, its condition number generally grows polynomially with the system size. These algorithms also commonly assume prior knowledge of additional problem-dependent parameters [9 , 10 , 11 , 12 ] , such as a sufficiently tight upper bound on the norm of the discretized operator, which may be computationally costly to obtain. Considering these assumptions, the practical feasibility and the computational advantage of quantum algorithms for realistic PDEs remain unclear.
In this paper, we formalize the concept of an end-to-end quantum algorithm for differential equations, by which we mean a quantum algorithm that accepts classical inputs and returns classical outputs (Figure 1 ). To this end, we present a set of broadly applicable algorithmic primitives for realizing the main subroutines of an end-to-end quantum algorithm. In particular, we present explicit quantum circuits for loading a quantum state into a quantum register and estimating properties of a quantum solution, construct implementations for different encodings of differential operators with constant and variable coefficients, and rigorously analyze the computational costs of these primitives. We then develop a tailored end-to-end quantum algorithm for the linearized Poisson-Boltzmann (LPB) equation, a second-order PDE with variable coefficients that is widely used in computational biochemistry to model the electrostatic potential around a biomolecule immersed in an ionic aqueous solution. The electrostatic potential and related quantities obtained from this model are used to study how the surrounding solution affects the stability of biomolecules, such as proteins, and their binding to other molecules, such as potential drugs [13 , 14 ] .
Figure 1. Common steps of an end-to-end quantum algorithm. The algorithm accepts classical inputs and returns classical outputs, denoted by double lines. In the first step, an initial state is prepared. The initial state is then evolved to a final state. The final step is to perform a measurement to obtain an expectation value of an observable with respect to the final state. These steps may need to be repeated to obtain multiple samples for more accurate computation of the desired expectation value.
A central contribution of our work is an efficient and fully explicit construction of an end-to-end quantum algorithm directly from a classical specification of the biomolecular system, without assuming access to abstract oracles or prior knowledge of additional problem-dependent parameters commonly taken as inputs to quantum algorithms. To achieve this, we exploit the mathematical and physical structure of the biomolecular system to develop suitable representations and quantum circuits tailored to the problem. In particular, we introduce a new discrete representation of multidimensional differential operators with variable coefficients that enables us to construct the oracle for the discretized PDE operator from simple components, which can be efficiently implemented by directly exploiting the geometry and physical properties of the biomolecular system. Similarly, we exploit the structure of the problem to develop an efficient quantum circuit for preparing an appropriate initial state from the classical specification, without explicitly loading the high-dimensional discretized data. We further identify physically relevant properties of the biomolecular system and construct efficiently implementable observables whose expectation values with respect to a quantum encoding of the solution yield these properties.
The differential operator of the LPB equation is a multidimensional generalization of a Sturm–Liouville operator with variable and bounded coefficients. When discretized, operators of this form yield matrices whose condition numbers scale polynomially with the matrix size N g N_g N g . However, such operators can be optimally preconditioned using a simple diagonal wavelet preconditioner [8 ] , meaning that the condition number of the preconditioned matrix becomes independent of the matrix size. We therefore build on the quantum PDE algorithm introduced in [8 ] , which uses wavelet preconditioning and a quantum linear-system solver to generate a distributed quantum encoding of the solution for the discretized PDE with a query cost independent of the condition number of the original discretized operator.
This favorable query cost, however, does not by itself guarantee an efficient quantum implementation, as the overall cost also depends on the normalization and gate cost of implementing a block encoding of the preconditioned matrix. The algorithm of [8 ] assumes access to a suitably normalized block encoding of the discretized PDE operator, without accounting for the normalization and gate cost associated with constructing such an encoding from the classical specification of a particular PDE. A key technical contribution of our work is that we construct an explicit and efficient block encoding of the wavelet-preconditioned matrix needed by this algorithm. To this end, we exploit the multiscale structure of the wavelet-transformed matrices to achieve a block encoding with a logarithmic normalization and polylogarithmic gate cost in the matrix size. Beyond constructing the required oracles, we make the quantum algorithm for generating the distributed quantum solution state explicit by implementing fixed-point amplitude amplification using a known lower bound on the success probability, and provide a detailed analysis of the computational cost and error of this procedure. These constructions enable an efficient gate-level realization of the algorithm and allow the favorable scaling of its query cost to be translated into the overall gate-cost scaling.
In constructing our algorithm for the biomolecular system, we treat the number of grid points N g N_g N g and the desired algorithmic error ε \varepsilon ε as independent parameters. Here, ε \varepsilon ε denotes the error tolerance in estimating a solution property relative to its ideal value for the discretized problem. It accounts for errors in generating a quantum solution state and estimating the expectation value of the corresponding observable, but not the error in spatial discretization of the continuous PDE. This treatment is motivated by the physical structure of the biomolecular system. Specifically, in spatial discretization of such systems, the grid resolution is constrained by the molecular geometry, particularly by the positions and van der Waals radii of the atoms. Consequently, the grid resolution, characterized by the number of grid points N N N per spatial dimension, is not determined as a function of the desired accuracy ε \varepsilon ε , as is done in [9 ] to control the discretization error for second-order PDEs with constant coefficients. In our application, N N N can thus be much larger than 1 / ε 1/\varepsilon 1/ ε . We therefore treat N g N_g N g and ε \varepsilon ε as separate parameters and analyze the computational cost of our algorithm with respect to both parameters.
We rigorously analyze the gate cost and error of the complete end-to-end algorithm using several methods for property estimation. Our analysis reveals different tradeoffs between circuit size, ancilla count, and the number of circuit runs. In particular, depending on the method used for property estimation, the end-to-end algorithm can be implemented using quantum circuits of size polylogarithmic in both N N N and 1 / ε 1/\varepsilon 1/ ε , but estimating a desired property to accuracy ε \varepsilon ε needs a number of circuit runs that scales quadratically with 1 / ε 1/\varepsilon 1/ ε . Alternatively, methods using larger circuits can reduce the number of runs and achieve an overall gate cost quasilinear in 1 / ε 1/\varepsilon 1/ ε , with the circuit size remaining polylogarithmic in N N N . We also account for the classical preprocessing needed to construct the quantum circuits for the end-to-end algorithm directly from the classical specification of the biomolecular system. We show that, for a fixed number of atoms, the computational cost of this preprocessing is at most polylogarithmic in both N N N and 1 / ε 1/\varepsilon 1/ ε , and therefore does not eliminate the favorable scaling of the gate cost of the quantum algorithm.
Our results thus demonstrate an exponential improvement in scaling with the number of grid points compared with known classical algorithms that solve the same discretized problem. By providing explicit circuit constructions and accounting for their costs, our work establishes a concrete realization of an end-to-end quantum algorithm for a realistic PDE of practical value and provides a foundation for assessing its potential quantum advantage in practice.
Organization. The remainder of the paper organized as follows. We begin § 2 by presenting a general framework for an end-to-end quantum algorithm for differential equations. We first discuss the classical specification of a general linear PDE and introduce a new discrete representation for variable-coefficient PDEs that is suitable for efficient implementation of various oracles of the discretized operator. We then present several algorithmic primitives, which have applications beyond the scope of this work, and provide a detailed analysis of their computational costs. In particular, we present an explicit approach for loading a quantum state onto a quantum register, construct various implementations for different oracular encodings of matrices obtained from discretizing a differential equation, and discuss several methods for estimating properties of a quantum state.
In § 3 , we present our tailored end-to-end quantum algorithm for the LPB equation used in simulating a biomolecular system. We describe this system and develop tailored implementations for preparing the initial state, generating a quantum solution, and estimating properties of interest. We analyze the computational cost of these implementations and provide a detailed cost analysis of the complete end-to-end algorithm. We conclude with a discussion of our results in § 4 . Technical proofs and detailed analyses are provided in the appendices.
End-to-end quantum algorithm for differential equations
An end-to-end quantum algorithm for a PDE accepts classical inputs and returns classical outputs. The classical inputs fully specify the PDE together with the desired properties of its solution, and the classical outputs are estimates of those properties (see Figure 1 ). In § 2.1 , we elaborate the full specification of a general linear PDE and the solution properties that serve as classical inputs for an end-to-end quantum PDE solver. We present a new representation for PDEs with variable coefficients in § 2.3 and discuss how this representation provides a simple and efficient implementation for the oracles of the PDE operator. We then use this representation to implement various oracle encodings of operators in § 2.4 and analyze the cost of these implementations. We conclude in § 2.5 by presenting several approaches for extracting properties of the quantum solution state with a rigorous cost analysis.
Specification of the discretized PDE
When discretized, a differential equation together with its boundary conditions, i.e., a boundary-value problem, becomes a finite-dimensional algebraic problem. For a linear PDE A u ( x ) = b ( x ) \mathcal{A}u(x)=b(x) A u ( x ) = b ( x ) , the discretization leads to a system of linear equations A u = b \mathcal{A}u=b A u = b . The vector u u u contains the discrete degrees of freedom used to represent the approximate solution. These degrees of freedom could be, for example, the values of u ( x ) u(x) u ( x ) at grid points in the finite-difference method, or the unknown expansion coefficients in the spectral or wavelet method, where the solution is expressed as a linear combination of basis functions of a finite-dimensional space. The matrix A A A represents the action of the differential operator A \mathcal{A} A on this space for the chosen discretization, and the vector b b b represents the corresponding discretization of b ( x ) b(x) b ( x ) . The boundary conditions are encoded in the linear system through appropriate modifications to A A A and b b b , for example by adding boundary rows in A A A with the corresponding boundary value in b b b , or by wrap-around entries in A A A for periodic boundary conditions.
The discretized PDE problem is therefore fully specified by the matrix A A A and the vector b b b . Quantum algorithms for PDEs often assume quantum encodings of A A A and b b b are given as input. For the vector b b b , the quantum encoding is often a procedure that prepares a quantum state that encodes elements of b b b on its amplitudes. More specifically, it is assumed that the quantum algorithm takes as an input a procedure P b \mathcal{P}_b P b that prepares the initial state ∣ b ⟩ : = ∑ j b ˉ j ∣ j ⟩ \lvert b\rangle:= \sum_j \bar{b}_j \lvert j\rangle ∣ b ⟩ := ∑ j b ˉ j ∣ j ⟩ with the normalized coefficients b ˉ j : = b j / ∥ b ∥ \bar{b}_j := b_j/\lVert b\rVert b ˉ j := b j / ∥ b ∥ . That is to say, P b P_b P b maps the all-zero state to the state ∣ b ⟩ \lvert b\rangle ∣ b ⟩ . The underlying assumption for the procedure P b P_b P b is that it can be constructed by access to a quantum oracle O b ∣ j ⟩ ∣ 0 ⟩ ↦ ∣ j ⟩ ∣ b ˉ j ⟩ O_b\lvert j\rangle\lvert0\rangle\mapsto\lvert j\rangle\lvert\bar{b}_j\rangle O b ∣ j ⟩ ∣ 0 ⟩ ↦ ∣ j ⟩ ∣ b ˉ j ⟩ that returns coefficients b ˉ j \bar{b}_j b ˉ j of the initial state ∣ b ⟩ \lvert b\rangle ∣ b ⟩ . Having an implementation for this oracle, P b P_b P b can be constructed, for example, using the Grover method [15 ] for quantum-state preparation or by the inequality-test method [16 ] , which significantly reduces the quantum arithmetic cost of the Grover method.
The oracle O b O_b O b or the procedure P b P_b P b can be regarded as a quantum specification of b b b . For an end-to-end algorithm, a classical specification of b b b is needed as input for implementing O b O_b O b and P b P_b P b . In general, b b b needs to be sparse or structured to efficiently prepare the state ∣ b ⟩ \lvert b\rangle ∣ b ⟩ , as otherwise the quantum speedup of a full quantum PDE solver may be eliminated by the cost of the initial-state preparation. The classical specification could be the nonzero entries of b b b if it is sparse or an efficient description of the structure of b b b . For example, if elements of b b b follow a Gaussian distribution, then b b b is fully specified by the mean and standard deviation of the Gaussian distribution, and these parameters will be the classical specification of b b b . In § 3 , we discuss the classical inputs that specify the initial state of the LPB equation and provide a tailored implementation for preparing the initial state.
The common quantum oracle encodings for the matrix A A A are the sparse encoding and the block encoding. The sparse encoding is specified by two quantum oracles that yield the location and the value of nonzero elements in A A A . Specifically, let r ( ℓ , j ) r(\ell,j) r ( ℓ , j ) be a function that returns the row index of the ℓ \ell ℓ th nonzero element in the j j j th column of A A A . The sparse encoding of A A A is then described by two oracles
LOC ∣ ℓ ⟩ ∣ j ⟩ = ∣ ℓ ⟩ ∣ r ( ℓ , j ) ⟩ , VAL ∣ 0 ⟩ ∣ ℓ ⟩ ∣ j ⟩ = R ( θ ( ℓ , j ) ) ∣ 0 ⟩ ∣ ℓ ⟩ ∣ j ⟩ (1) \operatorname{LOC}\lvert\ell\rangle\lvert j\rangle= \lvert\ell\rangle\lvert r(\ell,j)\rangle,\qquad\operatorname{VAL}\lvert0\rangle\lvert\ell\rangle\lvert j\rangle= R(\theta(\ell,j))\lvert0\rangle\lvert\ell\rangle\lvert j\rangle \tag*{(1)} LOC ∣ ℓ ⟩ ∣ j ⟩ = ∣ ℓ ⟩ ∣ r ( ℓ , j )⟩ , VAL ∣ 0 ⟩ ∣ ℓ ⟩ ∣ j ⟩ = R ( θ ( ℓ , j )) ∣ 0 ⟩ ∣ ℓ ⟩ ∣ j ⟩ (1)
where R ( θ ) R(\theta) R ( θ ) is the single-qubit rotation gate around the y y y -axis with angle θ \theta θ , R ( θ ) ∣ 0 ⟩ = cos ( θ / 2 ) ∣ 0 ⟩ + sin ( θ / 2 ) ∣ 1 ⟩ R(\theta)\lvert0\rangle= \cos(\theta/2)\lvert0\rangle+ \sin(\theta/2)\lvert1\rangle R ( θ ) ∣ 0 ⟩ = cos ( θ /2 ) ∣ 0 ⟩ + sin ( θ /2 ) ∣ 1 ⟩ , and where cos ( θ ( ℓ , j ) / 2 ) = A r ( ℓ , j ) , j / ∥ A ∥ max \cos(\theta(\ell,j)/2) = A_{r(\ell,j),j}/\lVert A\rVert_{\max} cos ( θ ( ℓ , j ) /2 ) = A r ( ℓ , j ) , j / ∥ A ∥ m a x with ∥ A ∥ max \lVert A\rVert_{\max} ∥ A ∥ m a x the max norm of a matrix. The location oracle LOC yields the location (i.e., the row index) of the ℓ \ell ℓ th nonzero element in the j j j th column of A A A and the value oracle VAL encodes the value of the nonzero element in the rotation angle of the single-qubit register. The sparse encoding strongly depends on the function r ( ℓ , j ) r(\ell,j) r ( ℓ , j ) , which itself depends on the matrix structure.
In the block encoding, the nonunitary matrix A A A is embedded as a block of a larger unitary matrix as
U A = [ A / α ∗ ∗ ∗ ] (2) U_A = \begin{bmatrix} A/\alpha& * \\ * & * \end{bmatrix} \tag*{(2)} U A = [ A / α ∗ ∗ ∗ ] (2)
where α ≥ ∥ A ∥ \alpha\ge\lVert A\rVert α ≥ ∥ A ∥ , and the blocks denoted by ∗ * ∗ could be any matrix as long as U A U_A U A is a unitary matrix. The block encoding does not need to be exact and can be accurate up to an error ε > 0 \varepsilon> 0 ε > 0 . More specifically, an ( α , a , ε ) (\alpha,a,\varepsilon) ( α , a , ε ) -block-encoding of an n n n -qubit matrix A A A is an ( n + a ) (n+a) ( n + a ) -qubit unitary U A U_A U A such that ∥ A − α ( ( ⟨ 0 a ∣ ⊗ I n ) U A ( ∣ 0 a ⟩ ⊗ I n ) ) ∥ ≤ ε \lVert A-\alpha((\langle0^a\rvert\otimes I_n)U_A(\lvert0^a\rangle\otimes I_n))\rVert\le\varepsilon ∥ A − α ((⟨ 0 a ∣ ⊗ I n ) U A (∣ 0 a ⟩ ⊗ I n ))∥ ≤ ε .
The sparse and block encodings described above provide a quantum specification of the discretized PDE matrix A A A . In practice, however, implementing these encodings requires a suitable classical specification of A A A . The classical specification of A A A is the classical data needed to implement these quantum encodings. The form of this classical specification depends on the structure of A A A . For a banded or sparse matrix with a fixed stencil pattern, it can be the list of distinct nonzero entries and their locations, or an efficiently computable function for generating them. If A A A is represented as a linear combination of Pauli operators, then the relevant classical data is a description of the Pauli strings and their coefficients. More generally, the classical specification should describe A A A in a form that allows efficient implementation of a quantum encoding of A A A . Otherwise, the overhead of constructing the quantum encoding could dominate the overall cost of a quantum PDE solver.
The last step of an end-to-end quantum PDE solver is to extract physically or computationally relevant properties of the solution vector u u u . In general, a solution property can be expressed as the expectation value ⟨ u ∣ M ∣ u ⟩ \langle u|M|u\rangle ⟨ u ∣ M ∣ u ⟩ of a Hermitian operator M M M with respect to the quantum state ∣ u ⟩ |u\rangle ∣ u ⟩ that encodes u u u . The operator M M M encodes the desired property and it is often a physical observable of the system under study. More generally, the desired property can be a function of the solution vector, for example a weighted average of the solution vector. In such cases, the measurement operator M M M is constructed so that its expectation value with respect to ∣ u ⟩ |u\rangle ∣ u ⟩ yields the desired property. Quantum algorithms for estimating expectation values are often based on a quantum encoding of the measurement operator M M M . Therefore, similar to the matrix A A A , a suitable classical specification of M M M is needed to construct this quantum encoding efficiently.
Loading an initial state onto a quantum register: the binary-tree approach
In this section, we present a procedure for loading a general m m m -qubit initial state onto an m m m -qubit quantum register using only a single ancilla qubit. The approach we present here is suitable when the amplitudes of the quantum state are given explicitly as classical data, as in our application later in § 3.2 , not implicitly by a function or an oracle. Specifically, we consider a general m m m -qubit state
∣ ψ ⟩ : = ∑ j = 0 2 m − 1 a j ∣ j ⟩ , ∑ j ∣ a j ∣ 2 = 1 , (3) |\psi\rangle:= \sum_{j=0}^{2^m-1} a_j |j\rangle,\qquad\sum_j |a_j|^2 = 1, \tag*{(3)} ∣ ψ ⟩ := j = 0 ∑ 2 m − 1 a j ∣ j ⟩ , j ∑ ∣ a j ∣ 2 = 1 , (3)
whose amplitudes { a j } \{a_j\} { a j } are given explicitly as an array of numbers. The binary-tree approach we present here provides a quantum circuit for loading this state using only CNOT and single-qubit rotation gates with classically precomputed rotation angles (Figure 2 ). First, we construct the circuit and then show the number of gates in the circuit scales as Θ ( 2 m ) \Theta(2^m) Θ ( 2 m ) . We also present a procedure for classical pre-computation of the rotation angles used in the circuit with a cost of Θ ( 2 m ) \Theta(2^m) Θ ( 2 m ) . This gate cost is expected for loading an arbitrary quantum state; note that just reading the input amplitudes already costs Ω ( 2 m ) \Omega(2^m) Ω ( 2 m ) . However, the construction here gives an explicit quantum circuit and a recipe for computing the angles, and is advantageous for small register size, where m ∈ O ( 1 ) m \in O(1) m ∈ O ( 1 ) or scales logarithmically with some input parameter.
Figure 2. Quantum circuit for loading a general m m m -qubit initial state. (a) The circuit first loads the state with magnitude of the amplitudes using uniformly controlled rotations. The phases of the amplitudes are then added using a uniformly controlled z z z -rotation with angle 2 α j 2\alpha_j 2 α j on an ancilla qubit initiated at ∣ 1 ⟩ \lvert1\rangle ∣ 1 ⟩ . (b) The circuit for loading the four-qubit magnitude state using rotation and CNOT gates; all rotation angles are classically precomputable. (c) An example of a uniformly controlled rotation implemented using an alternating sequence of a single-qubit rotation and CNOT gates.
Writing each amplitude as a j = ∣ a j ∣ exp ( i α j ) a_j = |a_j| \exp(\mathrm{i}\alpha_j) a j = ∣ a j ∣ exp ( i α j ) , we load the state in two steps. In the first step, we load the magnitude state whose amplitudes are { ∣ a j ∣ } \{|a_j|\} { ∣ a j ∣ } . In the second step, we incorporate the phase factors by implementing an operation that maps each basis state as ∣ j ⟩ ↦ exp ( i α j ) ∣ j ⟩ |j\rangle\mapsto\exp(\mathrm{i}\alpha_j)|j\rangle ∣ j ⟩ ↦ exp ( i α j ) ∣ j ⟩ , thereby loading the phases of the original amplitudes.
The magnitude-loading step is based on a binary tree of probability weights. Let us define the probabilities p j : = ∣ a j ∣ 2 p_j := |a_j|^2 p j := ∣ a j ∣ 2 and write the computational basis as ∣ j ⟩ = ∣ j m − 1 ⋯ j 1 j 0 ⟩ |j\rangle= |j_{m-1}\cdots j_1j_0\rangle ∣ j ⟩ = ∣ j m − 1 ⋯ j 1 j 0 ⟩ , where qubits are ordered from right to left, j 0 j_0 j 0 is the least significant bit in binary representation of j j j , and ∣ j ℓ ⟩ |j_\ell\rangle ∣ j ℓ ⟩ is the state of the ℓ \ell ℓ th qubit q ℓ q_\ell q ℓ . Consider a binary tree with m + 1 m+1 m + 1 levels ℓ = 0 , … , m \ell=0,\ldots,m ℓ = 0 , … , m , where the root node of the tree is at the top level ( ℓ = 0 ) (\ell=0) ( ℓ = 0 ) and the leaf nodes of the tree are at the bottom level ( ℓ = m ) (\ell=m) ( ℓ = m ) . At level ℓ < m \ell<m ℓ < m , we set the state of qubit q ℓ q_\ell q ℓ by applying a rotation gate. Let x = x ℓ − 1 ⋯ x 0 x=x_{\ell-1}\cdots x_0 x = x ℓ − 1 ⋯ x 0 be the bitstring of the rightmost ℓ \ell ℓ qubits q ℓ − 1 ⋯ q 0 q_{\ell-1}\cdots q_0 q ℓ − 1 ⋯ q 0 already prepared before level ℓ \ell ℓ ; note that no qubit is prepared at ℓ = 0 \ell=0 ℓ = 0 . We use x = 0 , … , 2 ℓ − 1 x=0,\ldots,2^\ell-1 x = 0 , … , 2 ℓ − 1 as the index of the three nodes at level ℓ \ell ℓ and assign the probability weight
w ( ℓ , x ) = ∑ j : right ℓ bits of j = x p j = ∑ j : j m o d 2 ℓ = x p j (4) w(\ell,x)=\sum_{j:\,\text{right }\ell\text{ bits of }j=x}p_j=\sum_{j:j\bmod2^\ell=x}p_j \tag*{(4)} w ( ℓ , x ) = j : right ℓ bits of j = x ∑ p j = j : j mod 2 ℓ = x ∑ p j (4)
for the node ( ℓ , x ) (\ell,x) ( ℓ , x ) . Here w ( ℓ , x ) w(\ell,x) w ( ℓ , x ) is the total probability weight of all basis states ∣ j ⟩ |j\rangle ∣ j ⟩ whose lower ℓ \ell ℓ bits j ℓ − 1 ⋯ j 0 j_{\ell-1}\cdots j_0 j ℓ − 1 ⋯ j 0 are equal to x x x . For instance, we have nodes x = x 0 ∈ { 0 , 1 } x=x_0\in\{0,1\} x = x 0 ∈ { 0 , 1 } at level ℓ = 1 \ell=1 ℓ = 1 and
w ( 1 , 0 ) = ∑ j : j 0 = 0 p j = ∑ j e v e n p j , w ( 1 , 1 ) = ∑ j : j 0 = 1 p j = ∑ j o d d p j , (5) w(1,0)=\sum_{j:j_0=0}p_j=\sum_{j\ \mathrm{even}}p_j,\qquad w(1,1)=\sum_{j:j_0=1}p_j=\sum_{j\ \mathrm{odd}}p_j, \tag*{(5)} w ( 1 , 0 ) = j : j 0 = 0 ∑ p j = j even ∑ p j , w ( 1 , 1 ) = j : j 0 = 1 ∑ p j = j odd ∑ p j , (5)
where w ( 1 , x 0 ) w(1,x_0) w ( 1 , x 0 ) is the total probability weight of all basis states ∣ j ⟩ |j\rangle ∣ j ⟩ with j 0 = x 0 j_0=x_0 j 0 = x 0 . Nodes at level ℓ = 2 \ell=2 ℓ = 2 are $x=x_1x_0\in { 00 , 01 , 10 , 11 } \{00, 01, 10, 11\} { 00 , 01 , 10 , 11 } , and the probability weights are
w ( 2 , 0 ) = ∑ j : j 1 j 0 = 00 p j , w ( 2 , 1 ) = ∑ j : j 1 j 0 = 01 p j (6) w(2,0)=\sum_{j:j_1j_0=00}p_j,\quad w(2,1)=\sum_{j:j_1j_0=01}p_j \tag*{(6)} w ( 2 , 0 ) = j : j 1 j 0 = 00 ∑ p j , w ( 2 , 1 ) = j : j 1 j 0 = 01 ∑ p j (6)
and so on. Note that the root node has weight w ( 0 , 0 ) = ∑ j p j = 1 w(0,0)=\sum_j p_j=1 w ( 0 , 0 ) = ∑ j p j = 1 , and the leaf nodes have weights equal to the target probabilities, i.e., we have w ( m , j ) = p j w(m,j)=p_j w ( m , j ) = p j .
For each node x x x at level ℓ ≥ 1 \ell\geq1 ℓ ≥ 1 , we use the bitstring x = x ℓ − 1 ⋯ x 0 x=x_{\ell-1}\cdots x_0 x = x ℓ − 1 ⋯ x 0 of the node to define its two children nodes located at level ℓ + 1 \ell+1 ℓ + 1 as 0 x : = x 0x:=x 0 x := x preceded by 0 and 1 x : = x 1x:=x 1 x := x preceded by 1, where 0 x 0x 0 x and 1 x 1x 1 x are ( ℓ + 1 ) (\ell+1) ( ℓ + 1 ) -bit numbers. The indices of these nodes in decimal are x x x and x + 2 ℓ x+2^\ell x + 2 ℓ , and we have the recursive formula
w ( ℓ , x ) = w ( ℓ + 1 , x ) + w ( ℓ + 1 , x + 2 ℓ ) (7) w(\ell,x)=w(\ell+1,x)+w(\ell+1,x+2^\ell) \tag*{(7)} w ( ℓ , x ) = w ( ℓ + 1 , x ) + w ( ℓ + 1 , x + 2 ℓ ) (7)
for the probability weight of the nodes, as the children nodes ( ℓ + 1 , x ) (\ell+1,x) ( ℓ + 1 , x ) and ( ℓ + 1 , x + 2 ℓ ) (\ell+1,x+2^\ell) ( ℓ + 1 , x + 2 ℓ ) partition the probability weight of the parent node ( ℓ , x ) (\ell,x) ( ℓ , x ) based on the next bit x ℓ x_\ell x ℓ (one bit to the left).
Using the probability weights of the nodes, let us now define the rotation angle
θ ( ℓ , x ) = 2 arccos w ( ℓ + 1 , x ) w ( ℓ , x ) (8) \theta(\ell,x)=2\arccos\sqrt{\frac{w(\ell+1,x)}{w(\ell,x)}} \tag*{(8)} θ ( ℓ , x ) = 2 arccos w ( ℓ , x ) w ( ℓ + 1 , x ) (8)
for all ℓ < m \ell<m ℓ < m and x = 0 , … , 2 ℓ − 1 x=0,\ldots,2^\ell-1 x = 0 , … , 2 ℓ − 1 . We set the qubit q ℓ q_\ell q ℓ using a rotation gate that is coherently controlled by previous qubits. Specifically, we apply the y y y -rotation gate R ( θ ( ℓ , x ) ) R(\theta(\ell,x)) R ( θ ( ℓ , x )) on q ℓ q_\ell q ℓ controlled on the state ∣ x ⟩ \lvert x\rangle ∣ x ⟩ of the rightmost ℓ \ell ℓ qubits (note that the gate on q 0 q_0 q 0 is uncontrolled). Let
∣ ψ ( ℓ ) ⟩ : = ∑ x ∈ { 0 , 1 } ℓ w ( ℓ , x ) ∣ 0 ⋯ 0 ⟩ m − ℓ ∣ x ⟩ ℓ (9) \lvert\psi(\ell)\rangle:=\sum_{x\in\{0,1\}^\ell}\sqrt{w(\ell,x)}\lvert0\cdots0\rangle_{m-\ell}\lvert x\rangle_\ell \tag*{(9)} ∣ ψ ( ℓ )⟩ := x ∈ { 0 , 1 } ℓ ∑ w ( ℓ , x ) ∣ 0 ⋯ 0 ⟩ m − ℓ ∣ x ⟩ ℓ (9)
be the state of the m m m -qubit register at level ℓ \ell ℓ before applying the rotation gate. Here w ( ℓ , x ) \sqrt{w(\ell,x)} w ( ℓ , x ) is the amplitude of the basis state ∣ 0 ⋯ 0 x ⟩ \lvert0\cdots0x\rangle ∣ 0 ⋯ 0 x ⟩ whose rightmost ℓ \ell ℓ bits are x x x and whose leftmost m − ℓ m-\ell m − ℓ bits are all zero. After the rotation gate, the state of qubit q ℓ q_\ell q ℓ is transformed as
∣ 0 ⟩ ∣ x ⟩ ℓ ↦ ( cos ( θ ( ℓ , x ) / 2 ) ∣ 0 ⟩ + sin ( θ ( ℓ , x ) / 2 ) ∣ 1 ⟩ ) ∣ x ⟩ ℓ (10) \lvert0\rangle\lvert x\rangle_\ell\mapsto\left(\cos(\theta(\ell,x)/2)\lvert0\rangle+\sin(\theta(\ell,x)/2)\lvert1\rangle\right)\lvert x\rangle_\ell \tag*{(10)} ∣ 0 ⟩ ∣ x ⟩ ℓ ↦ ( cos ( θ ( ℓ , x ) /2 ) ∣ 0 ⟩ + sin ( θ ( ℓ , x ) /2 ) ∣ 1 ⟩ ) ∣ x ⟩ ℓ (10)
and the amplitude of the basis state is split as
w ( ℓ , x ) ∣ 0 ⋯ 0 ⟩ m − ℓ ∣ x ⟩ ℓ ↦ ∑ x ℓ ∈ { 0 , 1 } w ( ℓ + 1 , x + x ℓ 2 ℓ ) ∣ 0 ⋯ 0 ⟩ m − ℓ − 1 ∣ x ℓ x ⟩ ℓ + 1 (11) \sqrt{w(\ell,x)}\lvert0\cdots0\rangle_{m-\ell}\lvert x\rangle_\ell\mapsto\sum_{x_\ell\in\{0,1\}}\sqrt{w(\ell+1,x+x_\ell2^\ell)}\lvert0\cdots0\rangle_{m-\ell-1}\lvert x_\ell x\rangle_{\ell+1} \tag*{(11)} w ( ℓ , x ) ∣ 0 ⋯ 0 ⟩ m − ℓ ∣ x ⟩ ℓ ↦ x ℓ ∈ { 0 , 1 } ∑ w ( ℓ + 1 , x + x ℓ 2 ℓ ) ∣ 0 ⋯ 0 ⟩ m − ℓ − 1 ∣ x ℓ x ⟩ ℓ + 1 (11)
by the definition of θ ( ℓ , x ) \theta(\ell,x) θ ( ℓ , x ) . Therefore, the state ∣ ψ ( ℓ + 1 ) ⟩ \lvert\psi(\ell+1)\rangle ∣ ψ ( ℓ + 1 )⟩ is obtained after the rotation gate at level ℓ \ell ℓ . By induction, we have the state ∣ ψ ( m ) ⟩ \lvert\psi(m)\rangle ∣ ψ ( m )⟩ after the rotation at level m − 1 m-1 m − 1 , where each basis state ∣ j ⟩ \lvert j\rangle ∣ j ⟩ with the full bitstring j = j m − 1 ⋯ j 0 j=j_{m-1}\cdots j_0 j = j m − 1 ⋯ j 0 will have the amplitude w ( m , j ) = p j = ∣ a j ∣ \sqrt{w(m,j)}=\sqrt{p_j}=\lvert a_j\rvert w ( m , j ) = p j = ∣ a j ∣ .
Loading the magnitude state is therefore achieved by applying a sequence of uniformly controlled rotations as shown in Figure 2 . Specifically, we apply the y y y -rotation gate R ( θ ( ℓ , x ) ) R(\theta(\ell,x)) R ( θ ( ℓ , x )) at level ℓ = 0 , … , m − 1 \ell=0,\ldots,m-1 ℓ = 0 , … , m − 1 controlled on the state ∣ x ⟩ \lvert x\rangle ∣ x ⟩ of previously prepared ℓ \ell ℓ qubits. Each uniformly controlled rotation gate with ℓ \ell ℓ control qubits can be implemented by Θ ( 2 ℓ ) \Theta(2^\ell) Θ ( 2 ℓ ) single-qubit rotations and CNOT gates [17 ] , so the total gate cost of loading the magnitude state is ∑ ℓ O ( 2 ℓ ) = O ( 2 m ) \sum_\ell O(2^\ell)=O(2^m) ∑ ℓ O ( 2 ℓ ) = O ( 2 m ) . This described approach is closely related to the probability-splitting idea used in the Grover-Rudolph method for state preparation [15 ] . However, the approach presented here gives an explicit and implementable quantum circuit using only CNOTs and single-qubit rotation gates.
Classical precomputation of the angles. We use the binary tree of probability weights to precompute the rotation angles classically before running the quantum circuit. To this end, we start from the leaves of the tree with weights w ( m , j ) = p j w(m,j)=p_j w ( m , j ) = p j and recursively compute the weights of the internal nodes from leaves upward to the tree root. Specifically, we use Eq. (7) to compute w ( ℓ , x ) w(\ell,x) w ( ℓ , x ) for ℓ = m − 1 , … , 0 \ell=m-1,\ldots,0 ℓ = m − 1 , … , 0 and each x = 0 , … , 2 ℓ − 1 x=0,\ldots,2^\ell-1 x = 0 , … , 2 ℓ − 1 . As the tree has 2 m − 1 2^m-1 2 m − 1 internal nodes, computing all weights costs Θ ( 2 m ) \Theta(2^m) Θ ( 2 m ) . Using the weights, we then compute the rotation angle for each node by Eq. (8) . Therefore, the cost of computing the angles of the uniformly controlled rotation gates is O ( 2 m ) O(2^m) O ( 2 m ) .
To decompose each uniformly controlled rotation gate into single-qubit rotations and CNOT gates, an additional classical computation is needed. A uniformly controlled rotation with ℓ \ell ℓ control qubits has 2 ℓ 2^\ell 2 ℓ conditional rotation angles. Following the construction in Ref. [17 ] , the angles of the single-qubit rotations in the decomposition are obtained by applying a Walsh–Hadamard transform to the vector of the conditional rotation angles. Using the fast Walsh–Hadamard transform, this operation costs Θ ( ℓ 2 ℓ ) \Theta(\ell2^\ell) Θ ( ℓ 2 ℓ ) for a uniformly controlled rotation with ℓ \ell ℓ control qubits. Summing over all levels (ℓ = 0 , … , m − 1 \ell= 0, \ldots, m - 1 ℓ = 0 , … , m − 1 ) we obtain ∑ ℓ Θ ( ℓ 2 ℓ ) = Θ ( m 2 m ) \sum_{\ell}\Theta(\ell2^\ell) = \Theta(m2^m) ∑ ℓ Θ ( ℓ 2 ℓ ) = Θ ( m 2 m ) for the cost of computing the angles. The overall cost of the classical precomputation is therefore Θ ( m 2 m ) \Theta(m2^m) Θ ( m 2 m ) .
Phase factors. We have so far described loading the magnitude state. To add the phase factors, we use an ancilla qubit initialized in ∣ 1 ⟩ \lvert1\rangle ∣ 1 ⟩ state and apply the map ∣ 1 ⟩ ∣ j ⟩ ↦ exp ( i α j ) ∣ 1 ⟩ ∣ j ⟩ \lvert1\rangle\lvert j\rangle\mapsto\exp(i\alpha_j)\lvert1\rangle\lvert j\rangle ∣ 1 ⟩ ∣ j ⟩ ↦ exp ( i α j ) ∣ 1 ⟩ ∣ j ⟩ . This map can be achieved by applying the z z z -rotation gate R z ( 2 α j ) : = diag ( e − i α j , e i α j ) R_z(2\alpha_j) := \operatorname{diag}(e^{-i\alpha_j}, e^{i\alpha_j}) R z ( 2 α j ) := diag ( e − i α j , e i α j ) on the ancilla qubit, uniformly controlled by the m m m -qubit register being in the state ∣ j ⟩ \lvert j\rangle ∣ j ⟩ . As before, this uniformly controlled rotation can be decomposed into Θ ( 2 m ) \Theta(2^m) Θ ( 2 m ) single-qubit rotations and CNOT gates [17 ] . Therefore, the gate cost for adding the phase factors to the magnitude state scales as Θ ( 2 m ) \Theta(2^m) Θ ( 2 m ) . The additional classical precomputation of the rotation angles used in implementing the phase factors has the same scaling Θ ( m 2 m ) \Theta(m2^m) Θ ( m 2 m ) as in the classical precomputation of the magnitude-loading step.
Finally, we note that if the amplitudes a j a_j a j are signed real numbers, the phase factors are ± 1 \pm1 ± 1 . In this case, we can apply the Z Z Z gate on the ancilla qubit, controlled on basis state ∣ j ⟩ \lvert j\rangle ∣ j ⟩ for which a j < 0 a_j < 0 a j < 0 . If only a small fraction of the amplitudes are negative, direct application of the multi-controlled Z Z Z gates may be simpler than implementing the uniformly controlled rotation.
Discrete representation for PDEs with variable coefficients
We now provide a new discrete representation for variable-coefficient PDEs. The discrete representation we discuss here is suitable for implementing the oracles that specify the discretized differential operator of the PDE. We consider PDEs of the form
L u ( x ) = − ∇ ⋅ ( ε ( x ) ∇ u ( x ) ) + k ( x ) u ( x ) = b ( x ) ∀ x ∈ Ω = ( 0 , L ) d (12) \mathcal{L}u(x)=-\nabla\cdot\left(\varepsilon(x)\nabla u(x)\right)+k(x)u(x)=b(x)\quad\forall x\in\Omega=(0,L)^d \tag*{(12)} L u ( x ) = − ∇ ⋅ ( ε ( x ) ∇ u ( x ) ) + k ( x ) u ( x ) = b ( x ) ∀ x ∈ Ω = ( 0 , L ) d (12)
where ε ( x ) \varepsilon(x) ε ( x ) and k ( x ) k(x) k ( x ) are variable coefficients of the differential operator L \mathcal{L} L . For convenience, we take the domain Ω \Omega Ω as a hypercube with side length L L L and consider periodic boundary conditions. However, the analysis below can be generalized to a hyperrectangle domain and to Dirichlet or Neumann boundary conditions.
We discretize the domain on a staggered uniform grid with periodic boundaries. This grid has two types of uniformly spaced points: node points and face points (see Figure 7 ). We use N N N node points with spacing h = L / N h=L/N h = L / N for each dimension. The node points are used to store the value of the solution u ( x ) u(x) u ( x ) and any variable coefficients that are multiplied to u ( x ) u(x) u ( x ) . The face points are located at the midpoint between two node points and are used to store the variable coefficients that are multiplied to ∇ u ( x ) \nabla u(x) ∇ u ( x ) .
Figure 7. Examples of small (acetamide), medium (Crambin), and large (lysozyme) biomolecule typically used in PBE solvers. The bottom panel shows the staggered grid used for discretization. The biomolecule is inside the cavity shown by dotted loop.
We begin with the 1D case and then extend the analysis to higher dimensions. In 1D, the node points are x j = j h x_j=jh x j = j h and the face points are x j + 1 / 2 ∀ j ∈ { 0 , … , N − 1 } x_{j+1/2}\ \forall j\in\{0,\ldots,N-1\} x j + 1/2 ∀ j ∈ { 0 , … , N − 1 } . The solution u ( x ) u(x) u ( x ) and the coefficient k ( x ) k(x) k ( x ) on node points are u j = u ( x j ) u_j=u(x_j) u j = u ( x j ) and k j = k ( x j ) k_j=k(x_j) k j = k ( x j ) , respectively, and the coefficient ε ( x ) \varepsilon(x) ε ( x ) on face points are ε j + 1 / 2 : = ε ( x j + 1 / 2 ) \varepsilon_{j+1/2}:=\varepsilon(x_{j+1/2}) ε j + 1/2 := ε ( x j + 1/2 ) . The discrete derivative at the face point j + 1 / 2 j+1/2 j + 1/2 is
( ∇ u ) j + 1 / 2 ≈ ( D u ) j + 1 / 2 = 1 h ( u j + 1 − u j ) . (13) (\nabla u)_{j+1/2}\approx(Du)_{j+1/2}=\frac{1}{h}(u_{j+1}-u_j). \tag*{(13)} ( ∇ u ) j + 1/2 ≈ ( D u ) j + 1/2 = h 1 ( u j + 1 − u j ) . (13)
From this expression, the discrete derivative matrix on the grid whit periodic boundaries is
D = 1 h ( S † − 1 ) , S ∣ j ⟩ : = ∣ j + 1 mod N ⟩ , (14) D=\frac{1}{h}(S^\dagger-\mathbb{1}),\quad S\lvert j\rangle:=\lvert j+1\mathbin{\operatorname{mod}}N\rangle, \tag*{(14)} D = h 1 ( S † − 1 ) , S ∣ j ⟩ := ∣ j + 1 mod N ⟩ , (14)
where S S S is the cyclic shift matrix that shifts the basis vector ∣ j ⟩ \lvert j\rangle ∣ j ⟩ as above. Note that the discrete derivative is second-order accurate at face points. To see this, we use the Taylor expansion of u ( x ) u(x) u ( x ) around the face point x m x_m x m with m = j + 1 / 2 m=j+1/2 m = j + 1/2 as
u j + 1 = u ( x m + h / 2 ) = u ( x m ) + ( h / 2 ) u ′ ( x m ) + ( h 2 / 8 ) u ′ ′ ( x m ) + O ( h 3 ) (15) u_{j+1}=u(x_m+h/2)=u(x_m)+(h/2)u'(x_m)+(h^2/8)u''(x_m)+O(h^3) \tag*{(15)} u j + 1 = u ( x m + h /2 ) = u ( x m ) + ( h /2 ) u ′ ( x m ) + ( h 2 /8 ) u ′′ ( x m ) + O ( h 3 ) (15)
u j = u ( x m − h / 2 ) = u ( x m ) − ( h / 2 ) u ′ ( x m ) + ( h 2 / 8 ) u ′ ′ ( x m ) + O ( h 3 ) , (16) u_j=u(x_m-h/2)=u(x_m)-(h/2)u'(x_m)+(h^2/8)u''(x_m)+O(h^3), \tag*{(16)} u j = u ( x m − h /2 ) = u ( x m ) − ( h /2 ) u ′ ( x m ) + ( h 2 /8 ) u ′′ ( x m ) + O ( h 3 ) , (16)
so the discrete derivative is second-order accurate at face points; that is, ( D u ) j + 1 / 2 = u ′ ( x j + 1 / 2 ) + O ( h 2 ) (Du)_{j+1/2}=u'(x_{j+1/2})+O(h^2) ( D u ) j + 1/2 = u ′ ( x j + 1/2 ) + O ( h 2 ) . As D D D is the discrete version of ∇ \nabla ∇ , the discrete version of − ∇ -\nabla − ∇ is simply D T D^T D T . The discrete version of the differential operator L \mathcal{L} L in 1D is then the matrix
A : = D T E D + K , (17) A:=D^TED+K, \tag*{(17)} A := D T E D + K , (17)
with the diagonal matrices
E = diag ( ε 1 / 2 , … , ε N − 1 / 2 ) , K = diag ( k 0 , … , k N − 1 ) , (18) E=\operatorname{diag}(\varepsilon_{1/2},\ldots,\varepsilon_{N-1/2}),\quad K=\operatorname{diag}(k_0,\ldots,k_{N-1}), \tag*{(18)} E = diag ( ε 1/2 , … , ε N − 1/2 ) , K = diag ( k 0 , … , k N − 1 ) , (18)
where E E E encodes the value of ε ( x ) \varepsilon(x) ε ( x ) on the face points and K K K encodes the value of k ( x ) k(x) k ( x ) on the node points. Specifically, for each node point j j j we have
( L u ( x ) ) j ≈ ( A u ) j = 1 h 2 ( − ε j − 1 / 2 u j − 1 + ( ε j − 1 / 2 + ε j + 1 / 2 ) u j − ε j + 1 / 2 u j + 1 ) + k j u j . (19) (\mathcal{L}u(x))_j\approx(Au)_j=\frac{1}{h^2}\left(-\varepsilon_{j-1/2}u_{j-1}+(\varepsilon_{j-1/2}+\varepsilon_{j+1/2})u_j-\varepsilon_{j+1/2}u_{j+1}\right)+k_ju_j. \tag*{(19)} ( L u ( x ) ) j ≈ ( A u ) j = h 2 1 ( − ε j − 1/2 u j − 1 + ( ε j − 1/2 + ε j + 1/2 ) u j − ε j + 1/2 u j + 1 ) + k j u j . (19)
Observe that when ε ( x ) = c \varepsilon(x)=c ε ( x ) = c is constant, we have A = − ( c / h 2 ) TRIDIAG ( 1 , − 2 , 1 ) + K A=-(c/h^2)\operatorname{TRIDIAG}(1,-2,1)+K A = − ( c / h 2 ) TRIDIAG ( 1 , − 2 , 1 ) + K , where TRIDIAG ( 1 , − 2 , 1 ) \operatorname{TRIDIAG}(1,-2,1) TRIDIAG ( 1 , − 2 , 1 ) is the familiar tridiagonal matrix form of the 1D Laplacian in the central finite-difference method.
For the higher-dimensional problems, we use row-major ordering to label the Cartesian coordinates of the grid points by a 1D index. In 2D, this means we label the node ( i , j ) (i,j) ( i , j ) by the 1D index ℓ = i + N j \ell=i+Nj ℓ = i + N j , which corresponds to ordering grid points from left to right within each row, and rows from bottom to top. With this ordering, the discrete 2D Laplacian has the known form L 2 D = 1 N ⊗ L 1 D + L 1 D ⊗ 1 N L_{2D}=\mathbb{1}_N\otimes L_{1D}+L_{1D}\otimes\mathbb{1}_N L 2 D = 1 N ⊗ L 1 D + L 1 D ⊗ 1 N . For our variable-coefficient operator L \mathcal{L} L in 2D, the discretized operator is
A : = D x T E x D x + D y T E y D y + K (20) A:=D_x^TE_xD_x+D_y^TE_yD_y+K \tag*{(20)} A := D x T E x D x + D y T E y D y + K (20)
with
D x = 1 N ⊗ D , D y = D ⊗ 1 N . (21) D_x=\mathbb{1}_N\otimes D,\quad D_y=D\otimes\mathbb{1}_N. \tag*{(21)} D x = 1 N ⊗ D , D y = D ⊗ 1 N . (21)
Here E x E_x E x and E y E_y E y are diagonal matrices that encode the value of ε ( x , y ) \varepsilon(x,y) ε ( x , y ) on face points and K K K is the diagonal matrix that encodes the value of k ( x , y ) k(x,y) k ( x , y ) on node points; i.e.,
( E x ) ℓ ℓ = ε i + 1 / 2 , j , ( E y ) ℓ ℓ = ε i , j + 1 / 2 , K ℓ ℓ = k i , j for ℓ = i + N j . (22) (E_x)_{\ell\ell}=\varepsilon_{i+1/2,j},\quad(E_y)_{\ell\ell}=\varepsilon_{i,j+1/2},\quad K_{\ell\ell}=k_{i,j}\ \text{for }\ell=i+Nj. \tag*{(22)} ( E x ) ℓℓ = ε i + 1/2 , j , ( E y ) ℓℓ = ε i , j + 1/2 , K ℓℓ = k i , j for ℓ = i + N j . (22)
For the 3D problem, we label the node ( i , j , k ) (i,j,k) ( i , j , k ) by the 1D index ℓ = i + N ( j + N k ) \ell= i + N(j + Nk) ℓ = i + N ( j + N k ) . The discretized L \mathcal{L} L in 3D becomes
A : = D x T E x D x + D y T E y D y + D z T E z D z + K , (23) A := D_x^T E_x D_x + D_y^T E_y D_y + D_z^T E_z D_z + K, \tag*{(23)} A := D x T E x D x + D y T E y D y + D z T E z D z + K , (23)
where
D x = 1 N ⊗ 1 N ⊗ D , D y = 1 N ⊗ D ⊗ 1 N , D z = D ⊗ 1 N ⊗ 1 N , (24) D_x = \mathbb{1}_N \otimes\mathbb{1}_N \otimes D,\quad D_y = \mathbb{1}_N \otimes D \otimes\mathbb{1}_N,\quad D_z = D \otimes\mathbb{1}_N \otimes\mathbb{1}_N, \tag*{(24)} D x = 1 N ⊗ 1 N ⊗ D , D y = 1 N ⊗ D ⊗ 1 N , D z = D ⊗ 1 N ⊗ 1 N , (24)
and the diagonal matrices are
( E x ) ℓ ℓ = ε i + 1 / 2 , j , k , ( E y ) ℓ ℓ = ε i , j + 1 / 2 , k , ( E z ) ℓ ℓ = ε i , j , k + 1 / 2 , K ℓ ℓ = k i , j , k for ℓ = i + N ( j + N k ) . (25) (E_x)_{\ell\ell} = \varepsilon_{i+1/2,j,k},\quad(E_y)_{\ell\ell} = \varepsilon_{i,j+1/2,k},\quad(E_z)_{\ell\ell} = \varepsilon_{i,j,k+1/2},\quad K_{\ell\ell} = k_{i,j,k}\ \text{for}\ \ell= i + N(j + Nk). \tag*{(25)} ( E x ) ℓℓ = ε i + 1/2 , j , k , ( E y ) ℓℓ = ε i , j + 1/2 , k , ( E z ) ℓℓ = ε i , j , k + 1/2 , K ℓℓ = k i , j , k for ℓ = i + N ( j + N k ) . (25)
The discrete representation of the d d d -dimensional problem with d > 3 d > 3 d > 3 follows similarly.
Oracle implementations for differential operators
Here we present several approaches for implementing sparse and block encodings of matrices obtained from discretizing differential operators and analyze their gate costs and ancilla qubit requirements. We begin with implementing sparse encoding of Toeplitz matrices, which frequently arise in the discretization of differential operators with constant coefficients. We then present several approaches for constructing a block encoding of these matrices. Finally, we utilize our discrete representation of variable-coefficient differentiation operators and construct block encodings for this class of operators.
Sparse encoding for Toeplitz matrices
A Toeplitz matrix is a matrix whose entries are constant along each diagonal. Formally, an N × N N \times N N × N matrix A = [ A i j ] A = [A_{ij}] A = [ A ij ] is Toeplitz if A i j = A i − 1 , j − 1 A_{ij} = A_{i-1,j-1} A ij = A i − 1 , j − 1 , or equivalently if A i j = a i − j A_{ij} = a_{i-j} A ij = a i − j for some sequence { a m } \{a_m\} { a m } of constant values. We consider Toeplitz matrices of the form
A = ( a 0 a − 1 ⋯ a − w a w − N ⋯ a 1 − N a 1 a 0 a − 1 ⋱ ⋮ ⋮ ⋱ ⋱ ⋱ a w − N a w ⋱ a 0 ⋱ a − w ⋱ ⋱ ⋱ ⋱ a w ⋱ a 0 ⋱ a − w a N − w ⋱ ⋱ ⋮ ⋮ ⋱ a 1 a 0 a − 1 a N − 1 ⋯ a N − w a w ⋯ a 1 a 0 ) , (26) A =
\begin{pmatrix}
a_0 & a_{-1} & \cdots& a_{-w} & & a_{w-N} & \cdots& a_{1-N} \\
a_1 & a_0 & a_{-1} & & \ddots& & & \vdots\\
\vdots& \ddots& \ddots& \ddots& & & & a_{w-N} \\
a_w & & \ddots& a_0 & \ddots& a_{-w} & & \\
& \ddots& & \ddots& \ddots& & \ddots& \\
& & a_w & & \ddots& a_0 & \ddots& a_{-w} \\
a_{N-w} & & & & & \ddots& \ddots& \vdots\\
\vdots& \ddots& & & & & a_1 & a_0 & a_{-1} \\
a_{N-1} & \cdots& a_{N-w} & & & a_w & \cdots& a_1 & a_0
\end{pmatrix}, \tag*{(26)} A = a 0 a 1 ⋮ a w a N − w ⋮ a N − 1 a − 1 a 0 ⋱ ⋱ ⋱ ⋯ ⋯ a − 1 ⋱ ⋱ a w a N − w a − w ⋱ a 0 ⋱ ⋱ ⋱ ⋱ ⋱ a w − N a − w a 0 ⋱ a w ⋯ ⋱ ⋱ ⋱ a 1 ⋯ a 1 − N ⋮ a w − N a − w ⋮ a 0 a 1 a − 1 a 0 , (26)
where 2 w + 1 ≤ N 2w + 1 \le N 2 w + 1 ≤ N . For cases where w w w is a constant, we have a banded Toeplitz matrix, which arises naturally in the discretization of differential operators. The sparse encoding we construct here applies to any valid w w w and is not limited to banded matrices. We refer to the bands on the top-right and bottom-left corners of A A A as the boundary bands, and the bands in the middle as the interior bands.
We exploit the structure of this matrix to construct the location and value oracles of the sparse encoding in Eq. (1) . Note that the location of a nonzero entry is independent of its value. We utilize this feature in constructing the location oracle. Specifically, to construct this oracle, we treat the matrix as if it is a periodic matrix (note that we are not assuming the matrix is periodic) and use the signed integer b ∈ { − w , … , 0 , … , w } b \in\{-w,\ldots,0,\ldots,w\} b ∈ { − w , … , 0 , … , w } as the index for bands of the matrix with cyclic location. We use b = 0 b = 0 b = 0 for the main diagonal with the constant a 0 a_0 a 0 ; b > 0 b > 0 b > 0 for the b b b th band below the main diagonal with the constant a b a_b a b and the band in the top-right corner with the constant a b − N a_{b-N} a b − N ; and b < 0 b < 0 b < 0 for the ∣ b ∣ |b| ∣ b ∣ th band above the main diagonal with the constant a − ∣ b ∣ a_{-|b|} a − ∣ b ∣ and the band in the bottom-left corner with the constant a N − ∣ b ∣ a_{N-|b|} a N − ∣ b ∣ . With this cyclic indexing for bands, the row index r ( b , j ) r(b,j) r ( b , j ) (i.e., the location of the nonzero value in a given column index j j j and band index b b b is
r ( b , j ) = { j + b 0 ≤ j + b < N (interior bands) j + b − N b > 0 and j + b ≥ N (top-right bands) j − ∣ b ∣ + N b < 0 and j + b < 0 (bottom-left bands) . (27) r(b,j) =
\begin{cases}
j+b & 0 \le j+b < N \quad\text{(interior bands)} \\
j+b-N & b > 0\ \text{and}\ j+b \ge N \quad\text{(top-right bands)} \\
j-|b|+N & b < 0\ \text{and}\ j+b < 0 \quad\text{(bottom-left bands)}.
\end{cases} \tag*{(27)} r ( b , j ) = ⎩ ⎨ ⎧ j + b j + b − N j − ∣ b ∣ + N 0 ≤ j + b < N (interior bands) b > 0 and j + b ≥ N (top-right bands) b < 0 and j + b < 0 (bottom-left bands) . (27)
which simplifies to r ( b , j ) = ( j + b ) m o d N r(b,j)=(j+b)\bmod N r ( b , j ) = ( j + b ) mod N . The location oracle is then
LOC ∣ b ⟩ ∣ j ⟩ = ∣ b ⟩ ∣ ( j + b ) m o d N ⟩ , (28) \operatorname{LOC}|b\rangle|j\rangle=|b\rangle|(j+b)\bmod N\rangle, \tag*{(28)} LOC ∣ b ⟩ ∣ j ⟩ = ∣ b ⟩ ∣ ( j + b ) mod N ⟩ , (28)
where the band register with the state ∣ b ⟩ |b\rangle ∣ b ⟩ has m = ⌈ log 2 ( 2 w + 1 ) ⌉ m=\lceil\log_{2}(2w+1)\rceil m = ⌈ log 2 ( 2 w + 1 )⌉ qubits (∀ w ≥ 1 \forall w\ge1 ∀ w ≥ 1 ) and encodes the signed integer b b b , and the data register with the state ∣ j ⟩ |j\rangle ∣ j ⟩ has n n n qubits (N = 2 n N=2^{n} N = 2 n ). This oracle then can be implemented by applying modular addition of two registers. However, we use a bit-weighted method to implement this addition for banded matrices (where w w w is a constant number and so m ≪ n m\ll n m ≪ n ) that typically arise in the discretization. In this method, we use the two’s complement binary representation2
b = ∑ k = 0 m − 2 2 k b k − 2 m − 1 b m − 1 (29) b=\sum_{k=0}^{m-2}2^{k}b_{k}-2^{m-1}b_{m-1} \tag*{(29)} b = k = 0 ∑ m − 2 2 k b k − 2 m − 1 b m − 1 (29)
of the m m m -bit number b b b to implement the location oracle as a product of bit-controlled constant additions. Specifically, let
CADD ( a ) ∣ b k ⟩ ∣ j ⟩ : = ∣ b k ⟩ ∣ j + b k a m o d N ⟩ (30) \operatorname{CADD}(a)|b_k\rangle|j\rangle:=|b_k\rangle|j+b_ka\bmod N\rangle \tag*{(30)} CADD ( a ) ∣ b k ⟩ ∣ j ⟩ := ∣ b k ⟩ ∣ j + b k a mod N ⟩ (30)
be the controlled-addition operation that adds the constant a a a to j j j controlled on the bit value b k b_k b k , then
LOC = ( ∏ k = 0 m − 2 CADD ( + 2 k ) ) CADD ( − 2 m − 1 ) , (31) \operatorname{LOC}=\left(\prod_{k=0}^{m-2}\operatorname{CADD}(+2^{k})\right)\operatorname{CADD}(-2^{m-1}), \tag*{(31)} LOC = ( k = 0 ∏ m − 2 CADD ( + 2 k ) ) CADD ( − 2 m − 1 ) , (31)
from which we obtain the quantum circuit in Figure 3 (b) for implementing the location oracle.
Figure 3. Quantum circuits for implementing the value and location oracles in the sparse encoding of Toeplitz matrices.
To implement the value oracle, note that the nonzero values of A A A depend only on the band index b b b . However, as we used a cyclic indexing for bands, care must be taken for the boundary bands. To this end, we use the function
f ( b , j ) = { 0 , 0 ≤ j + b < N 1 , b > 0 and j ˉ < b 1 , b < 0 and j < ∣ b ∣ (32) f(b,j)=
\begin{cases}
0, & 0\le j+b<N\\
1, & b>0\ \text{and}\ \bar{j}<b\\
1, & b<0\ \text{and}\ j<|b|
\end{cases} \tag*{(32)} f ( b , j ) = ⎩ ⎨ ⎧ 0 , 1 , 1 , 0 ≤ j + b < N b > 0 and j ˉ < b b < 0 and j < ∣ b ∣ (32)
as a flag to indicate if the band b b b in column j j j is an interior or boundary band. Here j ˉ = N − 1 − j \bar{j}=N-1-j j ˉ = N − 1 − j is the bitwise complement of j j j , which is achieved by applying bitwise NOT on bits of j j j (NOT gate on each qubit of ∣ j ⟩ |j\rangle ∣ j ⟩ ). The value oracle is then implemented by applying a y y y -rotation gate on the ancilla qubit with an appropriate rotation angle based on values of f f f and b b b . Specifically, we perform the multi-controlled rotation
CROT : ∣ 0 ⟩ a ∣ f ⟩ ∣ b ⟩ ↦ R y ( θ ( f , b ) ) ∣ 0 ⟩ a ∣ f ⟩ ∣ b ⟩ (33) \operatorname{CROT}:|0\rangle_{a}|f\rangle|b\rangle\mapsto R_y(\theta(f,b))|0\rangle_{a}|f\rangle|b\rangle \tag*{(33)} CROT : ∣0 ⟩ a ∣ f ⟩ ∣ b ⟩ ↦ R y ( θ ( f , b )) ∣0 ⟩ a ∣ f ⟩ ∣ b ⟩ (33)
controlled on the values of f f f and b b b , with the rotation angle
θ ( f , b ) = { 2 arccos ( a b / β ) , f = 0 2 arccos ( a b − N / β ) , f = 1 and b > 0 2 arccos ( a b + N / β ) , f = 1 and b < 0 (34) \theta(f,b)=
\begin{cases}
2\arccos(a_b/\beta), & f=0\\
2\arccos(a_{b-N}/\beta), & f=1\ \text{and}\ b>0\\
2\arccos(a_{b+N}/\beta), & f=1\ \text{and}\ b<0
\end{cases} \tag*{(34)} θ ( f , b ) = ⎩ ⎨ ⎧ 2 arccos ( a b / β ) , 2 arccos ( a b − N / β ) , 2 arccos ( a b + N / β ) , f = 0 f = 1 and b > 0 f = 1 and b < 0 (34)
where β = ∥ A ∥ max = max d ∣ a d ∣ \beta=\lVert A\rVert_{\max}=\max_d|a_d| β = ∥ A ∥ m a x = max d ∣ a d ∣ is the maximum magnitude of diagonals in A A A . Let ∣ f , b ⟩ : = ∣ f ⟩ ∣ b ⟩ |f,b\rangle:=|f\rangle|b\rangle ∣ f , b ⟩ := ∣ f ⟩ ∣ b ⟩ , then notice that
CROT = ∑ b , f R y ( θ ( f , b ) ) ⊗ ∣ f , b ⟩ ⟨ f , b ∣ (35) \operatorname{CROT}=\sum_{b,f}R_y(\theta(f,b))\otimes|f,b\rangle\langle f,b| \tag*{(35)} CROT = b , f ∑ R y ( θ ( f , b )) ⊗ ∣ f , b ⟩ ⟨ f , b ∣ (35)
is simply a uniformly controlled rotation over the joint control register comprised of the flag and band registers. That is, we treat these registers as an address register for selecting one angle. As shown in Figure 2 (c), this uniformly controlled rotation can be decomposed into an alternating sequence of CNOT and single-controlled rotation gates.
The value oracle thus can be implemented by computing the flag bit f f f , performing CROT and uncomputing f f f . We use a comparator operation to compute the flag. Let us write ∣ b ⟩ = ∣ s ⟩ ∣ x ⟩ |b\rangle=|s\rangle|x\rangle ∣ b ⟩ = ∣ s ⟩ ∣ x ⟩ , where s s s is the sign bit of b b b in two’s complement and the lower r = m − 1 r=m-1 r = m − 1 bits of b b b contain the integer x = 2 r − ∣ b ∣ x=2^{r}-|b| x = 2 r − ∣ b ∣ . Then we compute the flag by the following steps.
Temporarily turn j j j into its bitwise complement j ˉ \bar{j} j ˉ if b > 0 b>0 b > 0 . This is achieved by applying qubitwise NOT on qubits of ∣ j ⟩ |j\rangle ∣ j ⟩ controlled on s = 0 s=0 s = 0 . We then have ∣ j ⟩ ↦ ∣ u s ( j ) ⟩ |j\rangle\mapsto|u_s(j)\rangle ∣ j ⟩ ↦ ∣ u s ( j )⟩ , where u s ( j ) = j ˉ u_s(j)=\bar{j} u s ( j ) = j ˉ if s = 0 s=0 s = 0 and u s ( j ) = j u_s(j)=j u s ( j ) = j if s = 1 s=1 s = 1 .
Temporarily turn the lower bits of b b b into ∣ b ∣ \lvert b\rvert ∣ b ∣ if b < 0 b<0 b < 0 . To this end, controlled on s = 1 s=1 s = 1 , we apply qubitwise NOT on qubits of ∣ x ⟩ \lvert x\rangle ∣ x ⟩ to obtain bitwise complement x ˉ = 2 r − 1 − x = ∣ b ∣ − 1 \bar{x}=2^r-1-x=\lvert b\rvert-1 x ˉ = 2 r − 1 − x = ∣ b ∣ − 1 and then perform ∣ x ˉ ⟩ ↦ ∣ x ˉ + 1 ⟩ \lvert\bar{x}\rangle\mapsto\lvert\bar{x}+1\rangle ∣ x ˉ ⟩ ↦ ∣ x ˉ + 1 ⟩ by the increment operator.
Apply the quantum-quantum comparator
COM ∣ 0 ⟩ f ∣ b ∣ ∣ u s ( j ) ⟩ = { ∣ 0 ⟩ f ∣ b ∣ ∣ u s ( j ) ⟩ if ∣ b ∣ ≤ u s ( j ) , ∣ 1 ⟩ f ∣ b ∣ ∣ u s ( j ) ⟩ if ∣ b ∣ > u s ( j ) . (36) \operatorname{COM}\lvert0\rangle_f\lvert b\rvert\lvert u_s(j)\rangle=
\begin{cases}
\lvert0\rangle_f\lvert b\rvert\lvert u_s(j)\rangle& \text{if }\lvert b\rvert\leq u_s(j),\\
\lvert1\rangle_f\lvert b\rvert\lvert u_s(j)\rangle& \text{if }\lvert b\rvert>u_s(j).
\end{cases} \tag*{(36)} COM ∣ 0 ⟩ f ∣ b ∣ ∣ u s ( j )⟩ = { ∣ 0 ⟩ f ∣ b ∣ ∣ u s ( j )⟩ ∣ 1 ⟩ f ∣ b ∣ ∣ u s ( j )⟩ if ∣ b ∣ ≤ u s ( j ) , if ∣ b ∣ > u s ( j ) . (36)
Apply the inverse of the operations in Step 2 to restore b b b in two’s complement.
The next step to implement the value oracle is to apply CROT. As this operation does not depend on j j j , we do not restore j j j before CROT. To uncompute the flag, we then apply the operations in Step 2 above to have ∣ b ∣ \lvert b\rvert ∣ b ∣ in the lower r r r bits of the band register, followed by COM in Step 3. Finally, we restore b b b to two’s complement, and restore j j j by applying the inverse of the operation in Step 1. Altogether, we have the quantum circuit in Figure 3 (a) for implementing the value oracle.
We note that for the particular class of Toeplitz matrices where A A A is periodic with elements A i j = A ( i − j ) m o d N A_{ij}=A_{(i-j)\bmod N} A ij = A ( i − j ) mod N , we have a b ± N = a b a_{b\pm N}=a_b a b ± N = a b for any b ≠ 0 b\ne0 b = 0 , and A A A is a circulant matrix. The flag qubit and comparison operation are not needed in this case, as the nonzero values depend only on the band index b b b modulo N N N . The value oracle is simply a uniformly controlled rotation with the band register as the only control register.
Cost analysis. Let C ( f l a g ) C(\mathrm{flag}) C ( flag ) be the cost of computing the flag and let C ( C R O T ) C(\mathrm{CROT}) C ( CROT ) be the cost of implementing CROT, where the cost is either the gate cost or the circuit depth. The cost of implementing the value oracle is C ( V A L ) = C ( C R O T ) + 2 C ( f l a g ) C(\mathrm{VAL})=C(\mathrm{CROT})+2C(\mathrm{flag}) C ( VAL ) = C ( CROT ) + 2 C ( flag ) . CROT is a single-qubit rotation uniformly controlled on the flag qubit and the m m m -qubit band register. As in Figure 2 (c), this uniformly controlled rotation can be implemented by a circuit with Θ ( 2 m ) \Theta(2^m) Θ ( 2 m ) gates and Θ ( 2 m ) \Theta(2^m) Θ ( 2 m ) depth.
To analyze the cost of computing the flag by the above steps, we use the following lemmas for the cost of the controlled increment operator in Step 2 and the quantum-quantum comparator in Eq. (36) in Step 3.
Lemma 1 ([18 Cor. 7] ). The k k k -controlled increment operator on n n n qubits can be implemented using one dirty ancilla qubit and a circuit with Θ ( k + n ) \Theta(k+n) Θ ( k + n ) gates from { X , CNOT , Toffoli } \{X,\operatorname{CNOT},\operatorname{Toffoli}\} { X , CNOT , Toffoli } and Θ ( log ( k n ) ) \Theta(\log(kn)) Θ ( log ( k n )) circuit depth.
Lemma 2 ([18 Thm. 2] ). The n n n -qubit quantum-quantum comparator can be implemented without any ancilla qubits by a circuit with Θ ( n ) \Theta(n) Θ ( n ) gates from { X , CNOT , Toffoli } \{X,\operatorname{CNOT},\operatorname{Toffoli}\} { X , CNOT , Toffoli } and Θ ( log n ) \Theta(\log n) Θ ( log n ) depth.
Step 2: The qubitwise NOT on m − 1 m-1 m − 1 qubits can be implemented by a circuit with Θ ( m ) \Theta(m) Θ ( m ) gates and Θ ( log m ) \Theta(\log m) Θ ( log m ) depth. By Lemma 1, the 1 1 1 -controlled increment acting on n = m − 1 n=m-1 n = m − 1 qubits can be implemented using a dirty ancilla and a circuit with Θ ( m ) \Theta(m) Θ ( m ) gates and Θ ( log m ) \Theta(\log m) Θ ( log m ) depth.
Step 4 is the inverse of Step 2 with the same cost. Altogether, the VAL oracle can be implemented by a circuit with Θ ( n ) + Θ ( 2 m ) \Theta(n)+\Theta(2^m) Θ ( n ) + Θ ( 2 m ) gates and Θ ( log n ) + Θ ( w ) \Theta(\log n)+\Theta(w) Θ ( log n ) + Θ ( w ) depth. As shown in Figure 3 (b), the LOC oracle is simply m m m single-controlled additions of a known classical value to an n n n -qubit register. By the following lemma, this oracle can be implemented using one dirty ancilla and a circuit with Θ ( m log n ) \Theta(m\log n) Θ ( m log n ) gates and Θ ( m log 2 n ) \Theta(m\log^2 n) Θ ( m log 2 n ) depth. Together with the cost of VAL, we have the total gate cost Θ ( m n log n ) + Θ ( 2 m ) \Theta(mn\log n)+\Theta(2^m) Θ ( mn log n ) + Θ ( 2 m ) and the total circuit depth Θ ( m log 2 n ) + Θ ( 2 m ) \Theta(m\log^2 n)+\Theta(2^m) Θ ( m log 2 n ) + Θ ( 2 m ) for the sparse encoding.
Lemma 3 ([18 Cor. 8] ). The k k k -controlled classical-quantum adder on n n n qubits can be implemented using one dirty ancilla qubit and a circuit with Θ ( k + n log n ) \Theta(k+n\log n) Θ ( k + n log n ) gates from { X , CNOT , Toffoli } \{X,\operatorname{CNOT},\operatorname{Toffoli}\} { X , CNOT , Toffoli } and Θ ( log k + log 2 n ) \Theta(\log k+\log^2 n) Θ ( log k + log 2 n ) depth.
The total number of clean ancillas used is m + 2 m+2 m + 2 ; m m m ancillas used for the band register, one ancilla as the flag qubit, and one ancilla for value encoding. Only one dirty ancilla is used for the implementation. With m = ⌈ log 2 ( 2 w + 1 ) ⌉ m=\lceil\log_2(2w+1)\rceil m = ⌈ log 2 ( 2 w + 1 )⌉ , we obtain the resource cost reported in Table 1 for the sparse encoding of a Toeplitz matrix.
Table 1. Resource scaling of various approaches for encoding a Toeplitz matrix.
Block encodings for Toeplitz matrices and differential operators with constant coefficients
We now present several approaches to construct a block encoding for Toeplitz matrices. These matrices arise in discretizing differential operators with constant coefficients, so the block encodings we construct here apply to these operators.
Block encoding by sparse encoding. A generic approach to block-encode a matrix is via its sparse encoding [19 , 20 ] . Our first approach is to utilize the oracles we constructed for the sparse encoding to build a block encoding for a Toeplitz matrix. Specifically, we block-encode A A A as
U A = ( 1 1 ⊗ H ⊗ m ⊗ 1 n ) ( 1 1 ⊗ L O C ) V A L ( 1 1 ⊗ H ⊗ m ⊗ 1 n ) , (37) U_{A}=\left(\mathbb{1}_{1}\otimes H^{\otimes m}\otimes\mathbb{1}_{n}\right)\left(\mathbb{1}_{1}\otimes\mathrm{LOC}\right)\mathrm{VAL}\left(\mathbb{1}_{1}\otimes H^{\otimes m}\otimes\mathbb{1}_{n}\right), \tag*{(37)} U A = ( 1 1 ⊗ H ⊗ m ⊗ 1 n ) ( 1 1 ⊗ LOC ) VAL ( 1 1 ⊗ H ⊗ m ⊗ 1 n ) , (37)
where H H H is the Hadamard gate. This block encoding can be verified by its action on basis states
⟨ 0 ∣ ⟨ 0 m ∣ ⟨ i ∣ U A ∣ 0 ⟩ ∣ 0 m ⟩ ∣ j ⟩ = 1 α A i j , (38) \langle0|\langle0^{m}|\langle i|U_{A}|0\rangle|0^{m}\rangle|j\rangle=\frac{1}{\alpha}A_{ij}, \tag*{(38)} ⟨ 0∣ ⟨ 0 m ∣ ⟨ i ∣ U A ∣0 ⟩ ∣ 0 m ⟩ ∣ j ⟩ = α 1 A ij , (38)
where α = 2 m β = ( 2 w + 1 ) ∥ A ∥ max \alpha=2^{m}\beta=(2w+1)\lVert A\rVert_{\max} α = 2 m β = ( 2 w + 1 ) ∥ A ∥ m a x is the normalization factor. Observe that
⟨ 0 ∣ ⟨ 0 m ∣ ⟨ i ∣ U A ∣ 0 ⟩ ∣ 0 m ⟩ ∣ j ⟩ = 1 2 m ∑ b ′ b ⟨ 0 ∣ ⟨ b ′ ∣ ⟨ i ∣ ( 1 1 ⊗ L O C ) V A L ∣ 0 ⟩ ∣ b ⟩ ∣ j ⟩ (39) \langle0|\langle0^{m}|\langle i|U_{A}|0\rangle|0^{m}\rangle|j\rangle=\frac{1}{2^{m}}\sum_{b'b}\langle0|\langle b'|\langle i|(\mathbb{1}_{1}\otimes\mathrm{LOC})\mathrm{VAL}|0\rangle|b\rangle|j\rangle \tag*{(39)} ⟨ 0∣ ⟨ 0 m ∣ ⟨ i ∣ U A ∣0 ⟩ ∣ 0 m ⟩ ∣ j ⟩ = 2 m 1 b ′ b ∑ ⟨ 0∣ ⟨ b ′ ∣ ⟨ i ∣ ( 1 1 ⊗ LOC ) VAL ∣0 ⟩ ∣ b ⟩ ∣ j ⟩ (39)
= 1 2 m ∑ b ′ b ⟨ 0 ∣ R ( θ ( b , j ) ) ∣ 0 ⟩ ⟨ b ′ ∣ ⟨ i ∣ 1 1 ⊗ L O C ∣ b ⟩ ∣ j ⟩ (40) =\frac{1}{2^{m}}\sum_{b'b}\langle0|R(\theta(b,j))|0\rangle\langle b'|\langle i|\mathbb{1}_{1}\otimes\mathrm{LOC}|b\rangle|j\rangle \tag*{(40)} = 2 m 1 b ′ b ∑ ⟨ 0∣ R ( θ ( b , j )) ∣0 ⟩ ⟨ b ′ ∣ ⟨ i ∣ 1 1 ⊗ LOC ∣ b ⟩ ∣ j ⟩ (40)
= 1 2 m β ∑ b ′ b A r ( b , j ) , j ⟨ b ′ ∣ b ⟩ ⟨ i ∣ r ( b , j ) ⟩ (41) =\frac{1}{2^{m}\beta}\sum_{b'b}A_{r(b,j),j}\langle b'|b\rangle\langle i|r(b,j)\rangle \tag*{(41)} = 2 m β 1 b ′ b ∑ A r ( b , j ) , j ⟨ b ′ ∣ b ⟩ ⟨ i ∣ r ( b , j )⟩ (41)
= 1 2 m β ∑ b A r ( b , j ) , j δ i , r ( b , j ) = A i j 2 m β , (42) =\frac{1}{2^{m}\beta}\sum_{b}A_{r(b,j),j}\delta_{i,r(b,j)}=\frac{A_{ij}}{2^{m}\beta}, \tag*{(42)} = 2 m β 1 b ∑ A r ( b , j ) , j δ i , r ( b , j ) = 2 m β A ij , (42)
where the last equality follows because i = r ( b , j ) i=r(b,j) i = r ( b , j ) only for one band index b b b . Note that this block encoding applies to a generic Toeplitz matrix, as the sparse encoding oracles apply to a generic Toeplitz matrix. We also note that we have omitted the flag qubit used in the value oracle here as it starts and ends in ∣ 0 ⟩ |0\rangle ∣0 ⟩ state. The explicit quantum circuit for block encoding based on this approach, including the flag qubit, is given in Figure 4 (a). Note that the resource cost of this approach is similar to that of sparse encoding reported in Table 1 .
Figure 4. Quantum circuits for various block encodings of Toeplitz matrices.
Block encoding by LCU. We now provide another approach for block encoding of a periodic Toeplitz matrix (i.e., a circulant matrix) using the Linear Combination of Unitaries (LCU) technique [21 ] . In this approach, we use the structural properties of the matrix and decompose it as a linear combination of unitary matrices as A = ∑ b = − w w a b S b A=\sum_{b=-w}^{w}a_{b}S_{b} A = ∑ b = − w w a b S b , where S b S_{b} S b is the cyclic shift matrix with the action S b : ∣ j ⟩ ↦ ∣ ( j + b ) m o d N ⟩ S_{b}:|j\rangle\mapsto|(j+b)\bmod N\rangle S b : ∣ j ⟩ ↦ ∣ ( j + b ) mod N ⟩ on basis state ∣ j ⟩ |j\rangle ∣ j ⟩ , and construct the block encoding as
U A = ( P R E P † ⊗ 1 n ) S E L E C T ( P R E P ⊗ 1 n ) , (43) U_{A}=(\mathrm{PREP}^{\dagger}\otimes\mathbb{1}_{n})\mathrm{SELECT}(\mathrm{PREP}\otimes\mathbb{1}_{n}), \tag*{(43)} U A = ( PREP † ⊗ 1 n ) SELECT ( PREP ⊗ 1 n ) , (43)
where
PREP ∣ 0 ⟩ ⊗ m : = 1 a ∑ b = − w w ∣ a b ∣ ∣ b ⟩ (44) \operatorname{PREP}|0\rangle^{\otimes m} := \frac{1}{\sqrt{a}}\sum_{b=-w}^{w}\sqrt{|a_b|}|b\rangle \tag*{(44)} PREP ∣0 ⟩ ⊗ m := a 1 b = − w ∑ w ∣ a b ∣ ∣ b ⟩ (44)
with a : = ∑ b ∣ a b ∣ a := \sum_b |a_b| a := ∑ b ∣ a b ∣ and
SELECT ∣ b ⟩ ∣ j ⟩ : = ∣ b ⟩ S b ∣ j ⟩ = ∣ b ⟩ ∣ ( j + b ) m o d N ⟩ . (45) \operatorname{SELECT}|b\rangle|j\rangle:= |b\rangle S_b|j\rangle= |b\rangle|(j+b)\bmod N\rangle. \tag*{(45)} SELECT ∣ b ⟩ ∣ j ⟩ := ∣ b ⟩ S b ∣ j ⟩ = ∣ b ⟩ ∣ ( j + b ) mod N ⟩ . (45)
Note that SELECT \operatorname{SELECT} SELECT here is identical to LOC \operatorname{LOC} LOC in Eq. (28) , and so we use the bits of b b b to implement it as in Figure 4 (b). The cost of SELECT \operatorname{SELECT} SELECT is also identical to the cost of LOC \operatorname{LOC} LOC discussed before. PREP \operatorname{PREP} PREP can be implemented by a circuit with Θ ( 2 m ) \Theta(2^m) Θ ( 2 m ) gates and Θ ( 2 m ) \Theta(2^m) Θ ( 2 m ) depth by the loading procedure discussed in § 2.2 . Altogether, we obtain the resource cost reported in Table 1 for this encoding.
Block encoding by diagonalization. Yet another approach to block encoding of a periodic Toeplitz matrix is using the fact that it can be diagonalized by a unitary transformation. This approach does not require ancilla qubits as the control register in the previous approaches and could be appealing when the number of qubits is limited. Specifically, we diagonalize a circulant matrix A A A by the Fourier transform as A = F Λ F † A = F\Lambda F^\dagger A = F Λ F † , where Λ \Lambda Λ is a diagonal matrix with diagonals { λ j } \{\lambda_j\} { λ j } . This decomposition yields the block encoding U A = ( 1 ⊗ QFT ) O Λ ( 1 ⊗ QFT † ) U_A = (1 \otimes\operatorname{QFT})O_\Lambda(1 \otimes\operatorname{QFT}^\dagger) U A = ( 1 ⊗ QFT ) O Λ ( 1 ⊗ QFT † ) , where QFT \operatorname{QFT} QFT is the quantum Fourier transform and O Λ : = ∑ j R ( θ j ) ⊗ ∣ j ⟩ ⟨ j ∣ O_\Lambda:= \sum_j R(\theta_j) \otimes|j\rangle\langle j| O Λ := ∑ j R ( θ j ) ⊗ ∣ j ⟩ ⟨ j ∣ is a block encoding for the diagonal matrix Λ \Lambda Λ , which is simply a uniformly controlled rotation with the angle θ j \theta_j θ j where cos ( θ j / 2 ) = λ j / λ max \cos(\theta_j/2) = \lambda_j/\lambda_{\max} cos ( θ j /2 ) = λ j / λ m a x and λ max = max j ∣ λ j ∣ \lambda_{\max} = \max_j|\lambda_j| λ m a x = max j ∣ λ j ∣ . This block encoding is shown in Figure 4 (c).
The standard implementation for n n n -qubit QFT uses Θ ( n 2 ) \Theta(n^2) Θ ( n 2 ) elementary gates. Note that O Λ O_\Lambda O Λ is simply a single-qubit rotation uniformly controlled on n n n qubits. As in Figure 2 (c), this uniformly controlled rotation can be implemented by a circuit with Θ ( 2 n ) \Theta(2^n) Θ ( 2 n ) gates and Θ ( 2 n ) \Theta(2^n) Θ ( 2 n ) depth. Altogether, we obtain the resource cost reported in Table 1 for this encoding.
Block encodings for differential operators with variable coefficients
We now utilize our representation for the variable-coefficient differentiation operators in § 2.3 and construct a block encoding for such operators. We first consider the 1D case and then extend the construction to higher dimensions.
Our discrete representation for these operators takes the form of a sum and a product of matrices. For instance, the discretized operator has the form A = D T E D + K A = D^{T}ED + K A = D T E D + K in Eq. (17) for the 1D case. A straightforward approach to block encode D T E D D^{T}ED D T E D is to construct a block encoding for each factor, D T D^{T} D T , E E E and D D D , and then combine them using the standard product rule for block encodings. However, this approach does not exploit the structure of the matrices involved in the product. Instead of block encoding each factor in the product separately, we only block-encode the diagonal factor E E E and use it to build a block encoding of the matrix product by simple controlled-shift operations. This approach leads to a simple and more efficient construction than the direct product of individual block encodings.
To elaborate our approach, we use the decomposition D = ( S − 1 ) / h D=(S-1)/h D = ( S − 1 ) / h in terms of the shift operator S S S in Eq. (14) and express the matrix product A ~ : = h 2 D T E D \widetilde{A}:=h^{2}D^{T}ED A := h 2 D T E D as
A ~ = S † E S − S † E − E S + E . (46) \widetilde{A}=S^{\dagger}ES-S^{\dagger}E-ES+E. \tag*{(46)} A = S † E S − S † E − E S + E . (46)
Now suppose U E U_{E} U E is an α E \alpha_{E} α E block encoding of E E E . We prepare two ancilla qubits in the state ∣ ξ ⟩ = ∣ − ⟩ L ∣ − ⟩ R |\xi\rangle=|-\rangle_{L}|-\rangle_{R} ∣ ξ ⟩ = ∣ − ⟩ L ∣ − ⟩ R so that the left/right qubit is in the state ∣ − ⟩ : = ( ∣ 0 ⟩ − ∣ 1 ⟩ ) / 2 |-\rangle:=(|0\rangle-|1\rangle)/\sqrt{2} ∣ − ⟩ := ( ∣0 ⟩ − ∣1 ⟩) / 2 . The right qubit R R R controls whether to apply S S S before U E U_{E} U E , and the left qubit L L L controls whether to apply S † S^{\dagger} S † after U E U_{E} U E . Note that S S S and S † S^{\dagger} S † act only on data qubits (not on the ancilla) of U E U_{E} U E . Specifically, the right- and left-controlled shifts are
C R : = ∣ 0 ⟩ ⟨ 0 ∣ R ⊗ 1 n + 1 + ∣ 1 ⟩ ⟨ 1 ∣ R ⊗ 1 1 ⊗ S , (47) C_{R}:=|0\rangle\langle0|_{R}\otimes\mathbb{1}_{n+1}+|1\rangle\langle1|_{R}\otimes\mathbb{1}_{1}\otimes S, \tag*{(47)} C R := ∣0 ⟩ ⟨ 0 ∣ R ⊗ 1 n + 1 + ∣1 ⟩ ⟨ 1 ∣ R ⊗ 1 1 ⊗ S , (47)
C L : = ∣ 0 ⟩ ⟨ 0 ∣ L ⊗ 1 n + 1 + ∣ 1 ⟩ ⟨ 1 ∣ L ⊗ 1 1 ⊗ S † , (48) C_{L}:=|0\rangle\langle0|_{L}\otimes\mathbb{1}_{n+1}+|1\rangle\langle1|_{L}\otimes\mathbb{1}_{1}\otimes S^{\dagger}, \tag*{(48)} C L := ∣0 ⟩ ⟨ 0 ∣ L ⊗ 1 n + 1 + ∣1 ⟩ ⟨ 1 ∣ L ⊗ 1 1 ⊗ S † , (48)
where 1 1 \mathbb{1}_{1} 1 1 is the identity on the ancilla of U E U_{E} U E . Let Ξ : = Z H ⊗ Z H \Xi:=ZH\otimes ZH Ξ := Z H ⊗ Z H be the operator that prepares ∣ ξ ⟩ |\xi\rangle ∣ ξ ⟩ . Then the unitary
W : = Ξ † C L ( 1 2 ⊗ U E ) C R Ξ (49) W:=\Xi^{\dagger}C_{L}(\mathbb{1}_{2}\otimes U_{E})C_{R}\Xi \tag*{(49)} W := Ξ † C L ( 1 2 ⊗ U E ) C R Ξ (49)
block encodes A ~ \widetilde{A} A with three ancilla qubits, i.e.,
( ⟨ 0 3 ∣ ⊗ 1 n ) W ( ∣ 0 3 ⟩ ⊗ 1 n ) = A ~ 4 α E , (50) (\langle0^{3}|\otimes\mathbb{1}_{n})W(|0^{3}\rangle\otimes\mathbb{1}_{n})=\frac{\widetilde{A}}{4\alpha_{E}}, \tag*{(50)} (⟨ 0 3 ∣ ⊗ 1 n ) W ( ∣ 0 3 ⟩ ⊗ 1 n ) = 4 α E A , (50)
and with the block-encoding normalization factor of 4 α E 4\alpha_{E} 4 α E . The key point here is that U E U_{E} U E is applied only once and is not controlled by qubits L L L and R R R . Note that W W W block encodes the scaled matrix A ~ / h 2 \widetilde{A}/h^{2} A / h 2 as well, but with the normalization factor 4 α E / h 2 4\alpha_{E}/h^{2} 4 α E / h 2 .
Now let U K U_{K} U K be an α K \alpha_{K} α K block encoding for the diagonal matrix K K K . Then a block encoding for A = A ~ / h 2 + K A=\widetilde{A}/h^{2}+K A = A / h 2 + K can be constructed using the block encodings W W W and U K U_{K} U K following the standard LCU approach. However, we instead use the following approach to reduce the number of control qubits for the shift operations in the standard approach. Let us use a new ancilla qubit labeled as the ‘summation’ qubit s s s and let
Ω ∣ 0 3 ⟩ = cos ( θ / 2 ) ∣ 0 ⟩ s ∣ ξ ⟩ + sin ( θ / 2 ) ∣ 1 ⟩ s ∣ 00 ⟩ , (51) \Omega|0^{3}\rangle=\cos(\theta/2)|0\rangle_{s}|\xi\rangle+\sin(\theta/2)|1\rangle_{s}|00\rangle, \tag*{(51)} Ω∣ 0 3 ⟩ = cos ( θ /2 ) ∣0 ⟩ s ∣ ξ ⟩ + sin ( θ /2 ) ∣1 ⟩ s ∣00 ⟩ , (51)
where the rotation angle satisfies
cos ( θ / 2 ) = 2 h α E α A , α A : = 4 α E h 2 + α K , (52) \cos(\theta/2)=\frac{2}{h}\sqrt{\frac{\alpha_E}{\alpha_A}},\qquad\alpha_A:=\frac{4\alpha_E}{h^2}+\alpha_K, \tag*{(52)} cos ( θ /2 ) = h 2 α A α E , α A := h 2 4 α E + α K , (52)
then
U A = Ω † C L ( ∣ 0 ⟩ ⟨ 0 ∣ s ⊗ U E + ∣ 1 ⟩ ⟨ 1 ∣ s ⊗ U K ) C R Ω (53) U_A=\Omega^\dagger C_L\left(|0\rangle\langle0|_s\otimes U_E+|1\rangle\langle1|_s\otimes U_K\right)C_R\Omega \tag*{(53)} U A = Ω † C L ( ∣0 ⟩ ⟨ 0 ∣ s ⊗ U E + ∣1 ⟩ ⟨ 1 ∣ s ⊗ U K ) C R Ω (53)
is a block encoding for A A A with the normalization factor α A \alpha_A α A . Note that here U E U_E U E and U K U_K U K share a single ancilla to block encode the diagonals E E E and K K K , so four ancilla qubits are used in total for U A U_A U A . Also, note that Ω \Omega Ω is simply a rotation R ( θ ) R(\theta) R ( θ ) applied on qubit s s s followed by a ∣ 0 ⟩ |0\rangle ∣0 ⟩ -controlled preparation of ∣ ξ ⟩ |\xi\rangle ∣ ξ ⟩ on qubits L L L and R R R . When qubit s s s is in the ∣ 1 ⟩ |1\rangle ∣1 ⟩ state, the left L L L and right R R R qubits are in the zero state, and so C R C_R C R and C L C_L C L act as identity on system qubits. Altogether, our approach yields the quantum circuit in Figure 5 (a) for block encoding of A A A .
Figure 5. Quantum circuits for block encoding of differential operators with variable coefficients.
Two dimensions. To extend our construction to two dimensions, we decompose the derivative matrix in Eq. (21) in the ν ∈ { x , y } \nu\in\{x,y\} ν ∈ { x , y } direction as D ν = ( S ν − 1 2 n ) / h D_\nu=(S_\nu-\mathbb{1}_{2n})/h D ν = ( S ν − 1 2 n ) / h , where S x : = 1 n ⊗ S S_x:=\mathbb{1}_n\otimes S S x := 1 n ⊗ S and S y : = S ⊗ 1 n S_y:=S\otimes\mathbb{1}_n S y := S ⊗ 1 n with S S S the cyclic shift matrix as before, and express the discretized 2D operator in Eq. (20) as A = A ~ / h 2 + K A=\widetilde{A}/h^2+K A = A / h 2 + K , where
A ~ = D x T E x D x + D y T E y D y (54) \widetilde{A}=D_x^{\mathsf{T}}E_xD_x+D_y^{\mathsf{T}}E_yD_y \tag*{(54)} A = D x T E x D x + D y T E y D y (54)
= ( S x † − 1 2 n ) E x ( S x − 1 2 n ) + ( S y † − 1 2 n ) E y ( S y − 1 2 n ) . (55) =(S_x^\dagger-\mathbb{1}_{2n})E_x(S_x-\mathbb{1}_{2n})+(S_y^\dagger-\mathbb{1}_{2n})E_y(S_y-\mathbb{1}_{2n}). \tag*{(55)} = ( S x † − 1 2 n ) E x ( S x − 1 2 n ) + ( S y † − 1 2 n ) E y ( S y − 1 2 n ) . (55)
First we construct a block encoding for A ~ \widetilde{A} A , from which we build a block encoding for A A A . Suppose U E ν U_{E_\nu} U E ν is an α E ν \alpha_{E_\nu} α E ν block encoding of E ν E_\nu E ν . We use a fresh ancilla labeled as the ‘direction’ qubit ν \nu ν and prepare it in the direction state ∣ D I R ⟩ : = R ( θ ) ∣ 0 ⟩ = cos ( θ / 2 ) ∣ 0 ⟩ + sin ( θ / 2 ) ∣ 1 ⟩ |\mathrm{DIR}\rangle:=R(\theta)|0\rangle=\cos(\theta/2)|0\rangle+\sin(\theta/2)|1\rangle ∣ DIR ⟩ := R ( θ ) ∣0 ⟩ = cos ( θ /2 ) ∣0 ⟩ + sin ( θ /2 ) ∣1 ⟩ , where
cos ( θ / 2 ) = α E x α E with α E : = α E x + α E y , (56) \cos(\theta/2)=\sqrt{\frac{\alpha_{E_x}}{\alpha_E}}\quad\text{with}\quad\alpha_E:=\alpha_{E_x}+\alpha_{E_y}, \tag*{(56)} cos ( θ /2 ) = α E α E x with α E := α E x + α E y , (56)
to select the x ↔ ∣ 0 ⟩ x\leftrightarrow|0\rangle x ↔ ∣0 ⟩ or y ↔ ∣ 1 ⟩ y\leftrightarrow|1\rangle y ↔ ∣1 ⟩ direction based on the value of the direction qubit. Then for each direction ν \nu ν , the right qubit R R R (left qubit L L L ) selects whether to apply S ν S_\nu S ν (S ν † S_\nu^\dagger S ν † ) before (after)
U E : = ∣ 0 ⟩ ⟨ 0 ∣ ν ⊗ U E x + ∣ 1 ⟩ ⟨ 1 ∣ ν ⊗ U E y , (57) U_E:=|0\rangle\langle0|_\nu\otimes U_{E_x}+|1\rangle\langle1|_\nu\otimes U_{E_y}, \tag*{(57)} U E := ∣0 ⟩ ⟨ 0 ∣ ν ⊗ U E x + ∣1 ⟩ ⟨ 1 ∣ ν ⊗ U E y , (57)
the controlled application of U E ν U_{E_\nu} U E ν based on the direction qubit ν \nu ν . The described procedure block encodes A ~ \widetilde{A} A with the normalization factor 4 α E 4\alpha_E 4 α E . The block encoding for A A A follows similarly as in the 1D case. Using the summation qubit s s s , we prepare the state in Eq. (51) , where the angle is obtained from Eq. (52) but with α E \alpha_E α E given in Eq. (56) . The block encoding for A A A in 2D is analogous to the 1D case in Eq. (53) but with U E U_E U E in Eq. (57) and with Ω \Omega Ω that also prepares the direction state ∣ D I R ⟩ |\mathrm{DIR}\rangle ∣ DIR ⟩ . Additionally, C L C_L C L and C R C_R C R are controlled by the direction qubit ν \nu ν . Overall, five ancillas are used to construct U A U_A U A in 2D.
Higher dimensions. The same construction extends to three and higher dimensions. In general, for d d d -dimensional discretized operator with d > 1 d>1 d > 1 we write A = A ~ / h 2 + K A=\widetilde{A}/h^2+K A = A / h 2 + K , where
A ~ = ∑ ν = 0 d − 1 D ν T E ν D ν = ∑ ν = 0 d − 1 ( S ν † − 1 d n ) E ν ( S ν − 1 d n ) (58) \widetilde{A}=\sum_{\nu=0}^{d-1}D_\nu^{\mathsf{T}}E_\nu D_\nu=\sum_{\nu=0}^{d-1}(S_\nu^\dagger-\mathbb{1}_{d n})E_\nu(S_\nu-\mathbb{1}_{d n}) \tag*{(58)} A = ν = 0 ∑ d − 1 D ν T E ν D ν = ν = 0 ∑ d − 1 ( S ν † − 1 d n ) E ν ( S ν − 1 d n ) (58)
and S ν S_\nu S ν is the shift operator on direction ν \nu ν . In 3D, for instance, we have S 0 = S x = 1 n ⊗ 1 n ⊗ S S_0=S_x=\mathbb{1}_n\otimes\mathbb{1}_n\otimes S S 0 = S x = 1 n ⊗ 1 n ⊗ S , S 1 = S y = 1 n ⊗ S ⊗ 1 n S_1=S_y=\mathbb{1}_n\otimes S\otimes\mathbb{1}_n S 1 = S y = 1 n ⊗ S ⊗ 1 n and S 2 = S z = S ⊗ 1 n ⊗ 1 n S_2=S_z=S\otimes\mathbb{1}_n\otimes\mathbb{1}_n S 2 = S z = S ⊗ 1 n ⊗ 1 n . We use ⌈ log 2 d ⌉ \lceil\log_2 d\rceil ⌈ log 2 d ⌉ direction qubits prepared on the state
∣ D I R ⟩ : = ∑ ν α E ν α E ∣ ν ⟩ with α E : = ∑ ν α E ν (59) |\mathrm{DIR}\rangle:=\sum_\nu\sqrt{\frac{\alpha_{E_\nu}}{\alpha_E}}|\nu\rangle\quad\text{with}\quad\alpha_E:=\sum_\nu\alpha_{E_\nu} \tag*{(59)} ∣ DIR ⟩ := ν ∑ α E α E ν ∣ ν ⟩ with α E := ν ∑ α E ν (59)
to select the direction. For example, in 3D, x ↔ ∣ 00 ⟩ x\leftrightarrow|00\rangle x ↔ ∣00 ⟩ , y ↔ ∣ 01 ⟩ y\leftrightarrow|01\rangle y ↔ ∣01 ⟩ , z ↔ ∣ 10 ⟩ z\leftrightarrow|10\rangle z ↔ ∣10 ⟩ and ∣ 11 ⟩ |11\rangle ∣11 ⟩ is unused. Then for each direction ν \nu ν , the right qubit R R R (left qubit L L L ) selects whether to apply S ν S_\nu S ν (S ν † S_\nu^\dagger S ν † ) before (after)
U E = ∑ ν ∣ ν ⟩ ⟨ ν ∣ ⊗ U E ν . (60) U_E=\sum_\nu|\nu\rangle\langle\nu|\otimes U_{E_\nu}. \tag*{(60)} U E = ν ∑ ∣ ν ⟩ ⟨ ν ∣ ⊗ U E ν . (60)
The block encoding for A A A follows similarly as in the 2D case. As all U E ν U_{E_\nu} U E ν share a single block-encoding ancilla, the total ancilla qubits used to block encode the d > 1 d>1 d > 1 dimensional operator is 4 + ⌈ log 2 d ⌉ 4+\lceil\log_2 d\rceil 4 + ⌈ log 2 d ⌉ . Figure 5 (b) shows the quantum circuit for block encoding of A A A in d = 3 d=3 d = 3 dimensions.
Computing properties of a quantum solution
In this section, we present several approaches for extracting desired properties of the quantum solution state ∣ ψ ⟩ |\psi\rangle ∣ ψ ⟩ , which encodes an approximate solution of the discretized PDE. By a property of the quantum solution, we mean the expectation value of a given observable M M M with respect to this state, namely μ : = ⟨ ψ ∣ M ∣ ψ ⟩ \mu:= \langle\psi| M |\psi\rangle μ := ⟨ ψ ∣ M ∣ ψ ⟩ . Depending on M M M , this value can represent a physically or mathematically relevant feature of the solution. The purpose of this section is to make explicit how such information can be extracted from the quantum solution using a unitary encoding of observable [11 , 22 ] and, more importantly, to analyze and compare the end-to-end complexities when the costs of preparing the solution state and estimating a desired property are considered. We will later use these results in § 3 to obtain the full cost of the end-to-end algorithm tailored to the Poisson-Boltzmann equation.
Unitary embedding and reduction to nonnegative overlap
We begin by embedding the expectation value of the generally nonunitary observable M M M into an expectation value of a unitary operator, and then show how it can be reduced to a nonnegative overlap. Without loss of generality, we assume that ∥ M ∥ ≤ 1 \lVert M\rVert\le1 ∥ M ∥ ≤ 1 . Because M M M is Hermitian, μ \mu μ is real and satisfies μ ∈ [ − 1 , 1 ] \mu\in[-1,1] μ ∈ [ − 1 , 1 ] . We assume M M M is given as an exact block encoding U M U_M U M ; we will later construct such a block encoding for our application. That is to say, U M U_M U M acts on an a a a -qubit ancilla register and the n n n -qubit solution register and satisfies
( ⟨ 0 a ∣ ⊗ 1 n ) U M ( ∣ 0 a ⟩ ⊗ 1 n ) = M . (61) (\langle0^a| \otimes\mathbb{1}_n)U_M(|0^a\rangle\otimes\mathbb{1}_n) = M. \tag*{(61)} (⟨ 0 a ∣ ⊗ 1 n ) U M ( ∣ 0 a ⟩ ⊗ 1 n ) = M . (61)
Defining
∣ ϕ ⟩ : = ∣ 0 a ⟩ ⊗ ∣ ψ ⟩ , (62) |\phi\rangle:= |0^a\rangle\otimes|\psi\rangle, \tag*{(62)} ∣ ϕ ⟩ := ∣ 0 a ⟩ ⊗ ∣ ψ ⟩ , (62)
we obtain
⟨ ϕ ∣ U M ∣ ϕ ⟩ = ⟨ ψ ∣ M ∣ ψ ⟩ = μ . (63) \langle\phi| U_M |\phi\rangle= \langle\psi| M |\psi\rangle= \mu. \tag*{(63)} ⟨ ϕ ∣ U M ∣ ϕ ⟩ = ⟨ ψ ∣ M ∣ ψ ⟩ = μ . (63)
Thus, the expectation value of the unitary U M U_M U M on the extended space embeds the expectation value of M M M . We note that an alternative unitary embedding follows from Hamiltonian simulation [22 ] . In particular, we have
1 t Im ( ⟨ ψ ∣ e i M t ∣ ψ ⟩ ) = 1 t ⟨ ψ ∣ sin ( M t ) ∣ ψ ⟩ = μ + O ( t 2 ) , (64) \frac{1}{t}\operatorname{Im}\left(\langle\psi|e^{iMt}|\psi\rangle\right)=\frac{1}{t}\langle\psi|\sin(Mt)|\psi\rangle=\mu+O(t^2), \tag*{(64)} t 1 Im ( ⟨ ψ ∣ e i M t ∣ ψ ⟩ ) = t 1 ⟨ ψ ∣ sin ( M t ) ∣ ψ ⟩ = μ + O ( t 2 ) , (64)
or more precisely
∣ μ − 1 t Im ( ⟨ ψ ∣ e i M t ∣ ψ ⟩ ) ∣ ≤ t 2 6 . (65) \left|\mu-\frac{1}{t}\operatorname{Im}\left(\langle\psi|e^{iMt}|\psi\rangle\right)\right|\leq\frac{t^2}{6}. \tag*{(65)} μ − t 1 Im ( ⟨ ψ ∣ e i M t ∣ ψ ⟩ ) ≤ 6 t 2 . (65)
One can therefore estimate μ \mu μ by simulating exp ( i M t ) \exp(iMt) exp ( i M t ) for a sufficiently small t t t . However, this approach has a small-t t t approximation error. The block-encoding approach avoids this approximation, so we use it in the remainder of the section. To reduce the expectation value μ \mu μ to a nonnegative overlap, let us define the controlled block encoding
U M c : = ∣ 0 ⟩ ⟨ 0 ∣ ⊗ 1 + ∣ 1 ⟩ ⟨ 1 ∣ ⊗ U M , (66) U_M^{\mathrm{c}}:=|0\rangle\langle0|\otimes\mathbb{1}+|1\rangle\langle1|\otimes U_M, \tag*{(66)} U M c := ∣0 ⟩ ⟨ 0∣ ⊗ 1 + ∣1 ⟩ ⟨ 1∣ ⊗ U M , (66)
and let
∣ χ ⟩ : = ∣ + ⟩ ⊗ ∣ ϕ ⟩ = ∣ + ⟩ ⊗ ∣ 0 a ⟩ ⊗ ∣ ψ ⟩ , (67) |\chi\rangle:=|+\rangle\otimes|\phi\rangle=|+\rangle\otimes|0^a\rangle\otimes|\psi\rangle, \tag*{(67)} ∣ χ ⟩ := ∣ + ⟩ ⊗ ∣ ϕ ⟩ = ∣ + ⟩ ⊗ ∣ 0 a ⟩ ⊗ ∣ ψ ⟩ , (67)
where ∣ + ⟩ : = ( ∣ 0 ⟩ + ∣ 1 ⟩ ) / 2 |+\rangle:=(|0\rangle+|1\rangle)/\sqrt{2} ∣ + ⟩ := ( ∣0 ⟩ + ∣1 ⟩) / 2 . We then obtain
u : = ⟨ χ ∣ U M c ∣ χ ⟩ = 1 + ⟨ ϕ ∣ U M ∣ ϕ ⟩ 2 = 1 + μ 2 . (68) u:=\langle\chi|U_M^{\mathrm{c}}|\chi\rangle=\frac{1+\langle\phi|U_M|\phi\rangle}{2}=\frac{1+\mu}{2}. \tag*{(68)} u := ⟨ χ ∣ U M c ∣ χ ⟩ = 2 1 + ⟨ ϕ ∣ U M ∣ ϕ ⟩ = 2 1 + μ . (68)
Note that u ∈ [ 0 , 1 ] u\in[0,1] u ∈ [ 0 , 1 ] as μ ∈ [ − 1 , 1 ] \mu\in[-1,1] μ ∈ [ − 1 , 1 ] . Thus, estimating the observable expectation value is reduced to estimating the nonnegative overlap ⟨ χ ∣ U M c ∣ χ ⟩ = u \langle\chi|U_M^{\mathrm{c}}|\chi\rangle=u ⟨ χ ∣ U M c ∣ χ ⟩ = u , from which μ \mu μ is obtained as μ = 2 u − 1 \mu=2u-1 μ = 2 u − 1 .
The Hadamard-test approach
In this approach, we directly estimate the desired expectation value μ = ⟨ ψ ∣ M ∣ ψ ⟩ \mu=\langle\psi|M|\psi\rangle μ = ⟨ ψ ∣ M ∣ ψ ⟩ using the expectation value ⟨ ϕ ∣ U M ∣ ϕ ⟩ \langle\phi|U_M|\phi\rangle ⟨ ϕ ∣ U M ∣ ϕ ⟩ of the block encoding U M U_M U M of M M M . To this end, a test qubit is initialized in the state ∣ 0 ⟩ |0\rangle ∣0 ⟩ and transformed to ∣ + ⟩ |+\rangle ∣ + ⟩ by a Hadamard gate. This qubit is then used as the control qubit to apply U M U_M U M on the target register containing the block-encoding ancillas and the quantum solution register. Another Hadamard is then applied to the test qubit, after which the qubit is measured in the computational basis Figure 6 (b). The measurement outcome is either 0 or 1, and the probability of obtaining 0 is
Figure 6. Quantum circuits for estimating a property of the quantum solution state ∣ ψ ⟩ |\psi\rangle ∣ ψ ⟩ by three approaches: (a) phase estimation, (b) Hadamard test and (c) amplitude estimation. (d) Implementation of the controlled-S S S , with S S S given in Eq. (82) , in the amplitude-estimation approach
p 0 = 1 + Re ( ⟨ ϕ ∣ U M ∣ ϕ ⟩ ) 2 = 1 + μ 2 . (69) p_0=\frac{1+\operatorname{Re}(\langle\phi|U_M|\phi\rangle)}{2}=\frac{1+\mu}{2}. \tag*{(69)} p 0 = 2 1 + Re (⟨ ϕ ∣ U M ∣ ϕ ⟩) = 2 1 + μ . (69)
Now define a random variable X X X that takes the value + 1 +1 + 1 when the outcome is 0 and the value − 1 -1 − 1 when the outcome is 1. The average of X X X based on the possible measurement outcomes is then E ( X ) = p 0 − ( 1 − p 0 ) = μ \mathbb{E}(X)=p_0-(1-p_0)=\mu E ( X ) = p 0 − ( 1 − p 0 ) = μ . Therefore, the sample average of independent Hadamard-test outcomes provides an unbiased estimator of μ \mu μ . Specifically, let X 1 , … , X R X_1,\ldots,X_R X 1 , … , X R be the outcomes of R R R independent Hadamard tests. Then the sample average μ ~ : = ∑ r X r / R \tilde{\mu}:=\sum_r X_r/R μ ~ := ∑ r X r / R is an estimate of μ \mu μ . For a finite number of measurements, the error bound ∣ μ ~ − μ ∣ ≤ ε |\tilde{\mu}-\mu| \le\varepsilon ∣ μ ~ − μ ∣ ≤ ε does not always hold true. Because the measurement outcomes are random, the estimate μ ~ \tilde{\mu} μ ~ is also random. That is to say, different sets of R R R measurements generally give slightly different estimates. The probability that the statistical error from finitely many measurements exceeds the given error tolerance ε \varepsilon ε can be bounded using Hoeffding’s inequality as
Pr ( ∣ μ ~ − E ( X ) ∣ ≥ ε ) ≤ 2 exp ( − R ε 2 / 2 ) . (70) \Pr(|\tilde{\mu}-\mathbb{E}(X)| \ge\varepsilon) \le2\exp(-R\varepsilon^2/2). \tag*{(70)} Pr ( ∣ μ ~ − E ( X ) ∣ ≥ ε ) ≤ 2 exp ( − R ε 2 /2 ) . (70)
Therefore, R ≥ ⌈ 2 ε − 2 ln ( 2 / δ ) ⌉ R \ge\left\lceil2\varepsilon^{-2}\ln(2/\delta)\right\rceil R ≥ ⌈ 2 ε − 2 ln ( 2/ δ ) ⌉ independent repetitions are sufficient to estimate μ = E ( X ) \mu=\mathbb{E}(X) μ = E ( X ) to additive accuracy ε \varepsilon ε , with failure probability at most δ \delta δ .
Complexity. Each repetition needs a new preparation of the solution state ∣ ψ ⟩ |\psi\rangle ∣ ψ ⟩ and one controlled application of the block encoding U M U_M U M . Let C ψ ( ε ) C_{\psi}(\varepsilon) C ψ ( ε ) denote the cost of preparing the quantum solution state to accuracy ε \varepsilon ε . Also, let C M C_M C M denote the cost of implementing the block encoding U M U_M U M , or its controlled version; the additional control only changes the implementation cost by at most a constant factor. Then we have
C H T A = ( C ψ ( ε ) + C M ) × ⌈ 2 ε 2 ln ( 2 δ ) ⌉ (71) C_{\mathrm{HTA}}=(C_{\psi}(\varepsilon)+C_M)\times\left\lceil\frac{2}{\varepsilon^2}\ln\left(\frac{2}{\delta}\right)\right\rceil \tag*{(71)} C HTA = ( C ψ ( ε ) + C M ) × ⌈ ε 2 2 ln ( δ 2 ) ⌉ (71)
for the end-to-end complexity of the Hadamard-test approach for estimating solution properties.
The phase-estimation approach
Another approach for estimating the desired expectation value is to apply the quantum phase estimation (QPE) to the block encoding U M U_M U M and use samples from eigenphases of U M U_M U M to obtain an estimate of ⟨ ϕ ∣ U M ∣ ϕ ⟩ \langle\phi|U_M|\phi\rangle ⟨ ϕ ∣ U M ∣ ϕ ⟩ . This approach has two types of errors, one systematic error due to an approximation of the eigenphases and the other is statistical error due to a finite number of samples. For an accurate estimation, we need to bound both of these errors. To this end, let
U M = ∑ j e 2 π i θ j ∣ v j ⟩ ⟨ v j ∣ , θ j ∈ [ 0 , 1 ) , (72) U_M=\sum_j e^{2\pi i\theta_j}|v_j\rangle\langle v_j|,\quad\theta_j\in[0,1), \tag*{(72)} U M = j ∑ e 2 π i θ j ∣ v j ⟩ ⟨ v j ∣ , θ j ∈ [ 0 , 1 ) , (72)
be the spectral decomposition of U M U_M U M and expand ∣ ϕ ⟩ |\phi\rangle ∣ ϕ ⟩ in the eigenbasis of U M U_M U M as ∣ ϕ ⟩ = ∑ j α j ∣ v j ⟩ |\phi\rangle=\sum_j\alpha_j|v_j\rangle ∣ ϕ ⟩ = ∑ j α j ∣ v j ⟩ . Then we have
μ = ⟨ ϕ ∣ U M ∣ ϕ ⟩ = ∑ j ∣ α j ∣ 2 e 2 π i θ j = ∑ j ∣ α j ∣ 2 cos ( 2 π θ j ) (73) \mu=\langle\phi|U_M|\phi\rangle=\sum_j|\alpha_j|^2e^{2\pi i\theta_j}=\sum_j|\alpha_j|^2\cos(2\pi\theta_j) \tag*{(73)} μ = ⟨ ϕ ∣ U M ∣ ϕ ⟩ = j ∑ ∣ α j ∣ 2 e 2 π i θ j = j ∑ ∣ α j ∣ 2 cos ( 2 π θ j ) (73)
for the real number μ \mu μ . The phase-estimation algorithm Figure 6 (a) acts on t t t -qubit phase register initially prepared in the all-zero state, and a target register that encodes ∣ ϕ ⟩ |\phi\rangle ∣ ϕ ⟩ . Each qubit of the phase register is first transformed into the ∣ + ⟩ |+\rangle ∣ + ⟩ state. Then U M 2 k U_M^{2^k} U M 2 k is applied to the target register controlled on the k k k th qubit of the phase register. The inverse quantum Fourier transform (QFT) is then applied on the phase qubits, after which they are measured in the computational basis.
The result of measurement is a random t t t -bit number B ∈ { 0 , … , 2 t − 1 } B\in\{0,\ldots,2^t-1\} B ∈ { 0 , … , 2 t − 1 } . Each measurement outcome B = b B=b B = b provides an approximation θ ~ j = b / 2 t \tilde{\theta}_j=b/2^t θ ~ j = b / 2 t to one of the phases θ j \theta_j θ j , sampled with probability ∣ α j ∣ 2 |\alpha_j|^2 ∣ α j ∣ 2 . When θ j \theta_j θ j is not exactly representable by t t t bits, the QPE algorithm returns a t t t -bit estimate of an individual phase θ j \theta_j θ j only with a constant success probability. This success probability for each individual phase can be increased to 1 − δ 1-\delta 1 − δ by adding O ( log ( 1 / δ ) ) O(\log(1/\delta)) O ( log ( 1/ δ )) qubits to the phase register. However, for estimating an expectation value, it is not necessary to obtain individually accurate phases. That is to say, even though the t t t -bit phase is obtained only with constant probability, the expectation value of outputs can be accurate with high probability without requiring individually accurate phases. Moreover, increasing the number of phase qubits t t t only reduces the systematic error from the finite-bit approximation of the eigenphases. The scaling of the number of runs remains unchanged due to the statistical error associated with the eigenphase sampling.
More specifically, let us define the random variable X : = cos ( 2 π B / 2 t ) X:=\cos(2\pi B/2^t) X := cos ( 2 π B / 2 t ) using the random integer B B B obtained from measuring the phase register and let E ( X ) \mathbb{E}(X) E ( X ) be the expectation value of all measurement outcomes irrespective of which phase component j j j is selected. Then the systematic error due to the t t t -bit approximation of the phases is bounded as
∣ E ( X ) − μ ∣ ≤ 2 1 − t . (74) |\mathbb{E}(X)-\mu|\le2^{1-t}. \tag*{(74)} ∣ E ( X ) − μ ∣ ≤ 2 1 − t . (74)
See Appendix § 6 .§ 1 for a proof. Thus, choosing t ≥ ⌈ log 2 ( 2 / ε Q P E ) ⌉ t\ge\lceil\log_2(2/\varepsilon_{\mathrm{QPE}})\rceil t ≥ ⌈ log 2 ( 2/ ε QPE )⌉ suffices to make the systematic error at most ε Q P E \varepsilon_{\mathrm{QPE}} ε QPE . Now suppose X 1 , … , X R X_1,\ldots,X_R X 1 , … , X R are outcomes of R R R independent runs of QPE and let μ ~ : = ∑ r = 1 R X r / R \tilde{\mu}:=\sum_{r=1}^{R}X_r/R μ ~ := ∑ r = 1 R X r / R be their average. We can use Hoeffding’s inequality to bound the probability that the statistical error ∣ μ ~ − E ( X ) ∣ ≥ ε S T A T |\tilde{\mu}-\mathbb{E}(X)|\ge\varepsilon_{\mathrm{STAT}} ∣ μ ~ − E ( X ) ∣ ≥ ε STAT , for some error ε S T A T \varepsilon_{\mathrm{STAT}} ε STAT , from which we obtain a sufficient value for R R R . For simplicity, we assume ε Q P E = ε S T A T = ε / 2 \varepsilon_{\mathrm{QPE}}=\varepsilon_{\mathrm{STAT}}=\varepsilon/2 ε QPE = ε STAT = ε /2 , where ε \varepsilon ε is the given error tolerance. Then by Hoeffding’s inequality, Eq. (70) with ε → ε / 2 \varepsilon\to\varepsilon/2 ε → ε /2 , choosing R ≥ ⌈ 8 ε − 2 ln ( 2 / δ ) ⌉ R \ge\lceil8\varepsilon^{-2}\ln(2/\delta)\rceil R ≥ ⌈ 8 ε − 2 ln ( 2/ δ )⌉ is sufficient to obtain ∣ μ ~ − E ( X ) ∣ ≤ ε / 2 |\tilde{\mu}-\mathbb{E}(X)| \le\varepsilon/2 ∣ μ ~ − E ( X ) ∣ ≤ ε /2 with success probability at least 1 − δ 1-\delta 1 − δ . When ∣ μ ~ − E ( X ) ∣ ≤ ε / 2 |\tilde{\mu}-\mathbb{E}(X)| \le\varepsilon/2 ∣ μ ~ − E ( X ) ∣ ≤ ε /2 , the triangle inequality gives the bound
∣ μ ~ − μ ∣ ≤ ∣ μ ~ − E ( X ) ∣ + ∣ E ( X ) − μ ∣ ≤ ε 2 + ε 2 = ε (75) |\tilde{\mu}-\mu| \le|\tilde{\mu}-\mathbb{E}(X)|+|\mathbb{E}(X)-\mu| \le\frac{\varepsilon}{2}+\frac{\varepsilon}{2}=\varepsilon \tag*{(75)} ∣ μ ~ − μ ∣ ≤ ∣ μ ~ − E ( X ) ∣ + ∣ E ( X ) − μ ∣ ≤ 2 ε + 2 ε = ε (75)
for the total error. Therefore, the chosen values for t t t and R R R ensure that we have an ε \varepsilon ε -accurate estimation of μ \mu μ with high probability, i.e., Pr ( ∣ μ ~ − μ ∣ ≤ ε ) ≥ 1 − δ \Pr(|\tilde{\mu}-\mu| \le\varepsilon) \ge1-\delta Pr ( ∣ μ ~ − μ ∣ ≤ ε ) ≥ 1 − δ .
Complexity. Each run of QPE needs a new preparation of the solution state ∣ ψ ⟩ |\psi\rangle ∣ ψ ⟩ , one application of the inverse QFT on t t t qubits, and 2 t − 1 2^t-1 2 t − 1 controlled applications of the block encoding U M U_M U M . Let C Q F T ( t ) C_{\mathrm{QFT}}(t) C QFT ( t ) denote the cost of t t t -qubit QFT. Then we have
C P E A = ( C ψ ( ε ) + ( 2 t − 1 ) C M + C Q F T ( t ) ) × R (76) C_{\mathrm{PEA}}=\left(C_{\psi}(\varepsilon)+(2^t-1)C_M+C_{\mathrm{QFT}}(t)\right)\times R \tag*{(76)} C PEA = ( C ψ ( ε ) + ( 2 t − 1 ) C M + C QFT ( t ) ) × R (76)
with
t = ⌈ log 2 ( 4 ε ) ⌉ , R = ⌈ 8 ε 2 ln ( 2 δ ) ⌉ (77) t=\left\lceil\log_2\left(\frac{4}{\varepsilon}\right)\right\rceil,\qquad R=\left\lceil\frac{8}{\varepsilon^2}\ln\left(\frac{2}{\delta}\right)\right\rceil \tag*{(77)} t = ⌈ log 2 ( ε 4 ) ⌉ , R = ⌈ ε 2 8 ln ( δ 2 ) ⌉ (77)
for the end-to-end complexity of estimating solution properties by the phase-estimation approach. As t t t is logarithmic in 1 / ε 1/\varepsilon 1/ ε , we can use the standard implementation for QFT that uses Θ ( t 2 ) \Theta(t^2) Θ ( t 2 ) elementary gates.
The amplitude-estimation approach
We now build on the reduction discussed in § 2.5.1 to compute the expectation value μ \mu μ by estimating an amplitude. Notice that the nonnegative overlap u = ( 1 + μ ) / 2 u=(1+\mu)/2 u = ( 1 + μ ) /2 in Eq. (68) is equal to the amplitude ∣ ⟨ χ ∣ U M c ∣ χ ⟩ ∣ |\langle\chi|U_M^c|\chi\rangle| ∣ ⟨ χ ∣ U M c ∣ χ ⟩ ∣ . To estimate this amplitude, we construct a rotation operator S S S so that the state ∣ χ ⟩ |\chi\rangle ∣ χ ⟩ is an equal superposition of two eigenstates of S S S with eigenvalues exp ( ± 2 π i θ ) \exp(\pm2\pi i\theta) exp ( ± 2 π i θ ) , where cos ( π θ ) = u \cos(\pi\theta)=u cos ( π θ ) = u . A single run of QPE applied to S S S with target state ∣ χ ⟩ |\chi\rangle ∣ χ ⟩ then yields an accurate estimate of θ \theta θ , and hence of u u u and μ \mu μ , with constant success probability. A single run of QPE applied to S S S requires O ( 1 / ε ) \mathcal{O}(1/\varepsilon) O ( 1/ ε ) controlled applications of S S S to obtain θ \theta θ with accuracy ε \varepsilon ε , so this approach provides a quadratic improvement over the O ( 1 / ε 2 ) \mathcal{O}(1/\varepsilon^2) O ( 1/ ε 2 ) cost of previous approaches.
To elaborate this approach, let us define two r r r -qubit state vectors ∣ ψ 0 ⟩ : = ∣ χ ⟩ |\psi_0\rangle:=|\chi\rangle ∣ ψ 0 ⟩ := ∣ χ ⟩ and ∣ ψ 1 ⟩ : = U M c ∣ χ ⟩ |\psi_1\rangle:=U_M^c|\chi\rangle ∣ ψ 1 ⟩ := U M c ∣ χ ⟩ where r = 1 + a + n r=1+a+n r = 1 + a + n . Then we can express the overlap u = ⟨ ψ 0 ∣ ψ 1 ⟩ u=\langle\psi_0|\psi_1\rangle u = ⟨ ψ 0 ∣ ψ 1 ⟩ in terms of the angle α \alpha α between these vectors as ⟨ ψ 0 ∣ ψ 1 ⟩ = cos α \langle\psi_0|\psi_1\rangle=\cos\alpha ⟨ ψ 0 ∣ ψ 1 ⟩ = cos α , where α ∈ [ 0 , π / 2 ] \alpha\in[0,\pi/2] α ∈ [ 0 , π /2 ] by u ∈ [ 0 , 1 ] u\in[0,1] u ∈ [ 0 , 1 ] . Now let V V V be the r r r -qubit unitary such that V ∣ 0 r ⟩ = ∣ ψ 0 ⟩ V|0^r\rangle=|\psi_0\rangle V ∣ 0 r ⟩ = ∣ ψ 0 ⟩ , i.e., V V V is the unitary that prepares ∣ ψ 0 ⟩ |\psi_0\rangle ∣ ψ 0 ⟩ from the all-zero state. Also let R ψ : = 1 − 2 ∣ ψ ⟩ ⟨ ψ ∣ R_{\psi}:=1-2|\psi\rangle\langle\psi| R ψ := 1 − 2∣ ψ ⟩ ⟨ ψ ∣ be the reflection operator about the state ∣ ψ ⟩ |\psi\rangle ∣ ψ ⟩ . The product of two reflections S : = R ψ 1 R ψ 0 S:=R_{\psi_1}R_{\psi_0} S := R ψ 1 R ψ 0 is a rotation operator in the 2D space spanned by ∣ ψ 0 ⟩ |\psi_0\rangle ∣ ψ 0 ⟩ and ∣ ψ 1 ⟩ |\psi_1\rangle ∣ ψ 1 ⟩ . This is because a reflection about one vector followed by a reflection about another vector is a rotation by twice the angle between the vectors. The eigenvalues of S S S are therefore λ ± = exp ( ± 2 i α ) \lambda_{\pm}=\exp(\pm2i\alpha) λ ± = exp ( ± 2 i α ) . It also follows that the target state ∣ ψ 0 ⟩ |\psi_0\rangle ∣ ψ 0 ⟩ is an equal superposition of two eigenstates of S S S , i.e., ∣ ψ 0 ⟩ = ( ∣ ψ + ⟩ + ∣ ψ − ⟩ ) / 2 |\psi_0\rangle=(|\psi_+\rangle+|\psi_-\rangle)/\sqrt{2} ∣ ψ 0 ⟩ = ( ∣ ψ + ⟩ + ∣ ψ − ⟩) / 2 .
In the QPE convention, these eigenstates have eigenvalues λ + = exp ( 2 π i θ ) \lambda_+=\exp(2\pi i\theta) λ + = exp ( 2 π i θ ) and λ − = exp ( 2 π i ( 1 − θ ) ) \lambda_-=\exp(2\pi i(1-\theta)) λ − = exp ( 2 π i ( 1 − θ )) , where θ : = α / π ∈ [ 0 , 1 / 2 ] \theta:=\alpha/\pi\in[0,1/2] θ := α / π ∈ [ 0 , 1/2 ] . Thus, QPE applied to S S S with target state ∣ ψ 0 ⟩ |\psi_0\rangle ∣ ψ 0 ⟩ yields an estimate close to either θ \theta θ or 1 − θ 1-\theta 1 − θ , from which we obtain an estimate of θ \theta θ . Specifically, let b ∈ { 0 , … , 2 t − 1 } b\in\{0,\ldots,2^t-1\} b ∈ { 0 , … , 2 t − 1 } be the t t t -bit integer obtained from measuring t t t -qubit phase register, then θ ~ = min ( b / 2 t , 1 − b / 2 t ) \tilde{\theta}=\min(b/2^t,1-b/2^t) θ ~ = min ( b / 2 t , 1 − b / 2 t ) is an estimate of θ \theta θ obtained from the single run of QPE. From this estimate we have u ~ = cos ( π θ ~ ) \tilde{u}=\cos(\pi\tilde{\theta}) u ~ = cos ( π θ ~ ) and μ ~ = 2 u ~ − 1 \tilde{\mu}=2\tilde{u}-1 μ ~ = 2 u ~ − 1 .
As conventional in QPE, if we consider the nearest integer b = ⌊ 2 t ϕ ⌋ b=\lfloor2^t\phi\rfloor b = ⌊ 2 t ϕ ⌋ to 2 t ϕ 2^t\phi 2 t ϕ as the successful measurement outcome, where ϕ \phi ϕ is either of the eigenphases θ \theta θ or 1 − θ 1-\theta 1 − θ , then we have ∣ θ ~ − θ ∣ ≤ 1 / 2 t + 1 |\tilde{\theta}-\theta|\le1/2^{t+1} ∣ θ ~ − θ ∣ ≤ 1/ 2 t + 1 with a success probability that is at least 4 / π 2 4/\pi^2 4/ π 2 . We therefore have
∣ μ ~ − μ ∣ = 2 ∣ cos ( π θ ~ ) − cos ( π θ ) ∣ ≤ 2 π ∣ θ ~ − θ ∣ ≤ π 2 t , (78) |\tilde{\mu}-\mu|=2|\cos(\pi\tilde{\theta})-\cos(\pi\theta)|\le2\pi|\tilde{\theta}-\theta|\le\frac{\pi}{2^t}, \tag*{(78)} ∣ μ ~ − μ ∣ = 2∣ cos ( π θ ~ ) − cos ( π θ ) ∣ ≤ 2 π ∣ θ ~ − θ ∣ ≤ 2 t π , (78)
with probability ≥ 4 / π 2 ≈ 0.4 \ge4/\pi^2\approx0.4 ≥ 4/ π 2 ≈ 0.4 . As this probability is smaller than 1 / 2 1/2 1/2 , it cannot be amplified to an arbitrarily high value by repetition. As shown in Appendix § 6 .§ 2 , if we allow the phase error to be at most 1 / 2 t 1/2^t 1/ 2 t instead of 1 / 2 t + 1 1/2^{t+1} 1/ 2 t + 1 , then the success probability, i.e., the probability that ∣ θ ~ − θ ∣ ≤ 2 − t |\tilde{\theta}-\theta|\le2^{-t} ∣ θ ~ − θ ∣ ≤ 2 − t , becomes at least 8 / π 2 8/\pi^2 8/ π 2 . In this case, ∣ μ ~ − μ ∣ ≤ 2 π / 2 t |\tilde{\mu}-\mu|\le2\pi/2^t ∣ μ ~ − μ ∣ ≤ 2 π / 2 t and thus choosing t ≥ ⌈ log 2 ( 2 π / ε ) ⌉ t\ge\lceil\log_2(2\pi/\varepsilon)\rceil t ≥ ⌈ log 2 ( 2 π / ε )⌉ is sufficient to obtain an ε \varepsilon ε -accurate μ \mu μ with probability at least 8 / π 2 8/\pi^2 8/ π 2 .
We can now amplify the success probability to a high value of 1 − δ 1-\delta 1 − δ by repetition. To this end, let μ ~ 1 , … , μ ~ R \tilde{\mu}_1,\ldots,\tilde{\mu}_R μ ~ 1 , … , μ ~ R be estimates obtained from R R R independent runs and let μ ~ \tilde{\mu} μ ~ be the median of these estimates. Each run is successful if ∣ μ ~ r − μ ∣ ≤ ε |\tilde{\mu}_r-\mu|\le\varepsilon ∣ μ ~ r − μ ∣ ≤ ε , so the median can fail only if at most half of the runs are successful. To bound the failure probability, let us use f r ∈ { 0 , 1 } f_r\in\{0,1\} f r ∈ { 0 , 1 } as a flag to indicate whether run r r r is successful f r = 1 f_r=1 f r = 1 or not f r = 0 f_r=0 f r = 0 . The median μ ~ \tilde{\mu} μ ~ then fails if the average of successful runs f ˉ : = ∑ r f r / R \bar{f}:=\sum_r f_r/R f ˉ := ∑ r f r / R satisfies f ˉ ≤ 1 / 2 \bar{f}\le1/2 f ˉ ≤ 1/2 . Note that the bound E ( f ˉ ) ≥ 8 / π 2 \mathbb{E}(\bar{f})\ge8/\pi^2 E ( f ˉ ) ≥ 8/ π 2 on the expected value of the average for different sets of R R R estimates because the expected value of each flag is E ( f r ) = Pr ( ∣ μ ~ r − μ ∣ ≤ ε ) ≥ 8 / π 2 \mathbb{E}(f_r)=\Pr(|\widetilde{\mu}_r-\mu|\le\varepsilon)\ge8/\pi^2 E ( f r ) = Pr ( ∣ μ r − μ ∣ ≤ ε ) ≥ 8/ π 2 . The failure probability of the median can therefore be bounded as
Pr ( ∣ μ ~ − μ ∣ ≥ ε ) ≤ Pr ( f ‾ ≤ 1 / 2 ) (79) \Pr(|\widetilde{\mu}-\mu|\ge\varepsilon)\le\Pr(\overline{f}\le1/2) \tag*{(79)} Pr ( ∣ μ − μ ∣ ≥ ε ) ≤ Pr ( f ≤ 1/2 ) (79)
≤ Pr ( f ‾ − E ( f ‾ ) ≤ − c ) (80) \le\Pr(\overline{f}-\mathbb{E}(\overline{f})\le-c) \tag*{(80)} ≤ Pr ( f − E ( f ) ≤ − c ) (80)
≤ e − 2 R c 2 , (81) \le e^{-2Rc^2}, \tag*{(81)} ≤ e − 2 R c 2 , (81)
where c : = 8 / π 2 − 1 / 2 c:=8/\pi^2-1/2 c := 8/ π 2 − 1/2 , the second line follows from E ( f ‾ ) ≥ 8 / π 2 \mathbb{E}(\overline{f})\ge8/\pi^2 E ( f ) ≥ 8/ π 2 , and the third line is obtained from Hoeffding’s inequality. Therefore, choosing R ≥ ⌈ ln ( 1 / δ ) / ( 2 c 2 ) ⌉ R\ge\lceil\ln(1/\delta)/(2c^2)\rceil R ≥ ⌈ ln ( 1/ δ ) / ( 2 c 2 )⌉ would be sufficient to obtain an ε \varepsilon ε -accurate μ \mu μ with probability at least 1 − δ 1-\delta 1 − δ . For a unique median estimate, we choose the smallest odd integer for R R R here.
Complexity. Each run of QPE here needs a new preparation of the r r r -qubit state ∣ ψ 0 ⟩ = ∣ χ ⟩ |\psi_0\rangle=|\chi\rangle ∣ ψ 0 ⟩ = ∣ χ ⟩ with r = 1 + a + n r=1+a+n r = 1 + a + n , one application of the inverse QFT on t t t qubits, and 2 t − 1 2^t-1 2 t − 1 controlled applications of
S = U M R ψ 0 U M † R ψ 0 = U M V R 0 V † U M † V R 0 V † (82) S=U_M R_{\psi_0} U_M^\dagger R_{\psi_0}=U_M V R_0 V^\dagger U_M^\dagger V R_0 V^\dagger \tag*{(82)} S = U M R ψ 0 U M † R ψ 0 = U M V R 0 V † U M † V R 0 V † (82)
on r r r qubits Figure 6 (c). Here R 0 r R_{0^r} R 0 r is the reflection about ∣ 0 r ⟩ |0^r\rangle ∣ 0 r ⟩ and V V V is the r r r -qubit unitary that prepares ∣ χ ⟩ |\chi\rangle ∣ χ ⟩ from the all-zero state, i.e., V ∣ 0 r ⟩ = ∣ χ ⟩ = ∣ + ⟩ ∣ 0 a ⟩ ∣ ψ ⟩ V|0^r\rangle=|\chi\rangle=|+\rangle|0^a\rangle|\psi\rangle V ∣ 0 r ⟩ = ∣ χ ⟩ = ∣ + ⟩ ∣ 0 a ⟩ ∣ ψ ⟩ . The cost of V V V is then simply the cost C ψ ( ε ) C_\psi(\varepsilon) C ψ ( ε ) of unitary U ψ U_\psi U ψ for preparing the n n n -qubit solution state ∣ ψ ⟩ |\psi\rangle ∣ ψ ⟩ . Note that for the controlled-S S S operation, we only need to replace R 0 r R_{0^r} R 0 r with its controlled version R 0 r c R_{0^r}^c R 0 r c . This is because if the control qubit is at ∣ 0 ⟩ |0\rangle ∣0 ⟩ , then R 0 r c R_{0^r}^c R 0 r c becomes identity and all unitaries in S S S cancel out and if the control qubit is at ∣ 1 ⟩ |1\rangle ∣1 ⟩ , S S S is applied Figure 6 (d). The cost of controlled S S S is therefore C S = 2 C M + 4 C ψ ( ε ) + 2 C R ( r ) C_S=2C_M+4C_\psi(\varepsilon)+2C_R(r) C S = 2 C M + 4 C ψ ( ε ) + 2 C R ( r ) , where C R ( r ) C_R(r) C R ( r ) denotes the cost of controlled reflection about the r r r -qubit zero state. We therefore have
C A E A = ( C ψ ( ε ) + ( 2 t − 1 ) C S + C Q F T ( t ) ) × R (83) C_{\mathrm{AEA}}=\left(C_\psi(\varepsilon)+(2^t-1)C_S+C_{\mathrm{QFT}}(t)\right)\times R \tag*{(83)} C AEA = ( C ψ ( ε ) + ( 2 t − 1 ) C S + C QFT ( t ) ) × R (83)
with
t = ⌈ log 2 ( 2 π ε ) ⌉ , R = ⌈ ln ( 1 / δ ) 2 ( 8 π 2 − 1 2 ) 2 ⌉ (84) t=\left\lceil\log_2\left(\frac{2\pi}{\varepsilon}\right)\right\rceil,\qquad R=\left\lceil\frac{\ln(1/\delta)}{2\left(\frac{8}{\pi^2}-\frac{1}{2}\right)^2}\right\rceil \tag*{(84)} t = ⌈ log 2 ( ε 2 π ) ⌉ , R = ⌈ 2 ( π 2 8 − 2 1 ) 2 ln ( 1/ δ ) ⌉ (84)
for the end-to-end complexity of estimating solution properties by the amplitude-estimation approach. The controlled reflection about ∣ 0 r ⟩ |0^r\rangle ∣ 0 r ⟩ can be implemented using Θ ( r ) \Theta(r) Θ ( r ) elementary gates (Appendix § 6 .§ 3 ).
Finally, we note that unlike the phase-estimation approach, the number of runs R R R in the amplitude-estimation approach can be reduced to R = 1 R=1 R = 1 by increasing the size of the phase register. This is possible because the input state here is an equal superposition of two eigenstates with phases θ \theta θ and 1 − θ 1-\theta 1 − θ , and so a single run of QPE provides an ε \varepsilon ε -accurate estimate of θ \theta θ . By the standard analysis, if we increase the number of phase qubits to
t = ⌈ log 2 [ 2 π ε ( 2 + 1 2 δ ) ] ⌉ , (85) t=\left\lceil\log_2\left[\frac{2\pi}{\varepsilon}\left(2+\frac{1}{2\delta}\right)\right]\right\rceil, \tag*{(85)} t = ⌈ log 2 [ ε 2 π ( 2 + 2 δ 1 ) ] ⌉ , (85)
the success probability becomes at least 1 − δ 1-\delta 1 − δ . Although this approach has a single run, it needs more ancillas and running a deeper circuit as 2 t ∈ O ( 1 / δ ε ) 2^t\in O(1/\delta\varepsilon) 2 t ∈ O ( 1/ δ ε ) . The approach based on repetition is therefore preferable, as its circuit depth is independent of δ \delta δ and the number of runs scales only logarithmically with 1 / δ 1/\delta 1/ δ .
Tailored end-to-end quantum algorithm for the Poisson-Boltzmann equation
In this section, we construct a tailored quantum algorithm for the Poisson-Boltzmann equation in simulating a biomolecular system. We begin by describing the PDE in § 3.1 . In § 3.2 , we discuss the appropriate initial state of the system and present a tailored implementation for its oracle with a detailed cost analysis. We then present a quantum algorithm for generating a quantum solution of the PDE and provide an implementation for the operator oracle. Finally, in § 3.4 , we identify several properties of interest of the biomolecular system, construct a suitable observable for them and provide a tailored implementation for the observable oracle.
The linearized Poisson-Boltzmann equation
The Poisson-Boltzmann equation (PBE) is a nonlinear elliptic PDE that models the electrostatic potential in a system comprising a biomolecule, such as a protein, immersed in an ionic solution consisting of a solvent, such as water, and dissolved ions (see Figure 7 ). The biomolecule is represented by a collection of fixed atomic charges, whereas the solvent is treated as a dielectric continuum specified by its permittivity rather than explicitly representing its individual molecules. The dissolved ions are also described by continuous concentration distributions rather than by explicitly representing individual ions, and they are assumed to follow the Boltzmann distribution at equilibrium. This Poisson-Boltzmann equation has the form [23 , 24 , 25 , 26 , 27 ]
− ∇ ⋅ ( ε ( x ) ∇ u ( x ) ) + κ ˉ 2 ( x ) sinh ( u ( x ) ) = 4 π e 2 K B T ∑ a = 0 N a t m − 1 z a δ ( x − x a ) x ∈ Ω = ( 0 , L ) 3 ⊂ R 3 , (86) -\nabla\cdot\left(\varepsilon(x)\nabla u(x)\right) + \bar{\kappa}^{2}(x)\sinh(u(x)) = \frac{4\pi e^{2}}{K_{B}T}\sum_{a=0}^{N_{\mathrm{atm}}-1} z_{a}\delta(x-x_{a}) \quad x \in\Omega= (0,L)^{3} \subset\mathbb{R}^{3}, \tag*{(86)} − ∇ ⋅ ( ε ( x ) ∇ u ( x ) ) + κ ˉ 2 ( x ) sinh ( u ( x )) = K B T 4 π e 2 a = 0 ∑ N atm − 1 z a δ ( x − x a ) x ∈ Ω = ( 0 , L ) 3 ⊂ R 3 , (86)
where N a t m N_{\mathrm{atm}} N atm is the number of atomic point charges of the biomolecule, z a z_a z a is the partial charge of atom a a a at position x a x_a x a as a fraction of the elementary charge e e e , and u ( x ) = e ϕ ( x ) / K B T u(x) = e\phi(x)/K_BT u ( x ) = e ϕ ( x ) / K B T is the electrostatic potential ϕ ( x ) \phi(x) ϕ ( x ) in the dimensionless form, with K B T K_BT K B T the thermal energy. The position-dependent function ε ( x ) \varepsilon(x) ε ( x ) is the dielectric coefficient, and κ ˉ 2 ( x ) \bar{\kappa}^{2}(x) κ ˉ 2 ( x ) is the Debye–Huckel screening parameter, which depends on the concentration of the dissolved ions and determines their effect on the electrostatic potential.
The domain Ω \Omega Ω here is a cubic computational domain with side length L L L , chosen sufficiently large to contain the biomolecule and the surrounding solvent. The physical problem is naturally on the unbounded domain R 3 \mathbb{R}^{3} R 3 , with the potential vanishing far from the molecule, so Ω \Omega Ω represents a finite truncation of this domain. Biomolecules such as proteins and enzymes typically have sizes ranging from about 10 to over 100 angstroms, and a value of L L L several times larger than the molecular size is commonly used [28 ] .
A conventional approach [23 , 29 ] to model this system is to divide the domain Ω \Omega Ω into two regions Ω = Ω c a v ∪ Ω o u t \Omega= \Omega_{\mathrm{cav}} \cup\Omega_{\mathrm{out}} Ω = Ω cav ∪ Ω out , where Ω c a v \Omega_{\mathrm{cav}} Ω cav is the region occupied by the biomolecule and Ω o u t = Ω ∖ Ω c a v \Omega_{\mathrm{out}} = \Omega\setminus\Omega_{\mathrm{cav}} Ω out = Ω ∖ Ω cav is the region outside the molecular region occupied by the ionic solution. The molecular region is modeled by the van der Waals cavity as the union of overlapping atom-centered balls
Ω c a v = ⋃ a = 0 N a t m − 1 B ( x a , r a ) , (87) \Omega_{\mathrm{cav}} = \bigcup_{a=0}^{N_{\mathrm{atm}}-1} B(x_a,r_a), \tag*{(87)} Ω cav = a = 0 ⋃ N atm − 1 B ( x a , r a ) , (87)
where
B ( x a , r a ) : = { ∥ x − x a ∥ ≤ r a } (88) B(x_a,r_a) := \left\{\lVert x-x_a\rVert\le r_a\right\} \tag*{(88)} B ( x a , r a ) := { ∥ x − x a ∥ ≤ r a } (88)
is the ball centered at position x a x_a x a of atom a a a with the van der Waals radius of r a r_a r a . Hereafter, we refer to Ω c a v \Omega_{\mathrm{cav}} Ω cav as the molecular cavity. In this model, the dielectric coefficient ε ( x ) \varepsilon(x) ε ( x ) and the scaled screening parameter κ ( x ) : = κ ˉ 2 ( x ) \kappa(x) := \bar{\kappa}^{2}(x) κ ( x ) := κ ˉ 2 ( x ) are piecewise constant functions of the form
ε ( x ) = { ε c a v x ∈ Ω c a v ε o u t x ∈ Ω o u t k ( x ) = { 0 x ∈ Ω c a v ε o u t κ o u t 2 x ∈ Ω o u t , (89) \varepsilon(x) =
\begin{cases}
\varepsilon_{\mathrm{cav}} & x \in\Omega_{\mathrm{cav}} \\
\varepsilon_{\mathrm{out}} & x \in\Omega_{\mathrm{out}}
\end{cases}
\qquad
k(x) =
\begin{cases}
0 & x \in\Omega_{\mathrm{cav}} \\
\varepsilon_{\mathrm{out}}\kappa_{\mathrm{out}}^{2} & x \in\Omega_{\mathrm{out}},
\end{cases} \tag*{(89)} ε ( x ) = { ε cav ε out x ∈ Ω cav x ∈ Ω out k ( x ) = { 0 ε out κ out 2 x ∈ Ω cav x ∈ Ω out , (89)
where ε c a v \varepsilon_{\mathrm{cav}} ε cav and ε o u t \varepsilon_{\mathrm{out}} ε out are the dielectric permittivity of the biomolecule and solvent, respectively, and κ o u t \kappa_{\mathrm{out}} κ out is the Debye–Hückel screening constant of the ionic solution. Numerical values of these parameters depend on the solvent and temperature, but ε o u t \varepsilon_{\mathrm{out}} ε out is two orders of magnitude greater than ε c a v \varepsilon_{\mathrm{cav}} ε cav . For reference, at room temperature, representative values are ε c a v = 1 \varepsilon_{\mathrm{cav}} = 1 ε cav = 1 or 2 2 2 , ε o u t = 78.55 \varepsilon_{\mathrm{out}} = 78.55 ε out = 78.55 for water as the solvent, and κ o u t = 0.104 A ˚ − 1 \kappa_{\mathrm{out}} = 0.104\,\text{\AA}^{-1} κ out = 0.104 A ˚ − 1 [23 ] ; note that k ( x ) k(x) k ( x ) is dimensionless.
The nonlinearity of the PBE is due to sinh ( u ) \sinh(u) sinh ( u ) term, which describes the response of the dissolved ions to the electrostatic potential. In the regime where ∣ u ∣ ≪ 1 |u| \ll1 ∣ u ∣ ≪ 1 , the approximation sinh ( u ) = u + O ( ∣ u ∣ 3 ) \sinh(u) = u + O(|u|^{3}) sinh ( u ) = u + O ( ∣ u ∣ 3 ) is used to replace the nonlinear ionic response by a linear term, and we obtain the linearized PBE. For clarity and convenience, we write the linearized PBE compactly as L u ( x ) = b ( x ) \mathcal{L}u(x) = b(x) L u ( x ) = b ( x ) , where
L : = − ∇ ⋅ ( ε ( x ) ∇ ) + k ( x ) (90) \mathcal{L} := -\nabla\cdot\left(\varepsilon(x)\nabla\right) + k(x) \tag*{(90)} L := − ∇ ⋅ ( ε ( x ) ∇ ) + k ( x ) (90)
and the inhomogeneity is
b ( x ) : = c b ∑ a = 0 N a t m − 1 z a δ ( x − x a ) , c b : = 4 π e 0 2 K B T , (91) b(x) := c_b \sum_{a=0}^{N_{\mathrm{atm}}-1} z_a\delta(x-x_a), \qquad c_b := \frac{4\pi e_0^2}{K_{\mathrm{B}}T}, \tag*{(91)} b ( x ) := c b a = 0 ∑ N atm − 1 z a δ ( x − x a ) , c b := K B T 4 π e 0 2 , (91)
where c b c_b c b is a constant. The set of atom positions { x a } \{x_a\} { x a } , partial charges { z a } \{z_a\} { z a } , and the parameters in c b c_b c b specify b ( x ) b(x) b ( x ) . The cavity region Ω c a v \Omega_{\mathrm{cav}} Ω cav is determined from the set of atom positions { x a } \{x_a\} { x a } and the van der Waals radii { r a } \{r_a\} { r a } . These sets along with constants ε c a v \varepsilon_{\mathrm{cav}} ε cav , ε o u t \varepsilon_{\mathrm{out}} ε out , and κ o u t \kappa_{\mathrm{out}} κ out in Eq. (89) specify the functions ε ( x ) \varepsilon(x) ε ( x ) and k ( x ) k(x) k ( x ) , and hence the differential operator L \mathcal{L} L .
The initial state and tailored implementation for its oracle
The initial state to prepare is a quantum state ∣ b ⟩ |b\rangle ∣ b ⟩ whose amplitudes encode a discretized version of the function b ( x ) b(x) b ( x ) in Eq. (91) . A standard discretization approach used in classical Poisson-Boltzmann solvers is to map the Dirac delta associated with each point charge centered at position x a x_a x a onto nearest-neighbor grid points with weights that depend on the atom position. We adopt the same approach, but first consider the simpler case in which each atomic position is mapped onto its nearest-neighbor grid points with equal weights. We present our state-preparation algorithm for this case and then extend it to the case with position-dependent weights. We also extend our state-preparation approach to discretizations where each Dirac delta is mapped onto a larger set of neighboring grid points.
The initial state with uniform charge distribution
For clarity, we first describe this state in 1D and then extend it to higher dimensions. For the 1D problem, we map the Dirac delta associated with atom a a a centered at position x a x_a x a equally onto two nearest-neighbor grid points x a = ⌊ x a / h ⌋ x_a = \lfloor x_a/h \rfloor x a = ⌊ x a / h ⌋ and x a + 1 x_a + 1 x a + 1 , where h h h is the grid spacing. Specifically, we map the Dirac delta as
δ ( x − x a ) ↦ 1 2 h ∑ s ∈ { 0 , 1 } δ j , x a + s . (92) \delta(x-x_a) \mapsto\frac{1}{2h}\sum_{s\in\{0,1\}}\delta_{j,x_a+s}. \tag*{(92)} δ ( x − x a ) ↦ 2 h 1 s ∈ { 0 , 1 } ∑ δ j , x a + s . (92)
so that the same weight 1 / 2 1/2 1/2 is assigned to each neighboring point. The factor 1 / h 1/h 1/ h here is included so that the discretized Delta preserves the continuum normalization ∫ Ω d x δ ( x − x a ) = 1 \int_{\Omega} \mathrm{d}x\,\delta(x-x_a)=1 ∫ Ω d x δ ( x − x a ) = 1 . Similarly, for the d d d -dimensional problem, we map the Dirac delta as
δ ( x − x a ) ↦ 1 2 d h d ∑ s ∈ { 0 , 1 } d δ q , x a + s . (93) \delta(\mathbf{x}-\mathbf{x}_a) \mapsto\frac{1}{2^d h^d}\sum_{\mathbf{s}\in\{0,1\}^d}\delta_{\mathbf{q},\mathbf{x}_a+\mathbf{s}}. \tag*{(93)} δ ( x − x a ) ↦ 2 d h d 1 s ∈ { 0 , 1 } d ∑ δ q , x a + s . (93)
with equal weight of 1 / 2 d 1/2^d 1/ 2 d for each neighboring point. Here q \mathbf{q} q is the index of grid points and we refer to x a \mathbf{x}_a x a as the position of atom a a a in the grid coordinates. For the 3D problem, we have q = ( i , j , k ) \mathbf{q}=(i,j,k) q = ( i , j , k ) and x a = ( x a , y a , z a ) \mathbf{x}_a=(x_a,y_a,z_a) x a = ( x a , y a , z a ) , where x a = ⌊ x a / h ⌋ x_a=\lfloor x_a/h\rfloor x a = ⌊ x a / h ⌋ , y a = ⌊ y a / h ⌋ y_a=\lfloor y_a/h\rfloor y a = ⌊ y a / h ⌋ and z a = ⌊ z a / h ⌋ z_a=\lfloor z_a/h\rfloor z a = ⌊ z a / h ⌋ .
The discretized version of b ( x ) b(x) b ( x ) in Eq. (91) is then
b ( x ) ↦ b ( q ) : = c b 2 d h d ∑ a , s z a δ q , x a + s . (94) b(x)\mapsto b(\mathbf{q}):=\frac{c_b}{2^d h^d}\sum_{a,s}z_a\delta_{\mathbf{q},\mathbf{x}_a+\mathbf{s}}. \tag*{(94)} b ( x ) ↦ b ( q ) := 2 d h d c b a , s ∑ z a δ q , x a + s . (94)
Let us define b : = b ( q ) / ∥ b ( q ) ∥ \mathbf{b}:=b(\mathbf{q})/\|b(\mathbf{q})\| b := b ( q ) /∥ b ( q ) ∥ , then the normalized quantum state to prepare is
∣ b ⟩ = 1 ∥ z ∥ ∑ a = 0 N a t m − 1 z a ∣ ψ a ⟩ , ∣ ψ a ⟩ : = 1 2 d ∑ s ∈ { 0 , 1 } d ∣ x a + s ⟩ , (95) |b\rangle=\frac{1}{\|\mathbf{z}\|}\sum_{a=0}^{N_{\mathrm{atm}}-1}z_a|\psi_a\rangle,\qquad|\psi_a\rangle:=\frac{1}{\sqrt{2^d}}\sum_{\mathbf{s}\in\{0,1\}^d}|\mathbf{x}_a+\mathbf{s}\rangle, \tag*{(95)} ∣ b ⟩ = ∥ z ∥ 1 a = 0 ∑ N atm − 1 z a ∣ ψ a ⟩ , ∣ ψ a ⟩ := 2 d 1 s ∈ { 0 , 1 } d ∑ ∣ x a + s ⟩ , (95)
where the overall prefactor in b ( q ) b(\mathbf{q}) b ( q ) is removed by normalization. We refer to the state ∣ ψ a ⟩ |\psi_a\rangle ∣ ψ a ⟩ as the weighted atom-position state. In d d d dimensions, this state is simply a tensor product of 1D states as
∣ ψ a ⟩ = ∣ ψ a , 0 ⟩ ⊗ ⋯ ⊗ ∣ ψ a , d − 1 ⟩ , ∣ ψ a , ν ⟩ = 1 2 ∑ s ν ∈ { 0 , 1 } ∣ x a , ν + s ν ⟩ , (96) |\psi_a\rangle=|\psi_{a,0}\rangle\otimes\cdots\otimes|\psi_{a,d-1}\rangle,\qquad|\psi_{a,\nu}\rangle=\frac{1}{\sqrt{2}}\sum_{s_\nu\in\{0,1\}}|x_{a,\nu}+s_\nu\rangle, \tag*{(96)} ∣ ψ a ⟩ = ∣ ψ a , 0 ⟩ ⊗ ⋯ ⊗ ∣ ψ a , d − 1 ⟩ , ∣ ψ a , ν ⟩ = 2 1 s ν ∈ { 0 , 1 } ∑ ∣ x a , ν + s ν ⟩ , (96)
where ∣ ψ a , ν ⟩ |\psi_{a,\nu}\rangle ∣ ψ a , ν ⟩ is the atom-position state in direction ν \nu ν . The explicit state for the 3D problem is
∣ ψ a ⟩ = 1 2 3 ∑ s x , s y , s z ∈ { 0 , 1 } ∣ x a + s x ⟩ ∣ y a + s y ⟩ ∣ z a + s z ⟩ . (97) |\psi_a\rangle=\frac{1}{\sqrt{2^3}}\sum_{s_x,s_y,s_z\in\{0,1\}}|x_a+s_x\rangle|y_a+s_y\rangle|z_a+s_z\rangle. \tag*{(97)} ∣ ψ a ⟩ = 2 3 1 s x , s y , s z ∈ { 0 , 1 } ∑ ∣ x a + s x ⟩ ∣ y a + s y ⟩ ∣ z a + s z ⟩ . (97)
An important assumption we use here for the initial state ∣ b ⟩ |b\rangle ∣ b ⟩ to be a normalized state is that we assume the neighboring points associated with different atoms do not overlap. Specifically, let
supp ( a ) : = { x a + s : s ∈ { 0 , 1 } d } (98) \operatorname{supp}(a):=\{\mathbf{x}_a+\mathbf{s}: \mathbf{s}\in\{0,1\}^d\} \tag*{(98)} supp ( a ) := { x a + s : s ∈ { 0 , 1 } d } (98)
be the support of atom a a a , defined as the set of atom a a a 's neighboring grid points. We assume atoms have disjoint supports, i.e.,
supp ( a ) ∩ supp ( a ′ ) = ∅ (99) \operatorname{supp}(a)\cap\operatorname{supp}(a')=\varnothing \tag*{(99)} supp ( a ) ∩ supp ( a ′ ) = ∅ (99)
for each pair ( a , a ′ ) (a,a') ( a , a ′ ) of atoms. In this case, the atom-position states ∣ ψ a ⟩ \lvert\psi_a\rangle ∣ ψ a ⟩ are mutually orthogonal and ∣ b ⟩ \lvert b\rangle ∣ b ⟩ is a normalized state. The support of each atom depends on the grid spacing h h h ; this is also explicitly noted in the documentation of the Adaptive Poisson–Boltzmann Solver (APBS) [30 ] , which is a widely used software package for solving the PB equation.
As the grid spacing is a discretization parameter, the assumption of disjoint supports can always be satisfied by sufficiently refining the grid. That is, by choosing a sufficiently small grid spacing so that the support of different atoms do not overlap. A sufficient condition for disjoint supports is separation of atoms by at least 2 h 2h 2 h in at least one spatial direction. A simple and sufficient condition in d d d dimensions is then choosing h h h so that ∥ x a − x a ′ ∥ ≥ 2 h d \lVert x_a-x_{a'}\rVert\ge2h\sqrt{d} ∥ x a − x a ′ ∥ ≥ 2 h d . Typical bond lengths in biomolecules are in the range of 1–1.5 Å, and the grid spacing of h = 0.5 h=0.5 h = 0.5 Å is commonly used in classical PBE solvers [31 ] . Therefore, reducing the commonly used grid spacing to h = 0.25 h=0.25 h = 0.25 Å gives a separation of 2 3 h ≈ 0.9 2\sqrt{3}h\approx0.9 2 3 h ≈ 0.9 Å in 3D, which is below the typical bond lengths, and so it is sufficient to have disjoint supports.
Loading the initial sate with uniform charge distribution
We now present our approach for loading the initial state ∣ b ⟩ \lvert b\rangle ∣ b ⟩ in Eq. (95) . To this end, first we prepare the state
∣ z ⟩ : = ∑ a = 0 N a t m − 1 z ˉ a ∣ a ⟩ , z ˉ a : = z a ∥ z ∥ , (100) \lvert z\rangle:= \sum_{a=0}^{N_{\mathrm{atm}}-1} \bar{z}_a \lvert a\rangle,\qquad\bar{z}_a := \frac{z_a}{\lVert z\rVert}, \tag*{(100)} ∣ z ⟩ := a = 0 ∑ N atm − 1 z ˉ a ∣ a ⟩ , z ˉ a := ∥ z ∥ z a , (100)
where ∣ a ⟩ \lvert a\rangle ∣ a ⟩ is the basis state encoding the index a a a of atoms. This state can be simply prepared using the binary-tree approach discussed in § 2.2 . Using the state ∣ z ⟩ \lvert z\rangle ∣ z ⟩ and the classically known atomic positions { x a } \{x_a\} { x a } in the grid coordinates, we then prepare
∣ p o s ⟩ : = ∑ a z ˉ a ∣ x a ⟩ , (101) \lvert\mathrm{pos}\rangle:= \sum_a \bar{z}_a \lvert x_a\rangle, \tag*{(101)} ∣ pos ⟩ := a ∑ z ˉ a ∣ x a ⟩ , (101)
which we call the atom-position state. To prepare this state, first we perform the map
P O S : ∣ a ⟩ i d x ∣ 0 n ⟩ s y s ⊗ d ↦ ∣ a ⟩ i d x ∣ x a ⟩ s y s (102) \mathrm{POS}:\ \lvert a\rangle_{\mathrm{idx}}\lvert0^n\rangle_{\mathrm{sys}}^{\otimes d}\mapsto\lvert a\rangle_{\mathrm{idx}}\lvert x_a\rangle_{\mathrm{sys}} \tag*{(102)} POS : ∣ a ⟩ idx ∣ 0 n ⟩ sys ⊗ d ↦ ∣ a ⟩ idx ∣ x a ⟩ sys (102)
by adding the atom position x a x_a x a to the d n dn d n -qubit system register sys controlled on the value of the m m m -qubit atom-index register idx with m = ⌈ log 2 ( N a t m ) ⌉ m=\lceil\log_2(N_{\mathrm{atm}})\rceil m = ⌈ log 2 ( N atm )⌉ . Then we erase idx using values of the atom positions x a x_a x a . To erase idx, for each atom a a a , we test if the value encoded in sys is equal to x a x_a x a and write the result into a flag qubit f f f . That is, we perform the equality test
U t e s t : ∣ 0 ⟩ f ∣ q ⟩ s y s ↦ { ∣ 1 ⟩ f ∣ q ⟩ s y s if q = x a , ∣ 0 ⟩ f ∣ q ⟩ s y s else (103) U_{\mathrm{test}}:\ \lvert0\rangle_f\lvert q\rangle_{\mathrm{sys}}\mapsto
\begin{cases}
\lvert1\rangle_f\lvert q\rangle_{\mathrm{sys}} & \text{if }q=x_a,\\
\lvert0\rangle_f\lvert q\rangle_{\mathrm{sys}} & \text{else}
\end{cases} \tag*{(103)} U test : ∣ 0 ⟩ f ∣ q ⟩ sys ↦ { ∣ 1 ⟩ f ∣ q ⟩ sys ∣ 0 ⟩ f ∣ q ⟩ sys if q = x a , else (103)
for atom a a a , where q q q is the value of register sys. Then controlled on ∣ 1 ⟩ f \lvert1\rangle_f ∣ 1 ⟩ f , we add − a -a − a into m m m -qubit register idx, where a a a is the classically known m m m -bit atom index; this is simply controlled-addition operation CADD ( − a ) \operatorname{CADD}(-a) CADD ( − a ) in Eq. (30) on m m m qubits. We then erase the flag by reapplying the equality test. Let
U e r a s e : = U t e s t CADD U t e s t (104) U_{\mathrm{erase}}:=U_{\mathrm{test}}\operatorname{CADD}U_{\mathrm{test}} \tag*{(104)} U erase := U test CADD U test (104)
be the sequence of operations that erase the index register and let U z U_z U z be the unitary that prepares the state ∣ z ⟩ \lvert z\rangle ∣ z ⟩ in Eq. (100) . Also, let us define
U p o s : = U e r a s e POS U z , (105) U_{\mathrm{pos}}:=U_{\mathrm{erase}}\operatorname{POS}U_z, \tag*{(105)} U pos := U erase POS U z , (105)
then by the described steps
U p o s ∣ 0 ⟩ f ∣ 0 m ⟩ i d x ∣ 0 n ⟩ s y s ⊗ d = ∣ 0 ⟩ f ∣ 0 m ⟩ i d x ∣ p o s ⟩ s y s , (106) U_{\mathrm{pos}}\lvert0\rangle_f\lvert0^m\rangle_{\mathrm{idx}}\lvert0^n\rangle_{\mathrm{sys}}^{\otimes d}
=\lvert0\rangle_f\lvert0^m\rangle_{\mathrm{idx}}\lvert\mathrm{pos}\rangle_{\mathrm{sys}}, \tag*{(106)} U pos ∣ 0 ⟩ f ∣ 0 m ⟩ idx ∣ 0 n ⟩ sys ⊗ d = ∣ 0 ⟩ f ∣ 0 m ⟩ idx ∣ pos ⟩ sys , (106)
and so the atom-position state ∣ p o s ⟩ \lvert\mathrm{pos}\rangle ∣ pos ⟩ is prepared on the system register.
We now perform the map ∣ x a ⟩ ↦ ∑ s ∣ x a + s ⟩ \lvert x_a\rangle\mapsto\sum_s\lvert x_a+s\rangle ∣ x a ⟩ ↦ ∑ s ∣ x a + s ⟩ . To this end, we prepare a d d d -qubit ancilla register, which we call the selector register and denote it by sel, in the uniform state
∣ + ⟩ s e l d = 1 2 d ∑ s ∈ { 0 , 1 } d ∣ s ⟩ s e l , (107) \lvert+\rangle_{\mathrm{sel}}^d=\frac{1}{\sqrt{2^d}}\sum_{s\in\{0,1\}^d}\lvert s\rangle_{\mathrm{sel}}, \tag*{(107)} ∣ + ⟩ sel d = 2 d 1 s ∈ { 0 , 1 } d ∑ ∣ s ⟩ sel , (107)
by applying d d d Hadamard gates. Then we apply the shift operation
U s h i f t : ∣ s ⟩ s e l ∣ x a ⟩ s y s ↦ ∣ s ⟩ s e l ∣ x a + s ⟩ s y s (108) U_{\mathrm{shift}}:\ \lvert s\rangle_{\mathrm{sel}}\lvert x_a\rangle_{\mathrm{sys}}\mapsto\lvert s\rangle_{\mathrm{sel}}\lvert x_a+s\rangle_{\mathrm{sys}} \tag*{(108)} U shift : ∣ s ⟩ sel ∣ x a ⟩ sys ↦ ∣ s ⟩ sel ∣ x a + s ⟩ sys (108)
followed by d d d Hadamard gates on the selector register. Let us denote these operations by
W : = ( H ⊗ d ⊗ 1 ) U s h i f t ( H ⊗ d ⊗ 1 ) , (109) W := (H^{\otimes d} \otimes1)U_{\mathrm{shift}}(H^{\otimes d} \otimes1), \tag*{(109)} W := ( H ⊗ d ⊗ 1 ) U shift ( H ⊗ d ⊗ 1 ) , (109)
then we have
W ∣ 0 d ⟩ s e l ∣ p o s ⟩ s y s = 1 2 d ∣ 0 d ⟩ s e l ∣ b ⟩ s y s + ∣ ⊥ ⟩ s e l ⊗ s y s (110) W\lvert0^d\rangle_{\mathrm{sel}}\lvert\mathrm{pos}\rangle_{\mathrm{sys}} = \frac{1}{\sqrt{2^d}}\lvert0^d\rangle_{\mathrm{sel}}\lvert b\rangle_{\mathrm{sys}} + \lvert\perp\rangle_{\mathrm{sel}\otimes\mathrm{sys}} \tag*{(110)} W ∣ 0 d ⟩ sel ∣ pos ⟩ sys = 2 d 1 ∣ 0 d ⟩ sel ∣ b ⟩ sys + ∣ ⊥ ⟩ sel ⊗ sys (110)
with ( ⟨ 0 d ∣ ⊗ 1 ) ∣ ⊥ ⟩ = 0 (\langle0^d\lvert\otimes1)\lvert\perp\rangle= 0 (⟨ 0 d ∣ ⊗ 1 ) ∣ ⊥ ⟩ = 0 . This transformation can be verified as
( ⟨ 0 d ∣ ⊗ 1 ) W ∣ 0 d ⟩ ∣ p o s ⟩ = ( ⟨ 0 d ∣ ⊗ 1 ) ( H ⊗ d ⊗ 1 ) 1 2 d ∑ s ∑ a z ˉ a ∣ s ⟩ ∣ x a + s ⟩ = 1 2 d ∑ s , s ′ ∑ a z ˉ a ⟨ s ′ ∣ s ⟩ ∣ x a + s ⟩ = 1 2 d ∣ b ⟩ . (111) \begin{aligned}
(\langle0^d\lvert\otimes1)W\lvert0^d\rangle\lvert\mathrm{pos}\rangle
&= (\langle0^d\lvert\otimes1)(H^{\otimes d}\otimes1)\frac{1}{\sqrt{2^d}}\sum_s\sum_a \bar{z}_a\lvert s\rangle\lvert x_a+s\rangle\\
&= \frac{1}{2^d}\sum_{s,s'}\sum_a \bar{z}_a\langle s'\lvert s\rangle\lvert x_a+s\rangle\\
&= \frac{1}{\sqrt{2^d}}\lvert b\rangle. \tag*{(111)}
\end{aligned} (⟨ 0 d ∣ ⊗ 1 ) W ∣ 0 d ⟩ ∣ pos ⟩ = (⟨ 0 d ∣ ⊗ 1 ) ( H ⊗ d ⊗ 1 ) 2 d 1 s ∑ a ∑ z ˉ a ∣ s ⟩ ∣ x a + s ⟩ = 2 d 1 s , s ′ ∑ a ∑ z ˉ a ⟨ s ′ ∣ s ⟩ ∣ x a + s ⟩ = 2 d 1 ∣ b ⟩ . (111)
Observe that, condition on success, i.e., the d d d -qubit selector register being in the zero state, the generated state on the second register is the desired initial state ∣ b ⟩ \lvert b\rangle ∣ b ⟩ . The success probability is also known and is exactly 1 / 2 d 1/2^d 1/ 2 d . This probabilistic state preparation can be made deterministic using the amplitude-reduction technique [32 Sec. 2.3] followed by amplitude amplification.
If the initial success probability is p = sin 2 θ p=\sin^2\theta p = sin 2 θ , then the success probability becomes sin 2 [ ( 2 r + 1 ) θ ] \sin^2[(2r+1)\theta] sin 2 [( 2 r + 1 ) θ ] after r r r rounds of amplitude amplification. Perfect success is therefore obtained when initial probability is p r ⋆ = sin 2 [ ( π / 2 ) / ( 2 r + 1 ) ] p_r^\star=\sin^2[(\pi/2)/(2r+1)] p r ⋆ = sin 2 [( π /2 ) / ( 2 r + 1 )] . If the initial probability is larger than p r ⋆ p_r^\star p r ⋆ , we deliberately reduce it to p r ⋆ p_r^\star p r ⋆ with smallest r r r by appending one ancilla qubit prepared in the state R ( α ) ∣ 0 ⟩ = cos ( α / 2 ) ∣ 0 ⟩ + sin ( α / 2 ) ∣ 1 ⟩ R(\alpha)\lvert0\rangle=\cos(\alpha/2)\lvert0\rangle+\sin(\alpha/2)\lvert1\rangle R ( α ) ∣ 0 ⟩ = cos ( α /2 ) ∣ 0 ⟩ + sin ( α /2 ) ∣ 1 ⟩ and defining success to additionally require this ancilla to be in ∣ 0 ⟩ \lvert0\rangle ∣ 0 ⟩ . The new probability then becomes p cos 2 ( α / 2 ) p\cos^2(\alpha/2) p cos 2 ( α /2 ) , so choosing cos 2 ( α / 2 ) = p r ⋆ / p \cos^2(\alpha/2)=p_r^\star/p cos 2 ( α /2 ) = p r ⋆ / p , makes the initial success probability p r ⋆ p_r^\star p r ⋆ , and it then can be amplified to exactly 1 1 1 by r r r rounds of amplitude amplification.
For our 3D problem (d = 3 d=3 d = 3 ), the initial success probability is p = 1 / 8 > p 2 ⋆ = sin 2 ( π / 10 ) = ( 3 − 5 ) / 8 p=1/8>p_2^\star=\sin^2(\pi/10)=(3-\sqrt{5})/8 p = 1/8 > p 2 ⋆ = sin 2 ( π /10 ) = ( 3 − 5 ) /8 , so we choose the rotation angle
α = 2 arccos ( 3 − 5 ) (112) \alpha=2\arccos\left(\sqrt{3-\sqrt{5}}\right) \tag*{(112)} α = 2 arccos ( 3 − 5 ) (112)
for the ancilla qubit to reduce the initial success probability to sin 2 ( π / 10 ) \sin^2(\pi/10) sin 2 ( π /10 ) . As the flag qubit in Eq. (106) is returned to ∣ 0 ⟩ \lvert0\rangle ∣ 0 ⟩ , we use it as the ancilla qubit for amplitude reduction. Let us define
U p r o b : = R ( α ) W U p o s , (113) U_{\mathrm{prob}}:=R(\alpha)WU_{\mathrm{pos}}, \tag*{(113)} U prob := R ( α ) W U pos , (113)
then the probabilistic state preparation for the 3D problem can be written as
U p r o b ∣ 0 ⟩ f ∣ 0 3 ⟩ s e l ∣ 0 m ⟩ i d x ∣ 0 n ⟩ s y s = p s u c c ∣ G ⟩ + 1 − p s u c c ∣ B ⟩ , (114) U_{\mathrm{prob}}\lvert0\rangle_f\lvert0^3\rangle_{\mathrm{sel}}\lvert0^m\rangle_{\mathrm{idx}}\lvert0^n\rangle_{\mathrm{sys}}=\sqrt{p_{\mathrm{succ}}}\lvert G\rangle+\sqrt{1-p_{\mathrm{succ}}}\lvert B\rangle, \tag*{(114)} U prob ∣ 0 ⟩ f ∣ 0 3 ⟩ sel ∣ 0 m ⟩ idx ∣ 0 n ⟩ sys = p succ ∣ G ⟩ + 1 − p succ ∣ B ⟩ , (114)
where the success probability is p s u c c = sin 2 ( π / 10 ) p_{\mathrm{succ}}=\sin^2(\pi/10) p succ = sin 2 ( π /10 ) , the good state is
∣ G ⟩ = ∣ 0 ⟩ f ∣ 0 3 ⟩ s e l ∣ 0 m ⟩ i d x ∣ b ⟩ s y s , (115) \lvert G\rangle=\lvert0\rangle_f\lvert0^3\rangle_{\mathrm{sel}}\lvert0^m\rangle_{\mathrm{idx}}\lvert b\rangle_{\mathrm{sys}}, \tag*{(115)} ∣ G ⟩ = ∣ 0 ⟩ f ∣ 0 3 ⟩ sel ∣ 0 m ⟩ idx ∣ b ⟩ sys , (115)
and the bad state that satisfies ⟨ B ∣ G ⟩ = 0 \langle B\lvert G\rangle=0 ⟨ B ∣ G ⟩ = 0 . After just two rounds of amplitude amplification, the good state, and hence the initial state, is generated with unit success probability. That is,
A 2 U p r o b ∣ 0 ⟩ f ∣ 0 3 ⟩ s e l ∣ 0 m ⟩ i d x ∣ 0 n ⟩ s y s = ∣ 0 ⟩ f ∣ 0 3 ⟩ s e l ∣ 0 m ⟩ i d x ∣ b ⟩ s y s (116) \mathcal{A}^2U_{\mathrm{prob}}\lvert0\rangle_f\lvert0^3\rangle_{\mathrm{sel}}\lvert0^m\rangle_{\mathrm{idx}}\lvert0^n\rangle_{\mathrm{sys}}=\lvert0\rangle_f\lvert0^3\rangle_{\mathrm{sel}}\lvert0^m\rangle_{\mathrm{idx}}\lvert b\rangle_{\mathrm{sys}} \tag*{(116)} A 2 U prob ∣ 0 ⟩ f ∣ 0 3 ⟩ sel ∣ 0 m ⟩ idx ∣ 0 n ⟩ sys = ∣ 0 ⟩ f ∣ 0 3 ⟩ sel ∣ 0 m ⟩ idx ∣ b ⟩ sys (116)
where A \mathcal{A} A denotes the amplitude-amplification operator.
As the input state is the fixed all-zero state, we use ordinary amplitude amplification with the amplification operator
A = U p r o b R t U p r o b † R G , (117) \mathcal{A}=U_{\mathrm{prob}}R_tU_{\mathrm{prob}}^\dagger R_G, \tag*{(117)} A = U prob R t U prob † R G , (117)
where R t : = 2 ∣ 0 t ⟩ ⟨ 0 t ∣ − 1 t R_t:=2\lvert0^t\rangle\langle0^t\rvert-1_t R t := 2 ∣ 0 t ⟩ ⟨ 0 t ∣ − 1 t is the reflection about the input state ∣ 0 t ⟩ \lvert0^t\rangle ∣ 0 t ⟩ with t = 3 n + m + 4 t=3n+m+4 t = 3 n + m + 4 the total number of qubits of the input state, and R G = R 4 ⊗ 1 t − 4 R_G=R_4\otimes1_{t-4} R G = R 4 ⊗ 1 t − 4 is the reflection about the good state. Notice that R G R_G R G is simply a reflection about the flag and three ancilla qubits, because the index register index is zero in both good and bad states. The quantum circuit based on the described approach for loading the initial state with uniform charge distribution is given in Figure 8 .
Figure 8. Quantum circuit for loading the initial state with uniform charge distribution. The index register with m = 5 m = 5 m = 5 qubits is shown for illustration. The boxes with = ? \stackrel{?}{=} = ? represent equality testing.
Cost analysis. By the described approach, the total cost C l o a d C_{\mathrm{load}} C load of loading the initial state is
C l o a d = 5 C ( U p r o b ) + 2 C ( R G ) + 2 C ( R t ) , (118) C_{\mathrm{load}} = 5C(U_{\mathrm{prob}}) + 2C(R_G) + 2C(R_t), \tag*{(118)} C load = 5 C ( U prob ) + 2 C ( R G ) + 2 C ( R t ) , (118)
where C ( U ) C(U) C ( U ) denotes the cost of implementing the unitary U U U , with cost being either the gate cost G ( U ) G(U) G ( U ) or the circuit depth D ( U ) D(U) D ( U ) . By Eq. (113) and Eq. (109)
C ( U p r o b ) = 2 d + 1 + C ( U s h i f t ) + C ( U p o s ) (119) C(U_{\mathrm{prob}}) = 2d + 1 + C(U_{\mathrm{shift}}) + C(U_{\mathrm{pos}}) \tag*{(119)} C ( U prob ) = 2 d + 1 + C ( U shift ) + C ( U pos ) (119)
and by Eq. (105)
C ( U p o s ) = C ( U z ) + N a t m [ C ( P O S ) + C ( U e r a s e ) ] , (120) C(U_{\mathrm{pos}}) = C(U_z) + N_{\mathrm{atm}}[C(\mathrm{POS}) + C(U_{\mathrm{erase}})], \tag*{(120)} C ( U pos ) = C ( U z ) + N atm [ C ( POS ) + C ( U erase )] , (120)
where we used that POS and U e r a s e U_{\mathrm{erase}} U erase are applied for each atom. Also, by Eq. (104) , we have
C ( U e r a s e ) = 2 C ( U t e s t ) + C ( C A D D ) . (121) C(U_{\mathrm{erase}}) = 2C(U_{\mathrm{test}}) + C(\mathrm{CADD}). \tag*{(121)} C ( U erase ) = 2 C ( U test ) + C ( CADD ) . (121)
We now analyze the cost of the primitive operations: U z U_z U z , POS, U t e s t U_{\mathrm{test}} U test , CADD, U s h i f t U_{\mathrm{shift}} U shift , and the reflections R G R_G R G and R t R_t R t . We consider d = 3 d = 3 d = 3 in our cost analysis as our application is naturally a 3D problem, but the generalization to higher d d d is straightforward. We use the following lemma and its corollary in our cost analysis. Proof of Corollary 1 is provided in Appendix § 6 .§ 3 .
Lemma 4 ([33 ] and [18 Lem. 1] ). The k k k -controlled NOT gate, denoted by C k ( X ) C^k(X) C k ( X ) , can be implemented using one dirty ancilla qubit and a circuit with Θ ( k ) \Theta(k) Θ ( k ) gates from { X , C N O T , T o f f o l i } \{X, \mathrm{CNOT}, \mathrm{Toffoli}\} { X , CNOT , Toffoli } and Θ ( log k ) \Theta(\log k) Θ ( log k ) depth.
Corollary 1. The k k k -controlled reflection operator about the n n n -qubit zero state ∣ 0 n ⟩ \lvert0^n\rangle ∣ 0 n ⟩ can be implemented using one dirty ancilla qubit and a circuit with Θ ( k + n ) \Theta(k+n) Θ ( k + n ) gates from { X , C N O T , T o f f o l i } \{X, \mathrm{CNOT}, \mathrm{Toffoli}\} { X , CNOT , Toffoli } and Θ ( log ( k + n ) ) \Theta(\log(k+n)) Θ ( log ( k + n )) depth.
Using the binary-tree approach in § 2.2 for preparing ∣ z ⟩ \lvert z\rangle ∣ z ⟩ , U z U_z U z can be implemented using one clean ancilla and a circuit with Θ ( N a t m ) \Theta(N_{\mathrm{atm}}) Θ ( N atm ) gates and Θ ( N a t m ) \Theta(N_{\mathrm{atm}}) Θ ( N atm ) depth. The cost of classical precomputation is Θ ( N a t m log ( N a t m ) ) \Theta(N_{\mathrm{atm}}\log(N_{\mathrm{atm}})) Θ ( N atm log ( N atm )) .
POS writes the classically known atom position x a x_a x a in grid coordinates into the 3 n 3n 3 n -qubit register sys controlled on the m m m -qubit register idx. This is a m m m -controlled classical-quantum addition that, by Lemma 3, can be implemented using one dirty ancilla and a circuit with Θ ( m + n log n ) \Theta(m+n\log n) Θ ( m + n log n ) gates and Θ ( log m + log 2 n ) \Theta(\log m+\log^2 n) Θ ( log m + log 2 n ) depth. The cost of classical precomputation for computing all atom positions { x a } \{x_a\} { x a } is simply Θ ( N a t m ) \Theta(N_{\mathrm{atm}}) Θ ( N atm ) .
Altogether with m = ⌈ log 2 N a t m ⌉ m=\lceil\log_2 N_{\mathrm{atm}}\rceil m = ⌈ log 2 N atm ⌉ , the overall resource scaling for loading the initial state is
G l o a d = Θ ( N a t m ( log N a t m + n log n ) ) , (122) \mathcal{G}_{\mathrm{load}}=\Theta\left(N_{\mathrm{atm}}(\log N_{\mathrm{atm}}+n\log n)\right), \tag*{(122)} G load = Θ ( N atm ( log N atm + n log n ) ) , (122)
D l o a d = Θ ( N a t m ( log log N a t m + log 2 n ) ) , (123) \mathcal{D}_{\mathrm{load}}=\Theta\left(N_{\mathrm{atm}}(\log\log N_{\mathrm{atm}}+\log^2 n)\right), \tag*{(123)} D load = Θ ( N atm ( log log N atm + log 2 n ) ) , (123)
C l o a d c l a s s i c a l = Θ ( N a t m log N a t m ) , (124) \mathcal{C}_{\mathrm{load}}^{\mathrm{classical}}=\Theta\left(N_{\mathrm{atm}}\log N_{\mathrm{atm}}\right), \tag*{(124)} C load classical = Θ ( N atm log N atm ) , (124)
using m + 5 m+5 m + 5 clean ancilla qubits and one dirty ancilla. The clean ancillas are used in the m m m -qubit atom-index register, three selector qubits, one flag, and one additional clean ancilla for implementation.
Loading the initial state with beyond-nearest-neighbor charge distribution
Our approach can be extended to discretizations in which the charge of an atom is distributed over a larger set of neighboring grid points. For instance, in 1D, to distribute the charge of atom a a a over three points, we map the Dirac delta onto three grid points x a = ⌊ x a / h ⌉ x_a=\lfloor x_a/h\rceil x a = ⌊ x a / h ⌉ and x a ± 1 x_a\pm1 x a ± 1 as
δ ( x − x a ) ↦ 1 4 h ( δ j , x a − 1 + 2 δ j , x a + δ j , x a + 1 ) , (125) \delta(x-x_a)\mapsto\frac{1}{4h}\left(\delta_{j,x_a-1}+2\delta_{j,x_a}+\delta_{j,x_a+1}\right), \tag*{(125)} δ ( x − x a ) ↦ 4 h 1 ( δ j , x a − 1 + 2 δ j , x a + δ j , x a + 1 ) , (125)
where the weight w s = 2 1 − ∣ s ∣ / 4 w_s=2^{1-\lvert s\rvert}/4 w s = 2 1 − ∣ s ∣ /4 for s ∈ { 0 , ± 1 } s\in\{0,\pm1\} s ∈ { 0 , ± 1 } is chosen to preserve the continuum normalization of the Dirac delta. The corresponding normalized initial state in 1D is then
∣ b ⟩ = 1 ∥ z ∥ ∑ a = 0 N a t m − 1 z a ∣ ψ a ⟩ (126) \lvert b\rangle=\frac{1}{\lVert z\rVert}\sum_{a=0}^{N_{\mathrm{atm}}-1}z_a\lvert\psi_a\rangle \tag*{(126)} ∣ b ⟩ = ∥ z ∥ 1 a = 0 ∑ N atm − 1 z a ∣ ψ a ⟩ (126)
with the weighted atom-position state
∣ ψ a ⟩ = 1 6 ∑ s ∈ { 0 , ± 1 } 2 1 − ∣ s ∣ ∣ x a + s ⟩ . (127) \lvert\psi_a\rangle=\frac{1}{\sqrt{6}}\sum_{s\in\{0,\pm1\}}2^{1-\lvert s\rvert}\lvert x_a+s\rangle. \tag*{(127)} ∣ ψ a ⟩ = 6 1 s ∈ { 0 , ± 1 } ∑ 2 1 − ∣ s ∣ ∣ x a + s ⟩ . (127)
In d d d dimensions, the weight for s ∈ { 0 , ± 1 } d s\in\{0,\pm1\}^d s ∈ { 0 , ± 1 } d is
w s = 2 d − ∥ s ∥ 1 4 d = 1 2 d + ∥ s ∥ 1 , (128) w_s=\frac{2^{d-\lVert s\rVert_1}}{4^d}=\frac{1}{2^{d+\lVert s\rVert_1}}, \tag*{(128)} w s = 4 d 2 d − ∥ s ∥ 1 = 2 d + ∥ s ∥ 1 1 , (128)
where ∥ s ∥ 1 = ∑ ν ∣ s ν ∣ \lVert s\rVert_1=\sum_\nu\lvert s_\nu\rvert ∥ s ∥ 1 = ∑ ν ∣ s ν ∣ is the 1-norm of vector s s s . The initial state for the d d d -dimensional problem is simply obtained by the tensor product of the 1D atom-position states, in which case we have
∣ ψ a ⟩ = 1 6 d ∑ s ∈ { 0 , ± 1 } d 2 d − ∥ s ∥ 1 ∣ x a + s ⟩ . (129) \lvert\psi_a\rangle=\frac{1}{\sqrt{6^d}}\sum_{s\in\{0,\pm1\}^d}2^{d-\lVert s\rVert_1}\lvert x_a+s\rangle. \tag*{(129)} ∣ ψ a ⟩ = 6 d 1 s ∈ { 0 , ± 1 } d ∑ 2 d − ∥ s ∥ 1 ∣ x a + s ⟩ . (129)
To ensure atoms have disjoint supports needed for mutually orthogonal atom-position states ∣ ψ a ⟩ \lvert\psi_a\rangle ∣ ψ a ⟩ , we choose grid spacing sufficiently small so that atoms on grid coordinates are separated by at least 3 h 3h 3 h in at least one spatial direction. A simple and sufficient condition for disjoint supports in d d d dimensions is to choose h h h so that ∥ x a − x a ′ ∥ ≥ 3 h d \lVert x_a-x_{a'}\rVert\geq3h\sqrt{d} ∥ x a − x a ′ ∥ ≥ 3 h d .
The modification needed in the previously discussed approach for state loading is that instead of preparing the selector register in the uniform state ∣ + ⟩ ⊗ d \lvert+\rangle^{\otimes d} ∣ + ⟩ ⊗ d , we prepare it in the selector state defined as
∣ s e l ⟩ = ( U ∣ 00 ⟩ ) ⊗ d = 1 2 d ∑ s 2 d − ∥ s ∥ 1 ∣ s ⟩ (130) \lvert\mathrm{sel}\rangle=(U\lvert00\rangle)^{\otimes d}=\frac{1}{2^d}\sum_s\sqrt{2^{d-\lVert s\rVert_1}}\lvert s\rangle \tag*{(130)} ∣ sel ⟩ = ( U ∣ 00 ⟩ ) ⊗ d = 2 d 1 s ∑ 2 d − ∥ s ∥ 1 ∣ s ⟩ (130)
where
U ∣ 00 ⟩ = 1 2 ∑ s = − 1 1 2 1 − ∣ s ∣ ∣ s ⟩ = 1 2 ( ∣ 11 ⟩ + 2 ∣ 00 ⟩ + ∣ 01 ⟩ ) = C ( H ) ( H ⊗ 1 ) ∣ 00 ⟩ (131) U\lvert00\rangle= \frac{1}{2}\sum_{s=-1}^{1}\sqrt{2^{1-\lvert s\rvert}}\lvert s\rangle
= \frac{1}{2}\left(\lvert11\rangle+\sqrt{2}\lvert00\rangle+\lvert01\rangle\right)
= C(H)(H\otimes1)\lvert00\rangle \tag*{(131)} U ∣ 00 ⟩ = 2 1 s = − 1 ∑ 1 2 1 − ∣ s ∣ ∣ s ⟩ = 2 1 ( ∣ 11 ⟩ + 2 ∣ 00 ⟩ + ∣ 01 ⟩ ) = C ( H ) ( H ⊗ 1 ) ∣ 00 ⟩ (131)
is the selector state for each direction with ∣ 11 ⟩ ↔ ∣ s = − 1 ⟩ \lvert11\rangle\leftrightarrow\lvert s=-1\rangle ∣ 11 ⟩ ↔ ∣ s = − 1 ⟩ , ∣ 00 ⟩ ↔ ∣ s = 0 ⟩ \lvert00\rangle\leftrightarrow\lvert s=0\rangle ∣ 00 ⟩ ↔ ∣ s = 0 ⟩ and ∣ 01 ⟩ ↔ ∣ s = 1 ⟩ \lvert01\rangle\leftrightarrow\lvert s=1\rangle ∣ 01 ⟩ ↔ ∣ s = 1 ⟩ , and where C ( H ) C(H) C ( H ) is the controlled Hadamard gate. Note that the selector register now has two qubits per direction.
For the above modification, we replace the right Hadamard in W W W given in Eq. (109) with the two-qubit operation U U U and the left Hadamard with U † U^{\dagger} U † . Then, as in Eq. (110) , applying the modified W W W on ∣ 0 2 d ⟩ ∣ p o s ⟩ \lvert0^{2d}\rangle\lvert\mathrm{pos}\rangle ∣ 0 2 d ⟩ ∣ pos ⟩ yields the initial state ∣ b ⟩ \lvert b\rangle ∣ b ⟩ in Eq. (126) with the success probability ( 3 / 8 ) d (3/8)^d ( 3/8 ) d , where the success is conditioned on the 2 d 2d 2 d -qubit selector register being in the all-zero state. This follows as
( ⟨ 0 2 d ∣ ⊗ 1 ) W ∣ 0 2 d ⟩ ∣ p o s ⟩ = ( ⟨ 0 2 d ∣ ⊗ 1 ) ( U † ⊗ d ⊗ 1 ) 1 2 d ∑ s 2 d − ∥ s ∥ 1 ∑ a z ˉ a ∣ s ⟩ ∣ x a + s ⟩ (132) \left(\langle0^{2d}\rvert\otimes1\right)W\lvert0^{2d}\rangle\lvert\mathrm{pos}\rangle
=\left(\langle0^{2d}\rvert\otimes1\right)\left(U^{\dagger\otimes d}\otimes1\right)\frac{1}{2^d}\sum_s\sqrt{2^{d-\lVert s\rVert_1}}\sum_a\bar{z}_a\lvert s\rangle\lvert x_a+s\rangle \tag*{(132)} ( ⟨ 0 2 d ∣ ⊗ 1 ) W ∣ 0 2 d ⟩ ∣ pos ⟩ = ( ⟨ 0 2 d ∣ ⊗ 1 ) ( U †⊗ d ⊗ 1 ) 2 d 1 s ∑ 2 d − ∥ s ∥ 1 a ∑ z ˉ a ∣ s ⟩ ∣ x a + s ⟩ (132)
= 1 4 d ∑ s , s ′ 2 d − ∥ s ′ ∥ 1 2 d − ∥ s ∥ 1 ⟨ s ′ ∣ s ⟩ ∑ a z ˉ a ∣ x a + s ⟩ (133) =\frac{1}{4^d}\sum_{s,s'}\sqrt{2^{d-\lVert s'\rVert_1}}\sqrt{2^{d-\lVert s\rVert_1}}\langle s'\rvert s\rangle\sum_a\bar{z}_a\lvert x_a+s\rangle \tag*{(133)} = 4 d 1 s , s ′ ∑ 2 d − ∥ s ′ ∥ 1 2 d − ∥ s ∥ 1 ⟨ s ′ ∣ s ⟩ a ∑ z ˉ a ∣ x a + s ⟩ (133)
= 1 4 d ∑ s 2 d − ∥ s ∥ 1 ∑ a z ˉ a ∣ x a + s ⟩ (134) =\frac{1}{4^d}\sum_s2^{d-\lVert s\rVert_1}\sum_a\bar{z}_a\lvert x_a+s\rangle \tag*{(134)} = 4 d 1 s ∑ 2 d − ∥ s ∥ 1 a ∑ z ˉ a ∣ x a + s ⟩ (134)
= 6 d 4 d ∣ b ⟩ , (135) =\frac{\sqrt{6^d}}{4^d}\lvert b\rangle, \tag*{(135)} = 4 d 6 d ∣ b ⟩ , (135)
and so the success probability is ( 3 / 8 ) d (3/8)^d ( 3/8 ) d .
As the success probability is exactly known, we can amplify it to exactly 1 by the technique discussed in § 3.2.2 . For our 3D problem, the initial success probability is p = ( 3 / 8 ) 3 > p ⋆ 3 = sin 2 ( π / 14 ) p=(3/8)^3>p_{\star}^3=\sin^2(\pi/14) p = ( 3/8 ) 3 > p ⋆ 3 = sin 2 ( π /14 ) , so we choose the rotation angle α \alpha α for the ancilla qubit, where
cos ( α / 2 ) = ( 8 / 3 ) 3 sin ( π / 14 ) , (136) \cos(\alpha/2)=\sqrt{(8/3)^3}\sin(\pi/14), \tag*{(136)} cos ( α /2 ) = ( 8/3 ) 3 sin ( π /14 ) , (136)
to reduce the initial success probability to sin 2 ( π / 14 ) \sin^2(\pi/14) sin 2 ( π /14 ) . Then three rounds of amplitude amplifications generate the desired initial state. The resource scaling in this case is therefore the same as the resource scaling for the initial state with uniform charge distribution.
Loading the initial state with position-dependent charge distribution
We now extend the charge distribution with equal weights in Eq. (92) to the general case with position-dependent weights. To this end, we map the 1D Dirac delta as
δ ( x − x a ) ↦ 1 h [ ( 1 − η a ) δ j , x a + η a δ j , x a + 1 ] , (137) \delta(x-x_a)\mapsto\frac{1}{h}\left[(1-\eta_a)\delta_{j,x_a}+\eta_a\delta_{j,x_a+1}\right], \tag*{(137)} δ ( x − x a ) ↦ h 1 [ ( 1 − η a ) δ j , x a + η a δ j , x a + 1 ] , (137)
where η a : = x a / h − x a \eta_a:=x_a/h-x_a η a := x a / h − x a depends on the atom’s position and measures the distance between the actual position x a x_a x a of atom a a a and its left grid point x a = ⌊ x a / h ⌋ x_a=\lfloor x_a/h\rfloor x a = ⌊ x a / h ⌋ as a fraction of h h h . Note that the charge z a z_a z a of atom a a a is now distributed over the nearest-neighbor points x a + s x_a+s x a + s with position-dependent weights w a , s : = ( 1 − η a ) 1 − s η a s w_{a,s}:=(1-\eta_a)^{1-s}\eta_a^s w a , s := ( 1 − η a ) 1 − s η a s ; the uniform charge distribution is a special case with η a = 1 / 2 \eta_a=1/2 η a = 1/2 that gives w a , s = 1 / 2 w_{a,s}=1/2 w a , s = 1/2 for each s ∈ { 0 , 1 } s\in\{0,1\} s ∈ { 0 , 1 } . In d d d dimensions, we have
δ ( x − x a ) ↦ δ ~ ( x − x a ) = 1 h d ∑ s ∈ { 0 , 1 } d w a , s δ q , x a + s , (138) \delta(x-x_a)\mapsto\widetilde{\delta}(x-x_a)=\frac{1}{h^d}\sum_{s\in\{0,1\}^d}w_{a,s}\delta_{q,x_a+s}, \tag*{(138)} δ ( x − x a ) ↦ δ ( x − x a ) = h d 1 s ∈ { 0 , 1 } d ∑ w a , s δ q , x a + s , (138)
where the weight
w a , s = ∏ ν = 0 d − 1 w a , s ν , w a , s ν : = ( 1 − η a , ν ) 1 − s ν η a , ν s ν , (139) w_{a,s}=\prod_{\nu=0}^{d-1}w_{a,s_\nu},\quad w_{a,s_\nu}:=(1-\eta_{a,\nu})^{1-s_\nu}\eta_{a,\nu}^{s_\nu}, \tag*{(139)} w a , s = ν = 0 ∏ d − 1 w a , s ν , w a , s ν := ( 1 − η a , ν ) 1 − s ν η a , ν s ν , (139)
is a product of 1D weights w a , s ν w_{a,s_\nu} w a , s ν for each direction ν \nu ν with η a , ν : = x a , ν / h − x a , ν \eta_{a,\nu}:=x_{a,\nu}/h-x_{a,\nu} η a , ν := x a , ν / h − x a , ν .
As weights are now position-dependent, the weighted atom-position state is now
∣ ψ a ⟩ = 1 w a ∑ s ∈ { 0 , 1 } d w a , s ∣ x a + s ⟩ , w a : = ∑ s w a , s 2 , (140) |\psi_a\rangle= \frac{1}{\sqrt{w_a}}\sum_{s\in\{0,1\}^d} w_{a,s}|x_a+s\rangle,\quad w_a := \sum_s w_{a,s}^2, \tag*{(140)} ∣ ψ a ⟩ = w a 1 s ∈ { 0 , 1 } d ∑ w a , s ∣ x a + s ⟩ , w a := s ∑ w a , s 2 , (140)
where the normalization w a w_a w a is atom-dependent, unlike the uniform case in Eq. (95) . The normalized initial state with position-dependent weights is then
∣ b ⟩ = 1 ∥ z ′ ∥ ∑ a = 0 N a t m − 1 z a ′ ∣ ψ a ⟩ , z a ′ : = z a w a , (141) |b\rangle= \frac{1}{\lVert z'\rVert}\sum_{a=0}^{N_{\mathrm{atm}}-1} z'_a|\psi_a\rangle,\quad z'_a := z_a\sqrt{w_a}, \tag*{(141)} ∣ b ⟩ = ∥ z ′ ∥ 1 a = 0 ∑ N atm − 1 z a ′ ∣ ψ a ⟩ , z a ′ := z a w a , (141)
where z a ′ z'_a z a ′ is the rescaled charge of atom a a a and ∥ z ′ ∥ 2 = ∑ a z a 2 w a \lVert z'\rVert^2 = \sum_a z_a^2w_a ∥ z ′ ∥ 2 = ∑ a z a 2 w a .
To prepare this initial state, we first prepare the state
∣ z ′ ⟩ : = 1 ∥ z ′ ∥ ∑ a z a ′ ∣ a ⟩ = 1 ∥ z ′ ∥ ∑ a z a w a ∣ a ⟩ (142) |z'\rangle:= \frac{1}{\lVert z'\rVert}\sum_a z'_a|a\rangle= \frac{1}{\lVert z'\rVert}\sum_a z_a\sqrt{w_a}|a\rangle \tag*{(142)} ∣ z ′ ⟩ := ∥ z ′ ∥ 1 a ∑ z a ′ ∣ a ⟩ = ∥ z ′ ∥ 1 a ∑ z a w a ∣ a ⟩ (142)
on the index register. Then controlled on the state ∣ a ⟩ |a\rangle ∣ a ⟩ of this register, we prepare the atom-dependent selector state
∣ s e l a ⟩ = U a ∣ 0 d ⟩ = 1 w a ∑ s w a , s ∣ s ⟩ (143) |\mathrm{sel}_a\rangle= U_a|0^d\rangle= \frac{1}{\sqrt{w_a}}\sum_s w_{a,s}|s\rangle \tag*{(143)} ∣ sel a ⟩ = U a ∣ 0 d ⟩ = w a 1 s ∑ w a , s ∣ s ⟩ (143)
on the selector register, where U a U_a U a is a unitary that prepares ∣ s e l a ⟩ |\mathrm{sel}_a\rangle ∣ sel a ⟩ . That is to say, we perform the selector operation
U s e l : = ∑ a ∣ a ⟩ ⟨ a ∣ ⊗ U a (144) U_{\mathrm{sel}} := \sum_a |a\rangle\langle a|\otimes U_a \tag*{(144)} U sel := a ∑ ∣ a ⟩ ⟨ a ∣ ⊗ U a (144)
on the index and selector registers so that
U s e l ∣ a ⟩ i d x ∣ 0 d ⟩ s e l = 1 w a ∑ s w a , s ∣ a ⟩ i d x ∣ s ⟩ s e l . (145) U_{\mathrm{sel}}|a\rangle_{\mathrm{idx}}|0^d\rangle_{\mathrm{sel}} = \frac{1}{\sqrt{w_a}}\sum_s w_{a,s}|a\rangle_{\mathrm{idx}}|s\rangle_{\mathrm{sel}}. \tag*{(145)} U sel ∣ a ⟩ idx ∣ 0 d ⟩ sel = w a 1 s ∑ w a , s ∣ a ⟩ idx ∣ s ⟩ sel . (145)
We now apply POS in Eq. (102) to load the position of atom a a a into sys and then erase idx as before by U e r a s e U_{\mathrm{erase}} U erase in Eq. (104) . By the operations so far, we effectively replace U p o s U_{\mathrm{pos}} U pos in Eq. (105) with
U p o s ′ : = U e r a s e P O S U s e l U z ′ (146) U_{\mathrm{pos}}' := U_{\mathrm{erase}}\mathrm{POS}\,U_{\mathrm{sel}}\,U_{z'} \tag*{(146)} U pos ′ := U erase POS U sel U z ′ (146)
that prepares the state
∣ p o s ′ ⟩ : = 1 ∥ z ′ ∥ ∑ a z a ∑ s w a , s ∣ s ⟩ ∣ x a ⟩ (147) |\mathrm{pos}'\rangle:= \frac{1}{\lVert z'\rVert}\sum_a z_a\sum_s w_{a,s}|s\rangle|x_a\rangle \tag*{(147)} ∣ pos ′ ⟩ := ∥ z ′ ∥ 1 a ∑ z a s ∑ w a , s ∣ s ⟩ ∣ x a ⟩ (147)
on the selector and system registers. That is,
U p o s ′ : ∣ 0 d ⟩ s e l ∣ 0 n ⟩ s y s ↦ ∣ p o s ′ ⟩ s e l ⊗ s y s , (148) U_{\mathrm{pos}}' : |0^d\rangle_{\mathrm{sel}}|0^n\rangle_{\mathrm{sys}} \mapsto|\mathrm{pos}'\rangle_{\mathrm{sel}\otimes\mathrm{sys}}, \tag*{(148)} U pos ′ : ∣ 0 d ⟩ sel ∣ 0 n ⟩ sys ↦ ∣ pos ′ ⟩ sel ⊗ sys , (148)
where the action on the flag qubit and the index register is omitted as they start and finish in the zero state.
Next we apply the shift operator in Eq. (108) to perform the map ∣ x a ⟩ ↦ ∣ x a + s ⟩ |x_a\rangle\mapsto|x_a+s\rangle ∣ x a ⟩ ↦ ∣ x a + s ⟩ . Notice that we cannot now apply the inverse of U s e l U_{\mathrm{sel}} U sel on the selector register to conditionally prepare the initial state as in Eq. (110) , because U s e l U_{\mathrm{sel}} U sel depends on the atom index and that the index register has been erased. However, applying H ⊗ d H^{\otimes d} H ⊗ d on the selector register does prepare the initial state on sys conditioned on sel being in the all zero state. Specifically, we have
( H ⊗ d ⊗ 1 ) U s h i f t ∣ p o s ′ ⟩ s y s = 1 2 d ∣ 0 d ⟩ s e l ∣ b ⟩ + ∣ ⊥ ⟩ s e l ⊗ s y s (149) (H^{\otimes d}\otimes1)U_{\mathrm{shift}}|\mathrm{pos}'\rangle_{\mathrm{sys}} = \frac{1}{\sqrt{2^d}}|0^d\rangle_{\mathrm{sel}}|b\rangle+ |\perp\rangle_{\mathrm{sel}\otimes\mathrm{sys}} \tag*{(149)} ( H ⊗ d ⊗ 1 ) U shift ∣ pos ′ ⟩ sys = 2 d 1 ∣ 0 d ⟩ sel ∣ b ⟩ + ∣ ⊥ ⟩ sel ⊗ sys (149)
with ( ⟨ 0 d ∣ ⊗ 1 ) ∣ ⊥ ⟩ = 0 (\langle0^d|\otimes1)|\perp\rangle= 0 (⟨ 0 d ∣ ⊗ 1 ) ∣ ⊥ ⟩ = 0 . To show this, observe that
( ⟨ 0 d ∣ ⊗ 1 ) ( H ⊗ d ⊗ 1 ) U s h i f t ∣ p o s ′ ⟩ = ( ⟨ 0 d ∣ ⊗ 1 ) ( H ⊗ d ⊗ 1 ) 1 ∥ z ′ ∥ ∑ a z a ∑ s w a , s ∣ s ⟩ ∣ x a + s ⟩ = 1 2 d 1 ∥ z ′ ∥ ∑ a z a ∑ s , s ′ w a , s ⟨ s ′ ∣ s ⟩ ∣ x a + s ⟩ = 1 2 d ∣ b ⟩ . (150) \begin{aligned}
(\langle0^d|\otimes1)(H^{\otimes d}\otimes1)U_{\mathrm{shift}}|\mathrm{pos}'\rangle
&=(\langle0^d|\otimes1)(H^{\otimes d}\otimes1)\frac{1}{\lVert z'\rVert}\sum_a z_a\sum_s w_{a,s}|s\rangle|x_a+s\rangle\\
&=\frac{1}{\sqrt{2^d}}\frac{1}{\lVert z'\rVert}\sum_a z_a\sum_{s,s'}w_{a,s}\langle s'|s\rangle|x_a+s\rangle\\
&=\frac{1}{\sqrt{2^d}}|b\rangle. \tag*{(150)}
\end{aligned} (⟨ 0 d ∣ ⊗ 1 ) ( H ⊗ d ⊗ 1 ) U shift ∣ pos ′ ⟩ = (⟨ 0 d ∣ ⊗ 1 ) ( H ⊗ d ⊗ 1 ) ∥ z ′ ∥ 1 a ∑ z a s ∑ w a , s ∣ s ⟩ ∣ x a + s ⟩ = 2 d 1 ∥ z ′ ∥ 1 a ∑ z a s , s ′ ∑ w a , s ⟨ s ′ ∣ s ⟩ ∣ x a + s ⟩ = 2 d 1 ∣ b ⟩ . (150)
The success probability is known and is exactly 1 / 2 d 1/2^d 1/ 2 d , as in the case with uniform charge distribution. This probabilistic state loading can therefore be made deterministic using the same steps discussed in § 3.2.2 . Specifically, for the 3D problem, we prepare the flag qubit in the state R ( α ) ∣ 0 ⟩ R(\alpha)|0\rangle R ( α ) ∣0 ⟩ with the rotation angle α \alpha α given in Eq. (112) . Then by replacing
U p r o b → U p r o b ′ : = R ( α ) H ⊗ d U s h i f t U p o s ′ , (151) U_{\mathrm{prob}} \to U_{\mathrm{prob}}^{\prime} := R(\alpha)H^{\otimes d}U_{\mathrm{shift}}U_{\mathrm{pos}}^{\prime}, \tag*{(151)} U prob → U prob ′ := R ( α ) H ⊗ d U shift U pos ′ , (151)
we have the same probabilistic state loading in Eq. (114) with the initial success probability of sin 2 ( π / 10 ) \sin^2(\pi/10) sin 2 ( π /10 ) . Then by two rounds of amplitude amplification, with the operator
A ′ : = U p r o b ′ R t U p r o b ′ † R G , (152) \mathcal{A}^{\prime} := U_{\mathrm{prob}}^{\prime}R_t U_{\mathrm{prob}}^{\prime\dagger}R_G, \tag*{(152)} A ′ := U prob ′ R t U prob ′ † R G , (152)
the initial state is generated with unit success probability.
Finally, we decompose the unitary U a U_a U a for preparing the atom-dependent selector state ∣ s e l a ⟩ |\mathrm{sel}_a\rangle ∣ sel a ⟩ as a tensor product of single-qubit rotations. This follows because the weight w a , s w_{a,s} w a , s is a product of 1D weights as in Eq. (139) . To see this, observe that
∣ s e l a ⟩ = 1 w a ∑ s ∏ ν = 0 d − 1 w a , s ν ∣ s ⟩ = 1 w a ⨂ ν = 0 d − 1 ∑ s ν = 0 1 w a , s ν ∣ s ν ⟩ = ⨂ ν = 0 d − 1 1 N a , ν ∑ s ν = 0 1 w a , s ν ∣ s ν ⟩ = ⨂ ν = 0 d − 1 R ( θ a , ν ) ∣ 0 ⟩ , (153) \begin{aligned}
|\mathrm{sel}_a\rangle
&= \frac{1}{\sqrt{w_a}}\sum_s\prod_{\nu=0}^{d-1}w_{a,s_\nu}|s\rangle\\
&= \frac{1}{\sqrt{w_a}}\bigotimes_{\nu=0}^{d-1}\sum_{s_\nu=0}^{1}w_{a,s_\nu}|s_\nu\rangle\\
&= \bigotimes_{\nu=0}^{d-1}\frac{1}{\sqrt{N_{a,\nu}}}\sum_{s_\nu=0}^{1}w_{a,s_\nu}|s_\nu\rangle\\
&= \bigotimes_{\nu=0}^{d-1}R(\theta_{a,\nu})|0\rangle, \tag*{(153)}
\end{aligned} ∣ sel a ⟩ = w a 1 s ∑ ν = 0 ∏ d − 1 w a , s ν ∣ s ⟩ = w a 1 ν = 0 ⨂ d − 1 s ν = 0 ∑ 1 w a , s ν ∣ s ν ⟩ = ν = 0 ⨂ d − 1 N a , ν 1 s ν = 0 ∑ 1 w a , s ν ∣ s ν ⟩ = ν = 0 ⨂ d − 1 R ( θ a , ν ) ∣0 ⟩ , (153)
where, in the third line, we used
w a = ∑ s w a , s 2 = ∑ s 0 , … , s d − 1 ∏ ν = 0 d − 1 w a , s ν 2 = ∏ ν = 0 d − 1 N a , ν (154) w_a=\sum_s w_{a,s}^2=\sum_{s_0,\ldots,s_{d-1}}\prod_{\nu=0}^{d-1}w_{a,s_\nu}^2=\prod_{\nu=0}^{d-1}N_{a,\nu} \tag*{(154)} w a = s ∑ w a , s 2 = s 0 , … , s d − 1 ∑ ν = 0 ∏ d − 1 w a , s ν 2 = ν = 0 ∏ d − 1 N a , ν (154)
with
N a , ν : = ∑ s ν = 0 1 w a , s ν 2 = ( 1 − η a , ν ) 2 + η a , ν 2 , (155) N_{a,\nu}:=\sum_{s_\nu=0}^{1}w_{a,s_\nu}^2=(1-\eta_{a,\nu})^2+\eta_{a,\nu}^2, \tag*{(155)} N a , ν := s ν = 0 ∑ 1 w a , s ν 2 = ( 1 − η a , ν ) 2 + η a , ν 2 , (155)
and where the rotation angles satisfy
tan ( θ a , ν 2 ) = η a , ν 1 − η a , ν . (156) \tan\left(\frac{\theta_{a,\nu}}{2}\right)=\frac{\eta_{a,\nu}}{1-\eta_{a,\nu}}. \tag*{(156)} tan ( 2 θ a , ν ) = 1 − η a , ν η a , ν . (156)
The unitary U a U_a U a is therefore a tensor product of y y y -rotation gates with angles θ a , ν \theta_{a,\nu} θ a , ν . Consequently, U s e l U_{\mathrm{sel}} U sel in Eq. (144) for preparing the selector state is a uniformly controlled-rotation gate, which can be implemented by Θ ( N a t m ) \Theta(N_{\mathrm{atm}}) Θ ( N atm ) single-qubit rotations and Θ ( N a t m ) \Theta(N_{\mathrm{atm}}) Θ ( N atm ) CNOT gates. The cost of classical precomputation of the rotation angles { θ a , ν } \{\theta_{a,\nu}\} { θ a , ν } is also Θ ( N a t m ) \Theta(N_{\mathrm{atm}}) Θ ( N atm ) . The resource scaling in this case is also the same as the resource scaling for the initial state with uniform charge distribution.
The quantum solution and tailored implementation for the operator oracle
In this section, we develop a tailored quantum algorithm for generating a quantum state that encodes the solution of the discretized LPB equation for simulating the biomolecular system. Our approach builds on the quantum PDE algorithm introduced in [8 ] that uses wavelet preconditioning to solve a broad class of PDEs with a cost independent of the condition number of the discretized differential operator. The differential operator of the LPB equation in Eq. (90) has bounded coefficients, with ε ( x ) \varepsilon(x) ε ( x ) strictly positive and k ( x ) k(x) k ( x ) nonnegative, and belongs to the class of elliptic operators considered that can be optimally preconditioned by wavelets [8 ] . We therefore adopt the distributed quantum solution introduced in [8 ] to construct a quantum solution of the discretized system.
We begin by describing the distributed quantum solution in § 3.3.1 , tailor it for our application, and show how it can be used to extract properties of the system. We then discuss our approach for generating the distributed quantum solution in § 3.3.2 . We continue in § 3.3.3 to analyze the error in generating the solution state and its gate cost in terms of the gate cost of a block encoding of the preconditioned matrix. Finally, we construct a block encoding for the PDE operator in § 3.3.4 and a block encoding for the preconditioned matrix in § 3.3.5 , and discuss their gate cost, block encoding normalization and the number of ancillas used for block encodings.
The distributed quantum solution
Let A u = b A\boldsymbol{u}=\boldsymbol{b} A u = b be the system of linear equations obtained from the finite-difference discretization of the LPB equation, where b \boldsymbol{b} b is the normalized vector discussed in § 3.2 , and let ∣ u ⟩ \lvert u\rangle ∣ u ⟩ be the unnormalized solution vector. Following [8 ] , let us consider the preconditioned matrix
A p r e c = P W A W † P (157) A_{\mathrm{prec}}=PWA W^{\dagger}P \tag*{(157)} A prec = P W A W † P (157)
where W W W is the wavelet transform matrix and P P P is the diagonal wavelet preconditioner; here we consider the 1D problem; extension to the 3D follows similarly [8 ] . Then the solution can be expressed as ∣ u ⟩ = W † P A p r e c − 1 P W ∣ b ⟩ \lvert u\rangle=W^{\dagger}P A_{\mathrm{prec}}^{-1}PW\lvert b\rangle ∣ u ⟩ = W † P A prec − 1 P W ∣ b ⟩ with ∣ b ⟩ \lvert b\rangle ∣ b ⟩ the normalized initial state in § 3.2 . The preconditioned matrix A p r e c A_{\mathrm{prec}} A prec has a condition number, κ p r e c ∈ Θ ( 1 ) \kappa_{\mathrm{prec}}\in\Theta(1) κ prec ∈ Θ ( 1 ) , independent of the matrix size or the grid resolution, so A p r e c − 1 A_{\mathrm{prec}}^{-1} A prec − 1 can be implemented efficiently by a quantum linear-system algorithm. The transformation by W W W and its inverse can also be implemented efficiently by the quantum wavelet-transform algorithm [32 ] . However, directly applying the wavelet preconditioner P P P to prepare the conventional solution state ∣ u ⟩ / ∥ u ∥ \lvert u\rangle/\lVert u\rVert ∣ u ⟩ / ∥ u ∥ would make the cost of the algorithm linear in the matrix size.
To bypass this bottleneck, the algorithm in [8 ] expresses P P P as a combination of two unitaries U ± = exp ( ± i arccos P ) U^{\pm}=\exp(\pm i\arccos P) U ± = exp ( ± i arccos P ) as P = ( U + + U − ) / 2 P=(U^{+}+U^{-})/2 P = ( U + + U − ) /2 , where each unitary can be efficiently implemented by controlled-rotation gates. By this decomposition, we obtain ∣ u ⟩ = 1 4 ∑ a , b ∣ ψ a b ⟩ \lvert u\rangle=\frac{1}{4}\sum_{a,b}\lvert\psi_{ab}\rangle ∣ u ⟩ = 4 1 ∑ a , b ∣ ψ ab ⟩ , where
∣ ψ a b ⟩ : = W † U a A p r e c − 1 U b W ∣ b ⟩ , a , b ∈ { 0 , 1 } (158) \lvert\psi_{ab}\rangle:=W^{\dagger}U^{a}A_{\mathrm{prec}}^{-1}U^{b}W\lvert b\rangle,\quad a,b\in\{0,1\} \tag*{(158)} ∣ ψ ab ⟩ := W † U a A prec − 1 U b W ∣ b ⟩ , a , b ∈ { 0 , 1 } (158)
and U 0 / 1 ≡ U + / − U^{0/1}\equiv U^{+/-} U 0/1 ≡ U + / − . Ref. [8 ] then constructs the distributed quantum solution state in the extended space by two qubits as
∣ ψ ⟩ = 1 2 ξ ∑ a , b ∈ { 0 , 1 } ∣ a b ⟩ ∣ ψ a b ⟩ , ξ 2 : = 1 4 ∑ a , b ∥ ψ a b ∥ 2 (159) \lvert\psi\rangle=\frac{1}{2\xi}\sum_{a,b\in\{0,1\}}\lvert ab\rangle\lvert\psi_{ab}\rangle,\quad\xi^{2}:=\frac{1}{4}\sum_{a,b}\lVert\psi_{ab}\rVert^{2} \tag*{(159)} ∣ ψ ⟩ = 2 ξ 1 a , b ∈ { 0 , 1 } ∑ ∣ ab ⟩ ∣ ψ ab ⟩ , ξ 2 := 4 1 a , b ∑ ∥ ψ ab ∥ 2 (159)
which provides an alternative to the conventional solution state ∣ u ⟩ / ∥ u ∥ \lvert u\rangle/\lVert u\rVert ∣ u ⟩ / ∥ u ∥ . The central property of this representation is that ∣ u ⟩ \lvert u\rangle ∣ u ⟩ can be obtained by projecting the two qubits onto the uniform state ∣ + + ⟩ \lvert++\rangle ∣ + + ⟩ as ξ ( ⟨ + + ∣ ⊗ 1 ) ∣ ψ ⟩ = ∣ u ⟩ \xi(\langle++\rvert\otimes\mathbb{1})\lvert\psi\rangle=\lvert u\rangle ξ (⟨ + + ∣ ⊗ 1 ) ∣ ψ ⟩ = ∣ u ⟩ . This identity allows us to extract the solution property ⟨ u ∣ M ∣ u ⟩ \langle u\lvert M\lvert u\rangle ⟨ u ∣ M ∣ u ⟩ from the distributed quantum solution. Specifically, we have
⟨ u ∣ M ∣ u ⟩ = ξ 2 ⟨ ψ ∣ ( ∣ + + ⟩ ⟨ + + ∣ ⊗ M ) ∣ ψ ⟩ = ξ 2 ⟨ ψ ∣ M ′ ∣ ψ ⟩ (160) \langle u\lvert M\lvert u\rangle=\xi^{2}\langle\psi\lvert(\lvert++\rangle\langle++\rvert\otimes M)\lvert\psi\rangle=\xi^{2}\langle\psi\lvert M'\lvert\psi\rangle \tag*{(160)} ⟨ u ∣ M ∣ u ⟩ = ξ 2 ⟨ ψ ∣(∣ + + ⟩ ⟨ + + ∣ ⊗ M ) ∣ ψ ⟩ = ξ 2 ⟨ ψ ∣ M ′ ∣ ψ ⟩ (160)
where
M ′ : = ∣ + + ⟩ ⟨ + + ∣ ⊗ M = 1 4 ∑ a , b , c , d ∈ { 0 , 1 } ∣ a b ⟩ ⟨ c d ∣ ⊗ M (161) M':=\lvert++\rangle\langle++\rvert\otimes M=\frac{1}{4}\sum_{a,b,c,d\in\{0,1\}}\lvert ab\rangle\langle cd\rvert\otimes M \tag*{(161)} M ′ := ∣ + + ⟩ ⟨ + + ∣ ⊗ M = 4 1 a , b , c , d ∈ { 0 , 1 } ∑ ∣ ab ⟩ ⟨ c d ∣ ⊗ M (161)
is the observable in the extended space. The observable M ′ M' M ′ is a 4 × 4 4\times4 4 × 4 block matrix whose blocks are all equal to M / 4 M/4 M /4 . The block encoding U M ′ U_{M'} U M ′ of M ′ M' M ′ is then constructed by a single query to the block encoding of M M M as
U M ′ = V ⊗ U M (162) U_{M'}=V\otimes U_{M} \tag*{(162)} U M ′ = V ⊗ U M (162)
where
V = ( H ⊗ H ⊗ 1 f ) X f C 0 2 ( X f ) ( H ⊗ H ⊗ 1 f ) (163) V=(H\otimes H\otimes\mathbb{1}_{f})X_{f}C_{0}^{2}(X_{f})(H\otimes H\otimes\mathbb{1}_{f}) \tag*{(163)} V = ( H ⊗ H ⊗ 1 f ) X f C 0 2 ( X f ) ( H ⊗ H ⊗ 1 f ) (163)
is a ( 1 , 1 , 0 ) (1,1,0) ( 1 , 1 , 0 ) block encoding of ∣ + + ⟩ ⟨ + + ∣ \lvert++\rangle\langle++\rvert ∣ + + ⟩ ⟨ + + ∣ using an ancilla qubit f f f , and C 0 2 ( X f ) C_{0}^{2}(X_{f}) C 0 2 ( X f ) flips f f f when the two control qubits are ∣ 00 ⟩ \lvert00\rangle ∣ 00 ⟩ . Consequently, the distributed quantum solution enables access to properties of the original solution without directly preparing the original solution state.
For our application, we also discuss how the distributed quantum solution can be used to extract the expectation value of the form ⟨ ϕ ∣ M ∣ ϕ ⟩ \langle\phi\lvert M\lvert\phi\rangle ⟨ ϕ ∣ M ∣ ϕ ⟩ with the unnormalized state ∣ ϕ ⟩ \lvert\phi\rangle ∣ ϕ ⟩ and the observable M M M defined as
∣ ϕ ⟩ : = 1 2 ( ∣ 0 ⟩ ∣ u ⟩ + ∣ 1 ⟩ ∣ p o s ⟩ ) , M : = ∣ 0 ⟩ ⟨ 1 ∣ ⊗ T + ∣ 1 ⟩ ⟨ 0 ∣ ⊗ T † (164) \lvert\phi\rangle:=\frac{1}{\sqrt{2}}(\lvert0\rangle\lvert u\rangle+\lvert1\rangle\lvert\mathrm{pos}\rangle),\quad M:=\lvert0\rangle\langle1\rvert\otimes T+\lvert1\rangle\langle0\rvert\otimes T^{\dagger} \tag*{(164)} ∣ ϕ ⟩ := 2 1 (∣ 0 ⟩ ∣ u ⟩ + ∣ 1 ⟩ ∣ pos ⟩) , M := ∣ 0 ⟩ ⟨ 1 ∣ ⊗ T + ∣ 1 ⟩ ⟨ 0 ∣ ⊗ T † (164)
where T T T is a known operator, and ∣ p o s ⟩ |\mathrm{pos}\rangle ∣ pos ⟩ is a normalized quantum state with a known preparation unitary U p o s : ∣ 0 ⟩ ↦ ∣ p o s ⟩ U_{\mathrm{pos}}:|0\rangle\mapsto|\mathrm{pos}\rangle U pos : ∣0 ⟩ ↦ ∣ pos ⟩ ; we discuss these operators later in § 3.4 . To this end, let us define the normalized state
∣ Ψ ⟩ : = 1 2 ( ∣ 0 ⟩ ∣ ψ ⟩ + ∣ 1 ⟩ ∣ χ ⟩ ) , ∣ χ ⟩ : = ∣ + + ⟩ ∣ p o s ⟩ (165) |\Psi\rangle:= \frac{1}{\sqrt{2}}\left(|0\rangle|\psi\rangle+|1\rangle|\chi\rangle\right), \quad|\chi\rangle:= |++\rangle|\mathrm{pos}\rangle \tag*{(165)} ∣Ψ ⟩ := 2 1 ( ∣0 ⟩ ∣ ψ ⟩ + ∣1 ⟩ ∣ χ ⟩ ) , ∣ χ ⟩ := ∣ + + ⟩ ∣ pos ⟩ (165)
where ∣ ψ ⟩ |\psi\rangle ∣ ψ ⟩ is the distributed quantum solution and ∣ + + ⟩ |++\rangle ∣ + + ⟩ is the uniform state on the first two qubits of ∣ ψ ⟩ |\psi\rangle ∣ ψ ⟩ . This state can be prepared by applying a Hadamard on the leftmost qubit and then applying controlled preparation of ∣ ψ ⟩ |\psi\rangle ∣ ψ ⟩ and ∣ χ ⟩ |\chi\rangle ∣ χ ⟩ . By the identity ξ ( ⟨ + + ∣ ⊗ 1 ) ∣ ψ ⟩ = ∣ u ⟩ \xi(\langle++|\otimes\mathbb{1})|\psi\rangle=|u\rangle ξ (⟨ + + ∣ ⊗ 1 ) ∣ ψ ⟩ = ∣ u ⟩ , we then have
⟨ ϕ ∣ M ∣ ϕ ⟩ = ξ ⟨ Ψ ∣ M ′ ∣ Ψ ⟩ , M ′ = ∣ 0 ⟩ ⟨ 1 ∣ ⊗ 1 2 ⊗ T + ∣ 1 ⟩ ⟨ 0 ∣ ⊗ 1 2 ⊗ T † . (166) \langle\phi|M|\phi\rangle=\xi\langle\Psi|M'|\Psi\rangle,\quad M'=|0\rangle\langle1|\otimes\mathbb{1}_{2}\otimes T+|1\rangle\langle0|\otimes\mathbb{1}_{2}\otimes T^\dagger. \tag*{(166)} ⟨ ϕ ∣ M ∣ ϕ ⟩ = ξ ⟨ Ψ∣ M ′ ∣Ψ ⟩ , M ′ = ∣0 ⟩ ⟨ 1∣ ⊗ 1 2 ⊗ T + ∣1 ⟩ ⟨ 0∣ ⊗ 1 2 ⊗ T † . (166)
Notice that M ′ M' M ′ here only has 1 2 \mathbb{1}_{2} 1 2 on the first two qubits of ∣ ψ ⟩ |\psi\rangle ∣ ψ ⟩ . This construction is particularly useful for computing properties of the biomolecular system as we discuss in § 3.4 .
Generating the distributed quantum solution
We now describe a quantum circuit for generating the distributed solution state. We derive a lower bound on the success amplitude for generating this state and discuss the fixed-point amplitude amplification. To generate the state, we use Quantum Matrix Inversion, QMI, as the block encoding of A p r e c − 1 A_{\mathrm{prec}}^{-1} A prec − 1 . Specifically, QMI is an ( α i n v , a i n v , ε i n v ) (\alpha_{\mathrm{inv}},a_{\mathrm{inv}},\varepsilon_{\mathrm{inv}}) ( α inv , a inv , ε inv ) block encoding of A p r e c − 1 A_{\mathrm{prec}}^{-1} A prec − 1 such that
∥ A p r e c − 1 − α i n v ( ⟨ 0 a i n v ∣ ⊗ 1 ) Q M I ( ∣ 0 a i n v ⟩ ⊗ 1 ) ∥ ≤ ε i n v , (167) \left\|A_{\mathrm{prec}}^{-1}-\alpha_{\mathrm{inv}}\left(\langle0^{a_{\mathrm{inv}}}|\otimes\mathbb{1}\right)\mathrm{QMI}\left(|0^{a_{\mathrm{inv}}}\rangle\otimes\mathbb{1}\right)\right\|\leq\varepsilon_{\mathrm{inv}}, \tag*{(167)} A prec − 1 − α inv ( ⟨ 0 a inv ∣ ⊗ 1 ) QMI ( ∣ 0 a inv ⟩ ⊗ 1 ) ≤ ε inv , (167)
where a i n v a_{\mathrm{inv}} a inv is the number of ancilla qubits in the block encoding and the normalization factor satisfies α i n v ≥ ∥ A p r e c − 1 ∥ \alpha_{\mathrm{inv}}\geq\left\|A_{\mathrm{prec}}^{-1}\right\| α inv ≥ A prec − 1 . Later we construct QMI with the parameters
α i n v = 4 κ p r e c 3 ∥ A p r e c ∥ , a i n v = a p r e c + 1 , ε i n v = ε 4 ∥ A p r e c ∥ , (168) \alpha_{\mathrm{inv}}=\frac{4\kappa_{\mathrm{prec}}}{3\left\|A_{\mathrm{prec}}\right\|},\quad a_{\mathrm{inv}}=a_{\mathrm{prec}}+1,\quad\varepsilon_{\mathrm{inv}}=\frac{\varepsilon}{4\left\|A_{\mathrm{prec}}\right\|}, \tag*{(168)} α inv = 3 ∥ A prec ∥ 4 κ prec , a inv = a prec + 1 , ε inv = 4 ∥ A prec ∥ ε , (168)
where a p r e c a_{\mathrm{prec}} a prec is the number of ancillas in the block encoding of A p r e c A_{\mathrm{prec}} A prec and ε \varepsilon ε denotes the target error in generating the state. We first prepare the ( n + 1 ) (n+1) ( n + 1 ) -qubit state
∣ ϕ i n ⟩ : = 1 2 ∑ b ∈ { 0 , 1 } ∣ b ⟩ U b W ∣ b ⟩ . (169) |\phi_{\mathrm{in}}\rangle:=\frac{1}{\sqrt{2}}\sum_{b\in\{0,1\}}|b\rangle U^{b}W|b\rangle. \tag*{(169)} ∣ ϕ in ⟩ := 2 1 b ∈ { 0 , 1 } ∑ ∣ b ⟩ U b W ∣ b ⟩ . (169)
This state is obtained by preparing ∣ b ⟩ |b\rangle ∣ b ⟩ , applying the quantum wavelet transform W W W , and using a selector qubit in the ∣ + ⟩ |+\rangle ∣ + ⟩ state to coherently apply U b U^{b} U b conditioned on its value b b b . We then apply QMI on the system register (with no action on the selector qubit). The action of QMI is then
Q M I ∣ 0 a i n v ⟩ ∣ ϕ i n ⟩ = 1 α i n v ∣ 0 a i n v ⟩ ∣ ϕ ~ o u t ⟩ + ∣ ⊥ ⟩ , (170) \mathrm{QMI}|0^{a_{\mathrm{inv}}}\rangle|\phi_{\mathrm{in}}\rangle=\frac{1}{\alpha_{\mathrm{inv}}}|0^{a_{\mathrm{inv}}}\rangle|\widetilde{\phi}_{\mathrm{out}}\rangle+|\perp\rangle, \tag*{(170)} QMI ∣ 0 a inv ⟩ ∣ ϕ in ⟩ = α inv 1 ∣ 0 a inv ⟩ ∣ ϕ out ⟩ + ∣ ⊥ ⟩ , (170)
where ∣ ϕ ~ o u t ⟩ |\widetilde{\phi}_{\mathrm{out}}\rangle ∣ ϕ out ⟩ is an ε i n v \varepsilon_{\mathrm{inv}} ε inv -approximation of the ideal output state ∣ ϕ o u t ⟩ : = ( 1 1 ⊗ A p r e c − 1 ) ∣ ϕ i n ⟩ |\phi_{\mathrm{out}}\rangle:=(\mathbb{1}_{1}\otimes A_{\mathrm{prec}}^{-1})|\phi_{\mathrm{in}}\rangle ∣ ϕ out ⟩ := ( 1 1 ⊗ A prec − 1 ) ∣ ϕ in ⟩ with A p r e c − 1 A_{\mathrm{prec}}^{-1} A prec − 1 replaced with its approximation A ~ p r e c − 1 \widetilde{A}_{\mathrm{prec}}^{-1} A prec − 1 . The state ∣ ⊥ ⟩ |\perp\rangle ∣ ⊥ ⟩ is orthogonal to the all-zero state of the block encoding ancillas, ( ⟨ 0 a i n v ∣ ⊗ 1 ) ∣ ⊥ ⟩ = 0 (\langle0^{a_{\mathrm{inv}}}|\otimes\mathbb{1})|\perp\rangle=0 (⟨ 0 a inv ∣ ⊗ 1 ) ∣ ⊥ ⟩ = 0 . The all-zero state of the ancilla qubits then determines the successful application of the approximate inverse. To obtain a lower bound on the success amplitude, let us write Eq. (170) as
∣ Φ ⟩ : = Q M I ∣ 0 a i n v ⟩ ∣ ϕ i n ⟩ = p s u c c ∣ 0 a i n v ⟩ ∣ G ~ ⟩ + 1 − p s u c c ∣ B ~ ⟩ , (171) |\Phi\rangle:=\mathrm{QMI}|0^{a_{\mathrm{inv}}}\rangle|\phi_{\mathrm{in}}\rangle=\sqrt{p_{\mathrm{succ}}}|0^{a_{\mathrm{inv}}}\rangle|\widetilde{G}\rangle+\sqrt{1-p_{\mathrm{succ}}}|\widetilde{B}\rangle, \tag*{(171)} ∣Φ ⟩ := QMI ∣ 0 a inv ⟩ ∣ ϕ in ⟩ = p succ ∣ 0 a inv ⟩ ∣ G ⟩ + 1 − p succ ∣ B ⟩ , (171)
where ∣ G ~ ⟩ |\widetilde{G}\rangle ∣ G ⟩ is an approximation of the normalized output state ∣ G ⟩ : = ∣ ϕ o u t ⟩ / ∥ ϕ o u t ∥ |G\rangle:=|\phi_{\mathrm{out}}\rangle/\left\|\phi_{\mathrm{out}}\right\| ∣ G ⟩ := ∣ ϕ out ⟩ / ∥ ϕ out ∥ , and where ∣ B ~ ⟩ |\widetilde{B}\rangle ∣ B ⟩ has no support on the zero state of the block encoding ancillas. The success probability p s u c c p_{\mathrm{succ}} p succ satisfies
p s u c c = ∥ ϕ ~ o u t ∥ α i n v ≥ 9 16 κ p r e c ∈ Θ ( 1 ) . (172) \sqrt{p_{\mathrm{succ}}}=\frac{\left\|\widetilde{\phi}_{\mathrm{out}}\right\|}{\alpha_{\mathrm{inv}}}\geq\frac{9}{16\kappa_{\mathrm{prec}}}\in\Theta(1). \tag*{(172)} p succ = α inv ϕ out ≥ 16 κ prec 9 ∈ Θ ( 1 ) . (172)
This is because
1 ∥ A p r e c ∥ ≤ ∥ ϕ o u t ∥ ≤ ∥ ϕ ~ o u t ∥ + ε i n v , (173) \frac{1}{\left\|A_{\mathrm{prec}}\right\|}\leq\left\|\phi_{\mathrm{out}}\right\|\leq\left\|\widetilde{\phi}_{\mathrm{out}}\right\|+\varepsilon_{\mathrm{inv}}, \tag*{(173)} ∥ A prec ∥ 1 ≤ ∥ ϕ out ∥ ≤ ϕ out + ε inv , (173)
where the right-hand side follows from the triangle inequality, and so we obtain the lower bound on success amplitude as
p s u c c ≥ 1 α i n v ( 1 ∥ A p r e c ∥ − ε i n v ) ≥ 3 4 1 − ε / 4 κ p r e c ≥ 9 16 κ p r e c . (174) \sqrt{p_{\mathrm{succ}}} \ge\frac{1}{\alpha_{\mathrm{inv}}}\left(\frac{1}{\lVert A_{\mathrm{prec}}\rVert}-\varepsilon_{\mathrm{inv}}\right) \ge\frac{3}{4}\frac{1-\varepsilon/4}{\kappa_{\mathrm{prec}}} \ge\frac{9}{16\kappa_{\mathrm{prec}}}. \tag*{(174)} p succ ≥ α inv 1 ( ∥ A prec ∥ 1 − ε inv ) ≥ 4 3 κ prec 1 − ε /4 ≥ 16 κ prec 9 . (174)
where we used Eq. (168) . After amplitude amplification, we use a second selector qubit in the ∣ + ⟩ |+\rangle ∣ + ⟩ state to coherently apply U a U^{a} U a conditioned on its value a a a , and then apply the inverse quantum wavelet transform W † W^{\dagger} W † on the system register. The generated state becomes an ε \varepsilon ε -approximation of the distributed solution state.
Fixed-point amplitude amplification. As the exact value of the success probability p s u c c p_{\mathrm{succ}} p succ is unknown, the ordinary amplitude amplification cannot be applied. We instead use the fixed-point amplitude amplification (FPAA) [34 ] as it only needs a guaranteed lower bound on p s u c c p_{\mathrm{succ}} p succ , as in our case in Eq. (172) , to make the final success probability arbitrarily close to one. To apply the FPAA, let us define the generalized reflection operators about ∣ G ~ ⟩ |\widetilde{G}\rangle ∣ G ⟩ and ∣ Φ ⟩ |\Phi\rangle ∣Φ ⟩ respectively as
R G ~ ( β ) : = 1 − ( 1 − e i β ) Π G ~ , R Φ ( α ) : = 1 − ( 1 − e − i α ) Π Φ , (175) R_{\widetilde{G}}(\beta) := \mathbb{1}-(1-e^{i\beta})\Pi_{\widetilde{G}}, \qquad R_{\Phi}(\alpha) := \mathbb{1}-(1-e^{-i\alpha})\Pi_{\Phi}, \tag*{(175)} R G ( β ) := 1 − ( 1 − e i β ) Π G , R Φ ( α ) := 1 − ( 1 − e − i α ) Π Φ , (175)
with the projections Π G ~ : = ∣ G ~ ⟩ ⟨ G ~ ∣ \Pi_{\widetilde{G}}:=|\widetilde{G}\rangle\langle\widetilde{G}| Π G := ∣ G ⟩ ⟨ G ∣ and Π Φ : = ∣ Φ ⟩ ⟨ Φ ∣ \Pi_{\Phi}:=|\Phi\rangle\langle\Phi| Π Φ := ∣Φ ⟩ ⟨ Φ∣ . Here α \alpha α and β \beta β are some rotation angles; the ordinary reflection is a particular case with α = β = ± π \alpha=\beta=\pm\pi α = β = ± π . Let L = 2 ℓ + 1 L=2\ell+1 L = 2 ℓ + 1 be an odd integer, then the FPAA is a sequence of ℓ \ell ℓ generalized Grover iterates G ( α , β ) G(\alpha,\beta) G ( α , β ) as
A L = G ( α ℓ , β ℓ ) ⋯ G ( α 1 , β 1 ) , G ( α , β ) : = − R Φ ( α ) R G ~ ( β ) (176) \mathcal{A}_{L}=G(\alpha_{\ell},\beta_{\ell})\cdots G(\alpha_{1},\beta_{1}), \qquad G(\alpha,\beta):=-R_{\Phi}(\alpha)R_{\widetilde{G}}(\beta) \tag*{(176)} A L = G ( α ℓ , β ℓ ) ⋯ G ( α 1 , β 1 ) , G ( α , β ) := − R Φ ( α ) R G ( β ) (176)
with some angles { ( α j , β j ) } \{(\alpha_j,\beta_j)\} {( α j , β j )} to be specified, which transforms the state ∣ Φ ⟩ |\Phi\rangle ∣Φ ⟩ as
A L ∣ Φ ⟩ = p L e i θ G ~ ∣ 0 i n v ⟩ ∣ G ~ ⟩ + 1 − p L e i θ B ~ ∣ B ~ ⟩ , (177) \mathcal{A}_{L}|\Phi\rangle=\sqrt{p_{L}}e^{i\theta_{\widetilde{G}}}|0^{\mathrm{inv}}\rangle|\widetilde{G}\rangle+\sqrt{1-p_{L}}e^{i\theta_{\widetilde{B}}}|\widetilde{B}\rangle, \tag*{(177)} A L ∣Φ ⟩ = p L e i θ G ∣ 0 inv ⟩ ∣ G ⟩ + 1 − p L e i θ B ∣ B ⟩ , (177)
where θ G ~ \theta_{\widetilde{G}} θ G and θ B ~ \theta_{\widetilde{B}} θ B are phases of ∣ G ~ ⟩ |\widetilde{G}\rangle ∣ G ⟩ and ∣ B ⟩ |B\rangle ∣ B ⟩ , respectively, and p L p_{L} p L is the amplified success probability. That is to say, only the amplitudes and phases of these states are changed, but the states remain unchanged. Following the FPAA construction in [34 ] , the angles in the sequence A L \mathcal{A}_{L} A L are chosen as
α j = − β ℓ − j + 1 = 2 cot − 1 [ tan ( 2 π j L ) 1 − γ 2 ] , (178) \alpha_{j}=-\beta_{\ell-j+1}=2\cot^{-1}\left[\tan\left(\frac{2\pi j}{L}\right)\sqrt{1-\gamma^{2}}\right], \tag*{(178)} α j = − β ℓ − j + 1 = 2 cot − 1 [ tan ( L 2 π j ) 1 − γ 2 ] , (178)
where
γ − 1 = cosh [ 1 L arccosh ( 1 δ ) ] (179) \gamma^{-1}=\cosh\left[\frac{1}{L}\operatorname{arccosh}\left(\frac{1}{\delta}\right)\right] \tag*{(179)} γ − 1 = cosh [ L 1 arccosh ( δ 1 ) ] (179)
for some 0 < δ < 1 0<\delta<1 0 < δ < 1 . The FPAA guarantees p L ≥ 1 − δ 2 p_{L}\ge1-\delta^{2} p L ≥ 1 − δ 2 when p s u c c ≥ 1 − γ 2 p_{\mathrm{succ}}\ge1-\gamma^{2} p succ ≥ 1 − γ 2 .
We now determine a sufficient length L L L for the sequence using the lower bound on the initial success amplitude. Let p min = 9 / 16 κ p r e c \sqrt{p_{\min}}=9/16\kappa_{\mathrm{prec}} p m i n = 9/16 κ prec be the lower bound for p s u c c \sqrt{p_{\mathrm{succ}}} p succ in Eq. (172) . To have p s u c c ≥ 1 − γ 2 p_{\mathrm{succ}}\ge1-\gamma^{2} p succ ≥ 1 − γ 2 , we take p min ≥ 1 − γ 2 p_{\min}\ge1-\gamma^{2} p m i n ≥ 1 − γ 2 , from which we obtain L ≥ L ⋆ L\ge L_{\star} L ≥ L ⋆ with
L ⋆ = arccosh ( 1 / δ ) arctanh ( p min ) ≤ 1 p min ln ( 2 δ ) , (180) L_{\star}=\frac{\operatorname{arccosh}(1/\delta)}{\operatorname{arctanh}(\sqrt{p_{\min}})}\le\frac{1}{\sqrt{p_{\min}}}\ln\left(\frac{2}{\delta}\right), \tag*{(180)} L ⋆ = arctanh ( p m i n ) arccosh ( 1/ δ ) ≤ p m i n 1 ln ( δ 2 ) , (180)
where the upper bound is achieved using arccosh ( 1 / x ) ≤ ln ( 2 / x ) \operatorname{arccosh}(1/x)\le\ln(2/x) arccosh ( 1/ x ) ≤ ln ( 2/ x ) and arctanh ( x ) ≥ x \operatorname{arctanh}(x)\ge x arctanh ( x ) ≥ x for any x ∈ ( 0 , 1 ) x\in(0,1) x ∈ ( 0 , 1 ) . We then take the smallest odd integer L L L that satisfies
L ≥ 1 p min ln ( 2 δ ) = 16 9 κ p r e c ln ( 2 δ ) , (181) L\ge\frac{1}{\sqrt{p_{\min}}}\ln\left(\frac{2}{\delta}\right)=\frac{16}{9}\kappa_{\mathrm{prec}}\ln\left(\frac{2}{\delta}\right), \tag*{(181)} L ≥ p m i n 1 ln ( δ 2 ) = 9 16 κ prec ln ( δ 2 ) , (181)
from which we obtain ℓ = ( L − 1 ) / 2 \ell=(L-1)/2 ℓ = ( L − 1 ) /2 . With this L L L , the FPAA guarantees the approximate good state ∣ G ~ ⟩ |\widetilde{G}\rangle ∣ G ⟩ is prepared with the amplified success probability of p L ≥ 1 − δ 2 p_{L}\ge1-\delta^{2} p L ≥ 1 − δ 2 . Because κ p r e c ∈ O ( 1 ) \kappa_{\mathrm{prec}}\in O(1) κ prec ∈ O ( 1 ) , the length of the sequence scales as L ∈ O ( log ( 1 / δ ) ) L\in O(\log(1/\delta)) L ∈ O ( log ( 1/ δ )) . Finally, we remark that when the phase of the amplified good state matters, one can instead use the QSVT-based FPAA [19 Theorem 27] , which avoids the unknown phase issue and achieves the same same scaling for L L L .
Implementing FPAA. To implement the FPAA, note that ∣ Φ ⟩ \lvert\Phi\rangle ∣ Φ ⟩ is a t t t -qubit state with t = a i n v + n + 1 t=a_{\mathrm{inv}}+n+1 t = a inv + n + 1 as a i n v a_{\mathrm{inv}} a inv ancillas are used in QMI and ∣ ϕ i n ⟩ \lvert\phi_{\mathrm{in}}\rangle ∣ ϕ in ⟩ is a ( n + 1 ) (n+1) ( n + 1 ) -qubit state. Also, note that the good subspace is determined by the ancilla qubits, so we have Π G ~ = Π a i n v ⊗ 1 n + 1 \Pi_{\widetilde{G}}=\Pi_{a_{\mathrm{inv}}}\otimes1_{n+1} Π G = Π a inv ⊗ 1 n + 1 , where Π m : = ∣ 0 m ⟩ ⟨ 0 m ∣ \Pi_m:=\lvert0^m\rangle\langle0^m\rvert Π m := ∣ 0 m ⟩ ⟨ 0 m ∣ is the projection onto the m m m -qubit zero state. Let V i n V_{\mathrm{in}} V in be the unitary that prepares ∣ ϕ i n ⟩ \lvert\phi_{\mathrm{in}}\rangle ∣ ϕ in ⟩ , then the projection onto ∣ Φ ⟩ \lvert\Phi\rangle ∣ Φ ⟩ can be decomposed as Π Φ = ∣ Φ ⟩ ⟨ Φ ∣ = QMI V i n Π t V i n † QMI † \Pi_{\Phi}=\lvert\Phi\rangle\langle\Phi\rvert=\texttt{QMI}\ V_{\mathrm{in}}\Pi_t V_{\mathrm{in}}^\dagger\texttt{QMI}^\dagger Π Φ = ∣ Φ ⟩ ⟨ Φ ∣ = QMI V in Π t V in † QMI † . Let R m ( θ ) : = 1 m − ( 1 − e i θ ) Π m R_m(\theta):=1_m-(1-e^{\mathrm{i}\theta})\Pi_m R m ( θ ) := 1 m − ( 1 − e i θ ) Π m be the generalized reflection about the m m m -qubit zero state, then we have the decompositions
R G ~ ( β ) = R a i n v ( β ) , R Φ ( α ) = QMI V i n R t ( − α ) V i n † QMI † (182) R_{\widetilde{G}}(\beta)=R_{a_{\mathrm{inv}}}(\beta),\qquad R_{\Phi}(\alpha)=\texttt{QMI}\ V_{\mathrm{in}}R_t(-\alpha)V_{\mathrm{in}}^\dagger\texttt{QMI}^\dagger \tag*{(182)} R G ( β ) = R a inv ( β ) , R Φ ( α ) = QMI V in R t ( − α ) V in † QMI † (182)
for the reflection operators in Eq. (175) . With α j = − β ℓ − j + 1 \alpha_j=-\beta_{\ell-j+1} α j = − β ℓ − j + 1 we achieve
A L = ∏ j = ℓ 1 QMI V i n R t ( β ℓ − j + 1 ) V i n † QMI † R a i n v ( β j ) , (183) \mathcal{A}_L=\prod_{j=\ell}^{1}\texttt{QMI}\ V_{\mathrm{in}}R_t(\beta_{\ell-j+1})V_{\mathrm{in}}^\dagger\texttt{QMI}^\dagger R_{a_{\mathrm{inv}}}(\beta_j), \tag*{(183)} A L = j = ℓ ∏ 1 QMI V in R t ( β ℓ − j + 1 ) V in † QMI † R a inv ( β j ) , (183)
where L = 2 ℓ + 1 L=2\ell+1 L = 2 ℓ + 1 . We use this decomposition to construct the quantum circuit in Figure 9 (c) for implementing FPAA. The generalized reflections here are implemented in the circuit using the phase gate P ( θ ) = diag ( 1 , exp ( i θ ) ) \mathrm{P}(\theta)=\operatorname{diag}(1,\exp(\mathrm{i}\theta)) P ( θ ) = diag ( 1 , exp ( i θ )) based on the approach discussed in Appendix § 6 .§ 3 .
Figure 9. Quantum circuits for generating the distributed quantum solution state. (a) The main circuit based on high-level operations. (b) Implementation of QMI using the block encoding of the preconditioned matrix, its inverse, and low-level operations. (c) Implementation of FPAA by the operations used in the main circuit.
Cost and error analysis for the distributed quantum solution
Here we first analyze the query cost for implementing QMI using the QSVT approach. Then we analyze how the matrix-inversion error and the failure amplitude after FPAA contribute to the error in the generated solution state. Finally, we use the query cost and the gate cost of other operations to obtain the overall gate cost of generating the quantum solution in terms of the gate cost of a block encoding of the preconditioned matrix.
Query cost. To analyze the query cost, first we consider a general linear system A x = b A x = b A x = b with an invertible Hermitian matrix A A A , and then specialize the result for the preconditioned matrix A p r e c A_{\mathrm{prec}} A prec in our case. As a standard assumption in quantum linear-system solvers, suppose that ∥ A ∥ ≤ 1 \lVert A\rVert\le1 ∥ A ∥ ≤ 1 and that the spectrum of A A A satisfies spec ( A ) ⊆ I Δ : = [ − 1 , − Δ ] ∪ [ Δ , 1 ] \operatorname{spec}(A) \subseteq I_{\Delta} := [-1,-\Delta] \cup[\Delta,1] spec ( A ) ⊆ I Δ := [ − 1 , − Δ ] ∪ [ Δ , 1 ] , where Δ \Delta Δ is a lower bound on the absolute eigenvalues of A A A . In particular, for ∥ A ∥ ≤ 1 \lVert A\rVert\le1 ∥ A ∥ ≤ 1 , we can choose Δ = ∥ A ∥ / κ \Delta= \lVert A\rVert/\kappa Δ = ∥ A ∥ / κ with κ \kappa κ the condition number of A A A .
Let p ( x ) p(x) p ( x ) be an odd real polynomial of degree d ∈ O ( Δ − 1 log ( 1 / ε ′ ) ) d \in O(\Delta^{-1}\log(1/\varepsilon')) d ∈ O ( Δ − 1 log ( 1/ ε ′ )) that satisfies ∣ p ( x ) ∣ ≤ 1 \lvert p(x)\rvert\le1 ∣ p ( x )∣ ≤ 1 for all x ∈ [ − 1 , 1 ] x \in[-1,1] x ∈ [ − 1 , 1 ] and ∣ p ( x ) − 3 Δ / ( 4 x ) ∣ ≤ ε ′ \lvert p(x) - 3\Delta/(4x)\rvert\le\varepsilon' ∣ p ( x ) − 3Δ/ ( 4 x )∣ ≤ ε ′ for all x ∈ I Δ x \in I_{\Delta} x ∈ I Δ ; the factor here ensures 1 / x 1/x 1/ x is appropriately rescaled for a bounded polynomial approximation. Given a ( 1 , a A , 0 ) (1,a_A,0) ( 1 , a A , 0 ) -block encoding U A U_A U A of A A A , i.e., a perfect block encoding with zero error, QSVT constructs a ( 1 , a A + 1 , ε ′ ) (1,a_A+1,\varepsilon') ( 1 , a A + 1 , ε ′ ) -block encoding U p ( A ) U_{p(A)} U p ( A ) of p ( A ) p(A) p ( A ) using d d d queries to U A U_A U A and U A † U_A^\dagger U A † . The polynomial approximation guarantees ∥ p ( A ) − ( 3 Δ / 4 ) A − 1 ∥ ≤ ε ′ \lVert p(A)-(3\Delta/4)A^{-1}\rVert\le\varepsilon' ∥ p ( A ) − ( 3Δ/4 ) A − 1 ∥ ≤ ε ′ , and by rescaling we obtain
∥ 4 3 Δ p ( A ) − A − 1 ∥ ≤ 4 ε ′ 3 Δ . (184) \left\lVert\frac{4}{3\Delta}p(A)-A^{-1}\right\rVert\le\frac{4\varepsilon'}{3\Delta}. \tag*{(184)} 3Δ 4 p ( A ) − A − 1 ≤ 3Δ 4 ε ′ . (184)
Consequently, U p ( A ) U_{p(A)} U p ( A ) is an ( α i n v , a A + 1 , ε i n v ) (\alpha_{\mathrm{inv}},a_A+1,\varepsilon_{\mathrm{inv}}) ( α inv , a A + 1 , ε inv ) block encoding of A − 1 A^{-1} A − 1 with
α i n v : = 4 3 Δ , ε i n v : = 4 ε ′ 3 Δ . (185) \alpha_{\mathrm{inv}} := \frac{4}{3\Delta},\qquad\varepsilon_{\mathrm{inv}} := \frac{4\varepsilon'}{3\Delta}. \tag*{(185)} α inv := 3Δ 4 , ε inv := 3Δ 4 ε ′ . (185)
For Δ = ∥ A ∥ / κ \Delta=\lVert A\rVert/\kappa Δ = ∥ A ∥ / κ , these become α i n v = 4 κ / ( 3 ∥ A ∥ ) \alpha_{\mathrm{inv}}=4\kappa/(3\lVert A\rVert) α inv = 4 κ / ( 3 ∥ A ∥) and ε i n v = 4 κ ε ′ / ( 3 ∥ A ∥ ) \varepsilon_{\mathrm{inv}}=4\kappa\varepsilon'/(3\lVert A\rVert) ε inv = 4 κ ε ′ / ( 3 ∥ A ∥) . Therefore, we can express the polynomial degree in terms of properties of A A A and the error ε i n v \varepsilon_{\mathrm{inv}} ε inv in approximating A − 1 A^{-1} A − 1 as d ∈ O ( ( κ / ∥ A ∥ ) log ( κ / ( ∥ A ∥ ε i n v ) ) ) d \in O((\kappa/\lVert A\rVert)\log(\kappa/(\lVert A\rVert\varepsilon_{\mathrm{inv}}))) d ∈ O (( κ / ∥ A ∥) log ( κ / (∥ A ∥ ε inv ))) . If ε \varepsilon ε is the error in generating an approximation of the normalized solution state ∣ x ⟩ / ∥ ∣ x ⟩ ∥ \lvert x\rangle/\lVert\lvert x\rangle\rVert ∣ x ⟩ / ∥∣ x ⟩∥ of the linear system with ∣ x ⟩ : = A − 1 ∣ b ⟩ \lvert x\rangle:= A^{-1}\lvert b\rangle ∣ x ⟩ := A − 1 ∣ b ⟩ , then choosing ε i n v \varepsilon_{\mathrm{inv}} ε inv such that 2 ∥ A ∥ ε i n v ≤ ε 2\lVert A\rVert\varepsilon_{\mathrm{inv}}\le\varepsilon 2 ∥ A ∥ ε inv ≤ ε guarantees that the approximate state is within ε \varepsilon ε error of the ideal state. The query cost then becomes O ( ( κ / ∥ A ∥ ) log ( κ / ε ) ) O((\kappa/\lVert A\rVert)\log(\kappa/\varepsilon)) O (( κ / ∥ A ∥) log ( κ / ε )) . If ∥ A ∥ = 1 \lVert A\rVert=1 ∥ A ∥ = 1 , the familiar scaling O ( κ log ( κ / ε ) ) O(\kappa\log(\kappa/\varepsilon)) O ( κ log ( κ / ε )) for the query cost is obtained.
We now consider the more general case in which the block encoding of A A A is not exact. Suppose U A U_A U A is a ( 1 , a A , ε A ) (1,a_A,\varepsilon_A) ( 1 , a A , ε A ) block encoding of A A A with tunable error ε A \varepsilon_A ε A . By the robustness of QSVT [19 Lemma 22] , the imperfect block encoding introduces an additional error bounded by 4 d ε A 4d\sqrt{\varepsilon_A} 4 d ε A in the polynomial approximation; it makes the total error in approximating ( 3 Δ / 4 ) A − 1 (3\Delta/4)A^{-1} ( 3Δ/4 ) A − 1 to increase from ε ′ \varepsilon' ε ′ to ε ′ + 4 d ε A \varepsilon'+4d\sqrt{\varepsilon_A} ε ′ + 4 d ε A . By imposing the condition 4 d ε A ≤ ε ′ 4d\sqrt{\varepsilon_A}\le\varepsilon' 4 d ε A ≤ ε ′ on ε A \varepsilon_A ε A , the total error is then at most 2 ε ′ 2\varepsilon' 2 ε ′ , and hence ε i n v \varepsilon_{\mathrm{inv}} ε inv now becomes ε i n v = 8 ε ′ / ( 3 Δ ) \varepsilon_{\mathrm{inv}}=8\varepsilon'/(3\Delta) ε inv = 8 ε ′ / ( 3Δ ) .
In our case, QMI block encodes A p r e c − 1 A_{\mathrm{prec}}^{-1} A prec − 1 using a block encoding of A p r e c A_{\mathrm{prec}} A prec with the norm ∥ A p r e c ∥ ∈ Θ ( 1 ) \lVert A_{\mathrm{prec}}\rVert\in\Theta(1) ∥ A prec ∥ ∈ Θ ( 1 ) and the condition number κ p r e c ∈ Θ ( 1 ) \kappa_{\mathrm{prec}}\in\Theta(1) κ prec ∈ Θ ( 1 ) . In § 3.3.5 , we construct an ( α p r e c , a p r e c , ε p r e c ) (\alpha_{\mathrm{prec}},a_{\mathrm{prec}},\varepsilon_{\mathrm{prec}}) ( α prec , a prec , ε prec ) block encoding U A p r e c U_{A_{\mathrm{prec}}} U A prec of A p r e c A_{\mathrm{prec}} A prec with the normalization α p r e c ∈ Θ ( n ) \alpha_{\mathrm{prec}}\in\Theta(n) α prec ∈ Θ ( n ) and the error ε p r e c \varepsilon_{\mathrm{prec}} ε prec that satisfies the condition 4 d ε p r e c / α p r e c ≤ ε ′ 4d\sqrt{\varepsilon_{\mathrm{prec}}/\alpha_{\mathrm{prec}}}\le\varepsilon' 4 d ε prec / α prec ≤ ε ′ . Equivalently, U A p r e c U_{A_{\mathrm{prec}}} U A prec is a ( 1 , a p r e c , ε p r e c / α p r e c ) (1,a_{\mathrm{prec}},\varepsilon_{\mathrm{prec}}/\alpha_{\mathrm{prec}}) ( 1 , a prec , ε prec / α prec ) block encoding of the rescaled matrix A p r e c / α p r e c A_{\mathrm{prec}}/\alpha_{\mathrm{prec}} A prec / α prec whose norm is ≤ 1 \le1 ≤ 1 and whose eigenvalues are greater than Δ = ∥ A p r e c ∥ / ( α p r e c κ p r e c ) \Delta=\lVert A_{\mathrm{prec}}\rVert/(\alpha_{\mathrm{prec}}\kappa_{\mathrm{prec}}) Δ = ∥ A prec ∥ / ( α prec κ prec ) . The QMI built by the QSVT approach, i.e., QMI = U p ( A p r e c / α p r e c ) =U_{p(A_{\mathrm{prec}}/\alpha_{\mathrm{prec}})} = U p ( A prec / α prec ) , then provides an ( α i n v , a p r e c + 1 , ε i n v ) (\alpha_{\mathrm{inv}},a_{\mathrm{prec}}+1,\varepsilon_{\mathrm{inv}}) ( α inv , a prec + 1 , ε inv ) block encoding of A p r e c − 1 A_{\mathrm{prec}}^{-1} A prec − 1 , where
α i n v = 4 3 Δ α p r e c = 4 κ p r e c 3 ∥ A p r e c ∥ , ε i n v = 8 ε ′ 3 Δ α p r e c = 8 κ p r e c ε ′ 3 ∥ A p r e c ∥ . (186) \alpha_{\mathrm{inv}}=\frac{4}{3\Delta\alpha_{\mathrm{prec}}}=\frac{4\kappa_{\mathrm{prec}}}{3\lVert A_{\mathrm{prec}}\rVert},\qquad\varepsilon_{\mathrm{inv}}=\frac{8\varepsilon'}{3\Delta\alpha_{\mathrm{prec}}}=\frac{8\kappa_{\mathrm{prec}}\varepsilon'}{3\lVert A_{\mathrm{prec}}\rVert}. \tag*{(186)} α inv = 3Δ α prec 4 = 3 ∥ A prec ∥ 4 κ prec , ε inv = 3Δ α prec 8 ε ′ = 3 ∥ A prec ∥ 8 κ prec ε ′ . (186)
by Eq. (184) with A → A p r e c / α p r e c A\to A_{\mathrm{prec}}/\alpha_{\mathrm{prec}} A → A prec / α prec and ε ′ → 2 ε ′ \varepsilon'\to2\varepsilon' ε ′ → 2 ε ′ . By expressions of Δ \Delta Δ and ε ′ \varepsilon' ε ′ , it follows that QMI makes
Q Q M I ∈ O ( ( α p r e c κ p r e c ∥ A p r e c ∥ ) log ( κ p r e c ∥ A p r e c ∥ ε i n v ) ) (187) Q_{\mathrm{QMI}}\in O\left(\left(\frac{\alpha_{\mathrm{prec}}\kappa_{\mathrm{prec}}}{\lVert A_{\mathrm{prec}}\rVert}\right)\log\left(\frac{\kappa_{\mathrm{prec}}}{\lVert A_{\mathrm{prec}}\rVert\varepsilon_{\mathrm{inv}}}\right)\right) \tag*{(187)} Q QMI ∈ O ( ( ∥ A prec ∥ α prec κ prec ) log ( ∥ A prec ∥ ε inv κ prec ) ) (187)
queries to U A p r e c U_{A_{\mathrm{prec}}} U A prec and U A p r e c † U_{A_{\mathrm{prec}}}^{\dagger} U A prec † . In the following error analysis, we show that choosing ∥ A p r e c ∥ ε i n v ≤ ε / 4 \lVert A_{\mathrm{prec}}\rVert\varepsilon_{\mathrm{inv}}\le\varepsilon/4 ∥ A prec ∥ ε inv ≤ ε /4 guarantees that the normalized distributed solution state is obtained with error ≤ ε \le\varepsilon ≤ ε . With α p r e c ∈ Θ ( n ) \alpha_{\mathrm{prec}}\in\Theta(n) α prec ∈ Θ ( n ) and κ p r e c , ∥ A p r e c ∥ ∈ Θ ( 1 ) \kappa_{\mathrm{prec}},\lVert A_{\mathrm{prec}}\rVert\in\Theta(1) κ prec , ∥ A prec ∥ ∈ Θ ( 1 ) , we have
Q Q M I ∈ O ( n log ( 1 / ε ) ) (188) Q_{\mathrm{QMI}}\in O(n\log(1/\varepsilon)) \tag*{(188)} Q QMI ∈ O ( n log ( 1/ ε )) (188)
for the query cost. Note that the factor n n n in the query cost is due to the normalization factor in the block encoding of A p r e c A_{\mathrm{prec}} A prec .
Error analysis. We next bound the error in the normalized distributed solution state. The two sources of error are the approximation of A p r e c − 1 A_{\mathrm{prec}}^{-1} A prec − 1 by QMI and the failure amplitude after FPAA. The error in the normalized output state of QMI conditioned on ∣ 0 i n v ⟩ \lvert0^{\mathrm{inv}}\rangle ∣ 0 inv ⟩ is bounded as
∥ ∣ G ~ ⟩ − ∣ G ⟩ ∥ ≤ 2 ∥ ∣ ϕ ~ o u t ⟩ − ∣ ϕ o u t ⟩ ∥ ∥ ∣ ϕ o u t ⟩ ∥ ≤ 2 ε i n v ∥ A p r e c ∥ (189) \left\lVert\lvert\widetilde{G}\rangle-\lvert G\rangle\right\rVert\le2\frac{\left\lVert\lvert\widetilde{\phi}_{\mathrm{out}}\rangle-\lvert\phi_{\mathrm{out}}\rangle\right\rVert}{\lVert\lvert\phi_{\mathrm{out}}\rangle\rVert}\le2\varepsilon_{\mathrm{inv}}\lVert A_{\mathrm{prec}}\rVert \tag*{(189)} ∣ G ⟩ − ∣ G ⟩ ≤ 2 ∥∣ ϕ out ⟩∥ ∣ ϕ out ⟩ − ∣ ϕ out ⟩ ≤ 2 ε inv ∥ A prec ∥ (189)
where we used ∥ ∣ ϕ o u t ⟩ ∥ ≥ 1 / ∥ A p r e c ∥ \lVert\lvert\phi_{\mathrm{out}}\rangle\rVert\ge1/\lVert A_{\mathrm{prec}}\rVert ∥∣ ϕ out ⟩∥ ≥ 1/ ∥ A prec ∥ and that the numerator is ≤ ε i n v \le\varepsilon_{\mathrm{inv}} ≤ ε inv . The output state of FPAA is
∣ Φ ~ o u t ⟩ = p L ∣ 0 a i n v ⟩ ∣ G ~ ⟩ + 1 − p L ∣ B ~ ⟩ , (190) \lvert\widetilde{\Phi}_{\mathrm{out}}\rangle= \sqrt{p_L}\lvert0^{a_{\mathrm{inv}}}\rangle\lvert\widetilde{G}\rangle+ \sqrt{1-p_L}\lvert\widetilde{B}\rangle, \tag*{(190)} ∣ Φ out ⟩ = p L ∣ 0 a inv ⟩ ∣ G ⟩ + 1 − p L ∣ B ⟩ , (190)
and the target output of FPAA is ∣ Φ o u t ⟩ = ∣ 0 a i n v ⟩ ∣ G ~ ⟩ \lvert\Phi_{\mathrm{out}}\rangle= \lvert0^{a_{\mathrm{inv}}}\rangle\lvert\widetilde{G}\rangle ∣ Φ out ⟩ = ∣ 0 a inv ⟩ ∣ G ⟩ , so we have
∥ ∣ Φ ~ o u t ⟩ − ∣ Φ o u t ⟩ ∥ 2 ≤ 2 − 2 p L ≤ 2 ( 1 − p L ) ≤ 2 δ 2 (191) \left\lVert\lvert\widetilde{\Phi}_{\mathrm{out}}\rangle- \lvert\Phi_{\mathrm{out}}\rangle\right\rVert^2 \le2 - 2\sqrt{p_L} \le2(1-p_L) \le2\delta^2 \tag*{(191)} ∣ Φ out ⟩ − ∣ Φ out ⟩ 2 ≤ 2 − 2 p L ≤ 2 ( 1 − p L ) ≤ 2 δ 2 (191)
using 1 − δ 2 ≤ p L ≤ 1 1-\delta^2 \le p_L \le1 1 − δ 2 ≤ p L ≤ 1 for L L L in Eq. (181) . Let us now define
∣ Ψ ~ o u t ⟩ : = 1 2 ∑ a ∈ { 0 , 1 } ∣ a ⟩ W † U a ∣ Φ ~ o u t ⟩ , (192) \lvert\widetilde{\Psi}_{\mathrm{out}}\rangle:= \frac{1}{\sqrt{2}}\sum_{a\in\{0,1\}}\lvert a\rangle W^{\dagger}U^{a}\lvert\widetilde{\Phi}_{\mathrm{out}}\rangle, \tag*{(192)} ∣ Ψ out ⟩ := 2 1 a ∈ { 0 , 1 } ∑ ∣ a ⟩ W † U a ∣ Φ out ⟩ , (192)
which is an approximation of
∣ Ψ o u t ⟩ = ∣ 0 a i n v ⟩ ∣ ψ ⟩ , ∣ ψ ⟩ = 1 2 ∑ a ∈ { 0 , 1 } ∣ a ⟩ W † U a ∣ G ⟩ (193) \lvert\Psi_{\mathrm{out}}\rangle= \lvert0^{a_{\mathrm{inv}}}\rangle\lvert\psi\rangle,\quad\lvert\psi\rangle= \frac{1}{\sqrt{2}}\sum_{a\in\{0,1\}}\lvert a\rangle W^{\dagger}U^{a}\lvert G\rangle \tag*{(193)} ∣ Ψ out ⟩ = ∣ 0 a inv ⟩ ∣ ψ ⟩ , ∣ ψ ⟩ = 2 1 a ∈ { 0 , 1 } ∑ ∣ a ⟩ W † U a ∣ G ⟩ (193)
with ∣ ψ ⟩ \lvert\psi\rangle ∣ ψ ⟩ the ideal distributed solution state. We then have
∥ ∣ Ψ ~ o u t ⟩ − ∣ Ψ o u t ⟩ ∥ ≤ ∥ ∣ Φ ~ o u t ⟩ − ∣ 0 a i n v ⟩ ∣ G ⟩ ∥ (194) \left\lVert\lvert\widetilde{\Psi}_{\mathrm{out}}\rangle- \lvert\Psi_{\mathrm{out}}\rangle\right\rVert\le\left\lVert\lvert\widetilde{\Phi}_{\mathrm{out}}\rangle- \lvert0^{a_{\mathrm{inv}}}\rangle\lvert G\rangle\right\rVert \tag*{(194)} ∣ Ψ out ⟩ − ∣ Ψ out ⟩ ≤ ∣ Φ out ⟩ − ∣ 0 a inv ⟩ ∣ G ⟩ (194)
≤ ∥ ∣ Φ ~ o u t ⟩ − ∣ Φ o u t ⟩ ∥ + ∥ ∣ G ~ ⟩ − ∣ G ⟩ ∥ (195) \le\left\lVert\lvert\widetilde{\Phi}_{\mathrm{out}}\rangle- \lvert\Phi_{\mathrm{out}}\rangle\right\rVert+ \left\lVert\lvert\widetilde{G}\rangle- \lvert G\rangle\right\rVert \tag*{(195)} ≤ ∣ Φ out ⟩ − ∣ Φ out ⟩ + ∣ G ⟩ − ∣ G ⟩ (195)
≤ 2 δ + 2 ε i n v ∥ A p r e c ∥ , (196) \le\sqrt{2}\delta+ 2\varepsilon_{\mathrm{inv}}\lVert A_{\mathrm{prec}}\rVert, \tag*{(196)} ≤ 2 δ + 2 ε inv ∥ A prec ∥ , (196)
where the second line follows by adding and subtracting ∣ Φ o u t ⟩ = ∣ 0 a i n v ⟩ ∣ G ~ ⟩ \lvert\Phi_{\mathrm{out}}\rangle= \lvert0^{a_{\mathrm{inv}}}\rangle\lvert\widetilde{G}\rangle ∣ Φ out ⟩ = ∣ 0 a inv ⟩ ∣ G ⟩ and using the triangle inequality. By setting 2 ε i n v ∥ A p r e c ∥ = ε / 2 2\varepsilon_{\mathrm{inv}}\lVert A_{\mathrm{prec}}\rVert= \varepsilon/2 2 ε inv ∥ A prec ∥ = ε /2 and δ 2 = ε / 2 \delta\sqrt{2} = \varepsilon/2 δ 2 = ε /2 , we obtain the distributed solution state ∣ ψ ⟩ \lvert\psi\rangle ∣ ψ ⟩ with error ≤ ε \le\varepsilon ≤ ε . Notice that the smallest odd integer L L L used for FPAA is then L ∈ Θ ( log ( 1 / ε ) ) L \in\Theta(\log(1/\varepsilon)) L ∈ Θ ( log ( 1/ ε )) .
Gate cost. Let G ( U ) \mathcal{G}(U) G ( U ) denote the gate cost of implementing a unitary U U U or its inverse and let G ε ( ψ ) \mathcal{G}_{\varepsilon}(\psi) G ε ( ψ ) be the gate cost of generating an ε \varepsilon ε -approximation of the solution state. The solution state is generated by applying A L A_L A L QMI V i n V_{\mathrm{in}} V in on the all-zero state followed by controlled U ± U^{\pm} U ± and the inverse quantum wavelet transform. Then by Eq. (183) we have
G ε ( ψ ) = L ( G ( Q M I ) + G ( V i n ) ) + 1 2 ( L − 1 ) ( G ( R t ) + G ( R a i n v ) ) + G ( U ± ) + G ( W ) , (197) \mathcal{G}_{\varepsilon}(\psi) = L\bigl(\mathcal{G}(\mathrm{QMI})+\mathcal{G}(V_{\mathrm{in}})\bigr)+\frac{1}{2}(L-1)\bigl(\mathcal{G}(R_t)+\mathcal{G}(R_{a_{\mathrm{inv}}})\bigr)+\mathcal{G}(U^{\pm})+\mathcal{G}(W), \tag*{(197)} G ε ( ψ ) = L ( G ( QMI ) + G ( V in ) ) + 2 1 ( L − 1 ) ( G ( R t ) + G ( R a inv ) ) + G ( U ± ) + G ( W ) , (197)
where R m R_m R m denotes the generalized reflection about the m m m -qubit zero state. We first analyze the cost of QMI. As discussed before, it makes Q Q M I ∈ O ( n log ( 1 / ε ) ) Q_{\mathrm{QMI}}\in O(n\log(1/\varepsilon)) Q QMI ∈ O ( n log ( 1/ ε )) queries to U A p r e c U_{A_{\mathrm{prec}}} U A prec and U A p r e c † U_{A_{\mathrm{prec}}}^{\dagger} U A prec † . Moreover, it uses Q Q M I Q_{\mathrm{QMI}} Q QMI generalized reflections about the a p r e c a_{\mathrm{prec}} a prec -qubit zero state, implemented by ∣ 0 a p r e c ⟩ \lvert0^{a_{\mathrm{prec}}}\rangle ∣ 0 a prec ⟩ -controlled X X X gate followed by a single-qubit Z Z Z rotation and ∣ 0 a p r e c ⟩ \lvert0^{a_{\mathrm{prec}}}\rangle ∣ 0 a prec ⟩ -controlled X X X gate. Its gate cost is then
G ( Q M I ) = O ( n log ( 1 / ε ) [ G ( U A p r e c ) + G ( R a p r e c ) ] ) . (198) \mathcal{G}(\mathrm{QMI})=O\bigl(n\log(1/\varepsilon)[\mathcal{G}(U_{A_{\mathrm{prec}}})+\mathcal{G}(R_{a_{\mathrm{prec}}})]\bigr). \tag*{(198)} G ( QMI ) = O ( n log ( 1/ ε ) [ G ( U A prec ) + G ( R a prec )] ) . (198)
We now analyze the gate cost of other operations. Note that V i n = C 1 ( U − ) C 0 ( U + ) ( H ⊗ W ) U l o a d V_{\mathrm{in}}=C_1(U^- )C_0(U^+)(H\otimes W)U_{\mathrm{load}} V in = C 1 ( U − ) C 0 ( U + ) ( H ⊗ W ) U load , where U l o a d U_{\mathrm{load}} U load prepares the initial state ∣ b ⟩ \lvert b\rangle ∣ b ⟩ . The gate cost of U l o a d U_{\mathrm{load}} U load is Θ ( n log n ) \Theta(n\log n) Θ ( n log n ) by Eq. (122) ; the gate cost of W W W is Θ ( n 2 ) \Theta(n^2) Θ ( n 2 ) [32 ] ; and the gate cost of controlled U ± U^{\pm} U ± is O ( n ) O(n) O ( n ) [8 ] , so we obtain G ( V i n ) ∈ O ( n 2 ) \mathcal{G}(V_{\mathrm{in}})\in O(n^2) G ( V in ) ∈ O ( n 2 ) . As discussed in Appendix § 6 .§ 3 , the generalized reflection about the m m m -qubit zero state can be implemented with Θ ( m ) \Theta(m) Θ ( m ) gates, so we have G ( R t ) ∈ Θ ( t ) \mathcal{G}(R_t)\in\Theta(t) G ( R t ) ∈ Θ ( t ) ; G ( R a i n v ) ∈ Θ ( a i n v ) \mathcal{G}(R_{a_{\mathrm{inv}}})\in\Theta(a_{\mathrm{inv}}) G ( R a inv ) ∈ Θ ( a inv ) ; and G ( R a p r e c ) ∈ Θ ( a p r e c ) \mathcal{G}(R_{a_{\mathrm{prec}}})\in\Theta(a_{\mathrm{prec}}) G ( R a prec ) ∈ Θ ( a prec ) . With t = a i n v + n + 1 t=a_{\mathrm{inv}}+n+1 t = a inv + n + 1 and a i n v = a p r e c + 1 ∈ Θ ( n + log ( n / ε ) ) a_{\mathrm{inv}}=a_{\mathrm{prec}}+1\in\Theta(n+\log(n/\varepsilon)) a inv = a prec + 1 ∈ Θ ( n + log ( n / ε )) , all three reflection costs scale as Θ ( n + log ( n / ε ) ) \Theta(n+\log(n/\varepsilon)) Θ ( n + log ( n / ε )) . Combining these bounds with L ∈ Θ ( log ( 1 / ε ) ) L\in\Theta(\log(1/\varepsilon)) L ∈ Θ ( log ( 1/ ε )) gives the overall gate cost
G ε ( ψ ) ∈ O ( n log 2 ( 1 / ε ) G ( U A p r e c ) + O ( n 2 log ( 1 / ε ) ) + O ( n log 2 ( 1 / ε ) [ n + log ( n / ε ) ] ) ) (199) \mathcal{G}_{\varepsilon}(\psi)\in O\bigl(n\log^2(1/\varepsilon)\mathcal{G}(U_{A_{\mathrm{prec}}})+O(n^2\log(1/\varepsilon))+O(n\log^2(1/\varepsilon)[n+\log(n/\varepsilon)])\bigr) \tag*{(199)} G ε ( ψ ) ∈ O ( n log 2 ( 1/ ε ) G ( U A prec ) + O ( n 2 log ( 1/ ε )) + O ( n log 2 ( 1/ ε ) [ n + log ( n / ε )]) ) (199)
for generating an ε \varepsilon ε -approximation of the solution state.
Implementing the operator oracle by inequality tests
The differential operator L \mathcal{L} L of the linearized Poisson–Boltzmann equation in Eq. (90) is a variable-coefficient operator of the form in Eq. (12) . The discretized version of such an operator in d d d dimensions has the form (see Eq. (23) for the 3D case)
A = ∑ ν = 0 d − 1 D ν T E ν D ν + K , (200) A = \sum_{\nu=0}^{d-1} D_\nu^{T} E_\nu D_\nu+ K, \tag*{(200)} A = ν = 0 ∑ d − 1 D ν T E ν D ν + K , (200)
where only the diagonal matrices E ν E_\nu E ν and K K K are problem dependent. By the oracle implementation in § 2.4.3 , we only need to construct a tailored implementation for the block encodings U K U_K U K and U E = ∑ ν ∣ ν ⟩ ⟨ ν ∣ ⊗ U E ν U_E = \sum_\nu\lvert\nu\rangle\langle\nu\rvert\otimes U_{E_\nu} U E = ∑ ν ∣ ν ⟩ ⟨ ν ∣ ⊗ U E ν , to achieve a tailored implementation for the block encoding U A U_A U A of the discretized operator A A A . As the Poisson–Boltzmann equation is naturally a 3D problem, we focus on implementation for d = 3 d=3 d = 3 , in which case ν ∈ { x , y , z } \nu\in\{x,y,z\} ν ∈ { x , y , z } . Generalization of our implementation here to higher dimensions is straightforward.
In the grid discretization of the Poisson–Boltzmann equation, the diagonal elements of E ν E_\nu E ν encode the dielectric coefficient ε ( x ) \varepsilon(\boldsymbol{x}) ε ( x ) on grid’s face points in the ν \nu ν direction and the diagonal elements of K K K encode the screening function κ ( x ) \kappa(\boldsymbol{x}) κ ( x ) on grid’s node points; see Eq. (25) . These functions are piecewise constant functions as in Eq. (89) , and their values depend on whether the associated grid point is inside or outside the molecular cavity. Specifically, let q : = ( i , j , k ) \boldsymbol{q}:=(i,j,k) q := ( i , j , k ) denote the 3D index of grid nodes and let ∣ q ⟩ : = ∣ k ⟩ ∣ j ⟩ ∣ i ⟩ \lvert q\rangle:= \lvert k\rangle\lvert j\rangle\lvert i\rangle ∣ q ⟩ := ∣ k ⟩ ∣ j ⟩ ∣ i ⟩ denote the computational basis. Also, let e ν \boldsymbol{e}_\nu e ν denote the 3D unit vector in the ν \nu ν direction. Then ( q + e ν / 2 ) (\boldsymbol{q}+\boldsymbol{e}_\nu/2) ( q + e ν /2 ) is the index of the face point adjacent to q \boldsymbol{q} q in the ν \nu ν direction, and
x q : = h q and x q , ν : = h ( q + 1 2 e ν ) (201) \boldsymbol{x}_{q}:=h\boldsymbol{q}\quad\text{and}\quad\boldsymbol{x}_{q,\nu}:=h\left(\boldsymbol{q}+\frac{1}{2}\boldsymbol{e}_\nu\right) \tag*{(201)} x q := h q and x q , ν := h ( q + 2 1 e ν ) (201)
are the physical positions of the node point q \boldsymbol{q} q and its adjacent face point in the ν \nu ν direction, respectively. Moreover, we can write
E ν = ε o u t 1 + ( ε c a v − ε o u t ) P c a v ν , (202) E_\nu= \varepsilon_{\mathrm{out}}\mathbb{1} + \left(\varepsilon_{\mathrm{cav}}-\varepsilon_{\mathrm{out}}\right)P_{\mathrm{cav}}^\nu, \tag*{(202)} E ν = ε out 1 + ( ε cav − ε out ) P cav ν , (202)
where
P c a v ν = ∑ q : x q , ν ∈ Ω c a v ∣ q ⟩ ⟨ q ∣ (203) P_{\mathrm{cav}}^\nu= \sum_{q:\boldsymbol{x}_{q,\nu}\in\Omega_{\mathrm{cav}}} \lvert q\rangle\langle q\rvert \tag*{(203)} P cav ν = q : x q , ν ∈ Ω cav ∑ ∣ q ⟩ ⟨ q ∣ (203)
is the projector onto cavity face points in the ν \nu ν direction. Similarly, we have
K = ε o u t κ o u t 2 ( 1 − P c a v ) , (204) K = \varepsilon_{\mathrm{out}}\kappa_{\mathrm{out}}^2\left(1-P_{\mathrm{cav}}\right), \tag*{(204)} K = ε out κ out 2 ( 1 − P cav ) , (204)
where
P c a v = ∑ q : x q ∈ Ω c a v ∣ q ⟩ ⟨ q ∣ (205) P_{\mathrm{cav}} = \sum_{q:\boldsymbol{x}_{q}\in\Omega_{\mathrm{cav}}} \lvert q\rangle\langle q\rvert \tag*{(205)} P cav = q : x q ∈ Ω cav ∑ ∣ q ⟩ ⟨ q ∣ (205)
is the projector onto cavity nodes. With the reflection operator defined as R : = 1 − 2 P R:=\mathbb{1}-2P R := 1 − 2 P for each projector P P P , we write
E ν = α + 1 + α − R c a v ν , α ± : = 1 2 ( ε o u t ± ε c a v ) , (206) E_\nu= \alpha^{+}\mathbb{1}+\alpha^{-}R_{\mathrm{cav}}^\nu,\qquad\alpha^\pm:=\frac{1}{2}\left(\varepsilon_{\mathrm{out}}\pm\varepsilon_{\mathrm{cav}}\right), \tag*{(206)} E ν = α + 1 + α − R cav ν , α ± := 2 1 ( ε out ± ε cav ) , (206)
and
K = 1 2 ε o u t κ o u t 2 ( 1 + R c a v ) . (207) K = \frac{1}{2}\varepsilon_{\mathrm{out}}\kappa_{\mathrm{out}}^2\left(1+R_{\mathrm{cav}}\right). \tag*{(207)} K = 2 1 ε out κ out 2 ( 1 + R cav ) . (207)
The reflection operators act on basis states as
R c a v ∣ q ⟩ = ( − 1 ) f ( q ) ∣ q ⟩ , (208) R_{\mathrm{cav}}\lvert q\rangle= (-1)^{f(q)}\lvert q\rangle, \tag*{(208)} R cav ∣ q ⟩ = ( − 1 ) f ( q ) ∣ q ⟩ , (208)
R c a v ν ∣ q ⟩ = ( − 1 ) f ν ( q ) ∣ q ⟩ , (209) R_{\mathrm{cav}}^\nu\lvert q\rangle= (-1)^{f_\nu(q)}\lvert q\rangle, \tag*{(209)} R cav ν ∣ q ⟩ = ( − 1 ) f ν ( q ) ∣ q ⟩ , (209)
where f ν ( q ) = 1 f_\nu(\boldsymbol{q})=1 f ν ( q ) = 1 if the face point ( q + e ν / 2 ) h (\boldsymbol{q}+\boldsymbol{e}_\nu/2)h ( q + e ν /2 ) h is inside the cavity and f ν ( q ) = 0 f_\nu(\boldsymbol{q})=0 f ν ( q ) = 0 otherwise. Similarly, f ( q ) = 1 f(\boldsymbol{q})=1 f ( q ) = 1 if the node point q h \boldsymbol{q}h q h is inside the cavity and f ( q ) = 0 f(\boldsymbol{q})=0 f ( q ) = 0 otherwise. Constructing a block encoding for E ν E_\nu E ν and K K K then reduces to implementing these reflection operators.
Let us first focus on implementing the reflection R c a v R_{\mathrm{cav}} R cav . To this end, we can initialize an ancilla qubit in ∣ 0 ⟩ \lvert0\rangle ∣ 0 ⟩ and apply the unitary
U f : ∣ q ⟩ ∣ 0 ⟩ ↦ ∣ q ⟩ ∣ f ( q ) ⟩ , (210) U_f:\lvert q\rangle\lvert0\rangle\mapsto\lvert q\rangle\lvert f(q)\rangle, \tag*{(210)} U f : ∣ q ⟩ ∣ 0 ⟩ ↦ ∣ q ⟩ ∣ f ( q )⟩ , (210)
which flips the ancilla to ∣ 1 ⟩ |1\rangle ∣1 ⟩ only if q q q is a cavity node. A Z Z Z gate on the ancilla produces the desired phase, and another application of U f U_f U f resets the ancilla back to ∣ 0 ⟩ |0\rangle ∣0 ⟩ . Similarly, the reflection R c a v ν R_{\mathrm{cav}}^\nu R cav ν can be implemented using the unitary
U f ν : ∣ ν ⟩ ∣ q ⟩ ∣ 0 ⟩ ↦ ∣ ν ⟩ ∣ q ⟩ ∣ f ν ( q ) ⟩ , (211) U_{f_\nu}:|\nu\rangle|q\rangle|0\rangle\mapsto|\nu\rangle|q\rangle|f_\nu(q)\rangle, \tag*{(211)} U f ν : ∣ ν ⟩ ∣ q ⟩ ∣0 ⟩ ↦ ∣ ν ⟩ ∣ q ⟩ ∣ f ν ( q )⟩ , (211)
which flips the ancilla only if q + e ν / 2 q+e_\nu/2 q + e ν /2 is a face point inside the cavity. A naive approach to implement these unitaries is to apply a sequence of multi-controlled bit-flip operations (one for each cavity point), each conditioned on that ∣ q ⟩ |q\rangle ∣ q ⟩ encodes the index of the cavity point. However, this approach would be inefficient because its cost scales linearly with the number of cavity nodes, and so does with the total number of nodes, as cavity nodes is a fraction of the total nodes.
Inequality test for cavity nodes. To construct an implementation with a logarithmic cost in the number of nodes, we use the fact that the molecular cavity is determined by the set { x a , r a } \{x_a,r_a\} { x a , r a } of positions and radii of the atoms. Therefore, to determine whether a point q h qh q h is inside the cavity, we only need to test whether q h qh q h is inside at least one of the N a t m N_{\mathrm{atm}} N atm atom balls in Eq. (87) . That is to say, we use the fact that
f ( q ) = f 0 ( q ) ∨ f 1 ( q ) ∨ ⋯ f N a t m − 1 ( q ) (212) f(q)=f_0(q)\lor f_1(q)\lor\cdots f_{N_{\mathrm{atm}}-1}(q) \tag*{(212)} f ( q ) = f 0 ( q ) ∨ f 1 ( q ) ∨ ⋯ f N atm − 1 ( q ) (212)
where ∨ \lor ∨ is the logical OR and f a ( q ) f_a(q) f a ( q ) with a ∈ { 0 , … , N a t m − 1 } a\in\{0,\ldots,N_{\mathrm{atm}}-1\} a ∈ { 0 , … , N atm − 1 } indicates whether the node point q h qh q h is inside the ball of atom a a a . Similarly, we have
f ν ( q ) = f ν , 0 ( q ) ∨ f ν , 1 ( q ) ∨ ⋯ f ν , N a t m − 1 ( q ) , (213) f_\nu(q)=f_{\nu,0}(q)\lor f_{\nu,1}(q)\lor\cdots f_{\nu,N_{\mathrm{atm}}-1}(q), \tag*{(213)} f ν ( q ) = f ν , 0 ( q ) ∨ f ν , 1 ( q ) ∨ ⋯ f ν , N atm − 1 ( q ) , (213)
where f ν , a ( q ) f_{\nu,a}(q) f ν , a ( q ) indicates whether the face point ( q + e ν / 2 ) h (q+e_\nu/2)h ( q + e ν /2 ) h is inside the ball of atom a a a . Specifically,
f a ( q ) = { 1 ∥ x a − q h ∥ 2 ≤ r a 0 otherwise f ν , a ( q ) = { 1 ∥ x a − ( q + e ν / 2 ) h ∥ 2 ≤ r a 0 otherwise (214) f_a(q)=
\begin{cases}
1 & \lVert x_a-qh\rVert_2\le r_a\\
0 & \text{otherwise}
\end{cases}
\qquad
f_{\nu,a}(q)=
\begin{cases}
1 & \lVert x_a-(q+e_\nu/2)h\rVert_2\le r_a\\
0 & \text{otherwise}
\end{cases} \tag*{(214)} f a ( q ) = { 1 0 ∥ x a − q h ∥ 2 ≤ r a otherwise f ν , a ( q ) = { 1 0 ∥ x a − ( q + e ν /2 ) h ∥ 2 ≤ r a otherwise (214)
where x a = ( x a , y a , z a ) x_a=(x_a,y_a,z_a) x a = ( x a , y a , z a ) is position of atom a a a . We can therefore implement the unitaries U f U_f U f and U f ν U_{f_\nu} U f ν with N a t m N_{\mathrm{atm}} N atm inequality test (one per atom).
Instead of using one ancilla for each inequality test (N a t m N_{\mathrm{atm}} N atm ancillas for all tests), we use an ancilla register with
n c n t : = ⌈ log 2 ( N a t m + 1 ) ⌉ (215) n_{\mathrm{cnt}}:=\lceil\log_2(N_{\mathrm{atm}}+1)\rceil \tag*{(215)} n cnt := ⌈ log 2 ( N atm + 1 )⌉ (215)
qubits as a counter register, which we denote by c n t \mathrm{cnt} cnt . This register starts in the all-zero state, and we increment the counter by 1 when each inequality test yields 1. A non-zero counter then indicates the point is inside the cavity. This approach exponentially reduces the number of ancilla qubits with respect to the number of atoms. For efficient implementation, we also modify the inequality tests so that we only use integer numbers for comparison and avoid computing square roots on the quantum computer needed for computing the norm. To this end, first we multiply both sides of the inequalities in Eq. (214) by 2 b / h 2^b/h 2 b / h , for some positive integer b b b to be determined. We then use the rounding 2 b x / h ↦ x a : = ( x a , y a , z a ) 2^b x/h\mapsto x_a:=(x_a,y_a,z_a) 2 b x / h ↦ x a := ( x a , y a , z a ) and 2 b r a / h ↦ r a 2^b r_a/h\mapsto r_a 2 b r a / h ↦ r a with integers
x a : = ⌊ 2 b x a h ⌋ , y a : = ⌊ 2 b y a h ⌋ , z a : = ⌊ 2 b z a h ⌋ , r a : = ⌊ 2 b r a h ⌋ , (216) x_a:=\left\lfloor\frac{2^b x_a}{h}\right\rfloor,\quad
y_a:=\left\lfloor\frac{2^b y_a}{h}\right\rfloor,\quad
z_a:=\left\lfloor\frac{2^b z_a}{h}\right\rfloor,\quad
r_a:=\left\lfloor\frac{2^b r_a}{h}\right\rfloor, \tag*{(216)} x a := ⌊ h 2 b x a ⌋ , y a := ⌊ h 2 b y a ⌋ , z a := ⌊ h 2 b z a ⌋ , r a := ⌊ h 2 b r a ⌋ , (216)
and take the square of both sides. The inequalities are then mapped as
∥ x a − q h ∥ 2 ≤ r a ↦ ∥ x a − 2 b q ∥ 2 2 ≤ r a 2 , (217) \lVert x_a-qh\rVert_2\le r_a\mapsto\lVert x_a-2^bq\rVert_2^2\le r_a^2, \tag*{(217)} ∥ x a − q h ∥ 2 ≤ r a ↦ ∥ x a − 2 b q ∥ 2 2 ≤ r a 2 , (217)
∥ x a − ( q + e ν / 2 ) h ∥ 2 ≤ r a ↦ ∥ x a − 2 b ( q + e ν / 2 ) ∥ 2 2 ≤ r a 2 . (218) \lVert x_a-(q+e_\nu/2)h\rVert_2\le r_a\mapsto\lVert x_a-2^b(q+e_\nu/2)\rVert_2^2\le r_a^2. \tag*{(218)} ∥ x a − ( q + e ν /2 ) h ∥ 2 ≤ r a ↦ ∥ x a − 2 b ( q + e ν /2 ) ∥ 2 2 ≤ r a 2 . (218)
By expanding the norm, we separate the atom-dependent and atom-independent parts as
4 b ∥ q ∥ 2 − 2 b + 1 q ⋅ x a ≤ r a 2 − ∥ x a ∥ 2 − 4 b − 1 ⏟ = : C a (219) 4^b\lVert q\rVert^2-2^{b+1}q\cdot x_a\le\underbrace{r_a^2-\lVert x_a\rVert^2-4^{b-1}}_{=:C_a} \tag*{(219)} 4 b ∥ q ∥ 2 − 2 b + 1 q ⋅ x a ≤ =: C a r a 2 − ∥ x a ∥ 2 − 4 b − 1 (219)
4 b ( ∥ q ∥ 2 + q ⋅ e ν ) − 2 b + 1 q ⋅ x a − 2 b x a ⋅ e ν ≤ C a , (220) 4^b(\lVert q\rVert^2+q\cdot e_\nu)-2^{b+1}q\cdot x_a-2^b x_a\cdot e_\nu\le C_a, \tag*{(220)} 4 b (∥ q ∥ 2 + q ⋅ e ν ) − 2 b + 1 q ⋅ x a − 2 b x a ⋅ e ν ≤ C a , (220)
where the integer C a C_a C a depends only on the atomic data and can be classically precomputed. The left-hand sides here are integers to be computed on the quantum computer.
We note that b b b is a small constant determined by the grid spacing h h h and the precision of the input atomic data. Atomic coordinates in the standard Protein Data Bank format [35 ] are specified to three decimal places in ångström, so requiring the rounding error to be smaller than the input precision gives b = 4 b=4 b = 4 –9 9 9 for h ∈ ( 0.01 , 0.5 ) A ˚ h\in(0.01,0.5)\,\text{Å} h ∈ ( 0.01 , 0.5 ) A ˚ , where h = 0.5 A ˚ h=0.5\,\text{Å} h = 0.5 A ˚ is commonly used in the classical PBE solvers [31 ] .
We now implement the inequality tests in Eq. (220) for the face points by the following steps. The implementation of inequality tests in Eq. (219) for the node points follow similarly.
Compute the atom-independent term
4 b ( ∥ q ∥ 2 + q ⋅ e ν ) = 4 b ( i 2 + j 2 + k 2 ) + 4 b q ν (221) 4^{b}(\lVert q\rVert^{2}+q\cdot e_{\nu})=4^{b}(i^{2}+j^{2}+k^{2})+4^{b}q_{\nu} \tag*{(221)} 4 b (∥ q ∥ 2 + q ⋅ e ν ) = 4 b ( i 2 + j 2 + k 2 ) + 4 b q ν (221)
into a temporary register, where q ν = i , j , k q_{\nu}=i,j,k q ν = i , j , k for ν = x , y , z \nu=x,y,z ν = x , y , z , respectively. We denote this register by tmp and use it to store the value of the left-hand side in Eq. (220) . The magnitude of this value is no greater than 4 n + b + 1 4^{n+b+1} 4 n + b + 1 , so a temporary register with
n t m p : = 2 ( n + b ) + 3 = 2 n + Θ ( 1 ) (222) n_{\mathrm{tmp}}:=2(n+b)+3=2n+\Theta(1) \tag*{(222)} n tmp := 2 ( n + b ) + 3 = 2 n + Θ ( 1 ) (222)
qubits suffices to represent the stored value in two’s complement. The constant here is between 11–21 for b = 4 b=4 b = 4 –9. To compute this term, we first compute the direction-dependent part 4 b q ν 4^{b}q_{\nu} 4 b q ν into tmp controlled on the direction register ∣ ν ⟩ \lvert\nu\rangle ∣ ν ⟩ . As tmp is initially in the all-zero state and multiplying by 4 b 4^{b} 4 b is equivalent to shifting the n n n -bit number q ν q_{\nu} q ν to the left by 2 b 2b 2 b bits, we simply copy q ν q_{\nu} q ν into qubits 2 b , … , 2 b + n − 1 2b,\ldots,2b+n-1 2 b , … , 2 b + n − 1 of tmp conditioned on the value of ν \nu ν . We then compute the square terms, such as 4 b i 2 4^{b}i^{2} 4 b i 2 , by single- and double-controlled constant additions as follows. Let us use the binary expansion i = ∑ r = 0 n − 1 i r 2 r i=\sum_{r=0}^{n-1}i_{r}2^{r} i = ∑ r = 0 n − 1 i r 2 r , where i r i_{r} i r are bits of i i i , then
4 b i 2 = ∑ r i r 4 b + r + 2 ∑ r < s i r i s 2 2 b + r + s (223) 4^{b}i^{2}=\sum_{r}i_{r}4^{b+r}+2\sum_{r<s}i_{r}i_{s}2^{2b+r+s} \tag*{(223)} 4 b i 2 = r ∑ i r 4 b + r + 2 r < s ∑ i r i s 2 2 b + r + s (223)
and so 4 b i 2 4^{b}i^{2} 4 b i 2 can be added by n n n single-controlled additions of 4 b + r 4^{b+r} 4 b + r controlled on qubit r r r of ∣ i ⟩ \lvert i\rangle ∣ i ⟩ , and n ( n − 1 ) / 2 n(n-1)/2 n ( n − 1 ) /2 double-controlled additions of 2 2 b + r + s + 1 2^{2b+r+s+1} 2 2 b + r + s + 1 controlled on qubits r r r and s s s of ∣ i ⟩ \lvert i\rangle ∣ i ⟩ . These terms are ν \nu ν -independent, so no control on ∣ ν ⟩ \lvert\nu\rangle ∣ ν ⟩ is needed.
For each atom a = 0 , … , N a t m − 1 a=0,\ldots,N_{\mathrm{atm}}-1 a = 0 , … , N atm − 1 :
(a) Add the atom-dependent terms
− 2 b + 1 q ⋅ x a − 2 b x a ⋅ e ν = − 2 b + 1 ( i x a + j y a + k z a ) − 2 b x a , ν (224) -2^{b+1}q\cdot x_{a}-2^{b}x_{a}\cdot e_{\nu}=-2^{b+1}(ix_{a}+jy_{a}+kz_{a})-2^{b}x_{a,\nu} \tag*{(224)} − 2 b + 1 q ⋅ x a − 2 b x a ⋅ e ν = − 2 b + 1 ( i x a + j y a + k z a ) − 2 b x a , ν (224)
to the temporary register. Here x a , ν = x a , y a , z a x_{a,\nu}=x_{a},y_{a},z_{a} x a , ν = x a , y a , z a depending on ν \nu ν , so we add the constant − 2 b x a , ν -2^{b}x_{a,\nu} − 2 b x a , ν to tmp controlled on ∣ ν ⟩ \lvert\nu\rangle ∣ ν ⟩ . Other terms are ν \nu ν -independent and we add them by single-controlled constant additions. For instance, we add − 2 b + 1 i x a -2^{b+1}ix_{a} − 2 b + 1 i x a by n n n single-controlled additions of − 2 b + 1 + r x a -2^{b+1+r}x_{a} − 2 b + 1 + r x a , controlled on qubit r r r of ∣ i ⟩ \lvert i\rangle ∣ i ⟩ .
(b) Compare the value of temporary register with the classical value C a C_{a} C a and write the result into a flag qubit. This is achieved by a classical-quantum comparator operation that implements that map
∣ T ⟩ t m p ∣ 0 ⟩ f ↦ { ∣ T ⟩ t m p ∣ 1 ⟩ f if T < C a ∣ T ⟩ t m p ∣ 0 ⟩ f if T > C a (225) \lvert T\rangle_{\mathrm{tmp}}\lvert0\rangle_{f}\mapsto
\begin{cases}
\lvert T\rangle_{\mathrm{tmp}}\lvert1\rangle_{f} & \text{if }T<C_{a}\\
\lvert T\rangle_{\mathrm{tmp}}\lvert0\rangle_{f} & \text{if }T>C_{a}
\end{cases} \tag*{(225)} ∣ T ⟩ tmp ∣ 0 ⟩ f ↦ { ∣ T ⟩ tmp ∣ 1 ⟩ f ∣ T ⟩ tmp ∣ 0 ⟩ f if T < C a if T > C a (225)
where T T T is the value stored in the temporary register.
(c) Controlled on ∣ 1 ⟩ \lvert1\rangle ∣ 1 ⟩ of the flag qubit, increment the counter register by 1.
(d) Apply the inverse of step (b) to reset the flag qubit.
(e) Apply the inverse of step (a) to restore the temporary register to the atom-independent value in Eq. (221) .
Test whether the counter register cnt is nonzero and write the result into the flag qubit; note that this qubit is reset to ∣ 0 ⟩ \lvert0\rangle ∣ 0 ⟩ at the end of step 2 and can be reused. To this end, first we apply X X X on the flag qubit and then flip it conditioned on cnt being in the all-zero state. To implement the latter, we apply a multi-controlled X X X gate with ∣ 0 ⟩ \lvert0\rangle ∣ 0 ⟩ controls on all qubits of cnt. The flag qubit is then in ∣ 1 ⟩ \lvert1\rangle ∣ 1 ⟩ only if the counter is nonzero.
Apply Z Z Z on the flag qubit to produce the desired phase for the cavity points. Then reset the flag by applying the multi-controlled X X X gate followed by X X X gate. Step 4 is only applied to implement the reflection operator in Eq. (209) .
Apply the inverse of step 2 to reset the counter register to the all-zero state.
Apply the inverse of step 1 to reset the temporary register to the all-zero state.
Cost analysis. Let C s \mathcal{C}_{s} C s denote the cost of step s s s above. Then C = 2 C 1 + 2 N a t m C 2 + C 3 + C 4 \mathcal{C}=2\mathcal{C}_{1}+2N_{\mathrm{atm}}\mathcal{C}_{2}+\mathcal{C}_{3}+\mathcal{C}_{4} C = 2 C 1 + 2 N atm C 2 + C 3 + C 4 is the total cost of implementing all steps, and we have C 2 = 2 C 2 a + 2 C 2 b + C 2 c \mathcal{C}_{2}=2\mathcal{C}_{2a}+2\mathcal{C}_{2b}+\mathcal{C}_{2c} C 2 = 2 C 2 a + 2 C 2 b + C 2 c . Below we analyze the cost of the unique steps. We use the following lemma for the cost of the classical-quantum comparator in Eq. (225) .
Lemma 5 [18 Thm. 3] . The n n n -qubit classical-quantum comparator can be implemented with one dirty ancilla qubit by a circuit with Θ ( n ) \Theta(n) Θ ( n ) gates from { X , C N O T , T o f f o l i } \{X, \mathrm{CNOT}, \mathrm{Toffoli}\} { X , CNOT , Toffoli } and Θ ( log n ) \Theta(\log n) Θ ( log n ) depth.
Step 1: Copies the ν \nu ν -dependent part into tmp and adds the ν \nu ν -independent part. For each direction ν \nu ν , the copy needs n n n 3-controlled X X X gates, two controls on the direction register and one control on one of the qubits of the n n n -qubit basis state ∣ q ν ⟩ \lvert q_\nu\rangle ∣ q ν ⟩ , where ∣ q ν ⟩ = ∣ i ⟩ , ∣ j ⟩ , ∣ k ⟩ \lvert q_\nu\rangle= \lvert i\rangle, \lvert j\rangle, \lvert k\rangle ∣ q ν ⟩ = ∣ i ⟩ , ∣ j ⟩ , ∣ k ⟩ depending on ν \nu ν . Adding each term (i i i , j j j or k k k ) of the ν \nu ν -independent part needs n n n single-controlled and n ( n − 1 ) / 2 n(n-1)/2 n ( n − 1 ) /2 double-controlled additions of classical constants into tmp.
By Lemma 3, the single- and double-controlled classical-quantum addition on n t m p n_{\mathrm{tmp}} n tmp qubits can be implemented using one dirty ancilla qubit and a circuit with Θ ( n t m p log n t m p ) \Theta(n_{\mathrm{tmp}}\log n_{\mathrm{tmp}}) Θ ( n tmp log n tmp ) gates and Θ ( log 2 n t m p ) \Theta(\log^{2}n_{\mathrm{tmp}}) Θ ( log 2 n tmp ) depth. Therefore, Step 1 can be implemented using one dirty ancilla and a circuit with Θ ( n 2 n t m p log n t m p ) \Theta(n^{2}n_{\mathrm{tmp}}\log n_{\mathrm{tmp}}) Θ ( n 2 n tmp log n tmp ) gates and Θ ( n 2 log 2 n t m p ) \Theta(n^{2}\log^{2}n_{\mathrm{tmp}}) Θ ( n 2 log 2 n tmp ) depth.
Step 2a: Adds the ν \nu ν -dependent part − 2 b x a , ν -2^{b}x_{a,\nu} − 2 b x a , ν to tmp by 3 double-controlled constant additions (one for each direction ν \nu ν ) and adds the ν \nu ν -independent part by 3 n 3n 3 n single-controlled constant additions. So, by Lemma 3, this step can be implemented using one dirty ancilla and a circuit with Θ ( n n t m p log n t m p ) \Theta(nn_{\mathrm{tmp}}\log n_{\mathrm{tmp}}) Θ ( n n tmp log n tmp ) gates and Θ ( n log 2 n t m p ) \Theta(n\log^{2}n_{\mathrm{tmp}}) Θ ( n log 2 n tmp ) depth.
Step 3: Applies one X X X gate and one n c n t n_{\mathrm{cnt}} n cnt -controlled X X X gate controlled on the all-zero state of the counter register. By Lemma 4, this multi-controlled X X X gate can be implemented using one dirty ancilla and a circuit with Θ ( n c n t ) \Theta(n_{\mathrm{cnt}}) Θ ( n cnt ) gates and Θ ( log n c n t ) \Theta(\log n_{\mathrm{cnt}}) Θ ( log n cnt ) depth.
Step 4: Applies one Z Z Z , one X X X , and the n c n t n_{\mathrm{cnt}} n cnt -controlled X X X in Step 3, so its cost is similar to that of Step 3.
Putting all together, all inequality tests, and hence the reflection operators, can be implemented by a circuit with G \mathcal{G} G gates and depth D \mathcal{D} D scaling as
G = Θ ( n 2 n t m p log n t m p ) + N a t m ( Θ ( n n t m p log n t m p ) + Θ ( n c n t ) ) + Θ ( n c n t ) = Θ ( n 3 log n ) + N a t m ( Θ ( n 2 log n ) + Θ ( log N a t m ) ) (226) \begin{aligned}
\mathcal{G} &= \Theta(n^{2}n_{\mathrm{tmp}}\log n_{\mathrm{tmp}}) + N_{\mathrm{atm}}(\Theta(nn_{\mathrm{tmp}}\log n_{\mathrm{tmp}}) + \Theta(n_{\mathrm{cnt}})) + \Theta(n_{\mathrm{cnt}}) \\
&= \Theta(n^{3}\log n) + N_{\mathrm{atm}}(\Theta(n^{2}\log n) + \Theta(\log N_{\mathrm{atm}})) \tag*{(226)}
\end{aligned} G = Θ ( n 2 n tmp log n tmp ) + N atm ( Θ ( n n tmp log n tmp ) + Θ ( n cnt )) + Θ ( n cnt ) = Θ ( n 3 log n ) + N atm ( Θ ( n 2 log n ) + Θ ( log N atm )) (226)
D = Θ ( n 2 log 2 n t m p ) + N a t m ( Θ ( n log 2 n t m p ) + Θ ( log n c n t ) ) + Θ ( log n c n t ) = Θ ( n 2 log 2 n ) + N a t m ( Θ ( n log 2 n ) + Θ ( log log N a t m ) ) , (227) \begin{aligned}
\mathcal{D} &= \Theta(n^{2}\log^{2} n_{\mathrm{tmp}}) + N_{\mathrm{atm}}(\Theta(n\log^{2} n_{\mathrm{tmp}}) + \Theta(\log n_{\mathrm{cnt}})) + \Theta(\log n_{\mathrm{cnt}}) \\
&= \Theta(n^{2}\log^{2} n) + N_{\mathrm{atm}}(\Theta(n\log^{2} n) + \Theta(\log\log N_{\mathrm{atm}})), \tag*{(227)}
\end{aligned} D = Θ ( n 2 log 2 n tmp ) + N atm ( Θ ( n log 2 n tmp ) + Θ ( log n cnt )) + Θ ( log n cnt ) = Θ ( n 2 log 2 n ) + N atm ( Θ ( n log 2 n ) + Θ ( log log N atm )) , (227)
where we used n t m p ∈ Θ ( n ) n_{\mathrm{tmp}} \in\Theta(n) n tmp ∈ Θ ( n ) by Eq. (222) and n c n t ∈ Θ ( log N a t m ) n_{\mathrm{cnt}} \in\Theta(\log N_{\mathrm{atm}}) n cnt ∈ Θ ( log N atm ) by Eq. (215) .
Ancilla count. Two ancillas are used for the direction register. With the flag qubit and the qubits used for the temporary and counter register, the total number of clean ancilla qubits used is
n a n c = n t m p + n c n t + 3 = 2 ( n + b ) + ⌈ log 2 ( N a t m + 1 ) ⌉ + 6 = 2 n + ⌈ log 2 ( N a t m + 1 ) ⌉ + Θ ( 1 ) , (228) \begin{aligned}
n_{\mathrm{anc}} &= n_{\mathrm{tmp}} + n_{\mathrm{cnt}} + 3 \\
&= 2(n+b) + \lceil\log_{2}(N_{\mathrm{atm}}+1)\rceil+ 6 \\
&= 2n + \lceil\log_{2}(N_{\mathrm{atm}}+1)\rceil+ \Theta(1), \tag*{(228)}
\end{aligned} n anc = n tmp + n cnt + 3 = 2 ( n + b ) + ⌈ log 2 ( N atm + 1 )⌉ + 6 = 2 n + ⌈ log 2 ( N atm + 1 )⌉ + Θ ( 1 ) , (228)
where we used Eq. (215) and Eq. (222) . The constant Θ ( 1 ) \Theta(1) Θ ( 1 ) here is in the range 14–24 depending on the value of b = 4 b=4 b = 4 –9. We note that only a single dirty ancilla is used, as it can be shared between all steps.
Block encoding of the preconditioned matrix with logarithmic normalization
A block encoding of the preconditioned matrix A p r e c = P W A W † P A_{\mathrm{prec}}=PW A W^{\dagger}P A prec = P W A W † P can be constructed by the LCU technique using the block encoding U A U_A U A of the original matrix A A A and the decomposition P = ( U + + U − ) / 2 P=(U^{+}+U^{-})/2 P = ( U + + U − ) /2 for the preconditioner as linear combination of two unitaries U ± U^{\pm} U ± . Specifically, if we are given a ( α A , a A , 0 ) (\alpha_A,a_A,0) ( α A , a A , 0 ) block encoding of A A A , then an ( α p r e c , a p r e c , 0 ) (\alpha_{\mathrm{prec}},a_{\mathrm{prec}},0) ( α prec , a prec , 0 ) block encoding of A p r e c A_{\mathrm{prec}} A prec can be constructed with α p r e c = α A \alpha_{\mathrm{prec}}=\alpha_A α prec = α A and a p r e c = a A a_{\mathrm{prec}}=a_A a prec = a A by a single call to U A U_A U A [8 Appendix E.1] . This approach is useful only if the normalization α A \alpha_A α A is at most polylogarithmic in the dimension N g = N 3 = 2 3 n N_g=N^3=2^{3n} N g = N 3 = 2 3 n of A A A , as the query cost Q Q M I Q_{\mathrm{QMI}} Q QMI in Eq. (187) depends linearly on α p r e c \alpha_{\mathrm{prec}} α prec . As discussed in § 3.3.4 , α A ∈ Θ ( N ) \alpha_A\in\Theta(N) α A ∈ Θ ( N ) in our application, so this approach is not appropriate to obtain an algorithm with a polynomial-query cost. The block-encoding normalization in an important factor in quantum preconditioning, as a large normalization factor can offset the benefits of reducing the condition number by preconditioning [36 , 37 ] . We note that simply rescaling the original linear system by 1 / α A 1/\alpha_A 1/ α A does not remove the linear scaling of Q Q M I Q_{\mathrm{QMI}} Q QMI in α A \alpha_A α A by this approach as Q Q M I Q_{\mathrm{QMI}} Q QMI depends inversely on ∥ A p r e c ∥ \lVert A_{\mathrm{prec}}\rVert ∥ A prec ∥ and ∥ A p r e c ∥ ↦ ∥ A p r e c ∥ / α A \lVert A_{\mathrm{prec}}\rVert\mapsto\lVert A_{\mathrm{prec}}\rVert/\alpha_A ∥ A prec ∥ ↦ ∥ A prec ∥ / α A by rescaling.
Here we present a direct block encoding of A p r e c A_{\mathrm{prec}} A prec with the normalization α p r e c ∈ Θ ( n ) \alpha_{\mathrm{prec}} \in\Theta(n) α prec ∈ Θ ( n ) , i.e., logarithmic in the matrix dimension. We present our construction for block encoding of the preconditioned matrix in 1D, as extension to the 3D case is straightforward. Using A = D T E D + K A = D^{T} E D + K A = D T E D + K in 1D, we express the 1D preconditioned matrix as
A p r e c = Q T E Q + K p r e c , Q : = D W † P , (229) A_{\mathrm{prec}} = Q^{T} E Q + K_{\mathrm{prec}}, \qquad Q := D W^{\dagger} P, \tag*{(229)} A prec = Q T E Q + K prec , Q := D W † P , (229)
where K p r e c = P W K W T P K_{\mathrm{prec}} = P W K W^{T} P K prec = P W K W T P . A block encoding of A p r e c A_{\mathrm{prec}} A prec is then obtained by block encodings of Q Q Q , E E E and K p r e c K_{\mathrm{prec}} K prec using the standard product and summation rules for block encodings. The inequality-test approach in § 3.3.4 provides block encodings U E U_E U E and U K U_K U K for E E E and K K K with normalizations α E , α K ∈ Θ ( 1 ) \alpha_E, \alpha_K \in\Theta(1) α E , α K ∈ Θ ( 1 ) , respectively. With α K ∈ Θ ( 1 ) \alpha_K \in\Theta(1) α K ∈ Θ ( 1 ) , a block encoding of K p r e c K_{\mathrm{prec}} K prec with Θ ( 1 ) \Theta(1) Θ ( 1 ) normalization is obtained by the LCU technique using U K U_K U K and P = ( U + + U − ) / 2 P = (U^{+} + U^{-})/2 P = ( U + + U − ) /2 . In the following, we construct a block encoding for Q Q Q with normalization α Q ∈ Θ ( n ) \alpha_Q \in\Theta(\sqrt{n}) α Q ∈ Θ ( n ) , from which we obtain a block encoding for A p r e c A_{\mathrm{prec}} A prec with normalization α p r e c ∈ Θ ( n ) \alpha_{\mathrm{prec}} \in\Theta(n) α prec ∈ Θ ( n ) by the standard product and summation rules for block encodings.
To construct a block encoding for Q Q Q , we note that W W W is an n n n -level wavelet transform matrix and is specified by a sequence of numbers ( h 0 , … , h M − 1 ) (h_0,\ldots,h_{M-1}) ( h 0 , … , h M − 1 ) known as the wavelet filter coefficients; the sequence depends on the wavelet used and its length M M M is the wavelet order. See Refs. [8 , 32 , 38 , 39 , 40 , 41 ] for details of wavelets and their applications in quantum physics and computing. For n n n -level wavelet transform, W W W has the row block matrix form
W = [ 1 2 n W 0 ⋮ W n − 1 ] (230) W =
\begin{bmatrix}
\frac{1}{\sqrt{2^n}}\\
W_0\\
\vdots\\
W_{n-1}
\end{bmatrix} \tag*{(230)} W = 2 n 1 W 0 ⋮ W n − 1 (230)
where the top block is the constant vector 1 : = ( 1 , 1 , … , 1 ) / 2 n \mathbf{1} := (1,1,\ldots,1)/\sqrt{2^n} 1 := ( 1 , 1 , … , 1 ) / 2 n of size 2 n 2^n 2 n and the block W s W_s W s with 0 ≤ s < n 0 \le s < n 0 ≤ s < n is a 2 s × 2 n 2^s \times2^n 2 s × 2 n matrix obtained as W s = G s H s + 1 ⋯ H n − 1 W_s = G_s H_{s+1}\cdots H_{n-1} W s = G s H s + 1 ⋯ H n − 1 . Here H r H_r H r is known as the refinement matrix of size 2 r × 2 r + 1 2^r \times2^{r+1} 2 r × 2 r + 1 with entries [ H r ] i j = h ( j − 2 i ) m o d 2 r + 1 [H_r]_{ij} = h_{(j-2i)\bmod2^{r+1}} [ H r ] ij = h ( j − 2 i ) mod 2 r + 1 , and G r G_r G r has the same size with entries [ G r ] i j = g ( j − 2 i ) m o d 2 r + 1 [G_r]_{ij} = g_{(j-2i)\bmod2^{r+1}} [ G r ] ij = g ( j − 2 i ) mod 2 r + 1 , where g ℓ : = ( − 1 ) ℓ h M − 1 − ℓ g_\ell:= (-1)^\ell h_{M-1-\ell} g ℓ := ( − 1 ) ℓ h M − 1 − ℓ . Note that each row of these matrices is obtained from the previous row by a cyclic shift of two positions to the right. It then follows that each row of W s W_s W s is obtained from the previous row by a cyclic shift of 2 n − s 2^{n-s} 2 n − s positions to the right.
As W W W is a row block matrix, W † W^\dagger W † is a column block matrix as W † = [ 1 T ∣ W 0 T ∣ ⋯ ∣ W n − 1 T ] W^\dagger= [\mathbf{1}^{T}|W_0^{T}|\cdots|W_{n-1}^{T}] W † = [ 1 T ∣ W 0 T ∣ ⋯ ∣ W n − 1 T ] . By the structure of W † W^\dagger W † and P P P , it then follows that Q = [ 0 ∣ C 0 ∣ ⋯ ∣ C n − 1 ] Q = [0|C_0|\cdots|C_{n-1}] Q = [ 0∣ C 0 ∣ ⋯ ∣ C n − 1 ] is a column block matrix with blocks C s = 2 − s D W s † = 1 L A s C_s = 2^{-s} D W_s^\dagger= \frac{1}{L} A_s C s = 2 − s D W s † = L 1 A s , where the 2 n × 2 s 2^n \times2^s 2 n × 2 s matrix
A s : = 2 n − s ( S n − 1 n ) W s † = 2 n − s ( S n − 1 n ) H n − 1 † ⋯ H s + 1 † G s † (231) A_s := 2^{n-s}(S_n-\mathbb{1}_n)W_s^\dagger= 2^{n-s}(S_n-\mathbb{1}_n)H_{n-1}^{\dagger}\cdots H_{s+1}^{\dagger}G_s^{\dagger} \tag*{(231)} A s := 2 n − s ( S n − 1 n ) W s † = 2 n − s ( S n − 1 n ) H n − 1 † ⋯ H s + 1 † G s † (231)
is obtained by expanding D D D and W s † W_s^\dagger W s † . Note that the leftmost column block of Q Q Q is the zero column vector. Now let Q s Q_s Q s be the matrix obtained from Q Q Q with all blocks replaced with zero except the column block C s C_s C s . Then Q = ∑ s = 0 n − 1 Q s Q = \sum_{s=0}^{n-1} Q_s Q = ∑ s = 0 n − 1 Q s , and so a block encoding of Q Q Q can be constructed by a block encoding of Q s Q_s Q s with a fixed scale s s s . We first construct a block encoding of Q s Q_s Q s with a constant normalization by a direct implementation. Then we extend the fixed-scale construction to obtain a block encoding for the full matrix Q Q Q with normalization α Q ∈ Θ ( n ) \alpha_Q \in\Theta(\sqrt{n}) α Q ∈ Θ ( n ) .
To construct a block encoding of Q s Q_s Q s , let us write the first column of A s A_s A s as
A s ∣ 0 s ⟩ = ∑ m = 0 2 n − 1 a s , m ∣ m ⟩ , (232) A_s|0^s\rangle= \sum_{m=0}^{2^n-1} a_{s,m}|m\rangle, \tag*{(232)} A s ∣ 0 s ⟩ = m = 0 ∑ 2 n − 1 a s , m ∣ m ⟩ , (232)
where m m m is the row index of A s A_s A s and the coefficient a s , m a_{s,m} a s , m is the entry at row m m m of the first column. We use the following lemmas in our implementation; see Appendix § 6 .§ 5 for proofs for these lemmas.
Lemma 6. Let n s : = n − s − 1 n_s := n-s-1 n s := n − s − 1 for 0 ≤ s < n 0 \le s < n 0 ≤ s < n . The coefficient a s , m a_{s,m} a s , m is nonzero only for m = 2 n s c + b m = 2^{n_s}c+b m = 2 n s c + b , where 0 ≤ b < 2 n s 0 \le b < 2^{n_s} 0 ≤ b < 2 n s and 0 ≤ c < c max 0 \le c < c_{\max} 0 ≤ c < c m a x with c max c_{\max} c m a x a constant that depends only on the wavelet used.
Lemma 7. The magnitude of the coefficient a s , m a_{s,m} a s , m is bounded as 2 n − s ∣ a s , m ∣ ≤ c w \sqrt{2^{n-s}}|a_{s,m}| \le c_w 2 n − s ∣ a s , m ∣ ≤ c w , where c w c_w c w is a constant that depends only on the wavelet used.
We also note that each column 0 ≤ k < 2 s 0 \le k < 2^s 0 ≤ k < 2 s of A s A_s A s is obtained from the previous column by a cyclic shift of 2 n − s 2^{n-s} 2 n − s positions downward. This is because A ‾ s \overline{A}_s A s is obtained from W s † W_s^\dagger W s † . The action of A s A_s A s on the s s s -qubit state ∣ k ⟩ \lvert k\rangle ∣ k ⟩ is then
A s ∣ k ⟩ = ∑ m = 0 2 n − 1 a s , m ∣ ( m + 2 n − s k ) m o d 2 n ⟩ , (233) A_s\lvert k\rangle= \sum_{m=0}^{2^n-1} a_{s,m}\lvert(m+2^{n-s}k)\bmod2^n\rangle, \tag*{(233)} A s ∣ k ⟩ = m = 0 ∑ 2 n − 1 a s , m ∣( m + 2 n − s k ) mod 2 n ⟩ , (233)
where the output basis state is an n n n -qubit state. By this action, we obtain the action of Q s Q_s Q s on the n n n -qubit basis state ∣ j ⟩ \lvert j\rangle ∣ j ⟩ as
Q s ∣ j ⟩ = { 1 L A s ∣ k ⟩ if j = 2 s + k , 0 else . (234) Q_s\lvert j\rangle=
\begin{cases}
\frac{1}{L}A_s\lvert k\rangle& \text{if } j=2^s+k,\\
0 & \text{else}.
\end{cases} \tag*{(234)} Q s ∣ j ⟩ = { L 1 A s ∣ k ⟩ 0 if j = 2 s + k , else . (234)
To implement this action, we note that a s , m a_{s,m} a s , m is nonzero only for m = 2 n s c + b m=2^{n_s}c+b m = 2 n s c + b by Lemma 6, and express the action of A s A_s A s as
A s ∣ k ⟩ = ∑ c = 0 c max − 1 ∑ b = 0 2 n s − 1 a s , m ∣ ( 2 k + c ) m o d 2 s + 1 ⟩ ∣ b ⟩ . (235) A_s\lvert k\rangle= \sum_{c=0}^{c_{\max}-1}\sum_{b=0}^{2^{n_s}-1}a_{s,m}\lvert(2k+c)\bmod2^{s+1}\rangle\lvert b\rangle. \tag*{(235)} A s ∣ k ⟩ = c = 0 ∑ c m a x − 1 b = 0 ∑ 2 n s − 1 a s , m ∣( 2 k + c ) mod 2 s + 1 ⟩ ∣ b ⟩ . (235)
This equation follows because with m = 2 n s c + b m=2^{n_s}c+b m = 2 n s c + b the output basis state can be decomposed as ∣ ( 2 n − s k + m ) m o d 2 n ⟩ = ∣ ( 2 k + c ) m o d 2 s + 1 ⟩ ∣ b ⟩ \lvert(2^{n-s}k+m)\bmod2^n\rangle=\lvert(2k+c)\bmod2^{s+1}\rangle\lvert b\rangle ∣( 2 n − s k + m ) mod 2 n ⟩ = ∣( 2 k + c ) mod 2 s + 1 ⟩ ∣ b ⟩ by observing that
( 2 n − s k + m ) m o d 2 n = 2 n − s − 1 [ ( 2 k + c ) m o d 2 s + 1 ] + b = [ ( 2 k + c ) m o d 2 s + 1 b ] 2 , (236) \begin{aligned}
(2^{n-s}k+m)\bmod2^n=2^{n-s-1}[(2k+c)\bmod2^{s+1}]+b \\
&=[(2k+c)\bmod2^{s+1}b]_2, \tag*{(236)}
\end{aligned} ( 2 n − s k + m ) mod 2 n = 2 n − s − 1 [( 2 k + c ) mod 2 s + 1 ] + b = [( 2 k + c ) mod 2 s + 1 b ] 2 , (236)
where the second line is in binary; b b b is the lower n s = n − s − 1 n_s=n-s-1 n s = n − s − 1 bits and 2 k + c 2k+c 2 k + c is the upper s + 1 s+1 s + 1 bits. We now utilize the action of A s A_s A s in Eq. (235) to build a direct block encoding of A s A_s A s , from which we obtain a block encoding of Q s Q_s Q s . We summarize our approach in the following steps and analyze the cost of each step.
(Test the scale of j j j . ) First we test if the input basis state ∣ j ⟩ \lvert j\rangle ∣ j ⟩ is at scale s s s ; i.e., we test if j = 2 s + k j=2^s+k j = 2 s + k for some k k k . If j j j is at scale s s s , then ∣ j ⟩ = ∣ 0 n s ⟩ ∣ 1 ⟩ ∣ k ⟩ \lvert j\rangle=\lvert0^{n_s}\rangle\lvert1\rangle\lvert k\rangle ∣ j ⟩ = ∣ 0 n s ⟩ ∣ 1 ⟩ ∣ k ⟩ , where ∣ k ⟩ \lvert k\rangle ∣ k ⟩ has s s s qubits and n s = n − s − 1 n_s=n-s-1 n s = n − s − 1 . To test, we initialize a flag qubit t t t at ∣ 0 ⟩ t \lvert0\rangle_t ∣ 0 ⟩ t and flip it if the leftmost n s + 1 n_s+1 n s + 1 qubits of ∣ j ⟩ \lvert j\rangle ∣ j ⟩ are in the state ∣ 0 n s 1 ⟩ \lvert0^{n_s}1\rangle ∣ 0 n s 1 ⟩ . We then flip the flag so that its state is ∣ 0 ⟩ t \lvert0\rangle_t ∣ 0 ⟩ t when ∣ j ⟩ \lvert j\rangle ∣ j ⟩ is at scale s s s . Therefore, for any basis state ∣ j ⟩ \lvert j\rangle ∣ j ⟩ , the transformation in this step is
∣ 0 ⟩ t ∣ j ⟩ ↦ { ∣ 0 ⟩ t ∣ 0 n s ⟩ ∣ 1 k ⟩ j = 2 s + k , ∣ 1 ⟩ t ∣ j ⟩ otherwise . \lvert0\rangle_t\lvert j\rangle\mapsto
\begin{cases}
\lvert0\rangle_t\lvert0^{n_s}\rangle\lvert1k\rangle& j=2^s+k,\\
\lvert1\rangle_t\lvert j\rangle& \text{otherwise}.
\end{cases} ∣ 0 ⟩ t ∣ j ⟩ ↦ { ∣ 0 ⟩ t ∣ 0 n s ⟩ ∣ 1 k ⟩ ∣ 1 ⟩ t ∣ j ⟩ j = 2 s + k , otherwise .
The following steps are conditioned on the flag being in the zero state. The gate cost of this step is equivalent to the cost of ( n s + 1 ) (n_s+1) ( n s + 1 ) -controlled-NOT gate, which is Θ ( n s ) \Theta(n_s) Θ ( n s ) as per Lemma 4 . With n s < n n_s<n n s < n , the cost of this step is O ( n ) O(n) O ( n ) .
(Swap blocks of system register. ) We now perform the map ∣ 0 n s ⟩ ∣ 1 k ⟩ ↦ ∣ 1 k ⟩ ∣ 0 n s ⟩ \lvert0^{n_s}\rangle\lvert1k\rangle\mapsto\lvert1k\rangle\lvert0^{n_s}\rangle ∣ 0 n s ⟩ ∣ 1 k ⟩ ↦ ∣ 1 k ⟩ ∣ 0 n s ⟩ . That is, we swap the right block of s + 1 s+1 s + 1 qubits with the left block of n s n_s n s qubits. To implement this, we reverse the order of qubits in each block and then reverse the order of all qubits. Reversing a block ∣ q 1 q 2 , … q k ⟩ \lvert q_1q_2,\ldots q_k\rangle ∣ q 1 q 2 , … q k ⟩ with k k k qubits to ∣ q k … q 2 q 1 ⟩ \lvert q_k\ldots q_2q_1\rangle ∣ q k … q 2 q 1 ⟩ can be implemented by ⌊ k / 2 ⌋ \lfloor k/2\rfloor ⌊ k /2 ⌋ SWAP gates. Reversing the block ∣ 1 k ⟩ \lvert1k\rangle ∣ 1 k ⟩ needs ⌊ ( s + 1 ) / 2 ⌋ \lfloor(s+1)/2\rfloor ⌊( s + 1 ) /2 ⌋ SWAP gates, reversing the block ∣ 0 n s ⟩ \lvert0^{n_s}\rangle ∣ 0 n s ⟩ needs ⌊ n s / 2 ⌋ \lfloor n_s/2\rfloor ⌊ n s /2 ⌋ SWAP gates, and reversing all qubits needs ⌊ n / 2 ⌋ \lfloor n/2\rfloor ⌊ n /2 ⌋ SWAP gates. With s < n s<n s < n , the overall gate cost is then O ( n ) O(n) O ( n ) .
(Prepare uniform states over c c c and b b b . ) We now use an ancilla register c r e g \mathrm{creg} creg with n c = log 2 c max n_c=\log_2 c_{\max} n c = log 2 c m a x qubits initialized at the all-zero state and map it to uniform state over c c c by n c n_c n c Hadamards; for convenience here we assume c max c_{\max} c m a x is a power of two. We also map ∣ 0 n s ⟩ \lvert0^{n_s}\rangle ∣ 0 n s ⟩ to uniform state over b b b . The transformation in this step is then
∣ 0 n c ⟩ c r e g ∣ 0 n s ⟩ ↦ 1 2 n s c max ∑ c , b ∣ c ⟩ c r e g ∣ b ⟩ . \lvert0^{n_c}\rangle_{\mathrm{creg}}\lvert0^{n_s}\rangle\mapsto\frac{1}{\sqrt{2^{n_s}c_{\max}}}\sum_{c,b}\lvert c\rangle_{\mathrm{creg}}\lvert b\rangle. ∣ 0 n c ⟩ creg ∣ 0 n s ⟩ ↦ 2 n s c m a x 1 c , b ∑ ∣ c ⟩ creg ∣ b ⟩ .
Note that 2 n s 2^{n_s} 2 n s can be exponentially large in n n n depending on s s s . This step can be implemented with O ( n ) O(n) O ( n ) Hadamards.
(Compute the scaled coefficients. ) We now compute the scaled coefficient a s , m ′ = 2 n − s a s , m a'_{s,m}=\sqrt{2^{n-s}}a_{s,m} a s , m ′ = 2 n − s a s , m into a temporary register by implementing the operation
C O E F : ∣ c ⟩ ∣ b ⟩ ∣ 0 n t m p ⟩ ↦ ∣ c ⟩ ∣ b ⟩ ∣ a s , m ′ ⟩ , (237) \mathrm{COEF}:\lvert c\rangle\lvert b\rangle\lvert0^{n_{\mathrm{tmp}}}\rangle\mapsto\lvert c\rangle\lvert b\rangle\lvert a'_{s,m}\rangle, \tag*{(237)} COEF : ∣ c ⟩ ∣ b ⟩ ∣ 0 n tmp ⟩ ↦ ∣ c ⟩ ∣ b ⟩ ∣ a s , m ′ ⟩ , (237)
where the temporary register tmp has n t m p = p + Θ ( 1 ) n_{\mathrm{tmp}} = p + \Theta(1) n tmp = p + Θ ( 1 ) qubits. This register stores the scaled coefficient as a fixed-point binary number in two’s complement representation, where p p p is the number of bits for the fractional part, and Θ ( 1 ) \Theta(1) Θ ( 1 ) is a constant number of bits for the integer part. Note that by Lemma 7, the magnitude of the scaled coefficient is bounded by a constant, so only a constant number of bits is sufficient for the integer part. In Appendix § 6 .6, we show p ∈ Θ ( log ( n / ε ) ) p \in\Theta(\log(n/\varepsilon)) p ∈ Θ ( log ( n / ε )) is sufficient. The coherent transformation so far if the flag qubit t t t is at zero state is then
1 2 n s c max ∑ c , b ∣ c ⟩ ∣ 1 k ⟩ ∣ b ⟩ ∣ 0 n t m p ⟩ ↦ 1 2 n s c max ∑ c , b ∣ c ⟩ ∣ 1 k ⟩ ∣ b ⟩ ∣ a s , m ′ ⟩ \frac{1}{\sqrt{2^{n_s}c_{\max}}}\sum_{c,b}\lvert c\rangle\lvert1^k\rangle\lvert b\rangle\lvert0^{n_{\mathrm{tmp}}}\rangle\mapsto\frac{1}{\sqrt{2^{n_s}c_{\max}}}\sum_{c,b}\lvert c\rangle\lvert1^k\rangle\lvert b\rangle\lvert a'_{s,m}\rangle 2 n s c m a x 1 c , b ∑ ∣ c ⟩ ∣ 1 k ⟩ ∣ b ⟩ ∣ 0 n tmp ⟩ ↦ 2 n s c m a x 1 c , b ∑ ∣ c ⟩ ∣ 1 k ⟩ ∣ b ⟩ ∣ a s , m ′ ⟩
As we show later the gate cost of implementing COEF \operatorname{COEF} COEF is O ( n log 2 ( n / ε ) ) O(n\log^2(n/\varepsilon)) O ( n log 2 ( n / ε )) .
(Perform amplitude transduction. ) In this step, we perform the map ∣ a s , m ′ ⟩ ↦ α s , m ∣ a s , m ′ ⟩ \lvert a'_{s,m}\rangle\mapsto\alpha_{s,m}\lvert a'_{s,m}\rangle ∣ a s , m ′ ⟩ ↦ α s , m ∣ a s , m ′ ⟩ , where α s , m = a s , m ′ / c w \alpha_{s,m}=a'_{s,m}/c_w α s , m = a s , m ′ / c w and ∣ α s , m ∣ ≤ 1 \lvert\alpha_{s,m}\rvert\le1 ∣ α s , m ∣ ≤ 1 by Lemma 7. To implement this map, we use inequality testing. To this end, we compute the p p p -bit unsigned integer α s , m ( p ) = ⌊ 2 p ∣ α s , m ∣ ⌉ \alpha^{(p)}_{s,m}=\left\lfloor2^p\lvert\alpha_{s,m}\rvert\right\rceil α s , m ( p ) = ⌊ 2 p ∣ α s , m ∣ ⌉ into a p p p -qubit data register data, prepare a p p p -qubit reference register ref in the uniform state, and perform the transformation
1 2 p ∑ r = 0 2 p − 1 ∣ 0 ⟩ f ∣ r ⟩ r e f ∣ α s , m ( p ) ⟩ d a t a → C O M 1 2 p ( ∑ r < α s , m ( p ) ∣ 0 ⟩ f ∣ r ⟩ r e f + ∑ r ≥ α s , m ( p ) ∣ 1 ⟩ f ∣ r ⟩ r e f ) ∣ α s , m ( p ) ⟩ d a t a (238) \frac{1}{\sqrt{2^p}}\sum_{r=0}^{2^p-1}\lvert0\rangle_f\lvert r\rangle_{\mathrm{ref}}\lvert\alpha^{(p)}_{s,m}\rangle_{\mathrm{data}}
\xrightarrow{\mathrm{COM}}
\frac{1}{\sqrt{2^p}}\left(\sum_{r<\alpha^{(p)}_{s,m}}\lvert0\rangle_f\lvert r\rangle_{\mathrm{ref}}+\sum_{r\ge\alpha^{(p)}_{s,m}}\lvert1\rangle_f\lvert r\rangle_{\mathrm{ref}}\right)\lvert\alpha^{(p)}_{s,m}\rangle_{\mathrm{data}} \tag*{(238)} 2 p 1 r = 0 ∑ 2 p − 1 ∣ 0 ⟩ f ∣ r ⟩ ref ∣ α s , m ( p ) ⟩ data COM 2 p 1 r < α s , m ( p ) ∑ ∣ 0 ⟩ f ∣ r ⟩ ref + r ≥ α s , m ( p ) ∑ ∣ 1 ⟩ f ∣ r ⟩ ref ∣ α s , m ( p ) ⟩ data (238)
where COM \operatorname{COM} COM is the quantum-quantum comparison operation and flips the flag if r ≥ α s , m ( p ) r\ge\alpha^{(p)}_{s,m} r ≥ α s , m ( p ) . We now unprepare ref register by applying H ⊗ p H^{\otimes p} H ⊗ p . The amplitude of the state where the flag f f f and ref is zero becomes α s , m ( p ) / 2 p ≈ ∣ α s , m ∣ \alpha^{(p)}_{s,m}/2^p\approx\lvert\alpha_{s,m}\rvert α s , m ( p ) / 2 p ≈ ∣ α s , m ∣ . To observe this, note that ⟨ 0 p ∣ H ⊗ p ∣ r ⟩ = 1 / 2 p \langle0^p\vert H^{\otimes p}\lvert r\rangle=1/\sqrt{2^p} ⟨ 0 p ∣ H ⊗ p ∣ r ⟩ = 1/ 2 p for each r r r , so with ∑ r < α s , m ( p ) = α s , m ( p ) \sum_{r<\alpha^{(p)}_{s,m}}=\alpha^{(p)}_{s,m} ∑ r < α s , m ( p ) = α s , m ( p ) we obtain
( f ⟨ 0 ∣ ⟨ 0 p ∣ ⊗ 1 p ) H ⊗ p COM H ⊗ p ∣ 0 ⟩ f ∣ 0 p ⟩ r e f ∣ α s , m ( p ) ⟩ d a t a = α s , m ( p ) 2 p ∣ α s , m ( p ) ⟩ d a t a ≈ ∣ α s , m ∣ ∣ α s , m ( p ) ⟩ d a t a , (239) \begin{aligned}
\left({}_f\langle0\lvert\langle0^p\vert\otimes1_p\right)H^{\otimes p}\operatorname{COM}H^{\otimes p}\lvert0\rangle_f\lvert0^p\rangle_{\mathrm{ref}}\lvert\alpha^{(p)}_{s,m}\rangle_{\mathrm{data}}=\frac{\alpha^{(p)}_{s,m}}{2^p}\lvert\alpha^{(p)}_{s,m}\rangle_{\mathrm{data}} \\
&\approx\lvert\alpha_{s,m}\rvert\lvert\alpha^{(p)}_{s,m}\rangle_{\mathrm{data}}, \tag*{(239)}
\end{aligned} ( f ⟨ 0 ∣⟨ 0 p ∣ ⊗ 1 p ) H ⊗ p COM H ⊗ p ∣ 0 ⟩ f ∣ 0 p ⟩ ref ∣ α s , m ( p ) ⟩ data = 2 p α s , m ( p ) ∣ α s , m ( p ) ⟩ data ≈ ∣ α s , m ∣ ∣ α s , m ( p ) ⟩ data , (239)
where H ⊗ p H^{\otimes p} H ⊗ p acts on the middle state. Note that α s , m \alpha_{s,m} α s , m and a s , m ′ a'_{s,m} a s , m ′ have same signs, and because ∣ a s , m ′ ⟩ \lvert a'_{s,m}\rangle ∣ a s , m ′ ⟩ encodes a s , m ′ a'_{s,m} a s , m ′ in two’s complement, its leftmost qubit is the sign bit of α s , m \alpha_{s,m} α s , m . To produce the sign of α s , m \alpha_{s,m} α s , m in the amplitude, we flip the flag f f f , apply a controlled Z Z Z with control on the leftmost qubit of ∣ a s , m ′ ⟩ \lvert a'_{s,m}\rangle ∣ a s , m ′ ⟩ and the flag qubit as the target, and then flip the flag again. With these operations ∣ α s , m ∣ ↦ α s , m \lvert\alpha_{s,m}\rvert\mapsto\alpha_{s,m} ∣ α s , m ∣ ↦ α s , m . Finally, we erase α s , m ( p ) \alpha^{(p)}_{s,m} α s , m ( p ) in the data register. The output state at this step is
1 2 n s c max ∑ c , b α s , m ∣ c ⟩ ∣ 1 k ⟩ ∣ b ⟩ ∣ a s , m ′ ⟩ = 2 c w c max ∑ c , b a s , m ∣ c ⟩ ∣ 1 k ⟩ ∣ b ⟩ ∣ a s , m ′ ⟩ \frac{1}{\sqrt{2^{n_s}c_{\max}}}\sum_{c,b}\alpha_{s,m}\lvert c\rangle\lvert1^k\rangle\lvert b\rangle\lvert a'_{s,m}\rangle=\frac{\sqrt{2}}{c_w\sqrt{c_{\max}}}\sum_{c,b}a_{s,m}\lvert c\rangle\lvert1^k\rangle\lvert b\rangle\lvert a'_{s,m}\rangle 2 n s c m a x 1 c , b ∑ α s , m ∣ c ⟩ ∣ 1 k ⟩ ∣ b ⟩ ∣ a s , m ′ ⟩ = c w c m a x 2 c , b ∑ a s , m ∣ c ⟩ ∣ 1 k ⟩ ∣ b ⟩ ∣ a s , m ′ ⟩
if the flags t t t and f f f , and the ref register are at the zero state.
We now discuss the gate cost of this step. For convenience, we consider c w c_w c w to be a power of two as c w = 2 q c_w=2^q c w = 2 q with q < p q<p q < p . To compute the unsigned integer α s , m ( p ) \alpha^{(p)}_{s,m} α s , m ( p ) into the data register, temporarily map ∣ a s , m ′ ⟩ ↦ ∣ ∣ a s , m ′ ∣ ⟩ \lvert a'_{s,m}\rangle\mapsto\lvert\lvert a'_{s,m}\rvert\rangle ∣ a s , m ′ ⟩ ↦ ∣∣ a s , m ′ ∣⟩ as discussed in Step 2 in § 2.4.1 . Then copy the integer bits of ∣ a s , m ′ ⟩ \lvert a'_{s,m}\rangle ∣ a s , m ′ ⟩ and its first p − q p-q p − q fractional bits to the data register, and increment the value of data register by + 1 +1 + 1 if the ( p − q + 1 ) (p-q+1) ( p − q + 1 ) th fractional bit is 1. Finally, perform ∣ ∣ a s , m ′ ∣ ⟩ ↦ ∣ a s , m ′ ⟩ \lvert\lvert a'_{s,m}\rvert\rangle\mapsto\lvert a'_{s,m}\rangle ∣∣ a s , m ′ ∣⟩ ↦ ∣ a s , m ′ ⟩ . The gate cost of these operations is O ( p ) O(p) O ( p ) as the integer part only has Θ ( 1 ) \Theta(1) Θ ( 1 ) bits. Preparing and unpreparing ref register needs 2 p 2p 2 p Hadamards and COM \operatorname{COM} COM can be implemented by Θ ( p ) \Theta(p) Θ ( p ) gates. With p ∈ Θ ( log ( n / ε ) ) p\in\Theta(\log(n/\varepsilon)) p ∈ Θ ( log ( n / ε )) , the overall cost of this step is O ( log ( n / ε ) ) O(\log(n/\varepsilon)) O ( log ( n / ε )) .
(Uncompute the scaled coefficient. ) We now erase the tmp register by the inverse of the COEF \operatorname{COEF} COEF operation.
(Prepare the output basis state and unprepare the creg register. ) To prepare ∣ ( 2 k + c ) m o d 2 s + 1 ⟩ ∣ b ⟩ \lvert(2k+c)\bmod2^{s+1}\rangle\lvert b\rangle ∣( 2 k + c ) mod 2 s + 1 ⟩ ∣ b ⟩ , we perform the map
∣ c ⟩ c r e g ∣ 1 k ⟩ ∣ b ⟩ ↦ ∣ c ⟩ c r e g ∣ ( 2 k + c ) m o d 2 s + 1 ⟩ ∣ b ⟩ (240) \lvert c\rangle_{\mathrm{creg}}\lvert1^k\rangle\lvert b\rangle\mapsto\lvert c\rangle_{\mathrm{creg}}\lvert(2k+c)\bmod2^{s+1}\rangle\lvert b\rangle \tag*{(240)} ∣ c ⟩ creg ∣ 1 k ⟩ ∣ b ⟩ ↦ ∣ c ⟩ creg ∣( 2 k + c ) mod 2 s + 1 ⟩ ∣ b ⟩ (240)
by first implementing ∣ 1 k ⟩ ↦ ∣ k 0 ⟩ = ∣ 2 k ⟩ \lvert1^k\rangle\mapsto\lvert k0\rangle=\lvert2k\rangle ∣ 1 k ⟩ ↦ ∣ k 0 ⟩ = ∣ 2 k ⟩ and then adding the values of the first and second registers. Here ∣ 1 k ⟩ \lvert1^k\rangle ∣ 1 k ⟩ is a ( s + 1 ) (s+1) ( s + 1 ) -qubit state and ∣ 1 k ⟩ ↦ ∣ k 0 ⟩ \lvert1^k\rangle\mapsto\lvert k0\rangle ∣ 1 k ⟩ ↦ ∣ k 0 ⟩ follows by flipping the leftmost qubit and a cyclic shift of all qubits to the left. To unprepare ∣ c ⟩ |c\rangle ∣ c ⟩ , we apply H ⊗ n c H^{\otimes n_c} H ⊗ n c on creg. The overall output state conditioned on the flags t t t and f f f and the ref and creg registers being in the zero state is
2 c w c max ∑ c , b a s , m ∣ ( 2 k + c ) m o d 2 s + 1 ⟩ ∣ b ⟩ = 2 c max c w A s ∣ k ⟩ = L 2 c max c w Q s ∣ j ⟩ (241) \frac{\sqrt{2}}{c_w c_{\max}}\sum_{c,b}a_{s,m}|(2k+c)\bmod2^{s+1}\rangle|b\rangle=\frac{\sqrt{2}}{c_{\max}c_w}A_s|k\rangle=\frac{L\sqrt{2}}{c_{\max}c_w}Q_s|j\rangle \tag*{(241)} c w c m a x 2 c , b ∑ a s , m ∣ ( 2 k + c ) mod 2 s + 1 ⟩ ∣ b ⟩ = c m a x c w 2 A s ∣ k ⟩ = c m a x c w L 2 Q s ∣ j ⟩ (241)
so we achieve a block encoding for Q s Q_s Q s with the normalization α Q s = c max c w / L 2 ∈ Θ ( 1 ) \alpha_{Q_s}=c_{\max}c_w/L\sqrt{2}\in\Theta(1) α Q s = c m a x c w / L 2 ∈ Θ ( 1 ) independent of s s s . As n c n_c n c is a constant, the cost of unpreparing ∣ c ⟩ |c\rangle ∣ c ⟩ is Θ ( 1 ) \Theta(1) Θ ( 1 ) . The cost of the first part is O ( s ) O(s) O ( s ) , so by s < n s<n s < n , the overall cost of this step is O ( n ) O(n) O ( n ) .
Considering the gate cost of each step, the overall gate cost for block encoding of Q s Q_s Q s is O ( n log 2 ( n / ε ) ) O(n\log^2(n/\varepsilon)) O ( n log 2 ( n / ε )) . The flag qubits t t t and f f f , the n c n_c n c -qubit creg register, the p p p -qubit ref register are used for block encoding of Q s Q_s Q s ; the rest of ancilla qubits start and return to the zero state. With p ∈ Θ ( log ( n / ε ) ) p\in\Theta(\log(n/\varepsilon)) p ∈ Θ ( log ( n / ε )) and n c ∈ Θ ( 1 ) n_c\in\Theta(1) n c ∈ Θ ( 1 ) , the number of block encoding ancillas a a a for Q s Q_s Q s is a = p + n c + 2 ∈ Θ ( log ( n / ε ) ) a=p+n_c+2\in\Theta(\log(n/\varepsilon)) a = p + n c + 2 ∈ Θ ( log ( n / ε )) .
Block encoding of the full matrix. A simple approach to construct a block encoding of the full matrix Q = ∑ s Q s Q=\sum_s Q_s Q = ∑ s Q s using the block encoding U Q s U_{Q_s} U Q s of Q s Q_s Q s constructed above is by the LCU technique. However, the block encoding constructed by this approach would have a Θ ( n ) \Theta(n) Θ ( n ) normalization. We present an extension of the fixed-scale construction above that achieves a block encoding of Q Q Q with Θ ( n ) \Theta(\sqrt{n}) Θ ( n ) normalization.
For a fixed s s s , the block encoding U Q s U_{Q_s} U Q s we constructed first tests (in Step 1 above) whether the input basis state ∣ j ⟩ |j\rangle ∣ j ⟩ belongs to scale s s s . The result of this test is stored in the flag qubit t t t , and the remaining steps (Steps ≥ 2 \ge2 ≥ 2 above) implement the action of Q s Q_s Q s conditioned on t = 0 t=0 t = 0 . For the full matrix Q Q Q , instead of performing this scale test inside U Q s U_{Q_s} U Q s for each s = 0 , … , n − 1 s=0,\ldots,n-1 s = 0 , … , n − 1 , we first determine the scale of ∣ j ⟩ |j\rangle ∣ j ⟩ and store it on an m m m -qubit register scl with m = ⌈ log 2 ( n + 1 ) ⌉ m=\lceil\log_2(n+1)\rceil m = ⌈ log 2 ( n + 1 )⌉ . To this end, we implement the map
∣ 0 m ⟩ s c l ∣ j ⟩ ↦ ∣ s ( j ) ⟩ s c l ∣ j ⟩ (242) |0^m\rangle_{\mathrm{scl}}|j\rangle\mapsto|s(j)\rangle_{\mathrm{scl}}|j\rangle \tag*{(242)} ∣ 0 m ⟩ scl ∣ j ⟩ ↦ ∣ s ( j ) ⟩ scl ∣ j ⟩ (242)
where s ( j ) s(j) s ( j ) is the scale of j j j , which satisfies j = 2 s ( j ) + k j=2^{s(j)}+k j = 2 s ( j ) + k with 0 ≤ k < 2 s ( j ) 0\le k<2^{s(j)} 0 ≤ k < 2 s ( j ) ; for j = 0 j=0 j = 0 , we use s ( 0 ) = n s(0)=n s ( 0 ) = n as unused scale. As the scale of ∣ j ⟩ |j\rangle ∣ j ⟩ is now stored in scl, we no longer need to perform Step 1 in U Q s U_{Q_s} U Q s to test the scale of ∣ j ⟩ |j\rangle ∣ j ⟩ . We therefore remove the flag t t t , the initial scale test, and the controls on t = 0 t=0 t = 0 from the remaining steps. Let V s V_s V s denote the resulting circuit, consisting of Steps ≥ 2 \ge2 ≥ 2 in the construction of U Q s U_{Q_s} U Q s above. When ∣ j ⟩ |j\rangle ∣ j ⟩ is at scale s s s , we have
V s ∣ 0 a ⟩ ∣ j ⟩ = ∣ 0 a ⟩ Q s α ∣ j ⟩ + ∣ ⊥ ⟩ (243) V_s|0^a\rangle|j\rangle=|0^a\rangle\frac{Q_s}{\alpha}|j\rangle+|\perp\rangle \tag*{(243)} V s ∣ 0 a ⟩ ∣ j ⟩ = ∣ 0 a ⟩ α Q s ∣ j ⟩ + ∣ ⊥ ⟩ (243)
with ( ⟨ 0 a ∣ ⊗ 1 ) ∣ ⊥ ⟩ = 0 (\langle0^a|\otimes1)|\perp\rangle=0 (⟨ 0 a ∣ ⊗ 1 ) ∣ ⊥ ⟩ = 0 , where we used a = p + n s + 1 a=p+n_s+1 a = p + n s + 1 ancillas in block encoding of U Q s U_{Q_s} U Q s after removing the scale-test flag t t t . We now use the scale register to select the appropriate V s V_s V s . That is, for s = 0 , … , n − 1 s=0,\ldots,n-1 s = 0 , … , n − 1 , we apply V s V_s V s controlled on s ( j ) = s s(j)=s s ( j ) = s . Note that this performs SELECT ( V ) = ∑ s ∣ s ⟩ ⟨ s ∣ ⊗ V s \operatorname{SELECT}(V)=\sum_s|s\rangle\langle s|\otimes V_s SELECT ( V ) = ∑ s ∣ s ⟩ ⟨ s ∣ ⊗ V s and maps basis state as
∣ s ( j ) ⟩ ∣ j ⟩ ↦ 1 α ∣ s ( j ) ⟩ Q s ( j ) ∣ j ⟩ (244) |s(j)\rangle|j\rangle\mapsto\frac{1}{\alpha}|s(j)\rangle Q_{s(j)}|j\rangle \tag*{(244)} ∣ s ( j )⟩ ∣ j ⟩ ↦ α 1 ∣ s ( j )⟩ Q s ( j ) ∣ j ⟩ (244)
when the a a a ancillas are in the all-zero state. Now let UNIF \operatorname{UNIF} UNIF prepare the uniform state UNIF ∣ 0 m ⟩ = ( 1 / n ) ∑ s = 0 n − 1 ∣ s ⟩ \operatorname{UNIF}|0^m\rangle=(1/\sqrt{n})\sum_{s=0}^{n-1}|s\rangle UNIF ∣ 0 m ⟩ = ( 1/ n ) ∑ s = 0 n − 1 ∣ s ⟩ , then applying UNIF † \operatorname{UNIF}^{\dagger} UNIF † on the scale register gives a block encoding of Q Q Q with normalization α Q = α n ∈ Θ ( n ) \alpha_Q=\alpha\sqrt{n}\in\Theta(\sqrt{n}) α Q = α n ∈ Θ ( n ) . That is, Q / α Q Q/\alpha_Q Q / α Q is applied on ∣ j ⟩ |j\rangle ∣ j ⟩ conditioned on the scale register being in the all-zero state. To see this, observe that
( ⟨ 0 m ∣ ⊗ 1 ) ( UNIF † ⊗ 1 ) 1 α ∣ s ( j ) ⟩ Q s ( j ) ∣ j ⟩ = 1 α ⟨ 0 m ∣ UNIF † ∣ s ( j ) ⟩ Q s ( j ) ∣ j ⟩ = 1 α n Q s ( j ) ∣ j ⟩ = 1 α n ∑ s Q s ∣ j ⟩ = 1 α n Q ∣ j ⟩ (245) \begin{aligned}
(\langle0^m|\otimes1)(\operatorname{UNIF}^{\dagger}\otimes1)\frac{1}{\alpha}|s(j)\rangle Q_{s(j)}|j\rangle
&=\frac{1}{\alpha}\langle0^m|\operatorname{UNIF}^{\dagger}|s(j)\rangle Q_{s(j)}|j\rangle\\
&=\frac{1}{\alpha\sqrt{n}}Q_{s(j)}|j\rangle\\
&=\frac{1}{\alpha\sqrt{n}}\sum_sQ_s|j\rangle=\frac{1}{\alpha\sqrt{n}}Q|j\rangle \tag*{(245)}
\end{aligned} (⟨ 0 m ∣ ⊗ 1 ) ( UNIF † ⊗ 1 ) α 1 ∣ s ( j )⟩ Q s ( j ) ∣ j ⟩ = α 1 ⟨ 0 m ∣ UNIF † ∣ s ( j )⟩ Q s ( j ) ∣ j ⟩ = α n 1 Q s ( j ) ∣ j ⟩ = α n 1 s ∑ Q s ∣ j ⟩ = α n 1 Q ∣ j ⟩ (245)
where we used Q s ∣ j ⟩ = 0 Q_s|j\rangle=0 Q s ∣ j ⟩ = 0 for s ≠ s ( j ) s\ne s(j) s = s ( j ) . The resulting circuit is then a block encoding U Q U_Q U Q of Q Q Q with normalization α n \alpha\sqrt{n} α n . The ancilla count for block encoding of U Q U_Q U Q is a Q = m + a ∈ Θ ( log ( n / ε ) ) a_Q=m+a\in\Theta(\log(n/\varepsilon)) a Q = m + a ∈ Θ ( log ( n / ε )) using m = ⌈ log ( n + 1 ) ⌉ m=\lceil\log(n+1)\rceil m = ⌈ log ( n + 1 )⌉ and a ∈ Θ ( log ( n / ε ) ) a\in\Theta(\log(n/\varepsilon)) a ∈ Θ ( log ( n / ε )) .
Cost of the full block encoding. We use the scale test to implement the map in Eq. (242) that writes the scale of j j j into the scale register. Specifically, for each s = 0 , … , n − 1 s=0,\ldots,n-1 s = 0 , … , n − 1 , we test whether the leftmost n s + 1 n_s+1 n s + 1 qubits of ∣ j ⟩ \lvert j\rangle ∣ j ⟩ , with n s = n − s − 1 n_s=n-s-1 n s = n − s − 1 , are in the state ∣ 0 n s 1 ⟩ \lvert0^{n_s}1\rangle ∣ 0 n s 1 ⟩ and flip a temporary flag qubit. Then, controlled on ∣ 1 ⟩ \lvert1\rangle ∣ 1 ⟩ of the flag, we write the classically known m m m -bit binary representation of s s s into s c l \mathrm{scl} scl , and finally uncompute the flag. The scale test for each s s s has gate cost O ( n s ) \mathcal{O}(n_s) O ( n s ) , and writing s s s into s c l \mathrm{scl} scl needs at most m = ⌈ log n ⌉ m=\lceil\log n\rceil m = ⌈ log n ⌉ CNOTs. For all s s s , the gate cost is then O ( n 2 ) \mathcal{O}(n^2) O ( n 2 ) .
To implement SELECT ( V ) \operatorname{SELECT}(V) SELECT ( V ) , we compute a temporary flag for each s = 0 , … , n − 1 s=0,\ldots,n-1 s = 0 , … , n − 1 to indicate whether the scale register is in the state ∣ s ⟩ \lvert s\rangle ∣ s ⟩ , i.e., to test if s ( j ) = s s(j)=s s ( j ) = s . We then apply V s V_s V s controlled on this flag, and finally uncompute the flag. This implementation replaces the direct m m m -controlled application of V s V_s V s by a single-controlled V s V_s V s . Computing and uncomputing the flag has gate cost O ( m ) \mathcal{O}(m) O ( m ) for each s s s . The gate cost of V s V_s V s is simply the gate cost O ( n log 2 ( n / ε ) ) \mathcal{O}(n\log^2(n/\varepsilon)) O ( n log 2 ( n / ε )) of U Q s U_{Q_s} U Q s discussed before. So, applying controlled V s V_s V s for all n n n possible values of s s s has gate cost O ( n 2 log 2 ( n / ε ) ) \mathcal{O}(n^2\log^2(n/\varepsilon)) O ( n 2 log 2 ( n / ε )) . Altogether, we obtain G ( Q ) ∈ O ( n 2 log 2 ( n / ε ) ) \mathcal{G}(Q)\in\mathcal{O}(n^2\log^2(n/\varepsilon)) G ( Q ) ∈ O ( n 2 log 2 ( n / ε )) for the overall gate cost of implementing the block encoding U Q U_Q U Q of Q Q Q .
Having the block encoding U Q U_Q U Q , we construct the block encoding U A p r e c U_{A_{\mathrm{prec}}} U A prec of A p r e c A_{\mathrm{prec}} A prec by the block encodings U Q U_Q U Q , U E U_E U E and U K p r e c U_{K_{\mathrm{prec}}} U K prec using the standard product and summation rules for block encodings. The block encoding of K p r e c K_{\mathrm{prec}} K prec is obtained as U K p r e c = U P ( 1 ⊗ W ) U K ( 1 ⊗ W † ) U P U_{K_{\mathrm{prec}}}=U_P(1\otimes W)U_K(1\otimes W^\dagger)U_P U K prec = U P ( 1 ⊗ W ) U K ( 1 ⊗ W † ) U P , where the block encoding U P = ( H ⊗ 1 n ) C 0 ( U + ) C 1 ( U − ) ( H ⊗ 1 n ) U_P=(H\otimes1_n)C_0(U^+)C_1(U^-)(H\otimes1_n) U P = ( H ⊗ 1 n ) C 0 ( U + ) C 1 ( U − ) ( H ⊗ 1 n ) for P P P in terms of controlled application of U ± U^\pm U ± is obtained by the LCU technique and the decomposition P = ( U + + U − ) / 2 P=(U^++U^-)/2 P = ( U + + U − ) /2 [8 ] . By the inequality-test approach in § 3.3.4 , the gate cost of U E U_E U E and U K U_K U K is Θ ( n 3 log n ) \Theta(n^3\log n) Θ ( n 3 log n ) as per Eq. (226) . With the gate cost O ( n ) \mathcal{O}(n) O ( n ) for controlled U ± U^\pm U ± [8 ] and the gate cost G ( Q ) \mathcal{G}(Q) G ( Q ) for Q Q Q , we have
G ( U A p r e c ) ∈ O ( n 3 log n ) + O ( n 2 log 2 ( n / ε ) ) ⊆ O ( n 3 log 2 ( n / ε ) ) (246) \mathcal{G}(U_{A_{\mathrm{prec}}})\in\mathcal{O}(n^3\log n)+\mathcal{O}(n^2\log^2(n/\varepsilon))\subseteq\mathcal{O}(n^3\log^2(n/\varepsilon)) \tag*{(246)} G ( U A prec ) ∈ O ( n 3 log n ) + O ( n 2 log 2 ( n / ε )) ⊆ O ( n 3 log 2 ( n / ε )) (246)
for the gate cost of implementing the block encoding of the preconditioned matrix. The number of ancillas used for block encoding of the diagonals E E E and K K K is Θ ( n ) \Theta(n) Θ ( n ) as per Eq. (228) and a Q ∈ Θ ( log ( n / ε ) ) a_Q\in\Theta(\log(n/\varepsilon)) a Q ∈ Θ ( log ( n / ε )) ancillas are used for block encoding of Q Q Q . The total number of ancilla qubits a p r e c a_{\mathrm{prec}} a prec for block encoding of A p r e c A_{\mathrm{prec}} A prec then scales as a p r e c ∈ Θ ( n + log ( n / ε ) ) a_{\mathrm{prec}}\in\Theta(n+\log(n/\varepsilon)) a prec ∈ Θ ( n + log ( n / ε )) .
Computing the scaled coefficients. We now present a procedure for computing the scaled coefficients with a logarithmic time and space. We use the following lemma for our implementation.
Lemma 8. Let A s ′ = 2 n − s A s A'_s=\sqrt{2^{n-s}}A_s A s ′ = 2 n − s A s with A s A_s A s given in Eq. (231) . Then we can express A s ′ A'_s A s ′ as
A s ′ = 8 H n − 1 ′ ⋯ H s + 1 ′ † ( S s + 1 − 1 s + 1 ) G s ′ † (247) A'_s=\sqrt{8}H'_{n-1}\cdots H'^{\dagger}_{s+1}(S_{s+1}-1_{s+1})G'^{\dagger}_s \tag*{(247)} A s ′ = 8 H n − 1 ′ ⋯ H s + 1 ′ † ( S s + 1 − 1 s + 1 ) G s ′ † (247) where H r ′ H'_r H r ′ is the modified version of the refinement matrix H r H_r H r with entries [ H r ′ ] i j = h ( j − 2 i ) m o d 2 r + 1 ′ [H'_r]_{ij}=h'_{(j-2i)\bmod2^{r+1}} [ H r ′ ] ij = h ( j − 2 i ) mod 2 r + 1 ′ obtained from the modified filter coefficients h ℓ ′ : = 8 ∑ k = 0 ℓ ( − 1 ) ℓ − k h k h'_\ell:=\sqrt{8}\sum_{k=0}^{\ell}(-1)^{\ell-k}h_k h ℓ ′ := 8 ∑ k = 0 ℓ ( − 1 ) ℓ − k h k .
The scaled coefficient a s , m ′ = ⟨ m ∣ A s ′ ∣ 0 s ⟩ a'_{s,m}=\langle m|A'_s|0^s\rangle a s , m ′ = ⟨ m ∣ A s ′ ∣ 0 s ⟩ associated with c c c and b b b is at the index m = 2 n s c + b m=2^{n_s}c+b m = 2 n s c + b , where n s = n − s − 1 n_s=n-s-1 n s = n − s − 1 and 0 ≤ b < 2 n s 0\leq b<2^{n_s} 0 ≤ b < 2 n s . Here n s n_s n s is the number of refinements, i.e., the number of applications of H ′ † H'^\dagger H ′ † . Each refinement maps an input vector x x x to the output vector y = H ′ † x y=H'^\dagger x y = H ′ † x with elements y m = ∑ j h m − 2 j ′ x j y_m=\sum_j h'_{m-2j}x_j y m = ∑ j h m − 2 j ′ x j ; we omit the modulo operation for notational simplicity. Let D s : = ( S s + 1 − 1 s + 1 ) G s ′ † D_s:=(S_{s+1}-1_{s+1})G'^\dagger_s D s := ( S s + 1 − 1 s + 1 ) G s ′ † ; the initial vector is the nonzero elements of 8 D s ∣ 0 s ⟩ \sqrt{8}D_s|0^s\rangle 8 D s ∣ 0 s ⟩ . As shown in Appendix § 6 .§ 5 , these elements are d r = ⟨ r ∣ D s ∣ 0 s ⟩ d_r=\langle r|D_s|0^s\rangle d r = ⟨ r ∣ D s ∣ 0 s ⟩ for r = 0 , 1 , … , M r=0,1,\ldots,M r = 0 , 1 , … , M , where M M M is the length of the original wavelet filter, so the initial vector is the fixed-size vector x = 8 ( d 0 , … , d M ) x=\sqrt{8}(d_0,\ldots,d_M) x = 8 ( d 0 , … , d M ) .
To describe our approach for computing the scaled coefficient, let us first consider the case with one refinement (n s = 1 n_s=1 n s = 1 ). In this case, m = 2 c + b 0 m=2c+b_0 m = 2 c + b 0 with b 0 ∈ { 0 , 1 } b_0\in\{0,1\} b 0 ∈ { 0 , 1 } and the desired coefficient y 2 c + b 0 = ∑ ℓ h 2 ℓ + b 0 ′ x c − ℓ y_{2c+b_0}=\sum_\ell h'_{2\ell+b_0}x_{c-\ell} y 2 c + b 0 = ∑ ℓ h 2 ℓ + b 0 ′ x c − ℓ can be computed conditioned on the bit b 0 b_0 b 0 . Let us define the vector x 1 = ( x 0 1 , x 1 1 , … , x M ′ − 1 1 ) x^1=(x^1_0,x^1_1,\ldots,x^1_{M'-1}) x 1 = ( x 0 1 , x 1 1 , … , x M ′ − 1 1 ) with x ℓ 1 : = x c − ℓ x^1_\ell:=x_{c-\ell} x ℓ 1 := x c − ℓ , where M ′ M' M ′ is the length of the vector of modified filters h ′ = ( h 0 ′ , … , h M ′ − 1 ′ ) h'=(h'_0,\ldots,h'_{M'-1}) h ′ = ( h 0 ′ , … , h M ′ − 1 ′ ) . If b 0 = 0 b_0=0 b 0 = 0 , the desired coefficient y 2 c = ∑ ℓ h 2 ℓ ′ x ℓ 1 y_{2c}=\sum_\ell h'_{2\ell}x^1_\ell y 2 c = ∑ ℓ h 2 ℓ ′ x ℓ 1 is the inner product of the even-indexed filter coefficients ( h 0 ′ , h 2 ′ , … ) (h'_0,h'_2,\ldots) ( h 0 ′ , h 2 ′ , … ) and x 1 x^1 x 1 . If b 0 = 1 b_0=1 b 0 = 1 , the desired coefficient y 2 c + 1 y_{2c+1} y 2 c + 1 is obtained by the inner product of the odd-indexed filter coefficients ( h 1 ′ , h 3 ′ , … ) (h'_1,h'_3,\ldots) ( h 1 ′ , h 3 ′ , … ) and x 1 x^1 x 1 .
Let us now consider two refinements (n s = 2 n_s=2 n s = 2 ). In this case, m = 2 2 c + b m=2^2c+b m = 2 2 c + b with 0 ≤ b < 2 2 0\leq b<2^2 0 ≤ b < 2 2 . In binary b = ( b 1 b 0 ) 2 = 2 b 1 + b 0 b=(b_1b_0)_2=2b_1+b_0 b = ( b 1 b 0 ) 2 = 2 b 1 + b 0 , so we can write m = 2 ( 2 c + b 1 ) + b 0 = 2 c 1 + b 0 m=2(2c+b_1)+b_0=2c_1+b_0 m = 2 ( 2 c + b 1 ) + b 0 = 2 c 1 + b 0 with c 1 = 2 c + b 1 c_1=2c+b_1 c 1 = 2 c + b 1 . Let x 2 = ( x 0 2 , x 1 2 , … , x M ′ − 1 2 ) x^2=(x^2_0,x^2_1,\ldots,x^2_{M'-1}) x 2 = ( x 0 2 , x 1 2 , … , x M ′ − 1 2 ) be the vector obtained from the output vector y y y of the first refinement as x ℓ 2 : = y c 1 − ℓ = y 2 c + b 1 − ℓ x^2_\ell:=y_{c_1-\ell}=y_{2c+b_1-\ell} x ℓ 2 := y c 1 − ℓ = y 2 c + b 1 − ℓ ; the bit b 1 b_1 b 1 determines how this vector is obtained from x 1 x^1 x 1 . The second refinement then gives the coefficient y 2 c 1 + b 0 = ∑ ℓ h 2 ℓ + b 0 ′ y c 1 − ℓ = ∑ ℓ h 2 ℓ + b 0 ′ x ℓ 2 y_{2c_1+b_0}= \sum_\ell h'_{2\ell+b_0}y_{c_1-\ell}=\sum_\ell h'_{2\ell+b_0}x^2_\ell y 2 c 1 + b 0 = ∑ ℓ h 2 ℓ + b 0 ′ y c 1 − ℓ = ∑ ℓ h 2 ℓ + b 0 ′ x ℓ 2 . Notice that just as the one-refinement case, the last bit b 0 b_0 b 0 determines the even-indexed filter coefficients when b 0 = 0 b_0=0 b 0 = 0 and the odd-indexed filter coefficients when b 0 = 1 b_0=1 b 0 = 1 .
The same procedure can be used to extend the approach to n s n_s n s refinements. That is, for refinement r = 1 , … , n s r=1,\ldots,n_s r = 1 , … , n s , the bit b n s − r b_{n_s-r} b n s − r of b = ( b n s − 1 ⋯ b 1 b 0 ) 2 b=(b_{n_s-1}\cdots b_1b_0)_2 b = ( b n s − 1 ⋯ b 1 b 0 ) 2 , from left to right, controls whether to use the even- or odd-indexed filter coefficients. For all intermediate refinements, we compute a fixed-size vector of M + 1 M+1 M + 1 coefficients needed for the next refinement. At the final refinement, only the single coefficient a s , m ′ a'_{s,m} a s , m ′ is computed. This approach gives the following steps for computing the desired coefficient on a quantum register for n s ≥ 1 n_s \ge1 n s ≥ 1 . For n s 0 n_{s0} n s 0 , no refinement is needed, and the desired coefficient is directly obtained from the initial vector.
(Load the initial vector ). Initialize M + 1 M+1 M + 1 registers, each with n t m p n_{\mathrm{tmp}} n tmp qubits, in the all-zero state and perform the map ∣ c ⟩ ∣ 0 n t m p ⟩ ⋯ ∣ 0 n t m p ⟩ ↦ ∣ c ⟩ ∣ x 0 1 ⟩ ∣ x 1 1 ⟩ ⋯ ∣ x M 1 ⟩ |c\rangle|0^{n_{\mathrm{tmp}}}\rangle\cdots|0^{n_{\mathrm{tmp}}}\rangle\mapsto|c\rangle|x_0^1\rangle|x_1^1\rangle\cdots|x_M^1\rangle ∣ c ⟩ ∣ 0 n tmp ⟩ ⋯ ∣ 0 n tmp ⟩ ↦ ∣ c ⟩ ∣ x 0 1 ⟩ ∣ x 1 1 ⟩ ⋯ ∣ x M 1 ⟩ , where x ℓ 1 = x c − ℓ x_\ell^1=x_{c-\ell} x ℓ 1 = x c − ℓ are known classical values from the initial vector x = 8 ( d 0 , … , d M ) \mathbf{x}=\sqrt{8}(d_0,\ldots,d_M) x = 8 ( d 0 , … , d M ) . In compact notation, we write this map as ∣ c ⟩ ∣ 0 ⟩ ↦ ∣ c ⟩ ∣ x 1 ⟩ |c\rangle|0\rangle\mapsto|c\rangle|x^1\rangle ∣ c ⟩ ∣0 ⟩ ↦ ∣ c ⟩ ∣ x 1 ⟩ .
(Perform the intermediate refinements ). For each refinement r = 1 , … , n s − 1 r=1,\ldots,n_s-1 r = 1 , … , n s − 1 , compute the refined vector into a fresh set of M + 1 M+1 M + 1 n t m p n_{\mathrm{tmp}} n tmp -qubit registers controlled on qubit ∣ b n s − r ⟩ |b_{n_s-r}\rangle ∣ b n s − r ⟩ . That is, perform the map ∣ b n s − r ⟩ ∣ x r ⟩ ∣ 0 ⟩ ↦ ∣ b n s − r ⟩ ∣ x r ⟩ ∣ x r + 1 ⟩ |b_{n_s-r}\rangle|x^r\rangle|0\rangle\mapsto|b_{n_s-r}\rangle|x^r\rangle|x^{r+1}\rangle ∣ b n s − r ⟩ ∣ x r ⟩ ∣0 ⟩ ↦ ∣ b n s − r ⟩ ∣ x r ⟩ ∣ x r + 1 ⟩ . The control qubit determines whether the even- or odd-indexed filter coefficients are used for computing the refined vector x r + 1 x^{r+1} x r + 1 .
(Compute the coefficient by the final refinement ). Now controlled on qubit ∣ b 0 ⟩ |b_0\rangle ∣ b 0 ⟩ , perform the final refinement to obtain the desired coefficient. Specifically, we perform the map ∣ b 0 ⟩ ∣ x n s ⟩ ∣ 0 n t m p ⟩ ↦ ∣ b 0 ⟩ ∣ x n s ⟩ ∣ a s , m ′ ⟩ |b_0\rangle|x^{n_s}\rangle|0^{n_{\mathrm{tmp}}}\rangle\mapsto|b_0\rangle|x^{n_s}\rangle|a'_{s,m}\rangle ∣ b 0 ⟩ ∣ x n s ⟩ ∣ 0 n tmp ⟩ ↦ ∣ b 0 ⟩ ∣ x n s ⟩ ∣ a s , m ′ ⟩ .
Finally, we uncompute the intermediate vectors by reversing Steps 1 and 2, so that only the desired coefficient is in the output register.
The quantum circuit by the above steps acts on ∣ c ⟩ ∣ b ⟩ |c\rangle|b\rangle ∣ c ⟩ ∣ b ⟩ and computes a s , m ′ a'_{s,m} a s , m ′ on the fly for m = 2 n s c + b m=2^{n_s}c+b m = 2 n s c + b on an n t m p n_{\mathrm{tmp}} n tmp -qubit register. The number of ancilla registers used for storing intermediate vectors and the final coefficient is n s ( M + 1 ) + 1 n_s(M+1)+1 n s ( M + 1 ) + 1 and each register contains n t m p n_{\mathrm{tmp}} n tmp qubits. The overall number of ancilla qubits is then n a n c = ( n s ( M + 1 ) + 1 ) n t m p n_{\mathrm{anc}}=(n_s(M+1)+1)n_{\mathrm{tmp}} n anc = ( n s ( M + 1 ) + 1 ) n tmp . Using n s < n n_s<n n s < n , n t m p ∈ Θ ( log ( n / ε ) ) n_{\mathrm{tmp}}\in\Theta(\log(n/\varepsilon)) n tmp ∈ Θ ( log ( n / ε )) , and M ∈ Θ ( 1 ) M\in\Theta(1) M ∈ Θ ( 1 ) for a fixed wavelet, we achieve n a n c ∈ O ( n log ( n / ε ) ) n_{\mathrm{anc}}\in O(n\log(n/\varepsilon)) n anc ∈ O ( n log ( n / ε )) .
The overall cost of implementing COEF is as follows. The first step writes M + 1 M+1 M + 1 fixed-point numbers on n t m p n_{\mathrm{tmp}} n tmp -qubit registers controlled on a constant number of qubits. As M ∈ Θ ( 1 ) M\in\Theta(1) M ∈ Θ ( 1 ) , the cost of loading the initial vector is then O ( n t m p ) O(n_{\mathrm{tmp}}) O ( n tmp ) . The total number of refinements in Step 2 and Step 3 above is n s n_s n s and we show in the following that the gate cost of each refinement is Θ ( n t m p 2 ) \Theta(n_{\mathrm{tmp}}^2) Θ ( n tmp 2 ) . With n s < n n_s<n n s < n and n t m p ∈ Θ ( log ( n / ε ) ) n_{\mathrm{tmp}}\in\Theta(\log(n/\varepsilon)) n tmp ∈ Θ ( log ( n / ε )) , the overall gate cost of COEF is then O ( n log 2 ( n / ε ) ) O(n\log^2(n/\varepsilon)) O ( n log 2 ( n / ε )) .
Implementing one refinement. Each refinement is a map of the form ∣ β ⟩ ∣ x ⟩ ∣ 0 ⟩ ↦ ∣ β ⟩ ∣ x ⟩ ∣ y ⟩ |\beta\rangle|x\rangle|0\rangle\mapsto|\beta\rangle|x\rangle|y\rangle ∣ β ⟩ ∣ x ⟩ ∣0 ⟩ ↦ ∣ β ⟩ ∣ x ⟩ ∣ y ⟩ , where β ∈ { 0 , 1 } \beta\in\{0,1\} β ∈ { 0 , 1 } , and x x x and y y y are fixed-length vectors that satisfy y k = ∑ ℓ h 2 ℓ + β − k ′ x ℓ y_k=\sum_\ell h'_{2\ell+\beta-k}x_\ell y k = ∑ ℓ h 2 ℓ + β − k ′ x ℓ . Let us consider the even 2 k 2k 2 k and odd 2 k + 1 2k+1 2 k + 1 entries of y y y based on β \beta β . For β = 0 \beta=0 β = 0 , the even entries are y 2 k = ∑ j h 2 j ′ x k + j y_{2k}=\sum_j h'_{2j}x_{k+j} y 2 k = ∑ j h 2 j ′ x k + j , where we set ℓ = k − j \ell=k-j ℓ = k − j , and similarly the odd entries are y 2 k + 1 = ∑ j h 2 j + 1 ′ x k + j + 1 y_{2k+1}=\sum_j h'_{2j+1}x_{k+j+1} y 2 k + 1 = ∑ j h 2 j + 1 ′ x k + j + 1 . Therefore, when β = 0 \beta=0 β = 0 , the even entries of y y y are computed using even-indexed filter coefficients and the odd entries are obtained using the odd-indexed filter coefficients. It then follows that when β = 1 \beta=1 β = 1 , the even entries are computed using the odd-indexed filter coefficients as y 2 k = ∑ j h 2 j + 1 ′ x k + j y_{2k}=\sum_j h'_{2j+1}x_{k+j} y 2 k = ∑ j h 2 j + 1 ′ x k + j and the odd entries are computed using even-indexed filter coefficients as y 2 k + 1 = ∑ j h 2 j ′ x k + j y_{2k+1}=\sum_j h'_{2j}x_{k+j} y 2 k + 1 = ∑ j h 2 j ′ x k + j .
We compute each output entry using a sequence of multiply-and-accumulate operation defined as
MAC ( h j ′ ) ∣ x ⟩ ∣ y ⟩ = ∣ x ⟩ ∣ y + h j ′ x ⟩ , (248) \operatorname{MAC}(h'_j)|x\rangle|y\rangle=|x\rangle|y+h'_jx\rangle, \tag*{(248)} MAC ( h j ′ ) ∣ x ⟩ ∣ y ⟩ = ∣ x ⟩ ∣ y + h j ′ x ⟩ , (248)
which multiplies the first register by the classically known fixed-point constant h j ′ h'_j h j ′ and accumulates it to the second register. For example, for β = 0 \beta=0 β = 0 , y 2 k = h 0 ′ x k + h 2 ′ x k + 1 + ⋯ y_{2k}=h'_0x_k+h'_2x_{k+1}+\cdots y 2 k = h 0 ′ x k + h 2 ′ x k + 1 + ⋯ , so to compute y 2 k y_{2k} y 2 k we initialize the corresponding output register as ∣ y 2 k ⟩ = ∣ 0 ⟩ |y_{2k}\rangle=|0\rangle ∣ y 2 k ⟩ = ∣0 ⟩ and apply MAC ( h 0 ′ ) \operatorname{MAC}(h'_0) MAC ( h 0 ′ ) on ∣ x k ⟩ |x_k\rangle ∣ x k ⟩ and ∣ y 2 k ⟩ |y_{2k}\rangle ∣ y 2 k ⟩ to obtain ∣ y 2 k ⟩ = ∣ h 0 ′ x k ⟩ |y_{2k}\rangle=|h'_0x_k\rangle ∣ y 2 k ⟩ = ∣ h 0 ′ x k ⟩ . We then apply MAC ( h 2 ′ ) \operatorname{MAC}(h'_2) MAC ( h 2 ′ ) on ∣ x k + 1 ⟩ |x_{k+1}\rangle ∣ x k + 1 ⟩ and the same accumulator to obtain ∣ y 2 k ⟩ = ∣ h 0 ′ x k + h 2 ′ x k + 1 ⟩ |y_{2k}\rangle=|h'_0x_k+h'_2x_{k+1}\rangle ∣ y 2 k ⟩ = ∣ h 0 ′ x k + h 2 ′ x k + 1 ⟩ . This process is continued over the nonzero even-indexed filter coefficients until y 2 k y_{2k} y 2 k is computed. The other entries of y y y are computed similarly.
Cost of one refinement. The modified filter vector h ′ h' h ′ has length M ′ = M − 1 M'=M-1 M ′ = M − 1 , so each output entry can be computed by at most ⌈ M ′ / 2 ⌉ \lceil M'/2\rceil ⌈ M ′ /2 ⌉ MAC operations. The output vector y y y has M + 1 M+1 M + 1 entries, so the overall number of MAC operations used in one refinement is O ( M 2 ) O(M^2) O ( M 2 ) . For a fixed wavelet, M M M is constant, so the number of MAC operations used in one refinement is O ( 1 ) O(1) O ( 1 ) . As each h j ′ h'_j h j ′ is a classically known fixed-point constant, its multiplication does not need a general quantum multiplier. Using the binary representation of h j ′ h'_j h j ′ , multiplication by h j ′ h'_j h j ′ can be implemented using at most n t m p n_{\mathrm{tmp}} n tmp predetermined shifted additions [42 Appendix A] . Each addition of two n t m p n_{\mathrm{tmp}} n tmp -qubit quantum registers can be implemented using Θ ( n t m p ) \Theta(n_{\mathrm{tmp}}) Θ ( n tmp ) gates, so the overall cost of implementing MAC is O ( n t m p 2 ) = O ( log 2 ( n / ε ) ) O(n_{\mathrm{tmp}}^2)=O(\log^2(n/\varepsilon)) O ( n tmp 2 ) = O ( log 2 ( n / ε )) .
Properties of interest and tailored implementation for the observable oracle
Having developed a quantum algorithm for generating a quantum solution state that encodes the electrostatic potential of the biomolecular system, we now discuss extracting key properties of the solution. In particular, we consider two properties of interest: electrostatic free energy and solvation free energy. We show how these quantities can be expressed in terms of expectation values of a suitable observable with respect to the solution state. We then construct a block encoding of the observable, present a quantum circuit implementation, and analyze its gate cost and ancilla count.
Electrostatic free energy and its observable construction
A key quantity of interest for the biomolecular system is the electrostatic free energy, which represents the work needed to assemble the atomic charge distribution of the biomolecule. This energy is given by [24 , 25 ]
E = 1 2 ∑ a = 0 N a t m − 1 z a u ˉ a , (249) E = \frac{1}{2}\sum_{a=0}^{N_{\mathrm{atm}}-1} z_a\bar{u}_a, \tag*{(249)} E = 2 1 a = 0 ∑ N atm − 1 z a u ˉ a , (249)
where u ˉ a \bar{u}_a u ˉ a is the average electrostatic potential acting on atom a a a with charge z a z_a z a . The average u ˉ a \bar{u}_a u ˉ a is over nearby grid points and is obtained from the discretization of the Dirac delta. Specifically, by the continuum form of electrostatic free energy E = 1 2 ∫ Ω ρ ( x ) u ( x ) d x E = \frac{1}{2}\int_{\Omega}\rho(x)u(x)\,\mathrm{d}x E = 2 1 ∫ Ω ρ ( x ) u ( x ) d x and the atomic charge density ρ ( x ) = ∑ a z a δ ( x − x a ) \rho(x) = \sum_a z_a\delta(x-x_a) ρ ( x ) = ∑ a z a δ ( x − x a ) , the average potential is
u ˉ a = ∫ Ω u ( x ) δ ~ ( x − x a ) d x = ∑ s ∈ { 0 , 1 } d w a , s u x a + s , (250) \bar{u}_a = \int_{\Omega}u(x)\tilde{\delta}(x-x_a)\,\mathrm{d}x = \sum_{s\in\{0,1\}^d}w_{a,s}u_{x_a+s}, \tag*{(250)} u ˉ a = ∫ Ω u ( x ) δ ~ ( x − x a ) d x = s ∈ { 0 , 1 } d ∑ w a , s u x a + s , (250)
where δ ~ ( x − x a ) \tilde{\delta}(x-x_a) δ ~ ( x − x a ) is the discretized Dirac delta in Eq. (138) in the position-dependent charge distribution with weight w a , s w_{a,s} w a , s in Eq. (139) . For the uniform charge distribution over the nearest-neighbor points discussed in § 3.2.2 , the weight is 1 / 2 d 1/2^d 1/ 2 d , independent of s ∈ { 0 , 1 } d s\in\{0,1\}^d s ∈ { 0 , 1 } d and the position of atom a a a . Similarly, the weight w s = 1 / 2 d + ∥ s ∥ 1 w_s=1/2^{d+\lVert s\rVert_1} w s = 1/ 2 d + ∥ s ∥ 1 with s ∈ { 0 , ± 1 } d s\in\{0,\pm1\}^d s ∈ { 0 , ± 1 } d in Eq. (128) for the charge distribution over three nearby points is independent of the position of atom a a a . We first construct an observable for these position-independent cases and then discuss the general position-dependent average potential.
For the position-independent cases, let us define the translation operator
T = ∑ s w s T s , T s : = ∑ q ∣ q + s ⟩ ⟨ q ∣ , (251) T=\sum_s w_sT_s,\qquad T_s:=\sum_q\lvert q+s\rangle\langle q\rvert, \tag*{(251)} T = s ∑ w s T s , T s := q ∑ ∣ q + s ⟩ ⟨ q ∣ , (251)
where q q q is the index of grid points and T s T_s T s shifts the grid states as ∣ q ⟩ ↦ ∣ q + s ⟩ \lvert q\rangle\mapsto\lvert q+s\rangle ∣ q ⟩ ↦ ∣ q + s ⟩ . Also, let ∣ u ⟩ = ∑ q u q ∣ q ⟩ \lvert u\rangle=\sum_q u_q\lvert q\rangle ∣ u ⟩ = ∑ q u q ∣ q ⟩ be the vector (an unnormalized state) of approximate potential on grid points q q q . Then notice that T † T^\dagger T † maps ∣ u ⟩ \lvert u\rangle ∣ u ⟩ to the vector of average potentials on grid points as
T † : ∣ u ⟩ ↦ ∣ u ˉ ⟩ : = ∑ q u ˉ q ∣ q ⟩ , (252) T^\dagger:\lvert u\rangle\mapsto\lvert\bar{u}\rangle:=\sum_q\bar{u}_q\lvert q\rangle, \tag*{(252)} T † : ∣ u ⟩ ↦ ∣ u ˉ ⟩ := q ∑ u ˉ q ∣ q ⟩ , (252)
where u ˉ q = ∑ s w s u q + s \bar{u}_q=\sum_s w_su_{q+s} u ˉ q = ∑ s w s u q + s is average potential on grid point q q q . The average potential over atom a a a is then obtained as
⟨ x a ∣ T † ∣ u ⟩ = ∑ s w s u x a + s = u ˉ a , (253) \langle x_a\lvert T^\dagger\lvert u\rangle=\sum_s w_su_{x_a+s}=\bar{u}_a, \tag*{(253)} ⟨ x a ∣ T † ∣ u ⟩ = s ∑ w s u x a + s = u ˉ a , (253)
and by the atom-position state ∣ p o s ⟩ \lvert\mathrm{pos}\rangle ∣ pos ⟩ in Eq. (101)
⟨ p o s ∣ T † ∣ u ⟩ = 1 ∥ z ∥ ∑ a z a u ˉ a = 2 E ∥ z ∥ . (254) \langle\mathrm{pos}\lvert T^\dagger\lvert u\rangle=\frac{1}{\lVert z\rVert}\sum_a z_a\bar{u}_a=\frac{2E}{\lVert z\rVert}. \tag*{(254)} ⟨ pos ∣ T † ∣ u ⟩ = ∥ z ∥ 1 a ∑ z a u ˉ a = ∥ z ∥ 2 E . (254)
To turn this overlap into an expectation value, we define the unnormalized state ∣ ϕ ⟩ \lvert\phi\rangle ∣ ϕ ⟩ and the measurement operator M M M as
∣ ϕ ⟩ : = 1 2 ( ∣ 0 ⟩ ∣ u ⟩ + ∣ 1 ⟩ ∣ p o s ⟩ ) , M : = ∣ 0 ⟩ ⟨ 1 ∣ ⊗ T + ∣ 1 ⟩ ⟨ 0 ∣ ⊗ T † , (255) \lvert\phi\rangle:=\frac{1}{\sqrt{2}}\left(\lvert0\rangle\lvert u\rangle+\lvert1\rangle\lvert\mathrm{pos}\rangle\right),\qquad M:=\lvert0\rangle\langle1\rvert\otimes T+\lvert1\rangle\langle0\rvert\otimes T^\dagger, \tag*{(255)} ∣ ϕ ⟩ := 2 1 ( ∣ 0 ⟩ ∣ u ⟩ + ∣ 1 ⟩ ∣ pos ⟩ ) , M := ∣ 0 ⟩ ⟨ 1 ∣ ⊗ T + ∣ 1 ⟩ ⟨ 0 ∣ ⊗ T † , (255)
then E = 1 2 ∥ z ∥ ⟨ ϕ ∣ M ∣ ϕ ⟩ E=\frac{1}{2}\lVert z\rVert\langle\phi\lvert M\lvert\phi\rangle E = 2 1 ∥ z ∥ ⟨ ϕ ∣ M ∣ ϕ ⟩ . Note that T T T is symmetric for the uniform charge distribution over three nearby points, and in this case M = X ⊗ T M=X\otimes T M = X ⊗ T . The state ∣ ϕ ⟩ \lvert\phi\rangle ∣ ϕ ⟩ and the operator M M M here are the same as those in Eq. (164) , so by Eq. (166) we have
E = 1 2 ε ∥ z ∥ ⟨ Ψ ∣ M ′ ∣ Ψ ⟩ , (256) E=\frac{1}{2}\varepsilon\lVert z\rVert\langle\Psi\lvert M'\lvert\Psi\rangle, \tag*{(256)} E = 2 1 ε ∥ z ∥ ⟨ Ψ ∣ M ′ ∣ Ψ ⟩ , (256)
where
∣ Ψ ⟩ = 1 2 ( ∣ 0 ⟩ ∣ ψ ⟩ + ∣ 1 ⟩ ∣ χ ⟩ ) , ∣ χ ⟩ : = ∣ + + ⟩ ∣ p o s ⟩ (257) \lvert\Psi\rangle=\frac{1}{\sqrt{2}}\left(\lvert0\rangle\lvert\psi\rangle+\lvert1\rangle\lvert\chi\rangle\right),\qquad\lvert\chi\rangle:=\lvert++\rangle\lvert\mathrm{pos}\rangle \tag*{(257)} ∣ Ψ ⟩ = 2 1 ( ∣ 0 ⟩ ∣ ψ ⟩ + ∣ 1 ⟩ ∣ χ ⟩ ) , ∣ χ ⟩ := ∣ + + ⟩ ∣ pos ⟩ (257)
M ′ = ∣ 0 ⟩ ⟨ 1 ∣ ⊗ 1 2 ⊗ T + ∣ 1 ⟩ ⟨ 0 ∣ ⊗ 1 2 ⊗ T † . (258) M'=\lvert0\rangle\langle1\rvert\otimes\mathbb{1}_2\otimes T+\lvert1\rangle\langle0\rvert\otimes\mathbb{1}_2\otimes T^\dagger. \tag*{(258)} M ′ = ∣ 0 ⟩ ⟨ 1 ∣ ⊗ 1 2 ⊗ T + ∣ 1 ⟩ ⟨ 0 ∣ ⊗ 1 2 ⊗ T † . (258)
We now discuss block encoding of T T T for the case of uniform charge distribution over the nearest-neighbor points with weights w s = 1 / 2 d w_s = 1/2^d w s = 1/ 2 d ; the block encoding for the symmetric position-independent charge distribution over three points follows similarly. Let
PREP ∣ 0 d ⟩ = ∑ s ∈ { 0 , 1 } d w s ∣ s ⟩ = ∣ + ⟩ d , (259) \operatorname{PREP}|0^d\rangle= \sum_{s\in\{0,1\}^d}\sqrt{w_s}|s\rangle= |+\rangle^d, \tag*{(259)} PREP ∣ 0 d ⟩ = s ∈ { 0 , 1 } d ∑ w s ∣ s ⟩ = ∣ + ⟩ d , (259)
where PREP = H ⊗ d \operatorname{PREP} = H^{\otimes d} PREP = H ⊗ d , and let
SEL = ∑ s ∣ s ⟩ ⟨ s ∣ ⊗ T s , (260) \operatorname{SEL} = \sum_s |s\rangle\langle s| \otimes T_s, \tag*{(260)} SEL = s ∑ ∣ s ⟩ ⟨ s ∣ ⊗ T s , (260)
then U T = ( PREP † ⊗ 1 ) SEL ( PREP ⊗ 1 ) U_T = (\operatorname{PREP}^{\dagger}\otimes1)\operatorname{SEL}(\operatorname{PREP}\otimes1) U T = ( PREP † ⊗ 1 ) SEL ( PREP ⊗ 1 ) is an ( 1 , d , 0 ) (1,d,0) ( 1 , d , 0 ) -block encoding of T T T , and
U M = ∣ 0 ⟩ ⟨ 1 ∣ ⊗ U T + ∣ 1 ⟩ ⟨ 0 ∣ ⊗ U T † = ( ∣ 0 ⟩ ⟨ 0 ∣ ⊗ U T + ∣ 1 ⟩ ⟨ 1 ∣ ⊗ U T † ) ( X ⊗ 1 ) (261) U_M = |0\rangle\langle1| \otimes U_T + |1\rangle\langle0| \otimes U_T^{\dagger} = (|0\rangle\langle0| \otimes U_T + |1\rangle\langle1| \otimes U_T^{\dagger})(X\otimes1) \tag*{(261)} U M = ∣0 ⟩ ⟨ 1∣ ⊗ U T + ∣1 ⟩ ⟨ 0∣ ⊗ U T † = ( ∣0 ⟩ ⟨ 0∣ ⊗ U T + ∣1 ⟩ ⟨ 1∣ ⊗ U T † ) ( X ⊗ 1 ) (261)
is a ( 1 , d , 0 ) (1,d,0) ( 1 , d , 0 ) -block encoding of M M M . This block encoding can be simplified as
U M = ( 1 1 ⊗ PREP † ⊗ 1 ) ( ∣ 0 ⟩ ⟨ 0 ∣ ⊗ SEL + ∣ 1 ⟩ ⟨ 1 ∣ ⊗ SEL † ) ( X ⊗ PREP ⊗ 1 ) , (262) U_M = (1_1\otimes\operatorname{PREP}^{\dagger}\otimes1)(|0\rangle\langle0|\otimes\operatorname{SEL}+|1\rangle\langle1|\otimes\operatorname{SEL}^{\dagger})(X\otimes\operatorname{PREP}\otimes1), \tag*{(262)} U M = ( 1 1 ⊗ PREP † ⊗ 1 ) ( ∣0 ⟩ ⟨ 0∣ ⊗ SEL + ∣1 ⟩ ⟨ 1∣ ⊗ SEL † ) ( X ⊗ PREP ⊗ 1 ) , (262)
which we use in our implementation in Figure 10 . The block encoding of M ′ M' M ′ is similar but with an extra 1 2 1_2 1 2 as in Eq. (258) . In our application d = 3 d=3 d = 3 , and so the number of ancillas in U M U_M U M is constant.
Figure 10. Quantum circuit for implementing the block encoding of the observable M M M in Eq. (255) used for estimating the electrostatic free energy.
To implement SEL \operatorname{SEL} SEL , we note that T s T_s T s with s = s 1 s 2 ⋯ s d s=s_1s_2\cdots s_d s = s 1 s 2 ⋯ s d in binary can be decomposed as product of 1D shifts as
T s = S 1 s 1 ⋯ S d s d , T_s = S_1^{s_1}\cdots S_d^{s_d}, T s = S 1 s 1 ⋯ S d s d ,
where S j S_j S j is the shift operator in direction j j j , so we obtain SEL = C s 1 ( S 1 ) ⋯ C s d ( S d ) \operatorname{SEL}=C_{s_1}(S_1)\cdots C_{s_d}(S_d) SEL = C s 1 ( S 1 ) ⋯ C s d ( S d ) as product of controlled shift (increment) operations. Then U M U_M U M is implemented by d d d double-controlled increment operations and their inverses, and PREP \operatorname{PREP} PREP and its inverse. The gate cost of implementing U M U_M U M is therefore G ( U M ) ∈ Θ ( d n ) \mathcal{G}(U_M)\in\Theta(dn) G ( U M ) ∈ Θ ( d n ) by Lemma 1. We have the same gate cost for U M ′ U_{M'} U M ′ .
To extend our construction to the general position-dependent case, we use the trick in § 3.2.4 that the position-dependent weight w a , s w_{a,s} w a , s is encoded in the state ∣ p o s ′ ⟩ |\mathrm{pos}'\rangle ∣ pos ′ ⟩ in Eq. (147) . Notice that
SEL ∣ p o s ′ ⟩ = 1 ∥ z ′ ∥ ∑ a , s z a w a , s ∣ s ⟩ ∣ x a + s ⟩ , (263) \operatorname{SEL}|\mathrm{pos}'\rangle= \frac{1}{\lVert z'\rVert}\sum_{a,s}z_aw_{a,s}|s\rangle|x_a+s\rangle, \tag*{(263)} SEL ∣ pos ′ ⟩ = ∥ z ′ ∥ 1 a , s ∑ z a w a , s ∣ s ⟩ ∣ x a + s ⟩ , (263)
so by Eq. (250) we have
⟨ + ∣ ⊗ d ⟨ u ∣ SEL ∣ p o s ′ ⟩ = 1 ∥ z ′ ∥ 2 d ∑ a , s z a w a , s u x a + s = 1 ∥ z ′ ∥ 2 d ∑ a z a u ˉ a = 2 E ∥ z ′ ∥ 2 d . (264) \langle+|^{\otimes d}\langle u|\operatorname{SEL}|\mathrm{pos}'\rangle= \frac{1}{\lVert z'\rVert\sqrt{2^d}}\sum_{a,s}z_aw_{a,s}u_{x_a+s} = \frac{1}{\lVert z'\rVert\sqrt{2^d}}\sum_a z_a\bar{u}_a = \frac{2E}{\lVert z'\rVert\sqrt{2^d}}. \tag*{(264)} ⟨ + ∣ ⊗ d ⟨ u ∣ SEL ∣ pos ′ ⟩ = ∥ z ′ ∥ 2 d 1 a , s ∑ z a w a , s u x a + s = ∥ z ′ ∥ 2 d 1 a ∑ z a u ˉ a = ∥ z ′ ∥ 2 d 2 E . (264)
To turn this overlap into an expectation value as the uniform case, we modify the unnormalized state ∣ ϕ ⟩ |\phi\rangle ∣ ϕ ⟩ and the measurement operator M M M as
∣ ϕ ⟩ → ∣ ϕ ⟩ = 1 2 ( ∣ 0 ⟩ ∣ + ⟩ d ∣ u ⟩ + ∣ 1 ⟩ ∣ p o s ′ ⟩ ) (265) |\phi\rangle\to|\phi\rangle= \frac{1}{\sqrt{2}}\left(|0\rangle|+\rangle^d|u\rangle+ |1\rangle|\mathrm{pos}'\rangle\right) \tag*{(265)} ∣ ϕ ⟩ → ∣ ϕ ⟩ = 2 1 ( ∣0 ⟩ ∣ + ⟩ d ∣ u ⟩ + ∣1 ⟩ ∣ pos ′ ⟩ ) (265)
M → M = ∣ 0 ⟩ ⟨ 1 ∣ ⊗ SEL + ∣ 1 ⟩ ⟨ 0 ∣ ⊗ SEL † . (266) M \to M = |0\rangle\langle1|\otimes\operatorname{SEL} + |1\rangle\langle0|\otimes\operatorname{SEL}^{\dagger}. \tag*{(266)} M → M = ∣0 ⟩ ⟨ 1∣ ⊗ SEL + ∣1 ⟩ ⟨ 0∣ ⊗ SEL † . (266)
With these changes, we have
E = 2 d 2 ∥ ξ ∥ ⟨ ϕ ∣ M ∣ ϕ ⟩ = 2 d 2 ξ ∥ ⟨ Ψ ∣ M ′ ∣ Ψ ⟩ . (267) E = \frac{\sqrt{2^d}}{2}\|\xi\|\langle\phi|M|\phi\rangle= \frac{\sqrt{2^d}}{2}\xi\|\langle\Psi|M'|\Psi\rangle. \tag*{(267)} E = 2 2 d ∥ ξ ∥ ⟨ ϕ ∣ M ∣ ϕ ⟩ = 2 2 d ξ ∥ ⟨ Ψ∣ M ′ ∣Ψ ⟩ . (267)
The second identity here follows as before, but with the modified state
∣ Ψ ⟩ → ∣ Ψ ⟩ = 1 2 ( ∣ 0 ⟩ ∣ + ⟩ d ∣ ψ ⟩ + ∣ 1 ⟩ ∣ χ ′ ⟩ ) , ∣ χ ′ ⟩ : = ∣ + + ⟩ ∣ p o s ′ ⟩ (268) |\Psi\rangle\to|\Psi\rangle= \frac{1}{\sqrt{2}}\left(|0\rangle|+\rangle^d|\psi\rangle+ |1\rangle|\chi'\rangle\right), \qquad|\chi'\rangle:= |++\rangle|\mathrm{pos}'\rangle \tag*{(268)} ∣Ψ ⟩ → ∣Ψ ⟩ = 2 1 ( ∣0 ⟩ ∣ + ⟩ d ∣ ψ ⟩ + ∣1 ⟩ ∣ χ ′ ⟩ ) , ∣ χ ′ ⟩ := ∣ + + ⟩ ∣ pos ′ ⟩ (268)
and the modified measurement operator in the extended space
M ′ → M ′ = ∣ 0 ⟩ ⟨ 1 ∣ ⊗ S E L ′ + ∣ 1 ⟩ ⟨ 0 ∣ ⊗ S E L ′ † , (269) M' \to M' = |0\rangle\langle1| \otimes\mathrm{SEL}' + |1\rangle\langle0| \otimes\mathrm{SEL}'^\dagger, \tag*{(269)} M ′ → M ′ = ∣0 ⟩ ⟨ 1∣ ⊗ SEL ′ + ∣1 ⟩ ⟨ 0∣ ⊗ SEL ′ † , (269)
S E L → S E L ′ : = ∑ s ∣ s ⟩ ⟨ s ∣ ⊗ I 2 ⊗ T s . (270) \mathrm{SEL} \to\mathrm{SEL}' := \sum_s |s\rangle\langle s| \otimes\mathbb{I}_2 \otimes T_s. \tag*{(270)} SEL → SEL ′ := s ∑ ∣ s ⟩ ⟨ s ∣ ⊗ I 2 ⊗ T s . (270)
We note that, as per § 3.2.3 , encoding the position-dependent weight w a , s w_{a,s} w a , s in the state ∣ p o s ′ ⟩ \lvert\mathrm{pos}'\rangle ∣ pos ′ ⟩ does not change the gate cost of preparing the initial state for a fixed d d d . Moreover, note that M M M and M ′ M' M ′ here are Hermitian and unitary as their select operations are unitary. Their block encodings are therefore trivial. That is, M M M and M ′ M' M ′ are ( 1 , 0 , 0 ) (1,0,0) ( 1 , 0 , 0 ) -block encoding of themselves. The cost of these block encodings is Θ ( d n ) \Theta(dn) Θ ( d n ) , which is the cost of implementing the select operation.
Solvation free energy
Our approach for computing the electrostatic free energy from the quantum solution of the Poisson-Boltzmann equation can be used to compute other quantities of interest, such as the solvation free energy [25 , 29 ] . This quantity is the difference between the electrostatic free energies of the biomolecule in two environments: a homogeneous reference environment, where the dielectric coefficient is constant in the entire domain and equal to that of the biomolecule, and an inhomogeneous solvated environment, where the biomolecule and the surrounding solvent have different dielectric coefficients. The solvation free energy can then be obtained by applying our algorithm to estimate the electrostatic free energy in each environment and subtracting the reference energy from the solvated energy.
The complete algorithm and its overall cost
The complete end-to-end quantum algorithm is obtained by composing the algorithms for preparing the initial state, generating the distributed quantum solution state, and extracting a property of the solution state. As summarized in Table 2 , the overall gate cost of the end-to-end quantum algorithm is determined by the gate cost G ε ( ψ ) \mathcal{G}_{\varepsilon}(\psi) G ε ( ψ ) of generating the quantum solution state ∣ ψ ⟩ \lvert\psi\rangle ∣ ψ ⟩ , which includes the cost of preparing the initial state, and the gate cost G ( U M ) \mathcal{G}(U_M) G ( U M ) of a block encoding of the observable M M M associated with a property of the solution state.
Table 2. Cost of an end-to-end algorithm based on three different approaches for estimating a property of the quantum solution with accuracy ϵ \epsilon ϵ and success probability at least 1 − δ 1-\delta 1 − δ . Here U ψ U_\psi U ψ is the unitary that prepares the n n n -qubit quantum solution state ∣ ψ ⟩ |\psi\rangle ∣ ψ ⟩ and U M U_M U M is a block encoding of an observable M M M using a a a qubits. Ancilla qubits here are only those used for property estimation. The overall cost is obtained by the cost of a single run times the number of runs.
In Eq. (199) , we obtained the gate cost G ε ( ψ ) \mathcal{G}_{\varepsilon}(\psi) G ε ( ψ ) in terms of the gate cost G ( U A p r e c ) \mathcal{G}(U_{A_{\mathrm{prec}}}) G ( U A prec ) of a block encoding of the preconditioned matrix. For our construction of the block encoding, we established in Eq. (246) that G ( U A p r e c ) ∈ O ( n 2 log 2 ( n / ε ) ) \mathcal{G}(U_{A_{\mathrm{prec}}}) \in O(n^2\log^2(n/\varepsilon)) G ( U A prec ) ∈ O ( n 2 log 2 ( n / ε )) . By these equations, we obtain the overall gate cost
G d i s t ∈ O ( n 4 log 4 ( n / ε ) ) (271) \mathcal{G}_{\mathrm{dist}} \in O\left(n^4\log^4(n/\varepsilon)\right) \tag*{(271)} G dist ∈ O ( n 4 log 4 ( n / ε ) ) (271)
for generating the distributed quantum solution, where n = log 2 N n=\log_2 N n = log 2 N with N N N the number of grid points per dimension. Moreover, as shown in § 3.4 , our block encoding of the observable M M M has the gate cost G ( U M ) ∈ Θ ( n ) \mathcal{G}(U_M)\in\Theta(n) G ( U M ) ∈ Θ ( n ) . Considering these costs and the number of uses of U ψ U_{\psi} U ψ (the unitary for preparing the solution state) and the observable block encoding U M U_M U M , as specified for each property-estimation method in Table 2 , we obtain the overall gate cost reported in Table 3 for our tailored end-to-end algorithm for simulating the biomolecular system.
Table 3. The gate cost and ancilla count of our end-to-end quantum algorithm for simulating the biomolecular system based on three different approaches for estimating a property of the quantum solution with accuracy ε \varepsilon ε and success probability at least 1 − δ 1-\delta 1 − δ . Scratchpad qubits are ancillary qubits that start from and return to zero. The ancilla count for block encodings is the sum of ancilla qubits used in block encodings of the PDE operator and observable.
We now consider the number of ancilla qubits used in the algorithm. As we established in § 3.3.5 , the number of ancilla qubits for block encoding of the preconditioned matrix is a p r e c ∈ Θ ( n + log ( n / ε ) ) a_{\mathrm{prec}}\in\Theta(n+\log(n/\varepsilon)) a prec ∈ Θ ( n + log ( n / ε )) . To block encode the inverse of this matrix, the QSVT construction uses one additional ancilla qubit; i.e., a i n v = a p r e c + 1 a_{\mathrm{inv}}=a_{\mathrm{prec}}+1 a inv = a prec + 1 . As discussed in § 3.4 , our block encoding of the observable M M M uses Θ ( 1 ) \Theta(1) Θ ( 1 ) ancilla qubits. Consequently, the overall ancilla count for block encodings, accounting for both the PDE operator and the observable, scales as Θ ( n + log ( n / ε ) ) \Theta(n+\log(n/\varepsilon)) Θ ( n + log ( n / ε )) . In addition, our construction for the block encoding of the preconditioned matrix uses Θ ( n log ( n / ε ) ) \Theta(n\log(n/\varepsilon)) Θ ( n log ( n / ε )) scratchpad qubits that start and return to zero state and are used for intermediate computation. These ancilla counts are summarized in Table 3 along with the ancilla qubits used by each property-estimation method specified in Table 2 .
As seen in Table 3 , the three approaches considered for property estimation exhibit different tradeoffs between gate cost, ancilla count, and number of circuit runs, but all approaches have circuit size and overall gate cost polylogarithmic in N N N . The Hadamard test only needs one ancilla qubit for property estimation and has a gate cost polylogarithmic in 1 / ε 1/\varepsilon 1/ ε per run. Achieving accuracy ε \varepsilon ε needs a quadratic number of runs in 1 / ε 1/\varepsilon 1/ ε . Phase estimation needs Θ ( log ( 1 / ε ) ) \Theta(\log(1/\varepsilon)) Θ ( log ( 1/ ε )) ancillas for property estimation and has an additional gate cost of Θ ( n / ε ) \Theta(n/\varepsilon) Θ ( n / ε ) per run, without reducing the scaling of the number of runs. In contrast, the amplitude-estimation approach improves the overall gate cost to quasilinear in 1 / ε 1/\varepsilon 1/ ε . Specifically, repeating the amplitude-estimation approach O ( log ( 1 / δ ) ) O(\log(1/\delta)) O ( log ( 1/ δ )) times yields an estimate with success probability 1 − δ 1-\delta 1 − δ , with an overall gate cost of O ( ( 1 / ε ) log 4 ( 1 / ε ) ) O((1/\varepsilon)\log^4(1/\varepsilon)) O (( 1/ ε ) log 4 ( 1/ ε )) per run. Alternatively, the desired estimate can be achieved in a single run, at an overall gate cost that scales linearly in 1 / δ 1/\delta 1/ δ .
In Figure 11 , we provide an illustrative comparison of the computational cost scaling of our end-to-end quantum algorithm with that of a classical algorithm that explicitly computes the solution vector of the LPB equation. For our quantum algorithm, we consider the amplitude-estimation approach, which achieves the best overall scaling
Figure 11. Illustrative comparison of computational cost scaling for solving the LPB equation. Left: Normalized cost of our end-to-end quantum algorithm, quantified as the number of gates used, compared with that of the classical algorithm based on the geometric multigrid method, quantified as the number of arithmetic operations. Each cost is normalized by the cost at the reference value N 0 = 250 N_0 = 250 N 0 = 250 to compare its relative growth with N N N . Three accuracy levels are considered: ε = 10 − 4 \varepsilon= 10^{-4} ε = 1 0 − 4 (red), 10 − 3 10^{-3} 1 0 − 3 (green) and 10 − 2 10^{-2} 1 0 − 2 (blue). The highlighted region indicates representative grid sizes of N = 250 N = 250 N = 250 –300 300 300 points per dimension used in classical computations for the LPB equation [43 ] . Right: The gate cost of generating the distributed quantum solution Eq. (271) compared with that of generating the conventional quantum solution Eq. (273) . The gate cost of the end-to-end quantum algorithm Eq. (272) is also shown. The plots illustrate only the cost scaling; the number of atoms N a t m N_{\mathrm{atm}} N atm and constant factors are not considered.
G E 2 E ∈ O ( ( n 4 / ε ) log 4 ( n / ε ) ) (272) \mathcal{G}_{\mathrm{E2E}} \in O\left((n^4/\varepsilon)\log^4(n/\varepsilon)\right) \tag*{(272)} G E2E ∈ O ( ( n 4 / ε ) log 4 ( n / ε ) ) (272)
for the gate cost of the end-to-end quantum algorithm. For the classical approach, we consider the geometric multigrid method, which has been established as an optimal classical solver for the LPB equation in biomolecular applications [43 , 44 , 45 ] . For the 3D problem discretized over N 3 N^3 N 3 grid points (N N N grid points per dimension), the computational cost of this method is bounded by O ( N 3 log ( N / ε ) ) O(N^3\log(N/\varepsilon)) O ( N 3 log ( N / ε )) arithmetic operations [43 , 46 ] , where ε \varepsilon ε is the relative error between the computed solution vector and the exact solution of the discretized system, measured in the Euclidean norm. This scaling is consistent with the numerical results in [45 ] , which demonstrate nearly linear dependence in the total number of grid points.
As the classical arithmetic operations and quantum gates are different computational resources, we compare the relative growth of their computational cost instead of their absolute scalings. Specifically, we compare the normalized computational cost defined as C n o r m ( N , ε ) = C ( N , ε ) / C ( N 0 , ε ) C_{\mathrm{norm}}(N,\varepsilon)=C(N,\varepsilon)/C(N_0,\varepsilon) C norm ( N , ε ) = C ( N , ε ) / C ( N 0 , ε ) , which normalizes the cost scaling C ( N , ε ) C(N,\varepsilon) C ( N , ε ) of each algorithm by the cost C ( N 0 , ε ) C(N_0,\varepsilon) C ( N 0 , ε ) at a reference size of N 0 N_0 N 0 . This normalization allows us to compare how the computational costs increase with grid size without treating classical arithmetic operations and quantum gates as equivalent computational resources.
We also provide an illustrative comparison of the gate cost scaling for generating our distributed quantum solution with that of generating the conventional quantum solution that directly encodes the solution vector in the amplitudes of a quantum state. Using the optimal quantum linear-system solver, generating the conventional quantum solution requires O ( κ log ( 1 / ε ) ) O(\kappa\log(1/\varepsilon)) O ( κ log ( 1/ ε )) queries to a block encoding of the discretized LPB operator. For the 3D problem, the condition number of the discretized operator scales as κ ∈ Θ ( N 2 ) \kappa\in\Theta(N^2) κ ∈ Θ ( N 2 ) . Combining this with Θ ( n 3 log n ) \Theta(n^3\log n) Θ ( n 3 log n ) gate cost we established in § 3.3.4 for implementing the block encoding of the discretized LPB operator, and the Θ ( n log n ) \Theta(n\log n) Θ ( n log n ) gate cost for loading the initial state in § 3.2 , we obtain a total gate cost
G c o n v ∈ O ( N 2 n 3 log n log ( 1 / ε ) ) (273) \mathcal{G}_{\mathrm{conv}} \in O\left(N^2n^3\log n\log(1/\varepsilon)\right) \tag*{(273)} G conv ∈ O ( N 2 n 3 log n log ( 1/ ε ) ) (273)
for generating the conventional quantum solution.
The comparison in Figure 11 illustrates the improved scaling of our approach with the grid size for three values of ε \varepsilon ε . Although the plots provide only illustrative estimates based on scaling (i.e., constant factors are not considered), they demonstrate a substantial reduction in the scaling of computational cost with grid size for solving the LPB equation using our quantum algorithm. The comparison also highlights the cost of extracting properties of the quantum solution as a key factor in the overall cost of the end-to-end quantum algorithm.
Discussion
We have constructed an explicit end-to-end quantum algorithm for the linearized Poisson-Boltzmann equation used in simulating biomolecular systems. Our construction provides tailored and efficient implementations for all steps of an end-to-end quantum algorithm, from preparing an appropriate initial state to generating a quantum encoding of the solution and estimating relevant properties of the system. Our work demonstrates how to overcome challenges of translating abstract quantum algorithms for differential equations into practical applications using a classical specification of the problem rather than abstract oracle inputs. Moreover, in constructing the algorithm, we have developed and implemented several algorithmic primitives for an end-to-end quantum algorithm that are applicable beyond the specific application considered in this work.
We developed a new discrete representation for differential operators with variable coefficients, which enables efficient construction of the operator oracles, particularly in more than one spatial dimension. We also utilized the multiscale structure of the wavelet-transformation matrix to directly implement a block encoding of the preconditioned discretized operator with a logarithmic normalization. This allows us to construct a concrete realization of the algorithm in [8 ] based on wavelet preconditioning for generating a distributed quantum solution of the LPB equation with a cost independent of the condition number of the discretized PDE operator. Indeed, with our construction of the block encoding of the preconditioned discretized operator, the algorithm can be realized for PDEs whose operators have the form of the Sturm-Liouville operator with variable and bounded coefficients.
We have also rigorously analyzed the gate cost of the complete end-to-end algorithm based on three approaches for property estimation. Our cost analysis for these approaches reveals an important tradeoff between the size of quantum circuits for implementing the algorithm and the overall computational cost. The approach based on Hadamard test offers simpler circuits with a polylogarithmic size in 1 / ε 1/\varepsilon 1/ ε and fewer ancilla qubits, whereas the approach based on amplitude estimation achieves a quadratic improvement in the dependence of the overall gate cost on 1 / ε 1/\varepsilon 1/ ε , at the expense of larger circuits. Phase estimation offers no improvement in the overall gate cost. These tradeoffs are particularly relevant for practical quantum computing, where circuit size, available qubits and the number of circuit runs impose different resource constraints. The preferred estimation method can therefore depend on the capabilities of the quantum hardware, even though all three approaches have the favorable polylogarithmic dependence on the number of grid points N N N .
Importantly, we have also accounted for the cost of classical preprocessing needed for constructing the quantum circuits for implementing the algorithm. For a fixed number of atoms, we showed that the cost of classical preprocessing is at most polylogarithmic in both N N N and 1 / ε 1/\varepsilon 1/ ε , and preserves the favorable scaling of the gate cost of the quantum algorithm. In our cost analysis, we treated N N N and ε \varepsilon ε as independent parameters, motivated by the fact that the spatial discretization of the biomolecular system is constrained by the molecular geometry, particularly the atom positions and van der Waals radii. The gate cost we report is therefore the cost of the quantum algorithm for solving the discretized problem.
The polylogarithmic dependence of the overall cost on N N N offers an exponential improvement in scaling with the grid size compared with classical algorithms that explicitly solve the discretized LPB equation, whose computational costs scale at least linearly with the total number of grid points N g = N 3 N_g = N^3 N g = N 3 . However, the extent of practical quantum advantage also depends on the desired accuracy, the molecular parameters, and other constants involved in the circuit constructions. In particular, although the algorithm based on amplitude estimation has the best overall scaling in ε \varepsilon ε among the other approaches considered, it has a larger circuit size that may constrain practical implementation. Our analysis therefore highlights the importance of distinguishing the size of quantum circuits for implementation from the overall cost of the algorithm when assessing the advantages of quantum algorithms.
While our work provides explicit circuits and rigorous resource bounds, further steps are needed for hardware implementation. In particular, obtaining concrete resource estimates for representative molecular systems will help determine the problem sizes and accuracy regimes for which the algorithm can become practically competitive. Overall, our results provide a basis for evaluating the potential for practical quantum advantage and lay the groundwork for future implementations on quantum hardware. Alongside recent developments in end-to-end quantum algorithms for other PDEs and physical applications [47 , 48 ] , our work contributes to bridging the gap between theoretical quantum algorithms for differential equations and their practical applications. Extending the techniques developed here to other applications and more general variable-coefficient PDEs is another important direction for future research.
Acknowledgments
M.B. thanks Kouhei Nakaji for insightful discussions. M.B. and A.A.G. acknowledge the generous support and funding of this project by the Defense Advanced Research Projects Agency (DARPA) under Contract No. HR00112330021. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the Defense Advanced Research Projects Agency. A.A.G. also acknowledges support from the Canada 150 Research Chairs program and NSERC-IRC. AAG also acknowledges the generous support of Anders G. Frøseth. G.K.B. received support from the Australian Research Council Discovery Project DP260104888.
AI usage disclosure. The idea and research direction of this project were conceived and developed by the authors. The original writing of the manuscript, as well as the design of the figures and circuits, was carried out by the authors, mainly by the first author. AI tools were used to polish the writing, find counterexamples to ideas of the authors, particularly regarding the structure of matrices in wavelet bases utilized for quantum implementations, and assist with the literature search for details of the biomolecular system and the ranges of values for its relevant parameters. The authors take full responsibility for the manuscript.
Proofs
Bound for systematic error in estimating a property of the quantum solution by QPE
Here we prove the error bound in Eq. (74) for the systematic error in estimating
μ = ⟨ ϕ ∣ U M ∣ ϕ ⟩ = ∑ j ∣ α j ∣ 2 e 2 π i θ j = ∑ j ∣ α j ∣ 2 cos ( 2 π θ j ) (274) \mu= \langle\phi| U_M | \phi\rangle= \sum_j |\alpha_j|^2 e^{2\pi i\theta_j} = \sum_j |\alpha_j|^2 \cos(2\pi\theta_j) \tag*{(274)} μ = ⟨ ϕ ∣ U M ∣ ϕ ⟩ = j ∑ ∣ α j ∣ 2 e 2 π i θ j = j ∑ ∣ α j ∣ 2 cos ( 2 π θ j ) (274)
by quantum phase estimation, where ∣ ϕ ⟩ = ∑ j α j ∣ v j ⟩ |\phi\rangle= \sum_j \alpha_j |v_j\rangle ∣ ϕ ⟩ = ∑ j α j ∣ v j ⟩ is the solution state. Recall that the outcome of measuring the t t t -qubit phase register is a random t t t -bit number B B B , from which we have the random variable X : = cos ( 2 π B / 2 t ) X := \cos(2\pi B/2^t) X := cos ( 2 π B / 2 t ) for estimating μ \mu μ . Let E ( X ∣ j ) \mathbb{E}(X|j) E ( X ∣ j ) be the average value obtained from all possible outcomes of the phase register conditioned on the target register being in the eigenstate ∣ v j ⟩ |v_j\rangle ∣ v j ⟩ . We show that E ( X ∣ j ) \mathbb{E}(X|j) E ( X ∣ j ) exponentially concentrates around cos ( 2 π θ j ) \cos(2\pi\theta_j) cos ( 2 π θ j ) as
E ( X ∣ j ) = ( 1 − 2 − t ) cos ( 2 π θ j ) + 2 − t cos ( 2 π ( 2 t − 1 ) θ j ) . (275) \mathbb{E}(X|j) = (1 - 2^{-t})\cos(2\pi\theta_j) + 2^{-t}\cos(2\pi(2^t - 1)\theta_j). \tag*{(275)} E ( X ∣ j ) = ( 1 − 2 − t ) cos ( 2 π θ j ) + 2 − t cos ( 2 π ( 2 t − 1 ) θ j ) . (275)
By this equation, the systematic error due to the t t t -bit approximation for each phase is bounded as
∣ E ( X ∣ j ) − cos ( 2 π θ j ) ∣ ≤ 2 1 − t . (276) |\mathbb{E}(X|j) - \cos(2\pi\theta_j)| \le2^{1-t}. \tag*{(276)} ∣ E ( X ∣ j ) − cos ( 2 π θ j ) ∣ ≤ 2 1 − t . (276)
As this bound is independent of j j j , it gives ∣ E ( X ) − μ ∣ ≤ 2 1 − t |\mathbb{E}(X)-\mu| \le2^{1-t} ∣ E ( X ) − μ ∣ ≤ 2 1 − t as
∣ E ( X ) − μ ∣ = ∣ ∑ j ∣ α j ∣ 2 ( E ( X ∣ j ) − cos ( 2 π θ j ) ) ∣ ≤ ∑ j ∣ α j ∣ 2 2 1 − t = 2 1 − t . (277) |\mathbb{E}(X)-\mu|=\left|\sum_j |\alpha_j|^2\left(\mathbb{E}(X|j)-\cos(2\pi\theta_j)\right)\right| \le\sum_j |\alpha_j|^2 2^{1-t}=2^{1-t}. \tag*{(277)} ∣ E ( X ) − μ ∣ = j ∑ ∣ α j ∣ 2 ( E ( X ∣ j ) − cos ( 2 π θ j ) ) ≤ j ∑ ∣ α j ∣ 2 2 1 − t = 2 1 − t . (277)
To show the concentration in Eq. (275) , we first consider the average E ( exp ( 2 π i B / 2 t ) ∣ j ) \mathbb{E}(\exp(2\pi iB/2^t)|j) E ( exp ( 2 π i B / 2 t ) ∣ j ) and then take its real part. Note that the joint state of the phase and target registers before the inverse QFT is ∑ j α j ∣ ϕ j ⟩ ∣ v j ⟩ \sum_j \alpha_j|\phi_j\rangle|v_j\rangle ∑ j α j ∣ ϕ j ⟩ ∣ v j ⟩ , where
∣ ϕ j ⟩ : = ∑ k = 0 2 t − 1 a k ∣ k ⟩ with a k : = 1 2 t e 2 π i k θ j (278) |\phi_j\rangle:=\sum_{k=0}^{2^t-1}a_k|k\rangle\quad\text{with}\quad a_k:=\frac{1}{\sqrt{2^t}}e^{2\pi i k\theta_j} \tag*{(278)} ∣ ϕ j ⟩ := k = 0 ∑ 2 t − 1 a k ∣ k ⟩ with a k := 2 t 1 e 2 π ik θ j (278)
is the state of the phase register if the target register is in the eigenstate ∣ v j ⟩ |v_j\rangle ∣ v j ⟩ . After the inverse QFT
∣ ϕ j ⟩ ↦ ∣ ψ j ⟩ : = F 2 t † ∣ ϕ j ⟩ , (279) |\phi_j\rangle\mapsto|\psi_j\rangle:=F_{2^t}^{\dagger}|\phi_j\rangle, \tag*{(279)} ∣ ϕ j ⟩ ↦ ∣ ψ j ⟩ := F 2 t † ∣ ϕ j ⟩ , (279)
where
F 2 t ∣ k ⟩ = 1 2 t ∑ b = 0 2 t − 1 e 2 π i k b / 2 t ∣ b ⟩ (280) F_{2^t}|k\rangle=\frac{1}{\sqrt{2^t}}\sum_{b=0}^{2^t-1}e^{2\pi i kb/2^t}|b\rangle \tag*{(280)} F 2 t ∣ k ⟩ = 2 t 1 b = 0 ∑ 2 t − 1 e 2 π ik b / 2 t ∣ b ⟩ (280)
is the 2 t 2^t 2 t -dimensional quantum Fourier transform. Measuring the phase qubits gives the random variable B B B , and the probability of outcome B = b B=b B = b conditioned on target register being in the eigenstate ∣ v j ⟩ |v_j\rangle ∣ v j ⟩ is
Pr ( B = b ∣ j ) = ∣ ⟨ b ∣ ψ j ⟩ ∣ 2 = ⟨ ψ j ∣ b ⟩ ⟨ b ∣ ψ j ⟩ . (281) \Pr(B=b|j)=|\langle b|\psi_j\rangle|^2=\langle\psi_j|b\rangle\langle b|\psi_j\rangle. \tag*{(281)} Pr ( B = b ∣ j ) = ∣ ⟨ b ∣ ψ j ⟩ ∣ 2 = ⟨ ψ j ∣ b ⟩ ⟨ b ∣ ψ j ⟩ . (281)
We therefore have
E ( e 2 π i B / 2 t ∣ j ) = ∑ b = 0 2 t − 1 e 2 π i b / 2 t ⟨ ψ j ∣ b ⟩ ⟨ b ∣ ψ j ⟩ (282) \mathbb{E}\left(e^{2\pi iB/2^t}|j\right)=\sum_{b=0}^{2^t-1}e^{2\pi ib/2^t}\langle\psi_j|b\rangle\langle b|\psi_j\rangle \tag*{(282)} E ( e 2 π i B / 2 t ∣ j ) = b = 0 ∑ 2 t − 1 e 2 π ib / 2 t ⟨ ψ j ∣ b ⟩ ⟨ b ∣ ψ j ⟩ (282)
= ⟨ ψ j ∣ D ∣ ψ j ⟩ = ⟨ ϕ j ∣ F 2 t D F 2 t † ∣ ϕ j ⟩ (283) =\langle\psi_j|D|\psi_j\rangle=\langle\phi_j|F_{2^t}DF_{2^t}^{\dagger}|\phi_j\rangle \tag*{(283)} = ⟨ ψ j ∣ D ∣ ψ j ⟩ = ⟨ ϕ j ∣ F 2 t D F 2 t † ∣ ϕ j ⟩ (283)
where D : = ∑ b exp ( 2 π i b / 2 t ) ∣ b ⟩ ⟨ b ∣ D:=\sum_b\exp(2\pi ib/2^t)|b\rangle\langle b| D := ∑ b exp ( 2 π ib / 2 t ) ∣ b ⟩ ⟨ b ∣ is a diagonal unitary. Then it simply follows that
F 2 t D F 2 t † ∣ k ⟩ = ∣ k − 1 m o d 2 t ⟩ , (284) F_{2^t}DF_{2^t}^{\dagger}|k\rangle=|k-1\bmod2^t\rangle, \tag*{(284)} F 2 t D F 2 t † ∣ k ⟩ = ∣ k − 1 mod 2 t ⟩ , (284)
i.e., F 2 t D F 2 t † F_{2^t}DF_{2^t}^{\dagger} F 2 t D F 2 t † acts as a cyclic shift operator, and so we have
⟨ Φ j ∣ F 2 t D F 2 t † ∣ Φ j ⟩ = ∑ k = 0 2 t − 2 a k ∗ a k + 1 + a 2 t − 1 ∗ a 0 (285) \langle\Phi_j|F_{2^t}DF_{2^t}^{\dagger}|\Phi_j\rangle=\sum_{k=0}^{2^t-2}a_k^*a_{k+1}+a_{2^t-1}^*a_0 \tag*{(285)} ⟨ Φ j ∣ F 2 t D F 2 t † ∣ Φ j ⟩ = k = 0 ∑ 2 t − 2 a k ∗ a k + 1 + a 2 t − 1 ∗ a 0 (285)
= 1 2 t ∑ k = 0 2 t − 2 e 2 π i θ j + 1 2 t e − 2 π i ( 2 t − 1 ) θ j (286) =\frac{1}{2^t}\sum_{k=0}^{2^t-2}e^{2\pi i\theta_j}+\frac{1}{2^t}e^{-2\pi i(2^t-1)\theta_j} \tag*{(286)} = 2 t 1 k = 0 ∑ 2 t − 2 e 2 π i θ j + 2 t 1 e − 2 π i ( 2 t − 1 ) θ j (286)
= ( 1 − 2 − t ) e 2 π i θ j + 2 − t e − 2 π i ( 2 t − 1 ) θ j . (287) =\left(1-2^{-t}\right)e^{2\pi i\theta_j}+2^{-t}e^{-2\pi i(2^t-1)\theta_j}. \tag*{(287)} = ( 1 − 2 − t ) e 2 π i θ j + 2 − t e − 2 π i ( 2 t − 1 ) θ j . (287)
Taking the real part gives Eq. (275) .
Combined success probability of the lower and upper phase estimates
Here we show the success probability in one run of the QPE in the amplitude-estimation approach (§ 2.5.4 ) for computing solution properties can be increased from 4 / π 2 4/\pi^2 4/ π 2 to 8 / π 2 8/\pi^2 8/ π 2 if we increase the maximum error in the phase estimate from 1 / 2 t + 1 1/2^{t+1} 1/ 2 t + 1 to 1 / 2 t 1/2^t 1/ 2 t . To this end, let ϕ ∈ { θ , 1 − θ } ∈ [ 0 , 1 ] \phi\in\{\theta,1-\theta\}\in[0,1] ϕ ∈ { θ , 1 − θ } ∈ [ 0 , 1 ] denote either of the two eigenphases of the rotation operator S S S , with the corresponding eigenvalue exp ( 2 π i ϕ ) \exp(2\pi i\phi) exp ( 2 π i ϕ ) . Let us also define
ϕ − : = ⌊ 2 t ϕ ⌋ 2 t , ϕ + : = ⌈ 2 t ϕ ⌉ 2 t (288) \phi_-:=\frac{\lfloor2^t\phi\rfloor}{2^t},\qquad\phi_+:=\frac{\lceil2^t\phi\rceil}{2^t} \tag*{(288)} ϕ − := 2 t ⌊ 2 t ϕ ⌋ , ϕ + := 2 t ⌈ 2 t ϕ ⌉ (288)
as the lower and upper t t t -bit estimates of ϕ \phi ϕ . When 2 t ϕ 2^t\phi 2 t ϕ is not an integer, we have ϕ ∈ ( ϕ − , ϕ + ) \phi\in(\phi_-,\phi_+) ϕ ∈ ( ϕ − , ϕ + ) and ϕ + − ϕ − = 1 / 2 t \phi_+ - \phi_- = 1/2^t ϕ + − ϕ − = 1/ 2 t .
The outcome of measuring the t t t -qubit phase register is a random variable B ∈ { 0 , … , 2 t − 1 } B \in\{0,\ldots,2^t-1\} B ∈ { 0 , … , 2 t − 1 } . If the measurement outcomes is B = ⌊ 2 t ϕ ⌋ B = \lfloor2^t\phi\rfloor B = ⌊ 2 t ϕ ⌋ or B = ⌈ 2 t ϕ ⌉ B = \lceil2^t\phi\rceil B = ⌈ 2 t ϕ ⌉ , the measured phase estimate ϕ ~ = B / 2 t \tilde{\phi} = B/2^t ϕ ~ = B / 2 t equals to ϕ − \phi_- ϕ − or ϕ + \phi_+ ϕ + , respectively. That is to day, ϕ ± \phi_{\pm} ϕ ± are two particular values that the phase estimate ϕ ~ \tilde{\phi} ϕ ~ can take. The probability of the outcome B = b B=b B = b is
Pr ( B = b ) = ∣ 1 2 t ∑ k = 0 2 t − 1 e 2 π i k ( ϕ − b / 2 t ) ∣ 2 = 1 2 2 t ∣ 1 − e 2 π i ( 2 t ϕ − b ) 1 − e 2 π i ( ϕ − b / 2 t ) ∣ 2 = sin 2 ( π ( 2 t ϕ − b ) ) 2 2 t sin 2 ( π ( 2 t ϕ − b ) / 2 t ) . (289) \Pr(B=b)=\left|\frac{1}{2^t}\sum_{k=0}^{2^t-1}e^{2\pi ik(\phi-b/2^t)}\right|^2=\frac{1}{2^{2t}}\left|\frac{1-e^{2\pi i(2^t\phi-b)}}{1-e^{2\pi i(\phi-b/2^t)}}\right|^2=\frac{\sin^2(\pi(2^t\phi-b))}{2^{2t}\sin^2(\pi(2^t\phi-b)/2^t)}. \tag*{(289)} Pr ( B = b ) = 2 t 1 k = 0 ∑ 2 t − 1 e 2 π ik ( ϕ − b / 2 t ) 2 = 2 2 t 1 1 − e 2 π i ( ϕ − b / 2 t ) 1 − e 2 π i ( 2 t ϕ − b ) 2 = 2 2 t sin 2 ( π ( 2 t ϕ − b ) / 2 t ) sin 2 ( π ( 2 t ϕ − b )) . (289)
where we used the geometric series sum in the second identity and ∣ 1 − exp ( 2 i x ) ∣ = 2 ∣ sin ( x ) ∣ |1-\exp(2ix)|=2|\sin(x)| ∣1 − exp ( 2 i x ) ∣ = 2∣ sin ( x ) ∣ in the last identity.
If we consider the nearest integer b = ⌊ 2 t ϕ ⌉ b=\lfloor2^t\phi\rceil b = ⌊ 2 t ϕ ⌉ to 2 t ϕ 2^t\phi 2 t ϕ , as conventional in QPE, we obtain an estimate of the phase with error at most 1 / 2 t + 1 1/2^{t+1} 1/ 2 t + 1 and the success probability at least 4 / π 2 4/\pi^2 4/ π 2 . To see this, let Δ : = 2 t ϕ − ⌊ 2 t ϕ ⌉ \Delta:=2^t\phi-\lfloor2^t\phi\rceil Δ := 2 t ϕ − ⌊ 2 t ϕ ⌉ and note that ∣ Δ ∣ ≤ 1 / 2 |\Delta|\leq1/2 ∣Δ∣ ≤ 1/2 as ⌊ 2 t ϕ ⌉ \lfloor2^t\phi\rceil ⌊ 2 t ϕ ⌉ is the nearest integer. Then the error in the phase estimate ϕ ~ = ⌊ 2 t ϕ ⌉ / 2 t \tilde{\phi}=\lfloor2^t\phi\rceil/2^t ϕ ~ = ⌊ 2 t ϕ ⌉ / 2 t is
∣ ϕ ~ − ϕ ∣ = 1 2 t ∣ Δ ∣ ≤ 1 2 t + 1 , (290) |\tilde{\phi}-\phi|=\frac{1}{2^t}|\Delta|\leq\frac{1}{2^{t+1}}, \tag*{(290)} ∣ ϕ ~ − ϕ ∣ = 2 t 1 ∣Δ∣ ≤ 2 t + 1 1 , (290)
and the success probability, i.e., the probability that ∣ ϕ ~ − ϕ ∣ ≤ 1 / 2 t + 1 |\tilde{\phi}-\phi|\leq1/2^{t+1} ∣ ϕ ~ − ϕ ∣ ≤ 1/ 2 t + 1 , is
Pr ( ∣ ϕ ~ − ϕ ∣ ≤ 1 2 t + 1 ) = Pr ( B = ⌊ 2 t ϕ ⌉ ) = sin 2 ( π Δ ) 2 2 t sin 2 ( π Δ / 2 t ) ≥ sin 2 ( π Δ ) π 2 Δ 2 ≥ 4 π 2 . (291) \Pr\left(|\tilde{\phi}-\phi|\leq\frac{1}{2^{t+1}}\right)=\Pr(B=\lfloor2^t\phi\rceil)=\frac{\sin^2(\pi\Delta)}{2^{2t}\sin^2(\pi\Delta/2^t)}\geq\frac{\sin^2(\pi\Delta)}{\pi^2\Delta^2}\geq\frac{4}{\pi^2}. \tag*{(291)} Pr ( ∣ ϕ ~ − ϕ ∣ ≤ 2 t + 1 1 ) = Pr ( B = ⌊ 2 t ϕ ⌉) = 2 2 t sin 2 ( π Δ/ 2 t ) sin 2 ( π Δ ) ≥ π 2 Δ 2 sin 2 ( π Δ ) ≥ π 2 4 . (291)
where we used ∣ sin x ∣ ≤ ∣ x ∣ |\sin x|\leq|x| ∣ sin x ∣ ≤ ∣ x ∣ in the first inequality and ∣ sin ( π Δ ) ∣ / ∣ Δ ∣ ≥ 2 |\sin(\pi\Delta)|/|\Delta|\geq2 ∣ sin ( π Δ ) ∣/∣Δ∣ ≥ 2 for ∣ Δ ∣ ≤ 1 / 2 |\Delta|\leq1/2 ∣Δ∣ ≤ 1/2 in the second inequality.
We can increase the success probability if we allow the phase error to be at most 2 − t 2^{-t} 2 − t . In this case, both the lower and upper phase estimates ϕ ± \phi_{\pm} ϕ ± become successful phase estimates as ∣ ϕ ± − ϕ ∣ ≤ 2 − t |\phi_{\pm}-\phi|\leq2^{-t} ∣ ϕ ± − ϕ ∣ ≤ 2 − t , so the success probability is the probability that the measured phase estimate ϕ ~ \tilde{\phi} ϕ ~ is either ϕ − \phi_- ϕ − or ϕ + \phi_+ ϕ + , which correspond to measurement outcomes B = ⌊ 2 t ϕ ⌋ B=\lfloor2^t\phi\rfloor B = ⌊ 2 t ϕ ⌋ or B = ⌈ 2 t ϕ ⌉ B=\lceil2^t\phi\rceil B = ⌈ 2 t ϕ ⌉ , respectively. Specifically, we have
Pr ( ∣ ϕ ~ − ϕ ∣ ≤ 1 2 t ) = Pr ( B = ⌊ 2 t ϕ ⌋ ) + Pr ( B = ⌈ 2 t ϕ ⌉ ) . (292) \Pr\left(|\tilde{\phi}-\phi|\leq\frac{1}{2^t}\right)=\Pr(B=\lfloor2^t\phi\rfloor)+\Pr(B=\lceil2^t\phi\rceil). \tag*{(292)} Pr ( ∣ ϕ ~ − ϕ ∣ ≤ 2 t 1 ) = Pr ( B = ⌊ 2 t ϕ ⌋) + Pr ( B = ⌈ 2 t ϕ ⌉) . (292)
Now let x : = 2 t ϕ − ⌊ 2 t ϕ ⌋ ∈ [ 0 , 1 ] x:=2^t\phi-\lfloor2^t\phi\rfloor\in[0,1] x := 2 t ϕ − ⌊ 2 t ϕ ⌋ ∈ [ 0 , 1 ] , then 2 t ϕ − ⌈ 2 t ϕ ⌉ = x − 1 2^t\phi-\lceil2^t\phi\rceil=x-1 2 t ϕ − ⌈ 2 t ϕ ⌉ = x − 1 , and the combined success probability of obtaining the lower and upper phase estimates is
Pr ( B = ⌊ 2 t ϕ ⌋ ) + Pr ( B = ⌈ 2 t ϕ ⌉ ) ≥ sin 2 ( π x ) π 2 x 2 + sin 2 ( π ( x − 1 ) ) π 2 ( x − 1 ) 2 = sin 2 ( π x ) π 2 ( 1 x 2 + 1 ( x − 1 ) 2 ) . (293) \Pr(B=\lfloor2^t\phi\rfloor)+\Pr(B=\lceil2^t\phi\rceil)\geq\frac{\sin^2(\pi x)}{\pi^2x^2}+\frac{\sin^2(\pi(x-1))}{\pi^2(x-1)^2}=\frac{\sin^2(\pi x)}{\pi^2}\left(\frac{1}{x^2}+\frac{1}{(x-1)^2}\right). \tag*{(293)} Pr ( B = ⌊ 2 t ϕ ⌋) + Pr ( B = ⌈ 2 t ϕ ⌉) ≥ π 2 x 2 sin 2 ( π x ) + π 2 ( x − 1 ) 2 sin 2 ( π ( x − 1 )) = π 2 sin 2 ( π x ) ( x 2 1 + ( x − 1 ) 2 1 ) . (293)
The minimum of the right-hand side is at x = 1 / 2 x=1/2 x = 1/2 , so the success probability becomes at least 8 / π 2 8/\pi^2 8/ π 2 .
Implementing the multi-controlled reflection operator with one dirty ancilla
Let R n : = 1 n − 2 ∣ 0 n ⟩ ⟨ 0 n ∣ R_n:=\mathbb{1}_n-2|0^n\rangle\langle0^n| R n := 1 n − 2∣ 0 n ⟩ ⟨ 0 n ∣ be the reflection operator about the n n n -qubit zero state ∣ 0 n ⟩ |0^n\rangle ∣ 0 n ⟩ up to the global phase − 1 -1 − 1 , and let
C k ( R n ) : = ∣ 1 k ⟩ ⟨ 1 k ∣ ⊗ R n + ( 1 k − ∣ 1 k ⟩ ⟨ 1 k ∣ ) ⊗ 1 n (294) C^k(R_n):=|1^k\rangle\langle1^k|\otimes R_n+(\mathbb{1}_k-|1^k\rangle\langle1^k|)\otimes\mathbb{1}_n \tag*{(294)} C k ( R n ) := ∣ 1 k ⟩ ⟨ 1 k ∣ ⊗ R n + ( 1 k − ∣ 1 k ⟩ ⟨ 1 k ∣ ) ⊗ 1 n (294)
be the k k k -controlled reflection about ∣ 0 n ⟩ |0^n\rangle ∣ 0 n ⟩ of the n n n -qubit target register. Note that R 0 n R_0^n R 0 n only applies the phase − 1 -1 − 1 to ∣ 0 n ⟩ |0^n\rangle ∣ 0 n ⟩ and leaves all other basis states unchanged. A simple implementation for this multi-controlled reflection is then as follows.
We first map ∣ 0 n ⟩ → ∣ 1 n ⟩ |0^n\rangle\to|1^n\rangle ∣ 0 n ⟩ → ∣ 1 n ⟩ by applying X X X gate on each qubit of the target register. Then we apply the m m m -controlled Z Z Z gate denoted by C m ( Z ) C^m(Z) C m ( Z ) , with m = k + n − 1 m=k+n-1 m = k + n − 1 , where the target is the last qubit of the target register and the m m m controls are qubits of the k k k qubits of the control register and the first n − 1 n-1 n − 1 qubits of the target register. Finally, we reapply the X X X gates. Using Z = H X H Z=HXH Z = H X H , we replace C m ( Z ) C^m(Z) C m ( Z ) with C m ( X ) C^m(X) C m ( X ) by applying the Hadamard gate H H H before and after C m ( X ) C^m(X) C m ( X ) on the last qubit of the target register. Implementing the k k k -controlled reflection is now reduced to implementing the m m m -controlled NOT gate C m ( X ) C^m(X) C m ( X ) . By Lemma 4 , C m ( X ) C^m(X) C m ( X ) can be implemented with Θ ( k + n ) \Theta(k+n) Θ ( k + n ) gates from { X , C N O T , T o f f o l i } \{X,\mathrm{CNOT},\mathrm{Toffoli}\} { X , CNOT , Toffoli } and Θ ( log ( k + n ) ) \Theta(\log(k+n)) Θ ( log ( k + n )) circuit depth, using one dirty ancilla qubit.
For the generalized reflection R n ( θ ) : = 1 n − ( 1 − e i θ ) ∣ 0 n ⟩ ⟨ 0 n ∣ R_n(\theta):=\mathbb{1}_n-(1-e^{i\theta})|0^n\rangle\langle0^n| R n ( θ ) := 1 n − ( 1 − e i θ ) ∣ 0 n ⟩ ⟨ 0 n ∣ , we replace C k ( R n ) C^k(R_n) C k ( R n ) with C k ( R n ( θ ) ) C^k(R_n(\theta)) C k ( R n ( θ )) in the above equation. In this case, we need to apply the phase gate P ( θ ) = diag ( 1 , e i θ ) P(\theta)=\operatorname{diag}(1,e^{i\theta}) P ( θ ) = diag ( 1 , e i θ ) . If θ = π \theta=\pi θ = π , we have P ( θ ) = Z P(\theta)=Z P ( θ ) = Z , and we can replace Z Z Z with H X H HXH H X H , but this trick does not work for P ( θ ) P(\theta) P ( θ ) with general phase θ \theta θ . In this case, we simply use a clean ancilla qubit f f f to implement the k k k -controlled generalized reflection. To this end, after applying X X X gate on each qubit of the target register, we simply C k + n ( X ) C^{k+n}(X) C k + n ( X ) with the clean ancilla f f f as target. We then apply the phase gate P ( θ ) P(\theta) P ( θ ) on the ancilla and then erase the ancilla by C k + n ( X ) C^{k+n}(X) C k + n ( X ) . Finally, we reapply the X X X gates. Notice that for θ = π \theta=\pi θ = π , this approach implements the ordinary reflection, but using a clean ancilla. The generalized version then can be implemented with Θ ( k + n ) \Theta(k+n) Θ ( k + n ) gates from { X , C N O T , T o f f o l i } \{X,\mathrm{CNOT},\mathrm{Toffoli}\} { X , CNOT , Toffoli } and Θ ( log ( k + n ) ) \Theta(\log(k+n)) Θ ( log ( k + n )) circuit depth, using one dirty ancilla and one clean ancilla.
Uniform bound on the condition number of the preconditioned matrix
Here we analytically prove a uniform upper bound on the condition number of A P A_P A P . To this end, recall that
A = ∑ ν = 0 d − 1 D ν T E ν D ν + K , (295) A = \sum_{\nu=0}^{d-1} D_\nu^T E_\nu D_\nu+ K, \tag*{(295)} A = ν = 0 ∑ d − 1 D ν T E ν D ν + K , (295)
where the coefficient matrices E ν E_\nu E ν and K K K are bounded as
ε min 1 ⪯ E ν ⪯ ε max 1 , 0 ⪯ K ≺ k max 1 , (296) \varepsilon_{\min}\mathbf{1} \preceq E_\nu\preceq\varepsilon_{\max}\mathbf{1}, \quad0 \preceq K \prec k_{\max}\mathbf{1}, \tag*{(296)} ε m i n 1 ⪯ E ν ⪯ ε m a x 1 , 0 ⪯ K ≺ k m a x 1 , (296)
as per Eq. (89) with ( ε min , ε max ) = ( ε c a v , ε o u t ) (\varepsilon_{\min},\varepsilon_{\max})=(\varepsilon_{\mathrm{cav}},\varepsilon_{\mathrm{out}}) ( ε m i n , ε m a x ) = ( ε cav , ε out ) and k max = ε o u t κ o u t 2 k_{\max}=\varepsilon_{\mathrm{out}}\kappa_{\mathrm{out}}^2 k m a x = ε out κ out 2 ; here ⪯ \preceq ⪯ denotes the Loewner order for Hermitian matrices. We then have
ε min L ⪯ A ⪯ ε max L + k max 1 , (297) \varepsilon_{\min}L \preceq A \preceq\varepsilon_{\max}L+k_{\max}\mathbf{1}, \tag*{(297)} ε m i n L ⪯ A ⪯ ε m a x L + k m a x 1 , (297)
where L = ∑ ν D ν T D ν L=\sum_\nu D_\nu^T D_\nu L = ∑ ν D ν T D ν is the Laplacian matrix that represents the discretized Laplacian operator on the gird with periodic boundaries. By the lower bound A ⪰ ε min L A \succeq\varepsilon_{\min}L A ⪰ ε m i n L , we obtain
A P = P W A W † P ⪰ ε min L P → λ min ( A P ) ≥ ε min λ min ( L P ) , (298) A_P = P W A W^\dagger P \succeq\varepsilon_{\min}L_P \to\lambda_{\min}(A_P) \geq\varepsilon_{\min}\lambda_{\min}(L_P), \tag*{(298)} A P = P W A W † P ⪰ ε m i n L P → λ m i n ( A P ) ≥ ε m i n λ m i n ( L P ) , (298)
where L P L_P L P is the preconditioned Laplacian matrix. Moreover, by the upper bound on A A A and by P 2 ⪯ 1 P^2 \preceq1 P 2 ⪯ 1 , we obtain
A P ⪯ ε max L P + k max 1 → λ max ( A P ) ≤ ε max λ max ( L P ) + k max . (299) A_P \preceq\varepsilon_{\max}L_P+k_{\max}\mathbf{1} \to\lambda_{\max}(A_P) \leq\varepsilon_{\max}\lambda_{\max}(L_P)+k_{\max}. \tag*{(299)} A P ⪯ ε m a x L P + k m a x 1 → λ m a x ( A P ) ≤ ε m a x λ m a x ( L P ) + k m a x . (299)
We therefore have
κ ( A P ) = λ max ( A P ) λ min ( A P ) ≤ ε max ε min κ ( L P ) + k max 8 ε min L 2 (300) \kappa(A_P)=\frac{\lambda_{\max}(A_P)}{\lambda_{\min}(A_P)} \leq\frac{\varepsilon_{\max}}{\varepsilon_{\min}}\kappa(L_P)+\frac{k_{\max}}{8\varepsilon_{\min}}L^2 \tag*{(300)} κ ( A P ) = λ m i n ( A P ) λ m a x ( A P ) ≤ ε m i n ε m a x κ ( L P ) + 8 ε m i n k m a x L 2 (300)
where L L L is the side length of the computational domain Ω = ( 0 , L ) 3 \Omega=(0,L)^3 Ω = ( 0 , L ) 3 for the Poisson-Boltzmann equation. Here we used the fact that λ min ( L P ) ≥ 8 / L 2 \lambda_{\min}(L_P)\geq8/L^2 λ m i n ( L P ) ≥ 8/ L 2 . This provides a uniform bound for A P A_P A P , independent of the biomolecule used.
Proof of lemmas for block encoding of the preconditioned matrix
Proof of Lemma 6. We first show that the first column of D s = ( S s + 1 − 1 s + 1 ) G s † D_s=(S_{s+1}-\mathbf{1}_{s+1})G_s^\dagger D s = ( S s + 1 − 1 s + 1 ) G s † has at most M + 1 M+1 M + 1 nonzero elements, where M M M is the order of the wavelet used. Specifically, let us write D s ∣ 0 s ⟩ = ∑ r = 0 2 s + 1 − 1 d r ∣ r ⟩ D_s\lvert0^s\rangle=\sum_{r=0}^{2^{s+1}-1}d_r\lvert r\rangle D s ∣ 0 s ⟩ = ∑ r = 0 2 s + 1 − 1 d r ∣ r ⟩ , then we show the coefficient d r ≠ 0 d_r\ne0 d r = 0 only for 0 ≤ r ≤ M 0\leq r\leq M 0 ≤ r ≤ M . To this end, note that
G s † ∣ 0 s ⟩ = ∑ ℓ = 0 M − 1 g ℓ ∣ ℓ m o d 2 s + 1 ⟩ , (301) G_s^\dagger\lvert0^s\rangle=\sum_{\ell=0}^{M-1}g_\ell\lvert\ell\bmod2^{s+1}\rangle, \tag*{(301)} G s † ∣ 0 s ⟩ = ℓ = 0 ∑ M − 1 g ℓ ∣ ℓ mod 2 s + 1 ⟩ , (301)
where g ℓ = ( − 1 ) ℓ h M − 1 − ℓ g_\ell=(-1)^\ell h_{M-1-\ell} g ℓ = ( − 1 ) ℓ h M − 1 − ℓ and h ℓ h_\ell h ℓ are the wavelet filter coefficients. By this equation, we obtain
D s ∣ 0 s ⟩ = ( S s + 1 − 1 s + 1 ) G s † ∣ 0 s ⟩ = ∑ ℓ = 0 M − 1 g ℓ ( ∣ ℓ + 1 m o d 2 s + 1 ⟩ − ∣ ℓ m o d 2 s + 1 ⟩ ) . (302) D_s\lvert0^s\rangle=(S_{s+1}-\mathbf{1}_{s+1})G_s^\dagger\lvert0^s\rangle=\sum_{\ell=0}^{M-1}g_\ell(\lvert\ell+1\bmod2^{s+1}\rangle-\lvert\ell\bmod2^{s+1}\rangle). \tag*{(302)} D s ∣ 0 s ⟩ = ( S s + 1 − 1 s + 1 ) G s † ∣ 0 s ⟩ = ℓ = 0 ∑ M − 1 g ℓ (∣ ℓ + 1 mod 2 s + 1 ⟩ − ∣ ℓ mod 2 s + 1 ⟩) . (302)
If 2 s + 1 > M 2^{s+1}>M 2 s + 1 > M , then D s ∣ 0 s ⟩ = ∑ ℓ g ℓ ( ∣ ℓ + 1 ⟩ − ∣ ℓ ⟩ ) = ∑ r d r ∣ r ⟩ D_s\lvert0^s\rangle=\sum_\ell g_\ell(\lvert\ell+1\rangle-\lvert\ell\rangle)=\sum_r d_r\lvert r\rangle D s ∣ 0 s ⟩ = ∑ ℓ g ℓ (∣ ℓ + 1 ⟩ − ∣ ℓ ⟩) = ∑ r d r ∣ r ⟩ , where d r : = g r − 1 − g r d_r:=g_{r-1}-g_r d r := g r − 1 − g r with g ℓ ≠ 0 g_\ell\ne0 g ℓ = 0 only for 0 ≤ ℓ < M 0\leq\ell<M 0 ≤ ℓ < M . The only nonzero d r d_r d r is then when 0 ≤ r ≤ M 0\leq r\leq M 0 ≤ r ≤ M . If 2 s + 1 ≤ M 2^{s+1}\leq M 2 s + 1 ≤ M , we obtain that d r : = g ˉ ( r − 1 ) m o d 2 s + 1 − g ˉ r d_r:=\bar{g}_{(r-1)\bmod2^{s+1}}-\bar{g}_r d r := g ˉ ( r − 1 ) mod 2 s + 1 − g ˉ r , where g ˉ r : = ∑ k ≥ 0 g r + k 2 s + 1 \bar{g}_r:=\sum_{k\geq0}g_{r+k2^{s+1}} g ˉ r := ∑ k ≥ 0 g r + k 2 s + 1 . In this case, d r d_r d r is nonzero for 0 ≤ r < 2 s + 1 ≤ M 0\leq r<2^{s+1}\leq M 0 ≤ r < 2 s + 1 ≤ M . Therefore, d r ≠ 0 d_r\ne0 d r = 0 only for r r r that is at most M M M .
Now suppose the vector of modified filters is h ′ = ( h 0 ′ , … , h M ′ − 1 ′ ) \mathbf{h}'=(h'_0,\ldots,h'_{M'-1}) h ′ = ( h 0 ′ , … , h M ′ − 1 ′ ) , where M ′ = M − 1 M'=M-1 M ′ = M − 1 . Then after one refinement (one application of H ′ † H'^\dagger H ′ † ), an initial nonzero coefficient d r d_r d r at index r r r can affect coefficients with index of the form m = 2 r + ℓ 1 m=2r+\ell_1 m = 2 r + ℓ 1 with 0 ≤ ℓ 1 < M ′ 0\leq\ell_1<M' 0 ≤ ℓ 1 < M ′ . With two refinements, any nonzero coefficient has an index of the form m = 2 ( 2 r + ℓ 1 ) + ℓ 2 m=2(2r+\ell_1)+\ell_2 m = 2 ( 2 r + ℓ 1 ) + ℓ 2 . In general, after n s n_s n s refinements, any nonzero coefficient has an index of the form m = 2 n s r + S m=2^{n_s}r+S m = 2 n s r + S , where S : = ∑ j = 1 n s 2 n s − j ℓ j S:=\sum_{j=1}^{n_s}2^{n_s-j}\ell_j S := ∑ j = 1 n s 2 n s − j ℓ j with 0 ≤ ℓ j < M ′ 0\leq\ell_j<M' 0 ≤ ℓ j < M ′ .
Now let us express m = 2 n s c + b m=2^{n_s}c+b m = 2 n s c + b with 0 ≤ b < 2 n s 0\leq b<2^{n_s} 0 ≤ b < 2 n s . We then have
c = ⌊ m 2 n s ⌋ = r + ⌊ S 2 n s ⌋ ≤ r + M ′ − 2 , (303) c=\left\lfloor\frac{m}{2^{n_s}}\right\rfloor=r+\left\lfloor\frac{S}{2^{n_s}}\right\rfloor\leq r+M'-2, \tag*{(303)} c = ⌊ 2 n s m ⌋ = r + ⌊ 2 n s S ⌋ ≤ r + M ′ − 2 , (303)
where we used S ≤ ( M ′ − 1 ) ( 2 n s − 1 ) S\leq(M'-1)(2^{n_s}-1) S ≤ ( M ′ − 1 ) ( 2 n s − 1 ) , and so S / 2 n s < M ′ − 1 S/2^{n_s}<M'-1 S / 2 n s < M ′ − 1 . With r < M r<M r < M and M ′ = M − 1 M'=M-1 M ′ = M − 1 , we obtain 0 ≤ c ≤ c max 0\leq c\leq c_{\max} 0 ≤ c ≤ c m a x with c max : = 2 M − 3 c_{\max}:=2M-3 c m a x := 2 M − 3 a constant that depends only on the wavelet used.
Proof of Lemma 7. The coefficient a s , m a_{s,m} a s , m is the m m m th entry in the first column of A s = 2 n − s ( S n − 1 n ) W s † A_s = 2^{n-s}(S_n-\mathbb{1}_n)W_s^\dagger A s = 2 n − s ( S n − 1 n ) W s † . Specifically, we have a s , m = ⟨ m ∣ A s ∣ 0 ⟩ a_{s,m}=\langle m|A_s|0\rangle a s , m = ⟨ m ∣ A s ∣0 ⟩ . Because A s A_s A s is a real matrix, a s , m a_{s,m} a s , m is identical to the first m m m th entry in the first row of A s † A_s^\dagger A s † , i.e.,
a s , m = ⟨ 0 ∣ A s † ∣ m ⟩ = 2 n − s ( ⟨ 0 ∣ W s ∣ m − 1 ⟩ − ⟨ 0 ∣ W s ∣ m ⟩ ) , (304) a_{s,m}=\langle0|A_s^\dagger|m\rangle=2^{n-s}\left(\langle0|W_s|m-1\rangle-\langle0|W_s|m\rangle\right), \tag*{(304)} a s , m = ⟨ 0∣ A s † ∣ m ⟩ = 2 n − s ( ⟨ 0∣ W s ∣ m − 1 ⟩ − ⟨ 0∣ W s ∣ m ⟩ ) , (304)
where we used S n † ∣ m ⟩ = ∣ m − 1 ⟩ S_n^\dagger|m\rangle=|m-1\rangle S n † ∣ m ⟩ = ∣ m − 1 ⟩ . The matrix W s = G s H s + 1 † ⋯ H n − 1 † W_s=G_sH_{s+1}^\dagger\cdots H_{n-1}^\dagger W s = G s H s + 1 † ⋯ H n − 1 † is the row block s s s of the n n n -level wavelet transform matrix W W W and its entries are the overlap between the scale-s s s wavelet functions and the scale-n n n scaling functions. More specifically, Let ϕ ( x ) \phi(x) ϕ ( x ) and ψ ( x ) \psi(x) ψ ( x ) be the father scaling function and the mother wavelet function, respectively. Then the ( k , m ) (k,m) ( k , m ) entry of W s W_s W s is
[ W s ] k , m = ⟨ ψ s , k ( x ) ∣ ϕ n , m ( x ) ⟩ , (305) [W_s]_{k,m}=\langle\psi_{s,k}(x)|\phi_{n,m}(x)\rangle, \tag*{(305)} [ W s ] k , m = ⟨ ψ s , k ( x ) ∣ ϕ n , m ( x )⟩ , (305)
where f s , k ( x ) = 2 s f ( 2 s x − k ) f_{s,k}(x)=\sqrt{2^s}f(2^s x-k) f s , k ( x ) = 2 s f ( 2 s x − k ) with f ∈ { ϕ , ψ } f\in\{\phi,\psi\} f ∈ { ϕ , ψ } . Let w s , m : = [ W s ] 0 , m = ⟨ 0 ∣ W s ∣ m ⟩ w_{s,m}:=[W_s]_{0,m}=\langle0|W_s|m\rangle w s , m := [ W s ] 0 , m = ⟨ 0∣ W s ∣ m ⟩ be the m m m th entry in the first row. We then have
w s , m = ⟨ ψ s , 0 ( x ) ∣ ϕ n , m ( x ) ⟩ = 2 s + n ∫ ψ ( 2 s x ) ϕ ( 2 n x − m ) d x = 1 2 n − s ∫ ψ ( u + m 2 n − s ) ϕ ( u ) d u . (306) \begin{aligned}
w_{s,m}&=\langle\psi_{s,0}(x)|\phi_{n,m}(x)\rangle\\
&=\sqrt{2^{s+n}}\int\psi(2^s x)\phi(2^n x-m)\,dx\\
&=\frac{1}{\sqrt{2^{n-s}}}\int\psi\left(\frac{u+m}{2^{n-s}}\right)\phi(u)\,du. \tag*{(306)}
\end{aligned} w s , m = ⟨ ψ s , 0 ( x ) ∣ ϕ n , m ( x )⟩ = 2 s + n ∫ ψ ( 2 s x ) ϕ ( 2 n x − m ) d x = 2 n − s 1 ∫ ψ ( 2 n − s u + m ) ϕ ( u ) d u . (306)
where we used u = 2 n x − m u=2^n x-m u = 2 n x − m . If the wavelet function ψ ( x ) \psi(x) ψ ( x ) is Lipchitz continuous with the Lipchitz constant L ψ L_\psi L ψ , i.e., if ∣ ψ ( x ) − ψ ( y ) ∣ ≤ L ψ ∣ x − y ∣ |\psi(x)-\psi(y)|\le L_\psi|x-y| ∣ ψ ( x ) − ψ ( y ) ∣ ≤ L ψ ∣ x − y ∣ , then we have
∣ w s , m − 1 − w s , m ∣ ≤ 1 2 n − s L ψ 2 n − s ∫ ∣ ϕ ( u ) ∣ d u . (307) |w_{s,m-1}-w_{s,m}|\le\frac{1}{\sqrt{2^{n-s}}}\frac{L_\psi}{2^{n-s}}\int|\phi(u)|\,du. \tag*{(307)} ∣ w s , m − 1 − w s , m ∣ ≤ 2 n − s 1 2 n − s L ψ ∫ ∣ ϕ ( u ) ∣ d u . (307)
The 1-norm ∥ ϕ ∥ 1 = ∫ ∣ ϕ ( u ) ∣ d u \|\phi\|_1=\int|\phi(u)|\,du ∥ ϕ ∥ 1 = ∫ ∣ ϕ ( u ) ∣ d u of the scaling function is a constant. Let us define the constant c w : = ∥ ϕ ∥ 1 L ψ c_w:=\|\phi\|_1L_\psi c w := ∥ ϕ ∥ 1 L ψ , then
∣ a s , m ∣ = 2 n − s ∣ w s , m − 1 − w s , m ∣ ≤ c w 2 n − s , (308) |a_{s,m}|=2^{n-s}|w_{s,m-1}-w_{s,m}|\le\frac{c_w}{\sqrt{2^{n-s}}}, \tag*{(308)} ∣ a s , m ∣ = 2 n − s ∣ w s , m − 1 − w s , m ∣ ≤ 2 n − s c w , (308)
and the lemma follows.
Proof of Lemma 8. We now prove
A s ′ : = 2 3 ( n − s ) / 2 ( S n − 1 n ) H n − 1 † ⋯ H s + 1 † G s † = 8 H n − 1 ′ † ⋯ H s + 1 ′ † ( S s + 1 − 1 s + 1 ) G s † . (309) \begin{aligned}
A_s'&:=2^{3(n-s)/2}(S_n-\mathbb{1}_n)H_{n-1}^\dagger\cdots H_{s+1}^\dagger G_s^\dagger\\
&=\sqrt{8}H_{n-1}^{\prime\dagger}\cdots H_{s+1}^{\prime\dagger}(S_{s+1}-\mathbb{1}_{s+1})G_s^\dagger. \tag*{(309)}
\end{aligned} A s ′ := 2 3 ( n − s ) /2 ( S n − 1 n ) H n − 1 † ⋯ H s + 1 † G s † = 8 H n − 1 ′ † ⋯ H s + 1 ′ † ( S s + 1 − 1 s + 1 ) G s † . (309)
where H r ′ H_r' H r ′ is the modified refinement matrix of size 2 r × 2 r + 1 2^r\times2^{r+1} 2 r × 2 r + 1 with entries [ H r ′ ] i j = h ( j − 2 i ) m o d 2 r + 1 ′ [H_r']_{ij}=h'_{(j-2i)\bmod2^{r+1}} [ H r ′ ] ij = h ( j − 2 i ) mod 2 r + 1 ′ , and where
h ℓ ′ = 8 ∑ k = 0 ℓ ( − 1 ) ℓ − k h k . (310) h'_\ell=\sqrt{8}\sum_{k=0}^{\ell}(-1)^{\ell-k}h_k. \tag*{(310)} h ℓ ′ = 8 k = 0 ∑ ℓ ( − 1 ) ℓ − k h k . (310)
are the modified filter coefficients obtained from the original filter coefficients h = ( h 0 , … , h M − 1 ) \mathbf{h}=(h_0,\ldots,h_{M-1}) h = ( h 0 , … , h M − 1 ) . To this end, we show
8 ( S r + 1 − 1 r + 1 ) H r † = H r ′ † ( S r − 1 r ) , (311) \sqrt{8}(S_{r+1}-\mathbb{1}_{r+1})H_r^\dagger=H_r^{\prime\dagger}(S_r-\mathbb{1}_r), \tag*{(311)} 8 ( S r + 1 − 1 r + 1 ) H r † = H r ′ † ( S r − 1 r ) , (311)
which immediately gives the equivalent expression for A s ′ A_s' A s ′ . We prove this equation by the action of both side on basis vectors. Note that the action of H r † H_r^\dagger H r † on basis vector ∣ i ⟩ |i\rangle ∣ i ⟩ is
H r † ∣ i ⟩ = ∑ j h ( j − 2 i ) m o d 2 r + 1 ∣ j ⟩ = ∑ ℓ h ℓ ∣ 2 i + ℓ m o d 2 r + 1 ⟩ , (312) H_r^\dagger|i\rangle=\sum_j h_{(j-2i)\bmod2^{r+1}}|j\rangle=\sum_\ell h_\ell|2i+\ell\bmod2^{r+1}\rangle, \tag*{(312)} H r † ∣ i ⟩ = j ∑ h ( j − 2 i ) mod 2 r + 1 ∣ j ⟩ = ℓ ∑ h ℓ ∣2 i + ℓ mod 2 r + 1 ⟩ , (312)
and similar formula holds for H r ′ † H_r^{\prime\dagger} H r ′ † , where h ℓ h_\ell h ℓ is replaced with h ℓ ′ h_\ell' h ℓ ′ . We then have
8 ( S r + 1 − 1 r + 1 ) H r † ∣ i ⟩ = ∑ ℓ 8 ( h ℓ − 1 − h ℓ ) ∣ 2 i + ℓ m o d 2 r + 1 ⟩ , (313) \sqrt{8}(S_{r+1}-\mathbb{1}_{r+1})H_r^\dagger|i\rangle=\sum_\ell\sqrt{8}(h_{\ell-1}-h_\ell)|2i+\ell\bmod2^{r+1}\rangle, \tag*{(313)} 8 ( S r + 1 − 1 r + 1 ) H r † ∣ i ⟩ = ℓ ∑ 8 ( h ℓ − 1 − h ℓ ) ∣2 i + ℓ mod 2 r + 1 ⟩ , (313)
H r ′ † ( S r − 1 r ) ∣ i ⟩ = ∑ ℓ ( h ℓ − 2 ′ − h ℓ ′ ) ∣ 2 i + ℓ m o d 2 r + 1 ⟩ , (314) H_r^{\prime\dagger}(S_r-\mathbb{1}_r)|i\rangle=\sum_\ell(h'_{\ell-2}-h'_\ell)|2i+\ell\bmod2^{r+1}\rangle, \tag*{(314)} H r ′ † ( S r − 1 r ) ∣ i ⟩ = ℓ ∑ ( h ℓ − 2 ′ − h ℓ ′ ) ∣2 i + ℓ mod 2 r + 1 ⟩ , (314)
so the two sides are equal if h ℓ − 2 ′ − h ℓ ′ = 8 ( h ℓ − 1 − h ℓ ) h'_{\ell-2}-h'_\ell=\sqrt{8}(h_{\ell-1}-h_\ell) h ℓ − 2 ′ − h ℓ ′ = 8 ( h ℓ − 1 − h ℓ ) . Because h ℓ = 0 h_\ell=0 h ℓ = 0 for ℓ ∉ { 0 , … , M − 1 } \ell\notin\{0,\ldots,M-1\} ℓ ∈ / { 0 , … , M − 1 } , we obtain Eq. (310) by recursive analysis. We note that the original coefficients satisfy ∑ k = 0 M − 1 ( − 1 ) k h k = 0 \sum_{k=0}^{M-1}(-1)^kh_k=0 ∑ k = 0 M − 1 ( − 1 ) k h k = 0 , so h M − 1 ′ = 0 h'_{M-1}=0 h M − 1 ′ = 0 and therefore h ℓ ′ = 0 h'_\ell=0 h ℓ ′ = 0 for all ℓ > M \ell>M ℓ > M . The vector h ′ = ( h 0 ′ , … , h M − 2 ′ ) \mathbf{h}'=(h'_0,\ldots,h'_{M-2}) h ′ = ( h 0 ′ , … , h M − 2 ′ ) of the modified coefficients then has M − 1 M-1 M − 1 nonzero elements.
Error in block encoding of the preconditioned matrix
Here we first show ε p r e c ∈ O ( n 2 2 − p ) \varepsilon_{\mathrm{prec}} \in O(n^{2}2^{-p}) ε prec ∈ O ( n 2 2 − p ) by a direct error analysis and then obtain a sufficient size for the number of fractional bits p p p in terms of n n n and ε \varepsilon ε . For simplicity, we consider A p r e c = Q T E Q + K p r e c A_{\mathrm{prec}} = Q^{T}EQ + K_{\mathrm{prec}} A prec = Q T E Q + K prec in 1D as the result holds for 3D case. The error ε p r e c \varepsilon_{\mathrm{prec}} ε prec in block encoding of A p r e c A_{\mathrm{prec}} A prec is caused by the imperfect block encoding U Q U_{Q} U Q of Q Q Q with error ε Q \varepsilon_{Q} ε Q . That is, U Q U_{Q} U Q block encodes an approximation Q ~ \widetilde{Q} Q of Q Q Q with error ε Q \varepsilon_{Q} ε Q . Let us write Q ~ = Q + Δ \widetilde{Q} = Q + \Delta Q = Q + Δ , then ∥ Δ ∥ ≤ ε Q \lVert\Delta\rVert\le\varepsilon_{Q} ∥ Δ ∥ ≤ ε Q and
A ~ p r e c − A p r e c = Q ~ T E Q ~ − Q T E Q = Δ T E Q + Q T E Δ + Δ T E Δ . (315) \widetilde{A}_{\mathrm{prec}} - A_{\mathrm{prec}} = \widetilde{Q}^{T}E\widetilde{Q} - Q^{T}EQ = \Delta^{T}EQ + Q^{T}E\Delta+ \Delta^{T}E\Delta. \tag*{(315)} A prec − A prec = Q T E Q − Q T E Q = Δ T E Q + Q T E Δ + Δ T E Δ. (315)
Because ∥ A p r e c ∥ ∈ Θ ( 1 ) \lVert A_{\mathrm{prec}}\rVert\in\Theta(1) ∥ A prec ∥ ∈ Θ ( 1 ) and ∥ E ∥ ∈ Θ ( 1 ) \lVert E\rVert\in\Theta(1) ∥ E ∥ ∈ Θ ( 1 ) , we have ∥ Q ∥ ∈ Θ ( 1 ) \lVert Q\rVert\in\Theta(1) ∥ Q ∥ ∈ Θ ( 1 ) , and so
ε p r e c ≤ 2 ∥ Q ∥ ∥ E ∥ ε Q + ∥ E ∥ ε Q 2 ∈ O ( ε Q ) . (316) \varepsilon_{\mathrm{prec}} \le2\lVert Q\rVert\lVert E\rVert\varepsilon_{Q} + \lVert E\rVert\varepsilon_{Q}^{2} \in O(\varepsilon_{Q}). \tag*{(316)} ε prec ≤ 2 ∥ Q ∥ ∥ E ∥ ε Q + ∥ E ∥ ε Q 2 ∈ O ( ε Q ) . (316)
We obtain the block encoding of Q = ∑ s = 0 n − 1 Q s Q = \sum_{s=0}^{n-1} Q_{s} Q = ∑ s = 0 n − 1 Q s using a direct block encoding of each column block Q s Q_{s} Q s by its action on basis states. To this end, we first computed the coefficients a s , m ′ a'_{s,m} a s , m ′ and then performed amplitude transduction using inequality test. The coefficient a s , m ′ a'_{s,m} a s , m ′ is computed by loading an initial vector and performing n s = n − s − 1 n_{s} = n-s-1 n s = n − s − 1 refinements with each refinement using Θ ( 1 ) \Theta(1) Θ ( 1 ) fixed-point operations. As each entries of the initial vector has p p p fractional bits, the error in loading the initial vector is also at most O ( 2 − p ) O(2^{-p}) O ( 2 − p ) . The error for each refinement is at most O ( 2 − p ) O(2^{-p}) O ( 2 − p ) as it uses a constant number of fixed-point operations. The amplitude transduction gives the amplitude α s , m = a s , m ′ / c W \alpha_{s,m} = a'_{s,m}/c_{W} α s , m = a s , m ′ / c W with error O ( 2 − p ) O(2^{-p}) O ( 2 − p ) . The total error in block encoding of Q s Q_{s} Q s is then ε Q s ∈ O ( ( n s + 2 ) 2 − p ) \varepsilon_{Q_{s}} \in O((n_{s}+2)2^{-p}) ε Q s ∈ O (( n s + 2 ) 2 − p ) . We then obtain ε Q ≤ ∑ s ε Q s ∈ O ( n 2 2 − p ) \varepsilon_{Q} \le\sum_{s}\varepsilon_{Q_{s}} \in O(n^{2}2^{-p}) ε Q ≤ ∑ s ε Q s ∈ O ( n 2 2 − p ) , and so ε p r e c ∈ O ( n 2 2 − p ) \varepsilon_{\mathrm{prec}} \in O(n^{2}2^{-p}) ε prec ∈ O ( n 2 2 − p ) .
To obtain a sufficient size for the number of fractional bits p p p , note that in § 3.3.2 we imposed the error ε p r e c \varepsilon_{\mathrm{prec}} ε prec to satisfy 4 d ε p r e c / α p r e c ≤ ε ′ 4d\sqrt{\varepsilon_{\mathrm{prec}}/\alpha_{\mathrm{prec}}} \le\varepsilon' 4 d ε prec / α prec ≤ ε ′ . First we use the relations
∥ A p r e c ∥ ε i n v ≤ ε 4 , ε i n v = 8 κ p r e c ε ′ 3 ∥ A p r e c ∥ , d ∈ O ( n log ( 1 / ε ) ) (317) \lVert A_{\mathrm{prec}}\rVert\varepsilon_{\mathrm{inv}} \le\frac{\varepsilon}{4},\quad\varepsilon_{\mathrm{inv}} = \frac{8\kappa_{\mathrm{prec}}\varepsilon'}{3\lVert A_{\mathrm{prec}}\rVert},\quad d \in O(n\log(1/\varepsilon)) \tag*{(317)} ∥ A prec ∥ ε inv ≤ 4 ε , ε inv = 3 ∥ A prec ∥ 8 κ prec ε ′ , d ∈ O ( n log ( 1/ ε )) (317)
established in § 3.3.2 to establish a bound for ε p r e c \varepsilon_{\mathrm{prec}} ε prec in terms of n n n and ε \varepsilon ε . By this equation and κ p r e c ∈ Θ ( 1 ) \kappa_{\mathrm{prec}} \in\Theta(1) κ prec ∈ Θ ( 1 ) , we have
ε ′ = 3 ∥ A p r e c ∥ ε i n v 8 κ p r e c ≤ 3 ε 32 κ p r e c ∈ Θ ( ε ) , (318) \varepsilon' = \frac{3\lVert A_{\mathrm{prec}}\rVert\varepsilon_{\mathrm{inv}}}{8\kappa_{\mathrm{prec}}} \le\frac{3\varepsilon}{32\kappa_{\mathrm{prec}}} \in\Theta(\varepsilon), \tag*{(318)} ε ′ = 8 κ prec 3 ∥ A prec ∥ ε inv ≤ 32 κ prec 3 ε ∈ Θ ( ε ) , (318)
so by 4 d ε p r e c / α p r e c ≤ ε ′ 4d\sqrt{\varepsilon_{\mathrm{prec}}/\alpha_{\mathrm{prec}}} \le\varepsilon' 4 d ε prec / α prec ≤ ε ′ , we obtain
ε p r e c ≤ α p r e c 16 d 2 ε ′ 2 ∈ Θ ( n ε 2 ) / d 2 , (319) \varepsilon_{\mathrm{prec}} \le\frac{\alpha_{\mathrm{prec}}}{16d^{2}}\varepsilon'^{2} \in\Theta(n\varepsilon^{2})/d^{2}, \tag*{(319)} ε prec ≤ 16 d 2 α prec ε ′ 2 ∈ Θ ( n ε 2 ) / d 2 , (319)
where we used α p r e c ∈ Θ ( n ) \alpha_{\mathrm{prec}} \in\Theta(n) α prec ∈ Θ ( n ) . As d ∈ O ( n log ( 1 / ε ) ) d \in O(n\log(1/\varepsilon)) d ∈ O ( n log ( 1/ ε )) , it is then sufficient to choose
ε p r e c ∈ O ( ε 2 n log 2 ( 1 / ε ) ) . (320) \varepsilon_{\mathrm{prec}} \in O\left(\frac{\varepsilon^{2}}{n\log^{2}(1/\varepsilon)}\right). \tag*{(320)} ε prec ∈ O ( n log 2 ( 1/ ε ) ε 2 ) . (320)
We had ε p r e c ∈ O ( n 2 2 − p ) \varepsilon_{\mathrm{prec}} \in O(n^{2}2^{-p}) ε prec ∈ O ( n 2 2 − p ) by the direct error analysis. It is therefore sufficient to choose
n 2 2 p ≲ ε 2 n log 2 ( 1 / ε ) , (321) \frac{n^{2}}{2^{p}} \lesssim\frac{\varepsilon^{2}}{n\log^{2}(1/\varepsilon)}, \tag*{(321)} 2 p n 2 ≲ n log 2 ( 1/ ε ) ε 2 , (321)
where ≲ \lesssim ≲ suppresses constant factors, from which we obtain
p ≳ log n 3 log 2 ( 1 / ε ) ε 2 = 3 log n + 2 log ( 1 / ε ) + 2 log log ( 1 / ε ) ∈ Ω ( log ( n / ε ) ) . (322) p \gtrsim\log\frac{n^{3}\log^{2}(1/\varepsilon)}{\varepsilon^{2}} = 3\log n + 2\log(1/\varepsilon) + 2\log\log(1/\varepsilon) \in\Omega(\log(n/\varepsilon)). \tag*{(322)} p ≳ log ε 2 n 3 log 2 ( 1/ ε ) = 3 log n + 2 log ( 1/ ε ) + 2 log log ( 1/ ε ) ∈ Ω ( log ( n / ε )) . (322)
Note that we are free to choose any p p p that satisfies p ∈ Ω ( log ( n / ε ) ) p \in\Omega(\log(n/\varepsilon)) p ∈ Ω ( log ( n / ε )) . It is then sufficient to choose p ∈ Θ ( log ( n / ε ) ) p \in\Theta(\log(n/\varepsilon)) p ∈ Θ ( log ( n / ε )) .
References