Quantum circuit construction method based on concatenated variational quantum state compression and related device
By using the cascaded variable quantum state compression method, local features of classical data are gradually extracted into quantum superposition states, solving the problems of the number of qubits and coherence time limitations in quantum computers and realizing efficient quantum computing.
Patent Information
- Application Number
- CN202411203825.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2044-08-30
AI Technical Summary
At present, quantum computers are limited by the number of bits and coherence time, making it difficult to effectively handle the storage and computing needs of massive image data.
A cascaded variable quantum state compression method is adopted to extract local features of classical data into quantum superposition states step by step through angle coding and variational encoder. The first quantum bit is reused by quantum state reset to construct quantum circuits to solve real-world problems.
This technology effectively reduces the number of qubits required on existing NISQ devices, improves locality and interpretability, reduces the number of measurements, and enables efficient quantum computing.
Smart Images

Figure CN119272885B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of quantum computing technology, and in particular to a method and apparatus for constructing quantum circuits based on cascaded variable quantum state compression. Background Technology
[0002] Due to the superposition property of qubits, N qubits can store 2^N qubits. N Using qubits for information storage and representation, instead of classical bits, will significantly save storage space and computing power. Images, as a method of information representation, are intuitive and rich in content; however, massive amounts of image data require enormous storage and computing power, and storage based on classical bits is insufficient to cope with the current surge in image data. Qubits hold promise for solving the storage and computational bottlenecks faced by massive image data.
[0003] However, current quantum computers are often unable to handle real-world tasks due to limitations in the number of qubits and coherence time. Summary of the Invention
[0004] The purpose of this invention is to provide a quantum circuit construction method and related device based on cascaded variable quantum state compression to solve the technical problems in the prior art, so that the number of qubits is independent of the dimension of the original data, thereby providing a new approach to solving real-world problems using quantum neural networks on current NISQ devices.
[0005] In a first aspect, the present invention provides a method for constructing quantum circuits based on cascaded variable component quantum state compression, the method comprising:
[0006] Obtain datasets, each of which includes multiple sub-datasets, each containing multiple data values;
[0007] Construct a first quantum circuit including a first quantum bit and a second quantum bit. The first quantum circuit includes a combination of logic gates that act sequentially on the first quantum bit and a variational encoder that acts simultaneously on the first quantum bit and the second quantum bit.
[0008] The data values within multiple sub-data values are sequentially encoded into the quantum state of the first qubit using angle encoding.
[0009] After all data values within a subset of a dataset are encoded into the quantum state of the first qubit, this quantum state information is associated with a variational encoder and compressed onto the second qubit.
[0010] The first qubit is restored to its ground state, and then the data values in the next subset are encoded, until the quantum state information of the data values in all subsets is compressed into the second qubit;
[0011] The quantum state information of the second qubit is used as the input state to train the variational encoder, thereby determining the parameter weights in the variational encoder.
[0012] In the quantum circuit construction method based on cascaded variable component quantum state compression described above, preferably, each dataset includes multiple sub-datasets, each sub-dataset containing multiple data values, including:
[0013] The image is segmented to obtain several target regions. Each target region includes at least one pixel, and each pixel provides a data value. All data values within each target region are combined into a subset of the dataset.
[0014] The quantum circuit construction method based on cascaded variable component quantum state compression, as described above, preferably uses the first quantum rotation gate within each layer's action time to encode multiple data values within a subset of data to obtain the input quantum state by angle encoding when the first qubit is in the ground state, including:
[0015] The number of the first qubits is determined based on the number of pixels in the target region;
[0016] Along the action sequence, multiple first quantum rotation gates are applied to each first quantum bit. All data values in the same target region are encoded into the rotation control parameters of multiple first quantum rotation gates within the same action sequence. Data values in different target regions are encoded into the rotation control parameters of first quantum rotation gates within different action sequences.
[0017] In the quantum circuit construction method based on cascaded variable quantum state compression described above, preferably, the number of pixels in the target region is equal to the number of the first qubits.
[0018] In the quantum circuit construction method based on cascaded variational quantum state compression as described above, preferably, the variational encoder includes a plurality of CNOT gates and a plurality of second quantum rotation gates arranged sequentially along the action time sequence. The CNOT gates act on adjacent qubits in the first and second qubits, and the control bit of the CNOT gate is the higher-order qubit adjacent to the acted qubit. The second quantum rotation gates act on each of the first and second qubits.
[0019] In the quantum circuit construction method based on cascaded variable quantum state compression as described above, preferably, the first quantum rotation gate includes one or more of a first RX gate, a first RY gate, and a first RZ gate, and the second quantum rotation gate includes one or more of a second RX gate, a second RY gate, and a second RZ gate.
[0020] The quantum circuit construction method based on cascaded variable quantum state compression, as described above, preferably includes the step of using the quantum state information of the second qubit as an input state to train the variational encoder and determine the parameter weights in the variational encoder, comprising:
[0021] Construct training and test sets, set the batch size, select an optimizer and define a loss function. Each batch includes at least one of the datasets. Feed multiple datasets from the same batch into the first quantum circuit one by one to calculate the loss value. Each dataset generates a loss value.
[0022] The average loss value for a batch is obtained by summing multiple loss values within a batch.
[0023] The gradient value of each second quantum rotating gate is calculated by backpropagation based on the average loss value. The rotation control parameters of the second quantum rotating gate are updated based on this gradient value, thus completing the training of a batch.
[0024] The aforementioned process is repeated iteratively until the loss value can no longer be reduced, thus obtaining the final variational encoder.
[0025] In a second aspect, the present invention provides a quantum circuit construction apparatus, the apparatus comprising:
[0026] The acquisition module is used to acquire datasets, each of which includes multiple sub-datasets, each containing multiple data values;
[0027] The 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 combination of logic gates that act sequentially on the first quantum bit and a variational encoder that acts simultaneously on the first quantum bit and the second quantum bit.
[0028] An angle encoding module is used to sequentially encode the data values within multiple sub-data values into the quantum state of the first quantum bit using angle encoding.
[0029] The quantum state compression module is used to encode the quantum state of the first quantum bit after all the data values in a subset of the dataset have been encoded into the quantum state of the first quantum bit, and then to associate this quantum state information with the variational encoder and compress the quantum state information onto the second quantum bit to restore the first quantum bit to the ground state, and then to encode the data values in the next subset of the dataset, until the quantum state information of all the data values in the subset of the dataset has been compressed onto the second quantum bit;
[0030] Training module: Used to train the variational encoder by using the quantum state information of the second qubit as the input state, and to determine the parameter weights in the variational encoder.
[0031] Thirdly, the present invention provides a storage medium storing a computer program, wherein the computer program is configured to execute the aforementioned method at runtime.
[0032] Fourthly, the present invention provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the aforementioned method.
[0033] Compared with existing technologies, this invention extracts features from local regions of classical data into quantum superposition states through cascaded angle encoding and variable quantum state compression. Quantum state compression and feature extraction are integrated into one process. The first quantum bit is reused by quantum state reset, while the quantum features are preserved. This invention has the advantages of requiring fewer bits, good interpretability of locality, and fewer measurement attempts. Attached Figure Description
[0034] Figure 1 This is a network block diagram of a quantum circuit construction system provided in an embodiment of this application;
[0035] Figure 2 This is a flowchart of a quantum circuit construction method based on cascaded variable component quantum state compression provided in an embodiment of this application;
[0036] Figure 3 This is a schematic diagram of cascaded angle encoding in the quantum circuit construction method provided in the embodiments of this application;
[0037] Figure 4 This is a schematic diagram of a variational encoder provided in an embodiment of this application;
[0038] Figure 5 A flowchart illustrating the parameter training method for a variational encoder provided in this application embodiment;
[0039] Figure 6 This is a schematic diagram of a quantum circuit construction device provided in an embodiment of this application. Detailed Implementation
[0040] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0041] [Structure of a quantum circuit construction system]
[0042] Figure 1 This is a network block diagram of a quantum circuit construction system provided in an embodiment of this 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 memory, a classical processor, a quantum processor, and other devices not shown.
[0043] Network 110 is a medium used to provide communication links between various devices and computers connected together within a quantum circuit construction system, including but not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The connection method can be wired, wireless communication links, or fiber optic cables.
[0044] Server 120 and client 140 are conventional data processing systems that may contain data and applications or software tools that perform conventional computational processes. Client 140 may be a personal computer or a network computer, so the data may also be provided by server 120. Wireless device 130 may be a smartphone, tablet, laptop, smart wearable device, etc. Storage unit 150 may include database 151, which can be configured to store data such as qubit parameters, quantum logic gate parameters, quantum circuits, and quantum programs.
[0045] 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 program 162 (application program 173). The application program 162 (application program 173) may be used to implement a quantum algorithm compiled according to the quantum circuit construction method provided in the embodiments of this application.
[0046] Any data or information stored or generated in the classical processing system 160 (quantum processing system 170) can also be configured to be stored or generated in another classical (quantum) processing system in a similar manner, and any application executed therein can also be configured to be executed in another classical (quantum) processing system in a similar manner.
[0047] It should be noted that a true quantum computer has a hybrid structure, which includes at least... Figure 1 The system consists of two main parts: 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 computing.
[0048] The aforementioned classical processing system 160 and quantum processing system 170 can be integrated into a single device or distributed across two different devices. For example, the first device, including the classical processing system 160, runs a classical computer operating system that provides quantum application development tools and services, as well as the storage and network services required for quantum applications. Users develop quantum applications using the quantum application development tools and services on the second device and send the quantum program to the second device, including the quantum processing system 170, via the network services. The second device runs a quantum computer operating system, which parses the code of the quantum program and compiles it into instructions that can be recognized and executed by the quantum computer control system. The quantum processor 170 then implements the quantum algorithm corresponding to the quantum program based on these instructions.
[0049] In the classic silicon-based processing system 160, the units of the classic processor 161 are CMOS transistors. These computing units are not limited by time or coherence; that is, they are available at any time without time constraints. Furthermore, the number of these computing units in a silicon chip is sufficient; currently, a classic processor contains tens of thousands of computing units. The sufficient number of computing units and the fixed selectable computing logic of the CMOS transistors, such as AND logic, allow for computational efficiency through a combination of numerous CMOS transistors and limited logic functions.
[0050] Unlike the logic units in the classical processing system 160, the basic computational unit of the quantum processor 171 in the quantum processing system 170 is the qubit. The input of a qubit is limited by coherence and coherence time; that is, a qubit is limited by its available usage time and is not always readily available. Making full use of qubits within their available usage time is a key challenge in quantum computing. Furthermore, the number of qubits in a quantum computer is one of the representative indicators of its performance. Each qubit performs computational functions through on-demand configured logic functions. Given the limited number of qubits and the diverse logic functions available in quantum computing, such as Hadamard gates (H gates), Pauli-X gates (X gates), Pauli-Y gates (Y gates), Pauli-Z gates (Z gates), RX gates, RY gates, RZ gates, CR gates, iSWAP gates, Tofoli gates, etc., quantum computing requires combining a limited number of qubits with diverse combinations of logic functions to achieve computational effects.
[0051] Based on these differences, the design of logical functions applied to qubits (including the design of whether qubits are used and the design of the efficiency of each qubit's use) is crucial to improving the computational performance of quantum computers and requires specialized design. The aforementioned design considerations for qubits are technical issues that ordinary computing devices do not need to address.
[0052] A method for constructing quantum circuits based on cascaded variable component quantum state squeezing
[0053] like Figures 2 to 4 As shown, this invention provides a quantum circuit construction method based on cascaded variable component quantum state compression, used to encode classical data into a quantum superposition state. The method includes:
[0054] Step S101: Obtain a dataset. Each dataset includes multiple sub-datasets, and each sub-dataset contains multiple data values. In the embodiments provided by this invention, the data values come from the image data of pixels. The set of image data of all pixels in an image is the dataset. The image data of all pixels in an image is split into multiple parts, and the set of image data of each part is a sub-dataset.
[0055] In the embodiments provided by the present invention, the image is segmented to obtain several target regions. The image can be divided into multiple target regions according to longitude and latitude. Each target region includes at least one pixel. In this way, all pixels of the image are divided into multiple target regions arranged in a grid. The number of pixels in each target region corresponds to the number of first qubits mentioned later.
[0056] Each pixel provides its own pixel feature information. The values of the pixel feature information provided by different pixels can be the same or different, which is not limited here. Each pixel corresponds to a first qubit setting, thereby encoding the pixel feature information reflected by each pixel onto the quantum circuit where the corresponding first qubit is located.
[0057] Step S102: Construct a first quantum circuit including a first quantum bit and a second quantum bit. The first quantum circuit includes a combination of logic gates that act sequentially on the first quantum bit and a variational encoder that acts simultaneously on the first quantum bit and the second quantum bit.
[0058] The number of first qubits is determined based on the number of pixels in the target area. This number can be determined according to the number of qubits supported by the quantum device, and is generally less than or equal to the number of supported qubits. When the number of qubits supported by the quantum device is relatively large, the number of first qubits required for fabrication can be selected as appropriate.
[0059] In the embodiments provided by the present invention, the number of pixels in the target area is equal to the number of first qubits to reduce the complexity of the quantum circuit and the demand for quantum resources. Those skilled in the art will know that the structure of the circuit can also be optimized and the flexibility and efficiency of the quantum circuit can be improved by setting more auxiliary qubits, which is not limited here.
[0060] Step S103: With the first qubit in the ground state, the data values within multiple sub-data values are sequentially encoded into the quantum state of the first qubit using angle encoding.
[0061] Along the action sequence, multiple first quantum rotation gates are applied to each first quantum bit. All data values of the same target region (subdata set) are encoded into the rotation control parameters of multiple first quantum rotation gates within the same action sequence. Data values of different target regions are encoded into the rotation control parameters of first quantum rotation gates within different action sequences.
[0062] In one feasible implementation, an n-dimensional vector is taken. Target region d-dimensional vector Then for the d-dimensional vector Normalization operation is performed to obtain Make The calculation is shown in Formula 1;
[0063] x i =arctan(l i )#(1)
[0064] Angle coding is used to encode d-dimensional vectors. As shown in Formula 2:
[0065]
[0066] Where |ψ> represents the superposition quantum state after encoding, and |i> represents the i-th quantum state.
[0067] By using angle encoding, data values in different target areas are sequentially encoded into the quantum state of the first quantum bit, thereby establishing a connection between the data values in the target area and the first quantum circuit, allowing the first quantum bit to contain relevant information about the data values. In the embodiments provided in this application, the pixel feature information of the image pixels is linked to the first quantum bit, allowing the first quantum bit to contain the pixel feature information of each pixel.
[0068] Multiple target regions are linearly ordered, and multiple data values of a single target region are sequentially encoded into the first qubit. Before the next target region is encoded, the first qubit is restored to the ground state. There are many ways to reset the first qubit to the ground state, such as by measurement and then returning it to the ground state.
[0069] Step S104: Following the action sequence, after all data values within a subset of data sets are encoded into the quantum state of the first qubit, the quantum state information is associated with the quantum state information through a variational encoder and compressed into the second qubit, thereby changing the quantum state |ψ′> of the second qubit.
[0070] Step S105: Restore the first qubit to its ground state, then encode the data values in the next subset of data, until the quantum state information of all data values in all subsets is compressed into the second qubit, obtaining the final quantum state |ψ′. final >
[0071] In the embodiments provided by this invention, each variational encoder corresponds to a first quantum rotating gate setting with an action timing, as shown in the reference. Figure 4 As shown, the variational encoder includes multiple variational modules set sequentially along the action time sequence. The variational modules are repeated multiple times to increase the depth of evolution, thereby increasing the number of parameters, enhancing the expressive power of the model, capturing complex features, and improving the entanglement of quantum states.
[0072] Each variational module includes multiple CNOT gates and multiple second quantum rotation gates. The CNOT gates are positioned before the second quantum rotation gates. The number of second qubits is equal to the number of first qubits. The first qubits are located at the higher position of all second qubits. The CNOT gates act on adjacent qubits in the first and second qubits. The control qubit of the CNOT gate is the higher-position qubit adjacent to the qubit it acts on. The CNOT gate is a two-qubit controlled NOT gate. The CNOT gates are used to construct entanglement between qubits, forming multi-qubit entanglement. The second quantum rotation gates act on each of the first and second qubits.
[0073] In one feasible implementation, the first quantum rotation gate is a single-qubit rotation gate, including one or more of a first RX gate, a first RY gate, and a first RZ gate. After the first quantum rotation gate operation is performed, only the amplitude of the quantum state changes. The data value is used as the rotation control parameter of the first quantum rotation gate. Preferably, the first quantum rotation gate is a first RY gate, and the rotation control parameter of the first RY gate is arctanx, where x is the data value to be encoded by the first qubit.
[0074] The second quantum rotation gate is also a single-qubit rotation gate. The second quantum rotation gate includes one or more of the second RX gate, the second RY gate, and the second RZ gate. Preferably, the second quantum rotation gate is the second RY gate. The rotation control parameters of the second quantum rotation gate are not fixed in advance and need to be updated in the subsequent training and optimization process.
[0075] Furthermore, in the amplitude-encoded quantum circuit construction method, after step S105, step S106 is also included: using the quantum state information of the second qubit as the input state to train the variational encoder, and determining the parameter weights in the variational encoder. Specifically, refer to... Figure 5 As shown, it includes the following steps:
[0076] Step S1061: Construct training and test sets, set the batch size, select the optimizer, and define the loss function. Each batch includes at least one dataset. Feed multiple datasets from the same batch into the first quantum circuit one by one to calculate the loss value. Each dataset generates a loss value L. i .
[0077] Step S1062: Summing multiple loss values within a batch yields the average loss value for that batch. As shown in Formula 3;
[0078]
[0079] Step S1063: Calculate the gradient value of each second quantum rotation gate by backpropagation based on the average loss value. Optimize the parameters using an optimizer based on the calculated gradient values. For example, feed the gradient values into the Adam optimizer, which updates the rotation control parameters of the second quantum rotation gate, thus completing a batch of training.
[0080] Step S1064: Iterate through the above process until the loss value is lower than the set threshold or the set number of iterations is reached, then complete the training process, determine the parameter weights in the variational encoder, and obtain the desired variational encoder.
[0081] [Structure of a quantum circuit construction device]
[0082] Reference Figure 6 As shown, the quantum circuit construction device includes:
[0083] The acquisition module is used to acquire datasets. Each dataset includes multiple sub-datasets, and each sub-dataset contains multiple data values.
[0084] The 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 combination of logic gates that act sequentially on the first quantum bit and a variational encoder that acts simultaneously on the first quantum bit and the second quantum bit.
[0085] An angle encoding module is used to sequentially encode the data values within multiple sub-data values into the quantum state of the first quantum bit using angle encoding.
[0086] The quantum state compression module is used to encode the quantum state of the first quantum bit after all the data values in a subset of the dataset have been encoded into the quantum state of the first quantum bit. Then, it uses a variational encoder to associate this quantum state information and compress the quantum state information into the second quantum bit, restoring the first quantum bit to its ground state. Then, it encodes the data values in the next subset of the dataset until the quantum state information of all the data values in the subset of the dataset has been compressed into the second quantum bit.
[0087] Training module: Used to train the variational encoder by using the quantum state information of the second qubit as the input state, and to determine the parameter weights in the variational encoder.
[0088] [Structure of storage media]
[0089] This invention also provides a storage medium storing a computer program, wherein the computer program is configured to implement the steps in any of the above method embodiments when running.
[0090] Specifically, in this embodiment, the storage medium can be configured to store a computer program for implementing the following steps:
[0091] S101: Obtain the dataset. Each dataset includes multiple sub-datasets, and each sub-dataset contains multiple data values.
[0092] S102: Construct a first quantum circuit including a first quantum bit and a second quantum bit. The first quantum circuit includes a combination of logic gates that act sequentially on the first quantum bit and a variational encoder that acts simultaneously on the first quantum bit and the second quantum bit.
[0093] S103: Encode the data values within multiple sub-data values sequentially into the quantum state of the first qubit using angle encoding.
[0094] S104: After all the data values in a subset of the dataset are encoded into the quantum state of the first qubit, the quantum state information is associated with the quantum state information through a variational encoder and compressed into the second qubit.
[0095] S105: Restore the first qubit to its ground state, then encode the data values in the next subset, until the quantum state information of the data values in all subsets is compressed into the second qubit.
[0096] S106: Use the quantum state information of the second qubit as the input state to train the variational encoder and determine the parameter weights in the variational encoder.
[0097] Structure of electronic devices
[0098] This invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to implement the steps in any of the above method embodiments.
[0099] Specifically, the aforementioned electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the aforementioned processor, and the input / output device is connected to the aforementioned processor.
[0100] Specifically, in this embodiment, the processor described above can be configured to implement the following steps via a computer program:
[0101] S101: Obtain the dataset. Each dataset includes multiple sub-datasets, and each sub-dataset contains multiple data values.
[0102] S102: Construct a first quantum circuit including a first quantum bit and a second quantum bit. The first quantum circuit includes a combination of logic gates that act sequentially on the first quantum bit and a variational encoder that acts simultaneously on the first quantum bit and the second quantum bit.
[0103] S103: Encode the data values within multiple sub-data values sequentially into the quantum state of the first qubit using angle encoding.
[0104] S104: After all the data values in a subset of the dataset are encoded into the quantum state of the first qubit, the quantum state information is associated with the quantum state information through a variational encoder and compressed into the second qubit.
[0105] S105: Restore the first qubit to its ground state, then encode the data values in the next subset, until the quantum state information of the data values in all subsets is compressed into the second qubit.
[0106] S106: Use the quantum state information of the second qubit as the input state to train the variational encoder and determine the parameter weights in the variational encoder.
[0107] The above description, based on the embodiments shown in the figures, details the structure, features, and effects of the present invention. The above description is only a preferred embodiment of the present invention, but the present invention is not limited to the scope of implementation shown in the figures. Any changes made in accordance with the concept of the present invention, or equivalent embodiments modified to have equivalent changes, that do not exceed the spirit covered by the specification and figures, should be within the protection scope of the present invention.
Claims
1. A method for constructing quantum circuits based on cascaded variable component quantum state compression, characterized in that: The method includes: Obtain datasets, each of which includes multiple sub-datasets, each containing multiple data values; A first quantum circuit is constructed, comprising a first quantum bit and a second quantum bit. The first quantum circuit includes a combination of multiple first quantum rotation gates acting sequentially on the first quantum bit and a variational encoder acting simultaneously on the first quantum bit and the second quantum bit. The first quantum rotation gate is used to encode the data values in multiple subsets into the quantum state of the first quantum bit in a sequential manner by angle encoding when the first quantum bit is in the ground state. The data values within multiple subsets are sequentially encoded into the quantum state of the first qubit using angle encoding. After all data values within a subset of the dataset are encoded into the quantum state of the first qubit, each variational encoder corresponds to a first quantum rotation gate setting with an action timing, used to compress the corresponding input quantum state onto the second qubit; The first qubit is restored to its ground state, and then the data values in the next subset are encoded, until the quantum state information of the data values in all subsets is compressed into the second qubit; The quantum state information of the second qubit is used as the input state to train the variational encoder, thereby determining the parameter weights in the variational encoder.
2. The method according to claim 1, characterized in that: Each dataset comprises multiple sub-datasets, each containing multiple data values, including: The image is segmented to obtain several target regions. Each target region includes at least one pixel, and each pixel provides a data value. All data values within each target region are combined into a subset of the dataset.
3. The method according to claim 2, characterized in that: The first quantum rotation gate is used to sequentially encode data values within multiple sub-data values into the quantum state of the first quantum bit using angle encoding when the first quantum bit is in its ground state, including: The number of the first qubits is determined based on the number of pixels in the target region; Along the action sequence, multiple first quantum rotation gates are applied to each first quantum bit. All data values in the same target region are encoded into the rotation control parameters of multiple first quantum rotation gates within the same action sequence. Data values in different target regions are encoded into the rotation control parameters of first quantum rotation gates within different action sequences.
4. The method according to claim 3, characterized in that: The number of pixels in the target region is equal to the number of the first qubits.
5. The method according to claim 1, characterized in that: The variational encoder includes multiple CNOT gates and multiple second quantum rotation gates arranged sequentially along the operating time sequence. The CNOT gates operate on adjacent qubits of the first qubit and the second qubit. The control bit of the CNOT gate is the higher-order qubit adjacent to the qubit it operates on. The second quantum rotation gates operate on each of the first qubit and the second qubit.
6. The method according to claim 5, characterized in that: The first quantum rotation gate includes one or more of a first RX gate, a first RY gate, and a first RZ gate, and the second quantum rotation gate includes one or more of a second RX gate, a second RY gate, and a second RZ gate.
7. The method according to claim 5 or 6, characterized in that: The step of using the quantum state information of the second qubit as the input state to train the variational encoder and determine the parameter weights in the variational encoder includes: Construct training and test sets, set the batch size, select an optimizer and define a loss function. Each batch includes at least one of the datasets. Feed multiple datasets from the same batch into the first quantum circuit one by one to calculate the loss value. Each dataset generates a loss value. The average loss value for a batch is obtained by summing multiple loss values within a batch. The gradient value of each second quantum rotating gate is calculated by backpropagation based on the average loss value. The rotation control parameters of the second quantum rotating gate are updated based on this gradient value, thus completing the training of a batch. The aforementioned process is repeated iteratively until the loss value is lower than the set threshold or the set number of iterations is reached, at which point the training process is complete and the parameter weights in the variational encoder are determined.
8. A quantum circuit construction device, characterized in that, The device includes: The acquisition module is used to acquire datasets, each of which includes multiple sub-datasets, each containing multiple data values; The 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 combination of multiple first quantum rotation gates acting sequentially on the first quantum bit and a variational encoder acting simultaneously on the first quantum bit and the second quantum bit. The first quantum rotation gate is used to encode the data values in multiple subsets into the quantum state of the first quantum bit in a sequential manner by angle encoding when the first quantum bit is in the ground state. An angle encoding module is used to sequentially encode data values from multiple subsets into the quantum state of the first qubit using angle encoding. The quantum state compression module is used to compress the corresponding input quantum state onto the second quantum bit after all the data values in a subset of the dataset have been encoded into the quantum state of the first quantum bit. Each variational encoder corresponds to a first quantum rotation gate setting with an action timing, which is used to compress the corresponding input quantum state onto the second quantum bit, restore the first quantum bit to the ground state, and then encode the data values in the next subset of the dataset until the quantum state information of all the data values in the subset of the dataset has been compressed into the second quantum bit. Training module: Used to train the variational encoder by using the quantum state information of the second qubit as the input state, and to determine the parameter weights in the variational encoder.
9. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 7 when it is run.
10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Quantum state coding circuit, quantum calculation method and related device
CN117787428A
Engineering structure information model similarity evaluation method
CN118503725A