Quantum circuit simulation method and system

By converting the tensor network of quantum circuits into tensor decision diagrams and performing shrinkage optimization, the problems of low memory consumption and efficiency in quantum circuit simulation are solved, and efficient simulation of large-scale circuits is achieved.

CN119272887APending Publication Date: 2025-01-07INST OF SOFTWARE - CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411416956.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

The existing quantum circuit simulation methods have exponential problems in memory consumption, which leads to the inability to effectively simulate large-scale quantum circuits and low computing efficiency.

Method used

Tensor decision graph (TDD) is used to convert the tensor network of quantum circuits and optimize it through shrinkage algorithms to find an optimal shrinkage order to reduce memory space usage and improve computing efficiency.

Benefits of technology

It significantly reduces the memory space required for quantum circuit simulation, increases the circuit scale that can be simulated, improves simulation efficiency, and reduces computing time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119272887A_ABST
    Figure CN119272887A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of quantum circuit simulation, and relates to a quantum circuit simulation method and system. The method comprises the following steps: reading information of a quantum circuit, an input state and an output state, and converting the information into a tensor network; tensors in the tensor network are converted into a tensor decision diagram; shrinking the tensor decision diagram by using a shrinkage algorithm; and according to the tensor decision diagram after shrinkage is completed, single amplitude and full amplitude are read or sampling is carried out. Before the contraction is carried out, a tensor network optimization tool can be used for searching a better contraction sequence, and then the tensor decision diagram is contracted according to the contraction sequence. According to the invention, the memory space for simulation can be exponentially reduced on part of circuits, so that the scale of the circuit which can be simulated is greatly increased. Compared with simulation methods corresponding to other decision diagrams, the simulation efficiency can be improved on part of circuits, and the time required for simulation is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of quantum circuit simulation, and in particular relates to a method and system for quantum circuit simulation. Background Art

[0002] Quantum circuits are a computing model that uses the principles of quantum mechanics to process information. They consist of quantum bits (qubits) and quantum gates, which can be in multiple states (superposition) at the same time, thereby achieving parallel processing capabilities that exceed those of classical computers. Quantum circuits operate these qubits through quantum gates (such as Pauli-X, Pauli-Z, Hadamard gates, etc.) to execute quantum algorithms.

[0003] Quantum circuit simulation (Simulation, also often written as simulation) refers to the use of classical computers or other simulation methods to simulate the behavior of quantum circuits. Due to the high complexity of quantum systems, it is very difficult to directly simulate the entire quantum circuit, so some approximate methods or dedicated quantum simulators are usually used to achieve this. These simulations can help researchers understand and predict the output of quantum circuits, thereby optimizing the design of quantum algorithms and quantum hardware.

[0004] Tensor: In mathematics, a tensor is an object that can represent data of multiple dimensions. It is similar to vectors and matrices, but has more dimensions. Tensors are widely used in physics and engineering, especially in describing multidimensional data and complex systems. In quantum computing, tensors are also used to describe quantum states and quantum operations. The shape dimension of the data is called the rank of the tensor. Each rank corresponds to an index, and the value range of each index is called the dimension of this index. For example, a 4x3x2 tensor has a rank of 3, corresponding to three indices with dimensions of 4, 3, and 2 respectively.

[0005] Tensor Decision Diagram (TDD) is a data structure used to represent and manipulate high-dimensional data. It is similar to a traditional decision diagram, but adds support for tensors, making it possible to more efficiently represent and process multidimensional data. TDD represents data more compactly by organizing it into a tree structure, thereby achieving a certain degree of compression. In the field of quantum computing and quantum information, tensor decision diagrams can be used to represent quantum states and quantum operations. It is used in equivalence tests of quantum circuits and has advantages in approximate equivalence tests.

