Near term algorithms for linear systems of equations

Finding solutions to systems of linear equations is a common problem in many areas of science and engineering, with much potential for a speed up on quantum devices. While the Harrow–Hassidim–Lloyd (HHL) quantum algorithm yields up to an exponential speed up over classical algorithms in some cases, it requires a fault-tolerant quantum computer, which is unlikely to be available in the near-term. Thus, attention has turned to the investigation of quantum algorithms for noisy intermediate-scale quantum (NISQ) devices where several near-term approaches to solving systems of linear equations have been proposed. This paper focuses on the Variational Quantum Linear Solvers (VQLS), and other closely related methods and adaptions. Several contributions are made in this paper, which include: the first application of the Evolutionary Ansatz to the VQLS (EAVQLS), the first implementation of the Logical Ansatz VQLS (LAVQLS), based on the Classical Combination of Quantum States (CQS) method, a proof of principle demonstration of the CQS method on real quantum hardware and a method for the implementation of the Adiabatic Ansatz on the VQLS (AAVQLS). These approaches are implemented and contrasted. The CQS method is run with moderate success on a real quantum device. The EAVQLS and AAVQLS show promise as possible improvements to the standard VQLS algorithm once refined.


I. INTRODUCTION
Systems of linear equations play an important role in many areas of science and engineering, making the potential quantum speed-up for solving them of great interest.Solving a system of N linear equations with N unknowns, expressible as A x = b, involves finding the unknown solution vector x satisfying A x = b.This is known as the Linear Systems Problem (LSP).
The Harrow-Hassidim-Lloyd (HHL) algorithm [1] is a proposed quantum algorithm for the quantum linear systems problem (QLSP) [2], a quantum analogue of the LSP.The QLSP is stated as follows: Let A be an N × N hermitian matrix (however this algorithm is not limited to a hermitian matrix) and let x and b be N dimensional vectors, satisfying A x = b, having corresponding quantum states |x and |b , such that If A is not hermitian, define Ã = 0 A A † 0 , which is hermitian, and instead solve the equation Ã y = b 0 and solve for y = 0 x .Given access to matrix A by means of an oracle, and a unitary gate U such that U |0 = |b , output a quantum state |x such that |||x − |x || 2 ≤ , where is the error-bound of the approximate solution.
The HHL algorithm is a quantum algorithms expected to give a substantial speed-up over classical approaches, providing up to an exponential speed-up over known classical algorithms in cases where the linear system is sparse, the condition number is low, and the actual solution vector is not required to be read out, but instead some scalar measure on the solution vector is of interest.As with many promising quantum algorithms, the HHL algorithm requires a fault-tolerant quantum computer to be successfully implemented, predicted to only be available in the long term future.
Approaches at finding algorithms for noisy intermediate-scale quantum (NISQ) devices [3], available in the near-term future, have focused mainly on a class of algorithms known as Variational Hybrid Quantum Classical Algorithms (VHQCAs).
The idea behind VHQCAs is to utilize a quantum-classical feedback loop.Here a quantum device is used to compute a cost function for a parameterized quantum circuit (ansatz), much more efficiently than is possible on a classical device [6], while a classical device is used to optimise the selection of the ansatz parameters.VHQCAs rely on the use of short depth quantum circuits to make them more resistant to noise and allowing them to be successfully run on NISQ quantum hardware.The main difficulties of this approach lie in overcoming the noise inherent in quantum devices and the difficulty of optimizing the ansatz parameters.An example of these difficulties is the barren plateau problem [4].
The Variational Quantum Eigensolver (VQE) [5] is one notable VHQCA that solves the optimization problem, whereby the minimum eigenvalue E of some Hamiltonian H is approximated through the optimization of θ for some ansatz V (θ).The Variational Quantum Linear Solver [6,7] is based on the VQE, recently proposed to solve the quantum linear systems problem.Since its proposal, many variations have also been presented in order to overcome various difficulties faced by the algorithm, and VHQCAs in general.Attempts to combat these difficulties include training approaches like the Adiabatic Assisted VQE [7] and ansatz variations such as the Logical Ansatz, being a Classical Combination of various Ansätze [7,8] and the Evolutionary Ansatz [9], an evolutionary approach for Ansatz construction.The evolutionary ansatz was initially proposed for use in the VQE and has been applied here for the VQLS variation.Another non-variational approach to solving the quantum linear systems problem is the Classical Combination of Quantum States (CQS) method [7], of which the Logical Ansatz approach outlined in this paper is an adaption.
The following approaches were implemented and will be discussed in this paper: This paper makes several contributions to the literature on the VQLS.Firstly, we present the first application of the Evolutionary Ansatz to the VQLS.The Evolutionary Ansatz has previously been applied to the Variational Quantum Eigensolver [9].Secondly, the implementation proposed for solving systems of linear equations using the AAVQLS is also new to this work.Also, the first proof of principle demonstration of the CQS method on a real quantum device is conducted.Lastly, the first known implementation of the Logical Ansatz VQLS is given, with proposed training methods that are new to this work.All implementations of these approaches may be found in the Github repository [10].
This paper begins with a description of the above nearterm approaches for the Quantum Linear Systems Problem.Some experiments designed for an evaluation of these approaches are outlined in the section following that.We then present and discuss the results of the experiments.

II. NEAR-TERM ALGORITHMS
The inputs to the all the near-term algorithms below are the matrix A, and vector b.A is given in a slightly different form here than in the QLSP.Here A is given by m unitary matrices A i , implemented as unitary gates, such that A = m i=1 c i A i , c i ∈ C (any hermitian matrix in a finite-dimensional space can be written as a linear combination of unitary matrices).Also given is a unitary gate U, such that U |0 = |b .VQLS cost functions often require either or both A i and U to be given as controlled gates, which is assumed possible.

A. Variational Quantum Linear Solver
The standard VHQCA approach for the quantum linear systems problem is the Variational Quantum Linear Solver, itself being a basic application of the VQE.The VQLS simply involves the selection of a suitable ansatz, cost function, and classical optimizer.The algorithm runs in a simple feedback-loop, whereby the classical optimizer finds the optimal parameters for the ansatz circuit, by iteratively evaluating the cost function on the quantum device, and updating the parameters until a minimum cost value is achieved.The quantum device is used to evaluate the cost function, because it is much more efficient than any known method on a classical device for this step [6].
Let the ansatz be denoted by V (α), and let the optimal ansatz parameters be denoted by α * .Then once the VQLS algorithm terminates, V (α * ) |0 = |x , where |||x − |x || 2 ≤ , where is the error-bound of the approximate solution, and |x is the exact solution as described by equation (I).
Hardware-efficient ansätze are designed without taking into account the specific problem being solved, that is matrix A and |b , but rather only the topology (backend connectivity of the qubits) and available gates of a specific quantum computer.A hardware-efficient ansatz can be denoted by a sequence of n parameterized quantum gates as, where γ i denotes a specific parameterized gate in the quantum circuit, and α i denotes that parameters value.These ansätze can be constructed to be more resistant to noise on any specific available quantum device, but they may fall short finding a solution |x , as any particular hardware-efficient ansätze is not guaranteed to span the region of the Hilbert space containing any good approximation of the solution |x .Therefore a hardwareefficient ansatz effectively trades potential relevance to the specific problem, for increased noise resistance.
Problem-specific ansätze on the other hand do not take into account the specific quantum device being used, and rather try to exploit the knowledge of the problem available.The Quantum Alternating Operator Ansatz (QAOA) [6] is one such proposed problem-specific ansatz, using two hamiltonians, known as the driver and the mixer, denoted by H D and H M respectively, constructed from specific knowledge of the problem, namely A and b.This problem-specific ansatz can be denoted by a repeating sequence of driver and mixer hamiltonian simulations, each being applied for a variable amount of time.These time parameters α are the trainable aspect of this problem specific ansatz, which are optimized by some classical device.The QAOA can be denoted as, The requirement of Hamiltonian simulation from the QAOA makes these ansätze far less near-term, therefore these ansätze are not considered further in this paper.More information on the specific construction of the QAOA, including operators H D and H M is given in [6].

VQLS Cost Functions
The cost function Hamiltonian is where the application of the VQE algorithm to solving systems of linear equations is implemented.Various different cost functions have been proposed for the VQLS [6,7].For simplicity, denote the state V (α) |0 , as |x , and let |ψ = A |x .Ref. [6] proposes a cost function based on the overlap between the projector |ψ ψ| and the subspace orthogonal to |b .This cost function also normalizes the expectation value of the Hamiltonian to improve performance.The cost function is given by, where the Hamiltonian H G is given by, This cost function can have gradients that vanish exponentially with the number of qubits.To improve on this shortfall, the cost function C L is proposed by replacing H G with a local version of the Hamiltonian, H L , improving the trainability of the ansatz, given by, where 1j denotes identity on all qubits except qubit j.The cost function C L can be computed using the Hadamard Test as shown in Fig. 2. C L has been shown to be equivalent cost function to C G , however having improved performance [6], and is explicitly given by,

Classical Optimizers
The VQLS admits the use of either gradient-free or gradient-based optimizers.For gradient-based optimizers, gradient values can be found analytically [6,11], or estimated through finite differences.The classical optimizer chosen has a large impact on how well the optimization process deals with the noise inherent in NISQ devices.Some classical optimizers handle noise better than others [12], making classical optimizer selection important.

B. Adiabatic Assisted VQLS
The Adiabatic Assisted Variational Quantum Linear Solver (AAVQLS) [7], simply augments the standard FIG. 2. Hadamard Test Circuits for cost function CL Eq. ( 9).The top circuit is employed when calculating the value of the numerator x|HL|x , while the bottom circuit is employed when calculating the value of the denominator, ψ|ψ .The S † gate, is included when calculating imaginary-valued parts of the cost function, and excluded when calculating the realvalued parts.
VQLS approach, by proposing a variation in the Hamiltonian over time, inspired by adiabatic quantum computing methods [13], in an attempt to allow the ansatz state to always be close to the ground state of the Hamiltonian.Let H 0 be a Hamiltonian with a known ground state, and let H 1 be the Hamiltonian whose ground state corresponds to the solution of the linear system in question.Let the Hamiltonian of the AAVQLS be given by (1 − s)H 0 + sH 1 , where s is a discrete parameter, varying from s = 0, to s = 1, in T discrete intervals, during the optimization process.
This approach is the same as the VQLS with respect to the cost function and classical optimizer, however the ansatz must be chosen such that it can be easily initialized in the ground state of H 0 at the start of the algorithm.The only added procedure to the AAVQLS from the VQLS occurs during the training phase, where the parameter s is varied in T discrete intervals from s = 0 to s = 1, thereby varying the hamiltonian from Proposed here is one way in which the AAVQLS can be implemented as an adaption of the VQLS.Firstly the linear system is reformulated as, where s can be varied from 0 to 1, with x = b, when s = 0, and where α can be initialized such that V (α) = 1, append to it the unitary U (for creating state |b ) to create ansatz V AAV QLS (α) as below, Here V AAV QLS |0 is indeed be equal to |b when α is initialized appropriately (such that V (α) = 1).

Increment s by 1
T .3. Using the VQLS approach, with initial ansatz parameters set to α previous , find the new optimal parameters α current with ansatz V AAVQLS .

