Method for simulating quantum computing and related device

By directly processing the initial operation object of the quantum program in classical computing and using classical computing methods to perform target operations, the problem of long quantum computing simulation time is solved and more efficient quantum algorithm operation is achieved.

CN118734979AActive Publication Date: 2024-10-01ORIGIN QUANTUM COMPUTING TECH (HEFEI) CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202310300593.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-23
Publication Date
2024-10-01
Estimated Expiration
2043-03-23

AI Technical Summary

Technical Problem

Existing quantum computing simulation methods need to simulate various quantum logic gates one by one, resulting in long calculation times and inability to effectively and universally run quantum algorithms.

Method used

By determining the initial operation object to be performed in the quantum program in classical calculations, and using classical operation methods to perform target operations, the simulation of quantum logic gates is reduced, and the functions of quantum logic gates are directly processed for operations as a whole.

Benefits of technology

It significantly reduces the time consumption of quantum computing simulations and improves computing efficiency, allowing quantum algorithms to be implemented more quickly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734979A_ABST
    Figure CN118734979A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a related device for simulating quantum computing, and the method comprises the steps: determining an initial operation object of a current to-be-executed operation in a quantum program, the initial operation object comprising data which is determined based on the quantum program and participates in the to-be-executed operation; and executing a target operation mode on the initial operation object to obtain a target operation object, the target operation mode being a classical operation mode based on the initial operation object. According to the embodiment of the invention, the classical calculation is utilized to simulate the quantum calculation, and various quantum logic gates are not simulated one by one, so that the time consumption of the quantum calculation simulation is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of quantum computing simulation, and in particular to a method for simulating quantum computing and related devices. Background Art

[0002] Quantum computers use quantum superposition, and in theory they have the ability to exponentially accelerate in certain situations. For example, cracking an RSA key takes hundreds of years on a classical computer, but executing a quantum algorithm on a quantum computer only takes a few hours. However, quantum computers are currently limited by the limited number of bits that can be manipulated due to the development of quantum chip hardware, so their computing power is limited and they cannot run quantum algorithms universally. Universally running quantum algorithms usually requires the use of quantum computing simulation methods.

[0003] In the process of simulating quantum algorithms, it is usually necessary to use various quantum logic gates to construct quantum circuits and use quantum circuits for simulation. The number of quantum logic gates required to implement functions such as arithmetic operations is huge, which makes the time required for quantum computing simulation relatively long. Summary of the invention

[0004] The purpose of the present invention is to provide a method and related device for simulating quantum computing, which reduces the time consumption of quantum computing simulation by using classical computing to simulate quantum computing instead of simulating various quantum logic gates one by one.

[0005] An embodiment of the present application provides a method for simulating quantum computing, the method comprising:

[0006] Determining an initial operation object of a current operation to be performed in a quantum program, wherein the initial operation object includes data participating in the operation to be performed determined based on the quantum program;

[0007] A target operation method is executed on the initial operation object to obtain a target operation object, wherein the target operation method is a classical operation method based on the initial operation object.

[0008] Optionally, determining an initial operation object of a current operation to be executed in the quantum program includes:

[0009] Determining a target register based on information pre-set for an initial operand of a current operation to be performed in the quantum program;

[0010] The initial operand is obtained from the target register.

[0011] Optionally, the target operation mode is a classical operation mode corresponding to the Hadamard gate;

[0012] The performing a target operation mode on the initial operation object to obtain a target operation object includes:

[0013] According to the classical operation method corresponding to the Hadamard gate, the initial operation object is operated to obtain the operation results and the probabilities corresponding to the operation results;

[0014] In response to merging the operation results, the probabilities corresponding to the same operation results are merged, and the combined operation results and probabilities are used as target operation objects; or,

[0015] In response to not merging the operation results, the operation results and the corresponding probabilities are directly used as target operation objects.

[0016] Optionally, performing a target operation mode on the initial operation object to obtain a target operation object further includes:

[0017] Moving the initial operation object to a specified position of a current operation object queue, wherein the operation object queue is composed of operation objects arranged in the order of participating in the operation;

[0018] The operation result is placed after the initial operation object, and the probability corresponding to the initial operation object is adjusted to 0.

[0019] Optionally, merging the probabilities corresponding to the same operation results and using the combined operation results and probabilities as target operation objects includes:

[0020] Sort the current operation object queue;

[0021] The probabilities corresponding to the same operation results are added together, and an identical operation result in the sorted operation object queue is deleted to obtain the target operation object.

[0022] Optionally, the target operation mode is one of arithmetic operations.

[0023] Optionally, the method further includes:

[0024] The information of the initial operation object is set by using the system class and the state storage class.

[0025] Another embodiment of the present application provides a device for simulating quantum computing, the device comprising:

[0026] A determination module, used to determine an initial operation object of a current operation to be executed in a quantum program, wherein the initial operation object includes data participating in the operation to be executed determined based on the quantum program;

[0027] The obtaining module is used to execute a target operation mode on the initial operation object to obtain a target operation object, wherein the target operation mode is a classical operation mode based on the initial operation object.

[0028] Optionally, the determining module is specifically used to:

[0029] Determining a target register based on information pre-set for an initial operand of a current operation to be performed in the quantum program;

[0030] The initial operand is obtained from the target register.

[0031] Optionally, the target operation mode is a classical operation mode corresponding to the Hadamard gate;

[0032] The obtaining module comprises:

[0033] An obtaining unit, used to perform calculations on the initial operation object according to a classical calculation method corresponding to the Hadamard gate, to obtain calculation results and probabilities corresponding to each calculation result;

[0034] A merging unit, configured to merge the probabilities corresponding to the same operation results in response to merging the operation results, and use the combined operation results and probabilities as target operation objects;

[0035] The object determination unit is used to directly use the operation results and the corresponding probabilities as target operation objects in response to not merging the operation results.

[0036] Optionally, the obtaining module further includes:

[0037] A moving unit, used to move the initial operation object to a specified position of a current operation object queue, wherein the operation object queue is composed of operation objects arranged in the order of participating in the operation;

[0038] The adjustment unit is used to place the operation result after the initial operation object and adjust the probability corresponding to the initial operation object to 0.

[0039] Optionally, the merging unit is specifically used to:

[0040] Sort the current operation object queue;

[0041] The probabilities corresponding to the same operation results are added together, and an identical operation result in the sorted operation object queue is deleted to obtain the target operation object.

[0042] Optionally, the target operation mode is one of arithmetic operations.

[0043] Optionally, the device further comprises:

[0044] The setting module is used to set the information of the initial operation object by using the system class and the state storage class.

[0045] An embodiment of the present application provides a storage medium, in which a computer program is stored, wherein the computer program is configured to implement any of the above methods when running.

[0046] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement any of the above methods.

[0047] Compared with the prior art, the present invention first determines the initial operation object of the current operation to be executed in the quantum program, wherein the initial operation object includes data corresponding to the current state of the quantum bits participating in the operation to be executed; then performs a target operation method on the initial operation object to obtain a target operation object, wherein the target operation method is a classical operation method based on the initial operation object. By operating the initial operation object in a classical operation method, various quantum logic gates are no longer simulated one by one, which reduces the time consumption of quantum computing simulation. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 This is a hardware structure block diagram of a simulated quantum computing provided by an embodiment of the present invention;

[0049] Figure 2 A schematic diagram of a flow chart of a method for simulating quantum computing provided by an embodiment of the present invention;

[0050] Figure 3 A schematic diagram of the structure of a device for simulating quantum computing provided by an embodiment of the present invention. DETAILED DESCRIPTION

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

[0052] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0053] An embodiment of the present invention provides a method for simulating quantum computing, which can be applied to electronic devices, such as mobile terminals, such as mobile phones and tablet computers; such as computer terminals, such as ordinary computers and quantum computers.

[0054] The following describes it in detail by taking running on a computer terminal as an example. Figure 1 : is a hardware structure block diagram of a simulated quantum computing embodiment of the present application. Figure 1 As shown, the computer terminal 10 may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the computer terminal may also include a transmission device 106 for communication functions and an input and output device 108. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0055] The memory 104 can be used to store software programs and modules of application software, such as program instructions / modules corresponding to the method of simulating quantum computing in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implementing the above method. The memory 104 may include a high-speed random access memory, and may also include a 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 remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0056] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. 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 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0057] It should be noted that a true quantum computer is a hybrid structure, which consists of two parts: one part is a classical computer, which is responsible for performing classical calculations and control; the other part is a quantum device, which is responsible for running quantum programs and thus realizing quantum computing. A quantum program is a sequence of instructions written in a quantum language such as Qrunes that can be run on a quantum computer, which supports quantum logic gate operations and ultimately realizes quantum computing. Specifically, a quantum program is a sequence of instructions that operate quantum logic gates in a certain sequence.

