Quantum circuit optimization method, device, quantum computing device, electronic device, and computer program

By converting quantum circuits into unitary matrices and decomposing them under connected graph constraints, the method optimizes quantum circuits, enhancing computational efficiency and operation speed in quantum computing devices.

JP2024541912AActive Publication Date: 2024-11-13TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2024524590
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2022-07-26
Filing Date
2023-05-25
Publication Date
2024-11-13
Estimated Expiration
2043-05-25

AI Technical Summary

Technical Problem

Quantum circuits in superconducting quantum devices face constraints such as path limits, tree limits, and connected graph limits, making it difficult to optimize arbitrary unitary matrices effectively, which hinders the reduction of execution time and computational efficiency.

Method used

The method involves converting a quantum circuit into a unitary matrix, performing iterative decomposition to obtain qubit uniform control gates, decomposing these into qubit diagonal unitary matrices and single qubit gates, and matching these with connected graph constraints to form an optimized quantum circuit.

Benefits of technology

This approach allows for the optimization of quantum circuits under connected graph constraints, resulting in faster operation speeds and improved computational efficiency, accelerating quantum computing devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024541912000001_ABST
    Figure 2024541912000001_ABST
Patent Text Reader

Abstract

The present invention relates to quantum computing technology, and provides a quantum circuit optimization method, device, electronic device, computer-readable storage medium and computer program product. The method includes the steps of: converting a quantum circuit to be optimized into a unitary matrix to be processed, performing iterative decomposition on the unitary matrix to be processed to obtain a first number of qubit uniform control gates, decomposing each qubit uniform control gate into a second number of qubit diagonal unitary matrices and a third number of single qubit gates, determining a match quantum circuit corresponding to each qubit diagonal unitary matrix according to the restriction of a connection graph, matching the second number of match quantum circuits with the third number of single qubit gates to obtain a target quantum circuit of each qubit uniform control gate, and connecting the first number of target quantum circuits to obtain an optimized quantum circuit.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] This application claims priority to a Chinese patent application having application number 202210885994.4, filed on July 26, 2022, the entire contents of which are incorporated herein by reference.

[0002] The present invention relates to quantum computing technology, and in particular to a quantum circuit optimization method, device, electronic device, computer-readable storage medium, and computer program product. [Background technology]

[0003] The number of quantum gates in a quantum circuit is related to the execution time of a quantum algorithm, and to continue to improve computational efficiency, quantum circuits may be optimized to further reduce the execution time of quantum algorithms.

[0004] However, quantum circuits in superconducting quantum devices have various constraints, such as no limit, path limit, tree limit, and connected graph limit, so when implementing a circuit for an arbitrary unitary matrix, generalizing it based on existing quantum circuits without circuit constraints reduces the optimization effect of the quantum circuit. Summary of the Invention

[0005] SUMMARY OF THE DISCLOSURE The embodiments of the present invention provide a quantum circuit optimization method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can improve the optimization effect of a quantum circuit.

[0006] The technical solutions of the embodiments of the present invention are as follows:

[0007] In an embodiment of the present invention, a method for optimizing a quantum circuit, executed by an electronic device, is provided, the method including the steps of: converting a quantum circuit to be optimized into a unitary matrix to be processed, performing an iterative decomposition on the unitary matrix to be processed to obtain a first number of quantum bit uniform control gates; decomposing each of the quantum bit uniform control gates into a second number of quantum bit diagonal unitary matrices and a third number of single quantum bit gates; determining a match quantum circuit corresponding to each of the quantum bit diagonal unitary matrices according to a restriction of a connection graph; matching the second number of the match quantum circuits with the third number of the single quantum bit gates to obtain a target quantum circuit for each of the quantum bit uniform control gates; and connecting the first number of the target quantum circuits to obtain an optimized quantum circuit.

[0008] In an embodiment of the present invention, a quantum circuit optimization device is provided, the device including: a matrix decomposition module that converts a quantum circuit to be optimized into a unitary matrix to be processed, and performs iterative decomposition on the unitary matrix to be processed to obtain a first number of quantum bit uniform control gates; a control gate decomposition module that decomposes each of the quantum bit uniform control gates into a second number of quantum bit diagonal unitary matrices and a third number of single quantum bit gates; a circuit implementation module that determines a match quantum circuit corresponding to each of the quantum bit diagonal unitary matrices according to a restriction of a connection graph; and a connection matching module that matches the second number of the match quantum circuits and the third number of the single quantum bit gates to obtain a target quantum circuit for each of the quantum bit uniform control gates, and connects the first number of the target quantum circuits to obtain an optimized quantum circuit.

[0009] An embodiment of the present invention provides a quantum computing device including an optimized quantum circuit realized by a quantum circuit optimization method according to an embodiment of the present invention.

[0010] In an embodiment of the present invention, there is provided an electronic device including a memory having executable instructions stored therein, and a processor that, when executing the executable instructions stored in the memory, realizes a quantum circuit optimization method according to an embodiment of the present invention.

[0011] An embodiment of the present invention provides a computer readable storage medium having executable instructions stored thereon, the executable instructions, when executed by a processor, implementing a method for optimizing a quantum circuit according to an embodiment of the present invention.

[0012] In an embodiment of the present invention, there is provided a computer program product including a computer program or instructions, which, when executed by a processor, implements a method for optimizing a quantum circuit according to an embodiment of the present invention.

[0013] The embodiment of the present invention has the following advantageous effects: The electronic device performs iterative decomposition on the unitary matrix to be processed obtained by converting the quantum circuit to be optimized, and decomposes the quantum bit uniform control gate obtained by the decomposition to obtain a quantum bit diagonal unitary matrix and a single quantum bit gate. The structure of the quantum circuit to be optimized is relatively complex, and the quantum circuit to be optimized cannot be optimized without changing the function and under the premise of being restricted by the connection graph, while the implementation process of the quantum circuit of the quantum bit diagonal unitary matrix is ​​relatively simple. Therefore, the optimization problem of the quantum circuit can be converted into the implementation problem of the quantum circuit of the quantum bit diagonal unitary matrix, so that the optimization of the quantum circuit can be realized with high efficiency. In addition, according to the restriction of the connection graph, a match quantum circuit is determined for the quantum bit diagonal unitary matrix, and the match quantum circuit and the single quantum bit gate are matched to obtain the optimized quantum circuit. Therefore, a quantum circuit optimized under the restriction of the connection graph, that is, an optimized quantum circuit with a faster operation speed, can be obtained, the effect of the optimization of the quantum circuit can be improved, and the quantum computing efficiency can be improved by optimizing the quantum circuit. [Brief description of the drawings]

[0014] [Figure 1] FIG. 2 is a schematic diagram of a graph restriction. [Diagram 2] 1 is a schematic diagram of the architecture of a quantum circuit optimization system according to an embodiment of the present invention. [Diagram 3] FIG. 3 is a schematic diagram of a configuration of a server in FIG. 2 according to an embodiment of the present invention. [Figure 4] 1 is a schematic flowchart of a quantum circuit optimization method according to an embodiment of the present invention. [Diagram 5] FIG. 2 is a schematic diagram of an n-qubit uniform control gate according to an embodiment of the present invention. [Figure 6] FIG. 2 is a schematic diagram of a decomposition of a qubit uniform control gate in accordance with an embodiment of the present invention. [Figure 7] 2 is a schematic diagram of a connectivity graph according to an embodiment of the present invention; [Figure 8] FIG. 2 is a schematic diagram of a decomposition result of a unitary matrix to be processed according to an embodiment of the present invention; [Figure 9] 4 is another schematic flowchart of a quantum circuit optimization method according to an embodiment of the present invention. [Figure 10] 4 is yet another schematic flowchart of a quantum circuit optimization method according to an embodiment of the present invention. [Figure 11] FIG. 2 is a schematic diagram of a match quantum circuit according to an embodiment of the present invention; [Figure 12] FIG. 2 is a schematic diagram of qubit numbering according to an embodiment of the present invention. [Figure 13] FIG. 2 is a schematic diagram of a circuit implementation of a Controlled NOT (CNOT) gate with path restriction in accordance with an embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0015] In order to make the objectives, technical means and advantages of the present invention clearer, the following will further describe the embodiments of the present invention in detail with reference to the drawings. The described embodiments do not limit the present invention, and all other embodiments that a person skilled in the art can obtain without performing creative work belong to the scope of protection of the present invention.

[0016] In the following description, references to "some embodiments" describe a subset of all possible embodiments, but the "some embodiments" may be the same or different subsets of all possible embodiments and may be combined with each other unless inconsistent.

[0017] In the following description, references to the terms "first," "second," and "third" are merely intended to distinguish between similar objects and do not represent a particular order of the objects. It should be noted that "first," "second," and "third" may be interchanged with respect to a particular order or order, where permitted, such that the described embodiments of the invention may be practiced in orders other than those shown or described herein.

[0018] Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art. The terms used in this specification are merely for describing the embodiments of the present invention and are not intended to limit the present invention.

