The present invention relates to a method of solving matrix equations using a quantum computing system, and more particularly the present invention relates to a generalization of the Harrow/Hassidim/Lloyd algorithm which makes use of a quantum walk operator for the purposes of quantum phases estimation.
Matrix equation formulations are a powerful tool for the numerical analysis of physical systems, and their usage is widespread across many areas of engineering [1]-[3]. Unfortunately, the solution of practical matrix equations often demands an exorbitant supply of computational resources, with many present-day simulation problems already stressing the limits of available computing systems. For a matrix equation involving N unknowns, the most sophisticated algorithms of the current day provide (N) or
(NpolylogN) runtime and memory complexity [4]-[6], and are heavily reliant on the structure of very specific problem classes. Thus, as simulations naturally grow more complex with time, the requisite computational power must grow at least proportionately.
For such computationally intensive problems, quantum computers are growing in popularity as a potential remedy, as they are capable of leveraging procedures of dramatically reduced complexity relative to their classical counterparts [7], [8], [11]. This is chiefly due to the manner in which quantum computers store and operate on data. Values of interest are stored as the amplitudes of possible states for a register of qubits, meaning that a 1-qubit system (using a 2-state qubit) can store two values using the amplitudes of the |0 and |1
states; a 2-qubit system can store four values using the |00
, |01
, |10
, and |11
states; and so on. In general, the storage capacity of a quantum computer scales exponentially with the size of the system. Quantum operators then act directly on the system's qubits, allowing the effects of operators to also scale exponentially with system size.
On the topic of matrix equation solvers, the Harrow/Hassidim/Lloyd (HHL) algorithm [9] has become well established as the leading quantum algorithm. For a system of condition number κ, this algorithm is capable of providing computational complexity (κ2 log(N)/ϵ) in the calculation of a solution of precision ϵ. Thus, when κ and 1/ϵ scale logarithmically with N, the procedure offers an exponential speedup over classical algorithms.
A detailed description of the HHL algorithm is given in the description below, but we provide a brief overview of the procedure here for the sake of motivation. In what follows, note that the notation |ν indicates a vector
=Σj=0N−1νj|j
, where
is understood to also refer to the vector
=|b
, where A is an N×N matrix, and |x
and |b
are N-dimensional vectors. If a quantum system is initialized to the state |b
, then its state will be a superposition of the eigenvectors of A:
where |uj is an eigenvector of A, and βj is the component of |b
along |uj
. The solution vector |x
can then be obtained by applying the inverse of each eigenvalue λj of A to its corresponding eigenvector in the superposition |b
:
This application of inverse eigenvalues, conditioned on the presence of the corresponding eigenvectors, is the basic function of HHL. By using quantum phase estimation (QPE) [10], it is possible to extract and apply these eigenvalue factors in an efficient manner. However, this phase estimation requires the implementation of a problem-dependent unitary in terms of basic quantum gates. Generally the unitary eiA is employed for this purpose, but the process of decomposing this unitary into a sequence of basic quantum gates is nontrivial. Therefore the process of implementing this operation on real quantum hardware presents a bottleneck for the procedure.
In this work we consider a particular method, inspired by research into quantum walks, which produces a unitary with a known decomposition into basic gates.
According to one aspect of the invention there is provided a method of solving matrix equations using a quantum computing system, the method comprising:
The method may further comprise the quantum walk operator containing a reflection operator defined as 2TT†−I, where application of T† and T performs projection onto a vector space.
The method may further comprise defining:
and |ζja are arbitrary failure states.
The method may further comprise defining the quantum walk operator by the expression W=iS(2TT†−I), where S is a register swap operation.
The method may further comprise, subsequent to quantum phase estimation, extracting eigenvalues Δj and applying ancilla rotation.
The method may further comprise performing initial translation of |b to a superposition of eigenvectors of W by applying T, and performing uncomputation by applying T†.
The method may further comprise preventing negative elements from appearing on the diagonal of system matrix A by adding a constant multiple of the identity matrix.
Quantum computation offers a promising alternative to classical computing methods in many areas of numerical science, with algorithms that make use of the unique way in which quantum computers store and manipulate data often achieving dramatic improvements in performance over their classical counterparts. The potential efficiency of quantum computers is particularly important for numerical simulations, where the capabilities of classical computing systems are often insufficient for the analysis of real-world problems. In this work, we study problems involving the solution of matrix equations, for which there currently exists no efficient, general quantum procedure. We develop a generalization of the Harrow/Hassidim/Lloyd algorithm by providing an alternative unitary for eigenphase estimation. This unitary, which we have adopted from research in the area of quantum walks, has the advantage of being well defined for any arbitrary matrix equation, thereby allowing the solution procedure to be directly implemented on quantum hardware for any well-conditioned system. The procedure is most useful for sparse matrix equations, as it allows for the inverse of a matrix to be applied with (Nnz log(N)) complexity, where N is the number of unknowns, and Nnz is the total number of nonzero elements in the system matrix. This efficiency is independent of the matrix structure, and hence the quantum procedure can outperform classical methods for many common system types. We show this using the example of sparse approximate inverse (SPAI) preconditioning, which involves the application of matrix inverses for matrices with Nnz=
(N). While these matrices are indeed sparse, it is often found that their inverses are quite dense, and classical methods can require as much as
(N3) time to apply an inverse preconditioner.
One embodiment of the invention will now be described in conjunction with the accompanying drawings in which:
, the vector register is shown to have the state of a single eigenvector. In general, it will be prepared in a superposition of all eigenvectors of U. In the state |ϕj,a
, the second subscript a indicates the a-th bit of the eigenphase ϕj corresponding to |uj
. This final state assumes ϕj can be represented exactly by np bits. When ϕj cannot be represented thusly, the final state of the phase register will have probabilities which spike sharply in the vicinity of the most accurate approximation to ϕj.
, and P(k) gives the measured probability of observing the phase register in state |k
. The amplitudes of phase states corresponding to accurate eigenphase approximations spike sharply and roughly in proportion to the presence of the eigenvectors, indicating that the state of a given phase estimate is entangled with the corresponding eigenstate. These spikes are not exactly proportional due to the probability being distributed over a nontrivial range of potential approximations.
FIG. 3 illustrates a control procedure summary for a 4-qubit control register and arbitrary operator U. This approach provides (n) complexity for the implementation of an n-qubit control. This circuit is only applicable for a |1111
control state, but other controls can be easily implemented by applying Pauli X gates to qubits requiring a |0
control. Note that the actual application of U involves only a single control qubit, and hence the complexity of U does not compound with the control complexity.
and |r2
registers are the ancilla-augmented vector registers on which the walk operator and its associated constituents act. The phase register |p
provides space for the estimation of the eigenphases of W. The ancilla |a
is used for the application of the HHL rotation described in section II. We commonly refer to |a
as the “HHL ancilla” to distinguish it from the ancillae of |r1
and |r2
. The phase amplitudes ρjk+ and ρjk− are used to distinguish the amplitudes of phase estimates corresponding to each of the two eigenvectors |νj±
. The eigenvalue estimates themselves require no such distinction, as both μj+ and μj− have the same imaginary part.
, conditioned on the state of |r1
. Note that, due to the presumption that |r1
is initially prepared with an ancilla state of |0
, the |r1
ancilla is ignored in this calculation. Since the resulting system is highly entangled, individual qubit states cannot be separated. As a result, we have only provided a final state for the total system.
state. Here θjk=arccos (√{square root over (|Ajk|N/X)}) and ωjk=±arg(Ajk)/2, where the positive solution for ωjk is chosen iff arg(Ajk)=η and j>k. Thus, the Ry gates rotate according to the magnitudes of the elements of A, with the factor of XPX subsequently enforcing the correct phase on the |0
state of the ancilla.
and |r2
. The operator II can be applied to any qubit in |r1
or |r2
to produce the desired effect.
(N log N) line is shown for comparison.
(N log N) and
(N3) trend lines are used for the quantum and classical extrapolation, respectively.
Quantum walks are a popular area of study in quantum computing, as they have shown success in aiding the construction of efficient algorithms [16]. Reference gives an excellent introduction to the concept of quantum walks. In essence, they are stochastic processes that, when evolved and measured, give information about the system in which they have evolved. The structure of the evolution and the properties measured can be adjusted to change the information obtained. We are interested in the walk procedure developed in [18], which considers the problem of element-distinctness. This problem is quite far removed from our current study, but it is important for the fact that it introduces a particular walk operator based on Grover diffusion operators. Following this research, further investigated diffusion-based quantum walks defined by probabilistic maps, and considered the spectra of the walk operators. Finally, expanded on these findings from the perspective of Hamiltonian simulation, and showed that the walk operators could be defined from a Hamiltonian to produce an operator with a spectrum closely related to that of the Hamiltonian itself. Reference further explored methods by which these walk operators could be implemented in practice.
The method developed in uses QPE to extract the eigenvalues of the walk operator, which can then be related to the eigenvalues of the Hamiltonian. This is the critical component from which we can develop a general procedure for solving matrix equations. By treating a Hermitian system matrix as the Hamiltonian, we can apply QPE using the walk operator to extract the eigenvalues of the system matrix. From there, the HHL algorithm can proceed as usual.
An algorithm presented in also makes use of the relationship between quantum walk operators and the eigenvalues of the system matrix (in particular, this work considers singular values) to produce an iterative quantum matrix solver. Our procedure differs in that it provides a direct solution method, is more easily generalizable, and does not require explicit computation of any singular values of the system matrix.
The matrix solution procedure we present here is particularly efficient for cases involving sparse matrices, wherein it can easily be seen to outperform classical solvers. This is due to the (Nnz log N) gate complexity of the associated solution circuit, where Nnz is the total number of nonzero elements in the system matrix. When system matrices exhibit little reliable structure, it is often impossible for classical procedures to provide performance better than
(N3), regardless of the matrix sparsities. A key example of this is the technique of sparse approximate inverse (SPAI) preconditioning [20]-[22]. This technique typically generates a preconditioning matrix with
(N) nonzero elements, with a sparsity pattern that can be quite arbitrary, particularly for systems describing complex geometries. This lack of matrix structure makes the development of efficient, general classical solvers extremely difficult, and often impossible. However, our quantum method will always be capable of providing an inversion circuit having
(N log N) complexity (so long as the matrix is well-conditioned).
Using the Qiskit SDK [14], we have developed a program [15] which closely follows the herein described procedure. In the interest of expositional clarity, as well as to aid those seeking to investigate the program itself, we at times make reference to the specific functions of this program. At these points, the program is referred to simply as “the program”.
Here we describe the basic HHL algorithm which serves as a foundation for our matrix solution procedure. For brevity, we study only a primitive form of the HHL algorithm. More sophisticated formulations can be used to improve performance by, for example, ignoring ill-conditioned portions of the system matrix.
Given a matrix A∈N×N and a vector |b
∈
N, the HHL algorithm is a quantum procedure to determine |x
such that
A|x
=|b
. (3)
Due to the nature of quantum computation, several restrictive properties are required of this system. It is important to note, however, that all of these properties can be satisfied for any input system by means of a simple preparation procedure. Section V considers such preparation in depth. The restrictions are as follows: The vector |b is to be encoded onto a quantum system, and as such we require that N be a power of two and that |b
be normalized. Additionally, we require that A is Hermitian. This ensures that its eigenvectors form a basis for
N [26], and also aids us in the definition of the QPE unitary.
The first step of the HHL procedure is the preparation of three registers:
|b|0
⊗n
. (4)
The first register, which we refer to as the vector register, is initialized to |b, and hence it requires n=log2N qubits. The second register is an np-qubit phase register that is used to store the phase estimates produced by QPE. The value of n p is chosen by the user, and it should be large enough to admit sufficient resolution in the phase estimation. The final register is termed the ancilla register, and it consists of a single qubit. Once the eigenvalues of A have been estimated, the state of this register can be rotated to effect the application of the inverse eigenvalue factors.
The initial system state can be expressed in terms of the eigenvectors of A as
where |uj is the j-th eigenvector of A, and βj is the complex amplitude of |b
along |uj
. The next step of the procedure is to apply QPE to this superposition of eigenvectors to determine the corresponding eigenphases.
Quantum phase estimation is a procedure for the estimation of the eigenphases of a unitary. It begins with the observation that the eigenvalues of unitary operators lie on the complex unit circle, and hence they can be expressed in the form
μj=e2πiϕ
where μj is an eigenvalue of some unitary U, and φj∈[0,1) is termed the corresponding eigenphase. The fundamental action of QPE is to use one register, initialized to an eigenvector |uj of U, to write a binary representation of the corresponding eigenphase onto an external phase register:
Here {tilde over (ϕ)}j represents an np-bit approximation of ϕj: If ϕj can be exactly represented by np bits, then the phase register will have the final state |ϕj exactly. Note that ϕj is not, in general, an integer. The notation |ϕj
is used here simply as a label to indicate a precise eigenphase estimation. That is, |ϕj
is the state |k
such that k/2n
Where ρjk spikes sharply in the vicinity of states with k/2n
Since QPE is itself a linear operator, its effect when applied to a superposition of eigenvectors of U is as follows:
That is, the approximated eigenphase states appear on the phase register entangled with their corresponding eigenvectors.
In the case of our current system, we require a unitary with eigenvalues and eigenvectors which can be easily related to those of A. For the purposes of the HHL algorithm, the QPE unitary is typically defined as the exponential of the system matrix [27],
U=e
iAt, (10)
where t is some constant. This operator is useful due to the close relationships between its eigenvalues and eigenvectors, and those of A. However, it is interesting to note that this operator also corresponds to the simulation of a physical system subjected to a process described by the Hamiltonian A. The evolution of such a system is given by Schrodinger's” equation:
When evolved from an initial state |ψ(0) for a time t, the system's final state is given by
|ψ(t)=e−iAt/h|ψ(0)
. (12)
Thus, the operator in (10) can be considered to be a time evolution operator for the Hamiltonian A, up to the factor of −1/h.
Different values of t, and even combinations of different values, can be used to improve the performance of the calculation, but from this point on we will use t=1 for notational convenience. Then the unitary U=eiAt has eigenvalues eiλ
e
iA
=e
2πiϕ
⇒A
j=2πϕj+2πl, (13)
for some integer 1. Recall that ϕj is on the range [0,1). If we assume that A has eigenvalues on the range [−π, π] (this can be achieved in general by a simple rescaling of the system matrix) then we see that
correspond to λj∈[0,π], and
correspond to λj∈(−π, 0). Thus, λj can be computed as
Of course, we do not compute the eigenphases exactly. Instead, we transform the phase register to some superposition where the amplitude of a basis state |k grows large when k/Np≈ϕj. Here we have defined Np=2n
From the above descriptions, we see that the effect of QPE on the current system
where ρjk is the amplitude of the phase state |k resulting from the action of QPE on eigenvector |uj
. Thus, ρjk should spike sharply when |k
nears an accurate approximation of the j-th eigenphase of U, and remain near zero otherwise. With the eigenvalue extraction procedure defined, we can apply the third step of the procedure: ancilla rotation.
In this step, the ancilla register is used to impose the inverse eigenvalue factors on the system. We use the rotation operator
where C is a constant chosen to ensure that all arguments of the arccos function obey its domain restrictions. We recommend C=2π/Np, as this corresponds to the minimum possible magnitude of the denominator {tilde over (λ)}k in (15), excepting k=0. The k=0 case should be explicitly omitted from the calculation, as a nontrivial contribution from this state would indicate an eigenvalue near zero, and therefore an ill-conditioned matrix. By using a controlled version of this rotation operator, with the phase register acting as the control register, it is possible to entangle the {tilde over (λ)}k rotation with the |k state of the phase register. Applying this controlled rotation to the ancilla register for all k∈{1, . . . , Np−1}, the system is transformed to the state
where we have omitted the k=0 case on the assumption that ρj0≈0.
Note that the state (18) is approximately the following ideal state:
This is true since p jk spikes sharply when {tilde over (λ)}k approaches λj, with the spike narrowing as more accurate approximations become available. Then terms with {tilde over (λ)}k not approximately equal to λj are nullified by their corresponding coefficients ρjk approaching zero, and we can, up to an approximation error, replace {tilde over (λ)}k with λj, as we have done in (19). With the knowledge that the QPE error is obscured by this step, we from this point on assume that the system is in state (19) exactly. Acting on this state with an inverse QPE will then “uncompute” the phase register, leaving us in the state
This is the final state of the system, from which our solution can be extracted. Selecting those states with 10) in all qubits of the phase register and the ancilla register, we have
This state, when divided by C, is exactly the decomposition of A−1|b in terms of the eigenvectors of A, and hence (21) gives our final solution |x
.
A walk operator is a unitary operator that is used during a quantum walk procedure, with each application of the operator representing a “step” made by the system. As mentioned above, we do not here describe a quantum walk procedure per se. Rather, we simply adopt a walk operator from a formerly studied quantum walk procedure [18], [19]. The operator chosen is useful because its implementation is well defined for any arbitrary system matrix.
The walk operator itself has several constituents which must be defined before the operator can be stated succinctly. To begin, we define the vectors
for j∈{0, . . . , N−1}. Here X is a constant which must satisfy X≤N|Ajk|max, where |Ajk|max=maxj,k(|Ajk|). This factor is required for the purposes of ancilla rotation, as discussed in section IV. The |ϕj vectors are useful to us as carriers of information about the system matrix, and they form foundational elements of the walk operator. However, they are possessed of some critical shortcomings. First, they are not normalized. While they could be explicitly normalized through appropriate j-dependent factors, subsequent derivations serve to show that this scheme would destroy crucial operator properties. In particular, the result of (34) would no longer hold. The second concern regarding the |φj
vectors is their preparation. Producing unitary operators to generate these states is a nontrivial problem, and even once computed, these operators would also carry j-dependent normalization factors.
Both of these shortcomings can be remedied with relative ease by introducing an ancillary qubit and studying the set of augmented states
These states are normalized, and they can be easily produced through unitary transformations (see section IV). Note that the |φj states appear when the ancilla is in the |ϕ
state. Hence, the |1
state of the ancilla can be interpreted as a failure state.
Storage of each |ϕja) state requires an (n+1)-qubit register. We define two such registers, and refer to them by the names |r1 and |r2
. The ancilla-augmented basis states for these registers are indicated by a superscript α, e.g. |ja). Note that there are 2n+1=2N augmented basis states. When necessary, we always assume that the ancillary qubit is appended to the relevant register. In this procedure, there are two basic operators which act on these registers. The first is the swap operator, which swaps the content of |r1
and |r2
:
The second operator is that which produces |ϕja on |r2
when |r1
is in the state |j
with ancilla state |0
:
Here the |ζja states correspond to failure states. A forthcoming analysis of the T†ST operator shows that they must have ancilla state |1
, but otherwise their definition is insignificant. These are proper quantum states, and hence they must be normalized.
These prerequisites are sufficient for us to state the walk operator:
W=iS(2TT†−I). (26)
The process of implementing W is further explored in section IV. For the remainder of this section, we take it as given that W can be implemented. As stated above, this walk operator is particularly interesting to us because it has eigenvalues and eigenvectors closely related to those of A itself. In deriving these relationships between W and A, we first calculate some useful relationships for the constituent operators T and S. To begin, consider the product T†T:
Recalling that the |ϕja) and |ζja) states are normalized and that the basis states are orthonormal, we have
Note that despite the above, TT† does not yield the identity operator, and hence T is not a unitary transformation as currently stated. The second relationship of interest is the following:
If this operator acts on an arbitrary input vector |ψ, 0, we have
If each |ζja) has ancilla state |1, this expression becomes
This elimination of the |ζja) contributions is a crucial result, and hence we require that these states have ancilla state |1. The inner products are
Then we have
The statement that √{square root over (Akj*)}(√{square root over (Ajk*)})*=Ajk is true, but it presents an issue for implementation when Ajk lies on the negative real axis. This problem is further discussed in section IV. By the above, we see that T†ST, when applied to a vector with ancilla state |0, acts as a rescaled version of A. We introduce the shorthand
This transformation is a 2N×2N matrix, and it can therefore be applied directly to the 2N-dimensional augmented states. This simplifies the statement of (34):
T
†
ST|ψ,0=A|ψ,0
. (36)
Now we can begin the analysis of the walk operator's eigenvalues and eigenvectors. We begin with the assertion that the eigenvalues of  must lie on the range [−1,1]. By the definition of X, this is in fact always satisfied regardless of the choice of A, as we show in section V. With this established, consider now the effect of applying W to the vector T|uja=T|uj, 0) (recall that |uj
is an eigenvector of A):
WT|u
j
a
=iST|u
j
a
(37)
Note that we have continued to assume that the input vector is provided with ancilla state |0. Meanwhile, if W is applied to ST|uja
, we obtain
WST|u
j
a
=2i{circumflex over (λ)}jST|uja
−iT|uja
, (38)
where {circumflex over (λ)}j=Aj/X is the eigenvalue of A corresponding to |uja). Thus, if W is applied to any superposition of T|uja and ST|uja
, the result will be a simple superposition of the same two vectors:
W(T|uja+γST|uja
=−iγT|uja
+i(1+2{circumflex over (λ)}jγ)ST|uja
, (39)
where γ is an arbitrary factor for the relative phase and magnitude of the two contributions. Then (T|uja+γST|uja
) is an eigenvector |νj
of W, with eigenvalue μj, if γ=iμj and iμ2j=i(1+2{circumflex over (λ)}jγ). Solving this expression for the eigenvalues, we find two solutions:
μj±=i{circumflex over (λ)}j±√{square root over (1−{circumflex over (λ)}j2)}. (40)
The eigenvectors |νj±) corresponding to these eigenvalues can be normalized by computing the inner products of their unnormalized counterparts:
Therefore, W has the normalized eigenvectors
While the above analysis does not constitute a comprehensive investigation into the eigenvalues and eigenvectors of W, this simplified derivation is, as shown in what follows, sufficient for our purposes. For a detailed analysis, see [19]. To demonstrate the sufficiency of the above analysis, consider the following superposition of eigenvectors of W:
Expanding the eigenvector expressions and simplifying, we find
This result gives us the necessary components to build a matrix equation solver. By applying T to the initial right-hand side vector |b, 0 we can transform the vector into a predictable superposition of the |νj±
'S:
Then an application of QPE to this state using W as the requisite unitary yields the phase corresponding to μj+; or μj− when |uja appears in the initial state. From here it is possible to extract λj and apply an HHL-style ancilla rotation. After applying inverse QPE, the final step of the procedure is to uncompute by applying T†, thereby leaving only the rotated initial state, as in the result of HHL.
The analysis we have provided so far represents a complete theoretical formulation of the procedure, but practical implementation presents several nontrivial problems. In particular, the implementation of W, the initial application of T, and the eigenvalue extraction require elaboration. Here we present a recommended approach to the resolution of these sticking points.
Implementation of W requires, in addition to the straightforward operators i and S, the more involved operator 2TT†−I. This operator is a sum of conditional reflectors about the |ϕja and |ζja
states, as the following calculation shows. A brief introduction to the concept of reflectors is given in the section below under the heading “IX. Reflection Operators”. We begin by expanding and simplifying the TT† portion of the operator:
Then the full operator 2TT†−I is
That is, the operator reflects |r2 about |ϕja
when |r1
is in the state |j, 0), or it reflects about |ζja
when |r1
is in the state |j, 1
. To implement this operator, we first consider a state preparation operator Bj which prepares |ϕja
from the |0
state. By applying, in sequence, the inverse of this state preparation operator, a reflection about the |0
state, and finally the state preparation operator, we find
B
j(2|00|−I)Bj†=2Bj|0
0|Bj†−BjBj†=2|ϕja
ϕja|−I. (48)
Thus, this procedure effectively reflects about the state |ϕja. Likewise, we can reflect about the |ζja
states using an operator Bj′ which prepares |ζja
from |0
:
B
j′(2|00|−I)(Bj′)†=2|ζja
ζja|−I. (49)
The full operator can then be implemented as
Note that the swap operations involved in the walk operator mean that, at intermediate stages, the system stores essential data on the |1 state of the ancilla, and hence the reflections about the |ζja)'s cannot be ignored.
The implementation of the state preparation operators is straightforward. For the Bj operators, we begin by preparing a uniform superposition:
We can then apply a single Pauli X gate to the ancilla bit to obtain
Note that, for Ajk=0, the amplitudes of the |ka states are now exactly as desired. Then for |k
corresponding to nonzero Ajk, we rotate the ancilla to obtain:
It is at this point that the role of X becomes clear. In order to ensure a valid rotation, we select X such that X/N≤|Ajk|max. Note that the calculation of √{square root over (Ajk*)} requires some additional consideration. In particular, the result of (34) requires that
√{square root over (Akj*)}(√{square root over (Ajk*)})*=Ajk. (54)
In most cases, this can be satisfied by taking
√{square root over (Ajk*)}=√{square root over (|Ajk|)}e−iarg(A
and using the principal square root for √{square root over (|Ajk|)}. However, if Ajk∈(−∞, 0), then Ajk=Akj, and we have
√{square root over (Akj*)}(√{square root over (Ajk*)})*=(√{square root over (|Ajk|)}e−iπ/2)(√{square root over (|Ajk|)}eiπ/2)=|Ajk|. (56)
For j≠k, we can recover the correct sign by taking the negative square root in (55) whenever k>j. That is, if Ajk is a negative real number, we use
√{square root over (Ajk*)}=sign(j−k)|√{square root over (Ajk|)}e−iarg(A
While this prescription is effective for j≠k, it does not suffice when j=k. To address this case, we simply prevent negative elements from appearing on the diagonal of A by adding an appropriate multiple of the identity matrix. Proper treatment of this modification is considered in section V.
The Bj′ operators can be implemented by simply switching the ancilla state of the operand register to |1. This gives |ζja
=|0
⊗n|1
, which is sufficient for our purposes.
The initial application of T is also of concern. The operation is defined such that, when the |r1 ancilla qubit is in the |0
state, the |ϕja
states are produced on |r2
regardless of the initial state of the register. This is problematic to implement in practice, but since the only direct application of T occurs at the beginning of the calculation, we can safely assume that |r2
begins with all qubits in the |0
state. Then the initial application of T, which we shall distinguish by the term T0, can be effectively applied by conditional application of the state preparation operators:
Unlike T, this operator is unitary, and hence it is suitable for use in a quantum circuit. Since the initial state must be supplied with ancilla state |0, it is also possible to ignore the applications of Bj′.
While not strictly an issue for a naive implementation, the manner in which controls are applied is important for efficiency. Consider the Bj operator. If row j of A contains Nnzj nonzero elements, then Bj must apply Nnzj ancilla rotations, each with an n-qubit control. The default in-place control scheme provided by, for example, Qiskit requires time exponential in n to apply this control, thereby destroying the efficiency of the procedure. Reference [24] provides a method for implementing such controlled operations with (N2) complexity without including any additional qubits, but this approach requires n recursive square roots of the basic unitary to be computed. Even for unitaries where these square roots can be computed easily, the complexity of their implementation in terms of basic gates scales poorly as the precision needed to accurately describe the desired operator increases. This could potentially be addressed by providing a constant cutoff precision, but here we instead opt for a control scheme of complexity
(n) described in [23]. A diagram summarizing the procedure is shown in
(n+np). Additionally, it provides an optimal complexity scaling for the control procedure, and applies the desired unitary directly.
Using this control scheme, the rotation component of Bj will require (Nnzj log(N)) basic gates to implement. The initial Hadamard step to produce the uniform superposition can clearly be implemented with
(log(N)) gates, and the Pauli X gate requires constant complexity. Therefore, the total gate complexity of each Bj remains
(Nznj log(N)). Each application of T0 and W requires N controlled Bj operations, each requiring an (n+1)-qubit control. However, note that the actual application of Bj requires only a single control qubit, and hence the complexity of the control procedure is separate from that of Bj. Then a single controlled Bj has
(log(N))+
(Nnzj log(N))=
(Nnzj log(N)) gate complexity. Note that we have assumed Nnzj≥1 for all j, which must always be satisfied for a well-conditioned system. For constant precision, the solution circuit will require a constant number of applications of W and T0. Then, noting that Σj=0N−1Nnzj=Nnz, this gives the final gate complexity of the solution procedure:
(Nnz log(N)). (59)
The last point of concern is the new procedure for eigenvalue extraction. Where the canonical HHL unitary gives the eigenphase relationship e2πiϕ
sin(2πϕj)={circumflex over (λ)}j⇒λj=X sin(2πϕj). (60)
Recall the following list of restrictions that have been imposed on our system:
In this section, we develop a method by which an arbitrary matrix equation can be modified to satisfy these constraints. To keep our notation consistent, we begin from the following initial problem: Given A0∈M×M and |b0
∈
M, find |x
such that
A
0
|x
0
=|b
0
. (61)
This arbitrary input system provides the foundational elements for an appropriately restricted system.
The first restriction is that |b is normalized. This is easily satisfied by dividing (61) by the magnitude of |b0
:
Here we assume that ∥b0∥2≠0. Since the zero vector is always a valid solution when ∥b0∥2=0, this case is trivial and need not be considered for our purposes.
The second assumption is that the system matrix A must be Hermitian. This is satisfied in general by expanding the problem to the following 2M×2M system:
Third, we consider that the size of our quantum system must be a power of 2, as the algorithm is constructed for quantum systems using two-state qubits. Therefore, we define n=┌log(2M)┐ and N=2n, and once again expand our system, this time to
where IN−2M is the identity matrix of dimension N−2M, and we have appended N−2M zeros to each vector. Now each vector can be represented by an n-qubit state.
The final problem is the restriction of the eigenvalues of A to the range [−X, X]. Let λmax be the magnitude of the dominant eigenvalue of A. Then we have
λmax≤N|Ajk|max≤X, (65)
by the discussion following (53). Thus [−×max, ×max]⊆[−X, X] and hence the spectrum of A lies entirely on the required range. That is, for this procedure, no rescaling of the system is required to satisfy the eigenvalue restrictions.
Every element on the diagonal of the system matrix is now either 0 or a positive real number, and hence no negative real elements appear on its diagonal. This accounts for all imposed restrictions, leaving us with the following scheme for the preparation of an appropriate system:
Of course, it is possible that A0 is already Hermitian, in which case some efficiency can be gained by not performing the full expansion as stated above. Instead, only the size restriction must be satisfied. To this end, we redefine n=┌log(M)┐—keeping the definition N=2 n—and expand the system as follows:
Now it is possible for the system matrix to have negative real values on the diagonal. This can be amended by using a shifted system:
(A+dI)|x=|b
, (68)
where d is an upper bound on the magnitude of the offending values on the diagonal of A. For the purposes of the walk operator, A+dI should be used as the system matrix, but note that this has the effect of shifting all eigenvalues of A by d. Hence, in order to directly apply the inverse of A to the initial state, the eigenvalue extraction of (60) must be modified:
λj=X sin(2πϕj)−d. (69)
So long as X is calculated from the shifted system matrix, the eigenvalues are still appropriately bounded, and A still requires no additional rescaling to satisfy the eigenvalue restrictions.
Here we summarize the preceding analysis in the form of a self-contained procedure. We assume that the supplied matrix equation has been properly prepared according to section V.
with the control
is in the state |j, 0
The first stage of the procedure is the application of T0, which maps |r2 to a superposition of the |ϕja
and |ζja
states defined in section III. A circuit diagram for our suggested implementation of T0 is shown in
will in practice be initialized to |0
.
In this application of T0, the system undergoes the transformation
Here we have suppressed the phase and HHL ancilla registers, as they are not subject to the effects of T0.
With |r1 and |r2
prepared in the desired superposition of the walk operator's eigenvectors, an application of QPE using W as the unitary writes the eigenphases of W onto the phase register |p
. An expansion of this step, in the typical QPE format, is given in
states, wherein |ζja
=|0
⊗n|1). This eliminates the j dependence of the corresponding preparation operator, which we now refer to as simply B′. Since the swap operations can leave important data on the |1
state of |r1
's ancilla, B′ cannot be ignored as in the initial application of T0. In the model of our current study, B′ can be implemented by simply applying an X gate to the ancilla of |r2
. The program implements B′ in the “Bp” function of the “QWOps” module.
After phase estimation, the system is in the state
Here we have reintroduced the phase register, although |a remains suppressed. As in section II, ρjk± extracts accurate eigenvalue approximations by spiking sharply when {tilde over (λ)}k approaches an actual eigenvalue λj.
, with the control condition that |p
With the phase register holding the eigenphases of W, extraction of the corresponding eigenvalues can proceed according to the analysis of sections IV and V. Specifically, the eigenvalues are calculated according to
λj=X sin(2πϕj)−d, (72)
where d=0 can be used if the system was expanded to satisfy the Hermitian system matrix property. Of course, the exact values of ϕj are not known in general, and in practice approximate eigenvalues must be calculated from the state of the phase register as follows:
Once these eigenvalue approximations have been calculated, a rotation operator can be used to apply an eigenvalue factor corresponding to the inverse of the system matrix for every possible state of the phase register, as detailed in section II. A circuit diagram for this procedure is given in
<0| − I)Bj†
with the control condition
is in the state |j, 0
<0| − I)(Bj′)†
with the control condition that the
ancilla is in the state |1
and |r2
and |r2
or |r2
Upon completion of this rotation, the system has the state
After rotation, |p, |r2
, and the ancilla of |r1
are uncomputed by applying inverse QPE and T0 operations. Ideally, these registers are returned to the |0
state, and any other state can be interpreted as a failure of the procedure. This leaves |r1
entangled with |a
. When |a
takes the state |0
, the state of |r1
is proportional (up to the error introduced through QPE) to the solution state |x
. Meanwhile, if |a
is in the state |1
, the system is in a failure state. That is, the overall final state of the system is
C|x,0|0
⊗(n+1)|0
⊗n
+|failure). (75)
This final state is analogous to (20).
From this description, we see that the full procedure is well defined for any input matrix, with all constituent operations having explicit representations. This is in contrast to the canonical HHL algorithm, where the implementation of the QPE unitary presents an ambiguously defined bottleneck for the procedure.
In developing suitable tests for the practical performance of this procedure, two important limitations must be considered: First, the quantum systems currently available to the public are quite small, with the largest system we have access to offering only 7 qubits [25]. This is the ibmq_jakarta v1.0.23 system, which is one of the IBM Quantum Falcon Processors. Second, errors on these systems can propagate rapidly, with calculations involving more than ˜800 primitive gates being, in our experience, unlikely to yield the expected states. Therefore, when considering a problem suitable for fully quantum analysis, we are at present limited to very short, small calculations. Section VII-A constructs and analyzes such a problem, but it is possible to construct a more satisfying test using classical simulation. By using a classical computer to simulate a quantum system, we gain access to more qubits and eliminate gate errors. Such simulation is extremely inefficient, but we have found that as many as 14 qubits can be simulated for this procedure using available classical systems. Section VII-B considers a larger, less restricted test problem using classical simulation.
Aside from verifying the accuracy of our method, we must also show that it is efficient compared to classical algorithms. For this task, we use the example of sparse approximate inverse (SPAI) preconditioning. Section VII-C is dedicated analyzing the efficiency of preconditioner application.
Being limited to 7 qubits, we must consider only the smallest of possible problems. Thus we choose a problem of two unknowns, requiring a single qubit for each of the main portions of |r1 and |r2
. Both of these registers require ancillary qubits, and a third ancilla is also required for the eigenvalue rotation. Then we currently stand at 5 qubits accounted for, with 2 left for the phase register. Since we are most concerned with using a minimal number of qubits, we use the exponential time, in-place control scheme provided by default in Qiskit. Thus, no additional qubits are needed for control considerations. These four possible phase states admit no error in the phase estimation, and hence we must choose a problem such that the eigenphases can be exactly represented by two bits.
By (69), the eigenvalues of the system matrix must satisfy
The system
satisfies the constraints of our procedure, and has eigenvalues
λ0=−3=−d,λ1=−1=X−d. (78)
Thus, this system provides a suitable candidate for our analysis. Note that the system is Hermitian, and no expansion is required. For a right-hand side vector, we use an equal superposition of both eigenvectors of A:
For this problem of known form, some simplification is possible in the various operators of the solution procedure. This allows the size of the final circuit to be significantly reduced. The system matrix defining the walk operator is
Therefore, all Bj operators apply the same ancilla rotation:
Since all elements are real, no phase rotation is necessary, and all Bj operators can be implemented by simply applying a Hadamard gate to |r2. This elimination of the complicated phase and Ry gates, both of which also require additional control considerations, greatly reduces the complexity of each Bj operator.
This simplification of the Bj operators carries through the T0 and W operators. Without this reduction, the full program produces a circuit consisting of 15,728 basic gates. This figure results from transpilation using the available CX, I, Rz, √{square root over (X)}, and X basis gates. After simplification, the final circuit requires only 2,696 gates. This is a notable reduction, but the circuit is still much too large considering the errors incurred by each gate application. We remedy this by dividing the circuit into many smaller sub-circuits, and running each of these components as its own calculation. By initializing each component based on a classically simulated result from the previous component (rather than continuing from an imprecise result as a direct calculation would), the compounding effect of gate errors can be eliminated. We can then verify the validity of our solution by confirming that the results of each component agree with the simulated results for the same component.
In total, the circuit was divided into 120 components as listed below under the heading “X. Quantum Circuit Components”. Initializations were performed using Qiskit's built-in initialization function using the state vectors produced by classical simulation of the previous components. The results of the calculation are shown in
With space available for a slightly larger system, we consider a practical, though still trivial, problem. We consider a calculation of the charge per unit length on a transmission line consisting of two long, conducting strips of known potentials radiating in free space. This problem can be modeled as a method of moments discretization of a cross-section of the line, yielding a matrix equation for the element charges |Q as a function of their potentials IV
:
B|Q
=|V
. (82)
Elements of the matrix B are given by [28]:
where lj is the length of the j-th one-dimensional boundary element and djk is the separation between the centroids of elements j and k. By using elements of uniform size l, we can ensure that B is Hermitian. We give each strip unit width, and orient both strips parallel to each other with unit separation.
The calculated charge density for each element is shown in
Here we consider the calculation of charge density per unit length on a two-conductor rectangular transmission line using the same method of moments approach as in the previous section. For reference, a classical solution is shown in
By applying P−1 to the right-hand side vector of the matrix equation prior to performing an iterative solution procedure, the total number of iterations needed to solve the system can be drastically reduced [20]. However, even though P is generally sparse, P−1 can still be quite dense, as illustrated in (Nnz log(N)) time, regardless of the sparsity of P−1.
(N). We see that for large matrices, the time required increases roughly as
(N3), showing that no advantage whatsoever is gained from the sparsity of the initial matrix. For the quantum procedure,
(N log(N)) scaling is obtained, and therefore the quantum procedure is, asymptotically, more efficient than the classical procedure.
It is worth noting that the quantum procedure takes a very long time to produce a solution circuit for even modest problem sizes, limiting practical applicability to extremely large problems where the improved scaling can overcome the initial time difference.
Unfortunately, we are not able to analyze the time complexity of the solution circuit execution due to the limitations of available hardware. The total number of qubits required for a system of size N is
2n+2(n−1)+2+np+1=4n+np+1, (85)
accounting for the base registers and their ancillae, the control registers, the phase register (which could also require its own work register for controls, but we consider it to have constant size and therefore omit this extra dependence), and the HHL ancilla. Even with a trivial single-qubit phase estimation, a system of 26 qubits would be required to invert our smallest preconditioner (N=64). Since the largest system we can access provides only 7 qubits, this calculation is quite beyond the capabilities of available hardware. Note that, by this calculation, 82 qubits would be required at our estimated crossover point of quantum/classical efficiency (using n=20 as the smallest sufficient power of two).
By combining the known HHL algorithm with a unitary adopted from quantum walk research, we have developed a method for the solution of any well-conditioned matrix equation which is suitable for direct implementation on quantum hardware. The method has demonstrated (Nnz log(N)) complexity in time and gate count, and for sparse matrices is expected to outperform classical solvers for problems of N≥8×105 unknowns.
While the method itself is suitable for practical implementation, available quantum systems are far too small and unreliable to support the analysis of any nontrivial problem. This situation is expected to improve rapidly, however, with IBM projecting the release of a 1,000 qubit system by the end of 2023 [29]. They also anticipate a dramatic decrease in errors [30]. Google has also indicated plans to develop a commercial-grade system by 2029 [31].
Here we briefly describe the nature of reflection operators. In particular, we consider operators of the form 2|νv|−I, where |ν
is some normalized vector. This operator, when applied to another vector |w
of the same dimension, reflects |w
about |ν
. As an initial example, consider the two-dimensional case where Iv) is the unit vector along the y-axis, |{circumflex over (γ)}
, and |w
=a|{circumflex over (x)}
+b|{circumflex over (γ)}
is arbitrary. Then the effect of the reflection operator is as follows:
That is, the x component of |w is negated, while the y component remains unchanged.
In general, the operand vector |w consists of components both perpendicular and parallel to |ν
. Thus the vector can be written as |w
=a|w∥
+b|w⊥
, and the action of the reflector is
Then the arbitrary reflector 2|νν|−I has the effect of negating the perpendicular component of the operand vector, while leaving the parallel component unchanged.
This section lists the individual operations which constitute each component of the divided circuit described in section VII-A. Operations are given in Qiskit-style syntax similar to that used in the program. Operators are listed first, with the operand registers listed on the following line. We assume that C, X, and d have been defined. Note that each of these components also includes the operations necessary to initialize it to the ideal state resulting from the precise application of all previous components. These operations, applied in sequence to an appropriately initialized system, constitute the solution procedure for the relevant system.
The following documents are referred in the preceding sections by reference number in brackets [#] and are hereby incorporated herein by reference.
Engineering, 4th ed., Harlow, England: Pearson, 2012.
Since various modifications can be made in the invention as herein above described, and many apparently widely different embodiments of same made, it is intended that all matter contained in the accompanying specification shall be interpreted as illustrative only and not in a limiting sense.
This application claims the benefit under 35 U.S.C. 119(e) of U.S. provisional application Ser. No. 63/287,806, filed Dec. 9, 2021.
Number | Date | Country | |
---|---|---|---|
63287806 | Dec 2021 | US |