[0058] In practical applications, due to the limitations of the development of quantum device hardware, quantum computing simulation is usually required to verify quantum algorithms, quantum applications, etc. Quantum computing simulation is the process of simulating the operation of quantum programs corresponding to specific problems using a virtual architecture (i.e., quantum virtual machine) built with the resources of ordinary computers. Usually, it is necessary to build a quantum program corresponding to a specific problem. The quantum program referred to in the embodiment of the present invention is a program written in a classical language to characterize quantum bits and their evolution, in which quantum bits, quantum logic gates, etc. related to quantum computing are represented by corresponding classical codes.

[0059] Quantum circuits, as a manifestation of quantum programs, are also called quantum logic circuits. They are the most commonly used general quantum computing model. They represent circuits that operate on quantum bits in an abstract concept. They are composed of quantum bits, circuits (timelines), and various quantum logic gates. Finally, the results often need to be read out through quantum measurement operations.

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

[0061] A quantum program as a whole corresponds to a total quantum circuit. The quantum program described in the present invention refers to the total quantum circuit, wherein the total number of quantum bits in the total quantum circuit is the same as the total number of quantum bits in the quantum program. It can be understood that a quantum program can be composed of a quantum circuit, measurement operations on quantum bits in the quantum circuit, registers for storing measurement results, and control flow nodes (jump instructions). A quantum circuit can contain dozens, hundreds, or even thousands of quantum logic gate operations. The execution process of a quantum program is the process of executing all quantum logic gates in a certain time sequence. It should be noted that the time sequence is the time order in which a single quantum logic gate is executed.

[0062] It should be noted that in classical computing, the most basic unit is the bit, and the most basic control mode is the logic gate, which can achieve the purpose of controlling the circuit through the combination of logic gates. Similarly, the way to process quantum bits is quantum logic gates. The use of quantum logic gates can make the quantum state evolve. Quantum logic gates are the basis of quantum circuits. Quantum logic gates include single-bit quantum logic gates, such as Hadamard gates (H gates), Pauli-X gates, Pauli-Y gates, Pauli-Z gates, RX gates, RY gates, and RZ gates; multi-bit quantum logic gates, such as CNOT gates, CR gates, iSWAP gates, and Toffoli gates. Quantum logic gates are generally represented by unitary matrices, and unitary matrices are not only in the form of matrices, but also a type of operation and transformation.

[0063] In quantum programs, quantum states are changed by quantum logic gates acting on quantum bits. The quantum state can be the initial state of the quantum circuit or the state after the initial state has evolved through the simulation of the quantum logic gate acting on the quantum bit. The state corresponding to the quantum bit is the quantum state, which is represented by binary in quantum algorithms (or quantum programs). For example, a group of quantum bits is q0, q1, and q2, representing the 0th, 1st, and 2nd quantum bits, and is sorted from high to low as q2q1q0. The quantum state corresponding to this group of quantum bits is the superposition of the eigenstates corresponding to this group of quantum bits. There are 2 eigenstates corresponding to this group of quantum bits. n Where n is the number of quantum bits, that is, 8 eigenstates (determined states): |000>, |001>, |010>, |011>, |100>, |101>, |110>, |111>, and the bit of each eigenstate corresponds to the quantum bit. For example, in the |000> state, 000 corresponds to q2q1q0 from high to low, and |> is the Dirac symbol.

[0064] Taking a single quantum bit as an example, the state ψ of a single quantum bit may be in the |0> state, the |1> state, the superposition state of the |0> state and the |1> state (uncertain state), which can be specifically expressed as ψ=α|0>+|1>, where α and β are complex numbers representing the amplitude (probability amplitude) of the quantum state, and the square of the amplitude modulus || 2 and || 2 Respectively represent the probabilities of the |0> state and the |1> state, || 2 +|β| 2 = 1. In short, the quantum state is a superposition state composed of various eigenstates. When the probability of other eigenstates is 0, it is in the only determined eigenstate.

[0065] See also Figure 2 , Figure 2 A schematic flow chart of a method for simulating quantum computing provided by an embodiment of the present invention may include the following steps:

[0066] S201: Determine an initial operation object of a current operation to be executed in a quantum program, wherein the initial operation object includes data participating in the operation to be executed determined based on the quantum program.

[0067] During the execution of the quantum program of the initial operation object, the initial operation object is the input of the current operation to be executed. The initial operation object can be determined according to the order relationship between the operations contained in the quantum program and the information of the quantum bits involved in the operation. The data type corresponding to the initial operation object can be a binary string type Reg, a signed integer type Int, an unsigned integer type UInt, a Boolean type Bool, a long floating point type Rat, and specifically, it can be related to the current operation to be executed. Quantum computing simulation using quantum programs involves many operations in the simulation process. According to the time sequence, the result of one operation can be used as the initial operation object of another operation. Therefore, the data type of the initial operation object can be the same or different. As the operation is executed, the data can be converted from one data type to another data type in the operation. Exemplarily, an initial operation object is an unsigned integer. After the operation, a signed integer result is obtained, which can be used as the initial operation object of the next operation.

[0068] The current operation to be executed is the operation that realizes each specific function in the quantum program, which can be the operation corresponding to a quantum logic gate or the operation corresponding to a combination of multiple quantum logic gates. For example, the combination corresponding to multiple quantum logic gates can realize the modular multiplication function, and the specific function is modular multiplication. The current operation to be executed can be determined according to the operation identifier in the quantum program.

[0069] S202: Execute a target operation method on the initial operation object to obtain a target operation object, wherein the target operation method is a classic operation method based on the initial operation object.

[0070] In some possible implementations of the present invention, the target operation mode may be one of the arithmetic operations, and the arithmetic operation may be one of the addition operation, subtraction operation, multiplication operation, and division operation. The target operation mode may also be one of the power function operation, exponential function operation, logarithmic function operation, trigonometric function operation, and inverse trigonometric function operation.

[0071] When the target operation object is to participate in other operations, the target operation object can be the initial operation object of the next operation. When the target operation object no longer participates in the operation, the target operation object is one of the final results of the quantum program simulation. The target operation object can be processed as the state on the quantum bit after passing through the corresponding quantum logic gate. In an embodiment of the present invention, using the target operation method, the initial operation object can be directly subjected to classical operation. Instead of simulating the quantum logic gates one by one, the quantum logic gates that implement a certain operation method are treated as a whole and processed according to the operation functions jointly implemented by these quantum logic gates. The simulation can be performed quickly, reducing the time required for quantum computing simulation. In addition, the final simulation result obtained by simulating in a classical way may be classical data, and thus it may not be necessary to convert quantum data into classical data, simplifying the simulation process.

[0072] It can be seen that the embodiment of the present invention first determines the initial operation object of the current operation to be executed in the quantum program, wherein the initial operation object includes data corresponding to the current state of the quantum bits participating in the operation to be executed; then performs a target operation method on the initial operation object to obtain a target operation object, wherein the target operation method is a classical operation method based on the initial operation object. By operating the initial operation object in a classical operation method, various quantum logic gates are no longer simulated one by one, thereby reducing the time consumption of quantum computing simulation.

[0073] In some possible implementations of the present invention, determining the initial operation object of the operation to be currently executed in the quantum program includes:

[0074] Determining a target register based on information pre-set for an initial operand of a current operation to be performed in the quantum program;

[0075] The initial operand is obtained from the target register.

[0076] Before the current operation to be executed is executed, the corresponding initial operation object will be set, and the storage location, data type, etc. of the initial operation object will be set. Based on the set information, the target register can be determined. The target register stores the initial operation object. According to the identifier of the target register, the target register can be determined, and then the initial operation object is obtained.

[0077] For different target operation modes, the number of required registers may also be different. Specifically, it can be determined according to the target operation mode and the corresponding calculation formula. For example, if the target operation mode is multiplication, two registers are required, the target register stores the initial operation object, and the other register stores the target operation object. Multiply the value in the target register by the multiplier, and assign the result to another register. If the multiplication result continues to participate in the operation, the multiplication result is used as the new initial operation object, and the register storing the multiplication result can be the corresponding target register.

