Amplitude coding quantum circuit construction method and related device

Through cascade angle coding and variable component quantum state compression, the decoherence problem caused by amplitude coding is solved, and the ability to represent larger-sized pictures on quantum computers is realized.

CN119250211AActive Publication Date: 2025-01-03ORIGIN QUANTUM COMPUTING TECH (HEFEI) CO LTD

Patent Information

Application Number
CN202411202020.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2025-01-03
Estimated Expiration
2044-08-29

AI Technical Summary

Technical Problem

In the prior art, amplitude encoding can easily lead to decoherence problems on quantum computers and cannot effectively represent larger-sized image data.

Method used

Through cascading angle encoding and variable component quantum state compression, amplitude encoding is simulated using a variational encoder to reduce line depth, a quantum circuit including the first qubit and the second qubit is constructed, and quantum circuits are optimized for encoder parameters using SWAP to test quantum circuits , gradually encode classical data into quantum superposition state.

Benefits of technology

This alleviates the decoherence problem caused by amplitude coding and realizes the ability to represent larger-sized pictures on quantum computers at this stage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119250211A_ABST
    Figure CN119250211A_ABST
Patent Text Reader

Abstract

The invention discloses an amplitude coding quantum circuit construction method and a related device, and the method comprises the steps: obtaining a data value group which comprises a plurality of data values; the method comprises the following steps: constructing a first quantum circuit comprising a first quantum bit and a second quantum bit, the first quantum circuit comprising a plurality of first quantum revolving doors sequentially acting on the first quantum bit and a logic gate combination of a variational encoder simultaneously acting on the first quantum bit and the second quantum bit, each first quantum revolving door is used for encoding a data value in an angle encoding mode to obtain an input quantum state under the condition that the first quantum bit is a ground state, and each variational encoder is used for compressing the input quantum state in the corresponding logic gate combination to a second quantum bit. Compared with the prior art, the variational encoder is adopted to simulate amplitude coding, the line depth is reduced, and therefore the problem that decoherence is likely to be caused by amplitude coding on a real quantum computer is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of quantum computing bases, and in particular to an amplitude-coded quantum circuit construction method and related devices. Background Art

[0002] Due to the superposition property of quantum bits, N quantum bits can store 2 N Classical bits are used to store and represent information, which will greatly save storage space and computing power. As a method of representing information, images are intuitive and rich in content, but massive image data requires ultra-large storage and ultra-large computing power. Storage based on classical bits is difficult to cope with the current massive increase in image data. Quantum bits are expected to solve the bottleneck problems of storage and computing faced by massive image data. Amplitude coding can encode pixel values ​​into the amplitude of the quantum state, which can reduce storage space exponentially. However, amplitude coding often requires a large number of multi-bit control gates. The decomposition of multi-bit control gates will produce a large number of single-bit control gates, which greatly increases the circuit depth and makes it easy to decoherence when running on a real machine. Therefore, on current quantum computers, amplitude coding can often only represent smaller-sized images, but not larger-sized images. Summary of the invention

[0003] The purpose of the present invention is to provide a method for constructing an amplitude-coded quantum circuit and a related device to solve the technical problems in the prior art. The method can solve the problem that amplitude coding easily leads to decoherence on a real quantum computer and realize the representation of larger-sized images on current quantum computers.

[0004] In a first aspect, the present invention provides a method for constructing an amplitude-coded quantum circuit, the method comprising: Acquire a data value group, wherein the data value group has a plurality of data values; A first quantum circuit including a first quantum bit and a second quantum bit is constructed, wherein the first quantum circuit includes a plurality of first quantum rotating gates acting on the first quantum bit in sequence and a logic gate combination of a variational encoder acting on the first quantum bit and the second quantum bit simultaneously, wherein each first quantum rotating gate is used to encode a data value by angle encoding to obtain an input quantum state when the first quantum bit is in a ground state, and each variational encoder is used to compress the input quantum state in the corresponding logic gate combination to the second quantum bit.

