You are currently viewing a new version of our website. To view the old version click .
Applied Sciences
  • Article
  • Open Access

17 January 2024

Mod2VQLS: A Variational Quantum Algorithm for Solving Systems of Linear Equations Modulo 2

and
IonQ, Inc., College Park, MD 20740, USA
*
Author to whom correspondence should be addressed.
This article belongs to the Special Issue Current Developments in Quantum Hybrid Systems

Abstract

This paper presents a system for solving binary-valued linear equations using quantum computers. The system is called Mod2VQLS, which stands for Modulo 2 Variational Quantum Linear Solver. As far as we know, this is the first such proposal. The design is a classical–quantum hybrid. The quantum components are a new circuit design for implementing matrix multiplication modulo 2, and a variational circuit to be optimized. The classical components are the optimizer, which measures the cost function and updates the quantum parameters for each iteration, and the controller that runs the quantum job and classical optimizer iterations. We propose two alternative ansatze or templates for the variational circuit and present results showing that the rotation ansatz designed specifically for this problem provides the most direct path to a valid solution. Numerical experiments in low dimensions indicate that Mod2VQLS, using the custom rotations ansatz, is on par with the block Wiedemann algorithm, which is the best-known to date solution for this problem.

1. Introduction

This report describes a new quantum hybrid algorithm for solving systems of linear equations modulo 2. In such problems, we want to find an n-vector x such that A x = b , where A is an m × n matrix and b is an m-vector, all values are 0 or 1, and arithmetic is performed modulo 2, so that 1 + 1 = 0 .
Linear equations with binary coefficients are less ubiquitous than those with real coefficients, but they still have key mathematical applications and commercial uses. For example, solving binary linear equations is an important step in state-of-the-art sieving approaches to integer factorization, in which we want to find large square numbers that are products of combinations of numbers whose prime factors are known, which means we want their exponents to be even [1,2].
This paper presents a new quantum hybrid algorithm for solving systems of binary linear equations, which as far as we know is the first to apply quantum computing to this problem. The solution’s approach has two steps. First, we define a quantum circuit implementing matrix–vector products over the relevant finite vector spaces. Our circuit has one gate for each non-zero entry in the coefficient matrix. Then, we derive a variational cost function that can be optimized in order to produce solutions to the given system. This frames the problem as one of optimizing a variational quantum circuit, which has become a standard approach in quantum machine learning on NISQ (noisy intermediate-scale quantum) hardware ([3], Chapter 5).
Solving systems of simultaneous linear equations is a standard problem, and is most familiar in situations where the coefficients in the equations are real or complex numbers. When the coefficient matrix is not square, direct methods leveraging the LU or QR decompositions emerge as the natural choice [4]. Obtaining these factorizations incurs a computational cost of O ( m n 2 ) , which sets a useful baseline expectation for such algorithms. As shown in Section 6, the Mod2VQLS approach uses a number of matrix–vector product calculations, which scales linearly in the system dimension. It is also comparable to the state-of-the art block Wiedemann method, which also leverages sparsity in the coefficient matrix. We note that the block Wiedemann method has been used in recent record-breaking RSA factorization calculations [5].
The rest of the paper is organized as follows. Section 2 introduces quantum gates and circuits used throughout the paper. Section 3 explains the construction of a quantum circuit that implements the crucial matrix–vector multiplication operation for binary-valued matrices and vectors. Section 4 pairs this circuit with a variational component that can be optimized in a hybrid quantum–classical computing framework in order to solve linear systems. In particular, this section introduces a simple rotations ansatz that is especially well-suited to the problem. Section 5 presents initial proof-of-concept experiments, showing that in low dimensions, with the rotations ansatz, the number of iterations needed to find a solution scales linearly in the number of dimensions (with a scaling factor around 4). Section 6 compares the method introduced here with established classical and quantum alternatives, and Section 7 discusses more of the potential applications.
We shall use the following notation throughout. We let F 2 denote the field with the two elements { 0 , 1 } . (In other works, F 2 is sometimes written as Z 2 Z / 2 Z , or G F ( 2 ) , where G F stands for Galois Field.) Addition in F 2 is written using the symbol ⊕, so that 0 0 = 0 , 0 1 = 1 0 = 1 , and 1 1 = 0 . We fix an m × n matrix A and an m-vector b with a i j , b i F 2 . In addition, we let x denote an arbitrary element of F 2 n . The problem of solving the linear system is to find x such that A x = b , in this case over F 2 m (so all arithmetic is modulo 2).

2. Quantum Circuits and Gates Used in this Paper