[0019] Before describing the embodiments of the present invention in more detail, the nouns and terms contained in the embodiments of the present invention will be explained, and the nouns and terms contained in the embodiments of the present invention are suitable for the following interpretation.

[0020] (1) Quantum Computation: A computational method that utilizes properties such as the superposition and entanglement of quantum states to perform computational tasks at high speed.

[0021] (2) Quantum Circuit: A descriptive model of quantum computing that includes qubits and quantum operations on qubits. A quantum circuit includes a set of quantum gates and measurement sequences, where the quantum gates are used to perform a computation and the measurement sequences are used to measure the result of the computation.

[0022] (3) Quantum bit (Qubit): A form of carrying quantum information. In quantum computing, the unit of quantum information is a qubit, which is similar to a classical bit but with the addition of quantum properties of a physical atom.

[0023] (4) Quantum Gate: A basic quantum circuit that manipulates a small number of quantum bits. Quantum gates are the basis of quantum circuits, similar to the relationship between logic gates and digital circuits. Quantum gates operate on one or two quantum bits, a quantum gate that operates on one quantum bit is a single-qubit gate, and a quantum gate that operates on two quantum bits is a double-qubit gate. Below are some quantum gates and their definitions in Table 1 below.

[0024] Table 1 Quantum gates

[0025] [Table 1] (5) Unitary Matrix: Also called a unitary square matrix, it is used to represent quantum gates. That is, any quantum gate can be expressed as a unitary matrix. A unitary matrix is ​​used to represent that the Hermitian conjugate is equal to the inverse matrix. For a real matrix, the Hermitian conjugate is the transpose, so the real orthogonal representation represents that the transpose matrix is ​​equal to the inverse matrix.

[0026] (6) Connected graph: In an undirected graph, if there is a path from node i to node j, then node i and node j are said to be connected. If any two nodes in an undirected graph are connected, then the undirected graph is called a connected graph.

[0027] Quantum computing has the characteristic of completing computational tasks at high speed, and can solve some problems that are difficult for classical computers to solve. For example, the efficiency of the integer factoring problem can be exponentially improved by using quantum computing.

[0028] Since the number of quantum gates in a quantum circuit corresponds to the execution time of a quantum algorithm, to continue to improve computational efficiency, quantum circuits may be optimized to further reduce the execution time of quantum algorithms.

[0029] In the noisy intermediate-scale quantum era (NISQ era), the implementation of double qubit gates (e.g., CNOT gates) in superconducting quantum devices is restricted, e.g., only allowing them to operate on specific qubit pairs; such restrictions are referred to as graph restrictions in embodiments of the present invention.

[0030] FIG. 1 is a schematic diagram of graph restrictions. For example, the graph restrictions in FIG. 1 include path restriction 1-1, tree restriction 1-2, and brick-wall restriction 1-3. The nodes in FIG. 1 represent qubits, the edges represent the connection relationships of qubits, and the graph restriction is to apply a double qubit gate only to two connected qubits. For example, in path restriction 1-1, 0 and 1 are connected, and 0 and 1 can apply a CNOT gate, and 0 and 4 are not connected, and 0 and 4 cannot apply a CNOT gate. In tree restriction 1-2, 1 and 3 are connected, and 1 and 3 can apply a CNOT gate, and 2 and 6 are not connected, and 2 and 6 cannot apply a CNOT gate. In brick-wall restrictions 1-3, 4 and 15 are connected, and 4 and 15 can apply a CNOT gate, and 15 and 16 are not connected, and 15 and 16 cannot apply a CNOT gate.

[0031] Since any quantum circuit can be transformed into a unitary matrix, the size of the optimized quantum circuit can be transformed into the problem of implementing a quantum circuit for any unitary matrix. Therefore, under the graph restriction G = (V, E), the problem of quantum state preparation can be transformed into the problem of implementing a quantum circuit for any unitary matrix. (outside 1) JPEG2024541912000003.jpg24119 For an n-qubit circuit C US is the following formula

[0032]

number

[0033] Where: (outside 2) JPEG2024541912000005.jpg3041 represents a quantum state, and n-qubit circuit C US contains single-qubit gates and CNOT gates, and the arrangement of CNOT gates is restricted by G = (V, E), i.e., in the design of quantum circuits, only single-qubit gates and CNOT gates are allowed to be used, and CNOT gates are allowed to act only on two adjacent qubits.

[0034] In the related art, the quantum circuit optimization problem is solved by implementing a quantum circuit for an arbitrary unitary matrix when there is no circuit restriction, and implementing a quantum circuit for a special problem with a path restriction, and then generalizing based on this quantum circuit without circuit restriction to obtain an optimal quantum circuit. However, since quantum circuits in superconducting quantum devices have various restrictions, such as graph restrictions such as no restriction, path restriction, tree restriction, and connected graph restriction, if the circuit implementation of an arbitrary unitary matrix is ​​generalized based on the existing quantum circuit without circuit restriction, it becomes difficult to obtain an optimal quantum circuit in a gradual sense, and the optimization effect of the quantum circuit is ultimately reduced.

[0035] The embodiments of the present invention provide a quantum circuit optimization method, device, electronic device, computer-readable storage medium, and computer program product that can improve the optimization effect of the quantum circuit. The following describes an exemplary application of the electronic device for optimizing a quantum circuit according to the embodiments of the present invention. The electronic device according to the embodiments of the present invention may be implemented as various types of terminals or as a server. The following describes an exemplary application when the electronic device is implemented as a server.

[0036] 2 is a schematic diagram of the architecture of a quantum circuit optimization system according to an embodiment of the present invention. As shown in FIG. 2, in order to support the quantum circuit optimization application, in the quantum circuit optimization system 100, a terminal 400 and a quantum computing device 500 are connected to a server 200 via a network 300, which may be a wide area network or a local area network, or a combination of both.

[0037] The terminal 400 generates a quantum circuit to be optimized in accordance with the problem to be solved, and transmits the quantum circuit to be optimized to the server 200.

[0038] The server 200 converts the quantum circuit to be optimized into a unitary matrix to be processed, performs iterative decomposition on the unitary matrix to be processed to obtain a first number of quantum bit uniform control gates, decomposes each quantum bit uniform control gate into a second number of quantum bit diagonal unitary matrices and a third number of single quantum bit gates, determines a match quantum circuit corresponding to each quantum bit diagonal unitary matrix according to the restriction of the connected graph, matches the second number of match quantum circuits with the third number of single quantum bit gates, obtains a target quantum circuit of each quantum bit uniform control gate, connects the first number of target quantum circuits, obtains an optimized quantum circuit corresponding to the quantum circuit to be optimized, and realizes the quantum circuit optimization process.

[0039] The server 200 applies the optimized quantum circuit to the quantum computing equipment 500 (for example, transmits the optimized quantum circuit to a quantum chip manufacturing device, manufactures a quantum chip corresponding to the optimized quantum circuit, and obtains a quantum computing equipment based on the arrangement of the quantum chip), and improves the computing efficiency of the quantum computing equipment 500 by using the optimized quantum circuit.

[0040] In some embodiments, server 200 may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Networks (CDNs), and big data and artificial intelligence platforms. Terminal 400 may be, but is not limited to, a smartphone, a tablet computer, a notebook computer, a desktop computer, or the like.

[0041] FIG. 3 is a schematic diagram of a configuration of a server (one implementation of an electronic device) in FIG. 2 according to an embodiment of the present invention. The server 200 shown in FIG. 3 includes at least one processor 210, a memory 250, and at least one network interface 220. The components in the server 200 are connected via a bus system 240. The bus system 240 is used to realize connection and communication between these components. The bus system 240 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For convenience of explanation, the buses in FIG. 3 are collectively referred to as the bus system 240.

[0042] The processor 210 may be an integrated circuit chip with signal processing capabilities, such as a general purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where a general purpose processor may be a microprocessor or any conventional processor, etc.

[0043] Memory 250 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. Memory 250 preferably includes one or more storage devices that are physically separate from processor 210.

[0044] Memory 250 may include volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory may be Read Only Memory (ROM) and volatile memory may be Random Access Memory (RAM). Memory 250 as described in embodiments of the present invention is intended to include any suitable type of memory.

[0045] In some embodiments, memory 250 may store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, such as those illustrated below.

[0046] The operating system 251 includes system programs for handling various basic system services, implementing various basic services, and performing hardware-related tasks, such as a framework layer, a core library layer, and a driver layer for handling hardware-based tasks.

[0047] The network communication module 252 reaches other electronic devices through one or more (wired or wireless) network interfaces 220. Network interfaces 220 include, for example, Bluetooth, wireless compatibility (WiFi), and Universal Serial Bus (USB).

[0048] In some embodiments, the quantum circuit optimization device according to the embodiment of the present invention may be realized by software. As shown in FIG. 3, the quantum circuit optimization device 255 stored in the memory 250 may be software in the form of a program and a plug-in, and includes a matrix decomposition module 2551, a control gate decomposition module 2552, a circuit implementation module 2553, and a connection matching module 2554. These modules are logical, so they may be arbitrarily combined or further divided according to the realized functions. The following describes the functions of the modules.

