Quantum circuit diagram error correction method, device, equipment, storage medium and program product

By automatically detecting and completing the measurement gates in the quantum circuit diagram, the problem of invalid operations caused by missing measurement gates is solved, and the effective operation and resource saving of the quantum circuit diagram are realized.

CN116050529BActive Publication Date: 2024-09-20BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211529539.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-30
Publication Date
2024-09-20
Estimated Expiration
2042-11-30

AI Technical Summary

Technical Problem

In a quantum circuit diagram, missing measurement gates will cause invalid operations of the quantum device and waste precious quantum computing resources. It is difficult for existing technology to automatically detect and complete measurement gates.

Method used

By obtaining the running instructions of the quantum circuit diagram within the current drawing window, the actual number of measurement gates is determined, and when the number is found to be zero, measurement gates are automatically added to the end operation bit of the quantum register to complete error correction.

Benefits of technology

It realizes automatic error correction of quantum circuit diagrams, avoids invalid operations, saves computing resources of quantum devices, and reminds users to add necessary measurement gates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116050529B
    Figure CN116050529B
Patent Text Reader

Abstract

The present disclosure provides a quantum circuit diagram error correction method, device, equipment, storage medium and program product, which relate to the fields of quantum circuit diagram and visualization technology. The method comprises: obtaining an operation instruction for a quantum circuit diagram drawn in the current drawing window; determining the actual number of measurement gates in the drawn quantum circuit diagram according to the operation instruction; in response to the actual number being zero, adding a measurement gate to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram, and obtaining a quantum circuit diagram after error correction. The method first determines the actual number of measurement gates in the current drawn quantum circuit diagram before running, and when it is found that the actual number is zero, adds a measurement gate to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram, thereby completing the automatic error correction of the quantum circuit diagram, avoiding invalid operations of quantum devices due to the lack of necessary measurement gates, and saving precious computing resources of quantum devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, specifically to the field of quantum circuit diagrams and visualization technology, and in particular to a quantum circuit diagram error correction method, device, electronic device, computer-readable storage medium, and computer program product. Background Art

[0002] With the popularity of quantum computing, more and more beginners are trying to use the visual quantum computing platform to conduct simple quantum circuit experiments, to experience the magic and fun of quantum computing while learning quantum computing. A complete quantum circuit consists of multiple parts, among which the measurement gate is an important part of the quantum circuit. The measurement gate is the last operation of a quantum register, and a quantum register can have at most one measurement gate. Users can obtain the calculation results of the quantum circuit through measurement. A quantum circuit without a measurement gate is meaningless because users cannot obtain any calculation results. Summary of the invention

[0003] The embodiments of the present disclosure provide a quantum circuit diagram error correction method, device, electronic device, computer-readable storage medium, and computer program product.

[0004] In a first aspect, an embodiment of the present disclosure proposes a quantum circuit diagram error correction method, comprising: obtaining an operation instruction for a quantum circuit diagram drawn in a current drawing window; determining the actual number of measurement gates in the drawn quantum circuit diagram according to the operation instruction; in response to the actual number being zero, adding a measurement gate to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram, to obtain a quantum circuit diagram after error correction.

[0005] In a second aspect, an embodiment of the present disclosure proposes a quantum circuit diagram error correction device, comprising: an operation instruction acquisition unit, configured to acquire an operation instruction for a quantum circuit diagram drawn in a current drawing window; a measurement gate actual number determination unit, configured to determine the actual number of measurement gates in the drawn quantum circuit diagram according to the operation instruction; and a measurement gate automatic addition unit, configured to add a measurement gate to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram in response to the actual number being zero, so as to obtain a quantum circuit diagram after error correction.

[0006] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the quantum circuit diagram error correction method described in the first aspect can be implemented when the at least one processor executes the instructions.

[0007] In a fourth aspect, an embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, which are used to enable a computer to implement the quantum circuit diagram error correction method described in the first aspect when executed.

[0008] In a fifth aspect, an embodiment of the present disclosure provides a computer program product comprising a computer program, which, when executed by a processor, can implement the steps of the quantum circuit diagram error correction method described in the first aspect.