[0005] A method for constructing an amplitude-coded quantum circuit as described above, wherein preferably, the variational encoder includes a plurality of CNOT gates and a plurality of second quantum rotation gates arranged in sequence along an action sequence, the CNOT gate acts on adjacent quantum bits of the first quantum bit and the second quantum bit, the control quantum bit of the CNOT gate is a high-order quantum bit adjacent to the acted quantum bit, and the second quantum rotation gate acts on each quantum bit of the first quantum bit and the second quantum bit.

[0006] In the method for constructing an amplitude-coded quantum circuit as described above, preferably, the first quantum rotation gate includes one or more of a first RX gate, a first RY gate and the first RZ gate, and the second quantum rotation gate includes one or more of a second RX gate, a second RY gate and the second RZ gate.

[0007] In the method for constructing an amplitude-coded quantum circuit as described above, preferably, the first quantum circuit also includes a third quantum bit encoding a plurality of the data values ​​by amplitude coding, wherein the number of the third quantum bits is the same as the number of the second quantum bits.

[0008] The method for constructing an amplitude-coded quantum circuit as described above, wherein preferably, the method further comprises: The SWAP test quantum circuit is used to compare the quantum states of the second quantum bit and the third quantum bit.

[0009] A method for constructing an amplitude-coded quantum circuit as described above, wherein, preferably, the SWAP test quantum circuit includes a fourth quantum bit, the second quantum bit and the third quantum bit of the corresponding weight, an H gate acting in sequence, a plurality of controlled SWAP gates, an H gate and a measurement gate; wherein: the H gate and the measurement gate act on the fourth quantum bit, and the plurality of controlled SWAP gates use the fourth quantum bit as the control quantum bit and act in sequence on the third quantum bit at different weight positions and the second quantum bit of the corresponding weight of the third quantum bit.

[0010] The method for constructing an amplitude-coded quantum circuit as described above, wherein preferably, the method further comprises: Constructing a training data set and a test data set, setting the number of batches, each batch including at least one of the data value groups, sending multiple data value groups in the same batch one by one into the first quantum circuit to calculate the loss value, and each data value group generates a loss value; Sum up multiple loss values ​​within a batch to get the average loss value within a batch; Performing back propagation calculation according to the average loss value to obtain the gradient value of each of the second quantum rotation gates, and updating the rotation control parameters of the second quantum rotation gate according to the gradient value, thereby completing a batch of training; The above process is iterated until the loss value is lower than the set threshold or the set number of iterations is reached, and the training process is completed to determine the parameter weights in the variational encoder.

[0011] In a second aspect, the present invention provides a quantum circuit construction device, the device comprising: An acquisition module, used for acquiring a data value group, wherein the data value group has a plurality of data values; A first quantum circuit construction module is used to construct a first quantum circuit including a first quantum bit and a second quantum bit. The first quantum circuit includes a logic gate combination of a plurality of first quantum rotary gates acting on the first quantum bit in sequence and a variational encoder acting on the first quantum bit and the second quantum bit simultaneously. Each first quantum rotary gate is used to encode a data value by angle encoding to obtain an input quantum state when the first quantum bit is in a ground state, and each variational encoder is used to compress the input quantum state in the corresponding logic gate combination to the second quantum bit.

[0012] In a third aspect, the present invention provides a storage medium storing a computer program, wherein the computer program is configured to execute the aforementioned method when run.

[0013] In a third aspect, the present invention provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the aforementioned method.

