Method and apparatus for solving linear equations using variational quantum circuits

By constructing and updating parameters using variable quantum circuits, the problem of high complexity in solving linear equation systems was solved, achieving fast and accurate solutions and filling a technological gap in the field of quantum computing.

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

Patent Information

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

AI Technical Summary

Technical Problem

Existing methods for solving linear equations are highly complex, time-consuming, and computationally difficult to find exact solutions, and existing quantum computing methods cannot effectively address these issues.

Method used

By employing variable quantum circuits, and by constructing variable quantum circuits and obtaining approximate solutions corresponding to variational parameters, a loss function is constructed to determine the accuracy. The variational parameters are then updated until the accuracy requirements are met, thereby reducing the complexity of solving linear equation systems.

Benefits of technology

It reduces the complexity and difficulty of solving linear equation systems, achieves fast and accurate solutions, and fills a technological gap in the field of quantum computing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116976448B_ABST
    Figure CN116976448B_ABST
Patent Text Reader

Abstract

The application discloses a method and device for solving linear equations by using a variational quantum circuit, and the method comprises the following steps: firstly, determining a linear equation group to be solved, constructing a variational quantum circuit, and obtaining an approximate solution of the linear equation group corresponding to variational parameters; then, constructing a loss function according to the approximate solution and judging whether the value of the loss function meets the accuracy; if yes, taking the approximate solution as a target solution of the linear equation group; otherwise, updating the variational parameters, obtaining an approximate solution of the linear equation group corresponding to the updated variational parameters, and continuing to execute the steps of constructing the variational quantum circuit and obtaining the approximate solution of the linear equation group corresponding to the variational parameters until the approximate solution meeting the accuracy of the value of the loss function is obtained as the target solution of the linear equation group to be solved. By using the variational quantum circuit, the technical solution for calculating the linear equation group can be realized, the complexity and difficulty of solving the linear equation group are reduced, and the related technical blank in the field of quantum calculation is filled.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of quantum computing technology, and in particular to a method and apparatus for solving linear equations using variable quantum circuits. Background Technology

[0002] The study of general linear equation systems (including linear equation systems derived from partial differential equation systems) for application purposes or against the background of problems in other disciplines such as physics and mechanics is not only a major part of traditional applied mathematics, but also an important component of contemporary mathematics. It serves as a crucial bridge between mathematical theory and practical applications.

[0003] Solving linear equations is involved in many scientific and technological fields (such as fluid mechanics, finance, biology, and chemistry). Therefore, developing effective techniques and methods for solving linear equations is crucial, and research on how to solve linear equations accurately and quickly has shown significant theoretical and applied value. Quantum computing is a novel computing method that uses quantum mechanics theory to construct a computational framework. When solving certain problems, quantum computing offers exponential speedups compared to optimal classical algorithms.

[0004] Existing methods for solving linear equation systems are complex, time-consuming, and computationally difficult to find exact solutions, which is a problem that urgently needs to be solved. Summary of the Invention

[0005] The purpose of this invention is to provide a method and apparatus for solving linear equations using variable quantum circuits, thereby overcoming the shortcomings of the prior art. It can realize the calculation of linear equations using variable quantum circuits, reduce the complexity and difficulty of solving linear equations, and fill the technological gap in the field of quantum computing.

[0006] One embodiment of this application provides a method for solving a system of linear equations using a variable quantum circuit, the method comprising:

[0007] Identify the system of linear equations to be solved;

[0008] Construct a variable quantum circuit and obtain an approximate solution to the linear equation system corresponding to the variational parameters;

[0009] Construct a loss function based on the approximate solution and determine whether the value of the loss function meets the required precision.

[0010] If so, the approximate solution is taken as the target solution of the linear equation system; otherwise, the variational parameters are updated, the approximate solution of the linear equation system corresponding to the updated variational parameters is obtained, and the steps of constructing the variational quantum circuit and obtaining the approximate solution of the linear equation system corresponding to the variational parameters are continued until an approximate solution that satisfies the accuracy of the loss function is obtained, which is taken as the target solution of the linear equation system to be solved.

[0011] Optionally, determining the system of linear equations to be solved includes:

[0012] Obtain the initial conditions, boundary conditions, the system of partial differential equations to be solved, and their computational domain;

[0013] Discretize the initial conditions, boundary conditions and the computational domain to obtain the discretized algebraic equation system corresponding to the partial differential equation system to be solved.

[0014] Based on the discretized algebraic equations, the linear equations to be solved are determined.

[0015] Optionally, the step of constructing the variational quantum circuit and obtaining an approximate solution to the linear equation system corresponding to the variational parameters includes:

