Dirty quantum constant comparator, dirty quantum variable comparator and quantum computer

By designing dirty quantum constant comparator and dirty quantum variable comparator, using dirty qubits to compare operations with clean qubits, the problem of unreasonable resource utilization in the existing technology is solved, and more efficient qubit resource management is achieved.

CN119494414AActive Publication Date: 2025-02-21ORIGIN QUANTUM COMPUTING TECH (HEFEI) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202311037865.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-17
Publication Date
2025-02-21
Estimated Expiration
2043-08-17

AI Technical Summary

Technical Problem

In quantum computers, it is difficult for the existing technology to effectively utilize dirty quantum bits, resulting in unreasonable resource utilization.

Method used

A dirty quantum constant comparator and dirty quantum variable comparator are designed, using dirty quantum bits and clean qubits to achieve the size comparison between quantum states and constants through subtraction and addition modules, as well as the size comparison between two quantum states.

Benefits of technology

By using dirty qubits, more rational use of qubit resources is achieved, the use of clean qubits is saved, and the resource management efficiency of quantum computers is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119494414A_ABST
    Figure CN119494414A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a dirty quantum constant comparator, a dirty quantum variable comparator and a quantum computer, which can realize the size comparison between a quantum state and a constant and the size comparison between two quantum states based on a dirty quantum bit and a clean quantum bit; in the process of realizing the function of the quantum comparator, dirty quantum bits are used, so that clean quantum bits can be saved, and the utilization of quantum bit resources is more reasonable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical field

[0001] The application relates to the field of quantum computing technology, and in particular to dirty quantum constant comparators, dirty quantum variable comparators and quantum computers. Background technology

[0002] In the field of quantum computing technology, quantum comparators, as the basic hardware circuit of quantum computers, play an important role in the normal operation of quantum computers. Quantum comparators can be divided into quantum constant comparators and quantum variable comparators. Quantum constant comparators can compare the magnitude of the corresponding numerical values ​​of quantum states with the given numerical values, and quantum variable comparators can compare the magnitude of the corresponding numerical values ​​of two quantum states.

[0003] Quantum computers include physical bits and logical bits, and the number of physical bits is generally much larger than the number of logical bits. Physical bits may include clean qubits and dirty qubits, where clean qubits are qubits known in quantum states, and dirty qubits are quantum keys unknown in quantum states. Therefore, it is understandable that Clean qubits are more valuable in quantum computing than dirty qubits. Contents of invention

[0004] The object of the embodiment of the present application is to provide a dirty quantum constant comparator, a dirty quantum variable comparator and a quantum computer to achieve the rationality of increasing the utilization of quantum bit resources. The specific technical solutions are as follows:

[0005] First aspect, the embodiment of the present application provides a dirty quantum constant comparator, including:

[0006] The dirty quantum constant subtraction module is used to calculate the subtraction of the first quantum state and the first constant of the input based on the dirty quantum bits and clean qubits, and obtain the second quantum state used to represent the borrowing result and the third one represent the subtraction result. quantum state;

[0007] Wherein, when the second quantum state represents a borrowed bit, the value of the first quantum state is smaller than the first constant; when the second quantum state represents a borrowed bit, the first The value of the quantum state is not less than the first constant.

[0008] In one possible embodiment, the dirty quantum constant subtraction module includes:

[0009] The first dirty quantum increment submodule, the first series X-Enterprise module, the first dirty quantum constant carry, the second dirty quantum increment submodule, the second dirty quantum constant carry, the second series X-Enterprise module, the first Dirty quantum addition submodule;

[0010] The first dirty quantum increment submodule is used to perform a high-bit part of the first quantum state when the quantum state of the qubit indicating the borrowing result satisfies the one-add operation. Add one operation to obtain the fourth quantum state; if the quantum state representing the borrowing result does not satisfy the one operation, the first quantum state is output as the fourth quantum state;

[0011] The first series of X-gate modules are used to perform NAG logic operations on the high-bit part of the fourth quantum state to obtain the fifth quantum state;

[0012] The first dirty quantum constant carry device is used to use dirty quantum bits and clean qubits to make borrowing judgments on the low bits of the fifth quantum state and the low bits of the first constant, and to apply the borrowing result to represent the borrowing result. on the qubit;

[0013] The second dirty quantum increment submodule is used to perform a high-bit part of the fifth quantum state when the quantum state of the qubit indicating the borrowing result satisfies the one-add operation. Add one operation to obtain the sixth quantum state; if the quantum state of the qubit indicating the borrowing result does not satisfy the one operation, the fifth quantum state is output as the sixth quantum state;

[0014] The second series of X-gate modules are used to perform NAG logic operations on the high-bit part of the sixth quantum state to obtain the seventh quantum state;

[0015] The second dirty quantum constant carry device is used to use dirty quantum bits and clean qubits to make borrowing judgments on the low bits of the seventh quantum state and the low bits of the first constant, and to apply the borrowing result to represent the borrowing result. on the qubit;

[0016] The first dirty quantum addition submodule is used to perform subtraction operations on the high bits of the seventh quantum state and the high bits of the first constant, and perform subtraction operations on the low bits of the seventh quantum state and the low bits of the first constant, to obtain the third quantum state;

[0017] Among them, the quantum state of the qubit that represents the borrowing result is the second quantum state.

[0018] In one possible embodiment, the first dirty quantum increment submodule includes:

[0019] The third qubit interchange unit, the third same-quantity variable subtractor, the fifth series X gate unit, the third same-quantity variable adder, the sixth series X gate unit, the fourth same-quantity variable subtractor, the seventh series X Gate unit, fourth same-quantity variable adder, eighth series X gate unit, and fourth qubit interchange unit;

[0020] The third qubit interchange unit is used to exchange quantum states of dirty qubits and designated clean qubits;

[0021] The third same-quantity variable subtractor is used to calculate the difference between n qubits representing low bits and n qubits representing high bits;

[0022] The fifth series X gate unit is used to perform NAG logic operations on n qubits representing low bits;

[0023] The third same-quantitative variable adder is used to calculate the sum of n qubits representing low bits and n qubits representing high bits;

[0024] The sixth series X gate unit is used to perform NAG logic operations on n qubits representing low bits;

[0025] The fourth isometric variable subtractor is used to calculate the difference between n qubits representing high bits and n qubits representing low bits;

[0026] The seventh series X gate unit is used to perform NAG logic operations on each qubit;

[0027] The fourth isometric variable adder is used to calculate the sum of n qubits representing high bits and n qubits representing low bits;

[0028] The eighth series X gate unit is used to perform NAG logic operations on each qubit;

[0029] The fourth qubit interchange unit is used to interact with the quantum state of dirty qubits and designated clean qubits.

[0030] In one possible embodiment, the first dirty quantum constant carry is used for:

[0031] Interleaving the input clean qubits with the dirty qubits in quantum states, and adding preset qubits to the highest bit to obtain the current quantum state;

[0032] CNOT gate logic operation is performed on the two qubits that represent the lowest bit of the current quantum state to update the current quantum state;

[0033] The qubit to be operated is determined according to the low bit of the first constant, and the qubit to be operated in the current quantum state is performed to update the current quantum state;

[0034] CNOT gate logic operation is performed on the two qubits that represent the lowest bit of the current quantum state to update the current quantum state;

[0035] The qubit to be operated is determined according to the low bit of the first constant, and the qubit to be operated in the current quantum state is performed to update the current quantum state;

[0036] Among them, the quantum state of the preset qubit in the current quantum state represents the carry result.

[0037] In one possible embodiment, the dirty quantum constant comparator further comprises:

[0038] The dirty quantum constant addition module is used to calculate the addition of the third quantum state and the first constant based on the dirty quantum bits and the clean qubits, and reduce the first quantum state.

[0039] In one possible embodiment, the dirty quantum constant addition module comprises:

[0040] The third dirt quantum increment submodule, the third series X-Enterprise module, the third dirt quantum constant carry, the fourth dirt quantum increment submodule, the fourth dirt quantum constant carry, the fourth series X-Enterprise module, the second Dirty quantum addition submodule;

[0041] The third dirty quantum increment submodule is used to add the high-bit part of the third quantum state when the quantum state of the qubit representing the carry result satisfies the one-add operation. One operation is obtained; if the quantum state representing the borrowing result does not satisfy the one operation, the third quantum state is output as the eighth quantum state;

[0042] The third series X gate module is used to perform NAG logic operations on the high-bit part of the eighth quantum state to obtain the ninth quantum state;

[0043] The third dirty quantum constant carry-on is used to carry judgments on the low bit of the ninth quantum state and the low bit of the first constant using dirty qubits and clean qubits, and to apply the carry result to the qubit representing the carry result. superior;

[0044] The fourth viscous quantum increment submodule is used to add the high-bit part of the ninth quantum state when the quantum state of the qubit representing the carry result satisfies the one-add operation. One operation is obtained; if the quantum state of the qubit representing the carry result does not satisfy the one operation, the ninth quantum state is output as the tenth quantum state;

