Quantum circuit optimization method based on quinine-Maxlaski algorithm
By converting the truth table of the quantum circuit into an implicit item set and applying the Quinn-McLasky algorithm to process it, the problem of high computational complexity when processing a large number of variables is solved. , achieving depth compression and efficiency improvement of quantum circuits.
Patent Information
- Application Number
- CN202411344261.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-09-25
AI Technical Summary
In a noisy medium-scale quantum system, the Quinn-McLasky algorithm has an exponential increase in computational complexity when processing quantum lines with a large number of variables, making it difficult to achieve the optimal structure of quantum lines, resulting in limited quantum computing efficiency and practicality .
By converting the truth table of the quantum circuit into an implicit item set, the Quinn-McLasky algorithm is used to process it, and the intrinsic implicit item set is obtained, and the number of quantum logic gates is reduced through the merge and optimization process, reducing the quantum circuit's Complexity, improve the fidelity of quantum gates.
Without sacrificing the function of quantum circuits, the depth of quantum circuits is compressed, the control bit of quantum gates is reduced, the efficiency and fidelity of quantum circuits are improved, and the executability is improved.
Smart Images

Figure CN119250213A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of quantum circuit optimization, and more specifically, to a quantum circuit optimization method based on the Quine-McCluskey algorithm. Background Art
[0002] In the era of noisy medium-scale quantum systems, in order to improve the efficiency and practicality of quantum computing, it is necessary to find the optimal structure of quantum circuits. In related technologies, the Quine-McCluskey algorithm can be used to find the optimal structure of quantum circuits. The Quine-McCluskey algorithm 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-McCluskey algorithm increases exponentially with the increase in the number of variables, and the Quine-McCluskey algorithm will be difficult to implement. Summary of the invention
[0003] The present application provides a quantum circuit optimization method based on the Quine-McCluskey algorithm.
[0004] The embodiment of the present application provides a method for optimizing a quantum circuit based on the Quine-McCluskey algorithm, the method comprising:
[0005] Converting into a primary implied term set according to the truth table of the quantum circuit;
[0006] Processing the primary implied term set based on the Quine-McCluskey algorithm to obtain an essential prime implied term set;
[0007] Processing the essential element implication item set to obtain an optimized essential element implication item set;
[0008] A target quantum circuit is obtained according to the optimized essential prime implied term set to optimize the quantum circuit.
[0009] In this way, the computer device converts the truth table of the quantum circuit into a set of primary implications, and then processes the set of primary implications based on the Quine-McCluskey algorithm and the reversibility of the quantum circuit to obtain an optimized set of essential prime implications. Finally, the computer device obtains the target quantum circuit based on the optimized set of essential prime implications to optimize the quantum circuit. In this way, through this method, without sacrificing the function of the quantum circuit, the depth of the quantum circuit is compressed, and the control bits of the quantum gates in the quantum circuit are 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 improving the executability of the quantum circuit.
[0010] In certain embodiments, the method further comprises:
[0011] The truth table is obtained according to a pre-stored quantum gate-truth table correspondence.
[0012] In this way, the computer device obtains the truth table according to the pre-stored correspondence between quantum gates and truth tables. In this way, the computer device obtains the truth table, and in the subsequent process, the primary implied term set of the quantum circuit can be obtained according to the truth table.
[0013] In some embodiments, the truth table obtained according to the quantum circuit is converted into a set of primary implications, including:
[0014] The subscripts corresponding to the items with a value of 1 in the truth table are converted into binary to obtain the set of primary implications, wherein the number of bits of the binary is consistent with the number of quantum bits input into the quantum circuit, and the set of primary implications includes multiple primary implications.
[0015] In this way, the computer device converts the subscripts corresponding to the items with a value of 1 in the truth table into binary to obtain a set of primary implications, where the number of bits in the binary is consistent with the number of quantum bits of the input quantum circuit, and the set of primary implications includes multiple primary implications. In this way, the computer device converts the subscripts corresponding to the items with a value of 1 in the truth table into binary to obtain a set of primary implications, which is an important step of the Quine-McCluskey algorithm and the basis for realizing the subsequent merging of implications.
[0016] In some embodiments, the processing of the primary implicant set based on the Quine-McCluskey algorithm to obtain the essential prime implicant set includes:
[0017] Based on the Quine-McCluskey algorithm, the primary implied terms in the primary implied term set are merged to obtain a merged implied term set;
[0018] The essential element implication item set is obtained according to the combined implication item set.
[0019] In this way, the computer device merges the primary implied items in the primary implied item set based on the Quine-McCluskey algorithm to obtain a merged implied item set. Then, the computer device obtains an essential prime implied item set based on the merged implied item set. In this way, the process in which the computer device processes the primary implied item set based on the Quine-McCluskey algorithm and then obtains the essential prime implied item set can reduce the use of quantum logic gates, thereby reducing the complexity of quantum circuits. In addition, by merging implied items, the control bit of the quantum gate can be reduced by one bit, thereby improving the fidelity of the quantum gate.
[0020] In some implementations, the step of merging the primary implicants in the primary implicant set based on the Quine-McCluskey algorithm to obtain a merged implicant set includes:
[0021] Based on the Quine-McCluskey algorithm, the primary implicants with a Hamming distance of 1 in the primary implicant set are merged to obtain multiple implicants, so as to obtain the merged implicant set, wherein the Hamming distance is used to indicate the number of different characters at corresponding positions between two implicants, and the implicants include the primary implicants.
[0022] In this way, the computer device merges the primary implied items with a Hamming distance of 1 in the primary implied item set based on the Quine-McCluskey algorithm to obtain multiple implied items, so as to obtain a merged implied item set, wherein the Hamming distance is used to indicate the number of different characters at corresponding positions between two implied items, and the implied items include the primary implied items. In this way, by merging the primary implied items with a Hamming distance of 1 in the primary implied item set, the number of implied items can be reduced, thereby reducing the number of quantum logic gates in the quantum circuit, and ultimately improving the efficiency of the quantum circuit.
[0023] In some implementations, obtaining the set of essential element implications according to the combined set of implications includes:
[0024] Merging the implied items whose Hamming distance is 1 in the merged implied item set until the Hamming distance of each implied item in the merged implied item set is greater than 1;
[0025] The combined implication item set is processed according to a preset algorithm to obtain the essential element implication item set.
[0026] In this way, the computer device merges the implied items with a Hamming distance of 1 in the merged implied item set until the Hamming distance of each implied item in the merged implied item set is greater than 1. Then, the computer device processes the merged implied item set according to a preset algorithm to obtain an essential prime implied item set. In this way, by merging the merged implied item set, the quantum circuit can be further simplified, the number of quantum logic gates can be reduced, and the complexity of the quantum circuit can be reduced. In addition, by processing the merged implied item set with a preset algorithm, the complexity of the algorithm can be reduced and the utilization rate of resources can be improved.
[0027] In certain embodiments, the method further comprises:
[0028] The essential prime implication item set is searched for essential prime implication item pairs whose Hamming distance is less than or equal to a preset distance.
[0029] In this way, the computer device searches for essential element implication item pairs in the essential element implication item set whose Hamming distance is less than or equal to the preset distance. In this way, by searching for essential element implication item pairs in the essential element implication item set, it can provide help for obtaining reversible implication item pairs in subsequent processes.
[0030] In some embodiments, the processing of the essential element implication item set to obtain an optimized essential element implication item set includes:
[0031] Obtaining a reversible implicant pair based on the reversibility of the quantum circuit and the essential prime implicant pair;
[0032] The optimized essential prime implication set is obtained according to the reversible implication pair.
[0033] In this way, the computer device obtains a reversible implication pair based on the reversibility of the quantum circuit and the essential prime implication pair. Then, the computer device obtains an optimized essential prime implication set based on the reversible implication pair. In this way, through the reversibility of the quantum circuit and the essential prime implication pair, a reversible implication pair corresponding to the essential prime implication pair can be obtained. The reversible implication pair can be processed with the essential prime implication pair, which can reduce the number of quantum logic gates and the depth of the quantum circuit, thereby improving the efficiency of the quantum circuit.
[0034] In some embodiments, obtaining the optimized essential prime implicant set according to the reversible implicant pair includes:
[0035] Inserting the reversible implicant pair into the essential prime implicant set to obtain a reversible essential prime implicant set;
[0036] The reversible essential prime implication item set is merged to obtain an optimized essential prime implication item set.
[0037] In this way, the computer device inserts the reversible implication pair into the essential prime implication set to obtain the reversible essential prime implication set. Then, the computer device merges the reversible essential prime implication set to obtain the optimized essential prime implication set. In this way, due to the reversibility of the quantum circuit, it can be found that by inserting the reversible implication pair into the essential prime implication set to obtain the reversible essential prime implication set, the corresponding quantum circuit is consistent in function with the quantum circuit corresponding to the essential prime implication set. In addition, the computer device merges the reversible essential prime implication set to obtain the optimized essential prime implication set, and it can be found that although the number of implication contents in the essential prime implication set is consistent with the number of implication contents in the optimized essential prime implication set, the quantum circuit corresponding to the optimized essential prime implication set has fewer control bits of the quantum gate and higher fidelity of the quantum gate.
[0038] In some embodiments, the merging of the reversible essential prime implications to obtain an optimized essential prime implications set includes:
[0039] In the case where the optimized essential prime implication item set includes implication items with a Hamming distance of 1, merging the implication items in the reversible essential prime implication item set to obtain the optimized essential prime implication item set;
[0040] When the optimized essential prime implication item set does not include an implication item with a Hamming distance of 1, the optimized essential prime implication item set is output.
[0041] In this way, when the optimized essential prime implication item set includes an implication item with a Hamming distance of 1, the computer device merges the implication items in the reversible essential prime implication item set to obtain the optimized essential prime implication item set. When the optimized essential prime implication item set does not include an implication item with a Hamming distance of 1, the computer device outputs the optimized essential prime implication item set. In this way, by merging the reversible essential prime implication item set, the quantum circuit can be further simplified, the number of quantum logic gates can be reduced, and the complexity of the quantum circuit can be reduced. In addition, the process is repeated until the Hamming distances of all the implication items in the merged implication item set are greater than 1. This shows that each implication item in the obtained optimized essential prime implication item set is unique and cannot be replaced by other implication items.
[0042] Additional aspects and advantages of the embodiments of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0044] Figure 1 It is one of the flow charts of the implementation method of the present application;
[0045] Figure 2 This is the second flow chart of the implementation method of the present application;
[0046] Figure 3(a)-Figure 3(f) It is a schematic diagram of the correspondence between the quantum gate and the truth table in the implementation mode of the present application;
[0047] Figure 4 This is the third flow chart of the implementation method of this application;
[0048] Figure 5 This is the fourth flow chart of the implementation method of the present application;
[0049] Figure 6 This is the fifth flow chart of the implementation method of the present application;
[0050] Figure 7 This is one of the schematic diagrams of quantum circuit merging in the implementation mode of the present application;
[0051] Figure 8 This is the sixth flow chart of the implementation method of this application;
[0052] Fig. 9 It is one of the quantum circuit schematic diagrams of the implementation mode of the present application;
[0053] Fig.10 This is the seventh flow chart of the implementation method of the present application;
[0054] Fig.11 This is the eighth flow chart of the implementation method of the present application;
[0055] Fig.12 This is the ninth flowchart of the implementation method of the present application;
[0056] Fig.13 This is the second schematic diagram of quantum circuit merging in the implementation mode of the present application;
[0057] Fig.14 This is the tenth flowchart of the implementation method of the present application;
[0058] Fig.15 This is the second schematic diagram of the quantum circuit of the implementation mode of the present application;
[0059] Fig.16 This is the eleventh flow chart of the implementation method of the present application. DETAILED DESCRIPTION
[0060] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions from beginning to end. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of the present application, and cannot be understood as limiting the embodiments of the present application.
[0061] In the era of noisy intermediate-scale quantum systems (NISQ), quantum computers have demonstrated the ability to surpass classical computers on certain specific problems. However, due to the short coherence time of quantum systems, the limitations of interactions between quantum bits (qubits), and the crosstalk between physical devices, the fidelity of quantum gate operations and the depth of executable circuits of quantum computers usually cannot meet the needs of general fault-tolerant computing. Therefore, in order to adapt quantum circuits to current hardware performance and improve the efficiency and practicality of quantum computing, so as to meet the needs of general fault-tolerant computing, the optimal quantum circuit can be constructed by optimizing the number of quantum bits, the number of quantum gates, and the depth of quantum circuits.
[0062] In the related art, the Quine-McCluskey algorithm can be used to find the optimal structure of quantum circuits to improve the efficiency and practicality of quantum computing. The Quine-McCluskey algorithm is an important tool for simplifying logical functions. However, when dealing with quantum circuits with a large number of variables, due to the complexity of the Quine-McCluskey algorithm itself, the computational complexity of the Quine-McCluskey algorithm increases exponentially with the increase in the number of input variables, which makes it inefficient and difficult to implement when dealing with quantum circuits with a large number of variables.
[0063] Noisy intermediate-scale quantum system (NISQ) refers to quantum computers at the current stage of development of quantum computing hardware technology that have a medium number of quantum bits, but due to the noise in the quantum bit 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 that a quantum system can maintain its quantum coherence. Coherence refers to the existence of a specific relationship between different states in a quantum system, which enables the system to exhibit behaviors different from those of a classical system, such as quantum superposition and quantum entanglement.
[0065] Based on the above questions, please refer to Figure 1 The embodiment of the present application provides a method for optimizing a quantum circuit based on the Quine-McCluskey algorithm, the method comprising:
[0066] 011: Convert the truth table of quantum circuit into a set of primary implications;
[0067] 012: Based on the Quine-McCluskey algorithm, the primary implicant set is processed to obtain the essential prime implicant set;
[0068] 013: Process the essential element implication item set to obtain an optimized essential element implication item set;
[0069] 014: Obtain the target quantum circuit based on the set of optimized essential implied terms to achieve the optimization of the quantum circuit.
[0070] The embodiment of the present application also provides a computer device, including a memory and a processor. The optimization method of the quantum circuit of the embodiment of the present application can be implemented by the computer device of the embodiment of the present application. Specifically, a computer program is stored in the memory, and the processor is used to convert the truth table of the quantum circuit into a primary implication set. And the primary implication set is processed based on the Quine-McCluskey algorithm to obtain an essential prime implication set. The processor is also used to process the essential prime implication set to obtain an optimized essential prime implication set. And the target quantum circuit is obtained according to the optimized essential prime implication set to optimize the quantum circuit.
[0071] The embodiment of the present application also provides a quantum circuit optimization device. The optimization method of the quantum circuit of the embodiment of the present application can be implemented by the quantum circuit optimization device of the embodiment of the present application. Specifically, the quantum circuit optimization device includes a conversion module and a processing module. The conversion module is used to convert into a primary implication set according to the truth table of the quantum circuit. The processing module is used to process the primary implication set based on the Quine-McCluskey algorithm to obtain an essential prime implication set. The postponement module is used to postpone the single-bit quantum gate in the second quantum circuit according to the barrier gate to obtain a first optimized quantum circuit, so as to optimize the quantum circuit. The processing module is also used to process the essential prime implication set to obtain an optimized essential prime implication set. The processing module is also used to obtain a target quantum circuit according to the optimized essential prime implication set, so as to optimize the quantum circuit.
[0072] Specifically, a quantum circuit consists of a series of quantum gates, which are used to describe how quantum gates operate on the state of quantum bits and are the basis for implementing quantum algorithms and quantum information processing.
[0073] Quantum gates, also called quantum logic gates, are the basic operating units in quantum computing. They perform specific mathematical operations on quantum bits to achieve complex computing tasks and 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 can be in a superposition state.
[0075] Quantum circuit optimization refers to the adjustment and improvement of the structure, connection method, operation sequence and other aspects of the quantum circuit. Its significance lies in reducing the depth of the quantum circuit and optimizing the order of quantum gates, thereby improving the computing speed and accuracy of the quantum computer.
[0076] The depth of a quantum circuit refers to the number of quantum gates in the quantum circuit.
[0077] A truth table is a logic tool used to describe the output values of a logic function or logic expression under all possible input combinations.
[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] Prime implicant refers to those implicants in Boolean algebra and digital circuit design that cannot be further decomposed or simplified. That is, in the process of simplifying logic functions, the prime implicant is the most basic unit.
[0080] Essential prime implicants refer to prime implicants that cannot be eliminated by further merging operations during the simplification of logical functions.
[0081] The control bit of a quantum gate refers to the quantum bit used to control the operation of the quantum gate.
[0082] The fidelity of a quantum gate is an indicator that measures the accuracy of a quantum gate in performing a specific operation. The fidelity describes the degree of closeness between the actual operation results of the quantum gate and the ideal operation results.
[0083] Quantum Oracle is generally considered to be a special quantum gate that can realize a specific quantum function. It accepts quantum states as input and transforms the input quantum states according to certain classical functions to obtain corresponding output results. Quantum Oracle is a black box operation, and the specific implementation and details of the input quantum states in the quantum Oracle are invisible.
[0084] The computer device converts the truth table of the quantum circuit into a set of primary implications, and then processes the set of primary implications based on the Quine-McCluskey algorithm and the reversibility of the quantum circuit to obtain an optimized set of essential prime implications. Finally, the computer device obtains the target quantum circuit based on the optimized set of essential prime implications to optimize the quantum circuit. In this way, through this method, without sacrificing the function of the quantum circuit, the depth of the quantum circuit is compressed and the control bits of the quantum gates in the quantum circuit are 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 improving the executability of the quantum circuit.
[0085] It should be noted that the optimization method for quantum circuits based on the Quine-McCluskey algorithm provided in the embodiments of the present application optimizes the quantum circuit on a classical computer, and then uses a quantum computer to execute the optimized quantum circuit. In addition, this method is aimed at quantum Oracle, a quantum circuit used to describe problems or perform specific tasks.
[0086] The following is an example to illustrate the optimization method of the quantum circuit of the implementation mode of the present application. In the embodiment of the present 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-bit quantum bits as input, and the 4-bit quantum bits of the input are Q1, Q2, Q3 and Q4 respectively.
[0087] The computer device first converts the truth table [1,1,1,0,0,1,1,1,1,1,1,0,0,0,1,0] of the quantum circuit C into a primary implication set A. Then, the computer device processes the primary implication set A based on the Quine-McCluskey algorithm to obtain an essential prime implication set D. Then, the computer device processes the essential prime implication set D to obtain an optimized essential prime implication set F. Finally, the computer device obtains the target quantum circuit according to the optimized essential prime implication set F to optimize the quantum circuit C.
[0088] In summary, in the quantum circuit optimization method and computer device of the implementation mode of the present application, the computer device converts the truth table of the quantum circuit into a primary implied item set, and then processes the primary implied item set based on the Quine-McCluskey algorithm and the reversibility of the quantum circuit to obtain an optimized essential prime implied item set. Finally, the computer device obtains the target quantum circuit based on the optimized essential prime implied item set to achieve the optimization of the quantum circuit. In this way, without sacrificing the function of the quantum circuit, the depth of the quantum circuit is compressed, and the control bits of the quantum gates in the quantum circuit are 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 improving the executability of the quantum circuit.
[0089] See also Figure 2 In some embodiments, the method further comprises:
[0090] 015: Obtain the truth table according to the pre-stored quantum gate-truth table correspondence.
[0091] In some embodiments, the processing module is used to obtain a truth table according to a pre-stored correspondence between quantum gates and truth tables.
[0092] In some embodiments, the processor is further configured to obtain a truth table according to a pre-stored correspondence between quantum gates and truth tables.
[0093] Specifically, see Figure 3(a)-Figure 3(f) , Figure 3(a)-Figure 3(f) The correspondence between the pre-stored quantum gate and the truth table is shown.
[0094] Quantum gates simulate classical logic functions and use the characteristics of quantum bits such as superposition and entanglement and the reversibility of quantum computing circuits to solve specific problems. In this way, quantum gates can be represented by truth tables. Computer devices obtain truth tables based on the correspondence between pre-stored quantum gates and truth tables. In this way, the computer device obtains the truth table, and in subsequent processes, it can obtain the primary implied term set of the quantum circuit based on the truth table and the quantum circuit.
[0095] Continuing with the above example, please refer again to Figure 3(a)-Figure 3(f) , the computer device obtains the truth table [1,1,1,0,0,1,1,1,1,1,0,0,0,1,0] of the quantum circuit C according to the pre-stored correspondence between quantum gates and truth tables.
[0096] In this way, the computer device obtains the truth table [1,1,1,0,0,1,1,1,1,1,0,0,0,1,0] of the quantum circuit C. In the subsequent process, the primary implied term set A of the quantum circuit can be obtained according to the truth table [1,1,1,0,0,1,1,1,1,1,0,0,0,1,0].
[0097] See also Figure 4 In some embodiments, step 011 (converting the truth table obtained according to the quantum circuit into a set of primary implications) includes:
[0098] 0111: Convert the subscripts corresponding to the items with a value of 1 in the truth table into binary to obtain a set of implied items.
[0099] In some embodiments, the conversion module is used to convert the subscripts corresponding to the items 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 further configured to convert the subscripts corresponding to the items with a value of 1 in the truth table into binary to obtain a set of implied items.
[0101] Specifically, the number of binary bits is consistent with the number of quantum bits of the input quantum circuit. The primary implied term set includes multiple primary implied terms
[0102] The computer device converts the subscripts corresponding to the items with a value of 1 in the truth table into binary to obtain a set of implied items.
[0103] Continuing with the above example, the computer device converts the subscripts 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 primary implied term set A. Since the number of quantum bits of the input quantum circuit C is 4 bits, the primary implied term set A obtained by converting the subscripts 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 computer device converts the subscripts corresponding to the items with a value of 1 in the truth table into binary to obtain a set of implied terms, which is an important step of the Quine-McCluskey algorithm and the basis for the subsequent merging of implied terms to obtain the essential prime implied term set.
[0105] See also Figure 5 In some embodiments, step 012 (processing a primary implicant set based on the Quine-McCluskey algorithm to obtain an essential prime implicant set) includes:
[0106] 0121: Based on the Quine-McCluskey algorithm, the primary implied items in the primary implied item set are merged to obtain a merged implied item set;
[0107] 0122: Obtain the essential prime implicant set based on the merged implicant set.
[0108] In some embodiments, the merging module is used to merge the primary implicants in the primary implicant set based on the Quine-McCluskey algorithm to obtain a merged implicant set. The processing module is used to obtain an essential prime implicant set according to the merged implicant set.
[0109] In some embodiments, the processor is further configured to merge the primary implicants in the primary implicant set based on the Quine-McCluskey algorithm to obtain a merged implicant set, and to obtain an essential prime implicant set according to the merged implicant set.
[0110] Specifically, the computer device performs a merging process on the primary implicants in the primary implicants set based on the Quine-McCluskey algorithm to obtain a merged implicants set. Then, the computer device processes the merged implicants set to obtain an essential prime implicants set.
[0111] Continuing with the above example, see Table 1:
[0112] Table 1
[0113]
[0114] The computer device first groups the primary implication item set A according to the number of "1"s in the primary implication items, and the grouping is shown in Table 1. The computer device merges the primary implication items in the primary implication item set A to obtain a merged implication item set B. Then, the computer device processes the merged implication item set B to obtain an essential prime implication item set D.
[0115] In this way, the process of processing the primary implied term set A based on the Quine-McCluskey algorithm and then obtaining the essential prime implied term set D can reduce the use of quantum logic gates, thereby reducing the complexity of quantum circuits. In addition, by merging implied terms, the control bit of the quantum gate can be reduced by one, thereby improving the fidelity of the quantum gate.
[0116] See also Figure 6 In some implementations, step 0121 (merging the primary implicants in the primary implicant set based on the Quine-McCluskey algorithm to obtain a merged implicant set) includes:
[0117] 01211: Based on the Quine-McCluskey algorithm, the primary implied terms with a Hamming distance of 1 in the primary implied term set are merged to obtain multiple implied terms, so as to obtain a merged implied term set.
[0118] In some implementations, the merging module is used to merge the primary implicants with a Hamming distance of 1 in the primary implicant set based on the Quine-McCluskey algorithm to obtain multiple implicants, so as to obtain a merged implicant set.
[0119] In some implementations, the processor is further configured to merge the primary implicants with a Hamming distance of 1 in the primary implicant set based on the Quine-McCluskey algorithm to obtain multiple implicants, so as to obtain a merged implicant set.
[0120] Specifically, the Hamming distance is used to indicate the number of different characters at corresponding positions between two implied terms. Implied terms include primary implied terms. The meaning of a Hamming distance of 1 in a quantum circuit is that a control bit of two multi-controlled NOT gates can be either 0 or 1, which means that the bit has no significant meaning for the controlled NOT gate and the bit state can be ignored.
[0121] Please refer to Table 1 and Table 2. After obtaining the primary implied item set A, it is necessary to determine whether any two primary implied items in the primary implied item set can be merged. For any two primary implied items, the Hamming distance between the two is calculated. If the Hamming distance of the two primary implied items is 1, it is considered that the two primary implied items can be merged. For example, 0000 in A0 and 0001 in A1 have the same numbers in three positions, and only the last number is inconsistent, so it is considered that 0000 in A0 and 0001 in A1 can be merged. When performing the merging process, the primary implied item set is grouped in this embodiment to reduce unnecessary comparisons. Please refer to Table 1 again, it can be found that if it is a non-adjacent primary implied item group, then the Hamming distance cannot be 1, and it cannot be merged. For example, the minimum Hamming distance between A0 and A2 is 2. The primary implied items of the same primary implied item group do not need to be compared, and the Hamming distance cannot be 1. So we only need to compare adjacent primary implied item groups. Please refer to Table 2:
[0122] Table 2
[0123]
[0124] The computer device merges the primary implied items with a Hamming distance of 1 in the primary implied item set to obtain multiple implied items such as 000-, so as to obtain a merged implied item set B. If the number at a position can be both 1 and 0, it is represented by "-". Please refer to Figure 7 , the implied term 000-, which can be obtained by combining the implied terms 0000 and 0001, means that the valid bits become 3 bits, and the last bit is an invalid bit. The corresponding quantum circuit is represented by two C4(X)s that can be combined into one C3(X), such as Figure 7 shown.
[0125] If a primary implicant cannot be combined with any other term, then this term is called a prime implicant.
[0126] In this way, by merging the primary implications with a Hamming distance of 1 in the primary implications set A, the number of implications can be reduced, thereby reducing the number of quantum logic gates in the quantum circuit C, and ultimately improving the efficiency of the quantum circuit C.
[0127] See also Figure 8 In some implementations, step 0122 (obtaining an essential element implicant set according to a combined implicant set) includes:
[0128] 01221: merge the implicants with a Hamming distance of 1 in the merged implicant set until the Hamming distance of each implicant in the merged implicant set is greater than 1;
[0129] 01222: The merged implied item set is processed according to a preset algorithm to obtain an essential prime implied item set.
[0130] In some embodiments, the merging module is used to merge the implicants with a Hamming distance of 1 in the merged implicant set until the Hamming distance of each implicant in the merged implicant set is greater than 1. The processing module is also used to process the merged implicant set according to a preset algorithm to obtain an essential prime implicant set.
[0131] In some embodiments, the processor is further configured to merge the implicants with a Hamming distance of 1 in the merged implicant set until the Hamming distance of each implicant in the merged implicant set is greater than 1. And the merged implicant set is processed according to a preset algorithm to obtain an essential prime implicant set.
[0132] Specifically, the preset algorithm is a greedy algorithm. The computer device performs a merging process on the implied items with a Hamming distance of 1 in the merged implied item set until the Hamming distance of each implied item in the merged implied item set is greater than 1. Then, the computer device processes the merged implied item set according to the preset algorithm to obtain an essential prime implied item set.
[0133] Continuing with the above example, please refer to Table 2 and Table 3. The merged implied item set is merged as shown in Table 2. It can be found that the merged implied item set still includes implied items with a Hamming distance of 1 and can be merged. The computer device merges the implied items with a Hamming distance of 1 in the adjacent implied item groups to obtain a new merged implied item set, as shown in Table 3:
[0134] Table 3
[0135]
[0136]
[0137] It can be found that at this time, the Hamming distance between 0-01 obtained by merging the implicants with subscripts 1 and 5 and any other implicants in the merged implicant set is greater than 1, so 0-01 is a prime implicant.
[0138] In addition, it can be found that the obtained merged implicants include multiple repeated implicants, such as -00-, -0-0, etc. The repeated implicants are processed and only one of the same implicants is retained. It is determined whether there are still implicants with a Hamming distance of 1 between different implicants in the merged implicant set at this time. If any two implicants with a Hamming distance of 1 are still included, the merged implicant set is continued to be processed. If there are no implicants with a Hamming distance of 1, then all the implicants in the merged implicants are prime implicants at this time.
[0139] The final prime implied items are 0-01, 01-1, 011-, -00-, -0-0 and --10, but the number of prime implied items obtained at this time is not the minimum, and the number of prime implied items can be reduced. In order to obtain the set of essential prime implied items with the minimum number of prime implied items, commonly used methods in computer science such as recursive algorithm, search algorithm, backtracking algorithm, etc. are usually used. However, since there is a process for optimizing the set of essential prime implied items in the implementation method of the present application, the greedy algorithm is used in the implementation method of the present application to find the essential prime implied items. The process of using the greedy algorithm to find the essential prime implied items is roughly as follows: First, a directed graph is constructed based on all the prime implied items obtained by the merging process, each prime implied item is a node, and if two prime implied items contain a common primary implied item, an edge is connected. Each time greedily find the point with the least connecting edges from the directed graph, a set of essential prime implied items can be obtained. Then the remaining prime implied items are repeated through the above steps again until the essential prime implied items containing all the primary implied items are obtained. See also Fig. 9 , the set of essential prime implications obtained by quantum circuit C is [01-1, -00-, --10].
[0140] In this way, by merging the merged implied term set, the quantum circuit can be further simplified, the number of quantum logic gates can be reduced, and the complexity of the quantum circuit can be reduced. In addition, by processing the merged implied term set with a preset algorithm, the complexity of the algorithm can be reduced and the utilization rate of resources can be improved.
[0141] See also Fig.10 In some embodiments, the method further comprises:
[0142] 016: Query the essential prime implication item pairs in the essential prime implication item set whose Hamming distance is less than or equal to the preset distance.
[0143] In some embodiments, the query module is further used to query the essential prime implication item pairs whose Hamming distance is less than or equal to a preset distance in the essential prime implication item set.
[0144] In some implementations, the processor is further configured to search the essential prime implication item set for essential prime implication item pairs 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 searches for essential prime implication item pairs in the essential prime implication item set whose Hamming distance is less than or equal to a preset distance.
[0147] Continuing with the above example, in the implementation mode of the present application, the preset distance is set to 2. In other implementation modes, the preset distance can be other values, which are determined according to actual needs. It can be found that in the set of essential prime implications [01-1, -00-, -10] obtained by quantum circuit C, there is no essential prime implication pair with a Hamming distance less than or equal to 2.
[0148] In an example, the set of essential prime implications obtained by quantum circuit C1 is -01-, -10-, then the essential prime implications pair of quantum circuit C1 can be -01- and -10-.
[0149] In this way, by querying the essential element implication pairs in the essential element implication set of the quantum circuit C1, it is possible to provide assistance for obtaining reversible implication pairs in the subsequent process.
[0150] See also Fig.11 In some embodiments, step 013 (processing the essential element implication item set to obtain an optimized essential element implication item set) includes:
[0151] 0131: Based on the reversibility of quantum circuits and the essential prime implicant pairs, we obtain reversible implicant pairs;
[0152] 0132: Obtain the optimized set of essential prime implicants based on the reversible implicant pairs.
[0153] In some embodiments, the processing module is further used to obtain a reversible implicant pair based on the reversibility of the quantum circuit and the essential prime implicant pair. The acquisition module is used to obtain an optimized essential prime implicant set according to the reversible implicant pair.
[0154] In some embodiments, the processor is further configured to obtain a reversible implicant pair based on the reversibility of the quantum circuit and the essential prime implicant pair, and obtain an optimized essential prime implicant set based on the reversible implicant pair.
[0155] Specifically, the reversibility of quantum circuits means that if an additional circuit U and the inverse of U are inserted anywhere in the quantum circuit, the new quantum circuit is equivalent to the original circuit.
[0156] A reversible implicant pair is a pair of binary digits with the same positions as an essential prime implicant pair, but the binary digits are all 1, such as the reversible implicant pair of the essential prime implicant pair -01- and -10- is -11- and -11-.
[0157] The computer device obtains a reversible implicant pair based on the reversibility of the quantum circuit and the essential prime implicant pair. Then, the computer device obtains an optimized essential prime implicant set according to the reversible implicant pair.
[0158] Continuing with the above example, the set of essential prime implications obtained by quantum circuit C1 is -01-, -10-, then the essential prime implications pair of quantum circuit C1 can be -01- and -10-. Based on the reversibility of quantum circuits, the computer device obtains the reversible implications pair [-11-, -11-] from the essential prime implications pair [-01-, -10-]. Then, the computer device obtains the optimized essential prime implications set [-01-, -11-, -11-, -10-] based on the reversible implications pair.
[0159] In this way, through the reversibility of quantum circuits and essential prime implication pairs, reversible implication pairs corresponding to the essential prime implication pairs can be obtained. The reversible implication pairs can be processed with the essential prime implication pairs, which can reduce the number of quantum logic gates and the depth of quantum circuits, thereby improving the efficiency of quantum circuits.
[0160] See also Fig.12 In some embodiments, step 0132 (obtaining an optimized essential prime implicant set according to the reversible implicant pair) includes:
[0161] 01321: Insert the reversible implicant pair into the essential prime implicant set to obtain the reversible essential prime implicant set;
[0162] 01322: The reversible essential prime implications set is merged to obtain the optimized essential prime implications set.
[0163] In some embodiments, the inserting module is further used to insert the reversible implicant pair into the essential prime implicant set to obtain the reversible essential prime implicant set. The merging module is further used to merge the reversible essential prime implicant set to obtain the optimized essential prime implicant set.
[0164] In some embodiments, the processor is further configured to insert the reversible implicant pair into the essential prime implicant set to obtain a reversible essential prime implicant set, and to merge the reversible essential prime implicant set to obtain an optimized essential prime implicant set.
[0165] Specifically, the computer device inserts the reversible implication item pair into the essential element implication item set to obtain the reversible essential element implication item set. Then, the computer device performs a merging process on the reversible essential element implication item set to obtain the optimized essential element implication item set.
[0166] Continuing with the above example, unlike classical circuits, quantum circuits are reversible. If an extra circuit U and the inverse of U are inserted anywhere in the quantum circuit, the new quantum circuit is equivalent to the original circuit. Fig.13 , Fig. 9It means that the quantum circuit C1 is merged after adding the reversible implicant pair. The computer device inserts the reversible implicant pair [-11-, -11-] into the essential prime implicant set [-01-, -10-]. It can be found that -01-, -11- and -11-, -10- can be merged again to get -1-, -1-. The corresponding quantum circuit changes from two C2(X) to two C1(X).
[0167] In this way, due to the reversibility of quantum circuits, it can be found that by inserting the reversible implicants into the essential prime implicants set, the reversible essential prime implicants set is obtained, and the corresponding quantum circuit is functionally consistent with the quantum circuit corresponding to the essential prime implicants set. In addition, the computer device merges the reversible essential prime implicants set to obtain the optimized essential prime implicants set. It can be found that although the number of implicants in the essential prime implicants set is consistent with the number of implicants in the optimized essential prime implicants set, the quantum circuit corresponding to the optimized essential prime implicants set has fewer control bits and higher fidelity of the quantum gate.
[0168] See also Fig.14 In some embodiments, step 01322 (merging the reversible essential element implications set to obtain an optimized essential element implications set) includes:
[0169] 013221: When the optimized essential prime implication item set includes an implication item with a Hamming distance of 1, the implication items in the reversible essential prime implication item set are merged to obtain the optimized essential prime implication item set;
[0170] 013222: When the optimized set of essential prime implications does not include implications with a Hamming distance of 1, the optimized set of essential prime implications is output.
[0171] In some embodiments, the merging module is used to merge the implicants in the reversible essential element implicant set to obtain the optimized essential element implicant set when the optimized essential element implicant set includes implicants with a Hamming distance of 1. The output module is used to output the optimized essential element implicant set when the optimized essential element implicant set does not include implicants with a Hamming distance of 1.
[0172] In some embodiments, the processor is further configured to, when the optimized essential element implication item set includes an implication item with a Hamming distance of 1, merge the implication items in the reversible essential element implication item set to obtain the optimized essential element implication item set. And when the optimized essential element implication item set does not include an implication item with a Hamming distance of 1, output the optimized essential element implication item set.
[0173] Specifically, when the optimized essential element implication item set includes an implication item with a Hamming distance of 1, the computer device merges the implication items in the reversible essential element implication item set to obtain the optimized essential element implication item set. When the optimized essential element implication item set does not include an implication item with a Hamming distance of 1, the computer device outputs the optimized essential element implication item set.
[0174] Continuing with the above example, when the optimized essential element implication item set includes an implication item with a Hamming distance of 1, the computer device merges the implication items in the reversible essential element implication item set to obtain the optimized essential element implication item set. When the optimized essential element implication item set does not include an implication item with a Hamming distance of 1, the computer device outputs the optimized essential element implication item set. Fig. 9 , the final quantum circuit obtained by quantum circuit C is as follows Fig. 9 See Fig.15 The quantum circuit obtained by optimizing the quantum circuit using qiskit is shown in the figure, which includes 1 C3(X), 3 C2(X), and 1 C1(X). It can be found that the final quantum circuit obtained by the implementation method of the present application is better.
[0175] In this way, by merging the reversible essential prime implicants, the quantum circuit can be further simplified, the number of quantum logic gates can be reduced, and the complexity of the quantum circuit can be reduced. In addition, the process is repeated until the Hamming distance of all implicants in the merged implicants set is greater than 1. This shows that each implicant in the obtained optimized essential prime implicants set is unique and cannot be replaced by other implicants. See Fig.16 , the simple process of the implementation method of this application is shown in the figure.
[0176] The present application also provides a computer-readable storage medium containing a computer program. When the computer program is executed by one or more processors, the one or more processors execute the quantum circuit optimization method of the present application.
[0177] It is understood that a computer program includes computer program code. The computer program code may be in source code form, object code form, executable file or some intermediate form. Computer readable storage media may include: any entity or device capable of carrying computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), and software distribution medium.
[0178] In the description of this specification, the descriptions with reference to the terms "specifically", "further", "particularly", "understandably", etc. are intended to mean that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms are not intended to refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0179] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0180] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A method for optimizing a quantum circuit based on the Quine-McCluskey algorithm, characterized in that: The method comprises: Converting into a primary implied term set according to the truth table of the quantum circuit; Processing the primary implied term set based on the Quine-McCluskey algorithm to obtain an essential prime implied term set; Processing the essential element implication item set to obtain an optimized essential element implication item set; A target quantum circuit is obtained according to the optimized essential element implied term set to achieve optimization of the quantum circuit.
2. The method according to claim 1, characterized in that The method further comprises: The truth table is obtained according to a pre-stored quantum gate-truth table correspondence.
3. The method according to claim 1, characterized in that The truth table obtained according to the quantum circuit is converted into a set of primary implications, including: The subscripts corresponding to the items with a value of 1 in the truth table are converted into binary to obtain the set of primary implications, wherein the number of bits of the binary is consistent with the number of quantum bits input into the quantum circuit, and the set of primary implications includes multiple primary implications.
4. The method according to claim 3, characterized in that The step of processing the primary implied term set based on the Quine-McCluskey algorithm to obtain the essential prime implied term set includes: Based on the Quine-McCluskey algorithm, the primary implied terms in the primary implied term set are merged to obtain a merged implied term set; The essential element implication item set is obtained according to the combined implication item set.
5. The method according to claim 4, characterized in that The step of merging the primary implied terms in the primary implied term set based on the Quine-McCluskey algorithm to obtain a merged implied term set includes: Based on the Quine-McCluskey algorithm, the primary implicants with a Hamming distance of 1 in the primary implicant set are merged to obtain multiple implicants, so as to obtain the merged implicant set, wherein the Hamming distance is used to indicate the number of different characters at corresponding positions between two implicants, and the implicants include the primary implicants.
6. The method according to claim 4, characterized in that The step of obtaining the set of essential element implications according to the combined set of implications includes: Merging the implied items whose Hamming distance is 1 in the merged implied item set until the Hamming distance of each implied item in the merged implied item set is greater than 1; The combined implication item set is processed according to a preset algorithm to obtain the essential element implication item set.
7. The method according to claim 1, characterized in that The method further comprises: The essential prime implication item set is searched for essential prime implication item pairs whose Hamming distance is less than or equal to a preset distance.
8. The method according to claim 7, characterized in that The step of processing the set of essential element implications to obtain an optimized set of essential element implications includes: Obtaining a reversible implicant pair based on the reversibility of the quantum circuit and the essential prime implicant pair; The optimized essential prime implication set is obtained according to the reversible implication pair.
9. The method according to claim 8, characterized in that The step of obtaining the optimized essential prime implication set according to the reversible implication pair includes: Inserting the reversible implicant pair into the essential prime implicant set to obtain a reversible essential prime implicant set; The reversible essential prime implication item set is merged to obtain an optimized essential prime implication item set.
10. The method according to claim 9, characterized in that The step of merging the reversible essential prime implication item set to obtain an optimized essential prime implication item set includes: In the case where the optimized essential prime implication item set includes implication items with a Hamming distance of 1, merging the implication items in the reversible essential prime implication item set to obtain the optimized essential prime implication item set; When the optimized essential prime implication item set does not include an implication item with a Hamming distance of 1, the optimized essential prime implication item set is output.
Citation Information
Patent Citations
Integer decomposition optimization method and system based on Grover quantum computing search algorithm
CN112182494A
Task processing method and device based on quantum computing and ground state energy level determination method
CN116205302A
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
Cited By
Gas station tax risk identification method and system
CN121961751A
