Method, system, computer and medium for graphical preview of quantum circuit

By drawing the topological structure of quantum circuits into mesh graphics and visualizing them, the problem that the existing technology is difficult to reflect the two-dimensional topological structure of quantum processors is solved, and better quantum circuit design and understanding are achieved.

CN117763180BActive Publication Date: 2025-04-08BEIJING ZHONGKE ARCLIGHT QUANTUM SOFTWARE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311714942.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-13
Publication Date
2025-04-08
Estimated Expiration
2043-12-13

AI Technical Summary

Technical Problem

The prior art is difficult to effectively reflect the two-dimensional topology of quantum processors, which leads to difficulties in designing and understanding quantum circuits.

Method used

By obtaining the topological structure part and quantum operation part of the quantum circuit, the mesh graph corresponding to the topological structure is drawn on each plane, the nodes represent qubits, and the connection relationship represents the connection between qubits, and then visualize it to reflect the two-dimensional topological structure of the quantum circuit.

Benefits of technology

This method can well reflect the two-dimensional topology of quantum circuits, help design and understand quantum circuits, and improve design efficiency and difficulty of understanding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117763180B_ABST
    Figure CN117763180B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, system, computer and medium for graphical preview of quantum circuits, and relates to the field of quantum circuit graphical technology. The method comprises: obtaining the topological structure part and the quantum operation part of the quantum circuit; drawing a mesh graph corresponding to the topological structure part on each plane, wherein each quantum operation layer in the quantum operation part corresponds to a plane respectively, and 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; visualizing multiple planes with mesh graphs drawn thereon, and obtaining a visualized graph corresponding to the quantum circuit. The present invention can well reflect the two-dimensional topological structure of the quantum circuit, and is helpful for the staff to design and understand the quantum circuit.
Need to check novelty before this filing date? Find Prior Art

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, so quantum computing is considered a revolutionary technology.

[0003] In the field of quantum computing, quantum circuits are often used to represent a series of operations on multiple quantum bits, such as Figure 1 As shown in the figure. Among them, the quantum bit (qubit) is the object of quantum operation, which is represented by a line segment extending from left to right in the quantum circuit, and each line segment corresponds to a quantum bit. The squares, dots, vertical lines and other graphics drawn on the line segment represent quantum operations, and the execution order of quantum operations is from left to right. Many quantum algorithms and quantum programs can be described by 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] When using Figure 1 When the quantum circuit is represented in the way shown, the quantum bits are only arranged vertically in one dimension, which cannot well reflect the two-dimensional topological structure of the quantum processor, causing certain difficulties in designing and understanding the quantum circuit. 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, computer and medium for graphical preview of quantum circuits, as follows:

[0008] 1) In the first aspect, the present invention provides a method for graphical preview of a quantum circuit, and the specific technical solution is as follows:

[0009] Obtain the topological structure part and quantum operation part of the quantum circuit;

[0010] Draw a mesh graph corresponding to the topological structure part on each plane, wherein each quantum operation layer in the quantum operation part corresponds to a plane, and 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;

[0011] A plurality of planes on which mesh graphics are drawn are visualized to obtain visualization graphics corresponding to the quantum circuit.

[0012] The beneficial effects of the method for graphical preview of quantum circuits provided by the present invention are as follows:

[0013] Obtain the topological structure part and quantum operation part of the quantum circuit, draw a mesh graph corresponding to the topological structure part on the plane corresponding to each layer of quantum operation in the quantum operation part, and then visualize it. This can well reflect the two-dimensional topological structure of the quantum circuit and help staff design and understand the quantum circuit.

[0014] Based on the above solution, the method for graphical preview of a quantum circuit of the present invention can be further improved as follows.

[0015] Further, visualizing a plurality of planes on which mesh graphics are drawn to obtain a visualized graphic corresponding to the quantum circuit, further comprising:

[0016] A plurality of planes on which mesh graphics are drawn are tiled to obtain a two-dimensional visualized graphic obtained by tiling the plurality of planes on which mesh graphics are drawn.

[0017] Further, multiple planes with mesh graphics drawn thereon are visualized to obtain visualization graphics corresponding to the quantum circuit, including:

[0018] A plurality of planes on which mesh graphics are drawn are stacked to obtain a two-dimensional visualized graphic obtained by stacking the plurality of planes on which mesh graphics are drawn.

[0019] Furthermore, a plurality of planes on which mesh graphics are drawn are stacked to obtain a two-dimensional visualized graphic obtained by stacking the plurality of planes on which mesh graphics are drawn, including:

[0020] Calculate the coordinates of each preset key point of each element in each plane drawn with mesh graphics in the three-dimensional coordinate system, then calculate the two-dimensional coordinates of each preset key point of each element projected onto the screen according to the preset camera parameters, and draw a two-dimensional visualization graphic by stacking multiple planes drawn with mesh graphics based on the two-dimensional coordinates of each preset key point of each element projected onto the screen.

[0021] 2) In the second aspect, the present invention also provides a system for graphical preview of quantum circuits, and the specific technical solution is as follows:

[0022] Includes acquisition module, drawing module and visualization module;

[0023] The acquisition module is used to: acquire the topological structure part and the quantum operation part of the quantum circuit;

[0024] The drawing module is used to draw a mesh graph corresponding to the topological structure part on each plane, wherein each quantum operation layer in the quantum operation part corresponds to a plane, and 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.

[0025] The visualization module is used to visualize a plurality of planes on which mesh graphics are drawn, and obtain visualization graphics corresponding to the quantum circuit.

[0026] Based on the above solution, the system for graphical preview of quantum circuits of the present invention can be improved as follows.

[0027] Furthermore, the visualization module is specifically used to: tile multiple planes with mesh graphics drawn on them, to obtain a two-dimensional visualization graphic after tiling multiple planes with mesh graphics drawn on them.

[0028] Furthermore, the visualization module is also specifically used to: stack multiple planes with mesh graphics drawn on them to obtain a two-dimensional visualization graphic obtained by stacking multiple planes with mesh graphics drawn on them.

[0029] Furthermore, the visualization module is also specifically used to: calculate the coordinates of each preset key point of each element in each plane drawn with a mesh graphic in the three-dimensional coordinate system, and then calculate the two-dimensional coordinates of each preset key point of each element projected onto the screen according to the preset camera parameters; based on the two-dimensional coordinates of each preset key point of each element projected onto the screen, draw a two-dimensional visualization graphic that is a stack of multiple planes drawn with mesh graphics.

[0030] 3) In a third aspect, the present invention further provides a computer 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 computer device implements any of the above-mentioned methods for graphical preview of quantum circuits.

[0031] 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 to enable a computer to implement any of the above-mentioned methods for graphical preview of quantum circuits.

[0032] 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

[0033] 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:

[0034] Figure 1 is an example of a quantum circuit;

[0035] Figure 2 A schematic flow chart of a method for graphical preview of a quantum circuit according to an embodiment of the present invention;

[0036] Figure 3 This is an example of the display effect of circular nodes and rectangular connections;

[0037] Figure 4 is a schematic diagram of the stacking mode;

[0038] Figure 5 This is a schematic diagram of the tiling mode;

[0039] Figure 6 A schematic diagram of a flow chart of a system for graphical preview of a quantum circuit according to an embodiment of the present invention;

[0040] Figure 7 The figure is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0041] 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.

[0042] like Figure 2 As shown, a method for graphical preview of a quantum circuit according to an embodiment of the present invention comprises the following steps:

[0043] S1. Obtain the topological structure part and quantum operation part of the quantum circuit;

[0044] In order to display the quantum circuit graphically, we first need to convert the quantum circuit into a topological structure part and a quantum operation part. The data structures of the topological structure part and the quantum operation part are shown in Table 1.

[0045] Table 1:

[0046]

[0047] The topological structure part and quantum operation part are explained as follows:

[0048] 1) The topological structure part describes the specific two-dimensional topological structure of the quantum circuit, wherein the quantum circuit is generated for a preset type of quantum processor, and the specific two-dimensional topological structure of the quantum circuit can be determined according to the preset type of quantum processor. The type of quantum processor is the existing technology and no additional explanation is given. The topological structure part specifically includes the quantum bits that can execute operations and the quantum bit connections.

[0049] A qubit is a physical structure in a quantum processor that can maintain a quantum state. The "qubit ID" is a unique identifier for all qubits in the quantum processor. The "qubit position" is a two-dimensional coordinate, which usually reflects the actual position of the qubit in the quantum processor to a certain extent. When drawing the visualization corresponding to the quantum circuit, it is used to determine the position of each preset key point of each element, that is, the coordinates of each preset key point of each element in the three-dimensional coordinate system.

[0050] A qubit connection is a physical structure in a quantum processor that connects two qubits. The "id of a qubit connection" is a unique identifier for all qubit connections in that quantum processor. The "id of the qubit connected at one end" and the "id of the qubit connected at the other end" are the ids of the two qubits that the qubit connection connects.

[0051] "Whether a qubit is faulty" describes the fault condition of the qubit, and "Whether a qubit connection is faulty" describes the fault condition of the qubit connection. That is, the data structure of the topology part can also describe the fault condition of the quantum computing hardware, including the fault of the qubit and the fault of the qubit connection. When a qubit is faulty, a two-qubit gate involving the qubit cannot be applied, so the qubit connection connected to the qubit is also considered to be faulty.

[0052] The data structure of the topology part can also save other information about quantum bits and quantum bit connections, so that it can adapt to more needs.

[0053] 2) The quantum operation part describes the quantum operations contained in the quantum circuit. In the data structure of the quantum operation part, multiple quantum operations in the quantum circuit are divided into several quantum operation layers, and each quantum operation layer contains a set of quantum operations that can be executed in parallel in theory.

[0054] The data structure of the quantum operation part supports two types of quantum operations: single-qubit operations and double-qubit operations. The object of each single-qubit operation must be a single qubit, which is recorded as the id of the object in the data structure of the quantum operation part. The object of each double-qubit operation must be two connected qubits, which are recorded as the id of the object connection in the data structure of the quantum operation part. The types of single-qubit operations and double-qubit operations are explained as follows:

[0055] The types of single-qubit operations include, but are not limited to, X-gate, Y-gate, Z-gate, H-gate, Rx-gate, Ry-gate, Rz-gate, and measurement. The types of two-qubit operations include, but are not limited to, CNOT-gate, CY-gate, and CZ-gate. For some quantum operations, it is also necessary to record the parameters that come with them. For example, the Rx-gate needs to record the parameter θ that comes with it.

[0056] The data structure of the quantum operation part can also store other information of the quantum operation, so that it can adapt to more needs.

[0057] S2. Draw a mesh graph corresponding to the topological structure part on each plane, wherein each quantum operation layer in the quantum operation part corresponds to a plane, and the nodes in the mesh graph represent quantum bits. Any two connected nodes represent that there is a connection relationship between the quantum bits corresponding to the two nodes.

[0058] Nodes may be represented by circles or squares, and any two connected nodes may be connected by double straight lines, rectangles, single straight lines, etc. The specific implementation method of the nodes and the connection between the two nodes may also be set according to actual conditions.

[0059] The plane can be specifically understood as a blank layer, etc. When a mesh pattern is drawn on the plane, i.e., the blank layer, a plane with the mesh pattern drawn on it is obtained.

[0060] In one embodiment, the nodes are circular nodes, and any two connected nodes are connected by rectangles. When drawing circular nodes and rectangular connections, different colors, lines, and contents are assigned according to multiple factors. For example, when the quantum bit / qubit connection is in a fault state, the background color is set to light red. For another example, when the quantum bit / qubit connection corresponding to the layer has a quantum operation, the background color is set to yellow, and the type of the quantum operation is displayed in the circular node, such as Figure 3 As shown, Figure 3 a shows a faulty qubit, Figure 3 b shows a faulty qubit connection, Figure 3 c shows a single qubit operation, Figure 3 d shows a two-qubit operation.

[0061] S3. Visualize multiple planes with mesh graphics drawn on them to obtain visualization graphics corresponding to the quantum circuit.

[0062] In a method for graphical preview of a quantum circuit provided by the present invention, a topological structure part and a quantum operation part of the quantum circuit are obtained, and a mesh graph corresponding to the topological structure part is drawn on a plane corresponding to each layer of quantum operation in the quantum operation part, and then visualized, which can well reflect the two-dimensional topological structure of the quantum circuit and help staff design and understand the quantum circuit.

[0063] Optionally, in S3, multiple planes with mesh graphics drawn thereon are visualized to obtain visualization graphics corresponding to the quantum circuit, including:

[0064] 1) A plurality of planes on which mesh graphics are drawn are tiled to obtain a two-dimensional visualization graphic obtained by tiling the plurality of planes on which mesh graphics are drawn.

[0065] 2) Stacking the multiple planes on which the mesh graphics are drawn to obtain a two-dimensional visualization graphic obtained by stacking the multiple planes on which the mesh graphics are drawn.

[0066] There are two arrangement modes for multiple planes with mesh graphics drawn on them: stacking mode and tiling mode. Specifically:

[0067] 1) In stacking mode, multiple planes with mesh graphics are stacked, and the user's perspective is oblique, such as Figure 4 As shown. At this point, the user can browse multiple quantum operation layers more intuitively.

[0068] 2) In the tile mode, multiple planes with mesh graphics are tiled, and the user's perspective is the front view, such as Figure 5 At this point the user can observe and edit individual quantum operation layers in more detail.

[0069] Optionally, in the above technical solution, the user can adjust the camera parameters by dragging the scroll bar (or dragging the mouse, the mouse wheel, the keyboard, etc.), thereby moving the field of view to view different planes. For the stacking mode and the tiling mode in the present invention, the movement trajectory of the fixed camera is set respectively.

[0070] The user can also switch the arrangement mode through buttons (or double-clicking the mouse, keyboard, etc.). For example, when the current arrangement mode is stacking mode, the user can switch to tiling mode through buttons (or double-clicking the mouse, keyboard, etc.). For another example, when the current arrangement mode is tiling mode, the user can switch to stacking mode through buttons (or double-clicking the mouse, keyboard, etc.). During the switching process, linear interpolation is performed on the key points (3D coordinates) and camera parameters of all graphics to achieve a smooth transition animation.

[0071] Optionally, in the above technical solution, a plurality of planes with mesh graphics drawn thereon are stacked to obtain a two-dimensional visualized graphic obtained by stacking the plurality of planes with mesh graphics drawn thereon, including:

[0072] Calculate the coordinates of each preset key point of each element in each plane drawn with mesh graphics in the three-dimensional coordinate system, then calculate the two-dimensional coordinates of each preset key point of each element projected onto the screen according to the preset camera parameters, and draw a two-dimensional visualization graphic by stacking multiple planes drawn with mesh graphics based on the two-dimensional coordinates of each preset key point of each element projected onto the screen.

[0073] Optionally, in the above technical solution, a plurality of planes on which mesh graphics are drawn are tiled to obtain a two-dimensional visualized graphic obtained by tiling the plurality of planes on which mesh graphics are drawn, including:

[0074] Calculate the coordinates of each preset key point of each element in each plane drawn with mesh graphics in the three-dimensional coordinate system, then calculate the two-dimensional coordinates of each preset key point of each element projected onto the screen according to the preset camera parameters, and draw a two-dimensional visualization graphic that is a result of tiling multiple planes drawn with mesh graphics based on the two-dimensional coordinates of each preset key point of each element projected onto the screen.

[0075] The explanation of each preset key point of each element is as follows:

[0076] Elements refer to: nodes and the connection between any two connected nodes, such as the rectangle mentioned above. For example, when the node is a circular node, the center of the circle is used as the preset key point of the circular node; for example, when the connection between any two connected nodes is through a rectangle, the four corner points of the rectangle are used as the preset key points of the rectangle. Each preset key point of each element can also be set according to actual conditions.

[0077] Among them, the origin of the three-dimensional coordinate system can be set according to actual conditions.

[0078] Optionally, in the above technical solution, before drawing a two-dimensional visualized graphic obtained by stacking a plurality of planes on which mesh graphics are drawn, the method further includes:

[0079] First, consider each plane with mesh graphics as a whole and calculate the occlusion relationship between the planes with mesh graphics. According to the arrangement pattern, calculate the position of each plane with mesh graphics (represent the position by three-dimensional coordinates). Then determine the occlusion relationship based on the distance between each position with mesh graphics and the position of the camera. The plane with mesh graphics that is close to the camera position occludes the plane with mesh graphics that is far from the camera position.

[0080] Secondly, for each plane with a mesh graphic drawn on it, the positions of the multiple elements are calculated according to the type of the elements: when the element is a node graphic (such as the circle mentioned above), the center point of the node graphic is used to calculate the position; when the element is a connection graphic (such as the rectangle mentioned above), the node graphic that is farther from the camera among the two node graphics connected by the connection graphic is determined, and the position of the connection graphic is calculated based on the node graphic; for the plane used as the base, the position is not calculated. Then, the occlusion relationship is determined based on the distance from the position of each element to the position of the camera. The closer elements occlude the farther elements, and the plane used as the base is always occluded by other elements. Using this logic can ensure that the node graphic always occludes the connection graphic at the overlap of the node graphic and the connection graphic, avoiding the node graphic being occluded by the connection graphic, causing the user to be unable to see the content.

[0081] After the occlusion relationship is determined, all planes with mesh graphics drawn on them are sorted according to the determined occlusion relationship, and a two-dimensional visualization graphic is drawn by stacking multiple planes with mesh graphics drawn on them in the sorted order. In the specific implementation process, svg code is generated and the visualization graphic is displayed by the browser.

[0082] The drawing of visualization graphics corresponding to quantum circuits involves three-dimensional graphics rendering technology, especially in stacking mode. Instead of using existing three-dimensional graphics tools (such as three.js), it uses SVG tags supported by HTML5. The Vue framework is used to achieve real-time control of SVG tag content. The advantages are:

[0083] 1) Existing web development tools (such as Vue and CSS) can be used directly to adjust the drawing content and style;

[0084] 2) When processing user interactions, you can directly use the functions supported by HTML5 tags (such as listening to mouse events);

[0085] 3) Graphics can be drawn without strictly following the rendering logic of 3D graphics, and the occlusion relationship and deformation effects of each part of the graphics can be adjusted to make it more suitable for user interaction.

[0086] 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.

[0087] like Figure 6 As shown, a system 200 for graphical preview of a quantum circuit according to an embodiment of the present invention includes an acquisition module 201, a drawing module 202 and a visualization module 203;

[0088] The acquisition module 201 is used to: acquire the topological structure part and the quantum operation part of the quantum circuit;

[0089] The drawing module 202 is used to draw a mesh graph corresponding to the topological structure part on each plane, wherein each quantum operation layer in the quantum operation part corresponds to a plane, and 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.

[0090] The visualization module 203 is used to visualize a plurality of planes on which mesh graphics are drawn, to obtain visualization graphics corresponding to the quantum circuit.

[0091] Optionally, in the above technical solution, the visualization module 203 is specifically used to: tile multiple planes with mesh graphics drawn on them to obtain a two-dimensional visualization graphic obtained by tiling multiple planes with mesh graphics drawn on them.

[0092] Optionally, in the above technical solution, the visualization module 203 is further specifically used to: stack multiple planes with mesh graphics drawn on them to obtain a two-dimensional visualization graphic obtained by stacking multiple planes with mesh graphics drawn on them.

[0093] Optionally, in the above technical solution, the visualization module 203 is also specifically used to: calculate the coordinates of each preset key point of each element in each plane drawn with a mesh graphic in the three-dimensional coordinate system, and then calculate the two-dimensional coordinates of each preset key point of each element projected onto the screen according to preset camera parameters; based on the two-dimensional coordinates of each preset key point of each element projected onto the screen, draw a two-dimensional visualization graphic that is a stack of multiple planes drawn with mesh graphics.

[0094] It should be noted that the beneficial effects of the system 200 for graphical preview of a quantum circuit provided in the above embodiment are the same as the beneficial effects of the method for graphical preview 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.

[0095] like Figure 7 As shown, a computer 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 computer device 300 implements any of the above-mentioned methods for graphical preview of quantum circuits, specifically:

[0096] The computer 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 the one or more memories 310 store at least one computer program 330, and the at least one computer program 330 is loaded and executed by the one or more processors 320, so that the computer device 300 implements any method of graphical preview of quantum circuits provided in the above embodiments. Of course, the computer 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, and the computer device 300 may also include other components for implementing device functions, which will not be repeated here.

[0097] 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 methods for graphical preview of quantum circuits.

[0098] 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, etc.

[0099] 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 a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes any of the above-mentioned methods for graphical preview of a quantum circuit.

[0100] 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.

[0101] Those skilled in the art know that the present invention can be implemented as a system, method or computer program product. Therefore, the present disclosure 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.

[0102] Any combination of one or more computer-readable media may be used. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media 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 thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device, or device.

[0103] 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 graphical preview of quantum circuits, characterized in that: include: Obtain the topological structure part and quantum operation part of the quantum circuit; Draw a mesh graph corresponding to the topological structure part on each plane, wherein each quantum operation layer in the quantum operation part corresponds to a plane, and 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; Visualizing a plurality of planes on which mesh graphics are drawn to obtain visualization graphics corresponding to the quantum circuit; Visualizing a plurality of planes on which mesh graphics are drawn to obtain visualization graphics corresponding to the quantum circuit, including: Stacking the multiple planes on which the mesh graphics are drawn to obtain a two-dimensional visualized graphic obtained by stacking the multiple planes on which the mesh graphics are drawn; The plurality of planes on which the mesh graphics are drawn are stacked to obtain a two-dimensional visualized graphic obtained by stacking the plurality of planes on which the mesh graphics are drawn, including: Calculate the coordinates of each preset key point of each element in each plane with mesh graphics drawn in the three-dimensional coordinate system, and then calculate the two-dimensional coordinates of each preset key point of each element projected onto the screen according to the preset camera parameters, and draw a two-dimensional visualization graphic after stacking multiple planes with mesh graphics drawn according to the two-dimensional coordinates of each preset key point of each element projected onto the screen; Before drawing a two-dimensional visualization graphic obtained by stacking a plurality of planes on which mesh graphics are drawn, the method further includes: First, each plane with mesh graphics drawn on it is regarded as a whole, and the occlusion relationship between the planes with mesh graphics drawn on it is calculated. According to the arrangement mode, the position of each plane with mesh graphics drawn on it is calculated, and then the occlusion relationship is determined according to the distance between each position with mesh graphics drawn on it and the position of the camera. The plane with mesh graphics drawn on it that is close to the position of the camera occludes the plane with mesh graphics drawn on it that is far from the position of the camera. Secondly, for each of the multiple elements contained in the plane with the mesh graphics drawn, the positions are calculated according to the categories of the elements: When the element is a node graph, the center point of the node graph is taken to calculate the position; when the element is a connection graph, the node graph that is farther from the camera among the two node graphs connected by the connection graph is determined, and the position of the connection graph is calculated based on the node graph; for the plane used as the base, the position is not calculated, and then the occlusion relationship is determined based on the distance from the position of each element to the position of the camera. The elements that are closer occlude the elements that are farther away, and the plane used as the base is always occluded by other elements; After the occlusion relationship is determined, all planes with mesh graphics drawn thereon are sorted according to the determined occlusion relationship, and a two-dimensional visualization graphic is drawn by stacking multiple planes with mesh graphics drawn thereon in the sorted order.