This background section briefly reviews the quantum gates used in the circuits below. These include the single-qubit Pauli-X gate and fractional Y-rotation gate R Y ( θ ) (Figure 1), and the 2-qubit CNOT and controlled-Z gates (Figure 2).
Figure 1. Single-qubit gates used in this paper and their corresponding matrices, which operate on the superposition state α | 0 + β | 1 written as the column vector α β T .
Figure 2. Two-qubit CNOT (controlled-X) and controlled-Z gates.
The Pauli-X gate is commonly used to flip a qubit between the | 0 and | 1 gates, which is why it is also sometimes called the quantum NOT gate. X-gates directed at different qubits can be used to prepare an input state representing a binary-valued vector: the state | 010 001 is prepared by applying an X-gate to each of the qubits to be switched to the | 1 state.
The Hadamard (H) gate is commonly used to put a qubit into a superposition state; for example, it maps a qubit prepared in the state | 0 to the superposition 1 2 ( | 0 + | 1 ) . Applying an H-gate to each qubit in an array is used to initialize a binary vector all of whose coordinates have a 50:50 chance of being observed in the | 0 or | 1 state.
The CNOT gate is a 2-qubit entangling gate, which acts upon the state α | 00 + β | 01 + γ | 10 + δ | 11 . In the standard basis, its behavior can be described as “performing a NOT operation on the target qubit if the control qubit is in state | 1 ”.
The Pauli-X, Hadamard, CNOT, and CX gates are self-inverse: performing these operations twice gives the identity map. These periodic properties are crucial for performing the binary arithmetic operations in the matrix–vector product of Section 3.
The R Y ( θ ) rotates a single qubit through an angle θ around the Y-axis on the Bloch sphere (Nielsen and Chuang [6], Chapter 1). The angle θ can be varied, and optimizing these angles for many gates is the task of the variational algorithm in Section 4. The controlled-Z gate is similar to the CNOT gate and entangles two qubits; in the standard basis, its action is symmetric (in the sense that it does not matter which qubit is considered to be the control and which the target qubit).

3. Implementing the Matrix–Vector Product as a Quantum Circuit

This section introduces a quantum circuit that implements the binary-valued matrix–vector product A x , where A is a matrix and x is a vector, and both have values in F 2 as defined above.
The trick is to notice that binary arithmetic may be implemented with controlled-NOT operations. The NOT gate switches the state of an individual qubit between | 0 and | 1 , and the CNOT gate performs such an operation only if the so-called control qubit is in state | 1 . In particular, the CNOT gate acts on the two-qubit state | y , z as
CNOT | y , z = | y , y z .
Now let | x = | x 1 , x 2 , , x n denote the n-qubit quantum state corresponding to x and notice that
A x a 11 x 1 a 1 n x n a m 1 x 1 a m n x n mod 2 .
Thus the m-qubit state | A x can be prepared by applying the quantum circuit
A = j = 1 n A j , with A j = i = 1 m CNOT ( j , n + i ) a i j
to the tensor product | x | 0 . Here, CNOT ( k , ) denotes a CNOT gate controlled by the k th qubit and targeting the th one. The product operator Π in these definitions denotes composition, so it is implemented by applying the gates in sequence. Both products in Relation (2) may be taken in any order. We note that A requires m + n qubits and N quantum gates, with N denoting the number of non-zero entries in A.
In particular, we obtain the following theorem.
Theorem 1.
Using A as in Relation (2), with | 0 denoting the m-qubit all-zero state, and with | x | 0 denoting the concatenation/tensor product of | x and | 0 , we have
A ( | x | 0 ) = | x | A x .
Proof. 
The proof follows from an easy argument by induction on n that is left to the reader: the base case n = 1 can be easily established for all m by verifying that the ith qubit in the output register is zero precisely when a i j = 0 , and the inductive step follows from a quick calculation considering the inductive hypothesis and the action of the CNOT gate, as in Relation (1). □
Example 1.
The following example elucidates Theorem 1. For concreteness, consider the 2 × 3 matrix
A = 1 0 1 1 1 0 s o t h a t A x x 1 x 3 x 1 x 2 mod 2 .
Then
A 1 = CNOT ( 1 , 4 ) CNOT ( 1 , 5 ) , A 2 = CNOT ( 2 , 5 ) , a n d A 3 = CNOT ( 3 , 4 ) ,
and therefore
A | x | 0 , 0 = A 3 A 2 | x | x 1 , x 1 = A 3 | x | x 1 , x 1 x 2 = | x | x 1 x 3 , x 1 x 2 = | x , A x .
The diagram in Figure 3 shows how the operator A is implemented explicitly as a quantum circuit.
Figure 3. Quantum circuit implementing the operator A from Example 1.
These circuits work because the self-inverse behavior of the X and CNOT gates is ideal for binary arithmetic over F 2 . It is possible that the periodic nature of other gates could be used similarly to perform arithmetic operations over other finite fields, but such an adaptation is not straightforward unless we consider qudits instead of qubits, because the way several CNOT gates combine angles into a single target qubit does not perform like group addition for fields other than F 2 . More precisely, the X and CNOT gates rotate their target qubits through angles 0 and π , which is all we need for the 0 and 1 elements of F 2 , but if this is extended to a larger set of angles 2 π / p for p 2 , the use of CNOT gates to combine different contributions into a single target qubit as in Figure 4 is nonlinear [7]. It follows that the coordinates of the output vector b are not the same as the sums of the various inputs ( A x ) j , except for the two-element field F 2 .
Figure 4. An “adder circuit” that combines the values of θ and ϕ into the target qubit, whose probability of measuring a | 1 is sin 2 ( θ ) cos 2 ( φ ) + cos 2 ( θ ) sin 2 ( φ ) , as demonstrated in [8]. Note the structural similarity with the inputs to ( A x ) 0 in Figure 3.

