Quantum linear solving method and device based on quantum adiabatic linear algorithm, medium
By combining the subspace method with the quantum adiabatic linear algorithm, the linear system is processed in a reduced dimension, which solves the problem of high computational resource requirements of the quantum discrete adiabatic linear algorithm and realizes quantum linear solution in NISQ chip and classical computer.
Patent Information
- Application Number
- CN202410981049.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2044-07-19
AI Technical Summary
Existing quantum discrete adiabatic linear algorithms have high computational resource requirements, making them difficult to implement effectively in NISQ chips and classical computers.
By combining the subspace method with the quantum adiabatic linear algorithm, the linear system is reduced in dimension, and a quantum circuit is constructed to solve the approximate solution of the linear system in the Krylov subspace.
This reduces the computational resource requirements of the quantum discrete adiabatic linear algorithm, enabling its implementation in NISQ chips and classical computers.
Smart Images

Figure CN118966367B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of quantum computing, and in particular to a quantum linear solving method and device based on quantum adiabatic linear algorithm, and a medium. BACKGROUND
[0002] A quantum computer is a physical device that performs high-speed mathematical and logical operations, stores and processes quantum information in accordance with the laws of quantum mechanics. When a device processes and computes quantum information and runs quantum algorithms, it is a quantum computer. Quantum computing simulation is a simulation calculation that simulates the laws of quantum mechanics with the aid of numerical calculation and computer science. As a simulation program, it uses the high-speed computing power of a computer to depict the space-time evolution of quantum states in accordance with the basic laws of quantum bits of quantum mechanics.
[0003] Solving linear equations is the core of many scientific and engineering problems. The classical algorithms for solving such problems are collectively referred to as linear system algorithms. In recent years, one of the most important achievements in the field of quantum computing is quantum linear system algorithms. Among them, the quantum discrete adiabatic linear algorithm (QDALS) is currently the most efficient quantum linear algorithm for solving sparse linear equations. Practice shows that the quantum discrete adiabatic linear algorithm has a large demand for computing resources. For example, when the quantum discrete adiabatic linear algorithm is used to solve high-dimensional linear equations, both NISQ chips and classical computers are difficult to meet the computing resource requirements of the quantum discrete adiabatic linear algorithm, resulting in the inability to demonstrate and verify the quantum discrete adiabatic linear algorithm on NISQ chips or to perform quantum simulation verification of the quantum discrete adiabatic linear algorithm on classical computers. Therefore, how to reduce the demand of the quantum discrete adiabatic linear algorithm for computing resources so that the quantum discrete adiabatic linear algorithm can be implemented on NISQ chips and classical computers has become a technical problem to be solved. SUMMARY
[0004] The present application provides a quantum linear solving method and device based on quantum adiabatic linear algorithm, and a medium. By combining the subspace method with the quantum adiabatic linear algorithm, the demand of the quantum discrete adiabatic linear algorithm for computing resources is reduced, so that the quantum discrete adiabatic linear algorithm can be implemented on NISQ chips and classical computers.
[0005] To solve the above technical problems, the present application discloses a quantum linear solving method based on quantum adiabatic linear algorithm, which comprises:
[0006] Obtaining a linear system to be processed, and constructing a Krylov subspace matched with the linear system;
[0007] determining, according to the linear system and the Krylov subspace, a subspace equation set of the linear system based on the Krylov subspace;
[0008] constructing a quantum circuit corresponding to a quantum adiabatic linear algorithm according to the subspace equation set, and solving an approximate solution of the linear system in the Krylov subspace according to the quantum circuit.
[0009] As an optional implementation, in the first aspect of the present application, the linear system is A·x=b, where A is a first coefficient matrix, and b is a first constant vector;
[0010] And the determining, according to the linear system and the Krylov subspace, a subspace equation set of the linear system based on the Krylov subspace includes:
[0011] obtaining a preset iterative solution x k ; k calculating an iterative residual r k =b-A·x k , where k is an iteration number;
[0012] According to the iterative residual r k , a second coefficient matrix B and a second constant vector c corresponding to the linear system A·x=b after dimensionality reduction in the Krylov subspace are calculated, and a subspace equation set B·y=c of the linear system A·x=b based on the Krylov subspace is generated.
[0013] As an optional implementation, in the first aspect of the present application, the calculating a second coefficient matrix B and a second constant vector c corresponding to the linear system A·x=b after dimensionality reduction in the Krylov subspace includes:
[0014] constructing an orthogonal basis corresponding to the Krylov subspace, and obtaining a preset residual judgment standard ∈ s ;
[0015] If ||r k ||2≥∈ s , the iterative residual r k is determined according to the iterative residual r k , and a constraint equation of the linear system A·x=b based on the Krylov subspace is determined based on a complete orthogonalization subspace method, and a second coefficient matrix B and a second constant vector c corresponding to the linear system A·x=b after dimensionality reduction in the Krylov subspace are calculated according to the orthogonal basis and the constraint equation.
[0016] As an optional implementation, in the first aspect of the present application, the method further includes:
[0017] obtaining a preset convergence judgment criterion ∈ c , wherein the residual judgment criterion ∈ s and the convergence judgment criterion ∈ c satisfy: ∈ c < ∈ s ;
[0018] If ∈ s >||r k ||2> ∈ c , then the linear system A·x=b is determined based on the generalized minimal residual method according to the iteration residual r k , and based on the constraint equation of the Krylov subspace, the second coefficient matrix B and the second constant vector c corresponding to the linear system A·x=b after dimension reduction in the Krylov subspace are calculated according to the orthogonal basis and the constraint equation.
[0019] As an optional implementation, in the first aspect of the present application, the quantum circuit corresponding to the quantum adiabatic linear algorithm is constructed according to the subspace equation system, which comprises:
[0020] According to the subspace equation system B·y=c, a first Hamiltonian H0 whose ground state is |c) is constructed, a second Hamiltonian H1 whose ground state is |B -1 c> is constructed, and a time-dependent Hamiltonian H(t)=(1-t)H0+tH1 is generated, wherein t ∈ [0, 1];
[0021] According to the time-dependent Hamiltonian H(t) and a preset time interval Δt, a quantum walk gate W H(i×Δt ) is constructed, i ∈ {1, 2, …, 1 / Δt};
[0022] According to the second constant vector c, an encoding circuit E c is determined, wherein the encoding circuit E c satisfies E c |0>=|c>;
[0023] According to the quantum walk gate W H(i×Δt) and the encoding circuit E c , a quantum circuit corresponding to the quantum adiabatic linear algorithm is constructed.
[0024] As an optional implementation, in the first aspect of the present application, the approximate solution of the linear system in the Krylov subspace is solved according to the quantum circuit, which comprises:
[0025] The quantum circuit is executed to obtain a solution quantum state |y>, and the classical data Y corresponding to the solution quantum state |y> is determined according to the solution quantum state |y>;
[0026] Obtain the updated iterative solution x k+1 Wherein, the updated iterative solution x k+1 =x k +Y;
[0027] According to the updated iterative solution x k+1 Calculate the updated iterative residual r k+1 =bA·x k+1 ;
[0028] If the updated iterative residual r k+1 Satisfy ∈ c ≥||r k+1 ||2, then the updated iterative solution x is determined. k+1 This is an approximate solution of the linear system in the Krylov subspace.
[0029] As an optional implementation, in the first aspect of the present invention, the method further includes:
[0030] If the updated iterative residual r k+1 Not satisfied ∈ c ≥||r k+1 If ||2, then the iteration number k is incremented by 1, and the process of determining the subspace equations of the linear system based on the Krylov subspace is retried; constructing the quantum circuit corresponding to the quantum adiabatic linear algorithm based on the subspace equations; executing the quantum circuit to obtain the solution quantum state |y>; determining the classical data Y corresponding to the solution quantum state |y> based on the solution quantum state |y>; and determining the classical data Y corresponding to the solution quantum state |y> based on the updated iterative solution x>. k+1 Calculate the updated iterative residual r k+1 =bA·x k+1 The operation continues until the updated iterative residual r... k+1 Satisfy ∈ c ≥||r k+1 ||2.
[0031] As an optional implementation, in the first aspect of the invention, the step according to the quantum walk gate W... H(i×Δt) and the encoding line E c Constructing the quantum circuit corresponding to the quantum adiabatic linear algorithm includes:
[0032] According to the quantum walking gate W H(i×Δt) and the quantum walk gate W H(i×Δt) Based on the corresponding temporal order, construct an evolutionary quantum logic gate for executing the quantum state evolution corresponding to the quantum adiabatic linear algorithm; according to the encoded circuit E cConstruct encoded quantum logic gates for encoding qubits;
[0033] Based on the evolutionary quantum logic gate and the encoded quantum logic gate, a quantum circuit corresponding to the quantum adiabatic linear algorithm is constructed, wherein the quantum circuit includes data qubits and auxiliary qubits;
[0034] And, the execution of the quantum circuit to obtain the solution quantum state |y> includes:
[0035] The initial state of both the data qubit and the auxiliary qubit is set to |0>;
[0036] The encoded quantum logic gate performs an initial state encoding operation on the data qubit, such that the state of the data qubit is |c>.
[0037] The evolutionary quantum logic gate executes the quantum state evolution operation corresponding to the quantum adiabatic linear algorithm, obtains the target state of the data qubit after the quantum state evolution operation is completed, and determines the target quantum state as the solution quantum state |y>.
[0038] A second aspect of this invention discloses a quantum linear solution device based on a quantum adiabatic linear algorithm, the device comprising:
[0039] A subspace construction module is used to obtain the linear system to be processed and construct a Krylov subspace that matches the linear system.
[0040] An equation determination module is used to determine, based on the linear system and the Krylov subspace, a set of subspace equations for the linear system based on the Krylov subspace;
[0041] The circuit solving module is used to construct a quantum circuit corresponding to the quantum adiabatic linear algorithm based on the subspace equations, and to solve the approximate solution of the linear system in the Krylov subspace based on the quantum circuit.
[0042] As an optional implementation, in a second aspect of the invention, the linear system is A·x=b, where A is a first coefficient matrix and b is a first constant vector;
[0043] Furthermore, the equation determination module determines, based on the linear system and the Krylov subspace, the specific method by which it determines the subspace equations of the linear system based on the Krylov subspace, including:
[0044] Obtain the preset iterative solution x k According to the iterative solution x k Calculate the iterative residual r k =bA·xk Where k is the iteration number;
[0045] According to the iterative residual r k Calculate the second coefficient matrix B and the second constant vector c of the linear system A·x=b in the Krylov subspace after dimensionality reduction, and generate the subspace equation system B·y=c of the linear system A·x=b based on the Krylov subspace.
[0046] As an optional implementation, in a second aspect of the invention, the equation determination module calculates the second coefficient matrix B and the second constant vector c corresponding to the linear system A·x=b in the Krylov subspace after dimensionality reduction, including:
[0047] Construct the orthogonal basis set corresponding to the Krylov subspace, and obtain the preset residual judgment criterion ∈s;
[0048] If ||r k ||2≥∈ s Then, according to the iterative residual r k The constraint equations of the linear system A·x=b based on the Krylov subspace are determined based on the fully orthogonal subspace method. According to the orthogonal basis set and the constraint equations, the second coefficient matrix B and the second constant vector c corresponding to the linear system A·x=b in the Krylov subspace after dimensionality reduction are calculated.
[0049] As an optional implementation, in a second aspect of the invention, the equation determining module is further configured to:
[0050] Obtain the preset convergence criterion ∈ c Wherein, the residual judgment criterion ∈ s and the convergence criterion ∈ c The following conditions must be met between them: ∈ c <∈ s ;
[0051] If ∈ s >||r k ||2>∈ c Then, according to the iterative residual r k The constraint equations of the linear system A·x=b based on the Krylov subspace are determined based on the generalized minimum residual method. According to the orthogonal basis set and the constraint equations, the second coefficient matrix B and the second constant vector c corresponding to the linear system A·x=b in the Krylov subspace after dimensionality reduction are calculated.
[0052] As an optional implementation, in a second aspect of the present invention, the specific method by which the circuit solving module constructs the quantum circuit corresponding to the quantum adiabatic linear algorithm based on the subspace equation set includes:
[0053] Based on the subspace equation system B·y=c, construct the first Hamiltonian H0 of the ground state as |c), and construct the ground state as |B -1 The second Hamiltonian H1 of c> is generated, and the time-dependent Hamiltonian H(t) = (1-t)H0 + tH1 is generated, where t∈[0,1];
[0054] The quantum walk gate W is constructed based on the time-dependent Hamiltonian H(t) and the preset time interval Δt. H(i×Δt ), i∈{1, 2,…,1 / Δt};
[0055] The encoding line E is determined based on the second constant vector c. c Wherein, the encoding line E c Satisfy E c |0>=|c>;
[0056] According to the quantum walking gate W Hli×Δt) Together with the encoded circuit Ec, construct the quantum circuit corresponding to the quantum adiabatic linear algorithm.
[0057] As an optional implementation, in a second aspect of the invention, the specific method by which the circuit solving module solves for an approximate solution of the linear system in the Krylov subspace based on the quantum circuit includes:
[0058] Execute the quantum circuit to obtain the solution quantum state |y>, and determine the classical data Y corresponding to the solution quantum state |y> based on the solution quantum state |y>;
[0059] Obtain the updated iterative solution x k+1 Wherein, the updated iterative solution x k+1 =x k +Y;
[0060] According to the updated iterative solution x k+1 Calculate the updated iterative residual r k+1 =bA·x k+1 ;
[0061] If the updated iterative residual r k+1 Satisfy ∈ c ≥||r k+1 ||2, then the updated iterative solution x is determined. k+1 This is an approximate solution of the linear system in the Krylov subspace.
[0062] As an optional implementation, in a second aspect of the invention, the apparatus further includes:
[0063] The residual iteration module is used to determine the updated iterative residual r. k+1 Not satisfied ∈ c ≥||r k+1 When ||2, the value of the iteration number k is increased by 1, and the equation determination module is re-triggered to perform the operation of determining the subspace equations of the linear system based on the Krylov subspace according to the linear system and the Krylov subspace; and the circuit solving module constructs the quantum circuit corresponding to the quantum adiabatic linear algorithm according to the subspace equations, executes the quantum circuit, obtains the solution quantum state |y>, and determines the classical data Y corresponding to the solution quantum state |y> according to the solution quantum state |y>; according to the updated iterative solution x k+1 Calculate the updated iterative residual r k+1 =bA·x k+1 The operation continues until the updated iterative residual rk is reached. +1 Satisfy ∈ c ≥||r k+1 ||Up to 2.
[0064] As an optional implementation, in a second aspect of the invention, the circuit solving module determines the path based on the quantum walk gate W. H(i×Δt) and the encoding line E c The specific methods for constructing the quantum circuit corresponding to the quantum adiabatic linear algorithm include:
[0065] According to the quantum walking gate W H(i×Δt) and the quantum walk gate W H(i×Δt) Based on the corresponding temporal order, construct an evolutionary quantum logic gate for executing the quantum state evolution corresponding to the quantum adiabatic linear algorithm; according to the encoded circuit E c Construct encoded quantum logic gates for encoding qubits;
[0066] Based on the evolutionary quantum logic gate and the encoded quantum logic gate, a quantum circuit corresponding to the quantum adiabatic linear algorithm is constructed, wherein the quantum circuit includes data qubits and auxiliary qubits;
[0067] Furthermore, the specific method by which the circuit solving module executes the quantum circuit and obtains the solution quantum state |y> includes:
[0068] The initial state of both the data qubit and the auxiliary qubit is set to |0>;
[0069] The encoded quantum logic gate performs an initial state encoding operation on the data qubit, such that the state of the data qubit is |c>.
[0070] The evolutionary quantum logic gate executes the quantum state evolution operation corresponding to the quantum adiabatic linear algorithm, obtains the target state of the data qubit after the quantum state evolution operation is completed, and determines the target quantum state as the solution quantum state |y>.
[0071] A third aspect of this invention discloses another quantum linear solution device based on a quantum adiabatic linear algorithm, the device comprising:
[0072] Memory containing executable program code;
[0073] A processor coupled to the memory;
[0074] The processor calls the executable program code stored in the memory to execute the quantum linear solution method based on the quantum adiabatic linear algorithm disclosed in the first aspect of the present invention.
[0075] The fourth aspect of the present invention discloses a computer storage medium storing computer instructions, which, when invoked, are used to execute the quantum linear solution method based on the quantum adiabatic linear algorithm disclosed in the first aspect of the present invention.
[0076] Compared with the prior art, the present invention has the following beneficial effects:
[0077] In this embodiment of the invention, firstly, the linear system to be processed is obtained, and a Krylov subspace matching the linear system is constructed. Secondly, based on the linear system and the Krylov subspace, the subspace equations of the linear system based on the Krylov subspace are determined. Finally, based on the subspace equations, a quantum circuit corresponding to the quantum adiabatic linear algorithm is constructed, and based on the quantum circuit, an approximate solution of the linear system in the Krylov subspace is solved. It is evident that implementing this invention combines the subspace method with the quantum adiabatic linear algorithm, using the subspace method to reduce the dimensionality of the original high-dimensional linear equations in the quantum adiabatic linear algorithm, making the dimension of the linear equations actually solved during iteration smaller than the dimension of the original linear equations. This reduces the computational resource requirements of the quantum discrete adiabatic linear algorithm, thereby enabling its implementation in NISQ chips and classical computers. Attached Figure Description
[0078] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0079] Figure 1 This is a flowchart illustrating a quantum linear solution method based on a quantum adiabatic linear algorithm disclosed in an embodiment of the present invention;
[0080] Figure 2 This is a schematic diagram of the quantum circuit corresponding to a quantum adiabatic linear algorithm disclosed in an embodiment of the present invention;
[0081] Figure 3 This is a flowchart illustrating another quantum linear solution method based on a quantum adiabatic linear algorithm disclosed in an embodiment of the present invention;
[0082] Figure 4 This is a schematic diagram of the structure of a quantum linear solver based on a quantum adiabatic linear algorithm disclosed in an embodiment of the present invention;
[0083] Figure 5 This is a schematic diagram of another quantum linear solver based on a quantum adiabatic linear algorithm disclosed in an embodiment of the present invention;
[0084] Figure 6 This is a schematic diagram of another quantum linear solver based on a quantum adiabatic linear algorithm disclosed in an embodiment of the present invention. Detailed Implementation
[0085] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0086] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or end that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or ends.
[0087] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0088] This invention discloses a quantum linear solution method, apparatus, and medium based on a quantum adiabatic linear algorithm. By combining the subspace method with the quantum adiabatic linear algorithm, the computational resource requirements of the quantum discrete adiabatic linear algorithm are reduced, thereby enabling the implementation of the quantum discrete adiabatic linear algorithm in NISQ chips and classical computers. Detailed descriptions follow.
[0089] Example 1
[0090] Please see Figure 1 , Figure 1 This is a flowchart illustrating a quantum linear solution method based on a quantum adiabatic linear algorithm disclosed in an embodiment of the present invention. Figure 1 The described quantum linear solution method based on the quantum adiabatic linear algorithm can be applied to a quantum linear solution device based on the quantum adiabatic linear algorithm. This device can be integrated into a cloud server or a local server; this embodiment of the invention does not impose any limitations. Figure 1 As shown, the quantum linear solution method based on the quantum adiabatic linear algorithm can include the following operations:
[0091] 101. Obtain the linear system to be processed and construct a Krylov subspace that matches the linear system.
[0092] In this embodiment of the invention, specifically, a linear system is a mathematical model, referring to a system composed of linear operators that simultaneously satisfies superposition and homogeneity (also known as homogeneity). Currently, linear systems are central to many scientific and engineering fields. In this embodiment, the linear system to be processed can be A·x = b, where A is the first coefficient matrix, b is the first constant vector, and x is the solution vector. The goal of A·x = b is to find a solution vector x1 such that the product of A and x1 equals b. A coefficient matrix is one of many types of matrices. Simply put, a coefficient matrix is used to calculate the solution of a system of equations by assembling the coefficients of the equations. Coefficient matrices are often used to represent the mathematical relationships between items.
[0093] In this embodiment of the invention, specifically, using Krylov subspaces to solve linear systems is called the subspace method. The subspace method is a classic iterative solution method for linear equation systems. Its core advantage is to reduce the dimensionality of the original high-dimensional linear equation system, so that the dimension of the linear equation system actually solved during the iteration process is much smaller than the dimension of the original linear equation system.
[0094] In this embodiment of the invention, step 101 may specifically involve: constructing a linear system: A·x=b, where A is a first coefficient matrix with dimension N, and b is a first constant vector; constructing an m-order Krylov subspace that satisfies m<N.
[0095] In this embodiment of the invention, more specifically, the principle of constructing a Krylov subspace that matches a linear system is as follows:
[0096] For a linear problem A·x = b, where A is a non-singular full-rank N-dimensional matrix, given an initial solution x0, we have an initial residual r0 = bA·x0. Define K... m as follows:
[0097] K m =span{r0, A·r0, A 2 ·r0,…,A m-1 ·r0}
[0098] Here K m Let A be an m-order Krylov subspace of matrix A and residual r0, satisfying m < <N。
[0099] 102. Based on the linear system and the Krylov subspace, determine the subspace equations of the linear system based on the Krylov subspace.
[0100] The core operation of the Krylov subspace is to reduce the dimensionality of the original high-dimensional linear equation system, so that the dimension of the linear equation system actually solved during the iteration is much smaller than that of the original linear equation system. For a linear system A·x=b, the size of A determines the scale and dimension of the linear system. If A is an l×n matrix, then it represents 1 / n equations and n unknowns. Therefore, based on the linear system and the Krylov subspace, the subspace equation system of the linear system based on the Krylov subspace can be determined as follows: For the linear system A·x=b, the first coefficient matrix A is reduced in dimension using the Krylov subspace to obtain the second coefficient matrix B and the second constant vector c. Here, the second coefficient matrix B is the coefficient matrix corresponding to the linear system A·x=b after dimensionality reduction in the Krylov subspace, and the second constant vector c is the constant vector corresponding to the linear system A·x=b in the Krylov subspace. The dimension of the second coefficient matrix B is smaller than and much smaller than the dimension of the first coefficient matrix A. Based on the second coefficient matrix B and the second constant vector c, the subspace equation system B·y=c of the linear system based on the Krylov subspace is constructed.
[0101] There are many methods for solving linear systems using Krylov subspaces, such as the fully orthogonal subspace method, the generalized minimum residual method, and the conjugate gradient method. This invention's embodiments reveal that the fully orthogonal subspace method converges quickly, while the generalized minimum residual method converges slowly. Therefore, the fully orthogonal subspace method can be used to accelerate convergence when the residuals are large, while the generalized minimum residual method can be used to stably approximate the exact solution when the residuals are small, thus better determining the Krylov subspace equations for the linear system.
[0102] Therefore, in this embodiment of the invention, step 102 may specifically involve: obtaining a preset iterative solution; calculating the iterative residual based on the iterative solution and the Krylov subspace; determining the subspace equations of the linear system based on the Krylov subspace based on the fully orthogonalized subspace method when the magnitude of the iterative residual is greater than or equal to a preset threshold; and determining the subspace equations of the linear system based on the Krylov subspace based on the generalized minimum residual method when the magnitude of the iterative residual is less than the preset threshold.
[0103] In this embodiment of the invention, specifically, the principle for determining the subspace equations of a linear system based on a Krylov subspace, according to the linear system and the Krylov subspace, is as follows:
[0104] By K m As defined, Krylov subspaces are nested, i.e., K1∈K2∈…K m The orthonormal basis set of the subspace {V1, V2, ..., V} mThe subspace method is also nested. The core idea is to transform the exact solution of the original problem into finding the "optimal solution" within a specific subspace. When the solution is constrained to subspace K... m Within the time frame, the "optimal solution" x m It is obvious that K can be used. m The linear representation of the orthogonal basis set. From the nesting property, we know that when x... m In K m When A·x changes, m In a higher-order subspace K m+1 The corresponding changes within. Due to r m =r0-A·X m Therefore r m The size and direction will also change accordingly. In order for the "optimal solution" to approximate the exact solution, r is required to... m The modulus should be as small as possible. The ideal optimal criterion should be: to find x m ∈K m , making r m ⊥Ax m .
[0105] Because x m It is unknown, therefore r m and A·x m Since everything is unknown, x cannot be solved directly using the optimal criterion. m We need to modify the optimal criteria and find some approximate "suboptimal" criteria. Different suboptimal criteria correspond to different subspace methods.
[0106] Two commonly used subspace methods are fully orthogonal subspace (FOM) and generalized minimum residual (GMRES).
[0107] The principle of the fully orthogonal subspace method (FOM) is as follows:
[0108] When searching for the "optimal solution" within a certain subspace, it is not possible to directly utilize the ideal optimality criterion r. m ⊥Ax m This condition, but Ax m ∈K m+l Then as long as the strengthening condition r is satisfied m ⊥K m+1 It can then automatically satisfy the ideal optimal criterion r m ⊥Ax m The newly established strengthening condition r m ⊥K m+1 When solving overdetermined systems of equations, to avoid this situation, the fully orthogonal subspace method further weakens the strengthening conditions. Its optimal criterion is: to find X. m ∈K m , making rm ⊥K m It can be seen that in the fully orthogonal subspace method, both the solution space and the constraint space of the solution are K. m In the fully orthogonal subspace method, the constraint equations take the form:
[0109]
[0110] Considering x m ∈K m Therefore X m It can definitely be made by K m Orthogonal basis set V m Represented as X m =V m y m Substituting these equations into the governing equations of the fully orthogonal subspace method, and simplifying them using the properties of the standard orthogonal basis set, we finally obtain the equations that can be directly solved by the fully orthogonal subspace method:
[0111] H m y m =βe
[0112] H m Let B be the second coefficient matrix of the linear system A·x=b after dimensionality reduction in the Krylov subspace, and let βe be the second constant vector c of the linear system A·x=b after dimensionality reduction in the Krylov subspace. Where β=||r0||2, e=[1,0,…,0] T Solve for y m Then, the exact solution to the original linear problem is approximated by the following formula:
[0113] x = x0 + V m y m
[0114] The principle of the Generalized Minimal Residual Method (GMRES) is as follows:
[0115] The generalized minimum residual method directly from r m Starting with the condition of minimizing the modulus, the optimal criterion can be described as: finding X m ∈K m , satisfying x m =arg min||r0-Ax m 2. Based on the above conclusions, we have:
[0116] r0-Ax m =r0-AV m y m =V m+1 (βe-H m+1,m y m )
[0117] Due to V m+1 It is an orthonormal basis, therefore:
[0118] ||r0-Ax m ||2=||V m+1 (βe-H m+1,m y m )||2=||βe-H m+1,m y m ||2
[0119] As can be seen, in the generalized minimum residual method, the problem is transformed into a least squares problem. Using QR decomposition to solve the above least squares problem, let:
[0120]
[0121] For H m+1,m The QR decomposition form is given by: where Q is an orthogonal matrix and R is an upper triangular matrix. Therefore:
[0122]
[0123] Here q is Q m+1 The first column, R m It is R m+1,m The first m rows. Finally, we get y. m This can be obtained by solving the following system of upper trigonometric equations:
[0124] βq(1:m)=R m y m
[0125] R m Let B be the second coefficient matrix of the linear system A·x=b after dimensionality reduction in the Krylov subspace, and let βq(1:m) be the second constant vector c of the linear system A·x=b after dimensionality reduction in the Krylov subspace. Here, q(1:m) represents the vector consisting of the first m elements of the vector q.
[0126] The generalized minimum residual method has been proven to be equivalent to: finding X m ∈K m , making r m ⊥AK m .
[0127] The comparative analysis between the fully orthogonal subspace method (FOM) and the generalized minimum residual method (GMRES) is as follows:
[0128] In order to in subspace K mTo find the optimal approximate solution, m constraints need to be set. Typically, the parameters of the approximate solution are required to satisfy m orthogonality conditions, i.e., r0-Ax. m ⊥L. Here x m It is in K m The approximate solution sought in K is another m-dimensional space, where L is another m-dimensional space. m Let L be the search space or solution space, and L be the constraint space. Different choices of L will lead to different subspace methods, when L = K. m When the subspace is fully orthogonal, it is called an orthogonal projection method; otherwise, it is called an oblique projection method. Among these, the fully orthogonalized subspace method is an orthogonal projection method, while the generalized minimum residual method is an oblique projection method.
[0129] Let V and W be K and K respectively. m A set of orthonormal bases for L, due to x m ∈K m Therefore, x = x0 + Vy must exist. m By the orthogonality property, we have r0 - AVy m ⊥W, that is:
[0130] W T AVy m =W T r0
[0131] If W T Since AV is nonsingular, there must exist a solution x = x0 + V(W). T AV) -1 W T r0. Therefore, a subspace method is stable if it satisfies the following condition:
[0132] A is positive definite and L = K m ;
[0133] A is nonsingular and L = AK m ;
[0134] The fully orthogonal subspace method, as an orthogonal projection method, is stable only if A satisfies positive definiteness. The generalized minimum residual method, as an oblique projection method, is stable only if A satisfies invertibility.
[0135] In an optional embodiment, determining the subspace equations of the linear system based on the Krylov subspace, according to the linear system and the Krylov subspace, may include:
[0136] Obtain the preset iterative solution x k According to the iterative solution x k Calculate the iterative residual r k =bA·x k ;
[0137] Based on the iterative residual r k Calculate the second coefficient matrix B and the second constant vector c of the linear system A·x=b after dimensionality reduction in the Krylov subspace, and generate the subspace equation system B·y=c of the linear system A·x=b based on the Krylov subspace.
[0138] In this optional embodiment, further optionally, calculating the second coefficient matrix B and the second constant vector c corresponding to the linear system A·x=b in the Krylov subspace after dimensionality reduction may include:
[0139] Construct the orthogonal basis set corresponding to the Krylov subspace, and obtain the preset residual judgment criterion ∈s;
[0140] If ||r k ||2≥∈ s Then, based on the iterative residual r k Based on the fully orthogonal subspace method, the constraint equations of the linear system A·x=b based on the Krylov subspace are determined. According to the orthogonal basis set and constraint equations, the second coefficient matrix B and the second constant vector c corresponding to the linear system A·x=b in the Krylov subspace after dimensionality reduction are calculated.
[0141] In this optional embodiment, the method may further include:
[0142] Obtain the preset convergence criterion ∈ c Among them, the residual judgment criterion ∈ s Convergence criterion ∈ c The following conditions must be met between them: ∈ c <∈ s ;
[0143] If ∈ s >||r k ||2>∈ c Then, based on the iterative residual r k Based on the generalized minimum residual method, the constraint equations of the linear system A·x=b based on the Krylov subspace are determined. According to the orthogonal basis set and constraint equations, the second coefficient matrix B and the second constant vector c of the linear system A·x=b after dimensionality reduction in the Krylov subspace are calculated.
[0144] In this optional embodiment, specifically, the fully orthogonalized subspace method, as an orthogonal projection method, is stable only if the first coefficient matrix A satisfies positive definiteness; the generalized minimum residual method, as an oblique projection method, is stable only if the first coefficient matrix A satisfies invertibility. Furthermore, the fully orthogonalized subspace method converges faster than the generalized minimum residual method. Therefore, the subspace method in this embodiment can accelerate convergence when the residual is large, and stably approximate the exact solution when the residual is small.
[0145] In this optional embodiment, ||r k ||2≥∈ s Represents the iterative residual r k The L2 norm is greater than or equal to the preset residual judgment criterion ∈ s ,∈ s >||r k ||2>∈ c Represents the iterative residual r k The L2 norm is less than the preset residual judgment criterion ∈ s And greater than the preset convergence criterion ∈ c .
[0146] As can be seen, implementing this optional embodiment accelerates convergence by using the fully orthogonalized subspace method when the residual of the linear system is large, and uses the generalized minimum residual method to stably approximate the exact solution when the residual is small. Thus, based on the linear system and the Krylov subspace, the optimal subspace equations of the linear system based on the Krylov subspace are determined.
[0147] 103. Based on the subspace equations, construct the quantum circuit corresponding to the quantum adiabatic linear algorithm, and solve the approximate solution of the linear system in the Krylov subspace based on the quantum circuit.
[0148] In this embodiment of the invention, it should be noted that a true quantum computer comprises two main parts: a classical computer responsible for performing classical computation and control, and a quantum device responsible for running quantum programs to achieve quantum computation. A quantum program is a sequence of instructions written in a quantum language such as QRunes that can run on a quantum computer, supporting quantum logic gate operations and ultimately realizing quantum computation. Specifically, a quantum program is a sequence of instructions that operates quantum logic gates according to a specific timing order.
[0149] In practical applications, due to limitations in the development of quantum device hardware, quantum computing simulations are often required to verify quantum algorithms, quantum applications, and so on. Quantum computing simulation is the process of simulating the execution of a quantum program corresponding to a specific problem using a virtual architecture (i.e., a quantum virtual machine) built with the resources of a regular computer. Typically, it is necessary to construct a quantum program corresponding to a specific problem. The quantum program referred to in this invention is a program written in a classical language that represents qubits and their evolution, wherein qubits, quantum logic gates, etc., related to quantum computing all have corresponding classical code representations.
[0150] Quantum circuits, also known as quantum logic circuits, are a common manifestation of quantum programming and the most widely used general-purpose quantum computing model. They represent circuits that operate on qubits in an abstract sense. A quantum circuit consists of qubits, circuits (timelines), and various quantum logic gates. The results are often retrieved through quantum measurement operations. Unlike traditional circuits that use metal wires to transmit voltage or current signals, in quantum circuits, the circuits can be viewed as being connected by time. That is, the state of a qubit evolves naturally over time, following the instructions of Hamiltonian operators until it encounters a logic gate and is manipulated.
[0151] A quantum program corresponds to a total quantum circuit. In this invention, the quantum program refers to this total quantum circuit, where the total number of qubits in the total quantum circuit is the same as the total number of qubits in the quantum program. This can be understood as follows: a quantum program can consist of a quantum circuit, measurement operations on the qubits within the quantum circuit, registers to store the measurement results, and control flow nodes (jump instructions). A quantum circuit can contain dozens, hundreds, or even thousands of quantum logic gate operations. The execution process of a quantum program is the process of executing all the quantum logic gates in a certain timing order. It should be noted that the timing order refers to the chronological sequence in which individual quantum logic gates are executed.
[0152] The quantum discrete adiabatic linear algorithm is a quantum computing-based algorithm used to solve linear equation systems. It is a relatively efficient quantum linear algorithm for solving sparse linear equation systems. This algorithm utilizes the discrete adiabatic theorem in quantum computing to efficiently find solutions to linear equation systems.
[0153] Therefore, constructing the quantum circuit corresponding to the quantum adiabatic linear algorithm based on the subspace equations can be achieved by: constructing a quantum logic gate for executing the quantum state evolution corresponding to the quantum adiabatic linear algorithm based on the subspace equations, and constructing the quantum circuit corresponding to the quantum adiabatic linear algorithm based on this quantum logic gate. Optionally, the quantum logic gate includes an encoded quantum logic gate for quantum state encoding and an evolutionary quantum logic gate for executing the quantum state evolution corresponding to the quantum adiabatic linear algorithm.
[0154] As can be seen, the quantum linear solution method based on the quantum adiabatic linear algorithm in this embodiment of the invention can combine the subspace method with the quantum adiabatic linear algorithm. The subspace method reduces the dimensionality of the original high-dimensional linear equations in the quantum adiabatic linear algorithm, making the dimension of the linear equations actually solved during iteration smaller than the dimension of the original linear equations. This reduces the computational resource requirements of the quantum discrete adiabatic linear algorithm, enabling its implementation in NISQ chips and classical computers.
[0155] In an optional embodiment, constructing the quantum circuit corresponding to the quantum adiabatic linear algorithm based on the subspace equations may include:
[0156] Based on the subspace equation system B·y=c, construct the first Hamiltonian H0 with ground state |c>, and construct the ground state |B -1 The second Hamiltonian H1 of c> is generated, and the time-dependent Hamiltonian H(t) = (1-t)H0 + tH1 is generated, where t∈[0,1];
[0157] Construct a quantum walk gate W based on the time-dependent Hamiltonian H(t) and a preset time interval Δt. H(i×Δt) For i ∈ {1, 2, ..., 1 / Δt}, the encoding line E is determined based on the second constant vector c. c ;
[0158] According to the quantum walking gate W H(i×Δt) and coded line E c Construct the quantum circuit corresponding to the quantum adiabatic linear algorithm.
[0159] In this optional embodiment, specifically, the encoding line E c Satisfy E c |0>=|c>.
[0160] In this optional embodiment, it should be noted that in classical computing, the most basic unit is the bit, and the most basic control mode is the logic gate. The purpose of controlling a circuit can be achieved through combinations of logic gates. Similarly, the way to process qubits is through quantum logic gates. Using quantum logic gates, quantum states can evolve. Quantum logic gates are the foundation of quantum circuits. Quantum logic gates include single-qubit quantum logic gates, such as Hadamard gates (H-gates), Pauli-X gates (X-gates), Pauli-Y gates (Y-gates), Pauli-Z gates (Z-gates), RX gates, RY gates, RZ gates, etc.; and multi-qubit quantum logic gates, such as CNOT gates, CR gates, iSWAP gates, Tofoli gates, etc. Quantum logic gates are generally represented using unitary matrices, and unitary matrices are not only matrix forms but also operations and transformations. Generally, the effect of a quantum logic gate on a quantum state is calculated by left-multiplying the unitary matrix by the matrix corresponding to the right vector of the quantum state.
[0161] A quantum state, or the logical state of a qubit, is represented in binary in quantum algorithms (or quantum programs). For example, a set of qubits q0, q1, and q2 represents the 0th, 1st, and 2nd qubits, ordered from high to low as q2, q1, and q0. The quantum state corresponding to this set of qubits is a superposition of the eigenstates corresponding to this set of qubits. There are a total of 2^(1 / 2) eigenstates corresponding to this set of qubits, that is, 8 eigenstates (definite states): |000), |001), |010), |011), |100), |101), |110), and |111). The bits of each eigenstate correspond to the qubits. For example, in the state |000), 000 corresponds to q2, q1, and q0 from high to low, where |> is the Dirac notation.
[0162] To illustrate the logic state of a single qubit. It may be in a superposition of states |0>, |1>, |0>, and |1), which can be specifically represented as: Where c and d are complex numbers representing the quantum state amplitude (probability amplitude), and the square of the amplitude modulus |c| 2 and |d| 2 Let |c| represent the probabilities of states |0) and |1) respectively. 2 +|d| 2 =1. In short, a quantum state is a superposition of eigenstates. When the probability of other eigenstates is 0, it is in a uniquely determined eigenstate.
[0163] The basic principle of the quantum discrete adiabatic linear solution algorithm can be described as follows: Given a time-dependent Hamiltonian H(t) = (1-t)H0 + tH1, if the system satisfies the adiabatic evolution condition, the eigenvalue decomposition results of the initial and final states at their respective times are consistent (ignoring phase factors). Specifically, if the initial state satisfies H... 0x (0) = 0, then the final state of the system also satisfies H 1x (1) = 0.
[0164] In this embodiment of the invention, based on the fundamental principle of the quantum discrete adiabatic linear solution algorithm described above, for the Hamiltonian H(t) constructed in this embodiment of the invention, t∈[0,1], the ground state of H0 is set to the quantum state |c> of the second constant vector c, and the ground state of H1 is |B>. -1 c> also represents the quantum state |y> of the solution vector y, where H(0) = H0 and H(1) = H1, that is, the realization process of B·y = c is reflected through the evolution of the quantum state. The realization of the ground state of H(0) is |c>, which depends on the encoding of the encoding circuit. The encoding circuit, based on the second constant vector c, executes E c|0>=|c>, realizing the ground state of H(0) is the requirement of the quantum discrete adiabatic linear solution algorithm |c>.
[0165] It can be seen that the quantum linear solution method based on the quantum adiabatic linear algorithm in this optional embodiment can construct a time-dependent Hamiltonian H(t), t∈[0,1], according to the basic principle of the quantum discrete adiabatic linear solution algorithm, where the ground state of H(0) is |c> and the ground state of H(1) is |y>, thus constructing a quantum circuit for realizing the quantum discrete adiabatic linear algorithm for the subspace equation system, thereby realizing the combination of the subspace method and the quantum adiabatic linear algorithm.
[0166] In yet another alternative embodiment, solving for an approximate solution to a linear system in the Krylov subspace based on a quantum circuit may include:
[0167] Execute the quantum circuit to obtain the solution quantum state |y>, and determine the classical data Y corresponding to the solution quantum state |y> based on the solution quantum state |y>;
[0168] Obtain the updated iterative solution x k+1 , where the updated iterative solution x k+1 =x k +Y;
[0169] Based on the updated iterative solution x k+1 Calculate the updated iterative residual r k+1 =bA·x k+1 ;
[0170] If the updated iteration residual r k+1 Satisfy ∈ c ≥||r k+1 ||2, then the updated iterative solution x is determined. k+1 This is an approximate solution for the linear system in the Krylov subspace.
[0171] In this optional embodiment, a quantum circuit is executed, and the subspace equations are solved using a quantum discrete adiabatic linear algorithm to obtain the solution quantum state |y>. Then, classical data Y can be extracted from the solution quantum state |y> using methods such as quantum state tomography. The classical data Y is used to update the iterative solution. In this optional embodiment, the updated iterative residual r k+1 Satisfy ∈ c ≥||r k+1 ||2 represents the updated iterative residual r k+1If the L2 norm is less than or equal to the preset convergence threshold, since the aforementioned steps have already transformed the linear system into a subspace equation system, that is, the exact solution of the original linear system problem has been transformed into the problem of finding the "optimal solution" in a certain subspace, when the value of the iterative residual is less than or equal to the preset convergence threshold, it is confirmed that the iterative solution at this time is an approximate solution of the linear system in the Krylov subspace.
[0172] As can be seen, implementing this optional embodiment enables the process of solving a system of subspace equations using a quantum discrete adiabatic linear algorithm by executing quantum circuitry.
[0173] In yet another alternative embodiment, according to the quantum walk gate W H(i×Δt) And the quantum circuit corresponding to the quantum adiabatic linear algorithm, constructed from the encoded circuit Ec, can include:
[0174] According to the quantum walking gate W H(i×Δt) And the quantum walking gate W H(i×Δt) Based on the corresponding temporal order, construct an evolutionary quantum logic gate for executing the quantum state evolution corresponding to the quantum adiabatic linear algorithm; according to the encoding circuit E c Construct encoded quantum logic gates for encoding qubits;
[0175] Based on the evolutionary quantum logic gate and the encoded quantum logic gate, the quantum circuit corresponding to the quantum adiabatic linear algorithm is constructed, wherein the quantum circuit includes data qubits and auxiliary qubits;
[0176] Furthermore, executing a quantum circuit to obtain the solution quantum state |y> can include:
[0177] The initial state of both the data qubit and the auxiliary qubit is set to |0>;
[0178] The encoded quantum logic gate performs an initial state encoding operation on the data qubit, making the state of the data qubit |c>;
[0179] The evolutionary quantum logic gate performs the quantum state evolution operation corresponding to the quantum adiabatic linear algorithm, obtains the target state of the data qubit after the quantum state evolution operation is completed, and determines the target quantum state as the solution quantum state |y>.
[0180] In this optional embodiment, according to the quantum walk gate W H(i×Δt) And the quantum walking gate W H(i×Δt) Based on the corresponding temporal order, we construct an evolutionary quantum logic gate, namely the continuous quantum walk gate W. H(i×Δt) One of the alternative quantum circuits is... Figure 2 As shown, the quantum walk gate W H(i×Δt), i∈{1,2,…,1 / Δt} are arranged sequentially according to time order, where the first and last ends are quantum walk gates W. H(0) and W H(1) In the middle are several quantum walk gates W constructed according to a preset time interval Δt. H(i×Δt) , Figure 2 In the quantum circuit, the upper part is the auxiliary qubit, and the lower part is the data qubit, both initially at 0. The data qubit also passes through an encoding quantum logic gate to encode |c>.
[0181] In this optional embodiment, the execution of the quantum circuit can be as follows: the initial state of both the data qubit and the auxiliary qubit is set to |0>, the quantum logic gate performs an initial state encoding operation on the data qubit, such that the state of the data qubit is |c>, and then the data qubit in the state of |c> and the auxiliary qubit in the state of |0> act consecutively on a quantum walk gate W arranged sequentially according to time order. H(i×Δt) The discrete adiabatic process is realized, and the quantum state of the data qubit after completion is the solution quantum state |y>.
[0182] It is evident that the quantum linear solution method based on the quantum adiabatic linear algorithm in this optional embodiment can solve the problem according to the quantum walk gate W. H(i×Δt) And the quantum walking gate W H(i×Δt) A quantum circuit is constructed to implement the quantum adiabatic linear algorithm based on the corresponding temporal order. This quantum circuit performs quantum evolution operations on the data qubits and auxiliary qubits. The quantum state of the data qubit in the quantum circuit after completing one quantum adiabatic linear algorithm is the solution quantum state |y>.
[0183] Example 2
[0184] Please see Figure 3 , Figure 3 This is a flowchart illustrating another quantum linear solution method based on a quantum adiabatic linear algorithm disclosed in an embodiment of the present invention. Figure 3 The described quantum linear solution method based on the quantum adiabatic linear algorithm can be applied to a quantum linear solution device based on the quantum adiabatic linear algorithm. This device can be integrated into a cloud server or a local server; this embodiment of the invention does not impose any limitations. Figure 3 As shown, the quantum linear solution method based on the quantum adiabatic linear algorithm can include the following operations:
[0185] 201. Obtain the linear system to be processed and construct the Krylov subspace that matches the linear system.
[0186] 202. Obtain the preset residual judgment criteria ∈ sAnd convergence criterion ∈ c, where residual criterion ∈ s Convergence criterion ∈ c The following conditions must be met between them: ∈ c <∈ s According to the iterative solution x k Calculate the iterative residual r k =bA·x k .
[0187] 203. If the iterative residual r k Satisfy ||r k ||2≥∈ s Then, the subspace equations of the linear system based on the Krylov subspace are determined based on the fully orthogonalized subspace method.
[0188] 204. If the iterative residual r k Satisfy ∈ s >||r k ||2>∈ c Then, the subspace equations of the linear system based on the Krylov subspace are determined based on the generalized minimum residual method.
[0189] 205. Based on the subspace equation system B·y=c, construct the time-dependent Hamiltonian H(t), t∈[0,1].
[0190] 206. Construct a quantum walk gate W based on the time-dependent Hamiltonian H(t). H(i×Δt ), i∈{1,2,…,1 / Δt}, the encoding line E is determined according to the second constant vector c. c .
[0191] 207. Based on the quantum walking gate W H(i×Δt) Given i∈{1,2,…,1 / Δt} and the encoding circuit Ec, construct the quantum circuit corresponding to the quantum adiabatic linear algorithm.
[0192] 208. Execute the quantum circuit to obtain the solution quantum state |y>. Based on the solution quantum state |y>, determine the classical data Y corresponding to the solution quantum state |y>.
[0193] 209. Obtain the updated iterative solution x k+1 =x k +Y, based on the updated iterative solution x k+1 Calculate the updated iterative residual r k+1 =bA·x k+1 .
[0194] 210. If the updated iterative residual r k+1 Satisfy ∈ c ≥||r k+1 ||2, then the updated iterative solution x is determined. k+1This is an approximate solution for the linear system in the Krylov subspace.
[0195] 211. If the updated iterative residual r k+1 Not satisfied ∈ c ≥||r k+1 If ||2, then the iteration number k is incremented by 1, and steps 202 to 209 are retried; until the updated iterative residual satisfies ∈ c ≥||r k+1 ||Up to 2.
[0196] For other descriptions of steps 201-210 in this embodiment of the invention, please refer to the detailed description in Embodiment 1. This embodiment of the invention will not repeat them.
[0197] In this embodiment of the invention, specifically, when the iterative residual satisfies ||r k ||2≥∈ s or ∈ s >||r k ||2>∈ c If this happens, then it is necessary to continue establishing a subspace equation system according to the corresponding steps to update the iterative solution. Only when the updated iterative residual satisfies ∈ c ≥||r k+1 When ||2, it indicates that the iterative solution at this time meets the requirements, and the updated iterative solution x is determined. k+1 This is an approximate solution for the linear system in the Krylov subspace.
[0198] As can be seen, the quantum linear solution method based on the quantum adiabatic linear algorithm in this embodiment of the invention reduces the dimension of the actual solved linear equation system to that of the original linear equation system through an iterative process, thus realizing the dimensionality reduction of the original high-dimensional linear equation system in the quantum adiabatic linear algorithm using the subspace method. This reduces the computational resource requirements of the quantum discrete adiabatic linear algorithm, enabling its implementation in both NISQ chips and classical computers.
[0199] Example 3
[0200] Please see Figure 4 , Figure 4 This is a schematic diagram of a quantum linear solver based on a quantum adiabatic linear algorithm disclosed in an embodiment of the present invention. Figure 4 As shown, the quantum linear solver based on the quantum adiabatic linear algorithm may include:
[0201] Subspace construction module 301 is used to obtain the linear system to be processed and construct a Krylov subspace that matches the linear system;
[0202] Equation determination module 302 is used to determine the subspace equations of the linear system based on the Krylov subspace, according to the linear system and the Krylov subspace.
[0203] The circuit solving module 303 is used to construct the quantum circuit corresponding to the quantum adiabatic linear algorithm based on the subspace equations, and to solve the approximate solution of the linear system in the Krylov subspace based on the quantum circuit.
[0204] As can be seen, the quantum linear solver based on the quantum adiabatic linear algorithm in this embodiment of the invention can combine the subspace method with the quantum adiabatic linear algorithm. The subspace method reduces the dimensionality of the original high-dimensional linear equations in the quantum adiabatic linear algorithm, making the dimension of the linear equations actually solved during iteration smaller than the dimension of the original linear equations. This reduces the computational resource requirements of the quantum discrete adiabatic linear algorithm, enabling its implementation in NISQ chips and classical computers.
[0205] In one alternative embodiment, the linear system is A·x=b, where A is a first coefficient matrix and b is a first constant vector;
[0206] Furthermore, the equation determination module 302 determines the specific method by which it determines the subspace equations of the linear system based on the Krylov subspace, according to the linear system and the Krylov subspace. This may include:
[0207] Based on the iterative residual r k Calculate the second coefficient matrix B and the second constant vector c of the linear system A·x=b after dimensionality reduction in the Krylov subspace, and generate the subspace equation system B·y=c of the linear system A·x=b based on the Krylov subspace.
[0208] In this optional embodiment, further optional, such as Figure 5 As shown, the device may further include:
[0209] Standard acquisition module 305 is used to acquire preset residual judgment standards ∈ s Convergence criterion ∈ c Among them, the residual judgment criterion ∈ s Convergence criterion ∈ c The following conditions must be met between them: ∈ c <∈ s .
[0210] Furthermore, the specific method by which the equation determination module calculates the second coefficient matrix B and the second constant vector c corresponding to the linear system A·x=b in the Krylov subspace after dimensionality reduction can include:
[0211] Construct orthogonal basis sets corresponding to Krylov subspaces;
[0212] If ||r k ||2≥∈ s Then, based on the iterative residual r k Based on the fully orthogonal subspace method, the constraint equations of the linear system A·x=b based on the Krylov subspace are determined. According to the orthogonal basis set and constraint equations, the second coefficient matrix B and the second constant vector c corresponding to the linear system A·x=b in the Krylov subspace after dimensionality reduction are calculated.
[0213] In addition, the equation determination module is also used for:
[0214] If ∈ s >||r k ||2>∈ c Then, based on the iterative residual r k Based on the generalized minimum residual method, the constraint equations of the linear system A·x=b based on the Krylov subspace are determined. According to the orthogonal basis set and constraint equations, the second coefficient matrix B and the second constant vector c of the linear system A·x=b after dimensionality reduction in the Krylov subspace are calculated.
[0215] As can be seen, the quantum linear solver based on the quantum adiabatic linear algorithm in this optional embodiment uses the fully orthogonalized subspace method to accelerate convergence when the residual of the linear system is large, and uses the generalized minimum residual method to stably approximate the exact solution when the residual is small. Thus, based on the linear system and the Krylov subspace, the optimal subspace equations of the linear system based on the Krylov subspace are determined.
[0216] In another optional embodiment, the specific method by which the circuit solving module 303 constructs the quantum circuit corresponding to the quantum adiabatic linear algorithm based on the subspace equations may include:
[0217] Based on the subspace equation system B·y=c, construct the first Hamiltonian H0 with ground state |c>, and construct the ground state |B -1 The second Hamiltonian H1 of c> is generated, and the time-dependent Hamiltonian H(t) = (1-t)H0 + tH1 is generated, where t∈[0,1];
[0218] Construct a quantum walk gate W based on the time-dependent Hamiltonian H(t) and a preset time interval Δt. H(i×Δt) ,i∈{1,2,…,1 / Δt};
[0219] The encoding line E is determined based on the second constant vector c. c Among them, the coded line E c Satisfy E c |0>=|c>;
[0220] According to the quantum walking gate W H(i×Δt) And the encoding circuit Ec, construct the quantum circuit corresponding to the quantum adiabatic linear algorithm.
[0221] As can be seen, the quantum linear solver based on the quantum adiabatic linear algorithm in this optional embodiment can construct a time-dependent Hamiltonian H(t), t∈[0,1], according to the basic principle of the quantum discrete adiabatic linear solver algorithm, where the ground state of H(0) is |c> and the ground state of H(1) is |y>, thus constructing a quantum circuit for realizing the quantum discrete adiabatic linear algorithm for the subspace equation system, thereby realizing the combination of the subspace method and the quantum adiabatic linear algorithm.
[0222] In yet another optional embodiment, the specific method by which the circuit solving module 303 solves for an approximate solution of the linear system in the Krylov subspace based on the quantum circuit may include:
[0223] Execute the quantum circuit to obtain the solution quantum state |y>, and determine the classical data Y corresponding to the solution quantum state |y> based on the solution quantum state |y>;
[0224] Obtain the updated iterative solution x k+1 , where the updated iterative solution x k+1 =x k +Y;
[0225] Based on the updated iterative solution x k+1 Calculate the updated iterative residual r k+1 =bA·x k+1 ;
[0226] If the updated iteration residual r k+1 Satisfy ∈ c ≥||r k+1 ||2, then the updated iterative solution x is determined. k+1 This is an approximate solution for the linear system in the Krylov subspace.
[0227] As can be seen, the quantum linear solver based on the quantum adiabatic linear algorithm in this optional embodiment can realize the process of solving the subspace equation system using the quantum discrete adiabatic linear algorithm by executing the quantum circuit.
[0228] In yet another alternative embodiment, such as Figure 5 As shown, the device may further include:
[0229] Residual iteration module 304 is used to update the iterative residual r. k+1 Not satisfied ∈ c ≥||r k+1When ||2, the iteration number k is incremented by 1, and the equation determination module 302 is retried to perform the operation of determining the subspace equations of the linear system based on the Krylov subspace; and the circuit solution module 303 constructs the quantum circuit corresponding to the quantum adiabatic linear algorithm based on the subspace equations, executes the quantum circuit, obtains the solution quantum state |y>, and determines the classical data Y corresponding to the solution quantum state |y> based on the solution quantum state |y>; and determines the classical data Y corresponding to the solution quantum state |y> based on the updated iterative solution x. k+1 Calculate the updated iterative residual r k+1 =bA·x k+1 The operation continues until the updated iterative residual r is reached. k+1 Satisfying ∈c≥||rk +1 ||Up to 2.
[0230] As can be seen, the quantum linear solver based on the quantum adiabatic linear algorithm in this optional embodiment reduces the dimension of the actual solved linear equation system to be smaller than the dimension of the original linear equation system through an iterative process, thus realizing the dimensionality reduction of the original high-dimensional linear equation system in the quantum adiabatic linear algorithm using the subspace method. This reduces the computational resource requirements of the quantum discrete adiabatic linear algorithm, enabling its implementation in both NISQ chips and classical computers.
[0231] In yet another alternative embodiment, the circuit solving module 303 determines the path based on the quantum walk gate W. H(i×Δt) and coded line E c The specific methods for constructing the quantum circuit corresponding to the quantum adiabatic linear algorithm may include:
[0232] According to the quantum walking gate W H(i×Δt) And the quantum walking gate W H(i×Δt) Based on the corresponding temporal order, construct an evolutionary quantum logic gate for executing the quantum state evolution corresponding to the quantum adiabatic linear algorithm; according to the encoding circuit E c Construct encoded quantum logic gates for encoding qubits;
[0233] Based on the evolutionary quantum logic gate and the encoded quantum logic gate, the quantum circuit corresponding to the quantum adiabatic linear algorithm is constructed, wherein the quantum circuit includes data qubits and auxiliary qubits;
[0234] Furthermore, the specific methods by which the circuit solving module 303 executes the quantum circuit and obtains the solution quantum state |y> include:
[0235] The initial state of both the data qubit and the auxiliary qubit is set to |0>;
[0236] The encoded quantum logic gate performs an initial state encoding operation on the data qubit, making the state of the data qubit |c>;
[0237] The evolutionary quantum logic gate performs the quantum state evolution operation corresponding to the quantum adiabatic linear algorithm, obtains the target state of the data qubit after the quantum state evolution operation is completed, and determines the target quantum state as the solution quantum state |y>.
[0238] As can be seen, the quantum linear solution device based on the quantum adiabatic linear algorithm in this optional embodiment can solve the problem according to the quantum walk gate W. H(i×Δt) And the quantum walking gate W H(i×Δt) A quantum circuit is constructed to implement a quantum adiabatic linear algorithm based on the corresponding temporal order. This quantum circuit performs quantum evolution operations on the data qubits and auxiliary qubits, and stores the quantum state of the quantum circuit in a data register. The quantum state of the data qubit in the quantum circuit after completing one quantum adiabatic linear algorithm is the solution quantum state |y>.
[0239] Example 4
[0240] Please see Figure 6 , Figure 6 This is a schematic diagram of another quantum linear solver based on a quantum adiabatic linear algorithm disclosed in an embodiment of the present invention. Figure 6 As shown, the quantum linear solver based on the quantum adiabatic linear algorithm may include:
[0241] Memory 401 storing executable program code;
[0242] Processor 402 coupled to memory 401;
[0243] The processor 402 calls the executable program code stored in the memory 401 to execute the steps in the quantum linear solution method based on the quantum adiabatic linear algorithm described in Embodiment 1 or Embodiment 2 of the present invention.
[0244] Example 5
[0245] This invention discloses a computer storage medium storing computer instructions. When these computer instructions are invoked, they are used to execute the steps in the quantum linear solution method based on the quantum adiabatic linear algorithm described in Embodiment 1 or Embodiment 2 of this invention.
[0246] Example 6
[0247] This invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform the steps in the quantum linear solution method based on the quantum adiabatic linear algorithm described in Embodiment 1 or Embodiment 2.
[0248] The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0249] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-Erasable Programmable Read-Only Memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0250] Finally, it should be noted that the quantum linear solution method, apparatus, and medium disclosed in the embodiments of this invention are merely preferred embodiments of the present invention and are only used to illustrate the technical solutions of the present invention, not to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this invention.
Claims
1. A quantum linear solving method based on quantum adiabatic linear algorithm, characterized in that, The method comprises: acquiring a linear system to be processed, and constructing a Krylov subspace matched with the linear system; determining, according to the linear system and the Krylov subspace, a subspace equation system of the linear system based on the Krylov subspace ; wherein the B and c are respectively a second coefficient matrix and a second constant vector corresponding to the linear system to be processed after dimension reduction in the Krylov subspace According to the subspace equations , a first Hamiltonian whose ground state is , a second Hamiltonian whose ground state is , and a time-dependent Hamiltonian is generated, where ; According to the time-dependent Hamiltonian and a predetermined time interval configuring a quantum walk gate ; determining an encoding line based on the second constant vector c wherein the encoding line satisfies ; According to the quantum walk gate and the encoding circuit , a quantum circuit corresponding to a quantum adiabatic linear algorithm is constructed; solving an approximate solution of the linear system in the Krylov subspace according to the quantum circuit.
2. The quantum linear solving method based on quantum adiabatic linear algorithm according to claim 1, characterized in that, The linear system is where A is a first coefficient matrix and b is a first constant vector. And, determining a subspace equation set of the linear system based on the Krylov subspace according to the linear system and the Krylov subspace comprises: obtaining a preset iterative solution ; calculating an iterative residual error from the iterative solution where k is the iteration number; According to the iterative residual error , a linear system After dimension reduction in the Krylov subspace, the corresponding second coefficient matrix B and the second constant vector c are generated, and the linear system Based on the subspace equation set of the Krylov subspace .
3. The quantum linear solving method based on quantum adiabatic linear algorithm according to claim 2, characterized in that, The computing linear system The second coefficient matrix B and the second constant vector c corresponding to the dimension reduction in the Krylov subspace, comprising: constructing an orthogonal basis corresponding to the Krylov subspace, and obtaining a preset residual judgment criterion ; If then the linear system is determined based on a complete orthogonalization subspace method is computed based on the constraint equation of the Krylov subspace a second coefficient matrix B and a second constant vector c corresponding to the reduced dimension in the Krylov subspace.
4. The quantum linear solving method based on quantum adiabatic linear algorithm according to claim 3, characterized in that, The method further comprises: acquiring a preset convergence judgment criterion wherein the residual judgment criterion and the convergence judgment criterion satisfy: ; If then according to the iteration residual and based on the generalized minimal residual method, the linear system based on the constraint equation of the Krylov subspace, according to the orthogonal basis set and the constraint equation, the linear system the second coefficient matrix B and the second constant vector c corresponding to the dimension reduction in the Krylov subspace.
5. The quantum linear solving method based on quantum adiabatic linear algorithm according to claim 4, characterized in that, solving an approximate solution of the linear system in the Krylov subspace according to the quantum circuit comprises: executing the quantum circuit, obtaining a solution quantum state , determining, from the solution quantum state , classical data Y corresponding to the solution quantum state obtaining an updated iterative solution wherein the updated iterative solution ; According to the updated iterative solution Computing an updated iterative residual ; if the updated iteration residual satisfies then the updated iteration solution is determined to be an approximate solution of the linear system within the Krylov subspace.
6. The quantum linear solution method based on quantum adiabatic linear algorithm of claim 5, wherein, The method further comprises: if the updated iteration residual is not satisfied , the value of the iteration number k is increased by 1, and the operation of performing the determining, from the linear system and the Krylov subspace, a subspace equation system of the linear system based on the Krylov subspace; constructing a quantum circuit corresponding to a quantum adiabatic linear algorithm according to the subspace equation system, executing the quantum circuit, and obtaining a solution quantum state is re-triggered; according to the solution quantum state , determining classical data Y corresponding to the solution quantum state ; and calculating an updated iteration residual from the updated iteration solution is performed until the updated iteration residual is satisfied .
7. The quantum linear solution method based on quantum adiabatic linear algorithm of claim 5, wherein, The quantum walk gate according to the quantity And the encoding circuit , configure the quantum adiabatic linear algorithm corresponding to the quantum circuit, comprising: According to the quantum walk gate and the quantum walk gate corresponding to the quantum adiabatic linear algorithm, an evolution quantum logic gate is constructed for performing quantum state evolution corresponding to the quantum adiabatic linear algorithm; according to the encoding circuit , an encoding quantum logic gate is constructed for encoding quantum bits; constructing a quantum circuit corresponding to a quantum adiabatic linear algorithm according to the evolution quantum logic gate and the encoding quantum logic gate, wherein the quantum circuit comprises data quantum bits and auxiliary quantum bits; and the executing the quantum circuit, obtaining a dequantized state , comprising: setting the initial state of the data qubit and the ancilla qubit to be ; The encoding quantum logic gate performs an operation of initial state encoding on a data quantum bit such that a state of the data quantum bit is ; The evolution quantum logic gate performs the quantum state evolution operation corresponding to the quantum adiabatic linear algorithm, obtains a target state of the data quantum bit after the quantum state evolution operation ends, and determines the target quantum state as a solution quantum state .
8. A quantum linear solving device based on quantum adiabatic linear algorithm, characterized in that, The device comprises: a subspace construction module configured to acquire a linear system to be processed, and construct a Krylov subspace matched with the linear system; a system of equations determining module, configured to determine, according to the linear system and the Krylov subspace, a system of subspace equations of the linear system based on the Krylov subspace ; wherein the B and c are respectively a second coefficient matrix and a second constant vector corresponding to the linear system to be processed after dimension reduction in the Krylov subspace a solving module configured to: According to the subspace equations , a first Hamiltonian whose ground state is , a second Hamiltonian whose ground state is , and a time-dependent Hamiltonian is generated, where ; According to the time-dependent Hamiltonian and a predetermined time interval configuring a quantum walk gate ; determining an encoding line based on the second constant vector c wherein the encoding line satisfies ; According to the quantum walk gate and the encoding circuit , a quantum circuit corresponding to a quantum adiabatic linear algorithm is constructed; solve an approximate solution of the linear system in the Krylov subspace according to the quantum circuit.
9. A quantum linear solving apparatus based on quantum adiabatic linear algorithm, characterized by, The device comprises: a memory storing executable program codes; a processor coupled with the memory; the processor invokes the executable program codes stored in the memory to execute the quantum linear solving method based on the quantum adiabatic linear algorithm according to any one of claims 1-7.
10. A computer storage medium, characterized in that, The computer storage medium stores computer instructions, which are invoked to execute the quantum linear solving method based on the quantum adiabatic linear algorithm according to any one of claims 1-7.
Citation Information
Patent Citations
Linear system solving method and device based on quantum circuit, medium and equipment
CN116070707A