Quantum circuit decomposition method, quantum circuit and quantum chip
By constructing a candidate quantum gate operation pool and a variable layer quantum circuit decomposition method, the problems of high computational cost and large search space in the existing technology are solved, efficient quantum circuit decomposition is achieved, and the redundancy of quantum circuits and the number of SWAP gates are reduced.
Patent Information
- Application Number
- CN202510857353.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-06-25
AI Technical Summary
Existing technologies have problems with decomposing quantum circuits, such as high computational cost, large search space, and difficulty in finding the optimal decomposition solution. It is especially difficult to achieve efficient decomposition in large-scale logical quantum circuits.
A quantum circuit decomposition method is adopted to construct a candidate quantum gate operation pool, generate the coding layer and variational layer, perform parameter training and strategy evaluation, and use the topological structure of the quantum chip to generate the candidate quantum gate operation pool, adjust the structure of the variational quantum circuit, reduce redundancy, improve expression ability, and minimize the number of decomposition backdoors.
The decomposition of quantum circuits is completed at a shallower circuit depth, which reduces the redundancy of quantum circuits, improves the expressiveness of quantum circuits, and reduces the number of SWAP gates in the subsequent circuit mapping process.
Smart Images

Figure CN120373483B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of quantum compilation technology, and in particular to a quantum circuit decomposition method, a quantum circuit and a quantum chip. Background Art
[0002] Quantum computing, based on the entanglement and superposition properties of quantum bits (qubits), possesses inherent parallel computing capabilities and is gradually becoming a new computing paradigm. Many quantum algorithms, such as Shor's algorithm and Grover's algorithm, offer theoretical advantages over classical algorithms for solving specific problems. With the development of quantum computers, the implementation of many quantum algorithms has become possible. Currently, quantum computers are at the noisy intermediate-scale (NISQ) level, not large-scale or fault-tolerant. Therefore, the implementation of quantum algorithms on quantum computers requires consideration of hardware limitations, such as circuit depth, inter-bit connectivity, and the instruction set of basic gates that can be implemented on quantum computers. Decomposing a given quantum circuit into basic quantum gates that are as short as possible and implementable on a quantum computer is a fundamental issue in quantum information processing tasks such as quantum computing and quantum simulation.
[0003] Quantum circuit decomposition involves breaking down any quantum gate into a circuit consisting of a specific set of gates, enabling the execution of quantum algorithms on NISQ-type quantum computers. The goal of quantum circuit decomposition optimization is to minimize the number of optimized backdoors, circuit depth, and the number of two-qubit gates (CNOT gates). Otherwise, a large number of SWAP gates would be required for bit mapping, resulting in significant circuit overhead.
[0004] Currently available methods include exhaustive search, pattern matching algorithms, and reinforcement learning. Exhaustive search enumerates all possible circuit combinations and then selects the optimal one from these combinations through a traversal method. While this method guarantees optimal results, it incurs significant computational costs, and the search space grows exponentially with increasing problem size, limiting its application to large-scale quantum logic circuits.
[0005] Pattern matching algorithms use predefined gate equivalent substitution rules and then traverse the entire circuit to perform local replacement of subcircuits. However, due to the limited and fixed predefined rules, pattern matching algorithms are only applicable to the decomposition of specific local subcircuits and are difficult to decompose as a whole quantum circuit.
[0006] Reinforcement learning algorithms define quantum gates as actions, allowing agents to adaptively explore and learn. Each decision is rewarded by the environment, and the agent interacts with the environment to select the optimal action to maximize the reward. Reinforcement learning-based methods require extensive and time-consuming training. Furthermore, as the search depth increases, the agent is prone to falling into local optima, making it difficult to find the optimal decomposition solution for the entire quantum circuit. Summary of the Invention
[0007] The purpose of the present invention is to solve the shortcomings of the prior art and to propose a quantum circuit decomposition method, quantum circuit and quantum chip.
[0008] In order to achieve the above object, the present invention adopts the following technical solution: a quantum circuit decomposition method, comprising:
[0009] S1. Build a candidate quantum gate operation pool based on the target quantum chip;
[0010] S2. Determine the number of qubits in the variational quantum circuit based on the dimension of the gate to be decomposed, and then generate the coding layer;
[0011] S3. Based on the coding layer, continue adding a variation layer to the variational quantum circuit;
[0012] S4. Initialize parameters of the variational quantum circuit, then perform parameter training, and confirm whether the current combination of variational layers meets the preset gate decomposition accuracy based on the training results;
[0013] If so, the current variational quantum circuit meets the target quantum circuit decomposition requirements;
[0014] If not, proceed to step S5;
[0015] S5. Adding another layer of variational layers to the variational quantum circuit, wherein the added variational layers are constructed by obtaining quantum gates from a preset quantum gate operation pool;
[0016] S6. Perform strategy evaluation on the quantum gates in the added variational layer to select the quantum gates that meet the gradient requirements and form corresponding variational parameters, and then return to step S4.
[0017] As a further description of the above technical solution: Based on the coding layer, a method of adding a layer of variational layer to the variational quantum circuit includes:
[0018] Connect a parameter-containing rotating gate to the quantum bit to establish a coding layer;
[0019] A quantum gate is selected from the candidate quantum gate operation pool to establish a variation layer connected to the encoding layer, wherein one side of the variation layer is connected to the rotation gate.
[0020] As a further description of the above technical solution: the method for performing parameter training on the variational quantum circuit includes:
[0021] Calculate the square of the fidelity between the quantum state of the unitary matrix of the quantum circuit before decomposition and the quantum state of the unitary matrix of the variational quantum circuit after decomposition, as the approximation of the unitary matrices before and after decomposition;
[0022] The loss function is calculated according to the approximation to obtain the variational parameter corresponding to the minimum loss function.
[0023] As a further description of the above technical solution: a method for confirming whether the current combination of variational layers meets the preset gate decomposition accuracy based on the training results includes:
[0024] The approximation of the unitary matrix before and after the decomposition is used as the gate decomposition accuracy, and compared with the preset gate decomposition accuracy;
[0025] If it is greater than the preset gate decomposition accuracy, it is determined that the gate decomposition accuracy meets the decomposition requirements, and the current variational quantum circuit meets the target quantum circuit decomposition requirements;
[0026] If it is not greater than the preset gate decomposition accuracy, a new quantum gate is obtained from the candidate quantum gate operation pool.
[0027] As a further description of the above technical solution: the method for performing strategy evaluation on the quantum gate in the added variation layer includes:
[0028] According to the quantum gate of the new variational layer and the variational parameter, the expectation of the loss function is derived, and then the calculation is performed through the parameter shift rule to establish a gradient calculation model of the loss function with respect to the variational parameter;
[0029] The gradient of the loss function is obtained according to the input variational parameters, and it is determined whether it meets the gradient requirements. If so, the combination of the variational layers is trained together for parameters. If not, the quantum gate is acquired again.
[0030] As a further description of the above technical solution: the gradient requirement is the quantum gate corresponding to when the gradient of the loss function is maximum.
[0031] As a further description of the above technical solution: the candidate quantum gate operation pool is a quantum gate corresponding to a two-bit gate instruction and / or a single-bit gate instruction.
[0032] As a further description of the above technical solution: the variational quantum circuit that meets the preset gate decomposition accuracy is measured through the measurement layer, and then gradient optimization training is performed through the optimizer.
[0033] Also included is a quantum circuit, which is applicable to the quantum circuit decomposition method described in any one of the above technical solutions, including:
[0034] Coding layer;
[0035] The coding layer is connected to one side of the variation layer;
[0036] The other side of the variation layer is connected to the input side of the measurement layer for performing variational quantum circuit measurement;
[0037] The output side of the measurement layer is connected to an optimizer for performing gradient optimization training;
[0038] Wherein, the coding layer is composed of quantum bits and parameter-containing rotating gates;
[0039] The variation layer is composed of quantum gates corresponding to at least one or more two-bit gate instructions and / or single-bit gate instructions.
[0040] Also included is a quantum chip, which includes the quantum circuit decomposition method and quantum circuit described in any one of the above technical solutions.
[0041] The above technical solution has the following advantages or beneficial effects:
[0042] 1. Generate a candidate quantum gate operation pool based on the chip topology, perform strategic evaluation on the obtained quantum gates, and adjust the structure of the variational quantum circuit. This can adapt to the decomposition of the unitary matrix in any quantum circuit, reduce the redundancy of the quantum circuit, and improve the expressive power of the quantum circuit.
[0043] 2. The gate decomposition accuracy is evaluated using the approximate values of the unitary matrices before and after quantum circuit decomposition. A strategic evaluation of the variational quantum circuit is then performed, and the variational quantum circuits are sequentially added for training. This allows the decomposition of the quantum circuit to be completed at a shallower circuit depth, minimizing the number of gates after decomposition and further reducing the number of SWAP gates required to be inserted during subsequent circuit mapping. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0045] Figure 1 This is a flow chart of the quantum circuit decomposition method proposed in the present invention;
[0046] Figure 2A flow chart of the method for constructing a variational quantum circuit in the present invention;
[0047] Figure 3 Flowchart of the method for determining whether the door decomposition accuracy meets the preset door decomposition accuracy in the present invention;
[0048] Figure 4 Flowchart of the method for performing strategy evaluation on quantum gates in the present invention;
[0049] Figure 5 This is a schematic diagram of the structural principle of the quantum circuit proposed in this invention.
[0050] Legend:
[0051] 1. Coding layer; 2. Variation layer; 3. Measurement layer; 4. Optimizer. DETAILED DESCRIPTION
[0052] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0053] Due to the limited connectivity between quantum bits in current quantum chips, not just any two quantum bits can be entangled. Furthermore, because the gate operation instruction set currently supported by quantum computers is a collection of single-bit gates and two-qubit gates, quantum compilation is required to convert logical quantum circuits into physical quantum circuits when executing quantum algorithms. Existing quantum compilation methods first decompose quantum gates and then perform bit mapping based on the actual chip topology. Usually, a large number of SWAP gates are required for bit mapping after quantum gate decomposition, resulting in significant circuit overhead.
[0054] Reference Figure 1 The present invention provides an embodiment of a quantum circuit decomposition method, comprising:
[0055] S1. Build a candidate quantum gate operation pool based on the target quantum chip;
[0056] S2. Determine the number of qubits in the variational quantum circuit based on the dimension of the gate to be decomposed, and then generate the coding layer;
[0057] S3. Based on the coding layer, a variation layer is added to the variational quantum circuit;
[0058] S4. Initialize the parameters of the variational quantum circuit, then perform parameter training, and confirm whether the current combination of variational layers meets the preset gate decomposition accuracy based on the training results;
[0059] If so, the current variational quantum circuit meets the target quantum circuit decomposition requirements;
[0060] If not, proceed to step S5;
[0061] S5. Continue adding a variation layer to the variational quantum circuit, wherein the added variation layer is constructed by obtaining quantum gates from a preset quantum gate operation pool;
[0062] S6. Perform strategy evaluation on the quantum gates in the added variational layer to select quantum gates that meet the gradient requirements and form corresponding variational parameters, and then return to step S4.
[0063] In this embodiment, a candidate quantum gate operation pool is generated based on the quantum chip's topology. Positions where single-qubit and two-qubit gates can operate (where entanglement operations can occur between two qubits) are selected. The corresponding quantum gates are added to construct a variational quantum circuit, and the variational layers of the variational quantum circuit are trained. A variational layer is first selected for parameter initialization. The gate decomposition accuracy obtained after training is determined to be greater than a preset gate decomposition accuracy. If not, additional variational layers are added. Quantum gates are retrieved from the candidate quantum gate operation pool for strategy evaluation to determine whether they meet gradient requirements. If not, they are retrieved again until they meet the gradient requirements. A new variational quantum circuit is constructed using the corresponding quantum gates. Once the new variational layer is obtained, the variational layer is trained again until the gate decomposition accuracy exceeds the preset gate decomposition accuracy, completing the quantum circuit decomposition. Generating a candidate quantum gate operation pool based on the chip's topology, performing strategy evaluation on the retrieved quantum gates, and adjusting the structure of the variational quantum circuit can adapt to the decomposition of unitary matrices in any quantum circuit, reducing quantum circuit redundancy and improving quantum circuit expressiveness. By performing strategic evaluation on the variational quantum circuits and sequentially adding variational quantum circuits for training, the quantum circuit decomposition can be completed at a shallower circuit depth, minimizing the number of decomposition backdoors and further reducing the number of SWAP gates that need to be inserted in the subsequent circuit mapping process.
[0064] Reference Figure 2 Based on the coding layer, the method of adding a layer of variational layer to the variational quantum circuit includes:
[0065] S11: Connect a parameter-containing rotating gate to the quantum bit to establish the encoding layer;
[0066] S12: Select a quantum gate from the candidate quantum gate operation pool and establish a variational layer connected to the encoding layer, wherein one side of the variational layer is connected to the rotation gate.
[0067] In this embodiment, the corresponding quantum bit is determined according to the topological structure of the quantum chip, and a parameter-containing RY rotation gate is applied to the quantum bit to prepare the initial state of the quantum bit as the coding layer. Then, a two-qubit gate and a single-qubit gate are randomly obtained from the candidate quantum gate operation pool, where the number of gates can be defined, a variation layer is established, and connected to the coding layer.
[0068] Methods for parameter training of variational quantum circuits include:
[0069] Calculate the square of the fidelity between the quantum state of the unitary matrix of the quantum circuit before decomposition and the quantum state of the unitary matrix of the variational quantum circuit after decomposition, as the approximation of the unitary matrices before and after decomposition;
[0070] The loss function is calculated based on the approximation, and the variational parameters corresponding to the minimum loss function are obtained.
[0071] In this embodiment, assuming that the quantum gate instruction set supported by the quantum computer is g, the goal of quantum circuit decomposition is to decompose U into a set of basic gates, namely:
[0072]
[0073] Assume that the unitary matrix of the quantum circuit before decomposition is represented as U, and the unitary matrix of the variational quantum circuit after decomposition is represented as V. For any quantum state , the quantum state after the evolution of these two unitary matrices is recorded as and Measuring the proximity of these two quantum states can indirectly evaluate the proximity of the unitary matrices before and after decomposition. The approximation between U and V is defined as:
[0074]
[0075] in, For fidelity.
[0076] The training of the variational layer is carried out by calculating the loss function. The definition of the loss function is related to the problem to be optimized. The difference between the unitary matrices before and after the compilation is calculated by using the similarity between the quantum states before and after the compilation. The parameter update training is carried out by minimizing the loss function. The loss function is defined as:
[0077]
[0078] The closer F is to 0, the smaller the difference between the unitary matrices before and after compilation is, which means the decomposition accuracy is higher.
[0079] Find an optimal set of variational parameters Minimize the loss function, that is:
[0080]
[0081] in, is a variational parameter, which needs to be updated according to the results of each training, and the updated variational parameter is used for the next training. is the optimal variational parameter, is the loss function.
[0082] Reference Figure 3 ,The method for confirming whether the current combination of variational layers meets the preset gate decomposition accuracy based on the training results includes:
[0083] S21: The approximation of the unitary matrix before and after decomposition is used as the gate decomposition accuracy and compared with the preset gate decomposition accuracy;
[0084] S22: If it is greater than the preset gate decomposition accuracy, it is determined that the gate decomposition accuracy meets the decomposition requirements, and the current variational quantum circuit meets the target quantum circuit decomposition requirements;
[0085] S23: If it is not greater than the preset gate decomposition accuracy, a new quantum gate is obtained from the candidate quantum gate operation pool.
[0086] In this embodiment, the approximation of the unitary matrices before and after decomposition is used as the gate decomposition accuracy and is compared with the preset gate decomposition accuracy. Under ideal conditions, when F=1, it means that the fidelity of the two quantum states is 1, that is, the unitary matrix V of the variational quantum circuit after decomposition is an exact compilation of the unitary matrix U of the quantum circuit before decomposition.
[0087] However, in reality, accurate compilation is difficult to achieve through approximate methods. Therefore, a preset gate decomposition accuracy is set as a criterion for judging the approximate compilation of quantum circuits, namely:
[0088]
[0089] in, is the preset gate decomposition accuracy, and the preset gate decomposition accuracy is between 0 and 1. In this embodiment, the closer the preset gate decomposition accuracy of the gate decomposition accuracy is to 1, the better. However, in practice, only an approximate solution can be obtained. The preset gate decomposition accuracy can be set to 0.99. If it is greater than 0.99, it can be considered as a quantum circuit decomposition with a higher accuracy.
[0090] Reference Figure 4 , the method for evaluating the strategy of quantum gates in the added variational layer includes:
[0091] S31: Based on the quantum gates and variational parameters of the new variational layer, the expectation of the loss function is derived, and then the parameter shift rule is used to calculate the gradient calculation model of the loss function with respect to the variational parameters.
[0092] S32: Obtain the gradient of the loss function based on the input variational parameters, and determine whether it meets the gradient requirements. If so, perform parameter training on the combination of variational layers together. If not, re-acquire the quantum gate.
[0093] In this embodiment, when the preset gate decomposition accuracy of the gate precision is not met, quantum gates are re-obtained from the candidate quantum gate operation pool to generate variational quantum circuits, and a strategy evaluation is performed on the quantum gates. If the gradient of the variational quantum circuit before and after the addition of the quantum gates is lower than the predefined gradient requirement, the quantum gates need to be reselected until the gradient requirement is met for the next round of variational layer training.
[0094] The variational quantum circuit is calculated by the parameter shift rule, which is based on the idempotence of Hermitian operators. For a variational quantum circuit:
[0095] ,
[0096] Among them, the idempotent Hermitian operator H satisfies , I is the identity matrix.
[0097] The expectation of the loss function is derived, the variational quantum circuit is calculated using the parameter shift rule, and a gradient calculation model of the loss function with respect to the variational parameters of the variational quantum circuit is established, namely:
[0098]
[0099] in, is the expected derivative of the loss function, M is the measurement operator, is the initial state, is a variational quantum circuit, yes The conjugate transpose of , tr is the trace operation.
[0100] The parameters in the quantum circuit are increased by π / 2 and decreased by π / 2 respectively, and the objective function value is obtained as the loss function with respect to the variational parameter gradient.
[0101] The gradient of the loss function is obtained based on the input variational parameters, and compared with the gradient requirements to determine whether it meets the requirements. If so, the new variational quantum circuit is trained together with the obtained variational quantum circuit in a variational layer. If not, the quantum gate is re-acquired and the strategy is evaluated.
[0102] The gradient is required to be the quantum gate corresponding to the maximum gradient of the loss function.
[0103] In this embodiment, the gradient requirement is different for different gate decompositions, the preset gate decomposition accuracy, and the gradient calculated by the variational parameters are different. To meet the gradient requirement, a quantum gate with the largest calculated gradient can be selected from the current candidate quantum gate operation pool and added.
[0104] The candidate quantum gate operation pool is a quantum gate corresponding to a two-bit gate instruction and / or a single-bit gate instruction.
[0105] In this embodiment, when selecting quantum gates, a two-bit gate is initially chosen to entangle every bit as much as possible. A two-bit gate is applied between adjacent qubits. The number and position of single-bit gates can be randomly selected. Subsequently, the number and position of single-bit and two-bit gates can be randomly specified. After completion, the parameters are initialized, effectively initializing the parameters of the single-bit rotation gate. Generally, a random selection can be made in the interval (0, 2π).
[0106] The variational quantum circuit that meets the preset gate decomposition accuracy is measured through the measurement layer, and then gradient optimization training is performed through the optimizer.
[0107] In this embodiment, due to the limited number of measurements and the fact that as the number of bits increases, a barren plateau phenomenon is easily caused (when the number of bits of a quantum computer is large, the current quantum neural network framework can easily become unable to be effectively trained, and the measured objective function becomes very flat, resulting in a gradient that is too low to continue training), and falling into a local optimum, an Adam optimizer is optionally used for gradient optimization training. Compared to the standard stochastic gradient descent, the Adam optimizer automatically adjusts the learning rate for different parameters during the training process, thereby converging faster. The Adam optimizer adaptively adjusts the learning rate for each parameter by adjusting the first-order moment (mean of the gradient) and second-order moment (variance of the gradient) of each parameter. Specifically, the Adam optimizer adjusts the learning rate of each parameter based on the historical information of the parameter gradient, so that the update step size of the parameter with a larger gradient is smaller, while the update step size of the parameter with a smaller gradient is larger, thereby achieving gradient optimization training.
[0108] Reference Figure 5 , also includes an embodiment of a quantum circuit, the quantum circuit is applicable to any quantum circuit decomposition method in the above technical solution, including:
[0109] Coding layer 1;
[0110] Coding layer 1 is connected to one side of variation layer 2;
[0111] The other side of the variation layer 2 is connected to the input side of the measurement layer 3 for performing variational quantum circuit measurement;
[0112] The output side of the measurement layer 3 is connected to the optimizer 4 for performing gradient optimization training;
[0113] Among them, the coding layer 1 is composed of quantum bits and parameter-containing rotation gates;
[0114] The variation layer 2 is composed of quantum gates corresponding to at least one or more two-bit gate instructions and / or single-bit gate instructions.
[0115] In this embodiment, the corresponding quantum bits are confirmed according to the topological structure of the quantum chip, and a candidate quantum gate operation pool is generated; a parameter-containing RY rotation gate is set on one side of each quantum bit to prepare the initial state of the quantum bit, as the encoding layer 1, and the quantum gates corresponding to the two-qubit gate and / or the single-qubit gate are obtained from the candidate quantum gate operation pool. After strategy evaluation, the variation layer 2 is constructed, and UG is the quantum gate selected from the candidate quantum gate operation pool after strategy evaluation. The quantum gate corresponding to the two-qubit gate is preferentially selected for connection, wherein one side of the two-qubit gate is connected to the RY rotation gate, and the other side is connected to the single-qubit gate. The other side of the variation layer is connected in sequence to the measurement layer 3 and the optimizer 4. The measurement layer 3 is the existing quantum circuit measurement layer, and the objective function is obtained after measuring the optimization problem. The optimizer 4 is an Adam optimizer, and the objective function is trained for gradient optimization.
[0116] It is understandable that the quantum circuit provided in the embodiment of the present invention corresponds to the above-mentioned quantum circuit decomposition method. For the explanation, examples, beneficial effects, etc. of the relevant contents, reference can be made to the corresponding contents in the quantum circuit decomposition method, which will not be repeated here.
[0117] Also included is an embodiment of a quantum chip, which includes any quantum circuit decomposition method and quantum circuit in the above technical solutions.
[0118] Since the present quantum chip adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought about by the technical solutions of the above embodiments, which will not be described one by one here.
[0119] It should be noted that, through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus the necessary general hardware platform. In this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements that are not clearly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of further restrictions, the elements defined by the sentence "comprise a..." do not exclude the presence of other identical elements in the process, method, article or equipment including the elements.
[0120] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A quantum circuit decomposition method, characterized in that: include: S1. Build a candidate quantum gate operation pool based on the target quantum chip; S2. Determine the number of qubits in the variational quantum circuit based on the dimension of the gate to be decomposed, and then generate the coding layer; S3. Based on the coding layer, continue adding a variation layer to the variational quantum circuit; S4. Initialize parameters of the variational quantum circuit, then perform parameter training, and confirm whether the current combination of variational layers meets the preset gate decomposition accuracy based on the training results; If so, the current variational quantum circuit meets the target quantum circuit decomposition requirements; If not, proceed to step S5; S5. Adding another layer of variational layers to the variational quantum circuit, wherein the added variational layers are constructed by obtaining quantum gates from a preset quantum gate operation pool; S6. Performing strategy evaluation on the quantum gates in the added variational layer to select the quantum gates that meet the gradient requirements and form corresponding variational parameters, and returning to step S4; The approximation of the unitary matrix before and after decomposition is obtained through the parameter training; it is used as the gate decomposition accuracy; The approximation of the unitary matrices before and after the decomposition is used as the gate decomposition accuracy, and compared with the preset gate decomposition accuracy to determine whether the current combination of variational layers meets the preset gate decomposition accuracy.
2. The quantum circuit decomposition method according to claim 1, characterized in that: Based on the coding layer, the method of further adding a variation layer to the variational quantum circuit includes: Connect a parameter-containing rotating gate to the quantum bit to establish a coding layer; A quantum gate is selected from the candidate quantum gate operation pool to establish a variation layer connected to the encoding layer, wherein one side of the variation layer is connected to the rotation gate.
3. The quantum circuit decomposition method according to claim 1, characterized in that: The method for performing parameter training on the variational quantum circuit includes: Calculate the square of the fidelity between the quantum state of the unitary matrix of the quantum circuit before decomposition and the quantum state of the unitary matrix of the variational quantum circuit after decomposition, as the approximation of the unitary matrices before and after decomposition; The loss function is calculated according to the approximation to obtain the variational parameter corresponding to the minimum loss function.
4. The quantum circuit decomposition method according to claim 1, characterized in that: Methods for confirming whether the current combination of variational layers meets the preset gate decomposition accuracy based on training results include: If it is greater than the preset gate decomposition accuracy, it is determined that the gate decomposition accuracy meets the decomposition requirements, and the current variational quantum circuit meets the target quantum circuit decomposition requirements; If it is not greater than the preset gate decomposition accuracy, a new quantum gate is obtained from the candidate quantum gate operation pool.
5. The quantum circuit decomposition method according to claim 3, characterized in that: The method for performing strategy evaluation on the quantum gate in the added variable layer includes: According to the quantum gate of the new variational layer and the variational parameter, the expectation of the loss function is derived, and then the calculation is performed through the parameter shift rule to establish a gradient calculation model of the loss function with respect to the variational parameter; The gradient of the loss function is obtained according to the input variational parameters, and it is determined whether it meets the gradient requirements. If so, the combination of the variational layers is trained together for parameters. If not, the quantum gate is acquired again.
6. The quantum circuit decomposition method according to claim 5, characterized in that: The gradient requirement is the quantum gate corresponding to when the gradient of the loss function is maximum.
7. The quantum circuit decomposition method according to claim 1, characterized in that: The candidate quantum gate operation pool is a quantum gate corresponding to a two-bit gate instruction and / or a single-bit gate instruction.
8. The quantum circuit decomposition method according to claim 2, characterized in that: The variational quantum circuit that meets the preset gate decomposition accuracy is measured through the measurement layer, and then gradient optimization training is performed through the optimizer.
9. A quantum circuit, characterized in that: The quantum circuit is applicable to the quantum circuit decomposition method according to any one of claims 1 to 8, comprising: Coding layer; The coding layer is connected to one side of the variation layer; The other side of the variation layer is connected to the input side of the measurement layer for performing variational quantum circuit measurement; The output side of the measurement layer is connected to an optimizer for performing gradient optimization training; Wherein, the coding layer is composed of quantum bits and parameter-containing rotating gates; The variation layer is composed of quantum gates corresponding to at least one or more two-bit gate instructions and / or single-bit gate instructions.
10. A quantum chip, characterized in that: The quantum chip includes the quantum circuit decomposition method according to any one of claims 1 to 8 and the quantum circuit according to claim 9.
Citation Information
Patent Citations
Method and system for encoding data set in quantum circuit for quantum machine learning
CN118014096A
Construction method and device of variable component sub-circuit, medium and electronic device
CN118863078A