[0049] In some other embodiments, the quantum circuit optimization apparatus according to the embodiment of the present invention may be implemented in hardware. As an example, the quantum circuit optimization apparatus according to the embodiment of the present invention may employ a processor in the form of a hardware decoding processor, and is programmed to execute the quantum circuit optimization method according to the embodiment of the present invention. For example, the processor in the form of a hardware decoding processor may employ one or more Application Specific Integrated Circuits (ASICs), DSPs, Programmable Logic Devices (PLDs), Complex Programmable Logic Devices (CPLDs), Field-Programmable Gate Arrays (FPGAs), or other electronic components.

[0050] In some embodiments, the terminal or server may realize the quantum circuit optimization method according to the embodiments of the present application by executing a computer program. For example, the computer program may be an original program or software module in an operating system, a local (Native) application program (APP), i.e., a program that needs to be installed and executed in an operating system, such as a circuit optimization APP, an applet, i.e., a program that can be executed simply by downloading it to a browser environment, or an applet that can be embedded in any APP. In other words, the above computer program may be any type of application program, module, or plug-in software.

[0051] An embodiment of the present invention provides a quantum computing device, which includes an optimized quantum circuit, and the optimized quantum circuit is realized by a quantum circuit optimization method according to an embodiment of the present invention.

[0052] Before describing a method for optimizing a quantum circuit according to an embodiment of the present invention, basic symbols related to the embodiment of the present invention will be described first. [n] represents the set {1, 2, ..., n}.

[0053] (Outside 3) JPEG2024541912000006.jpg3143 represents a binary region, (outside 4) JPEG2024541912000007.jpg2641 represents addition in the binary domain, for any x = (x1, …, x n ) T ,y=(y1,…,y n ) T ∈{0,1} n For (outside 5) JPEG2024541912000008.jpg16114, where addition and multiplication are both defined in the binary domain. nrepresents a vector of length n whose elements are all 0, and 1 n represents a vector whose length is n and whose elements are all 1. The set S is a set of quantum bit number information, (outside 6) JPEG2024541912000009.jpg3044 is a quantum state (outside 7) If JPEG2024541912000010.jpg2935 consists of qubits in a set S, where S={q}, then (outside 8) JPEG2024541912000011.jpg3340 (outer 9) Let us briefly write it as JPEG2024541912000012.jpg2943. Sets S and T are (Outside 10) If the image satisfies JPEG2024541912000013.jpg17114, (Outside 11) Define it as JPEG2024541912000014.jpg15114.

[0054] The following describes a quantum circuit optimization method according to an embodiment of the present invention with reference to an exemplary application and implementation of an electronic device according to an embodiment of the present invention, and related basic codes. Figure 4 is a schematic flow chart of a quantum circuit optimization method according to an embodiment of the present invention. The method is described with reference to the steps shown in Figure 4.

[0055] S101: Convert the quantum circuit to be optimized into a unitary matrix to be processed, and perform iterative decomposition on the unitary matrix to be processed to obtain a first number of qubit uniform control gates.

[0056] The embodiment of the present invention is realized in a scenario of optimizing a quantum circuit to be optimized under the restriction of a connected graph. By optimizing the quantum circuit to be optimized, it is possible to obtain an optimized quantum circuit with fewer quantum gates (in other words, less computation time required) while achieving the same function as the quantum circuit to be optimized. Each quantum circuit has a corresponding unitary matrix, and in the embodiment of the present invention, the electronic device performs a unitary matrix transformation on the quantum circuit to be processed, and the obtained unitary matrix is ​​the unitary matrix to be processed. Since the structure of the quantum circuit to be optimized is relatively complex, it is difficult to optimize the quantum circuit to be optimized without changing the function and under the premise of being restricted by the connected graph, while the implementation process of the quantum circuit of the unitary matrix is ​​relatively simple, the embodiment of the present invention is to convert the size of the optimized quantum circuit into the implementation problem of the quantum circuit of an arbitrary unitary matrix.

[0057] It should be noted that the number of quantum bits that the quantum circuit to be optimized acts on may be set according to the actual situation, for example, set as n (n is a positive integer). In the embodiment of the present invention, the process of optimizing the quantum circuit to be optimized is described by taking the application of the quantum circuit to be optimized to n quantum bits as an example.

[0058] If the quantum circuit to be optimized operates on n qubits, the unitary matrix to be processed is an n-qubit unitary matrix. Thus, the optimization problem of the quantum circuit to be optimized is to implement the corresponding quantum circuit of the n-qubit unitary matrix under the connectivity graph constraint.

[0059] In addition, the number of qubits corresponding to the qubit uniform control gates obtained by iterative decomposition from the unitary matrix to be processed is the same as the number of qubits corresponding to the unitary matrix to be processed. That is, when the unitary matrix to be processed is an n-qubit unitary matrix, the electronic device performs n-times iterative decomposition on the n-qubit unitary matrix, and obtains one or more n-qubit uniformly controlled gates (UCGs) and qubit unitary matrices that need to be decomposed at each iterative decomposition, and the electronic device continues to decompose the obtained qubit unitary matrix, and repeats in this manner to obtain a first number of n-qubit uniform control gates until completing n-times iterative decomposition.

[0060] The role of the n-qubit uniform control gate is to n-1 The idea is to apply different single-qubit gates to a target bit under different kinds of control. For example, FIG. 5 is a schematic diagram of an n-qubit uniform control gate according to an embodiment of the present invention. Let S={s1, s2, ..., s n-1} represents the number of the control bit qubit, t represents the number of the target bit qubit, and the n-qubit uniform control gate V t S is a series of single-qubit gates (Outside 12) JPEG2024541912000015.jpg2780, including rotation gate R z (θ), V t S is an n-qubit diagonal unitary matrix, and Λ t S It is expressed as:

[0061] In some embodiments, the step of performing iterative decomposition on the unitary matrix to be processed in step S101 includes the steps of: iteratively performing a process of performing matrix decomposition on an initial unitary matrix of the i-th iteration to obtain a decomposition result of the i-th iteration, where i is a sequentially increasing positive integer, 1≦i≦n, and n is the number of quantum bits, and the initial unitary matrix of the first iteration is the unitary matrix to be processed; extracting a quantum bit uniform control gate of the i-th iteration and a generated unitary matrix of the i-th iteration from the decomposition result of the i-th iteration; and determining the generated unitary matrix of the i-th iteration as the initial unitary matrix of the (i+1)-th iteration; and iteratively performing a process of extracting the qubit uniform control gate of the i-th iteration and a generated unitary matrix of the i-th iteration from the decomposition result of the i-th iteration. n-1 determining the qubit uniform control gates as the first number of qubit uniform control gates.

[0062] Here, i is a positive integer that increases sequentially, 1≦i≦n, and n is the number of quantum bits. The i-th bit in the quantum bit uniform control gate of the i-th iteration is the target bit, the remaining n-1 bits are all control bits, and the quantum bit corresponding to the generating unitary matrix of the i-th iteration is one less than the quantum bit corresponding to the initial unitary matrix of the i-th iteration.

[0063] For example, if n quantum bits corresponding to any n-qubit unitary matrix (i.e., the unitary matrix to be processed) are represented as {1, 2, ..., n}, the electronic device may perform cosine-sine decomposition (i.e., matrix decomposition) on the n-qubit unitary matrix to obtain a decomposition result in the following form:

[0064]

number

[0065] (Outside 17) JPEG2024541912000021.jpg16114 is an n-qubit uniform control gate (i.e., a qubit uniform control gate in the first iteration) whose target bit is the first qubit, and V1 [n]-{1} Therefore, the cosine-sine decomposition of the first iteration may be written as

[0066]

number

[0067]

number

[0068]

number

[0069] In this way, by repeating the iterations until i becomes n, we can obtain the final expansion of U, which is 2 n −1 n-qubit uniform control gate. Thus, U may be written as

[0070]

number

[0071] For example, Figure 8 is a schematic diagram of a decomposition result of a unitary matrix to be processed according to an embodiment of the present invention. The unitary matrix to be processed corresponds to three qubits (represented as 1, 2, and 3), i.e., the unitary matrix to be processed is a 3-qubit unitary matrix. The electronic device decomposes the 3-qubit unitary matrix into seven 3-qubit uniform control gates, namely V3 [2] (The target bit is the third qubit, and the control bits are the first and second qubits), V2 {1,3} (The target bit is the second qubit, and the control bits are the first and third qubits), V3 [2] 、 V1 {2,3} (The target bit is the first qubit, and the control bits are the second and third qubits), V3 [2] , V2 {1,3} and V3 [2] may be obtained.

[0072] As described above, the electronic device can implement a quantum circuit for a unitary matrix to be processed under the restriction of the connected graph simply by implementing a circuit of n-qubit uniform control gates under the restriction of the connected graph.

[0073] S102: Decompose each qubit uniform control gate into a second number of qubit diagonal unitary matrices and a third number of single-qubit gates.

[0074] Any diagonal matrix in the qubit uniform control gate (a matrix in which all elements except the main diagonal are zero) can be used as a rotation gate R z(θ), Hadmard gate H, phase gate S and anti-phase gate (outside 29) JPEG2024541912000037.jpg12114, the electronic device realizes the decomposition for the qubit uniform control gate by decomposing each diagonal matrix, and obtains the qubit diagonal unitary matrix and the single qubit gate. In addition, since the quantum circuit of the single qubit gate is known, in the embodiment of the present invention, the implementation problem of the unitary matrix to be processed is further converted into the circuit implementation problem of the qubit diagonal unitary matrix based on the iterative decomposition of the unitary matrix to be processed and the decomposition of the qubit uniform control gate (the diagonal unitary matrix is ​​easier to realize than the unitary matrix).

[0075] The decomposition process of the quantum bit uniform control gate will be specifically described below with reference to equations (1) to (3).

[0076] Each diagonal element of any n-qubit uniform control gate is the diagonal matrix shown in equation (1).

[0077]

number

[0078] Any diagonal matrix U k For this, decomposition as shown in equation (2) may be performed.

[0079]

number

[0080] Thus, any n-qubit uniform control gate may be decomposed into the form shown in equation (3).

[0081]

number

[0082] For example, Figure 6 is a schematic diagram of a decomposition of a qubit uniform control gate according to an embodiment of the present invention. The electronics generates an n-qubit uniform control gate V t S Decompose (set S = {s1, s2, …, s n-1} represents the number of the control bit qubit, and t represents the number of the target bit qubit), three n-qubit diagonal unitary matrices, namely, Λt S (1), Λ t S (2) and Λ t S (3) (where Λ t S (1) corresponds to A6 in equation (3), and Λ t S (2) corresponds to A4 in equation (3), and Λ t S (3) is the merger of A1 and A2 in (3) (i.e., A1·A2), and four single-qubit gates (respectively from left to right in (3)). (Outside 35) JPEG2024541912000046.jpg7114, H, H, and S. Thus, the electronics obtains the n-qubit diagonal unitary matrix Λ t S (1), Λ t S (2) and Λ t S By simply implementing the circuit (3), i.e., R1, R2, and R3, an n-qubit uniform control gate V t S It is possible to realize a circuit U as follows.

[0083] As described above, by decomposing the n-qubit uniform control gate into an n-qubit diagonal unitary matrix in S102, the target quantum circuit of the n-qubit uniform control gate can be obtained simply by implementing the match quantum circuit of the n-qubit diagonal unitary matrix, so that a quantum circuit under the restriction of the connected graph of the unitary matrix to be processed can be obtained.

[0084] S103: Determine a matching quantum circuit corresponding to each qubit diagonal unitary matrix according to the constraints of the connected graph.

[0085] In an embodiment of the present invention, the electronic device needs to implement a circuit of a qubit diagonal unitary matrix under the restriction of the connection graph, and the obtained circuit is denoted as a matched quantum circuit. The electronic device determines number information for n qubits according to the connection graph, determines qubit pairs based on the number information, and recursively implements the matched quantum circuit of the qubit diagonal unitary matrix by a double qubit gate applied to the qubit pairs.

[0086] Note that any two nodes included in the connected graph are connected, i.e., there is an edge connected between any two nodes, and the nodes in the connected graph have a one-to-one correspondence with qubits, i.e., the nodes in the connected graph represent qubits. Restricting the connected graph means that a double-qubit gate in a quantum circuit is only allowed to act on two qubits that are connected by an edge in the connected graph. For example, FIG. 7 is a schematic diagram of a connected graph according to an embodiment of the present invention. In a connected graph G=(V,E), V={q1, q2, ..., q n Let} denote a set of n nodes in the connected graph, and E denote a set of edges in the connected graph. If the nodes of the connected graph G represent qubits in a quantum circuit, then under the restriction of the connected graph G, we allow a double-qubit gate (e.g., a CNOT gate) to act only on qubit pairs (q1,q2),(q2,q3),(q2,q4),(q4,q5) because there are edges connecting qubit pairs (q1,q2),(q2,q3),(q2,q4),(q4,q5).

[0087] The number information obtained based on the connected graph has one advantage: the distance from a quantum bit with number information k∈[n] (where [n] is the set of number information of n quantum bits) to a quantum bit with number information n does not exceed nk, which limits the circuit size when a double quantum bit gate is implemented in a circuit under path restrictions, and limits the size of the match quantum circuit.

[0088] The following describes the process of implementing a match quantum circuit for qubit diagonal unitary matrix correspondence under a connected graph constraint.

[0089] 9 is another schematic flow chart of a method for optimizing a quantum circuit according to an embodiment of the present invention. As shown in FIG. 9, in some embodiments, the control bits and target bits of different n-qubit uniform control gates may be different, so that the target bits and control bits of the n-qubit diagonal unitary matrices decomposed from different n-qubit uniform control gates may be different. Meanwhile, the diagonal unitary matrix Λ k [n]-{k} and the diagonal unitary matrix Λ l [n]-{l} can be converted between them using a CNOT circuit with a circuit size of O(n) or less. Therefore, electronic devices can be n [n-1] may be selected as a reference diagonal unitary matrix, a match quantum circuit (i.e., a reference quantum circuit) may be determined, and a transformation quantum circuit of the remaining diagonal unitary matrix may be obtained by CNOT gate transformation. In this way, a match quantum circuit of any n-qubit diagonal unitary matrix may be obtained. A specific implementation process of S103 may include S1031 to S1035 as follows:

[0090] S1031: Determine number information corresponding to each of the n quantum bits according to the restrictions of the connected graph.

[0091] In some embodiments, step S1031 may be realized by the following approach 2: extracting a target tree from the connected graph, numbering each node in the target tree, obtaining a node number corresponding to each node, and determining the node number corresponding to each node as number information of the quantum bit corresponding to each node, where the target tree is any one spanning tree in the connected graph, and each quantum bit corresponds to one node in the target tree.

[0092] For example, the electronic device randomly extracts one spanning tree from a connected graph G=(V,E) and numbers n qubits according to the spanning tree, where the nodes of the spanning tree are all the nodes in the connected graph G=(V,E) and the edges are parts of the edges in the connected graph G=(V,E), i.e., V(G')=V(G), E(G')⊆E(G), where G' represents the spanning tree, and all edges that satisfy the edge set E(G') can connect all the nodes without forming a circuit.

[0093] More specifically, the step of numbering each node in the target tree and obtaining a node number corresponding to each node in approach 2 may be realized by the following steps: generate an initialization number for each node in the target tree, and if there is no child node for a node with a node number of n-k+2 or no child node whose number is the initialization number, search for a target node that satisfies a search condition from nodes having node numbers, and determine the node number of the leftmost child node of the target node as n-k+1, and if there is a child node for a node with a node number of n-k+2 and the number of the child node is the initialization number, determine the node number of the leftmost child node among the child nodes whose numbers are the initialization number as n-k+1.

[0094] Here, the search conditions are a node with the maximum number and a child node whose number is the initialization number, 3≦k≦n, the node with node number n is the root node of the target tree (i.e., the nth node is the root node of the target tree), and the node with node number n-1 is the leftmost node of the root node (i.e., the n-1th node is the leftmost node of the root node). In other words, the electronic device first accesses the root node of the spanning tree and numbers the root node as n, then accesses the leftmost child node of the root node and numbers the node as n-1. Next, continuing to access downward, if the accessed node's number is n-k+2 (3≦k≦n), and there is no leaf node in node n-k+2 or there is no leaf node numbered 0 (0 is the initialization number), a search is made for the node with the largest number and a child node numbered 0 from the node set {n-k+2, n-k+3, ..., n} (i.e., nodes with node numbers), and the leftmost node of this node with number 0 is accessed and numbered as n-k+1, and if node n-k+2 has a child node numbered as 0, the leftmost child node of this child node with number 0 is accessed and numbered as n-k+1.

[0095] For example, FIG. 12 is a schematic diagram of the numbering of quantum bits according to an embodiment of the present invention. For a connected graph G, first, one spanning tree T is extracted, and the numbers of all nodes in the spanning tree T are set to 0 (initialization number). First, the root node of T is accessed, and its node number is determined to be 5, and then the leftmost child node of node 5 with number 0 is accessed, and its node number is determined to be 4. Since node 4 does not have a child node, the process returns to node 5, and the leftmost child node of the remaining child nodes with number 0 is accessed, and its node number is determined to be 3. Since node 3 has a child node with number 0, the process returns to node 3, and since node 3 has no other child nodes with number 0, the process continues to return to node 5, and the leftmost child node of the remaining child nodes with number 0 of node 5 is accessed, and its node number is determined to be 1. This obtains number information of five quantum bits, and this number information represents the access order of these five quantum bits.

[0096] According to the above numbering scheme, n quantum bits may be written as [n]. This numbering scheme has the advantage that the distance from a node with number information k∈[n] to a node with number information n does not exceed nk, and the subgraph generated by {k, k+1, k+2, ..., n} is a connected graph.

[0097] S1032: Extract a reference diagonal unitary matrix from the qubit diagonal unitary matrix based on the number information of n qubits, where the target bit of the reference diagonal unitary matrix is ​​the qubit whose number information is n, and the control bit is the qubit whose number information is the previous n-1.