C. Evolutionary Ansatz VQLS
The Evolutionary Ansatz [9] utilises a genetic algorithm to construct the parameterized quantum circuit, while concurrently optimising its parameters.This approach adapts the ansatz structure to both the specified problem and the backend configuration of the quantum device available, so it can be thought of as constructing an ansatz that is both hardware-efficient and problemspecific.This specialized ansatz would be highly noise resistant (being shallower and requiring fewer 2-qubit gates) while remaining applicable to the specific problem being solved.This approach still requires a VQLS cost function and classical minimizer, as standard in with VQLS.
The main outline of the Evolutionary Ansatz algorithm is presented here.For a full explanation please see the original paper [9].Some specific details about the evolutionary ansatz implementation in this discussion differ from the original paper.
Evolutionary Algorithms are based on the principle of natural selection.The Evolutionary Ansatz VQLS (EAVQLS) mimics this principle to adapt the ansatz choice by evolving a set of candidate ansatze, known as the population, through random mutations (the EAVQLS only mimics asexual reproduction, there are no crossovers between candidate solutions in the population).The candidate ansatze being evolved are known as genomes.A genome consists of a list of genes, and for the EAVQLS is given as follows.If V i (α) is any potential ansatz in the population, V i (α) is expressed as a genome g i that can be written as, where each γ i is a gene.Each gene γ i is a layer of gates such that each qubit of the ansatz is assigned a gate.This set of gates is chosen from a gate set, where I 2 is the single qubit identity gate, U 3 is the universal single qubit rotation, and ∧ 1 U 3 is the controlled version of U 3 .Other gate sets may be used, for example, if the VQLS problem only deals with real valued A and b, an appropriate gate set is given by, An example of an evolutionary ansatz genome is shown in Fig. 3. Initially, the evolutionary algorithm begins with a population consisting of random genomes, each only consisting of a single gene.The qubits in all ansatz circuits are initialized with the gate H ⊗n , allowing the first gene in the genome to contain controlled gates that aren't redundant when the ansatz corresponding to the genome is applied to the state |0 ⊗n .These genomes are evolved asexually, through the use of 3 genetic operators, topological search, parameter search and removal.
The topological search operator, τ , explores the space of possible ansätze, by adding a new random gene to the genome, which is equivalent to adding a new random layer of gates to the ansatz represented by the genome.The new gene added to the genome is initialized as identity, to ensure that the genome's fitness may only improve, or at worst, remain the same.The new gene added to the genome also takes into account the gates of the previous gene in the genome, eliminating potential redundant gates (two of the same gate on the same qubit/s in a row) being added to the genome with the new gene.The identity gate, I 2 , is only used whenever adding a different gate would cause some redundancy.The operation performed by τ is given by, The removal operator, ρ, acting on a genome, removes some number of genes from the genome, starting from the end of the gene list.The operation performed by ρ is given by, The parameter search runs an optimization subroutine, O, on each individual gene in the genome, in a random order.The optimization subroutine O is implemented for a genome g i and a gene y i (α i ), by using the ansatz V (α) represented by genome g i in the standard VQLS optimization routine, while only optimizing the specific parameters α i of the gene y i (α i ).This optimization is done per gene so that removal operator does not affect the training of the rest of the ansatz.
The fitness f i , of genome g i is calculated using the value of the cost achieved by the ansatz represented by the genome, as well as the depth of the ansatz (number of genes) and the number of 2-qubit gates.The fitness value is given by, where α and β are weighted variables that can be assigned, C(g i ) is the cost value of the ansatz of represented by g i , |g i | is the number of genes in g i , and |∧(g i )| is the number of 2-qubit gates in g i .This genome fitness value is then averaged amongst genomes of the same species and is called the species-adjusted fitness.Species are defined by a genetic distance measure, given by the average distance of a common ancestor between two separate genomes.Two genomes with an average distance of a common ancestor less than some given value may be assigned to the same species.
The EAVQLS Algorithm runs as follows: 1. Generate a population P of n empty genomes g i , and apply τ (g i ) to each genome.
2. Apply the optimization subroutine O to the last gene in each genome for all genomes in P .
3. Group the genomes in P by species, then calculate the fitness and then species-adjusted fitness of each genome g i in P .
4. Randomly select n parent genomes with replacement from P , inversely proportional to their fitness values, forming the next generation P .
5. For all of the genomes g i in P , apply the three genetic operators to g i with some predefined probabilities.
6.If a termination condition is met, return the fittest genome in P , else let P = P and return to step 2.

D. Classical Combination of Quantum States (CQS)
The Classical Combination of Quantum States (CQS) approach detailed in [7], is the most unique near-term approach presented in this paper.The CQS approach is not a variational algorithm, meaning there is no classical optimisation of ansatz parameters.The CQS approach solves the linear system by finding the solution as a linear combination of quantum states.
Given a set of n states S = {|s 1 , • • • , |s n }, the CQS method aims to find a linear combination x approximating the solution x to the linear systems problem A x = b where, Note that, differing from the above mentioned approaches, the solution x is never actually created on the quantum device.It is not necessarily normalized, and is proportional to the solution to the same problem solved using the other variational methods.
The CQS Algorithm runs as follows.Starting with m = 1, and the set S = {|s 1 } where |s 1 is a state that can be prepared by some efficient quantum circuit.
1. Solve the for the optimal values of α * such that x = Σ m i=1 α * i |s i , where x is the an approximation of x, given the set S.
2. Using the value of α * , find the next circuit generating the state |s m+1 and add |s m+1 to S.
3. Set m = m + 1 and repeat from step 1 until x is a sufficiently good solution.
Given a set of n efficiently prepared states, S = {|s 1 , • • • , |s n }, containing a close approximation of the solution x as a linear combination, the linear coefficients, c i , can be found efficiently by a hybrid quantum-classical procedure outlined below.
The standard regression function used to solve a linear system is given by, 13) can be rewritten as, where A simple regression problem for α can be obtained with the kernel matrix This quadratic optimization problem on complex α can be rewritten as a real optimization problem, where z = (Re[α], Im[α]), and Q and r are given by, Here Eq. ( 15) can be solved using standard convex quadratic programming methods.The Ansatz Tree (Fig. 4) is a proposed structure used to obtain a good set of unitaries.As previously specified, the matrix A is given as a linear combination, A = n i=1 c i A i , c i ∈ C. The unitaries A i are used in the construction of the ansatz tree as follows.
Each node in the ansatz tree represents a single state, |s i , composed from the unitaries A i and |b , which can be added to the ansatz set used to find the linear combination on a classical device.The ansatz tree can be expanded breadth-first, or searched via some heuristic.
A heuristic approach to searching the ansatz tree also proposed in [7], aims to expand the ansatz tree node by node.Let the current set of expanded nodes in the tree be given by the set S, and the current set of all potential child nodes of the nodes in S be the set C (S).Let the current approximate solution for the set of expanded nodes be given by α * .The ansatz tree is further explored by expanding the child node, |ψ ∈ C (S), that has the greatest overlap with the current gradient, maximizing the function given by, The logical ansatz approach is simply an adaption of the CQS method above, allowing for parameterized unitaries to be employed.This approach is then similar to the Standard VQLS approach, except it proposes that instead of a single ansatz circuit, a linear combination of multiple ansatz circuits be used.This greatly lowers the depth of any one of the multiple ansatz circuits.The Logical Ansatz is implemented here as suggested in [7], by implementing the CQS method with a selected set of n parameterized ansatze making the states S = {|s 1 (θ 1 ) , • • • , |s n (θ n ) }, and repeating the optimization process outlined for the CQS with a classical minimizer optimizing the parameters θ i of the ansatze creating the states |s i (θ i ) .This method avoids the ansatz tree expansion process for selecting unitaries, by instead optimizing a set of pre-selected parameterized unitaries.The solution found is expressed by, This logical ansatz implementation and training differs from that in [8].
The Logical Ansatz Linear Solver Algorithm runs much like the CQS method.