4. Solving the Linear System Using a Variational Quantum Algorithm

Now we propose a Variational Quantum Algorithm (VQA) designed to solve the linear system A x b mod 2 . As with any VQA, there are two main ingredients: a variational ansatz and a cost function that serves as the optimization objective. The ansatz gives a circuit pattern or template with gate parameters (typically angles) that can be varied and optimized. In this report we consider one objective function and compare two different ansatze: a rotations ansatz specially designed for the task, and a more generic brickwork ansatz.
The system as a whole is called Mod 2 VQLS , which stands for Modulo 2 Variational Quantum Linear Solver. Figure 5 illustrates the full variational circuit evaluated by Mod 2 VQLS when solving the linear system described in Example 1. In this case, the brickwork layout variational ansatz described in Section 4.2 is used, with 4 layers.
Figure 5. Variational circuit for solving A x = b as in Example 1 using a brickwork layout ansatz with 2 layers. The gray bars serve as visual aids helping th reader distinguish the different parts of the circuit: initial state creation, variational component, and matrix-vector product.
Our cost function here measures the overlap between the projector | ψ ( θ ) ψ ( θ ) | and the subspace orthogonal to | b , which is given by
C ^ = tr | ψ ( θ ) ψ ( θ ) | ( id | b b | ) .
We note that this cost function has appeared before in [9] as Equation (3) in the setting of solving square linear systems with real entries.
Some algebra shows that C ^ can be evaluated by computing the expected energy of an Ising Hamiltonian:
C ^ = tr | ψ ψ | ( id | b b | ) = ψ | ( id | b b | ) | ψ = 1 | b | ψ | 2 ,
where we have omitted the dependence on θ for simplicity of notation. Notice that the second term is the expected value of the rank-1 Ising Hamiltonian | b b | with eigenvalue 1 corresponding to the eigenstate | b , computed with respect to the variational state | ψ . Although it may be difficult to express this Hamiltonian as a linear combination of tensor products of Pauli matrices, we do not need to construct or even to know it explicitly; all we need is an oracle that can lazily evaluate the Hamiltonian’s eigenvalues.

4.1. Rotations Ansatz