[0009] A quantum circuit diagram error correction scheme provided by an embodiment of the present disclosure does not directly run when receiving an operation instruction for a quantum circuit diagram drawn in a current drawing window, but first determines the actual number of measurement gates in the current drawn quantum circuit diagram, and when it is found that the actual number is zero, adds a measurement gate to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram, thereby completing automatic error correction of the quantum circuit diagram, avoiding invalid operations of quantum devices due to the lack of necessary measurement gates, and saving precious computing resources of quantum devices.

[0010] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0012] Figure 1 is an exemplary system architecture in which the present disclosure may be applied;

[0013] Figure 2 A flowchart of a quantum circuit diagram error correction method provided by an embodiment of the present disclosure;

[0014] Figure 3 An example of a drawn quantum circuit diagram for initiating an operation instruction provided in an embodiment of the present disclosure;

[0015] Figure 4 A schematic diagram of branches for adding measurement gates in three different ways provided in an embodiment of the present disclosure;

[0016] Figure 5a A schematic diagram of a measurement gate addition result obtained by using a specified addition or any addition method provided in an embodiment of the present disclosure;

[0017] Figure 5b A schematic diagram of a measurement gate addition result obtained by adopting a full addition method according to an embodiment of the present disclosure;

[0018] Figure 6 A flow chart of a method for adjusting a mispositioned measuring door provided by an embodiment of the present disclosure;

[0019] Figure 7a An example diagram of setting a measurement gate at a non-final operation position provided in an embodiment of the present disclosure;

[0020] Figure 7b For the general Figure 7a The example diagram shown is an example diagram after error correction in which the measurement gate setting position is adjusted to the last operation position;

[0021] Figure 7c An example diagram of setting two measurement gates in succession provided in an embodiment of the present disclosure;

[0022] Figure 7d For the general Figure 7c The example diagram after error correction is shown in which one of the two measurement gates in the example diagram is deleted;

[0023] Figure 8 A flowchart of a method for highlighting error correction points and sending them for execution provided by an embodiment of the present disclosure;

[0024] Fig. 9 A flowchart of another quantum circuit diagram error correction method provided by an embodiment of the present disclosure;

[0025] Fig.10 A block diagram of a quantum circuit diagram error correction device provided by an embodiment of the present disclosure;

[0026] Fig.11 A schematic diagram of the structure of an electronic device suitable for executing a quantum circuit diagram error correction method provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0027] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description. It should be noted that the embodiments in the present disclosure and the features in the embodiments may be combined with each other without conflict.

[0028] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0029] Figure 1An exemplary system architecture 100 is shown to which embodiments of the quantum circuit error correction method, apparatus, electronic device, and computer-readable storage medium disclosed in the present disclosure can be applied.

[0030] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a server 104, and a quantum device 105. The network is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 104, and between the server 104 and the quantum device 105, and may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0031] Users can use terminal devices 101, 102, 103 to exchange information with server 104 through the network to receive operation results or send instructions, etc. Server 104 can also further send instructions received from terminal devices 101, 102, 103 to quantum device 105 for specific execution, or receive operation results returned by quantum device 105. Terminal devices 101, 102, 103, server 104 and quantum device 105 can be installed with various applications for realizing information communication between the two, such as instruction sending applications, instruction processing applications, quantum circuit diagram error correction applications, etc.

[0032] Terminal devices 101, 102, 103, server 104 and quantum device 105 are usually manifested as hardware in different forms, and can also be manifested as software or software products in certain simulation or virtual scenarios. When terminal devices 101, 102, 103 are manifested as hardware, they can be various electronic devices with display screens, including but not limited to smart phones, tablet computers, laptop portable computers and desktop computers, etc.; when terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above, which can be implemented as multiple software or software modules, or as a single software or software module, which is not specifically limited here. When server 104 is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server; when the server is software, it can be implemented as multiple software or software modules, or as a single software or software module, which is not specifically limited here.

[0033] The server 104 can provide various services through various built-in applications. Taking the instruction processing application that can provide special instruction processing services as an example, the server 104 can achieve the following effects when running the instruction processing application: first, receiving the operation instruction for the drawn quantum circuit diagram in the current drawing window transmitted by the user through the terminal devices 101, 102, and 103 through the network; then, determining the actual number of measurement gates in the drawn quantum circuit diagram according to the operation instruction; finally, when it is found that the actual number is zero, adding a measurement gate to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram to obtain the quantum circuit diagram after error correction.

[0034] Furthermore, the server 104 sends the error-corrected quantum circuit diagram to the quantum device 105 for execution, and receives the calculation result returned by the quantum device 105.

