Method, device and computer readable medium for adding quantum gate with radian parameter
By binding the drag function and radian attribute to the quantum gate with radian parameters on the quantum computing cloud platform, the problem of inconvenient management of radian parameters in the quantum computing cloud platform is solved, and real-time updating of radian values in quantum language programming and quantum computer control are realized. Run efficiently.
Patent Information
- Application Number
- CN202111041803.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-07
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-09-07
AI Technical Summary
When the quantum computing cloud platform adds quantum gates with radian parameters, it lacks effective methods to configure and manage these parameters, which makes it inconvenient to set and update radian values in quantum language programming and affects the operating efficiency of the computer.
By binding the drag and drop function to the quantum gate with radian, configure the radian attribute and set the default value, obtain the radian value after dragging it to the quantum register, update the language programming code, support the editing and real-time synchronization of the radian value, and use the JavaScript programming language to implement Display and transmission of radian values.
It realizes the effective addition and editing of quantum gates with radian parameters in the quantum computing cloud platform, ensures that the radian value is updated in real time in quantum language programming, supports radian setting and transmission similar to U3 gates, and improves the operating efficiency of quantum computers.
Smart Images

Figure CN113887731B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of web front-end and quantum computing, and in particular to a method and device for adding a quantum gate with a radian parameter and a computer-readable medium. Background Art
[0002] The idea of quantum computing was first proposed by Feynman in the 1980s. It is considered to be a new computing model with a disruptive impact on the future. A quantum computer is a computing system composed of a quantum chip and an external measurement and control system. The quantum cloud platform can intuitively provide users with some functions that require the use of quantum computers for calculations. The dragging, adding and editing of quantum gates is the key part of the quantum cloud platform. There are many types of quantum gates. Among them, the quantum gate with arc is an indispensable type. Therefore, the writing of this method is particularly important.
[0003] How to solve the unique needs of quantum computing cloud platforms for adding quantum gates with radian parameters is a technical problem that needs to be solved. Summary of the invention
[0004] The technical task of the present invention is to address the above shortcomings and provide a method, device and computer-readable medium for adding quantum gates with radian parameters to solve the technical problem of how to solve the unique needs of quantum computing cloud platforms for adding quantum gates with radian parameters.
[0005] In a first aspect, a method for adding a quantum gate with a radian parameter of the present invention is to add a quantum gate with a radian parameter to a quantum cloud computing platform, and the method comprises the following steps:
[0006] Bind a drag function to a quantum gate with a radius, wherein the drag function includes dragging the quantum gate with a radius to a quantum register, configuring a property for recording the radius for a quantum gate element in the quantum gate with a radius, and setting a default value for the property;
[0007] After dragging the quantum gate with radian to the quantum register by using the drag function, the radian value of the quantum gate is obtained, the language programming code is updated, and the radian value is displayed in the language programming code by string concatenation;
[0008] When the radian value needs to be changed, the radian value of the quantum gate with radian is edited, the attribute corresponding to the quantum gate with radian to be changed is obtained, the attribute value of the corresponding attribute is changed, and the language programming code is synchronously updated, so that the language programming code changes with the change of the radian of the quantum gate with radian.
[0009] Preferably, the attribute is angle, and the default value selects a common value of the quantum gate with an angle.
[0010] Preferably, when the radian value is displayed by string concatenation, the concatenation method is: quantum gate name+quantum gate location+radian value of the quantum gate.
[0011] Preferably, a change event of the language editor is triggered to update the code in the language editor.
[0012] Preferably, the code programmed in the language is converted into JSON format and transmitted to the back-end calculation of the quantum computing cloud platform.
[0013] Preferably, the language programming code is completed using JavaScript programming language.
[0014] Preferably, after dragging the quantum gate with the arc to the quantum register through the drag function, the arc value of the quantum gate is obtained through the getAtribute attribute acquisition method of JavaScript.
[0015] In a second aspect, a device of the present invention includes: at least one memory and at least one processor;
[0016] The at least one memory is used to store a machine-readable program;
[0017] The at least one processor is used to call the machine-readable program to execute any method described in the first aspect.
[0018] In a third aspect, a computer-readable medium of the present invention stores computer instructions, and when the computer instructions are executed by a processor, the processor executes any method described in the first aspect.
[0019] The method, device and computer-readable medium for adding quantum gates with radian parameters of the present invention have the following advantages: in the process of developing a quantum computing cloud platform, the radian of a quantum gate similar to a U3 gate is set and transmitted to the back end for running a quantum computer and can be displayed in real time in quantum language programming, and the development needs of modifying the radian can be met at the same time. When we add a quantum gate with radian, we need to give the quantum gate added at this time a default radian. If no modification is made, the default radian is passed when it is transmitted to the back end for calculation. When editing the radian, the method for changing the radian is called to complete the change, and the data information of the quantum gate is updated in real time in the language programming code. This method is aimed at the implementation needs of adding quantum gates with radian attributes such as U3 gates. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, 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 only 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.
[0021] The present invention is further described below in conjunction with the accompanying drawings.
[0022] Figure 1 This is a flowchart of a method for adding a quantum gate with a radian parameter in Example 1;
[0023] Figure 2 This is a schematic diagram of dragging a quantum gate with a radian parameter onto a register in the method for adding a quantum gate with a radian parameter in Example 1;
[0024] Figure 3 This is a schematic diagram of editing a quantum gate with a radian parameter in the method for adding a quantum gate with a radian parameter in Example 1;
[0025] Figure 4 This is a schematic diagram of updating the code in language programming after the radian of the quantum gate with radian parameter is changed in the method for adding a quantum gate with radian parameter in Example 1. DETAILED DESCRIPTION
[0026] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it. However, the embodiments are not intended to limit the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments may be combined with each other.
[0027] The embodiments of the present invention provide a method, an apparatus and a computer-readable medium for adding a quantum gate with a radian parameter, which are used to solve the technical problem of how to solve the unique demand of a quantum computing cloud platform for adding a quantum gate with a radian parameter.
[0028] Embodiment 1:
[0029] The method for adding a quantum gate with a radian parameter of the present invention is to add a quantum gate with a radian parameter to a quantum cloud computing platform, such as Figure 1 As shown, the method comprises the following steps:
[0030] S100, binding a drag function to a quantum gate with a radius, wherein the drag function includes dragging the quantum gate with a radius to a quantum register, configuring an attribute for recording the radius for a quantum gate element in the quantum gate with a radius, and setting a default value for the attribute;
[0031] S200, after dragging the quantum gate with the radian to the quantum register by means of the drag function, obtaining the radian value of the quantum gate, updating the language programming code, and displaying the radian value in the language programming code by means of string concatenation;
[0032] S300, when the radian value needs to be changed, the radian value of the quantum gate with radian is edited, the attribute corresponding to the quantum gate with radian to be changed is obtained, the attribute value of the corresponding attribute is changed, and the language programming code is synchronously updated, so that the language programming code changes with the change of the radian of the quantum gate with radian.
[0033] This method is implemented using the JavaScript programming language. Figure 2 As shown, in step S100, the quantum gate with radian is firstly added with a dragging function so that it can be placed on the quantum register, and the radian attribute is set for the element of the quantum gate, and an attribute angle is given to the quantum gate element at the front end and a default value is set to record the radian attribute of the quantum gate, so as to ensure that the quantum gate has an initial value after being dragged to the quantum register, and the initial value is generally the most commonly used value of the quantum gate.
[0034] like Figure 3 and Figure 4 As shown, after step S200 is dragged and dropped onto the quantum register, the change event of the language editor is triggered, the code in the language editor is updated, the radian value of the quantum gate is obtained through the angle attribute of the quantum gate, and then the code in the language editor is updated. The splicing method for the quantum gate with radian is the quantum gate name + the location of the quantum gate + the radian value of the quantum gate, so that the user can clearly understand the radian value of this quantum gate.
[0035] When the radian value of the quantum gate with radian is edited in step S300, the corresponding angle attribute of the quantum gate with radian to be changed needs to be obtained and the attribute value is changed. When the radian is changed in the language editor, the change event of the language editor is triggered, and its angle attribute is changed synchronously so that it changes with the change of the radian of the quantum gate.
[0036] In this embodiment, the code with arcs is converted into data in JSON format according to the format required by the backend and passed to the backend for calculation.
[0037] This method is aimed at the development process of quantum computing cloud platform, which requires the setting of the radian of quantum gates similar to U3 gates and the transmission to the back-end for running quantum computers. It can be displayed in real time in quantum language programming, and the development needs of the radian can be modified. When we add quantum gates with radians, we need to give the quantum gates added at this time a default radian. If no modification is made, the default radian will be passed when it is transmitted to the back-end for calculation. When the radian is edited, the method for changing the radian is called to complete the change, and the data information of the quantum gate is updated in real time in the language programming code. This method is aimed at the implementation needs of adding quantum gates with radian attributes such as U3 gates.
[0038] Embodiment 2:
[0039] The device of the present invention includes: at least one memory and at least one processor; at least one memory is used to store a machine-readable program; at least one processor is used to call the machine-readable program to execute the method disclosed in this embodiment 1.
[0040] Embodiment 3:
[0041] A computer-readable medium of the present invention stores computer instructions, and when the computer instructions are executed by a processor, the processor executes the method disclosed in any embodiment of the present invention. Specifically, a system or device equipped with a storage medium can be provided, on which a software program code for implementing the functions of any of the above embodiments is stored, and a computer (or CPU or MPU) of the system or device reads and executes the program code stored in the storage medium.
[0042] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.
[0043] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.
[0044] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.
[0045] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or written to a memory provided in an expansion unit connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or the expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.
[0046] It should be noted that not all steps and modules in the above-mentioned processes and system structure diagrams are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.
[0047] In the above embodiments, the hardware unit can be realized by mechanical means or electrical means. For example, a hardware unit can include permanent dedicated circuits or logic (such as special processors, FPGA or ASIC) to complete the corresponding operation. The hardware unit can also include programmable logic or circuits (such as general-purpose processors or other programmable processors), which can be temporarily set by software to complete the corresponding operation. Concrete implementation (mechanical means or dedicated permanent circuits or temporarily set circuits) can be determined based on cost and time considerations.
[0048] The present invention is shown and described in detail above through the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above multiple embodiments, those skilled in the art can know that the code review methods in the above different embodiments can be combined to obtain more embodiments of the present invention, and these embodiments are also within the protection scope of the present invention.
Claims
1. A method for adding a quantum gate with a radian parameter, characterized in that For adding a quantum gate with a radian parameter to a quantum cloud computing platform, the method comprises the following steps: Bind a drag function to a quantum gate with a radius, wherein the drag function includes dragging the quantum gate with a radius to a quantum register, configuring a property for recording the radius for a quantum gate element in the quantum gate with a radius, and setting a default value for the property; After dragging the quantum gate with a radius to the quantum register by the drag function, the radius value of the quantum gate is obtained, the language programming code is updated, and the radius value is displayed in the language programming code by string concatenation. The language programming code is converted into json format and transmitted to the back-end calculation of the quantum computing cloud platform. The language programming code is completed by JavaScript programming language. After dragging the quantum gate with a radius to the quantum register by the drag function, the radius value of the quantum gate is obtained by JavaScript's getAtribute attribute acquisition method. When the radian value needs to be changed, the radian value of the quantum gate with radian is edited, the attribute corresponding to the quantum gate with radian to be changed is obtained, the attribute value of the corresponding attribute is changed, and the change event of the language editor is triggered, and the language programming code is synchronously updated, so that the language programming code changes with the change of the radian of the quantum gate with radian.
2. The method for adding a quantum gate with a radian parameter according to claim 1, characterized in that The attribute is angle, and the default value selects a common value of the quantum gate with an angle.
3. The method for adding a quantum gate with a radian parameter according to claim 1, characterized in that When the radian value is displayed by string concatenation, the concatenation method is: quantum gate name+quantum gate location+radian value of the quantum gate.
4. A device for adding a quantum gate with a radian parameter, 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 3.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, which, when executed by a processor, enable the processor to execute any one of the methods of claims 1 to 3.
