Method for optimizing quantum circuits based on the quine-mccluskey algorithm
By optimizing the truth table of quantum circuits using the Quine-McLoughlin algorithm and merging and optimizing the set of implications, the problem of high computational complexity of quantum circuits in noisy isoscale systems is solved, achieving efficient optimization and improved executability of quantum circuits.
Patent Information
- Application Number
- CN202411344261.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2044-09-25
AI Technical Summary
In noisy, isoscale quantum systems, the Quine-McLoughlin algorithm exhibits exponentially increasing computational complexity when dealing with quantum circuits with a large number of variables, making it difficult to achieve optimal quantum circuit construction and thus limiting the efficiency and practicality of quantum computing.
By transforming the truth table of a quantum circuit into a set of first-order implications, and applying the Quine-McLoughlin algorithm to process and optimize the set of first-order implications, combined with the reversibility of the quantum circuit, the quantum circuit structure is optimized to reduce the number of control bits and logic gates in the quantum gate.
Without sacrificing the functionality of quantum circuits, we can compress the depth of quantum circuits, reduce complexity, improve the efficiency of quantum circuits and the fidelity of quantum gates, and enhance the executability of quantum circuits.
Smart Images

Figure CN119250213B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of quantum circuit optimization, and more specifically, to a method for optimizing quantum circuits based on the Quine-McLoughlin algorithm. Background Technology
[0002] In the era of noisy, isoscale quantum systems, finding the optimal construction of quantum circuits is crucial for improving the efficiency and practicality of quantum computing. Among related technologies, the Quine-McLoughlin algorithm can be used to find the optimal construction of quantum circuits; it is an important tool for simplifying logical functions. However, when dealing with quantum circuits with a large number of variables, the computational complexity of the Quine-McLoughlin algorithm increases exponentially with the number of variables, making it difficult to implement. Summary of the Invention
[0003] This application provides an optimization method for quantum circuits based on the Quine-McLoughlin algorithm.
[0004] This application provides an optimization method for quantum circuits based on the Quine-McLasky algorithm, the method comprising:
[0005] The truth table of the quantum circuit is transformed into a set of first-order implications.
[0006] The essential element implication set is obtained by processing the set of first-order implication terms using the Quine-McLoughski algorithm.
[0007] The set of essential element implications is processed to obtain an optimized set of essential element implications;
[0008] The target quantum circuit is obtained based on the optimized essential element implication term set, so as to achieve the optimization of the quantum circuit.
[0009] In this way, the computer device transforms the truth table of the quantum circuit into a set of first-order implications. Then, based on the Quine-McLoughlin algorithm and the invertibility of the quantum circuit, it processes this set of first-order implications to obtain an optimized essential elemental implications set. Finally, the computer device obtains the target quantum circuit based on the optimized essential elemental implications set, thus optimizing the quantum circuit. In this way, without sacrificing the functionality of the quantum circuit, the depth of the quantum circuit is compressed, and the number of control bits in the quantum gates is reduced, thereby reducing the complexity of the quantum circuit, improving its efficiency and the fidelity of the quantum gates, and enhancing its executability.
[0010] In some embodiments, the method further includes:
[0011] The truth table is obtained based on the pre-stored correspondence between quantum gates and truth tables.
[0012] Thus, the computer device obtains the truth table based on the pre-stored correspondence between quantum gates and the truth table. With this truth table, the computer device can then use it to derive the set of first-order implications of the quantum circuit in subsequent processes.
[0013] In some implementations, the truth table obtained from the quantum circuit is transformed into a set of first-order implications, including:
[0014] The index corresponding to the item with a value of 1 in the truth table is converted into binary to obtain the set of first-order implications, wherein the number of bits in the binary number is consistent with the number of qubits input to the quantum circuit, and the set of first-order implications includes multiple first-order implications.
[0015] Thus, the computer device converts the indices corresponding to items with a value of 1 in the truth table into binary to obtain a set of first-order implication terms. The number of bits in the binary representation matches the number of qubits in the input quantum circuit. Each set of first-order implication terms includes multiple first-order implication terms. This conversion of the indices corresponding to items with a value of 1 in the truth table into binary to obtain the set of first-order implication terms is a crucial step in the Quine-McLoughlin algorithm and forms the basis for subsequent merging of implication terms.
[0016] In some implementations, processing the set of first-order implications based on the Quine-McLasky algorithm to obtain the set of essential implications includes:
[0017] The first-order implications in the set of first-order implications are merged based on the Quine-McLusky algorithm to obtain a merged set of implications;
[0018] The essential element implication set is obtained by merging the implication set.
[0019] Thus, the computer device merges the first-order implications in the first-order implications set using the Quine-McLoughlin algorithm to obtain a merged implications set. Then, the computer device uses the merged implications set to obtain the essential implications set. This process of processing the first-order implications set using the Quine-McLoughlin algorithm to obtain the essential implications set reduces the number of quantum logic gates used, thereby reducing the complexity of the quantum circuit. Furthermore, by merging implications, one control bit can be reduced from the quantum gate, improving the fidelity of the quantum gate.
[0020] In some implementations, the step of merging the first-order implications in the set of first-order implications based on the Quine-McLasky algorithm to obtain a merged set of implications includes:
[0021] The Quine-McLoughlin algorithm is used to merge the first-order implications in the set of first-order implications with a Hamming distance of 1 to obtain multiple implications, thus obtaining the merged implication set. The Hamming distance is used to indicate the number of different characters at corresponding positions between two implications, and the implications include the first-order implications.
[0022] Thus, the computer device uses the Quine-McLoughlin algorithm to merge first-order implications with a Hamming distance of 1 from the set of first-order implications, resulting in a merged set of implications. The Hamming distance indicates the number of different characters at corresponding positions between two implications, and each implication includes first-order implications. By merging these first-order implications with a Hamming distance of 1, the number of implications can be reduced, thereby reducing the number of quantum logic gates in the quantum circuit and ultimately improving its efficiency.
[0023] In some implementations, obtaining the essential element implication set based on the merged implication set includes:
[0024] Merge the implication terms in the merged implication term set whose Hamming distance is 1 until the Hamming distance of each implication term in the merged implication term set is greater than 1;
[0025] The essential element implied term set is obtained by processing the merged implied term set according to a preset algorithm.
[0026] Thus, the computer device merges implication terms with a Hamming distance of 1 in the merged implication term set until the Hamming distance of all implication terms in the merged implication term set is greater than 1. Next, the computer device processes the merged implication term set according to a preset algorithm to obtain the essential implication term set. In this way, by merging the merged implication term set, the quantum circuit can be further simplified, the number of quantum logic gates can be reduced, and thus the complexity of the quantum circuit can be reduced. Furthermore, processing the merged implication term set using a preset algorithm can reduce the complexity of the algorithm and improve resource utilization.
[0027] In some embodiments, the method further includes:
[0028] Query the essential element implication pairs in the set of essential element implications where the Hamming distance is less than or equal to a preset distance.
[0029] Thus, the computer device queries the set of essential element implication pairs where the Hamming distance is less than or equal to a preset distance. This querying of essential element implication pairs helps in obtaining reversible implication pairs in subsequent processes.
[0030] In some embodiments, processing the set of essential element implications to obtain an optimized set of essential element implications includes:
[0031] Based on the reversibility of the quantum circuit and the essential element implied terms, a reversible implied term pair is obtained;
[0032] The optimized essential element implication set is obtained based on the reversible implication pair.
[0033] Thus, the computer device obtains reversible implication pairs based on the reversibility of quantum circuits and the pairs of essential element implications. Next, the computer device obtains an optimized set of essential element implications based on these reversible implication pairs. In this way, through the reversibility of quantum circuits and the pairs of essential element implications, it is possible to obtain reversible implication pairs corresponding to the pairs of essential element implications. These reversible implication pairs can be processed along with the pairs of essential element implications, reducing the number of quantum logic gates, decreasing the depth of quantum circuits, and thereby improving the efficiency of quantum circuits.
[0034] In some implementations, obtaining the optimized essential element implication set based on the reversible implication pair includes:
[0035] Inserting the reversible implication pairs into the set of essential element implication terms yields the set of reversible essential element implication terms.
[0036] The set of reversible essential element implications is merged to obtain the optimized set of essential element implications.
[0037] Thus, the computer device inserts reversible implication pairs into the set of essential implication pairs to obtain a reversible essential implication set. Next, the computer device merges these reversible essential implication sets to obtain an optimized essential implication set. Due to the reversibility of quantum circuits, it can be observed that by inserting reversible implication pairs into the set of essential implication pairs to obtain a reversible essential implication set, the corresponding quantum circuit functionally matches the quantum circuit corresponding to the set of essential implication pairs. Furthermore, by merging the reversible essential implication sets to obtain the optimized essential implication set, it can be observed that although the number of implications in the essential implication set is the same as in the optimized essential implication set, the quantum circuit corresponding to the optimized essential implication set has fewer control bits in its quantum gates, resulting in higher quantum gate fidelity.
[0038] In some implementations, the merging process of the reversible essential element implication set to obtain an optimized essential element implication set includes:
[0039] If the optimized essential element implication term set includes implication terms with a Hamming distance of 1, the implication terms in the invertible essential element implication term set are merged to obtain the optimized essential element implication term set.
[0040] If the optimized essential element implication set does not include implication terms with a Hamming distance of 1, output the optimized essential element implication set.
[0041] Thus, when the optimized set of essential implicants includes implicants with a Hamming distance of 1, the computer device merges the implicants in the reversible set of essential implicants to obtain the optimized set of essential implicants. When the optimized set of essential implicants does not include implicants with a Hamming distance of 1, the computer device outputs the optimized set of essential implicants. This merging operation on the reversible set of essential implicants further simplifies quantum circuits, reduces the number of quantum logic gates, and thus lowers the complexity of quantum circuits. Furthermore, this process is repeated until the Hamming distance of all implicants in the merged set is greater than 1. This indicates that each implicant in the resulting optimized set of essential implicants is unique and cannot be replaced by other implicants.
[0042] Additional aspects and advantages of embodiments of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of embodiments of this application. Attached Figure Description
[0043] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, wherein:
[0044] Figure 1 This is one of the flowcharts illustrating the implementation of this application;
[0045] Figure 2 This is a second flowchart illustrating the implementation method of this application;
[0046] Figures 3(a)-3(f) This is a schematic diagram illustrating the correspondence between quantum gates and truth tables in an embodiment of this application;
[0047] Figure 4 This is the third flowchart illustrating the implementation method of this application;
[0048] Figure 5 This is the fourth flowchart illustrating the implementation method of this application;
[0049] Figure 6 This is the fifth flowchart illustrating the implementation method of this application;
[0050] Figure 7 This is one of the schematic diagrams of quantum circuit merging in the embodiments of this application;
[0051] Figure 8 This is the sixth flowchart illustrating the implementation method of this application;
[0052] Figure 9 This is one of the quantum circuit diagrams of the embodiments of this application;
[0053] Figure 10 This is the seventh flowchart illustrating the implementation method of this application;
[0054] Figure 11 This is the eighth flowchart illustrating the implementation method of this application;
[0055] Figure 12 This is the ninth flowchart illustrating the implementation method of this application;
[0056] Figure 13 This is the second schematic diagram of quantum circuit merging in the embodiments of this application;
[0057] Figure 14 This is the tenth flowchart illustrating the implementation of this application;
[0058] Figure 15 This is a second schematic diagram of a quantum circuit according to an embodiment of this application;
[0059] Figure 16 This is the eleventh flowchart illustrating the implementation method of this application. Detailed Implementation
[0060] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of this application, and should not be construed as limiting the embodiments of this application.
[0061] In the era of Noisy Intermediate-Scale Quantum (NISQ), quantum computers have demonstrated capabilities surpassing classical computers in solving certain specific problems. However, due to the short coherence time of quantum systems, limitations imposed by the interactions between qubits, and crosstalk between physical devices, the fidelity of quantum gate operations and the depth of executable circuits in quantum computers often fail to meet the requirements of general-purpose fault-tolerant computing. Therefore, to adapt quantum circuits to current hardware performance and improve the efficiency and practicality of quantum computing, thereby meeting the needs of general-purpose fault-tolerant computing, optimal quantum circuits can be constructed by optimizing the number of qubits, the number of quantum gates, and the depth of the quantum circuits.
[0062] In related technologies, the Quine-McCluskey algorithm can be used to find the optimal construction of quantum circuits, thereby improving the efficiency and practicality of quantum computing. The Quine-McCluskey algorithm is an important tool for simplifying logic functions. However, when dealing with quantum circuits with a large number of variables, due to the inherent complexity of the Quine-McCluskey algorithm, its computational complexity increases exponentially with the number of input variables. This makes it inefficient and difficult to implement when handling quantum circuits with a large number of variables.
[0063] Noisy Intermediate-Scale Quantum (NISQ) refers to quantum computers at the current stage of quantum computing hardware development that have a moderate number of qubits, but due to noise in the qubit operation process, these quantum computers can only reliably execute relatively small-scale quantum circuits.
[0064] The coherence time of a quantum system refers to the length of time a quantum system can maintain its quantum coherence. Coherence refers to the specific relationship between different states in a quantum system, enabling the system to exhibit behavior different from that of classical systems, such as quantum superposition and quantum entanglement.
[0065] Based on the above issues, please refer to Figure 1 This application provides an optimization method for quantum circuits based on the Quine-McLoughlin algorithm, the method comprising:
[0066] 011: Based on the truth table of the quantum circuit, it is transformed into a set of first-order implications;
[0067] 012: The set of essential elemental implications is obtained by processing the set of first-order implications using the Quine-McLoughlin algorithm;
[0068] 013: Process the set of essential element implications to obtain an optimized set of essential element implications;
[0069] 014: Obtain the target quantum circuit by optimizing the set of essential element implications, so as to achieve the optimization of the quantum circuit.
[0070] This application also provides a computer device, including a memory and a processor. The quantum circuit optimization method of this application can be implemented by the computer device of this application. Specifically, the memory stores a computer program, and the processor is used to convert the truth table of the quantum circuit into a set of first-order implications. The processor then processes the set of first-order implications based on the Quine-McLoughlin algorithm to obtain a set of essential element implications. The processor is further used to process the set of essential element implications to obtain an optimized set of essential element implications. Finally, the processor obtains the target quantum circuit based on the optimized set of essential element implications, thereby achieving the optimization of the quantum circuit.
[0071] This application also provides a quantum circuit optimization device. The quantum circuit optimization method of this application can be implemented by the quantum circuit optimization device of this application. Specifically, the quantum circuit optimization device includes a conversion module and a processing module. The conversion module is used to convert the truth table of the quantum circuit into a set of first-order implications. The processing module is used to process the set of first-order implications based on the Quine-McLoughlin algorithm to obtain a set of essential element implications. The deferral module is used to defer the single-qubit quantum gates in the second quantum circuit according to the barrier gate to obtain a first optimized quantum circuit, thereby optimizing the quantum circuit. The processing module is also used to process the set of essential element implications to obtain an optimized set of essential element implications. The processing module is also used to obtain a target quantum circuit based on the optimized set of essential element implications, thereby optimizing the quantum circuit.
[0072] Specifically, a quantum circuit consists of a series of quantum gates, which describe how the quantum gates operate on the state of the qubits. It is the foundation for realizing quantum algorithms and quantum information processing.
[0073] Quantum gates, also known as quantum logic gates, are the basic operational units in quantum computing. They perform specific mathematical operations on qubits to achieve complex computational tasks and to build quantum algorithms and quantum protocols.
[0074] A qubit is the basic unit of a quantum circuit, similar to a bit in classical computing, but it can exist in a superposition state.
[0075] Quantum circuit optimization refers to adjusting and improving the structure, connection method, and operation sequence of quantum circuits. Its significance lies in reducing the depth of quantum circuits and optimizing the ordering of quantum gates, thereby improving the computing speed and accuracy of quantum computers.
[0076] The depth of a quantum circuit refers to the number of quantum gates in the quantum circuit.
[0077] A truth table is a logical tool used to describe the output value of a logical function or logical expression under all possible combinations of inputs.
[0078] The Quine-McCluskey algorithm is a classic logic circuit simplification algorithm that reduces the number of logic gates used through a series of logic simplification steps, thereby optimizing circuit design.
[0079] A first-order implicant refers to an implicant in Boolean algebra and digital circuit design that cannot be further decomposed or simplified. In other words, a first-order implicant is the most basic unit in the simplification of logic functions.
[0080] Essential prime implicants refer to prime implicants that cannot be eliminated through further merging operations during the simplification of logical functions.
[0081] A quantum gate's control bit is a qubit used to control the operation of a quantum gate.
[0082] Quantum gate fidelity is a metric that measures the accuracy with which a quantum gate performs a specific operation. Fidelity describes how close the actual operation result of a quantum gate is to the ideal operation result.
[0083] A quantum oracle is generally considered a special type of quantum gate capable of implementing specific quantum functions. It accepts a quantum state as input and transforms the input quantum state according to certain classical functions to obtain the corresponding output. A quantum oracle is a black box operation; the specific implementation and details of the input quantum state within the quantum oracle are invisible.
[0084] The computer device transforms the truth table of the quantum circuit into a set of first-order implications. Then, based on the Quine-McLoughlin algorithm and the invertibility of the quantum circuit, it processes this set of first-order implications to obtain an optimized essential elemental implications set. Finally, the computer device uses this optimized essential elemental implications set to obtain the target quantum circuit, thus optimizing the quantum circuit. In this way, without sacrificing the functionality of the quantum circuit, the depth of the quantum circuit is compressed, and the number of control bits in the quantum gates is reduced, thereby reducing the complexity of the quantum circuit, improving its efficiency and the fidelity of the quantum gates, and enhancing its executability.
[0085] It should be noted that the quantum circuit optimization method based on the Quine-McLoughlin algorithm provided in this application optimizes the quantum circuit on a classical computer, and then executes the optimized quantum circuit using a quantum computer. Furthermore, this method is specifically designed for quantum oracles, quantum circuits used to describe problems or perform specific tasks.
[0086] The following example illustrates the optimization method of the quantum circuit according to the embodiments of this application. In the embodiments described in this application, the truth table of the quantum circuit is [1,1,1,0,0,1,1,1,1,1,1,0,0,0,1,0], which is the truth table with 4 qubits as input, and the 4 qubits as input are Q1, Q2, Q3 and Q4 respectively.
[0087] The computer device first transforms the truth table [1,1,1,0,0,1,1,1,1,1,1,0,0,0,1,0] of quantum circuit C into a set of first-order implications A. Next, the computer device processes the first-order implications set A using the Quine-McLoughlin algorithm to obtain the essential element implications set D. Then, the computer device processes the essential element implications set D to obtain the optimized essential element implications set F. Finally, the computer device uses the optimized essential element implications set F to obtain the target quantum circuit, thus optimizing quantum circuit C.
[0088] In summary, in the quantum circuit optimization method and computer device of this application, the computer device transforms the truth table of the quantum circuit into a set of first-order implications, and then processes the set of first-order implications based on the Quine-McLoughlin algorithm and the reversibility of the quantum circuit to obtain an optimized essential element implications set. Finally, the computer device obtains the target quantum circuit based on the optimized essential element implications set, thereby optimizing the quantum circuit. In this way, without sacrificing the functionality of the quantum circuit, the depth of the quantum circuit is compressed, and the number of control bits of the quantum gates in the quantum circuit is reduced, thereby reducing the complexity of the quantum circuit, improving the efficiency of the quantum circuit and the fidelity of the quantum gates in the quantum circuit, and enhancing the executability of the quantum circuit.
[0089] Please see Figure 2 In some implementations, the method further includes:
[0090] 015: Obtain the truth table based on the pre-stored correspondence between quantum gates and truth tables.
[0091] In some implementations, the processing module is used to obtain the truth table based on a pre-stored correspondence between quantum gates and truth tables.
[0092] In some implementations, the processor is also configured to obtain the truth table based on a pre-stored correspondence between quantum gates and truth tables.
[0093] Specifically, please refer to Figures 3(a)-3(f) , Figures 3(a)-3(f) The correspondence between the pre-stored quantum gates and the truth table is shown.
[0094] Quantum gates solve specific problems by simulating classical logic functions and utilizing the properties of qubits such as superposition and entanglement, as well as the circuit reversibility of quantum computing. Thus, truth tables can be used to represent quantum gates. The computer device obtains the truth table based on the pre-stored correspondence between quantum gates and the truth table. In this way, the computer device obtains the truth table, and in subsequent processes, it can use this truth table and the quantum circuit to obtain the set of first-order implications of the quantum circuit.
[0095] Following the example above, please refer again. Figures 3(a)-3(f) The computer device obtains the truth table of quantum circuit C [1,1,1,0,0,1,1,1,1,1,1,0,0,0,1,0] based on the pre-stored correspondence between quantum gates and truth tables.
[0096] Thus, the computer device obtains the truth table [1,1,1,0,0,1,1,1,1,1,1,0,0,0,1,0] of the quantum circuit C, and in subsequent processes, it can obtain the set of first-order implications A of the quantum circuit based on this truth table [1,1,1,0,0,1,1,1,1,1,1,0,0,0,1,0].
[0097] Please see Figure 4 In some implementations, step 011 (converting the truth table obtained from the quantum circuit into a set of first-order implications) includes:
[0098] 0111: Convert the index of the item with a value of 1 in the truth table to binary to obtain a set of implied items.
[0099] In some implementations, the conversion module is used to convert the index corresponding to the item with a value of 1 in the truth table into binary to obtain a set of implied items.
[0100] In some implementations, the processor is also used to convert the index corresponding to the item with a value of 1 in the truth table into binary to obtain a set of implied items.
[0101] Specifically, the number of bits in the binary representation is the same as the number of qubits in the input quantum circuit. The set of first-order implications includes multiple first-order implications.
[0102] The computer device converts the index of the item with a value of 1 in the truth table into binary to obtain a set of implied items.
[0103] Continuing the example above, the computer device converts the indices corresponding to the items with a value of 1 in the truth table [1,1,1,0,0,1,1,1,1,1,0,0,0,1,0] into binary to obtain a set of first-order implications A. Since the number of qubits in the input quantum circuit C is 4 bits, the set of first-order implications A obtained by converting the indices corresponding to the items with a value of 1 into binary is [0000,0001,0010,0101,0110,0111,1000,1001,1010,1110].
[0104] Thus, the process of converting the index corresponding to the item with a value of 1 in the truth table into binary to obtain the first set of implied items is an important step in the Quine-McClusky algorithm, and it is the basis for realizing the subsequent merging of implied items to obtain the essential implied item set.
[0105] Please see Figure 5 In some implementations, step 012 (processing the set of primary implication terms based on the Quine-McLasky algorithm to obtain the set of essential implication terms) includes:
[0106] 0121: The Quine-McLoughlin algorithm is used to merge the first-order implication terms in the first-order implication term set to obtain the merged implication term set;
[0107] 0122: Obtain the set of essential element implied terms by merging the set of implied terms.
[0108] In some implementations, the merging module is used to merge the first-order implications in the first-order implication set based on the Quine-McLoughlin algorithm to obtain a merged implication set. The processing module is used to obtain the essential implication set based on the merged implication set.
[0109] In some implementations, the processor is further configured to merge the first-order implications in the first-order implication set based on the Quine-McLasky algorithm to obtain a merged implication set, and to obtain an essential implication set based on the merged implication set.
[0110] Specifically, the computer device merges the first-order implications in the set of first-order implications based on the Quine-McLoughlin algorithm to obtain a merged set of implications. Then, the computer device processes the merged set of implications to obtain the essential implication set.
[0111] Continuing with the examples above, please refer to Table 1:
[0112] Table 1
[0113]
[0114] The computer device first groups the set of linear implication terms A according to the number of "1"s in each linear implication term, as shown in Table 1. The computer device then merges the linear implication terms in set A to obtain a merged implication term set B. Next, the computer device processes the merged implication term set B to obtain the essential implication term set D.
[0115] Thus, the process by which a computer device processes the set of primary implications A according to the Quine-McLoughlin algorithm to obtain the set of essential implications D reduces the number of quantum logic gates used, thereby lowering the complexity of quantum circuits. Furthermore, by merging implications, the control bit of the quantum gate can be reduced by one, improving the gate's fidelity.
[0116] Please see Figure 6 In some implementations, step 0121 (merging the first-order implication terms in the first-order implication term set based on the Quine-McLasky algorithm to obtain a merged implication term set) includes:
[0117] 01211: Based on the Quine-McLawsky algorithm, the first-order implication terms with a Hamming distance of 1 in the set of first-order implication terms are merged to obtain multiple implication terms, so as to obtain a merged implication term set.
[0118] In some implementations, the merging module is used to merge the first-order implications with a Hamming distance of 1 in the set of first-order implications based on the Quine-McLoughlin algorithm to obtain multiple implications, thereby obtaining a merged set of implications.
[0119] In some implementations, the processor is also configured to merge the first-order implications with a Hamming distance of 1 in the set of first-order implications based on the Quine-McLoughlin algorithm to obtain multiple implications, thereby obtaining a merged set of implications.
[0120] Specifically, the Hamming distance is used to indicate the number of different characters at corresponding positions between two implication terms. Implication terms include first-order implication terms. A Hamming distance of 1 in quantum circuits means that if a control bit of two multi-control NOT gates can be either 0 or 1, it indicates that the bit has no significant meaning for the control NOT gate and its state can be ignored.
[0121] Please refer to Tables 1 and 2. After obtaining the set A of first-order implication terms, it is necessary to determine whether any two first-order implication terms in the set can be merged. For any two first-order implication terms, calculate the Hamming distance between them. If the Hamming distance between the two first-order implication terms is 1, then the two first-order implication terms are considered to be merged. For example, 0000 in A0 and 0001 in A1 have the same numbers in three positions, only the last number is different, so 0000 in A0 and 0001 in A1 are considered to be merged. In this embodiment, the first-order implication term set is grouped to reduce unnecessary comparisons. Please refer to Table 1 again. It can be seen that if the first-order implication term groups are not adjacent, then the Hamming distance cannot be 1, and therefore they cannot be merged. For example, the minimum Hamming distance between A0 and A2 is 2. First-order implication terms in the same first-order implication term group do not need to be compared, and the Hamming distance cannot be 1. Therefore, we only need to compare adjacent first-order implication term groups. Please refer to Table 2:
[0122] Table 2
[0123]
[0124] The computer device merges the first-order implications with a Hamming distance of 1 from the set of first-order implications to obtain multiple implications, such as 000-, to obtain the merged implication set B. Where a number at a position can be either 1 or 0, it is represented by "-". See also... Figure 7 The implication term 000-, obtained by merging the first implication terms 0000 and 0001, signifies that the effective bits become 3, with the last bit being an invalid bit. The corresponding quantum circuit representation is that two C4(X) can be merged into one C3(X), as shown below. Figure 7 As shown.
[0125] If a term cannot be combined with any other term, it is called a prime term.
[0126] Thus, by merging the first-order implications with a Hamming distance of 1 in the set of first-order implications A, the number of implications can be reduced, thereby reducing the number of quantum logic gates in quantum circuit C and ultimately improving the efficiency of quantum circuit C.
[0127] Please see Figure 8 In some implementations, step 0122 (obtaining the essential element implication set based on the merged implication set) includes:
[0128] 01221: Merge all implication terms in the merged implication term set that have a Hamming distance of 1 until the Hamming distance of all implication terms in the merged implication term set is greater than 1;
[0129] 01222: The set of essential element implicants is obtained by processing the merged implicant set according to the preset algorithm.
[0130] In some implementations, the merging module is used to merge implication terms in the merged implication term set whose Hamming distance is 1 until the Hamming distance of each implication term in the merged implication term set is greater than 1. The processing module is also used to process the merged implication term set according to a preset algorithm to obtain the essential implication term set.
[0131] In some implementations, the processor is further configured to merge implication terms in the merged implication term set whose Hamming distance is 1 until the Hamming distance of each implication term in the merged implication term set is greater than 1. And to process the merged implication term set according to a preset algorithm to obtain the essential implication term set.
[0132] Specifically, the preset algorithm is a greedy algorithm. The computer device merges implication terms with a Hamming distance of 1 in the merged implication term set until the Hamming distance of each implication term in the merged implication term set is greater than 1. Then, the computer device processes the merged implication term set according to the preset algorithm to obtain the essential implication term set.
[0133] Continuing with the example above, please refer to Tables 2 and 3. Merging the first set of implication terms yields the merged set of implication terms, as shown in Table 2. It can be observed that the merged set still includes implication terms with a Hamming distance of 1, indicating that merging is possible. The computer device merges implication terms with a Hamming distance of 1 in adjacent groups of implication terms, resulting in a new merged set of implication terms, as shown in Table 3.
[0134] Table 3
[0135]
[0136]
[0137] It can be observed that at this point, the Hamming distance between 0-01 (obtained by merging the primary implication terms with indices 1 and 5) and any other implication term within the merged implication term set is greater than 1, therefore 0-01 is a quality implication term.
[0138] Furthermore, it can be observed that the merged implications include multiple duplicate implications, such as -00- and -0-0. These duplicate implications are processed, retaining only one of each type. It is then determined whether there are any implications in the merged implication set whose Hamming distance is 1. If there are any two implications with a Hamming distance of 1, the merged implication set is further processed. If there are no implications with a Hamming distance of 1, then all implications in the merged implication set are prime implications.
[0139] The final prime implications are 0-01, 01-1, 011-, -00-, -0-0, and --10. However, the number of prime implications obtained at this point is not the minimum, and the number of prime implications can be further reduced. To obtain the set of essential prime implications with the minimum number of prime implications, methods commonly used in computer science, such as recursive algorithms, search algorithms, and backtracking algorithms, are typically used. However, since there is a subsequent optimization process for the set of essential prime implications in this embodiment, a greedy algorithm is used to find the essential prime implications. The process of finding essential prime implications using a greedy algorithm is roughly as follows: First, a directed graph is constructed based on all the prime implications obtained after merging. Each prime implication is a node. If two prime implications contain a common first-order implication, an edge is connected between them. Each time, the node with the fewest connected edges is greedily found from the directed graph, thus obtaining a set of essential prime implications. Then, the remaining prime implications are processed through the above steps again until the essential prime implications containing all first-order implications are obtained. Please see Figure 9 The set of essential element implications obtained by quantum circuit C is [01-1, -00-, --10].
[0140] Thus, by merging the set of implied terms, quantum circuits can be further simplified, the number of quantum logic gates reduced, and the complexity of quantum circuits lowered. Furthermore, processing the merged set of implied terms using a pre-defined algorithm can reduce algorithm complexity and improve resource utilization.
[0141] Please see Figure 10 In some implementations, the method further includes:
[0142] 016: Query the essential element implication pairs in the set whose Hamming distance is less than or equal to a preset distance.
[0143] In some implementations, the query module is also used to query pairs of essential element implications in the set whose Hamming distance is less than or equal to a preset distance.
[0144] In some implementations, the processor is also used to query pairs of essential element implications in the set whose Hamming distance is less than or equal to a preset distance.
[0145] Specifically, the preset distance is set according to actual needs.
[0146] The computer device queries the set of essential element implication pairs where the Hamming distance is less than or equal to a preset distance.
[0147] Continuing with the above example, in this embodiment, the preset distance is set to 2. In other embodiments, the preset distance can be other values, determined according to actual needs. It can be found that in the set of essential element implications [01-1, -00-, --10] obtained by quantum circuit C, there are no pairs of essential element implications with a Hamming distance less than or equal to 2.
[0148] In one example, if the set of essential element implications obtained by quantum circuit C1 is -01- and -10-, then the essential element implications pair of quantum circuit C1 is -01- and -10-.
[0149] Thus, by querying the set of essential element implication pairs in quantum circuit C1, we can obtain reversible implication pairs in subsequent processes.
[0150] Please see Figure 11 In some implementations, step 013 (processing the set of essential element implications to obtain an optimized set of essential element implications) includes:
[0151] 0131: Based on the reversibility of quantum circuits and the pair of essential elemental implication terms, we obtain reversible implication term pairs;
[0152] 0132: Obtain the optimized essential element implication set based on the reversible implication pairs.
[0153] In some implementations, the processing module is further configured to obtain reversible implication pairs based on the reversibility of the quantum circuit and the pairs of essential element implications. The acquisition module is configured to obtain an optimized set of essential element implications based on the reversible implication pairs.
[0154] In some implementations, the processor is also used to obtain reversible implication pairs based on the reversibility of the quantum circuit and the pairs of essential implication terms, and to obtain an optimized set of essential implication terms based on the reversible implication pairs.
[0155] Specifically, the reversibility of a quantum circuit means that if an additional circuit U is inserted at any point in the quantum circuit, and the inverse of U is also inserted, the new quantum circuit is equivalent to the original circuit.
[0156] A reversible implication pair is a binary number that has the same position as an essential implication pair, but the binary number is 1. For example, the reversible implication pairs of essential implication pairs -01- and -10- are -11- and -11-.
[0157] The computer device obtains reversible implication pairs based on the reversibility of quantum circuits and the pairs of essential element implications. Then, the computer device obtains an optimized set of essential element implications based on the reversible implication pairs.
[0158] Continuing the example above, the set of essential element implications obtained from quantum circuit C1 is -01- and -10-, so the essential element implications pair of quantum circuit C1 is -01- and -10-. Based on the reversibility of the quantum circuit, the computer device obtains the reversible implications pair [-11-, -11-] from the obtained essential element implications pair [-01-, -10-]. Then, the computer device obtains the optimized set of essential element implications [-01-, -11-, -11-, -10-] from the reversible implications pair.
[0159] Thus, by utilizing the reversibility of quantum circuits and the pair of essential element implicants, we can obtain a pair of reversible implicants corresponding to the pair of essential element implicants. This pair of reversible implicants can be processed with the pair of essential element implicants, which can reduce the number of quantum logic gates, decrease the depth of quantum circuits, and thus improve the efficiency of quantum circuits.
[0160] Please see Figure 12 In some implementations, step 0132 (obtaining the optimized essential element implication set based on reversible implication pairs) includes:
[0161] 01321: Inserting pairs of reversible implication terms into the set of essential element implication terms yields the set of reversible essential element implication terms;
[0162] 01322: Merging the set of reversible essential element implications yields the optimized set of essential element implications.
[0163] In some implementations, the insertion module is further configured to insert the reversible implication terms into the set of essential implication terms to obtain a set of reversible essential implication terms. The merging module is further configured to merge the set of reversible essential implication terms to obtain an optimized set of essential implication terms.
[0164] In some implementations, the processor is further configured to insert reversible implication pairs into the set of essential implication pairs to obtain a set of reversible essential implication pairs, and to merge the set of reversible essential implication pairs to obtain an optimized set of essential implication pairs.
[0165] Specifically, the computer device inserts reversible implication pairs into the set of essential implication terms to obtain a set of reversible essential implication terms. Then, the computer device merges the set of reversible essential implication terms to obtain an optimized set of essential implication terms.
[0166] Continuing with the previous example, unlike classical circuits, quantum circuits are reversible. Inserting an additional line U, and its inverse, at any point in the quantum circuit results in a new quantum circuit that is equivalent to the original circuit. Please refer to [link to previous example]. Figure 13 , Figure 9This indicates that the quantum circuit C1 is merged after adding reversible implication pairs. The computer device inserts the reversible implication pair [-11-, -11-] into the essential implication set [-01-, -10-]. It can be found that -01-, -11- and -11-, -10- can be merged again to obtain --1-, -1--. The corresponding quantum circuit changes from two C2(X) to two C1(X).
[0167] Thus, due to the reversibility of quantum circuits, it can be found that by inserting reversible implication pairs into the set of essential element implications, a set of reversible essential element implications is obtained. The corresponding quantum circuits are functionally identical to those corresponding to the set of essential element implications. Furthermore, by merging the reversible essential element implication sets using computer equipment to obtain optimized essential element implication sets, it can be observed that although the number of implications in the set of essential element implications is the same as that in the optimized set of essential element implications, the quantum circuits corresponding to the optimized set of essential element implications have fewer control bits in their quantum gates, resulting in higher quantum gate fidelity.
[0168] Please see Figure 14 In some implementations, step 01322 (merging the set of reversible essential element implications to obtain an optimized set of essential element implications) includes:
[0169] 013221: When the set of optimized essential element implications includes implications with a Hamming distance of 1, the implications in the set of invertible essential element implications are merged to obtain the set of optimized essential element implications.
[0170] 013222: Output the optimized set of essential element implications, excluding implications with a Hamming distance of 1.
[0171] In some implementations, the merging module is used to merge the implications in the invertible essential element implications set to obtain an optimized essential element implications set if the optimized essential element implications set includes implications with a Hamming distance of 1. The output module is used to output the optimized essential element implications set if the optimized essential element implications set does not include implications with a Hamming distance of 1.
[0172] In some implementations, the processor is further configured to, when the optimized set of essential element implications includes implications with a Hamming distance of 1, merge the implications in the invertible set of essential element implications to obtain an optimized set of essential element implications; and when the optimized set of essential element implications does not include implications with a Hamming distance of 1, output the optimized set of essential element implications.
[0173] Specifically, when the optimized set of essential implicants includes implicants with a Hamming distance of 1, the computer device merges the implicants in the reversible set of essential implicants to obtain the optimized set of essential implicants. When the optimized set of essential implicants does not include implicants with a Hamming distance of 1, the computer device outputs the optimized set of essential implicants.
[0174] Continuing the example above, if the optimized set of essential implicants includes implicants with a Hamming distance of 1, the computer device merges the implicants in the reversible set of essential implicants to obtain the optimized set of essential implicants. If the optimized set of essential implicants does not include implicants with a Hamming distance of 1, the computer device outputs the optimized set of essential implicants. Please refer to [link to previous example]. Figure 9 The final quantum circuit obtained from quantum circuit C is as follows: Figure 9 As shown. Please refer to [the original text]. Figure 15 The quantum circuit obtained by optimizing the quantum circuit using Qiskit is shown in the figure, containing one C3(X), three C2(X), and one C1(X). It can be observed that the final quantum circuit obtained by the embodiment of this application is superior.
[0175] Thus, by merging the set of reversible essential implicants, quantum circuits can be further simplified, the number of quantum logic gates reduced, and the complexity of the quantum circuits lowered. Furthermore, this process is repeated until the Hamming distance between all implicants in the merged set is greater than 1. This indicates that each implicant in the resulting optimized set of essential implicants is unique and cannot be replaced by other implicants. Please refer to [link to relevant documentation]. Figure 16 A simplified flowchart of the implementation method of this application is shown in the figure.
[0176] This application also provides a computer-readable storage medium containing a computer program. When the computer program is executed by one or more processors, it causes the one or more processors to perform the optimization method for the quantum circuit of this application.
[0177] It is understood that a computer program includes computer program code. Computer program code can be in the form of source code, object code, executable files, or some intermediate form. Computer-readable storage media can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, external hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), and software distribution media, etc.
[0178] In this specification, the terms "specifically," "furthermore," "particularly," "understandably," etc., refer to specific features, structures, materials, or characteristics described in connection with embodiments or examples that are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0179] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the function involved, as will be understood by those skilled in the art to which embodiments of this application pertain.
[0180] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.
Claims
1. An optimization method for quantum circuits based on the Quine-McLoughlin algorithm, characterized in that, The method includes: The truth table is obtained based on the pre-stored correspondence between quantum gates and the truth table and the quantum circuit. The index corresponding to the item with a value of 1 in the truth table is converted into binary to obtain a set of first-order implications, wherein the number of bits in the binary number is consistent with the number of qubits input to the quantum circuit, and the set of first-order implications includes multiple first-order implications. The first-order implications in the set of first-order implications are merged based on the Quine-McLusky algorithm to obtain a merged set of implications; The essential element implication set is obtained by merging the implication set; The set of essential element implications is processed to obtain an optimized set of essential element implications; The target quantum circuit is obtained based on the optimized essential element implication term set, so as to achieve the optimization of the quantum circuit.
2. The method according to claim 1, characterized in that, The process of merging the first-order implications in the set of first-order implications based on the Quine-McLasky algorithm to obtain a merged set of implications includes: The Quine-McLoughlin algorithm is used to merge the first-order implications in the set of first-order implications with a Hamming distance of 1 to obtain multiple implications, thus obtaining the merged implication set. The Hamming distance is used to indicate the number of different characters at corresponding positions between two implications, and the implications include the first-order implications.
3. The method according to claim 1, characterized in that, The process of obtaining the essential element implication set based on the merged implication set includes: Merge the implication terms in the merged implication term set whose Hamming distance is 1 until the Hamming distance of each implication term in the merged implication term set is greater than 1; The essential element implied term set is obtained by processing the merged implied term set according to a preset algorithm.
4. The method according to claim 1, characterized in that, The method further includes: Query the essential element implication pairs in the set of essential element implications where the Hamming distance is less than or equal to a preset distance.
5. The method according to claim 4, characterized in that, The process of processing the set of essential element implications to obtain an optimized set of essential element implications includes: Based on the reversibility of the quantum circuit and the essential element implied terms, a reversible implied term pair is obtained; The optimized essential element implication set is obtained based on the reversible implication pair.
6. The method according to claim 5, characterized in that, The step of obtaining the optimized essential element implication term set based on the reversible implication term pair includes: Inserting the reversible implication pairs into the set of essential element implication terms yields the set of reversible essential element implication terms. The set of reversible essential element implications is merged to obtain the optimized set of essential element implications.
7. The method according to claim 6, characterized in that, The process of merging the set of reversible essential element implications to obtain the optimized set of essential element implications includes: If the optimized essential element implication term set includes implication terms with a Hamming distance of 1, the implication terms in the invertible essential element implication term set are merged to obtain the optimized essential element implication term set. If the optimized essential element implication set does not include implication terms with a Hamming distance of 1, output the optimized essential element implication set.
Citation Information
Patent Citations
Computer-aided design tool for logic synthesis of a mix of CMOS gates and majority and minority logic circuits
US11748537B1
Systems and methods for implementing remote-state preparation on a noisy-intermediate size quantum device
US20230368060A1