[0035] Therefore, the quantum circuit diagram error correction method provided in the subsequent embodiments of the present disclosure is generally executed by setting up a server 104 in front of the quantum device 105 , and correspondingly, the quantum circuit diagram error correction device is generally also set in the server 104 .

[0036] It should be understood that Figure 1 The number of terminal devices, servers, and quantum devices in the embodiment is only illustrative. Any number of terminal devices, servers, and quantum devices may be provided according to implementation requirements.

[0037] Please refer to Figure 2 , Figure 2 A flowchart of a quantum circuit diagram error correction method provided by an embodiment of the present disclosure, wherein process 200 includes the following steps:

[0038] Step 201: obtaining an operation instruction for a quantum circuit diagram drawn in a current drawing window;

[0039] This step is intended to be performed by the execution subject of the quantum circuit error correction method (e.g. Figure 1 The server 104 shown in the figure obtains the operation instruction of the quantum circuit diagram drawn in the current drawing window. The drawing window for drawing the quantum circuit diagram can be operated by the above-mentioned execution subject or terminal device (for example Figure 1 The terminal devices 101, 102, 103 shown in the figure provide an application (e.g., a quantum circuit diagram drawing application) installed on the terminal devices, so that the user can draw a quantum circuit diagram according to his own ideas in the drawing window through his terminal device, and after considering that the drawing of the quantum circuit diagram is completed, initiate an operation instruction for the drawn quantum circuit diagram.

[0040] Step 202: determining the actual number of measurement gates in the drawn quantum circuit diagram according to the running instruction;

[0041] On the basis of step 201, this step aims to determine the actual number of measurement gates in the drawn quantum circuit diagram by the above-mentioned execution subject according to the running instruction. Specifically, for the number detection of the measurement gates, it is possible to perform target detection based on the image content of the gate icon of the measurement gate, or to find out whether there is component information of the measurement gate component by searching the component information of the drawn quantum circuit diagram, such as a specific string, a specific component name, a specific calling interface, etc.

[0042] Step 203: In response to the actual number being zero, a measurement gate is added to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram to obtain a quantum circuit diagram after error correction.

[0043] This step is based on the situation that the actual number of measurement gates determined in step 202 is zero. Since the actual number of measurement gates is zero, that is, there is no measurement gate in the drawn quantum circuit diagram (for example Figure 3 The example of the quantum circuit diagram drawn as shown in FIG. 1 is shown in FIG. 1 . Since the measurement gate is an important component of the quantum circuit, the measurement gate is required to obtain the calculation result of the quantum circuit. Therefore, a quantum circuit without a measurement gate is meaningless and cannot obtain any calculation result desired by the user. Therefore, in this step, when the above-mentioned execution subject finds that the measurement gate does not exist in the drawn quantum circuit diagram, the measurement gate is added to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram to obtain a quantum circuit diagram after the missing measurement gate is supplemented and corrected.

[0044] Furthermore, in order to enable the user terminal that initiates the run command to clearly identify the errors in the drawn quantum circuit diagram, it is also possible to output error correction prompt information that the quantum circuit diagram requires at least one measurement gate before adding the measurement gate, so that the user terminal can know from the error correction prompt information that it has forgotten to add the measurement gate, so as to remind itself not to forget it again when drawing other quantum circuit diagrams subsequently. At the same time, the error correction prompt information can also be used as a record information to reflect the error correction object.

[0045] The quantum circuit diagram error correction method provided by the embodiment of the present disclosure does not directly run the operation instruction for the drawn quantum circuit diagram in the current drawing window when receiving the operation instruction for the drawn quantum circuit diagram. Instead, the method first determines the actual number of measurement gates in the current drawn quantum circuit diagram, and when it is found that the actual number is zero, adds the measurement gate to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram, thereby completing the automatic error correction of the quantum circuit diagram, avoiding invalid operation of the quantum device due to the lack of necessary measurement gates, and saving precious operation resources of the quantum device.

[0046] In order to deepen the understanding of how to complete the process of adding the measurement gate, this embodiment also uses Figure 4 Three parallel ways of adding measurement gates are shown:

[0047] Method 1: in response to not obtaining additional adding position indication information, adding a measurement gate at the end operation position of any quantum register constituting the drawn quantum circuit diagram;

[0048] That is, this method is based on the minimum requirement that a quantum circuit diagram requires at least one measurement gate. When adding a measurement gate, add the measurement gate to the end operation bit of any quantum register. See Figure 5a The schematic diagram of the addition result is shown in Figure 3 On the basis of, it is equivalent to adding the measurement gate to the last operation bit of the Q(1) quantum register among the three quantum registers. Of course, when selecting any quantum register to add the measurement gate, the optional methods may include: polling selection according to the sequence number of the quantum register, random selection, etc.

[0049] Method 2: In response to not obtaining additional adding position indication information, adding a measurement gate to the end operation bit of each quantum register constituting the drawn quantum circuit diagram;

[0050] That is, this method adds the measurement gate to the end operation bit of each quantum register at the same time, see Figure 5b The schematic diagram of the addition result shown is equivalent to Figure 3 On the basis of , a measurement gate is added to the last operation bit of the three quantum registers at the same time. Compared with the first and third methods, this scheme is the simplest to implement because it does not need to determine the quantum register to be added.

[0051] Method three: in response to additionally acquiring the adding position indication information, determining the target quantum register according to the adding position indication information, and adding a measurement gate at the end operation position of the target quantum register.

[0052] That is, this method is also based on the minimum requirement that a quantum circuit diagram requires at least one measurement gate. When adding a measurement gate, the measurement gate is added to the end operation bit of the target quantum register indicated by the additional addition position indication information transmitted by the user end. See Figure 5a The schematic diagram of the addition result is shown in Figure 3 On the basis of, it is equivalent to adding a measurement gate to the last operation bit of the Q(1) quantum register among the three quantum registers, and the Q(1) quantum register is included in the additional adding position indication information transmitted by the user end. In order to obtain the adding position indication information, a corresponding inquiry can also be actively initiated to the user end.

[0053] Figure 4 The three adding methods shown cover different user needs in different scenarios as much as possible. You can flexibly select the applicable adding method according to the actual requirements in the actual application scenario.

[0054] The above embodiments are based on the assumption that the number of measurement gates in the drawn quantum circuit diagram is zero. For the case where the number of measurement gates is not zero, it is necessary to pay attention to whether the existing measurement gates are correctly set to the last operation position of the quantum register (i.e., as the last operation of the quantum register). If the existing measurement gates are not correctly set to the last operation position, their setting positions need to be adjusted.

[0055] See also Figure 6 , Figure 6 A flowchart of a method for adjusting a position-error measuring door provided by an embodiment of the present disclosure, wherein process 600 includes the following steps:

[0056] Step 601: In response to the actual number being not zero, determining that the measurement gate is located at the actual operation bit of the quantum register to which it belongs;

[0057] This step is intended to determine, by the execution subject, that the existing measurement gate is located at the actual operation bit of the quantum register to which it belongs, that is, the actual operation bit is used to indicate whether it is the last operation bit.

[0058] Step 602: Determine whether the actual operation bit is the last operation bit, if so, execute step 603, otherwise execute step 604;

[0059] On the basis of step 601, this step aims at allowing the execution subject to determine whether the actual operation bit is the last operation bit, and to execute different subsequent processing branches according to the determination result.

[0060] Specifically, when determining whether it is the last operation bit based on the actual operation bit, it can be determined whether it is the last operation bit based on whether there is a larger bit number after the bit number of the actual operation bit where the measurement gate is located, because when the actual operation bit is the last operation bit, there should not be a bit number larger than the bit number of the actual operation bit.

[0061] Step 603: No error correction is required;

[0062] This step is based on the judgment result of step 602 that the actual operation bit is the last operation bit, so the setting position of the existing measurement gate on the corresponding quantum register is correct, and no error correction is required, and it can be directly sent to the quantum device (for example Figure 1 The quantum device 105 shown is executed.

[0063] Step 604: Move the measurement gate to the last operation bit of the quantum register to which it belongs, and obtain a quantum circuit diagram after error correction.

[0064] This step is based on the fact that the judgment result in step 602 is that the actual operation bit is not the last operation bit, so the measurement gate needs to be moved to the last operation bit of the quantum register to which it belongs, so as to obtain the quantum circuit diagram after error correction.

[0065] Furthermore, before moving the measurement gate whose actual operation position is not the last operation position, error correction prompt information that the measurement gate can only be used as the last operation of the quantum register where it is located can be output, so that the user end can know that it has set the measurement gate to the wrong operation position according to the error correction prompt information, thereby reminding itself to try not to make the same mistake again when drawing other quantum circuit diagrams later. At the same time, the error correction prompt information can also be used as a record information to reflect the error correction object.

[0066] Figure 7a An example diagram of setting the measurement gate at a non-final operation position is shown. It can be seen that an "H" quantum gate circuit, a measurement gate, and another "H" quantum gate circuit are sequentially set on the Q(1) quantum register. That is, the measurement gate is obviously not set at the final operation position. In view of this situation, Figure 7b Shows the Figure 7a The example diagram shown is an example diagram after error correction in which the measurement gate setting position is adjusted to the last operation position, that is, the measurement gate originally set in the middle of the two "H" quantum gate circuits is moved to the back of the second "H" quantum gate circuit, so that it can be used as the last operation on the Q(1) quantum register.

[0067] The above situation can be used to solve the common situation of single measurement gate setting position error. In a few cases, there is also an error situation that at least two measurement gates are continuously set on the same quantum register. That is, when it is determined that at least two measurement gates are located in the same quantum register according to the actual operation position, it is also possible to first delete the redundant measurement gates until only one measurement gate is left on a quantum register, and then follow the method when only one measurement gate is left. Figure 7a to Figure 7b This error can be eliminated by repeating the adjustment process.

[0068] Figure 7c FIG. 1 shows an example of setting two measurement gates in succession. It can be seen that the “H” quantum gate circuit and two measurement gates are set in sequence on the Q(1) quantum register. In this case, only the middle measurement gate needs to be deleted. The example diagram after deletion is as follows: Figure 7d shown.

[0069] On the basis of any of the above embodiments, in order to clearly distinguish the quantum circuit diagrams before and after error correction, this embodiment further adopts Figure 8 A method for highlighting error correction points and sending them for execution is shown, and the process 800 includes the following steps:

[0070] Step 801: Determine that the quantum circuit diagram after error correction is different from the error correction point of the drawn quantum circuit diagram;

[0071] This step is intended to allow the execution subject to determine that the quantum circuit diagram after error correction is different from the error correction point of the drawn quantum circuit diagram.

[0072] Step 802: highlight the error correction point, and if the highlighted error correction point is not modified within a preset time period, send the corrected quantum circuit diagram to the quantum device for operation.

[0073] On the basis of step 801, this step aims to have the above-mentioned execution subject highlight the determined error correction point to facilitate quick viewing of the error correction point, and when the highlighted error correction point is not modified within a preset time period (that is, including the case where the error correction confirmation indication transmitted by the user end is directly received, and the case where no instruction is received within the preset time period), the corrected quantum circuit diagram is sent to the quantum device for operation.

[0074] This embodiment provides an implementation scheme for displaying and sending error correction points for operation through steps 801 and 802, that is, by comparing the quantum circuit diagrams before and after error correction, the error correction points are determined, and the error correction points are clearly displayed to the user end by highlighting the error correction points. Finally, if no modification instruction is received within a certain period of time, the above-mentioned execution entity will send the quantum circuit diagram after error correction to the quantum device for operation.

[0075] To deepen understanding, the present disclosure also provides a specific implementation solution in combination with a specific application scenario:

[0076] This solution mainly includes two aspects: measurement gate check and measurement gate addition. The measurement gate check mainly includes circuit construction process check and pre-operation check:

[0077] Check during circuit construction: When adding a new measurement gate or editing a measurement gate in the circuit diagram, if there is already a measurement gate on the quantum register where the measurement gate is located, such as Figure 7c As shown in the output box, the user is prompted that "each quantum register can have at most one measurement gate". If the measurement gate is not the last operation of the quantum register, such as Figure 7b As shown, the output box prompts the user that "measurement should be the last operation of a quantum register". If the user does not make corrections, after the user clicks "Run", the front end will submit the automatically corrected circuit to the server, that is, more than one measurement gate is recorded as having only one measurement gate on the quantum register, and if the measurement gate is not the last one, it is automatically corrected to be placed at the end of its corresponding quantum register (that is, the last operation bit corresponding to the last operation of the quantum register).

[0078] Pre-run check: When the user clicks Run, the circuit source code file is traversed to determine whether the quantum circuit contains measurement gates, and the number and column number of the measurement gates on each quantum register, as well as the maximum column number of the gate icon on the quantum register, are recorded. If there are measurement gates in the quantum circuit, check whether there is at most one measurement gate on each quantum bit, and whether the measurement gate is the last operation on the quantum bit. If not, the above method is used to automatically correct it for the user. If there are no measurement gates in the quantum circuit (such as Figure 3 ), a pop-up window will prompt the user that "each quantum circuit needs to have at least one measurement gate" and provide a manual addition (corresponding to Figure 5a Add method shown) and one-click add all option (corresponding to Figure 5b shown).

[0079] Measuring gate added: Figure 5b As shown in the figure, when the user clicks the one-click add all option, the front end uses the column number of each gate icon on each quantum bit recorded when checking the circuit to complete the function of adding a measurement gate to the quantum register with one click. Specifically, if there is no gate icon on a quantum register, a measurement gate will not be automatically added to it; if there is a gate icon on a quantum register, a measurement gate will be added to the end of the quantum register based on the largest column number of its gate icon.

[0080] Fig. 9 A flow chart showing a complete implementation process including all the above contents is shown.

[0081] Further references Fig.10 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a quantum circuit diagram error correction device. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0082] like Fig.10 As shown, the quantum circuit diagram error correction device 1000 of this embodiment may include: an operation instruction acquisition unit 1001, a measurement gate actual number determination unit 1002, and a measurement gate automatic addition unit 1003. The operation instruction acquisition unit 1001 is configured to acquire the operation instruction for the quantum circuit diagram drawn in the current drawing window; the measurement gate actual number determination unit 1002 is configured to determine the actual number of measurement gates in the drawn quantum circuit diagram according to the operation instruction; the measurement gate automatic addition unit 1003 is configured to add a measurement gate to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram in response to the actual number being zero, so as to obtain the quantum circuit diagram after error correction.

[0083] In this embodiment, in the quantum circuit diagram error correction device 100, the specific processing of the operation instruction acquisition unit 1001, the actual number of measurement gates determination unit 1002, and the measurement gate automatic addition unit 1003 and the technical effects thereof can be referred to respectively. Figure 2 The relevant descriptions of steps 201 - 203 in the corresponding embodiment are not repeated here.

[0084] In some optional implementations of this embodiment, the measurement gate automatic adding unit 1003 may be further configured to:

[0085] In response to not obtaining additional adding position indication information, a measurement gate is added to the end operation bit of any quantum register in the drawn quantum circuit diagram.

[0086] In some optional implementations of this embodiment, the measurement gate automatic adding unit 1003 may be further configured to:

[0087] In response to not obtaining additional adding position indication information, a measurement gate is added to the end operation bit of each quantum register constituting the drawn quantum circuit diagram.

[0088] In some optional implementations of this embodiment, the measurement gate automatic adding unit 1003 may be further configured to:

[0089] In response to the additional acquisition of the adding position indication information, determining the target quantum register according to the adding position indication information;

[0090] Add a measurement gate to the end operation bit of the target quantum register.

[0091] In some optional implementations of this embodiment, the quantum circuit diagram error correction device 1000 may further include:

[0092] The first error correction prompt information output unit is configured to output error correction prompt information that the quantum circuit diagram needs at least one measurement gate before adding the measurement gate.

[0093] In some optional implementations of this embodiment, the quantum circuit diagram error correction device 1000 may further include:

[0094] The actual operation is a determination unit configured to determine, in response to the actual number being not zero, that the measurement gate is located at the actual operation bit of the corresponding quantum register;

[0095] The measurement gate shifting unit is configured to shift the measurement gate to the last operation bit of the corresponding quantum register in response to the actual operation bit not being the last operation bit, so as to obtain a quantum circuit diagram after error correction.

[0096] In some optional implementations of this embodiment, the quantum circuit diagram error correction device 1000 may further include:

[0097] The second error correction prompt information output unit is configured to output error correction prompt information that the measurement gate can only be used as the last operation of the quantum register before moving the measurement gate whose actual operation bit is not the last operation bit.

[0098] In some optional implementations of this embodiment, the quantum circuit diagram error correction device 1000 may further include:

[0099] The redundant measurement gate deletion unit is configured to delete redundant measurement gates until only one measurement gate remains on a quantum register in response to determining that at least two measurement gates are located in the same quantum register according to the actual operation bit.

[0100] In some optional implementations of this embodiment, the quantum circuit diagram error correction device 1000 may further include:

[0101] an error correction point determination unit configured to determine an error correction point at which the quantum circuit diagram after error correction is different from the drawn quantum circuit diagram;

[0102] The highlighting and running unit is configured to highlight the error correction point, and when the highlighted error correction point is not modified within a preset time period, send the corrected quantum circuit diagram to the quantum device for running.

[0103] This embodiment exists as an apparatus embodiment corresponding to the above method embodiment. The quantum circuit diagram error correction device provided by this embodiment does not directly run when receiving an operation instruction for a drawn quantum circuit diagram in the current drawing window, but first determines the actual number of measurement gates in the current drawn quantum circuit diagram, and when it is found that the actual number is zero, adds a measurement gate to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram, thereby completing automatic error correction of the quantum circuit diagram, avoiding invalid operations of quantum devices due to the lack of necessary measurement gates, and saving precious computing resources of quantum devices.

[0104] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the quantum circuit diagram error correction method described in any of the above embodiments can be implemented when the at least one processor executes.

[0105] According to an embodiment of the present disclosure, the present disclosure further provides a readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to implement the quantum circuit diagram error correction method described in any of the above embodiments when executed.

[0106] According to an embodiment of the present disclosure, the present disclosure further provides a computer program product, which, when executed by a processor, can implement the steps of the quantum circuit diagram error correction method described in any of the above embodiments.

[0107] Fig.11 A schematic block diagram of an example electronic device 1100 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0108] like Fig.11 As shown, the device 1100 includes a computing unit 1101, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1102 or a computer program loaded from a storage unit 1108 into a random access memory (RAM) 1103. In the RAM 1103, various programs and data required for the operation of the device 1100 can also be stored. The computing unit 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.

[0109] A number of components in the device 1100 are connected to the I / O interface 1105, including: an input unit 1106, such as a keyboard, a mouse, etc.; an output unit 1107, such as various types of displays, speakers, etc.; a storage unit 1108, such as a disk, an optical disk, etc.; and a communication unit 1109, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1109 allows the device 1100 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0110] The computing unit 1101 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1101 performs the various methods and processes described above, such as the quantum circuit diagram error correction method. For example, in some embodiments, the quantum circuit diagram error correction method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1108. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1100 via the ROM 1102 and / or the communication unit 1109. When the computer program is loaded into the RAM 1103 and executed by the computing unit 1101, one or more steps of the quantum circuit diagram error correction method described above may be performed. Alternatively, in other embodiments, the computing unit 1101 may be configured to execute the quantum circuit diagram error correction method in any other appropriate manner (for example, by means of firmware).

[0111] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0112] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0113] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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 foregoing.