[0098] S1033: Based on the number information of the n quantum bits, a reference quantum circuit corresponding to the reference diagonal unitary matrix is ​​determined.

[0099] The standard diagonal unitary matrix (i.e., Λ n [n-1] ), we first determine the reference quantum circuit for n [n-1] We introduce the definition of the transformation in the standard basis of

[0100]

number

[0101]

number

[0102] 10 is a schematic flowchart of a quantum circuit optimization method according to an embodiment of the present invention. In some embodiments, a specific implementation process of S1033 may include S1033a to S1033e as follows.

[0103] S1033a: A plurality of qubit sequences are generated for a reference diagonal unitary matrix.

[0104] For example, the reference diagonal unitary matrix is ​​Λ n [n-1] If so, the electronic device is n-1 A sequence of qubits of length n-1 (Outside 39) Build JPEG2024541912000052.jpg9114.

[0105] In some embodiments, the step of generating a plurality of qubit sequences for a reference diagonal unitary matrix may be realized by the following process: determining a qubit to be inverted in the jth qubit sequence, and inverting an element in the qubit to be inverted to obtain the j+1th qubit sequence. n-1 If so, 2 n-1 qubit sequences are determined as the qubit sequences of a reference diagonal unitary matrix.

[0106] Note that 2≦j≦2. n-1 , the first qubit sequence is obtained by arranging n-1 second elements. For example, if the second element is 0, the first qubit sequence is an arrangement of n-1 0s. The qubit to be inverted is obtained by subtracting the values ​​of the ruler functions of n and j.

[0107] That is, the first quantum bit sequence c1=0 n-1 In this case, the qubit sequence c j is j-1 It is obtained by inverting the n-ζ(j-1)th bit of . As can be seen from the properties of the ruler function, (outside 40) JPEG2024541912000053.jpg10114 is obtained by inverting the first bit of c1, and (outside 41) The result is JPEG2024541912000054.jpg8114.

[0108] S1033b: Add a first element to the end of each quantum bit sequence to obtain a plurality of first quantum bit sequences, and add a second element to the end of each quantum bit sequence to obtain a plurality of second quantum bit sequences.

[0109] For example, the first element may be 1 and the second element may be 0. In this manner, the electronic device expands each length n-1 qubit sequence into two length n qubit sequences. For example, if the plurality of qubit sequences are 00, 01, 10, and 11, respectively, the plurality of first qubit sequences may be 001, 011, 101, and 111, and the plurality of second qubit sequences may be 000, 010, 100, and 110.

[0110] S1033c: Determine a first quantum circuit corresponding to a reference diagonal unitary matrix based on the number information of the n quantum bits, where the first quantum circuit is used to add a phase corresponding to a plurality of first quantum bit sequences to a standard basis.

[0111] For example, if the first element is 1, a phase corresponding to the first qubit sequence is added to the quantum circuit in the standard basis to obtain a first quantum circuit corresponding to the standard diagonal unitary matrix. n [n-1] , in step S1033c, the electronic device calculates the transformation (outside 42) Determine a quantum circuit for implementing JPEG2024541912000055.jpg12114. Here, c is a collective name for multiple quantum bit sequences, c1 is a collective name for the first quantum bit sequence obtained by adding 1 to the end of each quantum bit sequence, and α c1 is the set of real numbers constructed by the first sequence of qubits.

[0112] More specifically, S1033c may be realized by the following process: determining a match CNOT gate of the jth first quantum bit sequence based on the number information of n quantum bits, constructing a match R quantum gate to be applied after the match CNOT gate of the jth first quantum bit sequence based on the j+1th first quantum bit sequence, and when j is 2 n-1 If the result is -1, then 2 n-1 - Alternately connect one match CNOT gate and one match R quantum gate to obtain a candidate subcircuit, determine a fill R quantum gate and a fill CNOT gate, connect the fill R quantum gate and the fill CNOT gate to obtain a fill subcircuit, and determine a first quantum circuit based on the candidate subcircuit and the fill subcircuit, where j is a positive integer that increases sequentially, and 1≦j≦2 n-1 -1, 2 n-1 is the number of the first qubit series.

[0113] Here, the target bit of the match CNOT gate is a quantum bit with number information n, and the control bit is a quantum bit with number information n-ζ(j). That is, the electronic device applies a CNOT gate to a quantum bit with number information n and a quantum bit with number information n-ζ(j) (ζ(j) is calculated from the above definition of the ruler function), and the CNOT gate is used to process a first quantum bit sequence. In other words, the number information corresponding to the control bit of the match CNOT gate of the jth first quantum bit sequence is calculated from n and j, and the target bit is a quantum bit with number information n.

[0114] In addition, the refilling R quantum gate is determined based on the first quantum bit sequence, the control bit of the refilling CNOT gate is a quantum bit whose number information is 1, and the target bit of the refilling CNOT gate is a quantum bit whose number information is n.

[0115] For example, equation (2) is an example of an equation for a first quantum circuit.

[0116]

number

[0117] Equation (2) may be realized by the following process.

[0118]

number

[0119] In some embodiments, step S1033d may be realized by the following approach 1: A diagonal unitary matrix to be implemented corresponding to a reference diagonal unitary matrix is ​​determined. Here, the diagonal unitary matrix to be implemented corresponds to n-1 quantum bits. The unitary matrix to be implemented is decomposed by a conversion circuit to obtain a permutation diagonal unitary matrix. Here, the conversion circuit is used to permutate a quantum state in a first quantum bit set corresponding to the unitary matrix to be implemented to a quantum state in a second quantum bit set. Based on the number information of n quantum bits, a permutation quantum circuit corresponding to the permutation diagonal unitary matrix is ​​determined. A connection result of the conversion circuit, the permutation quantum circuit, and an inverse conversion circuit corresponding to the conversion circuit is determined as a second quantum circuit. Here, the inverse conversion circuit is used to permutate a quantum state in the second quantum bit set to a quantum state in the first quantum bit set (e.g., the inverse conversion circuit converts the quantum bits to an initial position, i.e., an original quantum state).

[0120] The following exemplarily describes approach 1. If the second element is 0, a second quantum circuit is obtained by adding a phase corresponding to the second bit sequence to the quantum circuit in the standard basis. n [n-1] With reference to the transformation in the standard basis and the set of real numbers, the electronic device (outside 45) The quantum circuit for implementing JPEG2024541912000060.jpg11140 is called the second quantum circuit. Here, c0 is the second quantum bit sequence obtained by adding 0 to the end of the bit sequence, and α c0 is the set of real numbers constructed by the second sequence of qubits.