[0014] Compared with the prior art, the present invention gradually encodes classical data into a quantum superposition state through cascaded angle coding and variational quantum state compression, and uses a variational encoder to simulate amplitude coding to reduce the circuit depth, thereby alleviating the problem that amplitude coding easily causes decoherence on a real quantum computer, and realizing the representation of larger-sized images on current quantum computers. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 is a network block diagram of a quantum circuit construction system provided in an embodiment of the present application; Figure 2 It is a flow chart of a method for constructing an amplitude-coded quantum circuit provided in an embodiment of the present application; Figure 3 This is a schematic diagram of cascade angle coding in the quantum circuit construction method provided in the embodiment of the present application; Figure 4 is a schematic diagram of a variational encoder provided in an embodiment of the present application; Figure 5 This is a schematic diagram of an angle tree when a quantum circuit amplitude encodes 4 data values ​​provided in an embodiment of the present application; Figure 6 1 is a schematic diagram of a quantum circuit when the quantum circuit amplitude encodes 4 data values ​​provided in an embodiment of the present application; Figure 7 It is a schematic diagram of a SWAP test quantum circuit in the quantum circuit construction method provided in an embodiment of the present application; Figure 8 A flow chart of a parameter training method for a variational encoder provided in an embodiment of the present application; Fig. 9 A schematic diagram of the structure of a quantum circuit construction device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0017] [Structure of quantum circuit construction system] Figure 1 1 is a network block diagram of a quantum circuit construction system provided in an embodiment of the present application. The quantum circuit construction system may include a network 110, a server 120, a wireless device 130, a client 140, a storage unit 150, a classical processing system 160, a quantum processing system 170, and may also include additional memories, classical processors, quantum processors, and other devices not shown.

[0018] The network 110 is a medium for providing communication links between various devices and computers connected together in the quantum circuit construction system, including but not limited to the Internet, corporate intranet, local area network, mobile communication network and their combination. The connection method can be wired, wireless communication links or optical fiber cables.

[0019] The server 120 and the client 140 are conventional data processing systems that may contain data and applications or software tools that perform conventional computing processes. The client 140 may be a personal computer or a network computer, so the data may also be provided by the server 120. The wireless device 130 may be a smart phone, a tablet, a laptop, a smart wearable device, etc. The storage unit 150 may include a database 151, which may be configured to store data such as quantum bit parameters, quantum logic gate parameters, quantum circuits, quantum programs, etc.

[0020] The classical processing system 160 (quantum processing system 170) may include a classical processor 161 (quantum processor 171) for processing classical data (quantum data) and a memory 163 (memory 172) for storing classical data (quantum data). The classical data (quantum data) may be a boot file, an operating system image, and an application 162 (application 173). The application 162 (application 173) may be used to implement a quantum algorithm compiled according to the quantum circuit construction method provided in an embodiment of the present application.

[0021] Any data or information stored or generated in the classical processing system 160 (quantum processing system 170) may also be configured to be stored or generated in another classical (quantum) processing system in a similar manner, and any application program executed therein may also be configured to be executed in another classical (quantum) processing system in a similar manner.

[0022] It should be noted that a true quantum computer is a hybrid structure, which includes at least Figure 1 There are two major parts in it: the classical processing system 160, which is responsible for performing classical calculations and control; and the quantum processing system 170, which is responsible for running quantum programs and thus realizing quantum calculations.

[0023] The classical processing system 160 and the quantum processing system 170 may be integrated into one device or distributed in two different devices. For example, the first device including the classical processing system 160 runs a classical computer operating system, on which quantum application development tools and services are provided, as well as storage and network services required for quantum applications. Users develop quantum applications through the quantum application development tools and services thereon, and send quantum programs to the second device including the quantum processing system 170 through the network services thereon. The second device runs a quantum computer operating system, parses the code of the quantum program through the quantum computer operating system, and compiles it into instructions that can be recognized and executed by the quantum computer measurement and control system. The quantum processor 170 implements the quantum algorithm corresponding to the quantum program according to the instructions.

[0024] In the classic processing system 160 based on silicon chips, the unit of the classic processor 161 is a CMOS tube. This computing unit is not limited by time and coherence, that is, this computing unit is not limited by the length of use and can be used at any time. In addition, in the silicon chip, the number of such computing units is also sufficient. At present, the number of computing units in a classic processor is tens of thousands. The number of computing units is sufficient and the computing logic that can be selected by the CMOS tube is fixed, for example: AND logic. When calculating with the help of CMOS tubes, a large number of CMOS tubes are combined with limited logic functions to achieve the calculation effect.