Now we turn to our variational ansatze. The first is a simple rotations pattern that is particularly well-suited for the Mod2VQLS cost function C ^ . This ansatz is just a product of single-qubit rotations about the Y-axis; in particular, we take
V ( θ ) = j = 1 n R Y j ( θ j ) ,
with R Y j denoting an R Y rotation applied on the j t h r qubit and each parameter θ [ 2 π , 2 π ] n . This circuit is interesting because it does not add to the overall computational cost of each iteration, and it is amenable to direct mathematical analysis.
In particular, we can derive an explicit formula for the variational cost as a function of the circuit parameters.
Theorem 2.
For each x F 2 n , define α x ( θ ) = j = 1 n cos ( θ j / 2 ) ( 1 x j ) sin ( θ j / 2 ) x j . In addition, let A 1 ( b ) = { x F 2 n A x b mod 2 } denote the inverse image of b under A. Then,
C ^ ( θ ) = 1 x A 1 ( b ) α x ( θ ) 2
with | ψ ( θ ) = A V ( θ ) | 0 and V ( θ ) denoting the ansatz defined by Relation (4).
Proof. 
The theorem follows from direct calculation. First, note that
R Y ( θ j ) | 0 = cos ( θ j / 2 ) | 0 + sin ( θ j / 2 ) | 1 .
So, a quick induction, left to the reader as an exercise, shows that
V ( θ ) | 0 n = j = 1 n R Y j ( θ j ) | 0 = j = 1 n cos ( θ j / 2 ) | 0 + sin ( θ j / 2 ) | 1 = x F 2 n α x ( θ ) | x .
Combined with Theorem 1, the last equation yields an expression for our variational quantum state:
| ψ ( θ ) = A V ( θ ) | 0 n = x F 2 n α x ( θ ) | x | A x .
We use this expression to compute the variational cost with respect to | ψ ( θ ) . In particular, let
H = I | b b | = y F 2 n | y y | | b b |
and use Relation (3) to write
1 C ^ ( θ ) = | b | ψ ( θ ) | 2 = ψ ( θ ) | H | ψ ( θ ) .
Now, since α x ( θ ) is real, we see that
ψ ( θ ) | H | ψ ( θ ) = x , y α x ( θ ) α y ( θ ) x | y A x | b b | A y = x F 2 n α x ( θ ) 2 | A x | b | 2 = x A 1 ( b ) α x ( θ ) 2 ,
so C ^ ( θ ) = 1 x A 1 ( b ) α x ( θ ) 2 as desired. □
Moreover, we can obtain a similar formula for the gradient of the cost function with respect to the circuit parameters.
Theorem 3.
For each j = 1 , , n , the cost function C ^ ( θ ) varies like
θ j C ^ ( θ ) = x A 1 ( b ) ( 1 ) 1 x j α x ( θ ) α x e j ( θ )
with respect to θ j . Here,denotes binary addition over F 2 n and e j denotes the jth standard basis vector in F 2 n .
Proof. 
The theorem follows from a direct computation using the chain rule. The key is to notice that differentiating α x swaps a sine for a cosine and vice versa; for instance, if x j = 0 , and we fix c k = cos θ k 2 and s k = sin θ k 2 for simplicity of notation, we see that
θ j α x ( θ ) = θ j k = 1 n c k 1 x k s k x k = s j 2 k j c k 1 x k s k x k = 1 2 α x e j ( θ ) .
Theorem 3 helps us understand the critical points on the variational cost landscape. In particular, it shows that the gradient C ^ ( θ ) is smooth, and moreover, each of its entries is a trigonometric polynomial on the 2 n variables c j = cos θ j 2 and s j = sin θ j 2 , for j = 1 , , n . Thus, every critical point of the cost surface satisfies C ^ = 0 . When combined with the Pythagorean identities c j 2 + s j 2 = 1 , the equation C ^ = 0 characterizes an algebraic variety defined by 2 n polynomials in 2 n variables. Hence Bezout’s Theorem [10], Chapter 2 implies that C ^ has at most ( 2 n ) n · 2 n = ( 4 n ) n real extrema.
It is interesting to note that when ( c j , s j ) is an 8 n -th root of unity, our variational cost can be written in terms of quantum integers or q-integers, which are ubiquitous in q-calculus, the representation theory of quantized enveloping algebras and quantum groups, and in the theory of crystal bases, amongst others [11,12,13,14,15]. We conjecture that these points characterize the extrema of our cost function. The conjecture is motivated by the size of the variety characterized by C ^ = 0 together with the Pythagorean identities as computed by Bezout’s Theorem and by the explicit computations summarized by Theorem 5.
Definition 1.
For any complex q 1 and any integer n, the quantum integer or q-integer [ n ] q is defined by
[ n ] q = q n q n q q 1 = q n 1 + q n 3 + + q 3 n + q 1 n .
In this setting, quantum integers appear in the coefficients α x ( θ ) . In particular, let θ j = π 2 n p j for any p j { 0 , 1 , , 4 n 1 } , let ξ = e i π 4 n denote a primitive 8 n -th root of unity, and notice
cos ( θ j / 2 ) 1 x j sin ( θ j / 2 ) x j = i 1 x j e i π p j 2 i 1 x j e i π p j 2 1 2 i = [ 2 n ( 1 x j ) + p j ] ξ [ 2 n ] ξ .
We use the last identity to prove the existence of globally optimal parameters for our variational circuit. It is important to observe these guarantees are not typically offered by VQAs; for instance, QAOA can only guarantee such parameters in the limit of infinite circuit depth.
We will need the following identities.
Lemma 4.
If ξ = e i π 4 n denotes a primitive 8 n -th root of unity, then the following identities relating ξ-integers hold:
[ 3 n ] ξ = [ n ] ξ = [ 2 n ] ξ 2 , a n d [ 4 k n ] ξ = 0 f o r a n y k Z .
Proof. 
The lemma follows from direct calculation. For example,
[ 3 n ] ξ = ξ 3 n ξ 3 n ξ ξ 1 = 2 i ξ ξ 1 · sin 3 n · π 4 n = 2 i ξ ξ 1 · sin n · π 4 n = [ n ] ξ .
The second equality follows because sin n · π 4 n = 1 / 2 and ξ 2 n = i , so that ξ 2 n ξ 2 n = 2 i . The last equality holds because ξ is an 8 n -th root of unity; in particular, ξ 4 k n = ξ 4 k n . □
Theorem 5.
Let θ = π 2 n p for some p Z n . First, suppose p = 2 n x for some x { 0 , 1 } n . Then, C ^ ( θ ) = 0 is a global minimum of C ^ : R n R if x satisfies A x = b ; otherwise, C ^ ( θ ) = 1 is a global maximum of the cost function.
Now assume p 1 = = p n = k n for some odd integer k and let rk ( A ) denote the rank of A over F 2 . In this case, C ^ ( θ ) = 1 2 rk ( A ) .
Proof. 
First, notice our cost function is non-negative; for any θ R n , we have
C ^ ( θ ) = 1 x A 1 ( b ) α x ( θ ) 2 1 x F 2 n α x ( θ ) 2 = 1 ψ ( θ ) | ψ ( θ ) = 0 .
This follows from Relation (5), which writes | ψ ( θ ) as a superposition over a tensor product of computational basis states with amplitudes given by α x ( θ ) . In addition, C ^ is bounded above by 1 because each α x ( θ ) 2 is non-negative. This means 0 C ^ ( θ ) 1 for every θ R n .
Thus, to prove the first claim, it remains to be shown that when p = 2 n x , the cost function vanishes if x belongs to the inverse image A 1 ( b ) and it is unity otherwise. This follows from direct calculation:
1 C ^ ( θ ) = x A 1 ( b ) α x ( θ ) 2 = 1 [ 2 n ] ξ 2 n x A 1 ( b ) j = 1 n [ 2 n ( 1 x j + x j * ) ] ξ 2 = 1 [ 2 n ] ξ 2 n x A 1 ( b ) δ x , x [ 2 n ] ξ 2 n = x A 1 ( b ) δ x , x .
Note that the product in the second equality vanishes whenever x x because [ 4 n ] ξ = 0 .
For the second claim, write k = 4 m + r for some integer m and with r = 1 , 3 . Now recall the well-known ‘summation rule’ [ s + t ] q = q s [ t ] + q t [ s ] q for quantum integers ([12], Relation V1.1.2). When combined with Lemma 4, the summation rule implies
[ k n ] ξ = ξ r n [ 4 m n ] ξ + ξ 4 m n [ r n ] ξ = ( 1 ) m [ r n ] ξ .
In addition, note that if r = 3 , Relation (6) implies [ ( r + 2 ) n ] ξ = [ 5 n ] ξ = [ r n ] ξ . Thus, if 1 T x Z denotes the (integer) sum of the elements of x, we see that
1 C ^ ( θ ) = x A 1 ( b ) α x ( θ ) 2 = 1 [ 2 n ] ξ 2 n x A 1 ( b ) j = 1 n [ 2 n ( 1 x j ) + k n ] ξ 2 = 1 [ 2 n ] ξ 2 n x A 1 ( b ) [ ( k + 2 ) n ] ξ n 1 T x [ k n ] ξ 1 T x 2 = 1 [ 2 n ] ξ 2 n x A 1 ( b ) [ ( r + 2 ) n ] ξ n 1 T x [ r n ] ξ 1 T x 2 = 1 [ 2 n ] ξ 2 n x A 1 ( b ) [ n ] ξ 2 n = | A 1 ( b ) | 2 2 n .
In the fourth equality we used Lemma 4 to simplify [ ( r + 2 ) ] ξ 2 = [ r n ] ξ 2 = [ n ] ξ 2 . In the fifth equality we applied Lemma 4 again, this time substituting [ n ] ξ = [ 2 n ] ξ / 2 .
To conclude, we recall the solution set A 1 ( b ) is an affine space in F 2 n with one point for each element of the kernel of A. Hence, if we let null ( A ) denote the dimension of ker A over F 2 and we recall the Rank–Nullity Theorem we obtain the desired result:
C ^ ( θ ) = 1 | A 1 ( b ) | 2 2 n = 1 2 null ( A ) 2 n = 1 2 rk ( A ) .

