A method of simulating quantum computation and related apparatus

CN118734979BActive Publication Date: 2026-10-23ORIGIN QUANTUM COMPUTING TECH (HEFEI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

依靠各种量子逻辑门实现如算术运算操作功能所需要的各种量子逻辑门数量庞大,进而使得量子计算模拟所需的时间比较长

Benefits of technology

[0047]与现有技术相比,本发明先确定量子程序中当前待执行运算的初始运算对象,其中,所述初始运算对象包括参与所述待执行运算的量子比特当前的状态对应的数据;再对所述初始运算对象执行目标运算方式,以获得目标运算对象,其中,所述目标运算方式为基于所述初始运算对象进行的经典运算方式。通过经典运算方式对初始运算对象进行运算,不再逐一对各种量子逻辑门进行模拟,减少量子计算模拟的耗时。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734979B_ABST
    Figure CN118734979B_ABST
Patent Text Reader

Abstract

The application discloses a method for simulating quantum calculation and related devices, and the method comprises the following steps: determining an initial operation object of a current operation to be executed in a quantum program, wherein the initial operation object comprises data participating in the operation to be executed which is determined based on the quantum program; and performing 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. By using the embodiment of the application, the simulation of various quantum logic gates is no longer performed one by one, and the time consumption of quantum calculation simulation is reduced by using classical calculation to simulate quantum calculation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of quantum computing simulation technology, and in particular to a method and related apparatus for simulating quantum computing. Background Technology

[0002] Quantum computers utilize the superposition property of quantum mechanics, theoretically offering exponential speedup capabilities in certain situations. For example, cracking an RSA key would take centuries on a classical computer, but executing a quantum algorithm on a quantum computer would only take hours. However, current quantum computers are limited by the finite number of controllable qubits resulting from advancements in quantum chip hardware, thus limiting their computational power and preventing the widespread execution of quantum algorithms. Broadly running quantum algorithms typically requires the use of quantum computing simulation methods.

[0003] In the simulation of quantum algorithms, it is usually necessary to construct quantum circuits using various quantum logic gates and then use these circuits for simulation. The number of quantum logic gates required to implement functions such as arithmetic operations is enormous, which makes quantum computing simulations relatively time-consuming. Summary of the Invention

[0004] The purpose of this invention is to provide a method and related apparatus for simulating quantum computing. By using classical computing to simulate quantum computing, it eliminates the need to simulate each quantum logic gate individually, thereby reducing the time consumption of quantum computing simulation.

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

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

[0007] The target operation method is performed on the initial operation object to obtain the target operation object, wherein the target operation method is a classic operation method based on the initial operation object.

[0008] Optionally, determining the initial operand of the current operation to be performed in the quantum program includes:

[0009] The target register is determined based on information pre-set for the initial operands of the current operation to be performed in the quantum program;

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

[0011] Optionally, the target computation method is the classic computation method corresponding to Hademamen;

[0012] The step of performing the target operation on the initial operation object to obtain the target operation object includes:

[0013] According to the classic operation method corresponding to Hademamen, the initial operation object is operated on to obtain the operation results and the probability corresponding to each operation result;

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

[0015] Instead of merging the calculation results, the calculation results and their corresponding probabilities are directly used as the target calculation objects.

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

[0017] The initial operand is moved to a specified position in the current operand queue, wherein the operand queue consists of operands arranged in the order in which they participate in the operation;

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

[0019] Optionally, the step of merging probabilities corresponding to the same calculation results, and using the merged calculation results and probabilities as the target calculation object, includes:

[0020] Sort the current operand queue;

[0021] Add the probabilities corresponding to the same operation result, and delete the same operation result from the sorted queue of operation objects to obtain the target operation object.

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

[0023] Optionally, the method further includes:

[0024] The information of the initial computation object is set using system classes and state storage classes.

[0025] Another embodiment of this application provides an apparatus for simulating quantum computing, the apparatus comprising:

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

[0027] The acquisition module is used to perform a target operation 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.

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

[0029] The target register is determined based on information pre-set for the initial operands of the current operation to be performed in the quantum program;

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

[0031] Optionally, the target computation method is the classic computation method corresponding to Hademamen;

[0032] The obtaining module includes:

[0033] The obtaining unit is used to perform operations on the initial operation object according to the classical operation method corresponding to Hademamen, and obtain the operation results and the probability corresponding to each operation result;

[0034] The merging unit is used to merge the operation results, merge the probabilities corresponding to the same operation results, and use the merged operation results and probabilities as the target operation objects.

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

[0036] Optionally, the obtaining module further includes:

[0037] A moving unit is used to move the initial operand to a specified position in the current operand queue, wherein the operand queue consists of operands arranged in the order in which they participate in the operation;

[0038] An adjustment unit is used to place the calculation 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 for:

[0040] Sort the current operand queue;

[0041] Add the probabilities corresponding to the same operation result, and delete the same operation result from the sorted queue of operation objects to obtain the target operation object.

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

[0043] Optionally, the device further includes:

[0044] The configuration module is used to configure the information of the initial computation object using system classes and state storage classes.

[0045] One embodiment of this application provides a storage medium storing a computer program, wherein the computer program is configured to implement the method described in any of the above-described embodiments when running.

[0046] One embodiment of this application provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to implement the method described in any of the above-described embodiments.

[0047] Compared with existing technologies, this invention first determines the initial computational object to be executed in the quantum program, wherein the initial computational object includes data corresponding to the current state of the qubits participating in the computation; then, a target computation method is performed on the initial computational object to obtain the target computational object, wherein the target computation method is a classical computation method based on the initial computational object. By performing computation on the initial computational object using a classical computation method, the simulation of various quantum logic gates is no longer performed one by one, thus reducing the time consumption of quantum computing simulation. Attached Figure Description

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

[0049] Figure 2 A flowchart illustrating a method for simulating quantum computing provided in an embodiment of the present invention;

[0050] Figure 3 This is a schematic diagram of a device for simulating quantum computing provided in an embodiment of the present invention. Detailed Implementation

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

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

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

[0054] The following detailed explanation uses a computer terminal as an example.Figure 1 This is a hardware structure block diagram of a simulated quantum computing embodiment of this application. For example... Figure 1 As shown, computer terminal 10 may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. Optionally, the computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

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

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

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

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

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

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

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

[0062] It's important to note that in classical computing, the most basic unit is the bit, and the most fundamental control mode is the logic gate. Circuit control can be achieved through combinations of logic gates. Similarly, the way to process qubits is through quantum logic gates. Using quantum logic gates, quantum states can evolve. Quantum logic gates are the foundation of quantum circuits. Quantum logic gates include single-qubit quantum logic gates, such as Hadma gates (H gates), Pauli-X gates, Pauli-Y gates, Pauli-Z gates, RX gates, RY gates, and RZ gates; and multi-qubit quantum logic gates, such as CNOT gates, CR gates, iSWAP gates, and Tofoli gates. Quantum logic gates are generally represented using unitary matrices, and unitary matrices are not only matrix forms but also operations and transformations.

[0063] In quantum programming, the quantum state is changed by the quantum logic gates acting on the qubits. The quantum state can be the initial state of the quantum circuit, or it can be the state after the initial state has undergone simulated evolution through the quantum logic gates acting on the qubit. The state corresponding to a qubit is a quantum state, represented in binary in quantum algorithms (or quantum programs). For example, a set of qubits q0, q1, and q2 represents the 0th, 1st, and 2nd qubits, ordered from most significant bit to least significant bit as q2q1q0. The quantum state corresponding to this set of qubits is a superposition of the eigenstates corresponding to this set of qubits. This set of qubits has a total of 2^36 eigenstates. n There are 8 eigenstates (defined states): |000>, |001>, |010>, |011>, |100>, |101>, |110>, and |111>. Each eigenstate corresponds to a qubit. For example, in the |000> state, 000 corresponds to q2q1q0 from the highest to the lowest bit. |> is the Dirac notation.

[0064] Taking a single qubit as an example, the state ψ of a single qubit may be in a superposition of the states |0>, |1>, |0>, and |1> (an uncertain state), 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 is || 2 and || 2 Let |0> and |1> represent the probabilities, respectively. 2 +|β| 2 =1. In short, a quantum state is a superposition of eigenstates. When the probability of other eigenstates is 0, it is in a uniquely determined eigenstate.

[0065] See Figure 2 , Figure 2 A flowchart illustrating a method for simulating quantum computing provided in an embodiment of the present invention may include the following steps:

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

[0067] In the execution of a quantum program, the initial operand is the input to the current operation to be performed. The initial operand can be determined based on the sequence of operations within the quantum program and the information of the qubits involved. The data type corresponding to the initial operand can be a binary string (Reg), a signed integer (Int), an unsigned integer (UInt), a Boolean (Bool), or a long floating-point number (Rat), depending on the specific operation to be performed. Quantum computing simulations using quantum programs involve many operations. Following a time sequence, the result of one operation can serve as the initial operand for another. Therefore, the data types of the initial operands can be the same or different. As operations are performed, data can be converted from one data type to another. For example, an initial operand might be an unsigned integer; after operation, a signed integer result can be obtained, which can then serve as the initial operand for the next operation.

[0068] The operation to be executed is the operation in the quantum program that implements each specific function. It can be an operation corresponding to a single quantum logic gate, or an operation corresponding to a combination of multiple quantum logic gates. For example, a combination of multiple quantum logic gates can implement modular multiplication, and the specific function is modular multiplication. The operation to be executed can be determined based on the operation identifier in the quantum program.

[0069] S202: Perform a target operation 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 embodiments of the present invention, the target operation method can be one of the arithmetic operations, which can be one of addition, subtraction, multiplication, and division. The target operation method can also be one of power function operation, exponential function operation, logarithmic function operation, trigonometric function operation, and inverse trigonometric function operation.

[0071] When the target operand needs to participate in other operations, it can serve as the initial operand for the next operation. When the target operand no longer participates in operations, it becomes one of the final results of the quantum program simulation. The target operand can be processed as the state of the qubit after passing through the corresponding quantum logic gate. In this embodiment of the invention, by utilizing the target operation method, classical operations can be directly performed on the initial operand, instead of simulating each quantum logic gate individually. Instead, the quantum logic gates implementing a certain operation method are treated as a whole and processed according to the common operational function implemented by these quantum logic gates. This allows for rapid simulation and reduces the time required for quantum computing simulation. Furthermore, by using the classical method for simulation, the final simulation result may be classical data, thus potentially eliminating the need for quantum data to classical data conversion, simplifying the simulation process.

[0072] As can be seen, the embodiments of the present invention first determine the initial computational object to be executed in the quantum program, wherein the initial computational object includes data corresponding to the current state of the qubits participating in the computation; then, a target computation method is performed on the initial computational object to obtain a target computational object, wherein the target computation method is a classical computation method based on the initial computational object. By performing computation on the initial computational object using a classical computation method, the simulation of various quantum logic gates is no longer performed one by one, thus reducing the time consumption of quantum computing simulation.

[0073] In some possible embodiments of the present invention, determining the initial operand of the current operation to be performed in the quantum program includes:

[0074] The target register is determined based on information pre-set for the initial operands of the 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 operand is set, including its storage location, data type, etc. Based on the set information, the target register can be determined. The target register stores the initial operand. According to the identifier of the target register, the target register can be determined, and thus the initial operand can be obtained.

[0077] The number of registers required may vary depending on the target operation method. Specifically, it can be determined based on the target operation method and the corresponding calculation formula. For example, if the target operation method is multiplication, two registers are needed: a target register to store the initial operand and another register to store the target operand. The value in the target register is multiplied by the multiplier, and the result is assigned to the other register. If the multiplication result is used in further operations, it becomes a new initial operand, and the register storing the multiplication result can be the corresponding target register.

[0078] For example, when the target operation is division, three registers are needed to perform this operation. Register reg_lhs stores the dividend, register reg_rhs stores the divisor, and register reg_out stores the result of the division. Both the divisor and dividend are the initial operands, and registers reg_lhs and reg_rhs are the destination registers. The division operation is completed by dividing the value in register reg_lhs by the value in register reg_rhs, and the result is stored in register reg_out.

[0079] For example, for complex calculation formulas After completing the a / b calculation, the sqrt function is called to perform a square root operation on the result of the division; the acos function is called to perform an arccos operation on the result of the square root; the result is divided by 2π to obtain the final result, which is then output as a floating-point number. The floating-point number is then converted into a binary string, and the binary string result is bitwise XORed and assigned to the register reg_out.

[0080] In this embodiment of the invention, the simulation is performed by using a target operation method instead of a quantum circuit. The simulation can be completed simply by performing classical operations on the values ​​in the target register. Furthermore, the values ​​in the target register can be of various data types, which allows for quick and convenient simulation of quantum programs and reduces the simulation time required.

[0081] In some possible embodiments of the present invention, the target computation method is the classic computation method corresponding to Hademamen;

[0082] The step of performing the target operation on the initial operation object to obtain the target operation object includes:

[0083] According to the classic operation method corresponding to Hademamen, the initial operation object is operated on to obtain the operation results and the probability corresponding to each operation result;

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

[0085] Instead of merging the calculation results, the calculation results and their corresponding probabilities are directly used as the target calculation objects.

[0086] H-gates are primarily used to realize superposition states. In quantum computing, this logic gate can operate on either the |0> state or the |1> state, thus creating a superposition state; that is, it can manipulate the |0> state into a superposition state. Operate the |1> state as For any quantum state |>=α|0>+|1>, Therefore, we can see that the H-gate transforms one input into two outputs. That is, performing the classic operation method corresponding to the H-gate yields two results and their corresponding probabilities. The classic operation method for the H-gate implements the corresponding function using classical computation techniques.

[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 duplicate operation results. If there is only one initial operand during the classical operation, no merging operation is needed, and the operation result and its corresponding probability are directly used as the target operand. If there are multiple initial operands, it is determined whether there are duplicate operation results. If so, merging is performed, that is, the probabilities corresponding to the duplicate operation results are added together, and one of the operation results is deleted. For example, operation result 1 is 0, with a corresponding probability of 0.1; operation result 2 is 1, with a corresponding probability of 0.4; operation result 3 is 0, with a corresponding probability of 0.2; operation result 4 is 1, with a corresponding probability of 0.3. The merged operation result is 1 and 0, and the probability of 0 is 0.3, and the probability of 1 is 0.7.

[0088] During the simulation, each computational object has a corresponding probability, referred to here as the observed probability. Each computation also calculates the corresponding probability to determine the probability of the target computational object. When simulating combinatorial optimization algorithms, the final computation result with the highest probability can be used as the objective solution, thereby determining the optimal or locally optimal combination.

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

[0090] The initial operand is moved to a specified position in the current operand queue, wherein the operand queue consists of operands arranged in the order in which they participate in the operation;

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

[0092] In this embodiment of the invention, the computation object queue records all computation objects in the current simulation. It can be a sub-queue corresponding to one qubit, and the computation object queue is composed of sub-queues of qubits in the quantum computing simulation. Using the task queue, the computation object to participate in the next computation can be determined relatively easily. For ease of operation, before performing the classical computation method corresponding to the H gate, the initial computation object in the computation object queue needs to be moved to the head or tail of the queue, and the estimated result is inserted after the initial computation object. The probability corresponding to the initial computation object is set to 0, indicating that the initial computation object no longer exists after computation.

[0093] In this embodiment of the invention, if the quantum algorithm contains a loop process, when simulating the loop, the target computational object can be directly obtained by utilizing the queue of computational objects previously recorded in the loop. This operation can omit some computational simulations and reduce simulation time.

[0094] In some possible embodiments of the present invention, the step of merging probabilities corresponding to the same calculation results, and using the merged calculation results and probabilities as the target calculation object, includes:

[0095] Sort the current operand queue;

[0096] Add the probabilities corresponding to the same operation result, and delete the same operation result from the sorted queue of operation objects to obtain the target operation object.

[0097] To facilitate subsequent operations and ensure data consistency, after inserting the calculation results into the queue of operands, the queue needs to be sorted to move them back to their original positions before merging the results. Specifically, the `sort` function is first used to move the positions of the calculation results, placing the results and the initial operands back to their original positions. Then, the queue is traversed using the `unique_and_merge` function. The `equalto` function is then used to determine the calculation results generated by the same initial operand, and the `merge_` function is used to merge the results, adding their probabilities. After merging, some calculation results are useless; the `remove_if` function is used to determine if the results in the merged operand queue can be deleted, and then the `erase` function is used to delete them.

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

[0099] The information of the initial computation object is set using system classes and state storage classes.

[0100] In this embodiment of the invention, the `system` class and the `statestorage` class are used to define the object on which the operation is performed—the initial computation object. The `system` class defines the initial computation object, and the `statestorage` class defines the name, size, data type, and value of the target register storing the initial computation object. Each initial computation object contains a register tuple of the `statestorage` class for register management. Register management includes allocating a new register for the initial computation object, determining the location of the register (i.e., finding the register), obtaining the data type and size of the register, removing the register, and so on.

[0101] See Figure 3 , Figure 3 This is a schematic diagram of the structure of a quantum computing simulation device provided in an embodiment of the present invention. Figure 2 Corresponding to the process shown, the apparatus includes:

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

[0103] The obtaining module 302 is used to perform a target operation 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.

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

[0105] The target register is determined based on information pre-set for the initial operands of the current operation to be performed in the quantum program;

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

[0107] In some possible embodiments of the present invention, the target computation method is the classic computation method corresponding to Hademamen;

[0108] The obtaining module 302 may include:

[0109] The obtaining unit is used to perform operations on the initial operation object according to the classical operation method corresponding to Hademamen, and obtain the operation results and the probability corresponding to each operation result;

[0110] The merging unit is used to merge the operation results, merge the probabilities corresponding to the same operation results, and use the merged operation results and probabilities as the target operation objects.

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

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

[0113] A moving unit is used to move the initial operand to a specified position in the current operand queue, wherein the operand queue consists of operands arranged in the order in which they participate in the operation;

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

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

[0116] Sort the current operand queue;

[0117] Add the probabilities corresponding to the same operation result, and delete the same operation result from the sorted queue of operation objects to obtain the target operation object.

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

[0119] In some possible embodiments of the present invention, the apparatus may further include:

[0120] The configuration module is used to configure the information of the initial computation object using system classes and state storage classes.

[0121] As can be seen, the embodiments of the present invention first determine the initial computational object to be executed in the quantum program, wherein the initial computational object includes data corresponding to the current state of the qubits participating in the computation; then, a target computation method is performed on the initial computational object to obtain a target computational object, wherein the target computation method is a classical computation method based on the initial computational object. By performing computation on the initial computational object using a classical computation method, the simulation of various quantum logic gates is no longer performed one by one, thus reducing the time consumption of quantum computing simulation.

[0122] This invention also provides a storage medium storing a computer program, wherein the computer program is configured to implement the steps in any of the above method embodiments when running.

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

[0124] S201: Determine 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 qubits participating in the operation to be executed;

[0125] S202: Perform a target operation 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] This invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the steps in any of the above method embodiments.

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

[0128] Specifically, in this embodiment, the processor described above can be configured to implement the following steps via a computer program:

[0129] S201: Determine 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 qubits participating in the operation to be executed;

[0130] S202: Perform a target operation 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 description, based on the embodiments shown in the figures, details the structure, features, and effects of the present invention. The above description is only a preferred embodiment of the present invention, but the present invention is not limited to the scope of implementation shown in the figures. Any changes made in accordance with the concept of the present invention, or equivalent embodiments modified to have equivalent changes, that do not exceed the spirit covered by the specification and figures, should be within the protection scope of the present invention.

Claims

1. A method for simulating quantum computing, characterized in that, The method includes: Determine the initial computational object of the current operation to be performed in the quantum program, wherein the initial computational object includes data participating in the operation to be performed, determined based on the quantum program; Perform the target operation on the initial operation object to obtain the target operation object, wherein the target operation method is the classic operation method corresponding to Hademamen, specifically including: According to the classic operation method corresponding to Hademamen, the initial operation object is operated on to obtain the operation results and the probability corresponding to each operation result; In response to merging the operation results, the probabilities corresponding to the same operation results are merged, and the merged operation results and probabilities are used as the target operation objects; or, Instead of merging the calculation results, the calculation results and their corresponding probabilities are directly used as the target calculation objects.

2. The method according to claim 1, characterized in that, The determination of the initial computation object for the current computation to be performed in the quantum program includes: The target register is determined based on information pre-set for the initial operands of the 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 step of performing the target operation on the initial operation object to obtain the target operation object further includes: The initial operand is moved to a specified position in the current operand queue, wherein the operand queue consists of operands arranged in the order in which they participate in the operation; The calculation result is placed after the initial operand, and the probability corresponding to the initial operand is adjusted to 0.

4. The method according to claim 3, characterized in that, The step of merging probabilities corresponding to the same calculation results, and using the merged calculation results and probabilities as the target calculation object, includes: Sort the current operand queue; Add the probabilities corresponding to the same operation result, and delete the same operation result from the sorted queue of operation objects to obtain the target operation object.

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

6. The method according to claim 2, characterized in that, The method further includes: The information of the initial computation object is set using system classes and state storage classes.

7. A device for simulating quantum computing, characterized in that, The device includes: A determination module is used to determine the initial computational object of the current operation to be executed in the quantum program, wherein the initial computational object includes data participating in the operation to be executed, determined based on the quantum program; The acquisition module is used to perform a target operation on the initial operation object to obtain a target operation object, wherein the target operation is the classic operation method corresponding to Hademamen, specifically including: performing an operation on the initial operation object according to the classic operation method corresponding to Hademamen, and obtaining the operation result and the probability corresponding to each operation result; In response to merging the operation results, the probabilities corresponding to the same operation results are merged, and the merged operation results and probabilities are used as the target operation objects; or, Instead of merging the calculation results, the calculation results and their corresponding probabilities are directly used as the target calculation objects.

8. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to implement the method described in any one of claims 1 to 6 when it is run.

9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to implement the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Novel universal quantum gate and quantum circuit optimization method

    CN108334952A

  • Quantum simulation method and device for operation to be executed

    CN113222156A