WO2023165500A1 - Processing method and apparatus for data processing task, storage medium, and electronic device - Google Patents
Processing method and apparatus for data processing task, storage medium, and electronic device Download PDFInfo
- Publication number
- WO2023165500A1 WO2023165500A1 PCT/CN2023/078928 CN2023078928W WO2023165500A1 WO 2023165500 A1 WO2023165500 A1 WO 2023165500A1 CN 2023078928 W CN2023078928 W CN 2023078928W WO 2023165500 A1 WO2023165500 A1 WO 2023165500A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- differential equation
- quantum
- differentiable
- predicted
- quantum circuit
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/11—Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
- G06F17/13—Differential equations
Definitions
- the embodiments of this specification relate to the field of data processing, and specifically relate to a processing method, device, storage medium, and electronic device for a data processing task.
- Quantum computing is a new type of computing. The principle is to construct a computing framework with the theory of quantum mechanics. Compared with the optimal classical algorithm, quantum computing has the effect of exponential speed-up when solving certain problems.
- Embodiments of this specification provide a data processing task processing method, device, storage medium, and electronic equipment, which are used to reduce resource consumption caused by grid division.
- An embodiment of this specification provides a processing method for a data processing task, the processing method comprising: acquiring data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes The differential equation; constructing a differentiable quantum circuit according to the data processing task data; predicting the target processing result of the data processing task based on the differentiable quantum circuit, and constructing the predicted processing result according to the prediction When the value of the loss function meets the specified accuracy condition, the prediction processing result that makes the value of the loss function meet the specified accuracy condition is taken as the target processing result.
- predicting the target processing result of the data processing task based on the differentiable quantum circuit includes: predicting the target of the differential equation based on the variational parameters in the differentiable quantum circuit solution to predict.
- the data processing task data further includes the initial conditions and boundary conditions satisfied by the solution of the differential equation;
- the step of constructing a differentiable quantum circuit according to the data processing task data includes: The differential equation and the initial conditions and boundary conditions satisfied by the solution of the differential equation construct the differentiable quantum circuit, and determine the variational parameters in the differentiable quantum circuit.
- constructing the differentiable quantum circuit according to the differential equation and the initial conditions and boundary conditions satisfied by the solution of the differential equation includes: acquiring a group of qubits and The initial state of is set to
- the step of predicting the target solution of the differential equation based on the variational parameters in the differentiable quantum circuit includes: updating the variational parameters through an optimization algorithm, based on the updated The latter variational parameters predict the target solution of the differential equation.
- the updating of the variational parameters through an optimization algorithm includes: updating the variational parameters ⁇ through the following formula: Wherein, the n is an integer not less than 1, ⁇ is the learning rate, and L is the loss function, is the gradient of the loss function to ⁇ .
- the loss function is:
- the L ⁇ (diff) represents that the predicted solution of the differential equation does not satisfy the error of the differential equation
- the d x f represents the derivative term in the differential equation
- the f represents the difference between the differential equation and the differential equation
- said x represents a variable
- said L ⁇ (boundary) represents the error that the predicted solution of said differential equation does not satisfy said boundary condition and said initial condition
- the differential equation is a time-dependent partial differential equation
- the target processing result of the data processing task is predicted based on the differentiable quantum circuit, and the predicted processing obtained according to the prediction
- the step of taking the predicted processing result that makes the value of the loss function meet the specified accuracy condition as the target processing result includes: based on the initial variable of the differentiable quantum circuit Predict the target solution of the time-dependent partial differential equation by sub-parameters, until according to If the value of the loss function at the current moment constructed by the prediction processing result obtained by the prediction meets the specified accuracy condition, the predicted solution of the time-dependent partial differential equation that makes the value of the loss function meet the specified accuracy condition is used as The objective solution of the time-dependent partial differential equation.
- the time-dependent partial differential equation includes:
- the u(x, t) is the solution of the time-dependent partial differential equation
- x is a space variable
- t is a time variable
- N'[u(x, t)] is a nonlinear term
- ⁇ is a computational domain
- T is time.
- the data processing task data also includes the initial conditions and boundary conditions of the time-dependent partial differential equation; after the step of obtaining the data processing task data, it also includes: A semi-discrete form of the time-dependent partial differential equation is determined.
- u(x, t+ ⁇ t) u(x, t)+ ⁇ t ⁇ N′[u(x, t+ ⁇ t)], wherein, the u(x, t+ ⁇ t) is the time-dependent partial differential The solution of the equation at time t+ ⁇ t.
- predicting the target solution of the time-dependent partial differential equation based on the initial variational parameters of the differentiable quantum circuit includes: obtaining a group of qubits and Set the state to
- the determination of the predicted solution of the time-dependent partial differential equation includes: obtaining a pre-selected measurement operator; determining the expected value corresponding to the measurement operator according to the final quantum state; according to The expected value determines a predicted solution of the time-dependent partial differential equation.
- the first type of quantum logic gates includes: Rx quantum logic gates, Ry quantum logic gates and Rz quantum logic gates; the second type of quantum logic gates includes: Rx quantum logic gates, Ry quantum logic gates Quantum logic gates, Rz quantum logic gates and CNOT quantum logic gates.
- the loss function at the current moment constructed according to the prediction processing result obtained from the prediction includes: if the current moment is the initial moment, the loss function at the initial moment is:
- the N' is the number of discrete points
- M is the number of boundary points
- i is the ith discrete point
- j' is the j'th boundary point
- g( xi ) is the initial condition
- h(x j' ,0) is the boundary condition at the initial moment
- the loss function at ⁇ t time is:
- the N'[u(x,t)] is determined according to the differentiable quantum circuits at the previous moment.
- the method further includes: updating the variational parameter ⁇ through the following formula: Wherein, the n is an integer not less than 1, ⁇ is the learning rate, and L is the loss function, is the gradient of the loss function to ⁇ .
- the method further includes: acquiring the computational domain of the differential equation and dividing the computational domain into several non-overlapping sub-computational domains;
- the step of constructing a differentiable quantum circuit according to the data processing task data includes: constructing a differentiable quantum circuit corresponding to the sub-computational domain; wherein, one sub-computational domain corresponds to a predicted solution of the differential equation; based on the The differentiable quantum circuit predicts the target processing result of the data processing task, and when the value of the loss function constructed according to the predicted processing result meets the specified accuracy condition, the value of the loss function meets the specified accuracy condition.
- the step of specifying the predicted processing result of the accuracy condition as the target processing result includes: predicting the target solution of the differential equation based on the differentiable quantum circuit, and then constructing the sub-calculation based on the predicted solution of the differential equation
- the value of the joint loss function of the domain conforms to the specified precision
- the predicted solution of the differential equation that makes the value of the loss function meet the specified accuracy condition is taken as the target solution of the differential equation.
- the differential equation is:
- the F is a functional function
- the d x u is a derivative term
- the u is the solution of the differential equation
- the x is a variable.
- predicting the target processing result of the data processing task based on the differentiable quantum circuit includes: the target solution of the differential equation based on the variational parameters in the differentiable quantum circuit Make predictions.
- the step of constructing a differentiable quantum circuit corresponding to the sub-computational domain includes: obtaining a group of qubits and setting the initial state of the qubits to
- the step of predicting the target solution of the differential equation based on the variational parameters in the differentiable quantum circuit includes: obtaining a pre-selected measurement operator; The final quantum state corresponding to the variational parameter in the circuit determines the expected value corresponding to the measurement operator; and determines the predicted solution of the differential equation according to the expected value.
- the first type of quantum logic gates includes: Rx quantum logic gates, Ry quantum logic gates and Rz quantum logic gates; the second type of quantum logic gates includes: Rx quantum logic gates, Ry quantum logic gates Quantum logic gates, Rz quantum logic gates and CNOT quantum logic gates.
- the joint loss function is:
- the n is the number of sub-computational domains
- the nb is the number of interfaces
- the L i (diff) [d x f i , f i , x] is the differential equation corresponding to the i-th sub-computational domain
- the error caused by the prediction solution not satisfying the differential equation, the L i (boundary) [f i , x] is the prediction solution of the differential equation corresponding to the i-th sub-calculation domain does not satisfy the solution of the differential equation
- the L i (interface) [f, x] is the predicted solution of the differential equation corresponding to the adjacent areas on both sides of the i-th interface does not satisfy the continuity condition of the interface and caused by the error and
- the n i is the number of discrete points on the i-th interface
- f + (x j ) and f - (x j ) are the predicted solutions of the differential equations corresponding to the sub-calculation
- the step of predicting the target solution of the differential equation based on the variational parameters in the differentiable quantum circuit includes: using an optimization algorithm to update the variational parameters in the differentiable quantum circuit Parameters; according to the updated variational parameters in the differentiable quantum circuit, an updated predicted solution of the differential equation is obtained.
- the step of using an optimization algorithm to update the variational parameters in the differentiable quantum circuit includes:
- the variational parameter ⁇ is updated by the following formula: Wherein, the n is an integer not less than 1, ⁇ is the learning rate, and L is the joint loss function, is the gradient of the joint loss function to ⁇ .
- the data processing task data further includes the derivative term of the differential equation;
- the step of constructing a differentiable quantum circuit according to the data processing task data includes: according to the differential equation and the The derivative terms of the differential equation respectively construct the differentiable quantum circuit; predict the target processing result of the data processing task based on the differentiable quantum circuit, and to the loss function constructed according to the predicted processing result obtained by the prediction
- the step of taking the predicted processing result that makes the value of the loss function meet the specified precision condition as the target processing result includes: the target solution of the differential equation based on the differentiable quantum circuit and
- the value of the derivative term of the differential equation is predicted to the value of the loss function constructed from the predicted solution of the differential equation and the predicted value of the derivative term of the differential equation will make the loss
- a predicted solution of the differential equation whose value of the function satisfies the specified accuracy condition is used as a target solution of the differential equation.
- the differential equation is:
- the F is a functional function
- the d x u is the derivative term of the differential equation
- the u is the predicted solution of the differential equation
- the x is the variable quantity.
- the step of respectively constructing the differentiable quantum circuit according to the differential equation and the derivative term of the differential equation includes: respectively constructing the predicted solution for solving the differential equation and the solving the differentiable quantum circuit of the predicted value of the derivative term of the differential equation, and respectively determining the predicted solution of the differential equation and the prediction of the derivative term of the differential equation corresponding to the variational parameters in the differentiable quantum circuit value.
- said respectively constructing differentiable quantum circuits for solving the predicted solution of the differential equation and for solving the predicted value of the derivative term includes: respectively obtaining a group of qubits and The initial state of the qubit is set to
- the space basis set is combined into the second sub-quantum circuit module of the predicted solution of the differential equation and the predicted value of the derivative term of the differential equation; respectively constructed for obtaining the predicted solution of the differential equation and the derivative of the differential equation
- the respectively determining the predicted solution of the differential equation corresponding to the variational parameter in the differentiable quantum circuit and the predicted value of the derivative term of the differential equation includes: obtaining a pre-selected measurement operator; determine the expected value corresponding to the measurement operator according to the final quantum state corresponding to the variational parameter in the differentiable quantum circuit; determine the predicted solution of the differential equation and the derivative of the differential equation according to the expected value item's predicted value.
- the loss function is:
- L[f i , f, x] L (diff) [f i , f, x]+L (boundary) [f, x], wherein said f i represents the i-th order derivative in said differential equation item, the L (diff) represents that the predicted solution of the differential equation does not satisfy the error of the differential equation, the f is the differential equation, the x represents a variable, and the L (boundary) represents the differential equation The error in which the predicted solution of the equation does not satisfy the boundary conditions and initial conditions of the solution of the differential equation.
- determining the predicted solution of the differential equation and the predicted value of the derivative term of the differential equation corresponding to the variational parameters in the differentiable quantum circuit respectively includes: updating the predicted value of the differential equation by using an optimization algorithm Variational parameters in the differentiable quantum circuit; according to the updated variational parameters in the differentiable quantum circuit, an updated predicted solution of the differential equation and a predicted value of a derivative term of the differential equation are obtained.
- the step of using an optimization algorithm to update the variational parameters in the differentiable quantum circuit includes: updating the variational parameters ⁇ by the following formula: Wherein, the n is an integer not less than 1, ⁇ is the learning rate, and L is the loss function, is the gradient of the loss function to ⁇ .
- An embodiment of this specification provides a processing device for a data processing task, and the determining device includes:
- An acquisition module configured to acquire data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes the differential equation;
- a building block configured to build a differentiable quantum circuit according to the data processing task data
- a prediction module configured to predict the target processing result of the data processing task based on the differentiable quantum circuit, until the value of the loss function constructed according to the predicted processing result obtained from the prediction meets the specified accuracy condition;
- the prediction processing result that makes the value of the loss function conform to the specified accuracy condition is taken as the target processing result.
- An embodiment of the present specification provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the method described in any one of the above when running.
- One embodiment of the present specification provides an electronic device, including a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to perform any of the above-mentioned method.
- the present application obtains data processing task data, constructs a differentiable quantum circuit based on the data processing task data, and then predicts the target processing result of the data processing task based on the differentiable quantum circuit, until When the value of the loss function constructed according to the prediction processing result obtained by the prediction meets the specified accuracy condition, the prediction processing result that makes the value of the loss function meet the specified accuracy condition is taken as the target processing result, and can be based on the prediction processing result Build a loss function and update the value of the loss function to solve the differential equation and reduce the resource consumption caused by grid division.
- FIG. 1 is a block diagram of the hardware structure of a computer terminal according to a data processing task processing method provided by an embodiment of this specification;
- FIG. 2 is a schematic flowchart of a processing method for a data processing task provided by an embodiment of this specification
- Fig. 3 is a schematic diagram of a differentiable quantum circuit provided by an embodiment of this specification.
- Fig. 4 is a schematic diagram of another differentiable quantum circuit provided by the embodiment of this specification.
- FIG. 5 is a schematic flowchart of another data processing task processing method provided by the embodiment of this specification.
- FIG. 6 is a schematic flowchart of another data processing task processing method provided by the implementation mode of this specification.
- FIG. 7 is a schematic diagram of a calculation domain division provided by an embodiment of this specification.
- Fig. 8 is a schematic diagram of another differentiable quantum circuit provided by the embodiment of this specification.
- FIG. 9 is a schematic flowchart of another method for processing a data processing task provided by an embodiment of this specification.
- FIG. 10 is a schematic structural diagram of a processing device for a data processing task provided by an embodiment of this specification.
- An embodiment of this specification provides a method for processing data processing tasks, and the method can be applied to electronic devices, such as computer terminals, specifically, ordinary computers, quantum computers, and the like.
- FIG. 1 is a block diagram of a hardware structure of a computer terminal according to a data processing task processing method provided by an embodiment of this specification.
- the computer terminal may include one or more (only one is shown in FIG. 1 ) processors 102 and a memory 104 for storing data, wherein the processor 102 may include but not limited to a microprocessor (Microcontroller Unit, MCU) or a processing device such as a programmable logic device (Field Programmable Gate Array, FPGA).
- MCU Microcontroller Unit
- FPGA Field Programmable Gate Array
- the above-mentioned computer terminal may further include a transmission device 106 and an input and output device 108 for communication functions.
- FIG. 1 is only for illustration, and it does not limit the structure of the above computer terminal.
- the computer terminal may also include more or fewer components than shown in FIG. 1 , or have a different configuration than that shown in FIG. 1 .
- the memory 104 can be used to store software programs and modules of application software, such as program instructions/modules corresponding to a processing method for implementing a data processing task in the embodiment of this specification, and the processor 102 runs the software programs stored in the memory 104 and module, so as to execute various functional applications and data processing, that is, to realize the above-mentioned 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.
- the memory 104 may further include a memory that is remotely located relative to the processor 102, and these remote memories may be connected to a computer terminal through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
- the transmission device 106 is used to receive or transmit data via a network.
- the specific example of the above-mentioned network may include a wireless network provided by the communication provider of the computer terminal.
- the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet.
- the transmission device 106 may be a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet in a wireless manner.
- RF Radio Frequency
- a real quantum computer has a hybrid structure, which consists of two parts: one is a classical computer, which is responsible for performing classical calculation and control; the other is a quantum device, which is responsible for running quantum programs and realizing quantum computing.
- the quantum program is a series of instruction sequences written in a quantum language such as QRunes that can be run on a quantum computer, which supports the operation of quantum logic gates and finally realizes quantum computing.
- a quantum program is a series of instruction sequences that operate quantum logic gates in a certain sequence.
- Quantum computing simulation is the process of simulating the quantum program corresponding to a specific problem using a virtual architecture built with the resources of an ordinary computer (that is, a quantum virtual machine). Often, quantum programs corresponding to specific problems need to be constructed.
- the quantum program referred to in the implementation mode of this specification refers to a program written in a classical language that characterizes qubits and their evolution, in which qubits, quantum logic gates, etc. related to quantum computing are represented by corresponding classical codes.
- quantum circuits are also called quantum logic circuits. They are the most commonly used general-purpose quantum computing models. They represent circuits that operate on qubits under an abstract concept. The components include qubits, circuits (timelines) , and various quantum logic gates, the results often need to be read out through quantum measurement operations.
- the circuits can be regarded as connected by time, that is, the state of qubits evolves naturally with time, in the process according to The instruction of the Hamiltonian operator is operated until it encounters a logic gate.
- a quantum program as a whole corresponds to a total quantum circuit
- the quantum program mentioned in this specification refers to the total quantum circuit, wherein the total number of qubits in the total quantum circuit is the same as the total number of qubits in the quantum program.
- a quantum program can be composed of quantum circuits, measurement operations for qubits in quantum circuits, registers for saving measurement results, and control flow nodes (jump instructions).
- a quantum circuit can contain tens, hundreds or even thousands of Tens of thousands of quantum logic gate operations.
- the execution process of a quantum program is the process of executing all quantum logic gates according to a certain time sequence. It should be noted that timing refers to the time sequence in which a single quantum logic gate is executed.
- Quantum logic gates can be used to evolve quantum states. Quantum logic gates are the basis of quantum circuits. Quantum logic gates include single-bit quantum logic gates, such as Hadamard Gate (H gate, Hadema gate), Pauli-X gate (X gate), Pauli-Y gate (Y gate), Pauli-Z gate (Z gate), RX gate, RY gate, RZ gate, etc. etc.; multi-bit quantum logic gates, such as CNOT gates, CR gates, iSWAP gates, Toffoli gates, etc.
- H gate Hadamard Gate
- X gate Pauli-X gate
- Y gate Pauli-Y gate
- Z gate Pauli-Z gate
- RX gate RY gate, RZ gate, etc. etc.
- multi-bit quantum logic gates such as CNOT gates, CR gates, iSWAP gates, Toffoli gates, etc.
- Quantum logic gates are generally represented by unitary matrices, and unitary matrices are not only in the form of matrices, but also a kind of operation and transformation. Generally, the effect of a quantum logic gate on a quantum state is calculated by multiplying the left side of the unitary matrix by the matrix corresponding to the right vector of the quantum state.
- the basic unit of information is a bit, and a bit has two states of 0 and 1, and the most common physical implementation method is to represent these two states through the level.
- the basic unit of information is the qubit.
- a qubit also has two states of 0 and 1, denoted as
- the state of the qubit will collapse to a certain state (eigenstate, here is
- 2 1, and
- the quantum state refers to the state of a qubit, and its eigenstate is expressed in binary in a quantum algorithm (or called a quantum program).
- a group of qubits is q0, q1, and q2, representing the 0th, 1st, and 2nd qubits, and the order from high to low is q2q1q0
- the quantum states of this group of qubits are 2 3 eigenstates
- the 8 eigenstates (determined states) refer to:
- a quantum state is a superposition state composed of eigenstates. When the probability amplitude of other states is 0, it is in one of the definite eigenstates.
- solving fluid dynamics problems with numerical methods generally involves the solution of differential equations, which are involved in many scientific and technological fields. Therefore, it is very important to develop effective methods for solving differential equations.
- This specification proposes a processing method for data processing tasks, wherein the data processing tasks include solving general differential equations (including but not limited to partial differential equations containing time items) to solve the problem of spatial derivatives in the case of complex computational domain shapes.
- general differential equations including but not limited to partial differential equations containing time items
- FIG. 2 is a schematic flowchart of a data processing task processing method provided in an embodiment of this specification, which may include the following steps:
- S101 Acquire data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes the differential equation.
- any equation that expresses the relationship between the unknown function, the derivative of the unknown function, and the independent variable is called a differential equation.
- the unknown function is a one-variable function, called an ordinary differential equation;
- the unknown function is a derivative of a multivariate function containing an unknown function, called a partial differential equation, for example etc.
- the data processing task may include solving the following differential equations:
- u is the data processing result of the data processing task, that is, the solution of the differential equation
- x is a variable.
- Step 1 Obtain a group of qubits and set the initial state of the qubits to
- Step 2 using the first type of quantum logic gates to construct the first sub-quantum circuit module that generates the basis set of the function space.
- the first type of quantum logic gates to construct the first sub-quantum circuit module for obtaining the basis set of the function space, which is used to convert the predefined nonlinear function
- the magnitude of the quantum state transformed into the initial state As a function space basis group, where, N is the number of qubits, j is the serial number of the qubit, is the Ry quantum logic gate on the jth qubit.
- T n (x) and U n (x) are Chebyshev n-degree polynomials of the first and second kind respectively, and they have three very key properties, which are linkability, nesting, and easiness of differentiability, These characteristics greatly enrich the characterization capabilities of Chebyshev polynomial basis sets, specifically:
- T n (T m (x)) T mn (x)
- the first type of quantum logic gates may include: Rx quantum logic gates, Ry quantum logic gates and Rz quantum logic gates.
- Step 3 Using the second type of quantum logic gates, constructing a second sub-quantum circuit module for combining function space basis sets into predicted solutions of differential equations.
- the second type of quantum logic gates to construct the second sub-quantum circuit module for combining the function space basis set into the predicted solution of the differential equation, so that the quantum state amplitude of the initial state into the final quantum state and solve the predicted solution of the differential equation according to the final quantum state, where, is the unitary matrix corresponding to the second sub-quantum circuit module.
- the second sub-quantum circuit may include but not limited to: Hardware Efficient Ansatz (HEA) circuit and Alternating Blocks Ansatz (ABA) circuit
- HEA consists of a single quantum rotating connection layer and global entanglement Layer composition, with the deepening of the number of layers, the expressive ability of the circuit is constantly improving, and it will also increase the difficulty of training the circuit
- ABA does not use the global entanglement layer, but divides the circuit into multiple sub-blocks , and use HEA-style circuits in sub-blocks, that is, ABA first establishes local entanglement, and then gradually forms correlated states by interleaving sub-blocks, which helps improve the trainability of circuits and maintains a high degree of expressiveness , and prevent the phenomenon of gradient disappearance in the iterative process.
- the second type of quantum logic gates may include: Rx quantum logic gates, Ry quantum logic gates, Rz quantum logic gates and CNOT quantum logic gates.
- Step 4 Build the measurement operation module for obtaining the predicted solution of the differential equation.
- a measurement operation module acting on the qubit is constructed to measure the final quantum state of the qubit.
- Step 5 sequentially combining the first sub-quantum circuit module, the second sub-quantum circuit module and the measurement operation module to obtain a differentiable quantum circuit.
- the first sub-quantum circuit module, the second sub-quantum circuit module, and the measurement operation module are combined in turn to construct a schematic diagram of a differentiable quantum circuit as shown in Figure 3.
- the black dot and ⁇ icon in the figure represent CNOT Quantum logic gate, wherein, the black dot is on the control bit of the CNOT quantum logic gate, and ⁇ is on the target bit of the CNOT quantum logic gate.
- S103 Predict the target processing result of the data processing task based on the differentiable quantum circuit, and when the value of the loss function constructed according to the predicted processing result obtained from the prediction meets the specified accuracy condition, make the The predicted processing result whose value of the above loss function meets the specified accuracy condition is used as the target processing result.
- Predicting the target processing result of the data processing task based on the differentiable quantum circuit may include the following steps:
- Step 1 Obtain the information of the differential equation to be solved and the initial conditions and boundary conditions satisfied by the solution of the differential equation to be solved.
- Step 2 Constructing a differentiable quantum circuit and determining variational parameters in the differentiable quantum circuit.
- Step 3 Predict the solution of the differential equation through the differentiable quantum circuit according to the initial condition and the boundary condition.
- predicting the solution of the differential equation through the differentiable quantum circuit may include:
- the measurement operator is required Measure the final state to obtain a predicted solution to the differential equation
- the key to this process is the preselection of the measurement operator
- the magnetization of the entire system can be selected as the measurement operator
- Z is the Pauli operator
- the Ising Hamiltonian with additional transverse and longitudinal magnetic fields can also be selected as the measurement operator.
- the expected value Determine the predicted solution f(x) for the differential equation.
- the output result of the quantum circuit that is, the predicted solution f(x) is:
- Constructing a loss function according to the prediction processing result obtained from the prediction may include:
- the L ⁇ (diff) represents that the prediction processing result does not satisfy the error of the above differential equation
- the d x f is the derivative term in the above differential equation
- the f is the function to be found of the above differential equation
- Said x represents a variable
- said L ⁇ (boundary) represents the error that said prediction processing result does not satisfy boundary conditions and initial conditions, said is the regular term error.
- f(x) is the prediction processing result obtained by predicting the above differential equation.
- the following loss function will be generated:
- M is the number of regular points
- u reg ( xi ) is the value of known regular points
- F[d x f( xi ), f( xi ), xi ] in the above formula is as follows:
- the prediction processing result that makes the value of the loss function meet the specified accuracy condition is just the target processing result of the above differential equation; otherwise, it can be updated through the optimization algorithm Variational parameters in differentiable quantum circuits.
- the variational parameter ⁇ is updated by the following formula, namely Among them, n is an integer not less than 1, ⁇ is the learning rate, is the gradient of the loss function to ⁇ , and L is the loss function.
- the updated variational parameters are passed to the differentiable quantum circuit, the evolution and measurement of the above steps are continued, and the prediction processing results and their corresponding loss functions are updated by continuously iterating the variational parameters until the value of the loss function is obtained.
- the predicted processing results that meet the preset accuracy conditions are used as the target processing results of the differential equation.
- the variational parameter ⁇ can be updated; the updated variational parameter can be substituted into the loss function, and the updated loss function can be obtained; the variational parameter can be further updated according to the updated loss function , repeating the above process until the loss function satisfies the predetermined accuracy condition, that is, the prediction processing result that makes the loss function satisfy the preset accuracy condition is taken as the target processing result of the differential equation.
- This embodiment is different from the traditional numerical calculation method to solve differential equations, because this method does not need to numerically discretize the spatial derivative, especially for the complex shape of the calculation domain, it can avoid the resource consumption caused by grid division; in addition, By adding a regular term to the loss function, the existing prior data can be fully utilized to achieve another way to solve the differential equation.
- the data of the data processing task is first obtained, and then a differentiable subcircuit is constructed according to the data processing task, and then the target processing result of the data processing task is predicted based on the differentiable subcircuit, until the result obtained according to the prediction is
- the prediction processing result that makes the value of the loss function meet the specified accuracy condition is set as the target processing result.
- This embodiment can construct a loss function based on the predicted solution and update the value of the loss function to realize another processing method for solving the differential equation and reduce resource consumption caused by grid division.
- DQC Differentiable Quantum Circuits
- FIG. 5 is a schematic flowchart of a solution task of using a quantum circuit to process a time-dependent partial differential equation provided in this embodiment, which may include the following steps:
- S201 Acquire data task data, wherein the data processing task is a task of solving a time-dependent partial differential equation; the data processing task data includes the time-dependent partial differential equation.
- 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 the fields of mechanics, control processes, ecological and economic systems, chemical cycle systems, and epidemiology. The use of partial differential equations to describe problems can fully take into account the influence of space, time, etc., so for partial differential equations that contain time items, they can be called time-dependent partial differential equations.
- time-dependent partial differential equation is obtained as follows:
- u(x,t) is the solution of the time-dependent partial differential equation
- x is the space variable
- t is the time variable
- N'[u(x,t)] is the nonlinear item
- ⁇ is the computational domain, T for time.
- constructing a differentiable quantum circuit may include the following steps:
- S2022 Using the first type of quantum logic gates, constructing a first sub-quantum circuit module that generates a function space basis set.
- the process of constructing the first sub-quantum circuit module is the same as the above-mentioned process of constructing the first sub-quantum circuit, and will not be repeated here.
- S2024 Construct a measurement operation module for obtaining a prediction solution of the time-dependent partial differential equation.
- a measurement operation module acting on the qubit is constructed to measure the final quantum state of the qubit.
- S2025 Combine the first sub-quantum circuit module, the second sub-quantum circuit module, and the measurement operation module in sequence to construct a differentiable quantum circuit.
- the first sub-quantum circuit module, the second sub-quantum circuit module, and the measurement operation module are combined in turn to construct a schematic diagram of a differentiable quantum circuit as shown in Figure 3.
- the black dot and ⁇ icon in the figure represent CNOT Quantum logic gates, where the black dots are in the CNOT On the control bit of the quantum logic gate, ⁇ is on the target bit of the CNOT quantum logic gate.
- S203 Predict the target processing result of the time-dependent partial differential equation based on the initial variational parameters of the differentiable quantum circuit, until the value of the loss function at the current moment constructed according to the predicted processing result obtained from the prediction meets the specified accuracy condition
- the predicted solution of the time-dependent partial differential equation that makes the value of the loss function meet the specified accuracy condition is used as the target solution of the time-dependent partial differential equation.
- Predicting the target processing result of the time-dependent partial differential equation based on the initial variational parameters of the differentiable quantum circuit may include the following steps:
- Step 1 Determine the initial conditions and boundary conditions of the time-dependent partial differential equation.
- Step 2 Determine the time-dependent partial differential equation in semi-discrete form according to a pre-selected differential scheme.
- the difference format is a discretization method that uses numerical methods to calculate the derivative of a function, that is, an algorithm that uses the difference between two or more adjacent numerical points to replace the derivative or partial derivative in the partial differential equation.
- the choice of the difference format is The first step in discretizing or semi-discretizing partial differential equations.
- the time item in the time-containing partial differential equation is firstly Discrete, get If the pre-selected differential format is an implicit differential format, the determination of the time-dependent partial differential equation in semi-discrete form according to the pre-selected differential format includes:
- the u(x, t+ ⁇ t) is the value of the function to be obtained at the time t+ ⁇ t.
- Step 3 According to the initial conditions and boundary conditions, the solution of the time-dependent partial differential equation is predicted through the differentiable quantum circuit.
- the forecasting process is the same as the aforementioned forecasting process, and will not be repeated here.
- Constructing a loss function at the current moment according to the prediction result obtained from the prediction may include:
- N' is the number of discrete points
- M is the number of boundary points
- i is the ith discrete point
- j' is the j'th boundary point
- g( xi ) is the initial condition
- h(x j' ,0) is the boundary condition at the initial moment
- the N'[u(x,t)] is determined according to the differentiable quantum circuits at the previous moment.
- the value of the loss function at the current moment constructed according to the prediction processing results meets the preset accuracy conditions, specifically:
- the target solution of the time-dependent partial differential equation is obtained, mainly by using the pre-selected measurement operator acting on the final quantum state , the predicted solution of the time-dependent partial differential equation at the current moment can be obtained And substitute the predicted solution at the current moment into the loss function at the corresponding moment to determine whether the value of the loss function meets the preset accuracy conditions, where the preset accuracy conditions can be set by the user according to the calculation requirements, for example, 10 -6 or 0 .
- the predicted solution that makes the value of the loss function meet the specified accuracy conditions is just the target solution of the above time-dependent partial differential equation; otherwise, through the optimization algorithm Update variational parameters in differentiable quantum circuits.
- the variational parameter ⁇ is updated by the following formula, namely Among them, n is an integer not less than 1, ⁇ is the learning rate, is the gradient of the loss function to ⁇ , and L is the loss function.
- the updated variational parameters are passed to the differentiable quantum circuit, and the evolution and measurement of the above steps are continued, and through continuous iterative variation Update the prediction solution and its corresponding loss function by sub-parameters until the prediction solution that makes the value of the loss function meet the preset accuracy conditions is obtained, which is used as the target solution of the above time-dependent partial differential equation.
- the loss function at time ⁇ t is obtained, namely:
- the approximate value of the predicted solution at time ⁇ t can be obtained in Determine according to the differentiable quantum circuit at the current moment, then update the variational parameters (parameters in the proposed design), and finally repeat the above steps until the predicted solution u of the time-dependent partial differential equation to be solved at a given time T is obtained (x,T).
- the time-dependent partial differential equation is semi-discretized and transformed into a semi-discrete time-dependent partial differential equation, and by constructing a differentiable quantum circuit and obtaining the predicted solution of the time-dependent partial differential equation corresponding to the initial variational parameters, the
- the classical data structure is connected with the quantum state in the quantum field, and the evolution operation of the classical data structure encoding to the quantum state is performed, and the quantum state of the evolved quantum circuit is obtained, which can use the superposition characteristics of the quantum to speed up processing.
- the high processing speed of solving tasks of time-dependent partial differential equations expands the simulation application scenarios of quantum computing.
- the DQC method has advantages in solving ordinary differential equations and ordinary differential equations, but because the differentiable quantum circuit model needs to use the parameter shift method to calculate the values of the derivatives in the differential equation many times, the calculation efficiency may be reduced.
- an embodiment of this specification combines domain decomposition technology with differentiable quantum circuits, and proposes a method for solving differential equations using quantum computing.
- the differential quantum circuit is solved on the entire computational domain, resulting in a waste of computational resources; on the other hand, it also effectively improves the computational efficiency of optimizing variational parameters.
- FIG. 6 is a schematic flowchart of a method for solving differential equations based on computational domain decomposition provided in this embodiment, which may include the following steps:
- S301 Acquire data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes the differential equation.
- the F is a functional function
- the d x u is a derivative term
- the u is the solution of the differential equation to be solved
- the x is a variable
- the u(x,t) is the solution of the differential equation
- x is the space variable
- t is the time variable
- N'[u(x,t)] is the non-linear item
- ⁇ is the computational domain
- T is the time
- S303 Construct differentiable quantum circuits corresponding to sub-regions, wherein one sub-computational domain corresponds to one predicted solution of the differential equation. Specifically, the process of constructing a differentiable quantum circuit corresponding to a sub-region is the same as the process of constructing a differentiable quantum circuit in the previous two embodiments, and will not be repeated here.
- S304 Predict the target solution of the differential equation based on the differentiable quantum circuit, until the value of the joint loss function of the sub-calculation domain constructed according to the predicted solution of the differential equation meets the specified accuracy condition, the value of the loss function will meet
- the predicted solution of the differential equation for the specified accuracy condition serves as the target solution of the differential equation.
- the prediction process is basically the same as the prediction process in the foregoing embodiments, and will not be repeated here.
- the joint loss function constructed according to the predicted solution of the differential equation may include:
- the n is the number of sub-regions
- the n b is the number of interfaces
- the L i (diff) [d x f i , f i , x] is the predicted solution of the i-th sub-region does not satisfy the differential equation but
- the error caused by L i (boundary) [f i , x] is the error caused by the prediction solution of the i-th sub-region not satisfying the boundary conditions
- the L i (interface) [f, x] is the error caused by the i-th sub-region
- the error caused by the prediction solution of the adjacent areas on both sides of the interface does not meet the continuity condition of the interface and
- the n i is the number of discrete points on the i-th interface
- f + (x j ) and f - (x j ) are the predicted solutions corresponding to the sub-regions on both sides of the interface.
- the target solution of the differential equation is obtained, which is mainly by using the pre-selected measurement operator
- f i (x)> each predicted solution f i (x) of the differential equation is obtained, and the predicted solution is substituted into the joint loss function to determine whether the value of the joint loss function meets the preset accuracy conditions , where the preset accuracy condition can be set by the user according to the calculation requirements, for example, 10 -6 or 0.
- the predicted solution that makes the value of the loss function meet the specified accuracy condition is just the target solution of the above differential equation; otherwise, the differentiable quantum is updated by the optimization algorithm Variational parameters in the circuit.
- the optimization process of variational parameters is basically the same as the optimization process of variational parameters in the foregoing embodiments, and will not be repeated here.
- the classical data structure is connected with the quantum state in the quantum field, and the evolution operation of encoding the classical data structure into the quantum state is performed.
- the quantum state of the evolved quantum circuit which can use the quantum superposition property to speed up the processing speed of the task of solving the differential equation with high complexity, and expand the simulation application scenarios of quantum computing.
- FIG. 9 is a schematic flowchart of a method for using a quantum circuit to solve a differential equation solution task provided by an embodiment of this specification, which may include the following steps:
- S401 Acquire data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes the differential equation and a derivative term of the differential equation.
- the solution of the predicted value of the derivative term of the differential equation in the task of solving the differential equation by using the differentiable quantum circuit described below wherein the derivative term of the differential equation can be divided into different categories, such as the derivative term and can be classified into one class, the derivative term and Belonging to one class, etc.
- the key to its classification is whether the same section of differentiable quantum circuit can be used to solve the predicted value of the derivative term.
- the F is a functional function
- the d x u is a derivative term
- the u is the predicted solution of the differential equation to be solved
- the x is a variable
- S402 Construct differentiable quantum circuits respectively according to the differential equation and derivative terms of the differential equation.
- constructing a differentiable quantum circuit according to the differential equation and the derivative term of the differential equation may include:
- the first differentiable quantum circuit is constructed according to the above differential equation
- the second differentiable quantum circuit is constructed according to the derivative term of the above differential equation
- the predicted solution and the second differential equation corresponding to the current variational parameters in the first differentiable quantum circuit are respectively determined.
- the current variational parameter in the differentiable quantum circuit corresponds to the predicted value of the derivative term of the differential equation.
- S403 Predict the target solution of the differential equation and the value of the derivative term of the differential equation based on the differentiable quantum circuit, until the value of the loss function constructed based on the predicted solution of the differential equation and the predicted value of the derivative term of the differential equation meets the specified accuracy In the case of the condition, the predicted solution of the differential equation that makes the value of the loss function meet the specified accuracy condition is taken as the target solution of the differential equation.
- the prediction process is basically the same as the prediction process in the foregoing embodiments, and will not be repeated here.
- said f i represents the i-th order derivative term in the differential equation
- said L (diff) represents that said predicted solution does not satisfy the error of the differential equation
- said f is said differential equation
- said x represents a variable
- the L (boundary) represents the error that the predicted solution does not satisfy the boundary conditions and initial conditions.
- the target solution of the differential equation is obtained, which is mainly by using the pre-selected measurement operator
- each predicted solution f i (x) of the differential equation and each predicted value f′ i (x) of the derivative term are obtained, and the predicted solution and predicted value are substituted into the loss function to determine the value of the loss function Whether it meets the preset accuracy condition, where the preset accuracy condition can be set by the user according to the calculation requirements, for example, 10 -6 or 0.
- the predicted solution that makes the value of the loss function meet the specified accuracy condition is just the target solution of the differential equation; Variational parameters in quantum circuits.
- the optimization process of variational parameters is basically the same as the optimization process of variational parameters in the foregoing embodiments, and will not be repeated here.
- the classical data structure is connected with the quantum state in the quantum field, and the classical data structure is executed.
- the evolution operation of structure encoding to quantum state obtains the quantum state of the evolved quantum circuit, which can take advantage of the superposition characteristics of quantum to speed up the processing speed of solving tasks of highly complex differential equations and expand the simulation application scenarios of quantum computing.
- FIG. 10 is a schematic structural diagram of a data processing task processing device provided in an embodiment of this specification, corresponding to the process shown in FIG. 2, and the device may include:
- An acquisition module 501 configured to acquire data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes the differential equation;
- a construction module 502 configured to construct a differentiable quantum circuit according to the data processing task data
- the prediction module 503 is configured to predict the target processing result of the data processing task based on the differentiable quantum circuit, and when the value of the loss function constructed according to the predicted prediction processing result meets the specified accuracy condition, the loss The predicted processing result whose value of the function meets the specified accuracy condition is used as the target processing result.
- the acquisition module 501 includes:
- the acquisition unit is used to acquire the information of the differential equation and the initial conditions and boundary conditions satisfied by the solution of the differential equation.
- the building block 502 includes:
- a construction unit for constructing a differentiable quantum circuit and determining variational parameters in the differentiable quantum circuit
- the building units include:
- the first acquisition subunit is used to acquire a group of qubits and set the initial state of the qubits to
- the first construction sub-unit is used to construct the first sub-quantum circuit module of the generating function space basis set by using the first type of quantum logic gate;
- the second construction subunit is used to construct a second sub-quantum circuit module for combining function space basis sets into predicted solutions of differential equations by using the second type of quantum logic gates;
- the third construction subunit is used to construct the measurement operation module for obtaining the prediction solution of the differential equation
- the combination subunit is used to sequentially combine the first sub-quantum circuit module, the second sub-quantum circuit module and the measurement operation module to obtain a differentiable quantum circuit.
- the prediction module 503 includes:
- a prediction unit configured to obtain a predicted solution of the differential equation through the differentiable quantum circuit according to the initial condition and the boundary condition;
- a determining unit configured to determine that the loss function constructed according to the predicted solution of the differential equation meets a preset accuracy condition
- the update unit is used to update the variational parameters through an optimization algorithm for the predicted solution of the differential equation whose loss function does not meet the preset accuracy condition, and obtain the predicted solution of the differential equation corresponding to the updated variational parameter.
- the update unit includes:
- the update subunit is used to update the variational parameter ⁇ through the following formula:
- n is an integer not less than 1
- ⁇ is the learning rate
- ⁇ is the gradient of the loss function to ⁇
- L is the loss function
- the embodiments of this specification also provide a storage medium, where a computer program is stored in the storage medium, wherein the computer program is configured to execute the steps in any one of the above embodiments when running.
- the above-mentioned storage medium may include but not limited to: U disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), mobile hard disk, magnetic disk Or various media such as optical discs that can store computer programs.
- the implementation mode of this specification also provides an electronic device, including a memory and a processor, the computer program is stored in the memory, and the processor is configured to run the computer program to perform any one of the above method embodiments A step of.
- the electronic device may further include a transmission device and an input and output device, wherein the transmission device is connected to the processor, and the input and output device is connected to the processor.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Computational Mathematics (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Pure & Applied Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Theoretical Computer Science (AREA)
- Operations Research (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Algebra (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
Embodiments of the present description provide a processing method and apparatus for a data processing task, a storage medium, and an electronic device. The method comprises: obtaining data processing task data, wherein a data processing task is a solving task of a differential equation, and the data processing task data comprises the differential equation; constructing a differentiable quantum circuit according to the data processing task data; and predicting a target processing result of the data processing task on the basis of the differentiable quantum circuit until when the value of a loss function constructed according to a predicted processing result satisfies a specified precision condition, the predicted processing result enabling the value of the loss function to satisfy the specified precision condition is used as the target processing result. According to the method provided by the embodiments of the present description, the loss function can be constructed on the basis of a predicted solution of the differential equation, and another processing manner of the solving task of the differential equation is realized by updating the value of the loss function, so that the resource consumption caused by grid division is reduced.
Description
本说明书实施方式涉及数据处理领域,具体涉及一种数据处理任务的处理方法、装置、存储介质及电子设备。The embodiments of this specification relate to the field of data processing, and specifically relate to a processing method, device, storage medium, and electronic device for a data processing task.
在计算机领域,硬件或软件功能主要通过处理数据处理任务的形式实现。根据输入数据执行数据处理任务的处理过程,将输出的数据处理任务的处理结果作为指定功能的直接输出或实现指定功能的指令。In the field of computing, hardware or software functions are primarily implemented in the form of processing data processing tasks. Execute the processing process of the data processing task according to the input data, and use the output processing result of the data processing task as the direct output of the specified function or the instruction to realize the specified function.
在很多科学技术领域(例如,流体力学、金融学、生物学、化学等),大量的数据处理任务都涉及到微分方程的求解,如何精准快速处理求解微分方程的数据处理任务就显示出了很重要的应用价值。In many fields of science and technology (for example, fluid mechanics, finance, biology, chemistry, etc.), a large number of data processing tasks involve the solution of differential equations. How to accurately and quickly process the data processing tasks of solving differential equations shows great important application value.
现有的求解微分方程的方法,由于直接求解微分方程在整个计算域的解,存在进行计算域网格划分的资源消耗较大的问题。The existing methods for solving differential equations directly solve the solution of differential equations in the entire computational domain, and there is a problem of large resource consumption for grid division in the computational domain.
量子计算是一种新型计算方式,原理是用量子力学理论构建了一种计算框架。在求解特定问题时,比起最优的经典算法,量子计算有指数加速的效果。Quantum computing is a new type of computing. The principle is to construct a computing framework with the theory of quantum mechanics. Compared with the optimal classical algorithm, quantum computing has the effect of exponential speed-up when solving certain problems.
发明内容Contents of the invention
本说明书实施方式提供了一种数据处理任务的处理方法、装置、存储介质及电子设备,用于减少网格划分所带来的资源消耗。Embodiments of this specification provide a data processing task processing method, device, storage medium, and electronic equipment, which are used to reduce resource consumption caused by grid division.
本说明书的一个实施方式提供了一种数据处理任务的处理方法,所述处理方法包括:获取数据处理任务数据;其中,所述数据处理任务为微分方程的求解任务;所述数据处理任务数据包括所述微分方程;根据所述数据处理任务数据构建可微分量子线路;基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,至在根据所述预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下,将使所述损失函数的值符合指定精度条件的预测处理结果作为目标处理结果。An embodiment of this specification provides a processing method for a data processing task, the processing method comprising: acquiring data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes The differential equation; constructing a differentiable quantum circuit according to the data processing task data; predicting the target processing result of the data processing task based on the differentiable quantum circuit, and constructing the predicted processing result according to the prediction When the value of the loss function meets the specified accuracy condition, the prediction processing result that makes the value of the loss function meet the specified accuracy condition is taken as the target processing result.
本说明书的另一个实施方式中,基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,包括:基于所述可微分量子线路中的变分参数对所述微分方程的目标解进行预测。In another embodiment of this specification, predicting the target processing result of the data processing task based on the differentiable quantum circuit includes: predicting the target of the differential equation based on the variational parameters in the differentiable quantum circuit solution to predict.
本说明书的另一个实施方式中,所述数据处理任务数据还包括所述微分方程的解所满足的初始条件和边界条件;根据所述数据处理任务数据构建可微分量子线路的步骤,包括:根据所述微分方程以及所述微分方程的解所满足的初始条件和边界条件构建所述可微分量子线路,并确定所述可微分量子线路中的变分参数。In another embodiment of this specification, the data processing task data further includes the initial conditions and boundary conditions satisfied by the solution of the differential equation; the step of constructing a differentiable quantum circuit according to the data processing task data includes: The differential equation and the initial conditions and boundary conditions satisfied by the solution of the differential equation construct the differentiable quantum circuit, and determine the variational parameters in the differentiable quantum circuit.
本说明书的另一个实施方式中,根据所述微分方程以及所述微分方程的解所满足的初始条件和边界条件构建所述可微分量子线路,包括:获取一组量子比特并将所述量子比特的初态置为|0>;利用第一类量子逻辑门,构建生成函数空间基组的第一子量子线路模块;利用第二类量子逻辑门,构建用于将函数空间基组组合成微分方程的预测解的第二子量子线路模块;构建用于获得所述微分方程的预测解的测量操作模块;依次将所述第一子量子线路模块、所述第二子量子线路模块和所述测量操作模块组合,得到所述可微分量子线路。In another embodiment of this specification, constructing the differentiable quantum circuit according to the differential equation and the initial conditions and boundary conditions satisfied by the solution of the differential equation includes: acquiring a group of qubits and The initial state of is set to |0>; use the first type of quantum logic gates to construct the first sub-quantum circuit module that generates the function space basis set; use the second type quantum logic gate to construct the function space basis set for combining the differential The second sub-quantum circuit module of the predicted solution of the equation; construct the measurement operation module used to obtain the predicted solution of the differential equation; sequentially connect the first sub-quantum circuit module, the second sub-quantum circuit module and the The measurement operation modules are combined to obtain the differentiable quantum circuit.
本说明书的另一个实施方式中,基于所述可微分量子线路中的变分参数对所述微分方程的目标解进行预测的步骤,包括:通过优化算法更新所述变分参数,基于所述更新后的变分参数对所述微分方程的目标解进行预测。In another embodiment of this specification, the step of predicting the target solution of the differential equation based on the variational parameters in the differentiable quantum circuit includes: updating the variational parameters through an optimization algorithm, based on the updated The latter variational parameters predict the target solution of the differential equation.
本说明书的另一个实施方式中,所述通过优化算法更新所述变分参数,包括:通过以下算式更新所述变分参数θ:其中,所述n为不小于1的整数,α为学习率,L为所述损失函数,为所述损失函数对θ的梯度。In another embodiment of the present specification, the updating of the variational parameters through an optimization algorithm includes: updating the variational parameters θ through the following formula: Wherein, the n is an integer not less than 1, α is the learning rate, and L is the loss function, is the gradient of the loss function to θ.
本说明书的另一个实施方式中,所述损失函数为:
In another embodiment of this specification, the loss function is:
In another embodiment of this specification, the loss function is:
其中,所述Lθ
(diff)表示所述微分方程的预测解不满足所述微分方程的误差,所述dxf表示所述微分方程中的导数项,所述f表示与所述微分方程对应的函数,所述x表示变量,所述Lθ
(boundary)表示所述微分方程的预测解不满足所述边界条件和所述初始条件的误差,所述表示正则项误差。Wherein, the L θ (diff) represents that the predicted solution of the differential equation does not satisfy the error of the differential equation, the d x f represents the derivative term in the differential equation, and the f represents the difference between the differential equation and the differential equation Corresponding function, said x represents a variable, said L θ (boundary) represents the error that the predicted solution of said differential equation does not satisfy said boundary condition and said initial condition, said Indicates the regularization term error.
本说明书的另一个实施方式中,所述微分方程为含时偏微分方程;基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,至在根据所述预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下,将使所述损失函数的值符合指定精度条件的预测处理结果作为目标处理结果的步骤,包括:基于所述可微分量子线路的初始变分参数对所述含时偏微分方程的目标解进行预测,至在根据
所述预测得到的预测处理结果构建的当前时刻的损失函数的值符合指定精度条件的情况下,将使所述损失函数的值符合指定精度条件的所述含时偏微分方程的预测解,作为所述含时偏微分方程的目标解。In another embodiment of this specification, the differential equation is a time-dependent partial differential equation; the target processing result of the data processing task is predicted based on the differentiable quantum circuit, and the predicted processing obtained according to the prediction When the value of the loss function constructed as a result meets the specified accuracy condition, the step of taking the predicted processing result that makes the value of the loss function meet the specified accuracy condition as the target processing result includes: based on the initial variable of the differentiable quantum circuit Predict the target solution of the time-dependent partial differential equation by sub-parameters, until according to If the value of the loss function at the current moment constructed by the prediction processing result obtained by the prediction meets the specified accuracy condition, the predicted solution of the time-dependent partial differential equation that makes the value of the loss function meet the specified accuracy condition is used as The objective solution of the time-dependent partial differential equation.
本说明书的另一个实施方式中,所述含时偏微分方程,包括:
In another embodiment of this specification, the time-dependent partial differential equation includes:
In another embodiment of this specification, the time-dependent partial differential equation includes:
其中,所述u(x,t)为所述含时偏微分方程的解,x为空间变量,t为时间变量,N′[u(x,t)]为非线性项,Ω为计算域,T为时间。Wherein, the u(x, t) is the solution of the time-dependent partial differential equation, x is a space variable, t is a time variable, N'[u(x, t)] is a nonlinear term, and Ω is a computational domain , T is time.
本说明书的另一个实施方式中,所述数据处理任务数据还包括所述含时偏微分方程的初始条件和边界条件;在获取数据处理任务数据的步骤之后,还包括:根据预先选择的差分格式确定半离散形式的所述含时偏微分方程。In another embodiment of this specification, the data processing task data also includes the initial conditions and boundary conditions of the time-dependent partial differential equation; after the step of obtaining the data processing task data, it also includes: A semi-discrete form of the time-dependent partial differential equation is determined.
本说明书的另一个实施方式中,所述预先选择的差分格式为隐式差分格式;所述根据预先选择的差分格式确定半离散形式的所述含时偏微分方程的步骤,包括:确定半离散形式的所述含时偏微分方程为:In another embodiment of this specification, the pre-selected difference format is an implicit difference format; the step of determining the time-dependent partial differential equation in a semi-discrete form according to the pre-selected difference format includes: determining a semi-discrete The time-dependent partial differential equation of the form is:
u(x,t+Δt)=u(x,t)+Δt·N′[u(x,t+Δt)],其中,所述u(x,t+△t)为所述含时偏微分方程在t+△t时刻的解。u(x, t+Δt)=u(x, t)+Δt·N′[u(x, t+Δt)], wherein, the u(x, t+Δt) is the time-dependent partial differential The solution of the equation at time t+△t.
本说明书的另一个实施方式中,基于所述可微分量子线路的初始变分参数对所述含时偏微分方程的目标解进行预测,包括:获取一组量子比特并将所述量子比特的初态置为|0>;利用第一类量子逻辑门,构建生成函数空间基组的第一子量子线路模块;获取初始变分参数并利用第二类量子逻辑门,构建用于将函数空间基组组合成含时偏微分方程的预测解的第二子量子线路模块;构建用于获得所述含时偏微分方程的预测解的测量操作模块;依次将所述第一子量子线路模块、所述第二子量子线路模块和所述测量操作模块组合,构建所述可微分量子线路,并根据获取所述初始变分参数对应的最终量子态确定所述含时偏微分方程的预测解。In another embodiment of this specification, predicting the target solution of the time-dependent partial differential equation based on the initial variational parameters of the differentiable quantum circuit includes: obtaining a group of qubits and Set the state to |0>; use the first type of quantum logic gates to construct the first sub-quantum circuit module that generates the function space basis set; obtain the initial variational parameters and use the second type of quantum logic gates to construct the function space basis set Combining the second sub-quantum circuit module to form the predicted solution of the time-dependent partial differential equation; constructing a measurement operation module for obtaining the predicted solution of the time-dependent partial differential equation; sequentially combining the first sub-quantum circuit module, the The second sub-quantum circuit module is combined with the measurement operation module to construct the differentiable quantum circuit, and determine the predicted solution of the time-dependent partial differential equation according to the obtained final quantum state corresponding to the initial variational parameter.
本说明书的另一个实施方式中,所述确定所述含时偏微分方程的预测解,包括:获取预先选择的测量算子;根据所述最终量子态确定所述测量算子对应的期望值;根据所述期望值确定所述含时偏微分方程的预测解。In another embodiment of this specification, the determination of the predicted solution of the time-dependent partial differential equation includes: obtaining a pre-selected measurement operator; determining the expected value corresponding to the measurement operator according to the final quantum state; according to The expected value determines a predicted solution of the time-dependent partial differential equation.
本说明书的另一个实施方式中,所述第一类量子逻辑门包括:Rx量子逻辑门、Ry量子逻辑门和Rz量子逻辑门;所述第二类量子逻辑门包括:Rx量子逻辑门、Ry量子逻辑门、Rz量子逻辑门和CNOT量子逻辑门。In another embodiment of this specification, the first type of quantum logic gates includes: Rx quantum logic gates, Ry quantum logic gates and Rz quantum logic gates; the second type of quantum logic gates includes: Rx quantum logic gates, Ry quantum logic gates Quantum logic gates, Rz quantum logic gates and CNOT quantum logic gates.
本说明书的另一个实施方式中,所述根据所述预测得到的预测处理结果构建的当前时刻的损失函数,包括:若当前时刻为初始时刻,则初始时刻的损失函数为:
In another embodiment of this specification, the loss function at the current moment constructed according to the prediction processing result obtained from the prediction includes: if the current moment is the initial moment, the loss function at the initial moment is:
In another embodiment of this specification, the loss function at the current moment constructed according to the prediction processing result obtained from the prediction includes: if the current moment is the initial moment, the loss function at the initial moment is:
其中,所述N'为离散点数量,M为边界点的数量,i为第i个离散点,j'为第j'个边界点,为初始时刻的预测处理结果,g(xi)为初始条件,h(xj',0)为初始时刻的边界条件;若当前时刻为△t时刻,则△t时刻的损失函数为:Wherein, the N' is the number of discrete points, M is the number of boundary points, i is the ith discrete point, j' is the j'th boundary point, is the prediction processing result at the initial moment, g( xi ) is the initial condition, h(x j' ,0) is the boundary condition at the initial moment; if the current moment is △t time, then the loss function at △t time is:
其中,所述N'[u(x,t)]根据上一时刻的可微分量子线路确定。Wherein, the N'[u(x,t)] is determined according to the differentiable quantum circuits at the previous moment.
本说明书的另一个实施方式中,所述方法还包括:通过以下算式更新所述变分参数θ:其中,所述n为不小于1的整数,α为学习率,L为所述损失函数,为所述损失函数对θ的梯度。In another embodiment of the present specification, the method further includes: updating the variational parameter θ through the following formula: Wherein, the n is an integer not less than 1, α is the learning rate, and L is the loss function, is the gradient of the loss function to θ.
本说明书的另一个实施方式中,在获取数据处理任务数据的步骤之后,所述方法还包括:获取所述微分方程的计算域并将所述计算域划分为若干相互不重叠的子计算域;根据所述数据处理任务数据构建可微分量子线路的步骤,包括:构建所述子计算域对应的可微分量子线路;其中,一个所述子计算域对应一个所述微分方程的预测解;基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,至在根据所述预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下,将使损失函数的值符合指定精度条件的预测处理结果作为目标处理结果的步骤,包括:基于所述可微分量子线路对所述微分方程的目标解进行预测,至在根据所述微分方程的预测解构建的所述子计算域的联合损失函数的值符合指定精
度条件的情况下,将使损失函数的值符合指定精度条件的所述微分方程的预测解作为所述微分方程的目标解。In another embodiment of the present specification, after the step of acquiring data processing task data, the method further includes: acquiring the computational domain of the differential equation and dividing the computational domain into several non-overlapping sub-computational domains; The step of constructing a differentiable quantum circuit according to the data processing task data includes: constructing a differentiable quantum circuit corresponding to the sub-computational domain; wherein, one sub-computational domain corresponds to a predicted solution of the differential equation; based on the The differentiable quantum circuit predicts the target processing result of the data processing task, and when the value of the loss function constructed according to the predicted processing result meets the specified accuracy condition, the value of the loss function meets the specified accuracy condition. The step of specifying the predicted processing result of the accuracy condition as the target processing result includes: predicting the target solution of the differential equation based on the differentiable quantum circuit, and then constructing the sub-calculation based on the predicted solution of the differential equation The value of the joint loss function of the domain conforms to the specified precision In the case of the accuracy condition, the predicted solution of the differential equation that makes the value of the loss function meet the specified accuracy condition is taken as the target solution of the differential equation.
本说明书的另一个实施方式中,所述微分方程为:
In another embodiment of this description, the differential equation is:
In another embodiment of this description, the differential equation is:
其中,所述F为泛函,所述dxu为导数项,所述u为所述微分方程的解,所述x为变量。Wherein, the F is a functional function, the d x u is a derivative term, the u is the solution of the differential equation, and the x is a variable.
本说明书的另一个实施方式中,基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,包括:基于所述可微分量子线路中的变分参数所述微分方程的目标解进行预测。In another embodiment of this specification, predicting the target processing result of the data processing task based on the differentiable quantum circuit includes: the target solution of the differential equation based on the variational parameters in the differentiable quantum circuit Make predictions.
本说明书的另一个实施方式中,构建所述子计算域对应的可微分量子线路的步骤,包括:获取一组量子比特并将所述量子比特的初态置为|0>;利用第一类量子逻辑门,构建生成函数空间基组的第一子量子线路模块;利用第二类量子逻辑门,构建用于将函数空间基组组合成微分方程的预测解的第二子量子线路模块;构建用于获得所述微分方程的预测解的测量操作模块;依次将所述第一子量子线路模块、所述第二子量子线路模块和所述测量操作模块组合,构建所述可微分量子线路。In another embodiment of this specification, the step of constructing a differentiable quantum circuit corresponding to the sub-computational domain includes: obtaining a group of qubits and setting the initial state of the qubits to |0>; using the first type Quantum logic gates, constructing the first sub-quantum circuit module for generating function space basis sets; utilizing the second type of quantum logic gates, constructing the second sub-quantum circuit module for combining function space basis sets into predicted solutions of differential equations; constructing A measurement operation module for obtaining a predicted solution of the differential equation; sequentially combining the first sub-quantum circuit module, the second sub-quantum circuit module and the measurement operation module to construct the differentiable quantum circuit.
本说明书的另一个实施方式中,基于所述可微分量子线路中的变分参数对所述微分方程的目标解进行预测的步骤,包括:获取预先选择的测量算子;根据所述可微分量子线路中的变分参数对应的最终量子态确定所述测量算子对应的期望值;根据所述期望值确定所述微分方程的预测解。In another embodiment of this specification, the step of predicting the target solution of the differential equation based on the variational parameters in the differentiable quantum circuit includes: obtaining a pre-selected measurement operator; The final quantum state corresponding to the variational parameter in the circuit determines the expected value corresponding to the measurement operator; and determines the predicted solution of the differential equation according to the expected value.
本说明书的另一个实施方式中,所述第一类量子逻辑门包括:Rx量子逻辑门、Ry量子逻辑门和Rz量子逻辑门;所述第二类量子逻辑门包括:Rx量子逻辑门、Ry量子逻辑门、Rz量子逻辑门和CNOT量子逻辑门。In another embodiment of this specification, the first type of quantum logic gates includes: Rx quantum logic gates, Ry quantum logic gates and Rz quantum logic gates; the second type of quantum logic gates includes: Rx quantum logic gates, Ry quantum logic gates Quantum logic gates, Rz quantum logic gates and CNOT quantum logic gates.
本说明书的另一个实施方式中,所述联合损失函数为:
In another embodiment of this specification, the joint loss function is:
In another embodiment of this specification, the joint loss function is:
其中,所述n为子计算域数量,所述nb为交界面数量,所述Li
(diff)[dxfi,fi,x]为第i个子计算域对应的所述微分方程的预测解不满足所述微分方程而引起的误差,所述Li
(boundary)[fi,x]为第i个子计算域的对应的所述微分方程的预测解不满足所述微分方程的解所满足的边界条件而引起的误差,所述Li
(interface)[f,x]为第i个交界面两侧相邻区域对应的所述微分方程的预测解不满***界面连续性条件而引起的误差且所述ni为第i个交界面上离散点的数量,f+(xj)和f-(xj)为交界面两侧的子计算域对应的所述微分方程的预测解。Wherein, the n is the number of sub-computational domains, the nb is the number of interfaces, and the L i (diff) [d x f i , f i , x] is the differential equation corresponding to the i-th sub-computational domain The error caused by the prediction solution not satisfying the differential equation, the L i (boundary) [f i , x] is the prediction solution of the differential equation corresponding to the i-th sub-calculation domain does not satisfy the solution of the differential equation The error caused by the boundary conditions satisfied, the L i (interface) [f, x] is the predicted solution of the differential equation corresponding to the adjacent areas on both sides of the i-th interface does not satisfy the continuity condition of the interface and caused by the error and The n i is the number of discrete points on the i-th interface, and f + (x j ) and f - (x j ) are the predicted solutions of the differential equations corresponding to the sub-calculation domains on both sides of the interface.
本说明书的另一个实施方式中,基于所述可微分量子线路中的变分参数对所述微分方程的目标解进行预测的步骤,包括:利用优化算法更新所述可微分量子线路中的变分参数;根据更新后的所述可微分量子线路中的变分参数,得到更新后的所述微分方程的预测解。In another embodiment of this specification, the step of predicting the target solution of the differential equation based on the variational parameters in the differentiable quantum circuit includes: using an optimization algorithm to update the variational parameters in the differentiable quantum circuit Parameters; according to the updated variational parameters in the differentiable quantum circuit, an updated predicted solution of the differential equation is obtained.
本说明书的另一个实施方式中,所述利用优化算法更新所述可微分量子线路中的变分参数的步骤,包括:In another embodiment of this specification, the step of using an optimization algorithm to update the variational parameters in the differentiable quantum circuit includes:
通过以下算式更新所述变分参数θ:其中,所述n为不小于1的整数,α为学习率,L为所述联合损失函数,为所述联合损失函数对θ的梯度。The variational parameter θ is updated by the following formula: Wherein, the n is an integer not less than 1, α is the learning rate, and L is the joint loss function, is the gradient of the joint loss function to θ.
本说明书的另一个实施方式中,所述数据处理任务数据还包括所述微分方程的导数项;根据所述数据处理任务数据构建可微分量子线路的步骤,包括:根据所述微分方程和所述微分方程的导数项分别构建所述可微分量子线路;基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,至在根据所述预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下,将使所述损失函数的值符合指定精度条件的预测处理结果作为目标处理结果的步骤,包括:基于所述可微分量子线路对所述微分方程的目标解和所述微分方程的导数项的值进行预测至在根据所述微分方程的预测解和所述微分方程的导数项的预测值构建的损失函数的值符合指定精度条件的情况下将使所述损失函数的值符合指定精度条件的所述微分方程预测解作为所述微分方程的目标解。In another embodiment of this specification, the data processing task data further includes the derivative term of the differential equation; the step of constructing a differentiable quantum circuit according to the data processing task data includes: according to the differential equation and the The derivative terms of the differential equation respectively construct the differentiable quantum circuit; predict the target processing result of the data processing task based on the differentiable quantum circuit, and to the loss function constructed according to the predicted processing result obtained by the prediction When the value meets the specified precision condition, the step of taking the predicted processing result that makes the value of the loss function meet the specified precision condition as the target processing result includes: the target solution of the differential equation based on the differentiable quantum circuit and The value of the derivative term of the differential equation is predicted to the value of the loss function constructed from the predicted solution of the differential equation and the predicted value of the derivative term of the differential equation will make the loss A predicted solution of the differential equation whose value of the function satisfies the specified accuracy condition is used as a target solution of the differential equation.
本说明书的另一个实施方式中,所述微分方程为:
In another embodiment of this description, the differential equation is:
In another embodiment of this description, the differential equation is:
其中,所述F为泛函,所述dxu为所述微分方程的导数项,所述u为微分方程的预测解,所述x为变
量。Wherein, the F is a functional function, the d x u is the derivative term of the differential equation, the u is the predicted solution of the differential equation, and the x is the variable quantity.
本说明书的另一个实施方式中,根据所述微分方程和所述微分方程的导数项分别构建所述可微分量子线路的步骤,包括:分别构建用于求解所述微分方程的预测解和用于求解所述微分方程的导数项的预测值的可微分量子线路,并分别确定所述可微分量子线路中的变分参数对应的所述微分方程的预测解和所述微分方程的导数项的预测值。In another embodiment of this specification, the step of respectively constructing the differentiable quantum circuit according to the differential equation and the derivative term of the differential equation includes: respectively constructing the predicted solution for solving the differential equation and the solving the differentiable quantum circuit of the predicted value of the derivative term of the differential equation, and respectively determining the predicted solution of the differential equation and the prediction of the derivative term of the differential equation corresponding to the variational parameters in the differentiable quantum circuit value.
本说明书的另一个实施方式中,所述分别构建用于求解所述微分方程的预测解和用于求解所述导数项的预测值的可微分量子线路,包括:分别获取一组量子比特并将所述量子比特的初态置为|0>;利用第一类量子逻辑门,分别构建生成函数空间基组的第一子量子线路模块;利用第二类量子逻辑门,分别构建用于将函数空间基组组合成所述微分方程的预测解和所述微分方程的导数项的预测值的第二子量子线路模块;分别构建用于获得所述微分方程的预测解和所述微分方程的导数项的预测值的测量操作模块;分别将所述第一子量子线路模块、所述第二子量子线路模块和所述测量操作模块组合,构建所述可微分量子线路。In another embodiment of this specification, said respectively constructing differentiable quantum circuits for solving the predicted solution of the differential equation and for solving the predicted value of the derivative term includes: respectively obtaining a group of qubits and The initial state of the qubit is set to |0>; using the first type of quantum logic gates, respectively constructing the first sub-quantum circuit modules that generate the function space basis set; using the second type of quantum logic gates, respectively constructing the function The space basis set is combined into the second sub-quantum circuit module of the predicted solution of the differential equation and the predicted value of the derivative term of the differential equation; respectively constructed for obtaining the predicted solution of the differential equation and the derivative of the differential equation The measurement operation module of the predicted value of the item; respectively combining the first sub-quantum circuit module, the second sub-quantum circuit module and the measurement operation module to construct the differentiable quantum circuit.
本说明书的另一个实施方式中,所述分别确定所述可微分量子线路中的变分参数对应的微分方程的预测解和所述微分方程的导数项的预测值,包括:获取预先选择的测量算子;分别根据所述可微分量子线路中的变分参数对应的最终量子态确定所述测量算子对应的期望值;根据所述期望值确定所述微分方程的预测解和所述微分方程的导数项的预测值。In another embodiment of the present specification, the respectively determining the predicted solution of the differential equation corresponding to the variational parameter in the differentiable quantum circuit and the predicted value of the derivative term of the differential equation includes: obtaining a pre-selected measurement operator; determine the expected value corresponding to the measurement operator according to the final quantum state corresponding to the variational parameter in the differentiable quantum circuit; determine the predicted solution of the differential equation and the derivative of the differential equation according to the expected value item's predicted value.
本说明书的另一个实施方式中,所述损失函数为:In another embodiment of this specification, the loss function is:
L[fi,f,x]=L(diff)[fi,f,x]+L(boundary)[f,x],其中,所述fi表示所述微分方程中的第i阶导数项,所述L(diff)表示所述微分方程的预测解不满足所述微分方程的误差,所述f为所述微分方程,所述x表示变量,所述L(boundary)表示所述微分方程的预测解不满足所述微分方程的解的边界条件和初始条件的误差。L[f i , f, x]=L (diff) [f i , f, x]+L (boundary) [f, x], wherein said f i represents the i-th order derivative in said differential equation item, the L (diff) represents that the predicted solution of the differential equation does not satisfy the error of the differential equation, the f is the differential equation, the x represents a variable, and the L (boundary) represents the differential equation The error in which the predicted solution of the equation does not satisfy the boundary conditions and initial conditions of the solution of the differential equation.
本说明书的另一个实施方式中,分别确定所述可微分量子线路中的变分参数对应的所述微分方程的预测解和所述微分方程的导数项的预测值,包括:利用优化算法更新所述可微分量子线路中的变分参数;根据更新后的可微分量子线路中的变分参数,得到更新后的所述微分方程的预测解和所述微分方程的导数项的预测值。In another embodiment of this specification, determining the predicted solution of the differential equation and the predicted value of the derivative term of the differential equation corresponding to the variational parameters in the differentiable quantum circuit respectively includes: updating the predicted value of the differential equation by using an optimization algorithm Variational parameters in the differentiable quantum circuit; according to the updated variational parameters in the differentiable quantum circuit, an updated predicted solution of the differential equation and a predicted value of a derivative term of the differential equation are obtained.
本说明书的另一个实施方式中,所述利用优化算法更新所述可微分量子线路中的变分参数的步骤,包括:通过以下算式更新所述变分参数θ:其中,所述n为不小于1的整数,α为学习率,L为所述损失函数,为所述损失函数对θ的梯度。In another embodiment of the present specification, the step of using an optimization algorithm to update the variational parameters in the differentiable quantum circuit includes: updating the variational parameters θ by the following formula: Wherein, the n is an integer not less than 1, α is the learning rate, and L is the loss function, is the gradient of the loss function to θ.
本说明书的一个实施方式提供了一种数据处理任务的处理装置,所述确定装置包括:An embodiment of this specification provides a processing device for a data processing task, and the determining device includes:
获取模块,用于获取数据处理任务数据;其中,所述数据处理任务为微分方程的求解任务;所述数据处理任务数据包括所述微分方程;An acquisition module, configured to acquire data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes the differential equation;
构建模块,用于根据所述数据处理任务数据构建可微分量子线路;a building block, configured to build a differentiable quantum circuit according to the data processing task data;
预测模块,用于基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,至在根据所述预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下;将使所述损失函数的值符合指定精度条件的预测处理结果作为目标处理结果。A prediction module, configured to predict the target processing result of the data processing task based on the differentiable quantum circuit, until the value of the loss function constructed according to the predicted processing result obtained from the prediction meets the specified accuracy condition; The prediction processing result that makes the value of the loss function conform to the specified accuracy condition is taken as the target processing result.
本说明书的一个实施方式提供了一种存储介质,所述存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行上述任一项中所述的方法。An embodiment of the present specification provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the method described in any one of the above when running.
本说明书的一个实施方式提供了一种电子装置,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行上述任一项中所述的方法。One embodiment of the present specification provides an electronic device, including a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to perform any of the above-mentioned method.
与相关技术相比,本申请通过获取数据处理任务数据,根据所述数据处理任务数据构建可微分量子线路,再基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,直至在根据所述预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下,将使所述损失函数的值符合指定精度条件的预测处理结果作为目标处理结果,能够基于预测处理结果构建损失函数并通过更新损失函数的值,实现微分方程的求解,减少网格划分所带来的资源消耗。Compared with related technologies, the present application obtains data processing task data, constructs a differentiable quantum circuit based on the data processing task data, and then predicts the target processing result of the data processing task based on the differentiable quantum circuit, until When the value of the loss function constructed according to the prediction processing result obtained by the prediction meets the specified accuracy condition, the prediction processing result that makes the value of the loss function meet the specified accuracy condition is taken as the target processing result, and can be based on the prediction processing result Build a loss function and update the value of the loss function to solve the differential equation and reduce the resource consumption caused by grid division.
为了更清楚地说明本说明书实施方式或相关技术中的技术方案,下面将对实施方式或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书的一些实施方式,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of this specification or related technologies, the following will briefly introduce the drawings that need to be used in the descriptions of the embodiments or related technologies. Obviously, the drawings in the following description are only Some implementations of the description should therefore not be regarded as limiting the scope. For those skilled in the art, other drawings can also be obtained according to these drawings without creative work.
图1为本说明书实施方式提供的一种数据处理任务的处理方法的计算机终端的硬件结构框图;FIG. 1 is a block diagram of the hardware structure of a computer terminal according to a data processing task processing method provided by an embodiment of this specification;
图2为本说明书实施方式提供的一种数据处理任务的处理方法的流程示意图;FIG. 2 is a schematic flowchart of a processing method for a data processing task provided by an embodiment of this specification;
图3为本说明书实施方式提供的一种可微分量子线路的示意图;Fig. 3 is a schematic diagram of a differentiable quantum circuit provided by an embodiment of this specification;
图4为本说明书实施方式提供的另一种可微分量子线路的示意图;
Fig. 4 is a schematic diagram of another differentiable quantum circuit provided by the embodiment of this specification;
图5为本说明书实施方式提供的另一种数据处理任务的处理方法的流程示意图;FIG. 5 is a schematic flowchart of another data processing task processing method provided by the embodiment of this specification;
图6为本说明书实施方式提供的另一种数据处理任务的处理方法的流程示意图;FIG. 6 is a schematic flowchart of another data processing task processing method provided by the implementation mode of this specification;
图7是本说明书实施方式提供的一种计算域划分的示意图;FIG. 7 is a schematic diagram of a calculation domain division provided by an embodiment of this specification;
图8为本说明书实施方式提供的另一种可微分量子线路的示意图;Fig. 8 is a schematic diagram of another differentiable quantum circuit provided by the embodiment of this specification;
图9为本说明书实施方式提供的另一种数据处理任务的处理方法的流程示意图;FIG. 9 is a schematic flowchart of another method for processing a data processing task provided by an embodiment of this specification;
图10为本说明书实施方式提供的一种数据处理任务的处理装置的结构示意图。FIG. 10 is a schematic structural diagram of a processing device for a data processing task provided by an embodiment of this specification.
下面通过参考附图描述的实施例是示例性的,仅用于解释本发明,而不能解释为对本发明的限制。The embodiments described below by referring to the figures are exemplary only for explaining the present invention and should not be construed as limiting the present invention.
本说明书的一个实施方式提供了一种数据处理任务的处理方法,该方法可以应用于电子设备,如计算机终端,具体如普通电脑、量子计算机等。An embodiment of this specification provides a method for processing data processing tasks, and the method can be applied to electronic devices, such as computer terminals, specifically, ordinary computers, quantum computers, and the like.
下面以运行在计算机终端上为例对其进行详细说明。图1为本说明书实施方式提供的一种数据处理任务的处理方法的计算机终端的硬件结构框图。如图1所示,计算机终端可以包括一个或多个(图1中仅示出一个)处理器102和用于存储数据的存储器104,其中,处理器102可以包括但不限于微处理器(Microcontroller Unit,MCU)或可编程逻辑器件(Field Programmable Gate Array,FPGA)等的处理装置。在一些实施方式中,上述计算机终端还可以包括用于通信功能的传输装置106以及输入输出设备108。本领域普通技术人员可以理解,图1所示的结构仅为示意,其并不对上述计算机终端的结构造成限定。例如,计算机终端还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。The following will describe it in detail by taking it running on a computer terminal as an example. FIG. 1 is a block diagram of a hardware structure of a computer terminal according to a data processing task processing method provided by an embodiment of this specification. As shown in FIG. 1 , the computer terminal may include one or more (only one is shown in FIG. 1 ) processors 102 and a memory 104 for storing data, wherein the processor 102 may include but not limited to a microprocessor (Microcontroller Unit, MCU) or a processing device such as a programmable logic device (Field Programmable Gate Array, FPGA). In some implementations, the above-mentioned computer terminal may further include a transmission device 106 and an input and output device 108 for communication functions. Those skilled in the art can understand that the structure shown in FIG. 1 is only for illustration, and it does not limit the structure of the above computer terminal. For example, the computer terminal may also include more or fewer components than shown in FIG. 1 , or have a different configuration than that shown in FIG. 1 .
存储器104可用于存储应用软件的软件程序以及模块,如本说明书实施方式中的实现一种数据处理任务的处理方法对应的程序指令/模块,处理器102通过运行存储在存储器104内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的方法。存储器104可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器104可进一步包括相对于处理器102远程设置的存储器,这些远程存储器可以通过网络连接至计算机终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 104 can be used to store software programs and modules of application software, such as program instructions/modules corresponding to a processing method for implementing a data processing task in the embodiment of this specification, and the processor 102 runs the software programs stored in the memory 104 and module, so as to execute various functional applications and data processing, that is, to realize the above-mentioned 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 examples, the memory 104 may further include a memory that is remotely located relative to the processor 102, and these remote memories may be connected to a computer terminal through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
传输装置106用于经由一个网络接收或者发送数据。上述的网络具体实例可包括计算机终端的通信供应商提供的无线网络。在一个实例中,传输装置106包括一个网络适配器(Network Interface Controller,NIC),其可通过基站与其他网络设备相连从而可与互联网进行通讯。在一个实例中,传输装置106可以为射频(Radio Frequency,RF)模块,其用于通过无线方式与互联网进行通讯。The transmission device 106 is used to receive or transmit data via a network. The specific example of the above-mentioned network may include a wireless network provided by the communication provider of the computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet in a wireless manner.
需要说明的是,真正的量子计算机是混合结构的,它包含两大部分:一部分是经典计算机,负责执行经典计算与控制;另一部分是量子设备,负责运行量子程序进而实现量子计算。而量子程序是由量子语言如QRunes语言编写的一串能够在量子计算机上运行的指令序列,实现了对量子逻辑门操作的支持,并最终实现量子计算。具体的说,量子程序就是一系列按照一定时序操作量子逻辑门的指令序列。It should be noted that a real quantum computer has a hybrid structure, which consists of two parts: one is a classical computer, which is responsible for performing classical calculation and control; the other is a quantum device, which is responsible for running quantum programs and realizing quantum computing. The quantum program is a series of instruction sequences written in a quantum language such as QRunes that can be run on a quantum computer, which supports the operation of quantum logic gates and finally realizes quantum computing. Specifically, a quantum program is a series of instruction sequences that operate quantum logic gates in a certain sequence.
在实际应用中,因受限于量子设备硬件的发展,通常需要进行量子计算模拟以验证量子算法、量子应用等等。量子计算模拟即借助普通计算机的资源搭建的虚拟架构(即量子虚拟机)实现特定问题对应的量子程序的模拟运行的过程。通常,需要构建特定问题对应的量子程序。本说明书实施方式所指量子程序,即是经典语言编写的表征量子比特及其演化的程序,其中与量子计算相关的量子比特、量子逻辑门等等均有相应的经典代码表示。In practical applications, due to the limitation of the development of quantum device hardware, quantum computing simulations are usually required to verify quantum algorithms, quantum applications, etc. Quantum computing simulation is the process of simulating the quantum program corresponding to a specific problem using a virtual architecture built with the resources of an ordinary computer (that is, a quantum virtual machine). Often, quantum programs corresponding to specific problems need to be constructed. The quantum program referred to in the implementation mode of this specification refers to a program written in a classical language that characterizes qubits and their evolution, in which qubits, quantum logic gates, etc. related to quantum computing are represented by corresponding classical codes.
量子线路作为量子程序的一种体现方式,也称量子逻辑电路,是最常用的通用量子计算模型,表示在抽象概念下对于量子比特进行操作的线路,其组成包括量子比特、线路(时间线),以及各种量子逻辑门,最后常需要通过量子测量操作将结果读取出来。As an embodiment of quantum programs, quantum circuits are also called quantum logic circuits. They are the most commonly used general-purpose quantum computing models. They represent circuits that operate on qubits under an abstract concept. The components include qubits, circuits (timelines) , and various quantum logic gates, the results often need to be read out through quantum measurement operations.
不同于传统电路是用金属线所连接以传递电压信号或电流信号,在量子线路中,线路可看成是由时间所连接,亦即量子比特的状态随着时间自然演化,在这过程中按照哈密顿运算符的指示,一直到遇上逻辑门而***作。Unlike traditional circuits, which are connected by metal wires to transmit voltage signals or current signals, in quantum circuits, the circuits can be regarded as connected by time, that is, the state of qubits evolves naturally with time, in the process according to The instruction of the Hamiltonian operator is operated until it encounters a logic gate.
一个量子程序整体上对应有一条总的量子线路,本说明书所述量子程序即指该条总的量子线路,其中,该总的量子线路中的量子比特总数与量子程序的量子比特总数相同。可以理解为:一个量子程序可以由量子线路、针对量子线路中量子比特的测量操作、保存测量结果的寄存器及控制流节点(跳转指令)组成,一条量子线路可以包含几十上百个甚至千上万个量子逻辑门操作。量子程序的执行过程,就是对所有的量子逻辑门按照一定时序执行的过程。需要说明的是,时序即单个量子逻辑门被执行的时间顺序。A quantum program as a whole corresponds to a total quantum circuit, and the quantum program mentioned in this specification refers to the total quantum circuit, wherein the total number of qubits in the total quantum circuit is the same as the total number of qubits in the quantum program. It can be understood as: a quantum program can be composed of quantum circuits, measurement operations for qubits in quantum circuits, registers for saving measurement results, and control flow nodes (jump instructions). A quantum circuit can contain tens, hundreds or even thousands of Tens of thousands of quantum logic gate operations. The execution process of a quantum program is the process of executing all quantum logic gates according to a certain time sequence. It should be noted that timing refers to the time sequence in which a single quantum logic gate is executed.
需要说明的是,经典计算中,最基本的单元是比特,而最基本的控制模式是逻辑门,可以通过逻辑门的组合来达到控制电路的目的。类似地,处理量子比特的方式就是量子逻辑门。使用量子逻辑门,能够使量子态发生演化,量子逻辑门是构成量子线路的基础,量子逻辑门包括单比特量子逻辑门,如Hadamard
门(H门,哈德玛门)、泡利-X门(X门)、泡利-Y门(Y门)、泡利-Z门(Z门)、RX门、RY门、RZ门等等;多比特量子逻辑门,如CNOT门、CR门、iSWAP门、Toffoli门等等。量子逻辑门一般使用酉矩阵表示,而酉矩阵不仅是矩阵形式,也是一种操作和变换。一般量子逻辑门在量子态上的作用是通过酉矩阵左乘以量子态右矢对应的矩阵进行计算的。It should be noted that in classical computing, the most basic unit is a bit, and the most basic control mode is a logic gate. The purpose of controlling a circuit can be achieved through the combination of logic gates. Similarly, the way to handle qubits is quantum logic gates. Quantum logic gates can be used to evolve quantum states. Quantum logic gates are the basis of quantum circuits. Quantum logic gates include single-bit quantum logic gates, such as Hadamard Gate (H gate, Hadema gate), Pauli-X gate (X gate), Pauli-Y gate (Y gate), Pauli-Z gate (Z gate), RX gate, RY gate, RZ gate, etc. etc.; multi-bit quantum logic gates, such as CNOT gates, CR gates, iSWAP gates, Toffoli gates, etc. Quantum logic gates are generally represented by unitary matrices, and unitary matrices are not only in the form of matrices, but also a kind of operation and transformation. Generally, the effect of a quantum logic gate on a quantum state is calculated by multiplying the left side of the unitary matrix by the matrix corresponding to the right vector of the quantum state.
本领域技术人员可以理解的是,在经典计算机中,信息的基本单元是比特,一个比特有0和1两种状态,最常见的物理实现方式是通过电平的高低来表示这两种状态。在量子计算中,信息的基本单元是量子比特,一个量子比特也有0和1两种状态,记为|0>和|1>,但它可以处于0和1两种状态的叠加态,可表示为其中,a、b为表示|0>态、|1>态振幅(概率幅)的复数,这是经典比特不具备的。测量后,量子比特的状态会塌缩至一个确定的状态(本征态,此处为|0>态、|1>态),其中,塌缩至|0>的概率是|a|2,塌缩至|1>的概率是|b|2,|a|2+|b|2=1,|>为狄拉克符号。Those skilled in the art can understand that in a classical computer, the basic unit of information is a bit, and a bit has two states of 0 and 1, and the most common physical implementation method is to represent these two states through the level. In quantum computing, the basic unit of information is the qubit. A qubit also has two states of 0 and 1, denoted as |0> and |1>, but it can be in the superposition state of the two states of 0 and 1, which can be expressed for Among them, a and b are complex numbers representing the amplitude (probability amplitude) of |0> state and |1> state, which is not available in classical bits. After measurement, the state of the qubit will collapse to a certain state (eigenstate, here is |0> state, |1> state), where the probability of collapse to |0> is |a| 2 , The probability of collapsing to |1> is |b| 2 , |a| 2 + |b| 2 =1, and |> is the Dirac symbol.
量子态,即指量子比特的状态,其本征态在量子算法(或称量子程序)中用二进制表示。例如,一组量子比特为q0、q1、q2,表示第0位、第1位、第2位量子比特,从高位到低位排序为q2q1q0,该组量子比特的量子态为23个本征态的叠加态,8个本征态(确定的状态)是指:|000>、|001>、|010>、|011>、|100>、|101>、|110>、|111>,每个本征态与量子比特位对应一致,如|000>态,000从高位到低位对应q2q1q0。简言之,量子态是各本征态组成的叠加态,当其他态的概率幅为0时,即处于其中一个确定的本征态。相关技术中,采用数值方法解决流体力学问题普遍涉及微分方程的求解,在很多科学技术领域都涉及到微分方程的求解,因此发展有效的微分方程的求解方法是至关重要的。The quantum state refers to the state of a qubit, and its eigenstate is expressed in binary in a quantum algorithm (or called a quantum program). For example, a group of qubits is q0, q1, and q2, representing the 0th, 1st, and 2nd qubits, and the order from high to low is q2q1q0, and the quantum states of this group of qubits are 2 3 eigenstates , the 8 eigenstates (determined states) refer to: |000>, |001>, |010>, |011>, |100>, |101>, |110>, |111>, each The eigenstates are consistent with the qubit bits, such as the |000> state, and 000 corresponds to q2q1q0 from high to low. In short, a quantum state is a superposition state composed of eigenstates. When the probability amplitude of other states is 0, it is in one of the definite eigenstates. In related technologies, solving fluid dynamics problems with numerical methods generally involves the solution of differential equations, which are involved in many scientific and technological fields. Therefore, it is very important to develop effective methods for solving differential equations.
可以理解的是,无论是通过经典计算机还是量子计算机求解微分方程,均是通过建立数据处理任务,执行数据处理任务的处理过程,得到数据处理任务的处理结果的方式实现的。It can be understood that, no matter the classical computer or the quantum computer is used to solve the differential equation, it is realized by establishing a data processing task, executing the processing process of the data processing task, and obtaining the processing result of the data processing task.
本说明书提出一种数据处理任务的处理方法,其中数据处理任务包括求解一般性微分方程(包括但不限于含有时间项的偏微分方程),以解决针对计算域形状复杂的情形下对空间导数进行数值离散资源消耗较高的问题;进一步可以提高已有的先验数据的利用率。This specification proposes a processing method for data processing tasks, wherein the data processing tasks include solving general differential equations (including but not limited to partial differential equations containing time items) to solve the problem of spatial derivatives in the case of complex computational domain shapes. The problem of high resource consumption for numerical discreteness; it can further improve the utilization rate of existing prior data.
参见图2,图2为本说明书一个实施方式提供的一种数据处理任务的处理方法的流程示意图,可以包括如下步骤:Referring to FIG. 2, FIG. 2 is a schematic flowchart of a data processing task processing method provided in an embodiment of this specification, which may include the following steps:
S101:获取数据处理任务数据;其中,所述数据处理任务为微分方程的求解任务;所述数据处理任务数据包括所述微分方程。S101: Acquire data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes the differential equation.
具体的,凡是表示未知函数、未知函数的导数与自变量之间的关系的方程,叫做微分方程。其中,未知函数是一元函数的,叫常微分方程;未知函数是多元函数的含有未知函数的导数,叫做偏微分方程,例如等都是微分方程。示例性的,数据处理任务可以包括对以下微分方程进行求解:
Specifically, any equation that expresses the relationship between the unknown function, the derivative of the unknown function, and the independent variable is called a differential equation. Among them, the unknown function is a one-variable function, called an ordinary differential equation; the unknown function is a derivative of a multivariate function containing an unknown function, called a partial differential equation, for example etc. are differential equations. Exemplarily, the data processing task may include solving the following differential equations:
Specifically, any equation that expresses the relationship between the unknown function, the derivative of the unknown function, and the independent variable is called a differential equation. Among them, the unknown function is a one-variable function, called an ordinary differential equation; the unknown function is a derivative of a multivariate function containing an unknown function, called a partial differential equation, for example etc. are differential equations. Exemplarily, the data processing task may include solving the following differential equations:
其中,u为数据处理任务的数据处理结果,即为微分方程的解,x为变量。Among them, u is the data processing result of the data processing task, that is, the solution of the differential equation, and x is a variable.
S102:根据所述数据处理任务数据构建可微分量子线路。S102: Construct a differentiable quantum circuit according to the data processing task data.
具体的,为能够清晰地阐明本说明书技术方案的思路,下面将首先对可微分量子线路进行详细的介绍,在此基础上再对本技术方案进行阐述。对于构建可微分量子线路,可以包括如下步骤:Specifically, in order to clearly illustrate the idea of the technical solution in this specification, the differentiable quantum circuit will first be introduced in detail below, and then the technical solution will be described on this basis. For the construction of differentiable quantum circuits, the following steps can be included:
步骤1:获取一组量子比特并将所述量子比特的初态置为|0>。Step 1: Obtain a group of qubits and set the initial state of the qubits to |0>.
步骤2:利用第一类量子逻辑门,构建生成函数空间基组的第一子量子线路模块。Step 2: using the first type of quantum logic gates to construct the first sub-quantum circuit module that generates the basis set of the function space.
具体的,利用第一类量子逻辑门,构建用以获取函数空间基组的第一子量子线路模块,用于将预定义的非线性函数转化为初始状态的量子态幅值作为函数空间基组,其中,N为量子比特数,j为量子比特的序号,为第j个量子比特上的Ry量子逻辑门。Specifically, use the first type of quantum logic gates to construct the first sub-quantum circuit module for obtaining the basis set of the function space, which is used to convert the predefined nonlinear function The magnitude of the quantum state transformed into the initial state As a function space basis group, where, N is the number of qubits, j is the serial number of the qubit, is the Ry quantum logic gate on the jth qubit.
示例性的,假设取预定义的非线性函数并带入得到:
Exemplary, assume a predefined nonlinear function and bring in get:
Exemplary, assume a predefined nonlinear function and bring in get:
其中,Tn(x)和Un(x)分别为第一和第二类切比雪夫n次多项式,它们具有三个非常关键的特性,分别是链接性、嵌套性、易微性,这些特性极大丰富了切比雪夫多项式基组的表征能力,具体的:Among them, T n (x) and U n (x) are Chebyshev n-degree polynomials of the first and second kind respectively, and they have three very key properties, which are linkability, nesting, and easiness of differentiability, These characteristics greatly enrich the characterization capabilities of Chebyshev polynomial basis sets, specifically:
链接性:2Tn(x)Tm(x)=Tm+n(x)+T|m-n|(x)Linkability: 2T n (x)T m (x)=T m+n (x)+T |mn| (x)
嵌套性:Tn(Tm(x))=Tmn(x)
Nesting: T n (T m (x)) = T mn (x)
易微性:
Differentiability:
相关近似理论指出任何光滑函数f(x)均可以表示为
Correlation approximation theory points out that any smooth function f(x) can be expressed as
其中,第一类量子逻辑门可以包括:Rx量子逻辑门、Ry量子逻辑门和Rz量子逻辑门。Wherein, the first type of quantum logic gates may include: Rx quantum logic gates, Ry quantum logic gates and Rz quantum logic gates.
步骤3:利用第二类量子逻辑门,构建用于将函数空间基组组合成微分方程的预测解的第二子量子线路模块。Step 3: Using the second type of quantum logic gates, constructing a second sub-quantum circuit module for combining function space basis sets into predicted solutions of differential equations.
具体的,利用第二类量子逻辑门,构建用于将函数空间基组组合成微分方程的预测解的第二子量子线路模块,以将所述初始状态的量子态幅值转化为最终量子态并根据最终量子态求解微分方程的预测解,其中,
为第二子量子线路模块对应的酉矩阵。Specifically, use the second type of quantum logic gates to construct the second sub-quantum circuit module for combining the function space basis set into the predicted solution of the differential equation, so that the quantum state amplitude of the initial state into the final quantum state and solve the predicted solution of the differential equation according to the final quantum state, where, is the unitary matrix corresponding to the second sub-quantum circuit module.
其中,第二子量子线路可以包括但不限于:硬件高效拟设(Hardware Efficient Ansatz,HEA)线路和交替块拟设(Alternating Blocks Ansatz,ABA)线路,HEA由单量子旋转的连接层和全局纠缠层构成,随着层数的加深,线路的表达能力在不断提升,同时也会导致线路的训练难度增大;与HEA不同,ABA并未使用全局纠缠层,而是将线路分成了多个子块,并在子块中使用HEA形式的线路,也就是说,ABA首先建立了局部纠缠,然后通过交错子块逐渐形成相关状态,其有助于提高线路的可训练性,并且保持高度的表达能力,以及防止迭代过程中的梯度消失现象的发生。Among them, the second sub-quantum circuit may include but not limited to: Hardware Efficient Ansatz (HEA) circuit and Alternating Blocks Ansatz (ABA) circuit, HEA consists of a single quantum rotating connection layer and global entanglement Layer composition, with the deepening of the number of layers, the expressive ability of the circuit is constantly improving, and it will also increase the difficulty of training the circuit; unlike HEA, ABA does not use the global entanglement layer, but divides the circuit into multiple sub-blocks , and use HEA-style circuits in sub-blocks, that is, ABA first establishes local entanglement, and then gradually forms correlated states by interleaving sub-blocks, which helps improve the trainability of circuits and maintains a high degree of expressiveness , and prevent the phenomenon of gradient disappearance in the iterative process.
其中,第二类量子逻辑门可以包括:Rx量子逻辑门、Ry量子逻辑门、Rz量子逻辑门和CNOT量子逻辑门。Wherein, the second type of quantum logic gates may include: Rx quantum logic gates, Ry quantum logic gates, Rz quantum logic gates and CNOT quantum logic gates.
步骤4:构建用于获得微分方程的预测解的测量操作模块。Step 4: Build the measurement operation module for obtaining the predicted solution of the differential equation.
具体的,构建作用于量子比特的测量操作模块,以对量子比特的最终量子态进行测量。Specifically, a measurement operation module acting on the qubit is constructed to measure the final quantum state of the qubit.
步骤5:依次将所述第一子量子线路模块、所述第二子量子线路模块和所述测量操作模块组合,得到可微分量子线路。Step 5: sequentially combining the first sub-quantum circuit module, the second sub-quantum circuit module and the measurement operation module to obtain a differentiable quantum circuit.
具体的,依次将第一子量子线路模块、第二子量子线路模块和测量操作模块组合,构建如图3所示的一种可微分量子线路的示意图,图中黑色圆点和⊕图标代表CNOT量子逻辑门,其中,黑色圆点在CNOT量子逻辑门的控制比特上,⊕在CNOT量子逻辑门的目标比特上。Specifically, the first sub-quantum circuit module, the second sub-quantum circuit module, and the measurement operation module are combined in turn to construct a schematic diagram of a differentiable quantum circuit as shown in Figure 3. The black dot and ⊕ icon in the figure represent CNOT Quantum logic gate, wherein, the black dot is on the control bit of the CNOT quantum logic gate, and ⊕ is on the target bit of the CNOT quantum logic gate.
在经过第一子量子线路、第二子量子线路之后,需要读取量子线路的信息,并获取变分参数对应的最终量子态。After passing through the first sub-quantum circuit and the second sub-quantum circuit, it is necessary to read the information of the quantum circuit and obtain the final quantum state corresponding to the variational parameters.
S103:基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,至在根据所述预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下,将使所述损失函数的值符合指定精度条件的预测处理结果作为目标处理结果。S103: Predict the target processing result of the data processing task based on the differentiable quantum circuit, and when the value of the loss function constructed according to the predicted processing result obtained from the prediction meets the specified accuracy condition, make the The predicted processing result whose value of the above loss function meets the specified accuracy condition is used as the target processing result.
基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,可以包括如下步骤:Predicting the target processing result of the data processing task based on the differentiable quantum circuit may include the following steps:
步骤1:获取待求解微分方程的信息以及所述待求解微分方程的解所满足的初始条件和边界条件。Step 1: Obtain the information of the differential equation to be solved and the initial conditions and boundary conditions satisfied by the solution of the differential equation to be solved.
具体的,微分方程的解一般有多个,但是解决具体的物理问题的时候,必须从中选取所需要的解,因此,还必须知道附加条件,也就是初始条件和边界条件。接上述示例,其中u(x0)=u0可以作为初始条件或边界条件。Specifically, there are generally multiple solutions to differential equations, but when solving specific physical problems, the required solution must be selected from them. Therefore, additional conditions must be known, that is, initial conditions and boundary conditions. Following the above example, where u(x 0 )=u 0 can be used as an initial condition or a boundary condition.
步骤2:构建可微分量子线路并确定所述可微分量子线路中的变分参数。Step 2: Constructing a differentiable quantum circuit and determining variational parameters in the differentiable quantum circuit.
步骤3:根据所述初始条件和所述边界条件,通过所述可微分量子线路对所述微分方程的解进行预测。Step 3: Predict the solution of the differential equation through the differentiable quantum circuit according to the initial condition and the boundary condition.
具体的,通过所述可微分量子线路对所述微分方程的解进行预测,可以包括:Specifically, predicting the solution of the differential equation through the differentiable quantum circuit may include:
a.获取预先选择的测量算子。a. Obtain a pre-selected measurement operator.
经过上述可微分量子线路之后,得到最终态为读取量子态信息,需用测量算子对最终态进行测量,得到微分方程的预测解此过程的关键是预先选择测量算子可以选择但不限于选择整个***的磁化作为测量算子即其中,Z为泡利算子;此外,还可以选择具有附加横向和纵向磁场的伊辛哈密顿量作为测量算子。After going through the above differentiable quantum circuits, the final state is obtained In order to read the quantum state information, the measurement operator is required Measure the final state to obtain a predicted solution to the differential equation The key to this process is the preselection of the measurement operator Optionally, but not limited to, the magnetization of the entire system can be selected as the measurement operator Right now Among them, Z is the Pauli operator; in addition, the Ising Hamiltonian with additional transverse and longitudinal magnetic fields can also be selected as the measurement operator.
b.根据所述最终量子态确定所述测量算子对应的期望值。b. Determine the expected value corresponding to the measurement operator according to the final quantum state.
具体的,根据最终量子态确定测量算子对应的期望值其中,期望值
Specifically, according to the final quantum state Determine the measurement operator corresponding expected value Among them, the expected value
c.根据所述期望值确定所述微分方程的预测解。c. Determining a predicted solution of said differential equation based on said expected value.
具体的,将期望值确定为微分方程的预测解f(x)。Specifically, the expected value Determine the predicted solution f(x) for the differential equation.
示例性的,求解上述微分方程,为方便说明,仅采用一个量子比特的线路进行演示,构建如图4所示的另一种可微分量子线路示意图,测量算子经测量操作后该量子线路的输出结果即为预测解f(x)。Exemplarily, to solve the above differential equation, for the convenience of illustration, only one qubit circuit is used for demonstration, and another differentiable quantum circuit schematic diagram is constructed as shown in Figure 4, and the measurement operator The output result of the quantum circuit after the measurement operation is the predicted solution f(x).
其中,当预定义的非线性函数时,根据第一子量子线路生成的函数空间基组的表达
式为:
Among them, when the predefined nonlinear function When , according to the expression of the function space basis set generated by the first sub-quantum circuit The formula is:
Among them, when the predefined nonlinear function When , according to the expression of the function space basis set generated by the first sub-quantum circuit The formula is:
利用Rx和Rz量子逻辑门构建用于将上述函数空间基组组合成微分方程的预测解的第二子量子线路,根据第二子量子线路将上述函数空间基组组合成微分方程的预测解的表达式为:
Utilizing Rx and Rz quantum logic gates to construct a second sub-quantum circuit for combining the above-mentioned function space basis sets into a predicted solution of the differential equation, and combining the above-mentioned function space basis sets into the prediction solution of the differential equation according to the second sub-quantum circuit The expression is:
Utilizing Rx and Rz quantum logic gates to construct a second sub-quantum circuit for combining the above-mentioned function space basis sets into a predicted solution of the differential equation, and combining the above-mentioned function space basis sets into the prediction solution of the differential equation according to the second sub-quantum circuit The expression is:
因此最终量子态为:
So the final quantum state is:
So the final quantum state is:
通过测量操作模块,经过测量操作之后,该量子线路的输出结果,即预测解f(x)为:
Through the measurement operation module, after the measurement operation, the output result of the quantum circuit, that is, the predicted solution f(x) is:
Through the measurement operation module, after the measurement operation, the output result of the quantum circuit, that is, the predicted solution f(x) is:
根据所述预测得到的预测处理结果构建损失函数,可以包括:Constructing a loss function according to the prediction processing result obtained from the prediction may include:
构建损失函数的形式如下:
The form of constructing the loss function is as follows:
The form of constructing the loss function is as follows:
其中,所述Lθ
(diff)表示所述预测处理结果不满足上述微分方程的误差,所述dxf为上述微分方程中的导数项,所述f为上述微分方程的待求函数,所述x表示变量,所述Lθ
(boundary)表示所述预测处理结果不满足边界条件和初始条件的误差,所述为正则项误差。Wherein, the L θ (diff) represents that the prediction processing result does not satisfy the error of the above differential equation, the d x f is the derivative term in the above differential equation, and the f is the function to be found of the above differential equation, so Said x represents a variable, said L θ (boundary) represents the error that said prediction processing result does not satisfy boundary conditions and initial conditions, said is the regular term error.
示例性的,接上述示例,f(x)是对上述微分方程进行预测得到的预测处理结果,在初始阶段由于该预测处理结果不满足微分方程和初始条件,因此会产生如下损失函数:
Exemplarily, following the above example, f(x) is the prediction processing result obtained by predicting the above differential equation. In the initial stage, since the prediction processing result does not satisfy the differential equation and the initial conditions, the following loss function will be generated:
Exemplarily, following the above example, f(x) is the prediction processing result obtained by predicting the above differential equation. In the initial stage, since the prediction processing result does not satisfy the differential equation and the initial conditions, the following loss function will be generated:
其中,
Lθ (boundary)[f,x]=(f(x0)-u0)2
in,
L θ (boundary) [f, x]=(f(x 0 )-u 0 ) 2
Lθ (boundary)[f,x]=(f(x0)-u0)2
in,
L θ (boundary) [f, x]=(f(x 0 )-u 0 ) 2
其中,M为正则点的数量,ureg(xi)为已知正则点的值,且上式中F[dxf(xi),f(xi),xi]的定义如下:
Among them, M is the number of regular points, u reg ( xi ) is the value of known regular points, and the definition of F[d x f( xi ), f( xi ), xi ] in the above formula is as follows:
Among them, M is the number of regular points, u reg ( xi ) is the value of known regular points, and the definition of F[d x f( xi ), f( xi ), xi ] in the above formula is as follows:
若根据预测处理结果构建的损失函数的值符合预设精度条件,则使所述损失函数的值符合指定精度条件的预测处理结果正好就是上述微分方程的目标处理结果;否则,可以通过优化算法更新可微分量子线路中的变分参数。If the value of the loss function constructed according to the prediction processing result meets the preset accuracy condition, then the prediction processing result that makes the value of the loss function meet the specified accuracy condition is just the target processing result of the above differential equation; otherwise, it can be updated through the optimization algorithm Variational parameters in differentiable quantum circuits.
例如,采用传统的优化方法——梯度下降法,通过以下算式更新变分参数θ,即其中,n为不小于1的整数,α为学习率,为损失函数对θ的梯度,L为损失函数。For example, using the traditional optimization method - gradient descent method, the variational parameter θ is updated by the following formula, namely Among them, n is an integer not less than 1, α is the learning rate, is the gradient of the loss function to θ, and L is the loss function.
然后,将更新后的变分参数传给可微分量子线路,继续执行上述步骤的演化和测量,通过不断迭代变分参数来更新预测处理结果及其对应的损失函数,直至得到使损失函数的值符合预设精度条件的预测处理结果,作为微分方程的目标处理结果。
Then, the updated variational parameters are passed to the differentiable quantum circuit, the evolution and measurement of the above steps are continued, and the prediction processing results and their corresponding loss functions are updated by continuously iterating the variational parameters until the value of the loss function is obtained The predicted processing results that meet the preset accuracy conditions are used as the target processing results of the differential equation.
示例性的,接上述示例,完成损失函数的构建之后,需要更新如图4所示的变分参数θ1、θ2和θ3,具体更新方法如下:
Exemplarily, following the above example, after completing the construction of the loss function, the variational parameters θ 1 , θ 2 and θ 3 as shown in Figure 4 need to be updated. The specific update method is as follows:
Exemplarily, following the above example, after completing the construction of the loss function, the variational parameters θ 1 , θ 2 and θ 3 as shown in Figure 4 need to be updated. The specific update method is as follows:
从上式可以看出,变分参数θ的更新需要计算损失函数对变分参数的梯度,具体数学形式如下:
It can be seen from the above formula that the update of the variational parameter θ needs to calculate the gradient of the loss function to the variational parameter. The specific mathematical form is as follows:
It can be seen from the above formula that the update of the variational parameter θ needs to calculate the gradient of the loss function to the variational parameter. The specific mathematical form is as follows:
然后根据上式描述的梯度计算方法,可更新变分参数θ;将更新后的变分参数代入到损失函数中,可得到更新后的损失函数;根据更新后的损失函数可以进一步更新变分参数,重复上述过程,直到损失函数满足预先给定的精度条件,即可将使损失函数满足预设精度条件的预测处理结果作为所述微分方程的目标处理结果。Then, according to the gradient calculation method described in the above formula, the variational parameter θ can be updated; the updated variational parameter can be substituted into the loss function, and the updated loss function can be obtained; the variational parameter can be further updated according to the updated loss function , repeating the above process until the loss function satisfies the predetermined accuracy condition, that is, the prediction processing result that makes the loss function satisfy the preset accuracy condition is taken as the target processing result of the differential equation.
本实施方式不同于传统的利用数值计算方法求解微分方程,由于该方法不需要对空间导数进行数值离散,尤其对于计算域形状复杂的情况,可以避免网格划分所带来的资源消耗;另外,通过在损失函数中添加正则项,可以充分利用已有的先验数据,实现另一种方式求解微分方程。This embodiment is different from the traditional numerical calculation method to solve differential equations, because this method does not need to numerically discretize the spatial derivative, especially for the complex shape of the calculation domain, it can avoid the resource consumption caused by grid division; in addition, By adding a regular term to the loss function, the existing prior data can be fully utilized to achieve another way to solve the differential equation.
可见,本实施方式首先获取数据处理任务数据,然后根据所述数据处理任务构建可微分量子线路,再基于所述可微分量子线路对数据处理任务的目标处理结果进行预测,至在根据预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下,将使损失函数的值符合指定精度条件的预测处理结果作为目标处理结果。本实施方式能够基于预测解构建损失函数并通过更新损失函数的值,实现微分方程求解任务的另一种处理方式,减少网格划分所带来的资源消耗。It can be seen that in this embodiment, the data of the data processing task is first obtained, and then a differentiable subcircuit is constructed according to the data processing task, and then the target processing result of the data processing task is predicted based on the differentiable subcircuit, until the result obtained according to the prediction is When the value of the loss function constructed by the prediction processing result meets the specified accuracy condition, the prediction processing result that makes the value of the loss function meet the specified accuracy condition is set as the target processing result. This embodiment can construct a loss function based on the predicted solution and update the value of the loss function to realize another processing method for solving the differential equation and reduce resource consumption caused by grid division.
由于可微分量子线路(Differentiable Quantum Circuits,DQC)方法在处理非线性微分方程的求解任务上具有优势,因此,本说明书的一个实施方式将时间离散技术和可微分量子线路相结合,提出了一种利用量子计算处理含时偏微分方程的求解任务的方法,一方面解决了由于时间变量的存在而导致的线路深度增加的问题;另一方面也降低了变分参数优化的难度。Since the Differentiable Quantum Circuits (Differentiable Quantum Circuits, DQC) method has advantages in dealing with the task of solving nonlinear differential equations, one embodiment of this specification combines time discretization techniques with differentiable quantum circuits, and proposes a The method of using quantum computing to solve the task of solving time-dependent partial differential equations, on the one hand, solves the problem of increased line depth due to the existence of time variables; on the other hand, it also reduces the difficulty of variational parameter optimization.
参见图5,图5为本实施方式提供的一种利用量子线路处理含时偏微分方程的求解任务的流程示意图,可以包括如下步骤:Referring to FIG. 5, FIG. 5 is a schematic flowchart of a solution task of using a quantum circuit to process a time-dependent partial differential equation provided in this embodiment, which may include the following steps:
S201:获取数据任务数据,其中,所述数据处理任务为含时偏微分方程的求解任务;所述数据处理任务数据包括所述含时偏微分方程。S201: Acquire data task data, wherein the data processing task is a task of solving a time-dependent partial differential equation; the data processing task data includes the time-dependent partial differential equation.
偏微分方程是现代数学的一个重要分支,无论在理论还是在实际应用中,偏微分方程均被用来描述力学、控制过程、生态与经济***、化工循环***及流行病学等领域的问题,利用偏微分方程描述问题可充分考虑到空间、时间等的影响,因此对于含有时间项的偏微分方程,可称为含时偏微分方程。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 the fields of mechanics, control processes, ecological and economic systems, chemical cycle systems, and epidemiology. The use of partial differential equations to describe problems can fully take into account the influence of space, time, etc., so for partial differential equations that contain time items, they can be called time-dependent partial differential equations.
具体的,获取含时偏微分方程如下:
Specifically, the time-dependent partial differential equation is obtained as follows:
Specifically, the time-dependent partial differential equation is obtained as follows:
其中,所述u(x,t)为含时偏微分方程的解,x为空间变量,t为时间变量,N'[u(x,t)]为非线性项,Ω为计算域,T为时间。Wherein, the u(x,t) is the solution of the time-dependent partial differential equation, x is the space variable, t is the time variable, N'[u(x,t)] is the nonlinear item, Ω is the computational domain, T for time.
S202:根据所述数据处理任务数据构建可微分量子线路。S202: Construct a differentiable quantum circuit according to the data processing task data.
对于差分格式为隐式差分格式而言,构建可微分量子线路,可以包括如下步骤:For the differential format is the implicit differential format, constructing a differentiable quantum circuit may include the following steps:
S2021:获取一组量子比特并将所述量子比特的初态置为|0>。S2021: Obtain a group of qubits and set the initial state of the qubits to |0>.
S2022:利用第一类量子逻辑门,构建生成函数空间基组的第一子量子线路模块。构建第一子量子线路模块的过程与前述构建第一子量子线路过程相同,此处不再赘述。S2022: Using the first type of quantum logic gates, constructing a first sub-quantum circuit module that generates a function space basis set. The process of constructing the first sub-quantum circuit module is the same as the above-mentioned process of constructing the first sub-quantum circuit, and will not be repeated here.
S2023:获取初始变分参数并利用第二类量子逻辑门,构建用于将函数空间基组组合成含时偏微分方程的预测解的第二子量子线路模块。构建第二子量子线路模块的过程与前述构建第二子量子线路过程相同,此处不再赘述。S2023: Obtaining initial variational parameters and using the second type of quantum logic gates to construct a second sub-quantum circuit module for combining function space basis sets into predicted solutions of time-dependent partial differential equations. The process of constructing the second sub-quantum circuit module is the same as the aforementioned process of constructing the second sub-quantum circuit, and will not be repeated here.
S2024:构建用于获得含时偏微分方程的预测解的测量操作模块。S2024: Construct a measurement operation module for obtaining a prediction solution of the time-dependent partial differential equation.
具体的,构建作用于量子比特的测量操作模块,以对量子比特的最终量子态进行测量。Specifically, a measurement operation module acting on the qubit is constructed to measure the final quantum state of the qubit.
S2025:依次将所述第一子量子线路模块、所述第二子量子线路模块和所述测量操作模块组合,构建可微分量子线路。S2025: Combine the first sub-quantum circuit module, the second sub-quantum circuit module, and the measurement operation module in sequence to construct a differentiable quantum circuit.
具体的,依次将第一子量子线路模块、第二子量子线路模块和测量操作模块组合,构建如图3所示的一种可微分量子线路的示意图,图中黑色圆点和⊕图标代表CNOT量子逻辑门,其中,黑色圆点在CNOT
量子逻辑门的控制比特上,⊕在CNOT量子逻辑门的目标比特上。Specifically, the first sub-quantum circuit module, the second sub-quantum circuit module, and the measurement operation module are combined in turn to construct a schematic diagram of a differentiable quantum circuit as shown in Figure 3. The black dot and ⊕ icon in the figure represent CNOT Quantum logic gates, where the black dots are in the CNOT On the control bit of the quantum logic gate, ⊕ is on the target bit of the CNOT quantum logic gate.
在经过第一子量子线路、第二子量子线路之后,需要读取量子线路的信息,并获取初始变分参数对应的最终量子态。After passing through the first sub-quantum circuit and the second sub-quantum circuit, it is necessary to read the information of the quantum circuit and obtain the final quantum state corresponding to the initial variational parameters.
S203:基于可微分量子线路的初始变分参数对含时偏微分方程的目标处理结果进行预测,至在根据所述预测得到的预测处理结果构建的当前时刻的损失函数的值符合指定精度条件的情况下,将使所述损失函数的值符合指定精度条件的含时偏微分方程的预测解,作为含时偏微分方程的目标解。S203: Predict the target processing result of the time-dependent partial differential equation based on the initial variational parameters of the differentiable quantum circuit, until the value of the loss function at the current moment constructed according to the predicted processing result obtained from the prediction meets the specified accuracy condition In this case, the predicted solution of the time-dependent partial differential equation that makes the value of the loss function meet the specified accuracy condition is used as the target solution of the time-dependent partial differential equation.
基于所述可微分量子线路的初始变分参数对含时偏微分方程的目标处理结果进行预测,可以包括如下步骤:Predicting the target processing result of the time-dependent partial differential equation based on the initial variational parameters of the differentiable quantum circuit may include the following steps:
步骤1:确定含时偏微分方程的初始条件和边界条件。Step 1: Determine the initial conditions and boundary conditions of the time-dependent partial differential equation.
具体的,含时偏微分方程的解一般有多个,但是解决具体的物理问题的时候,必须从中选取所需要的解,因此,还必须知道附加条件,也就是初始条件和边界条件。Specifically, there are generally multiple solutions to time-dependent partial differential equations, but when solving specific physical problems, the required solution must be selected from them. Therefore, additional conditions must be known, that is, initial conditions and boundary conditions.
示例性的,对于上述待求解含时偏微分方程,初始条件可预设为:u(x,0)=g(x),x∈Ω,边界条件预设为:u(x,t)=h(x,t),x∈Γ,其中,Γ表示计算域边界。Exemplarily, for the above time-dependent partial differential equation to be solved, the initial condition can be preset as: u(x,0)=g(x), x∈Ω, and the boundary condition is preset as: u(x,t)= h(x,t), x ∈ Γ, where Γ represents the computational domain boundary.
步骤2:根据预先选择的差分格式确定半离散形式的所述含时偏微分方程。Step 2: Determine the time-dependent partial differential equation in semi-discrete form according to a pre-selected differential scheme.
具体的,差分格式是利用数值方法计算函数导数的一种离散化方法,即用相邻两个或者多个数值点的差分取代偏微分方程中导数或者偏导数的一种算法,选择差分格式是离散化或半离散化偏微分方程的第一步。Specifically, the difference format is a discretization method that uses numerical methods to calculate the derivative of a function, that is, an algorithm that uses the difference between two or more adjacent numerical points to replace the derivative or partial derivative in the partial differential equation. The choice of the difference format is The first step in discretizing or semi-discretizing partial differential equations.
示例性的,接上述示例,首先将含时偏微分方程中的时间项进行离散,得到若预先选择的差分格式为隐式差分格式,所述根据预先选择的差分格式确定半离散形式的所述含时偏微分方程,包括:Exemplary, following the above example, the time item in the time-containing partial differential equation is firstly Discrete, get If the pre-selected differential format is an implicit differential format, the determination of the time-dependent partial differential equation in semi-discrete form according to the pre-selected differential format includes:
确定半离散形式的所述含时偏微分方程为:
u(x,t+Δt)=u(x,t)+Δt·N′[u(x,t+Δt)]The time-dependent partial differential equation that determines the semi-discrete form is:
u(x,t+Δt)=u(x,t)+Δt N'[u(x,t+Δt)]
u(x,t+Δt)=u(x,t)+Δt·N′[u(x,t+Δt)]The time-dependent partial differential equation that determines the semi-discrete form is:
u(x,t+Δt)=u(x,t)+Δt N'[u(x,t+Δt)]
其中,所述u(x,t+△t)为待求函数在t+△t时刻的值。Wherein, the u(x, t+Δt) is the value of the function to be obtained at the time t+Δt.
步骤3:根据所述初始条件和边界条件,通过可微分量子线路对含时偏微分方程的解进行预测。预测过程和前述预测过程相同,此处不再赘述。Step 3: According to the initial conditions and boundary conditions, the solution of the time-dependent partial differential equation is predicted through the differentiable quantum circuit. The forecasting process is the same as the aforementioned forecasting process, and will not be repeated here.
根据所述预测得到的预测结果构建当前时刻的损失函数,可以包括:Constructing a loss function at the current moment according to the prediction result obtained from the prediction may include:
若当前时刻为初始时刻,则初始时刻的损失函数为:
If the current moment is the initial moment, the loss function at the initial moment is:
If the current moment is the initial moment, the loss function at the initial moment is:
其中,所述N'为离散点数量,M为边界点的数量,i为第i个离散点,j'为第j'个边界点,为初始时刻的预测解,g(xi)为初始条件,h(xj',0)为初始时刻的边界条件;Wherein, the N' is the number of discrete points, M is the number of boundary points, i is the ith discrete point, j' is the j'th boundary point, is the predicted solution at the initial moment, g( xi ) is the initial condition, h(x j' ,0) is the boundary condition at the initial moment;
若当前时刻为△t时刻,则△t时刻的损失函数为:
If the current moment is △t time, then the loss function at △t time is:
If the current moment is △t time, then the loss function at △t time is:
其中,所述N'[u(x,t)]根据上一时刻的可微分量子线路确定。Wherein, the N'[u(x,t)] is determined according to the differentiable quantum circuits at the previous moment.
根据预测处理结果构建的当前时刻的所述损失函数的值符合预设精度条件,具体为:The value of the loss function at the current moment constructed according to the prediction processing results meets the preset accuracy conditions, specifically:
根据含时偏微分方程的预测解,进而求得含时偏微分方程的目标解,主要通过利用预先选择的测量算子作用于最终量子态时,可以得到含时偏微分方程在当前时刻的预测解并将当前时刻的预测解代入对应时刻的损失函数中,确定损失函数的值是否符合预设精度条件,其中预设精度条件可以由用户根据计算需求自行设定,例如取10-6或是0。According to the predicted solution of the time-dependent partial differential equation, the target solution of the time-dependent partial differential equation is obtained, mainly by using the pre-selected measurement operator acting on the final quantum state , the predicted solution of the time-dependent partial differential equation at the current moment can be obtained And substitute the predicted solution at the current moment into the loss function at the corresponding moment to determine whether the value of the loss function meets the preset accuracy conditions, where the preset accuracy conditions can be set by the user according to the calculation requirements, for example, 10 -6 or 0 .
若根据预测解构建当前时刻的损失函数的值符合预设精度条件,则使所述损失函数的值符合指定精度条件的预测解正好就是上述含时偏微分方程的目标解;否则,通过优化算法更新可微分量子线路中的变分参数。If the value of the loss function at the current moment constructed according to the predicted solution meets the preset accuracy conditions, then the predicted solution that makes the value of the loss function meet the specified accuracy conditions is just the target solution of the above time-dependent partial differential equation; otherwise, through the optimization algorithm Update variational parameters in differentiable quantum circuits.
例如,采用传统的优化方法——梯度下降法,通过以下算式更新变分参数θ,即其中,n为不小于1的整数,α为学习率,为损失函数对θ的梯度,L为损失函数。For example, using the traditional optimization method - gradient descent method, the variational parameter θ is updated by the following formula, namely Among them, n is an integer not less than 1, α is the learning rate, is the gradient of the loss function to θ, and L is the loss function.
然后,将更新后的变分参数传给可微分量子线路,继续执行上述步骤的演化和测量,通过不断迭代变
分参数来更新预测解及其对应的损失函数,直至得到使损失函数的值符合预设精度条件的预测解,作为上述含时偏微分方程的目标解。Then, the updated variational parameters are passed to the differentiable quantum circuit, and the evolution and measurement of the above steps are continued, and through continuous iterative variation Update the prediction solution and its corresponding loss function by sub-parameters until the prediction solution that makes the value of the loss function meet the preset accuracy conditions is obtained, which is used as the target solution of the above time-dependent partial differential equation.
示例性的,获取上述含时偏微分方程,构建可微分量子线路并获取初始变分参数对应的含时偏微分方程的初始预测解,得到初始时刻的损失函数,计算得到初始时刻损失函数的值不符合预设精度10-6,通过优化算法更新可微分量子线路中的变分参数,使其满足待求解的含时偏微分方程中给定的初始条件和边界条件,直到初始预测解满足上述含时的偏微分方程给定的初始条件和边界条件,即初始时刻的损失函数满足预设精度条件,由于是u(x,0)的近似函数,因此根据含时偏微分方程,得到△t时刻的损失函数,即:
Exemplarily, obtain the above time-dependent partial differential equation, construct a differentiable quantum circuit and obtain the initial prediction solution of the time-dependent partial differential equation corresponding to the initial variational parameters, obtain the loss function at the initial moment, and calculate the value of the loss function at the initial moment If it does not meet the preset accuracy of 10 -6 , update the variational parameters in the differentiable quantum circuit through the optimization algorithm to make it meet the given initial conditions and boundary conditions in the time-dependent partial differential equation to be solved until the initial prediction solution Satisfy the initial conditions and boundary conditions given by the time-dependent partial differential equation above, that is, the loss function at the initial moment satisfies the preset accuracy condition, because is an approximate function of u(x,0), so according to the time-dependent partial differential equation, the loss function at time Δt is obtained, namely:
Exemplarily, obtain the above time-dependent partial differential equation, construct a differentiable quantum circuit and obtain the initial prediction solution of the time-dependent partial differential equation corresponding to the initial variational parameters, obtain the loss function at the initial moment, and calculate the value of the loss function at the initial moment If it does not meet the preset accuracy of 10 -6 , update the variational parameters in the differentiable quantum circuit through the optimization algorithm to make it meet the given initial conditions and boundary conditions in the time-dependent partial differential equation to be solved until the initial prediction solution Satisfy the initial conditions and boundary conditions given by the time-dependent partial differential equation above, that is, the loss function at the initial moment satisfies the preset accuracy condition, because is an approximate function of u(x,0), so according to the time-dependent partial differential equation, the loss function at time Δt is obtained, namely:
对式中给出的△t时刻的损失函数进行优化,即可得到△t时刻的预测解的近似值其中根据当前时刻的可微分量子线路确定,然后再对变分参数(拟设中的参数)进行更新,最后重复上述的步骤,直到获得待求解含时偏微分方程在给定时间T的预测解u(x,T)。By optimizing the loss function at time △t given in the formula, the approximate value of the predicted solution at time △t can be obtained in Determine according to the differentiable quantum circuit at the current moment, then update the variational parameters (parameters in the proposed design), and finally repeat the above steps until the predicted solution u of the time-dependent partial differential equation to be solved at a given time T is obtained (x,T).
本实施方式通过将含时偏微分方程半离散化后转化成半离散形式的含时偏微分方程,通过构建可微分量子线路并获取初始变分参数对应的含时偏微分方程的预测解,将经典的数据结构与量子领域的量子态联系起来,并执行经典的数据结构编码到量子态的演化操作,得到演化后的量子线路的量子态,其能够利用量子的叠加特性,加快处理复杂度较高的含时偏微分方程的求解任务的处理速度,扩展量子计算的模拟应用场景。In this embodiment, the time-dependent partial differential equation is semi-discretized and transformed into a semi-discrete time-dependent partial differential equation, and by constructing a differentiable quantum circuit and obtaining the predicted solution of the time-dependent partial differential equation corresponding to the initial variational parameters, the The classical data structure is connected with the quantum state in the quantum field, and the evolution operation of the classical data structure encoding to the quantum state is performed, and the quantum state of the evolved quantum circuit is obtained, which can use the superposition characteristics of the quantum to speed up processing. The high processing speed of solving tasks of time-dependent partial differential equations expands the simulation application scenarios of quantum computing.
DQC方法在处理常微分方程和常微分方程组的求解任务上具有优势,但是由于可微分量子线路模型需要多次采用参数移动法计算微分方程中的各项导数的值,可能降低计算效率。The DQC method has advantages in solving ordinary differential equations and ordinary differential equations, but because the differentiable quantum circuit model needs to use the parameter shift method to calculate the values of the derivatives in the differential equation many times, the calculation efficiency may be reduced.
在相关技术中,利用可微分量子线路处理微分方程的求解任务时,是直接求解微分方程在整个计算域的解,这种做法有两个方面的缺点,其一是对于解的性质较为复杂的微分方程而言,直接在整个计算域内处理求解任务的方法可能会导致部分区域上解的精度不高,产生这种现象的原因是在量子比特数、特征映射层数和拟设层数一定的条件下可微分量子线路算法的表达能力,即逼近微分方程解的能力是有限的;其二是即使在可微分量子线路算法表达能力足够的条件下,当解的性质在整个计算域上较为复杂时,直接在整个计算域内处理微分方程的求解任务,也会产生优化困难的现象,这主要是两方面的原因造成的,一方面是因为解的性质复杂会对选择一组适合整个区域的变分参数造成困难,另一方面的由于在离散点分布密度一定的条件下,区域越大,离散点的数量越多,对预测解的约束越多(在每个离散点上预测解都要满足微分方程和边界条件),也会导致优化效率较低。In related technologies, when differentiable quantum circuits are used to solve the task of solving differential equations, the solution of the differential equation in the entire computational domain is directly solved. This approach has two disadvantages. One is that the nature of the solution is more complicated As far as differential equations are concerned, the method of directly processing the solving tasks in the entire computational domain may lead to low accuracy of solutions in some areas. The expressive ability of the differentiable quantum circuit algorithm under the condition of differentiable quantum circuit algorithm, that is, the ability to approximate the solution of the differential equation is limited; the second is that even under the condition that the expressive ability of the differentiable quantum circuit algorithm is sufficient, when the properties of the solution are relatively When it is complex, directly dealing with the task of solving differential equations in the entire calculation domain will also cause optimization difficulties. This is mainly caused by two reasons. Variational parameters cause difficulties. On the other hand, under the condition of a certain distribution density of discrete points, the larger the area, the more the number of discrete points, and the more constraints on the predicted solution (the predicted solution at each discrete point must be satisfies the differential equation and boundary conditions), which also leads to low optimization efficiency.
因此,本说明书的一个实施方式将区域分解技术和可微分量子线路相结合,提出了一种利用量子计算处理微分方程的求解任务的方法,一方面解决采用比特数较多、线路较深的可微分量子线路在整个计算域上进行求解,造成计算资源的浪费的问题;另一方面也有效地提高了优化变分参数的计算效率。Therefore, an embodiment of this specification combines domain decomposition technology with differentiable quantum circuits, and proposes a method for solving differential equations using quantum computing. The differential quantum circuit is solved on the entire computational domain, resulting in a waste of computational resources; on the other hand, it also effectively improves the computational efficiency of optimizing variational parameters.
参见图6,图6为本实施方式提供的一种基于计算域分解处理微分方程求解任务的方法的流程示意图,可以包括如下步骤:Referring to FIG. 6, FIG. 6 is a schematic flowchart of a method for solving differential equations based on computational domain decomposition provided in this embodiment, which may include the following steps:
S301:获取数据处理任务数据;其中,所述数据处理任务为微分方程的求解任务;所述数据处理任务数据包括所述微分方程。S301: Acquire data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes the differential equation.
具体的,待求解微分方程为:
Specifically, the differential equation to be solved is:
Specifically, the differential equation to be solved is:
其中,所述F为泛函,所述dxu为导数项,所述u为待求解微分方程的解,所述x为变量,u(x0)=u0可以为初始条件或者边界条件。Wherein, the F is a functional function, the d x u is a derivative term, the u is the solution of the differential equation to be solved, the x is a variable, and u(x 0 )=u 0 can be an initial condition or a boundary condition .
S302:获取所述微分方程的计算域并将所述计算域划分为若干相互不重叠的子计算域。S302: Obtain the computational domain of the differential equation and divide the computational domain into several non-overlapping sub-calculation domains.
具体的,将微分方程的计算域Ω分解为互不重叠的子区域Ω1,Ω2,...,Ωn,即Ω=Ω1∪Ω2∪...∪Ωn,其中Ωi∈Ω,i∈1,2,...,n。Specifically, the computational domain Ω of the differential equation is decomposed into non-overlapping sub-regions Ω 1 , Ω 2 , ..., Ω n , that is, Ω=Ω 1 ∪Ω 2 ∪...∪Ω n , where Ω i ∈ Ω, i ∈ 1, 2, ..., n.
示例性的,对于下述微分方程:
Exemplarily, for the following differential equation:
Exemplarily, for the following differential equation:
其中,所述u(x,t)为微分方程的解,x为空间变量,t为时间变量,N'[u(x,t)]为非线性项,Ω为计算域,T为时间,将计算域Ω划分为如图7所示的4个相互不重叠的子计算域,需要说明的是,微分方程的解一般有多个,但是解决具体的物理问题的时候,必须从中选取所需要的解,因此,还必须知道附加条件,也就是边界条件。Wherein, the u(x,t) is the solution of the differential equation, x is the space variable, t is the time variable, N'[u(x,t)] is the non-linear item, Ω is the computational domain, T is the time, Divide the computational domain Ω into four non-overlapping sub-computational domains as shown in Figure 7. It should be noted that there are generally multiple solutions to differential equations, but when solving specific physical problems, one must select the required The solution of , therefore, must also know the additional conditions, that is, the boundary conditions.
S303:构建子区域对应的可微分量子线路,其中,一个所述子计算域对应一个所述微分方程的预测解。具体的,构建一个子区域对应的可微分量子线路的过程与前两个实施方式构建可微分量子线路的过程相同,此处不再赘述。S303: Construct differentiable quantum circuits corresponding to sub-regions, wherein one sub-computational domain corresponds to one predicted solution of the differential equation. Specifically, the process of constructing a differentiable quantum circuit corresponding to a sub-region is the same as the process of constructing a differentiable quantum circuit in the previous two embodiments, and will not be repeated here.
S304:基于可微分量子线路对微分方程的目标解进行预测,至在根据微分方程的预测解构建的子计算域的联合损失函数的值符合指定精度条件的情况下,将使损失函数的值符合指定精度条件的微分方程的预测解作为微分方程的目标解。预测过程和前述实施方式中的预测过程基本相同,此处不再赘述。S304: Predict the target solution of the differential equation based on the differentiable quantum circuit, until the value of the joint loss function of the sub-calculation domain constructed according to the predicted solution of the differential equation meets the specified accuracy condition, the value of the loss function will meet The predicted solution of the differential equation for the specified accuracy condition serves as the target solution of the differential equation. The prediction process is basically the same as the prediction process in the foregoing embodiments, and will not be repeated here.
需要说明的是,依照上述方法构建一个子区域对应的一个可微分量子线路并获取微分方程的一个预测解,确定微分方程计算域划分相互不重叠的子计算域的个数并构建如图8所示的对应数量的可微分量子线路示意图,其中fi表示子计算域Ωi的预测解,各个子计算域的预测解fi是相互独立的,其中,对于解决实际问题中流动较为复杂或者微分方程解的性质较为复杂的区域,可以采用量子比特数多、线路深的可微分量子线路。It should be noted that, according to the above method, construct a differentiable quantum circuit corresponding to a sub-region and obtain a predicted solution of the differential equation, determine the number of sub-computational domains that do not overlap with each other in the calculation domain division of the differential equation, and construct the sub-computational domain as shown in Figure 8. The corresponding number of differentiable quantum circuit schematic diagrams are shown, where f i represents the predicted solution of the sub-computational domain Ω i , and the predicted solutions f i of each sub-computational domain are independent of each other. Among them, for solving practical problems, the flow is more complicated or differential In areas where the nature of the equation solution is relatively complex, a differentiable quantum circuit with a large number of qubits and a deep circuit can be used.
根据所述微分方程的预测解构建的联合损失函数,可以包括:
The joint loss function constructed according to the predicted solution of the differential equation may include:
The joint loss function constructed according to the predicted solution of the differential equation may include:
其中,所述n为子区域数量,所述nb为交界面数量,所述Li
(diff)[dxfi,fi,x]为第i个子区域的预测解不满足微分方程而引起的误差,所述Li
(boundary)[fi,x]为第i个子区域的预测解不满足边界条件而引起的误差,所述Li
(interface)[f,x]为第i个交界面两侧相邻区域的预测解不满***界面连续性条件而引起的误差且所述ni为第i个交界面上离散点的数量,f+(xj)和f-(xj)为交界面两侧的子区域对应的预测解。Wherein, the n is the number of sub-regions, the n b is the number of interfaces, and the L i (diff) [d x f i , f i , x] is the predicted solution of the i-th sub-region does not satisfy the differential equation but The error caused by L i (boundary) [f i , x] is the error caused by the prediction solution of the i-th sub-region not satisfying the boundary conditions, and the L i (interface) [f, x] is the error caused by the i-th sub-region The error caused by the prediction solution of the adjacent areas on both sides of the interface does not meet the continuity condition of the interface and The n i is the number of discrete points on the i-th interface, and f + (x j ) and f - (x j ) are the predicted solutions corresponding to the sub-regions on both sides of the interface.
根据微分方程的预测解构建的联合损失函数的值是否符合精度,具体为:Whether the value of the joint loss function constructed according to the predicted solution of the differential equation meets the accuracy, specifically:
根据各个子计算域中微分方程的预测解fi,进而求得微分方程的目标解,其主要是通过利用预先选择的测量算子作用于各个最终量子态|fi(x)>时,得到微分方程的各预测解fi(x),并将预测解代入联合损失函数中,确定联合损失函数的值是否符合预设精度条件,其中预设精度条件可以由用户根据计算需求自行设定,例如取10-6或是0。According to the predicted solution f i of the differential equation in each sub-computation domain, the target solution of the differential equation is obtained, which is mainly by using the pre-selected measurement operator When acting on each final quantum state |f i (x)>, each predicted solution f i (x) of the differential equation is obtained, and the predicted solution is substituted into the joint loss function to determine whether the value of the joint loss function meets the preset accuracy conditions , where the preset accuracy condition can be set by the user according to the calculation requirements, for example, 10 -6 or 0.
若根据预测解构建的联合损失函数的值符合预设精度条件,则使所述损失函数的值符合指定精度条件的预测解正好就是上述微分方程的目标解;否则,通过优化算法更新可微分量子线路中的变分参数。对变分参数的优化过程和前述实施方式中的变分参数的优化过程基本相同,此处不再赘述。If the value of the joint loss function constructed according to the predicted solution meets the preset accuracy condition, then the predicted solution that makes the value of the loss function meet the specified accuracy condition is just the target solution of the above differential equation; otherwise, the differentiable quantum is updated by the optimization algorithm Variational parameters in the circuit. The optimization process of variational parameters is basically the same as the optimization process of variational parameters in the foregoing embodiments, and will not be repeated here.
本实施方式通过构建可微分量子线路并根据可微分量子线路对微分方程的解进行预测,将经典的数据结构与量子领域的量子态联系起来,并执行经典的数据结构编码到量子态的演化操作,得到演化后的量子线路的量子态,其能够利用量子的叠加特性,加快复杂度较高的微分方程的求解任务的处理速度,扩展量子计算的模拟应用场景。In this embodiment, by constructing a differentiable quantum circuit and predicting the solution of the differential equation according to the differentiable quantum circuit, the classical data structure is connected with the quantum state in the quantum field, and the evolution operation of encoding the classical data structure into the quantum state is performed. , to obtain the quantum state of the evolved quantum circuit, which can use the quantum superposition property to speed up the processing speed of the task of solving the differential equation with high complexity, and expand the simulation application scenarios of quantum computing.
对于不能采用DQC的参数移动法计算导数的情况,采用数值方法计算导数,会带来数值误差。For the situation that the parameter shift method of DQC cannot be used to calculate the derivative, the numerical method is used to calculate the derivative, which will bring numerical errors.
参见图9,图9为本说明书一个实施方式提供的一种利用量子线路处理微分方程的求解任务的方法的流程示意图,可以包括如下步骤:Referring to FIG. 9, FIG. 9 is a schematic flowchart of a method for using a quantum circuit to solve a differential equation solution task provided by an embodiment of this specification, which may include the following steps:
S401:获取数据处理任务数据;其中,所述数据处理任务为微分方程的求解任务;所述数据处理任务数据包括所述微分方程和所述微分方程的导数项。S401: Acquire data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes the differential equation and a derivative term of the differential equation.
需要说明的是,本实施方式中下述利用可微分量子线路处理微分方程的求解任务中的微分方程导数项的预测值的求解,其中微分方程的导数项可以分为不同的类别,例如导数项和可归于一类,导数项和归于一类等,其分类的关键在于能否使用同一段可微分量子线路进行求解导数项的预测值。It should be noted that, in this embodiment, the solution of the predicted value of the derivative term of the differential equation in the task of solving the differential equation by using the differentiable quantum circuit described below, wherein the derivative term of the differential equation can be divided into different categories, such as the derivative term and can be classified into one class, the derivative term and Belonging to one class, etc., the key to its classification is whether the same section of differentiable quantum circuit can be used to solve the predicted value of the derivative term.
具体的,确定待求解微分方程为:
Specifically, determine the differential equation to be solved as:
Specifically, determine the differential equation to be solved as:
其中,所述F为泛函,所述dxu为导数项,所述u为待求解微分方程的预测解,所述x为变量,u(x0)=u0可以为初始条件或者边界条件。Wherein, the F is a functional function, the d x u is a derivative term, the u is the predicted solution of the differential equation to be solved, the x is a variable, and u(x 0 )=u 0 can be an initial condition or a boundary condition.
示例性的,对于一个具体的待求解微分方程:
Exemplarily, for a specific differential equation to be solved:
Exemplarily, for a specific differential equation to be solved:
其中,为导数项,u为待求解微分方程的解,x为变量。in, is the derivative term, u is the solution of the differential equation to be solved, and x is the variable.
S402:根据所述微分方程和所述微分方程的导数项分别构建可微分量子线路。S402: Construct differentiable quantum circuits respectively according to the differential equation and derivative terms of the differential equation.
具体的,根据所述微分方程和所述微分方程的导数项分别构建可微分量子线路,可以包括:Specifically, constructing a differentiable quantum circuit according to the differential equation and the derivative term of the differential equation may include:
根据上述微分方程构建第一可微分量子线路,根据上述微分方程的导数项构建第二可微分量子线路,并分别确定第一可微分量子线路中当前变分参数对应微分方程的预测解和第二可微分量子线路中当前变分参数对应微分方程的导数项的预测值。根据上述微分方程和上述微分方程的导数项分别构建第一、第二可微分量子线路的构建过程与前述实施方式基本相同,此处不再赘述。The first differentiable quantum circuit is constructed according to the above differential equation, the second differentiable quantum circuit is constructed according to the derivative term of the above differential equation, and the predicted solution and the second differential equation corresponding to the current variational parameters in the first differentiable quantum circuit are respectively determined. The current variational parameter in the differentiable quantum circuit corresponds to the predicted value of the derivative term of the differential equation. The construction process of respectively constructing the first and second differentiable quantum circuits according to the above differential equation and the derivative terms of the above differential equation is basically the same as that of the foregoing embodiment, and will not be repeated here.
S403:基于可微分量子线路对微分方程的目标解和微分方程的导数项的值进行预测,至在根据微分方程的预测解和微分方程的导数项的预测值构建的损失函数的值符合指定精度条件的情况下,将使损失函数的值符合指定精度条件的微分方程的预测解作为微分方程的目标解。预测过程和前述实施方式中的预测过程基本相同,此处不再赘述。S403: Predict the target solution of the differential equation and the value of the derivative term of the differential equation based on the differentiable quantum circuit, until the value of the loss function constructed based on the predicted solution of the differential equation and the predicted value of the derivative term of the differential equation meets the specified accuracy In the case of the condition, the predicted solution of the differential equation that makes the value of the loss function meet the specified accuracy condition is taken as the target solution of the differential equation. The prediction process is basically the same as the prediction process in the foregoing embodiments, and will not be repeated here.
需要说明的是,依照上述方法构建每一类导数项对应的一个可微分量子线路并获取导数项预测值,其中每一类导数项的预测值单独表示,各个导数项的预测值之间是相互独立的。It should be noted that a differentiable subcircuit corresponding to each type of derivative term is constructed according to the above method and the predicted value of the derivative term is obtained, wherein the predicted value of each type of derivative term is represented separately, and the predicted values of each derivative term are mutually correlated independent.
根据基于可微分量子线路得到的微分方程的预测解和微分方程的导数项的预测值,构建的损失函数为:
L[fi,f,x]=L(diff)[fi,f,x]+L(boundary)[f,x]According to the predicted solution of the differential equation obtained based on the differentiable quantum circuit and the predicted value of the derivative term of the differential equation, the loss function constructed is:
L[f i , f, x]=L (diff) [f i , f, x]+L (boundary) [f, x]
L[fi,f,x]=L(diff)[fi,f,x]+L(boundary)[f,x]According to the predicted solution of the differential equation obtained based on the differentiable quantum circuit and the predicted value of the derivative term of the differential equation, the loss function constructed is:
L[f i , f, x]=L (diff) [f i , f, x]+L (boundary) [f, x]
其中,所述fi表示微分方程中的第i阶导数项,所述L(diff)表示所述预测解不满足微分方程的误差,所述f为所述微分方程,所述x表示变量,所述L(boundary)表示所述预测解不满足边界条件和初始条件的误差。Wherein, said f i represents the i-th order derivative term in the differential equation, said L (diff) represents that said predicted solution does not satisfy the error of the differential equation, said f is said differential equation, and said x represents a variable, The L (boundary) represents the error that the predicted solution does not satisfy the boundary conditions and initial conditions.
根据微分方程的预测解和微分方程的导数项的预测值构建的损失函数的值是否符合预设精度条件,具体为:Whether the value of the loss function constructed based on the predicted solution of the differential equation and the predicted value of the derivative term of the differential equation meets the preset accuracy conditions, specifically:
根据各个可微分量子线路中得到的微分方程的预测解、微分方程的导数项的预测值,进而求得微分方程的目标解,其主要是通过利用预先选择的测量算子作用于各个最终量子态时,得到微分方程的各预测解fi(x)和导数项各预测值f′i(x),并将预测解和预测值代入损失函数中,确定损失函数的值是否符合预设精度条件,其中预设精度条件可以由用户根据计算需求自行设定,例如取10-6或是0。According to the predicted solution of the differential equation and the predicted value of the derivative term of the differential equation obtained in each differentiable quantum circuit, the target solution of the differential equation is obtained, which is mainly by using the pre-selected measurement operator When acting on each final quantum state, each predicted solution f i (x) of the differential equation and each predicted value f′ i (x) of the derivative term are obtained, and the predicted solution and predicted value are substituted into the loss function to determine the value of the loss function Whether it meets the preset accuracy condition, where the preset accuracy condition can be set by the user according to the calculation requirements, for example, 10 -6 or 0.
若根据预测解和预测值构建的损失函数的值符合预设精度条件,则使损失函数的值符合指定精度条件的预测解正好就是微分方程的目标解;否则,通过优化算法同时更新各可微分量子线路中的变分参数。对变分参数的优化过程和前述实施方式中的变分参数的优化过程基本相同,此处不再赘述。If the value of the loss function constructed according to the predicted solution and the predicted value meets the preset accuracy condition, then the predicted solution that makes the value of the loss function meet the specified accuracy condition is just the target solution of the differential equation; Variational parameters in quantum circuits. The optimization process of variational parameters is basically the same as the optimization process of variational parameters in the foregoing embodiments, and will not be repeated here.
本实施方式通过构建可微分量子线路并根据可微分量子线路对微分方程的解和微分方程的导数项的值进行预测,将经典的数据结构与量子领域的量子态联系起来,并执行经典的数据结构编码到量子态的演化操作,得到演化后的量子线路的量子态,其能够利用量子的叠加特性,加快复杂度较高的微分方程的求解任务的处理速度,扩展量子计算的模拟应用场景。In this embodiment, by constructing a differentiable quantum circuit and predicting the solution of the differential equation and the value of the derivative term of the differential equation according to the differentiable quantum circuit, the classical data structure is connected with the quantum state in the quantum field, and the classical data structure is executed. The evolution operation of structure encoding to quantum state obtains the quantum state of the evolved quantum circuit, which can take advantage of the superposition characteristics of quantum to speed up the processing speed of solving tasks of highly complex differential equations and expand the simulation application scenarios of quantum computing.
参见图10,图10为本说明书一个实施方式提供的一种数据处理任务的处理装置的结构示意图,与图2所示的流程相对应,所述装置可以包括:Referring to FIG. 10, FIG. 10 is a schematic structural diagram of a data processing task processing device provided in an embodiment of this specification, corresponding to the process shown in FIG. 2, and the device may include:
获取模块501,用于获取数据处理任务数据;其中,所述数据处理任务为微分方程的求解任务;所述数据处理任务数据包括所述微分方程;An acquisition module 501, configured to acquire data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes the differential equation;
构建模块502,用于根据所述数据处理任务数据构建可微分量子线路;A construction module 502, configured to construct a differentiable quantum circuit according to the data processing task data;
预测模块503,用于基于所述可微分量子线路对数据处理任务的目标处理结果进行预测,至在根据预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下,将使损失函数的值符合指定精度条件的预测处理结果作为目标处理结果。The prediction module 503 is configured to predict the target processing result of the data processing task based on the differentiable quantum circuit, and when the value of the loss function constructed according to the predicted prediction processing result meets the specified accuracy condition, the loss The predicted processing result whose value of the function meets the specified accuracy condition is used as the target processing result.
具体的,所述获取模块501,包括:Specifically, the acquisition module 501 includes:
获取单元,用于获取微分方程的信息以及所述微分方程的解所满足的初始条件和边界条件。The acquisition unit is used to acquire the information of the differential equation and the initial conditions and boundary conditions satisfied by the solution of the differential equation.
所述构建模块502,包括:
The building block 502 includes:
构建单元,用于构建可微分量子线路并确定所述可微分量子线路中的变分参数;a construction unit for constructing a differentiable quantum circuit and determining variational parameters in the differentiable quantum circuit;
具体的,所述构建单元,包括:Specifically, the building units include:
第一获取子单元,用于获取一组量子比特并将所述量子比特的初态置为|0>;The first acquisition subunit is used to acquire a group of qubits and set the initial state of the qubits to |0>;
第一构建子单元,用于利用第一类量子逻辑门,构建生成函数空间基组的第一子量子线路模块;The first construction sub-unit is used to construct the first sub-quantum circuit module of the generating function space basis set by using the first type of quantum logic gate;
第二构建子单元,用于利用第二类量子逻辑门,构建用于将函数空间基组组合成微分方程的预测解的第二子量子线路模块;The second construction subunit is used to construct a second sub-quantum circuit module for combining function space basis sets into predicted solutions of differential equations by using the second type of quantum logic gates;
第三构建子单元,用于构建用于获得微分方程的预测解的测量操作模块;The third construction subunit is used to construct the measurement operation module for obtaining the prediction solution of the differential equation;
组合子单元,用于依次将所述第一子量子线路模块、所述第二子量子线路模块和所述测量操作模块组合,得到可微分量子线路。The combination subunit is used to sequentially combine the first sub-quantum circuit module, the second sub-quantum circuit module and the measurement operation module to obtain a differentiable quantum circuit.
所述预测模块503,包括:The prediction module 503 includes:
预测单元,用于根据所述初始条件和所述边界条件,通过所述可微分量子线路得到所述微分方程的预测解;a prediction unit, configured to obtain a predicted solution of the differential equation through the differentiable quantum circuit according to the initial condition and the boundary condition;
确定单元,用于确定根据所述微分方程的预测解构建的损失函数符合预设精度条件;A determining unit, configured to determine that the loss function constructed according to the predicted solution of the differential equation meets a preset accuracy condition;
更新单元,用于对损失函数不符合预设精度条件的微分方程的预测解,通过优化算法更新变分参数,得到更新后的变分参数对应的所述微分方程的预测解。The update unit is used to update the variational parameters through an optimization algorithm for the predicted solution of the differential equation whose loss function does not meet the preset accuracy condition, and obtain the predicted solution of the differential equation corresponding to the updated variational parameter.
具体的,所述更新单元,包括:Specifically, the update unit includes:
更新子单元,用于通过以下算式更新变分参数θ:
The update subunit is used to update the variational parameter θ through the following formula:
其中,所述n为不小于1的整数,α为学习率,为损失函数对θ的梯度,L为损失函数。Wherein, the n is an integer not less than 1, α is the learning rate, is the gradient of the loss function to θ, and L is the loss function.
本说明书实施方式还提供了一种存储介质,所述存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行上述任一项实施方式中的步骤。The embodiments of this specification also provide a storage medium, where a computer program is stored in the storage medium, wherein the computer program is configured to execute the steps in any one of the above embodiments when running.
具体的,在本实施方式中,上述存储介质可以包括但不限于:U盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、移动硬盘、磁碟或者光盘等各种可以存储计算机程序的介质。Specifically, in this embodiment, the above-mentioned storage medium may include but not limited to: U disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), mobile hard disk, magnetic disk Or various media such as optical discs that can store computer programs.
本说明书实施方式还提供了一种电子装置,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行上述任一项中方法实施例中的步骤。The implementation mode of this specification also provides an electronic device, including a memory and a processor, the computer program is stored in the memory, and the processor is configured to run the computer program to perform any one of the above method embodiments A step of.
具体的,上述电子装置还可以包括传输设备以及输入输出设备,其中,该传输设备和上述处理器连接,该输入输出设备和上述处理器连接。Specifically, the electronic device may further include a transmission device and an input and output device, wherein the transmission device is connected to the processor, and the input and output device is connected to the processor.
以上依据图式所示的实施例详细说明了本发明的构造、特征及作用效果,以上所述仅为本发明的较佳实施例,但本发明不以图面所示限定实施范围,凡是依照本发明的构想所作的改变,或修改为等同变化的等效实施例,仍未超出说明书与图示所涵盖的精神时,均应在本发明的保护范围内。
The structure, features and effects of the present invention have been described in detail above based on the embodiments shown in the drawings. The above descriptions are only preferred embodiments of the present invention, but the present invention does not limit the scope of implementation as shown in the drawings. Changes made to the idea of the present invention, or modifications to equivalent embodiments that are equivalent changes, and still within the spirit covered by the description and illustrations, shall be within the protection scope of the present invention.
Claims (36)
- 一种数据处理任务的处理方法,其特征在于,所述方法包括:A processing method for a data processing task, characterized in that the method comprises:获取数据处理任务数据;其中,所述数据处理任务为微分方程的求解任务;所述数据处理任务数据包括所述微分方程;Acquiring data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes the differential equation;根据所述数据处理任务数据构建可微分量子线路;Constructing a differentiable quantum circuit according to the data processing task data;基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,至在根据所述预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下,将使所述损失函数的值符合指定精度条件的预测处理结果作为目标处理结果。Predict the target processing result of the data processing task based on the differentiable quantum circuit, and when the value of the loss function constructed according to the predicted processing result meets the specified accuracy condition, the loss The predicted processing result whose value of the function meets the specified accuracy condition is used as the target processing result.
- 根据权利要求1所述的方法,其特征在于,基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,包括:The method according to claim 1, wherein predicting the target processing result of the data processing task based on the differentiable quantum circuit comprises:基于所述可微分量子线路中的变分参数对所述微分方程的目标解进行预测。A target solution to the differential equation is predicted based on variational parameters in the differentiable quantum circuit.
- 根据权利要求1所述的方法,其特征在于,所述数据处理任务数据还包括所述微分方程的解所满足的初始条件和边界条件;根据所述数据处理任务数据构建可微分量子线路的步骤,包括:The method according to claim 1, wherein the data processing task data also includes initial conditions and boundary conditions satisfied by the solution of the differential equation; the step of constructing a differentiable quantum circuit according to the data processing task data ,include:根据所述微分方程以及所述微分方程的解所满足的初始条件和边界条件构建所述可微分量子线路,并确定所述可微分量子线路中的变分参数。The differentiable quantum circuit is constructed according to the differential equation and the initial conditions and boundary conditions satisfied by the solution of the differential equation, and the variational parameters in the differentiable quantum circuit are determined.
- 根据权利要求3所述的方法,其特征在于,根据所述微分方程以及所述微分方程的解所满足的初始条件和边界条件构建所述可微分量子线路,包括:The method according to claim 3, wherein constructing the differentiable quantum circuit according to the differential equation and the initial conditions and boundary conditions satisfied by the solution of the differential equation includes:获取一组量子比特并将所述量子比特的初态置为|0>;Obtain a group of qubits and set the initial state of the qubits to |0>;利用第一类量子逻辑门,构建生成函数空间基组的第一子量子线路模块;Using the first type of quantum logic gates, constructing the first sub-quantum circuit module that generates the basis set of the function space;利用第二类量子逻辑门,构建用于将函数空间基组组合成微分方程的预测解的第二子量子线路模块;Constructing a second sub-quantum circuit module for combining functional space basis sets into predicted solutions of differential equations using a second class of quantum logic gates;构建用于获得所述微分方程的预测解的测量操作模块;constructing a measurement operation module for obtaining a predicted solution of said differential equation;依次将所述第一子量子线路模块、所述第二子量子线路模块和所述测量操作模块组合,得到所述可微分量子线路。Combining the first sub-quantum circuit module, the second sub-quantum circuit module and the measurement operation module in sequence to obtain the differentiable quantum circuit.
- 根据权利要求2所述的方法,其特征在于,基于所述可微分量子线路中的变分参数对所述微分方程的目标解进行预测的步骤,包括:The method according to claim 2, wherein the step of predicting the target solution of the differential equation based on the variational parameters in the differentiable quantum circuit comprises:通过优化算法更新所述变分参数,基于所述更新后的变分参数对所述微分方程的目标解进行预测。The variational parameters are updated by an optimization algorithm, and the target solution of the differential equation is predicted based on the updated variational parameters.
- 根据权利要求5所述的方法,其特征在于,所述通过优化算法更新所述变分参数,包括:The method according to claim 5, wherein the updating of the variational parameters by an optimization algorithm comprises:通过以下算式更新所述变分参数θ:
The variational parameter θ is updated by the following formula:
其中,所述n为不小于1的整数,α为学习率,L为所述损失函数,为所述损失函数对θ的梯度。Wherein, the n is an integer not less than 1, α is the learning rate, and L is the loss function, is the gradient of the loss function to θ. - 根据权利要求6所述的方法,其特征在于,所述损失函数为:
The method according to claim 6, wherein the loss function is:
其中,所述Lθ (diff)表示所述微分方程的预测解不满足所述微分方程的误差,所述dxf表示所述微分方程中的导数项,所述f表示与所述微分方程对应的函数,所述x表示变量,所述Lθ (boundary)表示所述微分方程的预测解不满足所述边界条件和所述初始条件的误差,所述表示正则项误差。Wherein, the L θ (diff) represents that the predicted solution of the differential equation does not satisfy the error of the differential equation, the d x f represents the derivative term in the differential equation, and the f represents the difference between the differential equation and the differential equation Corresponding function, said x represents a variable, said L θ (boundary) represents the error that the predicted solution of said differential equation does not satisfy said boundary condition and said initial condition, said Indicates the regularization term error. - 根据权利要求1所述方法,其特征在于,所述微分方程为含时偏微分方程;基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,至在根据所述预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下,将使所述损失函数的值符合指定精度条件的预测处理结果作为目标处理结果的步骤,包括:The method according to claim 1, characterized in that, the differential equation is a time-dependent partial differential equation; the target processing result of the data processing task is predicted based on the differentiable quantum circuit, until the result is obtained according to the prediction When the value of the loss function constructed by the predicted processing result meets the specified accuracy condition, the steps of making the predicted processing result whose value of the loss function meets the specified accuracy condition are taken as the target processing result include:基于所述可微分量子线路的初始变分参数对所述含时偏微分方程的目标解进行预测,至在根据所述预测得到的预测处理结果构建的当前时刻的损失函数的值符合指定精度条件的情况下,将使所述损失函数的值符合指定精度条件的所述含时偏微分方程的预测解,作为所述含时偏微分方程的目标解。Predict the target solution of the time-dependent partial differential equation based on the initial variational parameters of the differentiable quantum circuit, until the value of the loss function at the current moment constructed according to the prediction processing result obtained from the prediction meets the specified accuracy condition In the case of , the predicted solution of the time-dependent partial differential equation that makes the value of the loss function meet the specified accuracy condition is used as the target solution of the time-dependent partial differential equation.
- 根据权利要求8所述的方法,其特征在于,所述含时偏微分方程,包括:
The method according to claim 8, wherein the time-dependent partial differential equation comprises:
其中,所述u(x,t)为所述含时偏微分方程的解,x为空间变量,t为时间变量,N′[u(x,t)]为非线性项,Ω为计算域,T为时间。Wherein, the u(x, t) is the solution of the time-dependent partial differential equation, x is a space variable, t is a time variable, N'[u(x, t)] is a nonlinear term, and Ω is a computational domain , T is time. - 根据权利要求9所述的方法,其特征在于,所述数据处理任务数据还包括所述含时偏微分方程的初始条件和边界条件;The method according to claim 9, wherein the data processing task data also includes initial conditions and boundary conditions of the time-dependent partial differential equation;在获取数据处理任务数据的步骤之后,还包括:After the step of obtaining the data of the data processing task, also include:根据预先选择的差分格式确定半离散形式的所述含时偏微分方程。Said time-dependent partial differential equations are determined in semi-discrete form according to a preselected difference scheme.
- 根据权利要求10所述的方法,其特征在于,所述预先选择的差分格式为隐式差分格式;所述根据预先选择的差分格式确定半离散形式的所述含时偏微分方程的步骤,包括:The method according to claim 10, wherein the pre-selected differential scheme is an implicit differential scheme; the step of determining the time-dependent partial differential equation in semi-discrete form according to the pre-selected differential scheme comprises: :确定半离散形式的所述含时偏微分方程为:The time-dependent partial differential equation that determines the semi-discrete form is:u(x,t+Δt)=u(x,t)+Δt·N′[u(x,t+Δt)]u(x,t+Δt)=u(x,t)+Δt N'[u(x,t+Δt)]其中,所述u(x,t+△t)为所述含时偏微分方程在t+△t时刻的解。Wherein, the u(x,t+Δt) is the solution of the time-dependent partial differential equation at time t+Δt.
- 根据权利要求8所述的方法,其特征在于,基于所述可微分量子线路的初始变分参数对所述含时偏微分方程的目标解进行预测,包括:The method according to claim 8, wherein the prediction of the target solution of the time-dependent partial differential equation based on the initial variational parameters of the differentiable quantum circuit comprises:获取一组量子比特并将所述量子比特的初态置为|0>;Obtain a group of qubits and set the initial state of the qubits to |0>;利用第一类量子逻辑门,构建生成函数空间基组的第一子量子线路模块;Using the first type of quantum logic gates, constructing the first sub-quantum circuit module that generates the basis set of the function space;获取初始变分参数并利用第二类量子逻辑门,构建用于将函数空间基组组合成含时偏微分方程的预测解的第二子量子线路模块;Obtaining initial variational parameters and using quantum logic gates of the second type to construct a second sub-quantum circuit module for combining function-space basis sets into predicted solutions of time-dependent partial differential equations;构建用于获得所述含时偏微分方程的预测解的测量操作模块;Constructing a measurement operation module for obtaining a predicted solution of the time-dependent partial differential equation;依次将所述第一子量子线路模块、所述第二子量子线路模块和所述测量操作模块组合,构建所述可微分量子线路,并根据获取所述初始变分参数对应的最终量子态确定所述含时偏微分方程的预测解。Combining the first sub-quantum circuit module, the second sub-quantum circuit module and the measurement operation module in turn to construct the differentiable quantum circuit, and determine according to the final quantum state corresponding to the obtained initial variational parameters A predicted solution of the time-dependent partial differential equation.
- 根据权利要求12所述的方法,其特征在于,所述确定所述含时偏微分方程的预测解,包括:The method according to claim 12, wherein said determining the predicted solution of said time-dependent partial differential equation comprises:获取预先选择的测量算子;Get the pre-selected measurement operator;根据所述最终量子态确定所述测量算子对应的期望值;determining an expected value corresponding to the measurement operator according to the final quantum state;根据所述期望值确定所述含时偏微分方程的预测解。A predicted solution to the time-dependent partial differential equation is determined based on the expected value.
- 根据权利要求12所述的方法,其特征在于,所述第一类量子逻辑门包括:Rx量子逻辑门、Ry量子逻辑门和Rz量子逻辑门;The method according to claim 12, wherein the first type of quantum logic gates comprises: Rx quantum logic gates, Ry quantum logic gates and Rz quantum logic gates;所述第二类量子逻辑门包括:Rx量子逻辑门、Ry量子逻辑门、Rz量子逻辑门和CNOT量子逻辑门。The second type of quantum logic gates includes: Rx quantum logic gates, Ry quantum logic gates, Rz quantum logic gates and CNOT quantum logic gates.
- 根据权利要求8所述的方法,其特征在于,所述根据所述预测得到的预测处理结果构建的当前时刻的损失函数,包括:The method according to claim 8, wherein the loss function at the current moment constructed according to the prediction processing result obtained by the prediction includes:若当前时刻为初始时刻,则初始时刻的损失函数为:
If the current moment is the initial moment, the loss function at the initial moment is:
其中,所述N'为离散点数量,M为边界点的数量,i为第i个离散点,j'为第j'个边界点,为初始时刻的预测处理结果,g(xi)为初始条件,h(xj',0)为初始时刻的边界条件;Wherein, the N' is the number of discrete points, M is the number of boundary points, i is the ith discrete point, j' is the j'th boundary point, is the prediction processing result at the initial moment, g( xi ) is the initial condition, h(x j' ,0) is the boundary condition at the initial moment;若当前时刻为△t时刻,则△t时刻的损失函数为:
If the current moment is △t time, then the loss function at △t time is:
其中,所述N'[u(x,t)]根据上一时刻的可微分量子线路确定。Wherein, the N'[u(x,t)] is determined according to the differentiable quantum circuits at the previous moment. - 根据权利要求8所述的方法,其特征在于,所述方法还包括:The method according to claim 8, characterized in that the method further comprises:通过以下算式更新所述变分参数θ:
The variational parameter θ is updated by the following formula:
其中,所述n为不小于1的整数,α为学习率,L为所述损失函数,为所述损失函数对θ的梯度。 Wherein, the n is an integer not less than 1, α is the learning rate, and L is the loss function, is the gradient of the loss function to θ. - 根据权利要求1所述的方法,其特征在于,在获取数据处理任务数据的步骤之后,所述方法还包括:The method according to claim 1, characterized in that, after the step of acquiring data processing task data, the method further comprises:获取所述微分方程的计算域并将所述计算域划分为若干相互不重叠的子计算域;Obtaining the computational domain of the differential equation and dividing the computational domain into several non-overlapping sub-computational domains;根据所述数据处理任务数据构建可微分量子线路的步骤,包括:The step of constructing a differentiable quantum circuit according to the data processing task data includes:构建所述子计算域对应的可微分量子线路;其中,一个所述子计算域对应一个所述微分方程的预测解;Constructing a differentiable quantum circuit corresponding to the sub-computation domain; wherein, one sub-computation domain corresponds to one predicted solution of the differential equation;基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,至在根据所述预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下,将使损失函数的值符合指定精度条件的预测处理结果作为目标处理结果的步骤,包括:Predict the target processing result of the data processing task based on the differentiable quantum circuit, and when the value of the loss function constructed according to the predicted processing result obtained from the prediction meets the specified accuracy condition, the loss function will be The steps of using the predicted processing result whose value meets the specified accuracy condition as the target processing result include:基于所述可微分量子线路对所述微分方程的目标解进行预测,至在根据所述微分方程的预测解构建的所述子计算域的联合损失函数的值符合指定精度条件的情况下,将使损失函数的值符合指定精度条件的所述微分方程的预测解作为所述微分方程的目标解。Predict the target solution of the differential equation based on the differentiable quantum circuit, and when the value of the joint loss function of the sub-calculation domain constructed according to the predicted solution of the differential equation meets the specified accuracy condition, The predicted solution of the differential equation that makes the value of the loss function meet the specified accuracy condition is used as the target solution of the differential equation.
- 根据权利要求17所述的方法,其特征在于,所述微分方程为:
The method according to claim 17, wherein the differential equation is:
其中,所述F为泛函,所述dxu为导数项,所述u为所述微分方程的解,所述x为变量。Wherein, the F is a functional function, the d x u is a derivative term, the u is the solution of the differential equation, and the x is a variable. - 根据权利要求17所述的方法,其特征在于,基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,包括:The method according to claim 17, wherein predicting the target processing result of the data processing task based on the differentiable quantum circuit comprises:基于所述可微分量子线路中的变分参数所述微分方程的目标解进行预测。A prediction is made based on a target solution of the differential equation for variational parameters in the differentiable quantum circuit.
- 根据权利要求19所述的方法,其特征在于,构建所述子计算域对应的可微分量子线路的步骤,包括:The method according to claim 19, wherein the step of constructing a differentiable quantum circuit corresponding to the sub-computational domain includes:获取一组量子比特并将所述量子比特的初态置为|0>;Obtain a group of qubits and set the initial state of the qubits to |0>;利用第一类量子逻辑门,构建生成函数空间基组的第一子量子线路模块;Using the first type of quantum logic gates, constructing the first sub-quantum circuit module that generates the basis set of the function space;利用第二类量子逻辑门,构建用于将函数空间基组组合成微分方程的预测解的第二子量子线路模块;Constructing a second sub-quantum circuit module for combining functional space basis sets into predicted solutions of differential equations using a second class of quantum logic gates;构建用于获得所述微分方程的预测解的测量操作模块;constructing a measurement operation module for obtaining a predicted solution of said differential equation;依次将所述第一子量子线路模块、所述第二子量子线路模块和所述测量操作模块组合,构建所述可微分量子线路。Combining the first sub-quantum circuit module, the second sub-quantum circuit module and the measurement operation module in sequence to construct the differentiable quantum circuit.
- 根据权利要求20所述的方法,其特征在于,基于所述可微分量子线路中的变分参数对所述微分方程的目标解进行预测的步骤,包括:The method according to claim 20, wherein the step of predicting the target solution of the differential equation based on the variational parameters in the differentiable quantum circuit comprises:获取预先选择的测量算子;Get the pre-selected measurement operator;根据所述可微分量子线路中的变分参数对应的最终量子态确定所述测量算子对应的期望值;determining the expected value corresponding to the measurement operator according to the final quantum state corresponding to the variational parameter in the differentiable quantum circuit;根据所述期望值确定所述微分方程的预测解。A predicted solution to the differential equation is determined based on the expected value.
- 根据权利要求20所述的方法,其特征在于,所述第一类量子逻辑门包括:Rx量子逻辑门、Ry量子逻辑门和Rz量子逻辑门;The method according to claim 20, wherein the first type of quantum logic gates comprises: Rx quantum logic gates, Ry quantum logic gates and Rz quantum logic gates;所述第二类量子逻辑门包括:Rx量子逻辑门、Ry量子逻辑门、Rz量子逻辑门和CNOT量子逻辑门。The second type of quantum logic gates includes: Rx quantum logic gates, Ry quantum logic gates, Rz quantum logic gates and CNOT quantum logic gates.
- 根据权利要求17所述的方法,其特征在于,所述联合损失函数为:
The method according to claim 17, wherein the joint loss function is:
其中,所述n为子计算域数量,所述nb为交界面数量,所述Li (diff)[dxfi,fi,x]为第i个子计算域对应的所述微分方程的预测解不满足所述微分方程而引起的误差,所述Li (boundary)[fi,x]为第i个子计算域的对应的所述微分方程的预测解不满足所述微分方程的解所满足的边界条件而引起的误差,所述Li (interface)[f,x]为第i个交界面两侧相邻区域对应的所述微分方程的预测解不满***界面连续性条件而引起的误差且所述ni为第i个交界 面上离散点的数量,f+(xj)和f-(xj)为交界面两侧的子计算域对应的所述微分方程的预测解。Wherein, the n is the number of sub-computational domains, the n b is the number of interfaces, and the L i (diff) [d x f i , f i , x] is the differential equation corresponding to the i-th sub-computational domain The error caused by the prediction solution of the differential equation does not satisfy the differential equation, the L i (boundary) [f i , x] is the prediction solution of the differential equation corresponding to the i-th sub-calculation domain does not satisfy the differential equation The error caused by solving the boundary conditions satisfied, the L i (interface) [f, x] is the predicted solution of the differential equation corresponding to the adjacent areas on both sides of the i-th interface does not satisfy the interface continuity condition errors caused by The n i is the i-th junction The number of discrete points on the surface, f + (x j ) and f - (x j ) are the predicted solutions of the differential equations corresponding to the sub-computational domains on both sides of the interface. - 根据权利要求19所述的方法,其特征在于,基于所述可微分量子线路中的变分参数对所述微分方程的目标解进行预测的步骤,包括:The method according to claim 19, wherein the step of predicting the target solution of the differential equation based on the variational parameters in the differentiable quantum circuit comprises:利用优化算法更新所述可微分量子线路中的变分参数;updating variational parameters in the differentiable quantum circuit using an optimization algorithm;根据更新后的所述可微分量子线路中的变分参数,得到更新后的所述微分方程的预测解。An updated predicted solution of the differential equation is obtained according to the updated variational parameters in the differentiable quantum circuit.
- 根据权利要求24所述的方法,其特征在于,所述利用优化算法更新所述可微分量子线路中的变分参数的步骤,包括:The method according to claim 24, wherein the step of using an optimization algorithm to update the variational parameters in the differentiable quantum circuit comprises:通过以下算式更新所述变分参数θ:
The variational parameter θ is updated by the following formula:
其中,所述n为不小于1的整数,α为学习率,L为所述联合损失函数,为所述联合损失函数对θ的梯度。Wherein, the n is an integer not less than 1, α is the learning rate, and L is the joint loss function, is the gradient of the joint loss function to θ. - 根据权利要求1所述的方法,其特征在于,所述数据处理任务数据还包括所述微分方程的导数项;The method according to claim 1, wherein the data processing task data also includes a derivative term of the differential equation;根据所述数据处理任务数据构建可微分量子线路的步骤,包括:The step of constructing a differentiable quantum circuit according to the data processing task data includes:根据所述微分方程和所述微分方程的导数项分别构建所述可微分量子线路;constructing the differentiable quantum circuits respectively according to the differential equation and derivative terms of the differential equation;基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,至在根据所述预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下,将使所述损失函数的值符合指定精度条件的预测处理结果作为目标处理结果的步骤,包括:Predict the target processing result of the data processing task based on the differentiable quantum circuit, and when the value of the loss function constructed according to the predicted processing result meets the specified accuracy condition, the loss The steps of using the predicted processing result whose value of the function meets the specified precision condition as the target processing result include:基于所述可微分量子线路对所述微分方程的目标解和所述微分方程的导数项的值进行预测,至在根据所述微分方程的预测解和所述微分方程的导数项的预测值构建的损失函数的值符合指定精度条件的情况下,将使所述损失函数的值符合指定精度条件的所述微分方程预测解作为所述微分方程的目标解。Predict the target solution of the differential equation and the value of the derivative term of the differential equation based on the differentiable quantum circuit, and construct according to the predicted solution of the differential equation and the predicted value of the derivative term of the differential equation When the value of the loss function meets the specified accuracy condition, the predicted solution of the differential equation that makes the value of the loss function meet the specified accuracy condition is used as the target solution of the differential equation.
- 根据权利要求26所述的方法,其特征在于,The method of claim 26, wherein所述微分方程为:
The differential equation is:
其中,所述F为泛函,所述dxu为所述微分方程的导数项,所述u为微分方程的预测解,所述x为变量。Wherein, the F is a functional function, the d x u is a derivative term of the differential equation, the u is a predicted solution of the differential equation, and the x is a variable. - 根据权利要求26所述的方法,其特征在于,根据所述微分方程和所述微分方程的导数项分别构建所述可微分量子线路的步骤,包括:The method according to claim 26, wherein the step of constructing the differentiable quantum circuit according to the differential equation and the derivative term of the differential equation respectively comprises:分别构建用于求解所述微分方程的预测解和用于求解所述微分方程的导数项的预测值的可微分量子线路,并分别确定所述可微分量子线路中的变分参数对应的所述微分方程的预测解和所述微分方程的导数项的预测值。Constructing the differentiable quantum circuit for solving the predicted solution of the differential equation and the predicted value of the derivative term for solving the differential equation, respectively, and determining the corresponding to the variational parameters in the differentiable quantum circuit A predicted solution to the differential equation and predicted values of derivative terms of the differential equation.
- 根据权利要求28所述的方法,其特征在于,所述分别构建用于求解所述微分方程的预测解和用于求解所述导数项的预测值的可微分量子线路,包括:The method according to claim 28, wherein said constructing respectively a differentiable quantum circuit for solving the predicted solution of the differential equation and for solving the predicted value of the derivative term comprises:分别获取一组量子比特并将所述量子比特的初态置为|0>;Obtain a group of qubits respectively and set the initial state of the qubits to |0>;利用第一类量子逻辑门,分别构建生成函数空间基组的第一子量子线路模块;Using the first type of quantum logic gates, respectively constructing the first sub-quantum circuit modules that generate function space basis sets;利用第二类量子逻辑门,分别构建用于将函数空间基组组合成所述微分方程的预测解和所述微分方程的导数项的预测值的第二子量子线路模块;Using the second type of quantum logic gates, respectively constructing a second sub-quantum circuit module for combining the function space basis set into the predicted solution of the differential equation and the predicted value of the derivative term of the differential equation;分别构建用于获得所述微分方程的预测解和所述微分方程的导数项的预测值的测量操作模块;respectively constructing measurement operation modules for obtaining the predicted solution of the differential equation and the predicted value of the derivative term of the differential equation;分别将所述第一子量子线路模块、所述第二子量子线路模块和所述测量操作模块组合,构建所述可微分量子线路。Combining the first sub-quantum circuit module, the second sub-quantum circuit module and the measurement operation module respectively to construct the differentiable quantum circuit.
- 根据权利要求29所述的方法,其特征在于,所述分别确定所述可微分量子线路中的变分参数对应的微分方程的预测解和所述微分方程的导数项的预测值,包括:The method according to claim 29, wherein said respectively determining the predicted solution of the differential equation corresponding to the variational parameter in the differentiable quantum circuit and the predicted value of the derivative term of the differential equation comprises:获取预先选择的测量算子;Get the pre-selected measurement operator;分别根据所述可微分量子线路中的变分参数对应的最终量子态确定所述测量算子对应的期望值;determining the expected value corresponding to the measurement operator according to the final quantum state corresponding to the variational parameter in the differentiable quantum circuit;根据所述期望值确定所述微分方程的预测解和所述微分方程的导数项的预测值。A predicted solution of the differential equation and a predicted value of a derivative term of the differential equation are determined based on the expected value.
- 根据权利要求26所述的方法,其特征在于,所述损失函数为:The method according to claim 26, wherein the loss function is:L[fi,f,x]=L(diff)[fi,f,x]+L(boundary)[f,x] L[f i , f, x]=L (diff) [f i , f, x]+L (boundary) [f, x]其中,所述fi表示所述微分方程中的第i阶导数项,所述L(diff)表示所述微分方程的预测解不满足所述微分方程的误差,所述f为所述微分方程,所述x表示变量,所述L(boundary)表示所述微分方程的预测解不满足所述微分方程的解的边界条件和初始条件的误差。Wherein, the f i represents the i-th order derivative term in the differential equation, the L (diff) represents that the predicted solution of the differential equation does not satisfy the error of the differential equation, and the f is the differential equation , the x represents a variable, and the L (boundary) represents an error that the predicted solution of the differential equation does not satisfy the boundary conditions and initial conditions of the solution of the differential equation.
- 根据权利要求28所述的方法,其特征在于,分别确定所述可微分量子线路中的变分参数对应的所述微分方程的预测解和所述微分方程的导数项的预测值,包括:The method according to claim 28, wherein determining the predicted solution of the differential equation corresponding to the variational parameter in the differentiable quantum circuit and the predicted value of the derivative term of the differential equation respectively includes:利用优化算法更新所述可微分量子线路中的变分参数;updating variational parameters in the differentiable quantum circuit using an optimization algorithm;根据更新后的可微分量子线路中的变分参数,得到更新后的所述微分方程的预测解和所述微分方程的导数项的预测值。According to the updated variational parameters in the differentiable quantum circuit, the updated predicted solution of the differential equation and the predicted value of the derivative term of the differential equation are obtained.
- 根据权利要求32所述的方法,其特征在于,所述利用优化算法更新所述可微分量子线路中的变分参数的步骤,包括:The method according to claim 32, wherein the step of using an optimization algorithm to update the variational parameters in the differentiable quantum circuit comprises:通过以下算式更新所述变分参数θ:
The variational parameter θ is updated by the following formula:
其中,所述n为不小于1的整数,α为学习率,L为所述损失函数,为所述损失函数对θ的梯度。Wherein, the n is an integer not less than 1, α is the learning rate, and L is the loss function, is the gradient of the loss function to θ. - 一种数据处理任务的处理装置,其特征在于,所述装置包括:A processing device for data processing tasks, characterized in that the device includes:获取模块,用于获取数据处理任务数据;其中,所述数据处理任务为微分方程的求解任务;所述数据处理任务数据包括所述微分方程;An acquisition module, configured to acquire data processing task data; wherein, the data processing task is a task of solving a differential equation; the data processing task data includes the differential equation;构建模块,用于根据所述数据处理任务数据构建可微分量子线路;a building block, configured to build a differentiable quantum circuit according to the data processing task data;预测模块,用于基于所述可微分量子线路对所述数据处理任务的目标处理结果进行预测,至在根据所述预测得到的预测处理结果构建的损失函数的值符合指定精度条件的情况下;将使所述损失函数的值符合指定精度条件的预测处理结果作为目标处理结果。A prediction module, configured to predict the target processing result of the data processing task based on the differentiable quantum circuit, until the value of the loss function constructed according to the predicted processing result obtained from the prediction meets the specified accuracy condition; The prediction processing result that makes the value of the loss function conform to the specified accuracy condition is taken as the target processing result.
- 一种存储介质,其特征在于,所述存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行所述权利要求1至33任一项中所述的方法。A storage medium, characterized in that a computer program is stored in the storage medium, wherein the computer program is configured to execute the method described in any one of claims 1 to 33 when running.
- 一种电子设备,包括存储器和处理器,其特征在于,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行所述权利要求1至33任一项中所述的方法。 An electronic device, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to perform the process described in any one of claims 1 to 33. described method.
Applications Claiming Priority (8)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210214645.X | 2022-03-04 | ||
CN202210214967.4A CN116738127A (en) | 2022-03-04 | 2022-03-04 | Solving method and device of differential equation, medium and electronic device |
CN202210214969.3A CN116738128B (en) | 2022-03-04 | 2022-03-04 | Method and device for solving time-containing partial differential equation by utilizing quantum circuit |
CN202210214966.X | 2022-03-04 | ||
CN202210214967.4 | 2022-03-04 | ||
CN202210214966.XA CN116738126B (en) | 2022-03-04 | 2022-03-04 | Differential equation solving method and device based on computational domain decomposition |
CN202210214969.3 | 2022-03-04 | ||
CN202210214645.XA CN116738125A (en) | 2022-03-04 | 2022-03-04 | Method and device for solving differential equation by utilizing quantum circuit |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023165500A1 true WO2023165500A1 (en) | 2023-09-07 |
Family
ID=87883023
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2023/078928 WO2023165500A1 (en) | 2022-03-04 | 2023-03-01 | Processing method and apparatus for data processing task, storage medium, and electronic device |
Country Status (1)
Country | Link |
---|---|
WO (1) | WO2023165500A1 (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112488317A (en) * | 2020-11-27 | 2021-03-12 | 北京百度网讯科技有限公司 | Simulation method and device in quantum control, classical computer and storage medium |
US20210097422A1 (en) * | 2019-09-27 | 2021-04-01 | X Development Llc | Generating mixed states and finite-temperature equilibrium states of quantum systems |
CN112668242A (en) * | 2021-01-05 | 2021-04-16 | 南方科技大学 | Quantum control waveform optimization method and device, computer equipment and storage medium |
CN112784205A (en) * | 2021-01-30 | 2021-05-11 | 西安电子科技大学 | Partial differential equation data processing method, system, storage medium, device and application |
CN113614753A (en) * | 2021-01-04 | 2021-11-05 | 香港应用科技研究院有限公司 | Quantum computing system |
CN114037082A (en) * | 2021-11-09 | 2022-02-11 | 腾讯科技(深圳)有限公司 | Quantum computing task processing method and system and computer equipment |
-
2023
- 2023-03-01 WO PCT/CN2023/078928 patent/WO2023165500A1/en unknown
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20210097422A1 (en) * | 2019-09-27 | 2021-04-01 | X Development Llc | Generating mixed states and finite-temperature equilibrium states of quantum systems |
CN112488317A (en) * | 2020-11-27 | 2021-03-12 | 北京百度网讯科技有限公司 | Simulation method and device in quantum control, classical computer and storage medium |
CN113614753A (en) * | 2021-01-04 | 2021-11-05 | 香港应用科技研究院有限公司 | Quantum computing system |
CN112668242A (en) * | 2021-01-05 | 2021-04-16 | 南方科技大学 | Quantum control waveform optimization method and device, computer equipment and storage medium |
CN112784205A (en) * | 2021-01-30 | 2021-05-11 | 西安电子科技大学 | Partial differential equation data processing method, system, storage medium, device and application |
CN114037082A (en) * | 2021-11-09 | 2022-02-11 | 腾讯科技(深圳)有限公司 | Quantum computing task processing method and system and computer equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Laguna | OptQuest | |
CN114219076B (en) | Quantum neural network training method and device, electronic equipment and medium | |
Dong et al. | On the expressivity of neural networks for deep reinforcement learning | |
Li et al. | Two-level multi-surrogate assisted optimization method for high dimensional nonlinear problems | |
CN114819163B (en) | Training method and device for quantum generation countermeasure network, medium and electronic device | |
Jin et al. | Quantum simulation in the semi-classical regime | |
Tong et al. | RoeNet: Predicting discontinuity of hyperbolic systems from continuous data | |
WO2023165500A1 (en) | Processing method and apparatus for data processing task, storage medium, and electronic device | |
CN116011681A (en) | Meteorological data prediction method and device, storage medium and electronic device | |
CN115829047B (en) | Quantum program final mapping determination method and device and quantum computer | |
CN113128015A (en) | Method and system for predicting resources required by single-amplitude analog quantum computation | |
CN116738128B (en) | Method and device for solving time-containing partial differential equation by utilizing quantum circuit | |
CN116738126B (en) | Differential equation solving method and device based on computational domain decomposition | |
CN117709415A (en) | Quantum neural network model optimization method and device | |
CN115700572B (en) | Quantum solving method and device for grid equation and physical equation iteration | |
CN116541947B (en) | Grover solving method and device for SAT or MAX-SAT problem of vehicle configuration | |
CN116738127A (en) | Solving method and device of differential equation, medium and electronic device | |
US20230394344A1 (en) | Quantum enhanced learning agent | |
CN115618663B (en) | Quantum solving method and device for coupling grid equation and physical equation | |
JP7452823B2 (en) | Quantum computing task processing method, system and computer device | |
CN115775028B (en) | Quantum circuit optimization method, quantum circuit optimization device, quantum circuit optimization medium and electronic device | |
CN114372583B (en) | Quantum program optimization method based on machine learning framework and related equipment | |
CN116738125A (en) | Method and device for solving differential equation by utilizing quantum circuit | |
CN116976448A (en) | Method and device for solving linear equation set by utilizing variable component sub-circuit | |
CN117852665A (en) | Quantum circuit-based physical system state prediction method and related device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 23762899 Country of ref document: EP Kind code of ref document: A1 |