View on GitHub
Open this notebook in GitHub to run it yourself
Solving the Quantum Linear Systems Problem (QLSP) using AQC
Adiabatic Quantum Computing (AQC) leverages the adiabatic theorem to solve computational problems by gradually evolving a quantum system from an initial ground state to the ground state of a problem-specific Hamiltonian (see the AQC tutorial). This tutorial focuses on applying the AQC approach to solve the Quantum Linear Systems Problem (QLSP), a cornerstone problem in quantum computing with significant applications in fields like machine learning, physics, and optimization. Specifically, we aim to demonstrate how to utilize AQC to approximate the solution to the QLSP [1]. This problem involves finding a quantum state that corresponds to the solution of a linear system of equations. The tutorial provides a structured overview of the QLSP, its mathematical formulation, and the steps needed to transform it into an eigenvalue problem, laying the foundation for solving it within the AQC framework. *This demonstration follows the [1] paper. This notebook was written in collaboration with Prof. Lin Lin and Dr. Dong An, the authors of the paper.*Problem Statement
Given a Hermitian positive-definite matrix and a vector , the goal is to approximate —the solution to the linear system —as a quantum state. We are given:- Matrix , an invertible Hermitian and positive-definite matrix with condition number and .
- Vector , a normalized vector.
- Target Error , specifying the desired accuracy.
Transformation into AQC
The QLSP is converted into an equivalent eigenvalue problem to leverage quantum computation. This involves the following steps.- Constructing
- is Hermitian.
- The null space of : , where
The null space of a matrix is the set of all vectors such that With regards to eigenstates and eigenvalues:
- The null space corresponds to the eigenspace of associated with the eigenvalue .
- Any vector in the null space is an eigenvector of with eigenvalue .
- Constructing
- If , then .
- Null space of : , where
- Adiabatic Interpolation
- Spectral Gap
- is a projection operator, and the spectral gap between and the rest of the eigenvalues of is .
- For , the gap between and the rest of the eigenvalues is bounded from below by . [1]
- Adiabatic Evolution and Null Space
Setting up a QLSP Example Where A Is a 4x4 Matrix
For simplicity, we first assume A is Hermitian and positive definite.In practical scenarios, the condition number is often approximated or known beforehand based on external factors or prior knowledge.
Output:
Constructing and
Thesetup_QLSP function prepares the necessary Hamiltonians and normalized components to solve the Quantum Linear Systems Problem (QLSP).
The built-in matrix_to_hamiltonian function, used in the setup_QLSP function, encodes the Hamitonian matrix into a sum of Pauli strings that is used to exponentiate the Hamiltonians with a product formula (Suzuki-Trotter) in the next step.
Defining the Interpolation Hamiltonian
For the sake of simplicity, we first use the “vanilla AQC” linear scheduling function to define the time-dependent interpolated Hamiltonian, where T is the total evolution time. As progresses from 0 to , satisfies the mapping.Analyzing the Spectral Gap
From the quantum adiabatic theorem [3, Theorem 3] the formula for the adiabatic error bound at any point is See Appendix A for a detailed explanation of the components. The formula shows that the adiabatic error is minimized when- The total runtime is large (slow evolution).
- The spectral gap is large (well-separated ground and excited states).
- The derivatives and are small (smooth Hamiltonian changes).


TOTAL_EVOLUTION_TIME). However, if we simply assume , are bounded by constants, and use the worst-case bound that , it can be shown that to have , the runtime of vanilla AQC is .
Implementing AQC
Since where is the time-ordering operator, it is sufficient to implement an efficient time-dependent Hamiltonian simulation of . One straightforward approach to achieve this is using the Trotter splitting method. The lowest order approximation takes the form which can further be approximated as where It is proved in [2] that the error of such an approximation is which indicates that to achieve an -approximation, it suffices to choose (Note that in our case also depends on .)Building the Quantum Model
Using the Classiq platform, we implement the adiabatic path with Suzuki-Trotter decomposition for Hamiltonian exponentiation. In our model is represented by theTOTAL_EVOLUTION_TIME and is represented by NUM_STEPS.
In the Trotter implementation, scales as with respect to the runtime , therefore this is our rough choice of :
adiabatic_evolution_qfunc function implements the adiabatic path with Suzuki-Trotter decomposition for Hamiltonian exponentiation:
Synthesizing, Verifying, and Executing
Synthesize the model into a quantum program, verify it, and execute it on a state vector simulator:Output:
Evaluating the Results
Output:


Output:
Output:
Output:

Output:
Output:


Output:
Output:
Output:
Output:


Output:
Output:
Important: The implementation example above aims to provide an intuitive understanding of the principles behind solving quantum linear solver problems with the adiabatic quantum evolution and the associated error bounds. However, for simplicity and accessibility, several aspects of the implementation are not optimal:These choices were made to prioritize conceptual clarity over computational efficiency. The next step would be to apply state-of-the-art techniques and show improvement in gate complexity and runtime.
- Suzuki-Trotter Decomposition: We utilized the first order Suzuki-Trotter approximation for time evolution. As such (as mentioned above), a more optimal approach based on the discrete adiabatic theorem [4] could be implemented.
- Schedule Function: We used the vanilla AQC scheduling function. Using more sophisticated scheduling functions as suggested in [1] will improve runtime.
- Brute-Force Encoding: The encoding of Pauli operators in this tutorial is direct and unoptimized, scaling exponentially with system size. Other encoding techniques (such as suggested in [4]) will be more efficient.
Appendix A: Explanation of the Adiabatic Error-bound Components
The adiabatic error bound is defined by the quantum adiabatic theorem [3, Theorem 3]: Detailed explanation of components:- :
- Represents the adiabatic error bound at a specific point .
- Quantifies the deviation of the quantum state from the ground state during evolution.
- :
- A proportionality constant that depends on system-specific properties such as the dimensionality and scaling of norms.
- :
- The operator norm of the first derivative of the Hamiltonian, , evaluated at .
- Indicates how quickly the Hamiltonian initially changes.
- :
- The total runtime of the adiabatic evolution.
- Larger values reduce the error, as slower evolution aids adiabaticity.
- :
- The spectral gap at , defined as the energy difference between the ground state and the first excited state of .
- Larger gaps improve the adiabatic process.
- :
- The operator norm of the first derivative of at an intermediate point .
- Reflects how fast the Hamiltonian changes during evolution.
- :
- The spectral gap at the point , mapped via the function .
- :
- The operator norm of the second derivative of the Hamiltonian, , at a point .
- Captures the curvature or acceleration of the Hamiltonian’s evolution.
- :
- An integral from to , summing contributions of the Hamiltonian’s derivatives over the path.
- Accounts for cumulative effects of the Hamiltonian’s changes during evolution.
- and :
- Higher powers of the spectral gap at .
- Larger gaps (in and ) significantly reduce the adiabatic error.
References
[1]: [An, D. and Lin, L.- “Quantum Linear System Solver Based on Time-Optimal Adiabatic Quantum Computing and Quantum Approximate Optimization Algorithm.” ACM Trans.
- arXiv:1909.05500](https://arxiv.org/abs/1909.05500)
- How powerful is adiabatic quantum computation? In Proceedings 42nd IEEE Symposium on Foundations of Computer Science. IEEE, Piscataway, NJ, 279–287](https://arxiv.org/abs/quant-ph/0206003).
- Bounds for the adiabatic approximation with applications to quantum computation. J. Math. Phys. 48, 10, 102111](https://arxiv.org/abs/quant-ph/0603175).