Quantum unitary matrix quasi-probability decomposition method and device based on diffusion model

By employing a quasi-probabilistic decomposition method for quantum unitary matrices based on a diffusion model, the target quantum unitary matrix and sub-circuit structures are uniformly encoded into multimodal embeddings. The conditional diffusion model is used to generate sub-circuit combinations that satisfy hardware constraints, thus solving the computational efficiency and adaptability problems of large-scale quantum circuits on noisy medium-sized devices and achieving efficient quantum circuit decomposition.

CN122264151APending Publication Date: 2026-06-23UNIV OF SCI & TECH OF CHINA +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
UNIV OF SCI & TECH OF CHINA
Filing Date
2026-05-26
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Currently, noisy medium-sized quantum devices cannot directly run large-scale quantum circuits. Quasi-probabilistic decomposition methods have high computational costs and lack flexible adaptability to hardware constraints in large-scale quantum circuit scenarios.

Method used

By employing a quantum unitary matrix quasi-probabilistic decomposition method based on a diffusion model, the target quantum unitary matrix, task constraints, and sub-circuit structures are uniformly encoded into multi-modal embeddings. Utilizing the iterative denoising generation process of the conditional diffusion model, weighted combinations of sub-circuits that satisfy the constraints are directly learned, achieving a polynomial increase in decomposition time with the number of qubits. Furthermore, through customizable constraint encoding and cosine similarity matching decoding, it adapts to different hardware constraints.

Benefits of technology

It significantly improves the computational efficiency and hardware adaptability of quasi-probabilistic decomposition, providing a feasible solution for the efficient deployment of large-scale quantum circuits on noisy medium-scale quantum devices, reducing computational overhead and improving decomposition accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122264151A_ABST
    Figure CN122264151A_ABST
Patent Text Reader

Abstract

This invention provides a quasi-probabilistic decomposition method and apparatus for quantum unitary matrices based on a diffusion model, primarily relating to the field of quantum computing technology. The method includes: responding to a received target quantum unitary matrix, encoding the target quantum unitary matrix based on decomposition constraints to obtain a joint condition vector; performing back-diffusion processing on the joint condition vector based on a conditional diffusion model to obtain a target tensor satisfying the decomposition constraints; decoding the target tensor to obtain multiple candidate sub-circuits; calculating a weighted sum matrix of the multiple candidate sub-circuits based on their respective real weights; and determining the multiple candidate sub-circuits and their corresponding weights as the decomposition result of the target quantum unitary matrix, provided that the fidelity between the weighted sum matrix of the multiple candidate sub-circuits and the target quantum unitary matrix meets a preset fidelity threshold.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of quantum computing technology, and more specifically, to a method and apparatus for quasi-probabilistic decomposition of quantum unitary matrices based on a diffusion model. Background Technology

[0002] Currently, noisy medium-scale quantum devices are limited by factors such as the number of qubits and coherence time, making it difficult to directly operate large-scale quantum circuits. Although quasi-probabilistic decomposition can reconstruct the target operation through linear combination of sub-circuits, its sampling overhead increases exponentially with the system size, and it lacks the ability to flexibly adapt to hardware constraints such as the maximum number of qubits and gate set of sub-circuits, making it difficult to meet the needs of practical applications. Summary of the Invention

[0003] In view of this, the present invention provides a method and apparatus for quasi-probabilistic decomposition of quantum unitary matrices based on a diffusion model.

[0004] One aspect of the present invention provides a quasi-probabilistic decomposition method for a quantum unitary matrix based on a diffusion model, comprising: in response to receiving a target quantum unitary matrix, encoding the target quantum unitary matrix based on decomposition constraints to obtain a joint condition vector; performing back-diffusion processing on the joint condition vector based on a conditional diffusion model to obtain a target tensor that satisfies the decomposition constraints; decoding the target tensor to obtain a plurality of candidate sub-circuits; calculating a weighted sum matrix of the plurality of candidate sub-circuits based on the real weights of each of the plurality of candidate sub-circuits; and determining the plurality of candidate sub-circuits and their respective weights as the decomposition result of the target quantum unitary matrix when the fidelity between the weighted sum matrix of each of the plurality of candidate sub-circuits and the target quantum unitary matrix satisfies a preset fidelity threshold.

[0005] According to an embodiment of the present invention, encoding the target quantum unitary matrix based on the decomposition constraint conditions to obtain a joint condition vector includes: performing dimensionality reduction processing on the target quantum unitary matrix to obtain a unitary embedding vector; encoding the decomposition constraint conditions to obtain a constraint embedding vector; and concatenating the unitary embedding vector and the constraint embedding vector to obtain the joint condition vector.

[0006] According to an embodiment of the present invention, the above decomposition constraint conditions include at least one of the following: the maximum allowed number of qubits in the sub-circuit, wherein the maximum allowed number of qubits is less than the number of qubits in the target quantum unitary matrix; and the allowed set of gates, wherein the allowed set of gates is a Clifford gate set, or a set of gates consisting of Clifford gates and at most one non-Clifford gate.

[0007] According to an embodiment of the present invention, the conditional diffusion model is trained by the following operations: obtaining a training dataset, which includes multiple sample quantum circuits and a sample unitary matrix corresponding to each sample quantum circuit; encoding the multiple sample quantum circuits respectively to obtain three-dimensional data tensors corresponding to each of the multiple sample quantum circuits; performing forward diffusion processing on each of the three-dimensional data tensors to generate multiple noisy tensors with different noise levels corresponding to each of the three-dimensional data tensors; training an initial diffusion model based on the noisy tensors, the diffusion steps corresponding to the noisy tensors, and the joint conditional vector, and optimizing the model parameters of the initial diffusion model using a target loss function to obtain the conditional diffusion model.

[0008] According to an embodiment of the present invention, the target loss function includes a weighted sum of syntax loss and physical loss; wherein, the syntax loss is used to determine the difference between the prediction gate operation sequence obtained by decoding the prediction tensor output by the initial diffusion model and the gate operation sequence obtained by decoding the three-dimensional data tensor corresponding to each of the plurality of sample quantum circuits; the physical loss is used to determine the difference between the first matrix corresponding to the sample quantum circuit and the second matrix corresponding to the prediction tensor, wherein both the first matrix and the second matrix characterize the quantum channel matrix.

[0009] According to an embodiment of the present invention, the plurality of sample quantum circuits are encoded to obtain three-dimensional data tensors corresponding to each of the plurality of sample quantum circuits, including: assigning mutually orthogonal unit vectors to each quantum gate in a preset gate set as gate embedding vectors for each quantum gate; for each sample quantum circuit, determining an initial three-dimensional data tensor of the sample quantum circuit based on the number of qubits and the maximum circuit depth of the sample quantum circuit; traversing the plurality of qubits included in the sample quantum circuit and filling the qubit positions in the initial three-dimensional data tensor according to the gate operation type of the qubit positions; adding position encoding to the filled initial three-dimensional data tensor to obtain the three-dimensional data tensor of the sample quantum circuit.

[0010] According to an embodiment of the present invention, the qubit positions in the initial three-dimensional data tensor are filled according to the gate operation type of the qubit positions, including: assigning a filling vector to the filling operation and assigning a background vector to the background operation; wherein the filling vector, the background vector, and the gate embedding vector are pairwise orthogonal to each other; for circuit depth layers in the sample quantum circuit that exceed the actual circuit depth, the qubit positions are filled with the filling vector; and when there is no gate operation at the qubit position, the qubit position is filled with the background vector.

[0011] According to an embodiment of the present invention, filling the qubit positions in the initial three-dimensional data tensor according to the gate operation type of the qubit positions further includes: when a single qubit gate exists at the qubit position, filling the qubit position in the initial three-dimensional data tensor with the gate embedding vector of the single qubit gate; when two qubit gates exist at the qubit position, and the qubit is the control qubit of the two qubit gates, filling the qubit position in the initial three-dimensional data tensor corresponding to the control qubit with the gate embedding vector of the two qubit gates; and when two qubit gates exist at the qubit position, and the qubit is the target qubit of the two qubit gates, filling the qubit position in the initial three-dimensional data tensor corresponding to the target qubit with the opposite vector of the gate embedding vector of the two qubit gates.

[0012] According to an embodiment of the present invention, the target tensor includes multiple qubit locations, each qubit location having a position vector; wherein decoding the target tensor to obtain multiple candidate sub-circuits includes: calculating the cosine similarity between the position vectors of each of the multiple qubit locations and each standard vector in a preset standard vector library; determining the gate operation corresponding to the target standard vector as the decoding result of each of the multiple qubit locations, wherein the target standard vector is the standard vector with the largest absolute value of the cosine similarity exceeding a preset similarity threshold; arranging the gate operations at the multiple qubit locations included in each circuit depth layer according to the decoding results of each of the multiple qubit locations and the qubit index, to obtain the gate operation sequence of each circuit depth layer; and combining the gate operation sequences of each of the multiple circuit depth layers based on the circuit depth index to obtain the multiple candidate sub-circuits.

[0013] According to an embodiment of the present invention, based on the decoding results of the plurality of qubit positions and the qubit index, the gate operations at the plurality of qubit positions included in each circuit depth layer are arranged to obtain the gate operation sequence of each circuit depth layer, including: for each circuit depth layer, traversing the plurality of qubit positions within the circuit depth layer, and performing the following operations based on the decoding results of the qubit positions: if the decoding result is a single-qubit gate, determining the single-qubit gate at the qubit position within the circuit depth layer; if the decoding result is a two-qubit gate, searching for another qubit position within the circuit depth layer with a standard vector sign opposite to that of the qubit position; pairing the qubit position with the other qubit position, determining the qubit position as the control qubit of the two-qubit gate, and determining the other qubit position as the target qubit of the two-qubit gate; if the decoding result is a padding vector or a background vector, determining a no-operation at the qubit position.

[0014] According to an embodiment of the present invention, after decoding the target tensor to obtain multiple candidate sub-circuits, the method further includes: performing syntax filtering on the multiple candidate sub-circuits to eliminate candidate sub-circuits that do not meet preset syntax rules, thereby obtaining a first set of intermediate candidate sub-circuits; performing constraint filtering on the first set of intermediate candidate sub-circuits according to the decomposition constraint conditions to eliminate candidate sub-circuits that do not meet the decomposition constraint conditions, thereby obtaining a second set of intermediate candidate sub-circuits; and determining the multiple sub-circuits included in the second set of intermediate candidate sub-circuits as the multiple candidate sub-circuits.

[0015] Another aspect of the present invention provides a quasi-probabilistic decomposition device for a quantum unitary matrix based on a diffusion model. The device includes: an encoding module, configured to encode the target quantum unitary matrix based on decomposition constraints in response to receiving the target quantum unitary matrix, obtaining a joint condition vector; a diffusion generation module, configured to perform back-diffusion processing on the joint condition vector based on a conditional diffusion model, obtaining a target tensor that satisfies the decomposition constraints; a decoding module, configured to decode the target tensor, obtaining multiple candidate sub-circuits; a calculation module, configured to calculate a weighted sum matrix of the multiple candidate sub-circuits based on their respective real weights, wherein the real weights include positive and negative weights; and a determination module, configured to determine the multiple candidate sub-circuits and their corresponding weights as the decomposition result of the target quantum unitary matrix, provided that the fidelity between the weighted sum matrix of the multiple candidate sub-circuits and the target quantum unitary matrix satisfies a preset fidelity threshold.

[0016] The embodiments of this invention encode the target quantum unitary matrix, task constraints, and sub-circuit structure into a multimodal embedding. By utilizing the iterative denoising generation process of the conditional diffusion model, the mapping from the target unitary matrix to the weighted combination of sub-circuits satisfying the constraints is directly learned, achieving a polynomial increase in decomposition time with the number of qubits. Simultaneously, through customizable constraint encoding and cosine similarity matching decoding, it can flexibly adapt to hardware constraints in different application scenarios, such as qubit number limitations and gate set limitations. This significantly improves the computational efficiency, fidelity, and hardware adaptability of quasi-probabilistic decomposition, providing a feasible solution for the efficient deployment of large-scale quantum circuits on noisy medium-scale quantum devices. Attached Figure Description

[0017] The above and other objects, features and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings.

[0018] Figure 1 A schematic diagram of a quantum unitary matrix quasi-probabilistic decomposition method based on a diffusion model according to an embodiment of the present invention is shown.

[0019] Figure 2 A flowchart of the training process according to a specific embodiment of the present invention is shown.

