A method and device for realizing quantum circuit diagram without quantum cloud platform
By laying out the association of the drag and drop area in the quantum circuit diagram area and encapsulating the drag and drop instructions, the generation of the quantum circuit diagram is realized, solving the problems of high cost and low efficiency in the existing technology, and providing a simple graphical interface to control quantum circuits and reduce human and financial costs.
Patent Information
- Application Number
- CN202210232205.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-09
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-03-09
AI Technical Summary
When implementing drag-and-drop generation of quantum circuit diagrams, existing methods need to rely on third-party platforms or use complex CANVAS and js operations, resulting in small project teams needing to invest a lot of manpower and time, with low efficiency and high costs, and cannot meet the company's projects. need.
By laying out the association between dragging, dragging and configuring areas in the circuit diagram area, the ability to automatically extend the dragging area is encapsulated, and functional operations are performed through intermediate services to ensure uniform storage and information integrity of quantum gates. Generate quantum circuit diagrams.
It realizes drag-and-drop sorting between quantum gates, reduces manual calculations, saves labor costs, provides a simple and easy-to-use graphical interface to control quantum circuits, supports true quantum cloud computing, and reduces post-maintenance and financial costs. .
Smart Images

Figure CN114611703B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of front-end quantum computing technology, and specifically provides a method and device for realizing a quantum circuit diagram without a quantum cloud platform. Background Art
[0002] Since its birth, quantum computing has been considered by some people in the industry as a new computing model that subverts tradition. Its biggest advantages are fast computing speed and low energy consumption. Based on these advantages, it has attracted the attention of a large number of researchers and has developed slowly. Since Peter Shor proposed a quantum algorithm for solving the prime factors of a decomposable positive odd number N, namely the Shor algorithm, it has directly threatened the RSA encryption algorithm of classical communication, making the research on the realization of quantum computers a hot research direction.
[0003] Compared with traditional computers, quantum computing has incomparable advantages over traditional computers in many aspects, such as exponential growth in operating speed, low energy consumption, broad development prospects, wide range of applications, and large growth space.
[0004] With the continuous development of the company in recent years, it has focused on the research of quantum computing, launched quantum computing services and achieved many phased research results. In the process of achieving gratifying results, it has also promoted the development of front-end research and development work of quantum cloud. In order to better serve the public with its research results, the front-end needs to urgently store the quantum gates involved in the quantum cloud on the circuit programming panel line by dragging and dropping, and then adjust the quantum gates on the line as needed to finally generate a circuit diagram and display it to the user.
[0005] However, currently, most of the methods that can be used to generate circuit diagrams by dragging and dropping, except for the quantum platform provided by IBM, are implemented by using CANVAS plus a large amount of js operations. For some small project teams, if they want to generate circuit diagrams by dragging and dropping, they either need to use a third-party quantum cloud platform or invest a lot of manpower and time in research and development. Either way, there are difficulties. If a third party is used, it will not only cost a lot of money but may also be subject to the third party in terms of project requirements. This is not a good way for some companies. The timeliness of using CANVAS cannot be guaranteed and many unknown difficulties must be overcome. Summary of the invention
[0006] In view of the above-mentioned deficiencies in the prior art, the present invention provides a method for realizing a quantum circuit diagram without using a quantum cloud platform and having strong practicality.
[0007] A further technical task of the present invention is to provide a device that is rationally designed, safe and applicable for realizing quantum circuit diagrams independent of the quantum cloud platform.
[0008] The technical solution adopted by the present invention to solve its technical problem is:
[0009] A method for realizing a quantum circuit diagram without a quantum cloud platform, firstly layout the area where the circuit diagram is located, ensure the correlation between the drag area, the drop area and the configuration area, and make the drag area automatically extended, then encapsulate the drag command drag, the drop command drop and the server service that can monitor the drag and drop and perform functional operations according to the drag and drop behavior;
[0010] After that, you need to store the dragged quantum gates evenly in the dragging area and configure the json object corresponding to each quantum gate to ensure the information is complete. Store the quantum circuit programming panel in the draggable area and cooperate with the configuration area to ensure that the configurable quantum registers and classical registers in the configuration area are consistent with the lines on the quantum circuit programming panel.
[0011] Finally, drag the quantum gates and store them on the circuit of the quantum circuit programming panel and obtain the json information corresponding to the relevant quantum gates. The quantum gates on the circuit programming panel circuit can be dragged and adjusted to adjust their positions as needed. After confirmation, the data is combined according to the information of the quantum gates on the circuit programming panel circuit, and the data is organized into relevant json objects and passed to the relevant interface of the quantum computer to generate the relevant quantum circuit diagram.
[0012] Furthermore, in the encapsulation of the drag instruction drag, it is necessary to obtain the gate data dragData corresponding to the quantum gate when dragging the quantum gate, and the identifier dragTag of the dragging area, where the dragTag mark represents the area where the dragged quantum gate is located;
[0013] Set up monitoring to monitor the drag start and drag end events. When dragging starts and ends, the monitored area and the monitored quantum gate data need to be stored in the intermediate service.
[0014] Furthermore, in the encapsulation of the specified drop, the emission event dropped and the dragging area identifier dropTag array in response to the dragging, the Dropped emission event is used for communication between the child and parent components, and the dropTag area array is used to limit the dragging area;
[0015] In addition, it is also necessary to set up a monitor to monitor the dragging object entry and dragging storage events. When the quantum gate is dragged into the dragging area, the data stored in the middle service by the dragging instruction is obtained. When the dragging is completed and the quantum gate enters the corresponding line, the obtained data is communicated to the parent component through emit mapping to obtain the data.
[0016] Furthermore, the parent component receives the data and performs deep copying of the data. When the array data is stored, it needs to be compared with the original data of the array to ensure that there is a measured electronic gate data in each circuit array.
[0017] Furthermore, when the intermediate service of dragging and dropping is provided, the data structure between dragging and dropping and the methods required in the service are defined. According to the requirements of dragging and dropping, the dragging is used to store data, the dropping is used to obtain data, and the service provides corresponding deletion operations.
[0018] Furthermore, when setting the object data corresponding to each quantum gate, it includes key, value, fontIcon and itemShow;
[0019] When the quantum gate is dragged, the corresponding gate object data is passed to the dragData instruction. The drag instruction stores the data in the service. When the quantum gate is stored on the line of the circuit editing panel, the drop instruction is used to obtain the data stored in the service by dragData and send it to the parent component through the drop mapping. After receiving the data, the parent component stores it in the array corresponding to the line of the circuit editing panel, and then traverses the multidimensional array to assemble the json data according to the format agreed upon by the front and back ends, and sends it to the back end to complete the packaging of the entire circuit diagram.
[0020] Preferably, when the quantum registers are reduced, the corresponding circuit editing panel lines are also reduced accordingly and are kept consistent with the arrays in the multidimensional array.
[0021] Furthermore, when deleting a quantum gate on a circuit editing panel line, it is necessary to confirm the subscript index corresponding to the quantum gate and the position of the circuit array in the multidimensional array before deleting the data.
[0022] A device for realizing a quantum circuit diagram without a quantum cloud platform, characterized in that it comprises: at least one memory and at least one processor;
[0023] The at least one memory is used to store a machine-readable program;
[0024] The at least one processor is used to call the machine-readable program to execute a method for implementing a quantum circuit diagram independent of the quantum cloud platform.
[0025] Compared with the prior art, the method and device for realizing a quantum circuit diagram without a quantum cloud platform of the present invention have the following outstanding beneficial effects:
[0026] The dragging and sorting between quantum gates in the present invention generates a new circuit diagram, which reduces human calculations to a certain extent and saves labor costs. The implemented analog circuit reduces the dependence of quantum computing on physical conditions and provides a scientific implementation tool for realizing true quantum cloud computing. Simple technology is used to achieve complex effects, which is maintainable in the later stage and saves financial resources.
[0027] Quantum computing supports the implementation of quantum circuits through a graphical interface. Graphical interface-based operations can quickly and efficiently control quantum gates and create quantum circuits more intuitively. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0029] Attached Figure 1 It is a schematic diagram of the drag-and-drop process in a method of realizing a quantum circuit diagram without a quantum cloud platform;
[0030] Attached Figure 2 It is a method for realizing quantum circuit diagram without quantum cloud platform, in which the same circuit diagram is mutually sequenced. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0032] A best embodiment is given below:
[0033] like Figure 1-2 As shown, in this embodiment, a method for realizing a quantum circuit diagram without a quantum cloud platform is provided. The method for realizing a quantum circuit diagram without a quantum cloud platform is characterized in that the area where the circuit diagram is located is firstly laid out to ensure that the drag area, the drag area and the configuration area are related to each other, and the drag area can be automatically extended, and then the drag command drag, the drop command drop and the server service that can monitor the drag and drop and perform functional operations according to the drag and drop behaviors are encapsulated;
[0034] After that, you need to store the dragged quantum gates evenly in the dragging area and configure the json object corresponding to each quantum gate to ensure the information is complete. Store the quantum circuit programming panel in the draggable area and cooperate with the configuration area to ensure that the configurable quantum registers and classical registers in the configuration area are consistent with the lines on the quantum circuit programming panel.
[0035] Finally, drag the quantum gates and store them on the circuit of the quantum circuit programming panel and obtain the json information corresponding to the relevant quantum gates. The quantum gates on the circuit programming panel circuit can be dragged and adjusted to adjust their positions as needed. After confirmation, the data is combined according to the information of the quantum gates on the circuit programming panel circuit, and the data is organized into relevant json objects and passed to the relevant interface of the quantum computer to generate the relevant quantum circuit diagram.
[0036] In the encapsulation of the drag command drag, it is necessary to obtain the gate data dragData corresponding to the quantum gate when dragging the quantum gate, and the drag area identifier dragTag, and the dragTag mark represents the area where the dragged quantum gate is located. Specific function descriptions such as: dragTag = "father" means that the area where the quantum gate is located is the father area, and the quantum gate cannot achieve the drag effect out of this area.
[0037] Set up monitoring to monitor the drag start and drag end events. When dragging starts and ends, the monitored area and the monitored quantum gate data need to be stored in the intermediate service.
[0038] In the package of dragging and dropping the specified drop, according to the requirements of the quantum cloud circuit, the emission event of the response in the dragging and the dropTag array of the dragging area identifier are required. The Dropped emission event is used for communication between child and parent components, and the dropTag area array is used to limit the dragging area. In addition, it is necessary to set up a monitor to monitor the entry of the dragged object and the dragging storage event. When the quantum gate is dragged into the dragging area, it is necessary to obtain the data stored in the intermediate service by the dragging instruction. When the dragging ends and the quantum gate enters the corresponding circuit, the acquired data is communicated to the parent component through emit mapping to obtain the data.
[0039] Encapsulate the intermediate service of dragging and dropping, define the data structure between dragging and dropping, ensure the uniformity of data format, define the methods required in the service, and according to the requirements of dragging and dropping, dragging requires data storage and dropping requires data acquisition. Considering the possibility of erroneous operations in dragging and dropping, this service needs to provide corresponding deletion operations.
[0040] Set the object data corresponding to each quantum gate, which needs to include key (gate name corresponding to the quantum gate vocabulary), value (gate name size corresponding to the quantum gate vocabulary), fontIcon (image corresponding to the gate), and itemShow (whether the corresponding gate displays the delete icon).
[0041] When the quantum gate is dragged, its corresponding gate object data is passed to the dragData instruction. The drag instruction stores the data in the service. When the quantum gate is stored on the line of the circuit editing panel, the drop instruction is used to obtain the data stored in the service by dragData and send it to the parent component through the drop mapping. After receiving the data, the parent component stores it in the array corresponding to the line of the circuit editing panel, and then traverses the multi-dimensional array to assemble the json data according to the format agreed upon by the front and back ends, and sends it to the back end to complete the packaging of the entire circuit diagram.
[0042] The entire circuit editing panel is a complete array, each editing line on the circuit editing panel corresponds to a circuit array, and the data format is presented in the form of a multi-dimensional array.
[0043] The parent component needs to perform a deep copy of the data when receiving it to prevent the pointers of the same quantum gate object data from pointing to the same area (changing the pointer pointing). When the array data is stored, it needs to be compared with the original data of the array to ensure that there is a measured electronic gate data in each circuit array.
[0044] When you sort and drag quantum gates on the same circuit editing panel line, you need to perform a moveItemInArray operation to ensure that the position of each data in the array corresponds to each quantum gate.
[0045] When dragging quantum gates on different circuit editing panel lines, it is necessary to keep adding and deleting quantum gates on the corresponding lines in real time to ensure that the position of each data in the array corresponds to each quantum gate.
[0046] When reducing quantum registers, the corresponding circuit editing panel lines also need to be reduced accordingly and kept consistent with the arrays in the multidimensional array.
[0047] When deleting a quantum gate on a circuit editing panel line on the page, you need to confirm the subscript index corresponding to the quantum gate and the position of the circuit array in the multidimensional array before deleting the data.
[0048] In order to improve the user experience with the page layout, when the browser page length is limited and there are a large number of quantum gates on the circuit editing panel line, it is necessary to obtain the length of the longest array in the multidimensional array, automatically set the length of the area where the circuit editing panel is located according to the length, and set the scroll bar.
[0049] A device for realizing a quantum circuit diagram without a quantum cloud platform, comprising: at least one memory and at least one processor;
[0050] The at least one memory is used to store a machine-readable program;
[0051] The at least one processor is used to call the machine-readable program to execute the method of realizing a quantum circuit diagram independent of a quantum cloud platform.
[0052] The above-mentioned specific implementations are only specific cases of the present invention. The patent protection scope of the present invention includes but is not limited to the above-mentioned specific implementations. Any method and device claims for realizing a quantum circuit diagram without a quantum cloud platform that conform to the present invention and any appropriate changes or substitutions made by ordinary technicians in the technical field shall fall within the patent protection scope of the present invention.
[0053] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for realizing a quantum circuit diagram without using a quantum cloud platform, characterized in that: First, lay out the area where the circuit diagram is located, ensure that the drag area, the drop area and the configuration area are related to each other, and make the drag area automatically extended, then encapsulate the drag command drag, the drop command drop and the server service that can listen to the drag and drop and perform functional operations according to the drag and drop behavior; After that, you need to store the dragged quantum gates evenly in the dragging area and configure the json object corresponding to each quantum gate to ensure the information is complete. Store the quantum circuit programming panel in the draggable area and cooperate with the configuration area to ensure that the configurable quantum registers and classical registers in the configuration area are consistent with the lines on the quantum circuit programming panel. Finally, drag the quantum gate and store it on the line of the quantum circuit programming panel and obtain the json information corresponding to the relevant quantum gate. The quantum gates on the circuit programming panel line can be dragged and adjusted to adjust their positions as needed. After confirmation, the data is combined according to the information of the quantum gates on the circuit programming panel line, organized into relevant json objects and passed to the relevant interface of the quantum computer to generate the relevant quantum circuit diagram.
2. According to claim 1, a method for realizing a quantum circuit diagram without a quantum cloud platform is characterized in that: In the encapsulation of the drag instruction drag, it is necessary to obtain the gate data dragData corresponding to the quantum gate when dragging the quantum gate, and the identifier dragTag of the dragging area, where the dragTag mark represents the area where the dragged quantum gate is located; Set up monitoring to monitor the drag start and drag end events. When dragging starts and ends, the monitored area and the monitored quantum gate data need to be stored in the intermediate service.
3. The method for realizing a quantum circuit diagram without a quantum cloud platform according to claim 2, characterized in that: In the encapsulation of the drag command drop, the emission event dropped and the drag area identifier dropTag array are used to identify the drag area in response to the drag. The Dropped emission event is used for communication between the child and parent components. The dropTag area array is used to limit the drag area. In addition, it is also necessary to set up a monitor to monitor the dragging object entry and dragging storage events. When the quantum gate is dragged into the dragging area, the data stored in the middle service by the dragging instruction is obtained. When the dragging is completed and the quantum gate enters the corresponding line, the obtained data is communicated to the parent component through emit mapping to obtain the data.
4. The method for realizing a quantum circuit diagram without a quantum cloud platform according to claim 3, characterized in that: The parent component receives the data and performs deep copying of the data. When the array data is stored, it needs to be compared with the original data of the array to ensure that there is a measured electronic gate data in each circuit array.
5. The method for realizing a quantum circuit diagram without a quantum cloud platform according to claim 4, characterized in that: When the intermediate service of dragging and dropping is provided, the data structure between dragging and dropping and the methods required in the service are defined. According to the requirements of dragging and dropping, the dragging needs to store data, and the dropping needs to obtain data, and the service provides corresponding deletion operations.
6. The method for realizing a quantum circuit diagram without a quantum cloud platform according to claim 5, characterized in that: When setting the object data corresponding to each quantum gate, it includes the gate name key corresponding to the quantum gate vocabulary, the gate name size value corresponding to the quantum gate vocabulary, the image fontIcon corresponding to the gate, and whether the corresponding gate displays the deletion icon itemShow; When the quantum gate is dragged, the corresponding gate object data is passed to the drag instruction. The drag instruction stores the data in the service. When the quantum gate is stored on the line of the circuit editing panel, the drop instruction is used to obtain the data stored in the service through dragData and send it to the parent component through drop mapping. After receiving the data, the parent component stores it in the array corresponding to the line of the circuit editing panel, and then traverses the multidimensional array to assemble the json data according to the format agreed upon by the front and back ends, and sends it to the back end to complete the packaging of the entire circuit diagram.
7. The method for realizing a quantum circuit diagram without a quantum cloud platform according to claim 6, characterized in that: When the quantum register is reduced, the corresponding circuit editing panel line is also reduced accordingly and remains consistent with the array in the multidimensional array.
8. The method for realizing a quantum circuit diagram without a quantum cloud platform according to claim 7, characterized in that: When deleting a quantum gate on a circuit editing panel line, it is necessary to confirm the subscript index corresponding to the quantum gate and the position of the circuit array in the multidimensional array before deleting the data.
9. A device for realizing a quantum circuit diagram without using a quantum cloud platform, characterized in that: include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is configured to call the machine-readable program to execute the method according to any one of claims 1 to 8.