[0045] The fourth viscous quantum constant carry-on is used to carry-by judgments on the low bits of the tenth quantum state and the low bits of the first constant using dirty qubits and clean qubits, and to apply the carry result to the qubits representing the carry result. superior;

[0046] The fourth series X gate module is used to perform NAG logic operations on the high-bit part of the tenth quantum state to obtain the eleventh quantum state;

[0047] The second dirty quantum addition submodule is used to perform addition operations on the high bits of the eleventh quantum state and the high bits of the first constant, and perform addition operations on the low bits of the eleventh quantum state and the low bits of the first constant, and obtain the A quantum state.

[0048] In one possible embodiment, the third dirty quantum increment submodule includes:

[0049] The first qubit interchange unit, the first same-quantity variable subtractor, the first series of X gate units, the first same-quantity variable adder, the second series of X gate units, the second same-quantity variable subtractor, the third series of X Gate unit, second same-quantity variable adder, fourth series X gate unit, second qubit interchange unit;

[0050] The first qubit interchange unit is used to exchange quantum states of dirty qubits and designated clean qubits;

[0051] The first identical variable subtractor is used to calculate the difference between n qubits representing low bits and n qubits representing high bits;

[0052] The first series of X gate units are used to perform NAG logic operations on n qubits representing low bits;

[0053] The first identical variable adder is used to calculate the sum of n qubits representing low bits and n qubits representing high bits;

[0054] The second series of X gate units are used to perform NAG logic operations on n qubits representing low bits;

[0055] The second same-quantity variable subtractor is used to calculate the difference between n qubits representing high bits and n qubits representing low bits;

[0056] The third series of X-gate units are used to perform NAG logic operations on each qubit;

[0057] The second same-quantity variable adder is used to calculate the sum of n qubits representing high bits and n qubits representing low bits;

[0058] The fourth series X gate unit is used to perform NAG logic operations on each qubit;

[0059] The second qubit interchange unit is used to exchange quantum states of dirty qubits and designated clean qubits.

[0060] In one possible embodiment, the third dirty quantum constant carry is used for:

[0061] Interleaving the input clean qubits with the dirty qubits is quantum state, and adding preset qubits to the highest bit to obtain the current quantum state;

[0062] CNOT gate logic operation is performed on the two qubits representing the lowest bit of the current quantum state to update the current quantum state;

[0063] The qubit to be operated is determined according to the low bit of the first constant, and the qubit to be operated in the current quantum state is performed to update the current quantum state;

[0064] CNOT gate logic operation is performed on the two qubits representing the lowest bit of the current quantum state to update the current quantum state;

[0065] The qubit to be operated is determined according to the low bit of the first constant, and the qubit to be operated in the current quantum state is performed to update the current quantum state;

[0066] Among them, the quantum state of the preset qubit in the current quantum state represents the carry result.

[0067] In a second aspect, the embodiment of the present application provides a dirty quantum variable comparator, including:

[0068] Dirty quantum different types of variable subtractors, dirty quantum different types of variable adders;

[0069] The dirty quantum variable subtractor is used to calculate the subtraction of the A quantum state and the B quantum state of the input based on the dirty quantum bits and clean qubits, and obtain the C quantum state used to represent the borrowing result and the subtraction result. D quantum state;

[0070] The dirty quantum different-type variable adder is used to calculate the addition of high and low bits in the D quantum state based on dirty quantum bits and clean quantum bits, and to reduce the A quantum state and B quantum state;

[0071] Wherein, when the C quantum state represents borrowing, the A quantum state is smaller than the B quantum state; when the C quantum state represents unboring, the A quantum state is not smaller than the B quantum state.

[0072] In one possible embodiment, the dirty quantum different type variable subtractor includes:

[0073] The first visceral quantum submodule, the fifth visceral quantum addition submodule, the first series of logic gates, the sixth visceral quantum addition submodule, and the second series of logic gates;

[0074] The first dirty quantum subtraction submodule is used to use dirty quantum bits and clean qubits to subtract one of the high-bit part of the input quantum state when the quantum state of the qubit representing the borrowing result satisfies the subtraction operation. Operation and output; if the quantum state representing the borrowing result does not satisfy the subtraction operation, the quantum state of the input is output;

[0075] The fifth visceral quantum one-increasing submodule is used to use dirty qubits and clean qubits to add one operation to the high-bit part of the input quantum state when the quantum state of the qubit representing the carry result satisfies the one-input operation. and output; if the quantum state of the qubit representing the carry result does not satisfy the one-add operation, the quantum state of the input is output;

[0076] The first series of logic gates is used to perform logic gate operations on the quantum state of the input;

[0077] The sixth viscous quantum increment submodule is used to add the high-bit part of the input quantum state when the quantum state of the input quantum state satisfies the one-add operation using the viscous qubit and clean qubit. One operation and output; if the quantum state of the qubit representing the carry result does not satisfy the one operation, the quantum state of the input is output;

[0078] The second series of logic gates is used to perform logic gate operations on the quantum state of the input.

[0079] In a third aspect, an embodiment of the present application provides a quantum computer, including a dirty quantum constant comparator as described in any of the present application and / or a dirty quantum variable comparator as described in any of the present application.

[0080] The beneficial effects of the embodiments of this application:

[0081] The dirty quantum constant comparator, dirty quantum variable comparator and quantum computer provided by the embodiment of this application can realize the size comparison between quantum states and constants, as well as the size comparison between two quantum states based on dirty quantum bits and clean quantum bits. ;In the process of implementing the function of a quantum comparator, dirty qubits are used, which can save clean qubits and make the utilization of qubit resources more reasonable. Of course, it is not necessary to implement any product or method of this application to achieve all the advantages described above simultaneously. Attached description of the drawings

[0082] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings required for use in the embodiments or the prior art description will be briefly described below. It is obvious that the accompanying drawings in the following description only These are some embodiments of the present application, and other embodiments can also be obtained from these drawings for those skilled in the art.

[0083] Figure 1 is a first schematic diagram of the dirty quantum constant comparator of the embodiment of the present application;

[0084] Figure 2 A second schematic diagram of the dirty quantum constant comparator of the embodiment of the present application;

[0085] Figure 3 This is a first schematic diagram of the dirty quantum constant addition module of the embodiment of the present application;

[0086] Figure 4 A second schematic diagram of the dirty quantum constant addition module of the embodiment of the present application;

[0087] Figure 5 A first schematic diagram of a dirty quantum addition submodule for the embodiment of the present application;

[0088] Figure 6 A second schematic diagram of a dirty quantum addition submodule for the embodiment of the present application;

[0089] Figure 7 A third schematic diagram of a dirty quantum addition submodule for the embodiment of the present application;

[0090] Figure 8 It is a first schematic diagram of the quantum constant carry device of the embodiment of the present application;

[0091] Figure 9 It is a second schematic diagram of the quantum constant carry device of the embodiment of the present application;

[0092] Figure 10 This is a third schematic diagram of the quantum constant carry device of the embodiment of the present application;

[0093] Figure 11 It is a first schematic diagram of the isotype variable adder in the embodiment of the present application;

[0094] Figure 12 It is a second schematic diagram of the isotype variable adder in the embodiment of the present application;

[0095] Figure 13 It is a first schematic diagram of the dirty quantum variable comparator in the embodiment of the present application;

[0096] Figure 14 It is a second schematic diagram of the dirty quantum variable comparator in the embodiment of the present application;

[0097] Figure 15 It is a first schematic diagram of a dirty quantum different type variable adder in the embodiment of the present application;

[0098] Figure 16 It is a second schematic diagram of the dirty quantum different type variable adder in the embodiment of the present application;

[0099] Figure 17 This is a third schematic diagram of a dirty quantum different type variable adder in the embodiment of the present application. Specific implementation methods

[0100] The technical solutions in the embodiments of the present application will be clearly and completely described below in light of the accompanying drawings in the embodiments of the present application. It is obvious that the described embodiments are only part of the embodiments of the present application, not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art based on the application are within the scope of protection of the application.

[0101] In order to increase the rationality of utilizing quantum bit resources, the embodiment of the present application provides a dirty quantum constant comparator, a dirty quantum variable comparator and a quantum computer.

[0102] It should be noted that a true quantum computer is a hybrid structure, which contains two parts: one is a classic computer, responsible for performing classical computing and control; the other is a quantum device, responsible for running quantum programs and then realizing quantum computing. Quantum programs are a series of instruction sequences written by quantum languages ​​such as QRunes that can run on quantum computers, which support quantum logic gate operations and ultimately implement quantum computing. Specifically, a quantum program is a series of instructions that operate quantum logic gates in a certain time sequence.

