Quantum circuit visualization editing method, system, electronic device and storage medium
Through the visual editing method and system of quantum circuits, the problem of low quantum circuit design and editing efficiency in the prior art is solved, and a more efficient quantum circuit design and editing process is achieved.
Patent Information
- Application Number
- CN202410535585.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-30
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-04-30
AI Technical Summary
The prior art quantum circuit design and editing in the field of quantum computing have problems of high technical barriers and low efficiency.
It provides a visual editing method and system for quantum circuits. By displaying the editing interface of the quantum operation layer corresponding to the mesh graphics, receiving user editing operations, obtaining the topological structure and operation parts of the quantum circuit, and drawing a mesh graphics on each plane to generate a new mesh graphics.
It simplifies the design and editing process of quantum circuits, lowers the technical threshold, and improves the work efficiency of designers.
Smart Images

Figure CN118313480B_ABST
Abstract
Description
Background Art
[0002] Quantum computing was first proposed by Feynman in the 1980s. It is a method of processing information using the principles of quantum mechanics. Quantum computing has obvious advantages over classical computing in some cases.
[0003] In the field of quantum computing, quantum circuits are often used to represent a series of operations on multiple quantum bits, where quantum bits (qubits) are the objects of quantum operations. In quantum circuits, they are represented by lines extending from left to right, with each line segment corresponding to a quantum bit. The squares, dots, vertical lines and other graphics drawn on the line segments represent quantum operations, which are executed from left to right. Many quantum algorithms and quantum programs can be described using such quantum circuits.
[0004] With the development of quantum computing hardware, a variety of quantum computing hardware implementations have emerged, namely quantum processors (QPUs). The above-mentioned quantum bits are stored in a physical structure in the quantum processor that can maintain the quantum state. There are physical connections between the multiple physical structures mentioned above, which are used to implement quantum operations involving multiple quantum bits.
[0005] Due to the difficulty of process and design, these physical structures and physical connections are usually arranged on a two-dimensional plane. For example, in a superconducting quantum chip, the above physical structures and physical connections are constructed on the two-dimensional surface of the substrate by etching and deposition. We call this type of quantum processor a "two-dimensional topological structure."
[0006] At present, quantum circuits are often designed and edited through low-level methods such as mathematics, which has problems of high technical barriers and low efficiency. Summary of the invention
[0007] The technical problem to be solved by the present invention is to address the deficiencies of the prior art and specifically provide a method, system, electronic device and storage medium for visual editing of quantum circuits, as follows:
[0008] 1) In the first aspect, the present invention provides a method for visual editing of quantum circuits, and the specific technical solution is as follows:
[0009] When any mesh graph is selected, an editing interface of a quantum operation layer corresponding to the mesh graph is displayed, and an editing operation of a user on the editing interface of the quantum operation layer corresponding to the mesh graph is received, wherein a topological structure part and a quantum operation part of a quantum circuit are obtained; a mesh graph corresponding to the topological structure part is drawn on each plane, each quantum operation layer in the quantum operation part corresponds to a plane, and nodes in the mesh graph represent quantum bits, and any two connected nodes represent that there is a connection relationship between the quantum bits corresponding to the two nodes;
[0010] When there is no mesh graphic, the quantum operation layer editing interface is displayed, and the user's editing operation on the quantum operation layer editing interface is received to generate a new mesh graphic.
[0011] The beneficial effects of the visual editing method of quantum circuits provided by the present invention are as follows:
[0012] When any mesh graphic is selected, the editing interface of the quantum operation layer corresponding to the mesh graphic is displayed, and the user's editing operations on the editing interface of the quantum operation layer corresponding to the mesh graphic are received. When the mesh graphic does not exist, the quantum operation layer editing interface is displayed, and the user's editing operations on the quantum operation layer editing interface are received to generate a new mesh graphic, which is more helpful for designers to design and edit quantum circuits.
[0013] Based on the above solution, the visual editing method of a quantum circuit of the present invention can also be improved as follows.
[0014] Furthermore, it also includes:
[0015] When any node in any mesh graph is selected, the editing interface of the quantum bit corresponding to the node is displayed, and the user's editing operation on the editing interface is received.
[0016] Furthermore, it also includes:
[0017] When a connection mark between any two nodes in any mesh graph is selected, an editing interface of the connection mark is displayed, and an editing operation of the user on the editing interface of the connection mark is received.
[0018] Furthermore, when a connection mark between any two nodes in any mesh graph is selected, an editing interface for editing the quantum bits corresponding to the two nodes is also displayed, and the user's editing operation on the editing interface is received.
[0019] 2) In the second aspect, the present invention also provides a visual editing system for quantum circuits, and the specific technical solution is as follows:
[0020] Includes mesh graphics editing module and quantum operation layer editing module;
[0021] The mesh graphics editing module is used to: when any mesh graphics is selected, display the editing interface of the quantum operation layer corresponding to the mesh graphics, and receive the editing operation of the user on the editing interface of the quantum operation layer corresponding to the mesh graphics, wherein the topological structure part and the quantum operation part of the quantum circuit are obtained; draw a mesh graphics corresponding to the topological structure part on each plane, each quantum operation layer in the quantum operation part corresponds to a plane respectively, the nodes in the mesh graphics represent quantum bits, and any two connected nodes represent: there is a connection relationship between the quantum bits corresponding to the two nodes respectively;
[0022] The quantum operation layer editing module is used to: when there is no mesh graphic, display the quantum operation layer editing interface, receive the user's editing operation on the quantum operation layer editing interface, and generate a new mesh graphic.
[0023] Based on the above solution, the visual editing system of quantum circuits of the present invention can also be improved as follows.
[0024] Furthermore, it also includes a node editing module, which is used to: when any node in any mesh graph is selected, display the editing interface of the node and receive the user's editing operation on the editing interface of the node.
[0025] Furthermore, it also includes a connection identifier editing module, which is used to: when a connection identifier between any two nodes in any mesh graph is selected, display the editing interface of the connection identifier and receive the user's editing operation on the editing interface of the connection identifier.
[0026] Furthermore, the connection identifier editing module is also used to: when a connection identifier between any two nodes in any mesh graph is selected, an editing interface for editing the quantum bits corresponding to the two nodes is displayed, and the user's editing operations on the editing interface are received.
[0027] 3) In a third aspect, the present invention further provides an electronic device, comprising a processor, the processor being coupled to a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor, so that the electronic device can implement any of the above-mentioned methods for visually editing quantum circuits.
[0028] 4) In a fourth aspect, the present invention further provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is loaded and executed by a processor so that a computer implements any of the above-mentioned visualization editing methods of quantum circuits.
[0029] It should be noted that the beneficial effects achieved by the technical solutions of the second to fourth aspects of the present invention and the corresponding possible implementation methods can be found in the above-mentioned technical effects of the first aspect and its corresponding possible implementation methods, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0031] Figure 1 A schematic diagram of a flow chart of a method for visually editing a quantum circuit according to an embodiment of the present invention;
[0032] Figure 2 An editing interface for setting up a single qubit;
[0033] Figure 3 This is the expanded editing interface for setting up a single qubit;
[0034] Figure 4 To show an example of "I";
[0035] Figure 5 To show an example of a single qubit name;
[0036] Figure 6 One of the examples showing "-";
[0037] Figure 7 This is the effect when a node is selected;
[0038] Figure 8 This is the effect when the connection mark is selected;
[0039] Fig. 9 This is the effect when the mouse hovers over a node;
[0040] Fig.10 This is the effect when the mouse hovers over the connection logo;
[0041] Fig.11 To set up the editing interface for dual qubits;
[0042] Fig.12 The expanded editing interface for setting up dual qubits;
[0043] Fig.13 To show an example of "II";
[0044] Fig.14 To show an example of the names of two qubits;
[0045] Fig.15 This is the second example showing “-”;
[0046] Fig.16 This is the third example showing “-”;
[0047] Fig.17 This is a schematic diagram before commutation;
[0048] Fig.18 This is the schematic diagram after commutation;
[0049] Fig.19 A schematic diagram of the structure of a visual editing system for quantum circuits according to an embodiment of the present invention;
[0050] Fig. 20 The figure is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0052] like Figure 1 As shown, a method for visual editing of a quantum circuit according to an embodiment of the present invention comprises the following steps:
[0053] S1. When any mesh graph is selected, an editing interface of a quantum operation layer corresponding to the mesh graph is displayed, and an editing operation of a user on the editing interface of the quantum operation layer corresponding to the mesh graph is received, wherein a topological structure part and a quantum operation part of a quantum circuit are obtained; a mesh graph corresponding to the topological structure part is drawn on each plane, each quantum operation layer in the quantum operation part corresponds to a plane, and nodes in the mesh graph represent quantum bits, and any two connected nodes represent that there is a connection relationship between the quantum bits corresponding to the two nodes;
[0054] Among them, the selection process of the mesh graphics is described as follows:
[0055] The user can change the selection state of the mesh graphic by clicking anywhere on the mesh graphic with the mouse. Specifically, when the user clicks, if the mesh graphic is currently in an unselected state, the mesh graphic switches to a selected state; if the mesh graphic is currently in a selected state, the mesh graphic switches to an unselected state. It should be noted that there is a corresponding relationship between the mesh graphic and the quantum operation layer. When any mesh graphic is selected, it is equivalent to selecting the quantum operation layer corresponding to the mesh graphic.
[0056] Optionally, the user can only select one mesh graphic at a time, and when the user selects any mesh graphic, the other mesh graphics automatically become unselected. When the user clicks a blank space on the preview interface for previewing the mesh graphics, all mesh graphics become unselected.
[0057] Optionally, when the user selects any mesh graphic, the mesh graphic and the plane where the mesh graphic is located become highlighted. At the same time, the preview interface automatically adjusts the field of view so that the selected mesh graphic is approximately located in the middle.
[0058] Optionally, when the user selects any mesh graphic, the editing interface of the selected mesh graphic will be displayed in the information bar on the right. The user can perform various operations through the buttons on the editing interface, including but not limited to: selecting the mesh graphic corresponding to the previous quantum operation layer of the quantum operation layer corresponding to the mesh graphic, selecting the mesh graphic corresponding to the next quantum operation layer of the quantum operation layer corresponding to the mesh graphic, inserting a mesh graphic corresponding to an empty quantum operation layer before selecting the quantum operation layer corresponding to the mesh graphic, inserting a mesh graphic corresponding to an empty quantum operation layer after selecting the quantum operation layer corresponding to the mesh graphic, and deleting the selected mesh graphic, where the empty quantum operation layer refers to a quantum operation layer that does not contain any quantum operation.
[0059] Optionally, when the user selects any mesh graphic, the information interface of the selected mesh graphic will also be displayed in the right information bar, and the information interface may include information such as editing time and editing user.
[0060] S2. When there is no mesh graphic, the quantum operation layer editing interface is displayed, and the user's editing operation on the quantum operation layer editing interface is received to generate a new mesh graphic.
[0061] That is to say, when the number of quantum operation layers is 0, that is, the number of mesh graphics is 0, the user cannot select any mesh graphics. At this time, the user cannot perform the above-mentioned editing operation on the quantum operation layer corresponding to the mesh graphics. In view of this situation, the present invention displays a quantum operation layer editing interface, and the user can edit through the quantum operation layer editing interface, such as adding a quantum operation layer and editing the added quantum operation layer, and generate a new mesh graphics according to the newly generated quantum operation layer. In another embodiment, the added quantum operation layer may be an empty quantum operation layer that does not contain any quantum operation.
[0062] In a method for visually editing a quantum circuit according to an embodiment of the present invention, when any mesh graphic is selected, an editing interface of a quantum operation layer corresponding to the mesh graphic is displayed, and editing operations performed by a user on the editing interface of the quantum operation layer corresponding to the mesh graphic are received; when no mesh graphic exists, a quantum operation layer editing interface is displayed, and editing operations performed by a user on the editing interface of the quantum operation layer are received, and a new mesh graphic is generated, which is more helpful for designers to design and edit quantum circuits.
[0063] Optionally, in the above technical solution, it also includes:
[0064] When any node in any mesh graph is selected, the editing interface of the quantum bit corresponding to the node is displayed, and the user's editing operation on the editing interface is received. The editing interface of the quantum bit corresponding to the node is used to realize the interaction between the user and the quantum circuit. The following operations can be realized through the editing interface of the quantum bit corresponding to the node:
[0065] The user can change the selection state of any node by clicking the mouse. Specifically: when the user clicks any node, if the node is currently in an unselected state, the node becomes selected; if the node is currently in a selected state, the node becomes unselected. It should be noted that there is a corresponding relationship between nodes and quantum bits. When any node is selected, it is equivalent to selecting the quantum bit corresponding to the node.
[0066] Optionally, the user can only select one node at a time. When the user selects any node, the other nodes automatically become unselected.
[0067] Optionally, considering that the node is part of a mesh graph, when the user clicks on any node, it is not regarded as clicking on the mesh graph where the node is located, that is, the above-mentioned editing operation on the mesh graph is not performed, but the above-mentioned editing operation on the node is performed.
[0068] Optionally, when the user selects any node, an information interface corresponding to the node is also displayed, and the information interface may include information such as editing time and editing user.
[0069] The editing interface of the quantum bit corresponding to the node can be called: an editing interface for setting a single quantum bit (one quantum bit). The user can edit the single quantum bit through the editing interface for setting a single quantum bit. Specifically:
[0070] 1) The editing interface for setting a single quantum bit includes a radio button, which is recorded as the first radio button. The first radio button will display the relevant information of the quantum bit corresponding to the node selected by the user, and allow the user to expand the option menu and select an item from it. The option menu contains multiple options, each of which corresponds to an available single quantum bit, such as Figure 2 and Figure 3 shown.
[0071] The content displayed in the first radio button is calculated by the following logic: traverse all quantum operations in each quantum operation layer, and if no quantum operation involves the quantum bit corresponding to the selected node, "I" is displayed (I stands for Identity, indicating that no operation is performed); if only one single quantum bit operation involves the selected quantum bit, the name of the single quantum bit operation is displayed; in other cases, "-" is displayed, such as Figures 4 to 6 shown.
[0072] After the user expands the option menu and selects an item: all quantum operations in the quantum operation layer are traversed, all quantum operations involving the selected quantum bit (whether single-qubit operations or double-qubit operations) are deleted, and then quantum operations of the type selected by the user that act on the selected quantum bit are re-added.
[0073] When the user selects an item, if the first radio button is in the state of displaying "-", it means that there is a conflict in this setting, which may not be the user's intention. A dialog box (or other form) is required to prompt the user and execute the above logic after confirmation.
[0074] If the user selects a quantum operation that contains parameters (such as an Rx gate), the user needs to fill in the parameters in a dialog box (or other form), and the subsequent logic will be executed only after the parameters are filled in.
[0075] When the quantum bit selected by the user is in a faulty state, the first radio button is in an unavailable state.
[0076] Optionally, when the user selects any node, the selected node becomes highlighted. At the same time, the nodes at the corresponding positions in the mesh graph corresponding to other quantum operation layers also become weaker highlighted, thereby giving the user a visual prompt and facilitating position comparison between different planes, such as Figure 7 shown.
[0077] Optionally, in the above technical solution, it also includes:
[0078] When a connection mark between any two nodes in any mesh graph is selected, the editing interface of the connection mark is displayed, and the user's editing operation on the editing interface of the connection mark is received. Through the editing interface of the connection mark, the quantum circuit and the user can interact. The following operations can be implemented through the editing interface of the connection mark:
[0079] The user can click on any connection mark with the mouse to change the selected state of the connection mark. Specifically, when the user clicks on any connection mark, if the connection mark is currently in an unselected state, the connection mark becomes selected; if the connection mark is currently in a selected state, the connection mark becomes unselected. Two nodes connected by a connection mark indicate that there is a connection relationship between the quantum bits corresponding to the two nodes. The connection mark can be specifically represented by a double straight line, a rectangle or a single straight line.
[0080] Optionally, the user can only select one connection identifier at a time. When the user selects any connection identifier, the other connection identifiers are automatically turned into an unselected state.
[0081] Optionally, the user can only select one node or one connection identifier at a time. When the user selects any node, the other nodes and all connection identifiers are automatically turned to an unselected state, and when the user selects any connection identifier, the other connection identifiers and all nodes are automatically turned to an unselected state.
[0082] Optionally, considering that the connection logo is part of the mesh graphic, when the user clicks on any connection logo, it is not regarded as clicking on the mesh graphic where the connection logo is located, that is, the above-mentioned editing operation on the connection logo is not performed, but the above-mentioned editing operation on the connection logo is performed.
[0083] Optionally, when the user selects any connection mark, the selected connection mark becomes highlighted. At the same time, the connection marks at corresponding positions in the mesh graph corresponding to other quantum operation layers also become weaker highlighted, thereby giving the user a visual prompt and facilitating position comparison between different planes.
[0084] Optionally, when the user selects any connection identifier, an information interface corresponding to the connection identifier is also displayed, and the information interface may include information such as editing time and editing user.
[0085] Optionally, when the user selects any connection mark, the selected connection mark becomes highlighted, and the two nodes connected by the connection mark also become highlighted, indicating that the editing operation of the connection mark will affect the two qubits at the same time, such as Figure 8 shown.
[0086] Optionally, when a node or a connection mark is selected, the mesh graph can be selected at the same time, that is, when the mesh graph is selected by clicking repeatedly, the node or the connection mark will not be deselected.
[0087] Optionally, when the user hovers the mouse over any node or any connection mark, similar to the effect of selection, the node or connection mark will change to a hover highlight style as a visual prompt, and the nodes or connection marks at the same position in other mesh graphics will also change to a hover highlight style at the same time, so that the user can compare the positions between different mesh graphics. Fig. 9 and Fig.10 shown.
[0088] Optionally, in the above technical solution, it also includes:
[0089] When the connection mark between any two nodes in any mesh graph is selected, an editing interface for editing the quantum bits corresponding to the two nodes is also displayed, and the user's editing operation on the editing interface is received. The editing interface for editing the quantum bits corresponding to the two nodes connected by the connection mark can be called an editing interface for setting double quantum bits. The following operations can be implemented through the editing interface:
[0090] The editing interface for setting the double quantum bit includes a radio button (referred to as the second radio button) and a reversing button. Specifically:
[0091] 1) The second radio button will display the information about the double quantum bit selected by the user (the two quantum bits connected by the selected connection mark), and allow the user to expand the option menu and select an item from it. The option menu contains multiple options, each of which corresponds to an available double quantum bit, such as Fig.11 and Fig.12 shown.
[0092] The content displayed in the second radio button is calculated by the following logic: traverse all qubits in this layer. If no quantum operation involves the qubits at both ends of the connection of the selected qubit, "II" is displayed (two I's, i.e. two identities, indicating that no operation is performed on the two qubits); if only one double qubit happens to involve these two qubits, the name of the double qubit is displayed; in other cases, "-" is displayed, such as Figures 13 to 16 shown.
[0093] When the user expands the options menu and selects an option: iterates through all quantum operations in the layer, removes all quantum operations involving qubits at both ends of the selected qubit connection (whether single-qubit or two-qubit), and then re-adds two-qubit quantum operations of the type selected by the user acting on the selected qubit connection. This ensures that gates within the same layer can be parallelized.
[0094] When the user selects an item, if the second radio button is in a state of displaying "-", it means that there is a conflict in this setting, which may not be the user's intention. A dialog box (or other form) is required to prompt the user and execute the above logic after confirmation.
[0095] If the user selects a quantum operation that contains parameters (such as a CRx gate), the user needs to fill in the parameters in a dialog box (or other form), and the subsequent logic will be executed only after the parameters are filled in.
[0096] 2) The reversal button is used to conveniently switch the direction of the two-qubit operation (there are two directions). The effect of the reversal button is to reverse the direction of the two-qubit operation involving the selected qubit. If the second radio button is in the state of displaying "II" and "-", the reversal button is in an unavailable state. Fig.17 and Fig.18 shown.
[0097] When the qubit connection selected by the user is in a faulty state or any one of the two qubits connected by the qubit connection is in a faulty state, the second radio button and the reversing button are both in an unavailable state.
[0098] Optionally, it also includes: organizing the quantum circuits.
[0099] In order to facilitate users to organize the entire quantum circuit, the present invention also provides a compact arrangement operation, which can be triggered by users by clicking a button or a shortcut key. This operation can move each quantum operation to the front quantum operation layer as much as possible without changing the semantics of the entire quantum circuit, and can execute as many quantum operations as possible in parallel to make the entire quantum circuit more compact. The specific implementation steps are as follows:
[0100] S101, starting from the second quantum operation layer in the quantum circuit, traverse each quantum operation layer in sequence backward, and traverse each quantum operation in each quantum operation layer. During the traversal process, perform the following steps:
[0101] a) The currently traversed quantum operation layer is recorded as the Lth layer, and the currently traversed quantum operation is recorded as O;
[0102] b) In the L-1th layer, determine whether there is a quantum operation (either a single-qubit operation or a double-qubit operation) at the corresponding position of O;
[0103] c) If there is no quantum operation (either single-qubit operation or double-qubit operation) at the corresponding position of O in the L-1th layer, then O is moved to the corresponding position in the L-1th layer (i.e., the corresponding position of O in the L-1th layer); if there is a quantum operation at the corresponding position of O in the L-1th layer, then O is not moved;
[0104] S102, repeatedly executing S101 until no quantum operation is moved;
[0105] S103. Clear the quantum operation layer that does not contain any quantum operation to obtain a sorted quantum circuit.
[0106] In the above embodiments, although the steps are numbered S1, S2, etc., these are only specific embodiments given by the present invention. Those skilled in the art may adjust the execution order of S1, S2, etc. according to actual conditions, which is also within the protection scope of the present invention. It can be understood that in some embodiments, some or all of the above embodiments may be included.
[0107] like Fig.19 As shown, a quantum circuit visualization editing system 200 according to an embodiment of the present invention includes a mesh graphics editing module 201 and a quantum operation layer editing module 202;
[0108] The mesh graph editing module 201 is used to: when any mesh graph is selected, display the editing interface of the quantum operation layer corresponding to the mesh graph, and receive the editing operation of the user on the editing interface of the quantum operation layer in the mesh graph, wherein the topological structure part and the quantum operation part of the quantum circuit are obtained; a mesh graph corresponding to the topological structure part is drawn on each plane, each quantum operation layer in the quantum operation part corresponds to a plane respectively, the nodes in the mesh graph represent quantum bits, and any two connected nodes represent that: there is a connection relationship between the quantum bits corresponding to the two nodes respectively;
[0109] The quantum operation layer editing module 202 is used to: when there is no mesh graphic, display the quantum operation layer editing interface, receive the user's editing operation on the quantum operation layer editing interface, and generate a new mesh graphic.
[0110] Optionally, the above technical solution further includes a node editing module, which is used to: when any node in any mesh graph is selected, display the editing interface of the node and receive the user's editing operation on the editing interface of the node.
[0111] Optionally, the above technical solution also includes a connection identifier editing module, which is used to: when a connection identifier between any two nodes in any mesh graph is selected, display the editing interface of the connection identifier and receive the user's editing operations on the editing interface of the connection identifier.
[0112] Optionally, in the above technical solution, the connection identifier editing module is also used to: when the connection identifier between any two nodes in any mesh graph is selected, an editing interface for editing the quantum bits corresponding to the two nodes is displayed, and the user's editing operations on the editing interface are received.
[0113] It should be noted that the beneficial effects of the visual editing system 200 of a quantum circuit provided in the above embodiment are the same as the beneficial effects of the visual editing method of a quantum circuit provided in the above embodiment, which will not be described in detail here. In addition, when the system provided in the above embodiment realizes its functions, only the division of the above functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the system can be divided into different functional modules according to actual conditions to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be described in detail here.
[0114] like Fig. 20As shown, an electronic device 300 according to an embodiment of the present invention includes a processor 320, the processor 320 is coupled to a memory 310, and the memory 310 stores at least one computer program 330, and the at least one computer program 330 is loaded and executed by the processor 320, so that the electronic device 300 implements any of the above-mentioned visualization editing methods of quantum circuits, specifically:
[0115] The electronic device 300 may have relatively large differences due to different configurations or performances, and may include one or more processors 320 (Central Processing Units, CPU) and one or more memories 310, wherein at least one computer program 330 is stored in the one or more memories 310, and the at least one computer program 330 is loaded and executed by the one or more processors 320, so that the electronic device 300 implements any of the visual editing methods of quantum circuits provided in the above embodiments. Of course, the electronic device 300 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The electronic device 300 may also include other components for realizing the functions of the device, which will not be described in detail here. The electronic device may specifically be a computer, etc.
[0116] A computer-readable storage medium according to an embodiment of the present invention stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that a computer implements any of the above-mentioned visualization editing methods for quantum circuits.
[0117] Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0118] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes any of the above-mentioned visualization editing methods for quantum circuits.
[0119] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects and represent the definition of a specific order or sequence. The order of use of similar objects can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than the order shown or described.
[0120] Those skilled in the art know that the present invention can be implemented as a system, method or computer program product. Therefore, the present invention can be specifically implemented in the following forms, namely: it can be complete hardware, it can be complete software (including firmware, resident software, microcode, etc.), or it can be a combination of hardware and software, which is generally referred to as "circuit", "module" or "system" herein. In addition, in some embodiments, the present invention can also be implemented in the form of a computer program product in one or more computer-readable media, and the computer-readable medium contains computer-readable program code.
[0121] Any combination of one or more computer-readable media can be used. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0122] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for visual editing of quantum circuits, characterized in that: include: When any mesh graph is selected, an editing interface of a quantum operation layer corresponding to the mesh graph is displayed, and an editing operation of a user on the editing interface of the quantum operation layer corresponding to the mesh graph is received, wherein a topological structure part and a quantum operation part of a quantum circuit are obtained; a mesh graph corresponding to the topological structure part is drawn on each plane, each quantum operation layer in the quantum operation part corresponds to a plane, and nodes in the mesh graph represent quantum bits, and any two connected nodes represent that there is a connection relationship between the quantum bits corresponding to the two nodes; When there is no mesh graphic, the quantum operation layer editing interface is displayed, and the user's editing operation on the quantum operation layer editing interface is received to generate a new mesh graphic; It also includes: organizing quantum circuits, specifically: S101, starting from the second quantum operation layer in the quantum circuit, traverse each quantum operation layer in sequence backward, and traverse each quantum operation in each quantum operation layer. During the traversal process, perform the following steps: a) The currently traversed quantum operation layer is recorded as the Lth layer, and the currently traversed quantum operation is recorded as O; b) In the L-1th layer, determine whether there is a quantum operation at the corresponding position of O; c) If there is no quantum operation at the corresponding position of O in the L-1th layer, O is moved to the corresponding position in the L-1th layer; if there is a quantum operation at the corresponding position of O in the L-1th layer, O is not moved; S102, repeatedly executing S101 until no quantum operation is moved; S103. Clear the quantum operation layer that does not contain any quantum operation to obtain a sorted quantum circuit.
2. A method for visual editing of quantum circuits according to claim 1, characterized in that: Also includes: When any node in any mesh graph is selected, the editing interface of the quantum bit corresponding to the node is displayed, and the user's editing operation on the editing interface is received.
3. A method for visual editing of quantum circuits according to claim 1, characterized in that: Also includes: When a connection mark between any two nodes in any mesh graph is selected, an editing interface of the connection mark is displayed, and an editing operation of the user on the editing interface of the connection mark is received.
4. A method for visual editing of quantum circuits according to claim 3, characterized in that: When the connection marks between any two nodes in any mesh graph are selected, an editing interface for editing the quantum bits corresponding to the two nodes is also displayed, and the user's editing operations on the editing interface are received.
5. A visual editing system for quantum circuits, characterized in that: Includes mesh graphics editing module and quantum operation layer editing module; The mesh graph editing module is used to: when any mesh graph is selected, display an editing interface of a quantum operation layer corresponding to the mesh graph, and receive an editing operation of a user on the editing interface of the quantum operation layer corresponding to the mesh graph, wherein a topological structure part and a quantum operation part of a quantum circuit are obtained; a mesh graph corresponding to the topological structure part is drawn on each plane, each quantum operation layer in the quantum operation part corresponds to a plane, and nodes in the mesh graph represent quantum bits, and any two connected nodes represent that there is a connection relationship between the quantum bits corresponding to the two nodes; The quantum operation layer editing module is used to: when there is no mesh graphic, display the quantum operation layer editing interface, receive the user's editing operation on the quantum operation layer editing interface, and generate a new mesh graphic; It also includes: organizing quantum circuits, specifically: S101, starting from the second quantum operation layer in the quantum circuit, traverse each quantum operation layer in sequence backward, and traverse each quantum operation in each quantum operation layer. During the traversal process, perform the following steps: a) The currently traversed quantum operation layer is recorded as the Lth layer, and the currently traversed quantum operation is recorded as O; b) In the L-1th layer, determine whether there is a quantum operation at the corresponding position of O; c) If there is no quantum operation at the corresponding position of O in the L-1th layer, O is moved to the corresponding position in the L-1th layer; if there is a quantum operation at the corresponding position of O in the L-1th layer, O is not moved; S102, repeatedly executing S101 until no quantum operation is moved; S103. Clear the quantum operation layer that does not contain any quantum operation to obtain a sorted quantum circuit.
6. A quantum circuit visualization editing system according to claim 5, characterized in that: It also includes a node editing module, which is used to: when any node in any mesh graph is selected, display the editing interface of the node and receive the user's editing operation on the editing interface of the node.
7. A quantum circuit visualization editing system according to claim 5, characterized in that: It also includes a connection identifier editing module, which is used to: when a connection identifier between any two nodes in any mesh graph is selected, display the editing interface of the connection identifier and receive the user's editing operation on the editing interface of the connection identifier.
8. A quantum circuit visualization editing system according to claim 7, characterized in that: The connection identifier editing module is also used to: when a connection identifier between any two nodes in any mesh graph is selected, an editing interface for editing the quantum bits corresponding to the two nodes is displayed, and the user's editing operations on the editing interface are received.
9. An electronic device, characterized in that: The electronic device includes a processor, the processor is coupled to a memory, at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor so that the electronic device implements a visual editing method for a quantum circuit as claimed in any one of claims 1 to 4.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that a computer implements a method for visually editing a quantum circuit as claimed in any one of claims 1 to 4.
Citation Information
Patent Citations
Method, system, computer and medium for graphical preview of quantum circuit
CN117763180A