A method for computing the Hilbert-Schmidt test
The ZX calculation method rewrites and simplifies quantum circuits, solves the problem of lack of general conjugation matrix in the existing technology, realizes efficient similarity calculation and inspection of quantum circuits, and improves the simplicity of Hilbert-Smit test Sex and efficiency.
Patent Information
- Application Number
- CN202210698044.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-20
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2042-06-20
AI Technical Summary
The lack of a general method in the prior art to process the conjugation matrix of different quantum lines, which makes it difficult to program quantum lines, especially in deeper lines, which makes it difficult to achieve efficient Hilbert-Smit test.
Using the ZX calculation method, the quantum circuit to be compared is rewritten into the ZX graph, and the conjugation and simplification operations are performed on the graph, and the quantum circuit is converted back to the quantum circuit to achieve a simple and efficient Hilbert-Smit test. The specific steps include determining the known and to be compared quantum circuits, rewriting them into ZX graphs, performing conjugation and simplifying operations, and finally reducing the quantum circuits back to the Hilbert-Smit test.
The calculation of the degree of similarity between two quantum lines is realized, and it is versatile. The line structure is optimized, and the simplicity and efficiency of the Hilbert-Smit test is improved, ensuring the accuracy of fidelity.
Smart Images

Figure CN115049065B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to quantum computing and quantum circuit optimization technology, and in particular to a method for computing a Hilbert-Schmidt test. Background Art
[0002] The Hilbert-Schmidt Test embeds two quantum circuits into a specific quantum circuit, and obtains the similarity of the two quantum circuits, i.e., the fidelity F, through Bell-based measurement. The two quantum circuits are the known quantum circuit U and the quantum circuit V to be compared. * , which is the conjugate of the quantum circuit V. After the Hilbert-Schmidt test quantum circuit is measured by Bell, the amplitude on |0…0> corresponds to That is, the inner product of U and V |<V,U> |The square of the fidelity F∈[0,1]. The larger the value, the higher the similarity between the two quantum circuits.
[0003] In the circuit for the Hilbert-Smith test, the general method for obtaining the conjugate matrix is a key point. The existing technology takes into account the quantum gates used by different quantum circuits for different quantum circuits, and then formulates a separate strategy for each gate. There is a problem that there is no general method in actual operation, which makes programming difficult to implement. Using ZX computing will solve this problem. ZX computing is a tensor network specially formulated for quantum computing. It consists of a ZX graph and rewriting rules. It can realize the rewriting of any quantum circuit into a ZX graph, that is, a graph mainly composed of white and gray points. In ZX computing, the ZX graph has many equivalent rules. The flexible use of equivalent rules can simplify the ZX graph, which is equivalent to simplifying the original quantum circuit and rewriting it into a ZX graph. Summary of the invention
[0004] In view of this, the object of the present invention is to provide a method for calculating the Hilbert-Schmidt test, so as to solve the technical problems that there is no method for universal quantum gate conjugation and the original quantum circuit is deep in the prior art. The present invention provides a method for calculating the Hilbert-Schmidt test, by using ZX calculation on the quantum circuit to be compared, rewriting the quantum circuit to be compared into a ZX diagram, performing conjugation and simplification operations on the ZX diagram, so that the converted circuit has a more concise characteristic, and the Hilbert-Schmidt test is efficiently performed.
[0005] In order to achieve the above object, the present invention adopts the following technical solution:
[0006] A method for calculating a Hilbert-Schmidt test, the method comprising:
[0007] Step S1, determine the known circuit U and the quantum circuit V to be compared;
[0008] Step S2, rewriting the quantum circuit V to be compared in step S2 into a ZX graph G according to the ZX calculation rewriting rule;
[0009] Step S3: Perform a conjugate operation on the G graph obtained in step S2 to obtain a conjugate ZX graph G * ;
[0010] Step S4: G obtained in step S3 * The graph is optimized according to the ZX graph simplification rules to obtain a simplified conjugate ZX graph
[0011] Step S5: The simplified conjugate obtained in step S4 The graph is restored back to the quantum circuit, and the quantum circuit is obtained
[0012] Step S6: Known quantum circuit U and quantum circuit Perform the Hilbert-Smith test and find the fidelity F.
[0013] Further, in step S1, the known line U, wherein the phase parameters of the revolving doors Z and X are π, -π / 2, -π / 8, -π / 4, π, -π / 2, -π / 4, -3π / 8 from top to bottom in each layer.
[0014] Furthermore, in step S1, the quantum circuit V to be compared adopts the same structure as the known circuit U, wherein the phase parameters of the revolving gates Z and X are the same as those of the known circuit U.
[0015] Furthermore, the step S2 comprises:
[0016] Step S201, for the quantum circuit V to be compared, keep the connection of the original quantum circuit unchanged and rewrite the quantum gate;
[0017] Step S202: rewrite the quantum gate according to different rewriting rules of the quantum gate to ensure that the ZX diagram and the original quantum circuit are in a linear mapping relationship.
[0018] Furthermore, in step S2, the ZX calculation rewrite rule specifically includes:
[0019] Rule 1: The ZX diagram is a gray-white line diagram, where the gray dots represent single-bit X rotation gates, and the phase mark is inside the dots; the white dots represent single-bit Z rotation gates, and the phase mark is inside the dots; the white boxes represent Hadamard gates;
[0020] Rule 2: When the quantum circuit is converted into a ZX diagram, the original connection remains unchanged, and the original quantum gate is converted into a node representation in the ZX diagram;
[0021] Rule 3: The two-bit CNOT gate is rewritten as follows: the control end is represented by a white dot with a phase of zero, and the controlled end is represented by a gray dot with a phase of zero;
[0022] Rule 4: The universal single-bit quantum gate is rewritten into a form of white dots, gray dots, and white dots connected to each other, and the influence of the global phase during the rewriting process is ignored.
[0023] Further, in step S2, the ZX graph G is rewritten, and its parameters are in the graph, and each layer from top to bottom is π, -π / 2, -π / 8, -π / 4, π, -π / 2, -π / 4, -3π / 8 respectively.
[0024] Further, in step S3, a conjugation operation is performed by the following method, including:
[0025] Take the opposite of all phase parameters in the ZX diagram to realize the conjugation operation of the quantum circuit corresponding to the ZX diagram.
[0026] Furthermore, in step S4, the ZX graph simplification rule includes the general decomposition rule of the Hadamard gate and the following rules:
[0027] Rule 1: Points of the same color merge with each other and their phases are added;
[0028] Rule 2: When the white box passes a point, the color of the point needs to change to the opposite color;
[0029] Rule 3: If there are two lines connecting two points of different colors, eliminate the two lines at the same time;
[0030] Rule 3: Rewrite the structure of the phase widget equivalently to realize the distribution of CNOT gates from ladder to tree.
[0031] Furthermore, in step S5, the circuit of the ZX graph is restored to a quantum circuit through the inverse operation of the ZX rewriting rule or the Gaussian elimination algorithm.
[0032] Further, in step S6, a Hilbert-Smidt test is performed by the following method, including:
[0033] Substitute the known quantum circuit U and the obtained simplified conjugate quantum circuit to be compared into the Hilbert-Schmidt test circuit, and then use quantum gate operations to map the Bell basis measurement to the computational basis measurement, and measure the probability of |0…0> and calculate the arithmetic square root to obtain the fidelity F.
[0034] The beneficial effects of the present invention are:
[0035] The Hilbert-Schmidt test method of the present invention combines ZX calculation rewriting, simplified rules and restoration to quantum circuit methods, and can realize the calculation of the similarity between two quantum circuits. The method is universal and optimizes the circuit structure, which can improve the simplicity and efficiency of the Hilbert-Schmidt test. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A schematic flow chart of a method for calculating a Hilbert-Schmidt test provided in Example 1;
[0037] Figure 2 A schematic diagram of the Hilbert-Schmidt test quantum circuit provided in Example 1;
[0038] Figure 3 A schematic diagram of a known quantum circuit U provided in Example 1;
[0039] Figure 4 A schematic diagram of a quantum circuit V to be compared provided in Example 1;
[0040] Figure 5 A schematic diagram of a ZX diagram G rewritten for the circuit to be compared provided in Example 1;
[0041] Figure 6 Rewrite it into a ZX graph provided in Example 1 and perform conjugate operation to obtain graph G * Schematic diagram of
[0042] Figure 7 The ZX diagram after applying the simplified rules provided in Example 1 Schematic diagram of
[0043] Figure 8 Provided for Example 1 The figure is restored back to the quantum circuit Schematic diagram of
[0044] Fig. 9 The quantum circuit diagram of the Hilbert-Smith test provided in Example 1. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] Example 1
[0047] See also Figure 1-Figure 9 This embodiment provides a method for calculating the Hilbert-Schmidt test. The specific process of the method is as follows: Figure 1 As shown, the method comprises the following steps:
[0048] Step S1, determine the known circuit U and the quantum circuit V to be compared;
[0049] Specifically, in this embodiment, Figure 2 For the quantum circuit of the Hilbert-Smith test, we only need to substitute the conjugate of the known quantum circuit U and the circuit to be compared V, and then perform calculation basis measurement to obtain the fidelity F. Figure 3 For the known quantum circuit U mentioned above, the phase parameters of the rotation gates Z and X are π, -π / 2, -π / 8, -π / 4, π, -π / 2, -π / 4, -3π / 8 from top to bottom in each layer. Figure 4 For the quantum circuit V to be compared mentioned above, the same structure as the quantum circuit U is adopted in this embodiment, wherein the phase parameters of the rotation gates Z and X are the same as those of the quantum circuit U.
[0050] Step S2, rewriting the quantum circuit V to be compared in step S2 into a ZX graph G according to the ZX calculation rewriting rule;
[0051] Specifically, in this embodiment, step S2 includes:
[0052] Step S201, for the quantum circuit V to be compared, keep the connection of the original quantum circuit unchanged and rewrite the quantum gate;
[0053] Step S202: rewrite the quantum gate according to different rewriting rules of the quantum gate to ensure that the ZX diagram and the original quantum circuit are in a linear mapping relationship.
[0054] More specifically, in this embodiment, the above ZX calculation rewriting rules include:
[0055] Rule 1: The ZX diagram is a gray-white connection diagram, in which the gray dots (single-input single-output) represent single-bit X rotation gates, and the phase mark is inside the dots; the white dots (single-input single-output) represent single-bit Z rotation gates, and the phase mark is inside the dots; in addition, the white boxes (single-input single-output) represent Hadamard gates.
[0056] Rule 2: When the quantum circuit is converted into a ZX diagram, the original connections remain unchanged, and the original quantum gates are converted into node representations in the ZX diagram.
[0057] Rule 3: The two-bit CNOT gate is rewritten as follows: the control end is represented by a white dot with a phase of zero, and the controlled end is represented by a gray dot with a phase of zero.
[0058] Rule 4: The universal single-bit quantum gate is rewritten into a form of white dots, gray dots, and white dots connected to each other, and the influence of the global phase during the rewriting process can be ignored.
[0059] Figure 5 This is the ZX graph G obtained by rewriting the quantum circuit V to be compared. The parameters in each layer from top to bottom in the figure are π, -π / 2, -π / 8, -π / 4, π, -π / 2, -π / 4, -3π / 8.
[0060] Step S3: Perform a conjugate operation on the G graph obtained in step S2 to obtain a conjugate ZX graph G * ;
[0061] Specifically, in this embodiment, the conjugation operation is performed by the following method, including:
[0062] By taking the opposite number of all phase parameters in the ZX diagram, the conjugation operation of the quantum circuit corresponding to the ZX diagram can be realized.
[0063] More specifically, in this embodiment, in the ZX calculation, the conjugate operation of the ZX graph has the characteristics of being simple and efficient, and the conjugate operation can be realized by only taking the opposite number of the phases in all white points and gray points. For example, a white point with a phase of -π becomes a white point with a phase of π after the conjugate operation.
[0064] Figure 6 The figure shows the conjugate operation on the G graph to obtain the conjugate ZX graph G. * .
[0065] Step S4: G obtained in step S3 * The graph is optimized according to the ZX graph simplification rules to obtain a simplified conjugate ZX graph
[0066] Specifically, in this embodiment, the above-mentioned graph simplification rules specifically include:
[0067] Rule 1: Points of the same color can be merged with each other and their phases can be added.
[0068] Rule 2: When the white box passes a point, the color of that point needs to change to the opposite color.
[0069] Rule 3: If there are two lines connecting two points of different colors, these two lines can be eliminated at the same time.
[0070] Rule 3: The structure of the phase widget can be equivalently rewritten to realize the CNOT gate distribution from a ladder-like to a tree-like distribution.
[0071] More specifically, in this embodiment, Figure 7 G *The graph is optimized according to the general simplification rules of ZX graph and some explored rules to obtain the simplified conjugate ZX graph The simplification rules include not only the simplification rules mentioned in this embodiment, but also the general decomposition rules of the Hadamard gate.
[0072] Step S5: The simplified conjugate obtained in step S4 The graph is restored back to the quantum circuit, and the quantum circuit is obtained
[0073] Specifically, in this embodiment, the circuit of the ZX diagram is restored to the quantum circuit by the inverse operation of the ZX rewriting rule or other algorithms.
[0074] More specifically, in this embodiment, Figure 8 To simplify the conjugation The graph is restored back to the quantum circuit, and the quantum circuit is obtained The restoration rule combines the inverse of the rewrite rule and the Gaussian elimination algorithm.
[0075] Step S6: Known quantum circuit U and quantum circuit Perform the Hilbert-Smith test and find the fidelity F.
[0076] Specifically, in this embodiment, the method for performing the Hilbert-Smith test is as follows:
[0077] Substitute the known quantum circuit U and the obtained simplified conjugate quantum circuit to be compared into the Hilbert-Schmidt test circuit, and then use quantum gate operations to map the Bell basis measurement to the computational basis measurement, and measure the probability of |0…0> and calculate the arithmetic square root to obtain the fidelity F.
[0078] More specifically, in this embodiment, Fig. 9 For the known circuit U and quantum circuit Substituting into the Hilbert-Smith test circuit, since the known quantum circuit U and the circuit to be compared V are the same quantum circuit, the fidelity F theoretical analysis should be 1, which means that the two quantum circuits being compared are the same. In the actual simulation, the fidelity obtained after measurement is 1, which is consistent with the theoretical analysis results. In addition, when using different circuits for comparison, the fidelity obtained is between 0 and 1.
[0079] In summary, the Hilbert-Schmidt test method provided in this embodiment combines ZX calculation rewriting, simplified rules and restoration to quantum circuit method, and can realize the calculation of the similarity between two quantum circuits. In addition, the method is universal and optimizes the circuit structure, which can improve the simplicity and efficiency of the Hilbert-Schmidt test.
[0080] The matters not described in detail in the present invention are all known technologies to those skilled in the art.
[0081] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.
Claims
1. A method for calculating a Hilbert-Schmidt test, characterized in that The method comprises: Step S1, determine the known circuit U and the quantum circuit V to be compared; Step S2, rewriting the quantum circuit V to be compared in step S2 into a ZX graph G according to the ZX calculation rewriting rule; Step S3: Perform a conjugate operation on the G graph obtained in step S2 to obtain a conjugate ZX graph G * ; Step S4: G obtained in step S3 * The graph is optimized according to the ZX graph simplification rules to obtain a simplified conjugate ZX graph Step S5: The simplified conjugate obtained in step S4 The graph is restored back to the quantum circuit, and the quantum circuit is obtained Step S6: Known quantum circuit U and quantum circuit Perform the Hilbert-Smith test to find the fidelity F; In step S2, the ZX calculates the rewriting rules, specifically including: Rule 1: The ZX diagram is a gray-white line diagram, where the gray dots represent single-bit X rotation gates, and the phase mark is inside the dots; the white dots represent single-bit Z rotation gates, and the phase mark is inside the dots; the white boxes represent Hadamard gates; Rule 2: When the quantum circuit is converted into a ZX diagram, the original connection remains unchanged, and the original quantum gate is converted into a node representation in the ZX diagram; Rule 3: The two-bit CNOT gate is rewritten as follows: the control end is represented by a white dot with a phase of zero, and the controlled end is represented by a gray dot with a phase of zero; Rule 4: The universal single-bit quantum gate is rewritten into a white dot, a gray dot, and a white dot connected to each other, and the influence of the global phase in the rewriting process is ignored; In step S4, the ZX graph simplification rules include the general decomposition rules of the Hadamard gate and the following rules: Rule 1: Points of the same color merge with each other and their phases are added; Rule 2: When the white box passes a point, the color of the point needs to change to the opposite color; Rule 3: If there are two lines connecting two points of different colors, eliminate the two lines at the same time; Rule 3: Rewrite the structure of the phase widget equivalently to realize the distribution of CNOT gates from ladder to tree.
2. A method for calculating a Hilbert-Schmidt test according to claim 1, characterized in that: In step S1, the phase parameters of the revolving doors Z and X of the known line U are π, -π / 2, -π / 8, -π / 4, π, -π / 2, -π / 4, -3π / 8 from top to bottom in each layer.
3. A method for calculating a Hilbert-Schmidt test according to claim 1, characterized in that: In step S1, the quantum circuit V to be compared adopts the same structure as the known circuit U, wherein the phase parameters of the revolving gates Z and X are the same as those of the known circuit U.
4. A method for calculating a Hilbert-Schmidt test according to claim 1, characterized in that: The step S2 comprises: Step S201, for the quantum circuit V to be compared, keep the connection of the original quantum circuit unchanged and rewrite the quantum gate; Step S202: rewrite the quantum gate according to different rewriting rules of the quantum gate to ensure that the ZX diagram and the original quantum circuit are in a linear mapping relationship.
5. A method for calculating a Hilbert-Schmidt test according to claim 1, characterized in that: In step S2, the ZX graph G is rewritten, and its parameters are in the graph, and each layer from top to bottom is π, -π / 2, -π / 8, -π / 4, π, -π / 2, -π / 4, -3π / 8 respectively.
6. A method for calculating a Hilbert-Schmidt test according to claim 1, characterized in that: In step S3, a conjugation operation is performed by the following method, including: Take the opposite of all phase parameters in the ZX diagram to realize the conjugation operation of the quantum circuit corresponding to the ZX diagram.
7. A method for calculating a Hilbert-Schmidt test according to claim 1, characterized in that: In step S5, the circuit of the ZX graph is restored to a quantum circuit by the inverse operation of the ZX rewriting rule or the Gaussian elimination algorithm.
8. A method for calculating a Hilbert-Schmidt test according to claim 1, characterized in that: In step S6, the Hilbert-Smidt test is performed by the following method, including: Substitute the known quantum circuit U and the obtained simplified conjugate quantum circuit to be compared into the Hilbert-Schmidt test circuit, and then use quantum gate operations to map the Bell basis measurement to the computational basis measurement, and measure the probability of |0…0> and calculate the arithmetic square root to obtain the fidelity F.
