Hybrid subspace-based linear system solving method, device, medium and equipment

By constructing hybrid subspaces and quantum circuits, and combining fully orthogonalized subspaces and generalized minimal residual methods, the problems of high computational resource requirements and high time complexity in linear system problems are solved, achieving efficient solutions for linear systems.

CN116957084BActive Publication Date: 2026-01-13ORIGIN QUANTUM COMPUTING TECH (HEFEI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210387083.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-13
Publication Date
2026-01-13
Estimated Expiration
2042-04-13

Smart Images

  • Figure CN116957084B_ABST
    Figure CN116957084B_ABST
Patent Text Reader

Abstract

The application discloses a kind of linear system solving method, device, medium and equipment based on mixed subspace, method includes: first determining linear system to be solved and pre-processing linear system to be solved, secondly, mixed subspace for solving linear system and quantum circuit for solving linear system are respectively constructed, the target solution of pre-processed linear system to be solved is calculated using mixed subspace and quantum circuit, using the comprehensive solving performance of mixed subspace, to solve the deficiencies in the prior art, it can reduce the time complexity and computation of linear problem solving, speed up the solving speed of quantum linear algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of quantum computing, and particularly relates to a linear system solving method and device based on a hybrid subspace, a medium and equipment. 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 calculates quantum information and runs quantum algorithms, it is a quantum computer. Quantum computers have the ability to process mathematical problems more efficiently than ordinary computers, for example, they can accelerate the time for cracking RSA keys from hundreds of years to a few hours, so they have become a key technology under research.

[0003] 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 a quantum state in accordance with the basic laws of quantum bits of quantum mechanics.

[0004] Solving a linear system group is the core of many scientific and engineering problems, and the classical algorithms for solving such problems are collectively referred to as linear system algorithms. The complete orthogonalization subspace method and the generalized minimal residual method are two commonly used classical subspace solving methods for linear problems. Although the complete orthogonalization subspace method has a faster convergence speed, its stability is poor. The generalized minimal residual method has good stability, but its convergence speed is slow. When solving linear system problems, regardless of which subspace method is used, as the dimension of the input matrix increases, the time complexity of solving the linear system problem will increase, which may require the use of megabytes or even gigabytes of data during the solving process, resulting in excessive demand for computing resources. This is a problem that needs to be solved urgently. SUMMARY

[0005] The purpose of the present application is to provide a linear system solving method, device, medium and equipment based on a hybrid subspace, which uses the comprehensive solving performance of the hybrid subspace to solve the problems in the prior art. It can reduce the time complexity and computational complexity of solving linear problems.

[0006] One embodiment of the present application provides a linear system solving method based on a hybrid subspace, which comprises:

[0007] determining a linear system to be solved and preprocessing the linear system to be solved;

[0008] constructing a hybrid subspace for solving the linear system and a quantum circuit for solving the linear system, respectively;

[0009] The target solution of the preprocessed linear system to be solved is calculated by using the mixed subspace and the quantum circuit.

[0010] Optionally, the determining the linear system to be solved and preprocessing the linear system to be solved comprises:

[0011] A linear system Ax=b to be solved is obtained, where A is a first matrix, and b is a first vector.

[0012] A sparse approximate matrix M used for linear system preprocessing is determined according to the first matrix A, where the sparse approximate matrix M is a sparse approximation of A and satisfies a preset sparse structure. -1

[0013] A second matrix A', a second vector b' and an initial residual b0 of the linear system after preprocessing are obtained according to the sparse approximate matrix M, where the second matrix A' = MA, the second vector b' = Mb, and the initial residual is calculated according to an initial approximate solution x0 and satisfies b0 = b'-A'x0.

[0014] Optionally, the constructing the mixed subspace for solving the linear system and the quantum circuit for solving the linear system comprises:

[0015] An m-order Krylov subspace K m and a first quantum circuit corresponding to the HHL algorithm for solving the linear system are constructed based on a complete orthogonalization subspace method; and

[0016] An m-order Krylov subspace K' m and a second quantum circuit corresponding to the HHL algorithm for solving the linear system are constructed based on a generalized minimal residual method.

[0017] Optionally, the calculating the target solution of the preprocessed linear system to be solved by using the mixed subspace and the quantum circuit comprises:

[0018] It is determined whether a norm of a current residual is greater than a first threshold, where the current residual is determined according to a current approximate solution.

[0019] If yes, a first approximate solution x m of the linear system in the subspace K m is calculated by using the complete orthogonalization subspace method according to the subspace K m , the first quantum circuit, and otherwise, a second approximate solution x' m of the linear system in the subspace K' m is calculated by using the generalized minimal residual method according to the subspace K' m , the second quantum circuit.​

[0020] updating the current approximate solution according to the first approximate solution x m or the second approximate solution x′ m , and continuing to execute the step of judging whether the norm of the current residual is greater than the first threshold value until an approximate solution meeting the accuracy is obtained as the target solution of the linear system to be solved.

[0021] Optionally, the first approximate solution x m of the linear system in the subspace K m is calculated according to the subspace K m , the first quantum circuit, and a complete orthogonalization subspace method, and the method comprises the following steps.

[0022] constructing a standard orthogonal basis V m and a Hessenberg matrix H m of the subspace K m corresponding to the second matrix A′ and the current residual;

[0023] processing the Hessenberg matrix H m and the value of the first residual vector β m by using the first quantum circuit to obtain an intermediate value y m of the linear system in the subspace K m , wherein the β m = [||b0||2, 0, 0, …, 0] T , H m , y m and β m satisfy a linear relationship: H m y m = β m ;

[0024] obtaining the first approximate solution x m of the linear system in the subspace K m according to the intermediate value y m , wherein the x m = x0+V m y m .

[0025] Optionally, after the method further comprises the following steps: g processing the Hessenberg matrix H m and the value of the first residual vector β m by using the first quantum circuit to obtain an intermediate value y m of the linear system in the subspace K m , wherein the β m = [||b0||2, 0, 0, …, 0] T , H m , y m and β m satisfy a linear relationship: H m y m = β m ;

[0026] judging whether the intermediate value y m meets the accuracy.m whether the intermediate value y m satisfies ||H m y m - β m ||2 < ε1, where ε1 is a preset first precision;

[0027] If the intermediate value y m satisfies ||H m y m - β m ||2 < ε1, an updated first residual vector is obtained and the step of inputting the Hessenberg matrix H m and the value of the first residual vector β m and outputting the intermediate value y m of the linear system in the subspace K new is executed again, where the updated first residual vector β m = β m - H m y .

[0028] Optionally, the method further comprises:

[0029] If the intermediate value y m satisfies ||H m y m - β m ||2 < ε1, it is determined whether the first approximate solution x m satisfies ||A'x m - b' ||2 < ε2, where ε2 is a preset second precision;

[0030] If the first approximate solution x m satisfies ||A'x m - b' ||2 < ε2, the first approximate solution x m is determined as the target solution of the linear system Ax = b in the subspace K m .

[0031] Optionally, the method further comprises:

[0032] If the first approximate solution x m does not satisfy ||A'x m - b' ||2 < ε2, the preset initial solution x0 is updated to the current first approximate solution x m , and an updated current residual b' - A'x m is obtained, and the step of determining whether the norm of the current residual is greater than the first threshold value is executed again and iterative calculation is continued until the target solution satisfying the preset second precision is obtained.

[0033] Optionally, the subspace K′ is used as a basis. m The second quantum circuit is used to calculate the linear system in the subspace K′ using the generalized minimum residual method. m The second approximate solution x′ m ,include:

[0034] Optimize the current residual using preset rules;

[0035] Construct the subspace K′ corresponding to the second matrix A′ and the optimized current residual. m Orthogonal basis set V′ m and Hessenberg matrix H m+1,m ;

[0036] For the Hessenberg matrix H m+1,m Perform QR decomposition;

[0037] The QR decomposition results are processed using the second quantum circuit to obtain the linear system in subspace K′. m The middle value within

[0038] According to the intermediate value Obtain the linear system in the subspace K′ m The second approximate solution x′ m , wherein

[0039] Optionally, the Hessenberg matrix H... m+1,m Perform QR decomposition, including:

[0040] The Hessenberg matrix H m+1,m Decomposed into Among them, Q m+1 R is an orthogonal matrix. m+1,m It is an upper triangular matrix.

[0041] Optionally, the process of using the second quantum circuit to process the QR decomposition result yields the linear system in subspace K′. m The middle value within include:

[0042] Using the second quantum circuit, input R m The value of the second residual vector α is used to output the linear system in subspace K′. m The middle value within Wherein, the R m R is an upper triangular matrix m+1,m For the first m rows, α = ||b0||2q1(1:m), where q1(1:m) represents the orthogonal matrix Q.m+1 The vector consisting of the first m elements of the first column, α and R m , Satisfying Relationship:

[0043] Optionally, the second quantum circuit is used to input R. m The value of the second residual vector α is used to output the linear system in subspace K′. m The middle value within Subsequently, the method further includes:

[0044] Determine the intermediate value Can it be satisfied? Where ∈3 represents the preset third precision;

[0045] If the intermediate value Not satisfied Then obtain the updated second residual vector α new And return to execute the operation using the second quantum circuit, input R m The value of the second residual vector α is used to output the linear system in subspace K′. m The middle value within The steps, wherein the updated second residual vector

[0046] Optionally, the method further includes:

[0047] If the intermediate value satisfy Then determine the second approximate solution x′ m Can ||A′x′ be satisfied? m -b′||2<∈4, where ∈4 is the preset fourth precision;

[0048] If the second approximate solution x′ m Satisfy ||A′x′ m -b′||2<∈4, then the second approximate solution x′ is determined. m That is, the linear system Ax = b in subspace K′ m The target solution within.

[0049] Optionally, the method further includes:

[0050] If the second approximate solution x′ m Not satisfied ||A′x′ m If -b′||2<∈4, then update the preset initial solution x0 to the current second approximate solution x′. m And obtain the updated current residual b′-A′x′ m, return to execute the step of judging whether the norm of the current residual is greater than the first threshold value and continue to iteratively calculate until a target solution satisfying a preset fourth precision is obtained.

[0051] Optionally, the quantum circuit for solving the linear system is constructed, comprising:

[0052] A plurality of quantum bits including an auxiliary quantum bit, a first quantum bit, and a second quantum bit are obtained, wherein initial states of the auxiliary quantum bit and the first quantum bit are set as |0>, and an initial state of the second quantum bit is set as The b i is the i-th element of the first vector b, and the N is the dimension of the first vector;

[0053] A unitary matrix U corresponding to the first matrix A is determined;

[0054] A first sub-quantum circuit module for phase estimation is constructed, which is used to decompose the |b〉 in the feature space of the first matrix A into and the initial state |0〉|b〉 of the first quantum bit and the second quantum bit is converted into wherein the |μ j 〉 is an eigenvector of the first matrix A, the λ j is an eigenvalue of the first matrix A, and the β j is an amplitude of the eigenvector of the first matrix A;

[0055] A second sub-quantum circuit module for performing a controlled rotation operation is constructed, which is used to rotate the |λ j > as a control bit to the auxiliary quantum bit to obtain wherein the C is a normalization constant;

[0056] A third sub-quantum circuit module for performing inverse phase estimation is constructed, which is used to reset the |λ j > to |0>;

[0057] A measurement operation module for the auxiliary quantum bit is constructed, so that when the quantum state of the auxiliary quantum bit is measured as |1>, the following is obtained: The |x'> is proportional to |x>;

[0058] The first sub-quantum circuit module, the second sub-quantum circuit module, the third sub-quantum circuit module, and the quantum measurement operation module are sequentially composed to form a quantum circuit for solving the linear system.

[0059] Another embodiment of the present application provides a linear system solving device based on a hybrid subspace, comprising:

[0060] determining a linear system to be solved and pre-processing the linear system to be solved;

[0061] constructing a hybrid subspace for solving the linear system and a quantum circuit for solving the linear system, respectively;

[0062] calculating a target solution of the pre-processed linear system to be solved by using the hybrid subspace and the quantum circuit.

[0063] Optionally, the determining module comprises:

[0064] a first obtaining unit configured to obtain a linear system Ax = b, where A is a first matrix and b is a first vector;

[0065] a first determining unit configured to determine a sparse approximate matrix M for linear system pre-processing according to the first matrix A, where the sparse approximate matrix M is a sparse approximation of A and satisfies a preset sparse structure; -1

[0066] a second obtaining unit configured to obtain a second matrix A', a second vector b' and an initial residual b0 after linear system pre-processing according to the sparse approximate matrix M, respectively, where the second matrix A' = MA, the second vector b' = Mb, and the initial residual is calculated according to an initial approximate solution x0 and satisfies b0 = b' - A'x0.

[0067] Optionally, the constructing module comprises:

[0068] a first constructing unit configured to construct an m-order Krylov subspace K m and a first quantum circuit corresponding to a HHL algorithm for solving the linear system based on a full orthogonalization subspace method; and

[0069] construct an m-order Krylov subspace K' m and a second quantum circuit corresponding to the HHL algorithm for solving the linear system based on a generalized minimal residual method.

[0070] Optionally, the calculating module comprises:

[0071] a first judging unit configured to judge whether a norm of a current residual is greater than a first threshold, where the current residual is determined according to a current approximate solution;

[0072] a first calculating unit configured to, if yes, calculate a first approximate solution x m of the linear system in the subspace K m by using the subspace K m ​, otherwise, according to the subspace K' m , a second quantum circuit is utilized to calculate a second approximate solution x' m of the linear system in the subspace K' m by using a generalized minimal residual method.

[0073] A first updating unit is configured to update a current approximate solution according to the first approximate solution x m or the second approximate solution x' m , and continue to execute the step of judging whether the norm of the current residual is greater than the first threshold value until an approximate solution meeting a precision requirement is obtained as a target solution of the linear system.

[0074] Optionally, the first calculating unit comprises:

[0075] A first constructing sub-unit is configured to construct an orthonormal basis V m and a Hessenberg matrix H m of the subspace K m corresponding to the second matrix A' and the current residual.

[0076] A first obtaining sub-unit is configured to obtain an intermediate value y m of the linear system in the subspace K m by processing values of the Hessenberg matrix H m and a first residual vector β m using the first quantum circuit, wherein the β m = [||b0||2, 0, 0, …, 0] T , H m , y m and β m satisfy a linear relationship: H m y m = β m .

[0077] A first acquiring sub-unit is configured to acquire a first approximate solution x m of the linear system in the subspace K m according to the intermediate value y m , wherein the x m = x0+V m y m .

[0078] Optionally, the first calculating unit further comprises:

[0079] A first judging sub-unit is configured to judge whether the intermediate value y m can satisfy ||H m y m - β m .||2<∈1, where ∈1 is the preset first precision;

[0080] The first output subunit is used if the intermediate value y m Not satisfied ||H m y m -β m If ||2<∈1, then obtain the updated first residual vector and return to execute the process of using the first quantum circuit and inputting the Hessenberg matrix H. m and the first residual vector β m The value of the linear system in subspace K is output. m The median value y within m The steps, wherein the updated first residual vector β new =β m -H m y m .

[0081] Optionally, the first computing unit further includes:

[0082] The second judgment subunit is used to determine if the intermediate value y m Satisfy ||H m y m -β m If ||2<∈1, then determine the first approximate solution x. m Can ||A′x be satisfied? m -b′||2<∈2, where ∈2 is the preset second precision;

[0083] The first determining subunit is used if the first approximate solution x m Satisfy ||A′x m -b′||2<∈2, then the first approximate solution x is determined. m That is, the linear system Ax = b in subspace K m The target solution within.

[0084] Optionally, the first computing unit further includes:

[0085] The first update subunit is used to update if the first approximate solution x m Not satisfied ||A′x m If -b′||2<∈2, then update the preset initial solution x0 to the current first approximate solution x. m And obtain the updated current residual b′-A′x m Then return to the step of determining whether the norm of the current residual is greater than the first threshold and continue iterative calculation until the target solution that satisfies the preset second precision is obtained.

[0086] Optionally, the first computing unit includes:

[0087] The optimization sub-unit is used to optimize the current residual using preset rules;

[0088] The second construction subunit is used to construct the subspace K′ corresponding to the second matrix A′ and the optimized current residual. m Orthogonal basis set V′ m and Hessenberg matrix H m+1,m ;

[0089] Decomposition sub-units are used to decompose the Hessenberg matrix H. m+1,m Perform QR decomposition;

[0090] The second subunit is used to process the QR decomposition results using the second quantum circuit to obtain the linear system in subspace K′. m The middle value within

[0091] The second acquisition subunit is used to obtain the intermediate value. Obtain the linear system in the subspace K′ m The second approximate solution x′ m , wherein

[0092] Optionally, the decomposition subunit includes:

[0093] The first decomposition subunit is used to decompose the Hessenberg matrix H. m+1,m Decomposed into Among them, Q m+1 R is an orthogonal matrix. m+1,m It is an upper triangular matrix.

[0094] Optionally, the second obtained subunit includes:

[0095] Input / output subunit, used to input R using the second quantum circuit. m The value of the second residual vector α is used to output the linear system in subspace K′. m The middle value within Wherein, the R m R is an upper triangular matrix m+1,m For the first m rows, α = ||b0||2q1(1:m), where q1(1:m) represents the orthogonal matrix Q. m+1 The vector consisting of the first m elements of the first column, α and R m , Satisfying Relationship:

[0096] Optionally, after the input and output subunit, the device further comprises:

[0097] a third judging subunit configured to judge the intermediate value whether it meets wherein ∈3 is a preset third precision;

[0098] a second updating subunit configured to, if the intermediate value does not meet obtain an updated second residual vector α new and return to execute the step of inputting R m and the value of the second residual vector α into the second quantum circuit to output an intermediate value of the linear system in the subspace K′ m .

[0099] Optionally, the device further comprises:

[0100] a fourth judging subunit configured to, if the intermediate value meets judge whether the second approximate solution x′ m meets ||A′x′ m -b′||2< ∈4, wherein ∈4 is a preset fourth precision;

[0101] a second determining subunit configured to, if the second approximate solution x′ m meets ||A′x′ m -b′||2< ∈4, determine that the second approximate solution x′ m is the target solution of the linear system Ax = b in the subspace K′ m .

[0102] Optionally, the device further comprises:

[0103] a third updating subunit configured to, if the second approximate solution x′ m does not meet ||A′x′ m -b′||2< ∈4, update a preset initial solution x0 to be a current second approximate solution x′ m , obtain an updated current residual b′-A′x′ m , and return to execute the step of judging whether the norm of the current residual is greater than the first threshold value and continue iterative calculation until a target solution meeting the preset fourth precision is obtained.

[0104] Still another embodiment of the present application provides a storage medium having a computer program stored therein, wherein the computer program is configured to execute the method described in any of the above embodiments when running.​

[0105] Another embodiment of this application provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the method described in any of the preceding claims.

[0106] Compared with existing technologies, this invention first identifies the linear system to be solved and preprocesses it. Then, it constructs a hybrid subspace for solving the linear system and a quantum circuit for solving the linear system. Using the hybrid subspace and the quantum circuit, it calculates the target solution of the preprocessed linear system. By utilizing the comprehensive solution performance of the hybrid subspace, it overcomes the shortcomings of existing technologies. It can reduce the time complexity and computational load of solving linear problems and accelerate the solution speed of quantum linear algorithms. Attached Figure Description

[0107] Figure 1 A hardware structure block diagram of a computer terminal for a linear system solution method based on hybrid subspace provided in an embodiment of the present invention;

[0108] Figure 2 A flowchart illustrating a method for solving linear systems based on hybrid subspaces, provided in an embodiment of the present invention;

[0109] Figure 3 A schematic diagram of the first sub-quantum circuit module corresponding to phase estimation provided in an embodiment of the present invention;

[0110] Figure 4 This is a schematic diagram of the quantum circuit corresponding to the HHL algorithm provided in this embodiment of the invention;

[0111] Figure 5 This is a schematic diagram of a linear system solving device based on a hybrid subspace provided in an embodiment of the present invention. Detailed Implementation

[0112] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0113] The present invention first provides a method for solving linear systems based on hybrid subspaces. This method can be applied to electronic devices, such as computer terminals, specifically ordinary computers, quantum computers, etc.