[0006] Quantum circuit simulation is a technique for simulating the behavior of quantum circuits. It has applications in multiple technical fields, including quantum computing, quantum information science, materials science, drug design, quantum software and tool development, etc. Quantum circuit simulation includes full amplitude simulation and single amplitude simulation. Full amplitude simulation is a method for simulating the amplitude of the entire quantum state. In this simulation, the state of each quantum bit is fully represented, including its probability amplitude and phase information. Full amplitude simulation can provide accurate results for quantum circuits, but the required computing resources increase exponentially as the number of quantum bits increases. This simulation technique is particularly important in the following areas: a) Quantum algorithm development: used to test and verify new quantum algorithms. b) Quantum error correction: research and design quantum error correction codes to improve the reliability of quantum computing. c) Quantum hardware verification: verify the performance and accuracy of quantum processors. Single amplitude simulation is a simulation method that only simulates a specific amplitude in a quantum state. It usually focuses on only one specific result or path in the quantum computing process, rather than all possible results. This approach can significantly reduce the required computing resources, but at the expense of the comprehensiveness of the results. Single amplitude simulation is particularly useful in the following fields: a) Quantum optimization problems: When solving optimization problems, you may only need to find the optimal solution or a few solutions, rather than all possible solutions. b) Quantum machine learning: When training a quantum machine learning model, you may only focus on specific outputs or behaviors of the model. c) Quantum chemistry simulation: When simulating molecules and chemical reactions, you may only focus on specific energy states or reaction paths. The development of quantum circuit simulation technology is crucial to promoting the practical application of quantum computing. It not only helps researchers understand the behavior of quantum systems, but also provides the necessary theoretical and experimental basis for the practical deployment of quantum technology.

[0007] At present, the methods for full-amplitude and single-amplitude simulation of quantum circuits are mainly divided into two categories, namely simulation based on matrix-vector multiplication and simulation based on tensor networks. For simulation based on matrix-vector multiplication, the input state will be regarded as a vector, and the quantum circuit will be disassembled into small matrices one by one. These small matrices will act on the vector corresponding to the initial state, so that the corresponding quantum state will continue to evolve, and the final output state is the result required for full-amplitude simulation, and the entry corresponding to a certain computational basis state of interest, that is, the corresponding amplitude is the result required for single-amplitude simulation. Tensor network-based simulation treats quantum gates and quantum states as small tensors, and then merges them through contraction operations in a certain order. In the end, for full-amplitude simulation, a rank-n tensor will be obtained, which contains the result of full-amplitude simulation, while for single-amplitude simulation, a rank-1 tensor (that is, a scalar) will be obtained, and the value of this scalar is the result of single-amplitude simulation.

[0008] In addition to the above two methods, for full-amplitude simulation, another common method is simulation based on decision diagrams, such as simulation using QuIDD (Quantum Infromation Decision Diagram) and QMDD (Quantum Multiple-Valued Decision Diagrams). Decision diagrams are a data structure that compresses data. They can merge data blocks with the same pattern in a large amount of data, thereby greatly reducing the space required for data storage. Therefore, in many cases, simulations of larger-scale quantum circuits can be completed more quickly.

[0009] The main defects of the above simulation methods are as follows:

[0010] For simulations based on matrix-vector multiplication, the dimensions and number of bits corresponding to the initial quantum state and the intermediate quantum state are exponential, which takes up a lot of memory space and takes a lot of time to manipulate. Therefore, only very small-scale single-amplitude simulations can usually be completed on a classical computer.

[0011] For simulations based on tensor networks, although certain techniques are used to reduce or avoid the appearance of large-scale tensors, which can alleviate the threat of exponential explosion to a certain extent, the relief it can bring is limited, especially for full-amplitude simulations. Since the rank of the tensor corresponding to the final result is n, exponential memory consumption is usually unavoidable.

[0012] Although decision graph-based simulation methods can alleviate this memory anxiety from another perspective, they are not always effective, especially for QuIDD and QMDD, which are not always the best decision graphs for representing and operating quantum circuits. Summary of the invention

[0013] The main problem to be solved by the present invention is to improve the exponential level memory consumption problem of the above-mentioned simulation methods, thereby increasing the scale of simulation of some circuits, while also hoping to improve the efficiency of simulation as much as possible and reduce the time consumed by simulation.

[0014] The technical solution adopted by the present invention is as follows:

[0015] A method for quantum circuit simulation, comprising the following steps:

[0016] Read the information of quantum circuits, input states, and output states, and convert them into tensor networks;

[0017] Convert tensors in a tensor network into tensor decision graphs;

[0018] The tensor decision graph is contracted using a contraction algorithm;

[0019] According to the tensor decision graph after the contraction is completed, single amplitude, full amplitude or sampling is read out.

[0020] Furthermore, before performing the contraction, a tensor network optimization tool is used to find a better contraction order, and then the tensor decision graph is contracted according to the contraction order.

