Simulation method, device and equipment based on quantum circuit and readable storage medium
By projecting the linear equation system onto a predefined subspace and constructing quantum state evolution operations using quantum circuits, the problem of high complexity in coefficient matrix inversion in large-scale fluid dynamics calculations is solved, achieving more efficient fluid state determination.
Patent Information
- Application Number
- CN202310526333.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-11
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2043-05-11
AI Technical Summary
In existing technologies for solving large-scale fluid dynamics calculations, the computational complexity of inverting the coefficient matrix is high, resulting in low efficiency in determining the fluid state.
By projecting the linear equations onto a predefined subspace and constructing quantum state evolution operations using the Chebyshev polynomials corresponding to the inverse matrix of A2 using quantum circuits, the qubits are measured to obtain the value of X2 and then reduced back to the dimension of X1.
It reduces computational complexity and improves the efficiency of determining fluid states, especially in solving large linear systems.
Smart Images

Figure CN118940649A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of quantum computing technology, and in particular to a simulation method, device, equipment and readable storage medium based on quantum circuits. Background Art
[0002] With the continuous development of random computer technology, we can use its computing advantages to simulate different systems and construct a linear equation system for the system. By solving the linear equation system, we can obtain information about the system in a stable state. For example, in CFD (Computational Fluid Dynamics), we can conduct numerical experiments, computer simulations, and analytical studies on fluid mechanics problems based on various discretized mathematical methods. For example, CFD can be used to calculate state information such as temperature and density at different positions of the fluid in a stable state.
[0003] In the prior art, when simulating fluid motion through computational fluid dynamics, it is necessary to solve the linear equation system AX=B, that is, to obtain X; X represents the state of the fluid, and A represents the coefficient matrix. During the calculation process, A must be inverted, and the dimension of the coefficient matrix is linearly related to the grid nodes constructed for the fluid. When the scale of the grid nodes is large, the calculation of the inversion of the coefficient matrix is very complicated, which will increase the complexity of the calculation, resulting in low efficiency in determining the state. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a simulation method, device, equipment and readable storage medium based on quantum circuits, which can reduce the complexity of calculations and improve the efficiency of determining physical quantities. The specific technical solutions are as follows:
[0005] In a first aspect of an embodiment of the present application, a simulation method based on a quantum circuit is first provided, the method comprising:
[0006] Get the first linear equation system A to be solved 1 X 1 =B 1 ;X 1 Represents the physical quantity to be solved of the target system;
[0007] Project the first linear equation system to be solved to a preset subspace to obtain a second linear equation system A to be solved 2 X 2 =B 2 ; Wherein, the dimension of the preset subspace is less than X 1 Dimensions;
[0008] Based on the constructed quantum circuit, the quantum state evolution operation is performed on the quantum bit, and the quantum bit is measured to obtain X2 The final value of; wherein the quantum circuit is based on A 2 The inverse matrix of the quantum circuit is constructed by the Chebyshev polynomial corresponding to the inverse matrix of the quantum circuit. The input of the quantum circuit includes B 2 The initial state of the corresponding quantum bit;
[0009] X 2 The final value of X is restored 1 The dimension of X 1 The final value of .
[0010] Optionally, the target system represents a fluid, X 1 represents the difference between the state of the fluid to be solved at one moment and the previous moment for each grid unit in the discretized network of the fluid; B 1 A represents the residual amount related to the fluid state to be solved at the previous moment and the coordinate information of the grid unit; 1 Represents a coefficient matrix related to the fluid state to be solved at the previous moment and the coordinate information of the grid unit.
[0011] Optionally, in the quantum circuit based on the construction, a quantum state evolution operation is performed on the quantum bit, and the quantum bit is measured to obtain X 2 Before the final value of
[0012] Based on the first formula, construct A 2 Each order of the Chebyshev polynomials corresponding to the inverse matrix;
[0013] The first formula is:
[0014]
[0015] in,
[0016]
[0017] A 2 -1 Indicates A 2 The inverse matrix of Indicates A 2 The g-th order of the Chebyshev polynomial corresponding to the inverse matrix of ; b=κ 2 log(κ / ∈), κ represents the condition number; ∈ represents the preset precision value; C represents the number of combinations.
[0018] Optionally, the quantum circuit includes a first Oracle and a second Oracle;
[0019] The first Oracle is used to implement the quantum walk algorithm. 2Each order of the Chebyshev polynomial corresponding to the inverse matrix of is encoded into B 2 The amplitude of the initial state of the corresponding quantum bit;
[0020] The second Oracle is used to implement the encoding result based on the operator linear combination algorithm and the first Oracle, and converts A 2 The weighted sum of the Chebyshev polynomials of each order corresponding to the inverse matrix of is encoded into B 2 The amplitude of the initial state of the corresponding quantum bit.
[0021] Optionally, the input of the quantum circuit further includes a first number of first auxiliary quantum bits and a second number of second auxiliary quantum bits;
[0022] The first Oracle is used to implement A based on the second formula 2 Each order of the Chebyshev polynomial corresponding to the inverse matrix of is encoded into B 2 The amplitude of the initial state of the corresponding quantum bit;
[0023] The second formula is:
[0024] in, Operator is used to implement the |0 m >|B 2 >To Mapping of Π|Φ ⊥ >=0,
[0025] d means A 2 The sparsity of Indicates A 2 The element in the jth row and kth column of N stands for A 2 Dimensions; Operator is used to implement the |0 m >|ψ j > to T|ψ j > mapping; Indicates the calculation of tensor product; I represents the identity matrix; |0 m > represents the second number of second auxiliary quantum bits; |B 2 > indicates B 2 The initial state of the corresponding quantum bit; represents the Hermitian conjugation operator; W g represents the W operator corresponding to the g-th order of the Chebyshev polynomial;
[0026] The second Oracle is used to implement A based on the third formula 2The weighted sum of the Chebyshev polynomials of each order corresponding to the inverse matrix of is encoded into B 2 The amplitude of the initial state of the corresponding quantum bit;
[0027] The third formula is:
[0028] The G operator is used to implement the operation from |0 r >|0 m >|B 2 >To The mapping of |Ψ ⊥ >Orthogonal to T|j>; |0 r > represents the first number of first auxiliary qubits; α=∑ g α g .
[0029] Optionally, the first number is determined based on a fourth formula, and the fourth formula is:
[0030] r=logM
[0031] Wherein, r represents the first number, M represents A 2 The order of the Chebyshev polynomial corresponding to the inverse matrix of ;
[0032] The second number is determined based on a fifth formula, which is:
[0033] m=log4N
[0034] m represents the second number.
[0035] Optionally, the quantum bit is measured to obtain X 2 The final value of includes:
[0036] When the qubit is measured and the registers corresponding to the first auxiliary qubit and the second auxiliary qubit are both in the |0> state, B 2 The measurement result of the register corresponding to the corresponding qubit;
[0037] Based on the obtained measurement results, we get X 2 The final value of .
[0038] Optionally, based on the obtained measurement result, obtain X 2 The final value of includes:
[0039] Based on the obtained measurement results, we get X 2 The current candidate value;
[0040] X-based 2The current candidate value is used to calculate the residual corresponding to the second linear equation system to be solved;
[0041] If the calculated residual meets the first termination condition, then based on X 2 The current candidate value determines X 2 The final value of
[0042] If the calculated residual does not meet the first termination condition, an iterative operation is performed based on the calculated residual, and X is determined based on the result of the iterative operation. 2 The final value of .
[0043] Optionally, the X 2 The final value of X is restored 1 The dimension of X 1 The final value of includes:
[0044] According to the sixth formula, X 2 The final value of X is restored 1 The dimension of X 1 The final value of; the sixth formula is:
[0045] X 1 =X 0 +V D X 2
[0046] Among them, X 0 represents the initial solution when performing projection; V D Represents a set of bases of the preset subspace determined when performing projection.
[0047] A second aspect of the embodiments of the present application provides a simulation device based on a quantum circuit, the device comprising:
[0048] An acquisition module is used to obtain the first linear equation system A to be solved 1 X 1 =B 1 ;X 1 Represents the physical quantity to be solved of the target system;
[0049] A projection module is used to project the first linear equation system to be solved to a preset subspace to obtain a second linear equation system A to be solved. 2 X 2 =B 2 ; Wherein, the dimension of the preset subspace is less than X 1 Dimensions;
[0050] The evolution module is used to perform quantum state evolution operations on the quantum bits based on the constructed quantum circuit, and measure the quantum bits to obtain X 2The final value of; wherein the quantum circuit is based on A 2 The inverse matrix of the quantum circuit is constructed by the Chebyshev polynomial corresponding to the inverse matrix of the quantum circuit. The input of the quantum circuit includes B 2 The initial state of the corresponding quantum bit;
[0051] Restore module, used to restore X 2 The final value of X is restored 1 The dimension of X 1 The final value of .
[0052] Optionally, the target system represents a fluid, X 1 represents the difference between the state of the fluid to be solved at one moment and the previous moment for each grid unit in the discretized network of the fluid; B 1 A represents the residual amount related to the fluid state to be solved at the previous moment and the coordinate information of the grid unit; 1 Represents a coefficient matrix related to the fluid state to be solved at the previous moment and the coordinate information of the grid unit.
[0053] Optionally, the device further comprises:
[0054] A construction module is used to perform a quantum state evolution operation on a quantum bit in the quantum circuit based on the construction, and measure the quantum bit to obtain X 2 Before the final value of 2 Each order of the Chebyshev polynomials corresponding to the inverse matrix;
[0055] The first formula is:
[0056]
[0057] in,
[0058]
[0059] A 2 -1 Indicates A 2 The inverse matrix of Indicates A 2 The g-th order of the Chebyshev polynomial corresponding to the inverse matrix of ; b=κ 2 log(κ / ∈), κ represents the condition number; ∈ represents the preset precision value; C represents the number of combinations.
[0060] Optionally, the quantum circuit includes a first Oracle and a second Oracle;
[0061] The first Oracle is used to implement the quantum walk algorithm. 2Each order of the Chebyshev polynomial corresponding to the inverse matrix of is encoded into B 2 The amplitude of the initial state of the corresponding quantum bit;
[0062] The second Oracle is used to implement the encoding result based on the operator linear combination algorithm and the first Oracle, and converts A 2 The weighted sum of the Chebyshev polynomials of each order corresponding to the inverse matrix of is encoded into B 2 The amplitude of the initial state of the corresponding quantum bit.
[0063] Optionally, the input of the quantum circuit further includes a first number of first auxiliary quantum bits and a second number of second auxiliary quantum bits;
[0064] The first Oracle is used to implement A based on the second formula 2 Each order of the Chebyshev polynomial corresponding to the inverse matrix of is encoded into B 2 The amplitude of the initial state of the corresponding quantum bit;
[0065] The second formula is:
[0066] in, Operator is used to implement the |0 m >|B 2 >To Mapping of Π|Φ ⊥ >=0, d means A 2 The sparsity of Indicates A 2 The element in the jth row and kth column of N stands for A 2 Dimensions; Operator is used to implement the |0 m >|ψ j > to T|ψ j > mapping; Indicates the calculation of tensor product; I represents the identity matrix; |0 m > represents the second number of second auxiliary quantum bits; |B 2 > indicates B 2 The initial state of the corresponding quantum bit; represents the Hermitian conjugation operator; W g represents the W operator corresponding to the g-th order of the Chebyshev polynomial;
[0067] The second Oracle is used to implement A based on the third formula 2 The weighted sum of the Chebyshev polynomials of each order corresponding to the inverse matrix of is encoded into B 2The amplitude of the initial state of the corresponding quantum bit;
[0068] The third formula is:
[0069] The G operator is used to implement the operation from |0 r >|0 m >|B 2 >To The mapping of |Ψ ⊥ >Orthogonal to T|j>; |0 r > represents the first number of first auxiliary qubits; α=∑ g α g .
[0070] Optionally, the first number is determined based on a fourth formula, and the fourth formula is:
[0071] r=logM
[0072] Wherein, r represents the first number, M represents A 2 The order of the Chebyshev polynomial corresponding to the inverse matrix of ;
[0073] The second number is determined based on a fifth formula, which is:
[0074] m=log4N
[0075] m represents the second number.
[0076] Optionally, the evolution module includes:
[0077] The measurement submodule is used to measure the qubit and obtain that when the registers corresponding to the first auxiliary qubit and the second auxiliary qubit are both in the |0> state, B 2 The measurement result of the register corresponding to the corresponding qubit;
[0078] The generation submodule is used to obtain X based on the obtained measurement results. 2 The final value of .
[0079] Optionally, the generating submodule is specifically configured to obtain X based on the obtained measurement result. 2 The current candidate value;
[0080] X-based 2 The current candidate value is used to calculate the residual corresponding to the second linear equation system to be solved;
[0081] If the calculated residual meets the first termination condition, then based on X 2 The current candidate value determines X2 The final value of
[0082] If the calculated residual does not meet the first termination condition, an iterative operation is performed based on the calculated residual, and X is determined based on the result of the iterative operation. 2 The final value of .
[0083] Optionally, the restoration module is specifically configured to convert X 2 The final value of X is restored 1 The dimension of X 1 The final value of; the sixth formula is:
[0084] X 1 =X 0 +V D X 2
[0085] Among them, X 0 represents the initial solution when performing projection; V D Represents a set of bases of the preset subspace determined when performing projection.
[0086] According to a third aspect of the embodiments of the present application, a quantum computer device is provided, including: a quantum circuit and a register, wherein the quantum computer device implements any of the above-mentioned methods when running.
[0087] In a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the method steps described above is implemented.
[0088] Beneficial effects of the embodiments of the present application:
[0089] The simulation method based on quantum circuits provided in the embodiment of the present application obtains a first linear equation group A to be solved 1 X 1 =B 1 ;X 1 Represents the physical quantity to be solved of the target system; the first linear equation system to be solved is projected onto the preset subspace to obtain the second linear equation system A 2 X 2 =B 2 ; Among them, the dimension of the preset subspace is less than X 1 Dimension; Based on the constructed quantum circuit, the quantum state evolution operation is performed on the quantum bit, and the quantum bit is measured to obtain X 2 The final value of 2 The inverse matrix of the quantum circuit is constructed by the Chebyshev polynomial corresponding to the inverse matrix of the quantum circuit. 2 The initial state of the corresponding quantum bit; X2 The final value of X is restored 1 The dimension of X 1 The final value of .
[0090] Based on the above processing, since X 2 Can be based on A 2 The inverse matrix and B 2 Get, and the quantum circuit is based on A 2 The inverse matrix of the Chebyshev polynomials is constructed, and the input of the quantum circuit contains B 2 The initial state of the corresponding quantum bit, therefore, after evolution, based on the measurement results of the quantum bit, we can get X 2 Correspondingly, we can also 2 The final value of X is restored 1 The dimension of X 1 Since the dimension of the preset subspace is smaller than X 1 Therefore, solving the second set of linear equations based on quantum circuits can reduce the complexity of calculations and improve the efficiency of determining the state.
[0091] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0092] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0093] Figure 1 A flowchart of a simulation method based on quantum circuits provided in an embodiment of the present application;
[0094] Figure 2 A schematic diagram of a quantum circuit provided in an embodiment of the present application;
[0095] Figure 3 A structural diagram of a simulation device based on quantum circuits provided in an embodiment of the present application. DETAILED DESCRIPTION
[0096] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0097] CFD problems are usually related to solving a series of equations using numerical methods. Among them, the CFD solver needs to integrate the partial derivative equations over time, so it is necessary to iterate using time increments to calculate small changes in the system and stop when the system becomes stable. In this problem setting, the classical algorithm is generally calculated through SU2 (The Standford University Unstructured suite, a high-precision partial differential equation solver developed by Stanford University). In CFD simulation, starting from the mathematical model, the following elements need to be defined, including: numerical grid, discretization method, numerical scheme and solution method.
[0098] Numerical grid: A grid is a discrete representation of the spatial continuous domain in which the problem is solved. Each spatial point is considered to be a node, and a grid cell is defined by the volume bounded by a set of adjacent nodes. In the case of a structured grid, each node and grid cell is uniquely identified by a set of indices. The standard method for solving the above fluid dynamics equations is FVM (Finite volume method). In the FVM method, the numerical grid is divided into multiple grid cells, the local volume associated with each grid cell is considered, and the integral conservation law is applied. This law states that the changes in all variables U of the fluid in the volume Ω depend only on the flux F on its surface S. FVM can automatically satisfy the conservation properties of the fluid dynamics equations. This conservation equation can be written as follows:
[0099]
[0100] After discretization of the spatial continuous domain, the mathematical operators of the equations to be solved must also be discretized. This approximation of the equations is achieved by numerical schemes. Two types of numerical schemes are considered: time-integrated schemes and spatial schemes. The time-integrated schemes model the time integration of the variables to be solved starting from the initial state of the fluid, while the spatial schemes represent the spatial gradients of these variables to be solved.
[0101] Based on the discretization numerical scheme and solution method introduced above, it is necessary to solve the numerical grid of space. In two-dimensional space, each spatial point is a node, identified by a set of indexes. The set of nodes connected by the nearest neighboring nodes forms a grid. In the discretization representation of formula (1), the differential operation is replaced by numerical approximation, and the implicit Euler format is selected to handle time differentials. Formula (1) is discretized as:
[0102]
[0103] U n is the fluid state of all grid cells at the nth moment (nth integration), Un = {U i}, i = 0, 1, 2, ..., N-1, U i =(ρ,ρu,ρν,E) i represents the fluid state of the i-th grid unit, ρ represents the fluid density, u and v represent the two components of the fluid velocity in two-dimensional coordinates, E represents the total energy per unit mass of the fluid, and b n (U n ) represents the residual at the nth moment, and it is n Related functions.
[0104] Let ΔU n =U n+1 -U n ,but:
[0105]
[0106] Substituting formula (3) into formula (2), we get:
[0107]
[0108] Among them, δ i,i′ δ j,j′ It is a parameter related to the coordinate information of the grid unit.
[0109] Other Then, formula (4) is equivalent to:
[0110] A(U n )ΔU n =-b n (U n ) (5)
[0111] Among them, A(U n ) represents the coefficient matrix at the nth moment, that is, the Jacobian matrix at the nth moment, and it is related to U n Related functions.
[0112] Will A(U n ) is abbreviated as A n , replace -b n (U n ) is abbreviated as b n , thus we get a linear system that needs to be solved: A n ΔU n =b n When the number of grid cells is N, then U n The dimension is 4N. When solving, the initial state of the fluid in these N network units is obtained to obtain U 0 , according to U 0 Calculate A 0,b 0 , solution A 0 (U 1 -U 0 )=b 0 , get U 1 , then calculate A 1 ,b 1 , get U 2 , keep iterating, the iteration cutoff condition is b n approaches 0. In this case, we need to use the solution A n ΔU n =b n The linear system method of the form, where ΔU n =U n+1 -U n .
[0113] A n It can be understood that A in this application 1 , ΔU n It can be understood that X in this application 1 , b n It can be understood that B in this application 1 .
[0114] In the classic scheme, the implicit Euler solver has linear complexity, A n It is a sparse matrix that must be inverted during the calculation process. The calculation of the inversion of this matrix is very complex and requires an iterative method. The classic solution method uses the multi-grid method. The dimension of this sparse matrix is linearly related to the grid nodes, and the running time has a good linear relationship with the number of grid cells, which makes it very difficult to implement.
[0115] The present application embodiment provides a simulation method based on quantum circuits, which can be implemented by electronic devices with quantum computing capabilities, such as quantum computers, etc., or by simulating quantum computing with classical computers. Figure 1 , Figure 1 A flowchart of a simulation method based on a quantum circuit is provided for an embodiment of the present application, and the method includes:
[0116] S101: Obtain the first linear equation system A to be solved 1 X 1 =B 1 ;X 1 Represents the physical quantity to be solved for the target system.
[0117] S102: Project the first linear equation system to be solved to a preset subspace to obtain a second linear equation system A to be solved 2 X 2 =B 2; Among them, the dimension of the preset subspace is less than X 1 Dimension.
[0118] S103: Based on the constructed quantum circuit, perform quantum state evolution operations on the quantum bit and measure the quantum bit to obtain X 2 The final value of .
[0119] Among them, the quantum circuit is based on A 2 The inverse matrix of the quantum circuit is constructed by the Chebyshev polynomial corresponding to the inverse matrix of the quantum circuit. 2 The initial state of the corresponding quantum bit.
[0120] Specifically, first based on A 2 The Chebyshev polynomials corresponding to the inverse matrix of determine the target quantum logic gate and the quantum bits and timing of the target quantum logic gate to obtain the quantum circuit; then B 2 The initial state encoded into the quantum bit is used as the input of the quantum circuit; the encoded quantum bit is evolved through the target quantum logic gate so that the initial state of the quantum bit evolves to the final state; then the quantum bit is measured to obtain the final state of the quantum bit; X is determined according to the final state of the quantum bit. 2 The final value of .
[0121] S104: X 2 The final value of X is restored 1 The dimension of X 1 The final value of .
[0122] The inherent feature of quantum computing is quantum parallelism. In Hilbert space, the quantum state of multiple qubits is a vector, and each quantum operation is a transformation in this linear space. Therefore, if the description of a practical problem is encoded as a quantum state vector of a set of qubits, the solution of the vector problem can be processed by executing an operation in parallel without iterating the state of each qubit in a set of qubits. 2 Can be based on A 2 The inverse matrix and B 2 Get, and the quantum circuit is based on A 2 The inverse matrix of the Chebyshev polynomials is constructed, and the input of the quantum circuit contains B 2 The initial state of the corresponding quantum bit, therefore, after evolution, based on the measurement results of the quantum bit, we can get X 2 Correspondingly, we can also 2 The final value of X is restored 1 The dimension of X 1 Since the dimension of the preset subspace is smaller than X 1Therefore, solving the second set of linear equations based on quantum circuits can reduce the complexity of calculations and improve the efficiency of determining the state.
[0123] For step S101, the first linear equation group to be solved is for the target system. For example, for some large linear systems, in the process of calculating the physical quantities of the large linear systems, it is necessary to solve the corresponding linear sparse equation group, then the linear sparse equation group can be used as the first linear equation group to be solved, and solved based on the method provided in this application.
[0124] In one embodiment, the target system may be a fluid. Accordingly, the solution of the first linear equation group to be solved, that is, the physical quantity to be solved, is the difference between the state of the fluid to be solved at one moment and the state of the fluid at the previous moment. That is, X 1 B represents the difference between the state of the fluid to be solved at one moment and the previous moment for each grid unit in the discretized network for the fluid; 1 A represents the residual related to the fluid state to be solved and the coordinate information of the grid unit at the previous moment; 1 A represents the coefficient matrix related to the fluid state to be solved and the coordinate information of the grid unit at the previous moment. For example, A 1 The Jacobian matrix related to the fluid state to be solved and the coordinate information of the grid unit at the previous moment is represented. The fluid state may include at least one of density, velocity and energy.
[0125] For step S102, in one implementation, the first system of linear equations to be solved can be projected based on a preset subspace algorithm. For example, the subspace algorithm can be a Krylov subspace algorithm. According to the dimension of the preset subspace, the first system of linear equations to be solved can be projected to the preset subspace using the subspace algorithm to obtain a second system of linear equations to be solved with a smaller dimension. In one embodiment, the subspace algorithm used can be a generalized minimum residual (GMRES) algorithm.
[0126] According to the generalized minimum residual algorithm, for a linear problem A 1 X 1 =B 1 , where A 1 is a non-singular full-rank matrix with dimension D. If an initial solution x is given 0 , then the initial residual r 0 =B 1 -A 1 x 0 If we define: is the matrix A 1and the initial residual r 0 D-order Krylov subspace. Then in the generalized minimal residual algorithm, the optimal criterion can be described as: find so that
[0127] For any vector If there exists a vector y such that x = x (0) +V D y,V D Representing a set of bases of the preset subspace, we can get Accordingly, we can get A 1 V D y, and then, we get β=‖r 0 ‖ 2 .
[0128] Among them, e 1 =[1,0,…0] T In addition, due to V D+1 The column vectors of are orthonormal, so we get:
[0129]
[0130] Therefore, when D is not small, QR (equilateral triangular) decomposition can be used to solve it. H D+1,D QR decomposition, where Q D+1 is an orthogonal matrix, R D+1,D is an upper triangular matrix, we can get:
[0131]
[0132] Among them, q 1 It's Q D+1 The first column, R D For R D+1,D Therefore, y can be obtained by solving the following upper triangular equations:
[0133] βq 1 (1:D)=R D y
[0134] Among them, q 1 (1:D) represents q 1 A vector consisting of the first D elements of a vector.
[0135] That is, the solution space of the generalized minimal residual algorithm is The solution constraint space is Its minimum value optimal criterion can be described as: finding Make
[0136] For example, based on the generalized minimal residual algorithm, the first linear equation system to be solved is projected into the preset subspace, and the obtained A 2 H D+1,D , B 2 βe 1 .
[0137] Correspondingly, in finding X 2 After obtaining the final value of X, we can use the sixth formula to calculate 2 The final value of X is restored 1 The dimension of X 1 The final value of .
[0138] The sixth formula is:
[0139] X 1 =X 0 +V D X 2
[0140] Among them, X 0 represents the initial solution when projecting using the generalized minimal residual algorithm; V D Represents a set of bases of a preset subspace determined when projecting using the generalized minimal residual algorithm.
[0141] Since the amount of computation and storage for each iteration of the generalized minimal residual algorithm will increase with the increase in the number of iterations, when the number of iterations is large, the computation time and storage will increase significantly. Therefore, a restart strategy can also be adopted, that is, given a maximum number of iterations, if it still does not converge after iterating to this number of steps, an approximate solution is calculated, and the approximate solution is used as the new initial solution, and the generalized minimal residual algorithm is executed again until convergence. In other words, in the above process of restarting the generalized minimal residual algorithm, the initial solution will be updated multiple times. Correspondingly, when restoring based on the sixth formula, the initial solution at the last restart can be used.
[0142] For step S103, based on QRAM (Quantum Random Access Machine), the digital coding state can be converted into an analog coding state. It can be understood that the analog coding state refers to the state in which digital information is encoded on the quantum state amplitude. Based on this method, B can be obtained. 2 The initial state of the corresponding quantum bit.
[0143] Any simple function can be linearly approximated as a linear combination of other functions, so the inverse function of a matrix can be approximated by a Chebyshev polynomial. It can be understood that each order of a Chebyshev polynomial corresponds to one term.
[0144] In one embodiment, before the above step S103, the method may further include the following steps:
[0145] Based on the first formula, construct A 2 Each order of the Chebyshev polynomials corresponding to the inverse matrix;
[0146] The first formula is:
[0147]
[0148] in,
[0149]
[0150] A 2 -1 Indicates A 2 The inverse matrix of represents the Chebyshev polynomial of the first kind; b=κ 2 log(κ / ∈), κ represents the condition number; ∈ represents the preset precision value; C represents the number of combinations to be found; Indicates A 2 The g-th order of the Chebyshev polynomial corresponding to the inverse matrix of . The order of the Chebyshev polynomial determined based on the first formula is g 0 +1. It is understandable that for the function g(x), we have (which can be called the preset condition), where represents the first kind of Chebyshev polynomial. That is, A constructed based on the first formula above 2 The Chebyshev polynomials corresponding to the inverse matrix of also meet the above preset conditions.
[0151] Correspondingly, the quantum circuit includes a first Oracle and a second Oracle. The first Oracle is used to implement the quantum walk algorithm. 2 Each order of the Chebyshev polynomial corresponding to the inverse matrix of is encoded into B 2 The second Oracle is used to implement the encoding result based on the operator linear combination algorithm and the first Oracle, and converts A 2 The weighted sum of the Chebyshev polynomials of each order corresponding to the inverse matrix of is encoded into B 2 The amplitude of the initial state of the corresponding quantum bit.
[0152] Among them, Oracle is a black box that represents the transition of a certain quantum state.
[0153] Based on the above method, in determining A 2After obtaining the Chebyshev polynomial corresponding to the inverse matrix of the first oracle, each order of the Chebyshev polynomial can be encoded into B 2 The amplitude of the initial state of the corresponding quantum bit, and then, based on the second Oracle, A 2 The Chebyshev polynomials corresponding to the inverse matrix of (i.e., the weighted sum of each order) are encoded into B 2 The amplitude of the initial state of the corresponding quantum bit. In this way, since the input of the quantum circuit contains B 2 The initial state of the corresponding quantum bit can be obtained based on the measurement result of the final state of the quantum bit. 2 The value of .
[0154] In one embodiment, it is also possible to use the division expression B 2 The other quantum bits other than the quantum bits in the initial state of the corresponding quantum bits are processed, that is, the input of the quantum circuit also includes a first number of first auxiliary quantum bits and a second number of second auxiliary quantum bits.
[0155] Correspondingly, the first Oracle is used to implement A based on the second formula. 2 Each order of the Chebyshev polynomial corresponding to the inverse matrix of is encoded into B 2 The amplitude of the initial state of the corresponding quantum bit. The second formula is:
[0156] in, Operator is used to implement the |0 m >|B 2 >To Mapping of Π|Φ ⊥ >=0, d means A 2 The sparsity of A 2jk Indicates A 2 The element in the jth row and kth column of N stands for A 2 Dimensions; Operator is used to implement the |0 m >|ψ j > to T|ψ j > mapping; Indicates the calculation of tensor product; I represents the identity matrix; Means defined as. |0 m > represents the second number of second auxiliary qubits; <0 m | means |0 m >The corresponding left arrow. |0 m ><0 m | represents an operator, which can be called a projection operator.
[0157] |B 2 > represents the quantum state of B 2 ; represents the Hermitian conjugate operator. The S operator performs a flip operation on the product state. <j| is the left ket of the quantum state. W g represents the W operator corresponding to the g-th order of the Chebyshev polynomial. The right side of the second formula is the result of encoding each order of the Chebyshev polynomial corresponding to the inverse matrix of A 2 , that is, through operator, W g operator, each order of the Chebyshev polynomial corresponding to the inverse matrix of A 2 can be encoded into the amplitude of the initial state of the qubit corresponding to B 2 .
[0158] The second Oracle is used to implement, based on the third formula, encoding the weighted sum of each order of the Chebyshev polynomial corresponding to the inverse matrix of A 2 into the amplitude of the initial state of the qubit corresponding to B 2 .
[0159] The third formula is:
[0160] where the G operator is used to implement the mapping from |0 r >|0 m >|B 2 > to , |Ψ ⊥ > is orthogonal to T|j>; |0 r > represents the first number of first auxiliary qubits; α = ∑ g α g . The right side of the third formula is the result of encoding the weighted sum of each order of the Chebyshev polynomial corresponding to the inverse matrix of A 2 , that is, through the G operator, the weighted sum of each order of the Chebyshev polynomial corresponding to the inverse matrix of A 2 can be encoded into the amplitude of the initial state of the qubit corresponding to B 2 .
[0161] In the embodiments of the present application, based on the first formula, the Chebyshev polynomial corresponding to the inverse matrix of A 2 can be determined, and thus each order of the Chebyshev polynomial corresponding to the inverse matrix of A 2 , and the weight coefficient of each order can be obtained. In the above formula, α g represents the weight coefficient of the g-th order of the Chebyshev polynomial.
[0162] In the above formula represents the first kind of Chebyshev polynomials, that is, the number of orders contained in the Chebyshev polynomials is g 0 +1. For the first kind of Chebyshev polynomials, there is the following recurrence relation:
[0163]
[0164] The following is a detailed introduction to the principle of encoding Chebyshev polynomials into quantum state amplitudes:
[0165] For A 2 , when‖A 2 ‖ max When ≤1, quantum walk can be used to construct
[0166] include:
[0167] Define the quantum walking space, the dimension of the walking space is 2N, that is:
[0168]
[0169] in, j∈[N].
[0170] Then, we can define two operators T and S where:
[0171]
[0172]
[0173] Based on operators T and S, we can construct a quantum walk operator:
[0174]
[0175] If we define the matrix Because ‖A 2 ‖ max ≤1, we get ‖H‖≤1. Let |λ> be the eigenvector of H and λ be the corresponding eigenvalue, then the quantum walk operator has the following minimum block structure:
[0176]
[0177] When λ=±1, WT|λ>=λT|λ>. Then for any eigenvalue λ, W n The minimum block structure is as follows:
[0178]
[0179] is a Chebyshev polynomial of the second kind of order n.
[0180] Furthermore, we can get:
[0181]
[0182] |λ ⊥ > represents the direction orthogonal to T|λ>. When |λ|=1, W n T|λ>=λ n T|λ>. Then we can get:
[0183]
[0184] |ψ ⊥ > represents an unnormalized vector and is orthogonal to T|j>. The above formula shows that the Chebyshev polynomial of the matrix H can be encoded into the quantum state amplitude through multiple quantum walks.
[0185] Since the operator T is a Therefore, for any There exists a unitary operation that implements the following process:
[0186] |0 m >|ψ>→T|ψ>
[0187] That is, to achieve from |0 m >|ψ> to T|ψ>.
[0188] If the unitary operation record is Accordingly, through This operation can achieve the following mapping:
[0189]
[0190] Among them, |Φ ⊥ >Satisfy Π|Φ ⊥ >=0,
[0191] That is, through This operation can encode each order of the Chebyshev polynomial into the quantum state amplitude.
[0192] In addition, after encoding each order of the Chebyshev polynomial into the quantum state amplitude, the weighted sum of each order can also be encoded into the quantum state amplitude, thus completing the encoding of the entire Chebyshev polynomial.
[0193] For example, given Among them, if is a unitary matrix, α g >0, then A 2 -1is usually a non-unitary matrix. Therefore, in order to simulate A 2 -1 , we can define two quantum gates V and U, where:
[0194]
[0195]
[0196] Among them, f=2g+1.
[0197] α=∑ g α g , and then, we can get the quantum gate And for this quantum gate we have:
[0198]
[0199] It is understandable that when measuring, as long as the results of the m registers corresponding to the auxiliary quantum bits are |0 m >, then the quantum state of the remaining registers can be obtained as Thus simulating And its probability is (||A 2 -1 |ψ>|| / α) 2 .
[0200] In addition, if A 2 -1 Represented as a linear combination of multiple matrices A 2 -1 =∑ i α i Z i , and each matrix Z i It is not necessarily a unitary matrix, but for any quantum state |ψ> it can satisfy the following equation:
[0201] U i |0 m >|ψ>=|0 m >Z i |ψ>+|Ψ ⊥ >
[0202] Then we have a unitary matrix Satisfy the following formula:
[0203]
[0204] Among them, U iThat is to say, based on the operator linear combination algorithm, for any matrix Y, as long as it can be expressed as a linear combination of several unitary matrices, then the operation Y|ψ> can definitely be realized through quantum circuits, and the probability of this realization is (‖Y|ψ>‖ / α) 2 Therefore, for A 2 -1 The corresponding Chebyshev polynomials can also be realized through quantum circuits.
[0205] In addition, in the related art, the HHL algorithm can also be used to calculate the solution of the linear equation system, and its complexity is O[log(N)κ 2 s 2 / ∈]. The method provided in the embodiment of the present application adopts the operator linear combination algorithm, the quantum walk algorithm, and combines the Chebyshev inversion method to obtain the solution of the linear equation system, and the complexity is O[s 2 κ 2 log(N / ∈)]. s represents the maximum number of non-zero elements in each row or column of the coefficient matrix. It can be seen that the method provided in the embodiment of the present application greatly optimizes the dependence of the algorithm complexity on the calculation accuracy ∈, and can speed up the solution of the linear system. In addition, the algorithm can be applied to real quantum computers at this stage.
[0206] In this application, if A 2 is a Hermitian matrix, and ‖A 2 ‖ max ≤1, the above steps S103-S104 can be used to process directly. 2 It is not Hermitian. The second linear equation system to be solved can be transformed into a form containing Hermitian matrices as follows:
[0207]
[0208] Based on the above method, the form of the Hermitian matrix corresponding to the second linear equation system to be solved can be obtained, that is: Subsequent steps can be based on S103-S104. to be processed.
[0209] In addition, if ‖A 2 ‖ max >1, you can also add A 2 Divide by its maximum eigenvalue to update A 2 , and follow the updated A 2 to be processed.
[0210] Accordingly, in one embodiment, the quantum bit is measured to obtain X 2The final value of B includes: measuring the quantum bit and obtaining that the registers corresponding to the first auxiliary quantum bit and the second auxiliary quantum bit are both in the state of |0>. 2 The measurement result of the register corresponding to the corresponding qubit. Based on the obtained measurement result, we get X 2 The final value of .
[0211] In the embodiment of the present application, after the measurement is performed, the measurement results of the registers corresponding to the first auxiliary qubit and the second auxiliary qubit (which may be referred to as auxiliary registers) and B 2 The measurement result of the register corresponding to the corresponding qubit (which can be called the target register). If the measurement results of the auxiliary register are all |0>, it means that the measurement result of the target register at this time represents A 2 -1 Acted on quantum state |0 r >|0 m >|b>, based on which we can determine X 2 The final value of .
[0212] For example, the expected value of the real part of the determined state obtained by multiple measurements can be calculated, and based on the expected value, X can be obtained. 2 It can be understood that the expected value obtained at this time is the same as A 2 -1 B 2 Proportional to, subsequently, the expected value can be calculated by multiplying it by α obtained when constructing the Chebyshev polynomial to obtain X 2 The final value of .
[0213] In one embodiment, based on the obtained B 2 The measurement result of the register corresponding to the corresponding quantum bit is obtained 2 The final value of X is obtained based on the obtained measurement results. 2 The current candidate value; based on X 2 The current candidate value is used to calculate the residual corresponding to the second linear equation group to be solved; if the calculated residual satisfies the first termination condition, then based on X 2 The current candidate value determines X 2 Otherwise, an iterative operation is performed based on the calculated residual, and X is determined based on the result of the iterative operation. 2 The final value of .
[0214] In the embodiment of the present application, for A 2 X 2 =B 2 , after measuring the expected value (i.e. X 2 The current candidate value) can be calculated 2The current candidate value is the same as A 2 and calculate the product of this product and B 2 If the difference is less than the preset threshold (i.e. the above-mentioned preset accuracy value), it can be determined that the first termination condition is met, and X 2 The current candidate value is determined to be X 2 The final value of .
[0215] Otherwise, construct the second linear equation system A to be solved 2 X 3 =B 3 , where B 3 represents the residual obtained in the last calculation, and calculates X again based on the method of steps S103-S104 3 The current candidate value, and continue to judge X 3 Does the current candidate value meet the first termination condition? If so, calculate X 2 The current candidate value is the same as X 3 The sum of the current candidate values is used as X 2 The final value of; if not, then construct the second linear equation system A to be solved 2 X 4 =B 4 , where B 4 represents the residual obtained in the last calculation, and calculates X again based on the method of steps S103-S104 4 The current candidate value, and continue to judge X 4 Whether the current candidate value meets the first termination condition. And so on, until the calculated residual meets the first termination condition.
[0216] In one embodiment, the first number is determined based on a fourth formula, which is: r=logM. Wherein r represents the first number, M represents A 2 The number of terms contained in the Chebyshev polynomial corresponding to the inverse matrix of , that is, the number of orders contained (which can be called the order).
[0217] The second number is determined based on the fifth formula, which is: m=log4N. m represents the second number, and N represents A 2 Dimension.
[0218] In one embodiment, X can also be calculated based on the subspace algorithm. 2 The final value of X is restored 1 The dimension of X 1 The current candidate value; based on X 1 The current candidate value is used to calculate the residual corresponding to the first linear equation to be solved; if the calculated residual satisfies the second termination condition, X 1 The current candidate value is determined to be X1 The final value of .
[0219] In the embodiment of the present application, based on the subspace algorithm, X 2 The final value of X is restored 1 The dimension of X 1 The current candidate value, then, can be calculated 1 The current candidate value is the same as A 1 and calculate the product of this product and B 1 If the difference is less than the preset threshold (i.e. the above-mentioned preset accuracy value), it can be determined that the second termination condition is met, and X 1 The current candidate value is determined to be X 1 The final value of .
[0220] See also Figure 2 , Figure 2 A schematic diagram of a quantum circuit provided in an embodiment of the present application.
[0221] reg.a represents the register corresponding to the first number of first auxiliary qubits, and r represents the first number; reg.b represents the register corresponding to the second number of second auxiliary qubits, and m represents the second number. The initial states of the first auxiliary qubit and the second auxiliary qubit are both |0>. reg.c represents B 2 The corresponding quantum bit corresponds to the register, |b> represents B 2 The initial state of the corresponding quantum bit. W g , And V simulates A 2 The inverse matrix of is evolved, and finally when the register corresponding to the first auxiliary quantum bit and the register corresponding to the second auxiliary quantum bit are both measured |0>, we can get B 2 The result of the register corresponding to the corresponding quantum bit, that is, |X> in the figure, can also be used to obtain the solution to the second set of linear equations to be solved.
[0222] Based on the same inventive concept, the present application also provides a simulation device based on quantum circuits, see Figure 3 , Figure 3 A structural diagram of a simulation device based on a quantum circuit provided in an embodiment of the present application, the device comprising:
[0223] The acquisition module 301 is used to acquire the first linear equation system A to be solved. 1 X 1 =B 1 ;X 1 Represents the physical quantity to be solved of the target system;
[0224] The projection module 302 is used to project the first linear equation system to be solved to a preset subspace to obtain a second linear equation system A to be solved. 2 X 2 =B 2 ; Wherein, the dimension of the preset subspace is less than X 1 Dimensions;
[0225] The evolution module 303 is used to perform quantum state evolution operations on the quantum bits based on the constructed quantum circuit, and measure the quantum bits to obtain X 2 The final value of; wherein the quantum circuit is based on A 2 The inverse matrix of the quantum circuit is constructed by the Chebyshev polynomial corresponding to the inverse matrix of the quantum circuit. The input of the quantum circuit includes B 2 The initial state of the corresponding quantum bit;
[0226] Restoration module 304, used to restore X 2 The final value of X is restored 1 The dimension of X 1 The final value of .
[0227] Optionally, the target system represents a fluid, X 1 represents the difference between the state of the fluid to be solved at one moment and the previous moment for each grid unit in the discretized network of the fluid; B 1 A represents the residual amount related to the fluid state to be solved at the previous moment and the coordinate information of the grid unit; 1 Represents a coefficient matrix related to the fluid state to be solved at the previous moment and the coordinate information of the grid unit.
[0228] Optionally, the device further comprises:
[0229] A construction module is used to perform a quantum state evolution operation on a quantum bit in the quantum circuit based on the construction, and measure the quantum bit to obtain X 2 Before the final value of 2 Each order of the Chebyshev polynomials corresponding to the inverse matrix;
[0230] The first formula is:
[0231]
[0232] in,
[0233]
[0234] A 2 -1 Indicates A 2 The inverse matrix of Indicates A2 The g-th order of the Chebyshev polynomial corresponding to the inverse matrix of ; b=κ 2 log(κ / ∈), κ represents the condition number; ∈ represents the preset precision value; C represents the number of combinations.
[0235] Optionally, the quantum circuit includes a first Oracle and a second Oracle;
[0236] The first Oracle is used to implement the quantum walk algorithm. 2 Each order of the Chebyshev polynomial corresponding to the inverse matrix of is encoded into B 2 The amplitude of the initial state of the corresponding quantum bit;
[0237] The second Oracle is used to implement the encoding result based on the operator linear combination algorithm and the first Oracle, and converts A 2 The weighted sum of the Chebyshev polynomials of each order corresponding to the inverse matrix of is encoded into B 2 The amplitude of the initial state of the corresponding quantum bit.
[0238] Optionally, the input of the quantum circuit further includes a first number of first auxiliary quantum bits and a second number of second auxiliary quantum bits;
[0239] The first Oracle is used to implement A based on the second formula 2 Each order of the Chebyshev polynomial corresponding to the inverse matrix of is encoded into B 2 The amplitude of the initial state of the corresponding quantum bit;
[0240] The second formula is:
[0241] in, Operator is used to implement the |0 m >|B 2 >To Mapping of Π|Φ ⊥ >=0,
[0242] d means A 2 The sparsity of A 2jk Indicates A 2 The element in the jth row and kth column of N stands for A 2 Dimensions; Operator is used to implement the |0 m >|ψ j > to T|ψ j > mapping; Indicates the calculation of tensor product; I represents the identity matrix; |0 m > represents the second number of second auxiliary quantum bits; |B 2 > indicates B 2 The initial state of the corresponding quantum bit; represents the Hermitian conjugation operator; W g represents the W operator corresponding to the g-th order of the Chebyshev polynomial;
[0243] The second Oracle is used to implement A based on the third formula 2 The weighted sum of the Chebyshev polynomials of each order corresponding to the inverse matrix of is encoded into B 2 The amplitude of the initial state of the corresponding quantum bit;
[0244] The third formula is:
[0245] The G operator is used to implement the operation from |0 r >|0 m >|B 2 >To The mapping of |Ψ ⊥ >Orthogonal to T|j>; |0 r > represents the first number of first auxiliary qubits; α=∑ g α g .
[0246] Optionally, the first number is determined based on a fourth formula, and the fourth formula is:
[0247] r=logM
[0248] Wherein, r represents the first number, M represents A 2 The order of the Chebyshev polynomial corresponding to the inverse matrix of ;
[0249] The second number is determined based on a fifth formula, which is:
[0250] m=log4N
[0251] m represents the second number.
[0252] Optionally, the evolution module 303 includes:
[0253] The measurement submodule is used to measure the qubit and obtain that when the registers corresponding to the first auxiliary qubit and the second auxiliary qubit are both in the |0> state, B 2 The measurement result of the register corresponding to the corresponding qubit;
[0254] The generation submodule is used to obtain X based on the obtained measurement results. 2 The final value of .
[0255] Optionally, the generating submodule is specifically configured to obtain X based on the obtained measurement result. 2 The current candidate value;
[0256] X-based 2 The current candidate value is used to calculate the residual corresponding to the second linear equation system to be solved;
[0257] If the calculated residual meets the first termination condition, then based on X 2 The current candidate value determines X 2 The final value of
[0258] If the calculated residual does not meet the first termination condition, an iterative operation is performed based on the calculated residual, and X is determined based on the result of the iterative operation. 2 The final value of .
[0259] Optionally, the restoration module is specifically configured to convert X 2 The final value of X is restored 1 The dimension of X 1 The final value of; the sixth formula is:
[0260] X 1 =X 0 +V D X 2
[0261] Among them, X 0 represents the initial solution when performing projection; V D Represents a set of bases of the preset subspace determined when performing projection.
[0262] An embodiment of the present application further provides a quantum computer device, including: a quantum circuit and a register, wherein the quantum computer device implements any of the above-mentioned methods when running.
[0263] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.
[0264] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0265] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, quantum computer device, and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0266] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A simulation method based on quantum circuits, characterized in that: The method comprises: Obtain the first linear equation group A1X1=B1 to be solved; X1 represents the physical quantity to be solved of the target system; Projecting the first linear equation system to be solved to a preset subspace to obtain a second linear equation system to be solved A2X2=B2; wherein the dimension of the preset subspace is smaller than the dimension of X1; Performing quantum state evolution operations on quantum bits based on the constructed quantum circuit, and measuring the quantum bits to obtain a final value of X2; wherein the quantum circuit is constructed based on the Chebyshev polynomial corresponding to the inverse matrix of A2; and the input of the quantum circuit includes the initial state of the quantum bit corresponding to B2; Restore the final value of X2 to the dimension of X1 to obtain the final value of X1.
2. The method according to claim 1, characterized in that The target system represents a fluid, X1 represents the difference between the state of the fluid to be solved at one moment and the previous moment for each grid unit in the discretized network of the fluid; B1 represents the residual amount related to the state of the fluid to be solved at the previous moment and the coordinate information of the grid unit; A1 represents the coefficient matrix related to the state of the fluid to be solved at the previous moment and the coordinate information of the grid unit.
3. The method according to claim 1, characterized in that Before performing a quantum state evolution operation on a quantum bit based on the constructed quantum circuit and measuring the quantum bit to obtain a final value of X2, the method further includes: Based on the first formula, construct each order of the Chebyshev polynomial corresponding to the inverse matrix of A2; The first formula is: in, A2 -1 represents the inverse matrix of A2; represents the g-th order of the Chebyshev polynomial corresponding to the inverse matrix of A2; b=κ 2 log(κ / ∈), κ represents the condition number; ∈ represents the preset precision value; C represents the number of combinations to be found.
4. The method according to claim 1, characterized in that: The quantum circuit includes a first Oracle and a second Oracle; The first Oracle is used to implement the quantum walk algorithm, encoding each order of the Chebyshev polynomial corresponding to the inverse matrix of A2 into the amplitude of the initial state of the quantum bit corresponding to B2; The second Oracle is used to implement the encoding result based on the operator linear combination algorithm and the first Oracle, and encode the weighted sum of each order of the Chebyshev polynomial corresponding to the inverse matrix of A2 to the amplitude of the initial state of the quantum bit corresponding to B2.
5. The method according to claim 4, characterized in that The input of the quantum circuit also includes a first number of first auxiliary quantum bits and a second number of second auxiliary quantum bits; The first Oracle is used to implement encoding of each order of the Chebyshev polynomial corresponding to the inverse matrix of A2 to the amplitude of the initial state of the quantum bit corresponding to B2 based on the second formula; The second formula is: in, Operator is used to implement the |0 m >|B2>To Mapping of Π|Φ ⊥ >=0, S:=S|j,k>=|k,j>; T:=∑ j∈[N] |ψ j > <j|, d represents the sparsity of A2; represents the element in row j and column k of A2, and satisfies N represents the dimension of A2; the O operator is used to implement the conversion from |0 m >|ψ j > to T|ψ j > mapping; Indicates the calculation of tensor product; I represents the identity matrix; |0 m > represents the second number of second auxiliary quantum bits; |B2> represents the initial state of the quantum bit corresponding to B2; represents the Hermitian conjugation operator; W g represents the W operator corresponding to the g-th order of the Chebyshev polynomial; The second Oracle is used to implement encoding of the weighted sum of each order of the Chebyshev polynomial corresponding to the inverse matrix of A2 into the amplitude of the initial state of the quantum bit corresponding to B2 based on the third formula; The third formula is: The G operator is used to implement the operation from |0 r >|0 m >|B2>To The mapping of |Ψ ⊥ >Orthogonal to T|j>; |0 r > represents the first number of first auxiliary qubits; α=∑ g α g .
6. The method according to claim 5, characterized in that The first number is determined based on a fourth formula, which is: r=logM Wherein, r represents the first number, and M represents the order of the Chebyshev polynomial corresponding to the inverse matrix of A2; The second number is determined based on a fifth formula, which is: m=log4N m represents the second number.
7. The method according to claim 5, characterized in that The measuring the quantum bit to obtain a final value of X2 includes: Measuring the qubit to obtain a measurement result of the register corresponding to the qubit corresponding to B2 when the registers corresponding to the first auxiliary qubit and the second auxiliary qubit are both in the |0> state; Based on the obtained measurement results, the final value of X2 is obtained.
8. The method according to claim 7, characterized in that The method of obtaining a final value of X2 based on the obtained measurement result includes: Based on the obtained measurement results, obtain the current candidate value of X2; Based on the current candidate value of X2, calculate the residual corresponding to the second linear equation system to be solved; If the calculated residual meets the first termination condition, the final value of X2 is determined based on the current candidate value of X2; If the calculated residual does not satisfy the first termination condition, an iterative operation is performed based on the calculated residual, and a final value of X2 is determined based on a result of the iterative operation.
9. The method according to claim 1, characterized in that: The method of restoring the final value of X2 to the dimension of X1 to obtain the final value of X1 includes: According to the sixth formula, the final value of X2 is restored to the dimension of X1 to obtain the final value of X1; the sixth formula is: X1=X 0 +V D X2 Among them, X 0 represents the initial solution when performing projection; V D Represents a set of bases of the preset subspace determined when performing projection.
10. A simulation device based on quantum circuits, characterized in that: The device comprises: An acquisition module, used for acquiring a first linear equation group A1X1=B1 to be solved; X1 represents a physical quantity to be solved of the target system; A projection module, used for projecting the first linear equation group to be solved to a preset subspace to obtain a second linear equation group to be solved A2X2=B2; wherein the dimension of the preset subspace is smaller than the dimension of X1; An evolution module, used to perform quantum state evolution operations on quantum bits based on a constructed quantum circuit, and measure the quantum bits to obtain a final value of X2; wherein the quantum circuit is constructed based on the Chebyshev polynomial corresponding to the inverse matrix of A2; and the input of the quantum circuit includes the initial state of the quantum bit corresponding to B2; The restoration module is used to restore the final value of X2 to the dimension of X1 to obtain the final value of X1.
11. A quantum computer device, characterized in that: include: Quantum circuits and registers, the quantum computer device implements the method described in any one of claims 1 to 9 when running.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Circuit design method and system for improving quantum calculation efficiency
CN112966456A
Computational fluid dynamics simulation method and device based on quantum algorithm, and equipment
CN114091363A
Grid equation and physical equation coupled quantum solving method and device
CN115618663A
Linear system solving method and device based on quantum circuit, medium and equipment
CN116070707A
Method for establishing ultra wide band class i chebyshev multi-section wilkinson power divider having equal ripple isolation characteristic
US20210203050A1