Select n parameterized ansatze each corresponding
to some state |s i (θ i ) , forming set S.
2. Solve the for the optimal value of α * such that x = Σ m i=1 α * i |s i (θ i ) , where x is the closest approximation of x, given the set S. Proceed either to 3 or 4 for method 1 or 2 respectively.
3. Method 1: For r training rounds, select each of the states |s i (θ i ) at random and optimize their parameters θ i with some classical optimizer, only solving the new α * value after the parameter optimization of each ansatz.
4. Method 2: Treating the entire state x = Σ m i=1 α * i |s i (θ i ) as a single logical ansatz, optimize all parameters at once with a classical optimizer, solving for the new α * value with each change of parameter during the optimization process.

III. EXPERIMENTATION AND EVALUATION
Tests of all above described methods follow below.The linear systems to be solved are given as a matrix A, where A = Σ l c l A l , for l unitary gates, and a state |b , given as a unitary U , prepared by some efficient quantum circuit, such that U |0 = |b , corresponding to some b, as described in the formulation of the near-term Quantum Linear Systems Problem.
In all problem instances detailed below, the state |b = H ⊗n |0 n , where n is the relevant number of qubits for the problem.These problems are also only real-valued linear systems, however these approaches are not limited to real-values.The number of shots for the Qiskit's Qasm simulator is set to 10000 (except for the CQS approach on the real device).

A. Variational Quantum Linear Solver
Three problem instances of differing sizes were selected to investigate the performance of the standard VQLS.Two different classical optimizers (gradient-based vs gradient-free), and three levels of noise were tested in order to further investigate their role in the performance of the VQLS.The two chosen optimizers were the gradient-based Broyden-Fletcher-Goldfarb-Shanno algorithm (BFGS) [14] (using an analytic gradient function computed on the quantum hardware) and the gradient-free Simultaneous Perturbation Stochastic Approximation algorithm (SPSA) [15], based on performance in [12].The three noise levels were chosen such to demonstrate the difference between zero noise, shot-noise only and realistic NISQ device noise, given by Qiskit's Statevector simulator, Qasm simulator and Qasm simulator with a realistic noise sample respectively.The noise sample is taken from the IBM-Vigo quantum device.
The three problem instances, using 3, 4 and 5 qubits respectively, are given by, where Z i , (i = 1, 2, 3) indicates the matrix formed by the tensor product, with Pauli gate Z applied to qubit i and the identity gate applied to the remaining qubits.Notation is similarly defined with Hadamard gate H and Pauli gate X. 1 indicates an N × N identity matrix.
The local cost function (detailed above) was selected for all the VQLS runs. 100 runs of the VQLS algorithm were conducted for each problem instance, noise-level and classical optimizer.Furthermore, the same 100 random initial ansatz parameter values were used for all runs in the same problem instance across all noise levels and classical optimizers.This was done to make the results obtained for each problem instance comparable.
In order to ensure even resource distribution between the gradient-based BFGS and the gradient-free SPSA classical optimizers, the optimizers were only allowed a limited number of cost function evaluations.The resource cost of a gradient call can be given in terms of cost function calls, being exactly 2 cost function calls per ansatz parameter, and so this comparison can be done.The 3, 4 and 5 qubit problem instances were limited to 1000, 1500 and 2000 cost function evaluations respectively.The ansätze selected for each of the problem instances are shown in the figure above Fig. 5. Ansatz selection was not done with any specific backend in mind, and as such the ansatz used have been assumed to be hardware efficient.No transpilation to any specific backend connectivity was done, even for the realistic noise simulation.