[0078] Exemplarily, when the target operation mode is a division operation, three registers are required to implement the operation. Register reg_lhs stores the dividend, register reg_rhs stores the divisor, and register reg_out stores the result of the division. The divisor and the dividend are both initial operation objects, and register reg_lhs and register reg_rhs are both target registers. The value of register reg_lhs is divided by the value of register reg_rhs to complete the division operation, and the result is stored in register reg_out.

[0079] For example, for complex calculation formulas After completing the calculation of a / b, call the sqrt (square root) function to perform a square root operation on the result of the division; call the acos (inverse cosine) function to perform an arccos calculation on the result of the square root; divide the result by 2π to get the final result, assign it to the floating point output, convert the floating point number into a binary string, and assign the binary string result to register reg_out by bitwise XOR.

[0080] In the embodiment of the present invention, the target operation mode is used to replace the quantum circuit for simulation. The simulation can be completed by performing classical operations on the values ​​in the target register. The values ​​in the target register can be of various data types, which can quickly and conveniently simulate quantum programs and reduce the time required for simulation.

[0081] In some possible implementations of the present invention, the target operation mode is a classical operation mode corresponding to the Hadamard gate;

[0082] The performing a target operation mode on the initial operation object to obtain a target operation object includes:

[0083] According to the classical operation method corresponding to the Hadamard gate, the initial operation object is operated to obtain the operation results and the probabilities corresponding to the operation results;

[0084] In response to merging the operation results, the probabilities corresponding to the same operation results are merged, and the combined operation results and probabilities are used as target operation objects; or,

[0085] In response to not merging the operation results, the operation results and the corresponding probabilities are directly used as target operation objects.

[0086] The H gate is mainly used to realize the superposition state. In quantum computing, this logic gate can operate on the |0> state or the |1> state, and then become a superposition state, that is, the |0> state is operated as Operate the |1> state as For any quantum state |>=α|0>+|1>, From this, we can see that the H gate will turn one input into two outputs, that is, the classical operation method corresponding to the H gate will obtain two operation results and corresponding probabilities. The classical operation method corresponding to the H gate is to use the classical operation method to realize the function corresponding to the H gate.

[0087] After performing the classical operation corresponding to the H gate, it is necessary to determine whether the obtained operation results need to be merged, that is, whether there are identical operation results in the operation results. If there is only one initial operation object when performing the classical operation, there is no need to perform a merge operation, and the operation result and the corresponding probability are directly used as the target operation object. If there are multiple initial operation objects, it is determined whether there are identical operation results. If so, merge them, that is, add the probabilities corresponding to the identical operation results, and delete one of the operation results. Exemplarily, operation result 1 is 0, and the corresponding probability is 0.1, operation result 2 is 1, and the corresponding probability is 0.4, operation result 3 is 0, and the corresponding probability is 0.2, and operation result 4 is 1, and the corresponding probability is 0.3. Then the merged operation results are 1 and 0, and the corresponding probability of 0 is 0.3, and the corresponding probability of 1 is 0.7.

[0088] During the simulation, each operation object has a corresponding probability. The probability here is the observation probability. Each time an operation is performed, the corresponding probability is also calculated to determine the probability of the target operation object. When simulating a combinatorial optimization algorithm, the final operation result with the highest probability can be used as the target solution to determine the optimal or locally optimal combination.

[0089] In some possible implementations of the present invention, performing a target operation on the initial operation object to obtain a target operation object further includes:

[0090] Moving the initial operation object to a specified position of a current operation object queue, wherein the operation object queue is composed of operation objects arranged in the order of participating in the operation;

[0091] The operation result is placed after the initial operation object, and the probability corresponding to the initial operation object is adjusted to 0.

[0092] In the embodiment of the present invention, the operation object queue records all the operation objects in the current simulation, which can be one quantum bit corresponding to one subqueue. The operation object queue is composed of the subqueues of the quantum bits in the quantum computing simulation. By using the task queue, it is relatively convenient to determine the operation object to participate in the next operation. For the convenience of operation, before performing the classical operation method corresponding to the H gate, it is necessary to move the initial operation object in the operation object queue to the head or tail of the queue, insert the budget result after the initial operation object, and set the probability corresponding to the initial operation object to 0, indicating that the initial operation object does not exist after the operation.

[0093] In an embodiment of the present invention, if there is a loop process in the quantum algorithm, when simulating the loop, it may be possible to directly obtain the target operand by using the operation object queue previously recorded in the loop. This operation can omit the simulation of some operations and reduce the simulation time.