[0021] Furthermore, the converting of tensors in the tensor network into tensor decision graphs includes: representing single-bit quantum states as tensor decision graphs; and representing quantum gates as tensor decision graphs.

[0022] Furthermore, the quantum gate is represented as a tensor decision graph, including: for a single-bit gate, a tensor decision graph with two indices is used for representation, and elements in the matrix corresponding to the single-bit gate are stored in different paths of the tensor decision graph; for a two-bit gate, a tensor decision graph with four indices is used for representation, and elements in the matrix corresponding to the two-bit gate are stored in different paths of the tensor decision graph.

[0023] Furthermore, the contraction algorithm is implemented through recursion. When the contraction of two tensor decision graphs is to be completed, the contraction process between their child nodes is first completed, and then the contraction results corresponding to the child nodes are classified and processed to complete the final contraction process; there are two recursive situations: if the index to be processed is an index that needs to be contracted, the two corresponding child nodes are contracted separately, and then the contraction results of the two child nodes are added; if the currently processed index is not an index that needs to be contracted, the contraction results of the two child nodes are connected to the same node to form a complete tensor decision graph.

[0024] Furthermore, for full-amplitude simulation, when all input and output quantum states and quantum gates are contracted, the result is a tensor decision graph associated with n indices, where n is the number of quantum bits in the circuit, and ultimately all amplitude data are read out from different paths of the tensor decision graph; for single-amplitude simulation, when all input and output quantum states and quantum gates are contracted, the result is a tensor decision graph with only one termination node, which contains the final amplitude.

[0025] Furthermore, for full-amplitude simulation, when it is necessary to sample a bit string from the probability distribution corresponding to the amplitude data, the tensor decision graph representing the output quantum state is traversed, the cumulative probability corresponding to the two branches of each node is calculated, and sampling is performed according to the cumulative probability.

[0026] A system for quantum circuit simulation, comprising:

[0027] The preprocessing module is used to read the information of quantum circuits, input states, and output states and convert them into tensor networks;

[0028] A conversion module, used to convert tensors in the tensor network into tensor decision graphs;

[0029] The contraction order search module is used to find a better contraction order using the tensor network optimization tool;

[0030] A contraction module, used to contract the tensor decision graph using a contraction algorithm according to a contraction order;

[0031] The post-processing module is used to read out a single amplitude, a full amplitude or perform sampling according to the tensor decision graph after the contraction is completed.

[0032] The beneficial effect of the present invention is that, compared with quantum circuit simulators based on matrix-vector multiplication and tensor networks, the memory space used for simulation can be reduced exponentially on some circuits, thereby greatly increasing the scale of circuits that can be simulated. Compared with simulation methods corresponding to other decision diagrams, the simulation efficiency can be improved on some circuits and the time required for simulation can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 : Representing the tensor decision diagram of a single-bit quantum state: (1) represents |φ>=a|0>+b|1>, where |a|≥|b|; (2) represents the |0> state; (3) represents |φ>=a|0>+b|1>, where |a|<|b|; (4) represents the |1> state.

[0034] Figure 2 : A tensor decision diagram representing a single-qubit gate: (1) Pauli X gate; (2) Pauli Y gate; (3) Pauli Z gate; (4) H gate.

[0035] Figure 3 : A tensor decision diagram representing two-qubit gates: (1) CX gate; (2) CZ gate.

[0036] Figure 4 : Indicates output state Tensor decision graph of .

[0037] Figure 5 : A tensor decision graph representing a single amplitude.

[0038] Figure 6 : Indicates output state The corresponding cumulative probability distribution plot.

[0039] Figure 7 : Flow chart of the steps of the method of the present invention.

[0040] Figure 8 : Example circuit.

[0041] Fig. 9 : A tensor decision diagram representing input and output quantum states and circuits: (1) Input state |00>; (2) Figure 5 middle circuit; (3) output quantum state |11>.

[0042] Fig.10 : The tensor decision graph that is finally calculated by contraction and represents the complete amplitude information of the output state.

[0043] Fig.11 : The tensor decision graph that finally represents the amplitude information calculated by contraction. DETAILED DESCRIPTION

[0044] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below through specific embodiments.

[0045] 1. Key points of the present invention

