CN112000673B - Method and device for inquiring transaction elements by quantum circuit - Google Patents
Method and device for inquiring transaction elements by quantum circuit Download PDFInfo
- Publication number
- CN112000673B CN112000673B CN202010897672.2A CN202010897672A CN112000673B CN 112000673 B CN112000673 B CN 112000673B CN 202010897672 A CN202010897672 A CN 202010897672A CN 112000673 B CN112000673 B CN 112000673B
- Authority
- CN
- China
- Prior art keywords
- quantum
- transaction
- amplitude
- circuit
- quantum circuit
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 62
- 239000002096 quantum dot Substances 0.000 claims description 73
- 238000004590 computer program Methods 0.000 claims description 15
- 230000021615 conjugation Effects 0.000 claims description 7
- 238000010276 construction Methods 0.000 claims description 3
- 230000007547 defect Effects 0.000 abstract description 9
- 238000010586 diagram Methods 0.000 description 23
- 238000004422 calculation algorithm Methods 0.000 description 9
- 238000005065 mining Methods 0.000 description 8
- 239000013598 vector Substances 0.000 description 8
- 239000011159 matrix material Substances 0.000 description 7
- 230000008569 process Effects 0.000 description 7
- 230000005540 biological transmission Effects 0.000 description 6
- 239000007787 solid Substances 0.000 description 6
- 238000004088 simulation Methods 0.000 description 5
- 235000013351 cheese Nutrition 0.000 description 4
- 238000005259 measurement Methods 0.000 description 4
- 235000013336 milk Nutrition 0.000 description 4
- 239000008267 milk Substances 0.000 description 4
- 210000004080 milk Anatomy 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 235000008429 bread Nutrition 0.000 description 3
- 235000014121 butter Nutrition 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000005610 quantum mechanics Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 230000007704 transition Effects 0.000 description 2
- 235000008098 Oxalis acetosella Nutrition 0.000 description 1
- 241001119522 Paullinia pinnata Species 0.000 description 1
- 235000010240 Paullinia pinnata Nutrition 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000011835 investigation Methods 0.000 description 1
- 239000002184 metal Substances 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
- 238000005303 weighing Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2465—Query processing support for facilitating data mining operations in structured databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N10/00—Quantum computing, i.e. information processing based on quantum-mechanical phenomena
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Physics (AREA)
- Probability & Statistics with Applications (AREA)
- Fuzzy Systems (AREA)
- Computational Linguistics (AREA)
- Artificial Intelligence (AREA)
- Computational Mathematics (AREA)
- Condensed Matter Physics & Semiconductors (AREA)
- Evolutionary Computation (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Pure & Applied Mathematics (AREA)
- Computing Systems (AREA)
- Complex Calculations (AREA)
- Superconductor Devices And Manufacturing Methods Thereof (AREA)
Abstract
The invention discloses a method and a device for inquiring transaction elements by utilizing quantum circuits, wherein the method comprises the following steps: the method comprises the steps of obtaining a transaction database at least comprising transaction indexes and corresponding transaction elements, constructing a first quantum circuit which is encoded with the transaction indexes, the transaction elements and binary values of the transaction elements to be queried by utilizing quantum logic gates and quantum bits, operating the first quantum circuit, outputting quantum states comprising the binary values of all the transaction indexes and corresponding first amplitudes thereof, and determining transaction index results corresponding to the transaction elements to be queried according to probability sizes corresponding to all the first amplitudes. By utilizing the embodiment of the invention, the quantum circuit can be designed in the field of quantum computing, so that the defect of low efficiency of inquiring transaction elements in the prior art is overcome.
Description
Technical Field
The invention belongs to the technical field of quantum computing, and particularly relates to a method and a device for inquiring transaction elements by utilizing a quantum circuit.
Background
The quantum computer is a kind of physical device which performs high-speed mathematical and logical operation, stores and processes quantum information according to the law of quantum mechanics. When a device processes and calculates quantum information and operates on a quantum algorithm, the device is a quantum computer. Quantum computers are a key technology under investigation because of their ability to handle mathematical problems more efficiently than ordinary computers, for example, to accelerate the time to crack RSA keys from hundreds of years to hours.
The quantum computing simulation is a simulation computation which simulates and follows the law of quantum mechanics by means of numerical computation and computer science, and is taken as a simulation program, and the high-speed computing capability of a computer is utilized to characterize the space-time evolution of the quantum state according to the basic law of quantum bits of the quantum mechanics.
Association rule mining is used to describe the association between things and mining the correlation between things, which is an explicit or implicit relationship that exists between searching two items in a transaction database, helping management and decision making. The method is characterized in that frequent item sets are obtained through statistical data items, and the method is widely applied to the fields of classified design, bundled sales, warehouse storage configuration and the like, and is a research hotspot for current big data analysis and processing.
In real life, association rules reflect interdependencies and associations between one thing and other things, and are commonly used in recommending systems for physical stores or online electronic commerce: through carrying out association rule mining on a purchasing transaction database of customers, the final purpose is to find the intrinsic commonality of purchasing habits of customer groups, such as the probability of purchasing a product A and simultaneously purchasing a product B, and according to mining results, the layout display of a goods shelf is adjusted, and a promotion combination scheme is designed, so that sales volume is improved.
In the prior art, the basic idea is to find out the item set (i.e. frequent item set) meeting the minimum support in the transaction database, and then generate the association rule according to the frequent item set. The method is characterized in that whether the method is a frequent item set is a core problem is judged, the method is characterized in that the method is used for searching layer by layer, the database is required to be completely scanned once for each search, the traditional serial mode is very low in efficiency, and in a big data environment, the processing capacity can generate a bottleneck.
Based on the above, it is necessary to construct a quantum circuit by utilizing the parallel characteristic of the quantum algorithm to solve the defect of low efficiency of inquiring transaction elements in the prior art.
Disclosure of Invention
The invention aims to provide a method and a device for inquiring transaction elements by utilizing a quantum circuit, which are used for solving the defects in the prior art, and can realize the design of the quantum circuit in the field of quantum computing so as to solve the defect of low efficiency of inquiring the transaction elements in the prior art.
One embodiment of the present application provides a method of querying a transaction element using a quantum wire, the method comprising:
acquiring a transaction database at least comprising transaction indexes and corresponding transaction elements thereof;
constructing a first quantum circuit with binary values of the transaction index, the transaction element and the transaction element to be queried by utilizing a quantum logic gate and a quantum bit, wherein the first quantum circuit is used for querying the transaction index corresponding to the transaction element to be queried;
And operating the first quantum circuit, outputting a quantum state containing binary values of each transaction index and corresponding first amplitudes thereof, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each first amplitude.
Optionally, after constructing the first quantum wire encoded with the transaction index, the transaction element, and the binary value of the transaction element to be queried, the method further comprises:
Adding the first quantum circuit to a first preset quantum bit position in the first preset quantum circuit according to a first preset time sequence to obtain a second quantum circuit at least used for amplitude updating;
The operation of the first quantum circuit, outputting a quantum state containing binary values of each transaction index and corresponding first amplitudes thereof, and determining a transaction index result corresponding to the transaction element to be queried according to the probability size corresponding to each first amplitude, including:
and operating the second quantum circuit, outputting a quantum state containing binary values of each transaction index and a second amplitude corresponding to the quantum state, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each second amplitude, wherein the second amplitude is an amplitude obtained by updating the first amplitude once.
Optionally, after the first quantum circuit is added to the first preset qubit position in the first preset quantum circuit according to the first preset time sequence to obtain the second quantum circuit at least used for amplitude updating, the method further includes:
sequentially adding a plurality of second quantum circuits to second preset quantum bit positions in the second preset quantum circuits according to a second preset time sequence to obtain a third quantum circuit at least used for repeatedly updating amplitude;
The operation of the second quantum circuit, outputting a quantum state containing binary values of each transaction index and a corresponding second amplitude thereof, and determining a transaction index result corresponding to the transaction element to be queried according to the probability size corresponding to each second amplitude, including:
And operating a second combined quantum circuit, outputting a quantum state containing binary values of each transaction index and a third amplitude corresponding to the quantum state, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each third amplitude, wherein the third amplitude is an amplitude obtained by repeatedly updating the first amplitude.
Optionally, the constructing, using quantum logic gates and quantum bits, a quantum circuit encoded with binary values of the transaction index, the transaction element, and the transaction element to be queried includes:
acquiring a group of quantum bits according to the transaction index and the binary bit number of the transaction element;
Coding a transaction index binary value and a transaction element binary value corresponding to each transaction information in the transaction database to a first quantum bit in sequence to construct a first sub-quantum circuit; wherein a binary bit corresponds to the first qubit;
Encoding the binary value of the transaction element to be queried onto a quantum bit corresponding to the transaction element, and adding a preset quantum logic gate into a second quantum bit to construct a second sub-quantum circuit; wherein the preset quantum logic gate comprises a brix-gate;
Adding a controlled U1 quantum logic gate to the second quantum bit to construct a third sub-quantum circuit;
Sequentially adding a transposed conjugation operation corresponding to the second sub-quantum circuit and a transposed conjugation operation corresponding to the first sub-quantum circuit to construct a fourth sub-quantum circuit;
and sequentially forming the first sub-quantum circuit, the second sub-quantum circuit, the third sub-quantum circuit and the fourth sub-quantum circuit into quantum circuits with binary values of the transaction index, the transaction element and the transaction element to be queried according to a preset quantum bit corresponding relation among the sub-quantum circuits.
Optionally, the determining, according to the probability magnitude corresponding to each first amplitude, a transaction index result corresponding to the transaction element to be queried includes:
and calculating the probability corresponding to each first amplitude, and determining the transaction index value contained in the quantum state corresponding to the maximum probability in each probability as a transaction index result corresponding to the transaction element to be queried.
Yet another embodiment of the present application provides a quantum wire building apparatus, including:
The acquisition module is used for acquiring a transaction database at least comprising transaction indexes and corresponding transaction elements;
The construction module is used for constructing a first quantum circuit which is encoded with the transaction index, the transaction element and the binary value of the transaction element to be queried by utilizing a quantum logic gate and a quantum bit, wherein the first quantum circuit is used for querying the transaction index corresponding to the transaction element to be queried;
The output module is used for operating the first quantum circuit, outputting a quantum state containing binary values of each transaction index and corresponding first amplitude, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each first amplitude.
Optionally, after the building module, the apparatus further includes:
The first adding module is used for adding the first quantum circuit to a first preset quantum bit position in the first preset quantum circuit according to a first preset time sequence to obtain a second quantum circuit at least used for amplitude updating;
The output module includes:
The first output unit is used for operating the second quantum circuit, outputting a quantum state containing binary values of each transaction index and corresponding second amplitude, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each second amplitude, wherein the second amplitude is an amplitude obtained by updating the first amplitude once.
Optionally, after the first adding module, the apparatus further includes:
the second adding module is used for sequentially adding a plurality of second quantum circuits to second preset quantum bit positions in the second preset quantum circuits according to a second preset time sequence to obtain a third quantum circuit at least used for repeatedly updating the amplitude;
the first output unit includes:
The second output unit is used for operating a second combined quantum circuit, outputting a quantum state containing binary values of each transaction index and a third amplitude corresponding to the quantum state, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each third amplitude, wherein the third amplitude is an amplitude obtained by repeatedly updating the first amplitude.
A further embodiment of the application provides a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the method of any of the preceding claims when run.
Yet another embodiment of the application provides an electronic device comprising a memory having a computer program stored therein and a processor configured to run the computer program to perform the method described in any of the above.
Compared with the prior art, the method for inquiring the transaction element by utilizing the quantum circuit provided by the invention has the advantages that firstly, the transaction database at least comprising the transaction index and the transaction element corresponding to the transaction index is obtained, then, the quantum logic gate and the quantum bit are utilized to construct the first quantum circuit which is encoded with the transaction index, the transaction element and the binary value of the transaction element to be inquired, the first quantum circuit is operated, the quantum state comprising the binary value of each transaction index and the first amplitude corresponding to the binary value are output, and the transaction index result corresponding to the transaction element to be inquired is determined according to the probability corresponding to each first amplitude, so that the quantum circuit is designed in the quantum computing field, the defect of low efficiency of inquiring the transaction element in the prior art is solved by utilizing the parallel characteristic of the quantum algorithm, and the efficiency of inquiring the transaction element is further improved.
Drawings
Fig. 1 is a hardware block diagram of a computer terminal according to a method for querying transaction elements by using quantum circuits according to an embodiment of the present invention;
Fig. 2 is a flow chart of a method for querying transaction elements by using quantum circuits according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a first sub-quantum circuit according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a second sub-quantum circuit according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a third sub-quantum circuit according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a fourth sub-quantum circuit according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a first quantum circuit according to an embodiment of the present invention;
fig. 8 is a schematic diagram of a first preset quantum circuit according to an embodiment of the present invention;
Fig. 9 is a schematic diagram of a second quantum circuit according to an embodiment of the present invention;
Fig. 10 is a schematic diagram of a third quantum circuit according to an embodiment of the present invention;
Fig. 11 is a schematic structural diagram of a device for querying transaction elements by using quantum circuits according to an embodiment of the present invention.
Detailed Description
The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the invention.
It should be noted that the terms "first," "second," and the like in the description and in the claims are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
The association rule mining can enable us to find out the relation between items (item and item) from the data set, and has many application scenes in our life, namely, shopping basket analysis is a common scene, and the scene can discover the association relation between commodities from the consumer transaction records, so that more sales can be brought by means of commodity binding sales or related recommendation. Association rule mining is therefore a very useful technique.
Based on this, the present invention first introduces a method for querying transaction elements by using quantum wires, which can be applied to electronic devices, such as computer terminals, in particular, general computers, quantum computers, and the like.
The following describes the operation of the computer terminal in detail by taking it as an example. Fig. 1 is a block diagram of a hardware structure of a computer terminal according to a method for querying transaction elements by using quantum circuits according to an embodiment of the present invention. As shown in fig. 1, the computer terminal may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as 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 appreciated by those skilled in the art that the configuration shown in fig. 1 is merely illustrative and is not intended to limit the configuration of the computer terminal described above. 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 method for querying transaction elements using quantum wires in the embodiments of the present application, and the processor 102 executes the software programs and modules stored in the memory 104 to perform various functional applications and data processing, i.e., implement the above-mentioned method. 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 remotely located relative to the processor 102, which may be connected to the computer terminal via 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 means 106 is arranged 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 a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module for communicating with the internet wirelessly.
It should be noted that a real quantum computer is a hybrid structure, which includes two major parts: part of the computers are classical computers and are responsible for performing classical computation 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 series of instruction sequences written in a quantum language such as QRunes language and capable of running on a quantum computer, so that the support of quantum logic gate operation is realized, and finally, quantum computing is realized. Specifically, the quantum program is a series of instruction sequences for operating the quantum logic gate according to a certain time sequence.
In practical applications, quantum computing simulations are often required to verify quantum algorithms, quantum applications, etc., due to the development of quantum device hardware. Quantum computing simulation is a process of realizing simulated 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 construct a quantum program corresponding to a specific problem. The quantum program, namely the program for representing the quantum bit and the evolution thereof written in the classical language, wherein the quantum bit, the quantum logic gate and the like related to quantum computation are all represented by corresponding classical codes.
Quantum circuits, which are one embodiment of quantum programs, also weigh sub-logic circuits, are the most commonly used general quantum computing models, representing circuits that operate on qubits under an abstract concept, the composition of which includes qubits, circuits (timelines), and various quantum logic gates, and finally the results often need to be read out by quantum measurement operations.
Unlike conventional circuits, which are connected by metal lines to carry voltage or current signals, in a quantum circuit, the circuit can be seen as being connected by time, i.e., the state of the qubit naturally evolves over time, as indicated by the hamiltonian operator, during which it is operated until a logic gate is encountered.
One quantum program is corresponding to one total quantum circuit, and the quantum program refers to the total quantum circuit, wherein the total number of quantum bits in the total quantum circuit is the same as the total number of quantum bits of the quantum program. It can be understood that: one quantum program may consist of a quantum circuit, a measurement operation for the quantum bits in the quantum circuit, a register to hold the measurement results, and a control flow node (jump instruction), and one quantum circuit may contain several tens to hundreds or even thousands of quantum logic gate operations. The execution process of the quantum program is a process of executing all quantum logic gates according to a certain time sequence. Note that the timing is the time sequence in which a single quantum logic gate is executed.
It should be noted that in classical computation, the most basic unit is a bit, and the most basic control mode is a logic gate, and the purpose of the control circuit can be achieved by a combination of logic gates. Similarly, the way in which the qubits are handled is a quantum logic gate. Quantum logic gates are used, which are the basis for forming quantum circuits, and include single-bit quantum logic gates, such as Hadamard gates (H gates, ada Ma Men), bery-X gates (X gates), bery-Y gates (Y gates), bery-Z gates (Z gates), RX gates, RY gates, RZ gates, and the like; multi-bit quantum logic gates such as CNOT gates, CR gates, iSWAP gates, toffoli gates, and the like. Quantum logic gates are typically represented using unitary matrices, which are not only in matrix form, but also an operation and transformation. The effect of a general quantum logic gate on a quantum state is calculated by multiplying the unitary matrix by the matrix corresponding to the right vector of the quantum state. Assume that a quantum state right vector isThe corresponding quantum state left vector is/>Wherein c 1,c2,...,cn is a plurality,/>Representing the conjugation of c n. It can be seen that the right vector represents a1 x n column vector, the left vector represents an n x 1 row vector, and the two vectors are transposed conjugated to each other.
It will be appreciated by those skilled in the art that in classical computers, the basic unit of information is a bit, one bit having two states, 0 and 1, the most common physical implementation being to represent both states by the level of high and low. In quantum computing, the basic unit of information is a qubit, and one qubit also has two states of 0 and 1, denoted as |0> and |1>, but it can be in a superposition of the two states of 0 and 1, which can be expressed asWhere a, b are complex numbers representing states, state amplitudes (probability magnitudes), which are not possessed by classical bits. After measurement, the state of the qubit collapses to a certain state (eigenstate, here |0> state, |1> state), where the probability of collapsing to |0> is a 2, the probability of collapsing to |1> is b 2,a2+b2 = 1, | > is a dirac sign.
The quantum state space represented by the quantum bit refers to quantum state information represented by all eigenvalues corresponding to the quantum bit, and the number of all eigenvalues is the power of 2 of the quantum bit.
Quantum states, i.e., states of a qubit, whose eigenstates are represented in binary in a quantum algorithm (or weighing subroutine). For example, a group of qubits q0, q1, q2, representing the 0 th, 1 st, and 2 nd qubits, ordered from high to low as q2q1q0, has a quantum state of 2 3 eigenstates superimposed, and 8 eigenstates (defined states) refer to: each eigenstate corresponds to a qubit, i 000>, i001 >, i010 >, i011 >, i100 >, i101 >, i110 >, i111 >, e.g., 000> states, 000 corresponds to q2q1q0 from high to low. In short, a quantum state is an overlapped state composed of each eigenstate, and when the probability amplitude of the other states is 0, it is in one of the determined eigenstates.
For example, the trading element value is 2, and a set of qubits for the encoding element has 2 or more, e.g., 5 qubits, then its quantum state may be |00010>, where the lowest two bits are binary 10, representing the binary value of the trading element. The useful information is the least significant two-bit information, so the quantum state corresponding to the transaction element value can also be abbreviated as |2> = |10>.
Referring to fig. 2, fig. 2 is a flow chart of a method for querying a transaction element by using a quantum circuit according to an embodiment of the present invention, where the method may include:
s201: a transaction database is obtained that contains at least a transaction index and its corresponding transaction elements.
Specifically, transaction element information and transaction index information in a transaction database are acquired, wherein the transaction element information is subset elements contained in each transaction item set, and the transaction index is data position information corresponding to the subset elements, which is data of the transaction elements in the transaction database, wherein the data corresponding to the element position information is identified.
For example, for a transaction database, it is assumed that it contains a transaction set of N transactions, denoted T= { T 0,T1,…,TN-1 }, each transaction is made up of a subset of M item sets I= { I 0,I1,…,IM-1 }, each transaction is contained in M item sets, namelyThe transaction database may thus be represented as an NxM coding matrix, denoted D, wherein element D ij +.0 indicates that transaction T i contains items I j, otherwise element D ij =0.
Illustratively, for a transaction database, the set of entries contained therein is shown in Table 1 below:
Table 1: transaction information and item information table contained in transaction database
Transaction | Items |
T0 | Bread, cheese and milk |
T1 | Bread and butter |
T2 | Cheese and milk |
T3 | Bread and cheese |
T4 | Cheese, butter and milk |
Wherein, if the number 1 is used to represent "cheese"; numeral 2 represents "milk"; numeral 3 represents "bread"; numeral 4 represents "butter"; the number 0 represents no such term, and the information in table 1 above can be represented by the following matrix:
For the 5×4 matrix, a transaction index and corresponding transaction element values are obtained. To accommodate the binary nature of the computer, various serial numbers, labels, etc. all start counting at 0. Generally default is from row 0 and column 0, for example, the element value of row 0 and column 0 is 1, the element value of row 0 and column 1 is 2, the element value of row 0 and column 2 is 3, the element value of row 0 and column 3 is 0, and so on, to obtain the transaction index and the corresponding transaction element information table as shown in table 2:
Table 2: transaction index and corresponding transaction element information table thereof
S202: and constructing a first quantum circuit which is encoded with the transaction index, the transaction element and the binary value of the transaction element to be queried by utilizing a quantum logic gate and a quantum bit, wherein the first quantum circuit is used for querying the transaction index corresponding to the transaction element to be queried.
Specifically, using quantum logic gates and qubits, constructing a quantum circuit encoded with binary values of the transaction index, the transaction element, and the transaction element to be queried may include the steps of:
s2021: and obtaining a group of quantum bits according to the transaction index and the binary bit number of the transaction element.
Specifically, a pre-constructed transaction index relationship and a group of quantum bits representing quantum bits and a quantum state space represented by the quantum bits can be obtained through user input, and the number of the group of quantum bits can be set by a user according to actual requirements. Under the condition of sufficient computing resources, a large number of qubits can be set, and the requirements of the qubits under most conditions are satisfied unconditionally.
Illustratively, the trade index, as shown in Table 2, and its corresponding trade elements, may include a row index and a column index. It can be known that the transaction database contains 5 transaction data, each transaction data contains 4 transaction elements, and decimal identifications of the transaction elements are (1, 2,3 and 4), so that the number of qubits for coding the column index is at least 2, the number of qubits for coding the row index is at least 3, and the number of qubits for coding the transaction elements is at least 3.
S2022: coding a transaction index binary value and a transaction element binary value corresponding to each transaction information in the transaction database to a first quantum bit in sequence to construct a first sub-quantum circuit; wherein a binary bit corresponds to a first qubit.
For example, as shown in the transaction index and the corresponding transaction element in table 2, it can be known that the transaction index binary value and the transaction element binary value corresponding to each transaction information are encoded onto the qubit, and a first sub-quantum circuit is constructed, so as to obtain a schematic diagram of the first sub-quantum circuit in the embodiment shown in fig. 3, where the open circle represents binary digit 0, the solid black circle represents binary digit 1, the connection represents a controlled state, V1 represents a combination of a series of quantum logic gates such as X gates, etc. for implementing the transaction element binary value 001 encoding with the transaction index of 0 row and 0 column, and when the quantum state is |00000>, the operation of the quantum logic gate is performed by V1, otherwise, the operation is not performed; similarly, the coding principles and methods of V2 to V20 are the same as V1, and will not be described again. In the figure, only the transaction index binary values and the transaction element binary value coding states of the 0 th row and the 4 th row of the transaction database information shown in table 2 are shown, and the method and the principle of the transaction index binary values and the transaction element binary value coding states of the 1 st row, the 2 nd row and the 3 rd row are the same as those of the 0 th row and the 4 th row, and are directly omitted in fig. 3 and are not shown.
In the real quantum circuit, binary encoding of the above elements may be performed in the form of an inserted quantum logic gate, for example, if binary digit 0 (a circle shown as open space) is to be encoded on the quantum circuit, no operation is performed on the qubit; for binary digits 1 (black circles shown in solid form) to be encoded on a quantum circuit, a brix-gate needs to be inserted over the qubit, representing the transition of the quantum state over the qubit from an initial 0 state to a1 state; if the encoding needs to be continued, a British-X gate is inserted into the qubit again, namely, the quantum state on the qubit is restored from 1 state to initial 0 state. Whatever method or quantum logic gate is used to encode the binary value of the transaction index and the binary value of the transaction element corresponding to each transaction information in the transaction database onto the qubit, the invention is covered in the scope of protection.
S2023: encoding the binary value of the transaction element to be queried onto a quantum bit corresponding to the transaction element, and adding a preset quantum logic gate into the second quantum bit to construct a second sub-quantum circuit; wherein the preset quantum logic gate comprises a brix-gate.
Specifically, fig. 4 is a schematic diagram of the second sub-quantum circuit in this embodiment. Optionally, in order to vividly show the binary coding process of the transaction index and the transaction element, the open circles represent binary digits 0, the solid black circles represent binary digits 1, the connection between the circles represents controlled, one open circle and one solid black circle connected by the brix-gate represent the transaction element to be queried as binary digits 01. It should be noted that, the binary coding schematic diagram of the transaction element to be queried shown in fig. 4 is only an example, and the actual binary coding quantum state needs to be determined according to the binary values of different transaction elements to be queried.
S2024: and adding a controlled U1 quantum logic gate to the second quantum bit to construct a third sub-quantum circuit.
Specifically, fig. 5 is a schematic diagram of the third sub-quantum circuit according to the present embodiment. The addition of solid black circles on the second qubit is connected with the quantum logic gate U1 gate, representing a controlled U1 gate, wherein the U1 gate is in the form of a matrixAnd determining θ according to the line requirement by a user, for example, θ=pi, so as to obtain a third sub-quantum line.
S2025: and sequentially adding a transposed conjugation operation corresponding to the second sub-quantum circuit and a transposed conjugation operation corresponding to the first sub-quantum circuit to construct a fourth sub-quantum circuit.
Specifically, fig. 6 is a schematic diagram of a fourth sub-quantum circuit according to the present embodiment, where,A hollow circle and a solid black circle representing the transposed conjugate of the bery-X gate, and likewise, the transposed conjugate of the bery-X gate, representing the transaction element to be queried as a binary value 01, is only an example, corresponding to the schematic diagram of the second sub-quantum circuit; /(I)Representing the transposed conjugate of the first sub-quantum wire.
S2026: and sequentially forming the first sub-quantum circuit, the second sub-quantum circuit, the third sub-quantum circuit and the fourth sub-quantum circuit into quantum circuits with binary values of the transaction index, the transaction element and the transaction element to be queried according to a preset quantum bit corresponding relation among the sub-quantum circuits.
Specifically, according to a preset quantum bit corresponding relation among sub-quantum circuits, the quantum circuits encoded with the transaction index, the transaction element and the binary value of the transaction element to be queried are sequentially formed, wherein the quantum bit corresponding relation is that the quantum bit of the first sub-quantum circuit corresponds to the quantum bit of the transposed conjugate of the first sub-quantum circuit, and the quantum bit of the second sub-quantum circuit corresponds to the quantum bit of the transposed conjugate of the second sub-quantum circuit, so as to obtain a schematic diagram of the first quantum circuit in the embodiment shown in fig. 7.
Note that Vi represents a series of quantum logic gates for realizing binary encoding of each transaction element, i represents a number, and the encoding principle is the same as that of the transaction index.
After the first quantum circuit with the binary values of the transaction index, the transaction element and the transaction element to be queried is constructed, the first quantum circuit can be added to a first preset quantum bit position in the first preset quantum circuit according to a first preset time sequence to obtain a second quantum circuit at least used for amplitude updating, a plurality of second quantum circuits are sequentially added to a second preset quantum bit position in the second preset quantum circuit according to a second preset time sequence to obtain a third quantum circuit at least used for repeatedly updating the amplitude.
Specifically, fig. 8 is a schematic diagram of a first preset quantum circuit in this embodiment, which includes a plurality of qubits, hadamard gates, controlled U1 gates, and SWAP quantum logic gates. Wherein,Indicating that a Hadamard gate acts on n quantum bits, and connecting a hollow circle with a U1 gate indicates that when the quantum state is |0000>, the U1 gate operation is executed, otherwise, the operation is not acted; and exchanging the corresponding quantum states in the quantum bit space acted by the SWAP gate.
As shown in fig. 9, which is a schematic diagram of a second quantum circuit in this embodiment, a brix gate, a Hadamard gate, and a first quantum circuit (Oracle circuit) are sequentially added to a first preset qubit position (the lower half of the qubits shown in fig. 9) in the first preset quantum circuit according to a first preset time sequence to obtain a second quantum circuit (G (k) circuit) for amplitude update, where the SWAP gate is used to implement index transfer of search results of query transaction elements; the second quantum circuit obtains an output result after amplitude updating, so that the index probability of the search result can be improved, the distinguishing degree of the probability is improved, and the query accuracy of the transaction element is more accurately output, so that the whole second quantum circuit (G (k) circuit) can be used as a process for querying the transaction element once.
Specifically, according to a second preset time sequence, the Brix-X gate and the Hadamard gate (in the circuitIndicating the application of Hadamard gates to n qubits), t second quantum wires (G (k) wires) to second preset qubit positions in the second preset quantum wires, a schematic diagram of a third quantum wire of the present embodiment as shown in fig. 10 is obtained. The n qubits in the upper half of the graph are used for storing search results, and t is the iteration number of the G (k) line, which can be determined by a user in advance according to iteration requirements.
It should be noted that, the number of qubits in the above schematic diagrams is only schematic, and does not truly show the corresponding relationship of the qubits in the present application, and in a specific practical application, the query method to be protected in the present application needs to be completed according to the preset corresponding relationship of the qubits between each quantum circuit or sub-quantum circuits.
S203: and operating the first quantum circuit, outputting a quantum state containing binary values of each transaction index and corresponding first amplitudes thereof, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each first amplitude.
Specifically, the first quantum circuit can be regarded as an Oracle quantum circuit, in quantum application, a specific function can be completed by operating the Oracle quantum circuit, and the internal principle of the Oracle quantum circuit is the coding method flow of the invention, so that a specific implementation mode can be provided in specific problems.
The complex function of the mutual conversion between quantum states corresponding to the transaction index and the specific representation of the transaction element in the transaction database is realized by using an Oracle line simulation mode, so that the quantum parallel calculation is realized.
And running the first quantum circuit to obtain a quantum state containing binary values of each transaction index and corresponding first amplitudes thereof, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each first amplitude.
Specifically, after the first quantum circuit is operated, a quantum state containing binary values of each transaction index and a first amplitude corresponding to the quantum state can be obtained, probabilities corresponding to the first amplitudes are calculated, and the transaction index value contained in the quantum state corresponding to the maximum probability in the probabilities is determined as a transaction index result corresponding to the transaction element to be queried.
For example, with the transaction database information shown in table 2, if the binary value of the transaction element to be queried encoded by the second sub-quantum circuit is 100, the first quantum circuit is operated, the quantum state containing the binary value of each transaction index and the corresponding first amplitude thereof are output, for convenience of explanation, the square value (i.e. probability value) of the first amplitude corresponding to each quantum state is directly calculated, and each probability value only retains 5 bits after the decimal point, and the following result can be obtained:
S*=0.0031|00000>+0.0031|00001>+0.0031|00010>+0.0031|00011>+0.0031|00100>+0.0031|00101>+0.0031|00110>+0.4542|00111>+0.0031|01000>+0.0031|01001>+0.0031|01010>+0.0031|01011>+0.0031|01100>+0.0031|01101>-0.0031|01110>+0.0031|01111>+0.0031|10000>+0.0031|10001>+0.0031|10010>+0.4542|10011>+0.0031|10100>+0.0031|10101>+0.0031|10110>+0.0031|10111>+0.0031|11000>+0.0031|11001>+0.0031|11010>+0.0031|11011>+0.0031|11100>+0.0031|11101>+0.0031|11110>+0.0031|11111>
from the above results, it can be seen that the maximum probability value is 0.4542, and the quantum states corresponding to the maximum probability value are |00111> and |10011>, respectively, that is, the transaction index of the binary element to be queried 100. For example, |00111> represents row 1, column 3, queriable binary element to be queried 100; the row and column 4 and 3 are represented by i 10011, where the binary element to be queried 100 is queriable.
And operating the second quantum circuit, outputting a quantum state containing binary values of each transaction index and a second amplitude corresponding to the quantum state, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each second amplitude, wherein the second amplitude is an amplitude obtained by updating the first amplitude once.
Specifically, the probability corresponding to the first amplitude is not easy to be directly measured, so that the quantum state containing the binary value of each transaction index and the corresponding second amplitude are required to be output by operating the second quantum circuit, and compared with the first amplitude, the probability of the transaction index result transition and the probability of the transaction index result improvement are realized by the second amplitude.
In this case, if the second amplitude value is iterated several times, the measured accuracy is higher and the result is more accurate. Thus, the following steps are performed:
And operating a second combined quantum circuit, outputting a quantum state containing binary values of each transaction index and a third amplitude corresponding to the quantum state, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each third amplitude, wherein the third amplitude is an amplitude obtained by repeatedly updating the first amplitude.
Specifically, the second combination quantum circuit is obtained by combining a plurality of second quantum circuits and a preset quantum logic gate according to a preset time sequence, wherein the number of the second quantum circuits in the second combination quantum circuit can be determined according to the number of quantum bits of the coded transaction index, and probability distribution of transaction index data can be obtained through a certain number of cyclic iterations, wherein the probability is the maximum, namely the result index of the queried element to be queried. In practical applications, the number of second quantum wires is preferably 3, 5 or 7.
According to the method, the frequent item set of the association rule mining can be obtained through quantum and classical mixed calculation, and through the method and the test and verification of some data, the method can realize the statistics of the frequent item set of the association rule mining and the calculation of the subsequent confidence coefficient. The core idea of the quantum circuit part of the method adopts a quantum walking search mode, and a transaction index coding mode is carried out on the basis of the quantum walking search mode to adapt to the problem of association rules. And counting the index of the search result corresponding to each candidate item set by utilizing the quantum circuit part, then obtaining a frequent item set, and then popularizing the method to iterate the frequent n item sets to obtain all the frequent item sets and give a result.
Compared with the prior art, the method for inquiring the transaction element by utilizing the quantum circuit provided by the invention has the advantages that firstly, the transaction database at least comprising the transaction index and the transaction element corresponding to the transaction index is obtained, then, the quantum logic gate and the quantum bit are utilized to construct the first quantum circuit which is encoded with the transaction index, the transaction element and the binary value of the transaction element to be inquired, the first quantum circuit is operated, the quantum state comprising the binary value of each transaction index and the first amplitude corresponding to the binary value are output, and the transaction index result corresponding to the transaction element to be inquired is determined according to the probability corresponding to each first amplitude, so that the quantum circuit is designed in the quantum computing field, the defect of low efficiency of inquiring the transaction element in the prior art is solved by utilizing the parallel characteristic of the quantum algorithm, and the efficiency of inquiring the transaction element is further improved.
Referring to fig. 11, fig. 11 is a schematic structural diagram of an apparatus for querying a transaction element by using a quantum circuit according to an embodiment of the present invention, corresponding to the flow shown in fig. 2, the apparatus may include:
an obtaining module 1101, configured to obtain a transaction database at least including a transaction index and a transaction element corresponding to the transaction index;
A construction module 1102, configured to construct a first quantum circuit encoded with the transaction index, the transaction element, and a binary value of the transaction element to be queried using a quantum logic gate and a quantum bit, where the first quantum circuit is configured to query the transaction index corresponding to the transaction element to be queried;
The output module 1103 is configured to operate the first quantum circuit, output a quantum state including binary values of the transaction indexes and a first amplitude corresponding to the quantum state, and determine a transaction index result corresponding to the transaction element to be queried according to a probability corresponding to the first amplitude.
Specifically, after the building module, the apparatus further includes:
The first adding module is used for adding the first quantum circuit to a first preset quantum bit position in the first preset quantum circuit according to a first preset time sequence to obtain a second quantum circuit at least used for amplitude updating;
Specifically, the output module includes:
The first output unit is used for operating the second quantum circuit, outputting a quantum state containing binary values of each transaction index and corresponding second amplitude, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each second amplitude, wherein the second amplitude is an amplitude obtained by updating the first amplitude once.
Specifically, after the first adding module, the apparatus further includes:
the second adding module is used for sequentially adding a plurality of second quantum circuits to second preset quantum bit positions in the second preset quantum circuits according to a second preset time sequence to obtain a third quantum circuit at least used for repeatedly updating the amplitude;
specifically, the first output unit includes:
The second output unit is used for operating a second combined quantum circuit, outputting a quantum state containing binary values of each transaction index and a third amplitude corresponding to the quantum state, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each third amplitude, wherein the third amplitude is an amplitude obtained by repeatedly updating the first amplitude.
Compared with the prior art, the method for inquiring the transaction element by utilizing the quantum circuit provided by the invention has the advantages that firstly, the transaction database at least comprising the transaction index and the transaction element corresponding to the transaction index is obtained, then, the quantum logic gate and the quantum bit are utilized to construct the first quantum circuit which is encoded with the transaction index, the transaction element and the binary value of the transaction element to be inquired, the first quantum circuit is operated, the quantum state comprising the binary value of each transaction index and the first amplitude corresponding to the binary value are output, and the transaction index result corresponding to the transaction element to be inquired is determined according to the probability corresponding to each first amplitude, so that the quantum circuit is designed in the quantum computing field, the defect of low efficiency of inquiring the transaction element in the prior art is solved by utilizing the parallel characteristic of the quantum algorithm, and the efficiency of inquiring the transaction element is further improved.
The embodiment of the invention also provides a storage medium in which a computer program is stored, wherein the computer program is arranged to perform the steps of the method embodiment of any of the above when run.
Specifically, in the present embodiment, the above-described storage medium may be configured to store a computer program for executing the steps of:
S201: acquiring a transaction database at least comprising transaction indexes and corresponding transaction elements thereof;
S202: constructing a first quantum circuit with binary values of the transaction index, the transaction element and the transaction element to be queried by utilizing a quantum logic gate and a quantum bit, wherein the first quantum circuit is used for querying the transaction index corresponding to the transaction element to be queried;
S203: and operating the first quantum circuit, outputting a quantum state containing binary values of each transaction index and corresponding first amplitudes thereof, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each first amplitude.
Specifically, in the present embodiment, the storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
Compared with the prior art, the method for inquiring the transaction element by utilizing the quantum circuit provided by the invention has the advantages that firstly, the transaction database at least comprising the transaction index and the transaction element corresponding to the transaction index is obtained, then, the quantum logic gate and the quantum bit are utilized to construct the first quantum circuit which is encoded with the transaction index, the transaction element and the binary value of the transaction element to be inquired, the first quantum circuit is operated, the quantum state comprising the binary value of each transaction index and the first amplitude corresponding to the binary value are output, and the transaction index result corresponding to the transaction element to be inquired is determined according to the probability corresponding to each first amplitude, so that the quantum circuit is designed in the quantum computing field, the defect of low efficiency of inquiring the transaction element in the prior art is solved by utilizing the parallel characteristic of the quantum algorithm, and the efficiency of inquiring the transaction element is further improved.
An embodiment of the invention also provides an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of the method embodiment of any of the above.
Specifically, the electronic apparatus may further include a transmission device and an input/output device, where the transmission device is connected to the processor, and the input/output device is connected to the processor.
Specifically, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
S201: acquiring a transaction database at least comprising transaction indexes and corresponding transaction elements thereof;
S202: constructing a first quantum circuit with binary values of the transaction index, the transaction element and the transaction element to be queried by utilizing a quantum logic gate and a quantum bit, wherein the first quantum circuit is used for querying the transaction index corresponding to the transaction element to be queried;
S203: and operating the first quantum circuit, outputting a quantum state containing binary values of each transaction index and corresponding first amplitudes thereof, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each first amplitude.
Compared with the prior art, the method for inquiring the transaction element by utilizing the quantum circuit provided by the invention has the advantages that firstly, the transaction database at least comprising the transaction index and the transaction element corresponding to the transaction index is obtained, then, the quantum logic gate and the quantum bit are utilized to construct the first quantum circuit which is encoded with the transaction index, the transaction element and the binary value of the transaction element to be inquired, the first quantum circuit is operated, the quantum state comprising the binary value of each transaction index and the first amplitude corresponding to the binary value are output, and the transaction index result corresponding to the transaction element to be inquired is determined according to the probability corresponding to each first amplitude, so that the quantum circuit is designed in the quantum computing field, the defect of low efficiency of inquiring the transaction element in the prior art is solved by utilizing the parallel characteristic of the quantum algorithm, and the efficiency of inquiring the transaction element is further improved.
While the foregoing is directed to embodiments of the present invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof, and the scope thereof is determined by the claims that follow.
Claims (10)
1. A method for querying a transaction element using a quantum wire, the method comprising:
acquiring a transaction database at least comprising transaction indexes and corresponding transaction elements thereof;
Constructing a first quantum circuit which is encoded with the transaction index, the transaction element and binary values of the transaction element to be queried by utilizing a quantum logic gate and a quantum bit, wherein the first quantum circuit is used for querying the transaction index corresponding to the transaction element to be queried, and the quantum logic gate at least comprises a Brix-X gate and a controlled U1 quantum logic gate;
And operating the first quantum circuit, outputting a quantum state containing binary values of each transaction index and corresponding first amplitudes thereof, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each first amplitude.
2. The method of claim 1, wherein after constructing the first quantum wire encoded with the binary values of the transaction index, the transaction element, and the transaction element to be queried, the method further comprises:
Adding the first quantum circuit to a first preset quantum bit position in the first preset quantum circuit according to a first preset time sequence to obtain a second quantum circuit at least used for amplitude updating;
The operation of the first quantum circuit, outputting a quantum state containing binary values of each transaction index and corresponding first amplitudes thereof, and determining a transaction index result corresponding to the transaction element to be queried according to the probability size corresponding to each first amplitude, including:
And operating a second quantum circuit, outputting a quantum state containing binary values of each transaction index and a second amplitude corresponding to the quantum state, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each second amplitude, wherein the second amplitude is an amplitude obtained by updating the first amplitude once.
3. The method of claim 2, wherein after adding the first quantum wire to a first predetermined qubit position in the first predetermined quantum wire according to a first predetermined timing, the method further comprises, after obtaining a second quantum wire for at least amplitude updating:
sequentially adding a plurality of second quantum circuits to second preset quantum bit positions in the second preset quantum circuits according to a second preset time sequence to obtain a third quantum circuit at least used for repeatedly updating amplitude;
The operation of the second quantum circuit, outputting a quantum state containing binary values of each transaction index and a corresponding second amplitude thereof, and determining a transaction index result corresponding to the transaction element to be queried according to the probability size corresponding to each second amplitude, including:
And operating a second combined quantum circuit, outputting a quantum state containing binary values of each transaction index and a third amplitude corresponding to the quantum state, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each third amplitude, wherein the third amplitude is an amplitude obtained by repeatedly updating the first amplitude.
4. The method of claim 1, wherein constructing a quantum wire encoded with binary values of the transaction index, the transaction element, and the transaction element to be queried using quantum logic gates and qubits, comprises:
acquiring a group of quantum bits according to the transaction index and the binary bit number of the transaction element;
Coding a transaction index binary value and a transaction element binary value corresponding to each transaction information in the transaction database to a first quantum bit in sequence to construct a first sub-quantum circuit; wherein a binary bit corresponds to the first qubit;
Encoding the binary value of the transaction element to be queried onto a quantum bit corresponding to the transaction element, and adding a preset quantum logic gate into a second quantum bit to construct a second sub-quantum circuit; wherein the preset quantum logic gate comprises a brix-gate;
Adding a controlled U1 quantum logic gate to the second quantum bit to construct a third sub-quantum circuit;
Sequentially adding a transposed conjugation operation corresponding to the second sub-quantum circuit and a transposed conjugation operation corresponding to the first sub-quantum circuit to construct a fourth sub-quantum circuit;
and sequentially forming the first sub-quantum circuit, the second sub-quantum circuit, the third sub-quantum circuit and the fourth sub-quantum circuit into quantum circuits with binary values of the transaction index, the transaction element and the transaction element to be queried according to a preset quantum bit corresponding relation among the sub-quantum circuits.
5. The method according to claim 1, wherein determining the transaction index result corresponding to the transaction element to be queried according to the probability magnitude corresponding to each first amplitude comprises:
and calculating the probability corresponding to each first amplitude, and determining the transaction index value contained in the quantum state corresponding to the maximum probability in each probability as a transaction index result corresponding to the transaction element to be queried.
6. An apparatus for querying a transaction element using a quantum wire, the apparatus comprising:
The acquisition module is used for acquiring a transaction database at least comprising transaction indexes and corresponding transaction elements;
The construction module is used for constructing a first quantum circuit which is encoded with the transaction index, the transaction element and the binary value of the transaction element to be queried by utilizing a quantum logic gate and a quantum bit, wherein the first quantum circuit is used for querying the transaction index corresponding to the transaction element to be queried, and the quantum logic gate at least comprises a Brix-X gate and a controlled U1 quantum logic gate;
The output module is used for operating the first quantum circuit, outputting a quantum state containing binary values of each transaction index and corresponding first amplitude, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each first amplitude.
7. The apparatus of claim 6, wherein after the building module, the apparatus further comprises:
The first adding module is used for adding the first quantum circuit to a first preset quantum bit position in the first preset quantum circuit according to a first preset time sequence to obtain a second quantum circuit at least used for amplitude updating;
The output module includes:
The first output unit is used for operating the second quantum circuit, outputting a quantum state containing binary values of each transaction index and corresponding second amplitude, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each second amplitude, wherein the second amplitude is an amplitude obtained by updating the first amplitude once.
8. The apparatus of claim 7, wherein after the first adding module, the apparatus further comprises:
the second adding module is used for sequentially adding a plurality of second quantum circuits to second preset quantum bit positions in the second preset quantum circuits according to a second preset time sequence to obtain a third quantum circuit at least used for repeatedly updating the amplitude;
the first output unit includes:
The second output unit is used for operating a second combined quantum circuit, outputting a quantum state containing binary values of each transaction index and a third amplitude corresponding to the quantum state, and determining a transaction index result corresponding to the transaction element to be queried according to the probability corresponding to each third amplitude, wherein the third amplitude is an amplitude obtained by repeatedly updating the first amplitude.
9. A storage medium having a computer program stored therein, wherein the computer program is arranged to perform the method of any of claims 1 to 5 when run.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the method of any of the claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010897672.2A CN112000673B (en) | 2020-08-31 | 2020-08-31 | Method and device for inquiring transaction elements by quantum circuit |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010897672.2A CN112000673B (en) | 2020-08-31 | 2020-08-31 | Method and device for inquiring transaction elements by quantum circuit |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112000673A CN112000673A (en) | 2020-11-27 |
CN112000673B true CN112000673B (en) | 2024-06-14 |
Family
ID=73464874
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010897672.2A Active CN112000673B (en) | 2020-08-31 | 2020-08-31 | Method and device for inquiring transaction elements by quantum circuit |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112000673B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115907016B (en) * | 2021-09-30 | 2024-06-14 | 本源量子计算科技(合肥)股份有限公司 | Quantum-based method for calculating search target range value and related device |
Family Cites Families (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100057622A1 (en) * | 2001-02-27 | 2010-03-04 | Faith Patrick L | Distributed Quantum Encrypted Pattern Generation And Scoring |
EP1400053A2 (en) * | 2001-02-27 | 2004-03-24 | Visa International Service Association | Distributed quantum encrypted pattern generation and scoring |
US8126830B2 (en) * | 2007-07-03 | 2012-02-28 | Seth Lloyd | Method for ensuring privacy while querying a database by using quantum superposition and multiple responses |
US8150835B2 (en) * | 2009-09-23 | 2012-04-03 | Nokia Corporation | Method and apparatus for creating and utilizing information signatures |
KR102085412B1 (en) * | 2015-03-24 | 2020-03-05 | 킨디 인코포레이티드 | Cognitive Memory Graph Indexing, Storage, and Retrieval Techniques |
US10726353B2 (en) * | 2015-08-03 | 2020-07-28 | Nxgen Partners Ip, Llc | Quantum mechanical framework for interaction of OAM with matter and applications in solid states, biosciences and quantum computing |
US10891555B2 (en) * | 2018-08-07 | 2021-01-12 | Nxgen Partners Ip, Llc | Universal quantum computer, communication, QKD security and quantum networks using OAM Qu-dits with digital light processing |
CN111902828A (en) * | 2018-04-20 | 2020-11-06 | 谷歌有限责任公司 | Performing a positive iteration and index operation |
KR102100368B1 (en) * | 2018-05-17 | 2020-04-14 | 한국과학기술원 | Effective quantum RAM architecture for quantum database |
EP4310737A3 (en) * | 2018-07-06 | 2024-05-01 | Google LLC | Preparing superpositions of computational basis states on a quantum computer |
US10469087B1 (en) * | 2018-10-08 | 2019-11-05 | Microsoft Technology Licensing, Llc | Bayesian tuning for quantum logic gates |
US10708046B1 (en) * | 2018-11-08 | 2020-07-07 | Nxgen Partners Ip, Llc | Quantum resistant blockchain with multi-dimensional quantum key distribution |
-
2020
- 2020-08-31 CN CN202010897672.2A patent/CN112000673B/en active Active
Non-Patent Citations (2)
Title |
---|
区块链技术在电力系统中的应用:前景与思路;王胜寒;郭创新;冯斌;张浩;杜振东;;电力系统自动化(11);全文 * |
量子计算与量子通信浅说(下);史一蓬;;数学建模及其应用(03);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN112000673A (en) | 2020-11-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Halvorsen et al. | Opportunities for improved distribution modelling practice via a strict maximum likelihood interpretation of MaxEnt | |
CN112073126B (en) | Method and device for ordering network node importance | |
CN112068798B (en) | Method and device for realizing importance ordering of network nodes | |
CN114418105B (en) | Method and device for processing quantum application problem based on quantum circuit | |
CN111563599A (en) | Quantum line decomposition method and device, storage medium and electronic device | |
CN116011682B (en) | Meteorological data prediction method and device, storage medium and electronic device | |
CN112000673B (en) | Method and device for inquiring transaction elements by quantum circuit | |
CN114519429B (en) | Method, device and medium for obtaining observability quantity of target system | |
CN112132614B (en) | Method and device for preference prediction demonstration by quantum circuit | |
CN113222153A (en) | Quantum state simulation method and device, storage medium and electronic device | |
CN116431807B (en) | Text classification method and device, storage medium and electronic device | |
CN116415958B (en) | Abnormal data detection method and device based on quantum technology and storage medium | |
CN116011681A (en) | Meteorological data prediction method and device, storage medium and electronic device | |
CN114418104B (en) | Quantum application problem processing method and device | |
CN117151231A (en) | Method, device and medium for solving linear system by using variable component sub-line | |
CN115907016B (en) | Quantum-based method for calculating search target range value and related device | |
CN116306952B (en) | Molecular property prediction method and device, storage medium and electronic device | |
CN115438791B (en) | Method and device for solving Bayesian network based on quantum circuit | |
CN115713122B (en) | Method and device for determining size relation between quantum data and classical data | |
CN115879558B (en) | Method and device for comparing sizes of multiple quantum states | |
CN116400430B (en) | Meteorological data prediction method and device, storage medium and electronic device | |
CN115879559B (en) | Method and device for judging equivalence relation among multiple quantum states and quantum computer | |
CN114819169B (en) | Quantum estimation method and device for matrix condition number | |
CN117035105A (en) | Data prediction method and related equipment | |
CN115374945B (en) | System state judging method and device based on quantum Bayesian network |
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 |