Quantum circuit generation method, execution method, and quantum circuit generation server
Through the low-code platform of quantum computing programming, the two-way translation of graphical user interface and code editing solves the problems of complexity and professional literacy requirements of quantum computing programming, and achieves the effect of simplifying the programming process and improving development efficiency.
Patent Information
- Application Number
- CN202411559712.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-03-07
AI Technical Summary
Quantum computing programming requires extremely high professional qualities, which limits the application of quantum computing technology, especially due to the design complexity and programming difficulty of quantum circuits.
It provides a low-code implementation method and platform for quantum computing programming. It generates target quantum circuits through input operations or input quantum instructions through graphical user interface, and synchronizes graphical interfaces and code editing in real time to reduce the complexity of quantum programming.
The quantum programming process is simplified, allowing users to design and modify quantum circuits even without deep background knowledge on quantum computing, improving the efficiency of quantum circuit development and reducing programming thresholds.
Smart Images

Figure CN119578571A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of quantum computing, and more specifically, to a low-code implementation method for quantum computing programming and a low-code platform for quantum computing programming. Background Art
[0002] Quantum computers use quantum bits to perform calculations. Due to the physical properties of quantum bits, quantum computers have the potential to far exceed traditional computers in solving certain complex problems. However, the programming and operation of quantum computing requires extremely high professionalism and a deep foundation in quantum physics and mathematics, which limits the application of quantum computing technology. Summary of the invention
[0003] The present application provides a low-code implementation method for quantum computing programming and a low-code platform for quantum computing programming.
[0004] The present application embodiment provides a low-code implementation method for quantum computing programming, the method comprising:
[0005] In response to an input operation of a graphical user interface or an input first quantum instruction, a first target quantum circuit is generated;
[0006] Generate a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit;
[0007] In response to a third quantum instruction inputted through a first editing operation on the second quantum instruction or a second editing operation on the first target quantum circuit in the graphical user interface, a second target quantum circuit and a fourth quantum instruction corresponding to the second target quantum circuit are generated.
[0008] Thus, the embodiment of the present application provides a low-code implementation method for quantum computing programming. First, in response to the input operation of the graphical user interface or the input of the first quantum instruction, the low-code platform generates a first target quantum circuit. Then, the low-code platform generates a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit. Finally, in response to the third quantum instruction input by the first editing operation of the second quantum instruction or the second editing operation of the first target quantum circuit in the graphical user interface, the low-code platform generates a second target quantum circuit and a fourth quantum instruction corresponding to the second target quantum circuit. In this way, the quantum circuit is designed in the graphical interface or the target instruction code is directly edited, and real-time synchronization between the two is ensured, which simplifies the process of quantum programming, so that users can design and modify quantum circuits even without in-depth background knowledge of quantum computing. In addition, by performing two-way translation between designing quantum circuits in the graphical interface and directly editing target instruction codes, the complexity of quantum circuit design is reduced, thereby improving the development efficiency of quantum circuits.
[0009] In some embodiments, generating a first target quantum circuit in response to an input operation of a graphical user interface or an input first quantum instruction includes:
[0010] In response to a selection operation on the graphical user interface, determining a target quantum gate;
[0011] In response to the parameter setting operation on the target quantum gate, the first target quantum circuit is generated.
[0012] Thus, first, the low-code platform determines the target quantum gate in response to the selection operation on the graphical user interface. Then, in response to the parameter setting operation on the target quantum gate, the low-code platform generates the first target quantum circuit. In this way, an intuitive and easy-to-operate design environment is provided, and users can build complex quantum circuits through simple operations and configurations.
[0013] In some embodiments, generating a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit includes:
[0014] Performing transformation processing on the first target quantum circuit to obtain a first target data structure;
[0015] Parsing the first target data structure to obtain a first target intermediate representation;
[0016] A second quantum instruction corresponding to the first target quantum circuit is generated according to the first target intermediate representation.
[0017] Thus, first, the low-code platform transforms the first target quantum circuit to obtain the first target data structure. Then, the low-code platform parses the first target data structure to obtain the first target intermediate representation. Finally, the low-code platform generates a second quantum instruction corresponding to the first target quantum circuit based on the first target intermediate representation. In this way, by transforming and parsing the generated quantum circuit, the representation of the quantum circuit is simplified, providing a clear and efficient logical framework for code generation, thereby achieving a complete conversion from user graphic operations to executable quantum instructions, simplifying the complexity of quantum programming, and improving development efficiency.
[0018] In some implementations, parsing the first target data structure to obtain a first target intermediate representation includes:
[0019] Performing a marking process on the first target data structure to obtain a first target mark;
[0020] Construct a first abstract syntax tree according to the first target tag;
[0021] The first abstract syntax tree is converted to obtain the first target intermediate representation.
[0022] Thus, first, the low-code platform performs a marking process on the first target data structure to obtain a first target mark. The marking process decomposes the first target data structure into manageable units for subsequent processing and analysis. Next, the low-code platform constructs a first abstract syntax tree based on the first target mark. The first abstract syntax tree provides a clear and structured quantum circuit representation, which facilitates the understanding and analysis of the logic of the circuit. Finally, the low-code platform converts the first abstract syntax tree to obtain a first target intermediate representation. The first target intermediate representation abstracts the operations of quantum gates and quantum bits, and can be easily adapted to different target quantum instructions. In this way, the low-code platform can support the generation of quantum instruction codes for different targets by generating intermediate representations, thereby providing good scalability and hardware compatibility for quantum circuit design. Users do not need to design circuits separately for different instructions. The low-code platform can automatically generate instruction codes, greatly improving the portability of the code.
[0023] In some implementations, constructing a first abstract syntax tree according to the first target tag includes:
[0024] Obtaining a first initial abstract syntax tree based on a preset grammar, a topological structure of the first target quantum circuit, and the first target tag;
[0025] The first initial abstract syntax tree is optimized to obtain the first abstract syntax tree.
[0026] In this way, based on the preset syntax, the topological structure of the first target quantum circuit and the first target tag, the low-code platform obtains the first initial abstract syntax tree. Then, the low-code platform optimizes the first initial abstract syntax tree to obtain the first abstract syntax tree. In this way, by constructing the first initial abstract syntax tree, the accuracy and comprehensibility of the circuit design are ensured. The first abstract syntax tree is optimized to obtain the first abstract syntax tree, which can significantly improve the performance of the quantum circuit, reduce execution time and resource consumption, and also make the circuit design clearer and easier to maintain.
[0027] In some embodiments, the generating of a second target quantum circuit and a fourth quantum instruction corresponding to the second target quantum circuit in response to a third quantum instruction inputted in response to a first editing operation on the second quantum instruction or a second editing operation on the first target quantum circuit in the graphical user interface comprises:
[0028] Obtain a second target intermediate representation according to the third quantum instruction;
[0029] Generate a second abstract syntax tree according to the second target intermediate representation;
[0030] Obtain a target logical structure and a second target tag according to the second abstract syntax tree;
[0031] Based on a preset layout algorithm, the second target quantum circuit is generated according to the target logical structure and the second target mark.
[0032] In this way, first, the low-code platform obtains the second target intermediate representation according to the third quantum instruction. Then, the low-code platform generates a second abstract syntax tree according to the second target intermediate representation. Then, the low-code platform obtains the target logical structure and the second target tag according to the second abstract syntax tree. Finally, based on the preset layout algorithm, the low-code platform generates the second target quantum circuit according to the target logical structure and the second target tag. In this way, the existing quantum circuit can be edited and processed by the first editing operation of the second quantum instruction, so as to generate a quantum circuit that better meets user needs. This method not only lowers the threshold of quantum programming, but also improves development efficiency and promotes the application and development of quantum computing technology.
[0033] In some embodiments, the generating of a second target quantum circuit and a fourth quantum instruction corresponding to the second target quantum circuit in response to a third quantum instruction inputted in response to a first editing operation on the second quantum instruction or a second editing operation on the first target quantum circuit in the graphical user interface comprises:
[0034] In response to the second editing operation, generating the second target quantum circuit;
[0035] Performing transformation processing on the second target quantum circuit to obtain a second target data structure;
[0036] Parsing the second target data structure to obtain a second target intermediate representation;
[0037] A fourth quantum instruction corresponding to the second target quantum circuit is generated according to the second target intermediate representation.
[0038] Thus, first, in response to the second editing operation, the low-code platform generates a second target quantum circuit. Next, the low-code platform transforms the second target quantum circuit to obtain a second target data structure. Then, the low-code platform parses the second target data structure to obtain a second target intermediate representation. Finally, the low-code platform generates a fourth quantum instruction corresponding to the second target quantum circuit based on the second target intermediate representation. In this way, the existing quantum circuit can be edited and processed through the second editing operation of the first target quantum circuit in the graphical user interface, thereby generating a quantum circuit that is more adapted to user needs. This method not only lowers the threshold for quantum programming, but also improves development efficiency and promotes the application and development of quantum computing technology.
[0039] In certain embodiments, the method further comprises:
[0040] Verifying the first quantum instruction based on a preset error repair algorithm;
[0041] In the case where there is an error in the first quantum instruction, displaying first error information in the first quantum instruction, and providing a first repair suggestion according to the first error information;
[0042] Based on the preset error repair algorithm, verifying the third quantum instruction;
[0043] In the case that there is an error in the third quantum instruction, second error information in the third quantum instruction is displayed, and a second repair suggestion is provided according to the second error information.
[0044] In this way, first, based on the preset error repair algorithm, the low-code platform verifies the first quantum instruction. Then, in the case that there is an error in the first quantum instruction, the low-code platform displays the first error information in the first quantum instruction, and provides a first repair suggestion based on the first error information. Then, based on the preset error repair algorithm, the low-code platform verifies the third quantum instruction. Finally, in the case that there is an error in the third quantum instruction, the low-code platform displays the second error information in the third quantum instruction, and provides a second repair suggestion based on the second error information. In this way, by presetting the error repair algorithm, the correctness of users' design of quantum circuits and writing of quantum instructions can be effectively improved, thereby lowering the threshold of quantum programming, improving development efficiency, and promoting the application and development of quantum computing technology. And it can quickly correct errors, reduce debugging time, and improve the development experience.
[0045] In certain embodiments, the method further comprises:
[0046] In response to a selection input for the first repair suggestion, repairing the first quantum instruction according to the first repair suggestion;
[0047] In response to a selection input for the second repair suggestion, repair processing is performed on the third quantum instruction according to the second repair suggestion.
[0048] In this way, in response to the selection input for the first repair suggestion, the low-code platform repairs the first quantum instruction according to the first repair suggestion. Then, in response to the selection input for the second repair suggestion, the low-code platform repairs the third quantum instruction according to the second repair suggestion. In this way, through automatic repair and step-by-step guidance, users can quickly correct errors and reduce debugging time, which can effectively improve the correctness of user-designed quantum circuits and quantum instruction codes and enhance the user development experience.
[0049] In certain embodiments, the method further comprises:
[0050] Based on the preset error repair algorithm, verifying the first target quantum circuit;
[0051] In the case where there is an error in the first target quantum circuit, displaying third error information in the first target quantum circuit, and providing a third repair suggestion according to the third error information;
[0052] Based on the preset error repair algorithm, verifying the second target quantum circuit;
[0053] In the case where an error exists in the second target quantum circuit, fourth error information in the second target quantum circuit is displayed, and a fourth repair suggestion is provided according to the fourth error information.
[0054] In this way, first, based on the preset error repair algorithm, the low-code platform verifies the first target quantum circuit. Then, in the case of an error in the first target quantum circuit, the low-code platform displays the third error information in the first target quantum circuit, and provides a third repair suggestion based on the third error information. Then, the low-code platform verifies the second target quantum circuit based on the preset error repair algorithm. Finally, in the case of an error in the second target quantum circuit, the low-code platform displays the fourth error information in the second target quantum circuit, and provides a fourth repair suggestion based on the fourth error information. In this way, by presetting the error repair algorithm, the correctness of users' design of quantum circuits and writing of quantum instructions can be effectively improved, thereby lowering the threshold of quantum programming, improving development efficiency, and promoting the application and development of quantum computing technology. And it can quickly correct errors, reduce debugging time, and improve the development experience.
[0055] In certain embodiments, the method further comprises:
[0056] In response to a selection input for the third repair suggestion, repairing the first target quantum circuit according to the third repair suggestion;
[0057] In response to a selection input for the fourth repair suggestion, repair processing is performed on the second target quantum circuit according to the fourth repair suggestion.
[0058] In this way, in response to the selection input for the third repair suggestion, the low-code platform repairs the first target quantum circuit according to the third repair suggestion. Then, in response to the selection input for the fourth repair suggestion, the low-code platform repairs the second target quantum circuit according to the fourth repair suggestion. In this way, through automatic repair and step-by-step guidance, users can quickly correct errors and reduce debugging time, which can effectively improve the correctness of user-designed quantum circuits and quantum instruction codes and enhance the user development experience.
[0059] The embodiment of the present application provides a low-code platform for quantum computing programming, the low-code platform comprising a quantum circuit generation module, a quantum instruction generation module and a quantum circuit editing module;
[0060] The quantum circuit generation module is configured to generate a first target quantum circuit in response to an input operation of a graphical user interface or an input first quantum instruction;
[0061] The quantum instruction generation module is configured to generate a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit;
[0062] The quantum circuit editing module is configured to generate a second target quantum circuit in response to a first editing operation on the second quantum instruction or a second editing operation on the first target quantum circuit in the graphical user interface, and the quantum instruction generation module is configured to generate a fourth quantum instruction corresponding to the second target quantum circuit according to the second target quantum circuit.
[0063] Thus, the embodiment of the present application provides a low-code platform for quantum computing programming, and the low-code platform includes a quantum circuit generation module, a quantum instruction generation module, and a quantum circuit editing module. The quantum circuit generation module can generate a first target quantum circuit in response to an input operation of a graphical user interface or an input first quantum instruction. The quantum instruction generation module can generate a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit. The quantum circuit editing module can generate a second target quantum circuit in response to a first editing operation on the second quantum instruction or a second editing operation on the first target quantum circuit in the graphical user interface, and the quantum instruction generation module is configured to generate a fourth quantum instruction corresponding to the second target quantum circuit according to the second target quantum circuit. In this way, based on the low-code platform, it can ensure that users can design and modify quantum circuits through simple graphical operations or quantum instructions, and the low-code platform is responsible for converting these operations into efficient and executable quantum instructions. This method not only lowers the threshold for quantum programming, but also improves development efficiency and promotes the application and development of quantum computing technology.
[0064] 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
[0065] 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:
[0066] Figure 1 It is one of the flowcharts of the low-code implementation method of certain implementation methods of the present application;
[0067] Figure 2 It is a schematic diagram of the structure of the low-code platform of certain implementation methods of the present application;
[0068] Figure 3 This is the second flowchart of the low-code implementation method of certain implementation methods of the present application;
[0069] Figure 4 This is the third flowchart of the low-code implementation method of certain implementation methods of the present application;
[0070] Figure 5 This is the fourth flowchart of the low-code implementation method of certain implementation methods of the present application;
[0071] Figure 6 This is the fifth flowchart of the low-code implementation method of certain implementation methods of the present application;
[0072] Figure 7This is the sixth flowchart of the low-code implementation method of certain implementation methods of the present application;
[0073] Figure 8 This is the seventh flowchart of the low-code implementation method of certain implementation methods of the present application;
[0074] Fig. 9 This is the eighth flowchart of the low-code implementation method of certain implementation methods of the present application;
[0075] Fig.10 This is the ninth flowchart of the low-code implementation method of certain implementation methods of the present application;
[0076] Fig.11 This is the tenth flowchart of the low-code implementation method of certain implementation methods of the present application;
[0077] Fig.12 This is the eleventh flowchart of the low-code implementation method of certain implementation methods of the present application;
[0078] Fig.13 It is a schematic diagram of a Bell state preparation circuit for certain embodiments of the present application. DETAILED DESCRIPTION
[0079] 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.
[0080] A quantum computer is a device that uses quantum bits to perform calculations, which is fundamentally different from traditional computers based on classical bits. Quantum bits, also known as qubits, are the basic units of quantum computing. They can achieve parallel processing of information through quantum mechanical phenomena such as quantum superposition and quantum entanglement. This unique physical property gives quantum computers great potential to surpass traditional computers in dealing with certain types of complex problems, such as prime factorization of large integers, search algorithms, and quantum simulations.
[0081] However, the programming and operation of quantum computers are far more complex than traditional computers. Quantum programming requires not only an understanding of the physical properties of quantum bits, but also the mastery of advanced concepts such as quantum logic gates, quantum algorithms, and quantum coding. Quantum logic gates are the basic operations in quantum computing, which act on quantum bits to achieve information conversion and processing. Quantum algorithms are algorithms that use the special properties of quantum bits to solve problems, such as the famous Shor algorithm and Grover algorithm. Quantum coding is to protect quantum information from noise and errors.
[0082] In addition, the operation of quantum computers also needs to take into account practical issues such as decoherence and error rate of quantum bits. Decoherence refers to the destruction of the quantum state of quantum bits due to their interaction with the environment, while the error rate is the probability of errors that may occur in quantum operations.
[0083] Based on the above questions, please refer to Figure 1 , the embodiment of the present application provides a low-code implementation method for quantum computing programming, the method comprising:
[0084] 011: generating a first target quantum circuit in response to an input operation of a graphical user interface or an input first quantum instruction;
[0085] 012: Generate a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit;
[0086] 013: In response to a third quantum instruction inputted through a first editing operation on the second quantum instruction or a second editing operation on the first target quantum circuit in a graphical user interface, a second target quantum circuit and a fourth quantum instruction corresponding to the second target quantum circuit are generated.
[0087] The embodiment of the present application also provides a low-code implementation server, including a memory and a processor. The low-code implementation method of quantum computing programming of the embodiment of the present application can be implemented by the low-code implementation server of the embodiment of the present application. Specifically, a computer program is stored in the memory, and the processor is used to generate a first target quantum circuit in response to an input operation of a graphical user interface or an input first quantum instruction. And a second quantum instruction corresponding to the first target quantum circuit is generated according to the first target quantum circuit. And in response to a third quantum instruction inputted for a first editing operation of the second quantum instruction or a second editing operation for the first target quantum circuit in a graphical user interface, a second target quantum circuit and a fourth quantum instruction corresponding to the second target quantum circuit are generated.
[0088] The embodiment of the present application also provides a low-code platform 100 for quantum computing programming. The low-code implementation method of quantum computing programming in the embodiment of the present application can be implemented by the low-code platform 100 for quantum computing programming in the embodiment of the present application. Specifically, the low-code platform 100 for quantum computing programming includes a quantum circuit generation module 10, a quantum instruction generation module 20, and a quantum circuit editing module 30. The quantum circuit generation module 10 is used to generate a first target quantum circuit in response to an input operation of a graphical user interface or an input first quantum instruction. The quantum instruction generation module 20 is used to generate a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit. The quantum circuit editing module 30 is used to generate a second target quantum circuit and a fourth quantum instruction corresponding to the second target quantum circuit in response to a third quantum instruction input for the first editing operation of the second quantum instruction or a second editing operation for the first target quantum circuit in the graphical user interface.
[0089] Specifically, input operations refer to operations such as clicking, dragging, and selecting performed by users when designing quantum circuits.
[0090] The first quantum instruction refers to a quantum instruction input by a user and used to generate a first target quantum circuit.
[0091] The second quantum instruction refers to the quantum instruction generated by the low-code platform 100 according to the first target quantum circuit. If the user generates the first target quantum circuit by inputting the first quantum instruction, the second quantum instruction is the first quantum instruction, and the first quantum instruction can be changed to the format of other programming languages.
[0092] The first editing operation refers to the user modifying quantum instructions or codes directly in the code editor. For example, the user may need to adjust the parameters of the quantum gate, such as the rotation angle, control bit, etc., to optimize the performance of the quantum circuit.
[0093] The third quantum instruction refers to the quantum instruction or code that the user modifies directly in the code editor.
[0094] The second editing operation refers to the user modifying the quantum circuit on the graphical interface through operations such as clicking, dragging, and selecting.
[0095] Quantum state refers to an abstract mathematical object, usually represented by a wave function or density matrix, which is used to describe all possible states of a quantum system and their probabilities.
[0096] Quantum circuit refers to the term used to describe the sequential application of quantum gates. Quantum circuits are often used to implement quantum algorithms and process quantum states.
[0097] Quantum gates refer to the basic operations in quantum computing, which are used to perform specific mathematical transformations on quantum bits. Similar to logic gates in traditional computers, quantum gates are the building blocks for building more complex computing operations. However, unlike classical bits that can only be in a 0 or 1 state, quantum bits can be in a superposition of 0 and 1.
[0098] Entanglement refers to a magical connection between two or more quantum systems. This connection goes beyond the cognitive scope of classical physics and is a purely quantum phenomenon.
[0099] Multi-bit quantum entangled state (Greenberger-Horne-Zeilinger, CHZ) is a key resource for quantum computing and the basis of many quantum computing algorithms. The characteristic is that all subsystems in the multi-bit quantum entangled state are in a quantum superposition of state 0 and state 1.
[0100] Low-code refers to developers using graphical interfaces and pre-made templates to create applications instead of manually writing a lot of code, which can speed up the application development process while reducing development difficulty and cost. Low-code platforms 100 usually provide visual design tools that enable developers to build user interfaces by dragging and dropping components and elements.
[0101] See also Figure 2 , Figure 2 It is a structural diagram of the low-code platform 100. Among them, the low-code platform 100 includes a quantum circuit generation module 10, a quantum instruction generation module 20, a quantum circuit editing module 30 and an error repair module 40. The quantum circuit generation module 10 is responsible for generating quantum circuits according to the user's input, providing a basis for subsequent quantum instruction generation and circuit editing. The user's input includes graphical interface operations or quantum instructions. It can parse the user's operations and convert them into representations of quantum circuits, including the arrangement of quantum bits, the configuration of quantum gates, etc. The quantum instruction generation module 20 generates corresponding quantum instructions based on the generated quantum circuit. These instructions are instructions that quantum computers can understand and execute, such as QASM (Quantum Assembly Language) codes. The quantum instruction generation module 20 relies on the quantum circuit representation provided by the quantum circuit generation module 10 to convert it into executable quantum instructions. At the same time, it also provides a basis for editing for the quantum circuit editing module 30. The quantum circuit generation module 10 and the quantum instruction generation module 20 use difference calculation and incremental update mechanisms to ensure real-time bidirectional translation and bidirectional synchronization between the graphical interface and the instruction code, avoid the occurrence of inconsistencies, and improve the development experience and the stability of the low-code platform 100.
[0102] It should be noted that there are four situations for the generation of quantum circuits. First, the first quantum instruction is first input to generate the first target quantum circuit, and then the third quantum instruction is input to modify the first target quantum circuit to generate the second target quantum circuit and the fourth quantum instruction corresponding to the second target quantum circuit. Second, the first quantum instruction is first input to generate the first target quantum circuit, and then the first target quantum circuit is dragged and processed through the graphical interface to generate the second target quantum circuit and the fourth quantum instruction corresponding to the second target quantum circuit. Third, in response to the input operation of the graphical user interface, that is, the user drags and performs operations such as dragging in the graphical interface, the first target quantum circuit is generated, and then the third quantum instruction is input to modify the first target quantum circuit to generate the second target quantum circuit and the fourth quantum instruction corresponding to the second target quantum circuit. Fourth, in response to the input operation of the graphical user interface, that is, the user drags and performs operations such as dragging in the graphical interface, and then the first target quantum circuit is dragged and processed through the graphical interface to generate the second target quantum circuit and the fourth quantum instruction corresponding to the second target quantum circuit.
[0103] The quantum circuit editing module 30 allows the user to edit and modify the quantum circuit. The user can add, delete or modify quantum gates, adjust the state of quantum bits, etc. through a graphical interface or a code editor. The quantum circuit editing module 30 receives the user's editing operations and updates the representation of the quantum circuit. The edited circuit will be re-parsed by the quantum instruction generation module 20 to generate new quantum instructions. The error repair module 40 is responsible for detecting errors in quantum circuits or quantum instructions and providing repair suggestions. It can check the topology of the circuit, the configuration of quantum gates, etc. to ensure the correctness of the circuit design. The error repair module 40 can intervene at any stage of quantum circuit generation, quantum instruction generation, and quantum circuit editing to help users find and correct errors. It works closely with other modules to ensure the efficiency and correctness of the entire programming process.
[0104] The user performs input operations or inputs the first quantum instruction through the graphical user interface, and the low-code platform 100 generates a first target quantum circuit based on these inputs. Then, the low-code platform 100 further generates a second quantum instruction corresponding to the generated first target quantum circuit. These instructions are programming descriptions of quantum circuits that can be understood and executed by quantum computers or simulators. In addition, the user can edit the second quantum instruction, input a third quantum instruction, or perform a second editing operation on the first target quantum circuit through the graphical user interface. The low-code platform 100 responds to these editing operations and generates a second target quantum circuit and a fourth quantum instruction corresponding to it.
[0105] In summary, in a quantum circuit generation method based on a large language model and a low-code platform 100 for quantum computing programming provided by the present application, first, in response to an input operation of a graphical user interface or an input first quantum instruction, the low-code platform 100 generates a first target quantum circuit. Next, the low-code platform 100 generates a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit. Finally, in response to a third quantum instruction input by a first editing operation of the second quantum instruction or a second editing operation of the first target quantum circuit in a graphical user interface, the low-code platform 100 generates a second target quantum circuit and a fourth quantum instruction corresponding to the second target quantum circuit. In this way, designing a quantum circuit in a graphical interface or directly editing the target instruction code, and ensuring real-time synchronization between the two, simplifies the process of quantum programming, so that users can design and modify quantum circuits even without in-depth background knowledge of quantum computing. In addition, by performing two-way translation between designing quantum circuits in a graphical interface and directly editing target instruction codes, the complexity of quantum circuit design is reduced, thereby improving the development efficiency of quantum circuits.
[0106] See also Figure 3 In some embodiments, step 011 (generating a first target quantum circuit in response to an input operation of a graphical user interface or an input first quantum instruction) includes:
[0107] 0111: In response to a selection operation on the graphical user interface, determining a target quantum gate;
[0108] 0112: In response to a parameter setting operation on a target quantum gate, a first target quantum circuit is generated.
[0109] In some embodiments, the quantum circuit generation module 10 is further configured to determine a target quantum gate in response to a selection operation on a graphical user interface, and to generate a first target quantum circuit in response to a parameter setting operation on the target quantum gate.
[0110] In some embodiments, the processor is further configured to determine a target quantum gate in response to a selection operation on the graphical user interface, and generate a first target quantum circuit in response to a parameter setting operation on the target quantum gate.
[0111] Specifically, the target quantum gate refers to the quantum gate selected by the user and required for this operation.
[0112] Parameter setting operation refers to the process in which users configure parameters of quantum gates or other components of quantum circuits.
[0113] The user selects the target quantum gate from the predefined quantum gate library through a graphical user interface. The quantum gate library includes Pauli gates, Hadamard gates, CNOT gates, etc. Then, the user sets parameters for the selected target quantum gate. These parameters may include the rotation angle, control bits, and target bits of the quantum gate, which determine the specific functions of the quantum gate. The low-code platform 100 automatically generates the first target quantum circuit based on the quantum gate selected by the user and its parameter settings.
[0114] In this way, an intuitive and easy-to-operate design environment is provided, where users can build complex quantum circuits through simple operations and configurations.
[0115] See also Figure 4 In some embodiments, step 012 (generating a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit) includes:
[0116] 0121: transforming the first target quantum circuit to obtain a first target data structure;
[0117] 0122: Parse the first target data structure to obtain a first target intermediate representation;
[0118] 0123: Generate a second quantum instruction corresponding to the first target quantum circuit according to the first target intermediate representation.
[0119] In some embodiments, the quantum instruction generation module 20 is used to transform the first target quantum circuit to obtain a first target data structure, parse the first target data structure to obtain a first target intermediate representation, and generate a second quantum instruction corresponding to the first target quantum circuit according to the first target intermediate representation.
[0120] In some embodiments, the processor is further configured to transform the first target quantum circuit to obtain a first target data structure, parse the first target data structure to obtain a first target intermediate representation, and generate a second quantum instruction corresponding to the first target quantum circuit according to the first target intermediate representation.
[0121] Specifically, the first target data structure refers to an internal data structure generated by the low-code platform 100 according to the first quantum circuit, such as a graph structure, a tree structure, an array or other complex structure suitable for representing a quantum circuit, which represents the connection relationship between quantum gates.
[0122] Parsing processing refers to the processing of the first target data structure by the low-code platform 100 according to the parser in the platform.
[0123] The first target intermediate representation refers to an abstract data structure in an intermediate form used to represent quantum circuits within the low-code platform 100. It appears in the form of a sequence of quantum gates, which directly reflects the operations of the quantum gates on different quantum bits.
[0124] The low-code platform 100 receives the first quantum circuit designed by the user through the graphical user interface and converts it into a data structure, namely the first target data structure. Then, based on the parser of the low-code platform 100, the low-code platform 100 parses the first target data structure to obtain a first target intermediate representation. Finally, the low-code platform 100 translates the first target intermediate representation into a second quantum instruction corresponding to the first target quantum circuit.
[0125] In this way, by converting and analyzing the generated quantum circuit, the representation of the quantum circuit is simplified, providing a clear and efficient logical framework for code generation, thereby achieving a complete conversion from user graphic operations to executable quantum instructions, simplifying the complexity of quantum programming and improving development efficiency.
[0126] See also Figure 5 In some implementations, step 0122 (parsing the first target data structure to obtain a first target intermediate representation) includes:
[0127] 01221: marking the first target data structure to obtain a first target mark;
[0128] 01222: construct a first abstract syntax tree according to the first target tag;
[0129] 01223: Perform conversion processing on the first abstract syntax tree to obtain a first target intermediate representation.
[0130] In some embodiments, the quantum instruction generation module 20 is further configured to perform a tagging process on the first target data structure to obtain a first target tag, construct a first abstract syntax tree according to the first target tag, and perform a conversion process on the first abstract syntax tree to obtain a first target intermediate representation.
[0131] In some embodiments, the processor is further configured to perform a tagging process on the first target data structure to obtain a first target tag, construct a first abstract syntax tree according to the first target tag, and perform a conversion process on the first abstract syntax tree to obtain a first target intermediate representation.
[0132] Specifically, the tagging process refers to a process of performing semantic analysis and annotation on the first target data structure based on a lexical parser.
[0133] The first target tag refers to the basic unit of quantum operation, such as gate type, quantum bit index, etc.
[0134] The first abstract syntax tree refers to a tree data structure used to represent a quantum circuit or a quantum instruction.
[0135] Users perform operations through a graphical interface, such as dragging and dropping quantum gates, connecting quantum bits, etc. The platform converts these operations into internal data structures, such as graph structures or tree structures, which reflect the connection relationships between quantum gates.
[0136] The low-code platform 100 performs a tagging process on the quantum circuit designed by the user through the graphical interface, i.e., the first target data structure. This process converts the various components of the quantum circuit, such as quantum gates, quantum bit connections, etc., into a series of tokens. A token is the basic building block of a quantum circuit, and each token represents a specific operation or element.
[0137] Next, the low-code platform 100 constructs a first abstract syntax tree according to the first target tag. The first abstract syntax tree is a tree data structure that represents the logical structure of the quantum circuit in the form of nodes and edges. Each node represents a quantum operation or sequence of operations, and the edge represents the dependency between operations.
[0138] Finally, the platform converts the first abstract syntax tree to obtain the first target intermediate representation. The first target intermediate representation is a representation closer to the machine execution level, which can be executed by a quantum computer or quantum simulator and usually contains information such as the sequence of quantum gates, action bits, and parameters.
[0139] In this way, the low-code platform 100 can support the generation of quantum instruction codes for different targets by generating intermediate representations, thereby providing good scalability and hardware compatibility for quantum circuit design. Users do not need to design circuits separately for different instructions. The low-code platform 100 can automatically generate instruction codes, greatly improving the portability of the code.
[0140] See also Figure 6 In some implementations, step 01222 (building a first abstract syntax tree according to the first target tag) includes:
[0141] 012221: obtaining a first initial abstract syntax tree based on a preset syntax, a topological structure of a first target quantum circuit and a first target tag;
[0142] 012222: Optimize the first initial abstract syntax tree to obtain a first abstract syntax tree.
[0143] In some embodiments, the quantum instruction generation module 20 is used to obtain a first initial abstract syntax tree based on a preset syntax, a topological structure of a first target quantum circuit, and a first target tag, and optimize the first initial abstract syntax tree to obtain a first abstract syntax tree.
[0144] In some embodiments, the processor is further configured to obtain a first initial abstract syntax tree based on a preset syntax, a topological structure of a first target quantum circuit, and a first target tag, and optimize the first initial abstract syntax tree to obtain a first abstract syntax tree.
[0145] Specifically, topology refers to the way qubits are connected and the arrangement of quantum gates in a quantum circuit. The topology of a quantum circuit is crucial to the implementation and performance of quantum algorithms because it determines how qubits interact and how information flows.
[0146] The low-code platform 100 constructs a first initial abstract syntax tree according to preset grammar rules, the topological structure of the first target quantum circuit and the first target tag. The first initial abstract syntax tree is a direct representation of the quantum circuit designed by the user, which contains all necessary quantum operations and structures.
[0147] Next, the low-code platform 100 optimizes the first initial abstract syntax tree. The optimization process may include eliminating redundant operations, merging similar operations, adjusting the order of operations, etc., to improve the efficiency and executability of the quantum circuit.
[0148] The final first abstract syntax tree is an optimized circuit representation, which is more concise and efficient.
[0149] In this way, by constructing the first initial abstract syntax tree, the accuracy and understandability of the circuit design are ensured. The first abstract syntax tree is optimized to obtain the first abstract syntax tree, which can significantly improve the performance of quantum circuits, reduce execution time and resource consumption, and also make the circuit design clearer and easier to maintain.
[0150] See also Figure 7 In some embodiments, step 013 (generating a second target quantum circuit and a fourth quantum instruction corresponding to the second target quantum circuit in response to a third quantum instruction input by a first editing operation on the second quantum instruction or a second editing operation on the first target quantum circuit in a graphical user interface) includes:
[0151] 0131: Obtain a second target intermediate representation according to the third quantum instruction;
[0152] 0132: Generate a second abstract syntax tree according to the second target intermediate representation;
[0153] 0133: Obtain a target logical structure and a second target tag according to the second abstract syntax tree;
[0154] 0134: Based on a preset layout algorithm, a second target quantum circuit is generated according to the target logical structure and the second target mark.
[0155] In some embodiments, the quantum circuit editing module 30 is used to obtain a second target intermediate representation according to the third quantum instruction. And generate a second abstract syntax tree according to the second target intermediate representation. The quantum circuit editing module 30 is also used to obtain a target logical structure and a second target tag according to the second abstract syntax tree. And based on a preset layout algorithm, generate a second target quantum circuit according to the target logical structure and the second target tag.
[0156] In some embodiments, the processor is further configured to obtain a second target intermediate representation according to the third quantum instruction, and to generate a second abstract syntax tree according to the second target intermediate representation. The processor is further configured to obtain a target logical structure and a second target tag according to the second abstract syntax tree, and to generate a second target quantum circuit according to the target logical structure and the second target tag based on a preset layout algorithm.
[0157] Specifically, the second target intermediate representation refers to an abstract data structure used to represent an intermediate form of the edited or optimized third quantum instruction.
[0158] The target logical structure refers to the logical framework of the quantum algorithm or quantum computing task that the user hopes to implement. This logical structure defines the interaction between quantum bits, the arrangement and operation sequence of quantum gates, and the high-level abstraction of the entire quantum computing process.
[0159] A preset layout algorithm refers to an algorithm that determines the layout of quantum bits and quantum gates in a quantum circuit, which improves the efficiency and performance of quantum computing by optimizing the physical implementation of the quantum circuit. Preset layout algorithms can be rule-based, heuristic, or machine learning-based, and they can automatically generate optimized quantum circuit layouts based on the characteristics of quantum devices and the requirements of quantum algorithms.
[0160] First, the low-code platform 100 obtains the second target intermediate representation according to the third quantum instruction. Next, the low-code platform 100 generates a second abstract syntax tree according to the second target intermediate representation. Then, the low-code platform 100 obtains the target logical structure and the second target tag according to the second abstract syntax tree. The target logical structure is a representation of the logical relationship of the second target quantum circuit, and the tag represents the basic unit of quantum operation. Finally, based on the preset layout algorithm, the low-code platform 100 generates the second target quantum circuit according to the target logical structure and the second target tag. The layout algorithm is responsible for placing quantum gates and quantum bits on the circuit diagram to form the final quantum circuit design.
[0161] In this way, the existing quantum circuit can be edited by the first editing operation of the second quantum instruction, thereby generating a quantum circuit that better meets the needs of the user. This method not only lowers the threshold of quantum programming, but also improves development efficiency and promotes the application and development of quantum computing technology.
[0162] See also Figure 8 In some embodiments, step 03 (generating a second target quantum circuit and a fourth quantum instruction corresponding to the second target quantum circuit in response to a third quantum instruction input by a first editing operation on the second quantum instruction or a second editing operation on the first target quantum circuit in a graphical user interface) includes:
[0163] 0135: In response to the second editing operation, generating a second target quantum circuit;
[0164] 0136: Perform transformation processing on the second target quantum circuit to obtain a second target data structure;
[0165] 0137: Parse the second target data structure to obtain a second target intermediate representation;
[0166] 0138: Generate a fourth quantum instruction corresponding to the second target quantum circuit according to the second target intermediate representation.
[0167] In some embodiments, the quantum circuit editing module 30 is further configured to generate a second target quantum circuit in response to the second editing operation. And perform a transformation process on the second target quantum circuit to obtain a second target data structure. The quantum circuit editing module 30 is further configured to perform a parsing process on the second target data structure to obtain a second target intermediate representation. And generate a fourth quantum instruction corresponding to the second target quantum circuit according to the second target intermediate representation.
[0168] In some embodiments, the processor is further configured to generate a second target quantum circuit in response to the second editing operation, and to transform the second target quantum circuit to obtain a second target data structure, and to parse the second target data structure to obtain a second target intermediate representation and to generate a fourth quantum instruction corresponding to the second target quantum circuit according to the second target intermediate representation.
[0169] Specifically, the user modifies the first target quantum circuit through a graphical user interface (GUI), such as adding, deleting or replacing quantum gates, to generate a second target quantum circuit. Next, the low-code platform 100 transforms the second target quantum circuit to obtain a second target data structure, which is an abstract representation of the second target quantum circuit, facilitating further processing by the platform. Then, the low-code platform 100 parses the second target data structure to obtain a second target intermediate representation. Finally, the low-code platform 100 generates a fourth quantum instruction corresponding to the second target quantum circuit based on the second target intermediate representation.
[0170] In this way, the existing quantum circuit can be edited through the second editing operation of the first target quantum circuit in the graphical user interface, thereby generating a quantum circuit that better meets the user's needs. This method not only lowers the threshold of quantum programming, but also improves development efficiency and promotes the application and development of quantum computing technology.
[0171] See also Fig. 9 In some embodiments, the method further comprises:
[0172] 014: Based on the preset error repair algorithm, the first quantum instruction is verified;
[0173] 015: when there is an error in the first quantum instruction, display first error information in the first quantum instruction, and provide a first repair suggestion according to the first error information;
[0174] 016: Based on the preset error repair algorithm, the third quantum instruction is verified;
[0175] 017: When there is an error in the third quantum instruction, display second error information in the third quantum instruction, and provide a second repair suggestion based on the second error information.
[0176] In some embodiments, the low-code platform 100 further includes an error repair module 40, which is used to verify the first quantum instruction based on a preset error repair algorithm. If there is an error in the first quantum instruction, the first error information in the first quantum instruction is displayed, and a first repair suggestion is provided based on the first error information. The error repair module 40 is also used to verify the third quantum instruction based on a preset error repair algorithm. If there is an error in the third quantum instruction, the second error information in the third quantum instruction is displayed, and a second repair suggestion is provided based on the second error information.
[0177] In some embodiments, the processor is further configured to verify the first quantum instruction based on a preset error repair algorithm. If there is an error in the first quantum instruction, display first error information in the first quantum instruction, and provide a first repair suggestion based on the first error information. The processor is further configured to verify the third quantum instruction based on a preset error repair algorithm. If there is an error in the third quantum instruction, display second error information in the third quantum instruction, and provide a second repair suggestion based on the second error information.
[0178] Specifically, the preset error correction algorithm refers to an algorithm used to detect and repair potential errors in quantum circuits or quantum instructions, which can ensure the correctness and reliability of quantum circuits and improve the efficiency and performance of quantum computing.
[0179] When users operate the code editor in the low-code platform 100, errors may occur, such as code syntax errors. After detecting an error, the low-code platform 100 will highlight the error line in the code editor, display error annotations and pop-up windows. At the same time, the low-code platform 100 provides an error panel that lists all error details, namely the first error message and the second error message. At the same time, the low-code platform 100 automatically provides users with automatic repair suggestions based on the first error message and the second error message, such as repairing syntax errors in the code.
[0180] In this way, by presetting the error repair algorithm, the accuracy of users’ quantum circuit design and quantum instruction writing can be effectively improved, thereby lowering the threshold of quantum programming, improving development efficiency, and promoting the application and development of quantum computing technology. It can also quickly correct errors, reduce debugging time, and improve the development experience.
[0181] See also Fig.10 In some embodiments, the method further comprises:
[0182] 018: In response to a selection input for a first repair suggestion, repair the first quantum instruction according to the first repair suggestion;
[0183] 019: In response to the selection input for the second repair suggestion, repair processing is performed on the third quantum instruction according to the second repair suggestion.
[0184] In some embodiments, the error repair module 40 is further configured to, in response to a selection input for a first repair suggestion, repair the first quantum instruction according to the first repair suggestion, and in response to a selection input for a second repair suggestion, repair the third quantum instruction according to the second repair suggestion.
[0185] In some embodiments, the processor is configured to, in response to a selection input for a first repair suggestion, perform repair processing on the first quantum instruction according to the first repair suggestion, and in response to a selection input for a second repair suggestion, perform repair processing on the third quantum instruction according to the second repair suggestion.
[0186] Specifically, in the graphical interface, the low-code platform 100 generates a repair wizard based on the first repair suggestion and the second repair suggestion. The user can choose to view the repair wizard, repair the error step by step, or apply the automatic repair with one click. In response to the user's selection input for the first repair suggestion or the second repair suggestion, the low-code platform 100 performs repair processing on the first quantum instruction or the third quantum instruction according to the user's selection. The repair processing includes modifying the erroneous part in the instruction, adjusting the parameters of the quantum gate, rearranging the connection of the quantum bits, etc.
[0187] In this way, through automatic repair and step-by-step guidance, users can quickly correct errors and reduce debugging time, which can effectively improve the correctness of user-designed quantum circuits and quantum instruction codes and enhance the user development experience.
[0188] See also Fig.11 In some embodiments, the method further comprises:
[0189] 020: Based on the preset error repair algorithm, the first target quantum circuit is tested;
[0190] 021: when there is an error in the first target quantum circuit, display third error information in the first target quantum circuit, and provide a third repair suggestion according to the third error information;
[0191] 022: Based on the preset error repair algorithm, the second target quantum circuit is tested;
[0192] 023: When there is an error in the second target quantum circuit, fourth error information in the second target quantum circuit is displayed, and a fourth repair suggestion is provided according to the fourth error information.
[0193] In some embodiments, the error repair module 40 is used to test the first target quantum circuit based on a preset error repair algorithm. If there is an error in the first target quantum circuit, display third error information in the first target quantum circuit, and provide a third repair suggestion based on the third error information. The error repair module 40 is also used to test the second target quantum circuit based on a preset error repair algorithm. If there is an error in the second target quantum circuit, display fourth error information in the second target quantum circuit, and provide a fourth repair suggestion based on the fourth error information.
[0194] In some embodiments, the processor is further configured to test the first target quantum circuit based on a preset error repair algorithm. If there is an error in the first target quantum circuit, display third error information in the first target quantum circuit, and provide a third repair suggestion based on the third error information. The processor is further configured to test the second target quantum circuit based on a preset error repair algorithm. If there is an error in the second target quantum circuit, display fourth error information in the second target quantum circuit, and provide a fourth repair suggestion based on the fourth error information.
[0195] Specifically, when the user operates through the graphical interface in the low-code platform 100, errors may occur, such as illegal quantum gate connections. After detecting an error, the low-code platform 100 will highlight the error location and display a prompt icon in the graphical interface. At the same time, the low-code platform 100 provides an error panel that lists all error details, namely the third repair suggestion and the fourth repair suggestion. At the same time, the low-code platform 100 provides users with automatic repair suggestions, such as automatically connecting unconnected quantum gates in the graphical interface.
[0196] In this way, by presetting the error repair algorithm, the accuracy of users’ quantum circuit design and quantum instruction writing can be effectively improved, thereby lowering the threshold of quantum programming, improving development efficiency, and promoting the application and development of quantum computing technology. It can also quickly correct errors, reduce debugging time, and improve the development experience.
[0197] See also Fig.12 In certain embodiments, the method further comprises:
[0198] 024: in response to a selection input for a third repair suggestion, repairing the first target quantum circuit according to the third repair suggestion;
[0199] 025: In response to the selection input for the fourth repair suggestion, repair the second target quantum circuit according to the fourth repair suggestion.
[0200] In some embodiments, the error repair module 40 is further configured to, in response to a selection input for a third repair suggestion, perform repair processing on the first target quantum circuit according to the third repair suggestion, and in response to a selection input for a fourth repair suggestion, perform repair processing on the second target quantum circuit according to the fourth repair suggestion.
[0201] In some embodiments, the processor is configured to, in response to a selection input for a third repair suggestion, perform a repair process on the first target quantum circuit according to the third repair suggestion, and in response to a selection input for a fourth repair suggestion, perform a repair process on the second target quantum circuit according to the fourth repair suggestion.
[0202] Specifically, in the graphical interface, the low-code platform 100 generates a repair wizard based on the third repair suggestion and the fourth repair suggestion. The user can choose to view the repair wizard, repair the error step by step, or apply the automatic repair with one click. In response to the user's selection input for the third repair suggestion or the fourth repair suggestion, the low-code platform 100 performs repair processing on the first target quantum circuit or the second target quantum circuit according to the user's selection. The repair processing includes modifying the error part in the instruction, adjusting the parameters of the quantum gate, rearranging the connection of the quantum bits, etc.
[0203] Please refer to Figure 2 An embodiment of the present application provides a low-code platform 100 for quantum computing programming. The low-code platform 100 includes a quantum circuit generation module 10, a quantum instruction generation module 20, and a quantum circuit editing module 30.
[0204] The quantum circuit generation module 10 is configured to generate a first target quantum circuit in response to an input operation of a graphical user interface or an input first quantum instruction;
[0205] The quantum instruction generation module 20 is configured to generate a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit;
[0206] The quantum circuit editing module 30 is configured to generate a second target quantum circuit in response to a first editing operation on the second quantum instruction or a second editing operation on the first target quantum circuit in the graphical user interface, and the quantum instruction generation module 20 is configured to generate a fourth quantum instruction corresponding to the second target quantum circuit according to the second target quantum circuit.
[0207] Specifically, the low-code platform 100 includes a quantum circuit generation module 10, a quantum instruction generation module 20, and a quantum circuit editing module 30. The quantum circuit generation module 10 is capable of generating a first target quantum circuit in response to an input operation of a graphical user interface or an input first quantum instruction. The quantum instruction generation module 20 is capable of generating a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit. The quantum circuit editing module 30 is capable of generating a second target quantum circuit in response to a first editing operation on the second quantum instruction or a second editing operation on the first target quantum circuit in the graphical user interface, and the quantum instruction generation module 20 is configured to generate a fourth quantum instruction corresponding to the second target quantum circuit according to the second target quantum circuit.
[0208] In summary, the embodiment of the present application provides a low-code platform 100 for quantum computing programming, and the low-code platform 100 includes a quantum circuit generation module 10, a quantum instruction generation module 20, and a quantum circuit editing module 30. The quantum circuit generation module 10 can generate a first target quantum circuit in response to an input operation of a graphical user interface or an input first quantum instruction. The quantum instruction generation module 20 can generate a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit. The quantum circuit editing module 30 can generate a second target quantum circuit in response to a first editing operation on the second quantum instruction or a second editing operation on the first target quantum circuit in the graphical user interface, and the quantum instruction generation module 20 is configured to generate a fourth quantum instruction corresponding to the second target quantum circuit according to the second target quantum circuit. In this way, based on the low-code platform 100, it can ensure that users can design and modify quantum circuits through simple graphical operations or quantum instructions, and the low-code platform 100 is responsible for converting these operations into efficient and executable quantum instructions. This method not only lowers the threshold for quantum programming, but also improves development efficiency and promotes the application and development of quantum computing technology.
[0209] The following is an example to illustrate the low-code implementation method of the above-mentioned quantum computing programming. The user designs the Bell state quantum circuit in the graphical interface of the low-code platform 100 for quantum computing programming, and the user drags different quantum gates on the platform and connects them to the corresponding quantum bits.
[0210] The Bell state refers to a special entangled state between two quantum bits in quantum mechanics. It is a fundamental concept in quantum computing and quantum communication, demonstrating the non-classical correlation between quantum bits.
[0211] See also Fig.13 , Fig.13 The schematic diagram of a Bell state preparation circuit is shown in Figure 1. The design process of the Bell state preparation circuit is as follows: Step 1, place a Hadamard gate on the 'Q0' quantum bit, which is represented by H in the figure. Step 2, place a Hadamard gate on the 'Q6' quantum bit. Step 3, place a controlled Z gate between the 'Q0' and 'Q6' quantum bits, which is represented by CZ in the figure. Step 4, place a Hadamard gate on the 'Q6' quantum bit. Step 5, place a Hadamard gate on the 'Q12' quantum bit. Step 6, place a controlled Z gate between 'Q6' and 'Q12'. Step 7, place a Hadamard gate on the 'Q12' quantum bit. Step 8, place measurement operations on the 'Q0', 'Q6' and 'Q12' quantum bits respectively, which are represented by M in the figure.
[0212] In the above design process, when the user drags and drops on the interface, the low-code platform 100 will automatically convert these graphical quantum gate operations into the corresponding first target data structure. At this time, the lexical parser of the low-code platform 100 will parse quantum gate types such as `H`, `X`, `CZ` and the quantum bits they act on, such as `Q0`, `Q6`, etc., as first target tags.
[0213] At this time, the original isq code of the Bell state preparation circuit is:
[0214] qbit q
[66] ;
[0215] procedure main(){
[0216] H(q[0]);
[0217] H(q[6]);
[0218] CZ(q[0],q[6]);
[0219] H(q[6]);
[0220] H(q
[12] );
[0221] CZ(q[6],q
[12] );
[0222] H(q
[12] );
[0223] M(q[0]);
[0224] M(q[6]);
[0225] M(q
[12] );
[0226] }
[0227] Subsequently, after parsing by a preset syntax parser, the low-code platform 100 generates a syntax tree to represent the gate operation sequence in the quantum circuit. Then, an abstract syntax tree AST is further constructed to simplify the circuit logic structure. This abstract syntax tree retains the relationship between all gate operations and quantum bits. The abstract syntax tree AST structure is as follows:
[0228] Program(QReg(q,66),Procedure(main,[H(q[0]),H(q[6]),CZ(q[0],q[6]),H(q[6]),H(q
[12] ),CZ(q[6],q
[12] ),H(q
[12] ),M(q[0]),M(q[6]),M(q
[12] )]))
[0229] Then, the low-code platform 100 converts the abstract syntax tree AST into an intermediate representation IR, which is an operation sequence containing a quantum gate sequence. The intermediate representation IR is:
[0230] ALLOCATE q 66
[0231] GATE H q[0]
[0232] GATE H q[6]
[0233] GATE CZ q[0]q[6]
[0234] GATE H q[6]
[0235] GATE H q
[12]
[0236] GATE CZ q[6]q
[12]
[0237] GATE H q
[12]
[0238] MEASURE q[0]
[0239] MEASURE q[6]
[0240] MEASURE q
[12]
[0241] Finally, the low-code platform 100 generates the QCIS instruction code:
[0242] Q0
[0243] Q6
[0244] Q6
[0245] Q6
[0246] Q12
[0247] CZ Q6 Q12
[0248] Q12
[0249] Q0
[0250] Q6
[0251] Q12
[0252] These instructions describe the execution order of the gates in the quantum circuit and the quantum bits that each gate acts on. It should be noted that in the low-code platform 100, the graphical quantum circuit and the QCIS instruction code maintain a bidirectional synchronization relationship. When the user drags the `H` gate to `Q0`, the low-code platform 100 will automatically generate the `H Q0` instruction at the bottom layer. If the user modifies it from the code side, such as deleting `H Q0`, the corresponding `H` gate on the graphical interface will also be removed synchronously.
[0253] 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 method of the present application.
[0254] 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.
[0255] 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.
[0256] 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.
[0257] 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 low-code implementation method for quantum computing programming, characterized in that: The method comprises: In response to an input operation of a graphical user interface or an input first quantum instruction, a first target quantum circuit is generated; Generate a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit; In response to a third quantum instruction inputted through a first editing operation on the second quantum instruction or a second editing operation on the first target quantum circuit in the graphical user interface, a second target quantum circuit and a fourth quantum instruction corresponding to the second target quantum circuit are generated.
2. The method according to claim 1, characterized in that The step of generating a first target quantum circuit in response to an input operation of a graphical user interface or an input first quantum instruction comprises: In response to a selection operation on the graphical user interface, determining a target quantum gate; In response to the parameter setting operation on the target quantum gate, the first target quantum circuit is generated.
3. The method according to claim 1, characterized in that Generating a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit includes: Performing transformation processing on the first target quantum circuit to obtain a first target data structure; Parsing the first target data structure to obtain a first target intermediate representation; A second quantum instruction corresponding to the first target quantum circuit is generated according to the first target intermediate representation.
4. The method according to claim 3, characterized in that The parsing the first target data structure to obtain a first target intermediate representation includes: Performing a marking process on the first target data structure to obtain a first target mark; Construct a first abstract syntax tree according to the first target tag; The first abstract syntax tree is converted to obtain the first target intermediate representation.
5. The method according to claim 4, characterized in that The step of constructing a first abstract syntax tree according to the first target tag includes: Obtaining a first initial abstract syntax tree based on a preset grammar, a topological structure of the first target quantum circuit, and the first target tag; The first initial abstract syntax tree is optimized to obtain the first abstract syntax tree.
6. The method according to claim 1, characterized in that The third quantum instruction input in response to the first editing operation on the second quantum instruction or the second editing operation on the first target quantum circuit in the graphical user interface generates a second target quantum circuit and a fourth quantum instruction corresponding to the second target quantum circuit, including: Obtain a second target intermediate representation according to the third quantum instruction; Generate a second abstract syntax tree according to the second target intermediate representation; Obtain a target logical structure and a second target tag according to the second abstract syntax tree; Based on a preset layout algorithm, the second target quantum circuit is generated according to the target logical structure and the second target mark.
7. The method according to claim 1, characterized in that The third quantum instruction input in response to the first editing operation on the second quantum instruction or the second editing operation on the first target quantum circuit in the graphical user interface generates a second target quantum circuit and a fourth quantum instruction corresponding to the second target quantum circuit, including: In response to the second editing operation, generating the second target quantum circuit; Performing transformation processing on the second target quantum circuit to obtain a second target data structure; Parsing the second target data structure to obtain a second target intermediate representation; A fourth quantum instruction corresponding to the second target quantum circuit is generated according to the second target intermediate representation.
8. The method according to claim 1, characterized in that: The method further comprises: Verifying the first quantum instruction based on a preset error repair algorithm; In the case where there is an error in the first quantum instruction, displaying first error information in the first quantum instruction, and providing a first repair suggestion according to the first error information; Based on the preset error repair algorithm, verifying the third quantum instruction; In the case that there is an error in the third quantum instruction, second error information in the third quantum instruction is displayed, and a second repair suggestion is provided according to the second error information.
9. The method according to claim 8, characterized in that The method further comprises: In response to a selection input for the first repair suggestion, repairing the first quantum instruction according to the first repair suggestion; In response to a selection input for the second repair suggestion, repair processing is performed on the third quantum instruction according to the second repair suggestion.
10. The method according to claim 8, characterized in that The method further comprises: Based on the preset error repair algorithm, verifying the first target quantum circuit; In the case where there is an error in the first target quantum circuit, displaying third error information in the first target quantum circuit, and providing a third repair suggestion according to the third error information; Based on the preset error repair algorithm, verifying the second target quantum circuit; In the case where an error exists in the second target quantum circuit, fourth error information in the second target quantum circuit is displayed, and a fourth repair suggestion is provided according to the fourth error information.
11. The method according to claim 10, characterized in that The method further comprises: In response to a selection input for the third repair suggestion, repairing the first target quantum circuit according to the third repair suggestion; In response to a selection input for the fourth repair suggestion, repair processing is performed on the second target quantum circuit according to the fourth repair suggestion.
12. A low-code platform for quantum computing programming, characterized in that: The low-code platform includes a quantum circuit generation module, a quantum instruction generation module, and a quantum circuit editing module; The quantum circuit generation module is configured to generate a first target quantum circuit in response to an input operation of a graphical user interface or an input first quantum instruction; The quantum instruction generation module is configured to generate a second quantum instruction corresponding to the first target quantum circuit according to the first target quantum circuit; The quantum circuit editing module is configured to generate a second target quantum circuit in response to a first editing operation on the second quantum instruction or a second editing operation on the first target quantum circuit in the graphical user interface, and the quantum instruction generation module is configured to generate a fourth quantum instruction corresponding to the second target quantum circuit according to the second target quantum circuit.
Citation Information
Patent Citations
Interface display method and device and interface switching method and device
CN110826720A
Quantum circuit generation method and device, electronic equipment and storage medium
CN118211667A
Intelligent and efficient error detection and repair method and system
CN118656107A
Integrated circuit design using metadata
WO2023163814A1