[0114] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0115] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0116] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.

[0117] According to the technical solution of the embodiment of the present disclosure, when an operation instruction for a drawn quantum circuit diagram in the current drawing window is received, it is not directly executed, but the actual number of measurement gates in the current drawn quantum circuit diagram is first determined, and when it is found that the actual number is zero, a measurement gate is added to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram, thereby completing automatic error correction of the quantum circuit diagram, avoiding invalid operations of quantum devices due to the lack of necessary measurement gates, and saving precious computing resources of quantum devices.

[0118] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0119] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A quantum circuit diagram error correction method, include: Get the running instruction of the quantum circuit diagram drawn in the current drawing window; Determine the actual number of measurement gates in the drawn quantum circuit diagram according to the running instruction, and determine the actual number in a manner including: performing a target detection method based on image content on the gate icon of the measurement gate; In response to the actual number being zero, adding the measurement gate to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram to obtain an error-corrected quantum circuit diagram; In response to the actual number being not zero, determining that the measurement gate is located at the actual operation bit of the quantum register to which it belongs; in response to the bit number of the actual operation bit being followed by a bit number having a larger bit number, moving the measurement gate to the last operation bit of the quantum register to which it belongs, and obtaining a quantum circuit diagram after error correction, wherein the last operation bit has the largest bit number.