[0114] The following detailed explanation uses a computer terminal as an example. Figure 1 This is a hardware structure block diagram of a computer terminal for a linear system solution method based on hybrid subspaces, provided in an embodiment of the present invention. (See diagram below.) Figure 1 As shown, a computer terminal may include one or more ( Figure 1The computer terminal shown in FIG. 1 includes only one processor 102 (the processor 102 can include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the computer terminal can further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art can understand that Figure 1 The structure shown in FIG. 1 is only illustrative and does not limit the structure of the computer terminal. For example, the computer terminal can include more or fewer components than those shown in FIG. 1, or have a different configuration than that shown in FIG. 1. Figure 1 Figure 1

[0115] The memory 104 can be used to store software programs and modules of application software, such as program instructions / modules corresponding to the hybrid subspace-based linear system solving method in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, i.e., implements the method described above. The memory 104 can include a high-speed random access memory and can further include a non-volatile memory such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 104 can further include a memory remotely disposed relative to the processor 102, which can be connected to the computer terminal through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0116] The transmission device 106 is used to receive or send data via a network. Specific examples of the network can include a wireless network provided by a communication provider of the computer terminal. In one example, the transmission device 106 includes a network adapter (NIC) which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module which is used to communicate with the Internet in a wireless manner.

[0117] It should be noted that a real quantum computer is a hybrid structure, which includes two parts: one part is a classical computer responsible for performing classical computation and control; the other part is a quantum device responsible for running a quantum program to implement quantum computation. The quantum program is a sequence of instructions written in a quantum language such as the QRunes language that can run on a quantum computer, which supports quantum logic gate operations and ultimately implements quantum computation. Specifically, the quantum program is a sequence of instructions for operating quantum logic gates in a certain time sequence.

[0118] ​​In practical applications, due to the limitation of the development of quantum device hardware, quantum computation simulation is usually needed to verify quantum algorithms, quantum applications, and the like. Quantum computation simulation is a process of simulating the running of a quantum program corresponding to a specific problem by means of a virtual architecture (i.e., a quantum virtual machine) of an ordinary computer. Generally, a quantum program corresponding to a specific problem needs to be constructed. The quantum program referred to in the embodiments of the present application is a program written in a classical language representing quantum bits and their evolution, wherein quantum bits, quantum logic gates, and the like related to quantum computation are represented by corresponding classical codes.

[0119] As an embodiment of a quantum program, a quantum circuit, also referred to as a quantum logic circuit, is the most commonly used general quantum computation model, representing a circuit for operating on quantum bits in an abstract concept, the composition of which includes quantum bits, a circuit (a time line), and various quantum logic gates, and finally the result needs to be read out by a quantum measurement operation.

[0120] Unlike a traditional circuit connected by metal wires to transmit voltage signals or current signals, in a quantum circuit, the circuit can be regarded as being connected by time, that is, the state of a quantum bit naturally evolves with time, and in this process, the quantum bit is operated according to the instruction of a Hamiltonian operator until it encounters a logic gate.

[0121] A quantum program as a whole corresponds to a total quantum circuit, and the quantum program described in the present application refers to the total quantum circuit, wherein the total number of quantum bits in the total quantum circuit is the same as the total number of quantum bits of the quantum program. It can be understood that: a quantum program can be composed of a quantum circuit, a measurement operation for quantum bits in the quantum circuit, a register for storing measurement results, and a control flow node (jump instruction), and a quantum circuit can include tens, hundreds, or even thousands or ten thousands of quantum logic gate operations. The execution process of a quantum program is a process of executing all quantum logic gates according to a certain timing sequence. It needs to be noted that the timing sequence is the time sequence in which a single quantum logic gate is executed.

[0122] It should be noted that in classical computing, the most basic unit is a bit, and the most basic control mode is a logic gate, which can be combined to achieve the purpose of controlling the circuit. Similarly, the way to handle quantum bits is quantum logic gates. Using quantum logic gates, quantum states can evolve, and quantum logic gates are the basis of quantum circuits, including single-bit quantum logic gates such as Hadamard gate (H gate), Pauli-X gate (X gate), Pauli-Y gate (Y gate), Pauli-Z gate (Z gate), RX gate, RY gate, RZ gate, and the like; multi-bit quantum logic gates such as CNOT gate, CR gate, iSWAP gate, Toffoli gate, and the like. Quantum logic gates are generally represented by unitary matrices, which are not only matrix forms but also operations and transformations. The effect of a general quantum logic gate on a quantum state is calculated by multiplying the quantum state right vector by the corresponding matrix on the left.

[0123] The quantum state, i.e., the logical state of the quantum bit, is represented in binary in quantum algorithms (or quantum programs), for example, a group of quantum bits q0, q1, q2 represents the 0th, 1st, and 2nd quantum bits, and the order from high to low is q2q1q0. The quantum state corresponding to the group of quantum bits is the superposition of the eigenstates corresponding to the group of quantum bits. The eigenstates corresponding to the group of quantum bits have 2 raised to the power of the total number of quantum bits, i.e., 8 eigenstates (determined states): |000>, |001>, |010>, |011>, |100>, |101>, |110>, |111>, each eigenstate corresponds to a bit corresponding to a quantum bit, such as |000> state, 000 corresponds to q2q1q0 from high to low, and |> is the Dirac symbol.

[0124] Taking a single quantum bit as an example, the logical state of a single quantum bit may be in the |0> state, the |1> state, the superposition state (indeterminate state) of the |0> state and the |1> state, which can be represented as where c and d are complex numbers representing the amplitude (probability amplitude) of the quantum state, and the square of the amplitude modulus |c| 2 and |d| 2 represent the probabilities of the |0> state and the |1> state, respectively, |c| 2 + |d| 2 = 1. In short, the quantum state is a superposition of eigenstates, and when the probability of other eigenstates is 0, it is in a uniquely determined eigenstate.

[0125] Referring to Figure 2 , Figure 2 A flowchart of a linear system solving method based on a hybrid subspace provided by an embodiment of the present application can include the following steps:

[0126] S201: determine a linear system to be solved and pre-process the linear system to be solved.

[0127] Specifically, determining a linear system to be solved and pre-processing the linear system to be solved can include:

[0128] Step 1: obtaining a linear system Ax = b to be solved, wherein A is a first matrix, and b is a first vector.

[0129] In the field of applied mathematics and scientific engineering calculation, the mathematical model of many problems can be described by a linear system group. For example, the simulation calculation problem of target electromagnetic characteristics is discretized by numerical algorithms such as moment method and finite element, which is converted into the solution of matrix equation, and for example, the solution of NS equation in fluid mechanics, lattice gauge theory in quantum chromodynamics (QCD) and the like.

[0130] A linear system is a mathematical model, which is a system composed of linear operators and simultaneously satisfies superposition and uniformity (also known as homogeneity). At present, the linear system is the core of many scientific and engineering fields. For a linear system Ax = b to be solved, the element information and dimension of the first matrix A and the first vector b are obtained, respectively, wherein the first matrix A can be a coefficient matrix, which is one of many types of matrices. In simple terms, the coefficient matrix is to form a matrix of the coefficient group of the equation to calculate the solution of the equation, and the coefficient matrix is often used to represent the mathematical relationship of some projects.

[0131] Step 2: determining a sparse approximate matrix M for linear system pre-processing according to the first matrix A, wherein the sparse approximate matrix M is a sparse approximation of A -1 and satisfies a preset sparse structure.

[0132] Specifically, let N = {1, 2, 3,..., n}, represent a preset sparse structure, and the sparse approximate inverse pre-processing technique aims to explicitly construct a sparse approximation of A -1 to reduce the condition number of the matrix, reduce the difficulty and complexity of solving, and the most basic premise is to give the first matrix A, there is a sparse approximate matrix M of A -1 in a certain sense, so that M ≈ A -1 , how to quickly capture the position information of the elements of A -1 to determine the sparse structure of M is the key to the success of the algorithm.

[0133] It should be noted that the sparse approximate inverse pre-processing technique of F-norm minimization calculates A F by minimizing the residual matrix ||AM-I|| -1The sparse approximation M is obtained, where M satisfies a certain sparse structure (M is either given in advance or dynamically determined during algorithm execution). Due to the characteristics of the matrix F-norm, ||AM-I|| is minimized. F It can be transformed into solving n independent least squares problems, thus possessing inherent parallelism. However, for a general first matrix A, it is often difficult to predetermine a reasonable and efficient sparse structure for M, when A... -1 When there are few large elements, the prior structure may not be able to effectively capture their positional information, or it may only be possible to obtain information about A at the cost of computation and storage when the prior structure is very dense. -1 A relatively high degree of approximation for M. To overcome the above difficulties, a strategy for dynamically determining the sparse structure of M can be proposed. This strategy often starts with a simple initial structure (such as the structure of the identity matrix or the structure of the first sparse matrix A), and then gradually expands or adaptively adjusts it according to a certain rule until the residual matrix satisfies a given precision ||AM-I|| with respect to a certain norm. F ≤ε, where ε represents a preset precision value, or the number of non-zero elements in M ​​reaches a preset maximum value.

[0134] Step 3: Based on the sparse approximation matrix M, obtain the second matrix A′, the second vector b′, and the initial residual b0 after the linear system preprocessing, where the second matrix A′ = MA, the second vector b′ = Mb, and the initial residual is calculated based on the initial approximation solution x0, satisfying b0 = b′ - A′x0.

[0135] Specifically, in mathematical statistics, residuals refer to the difference between actual values ​​and estimated values ​​(fitted values). Residuals contain important information about the basic assumptions of the system model.

[0136] Specifically, based on the sparse approximation matrix M, the second matrix A′ and the second vector b′ with reduced condition number in the linear system and the initial residual b0 are obtained respectively, wherein the second matrix A′ = MA, the second vector b′ = Mb, and the initial residual b0 is calculated based on the initial approximation solution x0, satisfying b0 = b′ - A′x0.

[0137] S202: Construct the hybrid subspace for solving the linear system and the quantum circuit for solving the linear system, respectively.

[0138] Specifically, constructing a hybrid subspace for solving linear systems and a quantum circuit for solving linear systems can include:

[0139] Based on the fully orthogonal subspace method, construct an m-order Krylov subspace K. m and the first quantum circuit corresponding to the HHL algorithm for solving the linear system; and

[0140] Based on the generalized minimal residual method, an m-order Krylov subspace K' is constructed m and a second quantum circuit corresponding to the HHL algorithm for solving the linear system.

[0141] Specifically, the full orthogonalization subspace (FOM) and the generalized minimal residual (GMRES) algorithm are two very important Krylov subspace methods. The quantum circuit for solving the linear system can include:

[0142] 1. Obtain a plurality of quantum bits including an auxiliary quantum bit, a first quantum bit, and a second quantum bit, wherein the initial state of the auxiliary quantum bit and the first quantum bit is |0>, and the initial state of the second quantum bit is The b i is the i-th element of the first vector b, and the N is the dimension of the first vector.

[0143] Specifically, the number of quantum bits can be determined by the user according to the demand, or a sufficient number of quantum bits can be set under the condition of sufficient computing resources to meet the computing demand.

[0144] Obtaining a plurality of quantum bits including an auxiliary quantum bit, a first quantum bit, and a second quantum bit can be represented by quantum bit positions. For example, the initial quantum bit position is |0>, indicating that the quantum state of the bit quantum bit is |0> state, and |1> indicates that the initial quantum state is |1> state.

[0145] It should be noted that for the convenience of subsequent distinction, the obtained plurality of quantum bits can be distinguished as auxiliary quantum bits, first quantum bits, and second quantum bits, and the specific distinguishing name is not limited here, and the initial state of each quantum bit can be prepared by the existing amplitude encoding method or quantum state encoding method. Wherein, the initial state of the auxiliary quantum bit and the first quantum bit is |0> state, and the initial state of the second quantum bit is For example, for a 4-dimensional first vector b = [b1, b2, b3, b4], i.e. N = 4, the data of the first vector b is encoded on the quantum state amplitude to obtain:

[0146]

[0147] The data of the first vector b is loaded onto the quantum state amplitude of the two second quantum bits in the quantum circuit.

[0148] 2. Determine the unitary matrix U corresponding to the first matrix A.

[0149] Specifically, if the first matrix A is a unitary matrix, the first matrix A is directly determined as the corresponding unitary matrix U;

[0150] If the first matrix A is a Hermite matrix, the transformation from a Hermite matrix to a unitary matrix can be achieved through Hamiltonian simulation, yielding the corresponding unitary matrix U = e^(-λ / λ). iAt Where t is a constant, typically taking the value 2π;

[0151] If the first matrix A is a non-Hermite matrix, it can be transformed by increasing its dimension to determine the corresponding Hermitian matrix. To determine the corresponding unitary matrix Simultaneously, the first vector b is transformed into... It can also be written as have to x m This is the objective solution described above.

[0152] 3. Construct a first sub-quantum circuit module for phase estimation, used to decompose |b〉 in the characteristic space of the first matrix A into And transform the initial states |0〉|b〉 of the first and second qubits into Wherein, the |μ j > is the eigenvector of the first matrix A, and λ j β is the eigenvalue of the first matrix A. j Let be the amplitude of the eigenvector of the first matrix A.

[0153] Specifically, a first sub-quantum circuit module for phase estimation is constructed to decompose the |b> in the characteristic space of the first matrix A into The initial states |0>|b> of the first and second qubits are transformed into As will be understood by those skilled in the art, phase estimation is an important application of the quantum Fourier transform (QFT), as it forms the basis of many quantum algorithms.

[0154] like Figure 3 The diagram shown is a schematic of the first sub-quantum circuit module corresponding to the phase estimation provided in this embodiment, including: an H-gate operation module, a controlled U-operator operation module, and a quantum Fourier inverse transform module (in the figure). (module), where the U operator is the unitary matrix U corresponding to the first matrix A. After passing through the first sub-quantum circuit module, the auxiliary qubit (corresponding to) Figure 3 The quantum state of the topmost timeline remains unchanged, and the first qubit (corresponding to) Figure 3 The initial state |0〉 of the intermediate timeline is transformed into |λ j >, the second quantum bit (corresponding to) Figure 3 Initial state of the lowest timeline | b> decomposition

[0155] In fact, the output λ j is an estimated value, and the output precision of phase estimation can be improved by increasing the number of first qubits. In practical applications, the auxiliary quantum register, the first quantum register, and the second quantum register can be set to store the quantum states of the auxiliary qubits, the first qubits, and the second qubits, respectively.

[0156] 4. A second sub-quantum circuit module is constructed to perform a controlled rotation operation, which is used to rotate the auxiliary qubits with |λ j as control bits to obtain wherein the C is a normalization constant.

[0157] Specifically, a second sub-quantum circuit module is constructed to perform a controlled rotation operation, which is used to rotate the auxiliary qubits with |λ j as control bits to obtain The controlled rotation can also be referred to as "extracting the proportion", because after the phase estimation operation, the first quantum register stores a series of eigenvalues λ j (especially in the ground state |λ j ), and the input state stored in the second quantum register, i.e., the initial state |b>, is decomposed on the eigenvalue space of the first matrix A, and then through the controlled rotation operation, the λ j value in the ground state is extracted to the amplitude, and the quantum state of the auxiliary qubit |0> is converted to The quantum states of each qubit are converted by the second sub-quantum circuit from to In order to reduce resource occupation, the auxiliary qubit can be set to 1 bit, and C is a constant, generally 1.

[0158] It should be noted that the quantum state |x> = A -1 |b> (more accurately, an approximate |x> quantum state) can be obtained in the second quantum register, accompanied by a constant factor C. The amplitude amplification method can be used later to improve the success probability, instead of the process of simple measurement and result screening.

[0159] 5. A third sub-quantum circuit module is constructed to perform inverse phase estimation, which is used to reset |λ j to |0>.

[0160] Specifically, those skilled in the art can understand that the inverse operation of phase estimation is the inverse process of the above phase estimation, or the transpose conjugate operation of phase estimation, which is used to reset |λ j to |0>, and specifically to convert the quantum state to the following:

[0161]

[0162] 6. constructing a measurement operation module for the ancillary qubit, so that when the quantum state of the ancillary qubit is measured as |1>, the following is obtained: The |x'> is proportional to |x>.

[0163] Specifically, a quantum measurement operation is applied to the ancillary qubit to measure the ancillary qubit after the phase estimation inverse operation. After measurement, the state of the ancillary qubit collapses to a certain state, wherein the probability of collapsing to |0> is The probability of collapsing to |1> is When the quantum state of the ancillary qubit is measured as |1> and C = 1, a certain quantum state is obtained: It can be seen that The corresponding result of amplitude normalization is performed. In actual application, |x> can be obtained according to the application scenario required by the user, or |x'> can be directly used for subsequent scene calculation.

[0164] 7. The first sub-quantum circuit module, the second sub-quantum circuit module, the third sub-quantum circuit module and the quantum measurement operation module are sequentially composed into a quantum circuit for solving the linear system.

[0165] Specifically, referring to Figure 4 , Figure 4 According to the execution sequence of the first sub-quantum circuit module, the second sub-quantum circuit module, the third sub-quantum circuit module and the quantum measurement operation module, a complete quantum circuit is sequentially composed, that is, the quantum circuit corresponding to the HHL algorithm for solving the linear system of the present application.

[0166] It should be noted that the first quantum circuit and the second quantum circuit can be constructed by the above-mentioned method of constructing a quantum circuit.

[0167] S203: calculating the target solution of the preprocessed linear system to be solved by using the mixed subspace and the quantum circuit.

[0168] Specifically, calculating the target solution of the preprocessed linear system to be solved by using the mixed subspace and the quantum circuit can include:

[0169] determining whether the norm of the current residual is greater than a first threshold value, wherein the current residual is determined according to the current approximate solution.

[0170] Specifically, determining whether the value of ||b0-b k ||2 is greater than a first threshold value P1, wherein the current residual is determined according to the current approximate solution x kIt is determined that the first threshold P1 can be preset by the user according to the accuracy requirements. For example, P1 can be preset to 10. -3 .

[0171] If so, then according to the subspace K m The first quantum circuit, and using the fully orthogonalized subspace method, calculates the linear system in the subspace K. m The first approximate solution x m Otherwise, according to the subspace K′ m The second quantum circuit is used to calculate the linear system in the subspace K′ using the generalized minimum residual method. m The second approximate solution x′ m .

[0172] Where, if ||b0-b k ||2>P1, then according to subspace K m The first quantum circuit is used to calculate the linear system in subspace K using the fully orthogonalized subspace method. m The first approximate solution x m It can include:

[0173] First, construct the subspace K corresponding to the second matrix A′ and the current residual. m Orthogonal basis set V m and Hessenberg matrix H m .

[0174] Specifically, the subspace K is constructed based on the Arnoldi algorithm, the second matrix A′, and the current residual. m Orthogonal basis set V m and Hessenberg matrix H m .

[0175] The FOM method is a classic subspace-based solution method for linear problems. For the linear system Ax = b to be solved, we define: K m =span{b0, Ab0, A 2 b0, ..., A m-1 Let b0} be the m-order Krylov subspace of the first matrix A and the initial residual b0. By definition, Krylov subspaces are nested, i.e., K1∈K2∈…∈K m Clearly, the orthogonal basis set of the subspace {V1, V2, ..., V} is... m} is also nested. The core idea of ​​FOM is to transform the exact solution of the linear system to be solved into finding the "optimal solution" in a certain subspace, when the solution x m Constrained in subspace K m Within the time frame, it is obvious that x m It can be made by Km base V m Linear representation. Based on the nested property mentioned above, we have Ax m ∈K m+1 When x m In K m When Ax changes, m In a higher-order subspace K m+1 The internal changes accordingly. Because of b m =b0-Ax m Therefore b m The magnitude and direction also change. In order for the "optimal solution" to approximate the exact solution, b is required to... m The modulus of x should be as small as possible, therefore the mathematical form of the perfectly orthogonal method can be described as: finding x m ∈K m , making b m ⊥Ax m .