[0020] Figure 3 A flowchart illustrating the reasoning process according to a specific embodiment of the present invention is shown.

[0021] Figure 4 A block diagram of a quantum unitary matrix quasi-probabilistic decomposition device based on a diffusion model according to an embodiment of this application is shown.

[0022] Figure 5 A block diagram of an electronic device suitable for implementing a quantum unitary matrix quasi-probabilistic decomposition method based on a diffusion model, according to an embodiment of this application, is shown. Detailed Implementation

[0023] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the invention. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the invention for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concept of the invention.

[0024] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0025] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0026] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).

[0027] Quantum computing has become a hot research topic at the forefront due to its potential to solve problems unsolvable by classical computing. However, current noisy intermediate-scale quantum (NISQ) devices generally face core hardware constraints such as a limited number of qubits, short coherence time, limited connectivity, and low gate fidelity, preventing large-scale quantum circuits from running completely on existing devices. To perform computational tasks beyond the capacity of resource-constrained quantum hardware, a quantum circuit decomposition technique has been proposed. This technique breaks down a large quantum circuit into multiple sub-circuits that can be directly implemented in hardware, and then reconstructs the output of the original circuit through classical post-processing.

[0028] Among existing decomposition techniques, quasi-probability decomposition (QPD) is a relatively common method. This technique represents the target quantum unitary operation as a linear combination of several experimentally implementable sub-circuits, where the combination coefficients are real values ​​that can be positive or negative, serving as quasi-probability coefficients. By sampling and executing the sub-circuits and weighting and combining the results, the expected value of the target operation can be unbiasedly reconstructed.

[0029] However, the sampling overhead of quasi-probabilistic decomposition is directly related to the ℓ1-norm of the coefficient set, which grows exponentially with system size, making the computational cost prohibitive in large-scale quantum circuit scenarios. Furthermore, traditional circuit cutting methods also face the problem of exponentially increasing recombination overhead, while machine learning-based decomposition methods heavily rely on classical simulations of quantum outputs, a simulation process itself suffers from exponential complexity bottlenecks when dealing with large-scale systems.

[0030] Besides computational overhead, existing decomposition techniques generally lack the ability to flexibly adapt to customized resource constraints in real-world application scenarios. For example, different noisy medium-scale quantum (NISQ) devices have varying hardware limitations on the maximum number of qubits in sub-circuits and the allowed set of gates, such as limiting the number of non-Clifford gates. Existing methods only support a single type of constraint and cannot be optimized for specific needs during the decomposition process.

[0031] In view of this, embodiments of the present invention encode the target quantum unitary matrix, task constraints, and sub-circuit structure into a multimodal embedding, and directly learn the mapping from the target unitary matrix to the weighted combination of sub-circuits satisfying the constraints using the iterative denoising generation process of the conditional diffusion model, achieving a polynomial growth of decomposition time with the number of qubits. Simultaneously, through customizable constraint encoding and cosine similarity matching decoding, it can flexibly adapt to hardware constraints in different application scenarios such as qubit number limitations and gate set limitations, significantly improving the computational efficiency, fidelity, and hardware adaptability of quasi-probabilistic decomposition, providing a feasible solution for the efficient deployment of large-scale quantum circuits on NISQ devices.

[0032] Specifically, embodiments of the present invention provide a quasi-probabilistic decomposition method for quantum unitary matrices based on a diffusion model. This method encodes the target quantum unitary matrix, task constraints, and sub-circuit structures into a multimodal embedding, and directly learns the mapping from the target unitary matrix to the weighted combination of sub-circuits satisfying the constraints using an iterative denoising generation process of the conditional diffusion model. This achieves a polynomial increase in decomposition time with the number of qubits. Furthermore, through customizable constraint encoding and cosine similarity matching decoding, it can flexibly adapt to hardware constraints in different application scenarios, such as qubit number limitations and gate set limitations, significantly improving the computational efficiency, fidelity, and hardware adaptability of the quasi-probabilistic decomposition. This provides a feasible solution for the efficient deployment of large-scale quantum circuits on NISQ devices.

[0033] It should be noted that the quantum unitary matrix quasi-probabilistic decomposition method and apparatus based on the diffusion model determined in the embodiments of the present invention can be used in the field of quantum computing technology. The quantum unitary matrix quasi-probabilistic decomposition method and apparatus based on the diffusion model determined in the embodiments of the present invention can also be used in any field other than quantum computing technology, such as financial quantitative computing, artificial intelligence and quantum machine learning technology, etc. The application fields of the quantum unitary matrix quasi-probabilistic decomposition method and apparatus based on the diffusion model determined in the embodiments of the present invention are not limited. All equivalent transformations, modifications, or applications to other similar technical problems using the technical concept and solution of the present invention fall within the protection scope of the present invention.

[0034] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to specific embodiments and accompanying drawings.

[0035] Figure 1 A schematic diagram of a quantum unitary matrix quasi-probabilistic decomposition method based on a diffusion model according to an embodiment of the present invention is shown.

[0036] like Figure 1 As shown, the quantum unitary matrix quasi-probabilistic decomposition method based on the diffusion model includes operations S110~S150.

[0037] In operation S110, in response to receiving the target quantum unitary matrix, the target quantum unitary matrix is ​​encoded based on the decomposition constraint conditions to obtain the joint condition vector.

[0038] In operation S120, the joint condition vector is back-diffused based on the conditional diffusion model to obtain the target tensor that satisfies the decomposition constraint conditions.

[0039] In operation S130, the target tensor is decoded to obtain multiple candidate sub-circuits.

[0040] In operation S140, a weighted sum matrix of multiple candidate sub-circuits is calculated based on their respective real weights.

[0041] In operation S150, if the fidelity between the weighted sum matrix of each of the multiple candidate sub-circuits and the target quantum unitary matrix meets the preset fidelity threshold, the multiple candidate sub-circuits and their respective weights are determined as the decomposition result of the target quantum unitary matrix.

[0042] The target quantum unitary matrix is ​​a complex matrix that needs to be decomposed to characterize the evolution of the target quantum circuit. The dimension of the target quantum unitary matrix can be determined by the number of qubits in the target quantum circuit. For example, if the target quantum circuit contains n qubits, then the dimension of the target quantum unitary matrix is... Its elements contain real and imaginary parts and satisfy the unitary condition. The product of its conjugate transpose and itself is the identity matrix, i.e. ,in, Let U be the conjugate transpose of U, and I be the identity matrix.

[0043] In some specific implementations, the received target quantum unitary matrix may come from large-scale quantum circuits that need to be decomposed in quantum computing tasks such as financial quantization and molecular simulation. The number of qubits in these circuits usually exceeds the hardware capacity of current NISQ devices and cannot be executed directly.

[0044] Decomposition constraints refer to customized constraints set according to the hardware limitations of NISQ devices and actual application requirements, used to limit the resource boundaries of the decomposed sub-circuits.

[0045] In this embodiment, the encoding process refers to the system receiving a large-scale target quantum unitary matrix as input, and then using multimodal embedding technology to convert the core information of the target quantum unitary matrix and the information of the decomposed constraints into numerical vector representations. These two vector representations are then combined to form a unified vector form that can be processed by the conditional diffusion model, serving as the joint condition vector. During this encoding process, the joint condition vector retains the core features of the target quantum unitary matrix and the key information of the constraints, providing clear guidance for the subsequent back-diffusion process and ensuring that the generated sub-circuits meet the constraint requirements.

[0046] The conditional diffusion model can be a generative model pre-trained with a large number of sample quantum circuits, used to gradually recover constrained tensor data from pure random noise through an iterative denoising process guided by joint conditional vectors.

[0047] In one specific embodiment, the core architecture of the conditional diffusion model may include a U-Net architecture adapted to quantum circuit decomposition, which, guided by joint conditional vectors, learns the mapping relationship between the target quantum unitary matrix and the constrained sub-circuit tensor through data-driven learning, without relying on classical simulation of quantum circuits.

[0048] In this embodiment, the reverse diffusion process refers to starting from the random Gaussian noise tensor, performing a denoising operation iteratively using a conditional diffusion model according to a preset number of diffusion steps. Each denoising step predicts the noise components based on the guidance of the current tensor and the joint conditional vector, thereby gradually restoring the target tensor that matches the target quantum unitary matrix and satisfies the decomposition constraint conditions.

[0049] The target tensor can represent a multidimensional array whose internal structure carries information about the sub-circuit structure that satisfies the decomposition constraints.

[0050] In this embodiment, since the target tensor, as the output of the conditional diffusion model, does not inherently possess an intuitive quantum circuit structure, the numerical information contained within the target tensor can be converted into an executable quantum circuit using specific rules, and this circuit can be used as a candidate sub-circuit. A candidate sub-circuit refers to multiple sub-circuits obtained after decoding that preliminarily conform to the gate operation rules. Each sub-circuit is a small-scale circuit that can be directly executed on quantum hardware, and its size or gate set satisfies the decomposition constraints.

[0051] Specifically, the decoding process involves mapping the embedding vector of each qubit position in the target tensor to discrete quantum gate operations through similarity matching, and then combining the gate operations in order of circuit depth to form multiple candidate sub-circuits. The number of candidate sub-circuits can be adjusted by the number of samplings in the diffusion model.

[0052] Real weights can be used to characterize the contribution of a subcircuit to the decomposition of the target quantum unitary matrix, serving as quasi-probabilistic decomposition coefficients. The real weights of candidate subcircuits include both positive and negative real weights. In one example, the specific values ​​of the real weights can be determined through an optimization algorithm to minimize the difference between the weighted sum matrix and the target quantum unitary matrix.

[0053] The weighted sum matrix can be obtained by multiplying the unitary matrix corresponding to each candidate sub-circuit by its own real weight and then summing the results. It is used to approximate the quantum evolution effect of the target quantum unitary matrix.

[0054] In this embodiment, a real weight can be assigned to each candidate sub-circuit. By multiplying the unitary matrix corresponding to each candidate sub-circuit with its weight, and then adding all the product results, a weighted sum matrix of the approximate target quantum unitary matrix can be obtained.

[0055] Fidelity can be achieved by quantizing the global similarity between the decomposition result and the target unitary evolution through the quantum channel matrix, thus avoiding the limitation of traditional quantum state fidelity being unable to globally characterize the result.

[0056] A preset fidelity threshold represents a pre-defined acceptable threshold used to determine whether the decomposition results meet the requirements of practical applications. In one example, this preset fidelity threshold can be set to 0.95.

[0057] In this embodiment, the fidelity between the quantum channel corresponding to the weighted sum matrix and the quantum channel corresponding to the target quantum unitary matrix is ​​calculated. If the fidelity value reaches or exceeds a preset qualified threshold, it indicates that the currently generated candidate sub-circuits and their weights can reconstruct the target quantum operation with sufficiently high accuracy. Therefore, these candidate sub-circuits and their corresponding weights are output as the final decomposition result. If the fidelity does not meet the threshold, the back diffusion process and subsequent steps are re-executed until a qualified decomposition result is obtained.

[0058] Based on this, embodiments of the present invention employ a conditional diffusion model to perform back-diffusion processing on the encoded joint conditional vector, directly generating a target tensor that satisfies the decomposition constraints, decoding to obtain candidate sub-circuits, and calculating a weighted sum matrix based on real weights that can be positive or negative. The decomposition results are output through fidelity verification, achieving efficient and customizable large-scale quantum unitary matrix quasi-probabilistic decomposition. This avoids the expensive quantum classical simulation that traditional decomposition methods rely on, decomposing large-scale quantum circuits into sub-circuit combinations executable by NISQ devices. At the same time, fidelity verification ensures decomposition accuracy, significantly reducing computational overhead and improving the efficiency and practicality of quantum circuit decomposition, providing core technical support for the large-scale quantum computing applications of NISQ devices.

[0059] According to an embodiment of the present invention, the decomposition constraint conditions include at least one of the following: the maximum allowed number of qubits in the sub-circuit, wherein the maximum allowed number of qubits is less than the number of qubits in the target quantum unitary matrix; and the allowed set of gates, wherein the allowed set of gates is a Clifford gate set, or a set of gates consisting of Clifford gates and at most one non-Clifford gate.

[0060] In this embodiment, the decomposition constraints may include the maximum allowed number of qubits in the sub-circuit or the allowed set of gates.