[0016] A first sub-quantum circuit and a second sub-quantum circuit are constructed respectively to form a variable sub-quantum circuit, wherein the first sub-quantum circuit is used to form a sub-quantum state containing an approximate solution of the linear equation system, and the second sub-quantum circuit is used to obtain the value of the loss function and / or the gradient of the loss function;

[0017] The variational quantum circuit is measured to obtain the final quantum state corresponding to the variational parameters, and the approximate solution of the linear equation system is determined.

[0018] Optionally, determining an approximate solution to the system of linear equations includes:

[0019] Obtain the pre-constructed Hamiltonian;

[0020] Determine the expected value of the Hamiltonian based on the final quantum state;

[0021] The approximate solution to the system of linear equations is determined based on the expected value.

[0022] Optionally, the loss function is:

[0023]

[0024] Among them, the For the loss function, the Let A be the coefficient matrix of the linear equation system, b be the vector of the linear equation system, and I be the identity matrix. and U is a parametric quantum logic gate.

[0025] Optionally, the updated variational parameters include:

[0026] The variational parameters are updated using the following formula.

[0027]

[0028] Where k is an integer not less than 1, and β is the learning rate. Let θ be the gradient of the loss function with respect to θ.

[0029] Another embodiment of this application provides an apparatus for solving a system of linear equations using a variable quantum circuit, the apparatus comprising:

[0030] The determination module is used to determine the system of linear equations to be solved.

[0031] The module is used to construct the variational quantum circuit and obtain the approximate solution of the linear equation system corresponding to the variational parameters;

[0032] The judgment module is used to construct a loss function based on the approximate solution and determine whether the value of the loss function meets the accuracy requirement;

[0033] The module is used to, if yes, take the approximate solution as the target solution of the linear equation system; otherwise, update the variational parameters, obtain the approximate solution of the linear equation system corresponding to the updated variational parameters, and continue to execute the steps of constructing the variational quantum circuit and obtaining the approximate solution of the linear equation system corresponding to the variational parameters until an approximate solution that satisfies the accuracy of the loss function is obtained, which is then taken as the target solution of the linear equation system to be solved.

[0034] Optionally, the determining module includes:

[0035] The acquisition unit is used to acquire initial conditions, boundary conditions, the system of partial differential equations to be solved, and their computational domain;

[0036] Discrete unit, used to discretize the initial conditions, boundary conditions and the computational domain to obtain the discretized algebraic equation system corresponding to the partial differential equation system to be solved;

[0037] The determining unit is used to determine the linear equation system to be solved based on the discretized algebraic equation system.

[0038] Optionally, the building module includes:

[0039] A construction unit is used to construct a first sub-quantum circuit and a second sub-quantum circuit respectively to form a variable quantum circuit, wherein the first sub-quantum circuit is used to form a sub-quantum state containing an approximate solution of the linear equation system, and the second sub-quantum circuit is used to obtain the value of the loss function and / or the gradient of the loss function;

[0040] The measurement unit is used to measure the variational quantum circuit, obtain the final quantum state corresponding to the variational parameters, and determine the approximate solution of the linear equation system.

[0041] Optionally, the measuring unit includes:

[0042] Obtain sub-units to obtain pre-constructed Hamiltonians;

[0043] The first determining subunit is used to determine the expected value corresponding to the Hamiltonian based on the final quantum state;

[0044] The second determining subunit is used to determine an approximate solution to the linear equation system based on the expected value.

[0045] Another embodiment of this application provides a storage medium storing a computer program, wherein the computer program is configured to execute the method described in any of the preceding claims when running.

[0046] 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.

[0047] Compared with existing technologies, this invention first identifies the system of linear equations to be solved, constructs a variable quantum circuit, and obtains an approximate solution to the system of linear equations corresponding to the variational parameters. Then, it constructs a loss function based on the approximate solution and determines whether the value of the loss function meets the required precision. If so, the approximate solution is used as the target solution of the system of linear equations; otherwise, the variational parameters are updated, and an approximate solution to the system of linear equations corresponding to the updated variational parameters is obtained. The process of constructing the variable quantum circuit and obtaining an approximate solution to the system of linear equations corresponding to the variational parameters continues until an approximate solution whose value of the loss function meets the required precision is obtained, which is then used as the target solution of the system of linear equations to be solved. By utilizing the variable quantum circuit, this invention enables the computation of linear equations, reducing the complexity and difficulty of solving linear equations and filling a technological gap in the field of quantum computing. Attached Figure Description

[0048] Figure 1 This is a hardware structure block diagram of a computer terminal for a method of solving linear equations using variable quantum circuits, provided in an embodiment of the present invention.

[0049] Figure 2 This is a flowchart illustrating a method for solving a system of linear equations using variable quantum circuits, as provided in an embodiment of the present invention.