[0121] Where: (outside 46) Implementing JPEG2024541912000061.jpg12118 involves the implementation of a (n-1)-qubit diagonal unitary matrix in the qubit set [n-1] (the diagonal unitary matrix Λ n-1 [n-2] ) (outside 47) JPEG2024541912000062.jpg19144The graph generated by the set of qubits [n-1] (i.e., the first set of qubits) is not necessarily a connected graph, but the graph generated by the set of qubits [n]-{1} (i.e., the second set of qubits) is a connected graph. Thus, Λ n-1 [n-2] To achieve this, in an embodiment of the present invention, an exchange circuit may first be determined that can replace the quantum states in the qubit set [n-1] of the diagonal unitary matrix to be implemented with the quantum state in the qubit set [n]-{1}. That is, the alternating circuit replaces the quantum state in the first qubit set corresponding to the diagonal unitary matrix to be implemented with the quantum state in the second qubit set. For example, the qubit set [n-1] is a set composed of qubits numbered 1, 2, 3, ..., n-1, and the quantum states of these qubits are (outside 48) JPEG2024541912000063.jpg7114, (outside 49) JPEG2024541912000064.jpg7114,…, (outside 50) In this case, the quantum state of the quantum bit numbered n is (outside 51) JPEG2024541912000066.jpg9114. The quantum bit set [n]-{1} is a set composed of quantum bits numbered 2, 3, ..., n. In this case, the process of replacing the quantum state in the quantum bit set [n-1] with the quantum bit set is as follows. The quantum states of the quantum bits numbered 2, 3, ..., n are respectively (outside 52) JPEG2024541912000067.jpg9114, (outside 53) JPEG2024541912000068.jpg8114,…, (outside 54) JPEG2024541912000069.jpg11114. In this case, the quantum state of the quantum bit with number n is (outside 55) JPEG2024541912000070.jpg9114. Then, the diagonal unitary matrix to be implemented is decomposed as follows. Based on the unitary matrix corresponding to the transformation circuit and the unitary matrix corresponding to the inverse transformation circuit, the unitary matrix to be implemented is decomposed, and Λ n [n-1]-{1} (permutation diagonal unitary matrix), where the decomposition principle is as follows: Λ n-1 [n-2] and Λ n [n-1]-{1} And Y=PXP -1 (Y represents the unitary matrix to be implemented, P represents the unitary matrix corresponding to the transformation circuit, and P -1 represents a unitary matrix corresponding to the inverse transformation circuit, and X represents a permutation diagonal unitary matrix). After determining the transformation circuit, the unitary matrix of the alternating circuit and the unitary matrix of the inverse exchange circuit are known quantities, so that the matrix transformation (i.e., P for Y -1 , right-multiply by P, and decompose Y. n [n-1]-{1} Then, obtain Λ by the following method. n [n-1]-{1} Determine the quantum circuit (permutation quantum circuit) of Λ n [n-1]-{1} is restricted by the connected graph, so we use the permutation diagonal unitary matrix Λ based on the number information of n quantum bits. n [n-1]-{1} Then, the quantum circuits corresponding to the quantum gates obtained by the decomposition may be connected to obtain a permutation quantum circuit. For example, n [n-1]-{1} Execute steps S1033a to S1033e with Λ as a new reference diagonal unitary matrix. n [n-1]-{1} That is, in step S1033, a permutation quantum circuit of Λ is obtained. n [n-1]-{1}A quantum bit sequence is constructed for , and in step S1033b, 0 and 1 are added to the end of the quantum bit sequence to obtain Λ n [n-1]-{1} Then, in a manner similar to the process in S1033c, obtain the first qubit sequence and the second qubit sequence of Λ n [n-1]-{1} and by the method of step S1033d, determine a first quantum circuit corresponding to Λ n [n-1]-{1} and in step S1033e, a second quantum circuit for n [n-1]-{1} Determine the permutation quantum circuit of Λ n [n-1]-{1} After determining the quantum circuit (permutation quantum circuit), a transformation circuit and an inverse transformation circuit corresponding to the transformation circuit are connected based on the permutation quantum circuit to obtain a second quantum circuit.

[0122] S1033e: Determine a reference quantum circuit corresponding to a reference diagonal unitary matrix based on the first quantum circuit and the second quantum circuit.

[0123] The electronic device first applies a first quantum circuit to n quantum bits, and then applies a second quantum circuit to n quantum bits, and the resulting overall circuit is the reference quantum circuit. In other words, the electronic device connects the first quantum circuit and the second quantum circuit to obtain the reference quantum circuit.

[0124] For example, Fig. 11 is a schematic diagram of a match quantum circuit according to an embodiment of the present invention. A first quantum circuit and a second quantum circuit are applied to quantum bits whose number information is 1, 2, ..., n-1, and n, respectively. Here, the second quantum circuit includes a transformation circuit P, a permutation quantum circuit, and an inverse transformation circuit (outside 56) Contains JPEG2024541912000071.jpg8114.

[0125] S1034: The reference quantum circuit is transformed by a controlled NOT (CNOT) gate to obtain a transformed quantum circuit corresponding to the residual diagonal unitary matrix.

[0126] Note that the residual diagonal unitary matrix is ​​a diagonal unitary matrix other than the reference diagonal unitary matrix among the quantum bit diagonal unitary matrices.

[0127] S1035: A reference quantum circuit corresponding to the reference diagonal unitary matrix and a transformation quantum circuit corresponding to the remaining diagonal unitary matrix are determined as match quantum circuits of the qubit diagonal unitary matrix.

[0128] S104: Match the second number of matched quantum circuits with a third number of single-qubit gates to obtain a target quantum circuit for each qubit uniform control gate.

[0129] Here, the single qubit gate is a known quantum circuit, and the electronic device is based on the match quantum circuit restricted by the connection graph obtained in the above step S103, and then step S104 may be realized in the following manner: connect the match quantum circuit and the single qubit gate according to a sequence to obtain a target quantum circuit for each qubit uniform control gate. The sequence is the decomposition sequence of the qubit diagonal unitary matrix and the single qubit gate obtained by decomposing the qubit uniform control gate, for example, the sequence in FIG. 6. Finally, the electronic device obtains a plurality of target quantum circuits that correspond one-to-one to a plurality of qubit uniform control gates.

[0130] For example, as shown in Figure 6, (outside 57) JPEG2024541912000072.jpg9114, H, H, and S are known quantum circuits. In step S103, the match quantum circuits corresponding to R1, R2, and R3 are obtained. Then, R1, (outside 58) JPEG2024541912000073.jpg8114, H, R2, H, S, R3 (i.e., the decomposition order of the qubit uniform control gate into a qubit diagonal unitary matrix and a single qubit gate), (outside 59) JPEG2024541912000074.jpg6114, H, H, S) and a match quantum circuit (i.e., the match quantum circuits corresponding to R1, R2, and R3, respectively) are connected to form an n-qubit uniform control gate V t S Obtain the target quantum circuit.

[0131] S105: A first number of the target quantum circuits are connected to obtain an optimized quantum circuit.

[0132] Here, after obtaining the first number of target quantum circuits in step S104, the electronic device connects the first number of target quantum circuits according to the iterative decomposition order of the quantum bit uniform control gates to obtain an optimized quantum circuit (i.e., an optimized quantum circuit corresponding to the quantum circuit to be optimized). Here, the iterative decomposition order is the order of the quantum bit uniform control gates obtained by iteratively decomposing the unitary matrix to be processed. As described above, the calculation time required to optimize a quantum circuit is less than the calculation time of the quantum circuit to be optimized.

[0133] As described above, the embodiment of the present invention is realized in a scenario of optimizing a quantum circuit to be optimized under the restriction of a connected graph. By optimizing the quantum circuit to be optimized, it is possible to obtain an optimized quantum circuit that can achieve the same function as the quantum circuit to be optimized and has fewer quantum gates (in other words, requires less calculation time). Each quantum circuit has a corresponding unitary matrix, and in the embodiment of the present invention, the electronic device performs a unitary matrix transformation on the quantum circuit to be processed, and the obtained unitary matrix is ​​the unitary matrix to be processed. The structure of the quantum circuit to be optimized is relatively complex, and it is difficult to optimize the quantum circuit to be optimized without changing the function and under the premise of being limited by the connected graph, while the implementation process of the quantum circuit of the unitary matrix is ​​relatively simple. Therefore, in the embodiment of the present invention, first, iterative decomposition is performed on the unitary matrix to be processed obtained by transforming the quantum circuit to be optimized, and then the quantum bit uniform control gate obtained by the decomposition is decomposed to obtain a quantum bit diagonal unitary matrix and a single quantum bit gate. This realizes recursively converting the quantum circuit optimization problem into a quantum circuit implementation problem of a qubit diagonal unitary matrix, and determines a match quantum circuit for the qubit diagonal unitary matrix under the restriction of the connection graph, and finally obtains an optimized quantum circuit by matching the match quantum circuit with a single qubit gate. Therefore, a quantum circuit optimized under the restriction of the connection graph, that is, an optimized quantum circuit with a faster operation speed, can be obtained, and the effect of optimizing the quantum circuit can be improved. In addition, when the obtained optimized quantum circuit is applied to a quantum computing device, the operation speed of the quantum computing device can be accelerated, and the operation efficiency of the quantum computing device can be improved.

[0134] The optimization effect of the quantum circuit optimization method according to the embodiment of the present invention has been described above.

[0135] First, we introduce circuit implementations of CNOT gates and exchange gates with path restrictions.

[0136] 1. CNOT Gate CNOT j iCircuit implementation for paths of: For example, FIG. 13 is a schematic diagram of a circuit implementation of a controlled NOT (CNOT) gate with path restriction according to an embodiment of the present invention. As shown in FIG. 13, with the restriction of path i-(i+1)-...-(j-1)-j, j i may be implemented by a CNOT circuit whose depth and size are both O(ji).

[0137] 2. SWAP j i Circuit implementation of SWAP j i =CNOT j i CNOT i j CNOT j i Therefore, by restricting the route i-(i+1)-…-(j-1)-j, SWAP j i may be realized by a CNOT circuit whose depth and size are both (ji).

[0138] 3. Compression of CNOT circuits under the restriction of any connected graph: Under the restriction of connected graph, the size of an n-qubit circuit constructed with any CNOT gate can be reduced to O(n 2 )

[0139] The following is the n-qubit diagonal unitary matrix Λ n [n-1] We analyze the size of circuits that can be implemented recursively under the constraint of the connected graph G of S. [n]-[k] Let denote the circuit size of the diagonal unitary matrix acting on the set of qubits [n]-[k], where (outside 60) When determining the first quantum circuit, we define CNOT as shown in the quantum bit number information in the connected graph. n n-ζ(j) The distance between the control bit n-ζ(j) and the target bit n in does not exceed ζ(j). As can be seen from the implementation of the CNOT gate in the path restriction, nn-ζ(j) can be implemented by a circuit of size O(ζ(j)). Also, the ruler function is (outside 61) In JPEG2024541912000076.jpg7114, element k is 2 n-1-k Because of the property that it appears times, the size of the first quantum circuit is as follows:

[0140]

number

[0141]

number

[0142] In addition, the embodiment of the present invention is a n), any n-qubit uniform control gate can be realized under the connected graph restriction, and the quantum state preparation circuit can be decomposed into n qubit uniform control gates of sizes 1, 2, ..., n, respectively. Therefore, in the embodiment of the present invention, the circuit size under the connected graph restriction is O(2 n ), the size of the quantum state preparation circuit is also optimal under the connected graph restriction.