[0103] In practical applications, due to the development of quantum device hardware, quantum computing simulations are usually required to verify quantum algorithms, quantum applications, etc. Quantum computing simulation is the process of implementing the simulation operation of quantum programs corresponding to specific problems with the virtual architecture (i.e., quantum virtual machines) built with the resources of ordinary computers. Usually, it is necessary to build quantum programs corresponding to specific problems. The quantum program referred to in the embodiment of the present invention is a program written in a classical language to characterize qubits and their evolution. The qubits, quantum logic gates, etc. related to quantum computing all have corresponding classic code representations.

[0104] Quantum circuits, as a way of embodying quantum programs, are also called quantum logic circuits. They are the most commonly used general quantum computing model, representing lines that operate on qubits under abstract concepts, and their compositions include qubits and lines (timelines) , and various quantum logic gates, and finally, they often need to read the results through quantum measurement operations.

[0105] Unlike traditional circuits that are connected by metal wires to transmit voltage signals or current signals, in quantum circuits, the circuit can be regarded as being connected by time, that is, the state of the qubits naturally evolves over time, in this process, according to The Hamiltonian operator's instructions are operated until they encounter a logic gate.

[0106] A quantum program generally 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 qubits in the total quantum circuit is the same as the total number of qubits of the quantum program. It can be understood that a quantum program can be composed of a quantum circuit, a measurement operation for the qubits in a quantum circuit, a register that saves the measurement results, and a control flow node (jump command). A quantum circuit can contain dozens or hundreds or even a Thousands of quantum logic gates operate. The execution process of quantum programs is the process of executing all quantum logic gates in a certain time sequence. It should be noted that timing is the order in which a single quantum logic gate is executed.

[0107] It should be noted that in classical computing, the most basic unit is bits, and the most basic control mode is a logic gate, which can achieve the purpose of controlling the circuit through the combination of logic gates. Similarly, the way to process qubits is the quantum logic gate. Quantum logic gates can enable quantum states to evolve. Quantum logic gates are the basis for forming quantum circuits. Quantum logic gates include single-bit quantum logic gates, such as Hadamard gate (H gate, Adama Gate), Pauli-X gate ( X door, Pauli X door), Pauli-Y door (Y door, Pauli Y door), Pauli-Z door (Z door, Pauli Z door), RX door (RX revolving door), RY door ( RY revolving door), RZ gate (RZ revolving door), etc.; multi-bit quantum logic gates, such as CNOT gate, CR gate, iSWAP gate, Toffoli gate, etc. Quantum logic gates generally use unitary matrix representations, and unitary matrix is ​​not only a matrix form, but also an operation and transformation. The general function of quantum logic gate on quantum states is to calculate by multiplying the left of the unitary matrix by the vector corresponding to the right vector of the quantum state.

[0108] Next, the dirty quantum constant comparator, dirty quantum variable comparator and quantum computer of the embodiment of the present application will be further described.

[0109] See Figure 1 , Figure 1 It is a schematic diagram of a dirty quantum constant comparator of an embodiment of the present application, including n+2 qubits, wherein, |A 0 >, |A 1 >…|A n > For the quantum state of n+1 qubits of the quantum state that needs to be compared (hereinafter referred to as the first quantum state), |0> For the input quantum state of the qubit result, K is the constant that needs to be compared ( Hereinafter, the first constant) in the line means that this part of the line uses dirty qubits, The output quantum state of the qubit result represents the borrowing result. In one example, when the quantum state is |0>, it means that the first quantum state is not less than the first constant, and when the quantum state is |1>, it means that the first The quantum state is smaller than the first constant. It is understandable that Figure 1 In this case, the input quantum state of the qubit result is only represented by |0>. In one example, the input quantum state of the qubit result is also represented by |1>. In this case, the quantum state is When |0>, it means that the first quantum state is less than the first constant, and when the quantum state is |1>, it means that the first quantum state is not less than the first constant.

[0110] In one possible embodiment, the dirty quantum constant comparator of the embodiment of the present application includes:

[0111] The dirty quantum constant subtraction module is used to calculate the subtraction of the first quantum state and the first constant of the input based on the dirty quantum bits and clean qubits, and obtain the second quantum state used to represent the borrowing result and the third one represent the subtraction result. quantum state;

[0112] Wherein, when the second quantum state represents a borrowed bit, the value of the first quantum state is smaller than the first constant; when the second quantum state represents a borrowed bit, the first The value of the quantum state is not less than the first constant.

[0113] The dirty quantum constant comparator of the embodiment of this application can realize the comparison of the size of the quantum state and the constant and the comparison of the size between the two quantum states based on the dirty qubits and clean qubits; in the process of realizing the function of the quantum comparator; , dirty qubits are used, which can save clean qubits and make the utilization of qubit resources more reasonable.

[0114] See Figure 2 , Figure 2 A second schematic diagram of a dirty quantum constant comparator of an embodiment of the present application, including:

[0115] The dirty quantum constant subtraction module 11 and the dirty quantum constant addition module 12;

[0116] The dirty quantum constant subtraction module 11 is used to calculate the subtraction of the first quantum state and the first constant of the input based on the dirty quantum bit and the clean qubit, and obtain the second quantum state for representing the borrowing result and the subtraction result the third quantum state;

[0117] The dirty quantum constant addition module 12 is used to calculate the addition of the third quantum state and the first constant based on the dirty quantum bits and clean qubits, and to reduce the first quantum state;

[0118] Wherein, when the second quantum state represents a borrowed bit, the value of the first quantum state is smaller than the first constant; when the second quantum state represents a borrowed bit, the first The value of the quantum state is not less than the first constant.

[0119] Figure 2 Middle, |A 0 >, |A 1 >…|A n >The quantum state of n+1 clean qubits of the first quantum state, |0>The input quantum state of the clean qubit of the debit result, K is the first constant, The output quantum state of the clean qubit bit that represents the borrowing result. In one example, when the quantum state is |0>, it means that the first quantum state is not less than the first constant. When the quantum state is |1>, it means that the first quantum state is A quantum state is smaller than the first constant. |dirty> means that dirty qubits are used in the quantum circuit of the corresponding module. It is understandable that Figure 2 In this case, the input quantum state of the qubit result is only represented by |0>. In one example, the input quantum state of the qubit result is also represented by |1>. In this case, the quantum state is When |0>, it means that the first quantum state is less than the first constant, and when the quantum state is |1>, it means that the first quantum state is not less than the first constant.

[0120] The output of the dirty quantum constant subtraction module is connected to the input of the dirty quantum constant addition module. The dirty quantum constant subtraction module can use dirty qubits to compare the sizes of the first quantum state and the first constant. The dirty quantum constant addition module can use dirty quantum constants. The quantum state output from the subtraction module is reduced to obtain the first quantum state. Specifically, the dirty quantum constant subtraction module performs the K subtraction operation of the first quantum state. When the value A represented by the first quantum state is less than K, the bit representing the lowest bit is flipped by borrowing "1" operation, if If A is not less than K, it will not cause borrowing to flip. The dirty quantum constant addition module performs a K addition operation on the third quantum state output by the dirty quantum constant subtraction module, thereby reducing the first quantum state.

[0121] For a given first quantum state|A> and a first constant K, where K<2 n , the comparison operation can be realized through the above-mentioned dirty quantum constant comparator, and the comparison result is recorded on the qubit representing the lowest bit of the line. The |dirty> in the line means that this part of the line uses dirty qubits. In the examples of this application, |A 0 >The side is called the line indicating the high position, and the side is called the line indicating the low position. It can be understood that the high position and the low position here are for the convenience of the description of the line. , and is not intended to limit the scope of protection of this application, in other possible scenarios, |A may also be used in 0 >The side where the line is called the low position of the line, and the side|0> is called the high position of the line, and all are within the protection scope of the present application.

[0122] In one example, taking n=3, A=13=1101, K=15=1111 as an example, considering the low position|0>, then:

[0123] |01101>-|1111>=-2=30mod 32=|11110>

[0124] The dirty quantum constant subtraction module performs the K-decrement operation and uses borrowing "1" to flip the bits representing the lowest bit. If A is not less than K, this step of borrowing will not be flipped, thus representing the lowest bit quantum. Bits have always been |0>.

[0125] The dirty quantum constant addition module is used to reduce all qubits representing high bits, and there are:

[0126] |1110>+|1111>=14+15=29=13mod 16=|1101>

[0127] This completes the reduction of the first quantum state, |A>reduction to |1101>, i.e. 13. Only the qubit representing the lowest bit records the magnitude relationship of the first quantum state and the first constant:

[0128]