[0050] Figure 3 A schematic diagram of a first sub-quantum circuit provided in an embodiment of the present invention;

[0051] Figure 4 A schematic diagram of a second sub-quantum circuit provided in an embodiment of the present invention;

[0052] Figure 5 This is a schematic diagram of a device for solving linear equations using variable quantum circuits, provided in an embodiment of the present invention. Detailed Implementation

[0053] 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.

[0054] This invention first provides a method for solving linear equations using variable quantum circuits. This method can be applied to electronic devices, such as computer terminals, specifically ordinary computers and quantum computers.

[0055] 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 solving a system of linear equations using variable quantum circuits, as provided in an embodiment of the present invention. Figure 1 As shown, a computer terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. Optionally, the computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, the computer terminal may also include components that are more complex than those described above. Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0056] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / modules corresponding to the method of solving linear equations using variable quantum circuits in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0057] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the computer terminal. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0058] It's important to note that a true quantum computer has a hybrid structure, comprising two main parts: a classical computer responsible for performing classical computations and control, and a quantum device responsible for running quantum programs to achieve quantum computation. A quantum program is a sequence of instructions written in a quantum language such as QRunes that can run on a quantum computer, supporting operations on quantum logic gates and ultimately enabling quantum computing. Specifically, a quantum program is a sequence of instructions that operates on quantum logic gates according to a specific timing order.

[0059] In practical applications, due to limitations in the development of quantum device hardware, quantum computing simulations are often required to verify quantum algorithms, quantum applications, and so on. Quantum computing simulation is the process of simulating the execution of a quantum program corresponding to a specific problem using a virtual architecture (i.e., a quantum virtual machine) built with the resources of a regular computer. Typically, it is necessary to construct a quantum program corresponding to a specific problem. The quantum program referred to in this embodiment of the invention is a program written in a classical language that represents qubits and their evolution, wherein qubits, quantum logic gates, etc., related to quantum computing all have corresponding classical code representations.

[0060] Quantum circuits, also known as quantum logic circuits, are a common manifestation of quantum programming and are the most widely used general-purpose quantum computing model. They represent circuits that operate on qubits under an abstract concept. They consist of qubits, circuits (timelines), and various quantum logic gates. Finally, the results are often read out through quantum measurement operations.

[0061] Unlike traditional circuits that use metal wires to transmit voltage or current signals, in quantum circuits, the circuits can be seen as being connected by time. That is, the state of a quantum bit evolves naturally over time, following the instructions of the Hamiltonian operator until it encounters a logic gate and is operated on.

[0062] A quantum program corresponds to a single quantum circuit. The quantum program described in this invention refers to this single quantum circuit, where the total number of qubits in the single quantum circuit is the same as the total number of qubits in the quantum program. This can be understood as follows: a quantum program can consist of a quantum circuit, measurement operations on the qubits within the quantum circuit, registers for storing measurement results, and control flow nodes (jump instructions). A single quantum circuit can contain dozens, hundreds, or even thousands of quantum logic gate operations. The execution of a quantum program is the process of executing all the quantum logic gates in a specific timing order. It should be noted that the timing order refers to the chronological sequence in which individual quantum logic gates are executed.

[0063] It's important to note that in classical computing, the most basic unit is the bit, and the most fundamental control mode is the logic gate. Circuit control can be achieved through combinations of logic gates. Similarly, the way to process qubits is through quantum logic gates. Quantum logic gates enable the evolution of quantum states and are the foundation of quantum circuits. Quantum logic gates include single-qubit gates, such as Hadamard gates (H-gates), Pauli-X gates (X-gates), Pauli-Y gates (Y-gates), Pauli-Z gates (Z-gates), RX gates, RY gates, RZ gates, etc.; and multi-qubit quantum logic gates, such as CNOT gates, CR gates, iSWAP gates, Tofoli gates, etc. Quantum logic gates are generally represented using unitary matrices, which are not only matrix forms but also operations and transformations. The effect of a quantum logic gate on a quantum state is generally calculated by left-multiplying the unitary matrix by the matrix corresponding to the right vector of the quantum state.

[0064] As those skilled in the art will understand, in classical computers, the basic unit of information is the bit, which has two states: 0 and 1. The most common physical implementation uses high and low voltage levels to represent these states. In quantum computing, the basic unit of information is the qubit, which also has two states: 0 and 1, denoted as |0> and |1>. However, it can exist in a superposition of these two states, which can be represented as... Here, a and b are complex numbers representing the amplitudes (probability amplitudes) of the |0> and |1> states, respectively, which is not present in classical bits. After measurement, the state of a quantum bit collapses to a definite state (eigenstate, here |0> and |1>), where the probability of collapsing to |0> is |a|. 2 The probability of collapsing to |1> is |b|. 2 , |a| 2 +|b| 2 =1, |> is the Dirac notation.