[0061] The maximum allowed number of qubits in a sub-circuit can refer to the upper limit of the number of qubits that each candidate sub-circuit can contain after decomposition. This upper limit can be determined by the hardware capabilities of the NISQ device. Since the number of qubits corresponding to the target quantum unitary matrix usually exceeds the carrying capacity of the NISQ device, the maximum allowed number of qubits in the sub-circuit must be less than the number of qubits in the target quantum unitary matrix.

[0062] For example, if the target quantum unitary matrix is ​​8 qubits, the maximum allowed number of qubits can be set to 4. After decomposition, the number of qubits in each sub-circuit does not exceed 4, ensuring that the sub-circuit can be directly executed on the NISQ device.

[0063] The allowed set of gates can refer to either the set of Clifford gates or the set of gates consisting of Clifford gates and at most one type of non-Clifford gate. Clifford gates are a fundamental class of quantum gates in quantum computing, including X-gates, Y-gates, Z-gates, H-gates, CX-gates, and S-gates. Doors, including Clifford doors, are characterized by their ease of operation and high fidelity. Non-Clifford doors include T-doors, etc. Gates, etc. Because non-Clifford gates are complex to operate and have high error rates, the allowed gate set should preferably be a pure Clifford gate set, meaning the maximum number of non-Clifford gates is 0. In one example, the selection of the allowed gate set must be compatible with the gate operation capabilities of the NISQ device to ensure that the decomposed sub-circuits can be executed on the target device.

[0064] In this embodiment, if the evolution process of the target quantum unitary matrix must include non-Clifford gates, the allowed gate set can be limited to a set consisting of Clifford gates and at most one type of non-Clifford gate. Furthermore, an upper limit on the number of non-Clifford gates can be set as needed, for example, allowing a maximum of one T-gate, to minimize the execution error of the sub-circuit and improve the fidelity of the decomposition result. It should be noted that if no restrictions are imposed on the gate set, the output quantum circuit may contain more than one type of non-Clifford gate, for example, simultaneously containing T-gates and... This situation can be effectively avoided by setting a limit on the number of non-Clifford doors.

[0065] Based on this, the two core decomposition constraints included in the embodiments of the present invention can be precisely adapted to the qubit number limit and gate operation capability limit of NISQ devices, solving the problem of lack of customized constraint adaptation in existing decomposition methods, ensuring that the decomposed sub-circuits can be directly executed on NISQ devices, and at the same time, by limiting the number of non-Clifford gates, the execution error of the sub-circuits is reduced, thereby improving the practicality and reliability of the decomposition results.

[0066] According to an embodiment of the present invention, encoding the target quantum unitary matrix based on decomposed constraint conditions to obtain a joint condition vector includes: reducing the dimensionality of the target quantum unitary matrix to obtain a unitary embedding vector; encoding the decomposed constraint conditions to obtain a constraint embedding vector; and concatenating the unitary embedding vector and the constraint embedding vector to obtain a joint condition vector.

[0067] A unitary embedding vector can represent a low-dimensional vector obtained after dimensionality reduction, which fully preserves the quantum evolution characteristics of the target quantum unitary matrix. In one example, the unitary embedding vector is represented by a dual-channel approach: real-imaginary or amplitude-phase.

[0068] The constraint embedding vector can represent the vector obtained by vectorizing the decomposed constraints, and is used to pass hardware constraint information to the condition diffusion model.

[0069] In one specific implementation, the dimension of the target quantum unitary matrix is... , where n represents the number of qubits in the target quantum unitary matrix. The number of qubits n increases exponentially; for example, an 8-qubit unitary matrix has a dimension of 256×256. Direct processing would lead to a surge in computational overhead, thus requiring dimensionality reduction.

[0070] In this embodiment, Singular Value Decomposition (SVD) can be used to extract core features, or random projection can be used to simplify the matrix dimension, converting high-dimensional complex matrices such as the target quantum unitary matrix into continuous unitary embedding vectors of fixed dimensions, thereby eliminating the computational pressure brought by exponential dimensions.

[0071] In one example, the dimensionality reduction embedding dimension can be set to be much smaller than 4. n A fixed value, such as 64 dimensions, or a dimension that grows with a polynomial of n, such as... This is to balance the distinguishability and computational efficiency of different unitary matrices. This indicates asymptotic order computation. During dimensionality reduction, the reduced matrix can be divided into two channels: real part and imaginary part, or amplitude and phase, and then converted into vector form to obtain the unitary embedding vector.

[0072] In this embodiment, the decomposed constraints can be converted into continuous vectors that can be handled by the conditional diffusion model and have the same dimension as the unitary embedding vector through numerical mapping.

[0073] In one example, if the decomposition constraint is the maximum allowed number of qubits in the sub-circuit, then the maximum allowed number of qubits in the sub-circuit can be converted into a numerical vector of fixed dimensions.

[0074] In another example, if the constraint is a set of allowed gates, each gate in the set can be encoded and combined to form a constraint embedding vector, ensuring that the constraint information can be recognized by the conditional diffusion model.

[0075] In this embodiment, the unitary embedding vector and the constraint embedding vector are merged in dimensional order to form a unified high-dimensional vector, namely the joint condition vector. After concatenation, projection processing is required to ensure that the dimension of the joint condition vector matches the input dimension of the conditional diffusion model, while retaining the core features of the unitary embedding and the key information of the constraint embedding. This ensures that the subsequent back-diffusion process can both conform to the evolution requirements of the target quantum unitary matrix and strictly follow the decomposition constraint conditions.

[0076] Based on this, the embodiments of the present invention solve the computational problem caused by the high dimensionality of the target quantum unitary matrix through a step-by-step encoding process of dimensionality reduction, constraint encoding, and splicing. At the same time, it realizes a unified representation of the target quantum unitary matrix and the decomposition constraint conditions, ensuring that the joint condition vector can provide accurate guidance for the conditional diffusion model, improving the accuracy and compliance of the subsequent back diffusion generation sub-circuit, further reducing the computational overhead of the encoding process, and laying the foundation for the efficient execution of the entire decomposition method.

[0077] According to an embodiment of the present invention, the conditional diffusion model is trained through the following operations: obtaining a training dataset, which includes multiple sample quantum circuits and a sample unitary matrix corresponding to each sample quantum circuit; encoding the multiple sample quantum circuits respectively to obtain three-dimensional data tensors corresponding to each sample quantum circuit; performing forward diffusion processing on each three-dimensional data tensor to generate multiple noisy tensors with different noise levels corresponding to each three-dimensional data tensor; training the initial diffusion model based on the noisy tensors, the diffusion steps corresponding to the noisy tensors, and the conditional vector, and optimizing the model parameters through a loss function to obtain the conditional diffusion model.

[0078] The training dataset can consist of multiple sample quantum circuits and corresponding sample unitary matrices, with the number of qubits in the sample quantum circuits ranging from 2 to 8.

[0079] The training dataset is the foundational data used to train the conditional diffusion model, and its construction must closely align with real-world application scenarios. In this embodiment, the training dataset contains 69,075 simulated quantum circuits. Each sample quantum circuit corresponds to a unique sample unitary matrix, meaning the dimension of the sample unitary matrix matches the number of qubits in the sample quantum circuit. This training dataset can be divided into an 80% training set, a 10% validation set, and a 10% test set, and deduplication is performed using redundancy gates to ensure the dataset's effectiveness and diversity.

[0080] A three-dimensional data tensor can represent a standard tensor encoded from a sample quantum circuit. In this embodiment, the dimension of the three-dimensional data vector is... , where N q N represents the dimension of the number of qubits, corresponding to the number of qubits in the sample quantum circuit; t d represents the circuit depth dimension, corresponding to the maximum circuit depth of the sample quantum circuit; gate This represents the gate embedding dimension, corresponding to the embedding dimensions of quantum gates, fill tokens, and background tokens.

[0081] In this embodiment, discrete sample quantum circuits or gate operation sequences are converted into continuous three-dimensional data tensors, which can be processed by the conditional diffusion model while retaining core information such as the number of qubits, gate operation types, and circuit depth of the sample quantum circuits.

[0082] The diffusion step count can refer to the number of iterations of forward and backward diffusion, characterizing the noise level of the tensor. In one example, the diffusion step count can preferably be 1000 steps.

[0083] In this embodiment, forward diffusion refers to the process of progressively adding Gaussian noise to a noise-free 3D data tensor. Specifically, an initial noise tensor is first sampled, which follows a standard normal distribution. (X)R Let R be the noise tensor obtained after R forward diffusion steps (representing the noise data at step R). A cosine beta scheduling strategy can be adopted, with a fixed number of diffusion steps R. Gaussian noise is gradually added to the 3D data tensor within the number of diffusion steps R. Each diffusion step generates a noise tensor with a corresponding noise level, resulting in R noise tensors with different noise levels. This allows the conditional diffusion model to learn the inverse process of noise addition. Each noise tensor corresponds to a unique number of diffusion steps, and the beta value increases with the number of diffusion steps to control the intensity of noise addition.

[0084] For example, for the three-dimensional data tensor of each sample quantum circuit The diffusion steps are iterated from 1 to R, with Gaussian noise added at each step, resulting in the noisy tensor for the corresponding diffusion step number. Where the current diffusion step number r = 1, 2, ..., R, X r Let X be the noisy tensor at step r. r−1 Let r be the noise tensor at step r-1. Let r be the noise attenuation coefficient at step r. , Let be the noise figure at step r, satisfying And as r increases, The Gaussian noise added in step r follows a standard normal distribution. As the number of diffusion steps increases, the noise intensity of the noisy tensor gradually increases until r=R, at which point the noisy tensor approaches pure noise.

[0085] The initial diffusion model can refer to a model that has not been trained and whose parameters are randomly initialized. Its architecture is a U-Net architecture adapted to quantum circuit decomposition. It is the initial state of the conditional diffusion model. The final usable model is obtained after training and optimizing the parameters.

[0086] In this embodiment, the initial diffusion model can be optimized to ensure that it accurately adapts to the quantum circuit decomposition requirements and effectively guides the denoising process. Specifically, the convolution operation is limited to the time step dimension, for example, the kernel size is [missing value]. Here, f represents the window length of the convolution kernel in the time step dimension, i.e., the number of time steps covered, while 1 represents the window length in the qubit dimension, i.e., processing only a single qubit at a time. This allows the convolution operation to slide only along the time dimension, while independently processing the channel information of each qubit in the qubit dimension, thus adapting to the nonlocal interconnected physical characteristics of quantum circuits. Furthermore, the encoder can extract multi-scale features through residual convolution downsampling, and the decoder can upsampling through transposed convolution, fusing low-dimensional and high-dimensional features via skip connections. Adaptive layer normalization injects the joint conditional vector into the residual convolution layer, guiding the denoising process towards generating features that satisfy the constraints.

[0087] The loss function can be used to measure the difference between the model's prediction and the true value. By minimizing the loss function, the model parameters can be optimized to improve the accuracy of model generation.

[0088] In this embodiment, during training, the noisy tensor, the number of diffusion steps, and the joint conditional vector of the sample quantum circuit are input into the initial diffusion model. The model predicts the noise contained in the noisy tensor and outputs the predicted noise. The error between the predicted noise and the actual noise is calculated using a target loss function. Gradient descent is used for backpropagation to optimize the model parameters until the model converges. Finally, a conditional diffusion model that can accurately generate compliant tensors is obtained.

[0089] The embodiments of the present invention construct diverse training datasets and combine forward diffusion with loss function optimization to train a diffusion model with conditional generation capabilities. This enables the model to learn the feature and constraint mapping relationship of sample circuits, generating sub-circuit embeddings that satisfy constraints without relying on expensive quantum classical simulations. This improves the model's generalization ability and generation accuracy, providing efficient and reliable model support for the subsequent decomposition of the target quantum unitary matrix.

[0090] According to an embodiment of the present invention, the target loss function includes a weighted sum of syntax loss and physical loss; wherein, the syntax loss is used to determine the difference between the prediction gate operation sequence obtained by decoding the prediction tensor output by the initial diffusion model and the gate operation sequence obtained by decoding the three-dimensional data tensors corresponding to each of the multiple sample quantum circuits; the physical loss is used to determine the difference between the first matrix corresponding to the sample quantum circuit and the second matrix corresponding to the prediction tensor, wherein both the first matrix and the second matrix characterize the quantum channel matrix.

[0091] The prediction tensor can represent the tensor obtained by denoising the noisy tensor in the initial diffusion model, and the prediction gate operation sequence is obtained after decoding.

[0092] A sequence of gate operations can represent the set of quantum gates arranged in order of circuit depth in a quantum circuit. A sequence of predicted gate operations can represent the sequence of gate operations obtained after decoding the predicted tensor.