[0025] Unlike the logic unit in the classical processing system 160, the basic computing unit of the quantum processor 171 in the quantum processing system 170 is a quantum bit. The input of the quantum bit is limited by coherence and coherence time, that is, the quantum bit is limited by the duration of use and is not available at any time. Making full use of the quantum bit within the available duration of use of the quantum bit is a key problem in quantum computing. In addition, the number of quantum bits in a quantum computer is one of the representative indicators of the performance of the quantum computer. Each quantum bit realizes the computing function through the logical function configured on demand. In view of the limited number of quantum bits, the logical functions in the field of quantum computing are diverse, such as: Hadamard gate (H gate), Pauli-X gate (X gate), Pauli-Y gate (Y gate), Pauli-Z gate (Z gate), RX gate, RY gate, RZ gate, CR gate, CR gate, iSWAP gate, Toffoli gate, etc. In quantum computing, it is necessary to use limited quantum bits combined with a variety of logical function combinations to achieve the computing effect.

[0026] Based on these differences, the design of the logical function on the quantum bit (including the design of whether the quantum bit is used and the design of the efficiency of each quantum bit) is the key to improving the computing performance of quantum computers, and requires special design. The above-mentioned design for quantum bits is a technical problem that ordinary computing devices do not need to consider or face.

[0027]

Amplitude-coded quantum circuit construction method

[0028] Step S102: Refer to Figure 3As shown, a first quantum circuit including a first quantum bit and a second quantum bit is constructed. The number of the first quantum bit and the second quantum bit can be determined as needed and is not limited here. The first quantum circuit includes a plurality of first quantum rotating gates acting on the first quantum bit in sequence and a logic gate combination of a variational encoder acting on the first quantum bit and the second quantum bit simultaneously. Each first quantum rotating gate is used to encode a data value by angle encoding to obtain an input quantum state when the first quantum bit is in a ground state, and each variational encoder is used to compress the input quantum state in the corresponding logic gate combination to the second quantum bit.

[0029] Multiple data values ​​are encoded sequentially into the quantum state of the first quantum bit by means of angle encoding, thereby establishing a connection between the data values ​​in the data value group and the first quantum circuit, so that the first quantum bit contains relevant information of the data values. In the embodiment provided in the present application, a connection is established between the pixel value information of the pixel points of the image and the first quantum bit, so that the first quantum bit contains the pixel value information of each pixel point.

[0030] In a feasible implementation, the first quantum bit is set to one, and multiple data values ​​are encoded onto the first quantum bit in sequence in a linearly ordered manner. Before each data value is encoded, the first quantum bit is restored to a ground state. There are many ways to reset the first quantum bit to a ground state, such as by measuring and then returning to the ground state.

[0031] Along the action sequence, after a data value is encoded into the quantum state of the first quantum bit, the quantum state information is associated through the variational encoder and the quantum state information on the first quantum bit is compressed to the second quantum bit. The first quantum bit is then restored to the ground state, and the next data value is encoded until the quantum state information of all data values ​​is compressed into the second quantum bit.

[0032] Based on the amplitude-coded quantum circuit construction method provided in the above embodiment, classical data is gradually encoded into the quantum superposition state through cascaded angle coding and variational quantum state compression, and a variational encoder is used to simulate amplitude coding to reduce the circuit depth, thereby alleviating the problem that amplitude coding is prone to decoherence on a real quantum computer, and achieving the representation of larger-sized images on current quantum computers.

[0033] In the embodiment provided by the present invention, each variational encoder corresponds to a first quantum rotating gate setting, referring to Figure 4 As shown, the variational encoder includes multiple variational modules arranged in sequence along the action sequence. The variational modules are repeated multiple times to increase the depth of evolution and thus increase the number of parameters, thereby enhancing the expressive power of the model, capturing complex features and improving the entanglement of the quantum state.