[0176] The m-th order Krylov subspace K is solved using the Arnoldi algorithm based on Gram-Schmidt orthogonalization. m Orthogonal basis set V m For subspace K m Approximate solution x within m , can be made by K m orthogonal basis set V m Linear representation, we have:

[0177] x m =x0+V m y m

[0178] Orthogonality condition b-Ax m ⊥K m ,have to:

[0179]

[0180] Therefore, determining x in the completely orthogonal method m The equation that can be solved directly is:

[0181]

[0182] Among them, the orthogonal basis set V m It has the following properties:

[0183]

[0184]

[0185] Among them, h m+1,m =(w m vm+1 ), w m =Aν m e m = [0, 0, 0, ..., 1] T H m The matrix formed during the execution of the Arnoldi algorithm records the projection information from the original space to the subspace, and its matrix form is as follows:

[0186]

[0187] Based on the properties of orthogonal basis sets mentioned above, the final linear system to be solved in FOM is:

[0188] β m -H m y m =0

[0189] Wherein, the β m =[||b0||2,0,0,…,0] T When the solution is found Then, the linear system Ax = b to be processed in subspace K m An approximate solution can then be obtained. It is evident that the most significant characteristic of using FOM to solve linear problems is its "dimensionality reduction" effect. If the dimension of the first matrix is ​​n, and the dimension of the subspace of the solution satisfying the accuracy requirement is m, generally m is significantly smaller than n.