[0046] The key point of the present invention is to use a new data structure, namely tensor decision diagram (TDD), to perform (single amplitude and full amplitude) simulation of quantum circuits.

[0047] The tensor decision graph combines the advantages of both tensor networks and decision graphs. It not only has the compactness of decision graphs, but also the flexibility of tensor networks. It can not only compress data, but also use various methods of tensor networks to find a better contraction order, so as to avoid the appearance of larger decision graphs as much as possible, thereby saving memory space, increasing the scale of quantum circuits that can be simulated, and also improving the efficiency of simulation.

[0048] 2. Technical solution

[0049] In order to design a more efficient quantum circuit amplitude simulation scheme to support the simulation of larger-scale quantum circuits and improve the efficiency of simulation, this patent proposes a quantum circuit (single amplitude and full amplitude) simulation method based on tensor decision diagram (TDD), and its implementation principle is described as follows.

[0050] First, a single-bit quantum state can be represented as a tensor decision graph. For a single-bit quantum state |φ>=a|0>+b|1>, if |a|≥|b|, it can be represented as Figure 1 The decision diagram shown in (1) is shown in Figure 1. In particular, the |0> state tensor decision diagram is represented as follows: Figure 1 As shown in (2); if |a|<|b|, it can be expressed as Figure 1 The decision diagram shown in (3) is shown in Figure 3. In particular, the |1> state tensor decision diagram is represented as follows: Figure 1 As shown in (4).

[0051] In these diagrams, different amplitudes are stored through different paths and their weights. For example, for the first diagram, the amplitude a in the quantum state |φ>=a|0>+b|1> is reflected by the top incoming edge weight a and the red edge weight 1, while the amplitude b is reflected by the top incoming edge weight a and the blue edge weight b / a. The meanings of other diagrams are similar. For single amplitude simulation, the input state is usually |0…0>, that is, a |0> state is applied to each bit. For single amplitude simulation, there is usually an output state of |o 0 …o n-1 >, where all o i , i∈{0,n-1} all take the value 0 or 1. In other words, we focus on the amplitude of the output quantum state on a specific computational basis state.

[0052] Second, all quantum gates can be represented as a tensor decision graph, such as the Pauli X, Y, Z gates, and the H gates. Figure 2As shown in Figure 1. They are all single-bit gates and can be represented by a tensor decision graph with two indices, and they correspond to matrices:

[0053]

[0054] Its elements are also stored in the different paths corresponding to the decision graph. For example, the 0 in the first column of the X matrix corresponds to the path of the incoming edge and the leftmost red edge (the first red edge is from x0 to y0, and the second red edge is from y0 to the terminal node), and 1 corresponds to the incoming edge and the leftmost red edge and blue edge path, and the other elements are similar. In general, x0 represents the index of the incoming edge corresponding to the quantum gate, and the red outgoing edge of the x0 node corresponds to the first column of the matrix, and the blue outgoing edge corresponds to the second column of the matrix; y0 represents the index of the outgoing edge of the quantum gate, and the red outgoing edge of the y0 node corresponds to the first row of the matrix, and the blue outgoing edge corresponds to the second row. The incoming edge weight corresponds to an overall coefficient of the matrix. For example, for the H gate, there is an overall weight can be extracted, so there will be a value not equal to 1 on the incoming edge weight. 0.71 in the figure is exactly The approximation is accurate to 2 decimal places, and j is used to represent the imaginary unit. It is particularly important to note that for the H gate, both elements in the first column are 1, so a y0 node is omitted, because there is no need to use the y0 node to separate two different branches to represent different values.

[0055] In addition to single-bit gates, two-bit gates can also be represented as tensor decision graphs, e.g. Figure 3 The tensor decision graph representations of the control X gate CX and the control Z gate CZ are given respectively. They each have 4 indexes, representing two input edges and two output edges of the quantum gate. Similarly, the elements in the matrices corresponding to CX and CZ are stored in different paths of the decision graph. The red outgoing edge of x0 corresponds to the left half of the matrix, and the blue outgoing edge corresponds to the right half of the matrix; the red outgoing edge of y0 corresponds to the upper half of the matrix, and the blue outgoing edge corresponds to the lower half; the red outgoing edge of x1 corresponds to the first column in the sub-block, and the blue outgoing edge corresponds to the second column in the sub-block; the red outgoing edge of y0 corresponds to the first row in the sub-block, and the blue outgoing edge corresponds to the second row in the sub-block.