[0094] In some possible implementations of the present invention, merging the probabilities corresponding to the same operation results and using the combined operation results and probabilities as target operation objects includes:

[0095] Sort the current operation object queue;

[0096] The probabilities corresponding to the same operation results are added together, and an identical operation result in the sorted operation object queue is deleted to obtain the target operation object.

[0097] In order to facilitate subsequent operations and ensure data consistency, after inserting the operation results into the operation object queue, the queue needs to be sorted, moved back to its original position, and then the operation results are merged. Specifically, first use the sort function to move the position of the operation result, and move the operation result and the initial operation object to the original position of the initial operation object; then traverse the queue, specifically, you can use the unique_and_merge function to traverse; then use the equalto function to determine the operation results generated by the same initial operation object, and then use the merge_ function to merge the operation results and add their probabilities. After merging, some operation results are useless. Use the remove_if function to determine whether the operation results in the operation object queue after the merger can be deleted. After confirmation, use the erase function to delete them.

[0098] In some possible implementations of the present invention, the method may further include:

[0099] The information of the initial operation object is set by using the system class and the state storage class.

[0100] In an embodiment of the present invention, the system class and the statestorage class are used to define the object on which the operation acts - the initial operation object. The system class defines the initial operation object, and the statestorage class defines the name, size, data type and value of the target register storing the initial operation object. Each initial operation object contains a register tuple of the Statestorage class for managing registers. Register management includes allocating a new register to the initial operation object, determining the location of the register, that is, finding the register, obtaining the data type and size of the register, removing the register, etc.

[0101] See also Figure 3 , Figure 3 A schematic diagram of a quantum computing simulation device provided by an embodiment of the present invention, and Figure 2 Corresponding to the process shown, the device includes:

[0102] A determination module 301 is used to determine an initial operation object of a current operation to be executed in a quantum program, wherein the initial operation object includes data participating in the operation to be executed determined based on the quantum program;

[0103] The obtaining module 302 is configured to execute a target operation mode on the initial operation object to obtain a target operation object, wherein the target operation mode is a classical operation mode performed based on the initial operation object.

[0104] In some possible implementations of the present invention, the determining module 301 may be specifically used to:

[0105] Determining a target register based on information pre-set for an initial operand of a current operation to be performed in the quantum program;

[0106] The initial operand is obtained from the target register.

[0107] In some possible implementations of the present invention, the target operation mode is a classical operation mode corresponding to the Hadamard gate;

[0108] The obtaining module 302 may include:

[0109] An obtaining unit, used to perform calculations on the initial operation object according to a classical calculation method corresponding to the Hadamard gate, to obtain calculation results and probabilities corresponding to each calculation result;

[0110] A merging unit, configured to merge the probabilities corresponding to the same operation results in response to merging the operation results, and use the combined operation results and probabilities as target operation objects;

[0111] The object determination unit is used to directly use the operation results and the corresponding probabilities as target operation objects in response to not merging the operation results.

[0112] In some possible implementations of the present invention, the obtaining module 302 may further include:

[0113] A moving unit, used to move the initial operation object to a specified position of a current operation object queue, wherein the operation object queue is composed of operation objects arranged in the order of participating in the operation;

[0114] The adjustment unit is used to place the operation result after the initial operation object and adjust the probability corresponding to the initial operation object to 0.

[0115] In some possible implementations of the present invention, the merging unit may be specifically used for:

[0116] Sort the current operation object queue;

[0117] The probabilities corresponding to the same operation results are added together, and an identical operation result in the sorted operation object queue is deleted to obtain the target operation object.

[0118] In some possible implementations of the present invention, the target operation mode is one of arithmetic operations.

[0119] In some possible implementations of the present invention, the device may further include:

[0120] The setting module is used to set the information of the initial operation object by using the system class and the state storage class.

[0121] It can be seen that the embodiment of the present invention first determines the initial operation object of the current operation to be executed in the quantum program, wherein the initial operation object includes data corresponding to the current state of the quantum bits participating in the operation to be executed; then performs a target operation method on the initial operation object to obtain a target operation object, wherein the target operation method is a classical operation method based on the initial operation object. By operating the initial operation object in a classical operation method, various quantum logic gates are no longer simulated one by one, thereby reducing the time consumption of quantum computing simulation.