[0190] Secondly, the Hessenberg matrix H is processed using the first quantum circuit. m and the first residual vector β m The value of the linear system in subspace K is obtained. m The median value y within m , where β m =[||b0||2,0,0,…,0] T H m y m and β m Satisfying a linear relationship: H m y m =β m .

[0191] Specifically, using the first quantum circuit, the Hessenberg matrix H is input. m and the first residual vector β m The value of the linear system in subspace K is output. m The median value y within m .

[0192] Specifically, the first quantum circuit corresponding to the HHL algorithm constructed above is used as the input to the Hessenberg matrix H. m and the first residual vector β m The value of this can be obtained through operations such as measurement to output the linear system to be solved in the Krylov subspace K. m The median value y within m .

[0193] Finally, based on the intermediate value y m Obtain the linear system in subspace K m The first approximate solution x m , where x m =x0+V m y m .

[0194] It should be noted that, using the first quantum circuit, the Hessenberg matrix H is input... m and the first residual vector β m The value of the linear system in subspace K is output. m The median value y within m Subsequently, the method further includes:

[0195] Determine the intermediate value y m Can it satisfy ||H m y m -β m ||2<∈1, where ∈1 is the preset first precision.

[0196] Specifically, determine ||H m y m -β m Whether the value of ||2 meets the first preset precision is mainly to determine the intermediate value y calculated using the HHL algorithm described above. m Whether it meets the user's preset precision requirement of ∈1 is for further processing.