2. The method according to claim 1, in, The adding of the measurement gate at the end operation bit of at least one quantum register in the drawn quantum circuit diagram comprises: In response to not obtaining additional adding position indication information, adding the measurement gate at the end operation position of any quantum register in the drawn quantum circuit diagram.

3. The method according to claim 1, in, The adding of the measurement gate at the end operation bit of at least one quantum register in the drawn quantum circuit diagram comprises: In response to not obtaining additional adding position indication information, the measurement gate is added to the end operation bit of each quantum register constituting the drawn quantum circuit diagram.

4. The method according to claim 1, in, The adding of the measurement gate at the end operation bit of at least one quantum register in the drawn quantum circuit diagram comprises: In response to additionally acquiring the adding position indication information, determining the target quantum register according to the adding position indication information; The measurement gate is added at the end operation bit of the target quantum register.

5. The method according to claim 1, further comprising: include: Before adding the measurement gate, outputting the quantum circuit diagram requires error correction prompt information of at least one measurement gate.

6. The method according to claim 1, further comprising: include: Before shifting the measurement gate whose actual operation bit is not the last operation bit, outputting the measurement gate can only serve as error correction prompt information of the last operation of the quantum register where it is located.

7. The method according to claim 1, further comprising: include: In response to determining that at least two of the measurement gates are located in the same quantum register according to the actual operation bit, redundant measurement gates are deleted until only a single measurement gate remains on one of the quantum registers.