[0034] Each variational module includes multiple CNOT gates and multiple second quantum rotation gates. The CNOT gate is located before the action timing of the second quantum rotation gate. There are multiple second quantum bits. The first quantum bit is located at the high position of all second quantum bits. The CNOT gate acts on the adjacent quantum bits of the first quantum bit and the second quantum bit. The control quantum bit of the CNOT gate is the high-position quantum bit adjacent to the quantum bit it acts on. The CNOT gate is a two-qubit controlled NOT gate. The CNOT gate is used to construct the entanglement relationship between quantum bits to form multi-qubit entanglement. The second quantum rotation gate acts on each quantum bit of the first quantum bit and the second quantum bit.

[0035] In a feasible implementation manner, the first quantum rotating gate is a single-qubit rotating gate, including one or more of a first RX gate, a first RY gate, and a first RZ gate. After the first quantum rotating gate operation is performed, only the amplitude of the quantum state changes, and the data value is used as the rotation control parameter of the first quantum rotating gate. Preferably, the first quantum rotating gate is a first RY gate, and the rotation control parameter of the first RY gate is , x is the data value to be encoded by the first quantum bit.

[0036] The second quantum rotating gate is also a single-qubit rotating gate. The second quantum rotating gate includes one or more of a second RX gate, a second RY gate and a second RZ gate. Preferably, the second quantum rotating gate is a second RY gate. The rotation control parameters of the second quantum rotating gate are not fixed in advance, and they need to be updated in the subsequent training optimization process.

[0037] Furthermore, the amplitude-coded quantum circuit construction method further includes the following steps: Step S103: Encode multiple data values ​​into the quantum state of the third quantum bit by amplitude coding.

[0038] In the process of constructing the first quantum circuit in step S102, the first quantum circuit further includes a third quantum bit encoding multiple data values ​​by amplitude coding, wherein the number of the third quantum bits is the same as the number of the second quantum bits.

[0039] The amplitude encoding process of step S103 includes two stages. The first stage is to pre-process multiple data values ​​to process them into target data that meets the requirements of amplitude encoding. For example, multiple data values ​​in a data value group are normalized, zero-filled, etc. to obtain the target data. The second stage is to construct an angle tree corresponding to the target data according to the target data, and encode the nodes on the angle tree corresponding to the target data into component quantum circuits respectively to combine the quantum states in the quantum circuits, and output the input quantum state of the encoded quantum circuit.

[0040] Among them: Amplitude coding requires the input data to be normalized in order to achieve the purpose of encoding the data value group into the amplitude of the quantum state, and also requires that the number of data values ​​in the data value group is N = 2 n If the number of data values ​​does not meet 2 n In the form of , it is necessary to fill it with zeros to increase the number of its elements. Therefore, it is necessary to pre-process multiple data values ​​in the data value group to obtain 2 n target data, where n is a positive integer to meet the encoding conditions of amplitude coding.

[0041] By performing preprocessing such as normalization and zero padding on multiple data values ​​in the data value group, multiple data values ​​in the data value group can meet the encoding conditions of amplitude coding, which is conducive to ensuring the subsequent effective amplitude coding.

[0042] After normalizing multiple data values ​​to get 2 n After the target data, according to 2 n The target data is used to construct the angle tree corresponding to the target data. In a feasible implementation, the data value is encoded on the third quantum bit using a top-down encoding method. The 2 at the bottom of the angle tree n The first node and 2 n The target data correspond one to one, and every two adjacent first nodes have one parent node.

[0043] In a feasible implementation mode, first RGB image Flatten to Dimensional vector , then Dimensional vector Perform normalization to obtain , so that The sum of the squares is equal to 1, and the calculation is shown in formula 1;

[0044] Then use amplitude coding to encode Dimensional vector , as shown in Formula 2:

[0045] in, represents the encoded superposition quantum state, Indicates quantum states, Indicates The amplitude of a quantum state.

[0046] Reference Figure 5 as well as Figure 6For example, if there are 4 data values ​​in the data value group, the 4 data values ​​are recorded as , , and , which corresponds to the 4 first nodes at the bottom of the angle tree. The 4 first nodes correspond to 2 second nodes above. Each second node has 2 first nodes as child nodes. The 2 second nodes correspond to 1 root node above. Set the value in the root node box to , the values ​​in the boxes of the two second nodes are as well as , The corresponding values ​​in the first node box are and , The corresponding values ​​in the first node box are and .