4.2. Brickwork Ansatz

The other variational ansatz we consider comprises a brickwork layout of parametrized two-qubit gates. For instance, Figure 6 illustrates a brickwork layout ansatz with a depth of 5 layers on 4 qubits. The two-qubit ‘brick’ design was used by authors including [9] for general linear solving and [16] for electron simulation. Various other general-purpose ansatz designs could be tried.
Figure 6. A brickwork layout ansatz on 4 qubits with a depth of 5 layers.
With enough layers, it should be possible for the brickwork ansatz to provide solutions to the equation A x = b , and intuitively, we expected that convergence would be slower but that the method might find more solutions overall. In practice, the convergence was considerably slower, and in most cases, the number of extra solutions found was modest.

4.3. Variational Parameter Optimization

Along with the quantum circuits, hybrid systems like Mod2VQLS rely on classical algorithms to optimize the variational parameters (for example, the θ parameters in the examples so far). Parameter optimization in variational quantum circuits has become an important topic in quantum machine learning, partly because it is a signification barrier to overcome if variational quantum circuits are to deliver valuable applications on NISQ hardware.
A considerable challenge here is that automatic differentiation (“autodiff”) is not straightforward on quantum computers: finite-difference methods require too many nearby calculations, and even when an analytic expression for gradients is available using a ‘parameter shift rule’, these expressions have to be evaluated separately for each parameter ([3], §5.3). As fresh problems are encountered, it is possible that quantum computers are not well-suited to computing gradients, and that there is no quantum approach to training variational networks that is as generally effective as classical backpropagation [17].
Simplex-based methods are a well-established alternative to gradient-based methods. In the simple one-dimensional case, binary search is an elementary example. In more dimensions, an n-dimensional simplex is the convex hull of n linearly independent vertices, and the search algorithm converges by iteratively partitioning the simplex and reducing to a smaller simplex that contains the desired solution. (For example, a triangle subdivided by a suitable line, or a tetrahedron subdivided by a suitable plane.) This is the backbone of many procedures, including the famous 1965 simplex algorithm of Nelder and Mead [18]. Nelder–Mead can sometimes be improved using interpolation based on the values of the objective function at the vertices, leading to the COBYLA algorithm published in 1994 [19]. SciPy’s COBYLA implementation was used in the Mod2VQLS experiments presented below.