B. Adiabatic Ansatz Variational Quantum Linear Solver
The following test of the AAVQLS algorithm compares the Adiabatic method to a standard VQLS approach, for the three same noise levels as the test above.The same local cost function was used, and Powell's method was used as the classical optimizer [16], due to its noise resistance [12].Both the AAVQLS and the VQLS used the same ansatz circuit given in Fig. 6.This ansatz can be initialized to identity with some non-zero random parameters, hence its use in the AAVQLS here.The circuit U for creating state |b is appending to the end of this ansatz in accordance with the method discussed in the AAVQLS description, to create the full adiabatic ansatz.
The example five qubit problem tested was given by, FIG. 6.The ansatz employed in the AAVQLS test.This ansatz can be initialized to identity with some random parameters.The circuit U for creating |b is appending to the end of this ansatz in accordance with the method discussed in the AAVQLS description in order to create the adiabatic ansatz.
The AAVQLS approach was split into two trials.One using 10 steps and the other using 20 steps, denoted in the results with the suffix '1' and '2' respectively.These were compared to a standard VQLS implementation.The same number of overall function evaluations were allowed for all approaches.20 runs for each approach and noise-level were conducted.

C. Evolutionary Ansatz Variational Quantum
Linear Solver The EAVQLS method was compared to three standard VQLS methods.Again the local cost function was used for both the EAVQLS and the VQLS, and the 4 Qubit ansatz in Fig. 5 was used for the VQLS comparison.The three standard VQLS methods differ by their use of three different classical optimizers: Constrained Optimization by Linear Approximation (COBYLA), BFGS and SPSA.The EAVQLS used the COBYLA [17] optimizer, as the simulation was done on a noise-free statevector simulator, and COBYLA has a very quick convergence rate on a noise-free simulation [12].The test problem consisted of four qubits with A given by, 20 Runs of the EAVQLS genetic algorithm were run, with a population of size 20 and 20 generations.The genetic hyper-parameters, topological search, parameter search and removal, were set to the values of 0.7, 0.2 and 0.4 respectively.Each VQLS instance was run 100 times, and the top 20 best runs were selected in the comparison.This is done to give a fair comparison to the resource intense EAVQLS method and even 100 Runs of a standard VQLS algorithm requires less quantum resources than the 20 EAVQLS Runs.

D. Classical Combination of Quantum States
The CQS method is the only non-variational approach tested.The aim of this test was to see how accurately the real quantum machine could approximate the solution given the nodes.This test follows the standard implementation of the CQS algorithm, however no ansatz tree expansion was conducted on the real device.Instead the ansatz tree was pre-expanded with the nodes as seen in Fig. 7, and then the solution was approximated on the real device.The three qubit test example used is given as follows, This example was selected as a non-trivial problem that suited the topology of the real backend selected (the IBMQX2 quantum device).The number of shots per Hadamard test was set to 245760 (being 30 repetitions of the max 8192 shots per run).

E. Logical Ansatz Variational Quantum Linear Solver
The logical ansatz used the same cost function as the CQS method as detailed above.Both COBYLA and Powell's method were tested as classical optimizers, and both a noise-free Statevector simulation, and a shot-noise Qasm simulation were tested.The logical ansatz was tested on the five qubit problem given by, The individual ansatze making up the logical ansatz were generated randomly.Each logical ansatz was made up of five shallow physical ansatze.Each ansatz consisting of 3 layers of gates, taken from the gate set {I 2 , R y , ∧ 1 X}.Two different approaches to training were tested, each denoted in the results by the suffix '1' or '2', for the first and second approach respectively.These two approaches are detailed as Method 1 and Method 2 in the Logical Ansatz section (Section.II E).Twenty runs for each approach were performed in order to obtain the results.