[0143] The following continues to describe an exemplary configuration in which the quantum circuit optimization device 255 according to an embodiment of the present invention is implemented as a software module. In some embodiments, as shown in FIG. 3, the software module of the quantum circuit optimization device 255 stored in the memory 250 may include the following modules:

[0144] The matrix decomposition module 2551 converts the quantum circuit to be optimized into a unitary matrix to be processed, and performs iterative decomposition on the unitary matrix to be processed to obtain a first number of qubit uniform control gates. The control gate decomposition module 2552 decomposes each qubit uniform control gate into a second number of qubit diagonal unitary matrices and a third number of single qubit gates. The circuit implementation module 2553 determines a match quantum circuit corresponding to each qubit diagonal unitary matrix according to the restriction of the connection graph. The connection matching module 2554 matches the second number of match quantum circuits with the third number of single qubit gates to obtain a target quantum circuit of each qubit uniform control gate, and connects the first number of target quantum circuits to obtain an optimized quantum circuit.

[0145] In some embodiments, the matrix decomposition module 2551 includes a step of iteratively performing a process of performing matrix decomposition on an initial unitary matrix of the i-th iteration to obtain a decomposition result of the i-th iteration, where i is a sequentially increasing positive integer, 1≦i≦n, and n is the number of qubits, where the initial unitary matrix of the first iteration is the unitary matrix to be processed; a process of extracting a qubit uniform control gate of the i-th iteration and a generated unitary matrix of the i-th iteration from the decomposition result of the i-th iteration; and a process of determining the generated unitary matrix of the i-th iteration as the initial unitary matrix of the i+1-th iteration; and a process of extracting the qubit uniform control gate of the i-th iteration and a generated unitary matrix of the i-th iteration from the decomposition result of the i-th iteration. n-1 determining the qubit uniform control gates as the first number of qubit uniform control gates.

[0146] In some embodiments, the circuit implementation module 2553 is configured to perform the steps of: determining number information corresponding to each of the n qubits according to the restriction of the connected graph; extracting a reference diagonal unitary matrix from the qubit diagonal unitary matrix based on the number information of the n qubits, where the target bit of the reference diagonal unitary matrix is ​​a qubit with number information n, and the control bit is a qubit with number information of the previous n-1; determining a reference quantum circuit corresponding to the reference diagonal unitary matrix based on the number information of the n qubits; transforming the reference quantum circuit by a controlled NOT (CNOT) gate to obtain a transformation quantum circuit corresponding to the residual diagonal unitary matrix, where the residual diagonal unitary matrix is ​​a diagonal unitary matrix other than the reference diagonal unitary matrix among the qubit diagonal unitary matrices; and determining the reference quantum circuit corresponding to the reference diagonal unitary matrix and the transformation quantum circuit corresponding to the residual diagonal unitary matrix as a match quantum circuit of the qubit diagonal unitary matrix.

[0147] In some embodiments, the circuit implementation module 2553 is configured to perform the steps of generating a plurality of qubit sequences for a reference diagonal unitary matrix; appending a first element to the end of each qubit sequence, respectively, to obtain a plurality of first qubit sequences; and appending a second element to the end of each qubit sequence, respectively, to obtain a plurality of second qubit sequences; determining a first quantum circuit corresponding to the reference diagonal unitary matrix based on number information of the n qubits, where the first quantum circuit is used to add a phase corresponding to the plurality of first qubit sequences to a standard basis; determining a second quantum circuit corresponding to the reference diagonal unitary matrix based on number information of the n qubits, where the second quantum circuit is used to add a phase corresponding to the plurality of second qubit sequences to the standard basis; and determining a reference quantum circuit corresponding to the reference diagonal unitary matrix based on the first quantum circuit and the second quantum circuit.

[0148] In some embodiments, the circuit implementation module 2553 determines a match CNOT gate for the j-th first qubit sequence based on the number information of the n qubits, where j is an increasing positive integer, and 1≦j≦2. n-1 -1, and constructing a match R quantum gate based on the j+1-th first quantum bit sequence to be applied after the match CNOT gate of the j-th first quantum bit sequence, where j is 2 n-1 If the result is -1, then 2 n-1 - alternately connecting one match CNOT gate and one match R quantum gate to obtain a candidate subcircuit; determining a fill R quantum gate and a fill CNOT gate, connecting the fill R quantum gate and the fill CNOT gate to obtain a fill subcircuit; and determining a first quantum circuit based on the candidate subcircuit and the fill subcircuit.

[0149] In some embodiments, a fill R quantum gate is determined based on the first qubit sequence, the control bit of the fill CNOT gate is a qubit with number information 1, and the target bit of the fill CNOT gate is a qubit with number information n. Number information corresponding to the control bit of the match CNOT gate of the jth first qubit sequence is calculated from n and j, and the target bit of the match CNOT gate of the jth first qubit sequence is a qubit with number information n.

[0150] In some embodiments, the circuit implementation module 2553 is configured to perform the steps of: determining a diagonal unitary matrix to be implemented corresponding to a reference diagonal unitary matrix, where the diagonal unitary matrix to be implemented corresponds to n-1 quantum bits; decomposing the unitary matrix to be implemented by a conversion circuit to obtain a permutation diagonal unitary matrix, where the conversion circuit is used to permutate a quantum state in a first set of quantum bits corresponding to the unitary matrix to be implemented with a quantum state in a second set of quantum bits; determining a permutation quantum circuit corresponding to the permutation diagonal unitary matrix based on the number information of the n quantum bits; and determining a connection result between the conversion circuit, the permutation quantum circuit, and an inverse conversion circuit corresponding to the conversion circuit as a second quantum circuit, where the inverse conversion circuit is used to permutate a quantum state in the second set of quantum bits with a quantum state in the first set of quantum bits.

[0151] In some embodiments, the circuit implementation module 2553 determines a qubit to invert in the jth qubit sequence, and inverts an element in the qubit to invert to obtain a j+1th qubit sequence, where 2≦j≦2 n-1 ,The 1st qubit sequence is obtained by arranging n-1 second elements,step, and the value of j in the iteration is 2. n-1 If so, 2 n-1 determining the qubit sequences as the qubit sequences of a reference diagonal unitary matrix.

[0152] In some embodiments, the circuit implementation module 2553 is configured to perform the steps of extracting a target tree from the connected graph, where the target tree is any one spanning tree in the connected graph, and each quantum bit corresponds to one node in the target tree; numbering each node in the target tree and obtaining a node number corresponding to each node; and determining the node number corresponding to each node as number information of the quantum bit corresponding to each node.

[0153] In some embodiments, the circuit implementation module 2553 is configured to perform the steps of: generating an initialization number for each node in the target tree; if there is no child node for the node with node number n-k+2 or if there is no child node whose number is the initialization number, searching for a target node that satisfies a search condition from the nodes having the node number and determining the node number of the leftmost child node of the target node as n-k+1, where the search condition is a node with the largest number and a child node whose number is the initialization number, 3≦k≦n, the node with node number n is the root node of the target tree, and the node with node number n-1 is the leftmost node of the root node; and if there is a child node for the node with node number n-k+2 and the number of the child node is the initialization number, determining the node number of the leftmost child node of the child nodes whose number is the initialization number as n-k+1.

[0154] An embodiment of the present invention further provides a computer program product or computer program comprising computer instructions, the computer instructions being stored in a computer readable storage medium, the computer instructions being read by a processor of an electronic device from the computer readable storage medium, the processor executing the computer instructions to cause the electronic device to perform the above quantum circuit optimization method according to an embodiment of the present invention.

[0155] An embodiment of the present invention is a computer-readable storage medium having computer-executable instructions stored thereon, which, when executed by a processor, causes the processor to perform a quantum circuit optimization method according to an embodiment of the present invention, such as the quantum circuit optimization method shown in FIG.

[0156] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM, or may be any device including one or any combination of the above memories.

[0157] In some embodiments, the executable instructions may be created in any type of programming language (including compiled or interpreted languages, or declarative or procedural languages) in the form of a program, software, software module, script, or code, and may be implemented in any form, for example as a stand-alone program, or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0158] As an example, the executable instructions may be implemented and executed on a single electronic device, may be executed on multiple electronic devices located at a single location, or may be executed on multiple electronic devices distributed at multiple locations and interconnected via a communications network.

[0159] As described above, according to the embodiment of the present invention, first, the quantum circuit to be optimized is converted to obtain a unitary matrix to be processed, and then the quantum bit uniform control gate obtained by the decomposition is decomposed to obtain a quantum bit diagonal unitary matrix and a single quantum bit gate. This realizes recursive conversion of the quantum circuit optimization problem into a quantum circuit implementation problem of the quantum bit diagonal unitary matrix, and determines a match quantum circuit for the quantum bit diagonal unitary matrix under the connection graph restriction, and finally obtains an optimized quantum circuit by matching the match quantum circuit and the single quantum bit gate. Therefore, a quantum circuit optimized under the connection graph restriction, that is, an optimized quantum circuit with a faster operation speed, can be obtained, and the effect of optimizing the quantum circuit can be improved. In addition, when the optimized quantum circuit is applied to a quantum computing device, the operation speed of the quantum computing device can be accelerated, and the operation efficiency of the quantum computing device can be improved. The circuit size under the connection graph restriction is O(2 n ), the size of the quantum state preparation circuit in the connected graph limit is also optimal.