[0065] A quantum state refers to the state of a qubit (or quantum bit). Its eigenstates are represented in binary form in quantum algorithms (or quantum programs). For example, a set of qubits q0, q1, and q2, representing the 0th, 1st, and 2nd qubits respectively, ordered from most significant bit to least significant bit as q2q1q0, has a quantum state of 2q1q ... 3 A quantum state is a superposition of 8 eigenstates. The 8 eigenstates (definite states) are: |000>, |001>, |010>, |011>, |100>, |101>, |110>, and |111>. Each eigenstate corresponds to a qubit. For example, in the |000> state, 000 corresponds to q2q1q0 from the highest to the lowest bit. In short, a quantum state is a superposition of eigenstates. When the probability amplitude of other states is 0, the state is in one of the definite eigenstates.

[0066] Current quantum computing-based finite volume methods use the Hierarchical High-Limited-Lower ...

[0067] This application combines the variational quantum algorithm with the finite volume method, employing a method that uses a variational quantum linear solver to accelerate the solution of classical computational fluid dynamics problems. Because the variational quantum algorithm requires fewer qubits and its constructed variational quantum circuitry is relatively simple, it can be used to interface with current quantum computers for computation, thus making it possible to solve classical CFD problems using real quantum computers.

[0068] See Figure 2 , Figure 2 A flowchart illustrating a method for solving a system of linear equations using variable quantum circuits, provided in an embodiment of the present invention, may include the following steps:

[0069] S201: Determine the system of linear equations to be solved.

[0070] Specifically, determining the system of linear equations to be solved can include:

[0071] Step 1: Obtain the initial conditions, boundary conditions, the system of partial differential equations to be solved, and their computational domain.

[0072] Specifically, a system of linear equations to be solved can be derived from a system of partial differential equations through discretization. If a system of differential equations contains partial derivatives of multivariable functions, or if the unknown function is related to several variables and the system contains derivatives of the unknown function with respect to those variables, then this system of differential equations is a partial differential equation system. Partial differential equations are an important branch of modern mathematics. Both in theory and in practical applications, partial differential equations are used to describe problems in mechanics, control processes, ecological and economic systems, chemical cycle systems, and epidemiology.

[0073] In general, there are multiple solutions to a system of partial differential equations. However, when solving a specific physical problem, it is necessary to select the solution that is required. Therefore, it is also necessary to know the additional conditions, namely the initial conditions, boundary conditions and their computational domain.

[0074] Step 2: Discretize the initial conditions, boundary conditions, and computational domain to obtain the discretized algebraic equation system corresponding to the partial differential equation system to be solved.

[0075] Specifically, to compute a system of partial differential equations, the computational domain must first be discretized. This involves dividing the spatially continuous computational domain into many sub-regions and determining the nodes in each region, thus generating a grid. The partial differential equations are then discretized on this grid, transforming the partial differential equations into a system of algebraic equations at each node. Due to different assumptions about the distribution of the dependent variable between nodes and different methods for deriving the discretization equations, different types of discretization methods have emerged, such as the finite difference method and the finite volume method.

[0076] For example, the finite difference method is used to discretize the partial differential equation system. The computational domain is replaced by a grid composed of a finite number of discrete points, and the function of the continuous variable in the computational domain is applied to the grid to obtain the discretized algebraic equation system, which is the finite difference equation system.

[0077] Step 3: Based on the discretized algebraic equation system, determine the linear equation system to be solved.

[0078] Specifically, the discretized algebraic equations are transformed into a linear equations to be solved.

[0079] For example, consider the steady-state, incompressible Navier-Stokes equations:

[0080]

[0081] Where U is the velocity vector unknown for each grid, and ρ is the density. Let ν be the pressure gradient and ν be the kinetic viscosity. Let g be the velocity gradient, and g be the gravitational term.

[0082] We can discretize the equation using a three-dimensional polyhedral mesh. In order to solve the Navier-Stokes equation using the SIMPLE algorithm, we need to rewrite the equation in the following matrix form:

[0083] AU = b

[0084] Where A is the coefficient matrix, U is the velocity vector unknown for each grid, and b is the right-hand side term (a known vector).

[0085] In the second-order finite volume method, the flow variables (p, T, U) vary along the grid lines. These flow variables, including pressure, temperature, velocity, etc., are stored at the grid center P. Similarly, adjacent grids need to be considered. Typically, each grid has M adjacent grids, and the flow variables are stored at the grid centers N.

[0086] First, we need to integrate the above Navier-Stokes equations along the grid center P to obtain:

[0087]

[0088] Where V is the mesh volume.