[0197] If the intermediate value y m Not satisfied ||H m y m -β m If ||2<∈1, then obtain the updated first residual vector and return to execute the process of using the first quantum circuit and inputting the Hessenberg matrix H. m and the first residual vector β m The value of the linear system in subspace K is output. m The median value y within m The steps, wherein the updated first residual vector β new =β m -Hm y m .

[0198] If the intermediate value y m Satisfy ||H m y m -β m If ||2<∈1, then determine the first approximate solution x. m Can ||A′x be satisfied? m -b′||2<∈2, where ∈2 is the preset second precision.

[0199] Specifically, determine ||A′x m Whether the value of -b′||2 can meet the second preset accuracy is mainly to check whether the accuracy of the approximate solution obtained after dimensionality reduction calculation using FOM is small enough to meet the user's preset accuracy requirements.

[0200] If the first approximate solution x m Satisfy ||A′x m -b′||2<∈2, then the first approximate solution x is determined. m That is, the linear system Ax = b in subspace K m The target solution within.

[0201] If the first approximate solution x m Not satisfied ||A′x m If -b′||2<∈2, then update the preset initial solution x0 to the current first approximate solution x. m And obtain the updated current residual b′-A′x m Then return to the step of determining whether the norm of the current residual is greater than the first threshold and continue iterative calculation until the target solution that satisfies the preset second precision is obtained.

[0202] Specifically, when the first approximate solution x m If the preset second precision is not met, then update the preset initial solution x0 to the current first approximate solution x. m That is, x0 = x m Get the updated current residual b′-A′x m As the input vector for the next iteration, return to the step of determining whether the norm of the current residual is greater than the first threshold and continue iterative calculation until the target solution that satisfies the preset second precision is obtained.

[0203] Therefore, the main steps for calculating the linear system to be solved using the first quantum circuit based on the fully orthogonal subspace method and the HHL algorithm can be summarized as follows:

[0204] For the linear system Ax = b to be solved, a sparse approximate inverse M is constructed, resulting in MAx = Mb. This leads to the dimensionality-reduced linear system A′x = b′, where A′ is the second matrix. An initial approximate solution x0 is given, and the initial residual b0 = b′ - A′x0 is defined. Then, using the initial residual and the second matrix, a Krylov subspace K is constructed. m Furthermore, the orthogonal basis set V is obtained. m and Hessenberg matrix H m The first residual vector β m The intermediate value y of the subspace is obtained by the following formula. m :

[0205] H m y m =β m (1)

[0206] Further, the approximate solution x of the original linear system to be solved is obtained using the following formula. m :

[0207] x m =x0+V m y m (2)

[0208] The above steps constitute the method and principle for finding an approximate solution to a linear system in a single step.

[0209] For the first quantum circuit, the input Hessenberg matrix H m The first residual vector β m The value of the linear system in subspace K is output. m The median value y within m Then, if we judge the intermediate value y m Satisfy ||H m y m -β m ||2>∈1, where ∈1 is the preset first precision. This indicates that there is an unacceptable error in solving equation (1). To facilitate distinction, a superscript is introduced, and the solution that does not meet the preset precision can be described as... have:

[0210]

[0211] Furthermore, we can obtain:

[0212]

[0213] Wherein, the first residual vector β new This is the error of the current solution, which is constructed by the following equation.

[0214]

[0215] Combining equations (3) and (4) above, we have:

[0216] Therefore, by repeatedly performing the above iterative steps, then:

[0217]

[0218] The above approximate solution It will continuously approach the target solution. Obviously, each iteration solves the above equation (4), but the approximate solution obtained is the sum of the approximate solutions obtained in each iteration.

[0219] The above describes the subspace K. m The median value y m The iterative approximation process, subspace K m The median value y m The original solution is mapped to using equation (2) above. Since equation (2) is linear, and x0 and V change in each iteration... m Since nothing changes, the final objective solution is:

[0220]

[0221] It should be noted that the main iterative steps summarized above are primarily aimed at addressing the poor accuracy of the FOM method in low-dimensional subspaces. By using the idea of ​​iteration to obtain an approximate solution for the objective, this approach can also be extended to the steps of solving linear systems using the GMRES method described below. This will not be summarized further below.