[0122] An embodiment of the present invention further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to implement the steps of any of the above method embodiments when running.

[0123] Specifically, in this embodiment, the above storage medium may be configured to store a computer program for implementing the following steps:

[0124] S201: Determine an initial operation object of a current operation to be executed in a quantum program, wherein the initial operation object includes data corresponding to a current state of a quantum bit participating in the operation to be executed;

[0125] S202: Execute a target operation method on the initial operation object to obtain a target operation object, wherein the target operation method is a classic operation method based on the initial operation object.

[0126] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the steps in any one of the above method embodiments.

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

[0128] Specifically, in this embodiment, the processor may be configured to implement the following steps through a computer program:

[0129] S201: Determine an initial operation object of a current operation to be executed in a quantum program, wherein the initial operation object includes data corresponding to a current state of a quantum bit participating in the operation to be executed;

[0130] S202: Execute a target operation method on the initial operation object to obtain a target operation object, wherein the target operation method is a classic operation method based on the initial operation object.

[0131] The above describes in detail the structure, features and effects of the present invention based on the embodiments shown in the drawings. The above is only a preferred embodiment of the present invention, but the present invention is not limited to the scope of implementation shown in the drawings. Any changes made according to the concept of the present invention, or modifications to equivalent embodiments with equivalent changes, which still do not exceed the spirit covered by the description and drawings, should be within the protection scope of the present invention.

Claims

1. A method for simulating quantum computing, characterized in that: The method comprises: Determining an initial operation object of a current operation to be performed in a quantum program, wherein the initial operation object includes data participating in the operation to be performed determined based on the quantum program; A target operation method is executed on the initial operation object to obtain a target operation object, wherein the target operation method is a classical operation method based on the initial operation object.

2. The method according to claim 1, characterized in that: The step of determining the initial operation object of the operation to be currently executed in the quantum program includes: Determining a target register based on information pre-set for an initial operand of a current operation to be performed in the quantum program; The initial operand is obtained from the target register.

3. The method according to claim 1 or 2, characterized in that: The target operation mode is the classical operation mode corresponding to the Hadamard gate; The performing a target operation mode on the initial operation object to obtain a target operation object includes: According to the classical operation method corresponding to the Hadamard gate, the initial operation object is operated to obtain the operation results and the probabilities corresponding to the operation results; In response to merging the operation results, the probabilities corresponding to the same operation results are merged, and the combined operation results and probabilities are used as target operation objects; or, In response to not merging the operation results, the operation results and the corresponding probabilities are directly used as target operation objects.

4. The method according to claim 3, characterized in that The performing of the target operation mode on the initial operation object to obtain the target operation object also includes: Moving the initial operation object to a specified position of a current operation object queue, wherein the operation object queue is composed of operation objects arranged in the order of participating in the operation; The operation result is placed after the initial operation object, and the probability corresponding to the initial operation object is adjusted to 0.

5. The method according to claim 4, characterized in that The step of merging the probabilities corresponding to the same operation results and using the combined operation results and probabilities as target operation objects includes: Sort the current operation object queue; The probabilities corresponding to the same operation results are added together, and an identical operation result in the sorted operation object queue is deleted to obtain the target operation object.

6. The method according to claim 1, characterized in that The target operation mode is one of arithmetic operations.

7. The method according to claim 2, characterized in that The method further comprises: The information of the initial operation object is set by using the system class and the state storage class.

8. A device for simulating quantum computing, characterized in that: The device comprises: A determination module, used to determine an initial operation object of a current operation to be executed in a quantum program, wherein the initial operation object includes data participating in the operation to be executed determined based on the quantum program; The obtaining module is used to execute a target operation mode on the initial operation object to obtain a target operation object, wherein the target operation mode is a classical operation mode based on the initial operation object.

9. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to implement the method according to any one of claims 1 to 7 when executed.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to implement the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Novel universal quantum gate and quantum circuit optimization method

    CN108334952A

  • Multivariate code construction method based on partial spread spectrum and partial multiplicative repeated superposition

    CN110212921A

  • Methods and apparatuses for two-qubit gate reduction in quantum circuits

    CN113168584A

  • Quantum simulation method and device for operation to be executed

    CN113222156A

  • Quantum simulation method and device, electronic device and storage medium

    CN113222157A