[0089] By using integral addition to separate the different terms in the parentheses of the above expression and integrating them one by one, we obtain:

[0090]

[0091] in, Represents the convection term. Represents the pressure gradient term, Represents the diffusion term, ∫ V [g]dV represents the source term, i.e., the gravity term.

[0092] For the source term ∫ V Since the gravitational acceleration g is constant, [g]dV can be moved outside the integral sign, resulting in:

[0093] ∫ V [g]dV=gV p

[0094] Among them, V p Let be the volume of the grid.

[0095] It should be noted that gradient calculations are involved in the convection and diffusion terms, which are difficult to handle. The following mainly introduces the method for handling the convection term. The method for handling the diffusion term is similar, so it will not be repeated.

[0096]

[0097] The divergence theorem is generally used to handle convection terms. The divergence theorem states that the integral of the divergence gradient of any vector is equivalent to the surface integral of the vector, i.e.:

[0098]

[0099] Therefore, by modifying the convection and diffusion terms using the divergence theorem, the integral can be calculated to obtain:

[0100]

[0101] The dot product of the velocity unit normal vector and the surface is the volumetric flow rate flowing out of the surface, i.e.:

[0102] Here, the velocity U is the quantity that needs to be solved, which can be decomposed into a surface integral, i.e.:

[0103]

[0104] The velocity changes linearly along the surface, therefore it can be determined by taking the velocity U at the center of the surface. fi As an approximation of the surface integral of velocity, we obtain:

[0105]

[0106] Where M is the number of adjacent grid cells.

[0107] The integral can be eliminated using the method described above; only summation is needed. However, due to U... fi Since it is unknown, interpolation is still required for calculation, such as using upwind schemes, second-order / linear upwind schemes, central difference schemes, QUICK interpolation methods to solve for the surface velocity U. fi Therefore, the convection term can be written as:

[0108]

[0109] As shown below, convection terms result in diagonal and off-diagonal terms, which reflects the connectivity between adjacent grids:

[0110]

[0111] Therefore, each term in the Navier-Stokes equation can be integrated one by one, and each term contributes differently to matrix A. These contributions need to be added together to form the complete matrix form.

[0112] By using the above linear transformation method, the partial differential equation system to be processed is transformed into a linear equation system to be processed, that is: AU = b.

[0113] S202: Construct a variational quantum circuit and obtain an approximate solution to the linear equation system corresponding to the variational parameters.

[0114] Specifically, constructing variational quantum circuits and obtaining approximate solutions to the linear equations corresponding to the variational parameters can include:

[0115] 1. Construct a first sub-quantum circuit and a second sub-quantum circuit respectively to form a variable quantum circuit, wherein the first sub-quantum circuit is used to form a sub-quantum state containing an approximate solution of the linear equation system, and the second sub-quantum circuit is used to obtain the value of the loss function and / or the gradient of the loss function.

[0116] For details, see Figure 3 , Figure 3 This is a schematic diagram of a first sub-quantum circuit provided in an embodiment of the present invention. The first sub-quantum circuit can be a HEA (Hardware Efficient Ansatz) circuit, wherein each layer of the HEA circuit is composed of parametric quantum logic gates (e.g., RY quantum logic gates) and CNOT quantum logic gates. The black dots in the diagram and... The icon represents a CNOT quantum logic gate, with the black dot on the control bit of the CNOT quantum logic gate. On the target qubit of the CNOT quantum logic gate, the variational parameter is expressed as the rotation angle. The vector is composed of a single-quantum rotation connection layer and a global entanglement layer. As the number of layers increases, the expressive power of the circuit continuously improves, but it also increases the training difficulty of the circuit. The number of qubits and layers of the circuit proposed in the figure can be determined by the dimension of the linear equation system to be solved. With sufficient computing resources, the circuit can be proposed with a sufficient number of qubits and a sufficient number of layers in the HEA to ensure the solution accuracy.

[0117] 2. Measure the variational quantum circuit to obtain the final quantum state corresponding to the variational parameters, and determine the approximate solution of the linear equation system.

[0118] Before measuring a variable quantum circuit, information about its linear equations can be input. One approach is to input a linear combination of S unitary matrices into which matrix A is decomposed, so that matrix A can be encoded into the quantum circuit. Here, A can be represented as: Among them, l s Let σ be the coefficient of the linear combination. s The unitary matrix (unitary operator); another piece of information input to the variable component quantum circuit's linear equations is the unitary matrix U obtained by encoding the vector b. b unitary matrix U bTo prepare a quantum state |b> proportional to the vector b, that is, after normalizing the vector b, encode it into the quantum circuit in the form |b>=U b |0>. The solution to the linear system is expressed using the quantum state trial wave function of the variational hypothesis as follows: The solution is the ground state of the Hamiltonian as described below.