[0222] In another embodiment, if ||b0-b k If ||2 is not greater than P1, then according to the subspace K′ m The second quantum circuit is used to calculate the linear system in the subspace K′ using the generalized minimum residual method. m The second approximate solution x′ m It can include:

[0223] Optimize the current residual using preset rules.

[0224] Specifically, since the generalized minimum residual method is used to calculate the linear system in the subspace K′ m The second approximate solution x′ m Its convergence speed is relatively slow. Based on this, dynamic relaxation preset rules can be used to optimize the residuals in a specific way to accelerate their convergence.

[0225] Preferably, for the linear system calculated using the generalized minimum residual method in the subspace K′, m The second approximate solution x′m It can be solved The value and judgment The value of x′ is located in the interval, and then the second approximate solution x′ is optimized according to the preset optimization rules. m Optimize accordingly. For example, this can be achieved by judging... If the value is between g and h, then perform the first optimization according to the preset rules; otherwise... If the value is not greater than g, then perform the second optimization according to the preset rules; if If the value is not less than h, then the third optimization of the preset rules will be performed.

[0226] For example, if Then, according to the corresponding preset optimization rules, the optimized second approximate solution like Then, according to the corresponding preset optimization rules, the optimized second approximate solution like Then, according to the corresponding preset optimization rules, the optimized second approximate solution like Then, according to the corresponding preset optimization rules, the optimized second approximate solution

[0227] It should be noted that optimizing the residuals using preset rules is unique to the GMRES method. Its function is to make specific modifications to the residuals to accelerate the approximate solution to approach the target solution, thereby improving the solution speed of the GMRES method. However, its acceleration effect is not strictly guided by theory, and researchers need to invest a lot of effort to obtain empirical optimization methods.

[0228] First, construct the subspace K′ corresponding to the second matrix A′ and the optimized current residual. m Orthogonal basis set V′ m and Hessenberg matrix H m+1,m .

[0229] Specifically, the subspace K′ can be constructed based on the Arnoldi algorithm, the second matrix A′, and the optimized current residual. m Orthogonal basis set V′ m and Hessenberg matrix H m+1,m .

[0230] The GMRES method is also a classic subspace-based solution method for linear problems. The core idea of ​​GMRES is to transform the exact solution of the linear system into finding the "optimal solution" within a certain subspace. m Constrained in subspace K′ m When x′ is inside, it is obvious m It can be derived from K′m The base V′ m Linear representation. Based on the nested property mentioned above, we have Ax′ m ∈K′ m+1 When x′ m At K′ m When Ax′ changes, m In a higher-order subspace K′ m+1 The internal changes accordingly. Because of b m =b0-Ax′ m Therefore b m The magnitude and direction also change. In order for the "optimal solution" to approximate the exact solution, b is required to... m The modulus should be as small as possible; therefore, the mathematical form of the generalized minimum residual method can be described as: finding x′ m ∈K′ m , making b m ⊥AK′ m It can be seen that in the GMRES method, the solution space is K′ m The constraint space of the solution is AK′ m .

[0231] The m-th order Krylov subspace K′ is solved using the Arnoldi algorithm based on Gram-Schmidt orthogonalization. m Orthogonal basis set V′ m For subspace K′ m The second approximate solution x′ m It can be determined by K′ m orthogonal basis set V′ m Linear representation, we have:

[0232]

[0233] Orthogonality condition b0-Ax′ m ⊥AK′ m ,have to:

[0234]

[0235] Among them, the orthogonal basis set V′ m It has the following properties:

[0236]

[0237]

[0238] Among them, h m+1,m =(w m ,ν m+1 ), w m =Av m em = [0, 0, 0, ..., 1] T H m+1,m The matrix formed by the elements during the execution of the Arnoldi algorithm records the projection information from the original space to the subspace. Combining this with the properties of orthogonal basis sets mentioned above, GMRES (Generalized Minimum Residual) directly extracts information from b. m Starting with the condition of minimizing the modulus, the optimal criterion can be described as finding x′. m ∈K′ m Solve for min||b0-Ax′ m ||2.

[0239] Secondly, regarding the Hessenberg matrix H m+1,m Perform QR decomposition.

[0240] The QR decomposition method is currently the most efficient and widely used method for finding all eigenvalues ​​of a general matrix. The general matrix is ​​first transformed into a Hessenberg matrix through orthogonal similarity transformation, and then the QR method is applied to find the eigenvalues ​​and eigenvectors. It decomposes the matrix into an orthogonal matrix Q and an upper triangular matrix R, hence the name QR decomposition, which is related to the common notation Q for this orthogonal matrix.

[0241] The Hessenberg matrix H can be... m+1,m Decomposed into Among them, Q m+1 R is an orthogonal matrix. m+1,m It is an upper triangular matrix.

[0242] Based on the above description, it is indeed Due to V′ m+1 The column vectors are orthogonal, therefore:

[0243]

[0244] Therefore, in the GMRES method, the problem is transformed into a least squares problem. When m is not very large, QR decomposition is used to solve the above least squares problem. From: H m+1,m The QR decomposition, where Q m+1 R is an orthogonal matrix. m+1,m Since it is an upper triangular matrix, we have:

[0245]

[0246] Among them, R m For R m+1,m The first m rows, therefore It can be obtained by solving the following system of upper triangular equations:

[0247]

[0248] Where α = ||b0||2q1(1:m), q1(1:m) represents the orthogonal matrix Q m+1 The vector consisting of the first m elements of the first column, q1 is Q m+1 The first column.

[0249] The final linear system to be solved in GMRES is:

[0250]

[0251] The linear system Ax = b to be solved in subspace K′ m An approximate solution can then be obtained. It is evident that the most significant characteristic of using GMRES to solve linear problems is its "dimensionality reduction" effect. If the dimension of the first matrix is ​​n, and the dimension of the subspace of the solution satisfying the accuracy requirement is m, generally m is significantly smaller than n.

[0252] Next, the QR decomposition results are processed using the second quantum circuit to obtain the linear system in subspace K′. m The middle value within

[0253] Specifically, using the second quantum circuit, input R m The value of the second residual vector α is used to output the linear system in subspace K′. m The middle value within Wherein, Rm is an upper triangular matrix R m+1,m For the first m rows, α = ||b0||2q1(1:m), where q1(1:m) represents the orthogonal matrix Q. m+1 The vector consisting of the first m elements of the first column, α and R m , Satisfying Relationship:

[0254] Finally, based on the intermediate value Obtain the linear system in the subspace K′ m The second approximate solution x′ m , wherein

[0255] It should be noted that, using the second quantum circuit, the input R m The value of the second residual vector α is used to output the linear system in subspace K′. m The middle value within Subsequently, the method further includes:

[0256] Determine the intermediate value Can it be satisfied? Wherein, ∈3 represents the preset third precision.

[0257] Specifically, judgment Whether the value can meet the preset third precision is mainly to determine whether the intermediate value calculated using the HHL algorithm described above is satisfactory. Whether it meets the user's preset accuracy requirements is for further processing.

[0258] If the intermediate value Not satisfied Then obtain the updated second residual vector α new And return to execute the operation using the second quantum circuit, input R m The value of the second residual vector α is used to output the linear system in subspace K′. m The middle value within The steps, wherein the updated second residual vector

[0259] If the intermediate value satisfy Then determine the second approximate solution x′ m Can ||A′x′ be satisfied? m -b′||2<∈4, where ∈4 is the preset fourth precision.

[0260] Specifically, determine ||A′x m Whether the value of -b′||2 can meet the preset fourth precision is mainly to check whether the precision loss of the second approximate solution obtained after dimensionality reduction calculation using GMRES is small enough to meet the user's preset precision requirements.

[0261] If the second approximate solution x′ m Satisfy ||A′x′ m -b′||2<∈4, then the second approximate solution x′ is determined. m That is, the linear system Ax = b in subspace K′ m The target solution within.

[0262] If the second approximate solution x′ m Not satisfied ||A′x′ m If -b′||2<∈4, then update the preset initial solution x0 to the current second approximate solution x′. m And obtain the updated current residual b′-A′x′ m Then return to the step of determining whether the norm of the current residual is greater than the first threshold and continue iterative calculation until the target solution that satisfies the preset fourth precision is obtained.

[0263] Specifically, when the second approximate solution x′ m If the preset fourth precision is not met, update the preset initial solution x0 to the current second approximate solution x′. m That is, x0 = x′ m And obtain the updated current residual b′-A′x′ m Then return to the step of determining whether the norm of the current residual is greater than the first threshold and continue iterative calculation until the target approximate solution that satisfies the preset fourth precision is obtained.

[0264] This embodiment combines the FOM and GMRES methods in linear system solving. Based on the complementary advantages and disadvantages of the two methods, a hybrid subspace algorithm that combines the advantages of both FOM and GMRES methods is presented. This algorithm can significantly make up for the shortcomings of individual FOM and GMRES methods, thereby improving the overall performance of the algorithm itself. Furthermore, the hybrid subspace-based algorithm not only reduces the dimension and condition number of the linear system to be solved and increases the sparsity, but also better stimulates the acceleration performance of the HHL algorithm, thus enabling the solution of large-scale linear problems based on the HHL algorithm on ordinary PCs.