[0047] Correspondingly, the third qubit has two, namely, a low-order qubit and a high-order qubit, and four data values ​​are encoded on these two third qubits. Specifically, along the action sequence, a third RY gate is applied to the high-order qubit, and two controlled RY gates are applied to the low-order qubit and the high-order qubit, respectively. The controlled RY gate uses the RY gate as the target gate, and its application depends on the state of one or more control qubits. In this embodiment, the control qubit of the controlled RY gate is the high-order qubit, and the target gate is located on the low-order qubit. When the RY gate is used as a controlled gate, the state of the control qubit will determine whether the effect of the RY gate is applied to the target qubit. If the control qubit is in the |1> state, the RY gate will be applied; if the control qubit is in the |0> state, the target qubit remains unchanged.

[0048] Specifically, the high-order quantum bit is rotated by the first angle toward the y-axis to obtain RY ( ), rotate the low-order quantum bit to the y-axis by a second angle, and get RY ( ), rotate the low-order quantum bit to the y-axis by a third angle, and get RY ( ).

[0049] Furthermore, the amplitude-coded quantum circuit construction method further includes the following steps: Step S104: using the SWAP test quantum circuit to compare the quantum states of the second quantum bit and the third quantum bit.

[0050] In the embodiment provided by the present invention, the similarity (fidelity) of the quantum states of the second quantum bit and the third quantum bit output by the SWAP test quantum circuit is used to measure the difference between the two. By calculating the loss value between the two, the parameters of the variational encoder are optimized by back propagation iterative update based on the loss value. When the loss value is lower than the set threshold or reaches the set number of iterations, the training of the variational encoder is completed, and the parameter weights in the variational encoder are determined.

[0051] In a feasible implementation mode, referring to Figure 7 As shown, the SWAP test quantum circuit includes a fourth quantum bit, a second quantum bit and a third quantum bit of corresponding weight, an H gate acting in sequence, a plurality of controlled SWAP gates, an H gate and a measurement gate; wherein: the H gate and the measurement gate act on the fourth quantum bit, and the plurality of controlled SWAP gates use the fourth quantum bit as the control quantum bit and act in sequence on the third quantum bit at different weight positions and the second quantum bit of the weight corresponding to the third quantum bit.

[0052] A fourth qubit is configured in the SWAP test quantum circuit, and the fidelity of the quantum state of the second and third qubits is obtained by measuring the fourth qubit, and the fidelity is used as the loss value. This test method only requires measuring one fourth qubit at a time, and does not require measuring multiple qubits, thus saving quantum resources.

[0053] By running the first quantum circuit The fourth qubit is measured and the quantum state is counted. Number of , Formula 3 is the loss function. The smaller the value of S is, the closer the quantum state is, that is, the more successful the quantum state simulation is.

[0054]

[0055] Reference Figure 8 As shown, in the embodiment provided by the present invention, the parameter training method of the variational encoder includes: Step S1041: construct a training data set and a test data set, set the number of batches, each batch includes at least one data value group, and send multiple data value groups in the same batch one by one into the first quantum circuit to calculate the loss value, and each data value group generates a loss value ; Step S1042: Sum multiple loss values ​​in a batch to obtain the average loss value in the batch , the calculation formula is shown in Formula 4;

[0056] Step S1043: performing back propagation calculation according to the average loss value to obtain the gradient value of each second quantum rotation gate, and sending the gradient value to the Adam optimizer, which is used to update the rotation control parameters of the second quantum rotation gate, thereby completing a batch of training; Step S1044: Iterate the above process until the loss value is lower than the set threshold or reaches the set number of iterations, completing the training process, determining the parameter weights in the variational encoder, and obtaining the desired variational encoder.