[0119] Specifically, determining an approximate solution to a system of linear equations can include:

[0120] a. Obtain the pre-constructed Hamiltonian.

[0121] b. Determine the expected value corresponding to the Hamiltonian based on the final quantum state.

[0122] c. Determine an approximate solution to the system of linear equations based on the expected value.

[0123] Specifically, after the aforementioned variable quantum circuit, the final state is obtained. To read quantum state information, a pre-constructed Hamiltonian can be used. By measuring the final state, an approximate solution to the system of linear equations can be obtained. The key to this process is the pre-constructed Hamiltonian. Expected value It is determined to be an approximate solution to the linear system of equations.

[0124] S203: Construct a loss function based on the approximate solution and determine whether the value of the loss function meets the accuracy requirements.

[0125] Specifically, the loss function is:

[0126]

[0127] Among them, the For the loss function, the Let A be the coefficient matrix of the linear equation system, b be the vector of the linear equation system, and I be the identity matrix. and U is a parametric quantum logic gate.

[0128]

[0129] In the partial derivative form of the loss function described above, it can be divided into three terms, namely: the first partial derivative term. Second partial derivative term and the third partial derivative term These three items can be measured separately through the second sub-quantum circuit, specifically:

[0130]

[0131]

[0132]

[0133] And because:

[0134]

[0135] For the purpose of measuring the second quantum circuit, Rewrite it in the following form:

[0136]

[0137] in, It is a unitary matrix.

[0138] See Figure 4 , Figure 4 This is a schematic diagram of a second sub-quantum circuit provided in an embodiment of the present invention. The specific second sub-quantum circuit mainly consists of three circuits shown in Figures (a), (b), and (c), which are used for the first partial derivative term, respectively. Second partial derivative term and the third partial derivative term The measurement is shown in the figure, where H represents the H quantum logic gate, S represents the S quantum logic gate, and U0, U0, ..., U i+1 U L This indicates the proposed U-gate. Denotes a unitary matrix, σ s Let σ' be a unitary matrix. s U represents a unitary matrix. b Let X represent the unitary matrix formed by encoding |b>, and let X represent the Pauli X gate.

[0139] To determine whether the value of the loss function meets the precision requirement, specifically:

[0140] Based on the approximate solution of the linear equation to be solved, the target solution of the system of linear equations to be solved is then obtained, mainly by using a pre-selected measurement operator. When applied to the final quantum state, an approximate solution to the system of linear equations to be solved can be obtained at the current step. This approximate solution is then substituted into the loss function, and the value of the loss function is further evaluated to determine if it meets the required precision. The precision can be set by the user according to their computational needs, for example, 10. -6 Or 0.

[0141] S204: If yes, then the approximate solution is taken as the target solution of the linear equation system; otherwise, the variational parameters are updated, the approximate solution of the linear equation system corresponding to the updated variational parameters is obtained, and the steps of constructing the variational quantum circuit and obtaining the approximate solution of the linear equation system corresponding to the variational parameters are continued until an approximate solution that satisfies the accuracy of the loss function is obtained, which is taken as the target solution of the linear equation system to be solved.

[0142] Specifically, if the value of the loss function constructed based on the approximate solution in the current step meets the preset accuracy, then the obtained approximate solution is exactly the target solution of the linear equation system to be solved; otherwise, the variational parameters in the variational quantum circuit are updated through optimization algorithms.

[0143] For example, using the traditional optimization method—gradient descent—the variational parameters are updated using the following formula.

[0144]

[0145] Where k is an integer not less than 1, and β is the learning rate. Let θ be the gradient of the loss function with respect to θ.

[0146] Then, the updated variational parameters are passed to the variational quantum circuit, and the evolution and measurement steps described above are continued. The approximate solution is updated and the loss function is solved by iterating the variational parameters until a predicted solution with the required accuracy to satisfy the loss function is obtained, which is then used as the target solution for the linear equation system to be solved.

[0147] This application discretizes the partial differential equations to be solved using the finite volume method, implicitly solves the discretized equations, inputs the resulting linear equations into a variable quantum linear circuit, and inputs the solution of the linear equations obtained by the variable quantum algorithm into classical calculations to update the flow field information. This process is repeated until the calculation is completed.