[0265] As can be seen, this invention first determines the linear system to be solved and preprocesses it. Then, it constructs a hybrid subspace for solving the linear system and a quantum circuit for solving the linear system. Using the hybrid subspace and the quantum circuit, it calculates the target solution of the preprocessed linear system. By utilizing the comprehensive solution performance of the hybrid subspace, it overcomes the shortcomings of the prior art. It can reduce the time complexity and computational load of solving linear problems and accelerate the solution speed of the quantum linear algorithm.

[0266] See Figure 5 , Figure 5 This is a schematic diagram of a linear system solver based on a hybrid subspace provided in an embodiment of the present invention. Figure 2 The process shown can include:

[0267] The determination module 501 is used to determine the linear system to be solved and to preprocess the linear system to be solved;

[0268] Construction module 502 is used to construct the hybrid subspace for solving the linear system and the quantum circuit for solving the linear system, respectively;

[0269] The calculation module 503 is used to calculate the target solution of the preprocessed linear system to be solved using the hybrid subspace and the quantum circuit.

[0270] Specifically, the determining module includes:

[0271] The first acquisition unit is used to acquire the linear system Ax = b to be solved, wherein A is a first matrix and b is a first vector;

[0272] The first determining unit is configured to determine a sparse approximation matrix M for linear system preprocessing based on the first matrix A, wherein the sparse approximation matrix M is A -1 The sparse approximation satisfies the preset sparse structure;

[0273] The second acquisition unit is used to acquire the second matrix A′, the second vector b′ and the initial residual b0 of the linear system after preprocessing, respectively, based on the sparse approximation matrix M, wherein the second matrix A′ = MA, the second vector b′ = Mb, and the initial residual is calculated based on the initial approximation solution x0, satisfying b0 = b′ - A′x0.

[0274] Specifically, the building module includes:

[0275] The first building unit is used to construct an m-order Krylov subspace K based on the fully orthogonalized subspace method. m and the first quantum circuit corresponding to the HHL algorithm for solving the linear system; and

[0276] Based on the generalized minimum residual method, construct the m-order Krylov subspace K′ m And the second quantum circuit corresponding to the HHL algorithm for solving the linear system.

[0277] Specifically, the computing module includes:

[0278] The first judgment unit is used to determine whether the norm of the current residual is greater than a first threshold, wherein the current residual is determined based on the current approximate solution;

[0279] The first computational unit is used to, if so, then, according to the subspace K m The first quantum circuit, and using the fully orthogonalized subspace method, calculates the linear system in the subspace K. m The first approximate solution x m Otherwise, according to the subspace K′ m The second quantum circuit is used to calculate the linear system in the subspace K′ using the generalized minimum residual method. m The second approximate solution x′ m ;

[0280] The first update unit is used to update the first approximate solution x. m Or the second approximate solution x′ mUpdate the current approximate solution and continue to execute the step of determining whether the norm of the current residual is greater than the first threshold until a solution that meets the accuracy requirements is obtained, which is then used as the target solution for the linear system to be solved.

[0281] Specifically, the first computing unit includes:

[0282] The first construction subunit is used to construct the subspace K corresponding to the second matrix A′ and the current residual. m Orthogonal basis set V m and Hessenberg matrix H m ;

[0283] The first sub-unit is used to process the Hessenberg matrix H using the first quantum circuit. m and the first residual vector β m The value of the linear system in subspace K is obtained. m The median value y within m , where β m =[||b0||2,0,0,…,0] T H m y m and β m Satisfying a linear relationship: H m y m =β m ;

[0284] The first acquisition subunit is used to obtain the intermediate value y. m Obtain the linear system in subspace K m The first approximate solution x m , where x m =x0+V m y m .

[0285] Specifically, the first computing unit further includes:

[0286] The first judgment subunit is used to judge the intermediate value y. m Can it satisfy ||H m y m -β m ||2<∈1, where ∈1 is the preset first precision;

[0287] The first output subunit is used if the intermediate value y m Not satisfied ||H m y m -β mIf ||2<∈1, then obtain the updated first residual vector and return to execute the process of using the first quantum circuit and inputting the Hessenberg matrix H. m and the first residual vector β m The value of the linear system in subspace K is output. m The median value y within m The steps, wherein the updated first residual vector β new =β m -H m y m .

[0288] Specifically, the first computing unit further includes:

[0289] The second judgment subunit is used to determine if the intermediate value y m Satisfy ||H m y m -β m If ||2<∈1, then determine the first approximate solution x. m Can ||A′x be satisfied? m -b′||2<∈2, where ∈2 is the preset second precision;

[0290] The first determining subunit is used if the first approximate solution x m Satisfy ||A′x m -b′||2<∈2, then the first approximate solution x is determined. m That is, the linear system Ax = b in subspace K m The target solution within.

[0291] Specifically, the first computing unit further includes:

[0292] The first update subunit is used to update if the first approximate solution x m Not satisfied ||A′x m If -b′||2<∈2, then update the preset initial solution x0 to the current first approximate solution x. m And obtain the updated current residual b′-A′x m Then return to the step of determining whether the norm of the current residual is greater than the first threshold and continue iterative calculation until the target solution that satisfies the preset second precision is obtained.

[0293] Specifically, the first computing unit includes:

[0294] The optimization sub-unit is used to optimize the current residual using preset rules;

[0295] The second construction subunit is used to construct the subspace K′ corresponding to the second matrix A′ and the optimized current residual. mOrthogonal basis set V′ m and Hessenberg matrix H m+1,m ;

[0296] Decomposition sub-units are used to decompose the Hessenberg matrix H. m+1,m Perform QR decomposition;

[0297] The second subunit is used to process the QR decomposition results using the second quantum circuit to obtain the linear system in subspace K′. m The middle value within

[0298] The second acquisition subunit is used to obtain the intermediate value. Obtain the linear system in the subspace K′ m The second approximate solution x′ m , wherein

[0299] Specifically, the decomposition subunit includes:

[0300] The first decomposition subunit is used to decompose the Hessenberg matrix H. m+1,m Decomposed into Among them, Q m+1 R is an orthogonal matrix. m+1,m It is an upper triangular matrix.

[0301] Specifically, the second subunit includes:

[0302] Input / output subunit, used to input R using the second quantum circuit. m The value of the second residual vector α is used to output the linear system in subspace K′. m The middle value within Wherein, the R m R is an upper triangular matrix m+1,m For the first m rows, α = ||b0||2q1(1:m), where q1(1:m) represents the orthogonal matrix Q. m+1 The vector consisting of the first m elements of the first column, α and R m , Satisfying Relationship:

[0303] Specifically, after the input / output subunit, the device further includes:

[0304] The third judgment subunit is used to judge the intermediate value. Can it be satisfied? Where ∈3 represents the preset third precision;

[0305] The second update subunit is used if the intermediate value Not satisfied Then obtain the updated second residual vector α new And return to the execution using the second quantum circuit, inputting the values ​​of Rm and the second residual vector α, and outputting the linear system in subspace K′. m The middle value within The steps, wherein the updated second residual vector

[0306] Specifically, the device further includes:

[0307] The fourth judgment subunit is used to determine if the intermediate value... satisfy Then determine the second approximate solution x′ m Can ||A′x′ be satisfied? m -b′||2<∈4, where ∈4 is the preset fourth precision;

[0308] The second determining subunit is used if the second approximate solution x′ m Satisfy ||A′x′ m -b′||2<∈4, then the second approximate solution x′ is determined. m That is, the linear system Ax = b in subspace K′ m The target solution within.

[0309] Specifically, the device further includes:

[0310] The third update subunit is used if the second approximate solution x′ m Not satisfied ||A′x′ m If -b′||2<∈4, then update the preset initial solution x0 to the current second approximate solution x′. m And obtain the updated current residual b′-A′x′ m Then return to the step of determining whether the norm of the current residual is greater than the first threshold and continue iterative calculation until the target solution that satisfies the preset fourth precision is obtained.

[0311] Compared with existing technologies, this invention first identifies the linear system to be solved and preprocesses it. Then, it constructs a hybrid subspace for solving the linear system and a quantum circuit for solving the linear system. Using the hybrid subspace and the quantum circuit, it calculates the target solution of the preprocessed linear system. By utilizing the comprehensive solution performance of the hybrid subspace, it overcomes the shortcomings of existing technologies. It can reduce the time complexity and computational load of solving linear problems and accelerate the solution speed of quantum linear algorithms.

[0312] This invention also provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the method embodiments described above when running.

[0313] Specifically, in this embodiment, the storage medium can be configured to store a computer program for performing the following steps:

[0314] S201: Determine the linear system to be solved and preprocess the linear system to be solved;

[0315] S202: Construct the hybrid subspace for solving the linear system and the quantum circuit for solving the linear system, respectively;

[0316] S203: Using the hybrid subspace and the quantum circuit, calculate the target solution of the preprocessed linear system to be solved.

[0317] Specifically, in this embodiment, the storage medium may include, but is not limited to, USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks, and other media capable of storing computer programs.

[0318] This invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the method embodiments described above.

[0319] Specifically, the aforementioned electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the aforementioned processor, and the input / output device is connected to the aforementioned processor.

[0320] Specifically, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0321] S201: Determine the linear system to be solved and preprocess the linear system to be solved;

[0322] S202: Construct the hybrid subspace for solving the linear system and the quantum circuit for solving the linear system, respectively;

[0323] S203: Using the hybrid subspace and the quantum circuit, calculate the target solution of the preprocessed linear system to be solved.