8. The method according to any one of claims 1 to 7, further comprising: include: Determining an error correction point where the error-corrected quantum circuit diagram is different from the drawn quantum circuit diagram; The error correction point is highlighted, and when the highlighted error correction point is not modified within a preset time period, the error-corrected quantum circuit diagram is sent to the quantum device for operation.

9. A quantum circuit error correction device, include: An operation instruction acquisition unit is configured to acquire an operation instruction for a quantum circuit diagram that has been drawn in a current drawing window; The actual number determination unit of the measurement gates is configured to determine the actual number of the measurement gates in the drawn quantum circuit diagram according to the running instruction, and the method of determining the actual number includes: performing a target detection method based on image content on the gate icon of the measurement gate; a measurement gate automatic adding unit, configured to add the measurement gate to the end operation bit of at least one quantum register constituting the drawn quantum circuit diagram in response to the actual number being zero, so as to obtain the quantum circuit diagram after error correction; The actual operation is a determination unit configured to determine, in response to the actual number being not zero, that the measurement gate is located at an actual operation bit of the quantum register to which it belongs; The measurement gate shifting unit is configured to shift the measurement gate to the last operation bit of the corresponding quantum register in response to a larger bit number after the bit number of the actual operation bit, so as to obtain a quantum circuit diagram after error correction, wherein the last operation bit has the largest bit number.