[0093] Syntax loss is used to constrain the gate operation sequence after decoding the predicted tensor of the model output to be consistent with the original gate operation sequence before encoding the sample quantum circuit, thus ensuring the syntactic validity of the gate operation sequence.

[0094] In one specific implementation, the syntax loss can be cross-entropy loss, used to calculate the difference in cross-entropy between the predicted gate operation sequence obtained by decoding the predicted tensor output of the initial diffusion model and the gate operation sequence obtained by decoding the three-dimensional data tensor corresponding to the sample quantum circuit. The smaller this difference, the smaller the syntax loss, indicating that the gate operation sequence after decoding the predicted tensor conforms more closely to the syntax rules of the quantum circuit. These syntax rules include, for example, that only one gate operation exists for the same qubit at the same circuit depth, and that the qubit index is correct.

[0095] The physical loss is used to constrain the physical evolution characteristics of the quantum circuits corresponding to the predicted tensors generated by the model to be consistent with those of the sample quantum circuits, thus ensuring the physical consistency of the decomposition results.

[0096] In one specific implementation, the physical loss may be a mean squared error (MSE) loss, used to determine the mean squared error between a first matrix corresponding to the sample quantum circuit and a second matrix corresponding to the prediction tensor.

[0097] Both the first and second matrices represent the quantum channel matrix. Specifically, the first matrix can be the Choi matrix corresponding to the sample quantum circuit, denoted as... The second matrix is ​​the Choi matrix corresponding to the prediction circuit obtained after decoding the prediction tensor, denoted as... Physical loss is calculated. and The mean square error, i.e. The difference between two Choi matrices is used to measure the difference between them. The smaller the difference, the smaller the physical loss, indicating that the quantum channel evolution characteristics of the prediction circuit and the sample circuit are closer.

[0098] In this embodiment, the target loss function can be obtained by adding the syntax loss and physical loss with fixed weights, as shown in the following expression: ,in, Represents the target loss function. Indicates syntax loss, Indicates physical loss. This represents the weighting coefficients used to balance the effects of syntax loss and physical loss. In one example, the weighting coefficients... It can be set to 0.1 to achieve the optimal balance between syntactic validity and physical fidelity.

[0099] Based on this, the embodiments of the present invention, through a weighted combination of syntactic loss and physical loss, ensure that the gate operation sequence generated by the model conforms to the syntactic rules of quantum circuits, avoiding invalid gate operations, and also ensure that the physical evolution characteristics of the generated circuit are consistent with the sample circuit. This solves the single defect of existing model training that only focuses on syntactic validity or only focuses on physical consistency, improves the training accuracy of the conditional diffusion model, and lays the foundation for the subsequent generation of high-fidelity sub-circuits.

[0100] According to an embodiment of the present invention, multiple sample quantum circuits are encoded to obtain three-dimensional data tensors corresponding to each sample quantum circuit. This includes: assigning mutually orthogonal unit vectors to each quantum gate in a preset gate set as gate embedding vectors for each quantum gate; for each sample quantum circuit, determining an initial three-dimensional data tensor based on the number of qubits and the maximum circuit depth of the sample quantum circuit; traversing the multiple qubits included in the sample quantum circuit and filling the qubit positions in the initial three-dimensional data tensor according to the gate operation type at each qubit position; and adding position encoding to the filled initial three-dimensional data tensor to obtain the three-dimensional data tensor of the sample quantum circuit.

[0101] In some specific embodiments, the preset gate set used in the sample circuits of the training dataset employed in this invention can be a complete gate set, such as including {X gate, Y gate, Z gate, H gate, CX gate, S gate, ...} Door, T-door, There are a total of 9 types of doors. The specific composition of the preset door set can be flexibly determined according to the actual application scenario and the door operation capabilities of the NISQ device. In some specific embodiments, it can also be any subset of the above door set, for example, including only 5 types of doors: {X door, Z door, H door, CX door, T door}.

[0102] In this embodiment, to ensure the uniqueness and distinguishability of the encoding of each quantum gate, the Gram-Schmidt orthogonalization method can be used to assign an orthogonal unit vector of the gate embedding dimension to each type of quantum gate as the gate embedding vector. This gate embedding vector satisfies... , where v G Let be any gate embedding vector, and the inner product of the gate embedding vectors of any two different quantum gates be 0, i.e. , where v G1 Let v represent the gate embedding vector of the first quantum gate. G2 Let represent the gate embedding vector of the second quantum gate, to ensure that the encoded features of different gate operations are uniquely distinguishable. Here, the gate embedding dimension d... gate =N gate +2, N gateThe set of gates is predefined, and the two additional dimensions are used for subsequent filling and background operations, respectively.

[0103] The initial three-dimensional data tensor can refer to the maximum number of qubits of the sample quantum circuit as N. q Dimensions, based on the maximum circuit depth of N t Dimensions, by d gate =N gate +2 is the zero tensor obtained by initializing the gate embedding dimension.

[0104] The circuit depth layer can represent the time step of gate operation execution in the sample quantum circuit. Each circuit depth layer corresponds to one time step, and the circuit depth layer includes the actual depth of the sample circuit from 1.

[0105] The position of a qubit refers to the unique position of an element in a tensor, which can be determined by the qubit index and the circuit depth index. The coordinates of the tensor are (q, t, :), which is represented as (the q-th qubit, the t-th time step, and the vector of all gate embedding dimensions).

[0106] The gate operation type refers to the gate operation performed at the location of that qubit, such as a single qubit gate, a two-qubit gate, or a gateless operation.

[0107] In this embodiment, the sample quantum circuit is traversed circuit by circuit depth and qubit by qubit. During the traversal, the corresponding quantum gate embedding vector is filled into the corresponding position of the initial three-dimensional data tensor, such as the (qubit index, circuit depth index) position, according to whether a gate operation exists at each qubit position and the type of gate operation, to ensure that the gate operation information is accurately encoded.

[0108] Position encoding can represent the feature encoding added to the initial three-dimensional data tensor. It is used to preserve the absolute position information of the qubit index and the circuit depth index, and avoid the model from confusing gate operations at different positions, such as confusing the same gate operation on different qubits or the same gate operation at different depth layers, so as to ensure the effectiveness of qubit gate placement.

[0109] In this embodiment, position encoding is superimposed on the initial three-dimensional data tensor after filling, preserving the position information of the qubits and the circuit depth, and finally obtaining a three-dimensional data tensor that can be input into the diffusion model.

[0110] Based on this, the embodiments of the present invention achieve accurate conversion from sample quantum circuits to three-dimensional data tensors through a step-by-step encoding process. This process not only preserves the core information of the sample circuit, such as the number of qubits, gate operation type, and circuit depth, but also ensures the distinguishability of gate operations through orthogonal gate embedding and the accuracy of gate operation positions through position encoding. This provides high-quality input data for the training of conditional diffusion models, thereby improving the efficiency and accuracy of model training.

[0111] According to an embodiment of the present invention, the qubit positions in the initial three-dimensional data tensor are filled according to the gate operation type of the qubit position, including: assigning a first orthogonal unit vector as a filling vector for the filling operation, and assigning a second orthogonal unit vector as a background vector for the background operation; for the circuit depth layer of the sample quantum circuit where the circuit depth is less than the maximum circuit depth, filling all qubit positions as filling vectors; and filling the qubit positions as background vectors when there are no gate operations at the qubit positions.

[0112] The padding operation is used to handle depth layers that exceed the actual depth of the sample quantum circuit, such as portions where the sample circuit depth is less than the maximum circuit depth. The padding vector is an orthogonal unit vector assigned to the padding operation, which corresponds to the padding token in the gate embedding dimension and is used to fill in positions where the circuit depth is insufficient.

[0113] Background operations are used to process the positions of gateless qubits within the same circuit depth layer. The background vector is an orthogonal unit vector assigned to the background operation, which corresponds to the background token in the gate embedding dimension and is used to represent the free positions without gates.

[0114] In this embodiment, both the padding vector and the background vector can be generated through Gram-Schmidt orthogonalization, with the dimension being the gate embedding dimension. During Gram-Schmidt orthogonalization, an independent orthogonal unit vector is assigned to both the padding and background operations, making the padding vector... Background vector With all gate embedding vectors The vectors are pairwise orthogonal, and the fill vector and the background vector are also mutually orthogonal. , , This forms a complete standard vector library, ensuring that the encoding of padding, background operations and gate operations can be completely distinguished, avoiding encoding confusion.

[0115] The actual circuit depth represents the true gate operation depth of the sample quantum circuit, which is less than the preset maximum circuit depth. A circuit depth layer exceeding the actual circuit depth refers to a layer where the actual depth of the sample quantum circuit is [not specified in the original text]. ,in, Then the circuit depth t starts from arrive All circuit depth layers are layers that exceed the actual depth.

[0116] In this embodiment, all qubit positions in the remaining circuit depth layer outside the actual circuit depth of the sample quantum circuit are filled with a padding vector to indicate that there is no actual gate operation at that time step. This padding operation is performed to unify the tensor dimension.

[0117] For example, if the actual circuit depth of the sample quantum circuit is 15, meaning the maximum circuit depth is 30, then circuit depth layers 16 to 30 represent the portion exceeding the actual circuit depth. All qubit positions within these circuit depth layers are filled with filling vectors. This is used to indicate that there are no actual gate operations in the circuit depth layer, and at the same time to achieve the encoding alignment of quantum circuits of different circuit depth samples.

[0118] In this embodiment, within the actual circuit depth layer of the sample quantum circuit, if a certain qubit location is in an idle state without any gate operation (e.g., it is neither an operating bit of a single-qubit gate nor a control bit or target bit of a two-qubit gate), then that qubit location is filled with the background vector. This is used to identify the position as idle, distinguishing it from the padding vector, and ensuring that idle operations and padding operations can be accurately identified during decoding.

[0119] For example, if there are no gate operations on the 3rd qubit at the 5th time step of the sample quantum circuit, then the tensor position (3,5,:) is filled with the background vector. .

[0120] Based on this, the embodiments of the present invention solve the encoding alignment problem of sample circuits at different depths by assigning orthogonal vectors, avoid encoding confusion between gateless operation positions and gated operation positions, ensure that the three-dimensional data tensor can accurately and completely reflect the structural information of the sample circuit, improve the uniformity and compatibility of encoding, and provide a guarantee for the accuracy of subsequent model training.

[0121] According to an embodiment of the present invention, filling the qubit positions in the initial three-dimensional data tensor according to the gate operation type of the qubit position further includes: when there is a single qubit gate at the qubit position, filling the qubit positions in the initial three-dimensional data tensor with the gate embedding vector of the single qubit gate; when there are two qubit gates at the qubit position, and the qubit is the control qubit of the two qubit gates, filling the qubit positions in the initial three-dimensional data tensor corresponding to the control qubit with the gate embedding vector of the two qubit gates; and when there are two qubit gates at the qubit position, and the qubit is the target qubit of the two qubit gates, filling the qubit positions in the initial three-dimensional data tensor corresponding to the target qubit with the opposite vector of the gate embedding vector of the two qubit gates.

[0122] A single-qubit gate can represent a quantum gate that operates only on a single qubit, such as the X gate, Y gate, Z gate, H gate, S gate, etc. Door, T-door, Gates. Each single-qubit gate corresponds to a unique gate embedding vector, such as the X gate corresponding to the X gate's gate embedding vector. The H-gate's corresponding H-gate's gate embedding vector .

[0123] In one specific implementation, if an H-gate exists at a certain qubit location, such as (qubit 3, circuit depth layer 5), the gate embedding vector of the H-gate can be filled at the position (3,5,:) in the initial three-dimensional data tensor. The door operation type at this location is directly identified as H door.

[0124] A two-qubit gate can represent a quantum gate that operates on two qubits, such as a CX gate, which includes a control qubit that triggers the gate operation and a target qubit that is affected by the gate operation.

[0125] In one specific implementation, if the CX gate corresponds to the gate embedding vector of the CX gate... If a CX gate is located at a certain qubit position, such as (qubit 2, circuit depth layer 7), then the gate embedding vector of the CX gate can be filled at the position (2,7,:) in the initial three-dimensional data tensor. .

[0126] To preserve the control-target logic relationship of a two-qubit gate and avoid loss of gate operation semantics, when there is a two-qubit gate at the qubit position and the qubit is the target qubit of the two-qubit gate, the qubit position can be filled with the opposite vector of the gate embedding vector controlling the qubit.

[0127] In one specific implementation, if the qubit position corresponding to the target qubit of the CX gate is (qubit 5, circuit depth layer 7), then the opposite vector of the gate embedding vector of the CX gate can be filled at the position (5,7,:) in the initial three-dimensional data tensor. By using opposite symbols to identify the control-target pairing relationship, it is ensured that the two qubits of the two-qubit gate can be accurately identified during subsequent decoding.

[0128] Based on this, the embodiments of the present invention use differentiated filling rules for single-qubit gates and two-qubit gates to ensure the encoding accuracy of different types of gate operations. In particular, the two-qubit gate uses the method of filling the control bit with the original vector and the target bit with the opposite vector, which preserves the control-target logic relationship without loss. This solves the problems of semantic loss and difficulty in pairing during decoding in existing encoding methods, and provides a guarantee for the accuracy and efficiency of subsequent tensor decoding. At the same time, it ensures that the encoded tensor can accurately reflect the gate operation logic of the quantum circuit.

[0129] According to an embodiment of the present invention, adding position codes to the filled initial three-dimensional data tensor to obtain the three-dimensional data tensor of the sample quantum circuit includes: superimposing the first position code and the second position code onto the corresponding dimensions of the filled initial three-dimensional data tensor to obtain the three-dimensional data tensor of the sample quantum circuit.

[0130] Position encoding can be configured as two-dimensional sinusoidal position encoding, which preserves the absolute position information of the qubit dimension and the circuit depth dimension, avoids model confusion of gate operations at different positions, and ensures the effectiveness of gate placement.

[0131] In this embodiment, the two-dimensional sinusoidal position encoding includes a first position encoding and a second position encoding. The first position encoding represents a sinusoidal position encoding generated along the qubit dimension to characterize the index differences of different qubits. The second position encoding represents a sinusoidal position encoding generated along the circuit depth dimension to characterize the timing differences of different circuit depths.

[0132] In this embodiment, the first position code and the second position code are generated in the same way, and the specific expressions are as follows:

[0133] (1);

[0134] in, This represents the position index in the dimension to be encoded. For the first position encoding (qubit dimension)... The value is taken as the quantum bit index (e.g., 0~7); for the second position encoding (circuit depth dimension). The value is the depth layer index (e.g., 0~29); Channel index for the gate embedding dimension; Embed the dimension as a gate.

[0135] In this embodiment, the first position code and the second position code are superimposed on the corresponding dimensions of the assigned initial three-dimensional data tensor to obtain the complete three-dimensional data tensor. Specifically, the first position code is superimposed on the qubit index dimension of the tensor, and the second position code is superimposed on the depth index dimension of the tensor. The superposition method can be element-wise addition to ensure that the position information and the gate embedding information are fused, thus preserving both the gate operation type and the position information of the gate operation.

[0136] Based on this, the embodiments of the present invention employ two-dimensional sinusoidal position encoding, which effectively preserves the absolute position information of the qubit index and circuit depth, solves the problem of gate operation confusion caused by the loss of position information during model training, ensures that the model can accurately learn the position rules of gate operations, improves the gate placement accuracy of subsequent back-diffusion generation sub-circuits, and further guarantees the effectiveness of the decomposition results.

[0137] According to an embodiment of the present invention, decoding a target tensor to obtain multiple candidate sub-circuits includes: calculating the cosine similarity between the position vectors of multiple qubit locations and each standard vector in a preset standard vector library; determining the gate operations corresponding to the target standard vectors as the decoding results of the multiple qubit locations; arranging the gate operations at the multiple qubit locations included in each circuit depth layer according to the decoding results of the multiple qubit locations and the qubit index to obtain a gate operation sequence for each circuit depth layer; and combining the gate operation sequences of the multiple circuit depth layers based on the circuit depth index to obtain multiple candidate sub-circuits.

[0138] The target tensor is a three-dimensional tensor output by the backdiffusion of the conditional diffusion model, with dimensions consistent with the three-dimensional data tensor of the sample quantum circuit. The target tensor includes multiple qubit positions, each corresponding to a gate embedding dimension. The position vector.

[0139] In this embodiment, since the position vector is a continuous vector generated after the model is denoised, it belongs to the same vector space as the gate embedding vector, padding vector and background vector in the encoding stage. However, due to the random error of the diffusion model, it cannot be completely consistent with the standard vector. Therefore, it is necessary to decode it through similarity matching.

[0140] The pre-defined standard vector library is a collection built during the encoding phase that includes all gate embedding vectors, padding vectors, and background vectors. This embodiment includes 11 standard vectors, such as 9 gate embedding vectors and 1 padding vector v. pad 1 background vector v bgAll standard vectors satisfy the condition that they are pairwise orthogonal. It should be noted that for the CX gate, its control bits and target bits are encoded using +v respectively. CX and −v CX However, the default standard vector library only stores +v. CX During decoding, the sign of the cosine similarity is used to distinguish between control bits and target bits.

[0141] Cosine similarity is a core indicator for measuring the directional similarity between two vectors. Its value ranges from -1 to 1. The closer the value is to 1, the more consistent the directions of the two vectors are; the closer the value is to -1, the more opposite the directions of the two vectors are; and the closer the value is to 0, the more unrelated the two vectors are.

[0142] In this embodiment, for the position vector at each (q, t) position of the target tensor, its cosine similarity with each standard vector in the preset standard vector library is calculated. This cosine similarity is used to measure the degree of similarity between the position vector in the target tensor and the standard vector. The calculation formula is as follows:

[0143] (2);

[0144] in, Let q be the position vector in the target tensor with qubit index and circuit depth index t; Let s be the s-th standard vector in the preset standard vector library, where s corresponds to different quantum gates, padding tokens, or background tokens; This represents the dot product of the position vector and the standard vector. , These are the L2 norms of the position vector and the standard vector, respectively, where the standard vector is a unit vector. This simplifies the calculation.

[0145] In this embodiment, by calculating the cosine similarity between each position vector and all standard vectors, the standard vector that best matches the position vector can be determined, providing a basis for subsequent decoding.

[0146] The target standard vector refers to the standard vector selected from the preset standard vector library for each position vector that meets the following conditions: the absolute value of the cosine similarity between the position vector and the standard vector is the largest and the absolute value exceeds the preset similarity threshold; for the CX gate standard vector v CX If the cosine similarity is positive, it is decoded as a control bit; if it is negative, it is decoded as a target bit.

[0147] A preset similarity threshold is used to filter out invalid matches caused by noise interference to ensure decoding accuracy. In one specific embodiment, the preset similarity threshold can be set to 0.8, meaning that the corresponding standard vector is determined as the target standard vector only when the absolute value of the cosine similarity is greater than or equal to 0.8. If the absolute value of the cosine similarity between all standard vectors and the vector at that position is less than 0.8, the decoding at that position is determined to have failed, and the gate operation related sub-circuits corresponding to that position are removed in the subsequent filtering process.

[0148] The decoding result refers to the operation type corresponding to the target standard vector. In this embodiment, if the target standard vector is a gate embedding vector, the decoding result is the quantum gate corresponding to that gate embedding vector. If the target standard vector is v CX If the cosine similarity is positive, then the decoding result is the control bit of the CX gate. If the target standard vector is v... CX If the cosine similarity is negative, then the decoding result is the target bit of the CX gate. If it is a padding vector... The decoding result is a padding operation. If it is a background vector... If the result is a background operation, then the decoding result is the background operation. This method allows for the accurate conversion of continuous position vectors into discrete operation types, completing the decoding of a single position.

[0149] In this embodiment, each circuit depth layer contains the qubit positions corresponding to all qubit indices.

[0150] In this embodiment, based on the decoding result of each qubit position and its corresponding qubit index, all valid gate operations within the circuit depth layer are sorted out to form an ordered sequence of gate operations. Specifically, for each time step, the decoding results corresponding to all qubit indices are traversed, the positions where the decoding result is a quantum gate are selected, padding operations and background operations are ignored, and then the valid gate operations are sorted according to the order of the qubit indices to obtain the gate operation sequence of the circuit depth layer.

[0151] For example, if the circuit depth t=5, the qubit index q=0 is decoded as the X gate, the qubit index q=2 is decoded as the control bit of the CX gate, the qubit index q=5 is decoded as the target bit of the CX gate, and the remaining qubits are decoded as background operations, then the gate operation sequence for this time step is [X(0),CX(2,5)]. Record all gate operations and their corresponding qubit positions within this time step.

[0152] In this embodiment, the gate operation sequences of all circuit depth layers are sequentially spliced ​​together in descending order of time steps to form a complete quantum circuit sequence. Each complete quantum circuit sequence is a candidate sub-circuit.

[0153] In this embodiment, due to the randomness of the conditional diffusion model, a single reverse diffusion process can generate multiple target tensors. Each target tensor corresponds to a candidate sub-circuit after decoding, thus ultimately yielding multiple candidate sub-circuits.

[0154] Based on this, embodiments of the present invention achieve robust decoding of continuous tensors to discrete gate operations through cosine similarity matching, effectively resisting the influence of random errors in the diffusion model and improving the accuracy of decoding. Through a hierarchical decoding process of single-position decoding, single-time-step arrangement, and multi-time-step combination, the temporal relationship of gate operations and the quantum bit connection relationship are not lost. At the same time, invalid matches are filtered by a preset similarity threshold, reducing the number of invalid candidate sub-circuits and improving the efficiency of subsequent weight calculation and fidelity verification, providing decoding-level support for the accuracy and efficiency of the decomposition results.

[0155] According to an embodiment of the present invention, based on the decoding results and qubit indices of multiple qubit positions, the gate operations at multiple qubit positions within each circuit depth layer are arranged to obtain a gate operation sequence for each circuit depth layer. This includes: for each circuit depth layer, traversing multiple qubit positions within the circuit depth layer, and performing the following operations based on the decoding results of the qubit positions: if the decoding result is a single-qubit gate, determining the single-qubit gate at the qubit position within the circuit depth layer; if the decoding result is a two-qubit gate, searching for another qubit position within the circuit depth layer with a standard vector sign opposite to that of the qubit position; pairing the qubit position with the other qubit position, determining the qubit position as the control qubit of the two-qubit gate, and determining the other qubit position as the target qubit of the two-qubit gate; if the decoding result is a padding vector or a background vector, determining a no-operation at the qubit position.

[0156] In this embodiment, for each circuit depth layer, all qubit positions within that layer are traversed first, and then the operation is performed according to the decoding result of each qubit position, such as the operation type corresponding to the target standard vector, to ensure that the gate operation sequence is accurate and complete.

[0157] In this embodiment, if the decoding result is a single-qubit gate, the corresponding single-qubit gate is directly determined at the qubit position, and the gate operation and the corresponding qubit index are recorded without additional pairing operations.

[0158] For example, if the decoding result of a certain qubit position (q=2, t=5) is an H gate, which is a single qubit gate, then the gate operation at that position is directly determined to be H(2), where "2" is the qubit index, used to identify the specific qubit that the gate operates on.

[0159] In this embodiment, if the decoding result is a two-qubit gate: due to the rule of "control qubits filling the original vector and target qubits filling the opposite vector" adopted in the encoding stage, the two qubit positions corresponding to the two-qubit gate after decoding have cosine similarity signs opposite to the same standard vector in the preset standard vector library. Therefore, it is necessary to search for another qubit position with a cosine similarity sign opposite to the standard vector of the qubit position within the current circuit depth layer. If a pairing position is found, the two qubit positions are paired. The qubit position with the original standard vector is determined as the control qubit of the two-qubit gate, and the other qubit position with the opposite standard vector is determined as the target qubit of the two-qubit gate. At the same time, the two qubit gates and the corresponding control-target qubit indices are recorded. If no valid pairing position with opposite signs can be found within the current circuit depth layer, the decoding of the two-qubit gate is determined to be invalid, and the sub-circuit is removed in subsequent filtering.

[0160] For example, the decoding result of a certain qubit position (q=3, t=7) is a CX gate (two-qubit gate), whose standard vector is... Within the same circuit depth t=7, the standard vector of the qubit position (q=6, t=7) is found to be: Then, the two are paired up, and the control qubit is determined to be q=3 and the target qubit is q=6. The gate operation is CX(3,6).

[0161] In this embodiment, if the decoding result is a padding vector or a background vector, a no-operation is directly determined at the position of the qubit, without the need to record the gate operation.

[0162] For example, the decoding result of a certain qubit position (q=4, t=5) is the background vector. If the position is a no-operation, it is not included in the composition of the deep layer gate operation sequence of this circuit; if the decoding result at a certain position (q=4, t=31) is a padding vector This is also determined to be a no-operation.

[0163] In this embodiment, after traversal is completed, all the determined valid gate operations within the circuit depth layer, such as single-qubit gates and paired two-qubit gates, are arranged in ascending order of qubit index to obtain the gate operation sequence of the circuit depth layer, ensuring that the sequence is ordered and the logic is clear.

[0164] According to an embodiment of the present invention, after decoding the target tensor to obtain multiple candidate sub-circuits, the method further includes: performing syntax filtering on the multiple candidate sub-circuits to eliminate candidate sub-circuits that do not meet preset syntax rules, thereby obtaining a first set of intermediate candidate sub-circuits; performing constraint filtering on the first set of intermediate candidate sub-circuits according to decomposition constraint conditions to eliminate candidate sub-circuits that do not meet decomposition constraint conditions, thereby obtaining a second set of intermediate candidate sub-circuits; and determining the multiple sub-circuits included in the second set of intermediate candidate sub-circuits as multiple candidate sub-circuits.

[0165] In this embodiment, multiple candidate sub-circuits are filtered to obtain filtered candidate sub-circuits. The filtering process eliminates invalid candidate sub-circuits caused by noise interference and similarity matching deviations during the decoding process, reducing the computational overhead of subsequent weight calculations and fidelity verification, and ensuring that all sub-circuits participating in the decomposition meet the requirements.

[0166] In this embodiment, the filtering process includes syntax verification and constraint verification. Syntax verification ensures that the gate operation sequence of the sub-circuit conforms to the basic syntax rules of quantum circuits. Constraint verification ensures that the sub-circuit conforms to preset decomposition constraints. The combination of these two methods enables precise selection of candidate sub-circuits.

[0167] Preset syntax rules are fundamental rules based on the operational logic of quantum circuits, used to avoid invalid gate operation combinations. In one example, preset syntax rules may include: within the same time step, the same qubit may not perform multiple single-qubit gate operations to avoid gate operation conflicts; two-qubit gates must have unique control qubits and target qubits, and the control qubits and target qubits may not be the same to avoid self-actualizing invalid gates; the control bits and target bits of two-qubit gates must appear in pairs, and there should be no isolated two-qubit gate control bits or target bits at the end of the gate operation sequence to ensure the integrity of the two-qubit gates.

[0168] In this embodiment, during the syntax verification process, the gate operation sequence of each candidate sub-circuit is checked one by one. If any preset syntax rule is violated, the candidate sub-circuit is determined to be invalid and is eliminated. If all rules are met, the syntax verification is passed.

[0169] Constraint verification is used to verify whether each of the multiple candidate sub-circuits satisfies the decomposition constraint conditions.

[0170] In this embodiment, during the constraint verification process, each candidate sub-circuit is examined one by one, and the following operations are performed: If the decomposition constraint includes a maximum allowed number of qubits for the sub-circuit, the actual number of qubits contained in the sub-circuit is counted; if it exceeds the maximum allowed number of qubits, the sub-circuit is eliminated. If the decomposition constraint includes an allowed set of gates, all quantum gates contained in the sub-circuit are examined; if there are quantum gates that exceed the allowed set of gates, the sub-circuit is eliminated.

[0171] In this embodiment, only candidate sub-circuits that pass both syntax verification and constraint verification can be used as filtered candidate sub-circuits and proceed to the subsequent weight calculation step. In a specific embodiment, the number of filtered candidate sub-circuits is maintained at 60% to 80% of the initial number of candidate sub-circuits, ensuring diversity while avoiding invalid calculations.

[0172] Based on this, by employing dual filtering through syntax verification and constraint verification, invalid candidate sub-circuits generated during the decoding process are effectively eliminated, preventing them from participating in subsequent weight calculations and fidelity verifications, thus significantly reducing the overall computational overhead. Simultaneously, the filtered candidate sub-circuits all conform to the quantum gate operation syntax and decomposition constraints, ensuring the effectiveness and accuracy of the subsequent decomposition process and avoiding decomposition failures or substandard fidelity due to invalid sub-circuits, further improving the stability and efficiency of the decomposition method.

[0173] According to an embodiment of the present invention, the quantum unitary matrix quasi-probabilistic decomposition method based on the diffusion model further includes: constructing a set of matrix equations based on the unitary matrices corresponding to each of the multiple candidate sub-circuits, solving the set of matrix equations by the least squares method to obtain the real weights of each of the multiple candidate sub-circuits, so as to minimize the Frobenius norm between the weighted sum matrix and the target quantum unitary matrix.

[0174] The matrix equation system is constructed based on the core requirement of approximating the target quantum unitary matrix using weighted sum matrix. Its core equation is:

[0175] (3);

[0176] in, It is the target quantum unitary matrix. It is the real weight of the i-th candidate sub-circuit. It is the unitary matrix corresponding to the i-th candidate sub-circuit, and K is the number of candidate sub-circuits after filtering.

[0177] In this embodiment, due to and All For a complex matrix, expanding the matrix elements into real numbers and splitting each complex number into its real and imaginary parts transforms the matrix equation into a system of linear equations, making it easier to solve.

[0178] In this embodiment, the real weights of multiple candidate sub-circuits are obtained by solving the matrix equations using the least squares method, including converting the target quantum unitary matrix and the unitary matrices corresponding to the multiple candidate sub-circuits into real vector form. The real vector form is the process of converting a complex matrix into a one-dimensional real vector.

[0179] In one specific implementation, let the target quantum unitary matrix be... The dimension is Where D=2 n For any A complex matrix A, whose elements are ,in, Indicates the real part, Representing the imaginary part, extract the real and imaginary parts of all elements in row-major order to obtain a 2D array. 2 A real vector. For example, The complex matrix is ​​transformed into a real vector of length 8. This transformation converts the complex matrix equation into a system of real linear equations, reducing the difficulty of solving the problem.

[0180] In this embodiment, the real weights of multiple candidate sub-circuits are obtained by solving the matrix equation system using the least squares method, including: constructing a linear equation system based on real vector form.

[0181] In one specific implementation, the real vectors of the K candidate sub-circuits are used as column vectors to form a matrix. ,Right now , where vec(U i ) represents the unitary matrix U corresponding to the i-th candidate sub-circuit. i Extract the real and imaginary parts of all elements in row-major order, and concatenate them to form a 2D array. 2 Real vectors, target quantum unitary matrix The real vector is denoted as The real weight vector to be solved is denoted as , where w i The weights of the i-th candidate sub-circuit are represented by the following linear equations: That is, by linearly combining the real vectors of the candidate sub-circuits with the weight vector w, the real vector u can be approximated.

[0182] In this embodiment, the real weights of multiple candidate sub-circuits are obtained by solving the matrix equation system using the least squares method, including: solving the linear equation system using the least squares method to obtain the optimal weight vector, and determining the elements in the optimal weight vector as the real weights of the multiple candidate sub-circuits.

[0183] In one specific implementation, the least squares method is used to minimize the objective function, that is, to minimize the sum of squared errors between the weighted combination vector and the objective vector. The optimal weight vector obtained after solving is the real weight (which can be positive or negative) of each candidate sub-circuit. In one specific implementation, it can be solved directly using gradient descent or the Moore-Penrose pseudo-inverse method. In one example, gradient descent is used to solve the least squares problem, with the number of iterations set to 1000 and the convergence threshold set to... This ensures the accuracy of the weight calculation.

[0184] Based on this, embodiments of the present invention transform the quasi-probability weighting problem into an efficient linear optimization problem by converting complex matrices into real vectors and constructing a system of linear equations, thus avoiding the complex iterations and high computational overhead of traditional weighting methods. The least squares method is employed to ensure that the obtained real weights maximize the approximation of the target quantum unitary matrix, providing weight-level support for achieving subsequent fidelity. Furthermore, this solution method is compatible with the sign requirement of quasi-probability weights, eliminating the need for additional constraints on non-negativity, thereby improving the efficiency and accuracy of weighting.

[0185] According to an embodiment of the present invention, the quasi-probabilistic decomposition method of quantum unitary matrix based on diffusion model further includes: constructing a target quantum channel matrix according to the target quantum unitary matrix; constructing a decomposed quantum channel matrix according to the weighted sum matrix; projecting the decomposed quantum channel matrix onto the matrix set of standard quantum channels to obtain the projected quantum channel matrix; and calculating the fidelity between the target quantum channel matrix and the projected target quantum channel matrix.

[0186] In this embodiment, traditional quantum state fidelity can only characterize the output similarity under specific input states and cannot globally characterize the overall effect of the quantum channel. Furthermore, the weighted sum matrix obtained by quasi-probabilistic decomposition corresponds to the Hermitic-Preserving and Trace-Preserving (HPTP) mapping, which is not the Completely Positive Trace-Preserving (CPTP) mapping corresponding to legitimate quantum evolution. Directly calculating the fidelity will lead to the distortion of the evaluation results. Therefore, Choi fidelity needs to be introduced, and the physical validity of the evaluation needs to be ensured through a projection step.

[0187] In this embodiment, the quantum evolution process corresponding to the quantum unitary operation can be fully characterized by the quantum channel. The Choi matrix is ​​the equivalent matrix representation of the quantum channel. Any quantum channel has a unique corresponding Choi matrix, and the two are in one-to-one correspondence.

[0188] In one specific embodiment of the present invention, the target quantum channel matrix, the decomposed quantum channel matrix, and the projected quantum channel matrix can all be Choi matrices. The Choi matrix is ​​used to convert the quantum channel into a quantizable matrix form, which facilitates the calculation of similarity.

[0189] The target quantum channel matrix refers to the quantum channel matrix corresponding to the target quantum unitary matrix, which can be represented as a Choi matrix. The target quantum channel matrix is ​​a fully positive trace-preserving (CPTP) mapping. The formula for calculating the Choi matrix of the target quantum channel is as follows: ,in, It is the unit operator for n qubits. It is the maximally entangled state of n qubits. This represents the tensor product. Wherein, the Choi matrix corresponds to the target quantum unitary matrix. It is a positive semi-definite matrix with a rank of 1.

[0190] The decomposition of the quantum channel matrix refers to the quantum channel matrix corresponding to the weighted sum matrix, which can be represented as a Choi matrix. The CPTP mapping of the quantum channel matrix is ​​as follows: Where ρ is an arbitrary quantum state. Due to the weights of the quasi-probabilistic decomposition... This mapping can be positive or negative; it is a Hermitian-preserving and trace-preserving (HPTP) mapping, satisfying only the Hermitian property (mapping Hermitian operators to Hermitian operators) and the trace preservation property (for any quantum state ρ, it satisfies...). This relaxes the fully positive definiteness constraint of the CPTP mapping, does not correspond to legitimate quantum physical evolution, and cannot be directly used for fidelity calculations. Its Choi matrix calculation formula is consistent with the target Choi matrix, i.e. Its dimension is the same as the target Choi matrix. Consistent, for example, both are This facilitates subsequent similarity calculations.

[0191] The matrix set of a standard quantum channel represents the set of Choi matrices corresponding to all CPTP mappings, and this projection step is crucial to ensuring that the fidelity calculation has physical meaning. Because For the corresponding HPTP mapping, directly calculate its AND... Similarity can lead to distorted evaluations, therefore it is necessary to... Projecting onto the set of Choi matrices corresponding to the nearest CPTP mapping yields a compliant CPTP mapping. and its corresponding Choi matrix This ensures that subsequent fidelity calculations conform to the laws of quantum physics.

[0192] In this embodiment, the core formula for calculating Choi fidelity is:

[0193] (4);

[0194] in, It is the conjugate transpose of the target Choi matrix. The trace of a matrix is ​​the sum of the elements on its diagonal. Represents the absolute value operation for complex numbers. 2 2n is the dimension of the Choi matrix, where n is the number of qubits corresponding to the target quantum unitary matrix. The Choi fidelity ranges from [0,1]. The closer the value is to 1, the higher the similarity between the decomposed quantum channel and the target quantum channel, i.e., the higher the approximation between the weighted sum matrix and the target quantum unitary matrix; the closer the value is to 0, the lower the approximation. In a specific embodiment of this invention, numerical calculation methods can be used to solve for the matrix trace and conjugate transpose to ensure computational accuracy.