[0148] As can be seen, this invention first identifies the system of linear equations to be solved, constructs a variable quantum circuit, and obtains an approximate solution to the system of linear equations corresponding to the variational parameters. Then, it constructs a loss function based on the approximate solution and determines whether the value of the loss function meets the required precision. If so, the approximate solution is used as the target solution of the system of linear equations; otherwise, the variational parameters are updated, and an approximate solution to the system of linear equations corresponding to the updated variational parameters is obtained. The process of constructing the variable quantum circuit and obtaining an approximate solution to the system of linear equations corresponding to the variational parameters continues until an approximate solution whose value of the loss function meets the required precision is obtained, which is then used as the target solution of the system of linear equations to be solved. By utilizing the variable quantum circuit, this invention enables the computation of linear equations, reducing the complexity and difficulty of solving linear equations and filling a technological gap in the field of quantum computing.

[0149] See Figure 5 , Figure 5 This is a schematic diagram of a device for solving linear equations using variable quantum circuits, provided in an embodiment of the present invention. Figure 2 The process shown can include:

[0150] Module 501 is used to determine the system of linear equations to be solved.

[0151] Module 502 is used to construct a variational quantum circuit and obtain an approximate solution to the linear equation system corresponding to the variational parameters;

[0152] The judgment module 503 is used to construct a loss function based on the approximate solution and to judge whether the value of the loss function meets the accuracy requirement;

[0153] Module 504 is used to, if yes, take the approximate solution as the target solution of the linear equation system; otherwise, update the variational parameters, obtain the approximate solution of the linear equation system corresponding to the updated variational parameters, and continue to execute the steps of constructing the variational quantum circuit and obtaining the approximate solution of the linear equation system corresponding to the variational parameters until an approximate solution that satisfies the accuracy of the loss function is obtained, which is then taken as the target solution of the linear equation system to be solved.

[0154] Specifically, the determining module includes:

[0155] The acquisition unit is used to acquire initial conditions, boundary conditions, the system of partial differential equations to be solved, and their computational domain;

[0156] Discrete unit, used to discretize the initial conditions, boundary conditions and the computational domain to obtain the discretized algebraic equation system corresponding to the partial differential equation system to be solved;

[0157] The determining unit is used to determine the linear equation system to be solved based on the discretized algebraic equation system.

[0158] Specifically, the building module includes:

[0159] A construction unit is used to construct a first sub-quantum circuit and a second sub-quantum circuit respectively to form a variable quantum circuit, wherein the first sub-quantum circuit is used to form a sub-quantum state containing an approximate solution of the linear equation system, and the second sub-quantum circuit is used to obtain the value of the loss function and / or the gradient of the loss function;

[0160] The measurement unit is used to measure the variational quantum circuit, obtain the final quantum state corresponding to the variational parameters, and determine the approximate solution of the linear equation system.

[0161] Specifically, the measurement unit includes:

[0162] Obtain sub-units to obtain pre-constructed Hamiltonians;

[0163] The first determining subunit is used to determine the expected value corresponding to the Hamiltonian based on the final quantum state;

[0164] The second determining subunit is used to determine an approximate solution to the linear equation system based on the expected value.

[0165] Compared with existing technologies, this invention first identifies the system of linear equations to be solved, constructs a variable quantum circuit, and obtains an approximate solution to the system of linear equations corresponding to the variational parameters. Then, it constructs a loss function based on the approximate solution and determines whether the value of the loss function meets the required precision. If so, the approximate solution is used as the target solution of the system of linear equations; otherwise, the variational parameters are updated, and an approximate solution to the system of linear equations corresponding to the updated variational parameters is obtained. The process of constructing the variable quantum circuit and obtaining an approximate solution to the system of linear equations corresponding to the variational parameters continues until an approximate solution whose value of the loss function meets the required precision is obtained, which is then used as the target solution of the system of linear equations to be solved. By utilizing the variable quantum circuit, this invention enables the computation of linear equations, reducing the complexity and difficulty of solving linear equations and filling a technological gap in the field of quantum computing.

[0166] 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.

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

[0168] S201: Determine the system of linear equations to be solved;

[0169] S202: Construct a variational quantum circuit and obtain an approximate solution to the linear equation system corresponding to the variational parameters;

[0170] S203: Construct a loss function based on the approximate solution and determine whether the value of the loss function meets the required precision;

[0171] S204: If yes, then the approximate solution is taken as the target solution of the linear equation system; otherwise, the variational parameters are updated, the approximate solution of the linear equation system corresponding to the updated variational parameters is obtained, and the steps of constructing the variational quantum circuit and obtaining the approximate solution of the linear equation system corresponding to the variational parameters are continued until an approximate solution that satisfies the accuracy of the loss function is obtained, which is taken as the target solution of the linear equation system to be solved.

[0172] 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.

[0173] 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.

[0174] 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.

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

[0176] S201: Determine the system of linear equations to be solved;

[0177] S202: Construct a variational quantum circuit and obtain an approximate solution to the linear equation system corresponding to the variational parameters;

[0178] S203: Construct a loss function based on the approximate solution and determine whether the value of the loss function meets the required precision;