IV. RESULTS AND DISCUSSION
Below are the results for the above mentioned experiments.Please note that the cost values achieved by the VQLS, AAVQLS and EAVQLS are not directly comparable to the cost values achieved by the CQS and LAVQLS due to a differing cost function.The box plot Fig. 8 and line graph Fig. 9 show the range of the termination values and the average rate of convergence respectively, for each problem instance, noise-level and classical optimizer used.Fig. 8 gives an idea of the difficulty of each problem instance, and also gives an idea as to the overall affect of noise on the optimization process.The 4 qubit problem instance appears to have been the most difficult, next being the 5 qubit instance, with the 3 qubit instance being the simplest to solve.
The VQLS algorithm performs very well in a noise-free state vector simulation, with the gradient-based BFGS undoubtedly performing the best outright.The inclusion of shot-noise alone does not appear to greatly disturb the optimization process much, however BFGS is much more affected by the shot-noise than the gradient-free SPSA.SPSA very much outperforms BFGS in the presence of noise.The realistic noise levels appear to greatly affect the optimization process, and while again, SPSA is less affected than BFGS, both are heavily set back.These trends seen between the different noise levels and classical optimizers appear to hold regardless of the problem instances apparent difficulty.Fig. 9 shows the average convergence rate of the top 50 attempts, for each noise-level, classical optimizer and problem instance.In all, SPSA converges faster than BFGS regardless of noise-level, and the more difficult the problem, the slower the rate of convergence.

B. Adiabatic Ansatz Variational Quantum Linear Solver
FIG. 10.AAVQLS Termination Values: AAVQLS termination values compared to a standard VQLS approach, for 2 different AAVQLS methods for 3 noise levels.These results appear to indicate there is not much of a significant difference between the VQLS and both AAVQLS approaches.
The box plot Fig. 10 shows the range of the final termination values achieved by the respective methods for the respective levels of noise.
The line graph Fig. 11 shows an average value of the cost function along the adiabatic optimization path for the best performing run of both AAVQLS 1 and 2 for each noise level.
The results captured in Fig. 10 appear to indicate there is not much of a significant difference between the VQLS and both AAVQLS approaches.However, the state vector simulation clearly favours the standard VQLS approach, while the both AAVQLS approaches slightly outperform the VQLS in the realistic noise situation.Given that the state vector simulation is merely theoretical, there may be some merit to the AAVQLS approach.AAVQLS 2 also ever so slightly outperforms AAVQLS 1 in the noisy simulations, meaning shorter, more frequent steps may be the better approach between the two.(The AAVQLS approach was split into two trials.One using 10 steps and the other using 20 steps, denoted in the results with the suffix '1' and '2' respectively) The line graph Fig. 11 shows that all methods kept fairly close to the ground state of the Hamiltonian during the initial phase of optimization, only to move further away from the ground state during the middle of the optimization process.The Statevector and Qasm simulations of both methods managed to move close to the ground state near the end of the optimization process however the noisy simulations did not.Ideally all methods should have kept fairly close to the ground state throughout the optimization process.

C. Evolutionary Ansatz Variational Quantum Linear Solver
The line graph Fig. 12, shows the difference between the best genome's fitness value (discussed in EAVQLS section) and the actual local cost function value per generation averaged across the 20 runs.
The box plot Fig. 13 shows the difference between the final value of the local cost function for the 20 EAVQLS runs and the 20 best VQLS runs per each approach.

Classical Combination of Quantum States
Relatively good results achieved on the real machine Fig. 14, given the noise levels of current NISQ devices, however the problem was specifically tailored to suite the connectivity of the selected backend.The optimal cost value achievable using the nodes in the ansatz tree given is equal to approximately 0.00324.Fig: 15 shows the spread of the final cost values of the logical ansatz approach.It is clear that the noise introduced by the Qasm simulator greatly affects the performance of the Logical Ansatz VQLS.The effect of noise may be increased when using a logical ansatz as multiple different hadamard test runs are needed, one for each pairing of the different physical ansatze, each adding some potential for error.