10. The device according to claim 9, in, The measuring gate automatic adding unit is further configured to: In response to not obtaining additional adding position indication information, adding the measurement gate at the end operation position of any quantum register in the drawn quantum circuit diagram.

11. The device according to claim 9, in, The measuring gate automatic adding unit is further configured to: In response to not obtaining additional adding position indication information, the measurement gate is added to the end operation bit of each quantum register constituting the drawn quantum circuit diagram.

12. The device according to claim 9, in, The measuring gate automatic adding unit is further configured to: In response to additionally acquiring the adding position indication information, determining the target quantum register according to the adding position indication information; The measurement gate is added at the end operation bit of the target quantum register.

13. The device according to claim 9, further comprising: include: The first error correction prompt information output unit is configured to output error correction prompt information that the quantum circuit diagram needs at least one measurement gate before adding the measurement gate.

14. The device according to claim 9, further comprising: include: The second error correction prompt information output unit is configured to output error correction prompt information that the measurement gate can only be used as the last operation of the quantum register before moving the measurement gate whose actual operation bit is not the last operation bit.

15. The device according to claim 9, further comprising: include: The redundant measurement gate deletion unit is configured to delete redundant measurement gates until only one measurement gate remains on one quantum register in response to determining that at least two measurement gates are located in the same quantum register according to the actual operation bit.

16. The device according to any one of claims 9 to 15, further comprising: include: an error correction point determination unit, configured to determine an error correction point where the error-corrected quantum circuit diagram is different from the drawn quantum circuit diagram; The highlighting and running unit is configured to highlight the error correction point, and when the highlighted error correction point is not modified within a preset time period, send the error-corrected quantum circuit diagram to the quantum device for running.

17. An electronic device, include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the quantum circuit error correction method according to any one of claims 1 to 8.

18. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the quantum circuit diagram error correction method according to any one of claims 1 to 8.

19. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the quantum circuit diagram error correction method according to any one of claims 1 to 8 are implemented.