[0057] [Structure of quantum circuit construction device] See also Fig. 9 As shown, the quantum circuit construction device includes: An acquisition module, used for acquiring a data value group, wherein the data value group has a plurality of data values; A first quantum circuit construction module is used to construct a first quantum circuit including a first quantum bit and a second quantum bit. The first quantum circuit includes a logic gate combination of a plurality of first quantum rotating gates acting on the first quantum bit in sequence and a variational encoder acting on the first quantum bit and the second quantum bit simultaneously. Each first quantum rotating gate is used to encode a data value by angle encoding to obtain an input quantum state when the first quantum bit is in a ground state, and each variational encoder is used to compress the input quantum state in the corresponding logic gate combination to the second quantum bit.

[0058] Furthermore, the quantum circuit construction module is also used to construct a third quantum bit, and the first quantum circuit also includes a third quantum bit that encodes multiple data values ​​by amplitude coding.

[0059] Furthermore, the quantum circuit construction device also includes a SWAP test quantum circuit construction module, which is used to construct a SWAP test quantum circuit, and use the SWAP test quantum circuit to compare the quantum states of the second quantum bit and the third quantum bit.

[0060] The SWAP test quantum circuit includes a fourth quantum bit, a second quantum bit and a third quantum bit of corresponding weight, an H gate acting in sequence, multiple controlled SWAP gates, an H gate and a measurement gate; wherein: the H gate and the measurement gate act on the fourth quantum bit, and the multiple controlled SWAP gates use the fourth quantum bit as the control quantum bit and act in sequence on the third quantum bit at different weight positions and the second quantum bit of the weight corresponding to the third quantum bit.

[0061]

Storage medium structure

[0062] Specifically, in this embodiment, the above storage medium may be configured to store a computer program for implementing the following steps: S101: Acquire a data value group, wherein the data value group has a plurality of data values.

[0063] S102: Construct a first quantum circuit including a first quantum bit and a second quantum bit, wherein the first quantum circuit includes a plurality of first quantum rotary gates acting on the first quantum bit in sequence and a logic gate combination of a variational encoder acting on the first quantum bit and the second quantum bit simultaneously, wherein each first quantum rotary gate is used to encode a data value by angle encoding to obtain an input quantum state when the first quantum bit is in a ground state, and each variational encoder is used to compress the input quantum state in the corresponding logic gate combination to the second quantum bit.

[0064] S103: Encode multiple data values ​​into the quantum state of the third quantum bit by amplitude coding.

[0065] S104: Using the SWAP test quantum circuit to compare the quantum states of the second quantum bit and the third quantum bit.

[0066]

Structure of electronic devices

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

[0068] Specifically, in this embodiment, the processor may be configured to implement the following steps through a computer program: S101: Acquire a data value group, wherein the data value group has a plurality of data values.

[0069] S102: Construct a first quantum circuit including a first quantum bit and a second quantum bit, wherein the first quantum circuit includes a plurality of first quantum rotary gates acting on the first quantum bit in sequence and a logic gate combination of a variational encoder acting on the first quantum bit and the second quantum bit simultaneously, wherein each first quantum rotary gate is used to encode a data value by angle encoding to obtain an input quantum state when the first quantum bit is in a ground state, and each variational encoder is used to compress the input quantum state in the corresponding logic gate combination to the second quantum bit.

[0070] S103: Encode multiple data values ​​into the quantum state of the third quantum bit by amplitude coding.

[0071] S104: Using the SWAP test quantum circuit to compare the quantum states of the second quantum bit and the third quantum bit.

[0072] The above describes in detail the structure, features and effects of the present invention based on the embodiments shown in the drawings. The above is only a preferred embodiment of the present invention, but the present invention is not limited to the scope of implementation shown in the drawings. Any changes made according to the concept of the present invention, or modifications to equivalent embodiments with equivalent changes, which still do not exceed the spirit covered by the description and drawings, should be within the protection scope of the present invention.

Claims