[0129] From the above analysis, it can be seen that the dirty quantum constant subtraction module is used to calculate the subtraction of quantum states and constants, while the dirty quantum constant addition module is used to calculate the addition of quantum states and constants. The dirty quantum bits are added in two steps (subtraction is regarded as the inverse operation of addition. ) plays a role. In one example, the dirty quantum constant subtraction module calculates the subtraction of quantum states and constants, or the dirty quantum constant addition module is used to calculate the addition of quantum states and constants, both of which require the dirty quantum increment / decrease operation, that is, In the calculation of the addition / subtraction of high or low bits of quantum states and constants, dirty quantum bits are used to represent; carry or borrow in the addition / subtraction of high or low bits of quantum states and constants. It can be understood that the quantum state of the dirty qubit is only used as an intermediate value, so after completing the addition / subtraction of the high or low bits of the quantum state and the constant, the addition / subtraction of the high or low bits of the quantum state and the constant can be calculated again. Subtraction, by calculating twice, we reduce dirty qubits, that is, eliminate the impact of dirty qubits on overall line calculation.

[0130] The dirty quantum constant comparator provided by the embodiment of this application can realize the comparison of the size of quantum states and constants based on the dirty qubits and clean qubits. In the process of realizing the function of the quantum comparator, dirty qubits are used, so that it can save money Clean qubits make the utilization of qubit resources more reasonable.

[0131] In one possible embodiment, the dirty quantum constant subtraction module includes:

[0132] The first dirty quantum increment submodule, the first series X-Enterprise module, the first dirty quantum constant carry, the second dirty quantum increment submodule, the second dirty quantum constant carry, the second series X-Enterprise module, the first Dirty quantum addition submodule;

[0133] The first dirty quantum increment submodule is used to perform a high-bit part of the first quantum state when the quantum state of the qubit indicating the borrowing result satisfies the one-add operation. Add one operation to obtain the fourth quantum state; if the quantum state representing the borrowing result does not satisfy the one operation, the first quantum state is output as the fourth quantum state;

[0134] The first series of X-gate modules are used to perform NAG logic operations on the high-bit part of the fourth quantum state to obtain the fifth quantum state;

[0135] The first dirty quantum constant carry device is used to use dirty quantum bits and clean qubits to make borrowing judgments on the low bits of the fifth quantum state and the low bits of the first constant, and to apply the borrowing result to represent the borrowing result. on the qubit;

[0136] The second dirty quantum increment submodule is used to perform a high-bit part of the fifth quantum state when the quantum state of the qubit indicating the borrowing result satisfies the one-add operation. Add one operation to obtain the sixth quantum state; if the quantum state of the qubit indicating the borrowing result does not satisfy the one operation, the fifth quantum state is output as the sixth quantum state;

[0137] The second series of X-gate modules are used to perform NAG logic operations on the high-bit part of the sixth quantum state to obtain the seventh quantum state;

[0138] The second dirty quantum constant carry device is used to use dirty quantum bits and clean qubits to make borrowing judgments on the low bits of the seventh quantum state and the low bits of the first constant, and to apply the borrowing result to represent the borrowing result. on the qubit;

[0139] The first dirty quantum addition submodule is used to perform subtraction operations on the high bits of the seventh quantum state and the high bits of the first constant, and perform subtraction operations on the low bits of the seventh quantum state and the low bits of the first constant, to obtain the third quantum state;

[0140] Among them, the quantum state of the qubit that represents the borrowing result is the second quantum state.

[0141] The first dirty quantum increment submodule is connected to the first series X gate module, the first series X gate module is connected to the first dirty quantum constant carry, the first dirty quantum constant carry and the second dirty quantum increment submodule Connection, the second dirty quantum increment submodule is connected to the second dirty quantum constant carry, the second dirty quantum constant carry is connected to the second series X-Enterprise module, the second series X-Enterprise module is connected to the first dirty quantum addition submodule connect.

[0142] In the embodiment of the present application, in the dirty quantum constant subtraction module, the subtraction of quantum states and constants is realized based on the dirty quantum bits and clean qubits. In the process of realizing the function of the quantum comparator, dirty quantum bits are used, thereby It can save qubits and make the utilization of qubit resources more reasonable

[0143] It can be understood that the carry device can make carry judgments or borrow judgments. In the embodiment of this application, the implementation process of each dirt quantum one-plus submodule can be referenced from each other without repeated description; the implementation process of each series of X-gate submodule can be Refer to each other without repeated retelling; the implementation process of each dirty quantum constant carry-on can be referred to each other without repeated retelling; the implementation process of each dirty quantum addition submodule can be referred to each other without repeated retelling.

[0144] See Figure 3 , Figure 3 It is the first schematic diagram of the dirty quantum constant addition module of the embodiment of this application, where K is the first constant, and the |dirty> in the line indicates that this part of the line uses dirty qubits, n represents n qubits, and e is 0 Or 1, depending on whether the total number of qubits to be calculated is an odd or even number. When it is an even number, 2n can be divided into high and low bits with the same digits, then e is 0; when it is an odd number, then e is 1.

[0145] In one possible implementation, see Figure 4 , Figure 4 A second schematic diagram of the dirty quantum constant addition module of the embodiment of the present application includes:

[0146] The third dirt quantum increment submodule 121, the third series X gate module 122, the third dirt quantum constant carry 123, the fourth dirt quantum increment submodule 124, the fourth dirt quantum constant carry 125, the fourth series X The gate module 126 and the second dirty quantum addition submodule 127;

[0147] The third dirty quantum increment submodule 121 is used to perform a high-bit part of the third quantum state when the quantum state of the qubit representing the carry result satisfies the one-add operation. Add one operation to obtain the eighth quantum state; if the quantum state representing the borrowing result does not satisfy the one operation, the third quantum state is output as the eighth quantum state;

[0148] The third series X gate module 122 is used to perform NAG logic operation on the high-bit part of the eighth quantum state to obtain the ninth quantum state;

[0149] The third dirty quantum constant carry 123 is used to carry the low bit of the ninth quantum state and the low bit of the first constant using the dirty qubit and the clean qubit, and to apply the carry result to the quantum representing the carry result. on bits;

[0150] The fourth viscous quantum increment submodule 124 is used to perform a high-bit part of the ninth quantum state when the quantum state of the qubit representing the carry result satisfies the one-add operation. Add one operation to obtain the tenth quantum state; if the quantum state of the qubit representing the carry result does not satisfy the one operation, the ninth quantum state is output as the tenth quantum state;

[0151] The fourth visceral quantum constant carry 125 is used to carry the low bit of the eleventh quantum state and the low bit of the first constant using the dirty qubit and the clean qubit, and to apply the carry result to the carry result. on qubits;

[0152] The fourth series X gate module 126 is used to perform NAG logic operations on the high-bit part of the tenth quantum state to obtain the eleventh quantum state;

[0153] The second dirty quantum addition submodule 127 is used to perform addition operations on the high bits of the eleventh quantum state and the high bits of the first constant, and perform addition operations on the low bits of the eleventh quantum state and the low bits of the first constant, to obtain The first quantum state.

[0154] Decompose the first constant K into K according to the high and low positions H , K L , where the high bit is represented by the quantum state of n qubits, and the low bit is represented by the quantum state of n+e qubits. E in n+e on the left side of the line is 0 or 1. When the total number of qubits to be calculated is an even number, e is 0, otherwise e is 1. The input to the left of the line indicating the lowest bit is a dirty qubit. |dirty> indicates that dirty qubits are used in the quantum circuit of the corresponding module. For example, |dirty> indicates that the third dirty quantum increment submodule 121 uses a dirty qubit, n|dirty> in the three-dirty quantum constant carry 123 means that the third-dirty quantum constant carry 123 uses n dirty qubits. The entire line is the third visceral quantum increment submodule 121, the third series X-gate submodule 122, the third visceral quantum constant carry 123, the fourth visceral quantum increment submodule 124, and the fourth visceral quantum constant respectively. Carryer 125, fourth series X gate submodule 126, and finally performs the second dirty quantum addition submodule 127 in the high-bit n bit and the low-bit n+e bit respectively.

[0155] In one example, when the dirty quantum constant addition module indicates that the quantum state of the dirty qubit at the lowest bit is |1>, it is determined that the addition operation is satisfied; in the dirty quantum constant addition module indicates that the quantum state of the dirty qubit at the lowest bit is | When 0>, it is determined that the additional operation is not satisfied.

[0156] There are many ways to perform quantum addition submodules separately at high and low positions. One is to call the dirty quantum constant addition module in this application again. This is an addition calculation process containing iterative ideas, which is constantly divided into low and high positions until the The high and low bits divided are only 1 bit; another feasible idea is to use the Fourier constant adder; the method of adding calculation using the Fourier constant adder can be referred to the prior art, and the specific limitations are not specified in this application. .

[0157] Add K in the dirty quantum constant addition module H , K L The reason is obvious. The first 6 parts of the module are to determine whether to go up to the high position, and whether the further depends on whether the low position of the input quantum state|A> and the low position of K produce a carry. The left side of the module looks like two sets of repetitive operations because the bits representing the low bits are dirty qubits by default, so they need to "calculate twice", which is a feature of dirty qubit calculation.

[0158] In one example, assuming |A>=11=|1011>, K=6=0110, the dirty qubit of the lowest bit is assumed to be |1>, then the initial state is:

[0159] |11011>

[0160] Split |A> into two parts, high and low, that is, register A can be regarded as being divided into two parts, high and low |11>;

[0161] In the first step, since the lowest bit is |1>, the third visceral quantum increment submodule is controlled to obtain the high bit |11>;

[0162] The second step is to perform NAND logic operations in the third series of X gate submodules to obtain high position|00>;

[0163] The third step is to execute the third dirty quantum constant carry. The addition of the low bit 10 of K and the low bit A requires carry, so the bit that represents the lowest bit is flipped and becomes |0>;

[0164] In the fourth step, since the low-level one is |0>, the fourth visceral quantum addition submodule does not operate;

[0165] Step 5, execute the fourth visceral quantum constant carry, indicating that the bit of the low bit is restored to |1>;

[0166] Step 6: Execute the fourth series X gate module, and the high position becomes |11>;

[0167] Step 7, the second viscous quantum addition submodel adds the high and low positions respectively, high positions|11>+|01>=|00>, low positions|11>+|10>=|01>;

[0168] The high and low bits are combined to |0001>, which is consistent with the result of 11+6=17=1mod 16 (only four bits, 16 will overflow, so it is equivalent to the operation of the mod 16.

[0169] It is understandable that here, only the quantum state of the dirty qubit input is |1>, indicating that the low-bit qubit will eventually recover. Therefore, the quantum state of the dirty qubit input can also be |0>, and its calculation principle is the same, so I will not repeat it here.

[0170] In the embodiment of the present application, the two dirty quantum constant carryrs each require n dirty qubits, but the high-bit qubits are "idle" when performing the carry operation, so n qubits can be selected from them as dirty quantums temporarily. Use, thus saving qubits.

[0171] See Figure 5 and Figure 6 , Figure 5 When n is an even number, the first schematic diagram of the dirty quantum increment submodule of the embodiment of the present application is shown in the first diagram; Figure 6 When n is an odd number, the first schematic diagram of the dirty quantum increment submodule of the embodiment of the present application is shown in the first diagram. The |dirty> in the line means that this part of the line uses dirty qubits.

[0172] In one possible implementation, see Figure 7 , Figure 7 For another schematic diagram of the quantum increment submodule of the embodiment of the present application, the third viscous quantum increment submodule 121 includes:

[0173] The first qubit interchange unit 1211, the first identical variable subtractor 1212, the first series of X gate units 1213, the first identical variable adder 1214, the second series of X gate units 1215, and the second identical variable subtractor 1216, the third series X gate unit 1217, the second same-quantity variable adder 1218, the fourth series X gate unit 1219, and the second qubit interchange unit 1210;

[0174] The first qubit interchange unit 1211 is used to exchange quantum states of dirty qubits and designated clean qubits;

[0175] The first identical variable subtractor 1212 is used to calculate the difference between n qubits representing low bits and n qubits representing high bits;

[0176] The first series of X gate units 1213 are used to perform NAG logic operations on n qubits representing low bits;

[0177] The first identical variable adder 1214 is used to calculate the sum of n qubits representing low bits and n qubits representing high bits;

[0178] The second series of X gate units 1215 are used to perform NAG logic operations on n qubits representing low bits;

[0179] The second same-quantity variable subtractor 1216 is used to calculate the difference between n qubits representing high bits and n qubits representing low bits;

[0180] The third series X gate unit 1217 is used to perform NAG logic operations on each qubit;

[0181] The second same-quantity variable adder 1218 is used to calculate the sum of n qubits representing high bits and n qubits representing low bits;

[0182] The fourth series X gate unit 1219 is used to perform NAG logic operations on each qubit;

[0183] The second qubit interchange unit 1210 is used to exchange quantum states of dirty qubits and designated clean qubits.

[0184] Among them, the designated clean qubits that exchange positions (quantum states) with the dirty quantum bits can be selected according to the actual situation of the calculation. In one embodiment, the n qubit bits that represent the low bits can be exchanged in the dirty quantum. When the bit is a qubit that represents the lowest bit, the positions of the dirty qubit and n-1 clean qubit representing the low bit are exchanged. For example, the n qubits from top to bottom before the exchange are respectively abcde, where abcd is Clean qubits, e is dirty qubits, and the n qubits from top to bottom after exchange are respectively eabcd.

[0185] In one example, the left side of the quantum increment submodule line includes multiple controlled gates to prevent the first n-1 bits from |11…111>, and no carry is required in other cases.

[0186] The reason why the quantum increment submodule can achieve increment is that the "non" operation of the line, that is, it acts as a series of X gates, which is equivalent to changing the number x to -x-1. Therefore, the second half of the circuit of the quantum increment submodule In essence, it is executed after determining that line +1 does not cause carry:

[0187]

[0188] Hereinafter, n is an odd number for example. It can be understood that the quantum increment submodule line still contains two calculation lines caused by dirty qubits. Here we only show the line operation process with one example:

[0189] Assuming that the input bit string is |1011001>, add dirty qubits, you might assuming the dirty qubit is |1>, then the initial state is |11011001>.

[0190] The first step is to perform the first qubit interchange unit, and the n qubit exchange positions representing the low bits are specifically position exchanges between dirty qubits and three clean qubits, obtain |10111001>;

[0191] The second step is to execute the first identical variable subtractor, and use the four bits representing the low bit to subtract the four bits of the high bit to obtain |01001001>;

[0192] The third step is to perform the first series of X gate units, controlled flip, still |01001001>;

[0193] The fourth step is to execute the first identical variable adder, and the second step is to reverse operation to obtain |10111001>;

[0194] Step 5, execute the second series of X gate units, controlled flip, still |10111001>;

[0195] Step 6, execute the second same-quantity variable subtracter, subtract the four bits representing the low bits with the four bits representing the high bits, and obtain |10111110>;

[0196] Step 7, execute the third series of X gate units, flip all bits, |01000001>;

[0197] Step 8, execute the second same-quantity variable adder, representing the four bits of the high bit, representing the four bits of the low bit, and obtain |01000101>;

[0198] Step 9, execute the fourth series X gate unit, bit flip|10111010>;

[0199] In the tenth step, perform the second qubit interchange unit, move the dirty qubits back to the position representing the lowest bit, and obtain |11011010>, thus completing the increment operation.

[0200] See Figure 7 In this article, n is only used as an example. It can be understood that the increment operation of n as an even number is attributed to the increment operation of n as an odd number, and will not be repeated here.

[0201] See Figure 8 , Figure 8 It is a schematic diagram of a quantum constant carry device of the embodiment of the present application, including n+1 qubits, wherein inputA represents the quantum state of n qubits and is located on the n+1 qubit. The |dirty> in the line means that this part of the line uses dirty qubits.

[0202] In one possible embodiment, the third dirty quantum constant carryr is used to interleave the input clean qubit with the dirty qubit in quantum states and add preset qubits to the highest bit to obtain Current quantum state; perform CNOT gate logic operation on the two qubits that represent the lowest bit of the current quantum state to update the current quantum state; determine the quantum bit to be operated based on the low bit of the first constant, and the quantum to be operated in the current quantum state The bit performs a NAND gate logic operation to update the current quantum state; performs a CNOT gate logic operation on the two qubits that represent the lowest bit of the current quantum state to update the current quantum state; determines the qubit to be operated based on the low bit of the first constant, The NAG logical operation is performed on the qubit to be operated in the current quantum state to update the current quantum state; where the quantum state of the preset qubit in the current quantum state represents the carry result.

[0203] The preset qubit can be |0> or |1>, and the specific settings can be customized according to the actual situation. The interleaving of clean qubits and dirty qubits in quantum states can be sequentially interleaved with the quantum states of clean qubits and dirty qubits in order from high to low or from low to high, for example, when according to high When reaching the low order, dirty qubits|d 2 d 1 d 0 >With clean qubits|A 2 A 1 A 0 >Interleaving quantum states can be obtained |d 2 A 2 d 1 A 1 d 0 A 0 >.

[0204] In one example, take n=3 as an example, see Figure 9 , Figure 9 For some lines of the quantum constant carry, the complete lines need to be restored |A> and dirty qubits|d>, so they need to be executed again. Figure 10 Dagger line in the box. in, The gate represents the component K when K i Execute X gate when equal to 1, otherwise it will not be executed. For example, when K=1=|01>, the component K of K is K 0 The component K equals 1, K 1 equal to 0; |A>Specifically expressed as |A 3 A 2 A 1 A 0 >,|d>Specified as|d 3 d 2 d 1 d 0 >. Furthermore, it is understood that the above-mentioned circuit requires n dirty qubits. Since the impact of dirty qubits on carry needs to be considered, the above circuit still follows the principle of counting the counteracting of dirty quantum effects twice. Among them, the dot symbol indicates the meaning of being controlled; the symbol with a plus sign in the circle indicates the X gate, which is equivalent to a CNOT gate when it is controlled by other qubits.

[0205] The following examples of the operation process of the quantum constant carry device are given, let |A>=9=|101>, K=8=100, and dirty quantum|d> is |010> (although Figure 9 Take n=3 as an example, but here n=2 as an example is used to illustrate):

[0206] The first step is to debris qubits|d>(expressed as|d 2 d 1 d 0 >) with clean qubits|A>(expressed as |A 2 A 1 A 0 >) Interleaving quantum states, plus the highest bit |0> (corresponding to the preset qubit), we obtain:

[0207] |0d 2 A 2 d 1 A 1 d 0 A 0 >=|0011001>

[0208] The second step is to execute CNOT on the two bits of the lowest bit;

[0209] Step 3, execute Figure 10 The lines in the black box, since K=100, there is only K 2 =1, get:

[0210] |0d 2 A 2 d 1 A 1 d 0 A 0 >=|0101001>

[0211] The fourth step is to execute the CNOT gate between the two bits representing the lowest bit, and get |1101001>;

[0212] In the fifth step, execute the inverse line of the black box indicating the high bit, and release the calculation of the bit indicating the high bit, and obtain:

[0213] |0d 2 A 2 d 1 A 1 d 0 A 0 >=|1011001>

[0214] This completes the carry judgment, indicating that the bit of the lowest bit becomes 1, indicating that the carry is required, and both bit strings representing the high bit in the line are restored.

[0215] See Figure 11 , Figure 11 As a schematic diagram of the isotype variable adder in the embodiment of the present application, inputA represents the quantum state of n qubits, and +A represents the sum of the quantum states of computing inputA and the other n qubits.

[0216] In one example, see Figure 12 , taking n=3 as an example, Figure 12 It is another schematic diagram of the isotype variable adder in the embodiment of the present application, Figure 12 The shown line is a TK adder (Y.Takahashi and N.Kunihiro). There are many common adders. The TK adder is one of the adders that can complete addition without the help of auxiliary bits in the original position. Among them, the dot symbol represents the meaning of being controlled; the double X symbol represents the position of the exchange qubit, that is, the SWAP gate; the symbol with a plus sign in the circle represents the X gate, which is equivalent to the A CNOT door.

[0217] The transformation of the bit string representing the low bits throughout the calculation process follows the formula:

[0218]

[0219] In one example, if A=11=|1011> and B=3=|0011>, then the two registers are merged into |00111011>, the first step is controlled flipped, and get |11001100>, and the intermediate line is executed, and get | 00011100>, and finally performs a controlled flip to get |11101011>, so the correct result is obtained, A+B=14=|1110>, and the first bit string is also restored.

[0220] In one possible embodiment, the first dirty quantum increment submodule includes:

[0221] The third qubit interchange unit, the third same-quantity variable subtractor, the fifth series X gate unit, the third same-quantity variable adder, the sixth series X gate unit, the fourth same-quantity variable subtractor, the seventh series X Gate unit, fourth same-quantity variable adder, eighth series X gate unit, and fourth qubit interchange unit;

[0222] The third qubit interchange unit is used to exchange quantum states of dirty qubits and designated clean qubits;

[0223] The third same-quantity variable subtractor is used to calculate the difference between n qubits representing low bits and n qubits representing high bits;

[0224] The fifth series X gate unit is used to perform NAG logic operations on n qubits representing low bits;

[0225] The third same-quantitative variable adder is used to calculate the sum of n qubits representing low bits and n qubits representing high bits;

[0226] The sixth series X gate unit is used to perform NAG logic operations on n qubits representing low bits;

[0227] The fourth isometric variable subtractor is used to calculate the difference between n qubits representing high bits and n qubits representing low bits;

[0228] The seventh series X gate unit is used to perform NAG logic operations on each qubit;

[0229] The fourth isometric variable adder is used to calculate the sum of n qubits representing high bits and n qubits representing low bits;

[0230] The eighth series X gate unit is used to perform NAG logic operations on each qubit;

[0231] The fourth qubit interchange unit is used to exchange quantum states of dirty qubits and designated clean qubits.

[0232] It can be understood that the specific implementation of each part in the first dirt quantum increment submodule can be seen in the specific implementation of each part in the above-mentioned third dirt quantum increment submodule, and will not be described here.

[0233] In one possible embodiment, the first dirty quantum constant carry is used for:

[0234] Interleaving the input clean qubits with the dirty qubits in quantum states, and adding preset qubits to the highest bit to obtain the current quantum state;

[0235] CNOT gate logic operation is performed on the two qubits that represent the lowest bit of the current quantum state to update the current quantum state;

[0236] The qubit to be operated is determined according to the low bit of the first constant, and the qubit to be operated in the current quantum state is performed to update the current quantum state;

[0237] CNOT gate logic operation is performed on the two qubits that represent the lowest bit of the current quantum state to update the current quantum state;

[0238] The qubit to be operated is determined according to the low bit of the first constant, and the qubit to be operated in the current quantum state is performed to update the current quantum state;

[0239] Among them, the quantum state of the preset qubit in the current quantum state represents the carry result.

[0240] It can be understood that the specific implementation of the first dirty quantum constant carryr can be seen in the above description of the above dirty quantum constant carryr, which will not be described here.

[0241] See Figure 13 , The embodiment of the present application also provides a dirty quantum variable comparator, wherein inputA represents the A quantum state of n qubits of n qubits:|A 0 >, |A 1 >…|A n >, B represents the B quantum state of n qubits: |B 0 >, |B 1 >…|B n >,|0>To represent the input quantum state of the qubit result, The output quantum state of the qubit result represents the borrowing result. In one example, when the quantum state is |0>, it means that the A quantum state is not less than the B quantum state, and when the quantum state is |1>, it means that the A quantum state is Less than B quantum state.

[0242] In one example, see Figure 14 , the dirty quantum variable comparator of the embodiment of the present application, including:

[0243] Dirty quantum different type variable subtractor 21 , dirty quantum different type variable adder 22 ;

[0244] The dirty quantum different type variable subtractor 21 is used to calculate the subtraction of the A quantum state and the B quantum state of the input based on the dirty quantum bits and clean quantum bits, and obtain the C quantum state used to represent the borrowing result and the subtraction result the D quantum state;

[0245] The dirty quantum different type variable adder 22 is used to calculate the addition of high and low bits in the D quantum state based on dirty quantum bits and clean quantum bits, and to reduce the A quantum state and B quantum state;

[0246] Wherein, when the C quantum state represents borrowing, the A quantum state is smaller than the B quantum state; when the C quantum state represents unboring, the A quantum state is not smaller than the B quantum state.

[0247] The core idea of ​​a dirty quantum variable comparator is the same as that of a dirty constant comparator. Both are determined by whether to borrow it and then restore the qubit through inverse operation.

[0248] In one possible embodiment, the dirty quantum different type variable subtractor includes:

[0249] The first visceral quantum subtracts one submodule, the fifth visceral quantum addition one submodule, the first series of logic gates, the sixth visceral quantum addition one submodule, and the second series of logic gates;

[0250] The first dirty quantum subtraction submodule is used to use dirty quantum bits and clean qubits to subtract one of the high-bit part of the input quantum state when the quantum state of the qubit representing the borrowing result satisfies the subtraction operation. Operation and output; if the quantum state representing the borrowing result does not satisfy the subtraction operation, the quantum state of the input is output;

[0251] The fifth visceral quantum one-increasing submodule is used to use dirty qubits and clean qubits to add one operation to the high-bit part of the input quantum state when the quantum state of the qubit representing the carry result satisfies the one-input operation. and output; if the quantum state of the qubit representing the carry result does not satisfy the one-add operation, the quantum state of the input is output;

[0252] The first series of logic gates is used to perform logic gate operations on the quantum state of the input;

[0253] The sixth viscous quantum increment submodule is used to add the high-bit part of the input quantum state when the quantum state of the input quantum state satisfies the one-add operation using the viscous qubit and clean qubit. One operation and output; if the quantum state of the qubit representing the carry result does not satisfy the one operation, the quantum state of the input is output;

[0254] The second series of logic gates is used to perform logic gate operations on the quantum state of the input.

[0255] Among them, the first visceral quantum submodule is connected to the fifth visceral quantum addition submodule, the fifth visceral quantum addition submodule is connected to the first series of logic gates, and the first series of logic gates is connected to the sixth visceral quantum addition submodule, The sixth visceral quantum addition submodule is connected to the second series of logic gates.

[0256] See Figure 15 , Figure 15 As a schematic diagram of a dirty quantum different type variable adder in the embodiment of the present application, inputA represents the quantum state of n qubits, and +A represents the sum of the quantum states of inputA and the other n qubits.

[0257] In one possible implementation, see Figure 16 , Figure 16 This is a second schematic diagram of the dirty quantum different type variable adder in the embodiment of the present application, the dirty quantum different type variable adder 22 includes:

[0258] The second dirt quantum submodule 221, the seventh dirt quantum increment submodule 222, the third series of logic gates 223, the eighth dirt quantum increment submodule 224, and the fourth series of logic gates 225;

[0259] The second dirty quantum subtraction submodule 221 is used to reduce the high-bit part of the input quantum state when the quantum state of the input quantum state meets the subtraction operation when the quantum state of the qubit result shows the debit result. One operation and output; if the quantum state representing the borrowing result does not satisfy the one operation, the quantum state of the input is output;

[0260] The seventh viscous quantum one-increasing submodule 222 is used to add one to the high-bit part of the input quantum state when the quantum state of the qubit representing the carry result satisfies the one-input operation. Operation and output; if the quantum state of the qubit representing the carry result does not satisfy the one-add operation, the quantum state of the input is output;

[0261] The third series of logic gates 223 are used to perform logic gate operations on the input quantum state;

[0262] The eighth dirt quantum increment submodule 224 is used to perform a high-bit part of the input quantum state when the quantum state of the qubit representing the carry result satisfies the one-add operation. Add one operation and output; if the quantum state of the qubit representing the carry result does not satisfy the one operation, the quantum state of the input is output;

[0263] The fourth series of logic gates 225 are used to perform logic gate operations on the input quantum state.

[0264] Among them, the second dirt quantum submodule is connected to the seventh dirt quantum increment submodule, the seventh dirt quantum increment submodule is connected to the third series of logic gates, and the third series of logic gates is connected to the eighth dirt quantum increment submodule, The eighth dirt quantum addition submodule is connected to the fourth series of logic gates. Among them, the dot symbol represents the meaning of being controlled; the double X symbol represents the position of the exchange qubit, that is, the SWAP gate; the symbol with a plus sign in the circle represents the X gate, which is equivalent to the A CNOT door.

[0265] In one example, when the quantum state of the controlled qubit is |1>, it is determined that the controlled operation is satisfied (eg, the added one operation / minus one operation); when the quantum state of the controlled qubit is | At 0>, it is determined that the controlled operation is not satisfied (for example, the plus one operation / minus one operation is not satisfied).

[0266] In one example, take n=3 as an example, see Figure 17 , Figure 17 For another schematic diagram of the dirty quantum different type variable adder in the embodiment of this application, the dirty quantum different type variable adder line is deformed on the TK adder, and the core idea is to continuously convert each register representing high bits. The bit is gradually moved to the bottom bit of the register representing the high bit, and then carried. Among them, the dot symbol represents the meaning of being controlled; the double X symbol represents the position of the exchange qubit, that is, the SWAP gate; the symbol with a plus sign in the circle represents the X gate, which is equivalent to the A CNOT door.

[0267] In one example, with A=11=|1011>, B=3=|00011>, unlike the calculation example in the original version of TK adder, here B has one more bit more bits, and several more bits can be used according to the actual situation. Define settings. Thus the complete bit string is:

[0268] BA=|000111011>

[0269] Perform a controlled decrement operation (the decrement operation is the inverse operation of the increment operation), and then perform a controlled increment operation at the high bit of B to obtain:

[0270] |01010101011>

[0271] Then execute the logic gate behind and get:

[0272] |010111011>

[0273] |010111011>

[0274] |010011011>

[0275] |010011011>

[0276] |01101101011>

[0277] |011010111>

[0278] Determine whether to perform an additional operation (not executed):

[0279] |011010111>

[0280] |01101101011>

[0281] |01101101011>

[0282] |011111011>

[0283] |011111011>

[0284] |011101011>

[0285] In this way, the restoration of register A is completed, and addition is completed on register B: 01110=14=11+3.

[0286] It can be understood that subtraction of different types of variables is an inverse operation of addition of different types of variables. The specific implementation process of dirt quantum different types of variable subtractors can be found in the specific implementation of dirt quantum different types of variable adders, which will not be described here.

[0287] The dirty quantum variable comparator provided by the embodiment of this application can realize the size comparison between two quantum states based on the dirty qubits and clean qubits; in the process of realizing the function of the quantum comparator, dirty qubits are used, thereby It can save qubits cleanly and make the utilization of qubit resources more reasonable.

[0288] The embodiments of the present application also provide a quantum computer, including any of the above-mentioned dirty quantum variable comparators and / or any of the above-mentioned dirty quantum constant comparators.

[0289] In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the flow or function as described in the embodiment of the present application is generated in whole or in part. The computer may be a general purpose computer, a dedicated computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be from a website site, computer, server, or data center. Transmission is performed to another website site, computer, server or data center by wired (eg coaxial cable, fiber optic, digital subscriber cable) or wireless (eg infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that the computer can access or a data storage device such as a server, data center, etc. that includes one or more available media integration. The available media may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state hard disk, SolidState Disk (SSD)), or the like.

[0290] It should be noted that, in this article, the technical features in each optional solution can be combined to form a solution as long as it is not contradictory, and these solutions are within the scope of the disclosure of this application. Relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order. Furthermore, the term "including", "comprising" or any other variation thereof is intended to cover non-exclusive inclusions such that a process, method, article or device including a series of elements includes not only those elements, but also not explicitly listed. other elements of or include elements inherent in such a process, method, article or equipment. Without further limitations, elements defined by the statement "including one..." do not exclude the existence of additional identical elements in the process, method, article or device including the elements.

[0291] Each embodiment in this specification is described in related ways. Each embodiment focuses on the differences from other embodiments, and the same and similar parts between each embodiment can be seen with each other.

[0292] The above is only a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modification, equivalent substitution, improvement, etc. made within the spirit and principles of this application are included within the scope of the protection of this application.

Claims

1. A dirty quantum constant comparator, characterized in that: include: A dirty quantum constant subtraction module, used to calculate the subtraction of the input first quantum state and the first constant based on the dirty quantum bit and the clean quantum bit, and obtain a second quantum state for representing the borrow result and a third quantum state for representing the subtraction result; In which, when the second quantum state represents borrowing, the value of the first quantum state is less than the first constant; when the second quantum state represents no borrowing, the value of the first quantum state is not less than the first constant.

2. The dirty quantum constant comparator according to claim 1, characterized in that: The dirty quantum constant subtraction module comprises: A first dirty quantum increase submodule, a first series of X gate submodules, a first dirty quantum constant carry device, a second dirty quantum increase submodule, a second dirty quantum constant carry device, a second series of X gate submodules, and a first dirty quantum addition submodule; The first dirty quantum increment submodule is used to use the dirty quantum bit and the clean quantum bit to perform an increment operation on the high-order part of the first quantum state to obtain a fourth quantum state when the quantum state of the quantum bit representing the borrow result satisfies the increment operation; and output the first quantum state as the fourth quantum state when the quantum state representing the borrow result does not satisfy the increment operation; The first series of X-gate submodules are used to perform a NOT gate logic operation on the high-order part of the fourth quantum state to obtain a fifth quantum state; The first dirty quantum constant carry device is used to use the dirty quantum bit and the clean quantum bit to perform a borrow judgment on the low bit of the fifth quantum state and the low bit of the first constant, and apply the borrow result to the quantum bit representing the borrow result; The second dirty quantum increment submodule is used to use the dirty quantum bit and the clean quantum bit, and when the quantum state of the quantum bit representing the borrow result satisfies the addition operation, perform an addition operation on the high-order part of the fifth quantum state to obtain the sixth quantum state; when the quantum state of the quantum bit representing the borrow result does not satisfy the addition operation, output the fifth quantum state as the sixth quantum state; The second series of X-gate submodules are used to perform a NOT gate logic operation on the high-order portion of the sixth quantum state to obtain a seventh quantum state; The second dirty quantum constant carry device is used to use the dirty quantum bit and the clean quantum bit to perform a borrow judgment on the low bit of the seventh quantum state and the low bit of the first constant, and apply the borrow result to the quantum bit representing the borrow result; The first dirty quantum addition submodule is used to perform a subtraction operation on the high bit of the seventh quantum state and the high bit of the first constant, and to perform a subtraction operation on the low bit of the seventh quantum state and the low bit of the first constant to obtain a third quantum state; Among them, the quantum state of the quantum bit representing the borrow result is the second quantum state.

3. The dirty quantum constant comparator according to claim 2, characterized in that: The first dirty quantum multiplication module includes: a third qubit swap unit, a third isovariable subtractor, a fifth series of X-gate units, a third isovariable adder, a sixth series of X-gate units, a fourth isovariable subtractor, a seventh series of X-gate units, a fourth isovariable adder, an eighth series of X-gate units, and a fourth qubit swap unit; The third qubit exchange unit is used to exchange the quantum state of the dirty qubit with the designated clean qubit; The third isoquant variable subtractor is used to calculate the difference between the n qubits representing the lower bits and the n qubits representing the higher bits; The fifth series of X-gate units are used to perform a NOT gate logic operation on the n qubits representing the lower bits; The third isoquant variable adder is used to calculate the sum of the n qubits representing the lower bits and the n qubits representing the higher bits; The sixth series of X-gate units are used to perform a NOT gate logic operation on the n qubits representing the lower bits; The fourth isoquant variable subtractor is used to calculate the difference between the n qubits representing the higher bits and the n qubits representing the lower bits; The seventh series of X-gate units are used to perform a NOT gate logic operation on each qubit; The fourth isoquant variable adder is used to calculate the sum of the n qubits representing the higher bits and the n qubits representing the lower bits; The eighth series of X-gate units are used to perform a NOT gate logic operation on each qubit; The fourth quantum bit exchange unit is used to exchange the quantum states of the dirty quantum bit and the designated clean quantum bit.

4. The dirty quantum constant comparator according to claim 2, characterized in that: The first dirty quantum constant carry device is used to: Interleave the quantum states of the input clean qubits and dirty qubits, and add a preset qubit to the highest position to obtain the current quantum state; Perform CNOT gate logic operation on the two quantum bits representing the lowest bit of the current quantum state to update the current quantum state; Determine the quantum bit to be operated according to the low bit of the first constant, and perform a NOT gate logic operation on the quantum bit to be operated in the current quantum state to update the current quantum state; Perform CNOT gate logic operation on the two quantum bits representing the lowest bit of the current quantum state to update the current quantum state; Determine the quantum bit to be operated according to the low bit of the first constant, and perform a NOT gate logic operation on the quantum bit to be operated in the current quantum state to update the current quantum state; Among them, the quantum state of the preset quantum bit in the current quantum state represents the carry result.

5. The dirty quantum constant comparator according to claim 1, characterized in that: The dirty quantum constant comparator further comprises: A dirty quantum constant addition module is used to calculate the addition of the third quantum state and the first constant based on the dirty quantum bit and the clean quantum bit, and restore the first quantum state.

6. The dirty quantum constant comparator according to claim 5, characterized in that: The dirty quantum constant addition module comprises: The third dirty quantum increase submodule, the third series X gate submodule, the third dirty quantum constant carry device, the fourth dirty quantum increase submodule, the fourth dirty quantum constant carry device, the fourth series X gate submodule, the second dirty quantum addition submodule; The third dirty quantum increment submodule is used to use the dirty quantum bit and the clean quantum bit, and when the quantum state of the quantum bit representing the carry result satisfies the addition operation, perform an addition operation on the high-order part of the third quantum state to obtain the eighth quantum state; when the quantum state representing the borrow result does not satisfy the addition operation, output the third quantum state as the eighth quantum state; The third series of X-gate submodules are used to perform a NOT gate logic operation on the high-order part of the eighth quantum state to obtain a ninth quantum state; The third dirty quantum constant carry device is used to use the dirty quantum bit and the clean quantum bit to perform a carry judgment on the low bit of the ninth quantum state and the low bit of the first constant, and apply the carry result to the quantum bit representing the carry result; The fourth dirty quantum increment submodule is used to use the dirty quantum bit and the clean quantum bit, and when the quantum state of the quantum bit representing the carry result satisfies the addition operation, perform an addition operation on the high-order part of the ninth quantum state to obtain the tenth quantum state; when the quantum state of the quantum bit representing the carry result does not satisfy the addition operation, output the ninth quantum state as the tenth quantum state; The fourth dirty quantum constant carry device is used to use the dirty quantum bit and the clean quantum bit to perform a carry judgment on the low bit of the tenth quantum state and the low bit of the first constant, and apply the carry result to the quantum bit representing the carry result; The fourth series of X-gate submodules are used to perform a NOT gate logic operation on the high-order part of the tenth quantum state to obtain an eleventh quantum state; The second dirty quantum addition submodule is used to perform an addition operation on the high bit of the eleventh quantum state and the high bit of the first constant, and to perform an addition operation on the low bit of the eleventh quantum state and the low bit of the first constant to obtain the first quantum state.

7. The dirty quantum constant comparator according to claim 6, characterized in that: The third quantum multiplication module comprises: A first qubit swap unit, a first isovariable subtractor, a first series of X-gate units, a first isovariable adder, a second series of X-gate units, a second isovariable subtractor, a third series of X-gate units, a second isovariable adder, a fourth series of X-gate units, and a second qubit swap unit; The first qubit exchange unit is used to exchange the quantum state of the dirty qubit with the designated clean qubit; The first isoquant variable subtractor is used to calculate the difference between the n qubits representing the lower bits and the n qubits representing the higher bits; The first series of X-gate units are used to perform a NOT gate logic operation on the n qubits representing the lower bits; The first isoquant variable adder is used to calculate the sum of n qubits representing low bits and n qubits representing high bits; The second series of X-gate units are used to perform a NOT gate logic operation on the n qubits representing the lower bits; The second isoquant variable subtractor is used to calculate the difference between the n qubits representing the higher bits and the n qubits representing the lower bits; The third series of X-gate units are used to perform a NOT gate logic operation on each qubit; The second isoquant variable adder is used to calculate the sum of the n qubits representing the higher bits and the n qubits representing the lower bits; The fourth series of X-gate units are used to perform a NOT gate logic operation on each qubit; The second quantum bit exchange unit is used to exchange the quantum state of the dirty quantum bit with the designated clean quantum bit.

8. The dirty quantum constant comparator according to claim 6, characterized in that: The third dirty quantum constant carry device is used to: Interleave the quantum states of the input clean qubits and dirty qubits, and add a preset qubit to the highest position to obtain the current quantum state; Perform CNOT gate logic operation on the two quantum bits representing the lowest bit of the current quantum state to update the current quantum state; Determine the quantum bit to be operated according to the low bit of the first constant, and perform a NOT gate logic operation on the quantum bit to be operated in the current quantum state to update the current quantum state; Perform CNOT gate logic operation on the two quantum bits representing the lowest bit of the current quantum state to update the current quantum state; Determine the quantum bit to be operated according to the low bit of the first constant, and perform a NOT gate logic operation on the quantum bit to be operated in the current quantum state to update the current quantum state; Among them, the quantum state of the preset quantum bit in the current quantum state represents the carry result.

9. A dirty quantum variable comparator, characterized in that include: Dirty quantum different type variable subtractor, dirty quantum different type variable adder; The dirty quantum heterogeneous variable subtractor is used to calculate the subtraction of the input A quantum state and B quantum state based on the dirty quantum bit and the clean quantum bit, and obtain the C quantum state used to represent the borrow result and the D quantum state representing the subtraction result; The dirty quantum heterogeneous variable adder is used to calculate the addition of the high bit and the low bit in the D quantum state based on the dirty quantum bit and the clean quantum bit, and restore the A quantum state and the B quantum state; Among them, when the C quantum state represents borrowing, the A quantum state is smaller than the B quantum state; when the C quantum state represents no borrowing, the A quantum state is not smaller than the B quantum state.

10. The dirty quantum variable comparator according to claim 9, characterized in that: The dirty quantum heterogeneous variable subtractor comprises: The first dirty quantum minus one submodule, the fifth dirty quantum plus one submodule, the first series of logic gates, the sixth dirty quantum plus one submodule, the second series of logic gates; The first dirty quantum minus one submodule is used to use dirty quantum bits and clean quantum bits to perform a minus one operation on the high-order part of the input quantum state and output it when the quantum state of the quantum bit representing the borrow result satisfies the minus one operation; and output the input quantum state when the quantum state representing the borrow result does not satisfy the minus one operation; The fifth dirty quantum increment submodule is used to use the dirty quantum bit and the clean quantum bit to perform an increment operation on the high-order part of the input quantum state and output it when the quantum state of the quantum bit representing the carry result satisfies the increment operation; when the quantum state of the quantum bit representing the carry result does not satisfy the increment operation, output the input quantum state; The first series of logic gates are used to perform logic gate operations on input quantum states; The sixth dirty quantum increment submodule is used to use the dirty quantum bit and the clean quantum bit to perform an increment operation on the high-order part of the input quantum state and output it when the quantum state of the quantum bit representing the carry result satisfies the increment operation; and output the input quantum state when the quantum state of the quantum bit representing the carry result does not satisfy the increment operation; The second series of logic gates are used to perform logic gate operations on the input quantum states.

11. A quantum computer, characterized in that: It comprises the dirty quantum constant comparator described in any one of claims 1-8 and / or the dirty quantum variable comparator described in claim 9 or 10.

Citation Information

Patent Citations

  • Machine differentiation of abnormalities in bioelectromagnetic fields

    CN110996785A

  • Design method of quantum divider

    CN112394905A

  • Optimized block encoding of low-rank fermion hamiltonians

    EP4115355A1

  • Quantum circuit libraries for floating-point arithmetic

    US20190156242A1

  • Measurement Based Uncomputation for Quantum Circuit Optimization

    US20200311594A1