[0056]

[0057] Finally, for the simulation of quantum circuits, the essence is to complete the multiplication between the state vector and the matrix corresponding to each quantum gate, and this task corresponds to the operation of contraction of the tensor decision graph. In other words, all input states, output states and quantum gates can be represented as a small tensor decision graph, and all these tensor decision graphs will become tensor decision graphs representing the final desired result after contraction operations.

[0058] For tensor decision graphs, the contraction algorithm is mainly implemented through recursion. In other words, when completing the contraction of two tensor decision graphs, the contraction process between their child nodes is always completed first, and finally the contraction results corresponding to these child nodes are classified and processed to complete the final contraction process. The recursive situation can be divided into two types. One is that if the index to be processed is an index to be contracted, then the two corresponding child nodes should be contracted separately, and then their results should be added; if the current index is not an index to be contracted, it is only necessary to connect the contraction results of the two child nodes to the same node to form a complete tensor decision graph.

[0059] In more formal language, assume that Γ and Y represent two tensor decision graphs, corresponding to tensors Φ and Ψ respectively, and x0 is an index related to these two tensors. If x0 needs to be collapsed, we have:

[0060] Φ×Ψ=Φ x0=0 ×Ψ x0=0 +Φ x0=1 ×Ψ x0=1 ,

[0061] If x0 does not need to be shrunk, we have:

[0062] Φ×Ψ=x′0·(Φ x0=0 ×Ψ x0=0 )+x0·(Φ x0=1 ×Ψ x0=1 ).

[0063] Among them, × represents the contraction between tensors, + represents the addition between tensors, Φ x0=0 The tensor Φ is the half of the tensor with x0=0. The other symbols have similar meanings, namely Φ x0=1 Take the half of the tensor Φ where x0=1, Ψ x0=0 Take the half of the tensor Ψ where x0=0, Ψ x0=1 Take the half of the tensor Ψ where x0=1; the formula x′0·(Φ x0=0 ×Ψ x0=0 )+x0·(Φ x0=1 ×Ψ x0=1) means that for the tensor in the result, the half with x0=0 is Φ x0=0 ×Ψ x0=0 , and the half with x0=1 is Φ x0=1 ×Ψ x0=1 , x′0 represents the complement of x0, when x0=0, x′0=1, and when x0=1, x′0=0.

[0064] Then, corresponding to the tensor decision graph, for the case where x0 is to be shrunk or not shrunk, we can also have:

[0065] Γ×Y=Γ x0=0 ×Y x0=0 +Γ x0=1 ×Y x0=1 ,

[0066] and

[0067] Γ×Y=x′0·(Γ x0=0 ×Y x0=0 )+x0·(Γ x0=1 ×Y x0=1 ).

[0068] where Γ x0=0 It represents taking the sub-tensor decision graph corresponding to the red outgoing edge of the x0 node in the tensor decision graph Γ, Γ x0=1 Indicates taking the sub-tensor decision graph corresponding to the blue outgoing edge of the x0 node in the tensor decision graph Γ, Y x0=0 Indicates taking the sub-tensor decision graph corresponding to the red outgoing edge of the x0 node in the tensor decision graph Y, Y x0=1 It means taking the sub-tensor decision graph corresponding to the blue outgoing edge of the x0 node in the tensor decision graph Y, and x′0·(Γ x0=0 ×Y x0=0 )+x0·(Γ x0=1 ×Y x0=1 ) represents the decision graph of two sub-tensors Γ x0=0 ×Y x0=0 and Γ x0=1 ×Y x0=1 Connect them with a node with x0. And the addition also has:

[0069] Γ+Y=x′0·(Γ x0=0 +Y x0=0 )+x0·(Γ x0=1 +Y x0=1 ).

[0070] Therefore, addition and contraction can be attributed to the recursive sub-steps until the scalar corresponding to the termination node. Of course, some intermediate results in the calculation process can be stored for easy reuse.

[0071] Finally, for the full amplitude simulation, when all input and output quantum states and quantum gates are shrunk (i.e., contraction operation is performed), the result will be a tensor decision graph associated with n indices, where n is the number of quantum bits in the circuit, such as Figure 4 As shown, ultimately all amplitude data can be read out from different paths of this decision graph.