[0324] The above description, based on the embodiments shown in the figures, details the structure, features, and effects of the present invention. The above description is only a preferred embodiment of the present invention, but the present invention is not limited to the scope of implementation shown in the figures. Any changes made in accordance with the concept of the present invention, or equivalent embodiments modified to have equivalent changes, that do not exceed the spirit covered by the specification and figures, should be within the protection scope of the present invention.

Claims

1. A method for solving linear systems based on hybrid subspaces, characterized in that, The method includes: Determine the first matrix of the linear system to be solved. The initial residuals are obtained by preprocessing the linear system to be solved. A hybrid subspace for solving the linear system and a quantum circuit for solving the linear system are constructed respectively; the hybrid subspace is constructed based on the fully orthogonal subspace method. Krylov subspace of order and constructed based on the generalized minimum residual method Krylov subspace of order The construction of the quantum circuit for solving the linear system includes: obtaining a plurality of qubits including an auxiliary qubit, a first qubit, and a second qubit, wherein the initial state of the auxiliary qubit and the first qubit is set to |0>, and the initial state of the second qubit is set to... The The first vector The The elements, the Let the dimension of the first vector be denoted by ; construct a first sub-quantum circuit module for phase estimation, used to convert the denoted vector into the first sub-quantum circuit module. First matrix Decomposed in feature space into and the initial states of the first and second qubits Transform into , wherein For the first matrix The feature vector, the For the first matrix The eigenvalues, the For the first matrix The amplitude of the eigenvector; constructing a second sub-quantum circuit module to perform controlled rotation operations, used to... The auxiliary qubit is rotated as a control bit; a third sub-quantum circuit module is constructed to perform inverse phase estimation, used to... Reset to Construct a measurement operation module for the auxiliary qubit, so that the measured quantum state of the auxiliary qubit is At that time, we obtained: The The first sub-quantum circuit module, the second sub-quantum circuit module, the third sub-quantum circuit module, and the quantum measurement operation module are sequentially combined to form a quantum circuit for solving the linear system. Determine whether the norm of the current residual is greater than a first threshold, wherein the current residual is determined based on the current approximate solution; If so, then according to subspace The first quantum circuit, and the linear system calculated in the subspace using the fully orthogonalized subspace method. The first approximate solution within Otherwise, according to subspace The second quantum circuit, and the generalized minimum residual method are used to calculate the linear system in the subspace. The second approximate solution within ; According to the first approximate solution Or the second approximate solution Update the current approximate solution and continue to execute the step of determining whether the norm of the current residual is greater than the first threshold until a solution that meets the accuracy requirements is obtained, which is then used as the target solution for the linear system to be solved.

2. The method according to claim 1, characterized in that, The first matrix of the linear system to be solved is determined. The linear system to be solved is preprocessed to obtain the initial residuals, including: Obtain the linear system to be solved , wherein For the first matrix, the Let it be the first vector; According to the first matrix Determine the sparse approximation matrix used for preprocessing of linear systems. , wherein the sparse approximation matrix for The sparse approximation satisfies the preset sparse structure; Based on the sparse approximation matrix Obtain the second matrix of the linear system after preprocessing. Second vector and initial residual , where the second matrix The second vector The initial residual is based on the initial approximate solution. Calculate, satisfy .

3. The method according to claim 1, characterized in that, According to subspace The first quantum circuit, and the linear system calculated in the subspace using the fully orthogonalized subspace method. The first approximate solution within ,include: Construct the corresponding second matrix and the subspace of the current residual Standard orthogonal basis sets and Hessenberg matrix ; Processing the Hessenberg matrix using the first quantum circuit and the first residual vector The value of the linear system in the subspace is obtained. The middle value within , wherein , , and Satisfies a linear relationship: ; According to the intermediate value To obtain the linear system in the subspace The first approximate solution within , wherein .

4. The method according to claim 3, characterized in that, The Hessenberg matrix is ​​input using the first quantum circuit. and the first residual vector The value of the linear system in the subspace is output. The middle value within Subsequently, the method further includes: Determine the intermediate value Can it be satisfied? ,in, Preset to the first precision; If the intermediate value Not satisfied Then, the updated first residual vector is obtained and the process of using the first quantum circuit to input the Hessenberg matrix is ​​returned. and the first residual vector The value of the linear system in the subspace is output. The middle value within The steps, wherein the updated first residual vector 5. The method according to claim 4, characterized in that, The method further includes: If the intermediate value satisfy Then determine the first approximate solution. Can it be satisfied? ,in, To preset the second precision; If the first approximate solution satisfy Then determine the first approximate solution. That is, the linear system In subspace The target solution within.

6. The method according to claim 5, characterized in that, The method further includes: If the first approximate solution Not satisfied Then update the preset initial solution. The current first approximate solution And obtain the updated current residual. Then return to the step of determining whether the norm of the current residual is greater than the first threshold and continue iterative calculation until the target solution that satisfies the preset second precision is obtained.

7. The method according to claim 1, characterized in that, According to subspace The second quantum circuit, and the generalized minimum residual method are used to calculate the linear system in the subspace. The second approximate solution within ,include: Optimize the current residual using preset rules; Construct the corresponding second matrix and the subspace of the optimized current residual Standard orthogonal basis sets and Hessenberg matrix ; For the Hessenberg matrix Perform QR decomposition; The QR decomposition results are processed using the second quantum circuit to obtain the linear system in the subspace. The middle value within ; According to the intermediate value To obtain the linear system in the subspace The second approximate solution within , wherein .

8. The method according to claim 7, characterized in that, The Hessenberg matrix Perform QR decomposition, including: The Hessenberg matrix Decomposed into ,in, It is an orthogonal matrix. It is an upper triangular matrix.

9. The method according to claim 8, characterized in that, The process of processing the QR decomposition results using the second quantum circuit yields the linear system in the subspace. The middle value within ,include: Using the second quantum circuit, input Second residual vector The value of the linear system in the subspace is output. The middle value within , wherein It is an upper triangular matrix The former OK, , Represents an orthogonal matrix The first column A vector consisting of n elements and , relation: .

10. The method according to claim 9, characterized in that, The second quantum circuit is used to input... Second residual vector The value of the linear system in the subspace is output. The middle value within Subsequently, the method further includes: Determine the intermediate value Can it be satisfied? ,in, The preset third precision; If the intermediate value Not satisfied Then obtain the updated second residual vector. And return to execute the operation using the second quantum circuit, input Second residual vector The value of the linear system in the subspace is output. The middle value within The steps, wherein the updated second residual vector 11. The method according to claim 10, characterized in that, The method further includes: If the intermediate value satisfy Then determine the second approximate solution. Can it be satisfied? ,in, The preset fourth precision; If the second approximate solution satisfy Then the second approximate solution is determined. That is, the linear system In subspace The target solution within.

12. The method according to claim 11, characterized in that, The method further includes: If the second approximate solution Not satisfied Then update the preset initial solution. The current second approximate solution And obtain the updated current residual. Then return to the step of determining whether the norm of the current residual is greater than the first threshold and continue iterative calculation until the target solution that satisfies the preset fourth precision is obtained.

13. A solution device for linear systems based on hybrid subspaces, characterized in that, The device includes: The determination module is used to determine the first matrix of the linear system to be solved. The initial residuals are obtained by preprocessing the linear system to be solved. The construction module is used to construct a hybrid subspace for solving the linear system and a quantum circuit for solving the linear system, respectively; the hybrid subspace is constructed based on the fully orthogonalized subspace method. Krylov subspace of order and constructed based on the generalized minimum residual method Krylov subspace of order The construction of the quantum circuit for solving the linear system includes: obtaining a plurality of qubits including an auxiliary qubit, a first qubit, and a second qubit, wherein the initial state of the auxiliary qubit and the first qubit is set to |0>, and the initial state of the second qubit is set to... The The first vector The The elements, the Let the dimension of the first vector be denoted by ; construct a first sub-quantum circuit module for phase estimation, used to convert the denoted vector into the first sub-quantum circuit module. First matrix Decomposed in feature space into and the initial states of the first and second qubits Transform into , wherein For the first matrix The feature vector, the For the first matrix The eigenvalues, the For the first matrix The amplitude of the eigenvector; constructing a second sub-quantum circuit module to perform controlled rotation operations, used to... As a control bit, the auxiliary qubit is rotated, wherein the The normalization constant is used; a third sub-quantum circuit module is constructed to perform inverse phase estimation, which is used to... Reset to Construct a measurement operation module for the auxiliary qubit, so that the measured quantum state of the auxiliary qubit is At that time, we obtained: The The first sub-quantum circuit module, the second sub-quantum circuit module, the third sub-quantum circuit module, and the quantum measurement operation module are sequentially combined to form a quantum circuit for solving the linear system. The calculation module determines whether the norm of the current residual is greater than a first threshold, wherein the current residual is determined based on the current approximate solution; If so, then according to subspace The first quantum circuit, and the linear system calculated in the subspace using the fully orthogonalized subspace method. The first approximate solution within Otherwise, according to subspace The second quantum circuit, and the generalized minimum residual method are used to calculate the linear system in the subspace. The second approximate solution within ; According to the first approximate solution Or the second approximate solution Update the current approximate solution and continue to execute the step of determining whether the norm of the current residual is greater than the first threshold until a solution that meets the accuracy requirements is obtained, which is then used as the target solution for the linear system to be solved.

14. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 12 when it is run.

15. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method as described in any one of claims 1 to 12.

Citation Information

Patent Citations

  • Hybrid quantum algorithm-based combinatorial optimization solving method, system and solver architecture

    CN113392580A

  • Method and terminal for solving constrained quadratic programming problem based on HHL algorithm

    CN113610646A