V. CONCLUSIONS
The success of the standard VQLS approach appears to be greatly dependant on the noise levels on the quantum device.The cost values achieved remain fairly consistent after the addition of shot-noise, and decline substantially when realistic levels of noise are added to the simulated quantum device.
The AAVQLS approach presents an ansatz optimization strategy that in theory could keep the ansatz near the ground state of the system's Hamiltonian, allowing a low cost value to be easily found.Considering the best runs recorded in Fig. 11, this trend is observed during the first part of the optimization where at all levels of noise, the system remained close the the ground state of the Hamiltonian.This trend faded just before midway through the optimization process, where all simulations, regardless of the level of noise, moved away from the ground state.This presents a particular flaw in this approach, whereby the system can leave the ground state.One possible explanation for this is that the optimization process had a step size that was too large (the evolution of the Hamiltonian was too fast), or the ground state was not contained in the Hilbert space spanned by the particular ansatz used.The latter issue may be avoided by evolving the initial Hamiltonian to the final Hamiltonian along a different path.In the later half of the optimization process, the Statevector and QASM simulations recovered the ground state while the realistic noise simulation did not.That the AAVQLS performs similarly to the VQLS in the QASM and Noisy simulations, as seen in Fig. 10, suggests that there may be some merit to this approach, especially because the best cost values achieved by the AAVQLS for those two simulations were quite substantially lower, even if, on average, they performed similarly.
The EAVQLS performed at around the same level as the VQLS for the specific problem instance simulated in these results.Seeing as only a statevector simulation was conducted, it is not yet known how a noisy simulation may have changed these results, as a key selling point of the EAVQLS algorithm is noise resistance, due to shorter, more problem and hardware specific ansätze.
The CQS approach was the only approach tested on the real quantum device, in order to gauge its effectiveness on near-term quantum hardware.With 20 runs on the IBMQX2 device, the CQS approach managed to achieve some fairly low cost values and a decent average cost value.This is positive for this approach, however it is noted that the specific problem that was solved may have been quite simple, yet still non-trivial.
The LAVQLS, being an adaptation of the CQS method, appears to work well in a noise-free simulation, however the shot-noise alone heavily reduced the final cost value achieved by the method.This may be because the many hadamard tests required to evaluate the cost function amplify the noise.This is not good because a proposed feature of the LAVQLS was noise resistance due to the use of shorter individual ansäze making up the logical ansatz.
In this paper a few approaches to solving systems of linear equations on near-term quantum hardware have been presented.Each approach that differs from the standard VQLS approach tries to offer some advantage over the standard approach, however whether the proposed advantages of these algorithms actually apply in implementation is yet to be conclusively seen.Some potential problems with these approaches have been highlighted and it is left to a future work to investigate the realistic advantages of these approaches.It may be the case that some of these approaches offer significant advantages over the standard VQLS approach, however this is still unclear.

FIG. 1 .
FIG. 1. VQLS Schematic: The algorithm runs in a simple feedback loop, whereby a classical optimizer finds the optimal parameters for the ansatz circuit, by iteratively evaluating the cost function on the quantum device and updating the parameters, until a minimum cost value is achieved.V (α) denotes the parameterized ansatz, α * denotes the optimal parameters.At termination, V (α * ) |0 = |x , where |||x − |x ||2 ≤ , with |x being the exact solution to the QLSP, and being the error-bound of the approximate solution.

5 .
V AAVQLS (α final ) |0 = |x , where |||x − |x || ≤ , where |x is the exact solution to the QLSP and is the error-bound of the approximate solution.

FIG. 3 . 4
FIG. 3. 4 Qubit Evolutionary Ansatz Genome Schematic:Three different genes (ansatz rows) are each outlined in red, blue and green in the genome above.The qubits are initialized as H ⊗n |0 ⊗n , allowing the first gene in the genome to contain controlled gates that aren't redundant.

FIG. 4 .
FIG. 4. Ansatz Tree Diagram: An example expansion of the Ansatz Tree.The highlighted node in the tree represents the unitary created by applying the unitaries A2 and then A1 to the state |b .

FIG. 7 .
FIG. 7. CQS algorithm ansatz tree expansion used to solve the CQS test problem on the real quantum machine.

A
FIG. 8. Termination Value Box plots: These box plots capture the final value at the termination of top 50 attempts of the VQLS algorithm for both the SPSA and BFGS optimizers, with three levels of noise in simulation, for 3 problems.The standard VQLS performance is greatly affected by the presence of noise in the quantum simulation.

FIG. 11 .
FIG. 11.Average Optimization Convergence: These line graphs capture the cost value measured by the AAVQLS algorithm during the optimization process, for 2 different methods, for 3 noise levels.This corresponds to how close the ansatz kept to the ground state of the Hamiltonian during the optimization.

FIG. 12 .
FIG.12.The best performing genome's fitness value vs the actual cost value, given by that same genome's ansatz by the local cost function, averaged over the 20 runs, for the 20 generations.Both the GA cost value and Actual cost value continue to decrease as the algorithm runs.

FIG. 14 .
FIG. 14. 20 runs of the CQS Algorithm on IBMQX2 machine, with the average cost indicated in red.

FIG. 15 .
FIG. 15.Termination Values achieved by the logical ansatz, for 2 methods, 2 noise levels and 2 different optimizers.Both training methods 1 and 2 performed similarly well.