[0072] For single-amplitude simulation, when all input and output quantum states and quantum gates are shrunk (i.e., contraction operation is performed), the result will be a tensor decision graph with only one termination node, such as Figure 5 As shown, the final amplitude represented by it is c, where c is a complex number and |c|≤1.

[0073] It should be noted that, usually before shrinking, some existing algorithms can be used to find a better shrinking order, rather than simply shrinking from left to right according to the circuit order. This can usually improve the efficiency of the simulation.

[0074] In addition, for full amplitude simulation, sometimes what may be needed is not the complete amplitude data, but some bit strings may be sampled from the probability distribution corresponding to these amplitude data. Then, the tensor decision graph representing the output quantum state can be traversed, and the cumulative probability corresponding to the two branches of each node can be calculated, and then sampling can be performed according to this probability. Figure 6 Given Figure 4 The cumulative probability distribution diagram corresponding to the quantum state in the middle, where the probability of each node's incoming edge is equal to the sum of the probabilities of its two outgoing edges, and for the terminal node, the probability of each incoming edge is the cumulative weight on the corresponding path, that is, the square of the modulus of the amplitude.

[0075] from Figure 6 It can be seen from the figure that starting from the y0 node, the two branches have a cumulative probability of 1 / 2 each, corresponding to the measurement of the calculation basis of the first bit, which will get 0 with a probability of 1 / 2 and 1 / 2. If y0 is randomly sampled to get 0, which corresponds to the red branch, then when it comes to the y1 node on the left, the cumulative probability of the first branch is 1 / 2, and the cumulative probability of the second branch is 0, so random sampling will only produce 0. This corresponds to the situation in this quantum state that when the first bit is measured to get 0, the second bit automatically collapses to 0. The other branch of y0 has a similar result.

[0076] Figure 7A flow chart of the quantum circuit simulation method of the present invention is given in FIG. The whole process is mainly divided into four steps: the first step is data preprocessing, in which the quantum circuit, input and output state and other information are mainly read and converted into a tensor network; the second step is to use existing tensor network optimization tools such as contengra, etc., and also include using some circuit cutting methods to find a better contraction order; the third step is, on the basis of the above, according to this contraction order, each tensor is gradually converted into TDD, and the contraction algorithm of TDD is used to complete the contraction of the tensor network; finally, according to the TDD after the contraction is completed, the single amplitude, full amplitude, or sampling is performed.

[0077] To further explain the method proposed in this patent for quantum circuit simulation, Figure 8 The two-bit quantum circuit shown calculates its complete output state and the amplitude of the output state on |11> under the condition that the input state is |00>.

[0078] In the first step, the circuit will be regarded as a tensor network containing three tensors (corresponding to two H gates and one CNOT gate). The input state can be regarded as two tensors (corresponding to two |0>), and the output state can be regarded as two tensors (corresponding to two |1>). Afterwards, the existing tensor network optimizer is used to find a better contraction order. For simplicity, it is assumed that the contraction order is to first contract the tensor network corresponding to the entire circuit, then contract it with the tensor corresponding to the input state, and then contract it with the tensor corresponding to the output state. Then, the tensor decision diagrams of the input state, the quantum circuit, and the output state are as follows. Fig. 9 As shown in (1), (2) and (3).

[0079] For the full amplitude simulation (without the above |11> output state), their decision diagram after contraction is as follows Fig.10 The full amplitude is read as This shows that the final output state of the simulation is

[0080] For the single amplitude simulation, their decision diagram after contraction is as follows Fig.11 This shows that the simulated single amplitude is -0.5.

[0081] The main alternatives of the present invention are

[0082] (1) Add, change, or use a different tensor network optimizer, or other components that find a better contraction order.

[0083] (2) Use alternative versions of TDD, such as implementations in different languages, or versions with different names but actually tensor decision graphs, or versions with added, deleted, or modified components.

[0084] (3) Versions of the simulation method used in different scenarios.

[0085] Another embodiment of the present invention provides a system for quantum circuit simulation, comprising:

[0086] The preprocessing module is used to read the information of quantum circuits, input states, and output states and convert them into tensor networks;

[0087] A conversion module, used to convert tensors in the tensor network into tensor decision graphs;

[0088] The contraction order search module is used to find a better contraction order using the tensor network optimization tool;