[0179] S204: If yes, then the approximate solution is taken as the target solution of the linear equation system; otherwise, the variational parameters are updated, the approximate solution of the linear equation system corresponding to the updated variational parameters is obtained, and the steps of constructing the variational quantum circuit and obtaining the approximate solution of the linear equation system corresponding to the variational parameters are continued until an approximate solution that satisfies the accuracy of the loss function is obtained, which is taken as the target solution of the linear equation system to be solved.

[0180] 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 a system of linear equations using variable quantum circuits, characterized in that, The method comprises the following steps: determining a linear equation group to be solved; constructing a variational quantum circuit and obtaining an approximate solution of the linear equation group corresponding to variational parameters; constructing a loss function according to the approximate solution and judging whether the value of the loss function meets the accuracy, wherein the loss function is: Wherein, the is a loss function, the is a variational parameter, the is a coefficient matrix of the linear equation group, the is a vector of the linear equation group, the is an identity matrix, the and , the is a parameterized quantum logic gate; if yes, taking the approximate solution as the target solution of the linear equation group, otherwise, updating the variational parameters, obtaining the approximate solution of the linear equation group corresponding to the updated variational parameters, and continuing to execute the step of constructing the variational quantum circuit and obtaining the approximate solution of the linear equation group corresponding to the variational parameters until the approximate solution meeting the value of the loss function meets the accuracy is obtained as the target solution of the linear equation group to be solved.

2. The method of claim 1, wherein, The step of determining the linear equation group to be solved comprises the following steps: obtaining initial conditions, boundary conditions, a partial differential equation group to be solved and a calculation domain thereof; discretizing the initial conditions, the boundary conditions and the calculation domain to obtain an algebraic equation group corresponding to the discretized partial differential equation group to be solved; determining the linear equation group to be solved according to the discretized algebraic equation group.

3. The method of claim 2, wherein, The step of constructing the variational quantum circuit and obtaining the approximate solution of the linear equation group corresponding to the variational parameters comprises the following steps: respectively constructing a first sub-quantum circuit and a second sub-quantum circuit to form a variational quantum circuit, wherein the first sub-quantum circuit is used to form a sub-quantum state containing the approximate solution of the linear equation group, and the second sub-quantum circuit is used to obtain the value of the loss function and / or the gradient of the loss function; measuring the variational quantum circuit to obtain a final quantum state corresponding to the variational parameters, and determining the approximate solution of the linear equation group.

4. The method of claim 3, wherein, The step of determining the approximate solution of the linear equation group comprises the following steps: obtaining a Hamiltonian constructed in advance; determining an expected value corresponding to the Hamiltonian according to the final quantum state; determining the approximate solution of the linear equation group according to the expected value.

5. The method according to any one of claims 1 to 4, characterized in that, The step of updating the variational parameters comprises the following steps: The variational parameters are updated by the following equation : wherein the is an integer not less than 1, is a learning rate, .

6. A device for solving a system of linear equations using variable quantum circuits, characterized in that, The device comprises: a determination module configured to determine a linear equation group to be solved; a construction module configured to construct a variational quantum circuit and obtain an approximate solution of the linear equation group corresponding to variational parameters; a judgment module configured to construct a loss function according to the approximate solution and judge whether the value of the loss function meets the accuracy, wherein the loss function is: Wherein, the is a loss function, the is a variational parameter, the is a coefficient matrix of the linear equation group, the is a vector of the linear equation group, the is an identity matrix, the and , the is a parametric quantum logic gate; a obtaining module configured to, if yes, take the approximate solution as the target solution of the linear equation group, otherwise, update the variational parameters, obtain the approximate solution of the linear equation group corresponding to the updated variational parameters, and continue to execute the step of constructing the variational quantum circuit and obtaining the approximate solution of the linear equation group corresponding to the variational parameters until the approximate solution meeting the value of the loss function meets the accuracy is obtained as the target solution of the linear equation group to be solved.

7. The apparatus of claim 6, wherein, The determination module comprises: an obtaining unit configured to obtain initial conditions, boundary conditions, a partial differential equation group to be solved and a calculation domain thereof; a discretizing unit configured to discretize the initial conditions, the boundary conditions and the calculation domain to obtain an algebraic equation group corresponding to the discretized partial differential equation group to be solved; a determination unit configured to determine the linear equation group to be solved according to the discretized algebraic equation group.

8. A storage medium, characterized by The storage medium stores a computer program, and the computer program is configured to execute the method in any one of claims 1 to 5 when running. 9.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to execute the computer program to execute the method in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Device, system, and method for solving systems of linear equations using parallel processing

    CN102855220A

  • Quantum computing simulation platform and linear equation set quantum solving simulation method and system

    CN112232512A