CN115879560A - Method and device for judging equivalence relation between quantum data and classical data - Google Patents
Method and device for judging equivalence relation between quantum data and classical data Download PDFInfo
- Publication number
- CN115879560A CN115879560A CN202111146660.7A CN202111146660A CN115879560A CN 115879560 A CN115879560 A CN 115879560A CN 202111146660 A CN202111146660 A CN 202111146660A CN 115879560 A CN115879560 A CN 115879560A
- Authority
- CN
- China
- Prior art keywords
- quantum
- data
- qubit
- classical
- bit
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 239000002096 quantum dot Substances 0.000 claims description 94
- 238000004590 computer program Methods 0.000 claims description 16
- 238000010276 construction Methods 0.000 claims description 3
- 238000004422 calculation algorithm Methods 0.000 abstract description 10
- 230000001133 acceleration Effects 0.000 abstract description 6
- 230000008901 benefit Effects 0.000 abstract description 6
- 238000005516 engineering process Methods 0.000 abstract description 6
- 230000008569 process Effects 0.000 description 7
- 230000005540 biological transmission Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 5
- 238000005259 measurement Methods 0.000 description 3
- 238000004088 simulation Methods 0.000 description 3
- 229910002056 binary alloy Inorganic materials 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 239000011159 matrix material Substances 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000007547 defect Effects 0.000 description 1
- 239000002184 metal Substances 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000005610 quantum mechanics Effects 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 238000005303 weighing Methods 0.000 description 1
Images
Landscapes
- Logic Circuits (AREA)
Abstract
The invention discloses a method and a device for judging an equivalence relation between quantum data and classical data, wherein the method comprises the following steps: obtaining quantum data and classical data to be judged; constructing a quantum line for judging whether the quantum data and the classical data are in an equivalence relation; and operating the quantum line, measuring target quantum bits contained in the quantum line, and judging whether the quantum data and the classical data are in an equivalence relation. By utilizing the embodiment of the invention, the parallel acceleration advantage of quantum computation can be exerted, the equivalent relation comparison of quantum data and classical data is realized, the method becomes the basis of other more complex quantum algorithms, and the blank of the related technology is filled.
Description
Technical Field
The invention belongs to the technical field of quantum computation, and particularly relates to a method and a device for judging an equivalence relation between quantum data and classical data.
Background
Quantum computers are physical devices that perform high-speed mathematical and logical operations, store and process quantum information in compliance with the laws of quantum mechanics. When a device processes and calculates quantum information and runs quantum algorithms, the device is a quantum computer. Quantum computers are a key technology under study because they have the ability to handle mathematical problems more efficiently than ordinary computers, for example, they can speed up the time to break RSA keys from hundreds of years to hours.
At present, with the continuous development of quantum computing, more and more quantum algorithms are generated. However, in the aspect of comparing equivalence relations between quantum data and classical data, a corresponding quantum algorithm is lacked so as to fully exert the parallel acceleration advantages of quantum computation, which is a problem to be solved urgently.
Disclosure of Invention
The invention aims to provide a method and a device for judging the equivalence relation between quantum data and classical data, which are used for solving the defects in the prior art, exerting the parallel acceleration advantage of quantum computation, realizing the comparison of the equivalence relation between the quantum data and the classical data, becoming the basis of other more complex quantum algorithms and filling the blank of the related technology.
An embodiment of the present application provides a method for determining an equivalence relation between quantum data and classical data, the method including:
obtaining quantum data and classical data to be judged;
constructing a quantum line for judging whether the quantum data and the classical data are in an equivalence relation;
and operating the quantum line, measuring target quantum bits contained in the quantum line, and judging whether the quantum data and the classical data are in an equivalence relation.
Optionally, the quantum data includes: quantum states, the classical data comprising: an integer number.
Optionally, the constructing a quantum wire for determining whether the quantum data and the classical data are in an equivalence relation includes:
acquiring a first quantum bit for storing the quantum data, a second quantum bit for storing carry information and a third quantum bit for storing a judgment result;
determining a binary form of the classical data, wherein a length of the binary form is consistent with a first qubit number;
according to each bit of the binary form, determining a corresponding first quantum logic gate for generating carry information and a corresponding second quantum logic gate for generating a judgment result according to the carry information;
and adding the first quantum logic gate to the first qubit and the second qubit, and adding the second quantum logic gate to the second qubit and the third qubit to obtain a quantum line for judging whether the quantum data and the classical data are in an equivalence relation.
Optionally, the determining, according to each bit of the binary form, a corresponding first quantum logic gate for generating carry information and a corresponding second quantum logic gate for generating a determination result according to the carry information includes:
for a first bit q [1] of the first qubit and a first bit a [1] of the second qubit, determining a first qubit logic gate acting on the q [1] and a [1] to be a virtual control X gate or a CNOT gate when the first bit of the binary form is 0 or 1;
determining, for a kth bit q [ k ] of the first qubit, a [ k-1] and a [ k ] of the second qubit, whether a first qubit logic gate acting on the q [ k ], the a [ k-1] and the a [ k ] is a virtual control CNOT gate or a Toffoli gate when the kth bit of the binary form is 0 or 1; wherein k is an integer and takes a value of 2 to n, and n is a first qubit number;
and determining the second quantum logic gate acting on the nth bit a [ n ] of the second qubit and the third qubit as a CNOT gate, wherein the second quantum logic gate is used for generating a judgment result according to carry information.
Optionally, the measuring a target quantum bit included in the quantum line, and determining whether the quantum data and the classical data are in an equivalence relation, includes:
measuring a quantum state of the third qubit as the determination result;
and judging whether the quantum data and the classical data are in an equivalence relation or not according to the judgment result.
Optionally, the determining, according to the determination result, whether the quantum data and the classical data are in an equivalence relation includes:
if the judgment result is in a state of |1>, judging that the quantum data and the classical data are in an equivalent relationship;
and if the judgment result is in the state of |0>, judging that the quantum data and the classical data are not in an equivalence relation.
Optionally, the method further includes:
adding a third quantum logic gate on the third qubit to determine an inequality relationship of the quantum data to the classical data.
Another embodiment of the present application provides a device for determining an equivalence relation between quantum data and classical data, where the device includes:
the acquisition module is used for acquiring quantum data and classical data to be judged;
the construction module is used for constructing a quantum line for judging whether the quantum data and the classical data are in an equivalence relation or not;
and the judging module is used for operating the quantum line, measuring target quantum bits contained in the quantum line and judging whether the quantum data and the classical data are in an equivalence relation.
A further embodiment of the present application provides a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the method of any one of the above when executed.
Yet another embodiment of the present application provides an electronic device comprising a memory having a computer program stored therein and a processor configured to execute the computer program to perform the method of any one of the above.
Compared with the prior art, the equivalent relation judgment method of the quantum data and the classical data, provided by the invention, comprises the steps of firstly obtaining quantum data and the classical data to be judged; constructing a quantum line for judging whether the quantum data and the classical data are in an equivalence relation; and (3) operating the quantum line, measuring target quantum bits contained in the quantum line, and judging whether the quantum data and the classical data are in an equivalence relation or not, thereby exerting the parallel acceleration advantage of quantum computation, realizing the comparison of the equivalence relation of the quantum data and the classical data, becoming the basis of other more complex quantum algorithms, and filling the blank of the related technology.
Drawings
Fig. 1 is a block diagram of a hardware structure of a computer terminal of a method for determining an equivalence relation between quantum data and classical data according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of a method for determining equivalence relation between quantum data and classical data according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a quantum circuit corresponding to an equivalence relation according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an apparatus for determining equivalence relation between quantum data and classical data according to an embodiment of the present invention.
Detailed Description
The embodiments described below with reference to the drawings are illustrative only and should not be construed as limiting the invention.
The embodiment of the invention firstly provides a method for judging the equivalence relation between quantum data and classical data, and the method can be applied to electronic equipment, such as a computer terminal, and specifically, a common computer, a quantum computer and the like.
This will be described in detail below by way of example as it would run on a computer terminal. Fig. 1 is a block diagram of a hardware structure of a computer terminal of a method for determining an equivalence relation between quantum data and classical data according to an embodiment of the present invention. As shown in fig. 1, the computer terminal may include one or more (only one shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, and optionally, a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the computer terminal. For example, the computer terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store software programs and modules of application software, such as program instructions/modules corresponding to the equivalence relation determination method of quantum data and classical data in the embodiment of the application, and the processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, so as to implement the above-mentioned method. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to a computer terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal. In one example, the transmission device 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device 106 can be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
It should be noted that a true quantum computer is a hybrid structure, which includes two major components: one part is a classic computer which is responsible for executing classic calculation and control; the other part is quantum equipment which is responsible for running quantum programs so as to realize quantum computation. The quantum program is a string of instruction sequences which can run on a quantum computer and are written by a quantum language such as a Qrun language, so that the support of the operation of the quantum logic gate is realized, and the quantum computation is finally realized. In particular, a quantum program is a sequence of instructions that operate quantum logic gates in a time sequence.
In practical applications, due to the limited development of quantum device hardware, quantum computation simulation is usually required to verify quantum algorithms, quantum applications, and the like. The quantum computing simulation is a process of realizing the simulation operation of a quantum program corresponding to a specific problem by means of a virtual architecture (namely a quantum virtual machine) built by resources of a common computer. In general, it is necessary to build quantum programs for a particular problem. The quantum program referred in the embodiment of the invention is a program written in a classical language for representing quantum bits and evolution thereof, wherein the quantum bits, quantum logic gates and the like related to quantum computation are all represented by corresponding classical codes.
A quantum circuit, which is an embodiment of a quantum program and also a weighing sub-logic circuit, is the most common general quantum computation model, and represents a circuit that operates on a quantum bit under an abstract concept, and the circuit includes the quantum bit, a circuit (timeline), and various quantum logic gates, and finally, a result is often read through a quantum measurement operation.
Unlike conventional circuits that are connected by metal lines to pass voltage or current signals, in quantum circuits, the lines can be viewed as being connected by time, i.e., the state of a qubit evolves naturally over time, in the process being operated on as indicated by the hamiltonian until a logic gate is encountered.
The quantum program refers to the total quantum circuit, wherein the total number of the quantum bits in the total quantum circuit is the same as the total number of the quantum bits of the quantum program. It can be understood that: a quantum program may consist of quantum wires, measurement operations for quantum bits in the quantum wires, registers to hold measurement results, and control flow nodes (jump instructions), and a quantum wire may contain tens to hundreds or even thousands of quantum logic gate operations. The execution process of the quantum program is a process executed for all the quantum logic gates according to a certain time sequence. It should be noted that timing is the time sequence in which the single quantum logic gate is executed.
It should be noted that, in the classical calculation, the most basic unit is a bit, and the most basic control mode is a logic gate, and the purpose of controlling the circuit can be achieved through the combination of the logic gates. Similarly, the way qubits are handled is quantum logic gates. The quantum state can be evolved by using quantum logic gates, which are the basis for forming quantum circuits, including single-bit quantum logic gates, such as Hadamard gates (H gates, hadamard gates), pauli-X gates (X gates), pauli-Y gates (Y gates), pauli-Z gates (Z gates), RX gates, RY gates, RZ gates, and the like; two-bit or multi-bit quantum logic gates such as CNOT gates, CR gates, CZ gates, iSWAP gates, toffoli gates, and the like. Quantum logic gates are typically represented using unitary matrices, which are not only matrix-form but also an operation and transformation. The function of a general quantum logic gate on a quantum state is calculated by multiplying a unitary matrix by a matrix corresponding to a quantum state right vector.
Quantum states, i.e. logical states of qubits, can be represented in a binary fashion in a quantum algorithm (or quantum program), e.g. a group of qubits q 1 、q 2 、q 3 Represents the 1 st, 2 nd and 3 rd quantum bits, and is ordered from high order to low order as q 3 q 2 q 1 The quantum state corresponding to the set of qubits is a superposition of the eigenstates corresponding to the set of qubits, and the eigenstates corresponding to the set of qubits total 2 to the power of the total number of qubits, i.e. 8 eigenstates (deterministic states): |000>、|001>、|010>、|011>、|100>、|101>、|110>、|111>With the bits of each eigenstate corresponding to qubits, e.g. |000>State, 000 high to low corresponds to q 3 q 2 q 1 ,|>Is a dirac symbol.
Illustrating the logic state of a single qubit in terms of a single qubitMay be at |0>State, |1>State, |0>Sum of states |1>The superimposed state of states (indeterminate state) can be expressed in particular as @>Wherein a and b are complex numbers representing the amplitude (probability amplitude) of the quantum state, the modulo square | a! of the amplitude 2 And | b |) 2 Respectively represent |0>State, |1>Probability of state, | a 2 +|b| 2 =1. In short, a quantum state is a superposition of the eigenstates, and is in a uniquely determined eigenstate when the probability of the other eigenstates is 0.
Referring to fig. 2, fig. 2 is a schematic flow chart of a method for determining an equivalence relation between quantum data and classical data according to an embodiment of the present invention, and the method may include the following steps:
s201, obtaining quantum data and classical data to be judged;
specifically, quantum data refers to quantum information data carried by quantum bits, and classical data refers to information data in the field of classical computation. Where quantum data is, for example, the quantum state of a quantum bit and classical data is, for example, an integer. In the following description, quantum data is used as quantum state, and classical data is used as integer, which do not limit the scope of the present application.
S202, constructing a quantum line for judging whether the quantum data and the classical data are in an equivalence relation;
specifically, in order to compare the equivalence relation between the quantum data and the classical data by using quantum computation, the equivalent relation can be implemented by constructing a quantum line with a corresponding function, and one construction method may be as follows:
s2021, acquiring a first qubit for storing the quantum data, a second qubit for storing carry information, and a third qubit for storing a determination result;
illustratively, the first qubit is provided with n bits q [1]]、q[2]、…、q[n]Corresponding to the quantum state: | i 1 >、|i 2 >、…、|i n >(ii) a Wherein n is a positive integer;
the second qubit is used for storing the comparison between each bit of quantum state of the first qubit and each bit of binary system of classical dataCarry information, provided with n bits: a 1]、a[2]、…、a[n]Carry information is stored specifically in the corresponding quantum state: | a 1 >、|a 2 >、…、|a n >For the equivalence relation, the comparison is started from the lowest bit, if one bit of the quantum state is equal to the corresponding bit of the classical data binary system, the carry information is 1, and if not, the carry information is 0;
the third qubit is used for storing the judgment result of whether the quantum state and the classical data are in an equivalence relation, and 1 bit can be set: q [ cmp ], the result of the determination is stored in the corresponding quantum state | c >.
It is noted that the initial quantum states of the second qubit and the third qubit may be set to the |0> state.
S2022, determining a binary form of the classical data, wherein the length of the binary form is consistent with a first qubit number;
taking classical data as an integer as an example, the integer can be converted into a binary form, and then the numerical value of the binary form is stored in the array t in an inverted order. Wherein the length of the binary form needs to be consistent with the first qubit number n.
For example, if the first qubit number n =6, the integer is 22, the corresponding binary is 10110, and the binary length is less than n, then the 10110 is padded with 0 to 010110, and stored in reverse order until t = [0,1,1,0,1,0]. If the binary length is larger than n, the binary length can be directly output as null, which indicates that the binary length is not equal value relation.
S2023, determining a corresponding first quantum logic gate for generating carry information and a corresponding second quantum logic gate for generating a judgment result according to the carry information according to each bit of the binary form;
in one particular implementation:
(1) Determining, for a first bit q [1] of the first qubit, a first bit a [1] of the second qubit, whether a first qubit logic gate acting on q [1] and a [1] is a virtual X-gate or a CNOT-gate, when a first bit, t [1], of the binary form is 0 or 1;
wherein, the effect of virtual control X gate is: at | i 1 >=|0>X gates are executed, i.e.: at | i 1 >=|0>When a [1]]Quantum state | a of 1 >From |0>Is turned to |1>Thereby obtaining and storing carry information 1 of the first bit;
the CNOT gate functions as: at | i 1 >=|1>When a [1]]Quantum state | a of 1 >From |0>Is turned to |1>Thereby obtaining and storing carry information 1 of the first bit.
(2) Determining, for a kth bit q [ k ] of the first qubit, a [ k-1] of the second qubit, and a [ k ] of the first qubit, that a first quantum logic gate acting on the q [ k ], the a [ k-1], and the a [ k ] is a virtually controlled CNOT gate or a Toffoli gate when a kth bit, i.e., t [ k ], of the binary form is 0 or 1; wherein k is an integer and takes a value of 2 to n, and n is a first quantum bit number;
wherein, the virtual control CNOT gate has the following functions: at | i k >=|0>The CNOT gate is executed, that is: i k >=|0>At | a k-1 >=|1>When the k-th bit a [ k ]]Quantum state | a of k >From |0>Is turned to |1>Thereby obtaining carry information 1 of the kth bit;
the effects of Toffoli gate are: at | i k >=|1>And | a k-1 >=|1>Then the k-th bit a [ k ]]Quantum state | a of k >From |0>Is turned to |1>Thereby obtaining carry information 1 of the k-th bit.
(3) And determining a second quantum logic gate which is used for generating a judgment result according to carry information and acts on the nth bit a [ n ] and the third qubit q [ cmp ] of the second qubit to be a CNOT gate.
Finally, after the virtual control CNOT gate or Toffoli gate is executed, CNOT gates acting on a [ n ] and q [ cmp ] are added, and carry information of a [ n ] is stored into q [ cmp ].
In practical applications, it is also feasible to use quantum logic gates equivalent to toffei gates, CNOT gates or X gates, which is not limited in this application.
S2024, adding the first quantum logic gate to the first qubit and the second qubit, and adding the second quantum logic gate to the second qubit and the third qubit, to obtain a quantum line for determining whether the quantum data and the classical data are in an equivalence relation.
Continuing with the above example, a quantum line corresponding to an equivalence relation can be obtained as shown in fig. 3, where the quantum logic gates shown are: a virtual control X gate, a CNOT gate, a virtual control CNOT gate, a Toffoli gate and a CNOT gate.
S203, operating the quantum line, measuring target quantum bits contained in the quantum line, and judging whether the quantum data and the classical data are in an equivalence relation.
Specifically, the quantum state | c > of the third qubit may be measured as a determination result; and judging whether the quantum data and the classical data are in an equivalence relation or not according to the judgment result.
In the field of computers, a true value true is generally denoted by 1, and exemplarily, if a judgment result is in a state |1>, quantum data and the classical data are judged to be in an equivalent relationship; and if the judgment result is in the state of |0>, judging that the quantum data and the classical data are not in an equivalence relation.
In practical applications, a third quantum logic gate, such as an X gate, may be added to the third qubit of the quantum wire to determine the inequality relationship between the quantum data and the classical data, where: and if the judgment result is in the state of |1>, judging that the quantum data and the classical data are in an unequal value relationship.
Therefore, quantum data and classical data to be judged are obtained; constructing a quantum line for judging whether the quantum data and the classical data are in an equivalence relation; and (3) operating the quantum line, measuring target quantum bits contained in the quantum line, and judging whether the quantum data and the classical data are in an equivalence relation or not, thereby exerting the parallel acceleration advantage of quantum computation, realizing the comparison of the equivalence relation of the quantum data and the classical data, becoming the basis of other more complex quantum algorithms, and filling the blank of the related technology.
Referring to fig. 4, fig. 4 is a schematic structural diagram of an apparatus for determining equivalence relation between quantum data and classical data according to an embodiment of the present invention, corresponding to the process shown in fig. 2, where the apparatus includes:
an obtaining module 401, configured to obtain quantum data and classical data to be determined;
a constructing module 402, configured to construct a quantum wire for determining whether the quantum data and the classical data are in an equivalence relation;
the determining module 403 is configured to run the quantum line, measure a target quantum bit included in the quantum line, and determine whether the quantum data and the classical data are in an equivalence relationship.
Specifically, the quantum data includes: quantum states, the classical data comprising: an integer number.
Specifically, the building module includes:
the acquisition unit is used for acquiring a first quantum bit for storing the quantum data, a second quantum bit for storing carry information and a third quantum bit for storing a judgment result;
a first determination unit for determining a binary form of the classical data, wherein the length of the binary form is consistent with a first qubit number;
the second determining unit is used for determining a corresponding first quantum logic gate for generating carry information and a corresponding second quantum logic gate for generating a judgment result according to the carry information according to each bit of the binary form;
and the adding unit is used for adding the first quantum logic gate to the first qubit and the second qubit and adding the second quantum logic gate to the second qubit and the third qubit to obtain a quantum line for judging whether the quantum data and the classical data are in an equivalence relation.
Specifically, the second determining unit is specifically configured to:
for a first bit q [1] of the first qubit and a first bit a [1] of the second qubit, determining a first qubit logic gate acting on the q [1] and a [1] to be a virtual control X gate or a CNOT gate when the first bit of the binary form is 0 or 1;
determining, for a kth bit q [ k ] of the first qubit, a [ k-1] and a [ k ] of the second qubit, whether a first qubit logic gate acting on the q [ k ], the a [ k-1] and the a [ k ] is a virtual control CNOT gate or a Toffoli gate when the kth bit of the binary form is 0 or 1; wherein k is an integer and takes a value of 2 to n, and n is a first quantum bit number;
and determining the second quantum logic gate acting on the nth bit a [ n ] of the second qubit and the third qubit as a CNOT gate, wherein the second qubit is used for generating a judgment result according to carry information.
Specifically, the judging module includes:
a measuring unit, configured to measure a quantum state of the third qubit as the determination result;
and the judging unit is used for judging whether the quantum data and the classical data are in an equivalence relation or not according to the judging result.
Specifically, the determining unit is specifically configured to:
if the judgment result is in a state of |1>, judging that the quantum data and the classical data are in an equivalent relationship; and if the judgment result is in the state of |0>, judging that the quantum data and the classical data are not in an equivalence relation.
Specifically, the apparatus further comprises:
and the adding module is used for adding a third quantum logic gate on the third quantum bit so as to judge the inequality relation between the quantum data and the classical data.
Therefore, quantum data and classical data to be judged are obtained; constructing a quantum line for judging whether the quantum data and the classical data are in an equivalence relation; and (3) operating the quantum line, measuring target quantum bits contained in the quantum line, and judging whether the quantum data and the classical data are in an equivalence relation or not, thereby exerting the parallel acceleration advantage of quantum computation, realizing the comparison of the equivalence relation of the quantum data and the classical data, becoming the basis of other more complex quantum algorithms, and filling the blank of related technologies.
An embodiment of the present invention further provides a storage medium, where a computer program is stored, where the computer program is configured to execute the steps in any one of the method embodiments when the computer program is run.
Specifically, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, obtaining quantum data and classical data to be judged;
s2, constructing a quantum line for judging whether the quantum data and the classical data are in an equivalence relation;
and S3, operating the quantum line, measuring target quantum bits contained in the quantum line, and judging whether the quantum data and the classical data are in an equivalence relation.
Specifically, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
An embodiment of the present invention further provides an electronic apparatus, which includes a memory and a processor, and is characterized in that the memory stores a computer program, and the processor is configured to execute the computer program to perform the steps in any of the above method embodiments.
Specifically, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Specifically, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, obtaining quantum data and classical data to be judged;
s2, constructing a quantum line for judging whether the quantum data and the classical data are in an equivalence relation;
and S3, operating the quantum line, measuring target quantum bits contained in the quantum line, and judging whether the quantum data and the classical data are in an equivalence relation.
The present invention has been described in detail with reference to the embodiments shown in the drawings, and it is therefore intended that the present invention not be limited to the exact forms and details shown and described, but that various changes and modifications can be made without departing from the spirit and scope of the invention.
Claims (10)
1. A method for judging an equivalence relation between quantum data and classical data is characterized by comprising the following steps:
obtaining quantum data and classical data to be judged;
constructing a quantum line for judging whether the quantum data and the classical data are in an equivalence relation;
and operating the quantum line, measuring target quantum bits contained in the quantum line, and judging whether the quantum data and the classical data are in an equivalence relation.
2. The method of claim 1, wherein the quantum data comprises: quantum states, the classical data comprising: an integer number.
3. The method of claim 1, wherein constructing the quantum wire for determining whether the quantum data and the classical data are in an equivalence relation comprises:
acquiring a first quantum bit for storing the quantum data, a second quantum bit for storing carry information and a third quantum bit for storing a judgment result;
determining a binary form of the classical data, wherein a length of the binary form is consistent with a first qubit number;
according to each bit of the binary form, determining a corresponding first quantum logic gate for generating carry information and a corresponding second quantum logic gate for generating a judgment result according to the carry information;
and adding the first quantum logic gate to the first qubit and the second qubit, and adding the second quantum logic gate to the second qubit and the third qubit to obtain a quantum line for judging whether the quantum data and the classical data are in an equivalence relation.
4. The method of claim 3, wherein determining, according to each bit of the binary form, a corresponding first quantum logic gate for generating carry information and a corresponding second quantum logic gate for generating a determination result according to the carry information comprises:
for a first bit q [1] of the first qubit and a first bit a [1] of the second qubit, determining a first qubit logic gate acting on the q [1] and a [1] to be a virtual control X gate or a CNOT gate when the first bit of the binary form is 0 or 1;
determining, for a kth bit q [ k ] of the first qubit, a [ k-1] and a [ k ] of the second qubit, whether a first qubit logic gate acting on the q [ k ], the a [ k-1] and the a [ k ] is a virtual control CNOT gate or a Toffoli gate when the kth bit of the binary form is 0 or 1; wherein k is an integer and takes a value of 2 to n, and n is a first qubit number;
and determining the second quantum logic gate acting on the nth bit a [ n ] of the second qubit and the third qubit as a CNOT gate, wherein the second quantum logic gate is used for generating a judgment result according to carry information.
5. The method of claim 3, wherein the measuring the target qubit contained in the quantum wire to determine whether the quantum data is in an equivalence relationship with the classical data comprises:
measuring the quantum state of the third qubit as the determination result;
and judging whether the quantum data and the classical data are in an equivalence relation or not according to the judgment result.
6. The method according to claim 5, wherein the determining whether the quantum data and the classical data are in an equivalence relation according to the determination result comprises:
if the judgment result is in a state of |1>, judging that the quantum data and the classical data are in an equivalent relationship; and if the judgment result is in the state of |0>, judging that the quantum data and the classical data are not in an equivalence relation.
7. The method according to any one of claims 1-6, further comprising:
adding a third quantum logic gate on the third qubit to determine an inequality relationship of the quantum data to the classical data.
8. An apparatus for determining equivalence relation between quantum data and classical data, the apparatus comprising:
the acquisition module is used for acquiring quantum data and classical data to be judged;
the construction module is used for constructing a quantum line for judging whether the quantum data and the classical data are in an equivalence relation or not;
and the judging module is used for operating the quantum line, measuring target quantum bits contained in the quantum line and judging whether the quantum data and the classical data are in an equivalence relation.
9. A storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of any of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, wherein the memory has a computer program stored therein, and the processor is configured to execute the computer program to perform the method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111146660.7A CN115879560B (en) | 2021-09-28 | 2021-09-28 | Equivalent relation judging method and device for quantum data and classical data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111146660.7A CN115879560B (en) | 2021-09-28 | 2021-09-28 | Equivalent relation judging method and device for quantum data and classical data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115879560A true CN115879560A (en) | 2023-03-31 |
CN115879560B CN115879560B (en) | 2024-06-14 |
Family
ID=85755793
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111146660.7A Active CN115879560B (en) | 2021-09-28 | 2021-09-28 | Equivalent relation judging method and device for quantum data and classical data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115879560B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101776934A (en) * | 2010-01-28 | 2010-07-14 | 华东交通大学 | Carry generation and transfer function generator and reversible and optimal addition line design method |
CN108984849A (en) * | 2018-06-21 | 2018-12-11 | 广西师范大学 | A kind of quantum comparison device design method based on quantum superposition state |
CN111310928A (en) * | 2020-02-28 | 2020-06-19 | 东南大学 | Implementation method of universal quantum comparison circuit |
CN112162723A (en) * | 2020-09-30 | 2021-01-01 | 合肥本源量子计算科技有限责任公司 | Quantum addition operation method and device, electronic device and storage medium |
WO2021110261A1 (en) * | 2019-12-04 | 2021-06-10 | Alpine Quantum Technologies Gmbh | A method and system for comparing two quantum states |
-
2021
- 2021-09-28 CN CN202111146660.7A patent/CN115879560B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101776934A (en) * | 2010-01-28 | 2010-07-14 | 华东交通大学 | Carry generation and transfer function generator and reversible and optimal addition line design method |
CN108984849A (en) * | 2018-06-21 | 2018-12-11 | 广西师范大学 | A kind of quantum comparison device design method based on quantum superposition state |
WO2021110261A1 (en) * | 2019-12-04 | 2021-06-10 | Alpine Quantum Technologies Gmbh | A method and system for comparing two quantum states |
CN111310928A (en) * | 2020-02-28 | 2020-06-19 | 东南大学 | Implementation method of universal quantum comparison circuit |
CN112162723A (en) * | 2020-09-30 | 2021-01-01 | 合肥本源量子计算科技有限责任公司 | Quantum addition operation method and device, electronic device and storage medium |
Non-Patent Citations (3)
Title |
---|
DAVID SENA OLIVEIRA等: "Quantum search algorithm using quantum bit string comparator", 《2006 INTERNATIONAL TELECOMMUNICATIONS SYMPOSIUM》, 21 January 2008 (2008-01-21) * |
MOZAMMEL H.A. KHAN: "Synthesis of quaternary reversible/quantum comparators", 《JOURNAL OF SYSTEMS ARCHITECTURE》, 31 October 2008 (2008-10-31), pages 977 - 982, XP024099923, DOI: 10.1016/j.sysarc.2008.04.006 * |
王冬;刘志昊;朱皖宁;李善治;: "基于多目标扩展通用Toffoli门的量子比较器设计", 计算机科学, no. 09, 15 September 2012 (2012-09-15) * |
Also Published As
Publication number | Publication date |
---|---|
CN115879560B (en) | 2024-06-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113222155B (en) | Quantum circuit construction method and device, electronic device and storage medium | |
CN111563599A (en) | Quantum line decomposition method and device, storage medium and electronic device | |
CN112633507A (en) | Method and device for encoding complex vector to quantum circuit | |
CN114819163A (en) | Quantum generation countermeasure network training method, device, medium, and electronic device | |
CN113222153B (en) | Quantum state simulation method and device, storage medium and electronic device | |
CN114511094B (en) | Quantum algorithm optimization method and device, storage medium and electronic device | |
CN116090568B (en) | Method and device for determining size relation between quantum data and classical floating point data | |
CN113222157B (en) | Quantum simulation method, quantum simulation device, electronic device and storage medium | |
CN113222151B (en) | Quantum state transformation method and device | |
CN114819168A (en) | Quantum comparison method and device for matrix eigenvalues | |
CN115879562B (en) | Quantum program initial mapping determination method and device and quantum computer | |
CN115829047B (en) | Quantum program final mapping determination method and device and quantum computer | |
CN114881238A (en) | Method and apparatus for constructing quantum discriminator, medium, and electronic apparatus | |
CN115809707B (en) | Quantum comparison operation method, device, electronic device and basic arithmetic component | |
CN115271076B (en) | Construction method and device of Bephylls network corresponding quantum circuit | |
CN114881239A (en) | Method and apparatus for constructing quantum generator, medium, and electronic apparatus | |
CN114912619B (en) | Quantum computing task scheduling method and device and quantum computer operating system | |
CN115983392A (en) | Method, device, medium and electronic device for determining quantum program mapping relation | |
CN115713122B (en) | Method and device for determining size relation between quantum data and classical data | |
CN115879560A (en) | Method and device for judging equivalence relation between quantum data and classical data | |
CN115879558B (en) | Method and device for comparing sizes of multiple quantum states | |
CN115879557B (en) | Quantum circuit-based data size comparison method and device and quantum computer | |
CN115879559B (en) | Method and device for judging equivalence relation among multiple quantum states and quantum computer | |
CN115438791B (en) | Method and device for solving Bayesian network based on quantum circuit | |
CN115879552B (en) | Quantum modulus multiplication inverse operation method and device, electronic device and modulus arithmetic component |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 230088 6th floor, E2 building, phase II, innovation industrial park, 2800 innovation Avenue, Hefei high tech Zone, Hefei City, Anhui Province Applicant after: Benyuan Quantum Computing Technology (Hefei) Co.,Ltd. Address before: 230088 6th floor, E2 building, phase II, innovation industrial park, 2800 innovation Avenue, Hefei high tech Zone, Hefei City, Anhui Province Applicant before: ORIGIN QUANTUM COMPUTING COMPANY, LIMITED, HEFEI |
|
GR01 | Patent grant | ||
GR01 | Patent grant |