4.4. Alternatives

There are several alternatives and ways this design could be varied. With the quantum parts of the system, one could use a different two-qubit block in the brickwork layout ansatz. More generally, we could use a different ansatz altogether. In particular, it might be beneficial to incorporate linear-algebraic information into the ansatz, such as something that encourages the superposition to be orthogonal to the range of A, in case b = 0 . Also, a swap test could be used for computing C ^ as part of the quantum circuit itself [20]. This may serve as a way to mitigate the measurement error, at the cost of requiring additional qubits.
For the classical parts of the system, we have discussed the reason for choosing a simplex-based rather than a gradient-based optimizer. This broad-strokes distinction leaves many opportunities for more specific combinations to be evaluated. Other optimization algorithms including SPSA (gradient-free) and AMSGrad (gradient-based) have also been evaluated by Pellow-Jarman et al. [21]. Finding ideal combinations of classical optimizers and quantum circuit ansatze is likely to remain an important research topic.

5. Experimental Results

This section describes the results of experiments evaluating the performance of Mod2VQLS solvers using both the rotation and brickwork ansatze.
In each dimension from 1 to 9, we generated ten consistent binary linear systems by constructing n × n matrices A and n-vectors x with independent and uniformly selected entries in { 0 , 1 } and then computing A x = b . Then, we solved the systems using Mod2VQLS, using both the brickwork and rotation ansatze. Solving a linear system entails optimizing the model’s variational parameters and then measuring the optimized state | ψ ( θ * ) . We tested all the computational states observed in the optimized superposition in order to determine whether they were valid solutions to the linear system in question. We counted the number of distinct valid and invalid solutions proposed, as well as the average number of iterations required for convergence of the variational method. We used SciPy 1.11’s COBYLA implemetation to update the variational parameters in our circuits; we note this optimization routine only requires a single quantum circuit execution per iteration. Circuits were coded and simulated using the Qiskit Python package [22].
In the brickwork case, the number of layers in the variational ansatz is an extra configuration parameter. From experimenting, we found that at least two layers were needed and that matching the number of layers/parameters to the number of dimensions produced a reasonable tradeoff between solution iterations and correctness.
Our results are presented in Table 1. The rotations ansatz performed quite simply and effectively, always finding a correct solution, and occasionally finding more than one, with a reasonably small number of iterations. The rotations ansatz proposed no invalid solutions. The brickwork ansatz was more costly and error-prone, using more iterations and producing some invalid solutions. The brickwork ansatz was also able to find a greater variety of valid solutions, though not dramatically so.
Table 1. Experimental results using brickwork and rotation ansatze in various dimensions, using 10 randomly generated matrices in each dimension, showing how many valid and invalid solutions were proposed, and how many iterations were used, by each method.
Figure 7 shows the growth in the number of iterations used by Mod2VQLS with the rotations ansatz. The growth is roughly linear in small dimensions, with a slope of (just under) 4. This allows for comparison with block Wiedemann, as explained in Section 6 below.
Figure 7. Average number of iterations needed to find a solution for each dimension using the rotations ansatz. The number of iterations grows approximately linearly, with a slope just under 4.
These experiments demonstrate proof-of-concept, in that the Mod2VQLS system does find correct solutions. They also demonstrate that there are performance tradeoffs, and that different choices of ansatz may be appropriate, depending on whether the task requires searching for any solution, or a more exhaustive search for all solutions.
These results are preliminary. The Mod2VQLS algorithm should be tested on larger systems of linear equations and compared with the results of classical solvers. The robustness of the circuits at larger scales with different kinds of noise has not yet been analyzed.

8. Conclusions

Variational quantum circuits provide design patterns that can be applied to a range of mathematical problems, especially ones that can be expressed as optimization problems with respect to some cost function. This paper demonstrated the Mod2VQLS system, which applies this design pattern to the problem of solving linear systems modulo 2. The key ingredients are a circuit for computing the matrix multiplication, a variational ansatz including parameters to optimize, and a classical optimization process. The rotation ansatz provided the most direct path to results, largely because its simple design made it amenable to analytical methods.
At the scales available to quantum computers today, the results here are potentially promising, but do not compete with classical solvers. The goal of this research is to investigate potential advantages at larger scale: we expect that medium-scale quantum computers will find their first regular commercial uses as part of larger hybrid pipelines. Understanding the quantum opportunities, and in particular, their scaling properties on real data sizes and distributions, will be crucial for guiding the choice between quantum opportunities. The Mod2VQLS system presented here is a worked example of how such proposals can be implemented and investigated today.

Author Contributions

Conceptualization, W.A. and D.W.; Methodology, W.A.; Software, W.A. and D.W.; Validation, D.W.; Formal analysis, W.A.; Investigation, D.W.; Writing—original draft, W.A. and D.W.; Writing—review & editing, W.A. and D.W.; Visualization, D.W. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The data presented in this study are available on request from the corresponding author. The data are not publicly available due to limited access to IonQ private repositories.

Conflicts of Interest

