[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN116136968A - Quantum circuit optimization method of Grover algorithm and related device - Google Patents

Quantum circuit optimization method of Grover algorithm and related device Download PDF

Info

Publication number
CN116136968A
CN116136968A CN202111356549.0A CN202111356549A CN116136968A CN 116136968 A CN116136968 A CN 116136968A CN 202111356549 A CN202111356549 A CN 202111356549A CN 116136968 A CN116136968 A CN 116136968A
Authority
CN
China
Prior art keywords
quantum state
gate
target
target quantum
quantum
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
Application number
CN202111356549.0A
Other languages
Chinese (zh)
Other versions
CN116136968B (en
Inventor
窦猛汉
王梦醒
王晶
方圆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Origin Quantum Computing Technology Co Ltd
Original Assignee
Origin Quantum Computing Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Origin Quantum Computing Technology Co Ltd filed Critical Origin Quantum Computing Technology Co Ltd
Priority to CN202111356549.0A priority Critical patent/CN116136968B/en
Publication of CN116136968A publication Critical patent/CN116136968A/en
Application granted granted Critical
Publication of CN116136968B publication Critical patent/CN116136968B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N10/00Quantum computing, i.e. information processing based on quantum-mechanical phenomena

Landscapes

  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Condensed Matter Physics & Semiconductors (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Optical Modulation, Optical Deflection, Nonlinear Optics, Optical Demodulation, Optical Logic Elements (AREA)

Abstract

The embodiment of the application provides a quantum circuit optimization method of a Grover algorithm and a related device, and relates to the technical field of quantum information science. The method comprises the steps of processing initialized quantum bits by utilizing a quantum input circuit to obtain first quantum states and first amplitudes corresponding to the first quantum states; processing the target quantum state by using a phase inversion circuit to obtain a target quantum state after phase inversion; the phase inversion circuit comprises a first control gate inserted into any one of the qubits, wherein the first control gate is used for inverting the phase of a first target quantum state processed by the first X gate; processing the target quantum state after phase inversion by using an amplitude amplification circuit to obtain a second amplitude corresponding to the target quantum state; and the second amplitude is greater than the first amplitude. By the method, an additional quantum bit line is not required to be additionally arranged in the quantum line, so that quantum resources are saved.

Description

Quantum circuit optimization method of Grover algorithm and related device
Technical Field
The application relates to the technical field of quantum information science, in particular to a quantum circuit optimization method of a Grover algorithm and a related device.
Background
The Grover algorithm can be used for solving the problem of unordered database searching, and when the Grover algorithm is used for searching unordered quantum states, the phase of the target quantum state needs to be overturned so as to mark the target quantum state.
At present, the phase inversion of the target quantum state is usually realized through a control X gate acting on the additional quantum bit line, but the mode can increase the use of the additional quantum bit line, and waste of quantum resources is caused.
Disclosure of Invention
In view of the foregoing, an object of the present application is to provide a quantum circuit optimization method and related apparatus for a Grover algorithm, so as to reduce the use of additional quantum bit circuits and save quantum resources.
In order to achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
in a first aspect, the present application provides a quantum circuit optimization method of a Grover algorithm, the method comprising:
processing the initialized quantum bit by utilizing a quantum input line to obtain a first quantum state after quantum superposition and a first amplitude corresponding to each first quantum state; wherein the first quantum state includes a target quantum state and other quantum states;
processing the target quantum state by using a phase inversion circuit to obtain a target quantum state after phase inversion; the phase inversion circuit comprises a first control gate inserted into any qubit, wherein the first control gate is used for inverting the phase of a first target quantum state processed by a first X gate;
Processing the target quantum state after phase inversion by using an amplitude amplification circuit to obtain a second amplitude corresponding to the target quantum state; wherein the second amplitude is greater than the first amplitude.
In an alternative embodiment, the step of processing the target quantum state by using a phase inversion circuit to obtain a phase-inverted target quantum state includes:
determining a target quantum bit with a value of 0 according to the state of the target quantum state;
processing the target qubit by using the first X gate, and obtaining the first target quantum state according to the target quantum state;
processing all the qubits by using the first control gate, and obtaining a second target quantum state according to the first target quantum state;
and processing the target quantum bit by using a second X gate, and obtaining a target quantum state with the inverted phase according to the second target quantum state.
In an alternative embodiment, when the first control gate is a combination of a first H gate, a first control X gate, and a second H gate, the step of processing all qubits with the first control gate to obtain a second target quantum state according to the first target quantum state includes:
And processing all the qubits by using the first H gate, the first control X gate and the second H gate in sequence, and obtaining the second target quantum state according to the first target quantum state.
In an optional embodiment, the step of processing the phase flipped target quantum state by using an amplitude amplifying circuit to obtain a second amplitude corresponding to the target quantum state includes:
processing all the qubits of the target quantum state after phase inversion by using a third H gate to obtain a third target quantum state;
all the qubits of the third target quantum state are processed by using a third X gate, a second control gate and a fourth X gate in sequence, so that a third target quantum state with a reversed phase is obtained;
and processing all the qubits of the third target quantum state after the phase inversion by using a fourth H gate to obtain a second amplitude corresponding to the target quantum state.
In an optional embodiment, when the second control gate is a combination of a fifth H gate, a second control X gate, and a sixth H gate, the step of sequentially processing the third target quantum state with a third X gate, a second control gate, and a fourth X gate to obtain a third target quantum state after phase inversion includes:
Processing all qubits of the third target quantum state by using the third X gate to obtain a fourth target quantum state;
sequentially processing all the qubits of the fourth target quantum state by using the fifth H gate, the second control X gate and the sixth H gate to obtain a fourth target quantum state with a reversed phase;
and processing all the qubits of the fourth target quantum state after phase inversion by using the fourth X gate to obtain a third target quantum state after phase inversion.
In an alternative embodiment, before the step of processing the quantum bit by using the quantum input circuit to obtain the first quantum state after quantum superposition and the first amplitude corresponding to each first quantum state, the method further includes:
and determining the quantum gate type in the quantum input circuit according to the state of the first quantum state.
In a second aspect, the present application provides a quantum wire optimization device for a Grover algorithm, the device comprising:
the quantum input module is used for processing the quantum bit to obtain a first quantum state after quantum superposition and a first amplitude corresponding to each first quantum state; wherein the first quantum state includes a target quantum state and other quantum states;
The phase overturning module is used for processing the target quantum state to obtain a target quantum state after phase overturning; the phase inversion circuit comprises a first control gate inserted into any qubit, wherein the first control gate is used for inverting the phase of a first target quantum state processed by a first X gate;
the amplitude amplifying module is used for processing the target quantum state after the phase inversion to obtain a second amplitude corresponding to the target quantum state; wherein the second amplitude is greater than the first amplitude.
In an alternative embodiment, the phase inversion module is further configured to determine a target qubit with a value of 0 according to the state of the target qustate;
processing the target quantum bit by using the first X gate to obtain a first target quantum state;
processing all the qubits by using the first control gate to obtain a second target quantum state;
and processing the target quantum bit by using a second X gate to obtain a target quantum state after phase inversion.
In a third aspect, the present application provides an electronic device comprising a processor and a memory storing a computer program executable by the processor, the processor being executable to implement the method of any of the preceding embodiments.
In a fourth aspect, the present application provides a computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, implements a method according to any of the preceding embodiments.
According to the quantum circuit optimization method and the quantum circuit optimization device for the Grover algorithm, when the target quantum state is processed through the phase inversion circuit, the first target quantum state processed through the first X gate is processed through the first control gate inserted into any quantum bit, so that the phase of the first target quantum state is inverted, and finally the phase inversion of the target quantum state is realized, and therefore the phase of the target quantum state is inverted without adding an additional quantum bit circuit in the quantum circuit, and quantum resources are saved.
In order to make the above objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting the scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1A-1C show a schematic diagram of the Grover algorithm.
Fig. 2 shows a Grover algorithm circuit employing an additional qubit circuit.
Fig. 3 shows a schematic flow chart of a quantum circuit optimization method of the Grover algorithm according to an embodiment of the present application.
Fig. 4 shows another flow chart of a quantum circuit optimization method of the Grover algorithm according to an embodiment of the present application.
Fig. 5 shows a schematic flow chart of a quantum circuit optimization method of the Grover algorithm according to an embodiment of the present application.
Fig. 6 shows a further flow diagram of a quantum circuit optimization method of the Grover algorithm according to an embodiment of the present application.
Fig. 7 shows the quantum circuit after optimization of the Grover algorithm.
Fig. 8 shows a further flow diagram of a quantum circuit optimization method of the Grover algorithm according to an embodiment of the present application.
Fig. 9A-9C show quantum circuit diagrams for simultaneous searching of multiple target quantum states using the Grover algorithm.
Fig. 10 shows a functional block diagram of a quantum circuit optimizing device of the Grover algorithm according to an embodiment of the present application.
Fig. 11 shows a block schematic diagram of an electronic device provided in an embodiment of the present application. Icon: 100-quantum input lines; 110-phase inversion line; 111-a first control gate; 120-amplitude amplifying circuit; 121-a second control gate; 200-quantum input module; 210-a phase inversion module; 220-an amplitude amplification module; 30-an electronic device; 310-memory; 320-a processor; 330-a communication module.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
It is noted that relational terms such as "first" and "second", and the like, are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The Grover algorithm is now commonly used to solve the problem of unordered database searches, enabling square root acceleration relative to classical searches. The Grover algorithm can utilize the characteristics of a quantum computer to carry out quantum coding on input data, and the amplitude of a quantum coding form of marked data is amplified by utilizing an amplitude amplification technology, so that the aim of searching is achieved.
Since the present application relates to quantum algorithms, for ease of understanding, the principles of the Grover algorithm will be briefly described before explaining the quantum circuit optimization method of the Grover algorithm provided in the embodiments of the present application.
Assuming n qubits for recording an index for each data in the database, therefore, the nA number of qubits may be used to represent 2N data, denoted N, where obviously n=2 n . When searching the target quantum state, the Grover algorithm needs to firstly mark the target quantum state, and is specifically characterized in that when other quantum states except the target quantum state are searched, the value is not changed, and when the target quantum state is searched, the phase is inverted, so that the phase of the target quantum state is changed into a negative number.
The expression can be expressed as follows:
Figure BDA0003357392240000061
wherein x is any data in the database to be searched, ω represents target data, |x >Representing any quantum state in the database to be searched, U ω Representing a diagonal matrix, such that the target quantum state has a negative phase.
A functional may be established to indicate whether a certain data is a search result:
Figure BDA0003357392240000071
the above formula characterizes that f (x) takes 1 when the searched data is the target data, and f (x) takes 0 when the searched data is not the target data.
On the basis, U ω |x>Can be expressed as:
U ω |x>=(-1) f(x) |x>
the steps of the Grover algorithm can be roughly divided into three steps:
step 1: the preparation of the quantum superposition state is carried out, so that an equal superposition state of all possible cases is obtained, and the preparation can be represented by the following formula:
Figure BDA0003357392240000072
wherein, |s>The state of the device is represented as an initial state,
Figure BDA0003357392240000073
representing the use of actions at n|0>Preparation of the upper H gate from |0 … 0>To |1 … 1>Is equal to the probability of each quantum state, +.>
Figure BDA0003357392240000074
The amplitude of each quantum state is represented, and n=2n.
If there are M target quantum states to be searched, the other quantum states not to be searched are N-M, and the solution of all non-search problems can be defined as one quantum state |s '>, and |s' >, can be expressed as:
Figure BDA0003357392240000075
wherein, sigma x1 Representing the sum of the solutions of all non-search questions on x.
The |ω > is a target quantum state corresponding to the target data, and since the |ω > and the |s' > are orthogonal to each other, the initial state |s > can be expressed as:
Figure BDA0003357392240000081
Referring to fig. 1A, a schematic diagram of the Grover algorithm is shown, wherein the left side is an initial state diagram, and the right side is a bar chart of each quantum state amplitude. It will be appreciated that the initial state is of |ω>And |s'>Space of tense, |s>=sinθ|ω>+cosθ|s′>Wherein, the method comprises the steps of, wherein,
Figure BDA0003357392240000082
and the amplitudes of all quantum states are equal and are +.>
Figure BDA0003357392240000083
Step 2: application U ω (oracle) to |s>So that |s>Concerning |s'>Symmetrical.
Referring to FIG. 1B, an alternative schematic diagram of the Grover algorithm is shown, where |s>Concerning |s'>Symmetric |psi t′ >Meaning |omega>The phase of (a) becomes negative, so that the amplitude value of the target quantum state becomes negative, and thus the average amplitude of all states decreases (indicated by a broken line).
Step 3: u is set to s Acting on |s>Fig. 1C is a schematic diagram of a Grover algorithm, in which U s Concerning the superimposed state |s>And thus can be decomposed into
Figure BDA0003357392240000084
U s U ω Acting at |s>On the other hand, the quantum state is continuously close to the target quantum state |omega>. Wherein U is s For the amplitude bar graph, it is understood that the reflection of the average amplitude is reflected.
Repeating step 2 and step 3, thereby rendering |s>Continuously approaches the target quantum state |omega>. After t times, |psi can be obtained t >And |ψ t >Can be expressed by the following formula:
t >=(U s U ω ) t |s>
wherein |ψ t >Representing the sum of s >And after t iterations, the quantum state is in a quantum state, and t represents the number of iterations.
Because each Grover iteration can rotate the quantum state anticlockwise by 2θ, after k Grover iterations, the quantum state of the last state is:
t >=cos((2k+1)θ)|s>+sin((2k+1)θ)|ω>
therefore, after a plurality of iterative operations, the probability of the last state on the |omega > state is high, the precision requirement is met, and the iterative times k meet the following conditions:
Figure BDA0003357392240000091
as can be seen from the above description of the Grover algorithm, the quantum stack preparation is required to be performed when the Grover algorithm is applied to search,for n qubits used to record the index of each data in the database, 2 can be prepared n Quantum state corresponding to 2 n And data, and simultaneously obtaining the corresponding amplitude of each quantum state, wherein the square of the amplitude is the probability that each quantum state is read in searching. Obviously, the probabilities of the quantum states obtained at this time are consistent, so in order to make the probability of the target quantum state being read larger, the target quantum state needs to be phase-inverted so as to mark the target quantum state, and then the amplitude of the target quantum state after the phase inversion is amplified, so that the target quantum state can be read with a great probability during searching.
In the prior art, the phase inversion of the target quantum state is generally realized by adopting a control X gate and a combination form of the X gate and the H gate in an additional quantum bit line. Taking the example of preparing a quantum superposition state by inputting three quantum bits, please refer to fig. 2, which is a Grover algorithm line using an additional quantum bit line.
Wherein q_0 corresponds to the additional qubit line, q_1-q_3 corresponds to the index space, and q_4-q_6 corresponds to the data space. The index space is used for encoding the position of each quantum state, and the data space is used for encoding the data of each quantum state; the additional bit line includes an X gate and an H gate, and a control X gate for phase flipping the target quantum state in the data space to effect marking of the target quantum state.
Obviously, since the method needs to introduce an additional quantum bit line to perform phase inversion on the target quantum state, the use of the additional quantum bit line is increased, and thus the waste of quantum resources is caused.
Based on the above findings, the inventor optimizes the quantum circuit of the existing Grover algorithm, and proposes a quantum circuit optimizing method of the Grover algorithm, so as to reduce the use of an additional quantum bit circuit and save quantum resources.
Next, an exemplary description is given of a quantum circuit optimization method of a Grover algorithm provided by an embodiment of the present application, and referring to fig. 3, a flowchart of the quantum circuit optimization method of the Grover algorithm provided by the embodiment of the present application is shown, where the method includes:
and S21, processing the initialized quantum bit by utilizing a quantum input circuit to obtain a first quantum state after quantum superposition and a first amplitude corresponding to each first quantum state.
Wherein the first quantum state includes a target quantum state and other quantum states.
In this embodiment, the quantum input line may process an initial state of a quantum bit through a quantum logic gate, and optionally, the initial state of the quantum bit may be a 0 state (|0 >) or a 1 state (|1 >); the quantum logic gate can be an H gate, and the H gate acts on a quantum bit with an initial state of 0 state to prepare a quantum superposition state, so that a first quantum state and a first amplitude corresponding to each first quantum state are obtained.
It can be understood that the first quantum state is an equal-amount superposition state of all possible cases, including the target quantum state and other quantum states, and the first amplitudes corresponding to the first quantum states are equal.
And S22, processing the target quantum state by using a phase inversion circuit to obtain the target quantum state after phase inversion.
The phase inversion circuit comprises a first control gate inserted into any one of the qubits, and the first control gate is used for inverting the phase of a first target quantum state processed by the first X gate.
In this embodiment, the quantum logic gate on the phase inversion line may be used to process the target quantum state in the data space, and the first control gate may be inserted into any one of the qubits, and the first target quantum state processed by the first X gate may be processed through the first control gate and the control bit thereof, so as to invert the phase of the first target quantum state, and finally achieve phase inversion of the target quantum state.
Since the data space is used to encode data of the target quantum state, it can be appreciated that the phase inversion circuit only changes the phase of the target quantum state to mark the target quantum state, and does not affect the amplitude of the target quantum state.
In this embodiment, in order to mark the target quantum state in all the first quantum states, all the first quantum states may be input into a phase inversion circuit, which may invert the phase of the target quantum state, so that the phase of the target quantum state becomes negative, while the phase states of other quantum states are not changed. Since the phase of the target quantum state is negative and the phases of the other quantum states are positive, the target quantum state can be marked in all the first quantum states.
And S23, processing the target quantum state after phase inversion by using an amplitude amplification circuit to obtain a second amplitude corresponding to the target quantum state.
Wherein the second amplitude is greater than the first amplitude. It can be appreciated that the square of the second amplitude is the probability value that the target quantum state was read at the time of search.
Alternatively, all quantum states may be input into the amplitude amplification circuit in the index space, and since the target quantum state is marked at this time, that is, only the phase of the target quantum state is inverted to be negative, the amplitude amplification circuit may identify the target quantum state according to the phase state, so that only the target quantum state after phase inversion is processed, and the amplitude of the target quantum state is amplified.
Since the square of the amplitude of each quantum state is the probability that each quantum state is read during searching, and the sum of the probabilities of each quantum state is 1, it can be understood that the amplitude of the target quantum state is amplified and the amplitudes of other quantum states are reduced at the same time after the processing of the amplitude amplifying circuit.
In this embodiment, the phase of the target quantum state is inverted after the phase inversion circuit processing, and at the same time, the amplitude of the target quantum state is inverted so as to become a negative number, that is, the average amplitude of the target quantum state and other quantum states is reduced. However, in this case, the absolute values of the amplitude of the target quantum state and the amplitudes of the other quantum states are not changed, and the first amplitude, that is, the probability of reading the target quantum state at the time of the search is not changed. In order to increase the probability of reading a target quantum state during searching, an amplitude amplifying circuit can be used for processing the target quantum state and amplifying the amplitude of the target quantum state.
In one possible implementation, in performing the over search, an open source quantum computation framework such as QPanda2 may be applied, using qcciit type parameters in_operate and state_operate to characterize the input lines and quantum preparation lines; adopting std: : vector < std: : the parameter mark_data of string > type represents a target quantum state set to be searched; characterizing the number of qubits of a data space and an index space by adopting parameters data_qubits and in_qubits of a QVec type; the virtual machine type is characterized by adopting the parameters qvm of the QuantumMachine type, so that the target quantum state is subjected to phase inversion and amplification according to the input line and the quantum state preparation line, and the complete quantum line is returned. When data marking is carried out, the quantum bit number of the turnover line can be represented by adopting a QVec type parameter flip_qubit; adopting std: : vector < std: : the string > type parameter mark_data characterizes a target quantum state to be searched, so that the target quantum state is searched, phase inversion is performed, and the inversion quantum line is returned. When the amplitude is amplified, the qVec type parameter q_us can be used for representing the quantum bit number of an amplifying circuit; and (3) adopting a parameter in_operation of QCIrcuit type to characterize an algorithm input line, thereby amplifying the searched amplitude of the target quantum state and returning to an amplifying line.
According to the quantum circuit optimization method of the Grover algorithm, the initialized quantum bits are processed through the quantum input circuit to prepare quantum superposition states, so that a first quantum state after quantum superposition and first amplitudes corresponding to the first quantum states are obtained, the first quantum state comprises a target quantum state and other quantum states, then the target quantum state is processed through the phase inversion circuit, the phase of the target quantum state is inverted, marking of the target quantum state is achieved, the phase inversion circuit comprises a first control gate inserted into any quantum bit, phase inversion of the first target quantum state obtained after the first X gate processing can be achieved through the first control gate, finally the amplitude amplification circuit is utilized to process the target quantum state after the phase inversion, so that second amplitudes corresponding to the target quantum state can be obtained, and the amplitudes of the target quantum state are amplified through the amplitude amplification circuit, so that the second amplitudes are larger than the first amplitudes. The first target quantum state processed by the first X gate is processed through the first control gate inserted into any quantum bit in the phase inversion circuit, so that the phase of the first target quantum state is inverted, and finally the phase inversion of the target quantum state is realized, and therefore, the phase of the target quantum state is inverted without adding an additional quantum bit circuit in the quantum circuit, and quantum resources are saved.
Optionally, in order to obtain the target quantum state after phase inversion, a possible implementation manner is given below, and specifically, on the basis of fig. 3, fig. 4 is another flow chart of a quantum circuit optimization method of the Grover algorithm provided in the embodiment of the present application, referring to fig. 4, the step S22 may further include the following steps:
step S221, determining a target quantum bit with a value of 0 according to the state of the target quantum state;
in step S222, the target qubit is processed by using the first X gate, and a first target quantum state is obtained according to the target quantum state.
In this embodiment, the target qubit having a value of 0 may be determined according to the state of the target qustate, and since the X gate may set "0" on each qubit to "1" and "1" to "0", by inserting the first X gate on the target qubit, "0" on each target qubit may be prepared as "1", thereby obtaining the first target qustate in which each qubit is 1.
In step S223, all the qubits are processed by using the first control gate, and a second target quantum state is obtained according to the first target quantum state.
In this embodiment, all the qubits of the first target quantum state may be processed through the first control gate, so that the phase of the first target quantum state in which each qubit is 1 is flipped, and the second target quantum state is obtained, that is, the second target quantum state is in the negative form of the first target quantum state.
In step S224, the target qubit is processed by using the second X gate, and the target quantum state after phase inversion is obtained according to the second target quantum state.
In this embodiment, a second X gate may be inserted into the target qubit, and a "1" on the target qubit is set to "0" for the second target qustate, so that the second target qustate of all 1 states is reduced to the target quantum state while the phase inversion result is maintained, thereby obtaining a target quantum state after phase inversion, that is, the target quantum state after phase inversion is negative.
According to the quantum circuit optimization method of the Grover algorithm, in the phase inversion circuit, a target quantum state can be prepared into a first target quantum state of all 1 through a first X gate, phase inversion of the first target quantum state is achieved through a first control gate inserted into any quantum bit, a second target quantum state is obtained, and finally the second target quantum state is processed through a second X gate, so that a target quantum state after phase inversion is obtained. The phase inversion process can be completed through the first control gate, so that an additional quantum bit line is not required to be additionally arranged, the use of the additional quantum bit line is reduced, and quantum resources are saved.
Alternatively, the first control gate may be a combination of an H gate, a control X gate, and an H gate. When the first control gate is a combination of the first H gate, the first control X gate, and the second H gate, the above step S223 may be implemented by:
and processing all the qubits by using the first H gate, the first control X gate and the second H gate in sequence, and obtaining a second target quantum state according to the first target quantum state.
Optionally, the first H gate, the first control X gate, and the second H gate may be inserted on the same qubit, where the target bit of the first control X gate is the same qubit, and the control bits are other qubits.
Optionally, the first H-gate, the first control X-gate and the second H-gate as a whole process all qubits including the target bit and the control bit.
Optionally, the first control gate may also be a control Z gate, where step S223 may be implemented by: and processing all the qubits by using a first control Z gate, and obtaining a second target quantum state according to the first target quantum state.
Optionally, a first control Z gate may be inserted into any qubit, where the target bit of the first control Z gate is the any qubit and the control bits are other qubits.
Because the phase inversion circuit only performs phase inversion on the target quantum state so as to mark the target quantum state, and does not change the probability that the target quantum state is read during searching, amplitude amplification is also required for the marked target quantum state. Specifically, fig. 5 is a schematic flow chart of another quantum circuit optimization method of the Grover algorithm according to the embodiment of the present application on the basis of fig. 3, referring to fig. 5, the step S23 may further include the following steps:
and step S231, processing all qubits of the target quantum state after phase inversion by using a third H gate to obtain a third target quantum state.
In this embodiment, the phase inversion circuit may identify the target quantum state according to the phase state, process the target quantum state, amplify the amplitude of the target quantum state, insert a third H gate on all the qubits, and process all the qubits of the target quantum state after phase inversion by the third H gate, to obtain a third target quantum state in which each qubit is 0. At this time, the phase of the third target quantum state is positive.
And S232, processing all the qubits of the third target quantum state by using a third X gate, a second control gate and a fourth X gate in sequence to obtain the third target quantum state after phase inversion.
Alternatively, a third X gate may be inserted over all qubits, a second control gate may be inserted over any qubit, and a fourth X gate may be inserted over all qubits.
In this embodiment, the third X gate, the second control gate, and the fourth X gate may invert the phase of the third target quantum state to obtain a third target quantum state after phase inversion. It can be understood that each qubit of the third target quantum state after phase inversion is still 0 at this time, and its phase is negative.
And step S233, processing all qubits of the third target quantum state after phase inversion by using a fourth H gate to obtain a second amplitude corresponding to the target quantum state.
Optionally, a fourth H-gate may be inserted over all qubits for processing all qubits of the third target quantum state after phase inversion.
It will be appreciated that after processing through the fourth H-gate, 0 on each qubit of the third target quantum state after phase inversion can be reduced to the value of the target quantum state, while a second amplitude of the amplified target quantum state can be obtained.
After the target quantum state is identified from the phase state, the amplitude amplification circuit processes each qubit and phase of the target quantum state by each quantum logic gate, and amplifies the amplitude of the target quantum state. Obviously, at this time the amplitude of the target quantum state is amplified, the second amplitude being greater than the first amplitude.
In the quantum circuit optimization method of the Grover algorithm, in the amplitude amplification circuit, all the qubits of the target quantum state can be processed through the third H gate, the third X gate, the second control gate, the fourth X gate and the fourth H gate, so that the amplitude of the target quantum state is amplified, and the probability of reading the target quantum state during searching is increased.
Optionally, the second control gate may be a combination of an H gate, a control X gate, and an H gate, on the basis of fig. 5, fig. 6 is a schematic flow chart of a quantum circuit optimization method of the Grover algorithm according to the embodiment of the present application, and when the second control gate is a combination of a fifth H gate, a second control X gate, and a sixth H gate, referring to fig. 6, the step S232 may be implemented by:
and S232-1, processing all qubits of a third target quantum state by using a third X gate to obtain a fourth target quantum state.
In this embodiment, a third X gate may be inserted into all the qubits, all the qubits of the third target quantum state where each of the qubits is 0 are processed, and "0" on each of the qubits is set to "1", so as to obtain a fourth target quantum state where each of the qubits is 1, and the phase of the fourth target quantum state at this time is a positive number.
And S232-2, processing all quantum bits of the fourth target quantum state by sequentially utilizing a fifth H gate, a second control X gate and a sixth H gate to obtain the fourth target quantum state after phase inversion.
In this embodiment, the fifth H gate, the second control X gate, and the sixth H gate may be inserted on the same qubit, the target bit of the second control X gate is the same qubit, the control bit is another qubit, and the fifth H gate, the second control X gate, and the sixth H gate may be used as a whole to implement phase inversion for the fourth target quantum state.
It can be understood that each qubit of the fourth target quantum state after phase inversion is 1, and the phase of the fourth target quantum state after phase inversion is negative.
Optionally, the second control gate may be a control Z gate, where when the second control gate is a second control Z gate, the second control Z gate may be inserted into any qubit, and all qubits in the fourth target quantum state are processed by using the second control Z gate, and the fourth target quantum state after phase inversion is obtained.
Optionally, the second control Z gate includes control bits acting on other qubits, the other qubits being all but the qubit inserted into the second control Z gate.
And S232-3, processing all qubits of the fourth target quantum state after phase inversion by using a fourth X gate to obtain a third target quantum state after phase inversion.
In this embodiment, a fourth X gate may be inserted into all the qubits, and the fourth X gate may process all the qubits of the fourth target quantum state after phase inversion, and place "1" on each of the qubits to "0" so as to obtain a third target quantum state after phase inversion.
It can be understood that each qubit of the third target quantum state after phase inversion is 0 at this time, and the phase of the third target quantum state after phase inversion is negative.
In the following, taking an example of preparation of a quantum superposition state by inputting 4 quantum bits as an example, the initial state of the quantum bits is |0>, a quantum circuit optimization method of the Grover algorithm provided in the embodiment of the present application will be described in detail, and for convenience of understanding, a barrier gate is added to a quantum circuit for demonstration. Wherein, the barrier gate (barrier) is represented by a vertical dotted line, and the barrier has the function of preventing the self-adaptation of the circuit from disturbing the circuit layout which the user wants to realize, keeping the correctness of the time sequence and preventing the logic gate from moving forward; preventing logic gates from merging; and can also function as placeholders.
Referring to fig. 7, a quantum circuit after optimization of the Grover algorithm includes a quantum input circuit 100, a phase inversion circuit 110, and an amplitude amplification circuit 120, wherein the phase inversion circuit 110 includes a first control gate 111, and the amplitude amplification circuit 120 includes a second control gate 121.
4 qubits are input, and the initial state of each qubit is |0>The initialized qubit is processed by the H gate in the quantum input line 100 to obtain the first quantum state with equal probability, and since 4 qubits are input, 2 is obtained 4 I.e. 16 first quantum states, respectively |0000>、|0001>、|0011>、|0100>、|0101>、|0110>、|0111>、|1000>、|1001>、|1010>、|1011>、|1100>、|1101>、|1110>、|1111>。
After the first quantum state with equal probability is obtained, a target quantum state in the first quantum state can be subjected to phase inversion through a phase inversion circuit, so that the target quantum state is marked. In one example, if the target quantum state is 0110, the target quantum bit having the value of 0 should be the 0 th bit and the 3 rd bit, so the phase inversion line 110 may insert the first X gate at q_3 and q_0, respectively, so as to prepare the target quantum state as the first target quantum state, and it can be understood that the first target quantum state is 1111.
The phase of the first target quantum state (1111) may then be flipped by the first control gate 111, and in one example, the first control gate 111 is a combination of a first H gate, a first control X gate, and a second H gate, please continue to refer to fig. 7, the first control gate 111 is inserted onto the qubit q_3, and the first control gate 111 may implement the processing for each qubit of the first target quantum state by the first control X gate and its control bits acting on q_0, q_1, and q_2, thereby obtaining a second target quantum state, which may be understood to be-1111.
Because the phase of the first target quantum state is overturned after the processing of the first control gate, in order to obtain the target quantum state after the phase is overturned, the target quantum bit subjected to the processing of setting '1' is also required to be reset to 0, namely, the second X gate can be respectively inserted into q_3 and q_0, so that the target quantum bit of the second target quantum state (-1111) is set to '0' from '1', and the target quantum state after the phase is overturned, namely-0110, is obtained, and the marking of the target quantum state is finished without adding an additional quantum bit line.
The phase flipped target quantum state (-0110) should then be processed through an amplitude amplification circuit to amplify the amplitude of the target quantum state.
Referring to fig. 7, a third H gate is first inserted into all qubits, and after a target quantum state that should be amplified in amplitude is identified according to the phase state, the target quantum state may be processed through the third H gate, and the target quantum state (0110) is prepared to be a state of all 0, so as to obtain a third target quantum state. It is understood that the third target quantum state is 0000.
Next, a phase inversion of the third target quantum state is required, and a third X gate may be inserted over each qubit to place a "0" on each qubit of the third target quantum state (0000) at a "1" to obtain a fourth target quantum state. It is understood that the fourth target quantum state is 1111.
To achieve phase inversion, the fourth target quantum state (1111) may be processed by the second control gate 121, and in one example, the second control gate 121 is a combination of a fifth H gate, a second control X gate, and a sixth H gate, the second control gate 121 is inserted onto the qubit q_3, and the second control gate 121 may implement processing for each qubit of the fourth target quantum state by the first control X gate and its control bits acting on q_0, q_1, and q_2, thereby obtaining a fourth target quantum state after phase inversion, which is-1111 as can be appreciated.
And then, a fourth target quantum state (-1111) after phase inversion is processed through a fourth X gate inserted into each qubit, and a '1' on each qubit of the fourth target quantum state after phase inversion is set to be '0', so that a third target quantum state after phase inversion is obtained. It is understood that the third target quantum state after the phase inversion is-0000.
And finally, processing all the qubits of the third target quantum state after phase inversion through a fourth H gate inserted into each qubit, converting '0' on each qubit of the third target quantum state (-0000) after phase inversion into a numerical value of the target quantum state, thereby obtaining-0110 and obtaining the amplified amplitude of the target quantum state.
Since different first quantum states need to be prepared for different problems, different quantum input lines are needed to encode the initialized qubits for different problems. Specifically, fig. 8 is another flow chart of a quantum circuit optimization method of the Grover algorithm provided in the embodiment of the present application, please refer to fig. 8, before step S21, the method further includes:
step S20, determining the quantum gate type in the quantum input line according to the state of the first quantum state.
In this embodiment, the state of the first quantum state to be prepared should be determined in combination with the problem to be solved, so that the type of quantum gate in the quantum input line is determined according to the state of the first quantum state.
According to the quantum circuit optimization method of the Grover algorithm, the quantum gate type in the quantum input circuit can be determined according to the state of the first quantum state, so that the first quantum state meeting corresponding requirements is prepared. In this way, the Grover algorithm can be adapted to a variety of application scenarios, for example, for solving the problems of QUBO (Quadratic Unconstrained Binary Optimization quadratic unconstrained binary optimization), SAT (Boolean satisfiability problem), etc.
Optionally, when searching and reading are required to be performed on multiple target quantum states at the same time, variable types can be optimized through programming, and phase inversion is performed on each piece of data to be searched, so that simultaneous searching on multiple target quantum states is achieved.
In one example, if the quantum state set is {7,6,2,6,5,1,1,4}, the target quantum states "1", "2", "7" need to be searched simultaneously, and the corresponding quantum states are encoded as 001, 010, 111, in a possible implementation manner, the first control gate and the second control gate may be both control Z gates, specifically, fig. 9A shows a quantum circuit schematic diagram of searching for multiple target quantum states simultaneously by using the Grover algorithm when the first control gate is the first control Z gate and the second control gate is the second control Z gate. Where q_0-q_2 are index spaces and q_3-q_5 are data spaces.
For ease of understanding, fig. 9B shows a phase inversion circuit with the addition of a barrier gate, and referring to fig. 9B, each piece of data with a search may be phase-inverted separately, so that the marking of multiple target quantum states may be achieved without adding additional circuits. After finishing phase inversion on the plurality of target quantum states, the target quantum states after phase inversion can be processed through an amplitude amplification circuit, so that the amplitudes of the plurality of target quantum states are amplified simultaneously, and the probability that each target quantum state is read in searching is increased.
In another possible implementation manner, the first control gate and the second control gate may be in a combination of an H gate, a control X gate and an H gate, and in particular, fig. 9C shows a quantum circuit schematic diagram of searching for multiple target quantum states simultaneously by using the Grover algorithm when the first control gate is a combination of a first H gate, a first control X gate and a second H gate, and the second control gate is a combination of a fifth H gate, a second control X gate and a sixth H gate. Where q_0-q_2 are index spaces and q_3-q_5 are data spaces.
Optionally, when the situation that a plurality of target quantum states need to be searched simultaneously is faced, considering the problem that the searching efficiency is reduced, the number of quantum bits needed by the index space and the data space can be judged according to the size and the numerical value of the database to be searched, and in the process of carrying out phase inversion on each target quantum state by utilizing the phase inversion circuit, the high order of the target quantum state obtained after the processing of the first X gate is automatically zero-padded according to the bit size of the data space, so that the first target quantum state with fixed size can be obtained, the subsequent operation of carrying out phase inversion on the first target quantum state through the first control gate is more universal, and the searching efficiency of the Grover algorithm when the plurality of target quantum states are used for searching simultaneously is improved.
Referring to fig. 10, a functional block diagram of a quantum circuit optimizing device of a Grover algorithm according to an embodiment of the present application includes a quantum input module 200, a phase inversion module 210, and an amplitude amplification module 220.
The quantum input module 200 is configured to process the quantum bit to obtain a first quantum state after quantum superposition and a first amplitude corresponding to each first quantum state; wherein the first quantum state includes a target quantum state and other quantum states.
It is understood that the quantum input module 200 may be used to perform the above step S21.
The phase inversion module 210 is configured to process the target quantum state to obtain a phase-inverted target quantum state; the phase inversion circuit comprises a first control gate inserted into any one of the qubits, and the first control gate is used for inverting the phase of a first target quantum state processed by the first X gate.
It is understood that the phase inversion module 210 may be used to perform the step S22 described above.
The amplitude amplifying module 220 is configured to process the phase-flipped target quantum state to obtain a second amplitude corresponding to the target quantum state; wherein the second amplitude is greater than the first amplitude.
It is understood that the amplitude amplification module 220 may be used to perform the above step S23.
Optionally, the phase flip module 210 is further configured to determine a target qubit with a value of 0 according to the state of the target quantum state; processing the target qubit by using a first X gate to obtain a first target quantum state; processing all the qubits by using a first control gate to obtain a second target quantum state; and processing the target quantum bit by using a second X gate to obtain a target quantum state after phase inversion.
It is understood that the phase inversion module 210 may also be used to perform steps S221-224 described above.
Optionally, when the first control gate is a combination of the first H gate, the first control X gate, and the second H gate, the phase inversion module 210 is further configured to process all the qubits sequentially with the first H gate, the first control X gate, and the second H gate, and obtain a second target quantum state according to the first target quantum state.
Optionally, the amplitude amplification module 220 is further configured to process all qubits of the target quantum state after phase inversion by using a third H gate to obtain a third target quantum state; all the qubits of the third target quantum state are processed by using a third X gate, a second control gate and a fourth X gate in sequence, so that the third target quantum state after phase inversion is obtained; and processing all the qubits of the third target quantum state after phase inversion by using a fourth H gate to obtain a second amplitude corresponding to the target quantum state.
It will be appreciated that the amplitude amplification module 220 may also perform steps 231-233 described above.
Optionally, when the second control gate is a combination of a fifth H gate, a second control X gate, and a sixth H gate, the amplitude amplification module 220 is further configured to process all qubits of the third target quantum state with the third X gate to obtain a fourth target quantum state; all the qubits of the fourth target quantum state are processed by sequentially utilizing a fifth H gate, a second control X gate and a sixth H gate, so that the fourth target quantum state after phase inversion is obtained; and processing all the qubits of the fourth target quantum state after phase inversion by using a fourth X gate to obtain a third target quantum state after phase inversion.
It will be appreciated that the amplitude amplification module 220 may also perform steps 232-1-232-3 described above.
Optionally, the quantum input module 200 is further configured to determine a quantum gate type in the quantum input line according to the state of the first quantum state.
It is understood that the quantum input module 200 may also perform the above step S20.
According to the quantum circuit optimizing device of the Grover algorithm, a target quantum state is processed through a quantum input module, and the target quantum state after phase inversion is obtained; the phase inversion circuit comprises a first control gate inserted into any one of the qubits, wherein the first control gate is used for inverting the phase of a first target quantum state processed by the first X gate; processing the target quantum state through a phase inversion module to obtain a target quantum state after phase inversion; the phase inversion circuit comprises a first control gate inserted into any one of the qubits, wherein the first control gate is used for inverting the phase of a first target quantum state processed by the first X gate; processing the target quantum state after phase inversion by an amplitude amplification module to obtain a second amplitude corresponding to the target quantum state; wherein the second amplitude is greater than the first amplitude. The first target quantum state processed by the first X gate is processed through the first control gate inserted into any quantum bit in the phase inversion circuit, so that the phase of the first target quantum state is inverted, and finally the phase inversion of the target quantum state is realized, and therefore, the phase of the target quantum state is inverted without adding an additional quantum bit circuit in the quantum circuit, and quantum resources are saved.
Referring to fig. 11, a block diagram of an electronic device 30 capable of implementing the above-mentioned quantum circuit optimization method of the Grover algorithm according to an embodiment of the present application is shown. The electronic device includes a memory 310, a processor 320, and a communication module 330. The memory 310, the processor 320 and the communication module 330 are electrically connected directly or indirectly to each other to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
Wherein the memory 310 is used to store programs or data. The Memory 310 may be, but is not limited to, random access Memory (RandomAccess Memory, RAM), read Only Memory (ROM), programmable Read Only Memory (Programmable Read-Only Memory, PROM), erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.
The processor 320 is used to read/write data or programs stored in the memory and perform corresponding functions.
The communication module 330 is used for establishing communication connection between the server and other communication terminals through the network, and for transceiving data through the network.
It should be understood that the architecture shown in fig. 11 is merely a schematic diagram of a server that may also include more or fewer components than those shown in fig. 11, or have a different configuration than that shown in fig. 11. The components shown in fig. 11 may be implemented in hardware, software, or a combination thereof.
The embodiment of the application further provides a computer readable storage medium, on which a computer program is stored, where the computer program when executed by a processor implements each process of the above quantum circuit optimization method of the above Grover algorithm, and the same technical effects can be achieved, so that repetition is avoided, and no further description is given here. Wherein, the computer readable storage medium is Read-only memory (ROM), random Access Memory (RAM), magnetic disk or optical disk, etc.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners as well. The apparatus embodiments described above are merely illustrative, for example, flow diagrams and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the same, but rather, various modifications and variations may be made by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims (10)

1. A quantum wire optimization method of a Grover algorithm, the method comprising:
processing the initialized quantum bit by utilizing a quantum input line to obtain a first quantum state after quantum superposition and a first amplitude corresponding to each first quantum state; wherein the first quantum state includes a target quantum state and other quantum states;
processing the target quantum state by using a phase inversion circuit to obtain a target quantum state after phase inversion; the phase inversion circuit comprises a first control gate inserted into any qubit, wherein the first control gate is used for inverting the phase of a first target quantum state processed by a first X gate;
processing the target quantum state after phase inversion by using an amplitude amplification circuit to obtain a second amplitude corresponding to the target quantum state; wherein the second amplitude is greater than the first amplitude.
2. The method of claim 1, wherein the step of processing the target quantum state with a phase inversion circuit to obtain a phase-inverted target quantum state comprises:
determining a target quantum bit with a value of 0 according to the state of the target quantum state;
Processing the target qubit by using the first X gate, and obtaining the first target quantum state according to the target quantum state;
processing all the qubits by using the first control gate, and obtaining a second target quantum state according to the first target quantum state;
and processing the target quantum bit by using a second X gate, and obtaining a target quantum state with the inverted phase according to the second target quantum state.
3. The method of claim 2, wherein when the first control gate is a combination of a first H gate, a first control X gate, and a second H gate, the step of processing all qubits with the first control gate to obtain a second target quantum state from the first target quantum state comprises:
and processing all the qubits by using the first H gate, the first control X gate and the second H gate in sequence, and obtaining the second target quantum state according to the first target quantum state.
4. The method of claim 1, wherein the step of processing the phase flipped target quantum state with an amplitude amplification circuit to obtain a second amplitude corresponding to the target quantum state comprises:
Processing all the qubits of the target quantum state after phase inversion by using a third H gate to obtain a third target quantum state;
all the qubits of the third target quantum state are processed by using a third X gate, a second control gate and a fourth X gate in sequence, so that a third target quantum state with a reversed phase is obtained;
and processing all the qubits of the third target quantum state after the phase inversion by using a fourth H gate to obtain a second amplitude corresponding to the target quantum state.
5. The method of claim 4, wherein when the second control gate is a combination of a fifth H gate, a second control X gate, and a sixth H gate, the step of sequentially processing the third target quantum state with a third X gate, a second control gate, and a fourth X gate to obtain a phase flipped third target quantum state includes:
processing all qubits of the third target quantum state by using the third X gate to obtain a fourth target quantum state;
sequentially processing all the qubits of the fourth target quantum state by using the fifth H gate, the second control X gate and the sixth H gate to obtain a fourth target quantum state with a reversed phase;
And processing all the qubits of the fourth target quantum state after phase inversion by using the fourth X gate to obtain a third target quantum state after phase inversion.
6. The method of claim 1, wherein prior to the step of processing the qubit with the quantum input circuit to obtain quantum-stacked first quantum states and first amplitudes corresponding to each first quantum state, the method further comprises:
and determining the quantum gate type in the quantum input circuit according to the state of the first quantum state.
7. A quantum wire optimizing device of a Grover algorithm, the device comprising:
the quantum input module is used for processing the quantum bit to obtain a first quantum state after quantum superposition and a first amplitude corresponding to each first quantum state; wherein the first quantum state includes a target quantum state and other quantum states;
the phase overturning module is used for processing the target quantum state to obtain a target quantum state after phase overturning; the phase inversion circuit comprises a first control gate inserted into any qubit, wherein the first control gate is used for inverting the phase of a first target quantum state processed by a first X gate;
The amplitude amplifying module is used for processing the target quantum state after the phase inversion to obtain a second amplitude corresponding to the target quantum state; wherein the second amplitude is greater than the first amplitude.
8. The apparatus of claim 7, wherein the phase inversion module is further configured to determine a target qubit having a value of 0 according to a state of the target qustate;
processing the target quantum bit by using the first X gate to obtain a first target quantum state;
processing all the qubits by using the first control gate to obtain a second target quantum state;
and processing the target quantum bit by using a second X gate to obtain a target quantum state after phase inversion.
9. An electronic device comprising a processor and a memory, the memory storing a computer program executable by the processor, the processor being executable to implement the method of any one of claims 1-6.
10. A computer readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the method according to any of claims 1-6.
CN202111356549.0A 2021-11-16 2021-11-16 Quantum circuit optimization method of Grover algorithm and related device Active CN116136968B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111356549.0A CN116136968B (en) 2021-11-16 2021-11-16 Quantum circuit optimization method of Grover algorithm and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111356549.0A CN116136968B (en) 2021-11-16 2021-11-16 Quantum circuit optimization method of Grover algorithm and related device

Publications (2)

Publication Number Publication Date
CN116136968A true CN116136968A (en) 2023-05-19
CN116136968B CN116136968B (en) 2024-06-21

Family

ID=86334153

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111356549.0A Active CN116136968B (en) 2021-11-16 2021-11-16 Quantum circuit optimization method of Grover algorithm and related device

Country Status (1)

Country Link
CN (1) CN116136968B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118014095A (en) * 2024-04-10 2024-05-10 国开启科量子技术(安徽)有限公司 Distributed multi-target quantum search method, device, medium and equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7028275B1 (en) * 2001-10-15 2006-04-11 The Texas A&M University System Quantum circuit design for grover's algorithm
CN108334952A (en) * 2017-11-24 2018-07-27 南京航空航天大学 A kind of novel universal quantum door and quantum wire optimization method
CN110162536A (en) * 2019-04-10 2019-08-23 深圳大学 A kind of quantum searching method, system, electronic device and storage medium
US10637480B1 (en) * 2019-04-25 2020-04-28 International Business Machines Corporation Multi-control quantum state inversion gate
US20200192417A1 (en) * 2018-08-28 2020-06-18 Synopsys, Inc. Semiconductor digital logic circuitry for non-quantum enablement of quantum algorithms
CN112182494A (en) * 2020-09-27 2021-01-05 中国人民解放军战略支援部队信息工程大学 Integer decomposition optimization method and system based on Grover quantum computing search algorithm

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7028275B1 (en) * 2001-10-15 2006-04-11 The Texas A&M University System Quantum circuit design for grover's algorithm
CN108334952A (en) * 2017-11-24 2018-07-27 南京航空航天大学 A kind of novel universal quantum door and quantum wire optimization method
US20200192417A1 (en) * 2018-08-28 2020-06-18 Synopsys, Inc. Semiconductor digital logic circuitry for non-quantum enablement of quantum algorithms
CN110162536A (en) * 2019-04-10 2019-08-23 深圳大学 A kind of quantum searching method, system, electronic device and storage medium
US10637480B1 (en) * 2019-04-25 2020-04-28 International Business Machines Corporation Multi-control quantum state inversion gate
CN112182494A (en) * 2020-09-27 2021-01-05 中国人民解放军战略支援部队信息工程大学 Integer decomposition optimization method and system based on Grover quantum computing search algorithm

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ZIJIAN DIAO ET AL.: "A Quantum Circuit Design for Grover‘s Algorithm", 《ZEITSCHRIFT FÜR NATURFORSCHUNG A》, vol. 57, no. 8, 2 June 2014 (2014-06-02), pages 701 - 708 *
刘晓楠 等: "Grover算法改进与应用综述", vol. 48, no. 10, 31 October 2021 (2021-10-31), pages 315 - 323 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118014095A (en) * 2024-04-10 2024-05-10 国开启科量子技术(安徽)有限公司 Distributed multi-target quantum search method, device, medium and equipment
CN118014095B (en) * 2024-04-10 2024-08-13 国开启科量子技术(安徽)有限公司 Distributed multi-target quantum search method, device, medium and equipment

Also Published As

Publication number Publication date
CN116136968B (en) 2024-06-21

Similar Documents

Publication Publication Date Title
Chatterjee Concentration inequalities with exchangeable pairs
CN114072817B (en) Quantum circuit optimization method and system
US8407560B2 (en) Systems and methods for encoding information for storage in an electronic memory and for decoding encoded information retrieved from an electronic memory
US20190354316A1 (en) Effective Quantum RAM Architecture for Quantum Database
CN117454994A (en) Magic state purification with low space overhead and asymptotic input counting
CN113032580B (en) Associated file recommendation method and system and electronic equipment
US20020169563A1 (en) Linear and non-linear genetic algorithms for solving problems such as optimization, function finding, planning and logic synthesis
US11887002B2 (en) Method of generating data by using artificial neural network model having encoder-decoder structure
US20230080222A1 (en) Quantum state preparation circuit generating method and superconducting quantum chip
CN116136968B (en) Quantum circuit optimization method of Grover algorithm and related device
Okeke et al. Approximation of the Fixed Point of Multivalued Quasi‐Nonexpansive Mappings via a Faster Iterative Process with Applications
CN115982310B (en) Chain table generation method with verification function and electronic equipment
Schuld et al. Representing data on a quantum computer
Goles et al. Communication complexity and intrinsic universality in cellular automata
Miller et al. A quantum Hopfield associative memory implemented on an actual quantum processor
Edelman et al. Some new results on the maximum growth factor in Gaussian elimination
Chaurra-Gutierrez et al. QIST: One-dimensional quantum integer wavelet S-transform
Smith et al. Faster variational quantum algorithms with quantum kernel-based surrogate models
US20240275601A1 (en) Systems And Methods For State Minimization And Unlinkable Transactions
Blum Minimum common string partition: on solving large‐scale problem instances
Chatterjee Concentration inequalities with exchangeable pairs (Ph. D. thesis)
Hong et al. Equivalence Checking of Parameterised Quantum Circuits
US20240037433A1 (en) Method and device for constructing quantum circuit of qram architecture, and method and device for parsing quantum address data
Levy-dit-Vehel et al. A framework for the design of secure and efficient proofs of retrievability
Hsieh et al. Unconditionally separating noisy $\mathsf {QNC}^ 0$ from bounded polynomial threshold circuits of constant depth

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

Country or region after: China

Address after: 230000, floor 6, E2 building, phase II, innovation industrial park, No. 2800, innovation Avenue, high tech Zone, Hefei, Anhui Province

Applicant after: Benyuan Quantum Computing Technology (Hefei) Co.,Ltd.

Address before: 230000, floor 6, E2 building, phase II, innovation industrial park, No. 2800, innovation Avenue, high tech Zone, Hefei, Anhui Province

Applicant before: ORIGIN QUANTUM COMPUTING COMPANY, LIMITED, HEFEI

Country or region before: China

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant