Efficient simulation processing method of non-adjacent bit quantum gate

By dynamically selecting the overall contraction and decomposition strategy or the traditional SWAP gate insertion method in non-adjacent bit quantum gate operations, the problems of excessive computational cost and memory overhead in the MPS simulation method are solved, efficient quantum circuit simulation is achieved, and the application scope and computational efficiency of medium and large-scale quantum algorithms are improved.

CN120671858APending Publication Date: 2025-09-19NAT UNIV OF DEFENSE TECH

Patent Information

Application Number
CN202510820138.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-19
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

Existing quantum circuit simulation methods based on matrix product states (MPS) frequently perform tensor contraction and tensor decomposition operations when processing non-adjacent bit quantum gate operations, resulting in excessively high computational costs and memory overhead, which limits their application scope in medium and large-scale quantum algorithms, especially when operating non-adjacent quantum bits across large distances.

Method used

A hybrid control method for non-adjacent bit quantum gates is proposed. By dynamically selecting the overall contraction and decomposition strategy or the traditional SWAP gate insertion method, the optimal simulation method is automatically determined during each non-adjacent bit gate operation based on indicators such as tensor dimension information and bit spacing, avoiding multiple insertions of SWAP gates and using overall contraction and decomposition operations to restore the MPS structure.

Benefits of technology

It significantly improves simulation efficiency and resource utilization, can reduce execution time by about 50% in high-entanglement scenarios, and provide 30-40% time acceleration in typical quantum algorithm scenarios. It is suitable for scenarios such as quantum Fourier transform and quantum chemistry Hamiltonian solution, reducing the requirements for hardware performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120671858A_ABST
    Figure CN120671858A_ABST
Patent Text Reader

Abstract

An improved non-adjacent bit quantum gate efficient analog calculation method comprises the steps that S1, dimension information of each tensor in a tensor network is obtained, the dimension information comprises the physical dimension and the auxiliary dimension of the current quantum state tensor, and the auxiliary dimension of the quantum state tensor after the quantum gate is acted is judged for subsequent contraction judgment and resource evaluation; s2, selecting a corresponding strategy for execution based on the target bit spacing and the tensor dimension; s3, judging whether the dimension of the contracted intermediate tensor exceeds a preset resource limit or not under the condition that the overall contraction mode is adopted; if the target bit exceeds the limit, inserting an SWAP gate through an overall contraction and decomposition strategy to rearrange the target bit to the maximum distance under the memory limit, and circulating to S3 for judgment; and if the limit is not exceeded, executing normally. Experiments show that in a highly entangled quantum circuit, the method of the invention can realize about 50% of simulation time optimization at most, and can limit the maximum intermediate tensor scale at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical field:

[0001] The present invention relates to the field of quantum computing simulation technology, and in particular to an efficient simulation processing (computation) method for non-adjacent bit quantum gates of a quantum circuit simulator based on matrix product states. Background technology:

[0002] The quantum circuit model, also known as a quantum circuit, is a universal computational model for quantum computing and is currently the mainstream model, corresponding to the classical circuit model. In a quantum circuit, quantum states are continuously modified through a series of quantum gate operations to achieve specific computational tasks. Quantum gates, the basic operating units of quantum circuits, function similarly to logic gates in traditional digital circuits. Unlike most traditional logic gates, quantum logic gates must generally be reversible and can be represented using unitary matrices.

[0003] The width of a quantum circuit is typically used to represent the number of qubits involved in the circuit, while the depth of a quantum circuit is defined as the maximum number of consecutive time steps required to execute the entire circuit—that is, the maximum number of layers of gate operations that can be executed in parallel within each time step. The width and depth of a quantum circuit are key parameters for measuring its complexity and computational resource requirements.

[0004] Given the current state of quantum computing, quantum physics systems are limited in scale and difficult to popularize. Classical simulation methods are often used to support quantum algorithm research, which has broad application prospects in fields such as materials design and computational fluid dynamics. Generally, there are two main technical approaches for simulating quantum circuits of width n and depth d: one method maintains the complete state vector in memory for calculation, the so-called "full-amplitude simulation" method; the other method represents the quantum circuit as a tensor network model and simulates the behavior of the quantum circuit through tensor network contraction.

[0005] A tensor is a common data structure that can be viewed as a high-dimensional extension of an array, and its dimension is also called the order of the tensor. Zero-order tensors, first-order tensors, and second-order tensors correspond to scalars, vectors, and matrices, respectively. The contraction of tensors can also be viewed as an extension of matrix multiplication; the basic idea of ​​the tensor network method is that any quantum circuit can be formally represented as a network structure composed of a series of tensors, where a single-bit quantum gate corresponds to a second-order tensor and a two-bit gate corresponds to a fourth-order tensor. By contracting these tensors in a specific way, an equivalent simulation of the quantum computing process can be achieved. CN202180096422.1 discloses a method for contracting a tensor network in a simulator: specifically, it relates to simulating quantum circuits with a quantum simulator. A processor for a quantum simulator is provided. The processor is configured to execute a local search algorithm to determine a plurality of contraction expressions suitable for contracting a corresponding tensor network into a determined contracted tensor network. The processor is further configured to, for each contraction expression, determine a contraction cost for contracting the corresponding tensor network based on a cost function, and select the contraction expression with the lowest contraction cost to contract each tensor network into the contracted tensor network determined above. The cost function is based on three parameters, which respectively indicate the amount of memory required to contract the corresponding tensor network into the contracted tensor network determined above. The three parameters indicate the amount of memory required, the computational complexity, and the number of read and write operations required to contract the corresponding tensor network into the contracted tensor network determined above. Unlike the tensor network contraction method disclosed in the invention, the present invention uses a tensor network structure based on matrix multiplication of basis states to represent quantum states and optimizes key computational processes therein to achieve an efficient quantum circuit simulation computation method.

[0006] The matrix product state (MPS) is a tensor network structure used to represent the quantum state of a one-dimensional many-body quantum system. Its core concept is to transform the high-order tensor representation of the overall quantum state into multiple lower-order tensors (typically third-order tensors with three variable free dimensions) connected sequentially along a linear structure, thereby effectively compressing storage and computational resources while maintaining a certain level of accuracy. In the MPS representation, each physical bit corresponds to a tensor node, and adjacent nodes are connected via an auxiliary dimension, forming a special one-dimensional tensor network.

[0007] Quantum gates can be expressed in the form of matrix product operators (MPO). MPS and MPO are almost identical in structure, but the low-order tensor converted from the MPO form is usually fourth-order, which is different from the tensor order of MPS.

[0008] Compared to other quantum circuit simulators with tensor network structures, MPS-based simulators have significantly lower memory overhead. Each quantum gate operation immediately triggers a tensor contraction and decomposition operation to maintain the MPS structure of the entire system, while incurring additional time overhead. This mechanism maintains high simulation efficiency in scenarios with a small number of qubits and shallow quantum circuit depth.

[0009] However, as the number of qubits and circuit depth increase, frequent tensor contraction and decomposition operations significantly increase the computational cost of the simulation process, especially when operations involving non-adjacent qubits across large distances are involved. This rapid increase in resource consumption limits the application of such simulators for medium- and large-scale quantum algorithms.

[0010] The SWAP gate is a fundamental logic gate used in quantum computing to swap the states of two qubits. Its function is similar to the swap operation in classical computing, but with the added benefit of quantum superposition. In quantum circuits, the SWAP gate can be implemented by combining three CNOT gates.

[0011] For quantum gate operations acting on non-adjacent bits, existing MPS-based quantum circuit simulation methods typically employ repeated insertion of SWAP gates, temporarily moving the target bits to adjacent positions to implement the gate operation, and then returning them to their original positions using the same method after the operation. Because each SWAP gate requires tensor contraction and decomposition to maintain the MPS tensor structure, this approach incurs significant computational and memory overhead when the target bits are far apart or the quantum circuit is deep, severely impacting simulation efficiency. Summary of the invention:

[0012] To address this problem, the purpose of the present invention is to propose an improved non-adjacent bit quantum gate processing method, a hybrid control method or mechanism for the execution of non-adjacent bit quantum gates, and an overall framework of the algorithm.

[0013] The hybrid control method for non-adjacent bit quantum gate execution proposed in this paper dynamically selects the optimal simulation method. Based on indicators such as tensor dimension information, bit spacing, and preset resource thresholds, this method automatically determines whether to use a global contraction approach or fall back to traditional SWAP gate insertion for each non-adjacent bit gate operation. This method improves overall execution efficiency and resource utilization while maintaining simulation accuracy.

[0014] The technical solution of the present invention is a highly efficient simulation and computational method for non-adjacent bit quantum gates. This method is a hybrid control method or mechanism for the execution of non-adjacent bit quantum gates, which can be considered the overall framework of the algorithm of the present invention. The core is the overall contraction and decomposition method of tensors (corresponding to S4.1-S4.4). Without relying on multiple insertions of SWAP gates, this strategy completes the simulation of quantum gates between non-adjacent bits by contracting the target bit and all related tensors into a unified tensor, applying quantum gate operations, and then gradually decomposing it to restore the original MPS structure.

[0015] The hybrid control mechanism can be regarded as the overall framework of the algorithm of the present invention. The specific process includes the following steps:

[0016] S1. Obtain the dimension information of each tensor in the tensor network, including the current quantum state tensor and the auxiliary dimension size, and determine the auxiliary dimension size of the quantum state tensor after the quantum gate, which is used for subsequent contraction judgment and resource evaluation;

[0017] S2. Based on the target bit spacing and tensor dimension size, select the corresponding strategy (i.e., method) from S2.1-S2.4 to execute;

[0018] S2.1. When the tensor dimensions between target bits are strictly increasing or decreasing, the quantum gate operation is directly executed according to the overall contraction and decomposition strategy;

[0019] S2.2. When the tensor dimensions between the target bits are exactly the same, the quantum gate operation is performed by inserting multiple SWAP gates in the traditional way.

[0020] S2.3. When the tensor dimension between the target bits has a unique maximum value, insert a SWAP gate according to the overall contraction and decomposition strategy, transfer one of the target bits to the maximum value, and then perform the quantum gate operation according to the situation in S2.1.

[0021] S2.4. When the tensor dimension size between target bits has a maximum value and is not unique, first select one of the target bits and insert a SWAP gate according to the overall contraction and decomposition strategy to move it to the first or last maximum value. Then, insert multiple SWAP gates to move the selected target bit to the position of another maximum value and perform the operation according to the situation in S2.1.

[0022] S3. In all cases where the overall contraction method is adopted, determine whether the dimension of the intermediate tensor after contraction exceeds the preset resource limit (such as memory threshold or tensor rank limit);

[0023] S3.1: If the limit is exceeded, insert SWAP gates through the overall contraction and decomposition strategy to rearrange the target bits to the maximum distance under the memory limit, and loop back to S3 for judgment;

[0024] S3.2. If the limit is not exceeded, proceed normally;

[0025] S4. Performing overall contraction and decomposition operations, including steps S4.1-S4.4;

[0026] S4.1. Obtain an MPS structure tensor representing the quantum state of the quantum bit to be operated, and an MPO tensor representing the quantum gate to be operated;

[0027] S4.2. Contract all tensors of MPS structures and all tensors of MPO structures in sequence;

[0028] S4.3. Perform a tensor multiplication operation on the quantum state tensor obtained in the above two steps and the corresponding quantum gate tensor, and rearrange the tensor dimensions of the product so that the original order of physical dimensions and auxiliary dimensions is maintained;

[0029] S4.4. Use the SVD algorithm to decompose the large tensor into small tensors in descending order of the auxiliary dimensions to restore the original structure;

[0030] In scenarios with high system entanglement (manifested by large auxiliary dimensions between quantum bit tensors), this strategy can significantly reduce execution time while maintaining simulation accuracy, achieving a time optimization rate of up to approximately 50% in experiments.

[0031] The method described in the present invention is based on the matrix product state structure. In order to solve the problems of low simulation efficiency and high resource overhead caused by the traditional method of inserting multiple SWAP gates to realize non-adjacent quantum bit gate operations, a tensor overall contraction and decomposition strategy is proposed. It can significantly reduce the execution time when the auxiliary dimension of the quantum bit changes monotonically. Furthermore, the present invention also constructs a set of dynamic hybrid control mechanisms. During each non-adjacent bit operation, based on the tensor structure, auxiliary dimension distribution and computing resource constraints, it automatically determines whether to adopt the overall contraction method or return to the traditional SWAP operation path to achieve optimal simulation efficiency. Experiments show that in highly entangled quantum circuits, the method of the present invention can achieve simulation time optimization of up to about 50%, while being able to limit the maximum intermediate tensor size, thereby improving the simulator's adaptability to complex quantum circuits, accelerating quantum computing simulation, and improving the efficiency of quantum algorithm development.

[0032] Beneficial effects of the present invention: 1. The core strategy proposed in the present invention - the overall contraction and decomposition of tensors, the contraction and decomposition process of quantum state tensors, the dynamic judgment mechanism of auxiliary dimensions and the execution logic of the hybrid control strategy, demonstrate the specific technical path of the present invention to realize non-adjacent bit quantum gate operations under the tensor network structure.

[0033] 2. The strategy proposed in this invention has higher execution efficiency than the traditional method of implementing non-adjacent bit quantum gate operations by inserting multiple SWAP gates. In Examples 1 and 2, this strategy can optimize the execution time by up to approximately 50% in single-step simulations of cross-qubit gates. In Example 3, this strategy can provide approximately 30% overall time acceleration in simulations of variational Hamiltonian solutions. In Example 4, this strategy can provide approximately 40% overall time acceleration in simulations of quantum Fourier transforms.

[0034] 3. The optimization strategy proposed in this paper has good versatility and can be applied to simulate any quantum circuit structure containing non-adjacent bit quantum gates, such as typical scenarios such as quantum Fourier transform (QFT), quantum chemistry Hamiltonian solution, variational quantum algorithm (VQE, QAOA), etc., and no adjustment of algorithm parameters or core methods is required during application, which shows wide adaptability and promotion value.

[0035] 4. The overall tensor contraction and decomposition strategy is not only applicable to the quantum gate operation itself, but can also be used for the equivalent insertion of SWAP gates. That is, without the need to insert adjacent SWAP gates one by one, the temporary adjustment of bit positions can be completed through overall contraction, thereby further optimizing the operation mode.

[0036] 5. The hybrid control mechanism designed by the present invention for executing non-adjacent bit quantum gates can dynamically switch between the overall contraction strategy and the traditional SWAP gate insertion strategy, automatically selecting the optimal simulation method based on factors such as the target bit spacing and tensor dimension, combining flexibility and versatility.

[0037] 6. To adapt to computing platforms with limited memory resources, the present invention introduces a maximum intermediate tensor order limitation strategy during the simulation process, which effectively constrains computing resource consumption, reduces hardware performance requirements, and significantly improves the portability and applicability of the algorithm.

[0038] In scenarios where the system entanglement is high (manifested by a large auxiliary dimension between quantum bit tensors), the present invention can significantly reduce the execution time while maintaining simulation accuracy, and can achieve a time optimization rate of up to about 50% in experiments. The core of the improved non-adjacent bit quantum gate processing method is the overall contraction and decomposition strategy of the tensor (corresponding to S4.1-S4.4). Without relying on multiple insertions of SWAP gates, this method shrinks the target bit and all related tensors between them into a unified tensor, applies quantum gate operations, and then gradually decomposes to restore the original MPS structure, thereby completing the simulation of quantum gates between non-adjacent bits. Description of the drawings:

[0039] In order to more clearly illustrate the specific implementation of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the specific implementation or implementation technology.

[0040] Figure 1 This is a system flow chart of the hybrid control mechanism of non-adjacent bit quantum gates provided by an embodiment of the present invention;

[0041] Figure 2 Schematic diagram of the judgment mechanism of the hybrid control mechanism of non-adjacent bit quantum gates provided by an embodiment of the present invention;

[0042] Figure 3 Schematic diagram of the operation flow of the overall tensor contraction and decomposition strategy provided by an embodiment of the present invention;

[0043] Figure 4 This is an algorithm flow chart of the efficient simulation calculation method of non-adjacent bit quantum gates provided by an embodiment of the present invention;

[0044] Figure 5 This is a comparison chart of the computational efficiency between a tensor overall contraction decomposition strategy provided by an embodiment of the present invention and a traditional SWAP strategy (the number of quantum bits is 10 and the system is not entangled);

[0045] Figure 6 This is a comparison chart of the computational efficiency of another tensor overall contraction and decomposition strategy provided by an embodiment of the present invention and the traditional SWAP strategy (the number of quantum bits is 10 and the system reaches the maximum entanglement degree);

[0046] Figure 7 This is a comparison chart of the computational efficiency of a complete algorithm for a hybrid control mechanism using non-adjacent bit quantum gates, provided by an embodiment of the present invention, and a traditional SWAP strategy (the number of quantum bits is 10 and the system reaches maximum entanglement).

[0047] Figure 8 It is a variational quantum circuit diagram implemented for solving the Hamiltonian of the spin chain model provided by an embodiment of the present invention;

[0048] Figure 9 This is a comparison chart of the execution efficiency of a variational quantum circuit diagram simulation performed to solve the spin chain model Hamiltonian provided by an embodiment of the present invention between a complete non-adjacent bit quantum gate algorithm and a traditional SWAP strategy;

[0049] Figure 10 is a quantum Fourier transform circuit diagram used in an embodiment of the present invention;

[0050] Figure 11 This is a comparison chart of the simulated computational efficiency of the quantum Fourier transform provided by an embodiment of the present invention between a complete non-adjacent bit quantum gate algorithm and a traditional SWAP strategy. Specific implementation method:

[0051] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be described clearly and completely below. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of the present invention. The embodiments provided by the present invention are for the case of a two-bit quantum gate, and other multi-bit quantum gate cases can be derived from this embodiment.

[0052] Quantum circuit simulators based on the matrix product state (MPS) tensor structure have outstanding performance advantages in low-depth quantum circuit simulations, especially in terms of memory resource usage and computational response speed. Specifically, the MPS structure can decompose the high-order large tensor that originally represents the overall quantum state into multiple third-order tensor nodes, significantly reducing memory consumption. At the same time, after each quantum gate operation, the MPS simulator immediately performs the corresponding tensor contraction and decomposition operations, updating the quantum state representation in real time, which is conducive to achieving fast feedback and subsequent computational processing.

[0053] However, in practical applications, as the depth of quantum circuits increases, entangled information accumulates within the system, leading to a gradual expansion of the auxiliary dimension between qubits, significantly reducing the efficiency of the simulator. This problem is particularly severe when processing quantum gate operations that act on qubits that are far apart. Traditional methods typically require moving the target bit to an adjacent position by continuously inserting SWAP gates before applying the quantum gate operation. After the operation is completed, the bit positions must be restored to their original order. This entire process incurs a significant amount of tensor contraction and decomposition overhead, severely impacting simulation efficiency.

[0054] To solve the above problems, the present invention proposes a complete set of efficient simulation calculation methods for non-adjacent bit quantum gates, which consists of two parts:

[0055] The first part, the core of this algorithm, is a strategy for overall tensor contraction and decomposition (corresponding to steps S4.1 through S4.4), which improves the computational efficiency of the traditional method of inserting multiple SWAP gates. This strategy achieves optimal performance when the auxiliary dimensions are monotonically increasing or decreasing, achieving up to a 50% improvement in execution time. However, when the auxiliary dimensions are exactly equal or increase first and then decrease, the simulation efficiency may be lower than that of traditional methods. Figure 5 、 Figure 6 This can support the conclusion.

[0056] The second part is a hybrid control mechanism for the execution of non-adjacent bit quantum gates (corresponding to steps S1 to S3), the purpose of which is to avoid the efficiency loss caused by the overall contraction strategy in unsuitable situations. This mechanism dynamically selects the optimal execution strategy based on the current state of the system to maximize the overall execution efficiency of the simulator. Among them, the strategy selection logic corresponds to steps S2.1 to S2.4, covering all structural situations that may occur during the simulation of non-adjacent bit quantum gates and the corresponding optimal execution strategies. In addition, given that the overall contraction and decomposition strategy of the tensor is essentially a method of trading space for time, the present invention limits the growth of the intermediate tensor node dimension in the hybrid control mechanism (corresponding to step S3) to control the memory usage during the simulation process and adapt to simulation devices under different computing resource conditions as much as possible.

[0057] Next, the above two parts will be elaborated in detail.

[0058] The overall contraction and decomposition strategy of tensors is the core part of the efficient simulation calculation method of non-adjacent bit quantum gates proposed in this invention. Figure 3 A graphical flow chart of this strategy is shown in an example of a two-bit quantum gate.

[0059] In the figure, each hollow circle represents a tensor node corresponding to a qubit, while a solid circle represents the target bit of the current quantum gate. The broken lines represent the dimensions of the tensor, and the lines connecting the circles indicate that the related tensor nodes are performing tensor contraction on the corresponding dimensions.

[0060] Combined with the schematic diagram, the overall contraction and decomposition strategy of the tensor includes the following steps:

[0061] S4.1. Obtain the MPS structure tensor representing the quantum state of the quantum bit to be operated, and the MPO tensor representing the quantum gate to be operated.

[0062] Among them, the MPS structure tensor of the quantum state of the quantum bit to be operated refers to the target bit and all the tensor nodes in between after the position is adjusted by the SWAP gate in steps S2 and S3. It is the main object of this tensor operation; and the quantum gate to be operated is represented in the form of MPO, and its corresponding tensor serves as another main object of this operation.

[0063] The ideal execution environment for the overall tensor contraction and decomposition strategy is that the auxiliary dimensions between the involved qubits are strictly monotonically increasing or decreasing. Since the target bit has been moved to the appropriate position through the SWAP operation in step S2, the relevant auxiliary dimensions can be assumed to meet the strict monotonicity condition at this stage.

[0064] S4.2. Contract all tensors of MPS structures and all tensors of MPO structures in sequence;

[0065] Tensor contraction is the process of performing tensor multiplication operations on multiple tensors sequentially along a specified dimension. The order in which tensor contractions are performed has a significant impact on overall computational efficiency.

[0066] However, under the algorithm framework provided by the present invention, the computational overhead is mainly concentrated in the subsequent tensor decomposition process, and its time complexity is usually cubic (O(n 3 )), while the complexity of tensor contraction itself is only quadratic (O(n 2 )). Therefore, in this strategy, the impact of contraction order on performance can be ignored, and the tensors can be contracted in any order, ultimately constructing two unified high-order tensors for subsequent operations.

[0067] S4.3. Perform a tensor multiplication operation on the quantum state tensor obtained in the above two steps and the corresponding quantum gate tensor, and rearrange the tensor dimensions of the product so that the original order of physical dimensions and auxiliary dimensions is maintained;

[0068] S4.4. Use the SVD algorithm to decompose the large tensor into small tensors in descending order of the auxiliary dimensions to restore the original structure.

[0069] This step is the main source of computational overhead for this algorithm. Since step S4.1 assumes that the auxiliary dimensions of the tensors vary strictly monotonically, this step requires starting the decomposition from the tensor with the largest auxiliary dimension.

[0070] When the number of tensor network grid points involved in the contraction is more than 2, choosing different locations to use SVD has different costs, so the order of large to small is adopted to achieve maximum efficiency.

[0071] The overall tensor contraction and decomposition strategy has a significant time optimization effect when the auxiliary dimension changes monotonically. However, this strategy still has two potential problems in practical applications:

[0072] First, when the auxiliary dimension does not meet the monotonicity condition, the computational efficiency of the tensor decomposition step will drop significantly, even lower than the traditional SWAP gate method;

[0073] Second, during the overall contraction process, intermediate tensors with higher dimensions may be generated, resulting in increased memory usage and greater pressure on computing resources.

[0074] The second part of the present invention, the hybrid control mechanism implemented by the non-adjacent bit quantum gate, solves the above two problems. Figure 1 A flow chart of the mechanism is presented. Combined with the schematic diagram, the specific steps of the mechanism include:

[0075] S1. Obtain the dimension information of each tensor in the tensor network, including the physical dimension and auxiliary dimension of the current quantum state tensor, and determine the physical dimension of the quantum state tensor after the quantum gate, which is used for subsequent contraction judgment and resource evaluation;

[0076] Among them, the auxiliary dimension size of the current quantum state tensor is an important factor in determining which execution strategy to adopt. Specifically, the auxiliary dimension size after the action needs to be deduced from the current auxiliary dimension size of the quantum state tensor. The derivation method is as follows: Figure 4 The S1 section in the description is as follows:

[0077] Assume that the auxiliary dimensions of all current tensors are d1, d2, ..., d n , record it as the maximum value d m =max(d1,d2,…,d n).

[0078] Construct d1 to d m The range is all power multiple sequences with base 2, i.e. d1, 2d1, 4d1, ... d m .

[0079] If the number of elements in the sequence is less than n, continue to construct d m to d n All base 1 / 2 sequences d between m ,…,4d n ,2d n ,d n .

[0080] If the combination of the above two sequences contains exactly n elements, the desired result is obtained. At this time, the system is in a state of maximum entanglement and its density matrix is ​​a full-rank matrix.

[0081] If the number of elements after the combination is less than n, add a number of d between the two sequences. m Bring the total to n.

[0082] Taking the tensor network with auxiliary dimensions of 1, 2, 1, 1, 2, 4, 2 as an example, according to the above method, the new auxiliary dimensions should be 1, 2, 4, 4, 4, 4, 2, corresponding to the situation S2.4.

[0083] S2. Based on the target bit spacing and tensor dimension size, select the corresponding strategy to execute.

[0084] According to the overall change pattern of the sequence, the non-adjacent bit quantum gate operation situations can be divided into four types of structural characteristics, covering all typical structural situations that may occur during the simulation process. Figure 2 Schematic diagram of four cases, the hollow circles at the beginning and end represent the target bits. Figure 7 This is a comparison of the efficiency of the complete non-adjacent bit gate algorithm with the hybrid control mechanism and the traditional SWAP gate insertion method. In conjunction with the legend, the four cases are:

[0085] S2.1. All auxiliary dimensions between target bits are strictly monotonically increasing. In this case, the overall contraction and decomposition strategy is theoretically the most efficient and no adjustment is required.

[0086] S2.2. All auxiliary dimensions between target bits are equal. In this case, the overall contraction and decomposition strategy has the lowest theoretical efficiency, and the traditional insertion SWAP gate method can be used.

[0087] S2.3. If the auxiliary dimension between target bits increases first and then decreases, and a unique maximum value exists, one of the target bits can be moved to the position with the largest auxiliary dimension, and then the quantum gate can be operated using the overall contraction and decomposition strategy. The choice of the first or second target bit depends on the size of the first and last auxiliary dimensions in the entire quantum state tensor. If the first auxiliary dimension is larger, the first target bit is selected, and vice versa.

[0088] For example, when the auxiliary dimensions are 1, 2, 4, 8, 4, 2, and 1, the first or last bit can be moved to the position of the bit with the auxiliary dimension of 8. In addition, the insertion of the SWAP gate can also use the overall contraction and decomposition strategy.

[0089] S2.4. If the auxiliary dimension between target bits first increases and then decreases, and there are multiple maximum values, you can choose to transfer the first target bit to the position of the first maximum auxiliary dimension, or transfer the second target bit to the position of the last maximum auxiliary dimension. Then, by inserting adjacent SWAP gates, the two target bits are gradually adjusted to adjacent positions and quantum gate operations are applied.

[0090] Whether to choose the former or the latter can be judged based on the size relationship between the first and last auxiliary dimensions in the entire quantum state tensor: if the first auxiliary dimension is larger than the last auxiliary dimension, then choose to move the first target bit to the middle; otherwise, choose to move the last target bit to the middle.

[0091] For example, when the auxiliary dimensions are 1, 2, 4, 4, 4, 2, there are multiple maximum values ​​of 4 in the dimensions, and the last dimension is larger than the first dimension, so the last bit can be moved to the position of the second to last bit.

[0092] S3. In all cases where the overall contraction method is adopted, determine whether the dimension of the intermediate tensor after contraction exceeds the preset resource limit (such as a memory threshold or a tensor rank limit).

[0093] The size of the largest intermediate tensor in the overall contraction and decomposition strategy is determined by multiplying the auxiliary dimension size and physical dimension size of all tensors between the target bits. For example, the maximum intermediate tensor size in the overall contraction process of a quantum system with a physical dimension of 2 and auxiliary dimensions of 1, 2, 4, 8, and 4 is 1*2*4*8*4*2 n =2 11 .

[0094] If, during a quantum gate operation involving non-adjacent bits, the predicted dimensions of the resulting intermediate tensor exceed the memory limits of the processing device, a SWAP gate can be inserted to temporarily shift the target bit to a closer location, reducing the size of the contracted tensor. The specific shift distance can be set based on available memory resources, splitting the original single-step operation into multiple steps, effectively reducing space usage and improving system adaptability.

[0095] S4. Perform overall contraction and decomposition operations according to the first part.

[0096] Figure 8 The figure shows a comparison of the simulation efficiency of the above complete optimization algorithm and the traditional SWAP strategy on the variational quantum algorithm. The quantum circuit used in the figure cyclically uses CX gates, that is, it contains a non-adjacent bit CX gate from the last bit to the first bit.

[0097] The above is a complete operational flow example of the efficient simulation computation method for non-adjacent bit quantum gates proposed in this invention. Starting from the algorithmic logic, this example details the contraction and decomposition process of the quantum state tensor, the dynamic judgment mechanism for auxiliary dimensions, and the execution logic of the hybrid control strategy. It demonstrates the specific technical path for implementing non-adjacent bit gate operations within a tensor network structure. Those skilled in the art, based on their understanding of this example, can implement the algorithm of this invention in various quantum circuit simulation tasks, reproducing it without inventive effort.

[0098] In addition to the above method flow description, the present invention also provides the following specific experimental examples based on actual simulation tasks to verify the applicability and performance advantages of the present invention under different quantum circuit structures and entanglement strength conditions. The following is a description of the specific experimental examples:

[0099] Example 1: Experiment on the effect of non-adjacent bit CX gates.

[0100] In order to verify the performance of the overall tensor contraction and decomposition strategy proposed in the present invention in processing non-adjacent bit quantum gate operations, a tensor network structure containing 10 quantum bits is constructed, and a single-step CX gate operation is applied to two non-adjacent bits, and the execution efficiency is compared with the traditional simulation method based on SWAP gate insertion. Among them, the 10-bit quantum state is represented as a 10-lattice MPS during modeling, and the CX gate is a two-bit gate, modeled as a 2-lattice MPO. This embodiment will complete the contraction of the MPO corresponding to the CX gate and the MPS corresponding to the 10-bit quantum state. When the CX gate acts on non-adjacent lattices, the SWAP gate is usually added to maintain the logical consistency of the operation and maintain the logical topology of the MPS. The present invention directly contracts the MPO lattice of the CX gate with the MPS lattice of the quantum state (steps S4.2 and S4.3), and then restores the tensor network to the MPS topology according to the process of S4.4.

[0101] In the experiment, the quantum state is represented by the MPS structure, and the auxiliary dimensions between tensors are set to the following two typical cases:

[0102] 1. No entanglement state ( Figure 5 Corresponding): The auxiliary dimensions of all tensors are initially 0, and there is no entanglement connection between quantum bits;

[0103] 2. Maximum entanglement state ( Figure 6 Correspondingly, the auxiliary tensor dimensions are set to 1, 2, 4, 8, 16, 32, 32, 16, 8, 4, 2, and 1, resulting in the system being maximally entangled. Depending on the position of the CX gate, the size of the auxiliary dimension also determines the SVD order in step S4.4 of this invention.

[0104] In each test, a CX gate simulation between non-adjacent qubits was performed 10,000 times using both the traditional SWAP strategy and the overall contraction and decomposition strategy of our invention. The execution time of the quantum gate was recorded. The first target bit was the leading qubit, and the position of the second target bit corresponds to the horizontal axis of the graph.

[0105] The experimental results are as follows Figure 5 and Figure 6 As shown in the figure, under the maximum entanglement state, the method of the present invention can improve the execution efficiency by up to about 53.6% compared with the traditional SWAP strategy. The specific improvement is related to factors such as the initial quantum state quantity and the computing environment, but will not be significantly lower than this value.

[0106] Example 2: Experiment on the effect of non-adjacent bit CX gates with hybrid control mechanism.

[0107] In this embodiment, in order to further verify the actual effect of the hybrid control mechanism proposed in the present invention in improving simulation efficiency and reducing resource overhead, based on the 10-bit tensor network structure constructed in Example 1, a hybrid control mechanism is added to verify the execution efficiency of non-adjacent bit CX gates.

[0108] The experimental setup is consistent with the maximum entangled state in Example 1, and the experimental results are as follows: Figure 7 As shown, in the maximum entangled state, this embodiment ensures the maximum improvement in execution efficiency and is comprehensively superior to Example 1, especially when the target bit distances are 8 and 9. This shows that the efficient simulation method for non-adjacent bit quantum gates proposed in this invention is completely superior to the traditional SWAP method in terms of computational efficiency.

[0109] Example 3: Experiment on solving the spin chain model Hamiltonian using a variational quantum eigensolver.

[0110] To further verify the versatility and performance advantages of the method of the present invention in actual quantum algorithms, this example selects the variational quantum eigensolver (VQE) task under the one-dimensional spin chain model as the test scenario to approximate the ground state energy of the system Hamiltonian.

[0111] The variational quantum eigensolver (VQE) is one of the most core and practical quantum algorithms in quantum chemistry and quantum machine learning, particularly suitable for current "noisy intermediate-scale quantum devices (NISQ)." It combines the expressive power of quantum computing with the optimization capabilities of classical computing. VQE is primarily used to solve ground-state energy problems:

[0112] H|ψ>=E|ψ>

[0113] Where H is the Hamiltonian of the target system, |ψ> is the ground state wave function to be solved, and E is the ground state energy. VQE uses the variational principle to approximate this ground state energy:

[0114] E var =<ψ(θ)|H|ψ(θ)>≥E0

[0115] Measure the energy expectation E of |ψ(θ)> var After that, the parameters are updated using the classic optimizer until convergence.

[0116] In this embodiment, the VQE circuit uses a standard "hardware-efficient" variational form, which includes multiple levels of two-bit CNOT gates and single-bit rotation gates. Non-adjacent bit quantum gates appear in each level of variational blocks. The specific implementation is as follows:

[0117] 1. Build an MPS tensor network containing 5-20 qubits and a spin Hamiltonian of corresponding size, randomly initialize the rotation gate parameters, and equip each rotation gate with an independent parameter;

[0118] 2. According to Figure 8 The quantum circuit applies a Hadamard gate to each qubit, an Ry gate with the corresponding parameter, and a CX gate to the adjacent bit, including a CX gate between the last bit and the first bit that is not adjacent to the qubit. The Ry gate and CX gate are repeated 10 times.

[0119] 3. Use the parameter shift rule to calculate the gradient of each parameter. That is, take out a parameter and add π / 2, while keeping the other parameters unchanged. After step 2, calculate the expectation of the spin Hamiltonian in the current quantum state (the Hamiltonian can be regarded as an MPO structure), and then subtract it from the expectation value of the parameter minus π / 2. The result divided by 2 is the gradient of the parameter.

[0120] 4. Update the gradient for each parameter. In this embodiment, the number of quantum bits is n, the circuit depth is 10, and a single-step iteration requires 20n circuit simulations. A total of 1100n single-bit quantum gates and 1000n two-bit CX gates need to be simulated, of which 100n are non-adjacent bit CX gates with a span of n.

[0121] Experimental results show that in this type of practical problem, the method of the present invention can reduce the total time overhead of calculating the spin Hamiltonian task by about 1 / 4 when only one non-adjacent bit quantum gate appears in a single-layer variational block, and the maximum time optimization rate can reach 27.3%. This shows that in the case of high entanglement, quantum gates with a large target bit span are very inefficient in simulation calculations, and the method proposed in the present invention can effectively solve this problem.

[0122] Example 4: Quantum Fourier transform (QFT) simulation experiment.

[0123] The quantum Fourier transform (QFT) is a fundamental and important transformation operation in quantum computing, widely used in algorithms such as period detection, prime factorization (such as Shor's algorithm), and quantum signal processing. Essentially, it is a quantum version of the discrete Fourier transform (DFT) applied to quantum states. The core operation consists of a series of Hadamard gates and controlled phase rotation gates (CP gates).

[0124] QFT circuits typically exhibit high symmetry and nonlocal interactions. During circuit execution, lower-numbered qubits must undergo controlled phase-gate operations with multiple higher-numbered qubits. This structure results in a large number of non-adjacent qubits interacting via non-adjacent bit quantum gates. In traditional SWAP simulation strategies, QFT execution requires frequent insertion of numerous SWAP gates to move target bits to adjacent locations, incurring additional computational overhead. Therefore, QFT is one of the most representative scenarios for testing the performance of non-adjacent bit gate simulation methods.

[0125] In this embodiment, the experiment uses the QFT circuit ( Figure 10 ), and use the non-adjacent bit gate action method described in the present invention and the traditional SWAP action method to execute a 5-14 bit quantum Fourier transform circuit, repeat 10 times, and record the total time required for the simulation.

[0126] like Figure 11As shown in the figure, compared with the traditional SWAP insertion strategy, the simulation method proposed in the present invention can achieve a maximum time optimization rate of 41.5% in this experimental scenario, which is close to the theoretical maximum optimization upper limit (about 50%). Non-adjacent bit quantum gates are not only one of the key operations that are difficult to implement in quantum physics systems, but also one of the bottleneck operations with the largest consumption of computing resources in tensor network simulations. The overall contraction and hybrid control strategy described in the present invention can effectively reduce the simulation computation overhead brought by non-adjacent bit gate operations in multiple typical quantum algorithm scenarios, thereby improving the overall simulation efficiency.

[0127] Finally, it should be noted that the traditional SWAP strategy used in the present invention refers to a method of inserting adjacent SWAP gates multiple times to transfer the target quantum bit, and all solutions that achieve the target task in this form should be covered. The above embodiments are only used to illustrate the technical solutions of the present invention, not to limit it. Although this specification describes the present invention in detail with reference to the above embodiments, those skilled in the art should understand that these technical solutions can still be modified, or some or all of the technical features therein can be replaced by equivalents without departing from the core idea of ​​the present invention. These modifications or replacements should not be regarded as exceeding the scope of protection claimed by the present invention.

Claims

1. An improved non-adjacent bit quantum gate processing method, characterized in that: The core of the hybrid control method for executing quantum gates between non-adjacent bits is the overall contraction and decomposition method of tensors. Without relying on multiple insertions of SWAP gates, the target bit and all related tensors are contracted into a unified tensor, and after applying quantum gate operations, the tensor is gradually decomposed to restore the original MPS structure, thereby completing the simulation of quantum gates between non-adjacent bits. The following steps are involved: S1. Obtain the dimension information of each tensor in the tensor network, including the physical dimension and auxiliary dimension size of the current quantum state tensor, and determine the auxiliary dimension size of the quantum state tensor after the quantum gate, which is used for subsequent contraction judgment and resource evaluation; S2. Based on the target bit spacing and tensor dimension size, select the corresponding strategy from S2.1-S2.4 for execution; S2.

1. When the tensor dimensions between target bits are strictly increasing or decreasing, the quantum gate operation is directly executed according to the overall contraction and decomposition strategy; S2.

2. When the tensor dimensions between the target bits are exactly the same, the quantum gate operation is performed by inserting multiple SWAP gates in the traditional way. S2.

3. When the tensor dimension between the target bits has a unique maximum value, insert a SWAP gate according to the overall contraction and decomposition strategy, transfer one of the target bits to the maximum value, and then perform the quantum gate operation according to the situation in S2.

1. S2.

4. When the tensor dimension size between target bits has a maximum value and is not unique, first select one of the target bits and insert a SWAP gate according to the overall contraction and decomposition strategy to move it to the first or last maximum value. Then, insert multiple SWAP gates to move the selected target bit to the position of another maximum value and perform the operation according to the situation in S2.

1. S3. In all cases where the overall contraction method is adopted, determine whether the dimension of the intermediate tensor after contraction exceeds the preset resource limit, including the memory threshold or the tensor rank limit; S3.1: If the limit is exceeded, insert SWAP gates through the overall contraction and decomposition strategy to rearrange the target bits to the maximum distance under the memory limit, and loop back to S3 for judgment; S3.

2. If the limit is not exceeded, execute normally.

2. The improved non-adjacent bit quantum gate processing method according to claim 1, characterized in that: The overall shrinkage and decomposition method includes the following steps: S4.1-S4.4; S4.

1. Obtain an MPS structure tensor representing the quantum state of the quantum bit to be operated, and an MPO tensor representing the quantum gate to be operated; S4.

2. Contract all tensors of MPS structures and all tensors of MPO structures in sequence; S4.

3. Perform a tensor multiplication operation on the quantum state tensor obtained in the above two steps and the corresponding quantum gate tensor, and rearrange the tensor dimensions of the product so that the original order of physical dimensions and auxiliary dimensions is maintained; S4.

4. Use the SVD algorithm to decompose the large tensor into small tensors in descending order of the auxiliary dimensions to restore the original structure.

3. The improved non-adjacent bit quantum gate processing method according to claim 2, characterized in that: In S4.1, the MPS structure tensor of the quantum state of the qubit to be operated refers to the target bit and all tensor nodes in between after the position adjustment by the SWAP gate in step S2, which is the main object of this tensor operation; the quantum gate to be operated is represented in the form of MPO, and its corresponding tensor serves as the other main object of this operation; The ideal execution environment for the overall tensor contraction and decomposition strategy is that the auxiliary dimensions between the involved qubits are strictly monotonically increasing or decreasing. Since the target bit has been moved to the appropriate position through the SWAP operation in step S2, it can be assumed that the relevant auxiliary dimensions meet the strict monotonic condition at this stage; In S4.2, tensor contraction refers to the process of performing tensor multiplication operations sequentially across multiple tensors along a specified dimension. The order of tensor contraction significantly impacts overall computational efficiency. To simulate quantum gate operations, several MPS points are contracted together in S4.2 and then separated using the SVD algorithm. When the number of tensor points exceeds two, the cost of applying SVD varies depending on the location, so the order of contraction is used first, then the smallest.

4. The improved non-adjacent bit quantum gate processing method according to claim 1, wherein: In S1, the auxiliary dimension size of the current quantum state tensor is determined by deducing the auxiliary dimension size after the action through the current auxiliary dimension size of the quantum state tensor, specifically: Assume that the auxiliary dimensions of all current tensors are d1, d2, ..., d n , record it as the maximum value d m =max(d1,d2,…,d n ). Construct d1 to d m The range is all power multiple sequences with base 2, i.e. d1, 2d1, 4d1, ... d m . If the number of elements in the sequence is less than n, continue to construct d m to d n All base 1 / 2 sequences d between m ,…,4d n ,2d n ,d n . If the combination of the above two sequences contains exactly n elements, the desired result is obtained. At this time, the system is in a state of maximum entanglement and its density matrix is ​​a full-rank matrix. If the number of elements after the combination is less than n, add a number of d between the two sequences. m Bring the total to n. In S3, the size of the largest intermediate tensor in the overall contraction and decomposition strategy is determined by multiplying the auxiliary dimension size and physical dimension size of all tensors between the target bits. If, during a quantum gate operation involving non-adjacent bits, the predicted dimensions of the resulting intermediate tensor exceed the memory limits of the processing device, a SWAP gate can be inserted to temporarily shift the target bit to a closer location, reducing the size of the contracted tensor. The specific shift distance can be set based on available memory resources, splitting the original single-step operation into multiple steps, effectively reducing space usage and improving system adaptability.

Citation Information

Patent Citations

  • Processor and method for tensor network contraction in quantum simulator

    CN117203647A

Cited By

  • Information processing method and device, electronic equipment and storage medium

    CN120875069A