Author Willie Aboumrad and Dominic Widdows were employed by the company IonQ, Inc. The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

References

  1. Pomerance, C. A tale of two sieves. Not. Am. Math. Soc. 1996, 43, 1473–1485. [Google Scholar]
  2. Aboumrad, W.; Widdows, D.; Kaushik, A. Quantum and Classical Combinatorial Optimizations Applied to Lattice-Based Factorization. arXiv 2023, arXiv:2308.07804. [Google Scholar]
  3. Schuld, M.; Petruccione, F. Machine Learning with Quantum Computers; Springer: Berlin/Heidelberg, Germany, 2021. [Google Scholar]
  4. Trefethen, L.N.; Bau, D. Numerical Linear Algebra; S.I.A.M.: Philadelphia, PA, USA, 1997. [Google Scholar]
  5. Boudot, F.; Gaudry, P.; Guillevic, A.; Heninger, N.; Thome, E.; Zimmermann, P. Comparing the difficulty of factorization and discrete logarithm: A 240-digit experiment. In Proceedings of the Advances in Cryptology–CRYPTO 2020: 40th Annual International Cryptology Conference, CRYPTO 2020, Santa Barbara, CA, USA, 17–21 August 2020; pp. 62–91. [Google Scholar] [CrossRef]
  6. Nielsen, M.A.; Chuang, I. Quantum Computation and Quantum Information; American Association of Physics Teachers: Cambridge, UK, 2002. [Google Scholar]
  7. Widdows, D.; Zhu, D.; Zimmerman, C. Near-Term Advances in Quantum Natural Language Processing. arXiv 2022, arXiv:2206.02171. [Google Scholar]
  8. Widdows, D. Nonlinear Addition of Qubit States Using Entangled Quaternionic Powers of Single-Qubit Gates. arXiv 2022, arXiv:2204.13787. [Google Scholar]
  9. Bravo-Prieto, C.; LaRose, R.; Cerezo, M.; Subasi, Y.; Cincio, L.; Coles, P.J. Variational quantum linear solver. Quantum 2023, 7, 1188. [Google Scholar] [CrossRef]
  10. Fischer, G. Plane Algebraic Curves; American Mathematical Society: Providence, RI, USA, 2001; Volume 15. [Google Scholar]
  11. Kac, V.G.; Cheung, P. Quantum Calculus; Springer: Berlin/Heidelberg, Germany, 2015. [Google Scholar]
  12. Kassel, C. Quantum Groups; Springer: New York, NY, USA, 1995. [Google Scholar]
  13. Chari, V.; Pressley, A. A Guide to Quantum Groups; Cambridge University: London, UK, 2000. [Google Scholar]
  14. Kashiwara, M. Crystalizing the q-analogue of universal enveloping algebras. Commun. Math. Phys. 1990, 133, 249–260. [Google Scholar] [CrossRef]
  15. Lusztig, G. Canonical bases arising from quantized enveloping algebras. J. Am. Math. Soc. 1990, 3, 447–498. [Google Scholar] [CrossRef]
  16. Niu, D.; Haghshenas, R.; Zhang, Y.; Foss-Feig, M.; Chan, G.K.L.; Potter, A.C. Holographic simulation of correlated electrons on a trapped-ion quantum processor. PRX Quantum 2022, 3, 030317. [Google Scholar] [CrossRef]
  17. Abbas, A.; King, R.; Huang, H.Y.; Huggins, W.J.; Movassagh, R.; Gilboa, D.; McClean, J.R. On quantum backpropagation, information reuse, and cheating measurement collapse. In Proceedings of the Thirty-Seventh Annual Conference on Neural Information Processing Systems (NeurIPS), New Orleans, LA, USA, 10–16 December 2023. [Google Scholar]
  18. Nelder, J.A.; Mead, R. A simplex method for function minimization. Comput. J. 1965, 7, 308–313. [Google Scholar] [CrossRef]
  19. Powell, M.J. A view of algorithms for optimization without derivatives. Math.-Today-Bull. Inst. Math. Its Appl. 2007, 43, 170–174. [Google Scholar]
  20. Buhrman, H.; Cleve, R.; Watrous, J.; De Wolf, R. Quantum fingerprinting. Phys. Rev. Lett. 2001, 87, 167902. [Google Scholar] [CrossRef]
  21. Pellow-Jarman, A.; Sinayskiy, I.; Pillay, A.; Petruccione, F. A comparison of various classical optimizers for a variational quantum linear solver. Quantum Inf. Process. 2021, 20, 202. [Google Scholar] [CrossRef]
  22. Anis, M.S.; Abby-Mitchell; Abraham, H.; AduOffei; Agarwal, R.; Agliardi, G.; Aharoni, M.; Akhalwaya, I.Y.; Aleksandrowicz, G.; Alexander, T.; et al. Qiskit: An Open-Source Framework for Quantum Computing; Zenodo: Geneva, Switzerland, 2021. [Google Scholar] [CrossRef]
  23. Harrow, A.W.; Hassidim, A.; Lloyd, S. Quantum algorithm for linear systems of equations. Phys. Rev. Lett. 2009, 103, 150502. [Google Scholar] [CrossRef] [PubMed]
  24. Dervovic, D.; Herbster, M.; Mountney, P.; Severini, S.; Usher, N.; Wossnig, L. Quantum linear systems algorithms: A primer. arXiv 2018, arXiv:1802.08227. [Google Scholar]
  25. Aaronson, S. Read the fine print. Nat. Phys. 2015, 11, 291–293. [Google Scholar] [CrossRef]
  26. Patil, H.; Wang, Y.; Krstić, P.S. Variational quantum linear solver with a dynamic ansatz. Phys. Rev. A 2022, 105, 012423. [Google Scholar] [CrossRef]
  27. Trahan, C.J.; Loveland, M.; Davis, N.; Ellison, E. A Variational Quantum Linear Solver Application to Discrete Finite-Element Methods. Entropy 2023, 25, 580. [Google Scholar] [CrossRef]
  28. Golub, G.; van Loan, C. Matrix Computations; John Hopkins University Press: Baltimore, MD, USA, 1996. [Google Scholar]
  29. Coppersmith, D. Solving homogeneous linear equations over GF(2) via block Wiedemann algorithm. Math. Comput. 1994, 62, 333. [Google Scholar] [CrossRef]
  30. Kaltofen, E. Analysis of Coppersmith’s block Wiedemann algorithm for the parallel solution of sparse linear systems. Math. Comput. 1995, 64, 777. [Google Scholar] [CrossRef]
  31. Soos, M.; Nohl, K.; Castelluccia, C. Extending SAT solvers to cryptographic problems. In Proceedings of the International Conference on Theory and Applications of Satisfiability Testing, Swansea, UK, 30 June–3 July 2009; pp. 244–257. [Google Scholar]
  32. Alonso, D.; Sánchez, P.; Sánchez-Rubio, F. Engineering the development of quantum programs: Application to the Boolean satisfiability problem. Adv. Eng. Softw. 2022, 173, 103216. [Google Scholar] [CrossRef]
  33. Rupp, A.; Pelzl, J.; Paar, C.; Mertens, M.; Bogdanov, A. A parallel hardware architecture for fast Gaussian elimination over GF(2). In Proceedings of the 2006 14th Annual IEEE Symposium on Field-Programmable Custom Computing Machines, Napa, CA, USA, 24–26 April 2006; pp. 237–248. [Google Scholar]
  34. Wang, W.; Szefer, J.; Niederhagen, R. Solving large systems of linear equations over GF(2) on FPGAs. In Proceedings of the 2016 International Conference on ReConFigurable Computing and FPGAs (ReConFig), Cancun, Mexico, 30 November–2 December 2016; pp. 1–7. [Google Scholar] [CrossRef]
  35. Hu, J.; Wang, W.; Gaj, K.; Chen, D.; Wang, H. Universal Gaussian Elimination Hardware for Cryptographic Purposes. Cryptol. ePrint Arch. 2022. Available online: https://eprint.iacr.org/2022/928.pdf (accessed on 9 January 2024).
  36. Luby, M.G.; Mitzenmacher, M.; Shokrollahi, M.A.; Spielman, D.A.; Stemann, V. Practical loss-resilient codes. In Proceedings of the Twenty-Ninth Annual ACM Symposium on Theory of Computing, El Paso, TX, USA, 4–6 May 1997; pp. 150–159. [Google Scholar]
  37. Babar, Z.; Botsinis, P.; Alanis, D.; Ng, S.X.; Hanzo, L. Fifteen years of quantum LDPC coding and improved decoding strategies. IEEE Access 2015, 3, 2492–2519. [Google Scholar] [CrossRef]
  38. Verdon, G.; McCourt, T.; Luzhnica, E.; Singh, V.; Leichenauer, S.; Hidary, J. Quantum graph neural networks. arXiv 2019, arXiv:1909.12264. [Google Scholar]
  39. Mernyei, P.; Meichanetzidis, K.; Ceylan, I.I. Equivariant quantum graph circuits. In Proceedings of the International Conference on Machine Learning, Baltimore, MD, USA, 17–23 July 2022; pp. 15401–15420. [Google Scholar]
  40. Panteleev, P.; Kalachev, G. Quantum LDPC codes with almost linear minimum distance. IEEE Trans. Inf. Theory 2021, 68, 213–229. [Google Scholar] [CrossRef]
  41. Breuckmann, N.P.; Eberhardt, J.N. Quantum low-density parity-check codes. PRX Quantum 2021, 2, 040101. [Google Scholar] [CrossRef]
  42. Yang, C.H.H.; Qi, J.; Chen, S.Y.C.; Chen, P.Y.; Siniscalchi, S.M.; Ma, X.; Lee, C.H. Decentralizing feature extraction with quantum convolutional neural network for automatic speech recognition. In Proceedings of the ICASSP 2021–2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Toronto, ON, Canada, 6–11 June 2021; pp. 6523–6527. [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.