Quantum processing method for computer tasks and related device
By iteratively solving the residual equations and using the quantum state to classical data module, the error problem caused by noise interference on the medium-scale quantum computer was solved, the linear equations were accurately solved, and the real-world problem-solving capability of the quantum computer was enhanced.
Patent Information
- Application Number
- CN202410313292.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-19
- Publication Date
- 2025-09-19
AI Technical Summary
On mesoscale noisy quantum computers, there is obvious quantum noise interference in the quantum computing process, which makes it impossible to accurately solve linear equations and produces large errors.
By iteratively solving the residual equations, quantum circuits are used to update the preset solution until the residual vector of the linear equations meets the preset convergence conditions. The quantum state conversion module is combined with classical data to reduce the impact of noise and achieve accurate solutions.
The accurate solution of linear equations was achieved on a mesoscale noisy quantum computer, reducing quantum noise errors and improving the ability of quantum computers to solve real-world problems.
Smart Images

Figure CN120671860A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of quantum computing technology, and in particular to a quantum processing method for computer tasks and related devices. Background Art
[0002] Solving systems of linear equations is a common problem in many scientific and technological fields and physical scenarios (for example, fluid mechanics, finance, biology, and chemistry). The research on how to quickly and accurately solve these systems has shown significant theoretical and applied value, leading to the development of numerous effective techniques and methods for solving linear equations. For example, in the field of CFD (Computational Fluid Dynamics), linear equations representing fluid state changes can be constructed based on various discretized mathematical methods. This allows for numerical experiments, computer simulations, and analytical research on fluid mechanics problems, including the calculation of state information such as temperature and density at different locations in a stable fluid state.
[0003] Quantum computers are physical devices that follow the laws of quantum mechanics to perform high-speed mathematical and logical operations, store, and process quantum information. Quantum computers are a key technology under research because they can process mathematical problems more efficiently than conventional computers. For example, they can reduce the time required to crack a cryptographic key from hundreds of years to just hours. Quantum linear solvers are mathematical tools that use quantum computers to accelerate the solution of linear equations. Compared to classical solvers, the quantum algorithms they use can replace classical algorithms and provide exponential acceleration.
[0004] Therefore, quantum computers can be used to solve many real-world mathematical or physical problems. For example, by modeling the flow process of a fluid system, a computer task can be constructed to solve a large-scale system of linear equations. A quantum linear solver can then be used to run a quantum linear algorithm to obtain information about the state of the fluid system at each moment. However, on current NISQ (Noisy Intermediate Scale Quantum) computers, real quantum bits have not yet fully achieved the performance of logical bits. Significant quantum noise interference exists during quantum computing, resulting in large errors during quantum processing and making it impossible to obtain accurate solutions to linear equations. Summary of the Invention
[0005] The purpose of the present invention is to provide a quantum processing method and related device for computer tasks, which aims to reduce the errors caused by quantum noise in the quantum processing of computer tasks by iteratively solving the residual equation system, so as to achieve accurate solution of linear equation systems on current mesoscale noisy quantum computers.
[0006] One embodiment of the present invention provides a quantum processing method for a computer task, the method comprising:
[0007] Acquiring task data; wherein the task data includes a system of linear equations and preset solutions to the system of linear equations, wherein the system of linear equations is used to describe a computer task to be processed;
[0008] In the process of processing the computer task based on the iterative solution of the linear equations, the preset solution is updated based on the quantum state representing the solution of the residual equations until the residual vector of the linear equations meets the preset convergence condition.
[0009] Optionally, the quantum state representing the solution of the residual equation system is obtained by the following method:
[0010] In each iteration step, a residual equation system is determined based on a coefficient matrix of the linear equation system and a residual vector corresponding to the preset solution;
[0011] constructing a quantum circuit for solving the residual equations;
[0012] The quantum circuit is run to obtain the quantum state of the solution of the residual equation group.
[0013] Optionally, updating a preset solution of the linear equation system in a previous iteration step based on the quantum state representing the solution of the residual equation system until the residual vector of the linear equation system satisfies a preset convergence condition includes:
[0014] If the residual vector of the linear equation system does not satisfy a preset convergence condition in the current iteration step, a quantum circuit for solving the residual equation system of the current iteration step is constructed, and the quantum circuit is run to obtain a quantum state of a solution of the residual equation system;
[0015] The preset solution is updated according to the quantum state to obtain a new residual vector; until the new residual vector satisfies the preset convergence condition, the preset solution corresponding to the residual vector is used as the target solution of the linear equation system, and the target solution is used as the processing result of the computer task.
[0016] Optionally, the quantum state of the solution of the residual equation system is a noisy quantum state, and updating the preset solution according to the quantum state includes:
[0017] Converting the noisy quantum state into classical data using a pre-built quantum state to classical data module;
[0018] The sum of the classical data and the preset solution of the current iteration step is used as the preset solution of the next iteration step.
[0019] Optionally, the converting the noisy quantum state into classical data using a pre-built quantum state to classical data module includes:
[0020] Updating the conversion coefficient corresponding to the current iteration step in the quantum state to classical data module;
[0021] The product of the state vector corresponding to the noisy quantum state and the conversion coefficient is used as the classical data.
[0022] Optionally, the conversion coefficient corresponding to the current iteration step is determined by the coefficient matrix of the linear equation group, the residual vector of the current iteration step and the state vector corresponding to the noisy quantum state.
[0023] Optionally, the conversion coefficient L corresponding to the current iteration step is calculated based on the following formula:
[0024]
[0025] Among them, r k represents the kth item in the residual vector r of the current iteration step, z k represents the kth term in the intermediate vector z, which is the product of the coefficient matrix of the linear equations and the state vector corresponding to the noisy quantum state of the current iteration step.
[0026] Optionally, the quantum circuit solves the quantum state of the solution to the residual equation group by running at least one of a variational quantum linear algorithm, a quantum discrete adiabatic linear solution algorithm, a CKS algorithm or an HHL algorithm.
[0027] Optionally, the preset convergence condition includes: the 2-norm of the residual vector of the current iteration step is not greater than a preset accuracy parameter.
[0028] Yet another embodiment of the present invention provides a quantum processing device for computer tasks, the device comprising:
[0029] An acquisition module, configured to acquire task data; wherein the task data includes a system of linear equations and preset solutions of the system of linear equations, wherein the system of linear equations is used to describe a computer task to be processed;
[0030] A processing module is used to update the preset solution based on the quantum state representing the solution of the residual equation group during the process of processing the computer task based on the iterative solution of the linear equation group until the residual vector of the linear equation group meets the preset convergence condition.
[0031] Yet another embodiment of the present invention provides a storage medium storing a computer program, wherein the computer program is configured to execute the method described in any one of the above embodiments when run.
[0032] Yet another embodiment of the present invention 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 execute the method described in any one of the above embodiments.
[0033] Compared with the prior art, the present invention provides a quantum processing method and related device for computer tasks, which can obtain task data including a system of linear equations and a preset solution of the system of linear equations; and in the process of iteratively solving the computer task based on the system of linear equations, in each iterative step, a quantum circuit for solving the residual equation system of the current iterative step is constructed; thereby, the preset solution of the linear equation system is iteratively updated based on the quantum state of the solution of the residual equation system, until the residual vector meets the preset convergence condition, the target solution of the linear equation system can be obtained, and the processing result of the computer task is determined.
[0034] This scheme converts the quantum state of the solution of the residual equations into high-quality classical data, and uses the solution of the residual equations to continuously iteratively update the preset solution of the linear equations, thereby continuously reducing the impact of quantum noise on the classical solution during the iteration process, improving the quantum linear solver's resistance to quantum noise, and reducing the errors caused by quantum noise. This makes it possible to successfully run the quantum linear solver on current mesoscale noisy quantum computers, achieve accurate solutions to linear equations, and further enhance the ability of quantum computers to solve real-world problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A network block diagram of a quantum processing system for computer tasks provided by an embodiment of the present invention;
[0036] Figure 2 A flowchart of a quantum processing method for computer tasks provided by an embodiment of the present invention;
[0037] Figure 3 A specific flow chart of updating a preset solution provided by an embodiment of the present invention;
[0038] Figure 4 A specific flow chart for converting a noisy quantum state into classical data provided by an embodiment of the present invention;
[0039] Figure 5 A schematic diagram of a convergence process of a residual vector provided by an embodiment of the present invention;
[0040] Figure 6 A schematic diagram of the structure of a quantum processing device for computer tasks provided by an embodiment of the present invention;
[0041] Figure 7A schematic structural diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limiting the present invention.
[0043] Figure 1 This is a network block diagram of a quantum processing system for computer tasks provided by an embodiment of the present invention. The quantum processing system for computer tasks may include a network 110, a server 120, a wireless device 130, a client 140, storage 150, a classical computing unit 160, a quantum computing unit 170, and may also include additional memory, classical processors, quantum processors, and other devices (not shown).
[0044] The network 110 is a medium for providing communication links between various devices and computers connected together in the quantum processing system of the computer task, including but not limited to the Internet, corporate intranet, local area network, mobile communication network and their combination. The connection method can be wired, wireless communication links or optical fiber cables.
[0045] Server 120, wireless device 130, and client 140 are conventional data processing systems that may contain data and applications or software tools that perform conventional computing processes. Client 140 may be a personal computer or a network computer, so the data may also be provided by server 120. Wireless device 130 may be a smartphone, tablet, laptop, smart wearable device, etc. Storage unit 150 may include database 151, which may be configured to store data such as qubit parameters, quantum logic gate parameters, quantum circuits, and quantum programs.
[0046] The classical computing unit 160 (quantum computing unit 170) may include a classical processor 161 (quantum processor 171) for processing classical data (quantum data) and a memory 162 (memory 172) for storing the classical data (quantum data). The classical data (quantum data) may be a boot file, an operating system image, and an application 163 (application 173). The application 163 (application 173) may be used to implement a quantum algorithm compiled according to the quantum processing method for computer tasks provided in an embodiment of the present invention.
[0047] Any data or information stored or generated in the classical computing unit 160 (quantum computing unit 170) can also be configured to be stored or generated in another classical (quantum) processing system in a similar manner, and similarly, any application program executed therein can also be configured to be executed in another classical (quantum) processing system in a similar manner.
[0048] It should be noted that a true quantum computer is a hybrid structure, which includes at least Figure 1 The system consists of two parts: the classical computing unit 160, which is responsible for performing classical calculations and control; and the quantum computing unit 170, which is responsible for running quantum programs and thus realizing quantum computing.
[0049] The classical computing unit 160 and quantum computing unit 170 can be integrated into a single device or distributed across two different devices. For example, a first device including the classical computing unit 160 runs a classical computer operating system, provides quantum application development tools and services, and also provides the storage and network services required for quantum applications. Users develop quantum programs using the quantum application development tools and services on the device, and send the quantum programs to a second device including the quantum computing unit 170 via the network services on the device. The second device runs a quantum computer operating system, which parses and compiles the code of the quantum program into instructions that can be recognized and executed by the quantum processor 170. The quantum processor 170 then implements the quantum algorithm corresponding to the quantum program based on the instructions.
[0050] The computing units of the classic processor 161 in the classic computing unit 160 are based on CMOS transistors on a silicon chip. These computing units are not constrained by time or coherence, meaning they are available at all times, regardless of the duration of their use. Furthermore, the number of these computing units on a silicon chip is plentiful. Currently, a classic processor 161 contains tens of thousands of computing units. This abundance of computing units and the selectable computational logic of the CMOS transistors are fixed, such as AND logic. When computing with CMOS transistors, a large number of CMOS transistors are combined with a limited number of logical functions to achieve the desired computational effect.
[0051] The basic computing unit of the quantum processor 171 in the quantum computing unit 170 is the qubit. The input of the qubit is limited by coherence and coherence time, that is, the qubit is limited by the length of use and is not available at any time. Making full use of the qubit within the available usage time of the qubit is a key problem in quantum computing. In addition, the number of qubits in a quantum computer is one of the representative indicators of the performance of the quantum computer. Each qubit realizes the computing function through the logical function configured on demand. Given the limited number of qubits, the logical functions in the field of quantum computing are diverse, such as: Hadamard gate (H gate), Pauli-X gate (X gate), Pauli-Y gate (Y gate), Pauli-Z gate (Z gate), X gate, RY gate, RZ gate, CNOT gate, CR gate, iSWAP gate, Toffoli gate, etc. During quantum computing, it is necessary to use limited qubits combined with a variety of logical functions to achieve the computing effect.
[0052] Based on these differences, the application of classical logic functions to the design of CMOS tubes and the application of quantum logic functions to the design of quantum bits are significantly and essentially different. The application of classical logic functions to the design of CMOS tubes does not require consideration of the individuality of the CMOS tubes. For example, the representation of CMOS tubes in silicon chips is the individual identification, position, and usable life of each CMOS tube. Therefore, the classical algorithms composed of classical logic functions only express the operational relationships of the algorithms, and do not express the algorithm's dependence on the individual CMOS tubes.
[0053] Quantum logic functions acting on qubits must consider their individuality, such as their position within the quantum chip, their individual identifier, their location, their relationship to surrounding qubits, and the usable lifespan of each qubit. Therefore, quantum algorithms composed of quantum logic functions not only express the algorithm's operational relationships but also its dependence on individual qubits.
[0054] Quantum chips can include qubits and channels that control them. Quantum logic gates are implemented using analog signals. Different combinations of analog signals are applied to qubits through the channels that control them, thereby realizing quantum circuits with different functions and completing data processing. Therefore, the design of quantum logic functions applied to qubits (including whether qubits are used and the efficiency of each qubit's use) is key to improving the computing performance of quantum computers and requires special design. This is also the uniqueness of quantum algorithms based on quantum logic functions, which are fundamentally and significantly different from classical algorithms based on classical logic functions. However, the above-mentioned qubit-specific design is a technical issue that ordinary computing devices do not need to consider or face.
[0055] Current noisy intermediate-scale quantum (NISQ) computers have two characteristics: First, the number of physical qubits is small, typically no more than 1,000; second, physical qubits have not yet fully achieved the performance of logical bits, resulting in significant quantum noise interference during quantum computing. Consequently, when using NISQ computers to solve linear equations using the Quantum Linear Algorithm (QLA), quantum noise can lead to large errors in the quantum computation, preventing accurate solutions.
[0056] To address the above issues, a fault-tolerant quantum linear algorithm with significant resistance to quantum noise can be designed, which can then be used to perform quantum processing on current mesoscale noisy quantum computers and accurately solve linear equations. An embodiment of the present invention provides a method for quantum processing of computer tasks, comprising the following steps:
[0057] First, obtain the task data;
[0058] The task data includes a set of linear equations and preset solutions to the set of linear equations, and the set of linear equations is used to describe the computer task to be processed.
[0059] Furthermore, in the process of processing the computer task based on the iterative solution of the linear equations, the preset solution is updated based on the quantum state representing the solution of the residual equations until the residual vector of the linear equations meets the preset convergence condition.
[0060] For details, see Figure 2 , the above method may include the following steps:
[0061] Step 201, obtaining task data;
[0062] In the quantum processing solution for computer tasks provided by an embodiment of the present invention, first, task data of the computer task to be processed can be obtained. The task data includes a system of linear equations and preset solutions to the system of linear equations. The system of linear equations can be used to describe the computer task to be processed.
[0063] Specifically, the computer tasks to be processed can be: computational tasks constructed by mathematical modeling or simulation of problems that need to be solved in real physical scenarios. For example, a CFD (Computational Fluid Dynamics) simulation and analysis task can be performed on a fluid system. The specific steps may include: constructing a corresponding numerical network based on the fluid system, spatially discretizing the fluid system, and then constructing a linear equation system reflecting the flow conditions of the fluid system through methods such as finite difference method, finite element method, spectral element method or finite volume method. The solution of the linear equation system reflects the flow parameters of the grid unit of the fluid system at a certain moment; then using a quantum computer to process the CFD simulation and analysis task of the fluid system, the obtained solution can be used to continuously update the state of the fluid system; the above scheme can be specifically used in multiple technical fields such as aircraft aerodynamic design, weather forecasting, and building environmental analysis.
[0064] Correspondingly, the aforementioned computer tasks to be processed may also be problem-solving tasks involving solving systems of linear equations in fields such as finance, biology, and chemistry. These linear equations may be used to determine the optimal solution to a portfolio optimization problem, or to determine chemical products and chemical equilibrium between compounds, etc., and will not be elaborated on here.
[0065] The preset solution to the system of linear equations can be any pre-set initial solution. That is, the preset solution can be understood as an initial noisy solution to the system of linear equations. Thus, during subsequent task processing, the solution in the embodiment of the present invention can continuously mitigate the error in the preset solution, ultimately obtaining a target solution that meets the requirements. For example, the preset solution can be a solution vector, and all elements in the vector can be zero, that is, the initial preset solution can be a zero vector.
[0066] In one embodiment, to improve the accuracy of the preset solution, thereby reducing the quantum processing time of computer tasks and improving computational efficiency, the aforementioned linear equations can be pre-solved by quantum or classical computation, with the resulting preset solution being closer to the target solution than the zero vector. For example, a random pseudo-quantum circuit corresponding to the aforementioned linear equations can be constructed based on a variational quantum linear algorithm, and then the random pseudo-quantum circuit can be trained and its loss function reduced. After training, the random pseudo-quantum circuit can be run to perform quantum state evolution and measure the expected value of each quantum bit. These expected values can then be processed to obtain the preset solution to the linear equations.
[0067] Furthermore, it can be determined whether the residual vector of the linear equation system meets the preset convergence condition in the current iteration step.
[0068] Specifically, this solution is mainly based on the iterative solution of the residual equation system to reduce the error caused by quantum noise in the quantum processing of computer tasks. Then, it can be determined whether the residual vector corresponding to the preset solution in the initial iteration step meets the preset convergence condition.
[0069] For example, the linear equations describing the computer task to be processed can be expressed as Ax = b, where A is the coefficient matrix of the linear equations, b is the right-hand side of the linear equations, and x is the unknown quantity to be solved. Then, when the preset solution of the initial iteration step is x0, the residual vector r0 = b - Ax0 can be calculated, and it is determined whether the residual vector r0 meets the preset convergence condition.
[0070] As an implementation manner of an embodiment of the present invention, the preset convergence condition may include: the 2-norm of the residual vector of the current iteration step is not greater than a preset accuracy parameter.
[0071] Specifically, in the field of solving linear equations, the preset convergence condition can generally consider various norms of the residual vector, such as the L0 norm, the L1 norm, the infinity norm, or the Lp norm. In this embodiment, the 2 norm of the residual vector can be calculated by a common method, and its value can be determined to be no greater than a preset accuracy parameter. Specifically, the 2 norm of the residual vector r is calculated as follows:
[0072]
[0073] Among them, r i represents the i-th item in the residual vector r. In other feasible implementations, various other norms of the residual vector may also be considered, and different preset convergence conditions may be set, which will not be described in detail here.
[0074] Still taking the above-mentioned preset solution of the initial iteration step as x0 as an example, after calculating the residual vector r0, the 2-norm of the residual vector r0 of the initial iteration step can be calculated as ‖r0‖2, and it is judged whether ‖t0‖2 is not greater than the preset accuracy parameter ∈, where the preset accuracy parameter ∈ can be 10 -4 , 10 -5 or 10 -6 If ‖r0‖2 is not greater than the preset precision parameter ∈, the residual vector r0 can be considered to meet the preset convergence conditions and has converged, and the preset solution x0 can be directly used as the target solution to the linear equation system; if ‖r0‖2 is greater than the preset precision parameter ∈, the residual vector r0 can be considered to not meet the preset convergence conditions and has not converged. It is necessary to continuously update the preset solution in multiple iterations using the following method until, in a certain iteration, the 2-norm of the residual vector is no greater than the preset precision parameter ∈, at which point the preset solution corresponding to the residual vector can be used as the target solution to the linear equation system.
[0075] If the residual vector of the linear equation system does not meet the preset convergence condition in the current iteration step, step 202 may be executed to construct a quantum circuit for solving the residual equation system of the current iteration step, and run the quantum circuit to obtain the quantum state of the solution of the residual equation system;
[0076] The quantum state representing the solution of the residual equation system can be obtained by the following method:
[0077] In each iteration step, a residual equation system is determined based on a coefficient matrix of the linear equation system and a residual vector corresponding to the preset solution;
[0078] A quantum circuit for solving the residual equation group is constructed; and the quantum circuit is run to obtain a quantum state of a solution to the residual equation group.
[0079] Specifically, if the residual vector of the linear equation system does not meet the preset convergence condition in a certain iteration step, the residual equation system corresponding to the current iteration step can be determined. The residual equation system is determined by the coefficient matrix A and the residual vector r of the linear equation system. For example, if the residual vector r0 corresponding to the preset solution x0 of the initial iteration step does not meet the preset convergence condition, the residual equation system Ay=r0 corresponding to the computer task can be established, where y is the unknown in the residual equation system, that is, the residual required for the preset solution x0 of the linear equation system.
[0080] Then, based on any quantum linear algorithm, we can construct a quantum circuit for solving the residual equation group Ay=r0, run the quantum circuit on a real quantum computer, execute the quantum linear algorithm, and finally obtain the quantum state |y> of the solution to the residual equation group Ay=r0.
[0081] As an implementation method of an embodiment of the present invention, the quantum circuit can solve the quantum state of the solution of the residual equation group by running at least one of a variational quantum linear algorithm, a quantum discrete adiabatic linear solution algorithm, a CKS algorithm or an HHL algorithm.
[0082] Specifically, the variational quantum linear algorithm, the quantum discrete adiabatic linear solution algorithm, the CKS algorithm, and the HHL algorithm are all commonly used quantum linear algorithms in the field of quantum computing, and will not be introduced in detail here. It is known to those skilled in the art that based on the different formats of the residual equations to be solved and the different quantum chips of the real quantum computer, a more suitable quantum linear algorithm can be selected to solve the above residual equations. Based on any of the above quantum linear algorithms, a real quantum computer can calculate and solve the residual equations and obtain the quantum state of the solution of the residual equations.
[0083] Then, step 203 is executed to update the preset solution according to the quantum state to obtain a new residual vector, and the process returns to the step of determining whether the residual vector of the linear equation system in the current iteration step satisfies the preset convergence condition.
[0084] Specifically, the quantum state of the solution to the residual equations can be converted into classical data based on the obtained quantum state, so that the preset solution can be updated based on the classical data. For example, if the classical form of the solution to the residual equations in the initial iteration step is calculated to be y0, the preset solution for the next iteration step can be updated from x0 to x0+y0, and the residual vector r1=bA(x0+y0) for the next iteration step can be calculated to determine whether the residual vector r1 meets the preset convergence condition. This loop iterative operation is repeated until the residual vector of a certain iteration step meets the preset convergence condition.
[0085] Correspondingly, if the residual vector of the linear equation group meets the preset convergence condition in the current iteration step, step 204 can be executed, and the preset solution corresponding to the residual vector is used as the target solution of the linear equation group, and the target solution is used as the processing result of the computer task.
[0086] Specifically, through the solution provided by the embodiments of the present invention, the impact of quantum noise on the classical solution is continuously reduced with each iteration step, the residual vector gradually decreases until convergence, and the preset solution gradually approaches the target solution. Therefore, if the residual vector of a certain iteration step meets the preset convergence condition, the preset solution corresponding to the residual vector can be used as the target solution to the linear system of equations, and this target solution can be used as the processing result of the aforementioned computer task.
[0087] It can be seen that in the solution provided by the embodiment of the present invention, by converting the quantum state of the solution of the residual equation group into high-quality classical data, the solution of the residual equation group is used to continuously iteratively update the preset solution of the linear equation group, thereby continuously reducing the influence of quantum noise on the classical form of the solution during the iteration process, improving the resistance of the quantum linear solver to quantum noise, and reducing the error caused by quantum noise, so that the quantum linear solver can also be successfully run on the current mesoscale noisy quantum computer to achieve accurate solution of the linear equation group, thereby further enhancing the ability of quantum computers to solve real-world problems.
[0088] As an implementation method of the embodiment of the present invention, Figure 3 As shown, the quantum state of the solution of the residual equation group is a noisy quantum state, and updating the preset solution according to the quantum state may include the following steps:
[0089] Step 301: Use a pre-built quantum state to classical data module to convert the noisy quantum state into classical data.
[0090] Specifically, in step 202, a quantum circuit for solving the residual equations can be constructed and run to obtain the quantum state of the solution to the residual equations. Because this quantum circuit runs on a real quantum computer, the quantum computation process is subject to interference from quantum noise, and the quantum state of the solution to the residual equations obtained by measurement may be a noisy quantum state. Therefore, a dedicated quantum state-to-classical data module can be constructed to convert the quantum state of the solution to the residual equations into high-quality classical data.
[0091] In one embodiment, Figure 4 As shown, the use of a pre-built quantum state to classical data module to convert the noisy quantum state into classical data may include the following steps:
[0092] Step 3011, updating the conversion coefficient corresponding to the current iteration step in the quantum state to classical data module;
[0093] The conversion coefficient corresponding to the current iteration step can be jointly determined by the coefficient matrix of the linear equation group, the residual vector of the current iteration step and the state vector corresponding to the noisy quantum state.
[0094] Specifically, in each iterative step, those skilled in the art know that the above-mentioned use of a pre-built quantum state to classical data module to convert the noisy quantum state |y> into classical data y can be understood as: calculating the product of the state vector |y> corresponding to the noisy quantum state and the conversion coefficient L corresponding to the iterative step, and using the vector corresponding to the product L|y> as the classical form data y of the solution to the residual equation group, that is, y=L|y>.
[0095] Correspondingly, in different stages of the above iterative process, the residual vector r i and based on the residual vector r i The constructed residual equation system Ay=r i There are differences, and the interference of quantum noise in each iteration step is also different. Then the noisy quantum state |y> obtained by quantum circuit calculation and measurement also reflects the above characteristics of the iteration step and the influence of quantum noise. Therefore, the conversion coefficient L constructed based on the coefficient matrix of the linear equation system, the residual vector of the current iteration step and the state vector corresponding to the noisy quantum state can comprehensively consider the influence of various factors in the current iteration step, so that the classical data y converted by the quantum state to classical data module can satisfy ‖r i -Ay‖2≤‖r i ‖2, that is, the residual vector continues to shrink during the cyclic iteration process, thereby constructing a fault-tolerant quantum linear algorithm with significant resistance to quantum noise, which can continuously reduce the impact of quantum noise on the solution of the classical form and ultimately achieve accurate solution to the linear equations.
[0096] In a specific embodiment, the conversion coefficient L corresponding to the current iteration step can be calculated based on the following formula:
[0097]
[0098] Among them, r k represents the kth item in the residual vector r of the current iteration step, z k represents the kth term in the intermediate vector z, which is the product of the coefficient matrix of the linear equations and the state vector corresponding to the noisy quantum state of the current iteration step.
[0099] Specifically, in order to convert the quantum state |y> of the solution of the residual equation system into high-quality classical data y, it is necessary to update the conversion coefficient L corresponding to the current iteration step in the pre-built quantum state to classical data module in each iteration step.
[0100] Then, in order to achieve the continuous reduction of the residual vector in the loop iteration process as much as possible, that is, ‖r i -Ay‖2≤‖r i ‖2, first we need to determine the conversion coefficient L to satisfy:
[0101] L=argmin‖r i -LA|y>‖2
[0102] For easier calculation and representation, we can set the intermediate vector z = A|y> and omit the subscript i corresponding to each iteration step, transforming the above formula into:
[0103]
[0104] The above formula is equivalent to finding the minimum value of the function f, so it is equivalent to finding the solution when the derivative of the function f is 0, that is:
[0105]
[0106] Then we can calculate:
[0107] Step 3012: multiplying the state vector corresponding to the noisy quantum state by the conversion coefficient as the classical data.
[0108] Step 302: The sum of the classical data and the preset solution of the current iteration step is used as the preset solution of the next iteration step.
[0109] Correspondingly, in each iteration step, the residual vector r can be calculated first, and the state vector |y> corresponding to the noisy quantum state is obtained, and its product with the coefficient matrix A of the linear equation system is calculated to obtain the intermediate vector z=A|y>. Then, based on the above residual vector r and the terms in the intermediate vector z, combined with the above formula The conversion coefficient L can then be dynamically updated in each iteration step.
[0110] Then, the product of the conversion coefficient L and the state vector |y> corresponding to the noisy quantum state is used as the classical form of the solution of the residual equation system, and the preset solution x of the current iteration step can be obtained. i Update, specifically: calculate the classic data y of each iteration step and the preset solution x of the current iteration step i The sum x i +y, as the default solution x for the next iteration step i+1 .
[0111] It can be seen that in this embodiment, a quantum state to classical data module is pre-constructed, and the conversion coefficient therein is updated in real time in each iterative step, wherein the above-mentioned conversion coefficient is jointly determined by the coefficient matrix of the linear equation system, the residual vector of the current iterative step, and the state vector corresponding to the noisy quantum state. Therefore, in each iterative step, the quantum state of the solution of the residual equation system can be converted into high-quality classical data, so that the residual vector continues to shrink during the cyclic iteration process, thereby continuously reducing the impact of quantum noise on the solution of the classical form. A fault-tolerant quantum linear algorithm with significant resistance to quantum noise is constructed, which improves the resistance of the quantum linear solver to quantum noise and reduces the error caused by quantum noise, so that the quantum linear solver can also be successfully run on the current mesoscale noisy quantum computer to achieve accurate solution of the linear equation system, thereby further enhancing the ability of quantum computers to solve real-world problems.
[0112] In a specific embodiment of the quantum processing scheme using a real quantum chip to verify the above computer task, a test was conducted using the 72-bit quantum chip "Wukong" from Benyuan Quantum, and the verification results were as follows: Figure 5 As shown, the linear equation group used to describe the computer task to be processed is Ax=b, then the information of the acquired task data can be as follows:
[0113]
[0114] Where A is the coefficient matrix of the linear system, b is the right-hand side term of the linear system, and x0 is the initial preset solution of the linear system. The preset convergence condition of the iterative process is that the 2-norm of the residual vector of the current iteration step is no greater than the preset accuracy parameter ∈, ∈ = 0.0001.
[0115] The residual vector r0=b-Ax0 corresponding to the initial preset solution x0 is:
[0116]
[0117] Accordingly,
[0118] In the initial iteration, a variational quantum linear algorithm can be used to construct the corresponding variational quantum circuit to solve the residual equation system Ay = r0. Then, after the parameter training in the above variational quantum circuit is completed and the loss function converges, the state vector corresponding to the quantum state of the solution to the residual equation system can be calculated as: Then, according to the formula in the above embodiment The conversion coefficient corresponding to the initial iteration step can be calculated to be L = 0.019926135461756322; further, the classical form of the solution of the residual equations can be calculated as Then use the above classic data y to update the initial preset solution x0, and the preset solution for the next iteration step can be obtained as
[0119] Accordingly, in the first iteration step after the initial iteration step, Calculation shows that ‖r1‖2>∈. Then, a variational quantum circuit is constructed again to solve the residual equation system Ay=r1. After the parameter training in this variational quantum circuit is completed and the loss function converges, the state vector corresponding to the quantum state of the solution to the residual equation system can be calculated as: Then, according to the formula in the above embodiment The conversion coefficient corresponding to the first iteration step can be calculated to be L = 0.0031769302396448353; further, the classical form of the solution of the residual equations can be calculated to be By using the above-mentioned classical data y to update the preset solution x1 of the first iteration step, the preset solution x2=x1+y of the next iteration step can be obtained.
[0120] And so on, such as Figure 5 As shown in Figure 2, the 2-norm of the residual vector is significantly reduced in each iteration step compared to the previous iteration step, so that after 11 iterations, ‖r 11 ‖2 is not greater than ∈, satisfying the preset convergence conditions and obtaining the target solution
[0121] It can be seen that the solution provided by the embodiment of the present invention can calculate the target solution of the linear equation system on a real quantum computer by establishing a residual equation system and iteratively updating the preset solution; through a finite number of iterative calculations, not only the error caused by quantum noise to the quantum linear solver is alleviated, but also the residual vector can be quickly converged, thereby improving the solution efficiency of the quantum linear solver, achieving accurate solution of the linear equation system, and further enhancing the ability of quantum computers to solve real-world problems.
[0122] See also Figure 6 , Figure 6 An embodiment of the present invention provides a quantum processing device for computer tasks, the device comprising:
[0123] Acquisition module 601, used to acquire task data;
[0124] The task data includes a linear equation system and a preset solution of the linear equation system, wherein the linear equation system is used to describe the computer task to be processed;
[0125] The processing module 602 is used to update the preset solution based on the quantum state representing the solution of the residual equation system during the process of processing the computer task based on the iterative solution of the linear equation system, until the residual vector of the linear equation system meets the preset convergence condition.
[0126] The specific functions and effects achieved by the quantum processing device for the above-mentioned computer tasks can be explained in conjunction with other embodiments of this specification and will not be repeated here. The various modules in the quantum processing device for the above-mentioned computer tasks can be implemented in whole or in part through software, hardware, or a combination thereof. The modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0127] See also Figure 7 , the embodiments of this specification also provide a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the quantum processing method of the computer task in any of the above embodiments when executing the computer program. Figure 7 The computer device may be a classical computer or a quantum computer.
[0128] The embodiments of this specification also provide a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a computer, the computer performs the quantum processing method of the computer task in any of the above embodiments.
[0129] The embodiments of this specification also provide a computer program product comprising instructions, which, when executed by a computer, causes the computer to perform the quantum processing method of the computer task in any of the above embodiments.
[0130] It should be understood that the specific examples in this specification are only intended to help those skilled in the art better understand the implementation methods of this specification, rather than to limit the scope of the present invention.
[0131] It can be understood that in the various implementations of this specification, the size of the serial number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the implementation methods of this specification.
[0132] It can be understood that the various embodiments described in this specification can be implemented individually or in combination, and the embodiments in this specification are not limited to this.
[0133] Unless otherwise indicated, all technical and scientific terms used in the embodiments of this specification have the same meaning as those commonly understood by those skilled in the art in the technical field of this specification. The terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit the scope of this specification. The term "and / or" used in this specification includes any and all combinations of one or more related listed items. The singular forms "a", "above", and "the" used in the embodiments of this specification and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise.
[0134] It is understood that the processor in the embodiments of this specification can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method embodiment can be completed by hardware integrated logic circuits in the processor or software instructions. The above processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of this specification can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this specification can be directly implemented as being executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0135] It will be understood that the memory in the embodiments of this specification may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0136] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this specification.
[0137] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, devices and units can refer to the corresponding processes in the aforementioned method implementation methods and will not be repeated here.
[0138] In the several embodiments provided in this specification, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0139] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of this embodiment.
[0140] In addition, each functional unit in each embodiment of this specification may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0141] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this specification, or the part that contributes to the prior art, or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of this specification. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0142] The above description is merely a specific embodiment of this specification, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this specification should be included within the scope of protection of this specification. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A quantum processing method for computer tasks, characterized in that The method comprises: Acquiring task data; wherein the task data includes a system of linear equations and preset solutions to the system of linear equations, wherein the system of linear equations is used to describe a computer task to be processed; In the process of processing the computer task based on the iterative solution of the linear equations, the preset solution is updated based on the quantum state representing the solution of the residual equations until the residual vector of the linear equations meets the preset convergence condition.
2. The method according to claim 1, wherein The quantum state representing the solution of the residual equation system is obtained by the following method: In each iteration step, a residual equation system is determined based on a coefficient matrix of the linear equation system and a residual vector corresponding to the preset solution; constructing a quantum circuit for solving the residual equations; The quantum circuit is run to obtain the quantum state of the solution of the residual equation group.
3. The method according to claim 1, wherein The method of updating a preset solution of the linear equation system in a previous iteration step based on the quantum state representing the solution of the residual equation system until the residual vector of the linear equation system satisfies a preset convergence condition includes: If the residual vector of the linear equation system does not satisfy a preset convergence condition in the current iteration step, a quantum circuit for solving the residual equation system of the current iteration step is constructed, and the quantum circuit is run to obtain a quantum state of a solution of the residual equation system; The preset solution is updated according to the quantum state to obtain a new residual vector; until the new residual vector satisfies the preset convergence condition, the preset solution corresponding to the residual vector is used as the target solution of the linear equation system, and the target solution is used as the processing result of the computer task.
4. The method according to claim 3, wherein The quantum state of the solution of the residual equation group is a noisy quantum state, and updating the preset solution according to the quantum state includes: Converting the noisy quantum state into classical data using a pre-built quantum state to classical data module; The sum of the classical data and the preset solution of the current iteration step is used as the preset solution of the next iteration step.
5. The method according to claim 4, wherein The method of converting the noisy quantum state into classical data using a pre-built quantum state to classical data module includes: Updating the conversion coefficient corresponding to the current iteration step in the quantum state to classical data module; The product of the state vector corresponding to the noisy quantum state and the conversion coefficient is used as the classical data.
6. The method according to claim 5, wherein The conversion coefficient corresponding to the current iteration step is jointly determined by the coefficient matrix of the linear equation group, the residual vector of the current iteration step and the state vector corresponding to the noisy quantum state.
7. The method according to claim 6, wherein The conversion coefficient L corresponding to the current iteration step is calculated based on the following formula: Among them, r k represents the kth item in the residual vector r of the current iteration step, z k represents the kth term in the intermediate vector z, which is the product of the coefficient matrix of the linear equations and the state vector corresponding to the noisy quantum state of the current iteration step.
8. The method according to any one of claims 1 to 7, wherein The quantum circuit solves the quantum state of the solution of the residual equation group by running at least one of a variational quantum linear algorithm, a quantum discrete adiabatic linear solution algorithm, a CKS algorithm or a HHL algorithm.
9. The method according to any one of claims 1 to 7, wherein: The preset convergence condition includes: the 2-norm of the residual vector of the current iteration step is not greater than the preset accuracy parameter.
10. A quantum processing device for computer tasks, characterized in that The device comprises: An acquisition module, configured to acquire task data; wherein the task data includes a system of linear equations and preset solutions of the system of linear equations, wherein the system of linear equations is used to describe a computer task to be processed; A processing module is used to update the preset solution based on the quantum state representing the solution of the residual equation group during the process of processing the computer task based on the iterative solution of the linear equation group until the residual vector of the linear equation group meets the preset convergence condition.
11. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 9 when run.
12. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 9.