[0195] In this embodiment, if the Choi fidelity F Choi If the fidelity is greater than the preset fidelity threshold, then multiple candidate sub-circuits and their corresponding real weights are determined as the decomposition result. If the Choi fidelity F... Choi If the value is less than or equal to the preset fidelity threshold, the process of reverse diffusion, decoding, filtering, and weight calculation is repeated until the Choi fidelity meets the threshold requirement.

[0196] In a specific embodiment of the present invention, the preset fidelity threshold can be configured to 0.95, and the Choi fidelity F Choi A decomposition result with a fidelity greater than 0.95 is considered an acceptable and effective decomposition. This preset fidelity threshold can be flexibly adjusted according to the actual precision requirements of quantum computing. For example, it can be set to 0.98 for high-precision scenarios and 0.9 for low-precision scenarios. If the threshold requirement is not met in a single iteration, optimization can be achieved by increasing the number of candidate sub-circuits, such as generating 20 target tensors in a single back-diffusion, or adjusting the diffusion model parameters, until the threshold is met, thus ensuring the accuracy of the decomposition result.

[0197] In one example, after solving for the weights, the Choi fidelity is calculated according to the above process. The specific implementation is as follows: Based on the weighted combination of the 9 filtered valid candidate sub-circuits, an HPTP mapping is constructed. C i Let i be the i-th candidate sub-circuit. Calculate the Choi matrix corresponding to this HPTP mapping. ;Will Projecting onto the nearest CPTP Choi matrix set yields compliant results. ; Calculate the target 8qubit unitary matrix as follows The corresponding Choi matrix Substituting into the core formula for calculating Choi fidelity above, we can obtain The calculated Choi fidelity of this decomposition is 0.94, which is close to the acceptable threshold of 0.95. It can be further improved to above 0.95 by increasing the number of sampling steps, which is completely in line with the experimental results.

[0198] Based on this, compared with traditional quantum state fidelity, Choi fidelity can globally characterize the similarity of quantum channels, avoiding the defect that local similarity cannot reflect the overall decomposition effect, and improving the accuracy of fidelity measurement. By adding the projection step of HPTP mapping to CPTP set, the evaluation distortion problem caused by directly calculating the fidelity of HPTP mapping and CPTP mapping in the prior art is solved, ensuring the physical validity of fidelity calculation.

[0199] Figure 2 A flowchart of the training process according to a specific embodiment of the present invention is shown.

[0200] In this specific embodiment, the quasi-probabilistic decomposition of an 8qubit target quantum unitary matrix is ​​taken as the specific scenario. The training process includes operations S201~S205.

[0201] In operation S201, obtain the training dataset.

[0202] In this embodiment, a preprocessed simulated quantum circuit training dataset is loaded. The training dataset contains 69,075 simulated quantum circuits and a corresponding unitary matrix for each sample quantum circuit; the samples cover 2-8 qubits, and the quantum gate set includes X-gate, Y-gate, Z-gate, H-gate, CX-gate, S-gate, and so on. Door, T-door, There are 9 types of gates. All samples have been optimized using quantum circuit compilation tools, such as removing redundant gates and deduplication. The data is divided into 80% training set, 10% validation set, and 10% test set. The gate frequency meets the preset constraints.

[0203] In operation S202, each sample quantum circuit in the training dataset is encoded to obtain a three-dimensional data tensor corresponding to each of the multiple sample quantum circuits.

[0204] In this embodiment, firstly, mutually orthogonal unit gate embedding vectors are assigned to each quantum gate in the preset gate set; filling vectors are assigned to filling operations; and background vectors are assigned to background operations. Then, the initial three-dimensional data tensor is determined based on the number of qubits and the maximum circuit depth of the sample quantum circuit. , where n q =8,n t =30, d gate=11, then iterate through each qubit of each circuit depth layer, and fill the corresponding vector according to the gate operation type (single qubit gate, two qubit gate, no gate operation). The two qubit gate adopts the rule of filling the original vector with the control bit and filling the opposite vector with the target bit. Finally, add a two-dimensional sinusoidal position code to the filled tensor to retain the absolute position information of the qubit index and the circuit depth.

[0205] In operation S203, a joint conditional vector is constructed, and forward diffusion is performed on each three-dimensional data tensor to generate multiple noisy tensors.

[0206] In this embodiment, for each sample quantum circuit, the sample unitary matrix (8qubit sample dimension is...) is... The SVD dimensionality reduction method was used to obtain a 64-dimensional unitary embedding vector. Simultaneously, the preset decomposition constraints (such as the maximum allowed number of qubits in the sub-circuit m=4, or a pure Clifford gate set) are encoded to obtain the constraint embedding vector. By concatenating and projecting the two, a joint condition vector is obtained. The diffusion step count R=1000 is set, and a cosine beta scheduling strategy is used to progressively add Gaussian noise to the three-dimensional data tensor output by operation S202, generating noisy tensors X with different noise levels. r Each noise tensor corresponds to a unique diffusion step number r.

[0207] In operation S204, the initial diffusion model is trained based on the noise tensor, the diffusion steps corresponding to the noise tensor, and the joint conditional vector. The model parameters of the initial diffusion model are then optimized using the objective loss function to obtain the conditional diffusion model.

[0208] In this embodiment, the noise-adding tensor X r The number of diffusion steps R for conversion to two-dimensional sinusoidal position coding, and the joint condition vector. Input an initial diffusion model, train the model to predict noise, and apply the target loss function. The model parameters are optimized through backpropagation, and an early stopping strategy is adopted, such as using the validation set Choi MSE loss not decreasing for 10 consecutive training rounds as a termination condition to terminate training.

[0209] In operation S205, the trained model parameters are saved, and the model is tested on the validation set.

[0210] In this embodiment, under the constraint that the maximum allowed number of qubits in the sub-circuit is m=4, the Choi fidelity of the validation set decomposition is ≥0.92; under the constraint that the allowed set of gates is a pure Clifford gate set, the Choi fidelity of the validation set decomposition is ≥0.78, ensuring that the model meets the requirements for subsequent inference. If the validation fails, the process returns to operation S204 to adjust the model parameters and retrain; if the validation passes, the model is saved and the training process terminates.

[0211] Figure 3 A flowchart illustrating the reasoning process according to a specific embodiment of the present invention is shown.

[0212] like Figure 3 As shown, the reasoning process includes operations S301 to S308.

[0213] In operation S301, the target quantum unitary matrix and decomposition constraints are obtained.

[0214] In this embodiment, the input is an 8qubit target quantum unitary matrix U to be decomposed. target The matrix has a dimension of 256×256, which satisfies the unitarity condition. At the same time, the decomposition constraint condition is set as the maximum allowable number of qubits in the sub-circuit m=4 (m<8).

[0215] In operation S302, the target quantum unitary matrix is ​​encoded based on the decomposition constraint conditions to obtain the joint condition vector.

[0216] In this embodiment, the target quantum unitary matrix U target SVD dimensionality reduction is performed to obtain a 64-dimensional unitary embedding vector. Encode the decomposition constraints, such as the maximum allowed number of qubits m=4 for the sub-circuit, to obtain the constraint embedding vector. Unitary embedding vector With constraint embedding vector By concatenating and projecting, we obtain the joint condition vector. This vector integrates the core features and decomposition constraints of the target quantum unitary matrix, providing precise guidance for the subsequent back diffusion process.

[0217] In operation S303, the joint conditional vector is back-diffused based on the conditional diffusion model to obtain the target tensor.

[0218] In this embodiment, the trained conditional diffusion model is invoked, and an initial noise tensor is sampled first. Then, following the aforementioned reverse diffusion process, the noise tensor is iterated and updated 1000 times. In each step, the tensor features are adjusted based on the noise predicted by the model to ensure that the generated target tensor is... It meets the constraint requirement of m=4.

[0219] By operating S304, the target tensor is decoded to obtain multiple candidate sub-circuits.

[0220] In this embodiment, for the target tensor The cosine similarity matching decoding method is adopted to calculate the cosine similarity between the position vector of each qubit and each standard vector in the preset standard vector library. The target standard vector is selected and converted into the corresponding gate operation. Multiple candidate sub-circuits are obtained by combining them according to the circuit depth index. After decoding and deduplication, 12 candidate sub-circuits are obtained.

[0221] In this embodiment, 12 candidate sub-circuits are subjected to syntax verification and constraint verification. Syntax verification ensures that the gate operation sequence conforms to the basic syntax rules of quantum circuits, and constraint verification ensures that the number of qubits in the sub-circuit does not exceed m=4. Finally, 2 invalid sub-circuits are eliminated, and 10 valid candidate sub-circuits are retained.

[0222] In operation S305, the real weights of each candidate sub-circuit are calculated based on the unitary matrix corresponding to each candidate sub-circuit.

[0223] In this embodiment, the unitary matrix U corresponding to each of the 10 valid candidate sub-circuits is obtained. i , will U target With all unitary matrices U i Convert to real vector form and construct a system of linear equations. Each column of V is , The real weights of each candidate sub-circuit are obtained by using the least squares method. .

[0224] In operation S306, a weighted sum matrix of multiple candidate sub-circuits is calculated based on their respective real weights.

[0225] In this embodiment, the weighted sum matrix is ​​calculated. .

[0226] In operation S307, it is determined whether the fidelity between the weighted sum matrix of each of the multiple candidate sub-circuits and the target quantum unitary matrix meets the preset fidelity threshold. If yes, operation S308 is executed; otherwise, operation S303 is executed.

[0227] In this embodiment, based on the aforementioned Choi fidelity calculation method, the weighted sum matrix and U are calculated. target The Choi fidelity between them was calculated to obtain F. Choi =0.95, which meets the preset fidelity threshold. If the fidelity does not meet the threshold, return to S303 to re-execute the reverse diffusion and subsequent steps; if it meets the threshold, execute operation S308.

[0228] In operation S308, the weights of multiple candidate sub-circuits and their respective values ​​are determined as the decomposition result of the target quantum unitary matrix.

[0229] In this embodiment, the final decomposition result is output when the Choi fidelity meets a preset threshold. Simultaneously, the time consumed in the decomposition is recorded, completing the entire reasoning process.

[0230] This application also proposes a quantum unitary matrix quasi-probabilistic decomposition device based on a diffusion model.

[0231] Figure 4 A block diagram of a quantum unitary matrix quasi-probabilistic decomposition apparatus based on a diffusion model according to an embodiment of this application is shown.

[0232] like Figure 4 As shown, the quantum unitary matrix quasi-probabilistic decomposition device 400 based on the diffusion model includes an encoding module 410, a diffusion generation module 420, a decoding module 430, a calculation module 440, and a determination module 450.

[0233] The encoding module 410 is used to encode the target quantum unitary matrix based on the decomposition constraint conditions in response to receiving the target quantum unitary matrix, so as to obtain the joint condition vector.

[0234] The diffusion generation module 420 is used to perform back diffusion processing on the joint condition vector based on the conditional diffusion model to obtain the target tensor that satisfies the decomposition constraint conditions.

[0235] The decoding module 430 is used to decode the target tensor to obtain multiple candidate sub-circuits.

[0236] The calculation module 440 is used to calculate the weighted sum matrix of multiple candidate sub-circuits based on their respective real weights.

[0237] The determination module 450 is used to determine the weights of the multiple candidate sub-circuits as the decomposition result of the target quantum unitary matrix, provided that the fidelity between the weighted sum matrix of the multiple candidate sub-circuits and the target quantum unitary matrix meets a preset fidelity threshold.

[0238] Any one or more of the modules, submodules, units, and subunits according to the embodiments of this application, or at least part of the functions of any one or more of them, can be implemented in one module. Any one or more of the modules, submodules, units, and subunits according to the embodiments of this application can be implemented by dividing them into multiple modules. Any one or more of the modules, submodules, units, and subunits according to the embodiments of this application can be at least partially implemented as hardware circuits, such as field-programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems-on-a-chip, systems-on-a-substrate, systems-on-package, application-specific integrated circuits (ASICs), or implemented by hardware or firmware in any other reasonable manner by integrating or packaging circuits, or implemented in any one of software, hardware, and firmware, or in a suitable combination of any of these. Alternatively, one or more of the modules, submodules, units, and subunits according to the embodiments of this application can be at least partially implemented as computer program modules, which, when run, can perform corresponding functions.