2. The method for graphical preview of a quantum circuit according to claim 1, characterized in that: Visualizing a plurality of planes on which mesh graphics are drawn to obtain visualization graphics corresponding to the quantum circuit, further comprising: A plurality of planes on which mesh graphics are drawn are tiled to obtain a two-dimensional visualized graphic obtained by tiling the plurality of planes on which mesh graphics are drawn.

3. A system for graphical preview of quantum circuits, characterized in that: Includes acquisition module, drawing module and visualization module; The acquisition module is used to: acquire the topological structure part and the quantum operation part of the quantum circuit; The drawing module is used to draw a mesh graph corresponding to the topological structure part on each plane, wherein each quantum operation layer in the quantum operation part corresponds to a plane, and 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. The visualization module is used to: visualize a plurality of planes on which mesh graphics are drawn to obtain visualization graphics corresponding to the quantum circuit; The visualization module is also specifically used for: stacking a plurality of planes on which mesh graphics are drawn, to obtain a two-dimensional visualization graphic after stacking the plurality of planes on which mesh graphics are drawn; Visualizing a plurality of planes on which mesh graphics are drawn to obtain visualization graphics corresponding to the quantum circuit, including: Stacking the multiple planes on which the mesh graphics are drawn to obtain a two-dimensional visualized graphic obtained by stacking the multiple planes on which the mesh graphics are drawn; The visualization module is also specifically used to: calculate the coordinates of each preset key point of each element in each plane with mesh graphics drawn in the three-dimensional coordinate system, and then calculate the two-dimensional coordinates of each preset key point of each element projected onto the screen according to the preset camera parameters, and draw a two-dimensional visualization graphic after stacking multiple planes with mesh graphics drawn according to the two-dimensional coordinates of each preset key point of each element projected onto the screen; Before drawing a two-dimensional visualization graphic obtained by stacking a plurality of planes on which mesh graphics are drawn, the method further includes: First, each plane with mesh graphics drawn on it is regarded as a whole, and the occlusion relationship between the planes with mesh graphics drawn on it is calculated. According to the arrangement mode, the position of each plane with mesh graphics drawn on it is calculated, and then the occlusion relationship is determined according to the distance between each position with mesh graphics drawn on it and the position of the camera. The plane with mesh graphics drawn on it that is close to the position of the camera occludes the plane with mesh graphics drawn on it that is far from the position of the camera. Secondly, for each of the multiple elements contained in the plane with the mesh graphics drawn, the positions are calculated according to the categories of the elements: When the element is a node graph, the center point of the node graph is taken to calculate the position; when the element is a connection graph, the node graph that is farther from the camera among the two node graphs connected by the connection graph is determined, and the position of the connection graph is calculated based on the node graph; for the plane used as the base, the position is not calculated, and then the occlusion relationship is determined based on the distance from the position of each element to the position of the camera. The elements that are closer occlude the elements that are farther away, and the plane used as the base is always occluded by other elements; After the occlusion relationship is determined, all planes with mesh graphics drawn thereon are sorted according to the determined occlusion relationship, and a two-dimensional visualization graphic is drawn by stacking multiple planes with mesh graphics drawn thereon in the sorted order.

4. A system for graphical preview of quantum circuits according to claim 3, characterized in that: The visualization module is specifically used to: perform tiling processing on a plurality of planes on which mesh graphics are drawn, so as to obtain a two-dimensional visualization graphic obtained by tiling the plurality of planes on which mesh graphics are drawn.

5. A computer device, characterized in that: The computer 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 computer device implements the method for graphical preview of a quantum circuit as claimed in any one of claims 1 to 2.

6. 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 graphical preview of a quantum circuit as claimed in any one of claims 1 to 2.

Citation Information

Patent Citations

  • Graphical quantum circuit construction method based on real quantum chip and related equipment

    CN116562378A