[0160] The above only describes the exemplary embodiments of the present invention, and does not limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention are included within the protection scope of the present invention.

Claims

1. A method for optimizing a quantum circuit, the method comprising: converting the quantum circuit to be optimized into a unitary matrix to be processed, and performing an iterative decomposition on the unitary matrix to be processed to obtain a first number of qubit uniform control gates; decomposing each said qubit uniform control gate into a second number of qubit diagonal unitary matrices and a third number of single qubit gates; determining a matching quantum circuit corresponding to each said qubit diagonal unitary matrix according to a restriction of a connectivity graph; matching a second number of said matched quantum circuits with a third number of said single qubit gates to obtain a target quantum circuit for each said qubit uniform control gate; and connecting a first number of the target quantum circuits to obtain an optimized quantum circuit.

2. The step of performing an iterative decomposition on the unitary matrix to be processed to obtain a first number of qubit uniform control gates comprises: Let i be a positive integer that increases sequentially, 1≦i≦n, and n be the number of quantum bits. A process of performing matrix decomposition on an initial unitary matrix of an i-th iteration to obtain a decomposition result of the i-th iteration, where the initial unitary matrix of the first iteration is the unitary matrix to be processed; Extracting the qubit uniform control gate of the i-th iteration and the generator unitary matrix of the i-th iteration from the decomposition result of the i-th iteration; determining a generated unitary matrix of the i-th iteration as an initial unitary matrix of the i+1-th iteration; 2 obtained by n iterations n-1 and determining qubit uniform control gates as the first number of said qubit uniform control gates.

3. the qubit diagonal unitary matrix corresponds to n qubits; determining a matching quantum circuit corresponding to each of the qubit diagonal unitary matrices according to a restriction of the connected graph, determining number information corresponding to each of the n quantum bits according to a restriction of the connection graph; Extracting a reference diagonal unitary matrix from the qubit diagonal unitary matrix based on number information of the n qubits, where the target bit of the reference diagonal unitary matrix is ​​a qubit with number information n, and the control bit is a qubit with number information of the previous n-1; determining a reference quantum circuit corresponding to the reference diagonal unitary matrix based on number information of the n quantum bits; transforming the reference quantum circuit by a controlled NOT (CNOT) gate to obtain a transformed quantum circuit corresponding to a residual diagonal unitary matrix, the residual diagonal unitary matrix being a diagonal unitary matrix other than the reference diagonal unitary matrix among the qubit diagonal unitary matrices; determining a reference quantum circuit corresponding to the reference diagonal unitary matrix and a transformation quantum circuit corresponding to the remaining diagonal unitary matrix as the match quantum circuit of the qubit diagonal unitary matrix.

4. The step of determining a reference quantum circuit corresponding to the reference diagonal unitary matrix based on number information of the n quantum bits includes: generating a plurality of qubit sequences for the reference diagonal unitary matrix; adding a first element to the end of each of the quantum bit sequences to obtain a plurality of first quantum bit sequences, and adding a second element to the end of each of the quantum bit sequences to obtain a plurality of second quantum bit sequences; A step of determining a first quantum circuit corresponding to the reference diagonal unitary matrix based on number information of the n quantum bits, the first quantum circuit being used to add a phase corresponding to a plurality of the first quantum bit series to a standard basis; A step of determining a second quantum circuit corresponding to the reference diagonal unitary matrix based on number information of the n quantum bits, the second quantum circuit being used to add a phase corresponding to a plurality of the second quantum bit series to the standard basis; and determining the reference quantum circuit corresponding to the reference diagonal unitary matrix based on the first quantum circuit and the second quantum circuit.

5. The step of determining a first quantum circuit corresponding to the reference diagonal unitary matrix based on number information of the n quantum bits includes: determining a match CNOT gate for the j-th first quantum bit sequence based on the number information of the n quantum bits, where j is a sequentially increasing positive integer, and 1≦j≦2; n-1 -1, step, constructing a match R quantum gate based on the j+1 th first quantum bit sequence to be applied after the match CNOT gate of the j th first quantum bit sequence; j is 2 n-1 If it is -1, then 2 n-1 - connecting one match CNOT gate and one match R quantum gate alternately to obtain a candidate subcircuit; determining a fill R quantum gate and a fill CNOT gate, and connecting the fill R quantum gate and the fill CNOT gate to obtain a fill subcircuit; determining the first quantum circuit based on the candidate subcircuit and the fill subcircuit.

6. The fill R quantum gate is determined based on a first quantum bit sequence, a control bit of the fill CNOT gate is a quantum bit having number information of 1, and a target bit of the fill CNOT gate is a quantum bit having number information of n; 6. The method of claim 5, wherein number information corresponding to a control bit of a match CNOT gate of a j-th first quantum bit series is calculated from n and j, and a target bit of a match CNOT gate of a j-th first quantum bit series is a quantum bit whose number information is n.

7. The step of determining a second quantum circuit corresponding to the reference diagonal unitary matrix based on number information of the n quantum bits includes: determining a diagonal unitary matrix to be implemented corresponding to the reference diagonal unitary matrix, the diagonal unitary matrix to be implemented corresponding to n−1 quantum bits; decomposing the unitary matrix to be implemented by a transformation circuit to obtain a permutation diagonal unitary matrix, the transformation circuit being used to permutate a quantum state in a first set of qubits corresponding to the unitary matrix to be implemented with a quantum state in a second set of qubits; determining a permutation quantum circuit corresponding to the permutation diagonal unitary matrix based on the number information of the n quantum bits; 5. The method of claim 4, further comprising: determining a connection result of the conversion circuit, the permutation quantum circuit, and an inverse conversion circuit corresponding to the conversion circuit as the second quantum circuit, the inverse conversion circuit being used to permute a quantum state in a second set of quantum bits into a quantum state in the first set of quantum bits.

8. The step of generating a plurality of qubit sequences for the reference diagonal unitary matrix includes: determining a qubit to be inverted in the jth qubit sequence, and inverting an element in the qubit to be inverted to obtain a j+1th qubit sequence, n-1 , the first qubit sequence is obtained by arranging n−1 second elements; and The value of iteration j is 2 n-1 In this case, 2 n-1and determining qubit sequences as the qubit sequences of the reference diagonal unitary matrix.

9. The step of determining number information corresponding to each of the n quantum bits according to the restriction of the connection graph includes: extracting a target tree from the connected graph, the target tree being an arbitrary spanning tree in the connected graph, each quantum bit corresponding to a node in the target tree; numbering each node in the target tree and obtaining a node number corresponding to each node; The method according to claim 3 , further comprising: determining a node number corresponding to each of the nodes as number information of a quantum bit corresponding to each of the nodes.

10. The step of numbering each node in the target tree and obtaining a node number corresponding to each node includes: generating an initialization number for each node in the target tree; if there is no child node for the node with node number n-k+2 or no child node whose number is an initialization number, searching for a target node that satisfies a search condition from nodes having a node number, and determining the node number of the leftmost child node of the target node as n-k+1, the search condition being a node with the largest number and a child node whose number is an initialization number, 3≦k≦n, the node with node number n is the root node of the target tree, and the node with node number n-1 is the leftmost node of the root node; 10. The method of claim 9, further comprising: if a child node exists for a node whose node number is n-k+2 and the number of the child node is an initialization number, determining the node number of the leftmost child node among the child nodes whose number is an initialization number as n-k+1.

11. A quantum circuit optimization device, comprising: a matrix decomposition module for converting the quantum circuit to be optimized into a unitary matrix to be processed, and performing an iterative decomposition on the unitary matrix to be processed to obtain a first number of qubit uniform control gates; a control gate decomposition module for decomposing each said qubit uniform control gate into a second number of qubit diagonal unitary matrices and a third number of single qubit gates; a circuit implementation module that determines a matching quantum circuit corresponding to each said qubit diagonal unitary matrix according to a restriction of a connectivity graph; and a connection matching module that matches a second number of the matched quantum circuits with a third number of the single qubit gates to obtain a target quantum circuit for each of the qubit uniform control gates, and connects the first number of the target quantum circuits to obtain an optimized quantum circuit.

12. A quantum computing device comprising an optimized quantum circuit realized by the quantum circuit optimization method according to any one of claims 1 to 10.

13. A memory having executable instructions stored therein; A processor that, when executing executable instructions stored in the memory, implements the method of optimizing a quantum circuit according to any one of claims 1 to 10.

14. A computer program product which, when executed by a processor, implements the method for optimizing a quantum circuit according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Quantum state preparation circuit generation method and device, quantum operation chip and equipment

    CN113592093A

  • Re-generation of a gate-level quantum circuit based on gate-level analysis

    US11281988B1