[0239] For example, any plurality of the encoding module 410, diffusion generation module 420, decoding module 430, calculation module 440, and determination module 450 can be combined into one module / unit / subunit, or any one of these modules / units / subunits can be split into multiple modules / units / subunits. Alternatively, at least part of the functionality of one or more of these modules / units / subunits can be combined with at least part of the functionality of other modules / units / subunits and implemented in one module / unit / subunit. According to embodiments of this application, at least one of the encoding module 410, diffusion generation module 420, decoding module 430, calculation module 440, and determination module 450 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging the circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the encoding module 410, diffusion generation module 420, decoding module 430, calculation module 440, and determination module 450 may be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.

[0240] It should be noted that the quantum unitary matrix quasi-probability decomposition device based on the diffusion model in the embodiments of this application corresponds to the quantum unitary matrix quasi-probability decomposition method based on the diffusion model in the embodiments of this application. For a detailed description of the quantum unitary matrix quasi-probability decomposition device based on the diffusion model, please refer to the quantum unitary matrix quasi-probability decomposition method based on the diffusion model, which will not be repeated here.

[0241] Figure 5 A block diagram of an electronic device suitable for implementing a quantum unitary matrix quasi-probabilistic decomposition method based on a diffusion model, according to an embodiment of this application, is shown. Figure 5 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0242] like Figure 5 As shown, an electronic device according to an embodiment of this application includes a processor 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory ROM 502 or a program loaded from a storage portion 508 into a random access memory RAM 503. The processor 501 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this application.

[0243] RAM 503 stores various programs and data required for the operation of the electronic device. Processor 501, ROM 502, and RAM 503 are interconnected via bus 504. Processor 501 executes various operations of the method flow according to embodiments of this application by executing programs in ROM 502 and / or RAM 503. It should be noted that the programs may also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 may also execute various operations of the method flow according to embodiments of this application by executing programs stored in said one or more memories.

[0244] According to embodiments of this application, the electronic device may further include an input / output (I / O) interface 505, which is also connected to a bus 504. The electronic device may also include one or more of the following components connected to the input / output (I / O) interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 510 as needed so that computer programs read from it can be installed into the storage section 508 as needed.

[0245] According to embodiments of this application, the method flow according to embodiments of this application can be implemented as a computer software program. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by processor 501, it performs the functions defined in the system of embodiments of this application. According to embodiments of this application, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0246] This application also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of this application.

[0247] According to embodiments of this application, the computer-readable storage medium can be a non-volatile computer-readable storage medium. Examples include, but are not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0248] For example, according to embodiments of this application, a computer-readable storage medium may include the ROM 502 and / or RAM 503 described above and / or one or more memories other than ROM 502 and RAM 503.

[0249] Embodiments of this application also include a computer program product, which includes a computer program containing program code for performing the methods provided in the embodiments of this application. When the computer program product is run on an electronic device, the program code is used to enable the electronic device to implement the transformer inrush current risk identification method provided in the embodiments of this application.

[0250] When the computer program is executed by the processor 501, it performs the functions defined in the system / apparatus of this application embodiment. According to the embodiments of this application, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0251] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 509, and / or installed from a removable medium 511. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0252] According to embodiments of this application, program code for executing the computer programs provided in the embodiments of this application can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0253] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions. Those skilled in the art will understand that the features described in the various embodiments of the present invention can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present invention. In particular, the features described in the various embodiments of the present invention can be combined and / or combined in various ways without departing from the spirit and teachings of the present invention. All such combinations and / or pairings fall within the scope of this invention.

[0254] The embodiments of the present invention have been described above. However, these embodiments are merely illustrative and not intended to limit the scope of the invention. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of the invention, and all such substitutions and modifications should fall within the scope of the invention.

Claims

1. A quasi-probabilistic decomposition method for quantum unitary matrices based on a diffusion model, characterized in that, The quantum unitary matrix quasi-probabilistic decomposition method includes: In response to receiving the target quantum unitary matrix, the target quantum unitary matrix is ​​encoded based on the decomposition constraint conditions to obtain the joint condition vector; The joint conditional vector is back-diffused based on the conditional diffusion model to obtain the target tensor that satisfies the decomposition constraint conditions. Decoding the target tensor yields multiple candidate sub-circuits; Based on the real weights of each of the candidate sub-circuits, a weighted sum matrix of the candidate sub-circuits is calculated, wherein the real weights include positive weights and negative weights. If the fidelity between the weighted sum matrix of each of the plurality of candidate sub-circuits and the target quantum unitary matrix satisfies a preset fidelity threshold, the weights of the plurality of candidate sub-circuits and their respective weights are determined as the decomposition result of the target quantum unitary matrix.

2. The quantum unitary matrix quasi-probabilistic decomposition method according to claim 1, characterized in that, The target quantum unitary matrix is ​​encoded based on the decomposition constraint conditions to obtain a joint condition vector, including: The target quantum unitary matrix is ​​reduced in dimension to obtain the unitary embedding vector; The decomposed constraints are encoded to obtain constraint embedding vectors; The unitary embedding vector and the constraint embedding vector are concatenated to obtain the joint condition vector.

3. The quantum unitary matrix quasi-probabilistic decomposition method according to claim 2, characterized in that, The decomposition constraints include at least one of the following: The maximum allowed number of qubits in the sub-circuit, wherein the maximum allowed number of qubits is less than the number of qubits in the target quantum unitary matrix; The allowed set of doors, which is either a set of Clifford doors or a set of doors consisting of Clifford doors and at most one type of non-Clifford door.

4. The quantum unitary matrix quasi-probabilistic decomposition method according to claim 1, characterized in that, The conditional diffusion model is trained through the following operations: Obtain a training dataset, which includes multiple sample quantum circuits and a sample unitary matrix corresponding to each sample quantum circuit; Encode each of the multiple sample quantum circuits to obtain a three-dimensional data tensor corresponding to each of the multiple sample quantum circuits. The dimensions of the three-dimensional data tensor include the quantum bit number dimension, the circuit depth dimension, and the gate embedding dimension. Forward diffusion is performed on each of the three-dimensional data tensors to generate multiple noisy tensors with different noise levels corresponding to each of the three-dimensional data tensors, wherein each noisy tensor corresponds to one diffusion step; Based on the noise tensor, the diffusion steps corresponding to the noise tensor, and the joint conditional vector, the initial diffusion model is trained, and the model parameters of the initial diffusion model are optimized using the objective loss function to obtain the conditional diffusion model.

5. The quantum unitary matrix quasi-probabilistic decomposition method according to claim 4, characterized in that, The target loss function comprises a weighted sum of syntax loss and physical loss; The syntax loss is used to determine the difference between the prediction gate operation sequence obtained by decoding the prediction tensor output by the initial diffusion model and the gate operation sequence obtained by decoding the three-dimensional data tensor corresponding to each of the plurality of sample quantum circuits. The physical loss is used to determine the difference between a first matrix corresponding to the sample quantum circuit and a second matrix corresponding to the prediction tensor, wherein both the first matrix and the second matrix characterize the quantum channel matrix.

6. The quantum unitary matrix quasi-probabilistic decomposition method according to claim 4, characterized in that, Encoding is performed on each of the plurality of sample quantum circuits to obtain a three-dimensional data tensor corresponding to each of the plurality of sample quantum circuits, including: Assign mutually orthogonal unit vectors to each quantum gate in the preset gate set as gate embedding vectors for each quantum gate; For each of the sample quantum circuits, the initial three-dimensional data tensor of the sample quantum circuit is determined based on the number of qubits and the maximum circuit depth of the sample quantum circuit. The sample quantum circuit is traversed, and the positions of the qubits in the initial three-dimensional data tensor are filled according to the gate operation type of the qubit position. The qubit positions are determined by the qubit index and the circuit depth index. Position encoding is added to the initial three-dimensional data tensor after filling to obtain the three-dimensional data tensor of the sample quantum circuit.

7. The quantum unitary matrix quasi-probabilistic decomposition method according to claim 6, characterized in that, The initial three-dimensional data tensor is filled with qubit positions according to the gate operation type at each qubit position, including: A fill vector is assigned to the fill operation, and a background vector is assigned to the background operation; wherein the fill vector, the background vector, and the gate embedding vector are all pairwise orthogonal to each other; For the circuit depth layer in the sample quantum circuit that exceeds the actual circuit depth, the qubit positions are filled with the filling vector; In the absence of gate operations at the qubit location, the qubit location is filled with the background vector.

8. The quantum unitary matrix quasi-probabilistic decomposition method according to claim 6, characterized in that, Filling the qubit positions in the initial three-dimensional data tensor according to the gate operation type at the qubit positions further includes: If a single-qubit gate exists at the qubit position, the qubit position in the initial three-dimensional data tensor is filled with the gate embedding vector of the single-qubit gate; When there are two qubit gates at the qubit position, and the qubit is the control qubit of the two qubit gates, the qubit position in the initial three-dimensional data tensor corresponding to the control qubit is filled with the gate embedding vector of the two qubit gates; When the two qubit gates exist at the qubit position and the qubit is the target qubit of the two qubit gates, the qubit position in the initial three-dimensional data tensor corresponding to the target qubit is filled with the opposite vector of the gate embedding vector of the two qubit gates.

9. The quantum unitary matrix quasi-probabilistic decomposition method according to claim 1, characterized in that, The target tensor includes multiple qubit positions, and each qubit position has a position vector; The target tensor is decoded to obtain multiple candidate sub-circuits, including: The cosine similarity between the position vector of each of the multiple qubits and each standard vector in the preset standard vector library is calculated. The gate operation corresponding to the target standard vector is determined as the decoding result of each of the multiple qubit positions, wherein the target standard vector is the standard vector with the largest absolute value of the cosine similarity that exceeds the preset similarity threshold; Based on the decoding results and qubit indices of the multiple qubit positions, the gate operations at the multiple qubit positions included in each circuit depth layer are arranged to obtain the gate operation sequence of each circuit depth layer; Based on the circuit depth index, the gate operation sequences of each of the multiple circuit depth layers are combined to obtain the multiple candidate sub-circuits.

10. The quantum unitary matrix quasi-probabilistic decomposition method according to claim 9, characterized in that, Based on the decoding results and qubit indices of the plurality of qubit positions, the gate operations at the plurality of qubit positions within each circuit depth layer are arranged to obtain the gate operation sequence for each circuit depth layer, including: For each circuit depth layer, traverse the plurality of qubit locations within the circuit depth layer and perform the following operations based on the decoding results of the qubit locations: If the decoding result is a single-qubit gate, the single-qubit gate is determined at the location of the qubit within the circuit depth layer; If the decoding result is a two-qubit gate, within the circuit depth layer, find another qubit position with the opposite standard vector sign to the qubit position; pair the qubit position with the other qubit position, and determine the qubit position as the control qubit of the two-qubit gate, and determine the other qubit position as the target qubit of the two-qubit gate; If the decoding result is a padding vector or a background vector, a no-operation is determined at the position of the qubit.

11. The quantum unitary matrix quasi-probabilistic decomposition method according to claim 10, characterized in that, After decoding the target tensor to obtain multiple candidate sub-circuits, the method further includes: The multiple candidate sub-circuits are subjected to syntax filtering to eliminate candidate sub-circuits that do not meet the preset syntax rules, thereby obtaining a first intermediate candidate sub-circuit set. The first set of intermediate candidate sub-circuits is subjected to constraint filtering based on the decomposition constraints, and candidate sub-circuits that do not meet the decomposition constraints are eliminated to obtain the second set of intermediate candidate sub-circuits. The multiple sub-circuits included in the second set of intermediate candidate sub-circuits are determined as the multiple candidate sub-circuits.

12. A quantum unitary matrix quasi-probabilistic decomposition device based on a diffusion model, characterized in that, The quantum unitary matrix quasi-probabilistic decomposition device includes: The encoding module is used to encode the target quantum unitary matrix based on the decomposition constraint conditions in response to receiving the target quantum unitary matrix, so as to obtain a joint condition vector; The diffusion generation module is used to perform back diffusion processing on the joint condition vector based on the conditional diffusion model to obtain the target tensor that satisfies the decomposition constraint conditions. A decoding module is used to decode the target tensor to obtain multiple candidate sub-circuits; The calculation module is used to calculate the weighted sum matrix of the multiple candidate sub-circuits based on their respective real weights, wherein the real weights include positive weights and negative weights. The determining module is used to determine the weights of the multiple candidate sub-circuits and their respective weights as the decomposition result of the target quantum unitary matrix, provided that the fidelity between the weighted sum matrix of each of the multiple candidate sub-circuits and the target quantum unitary matrix meets a preset fidelity threshold.