1. A method for constructing an amplitude-coded quantum circuit, characterized in that: The method comprises: Acquire a data value group, wherein the data value group has a plurality of data values; A first quantum circuit including a first quantum bit and a second quantum bit is constructed, wherein the first quantum circuit includes a plurality of first quantum rotating gates acting on the first quantum bit in sequence and a logic gate combination of a variational encoder acting on the first quantum bit and the second quantum bit simultaneously, wherein each first quantum rotating gate is used to encode a data value by angle encoding to obtain an input quantum state when the first quantum bit is in a ground state, and each variational encoder is used to compress the input quantum state in the corresponding logic gate combination to the second quantum bit.

2. The method according to claim 1, characterized in that: The variational encoder includes a plurality of CNOT gates and a plurality of second quantum rotation gates which are sequentially arranged along an action sequence. The CNOT gate acts on adjacent quantum bits of the first quantum bit and the second quantum bit. The control quantum bit of the CNOT gate is a high-order quantum bit adjacent to the acted quantum bit. The second quantum rotation gate acts on each quantum bit of the first quantum bit and the second quantum bit.

3. The method according to claim 1, characterized in that: The first quantum rotating gate includes one or more of a first RX gate, a first RY gate, and the first RZ gate, and the second quantum rotating gate includes one or more of a second RX gate, a second RY gate, and the second RZ gate.

4. The method according to claim 1, characterized in that: The first quantum circuit further includes a third quantum bit encoding a plurality of the data values ​​by amplitude coding, wherein the number of the third quantum bits is the same as the number of the second quantum bits.

5. The method according to claim 4, characterized in that: The method further comprises: The SWAP test quantum circuit is used to compare the quantum states of the second quantum bit and the third quantum bit.

6. The method according to claim 5, characterized in that The SWAP test quantum circuit includes a fourth quantum bit, the second quantum bit and the third quantum bit of the corresponding weight, an H gate acting in sequence, a plurality of controlled SWAP gates, an H gate and a measurement gate; wherein: the H gate and the measurement gate act on the fourth quantum bit, and the plurality of controlled SWAP gates use the fourth quantum bit as the control quantum bit and act in sequence on the third quantum bit at different weight positions and the second quantum bit of the weight corresponding to the third quantum bit.

7. The method according to claim 6, characterized in that The method further comprises: Constructing a training data set and a test data set, setting the number of batches, each batch including at least one of the data value groups, sending multiple data value groups in the same batch one by one into the first quantum circuit to calculate the loss value, and each data value group generates a loss value; Sum up multiple loss values ​​within a batch to get the average loss value within a batch; Performing back propagation calculation according to the average loss value to obtain the gradient value of each of the second quantum rotation gates, and updating the rotation control parameters of the second quantum rotation gate according to the gradient value, thereby completing a batch of training; The above process is iterated until the loss value is lower than the set threshold or the set number of iterations is reached, and the training process is completed to determine the parameter weights in the variational encoder.

8. A quantum circuit construction device, characterized in that: The device comprises: An acquisition module, used for acquiring a data value group, wherein the data value group has a plurality of data values; A first quantum circuit construction module is used to construct a first quantum circuit including a first quantum bit and a second quantum bit. The first quantum circuit includes a logic gate combination of a plurality of first quantum rotary gates acting on the first quantum bit in sequence and a variational encoder acting on the first quantum bit and the second quantum bit simultaneously. Each first quantum rotary gate is used to encode a data value by angle encoding to obtain an input quantum state when the first quantum bit is in a ground state, and each variational encoder is used to compress the input quantum state in the corresponding logic gate combination to the second quantum bit.

9. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 7 when executed.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and system for encoding a dataset in a quantum circuit for quantum machine learning

    CA3218749A1

  • Classification method based on machine learning framework and related device

    CN114358318A

  • Multi-classification method and device based on variable component calculation

    CN116756663A

  • A quantum neural network for noisy intermediate scale quantum devices

    WO2023287333A1

Cited By

  • Quantum state preparation method and device based on sparse real vector, medium and equipment

    CN119416902A

  • Quantum state amplitude coding method, device, equipment and medium

    CN119783842A

  • Quantum variation circuit, data processing method and device, medium and equipment

    CN119808973A