[0089] A contraction module, used to contract the tensor decision graph using a contraction algorithm according to a contraction order;

[0090] The post-processing module is used to read out a single amplitude, a full amplitude or perform sampling according to the tensor decision graph after the contraction is completed.

[0091] The specific implementation process of each module refers to the above description of the method of the present invention.

[0092] Another embodiment of the present invention provides a computer device (computer, server, smart phone, etc.), which includes a memory and a processor, the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program includes instructions for executing each step in the method of the present invention.

[0093] Another embodiment of the present invention provides a computer-readable storage medium (such as ROM / RAM, magnetic disk, optical disk), wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a computer, the steps of the method of the present invention are implemented.

[0094] It should be understood that the systems and methods disclosed in the above embodiments provided by the present invention can be implemented in other ways. For example, the system embodiments described above are only schematic, and the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the parameters mentioned in the above embodiments can be replaced with other parameters within a reasonable range according to actual applications.

[0095] The specific embodiments of the present invention disclosed above are intended to help understand the content of the present invention and implement it accordingly. It can be understood by those skilled in the art that various replacements, changes and modifications are possible without departing from the spirit and scope of the present invention. The present invention should not be limited to the contents disclosed in the embodiments of this specification, and the scope of protection of the present invention shall be subject to the scope defined in the claims.

Claims

1. A method for quantum circuit simulation, characterized in that: The following steps are involved: Read the information of quantum circuits, input states, and output states, and convert them into tensor networks; Convert tensors in a tensor network into tensor decision graphs; The tensor decision graph is contracted using a contraction algorithm; According to the tensor decision graph after the contraction is completed, single amplitude, full amplitude or sampling is read out.

2. The method according to claim 1, characterized in that Before performing the contraction, a tensor network optimization tool is used to find a better contraction order, and then the tensor decision graph is contracted according to the contraction order.

3. The method according to claim 1, characterized in that The converting of tensors in the tensor network into tensor decision graphs includes: representing single-bit quantum states as tensor decision graphs; and representing quantum gates as tensor decision graphs.

4. The method according to claim 3, characterized in that: The quantum gate is represented as a tensor decision graph, including: for a single-bit gate, a tensor decision graph with two indices is used for representation, and elements in a matrix corresponding to the single-bit gate are stored in different paths of the tensor decision graph; for a two-bit gate, a tensor decision graph with four indices is used for representation, and elements in a matrix corresponding to the two-bit gate are stored in different paths of the tensor decision graph.

5. The method according to claim 1, characterized in that The contraction algorithm is implemented through recursion. When the contraction of two tensor decision graphs is to be completed, the contraction process between their child nodes is first completed, and then the contraction results corresponding to the child nodes are classified and processed to complete the final contraction process; there are two recursive situations: if the index to be processed is an index that needs to be contracted, the two corresponding child nodes are contracted separately, and then the contraction results of the two child nodes are added; if the currently processed index is not an index that needs to be contracted, the contraction results of the two child nodes are connected to the same node to form a complete tensor decision graph.

6. The method according to claim 1, characterized in that For full-amplitude simulation, when all input and output quantum states and quantum gates are contracted, the result is a tensor decision graph associated with n indices, where n is the number of quantum bits in the circuit, and ultimately all amplitude data are read out from different paths of the tensor decision graph; for single-amplitude simulation, when all input and output quantum states and quantum gates are contracted, the result is a tensor decision graph with only one termination node, which contains the final amplitude.

7. The method according to claim 1, characterized in that For full-amplitude simulation, when it is necessary to sample a bit string from the probability distribution corresponding to the amplitude data, the tensor decision graph representing the output quantum state is traversed, the cumulative probability corresponding to the two branches of each node is calculated, and sampling is performed according to the cumulative probability.

8. A system for quantum circuit simulation, characterized in that: include: The preprocessing module is used to read the information of quantum circuits, input states, and output states and convert them into tensor networks; A conversion module, used to convert tensors in the tensor network into tensor decision graphs; The contraction order search module is used to find a better contraction order using the tensor network optimization tool; A contraction module, used to contract the tensor decision graph using a contraction algorithm according to a contraction order; The post-processing module is used to read out a single amplitude, a full amplitude or perform sampling according to the tensor decision graph after the contraction is completed.

9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program comprises instructions for executing the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a computer, the method according to any one of claims 1 to 7 is implemented.