Quantum bit calibration method and device and storage medium
By constructing a qubit calibration method, and using a universal functor structure and function pointers to achieve qubit calibration, the problem of manually written calibration functions not adhering to interface definitions is solved, and a low-cost conversion to automated calibration is realized.
Patent Information
- Application Number
- CN202410764930.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2025-12-16
AI Technical Summary
In existing technologies, manually written qubit calibration functions do not adhere to a consistent programming abstraction interface definition, resulting in high modification costs and difficulty in achieving automated calibration.
By obtaining the general functor structure of the calibration function to be called, constructing the general function prototype structure, and using the function pointer to call the actual calibration function, the qubit calibration is achieved, avoiding direct modification of the original calibration function.
Automated qubit calibration is achieved with low modification costs, while maintaining the freedom and consistency of the original calibration function, thus reducing modification costs.
Smart Images

Figure CN121146112A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of quantum computing, and in particular to a quantum bit calibration method and device and storage medium. BACKGROUND
[0002] Quantum bit calibration is a process to ensure that quantum bits can correctly represent quantum information and maintain their coherence and entanglement during quantum computing. For quantum bit calibration, the related art proposes an automated data and algorithm implementation, which predefines explicit programming abstraction interfaces, and then various calibration functions for quantum bit calibration are written based on these interfaces, so that quantum bit calibration can be automatically implemented through these calibration functions.
[0003] This method requires that the calibration functions for quantum bit calibration all comply with consistent programming abstraction interface definitions, that is, all calibration functions for quantum bit calibration must be written based on these programming abstraction interfaces to implement corresponding calibration functions. However, there are still a large number of manually written calibration functions that do not comply with consistent programming abstraction interface definitions. If these manually written calibration functions are to be used to implement quantum bit calibration, the original manually written calibration functions need to be completely re-written and re-engineered, resulting in a large amount of re-engineering costs. Therefore, how to implement automated quantum bit calibration using the original manually written calibration functions at a lower re-engineering cost is a technical problem that needs to be solved. SUMMARY
[0004] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
[0005] The embodiments of the present application provide a quantum bit calibration method, device and storage medium, which can implement automated quantum bit calibration using original manually written calibration functions at a lower re-engineering cost.
[0006] In one aspect, the embodiments of the present application provide a quantum bit calibration method, comprising the following steps:
[0007] For a to-be-called calibration function in a quantum bit calibration graph, a general functor structure corresponding to the to-be-called calibration function is obtained;
[0008] According to the general functor structure, a general function prototype structure corresponding to the to-be-called calibration function is constructed, wherein the general function prototype structure has a function pointer, and the function pointer points to the to-be-called calibration function;
[0009] Based on the general function prototype structure, construct the actual call calibration function corresponding to the calibration function to be called, wherein the actual call calibration function has the function pointer;
[0010] The actual calibration function is invoked to complete the qubit calibration based on the qubit calibration diagram. When the actual calibration function is invoked, it calls the calibration function to be invoked through the function pointer to run the function body of the calibration function to be invoked.
[0011] On the other hand, embodiments of this application also provide a quantum bit calibration device, including:
[0012] The structure acquisition unit is used to acquire the general functor structure corresponding to the calibration function to be called in the qubit calibration diagram.
[0013] The structure construction unit is used to construct a general function prototype structure corresponding to the calibration function to be called based on the general functor structure, wherein the general function prototype structure has a function pointer, and the function pointer points to the calibration function to be called;
[0014] The function construction unit is used to construct the actual call calibration function corresponding to the calibration function to be called based on the general function prototype structure, wherein the actual call calibration function has the function pointer;
[0015] The function call unit is used to call the actual call calibration function to complete the qubit calibration based on the qubit calibration diagram. When the actual call calibration function is called, it calls the calibration function to be called through the function pointer to run the function body of the calibration function to be called.
[0016] Optionally, the qubit calibration diagram includes multiple function nodes, each corresponding to a calibration function used for qubit calibration, and the function nodes are named in the qubit calibration diagram using the function name of the calibration function; the structure acquisition unit is specifically used for:
[0017] Among the multiple function nodes in the quantum bit calibration diagram, the function node to be executed is determined;
[0018] The calibration function corresponding to the function node to be executed is determined as the calibration function to be called, and the function name of the calibration function to be called is obtained according to the function name corresponding to the function node to be executed;
[0019] Based on the function name of the calibration function to be called, obtain the general functor structure corresponding to the calibration function to be called from the preset automatic calibration function library.
[0020] Optionally, the qubit calibration device further includes a function library construction unit, which is used for:
[0021] Establish an initial function library;
[0022] Obtain multiple calibration functions and determine the function of each calibration function;
[0023] Based on the function of each calibration function, determine the calling parameter mnemonic and the return parameter mnemonic for each calibration function;
[0024] For each calibration function, a corresponding general functor structure is generated based on the calling parameter mnemonic and the return parameter mnemonic.
[0025] Based on the function name of each calibration function, the general functor structure corresponding to each calibration function is saved to the initial function library to obtain the automated calibration function library.
[0026] Optionally, the function library construction unit is specifically used for:
[0027] Based on the calling parameter mnemonic and the return parameter mnemonic, a functor main structure corresponding to the calibration function is generated, wherein the functor main structure includes the calling parameter mnemonic and the return parameter mnemonic;
[0028] Determine the first data type and first data structure supported by the mnemonic for the calling parameters, generate a first calling parameter substructure based on the first data type, and generate a second calling parameter substructure based on the first data structure;
[0029] Determine the second data type and second data structure supported by the mnemonic for the return parameter, generate a first return parameter substructure based on the second data type, and generate a second return parameter substructure based on the second data structure;
[0030] Based on the main functor structure, the first call parameter substructure, the second call parameter substructure, the first return parameter substructure, and the second return parameter substructure, the general functor structure corresponding to the calibration function is obtained.
[0031] Optionally, the function library construction unit is specifically used for:
[0032] Create an empty struct;
[0033] Obtain the functor identifier of the general functor structure corresponding to the calibration function, and the function name of the calibration function;
[0034] Set corresponding parameter types for the function name, the functor identifier, the calling parameter mnemonic, and the return parameter mnemonic, respectively;
[0035] The function name, the functor identifier, the calling parameter mnemonic, the return parameter mnemonic, and their respective parameter types are filled into the blank structure to obtain the functor main structure corresponding to the calibration function.
[0036] Optionally, the function library construction unit is specifically used for:
[0037] For each calibration function, the function name of the calibration function is used as a handle, and the structure name of the general functor structure corresponding to the calibration function is used as a pointer to the general functor structure, thus establishing a mapping relationship between each calibration function and the corresponding general functor structure;
[0038] The general functor structure and the mapping relationship corresponding to each calibration function are saved to the initial function library to obtain the automated calibration function library.
[0039] Optionally, the structure acquisition unit is specifically used for:
[0040] Based on the function name of the calibration function to be called, the corresponding target mapping formula is obtained from the preset automated calibration function library;
[0041] The structure name corresponding to the calibration function to be called is obtained according to the target mapping formula;
[0042] Based on the structure name, obtain the general functor structure corresponding to the calibration function to be called from the automated calibration function library.
[0043] Optionally, the general functor structure includes call parameter mnemonics and return parameter mnemonics; the structure building unit is specifically used for:
[0044] Construct a blank function prototype structure;
[0045] Based on the calling parameter mnemonic and the return parameter mnemonic of the general functor structure, generate the calling parameter structure block and the return parameter structure block;
[0046] The call parameter structure block and the return parameter structure block are filled into the blank function prototype structure to obtain the general function prototype structure corresponding to the calibration function to be called.
[0047] Optionally, the calibration function to be called includes input parameter names and output parameter names; the structure building unit is specifically used for:
[0048] Generate a call parameter structure block based on the input parameter name of the calibration function to be called and the call parameter mnemonic of the general functor structure;
[0049] A return parameter structure block is generated based on the output parameter name of the calibration function to be called and the return parameter mnemonic of the general functor structure.
[0050] Optionally, the general function prototype structure includes a call parameter structure block; the function construction unit is specifically used for:
[0051] Based on the call parameter structure block of the general function prototype structure, obtain the corresponding input parameters input to the calibration function to be called;
[0052] Generate an input parameter structure block based on the input parameters;
[0053] The input parameter structure block is filled into the position in the general function prototype structure corresponding to the call parameter structure block to obtain the actual call calibration function corresponding to the calibration function to be called.
[0054] Optionally, the input parameters include input parameter type and input parameter value; the function construction unit is specifically used for:
[0055] Create an empty parameter substructure block;
[0056] Generate parameter type definition statements based on the input parameter types;
[0057] Generate parameter assignment statements based on the input parameter values;
[0058] The parameter type definition statement and the parameter assignment statement are filled into the parameter substructure block to obtain the input parameter structure block.
[0059] On the other hand, embodiments of this application also provide an electronic device, including:
[0060] At least one processor;
[0061] At least one memory for storing at least one program;
[0062] The qubit calibration method described above is implemented when at least one of the programs is executed by at least one of the processors.
[0063] On the other hand, embodiments of this application also provide a computer-readable storage medium storing a processor-executable computer program, which, when executed by a processor, is used to implement the aforementioned quantum bit calibration method.
[0064] On the other hand, embodiments of this application also provide a computer program product, including a computer program or computer instructions, the computer program or computer instructions being stored in a computer-readable storage medium, the processor of an electronic device reading the computer program or computer instructions from the computer-readable storage medium, and the processor executing the computer program or computer instructions to cause the electronic device to perform the quantum bit calibration method as described above.
[0065] In the technical solution provided in this application embodiment, for the calibration function to be called in the qubit calibration diagram, firstly, its corresponding general functor structure is obtained, then a corresponding general function prototype structure is constructed based on the general functor structure, and then a corresponding actual call calibration function is constructed based on the general function prototype structure. The actual call calibration function has a function pointer pointing to the calibration function to be called. Then, the actual call calibration function is called, so that the actual call calibration function calls the calibration function to be called through the function pointer to run the function body of the calibration function to be called, thereby completing the qubit calibration based on the qubit calibration diagram. Because this process does not directly call the calibration function to be called, but first constructs a corresponding general function prototype structure based on the general functor structure corresponding to the calibration function to be called, and then calls the actual calibration function constructed based on the general function prototype structure to achieve qubit calibration, even if the calibration function to be called is a manually written calibration function that does not conform to a consistent programming abstraction interface definition, its original function structure can be transformed into a unified general function prototype structure using its corresponding general functor structure. This allows different calibration functions to be called to implement their original functions based on a unified general function prototype structure. In this way, the interfaces of different calibration functions to be called can be consistently aligned to achieve automated qubit calibration without modifying the calibration function to be called. Since no modification to the calibration function to be called is required in this process, the technical solution provided by this application embodiment can achieve automated qubit calibration using the original manually written calibration function with low modification cost. In addition, since it is no longer necessary to conform to the standardized programming abstraction interface definition to constrain the process of manually writing calibration functions, the consistency of automated calibration can be achieved while fully retaining the freedom of manually writing calibration functions.
[0066] Other features and advantages of this application will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the description and the accompanying drawings. Attached Figure Description
[0067] The accompanying drawings are used to provide a further understanding of the technical solutions of this application and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of this application and do not constitute a limitation on the technical solutions of this application.
[0068] Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application;
[0069] Figure 2 This is a flowchart of a quantum bit calibration method provided in an embodiment of this application;
[0070] Figures 3A-3B This is a schematic diagram of the overall architecture of a quantum bit calibration method provided in an embodiment of this application;
[0071] Figure 4 This is a schematic diagram of the quantum bit calibration diagram provided in the embodiments of this application;
[0072] Figure 5 This is a schematic diagram of the automated calibration function library provided in the embodiments of this application;
[0073] Figure 6 This is a schematic diagram illustrating the construction of an automated calibration function library based on an initial function library, provided in an embodiment of this application.
[0074] Figure 7 This is a schematic diagram illustrating the establishment of mapping relationships provided in an embodiment of this application;
[0075] Figure 8 This is another schematic diagram illustrating the construction of an automated calibration function library based on an initial function library, provided in an embodiment of this application.
[0076] Figure 9 This is a schematic diagram illustrating the actual invocation of the calibration function provided in the embodiments of this application;
[0077] Figure 10 These are detailed implementation diagrams of the quantum bit calibration method provided in the embodiments of this application;
[0078] Figure 11 This is a schematic diagram of the system architecture of the quantum bit calibration method provided in the embodiments of this application;
[0079] Figure 12 This is a schematic diagram of a quantum bit calibration device provided in an embodiment of this application;
[0080] Figure 13 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0081] The present application will be further described below with reference to the accompanying drawings and specific embodiments. The described embodiments should not be considered as limitations on the present application, and all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of the present application.
[0082] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0083] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0084] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0085] Superconducting quantum chip: The central processing unit of a superconducting quantum computer. A quantum computer is a machine that uses the principles of quantum mechanics to perform calculations. Based on the superposition principle and quantum entanglement in quantum mechanics, quantum computers have strong parallel processing capabilities and can solve some problems that are difficult for classical computers to compute. The zero-resistance characteristic of superconducting qubits and their manufacturing process, which is similar to that of integrated circuits, make quantum computing systems built using superconducting qubits one of the most promising systems for realizing practical quantum computing.
[0086] Qubit calibration: Qubits are currently a type of in-memory computing structure. Their data storage and computational control both require precise control of quantum states. The standardization of this control process is the qubit calibration process. A calibrated qubit can maintain precise control within a certain range for a period of time. Unlike the gate logic of digital computers, qubits are essentially a form of analog computational control.
[0087] Quantum bit calibration graph: To meet the requirements for computational computation, qubits undergo a series of calibration procedures based on physical models. These typically involve searching for the operating frequency of the quantum device, calibrating the quantum states and gates of isolated qubits, and co-calibrating multiple qubit gates, among other physical parameter calibration and setting steps. This can be abstracted as a directed graph structure. Due to its analog nature, the calibration process may involve repeated adjustments before and after each calibration step. Current published calibration schemes decompose the same calibration nodes for different calibration targets into multiple isolated nodes and incorporate them into the calibration graph. This avoids the appearance of a loop structure in the graph, potentially leading to a more precise definition of the calibration graph.
[0088] Automated calibration: The calibration process of a qubit involves multiple sets of dependent calibration processes for multiple quantum devices, which can be defined as qubit calibration maps. Each actual node in these processes is involved.
[0089] An Application Binary Interface (ABI) is a set of rules that specifies how a binary executable should exchange information with certain services (such as those provided by the kernel or function libraries) at runtime. The ABI specifically defines which registers and stack addresses are used for information exchange and the meaning of the exchanged values. Once compiled against a given ABI, the binary executable should be able to run on any system with the same ABI. The ABI contains the programming conventions that an application must follow when running on that system, including a series of system calls and methods for using these system calls, as well as rules regarding the memory addresses the program can use and the machine registers it can use.
[0090] Currently disclosed automated calibration schemes for superconducting qubits generally use abstract interfaces to constrain the diversity of calibration functions, employing polymorphic calling methods during actual scheduling. However, in practice, automated quantum calibration involves transforming manually written calibration processes into a finely structured system comprised of interconnected calibration functions through a Directed Acyclic Graph (DAG). This crucial transformation requires a universal structure to accommodate diverse calibration functions, enabling the formation of automatically consistent prototype definitions and the organization of various open calibration functions. However, due to the openness and diversity of actual calibration functions, the transition from manual to automated calibration necessitates a complete overhaul of existing calibration functions, resulting in substantial modification costs.
[0091] Based on this, embodiments of this application provide a qubit calibration method, a qubit calibration device, an electronic device, a computer-readable storage medium, and a computer program product. In the qubit calibration process, the calibration function to be called is not directly invoked. Instead, a corresponding general function prototype structure is first constructed based on the general functor structure corresponding to the calibration function to be called. Then, the actual calibration function constructed based on this general function prototype structure is called to achieve qubit calibration. In this way, even if the calibration function to be called is a manually written calibration function that does not adhere to a consistent programming abstract interface definition, its original function structure can be transformed into a unified general function prototype structure using its corresponding general functor structure. This allows different calibration functions to be called to implement their original function functions based on the unified general function prototype structure. Thus, without modifying the calibration function to be called, the interfaces of different calibration functions to be called can be consistently aligned to achieve automated qubit calibration. Since no modification to the calibration function to be called is required in this process, automated qubit calibration can be achieved using existing manually written calibration functions at a low modification cost. Furthermore, since it is no longer necessary to adhere to standardized programming abstraction interface definitions to constrain the process of manually writing calibration functions, consistency of automated calibration can be achieved while fully preserving the freedom of manually writing calibration functions.
[0092] See Figure 1 , Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application. The implementation environment includes a terminal 101 and a server 102. The terminal 101 and the server 102 can be directly or indirectly connected via wired or wireless communication. The terminal 101 and the server 102 can be nodes in a blockchain, but this embodiment does not specifically limit their presence.
[0093] In some embodiments, terminal 101 may be a smartphone, tablet, laptop, desktop computer, smart voice interaction device, smart home appliance, vehicle terminal, aircraft, VR (Virtual Reality) device, AR (Augmented Reality) device, etc., but is not limited thereto. Optionally, terminal 101 may obtain the calibration function to be called in the qubit calibration diagram and send a calibration request to server 102.
[0094] In some embodiments, server 102 can be a standalone server, a server cluster or distributed system composed of multiple servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. In some embodiments, server 102 primarily undertakes computational work, while terminal 101 undertakes secondary computational work; or, server 102 undertakes secondary computational work, while terminal 101 undertakes primary computational work; or, server 102 and terminal 101 collaborate on computation using a distributed computing architecture. Optionally, server 102 can provide calibration services based on received calibration requests, i.e., perform qubit calibration based on the calibration function to be invoked in the qubit calibration diagram.
[0095] Reference Figure 1 As shown, in one application scenario, assuming terminal 101 is a computer, and terminal 101 provides calibration services. During the process of the target object using terminal 101 to perform qubit calibration, terminal 101 first obtains the general functor structure corresponding to the calibration function to be called. Based on the general functor structure, terminal 101 constructs the general function prototype structure corresponding to the calibration function to be called, where the general function prototype structure has a function pointer pointing to the calibration function to be called. Based on the general function prototype structure, terminal 101 constructs the actual call calibration function corresponding to the calibration function to be called, where the actual call calibration function has this function pointer. Finally, terminal 101 calls the actual call calibration function to complete the qubit calibration based on the qubit calibration diagram. When the actual call calibration function is called, it calls the calibration function to be called through this function pointer to run the function body of the calibration function to be called.
[0096] Reference Figure 1As shown, the calibration service can be divided into an acquisition sub-service, a construction sub-service, and an invocation sub-service. In one embodiment, the acquisition and invocation sub-services can be provided by terminal 101, and the construction sub-service can be provided by server 102. Specifically, during the acquisition sub-service provision by terminal 101, for the calibration function to be invoked in the qubit calibration diagram, a general functor structure corresponding to the calibration function to be invoked is acquired. Terminal 101 sends the general functor structure and a construction request to server 102. During the construction sub-service provision by server 102, a general function prototype structure corresponding to the calibration function to be invoked is constructed based on the received construction request using the general functor structure. The general function prototype structure has a function pointer that points to the calibration function to be invoked. Server 102 also constructs the actual invocation calibration function corresponding to the calibration function to be invoked based on the general function prototype structure and sends the actual invocation calibration function to terminal 101. The actual invocation calibration function has the function pointer. During the process of providing the sub-service call in terminal 101, the actual calibration function is called to complete the qubit calibration based on the qubit calibration diagram. When the actual calibration function is called, it calls the calibration function to be called through the function pointer to run the function body of the calibration function to be called.
[0097] In one embodiment, the calibration service can also be provided by the server 102, including obtaining sub-services, constructing sub-services, and invoking sub-services. The process of the server 102 providing the calibration service is similar to the process of the terminal 101 providing the calibration service described above, and will not be repeated here.
[0098] Figure 2 This is a flowchart illustrating a qubit calibration method provided in an embodiment of this application. The qubit calibration method is executed by a terminal or server alone, or jointly by a terminal and server. In this embodiment, the method is described using an example of execution by a terminal. (Refer to...) Figure 2 The qubit calibration method includes, but is not limited to, steps 210 to 240.
[0099] Step 210: For the calibration function to be called in the qubit calibration diagram, obtain the general functor structure corresponding to the calibration function to be called;
[0100] Step 220: Based on the general functor structure, construct the general function prototype structure corresponding to the calibration function to be called;
[0101] Step 230: Based on the general function prototype structure, construct the actual call calibration function corresponding to the calibration function to be called;
[0102] Step 240: Call the actual calibration function to complete the qubit calibration based on the qubit calibration map.
[0103] It should be noted that the quantum bit calibration method provided in this application embodiment is a method for calibrating quantum bits based on a quantum bit calibration diagram.
[0104] Figures 3A-3B This is a general architecture diagram of a quantum bit calibration method according to an embodiment of this application.
[0105] Figure 3A The top layer is the general functor structure in step 210. The qubit calibration diagram in step 210 has already been described above and will not be repeated here. The calibration function to be called is a piece of program code, specifically the program code / code block waiting to be calibrated corresponding to the function node in the qubit calibration diagram. A general functor structure is a generic data structure used to represent a callable function object or function pointer, which can accept any number and type of parameters and return a value. By defining a general functor structure, any calibration function to be called can be wrapped into a callable object, thus facilitating the passing and manipulation of functions in the program. A general functor structure typically contains member variables and member functions for storing function objects or function pointers, as well as for performing function calls. By defining different member functions or operator overloading, different behaviors of the general functor structure can be implemented, such as function object calls, composition, mapping, etc. General functor structures can be used to implement functional programming operations such as mapping, filtering, and folding, improving code flexibility and reusability.
[0106] A typical qubit calibration diagram includes multiple calibration functions to be called, each of which performs a specific function based on the calling parameters and outputs a return parameter. Often, these functions have dependencies; for example, the return parameter of one function might be the calling parameter of another. Since these functions may be defined by different developers or vendors, there's a possibility that a later function cannot use the return parameter of a previous function as its calling parameter, preventing the qubit calibration from being completed. In this embodiment, instead of directly calling the calibration functions, the general functor structure corresponding to each function is first obtained. This allows the actual calibration function to be regenerated based on the general functor structure, reducing the likelihood of a later function being unable to use the return parameter of a previous function as its calling parameter during the calibration process.
[0107] Steps 220 and 230 correspond to Figure 3A The reflection in the data, through steps 220 and 230, yields the actual call to the calibration function. (Refer to...) Figure 3BThe general functor structure can be obtained from the automated calibration function library via the ABI call engine. After obtaining the general functor structure, steps 220 and 230 are executed to obtain the actual calibration function. The actual calibration function is then called to execute the corresponding function to complete the calibration of the qubit.
[0108] It should be noted that the implementation of automated calibration functions in related technologies requires a set of predefined programming abstract interfaces. All calibration functions must implement their functions based on these abstract interfaces, achieving interface consistency through traditional polymorphism to achieve scheduling harmony with the scheduling state machine. The embodiments of this application solve the problem that even when multiple calibration functions do not adhere to a consistent abstract interface definition, interface consistency alignment at the ABI level can be achieved through reflective functor definitions. This allows a large number of historically accumulated calibration functions written manually to be added to the automated calibration system without modification, significantly reducing modification costs and enabling a smooth transition from manual to automated calibration, while preserving the openness for continued development of calibration functions during manual calibration.
[0109] In one embodiment, step 210 includes:
[0110] Among the multiple function nodes in the qubit calibration graph, determine the function node to be executed;
[0111] The calibration function corresponding to the function node to be executed is determined as the calibration function to be called, and the function name of the calibration function to be called is obtained according to the function name corresponding to the function node to be executed;
[0112] Based on the function name of the calibration function to be called, obtain the general functor structure corresponding to the calibration function to be called from the preset automatic calibration function library.
[0113] Specifically, the qubit calibration diagram includes multiple function nodes. A function node represents a node that performs a specific operation (such as calibration, rotation, or measurement). For example, a function node can represent a quantum gate operation, a quantum entanglement operation, or a measurement operation. Function nodes are also the basic units that actually perform operations, used to describe the relationships and interactions between qubits. In this embodiment, the function nodes correspond to the calibration functions used for qubit calibration, and the function nodes are named in the qubit calibration diagram after the function names of the calibration functions.
[0114] In one example, refer to Figure 4The qubit calibration diagram includes five function nodes: function node 401, function node 402, function node 403, function node 404, and function node 405. Function node 401 corresponds to calibration function J1 used for qubit calibration and is named after it, such as FunctorJ1. Function node 402 corresponds to calibration function J2 used for qubit calibration and is named after it, such as FunctorJ2. Function node 403 corresponds to calibration function J3 used for qubit calibration and is named after it, such as FunctorJ3. Function node 404 corresponds to calibration function J4 used for qubit calibration and is named after it, such as FunctorJ4. Function node 405 corresponds to calibration function J5 used for qubit calibration. Function node 405 is named after the function name of calibration function J5, such as FunctorJ5.
[0115] Based on the actual calibration requirements, the function node to be executed can be determined from multiple function nodes. In one embodiment, the process of determining the function node to be executed from multiple function nodes in the qubit calibration graph can include: first, obtaining the calibration requirements, which include calibration operations and calibration accuracy requirements; and then determining the function node to be executed from multiple function nodes in the qubit calibration graph based on the calibration requirements. Specifically, it is first necessary to clarify the specific calibration requirements, i.e., which qubits or quantum gate operations need to be calibrated, and what the calibration accuracy requirements are. Based on the calibration requirements, the specific operations to be performed are determined, thereby selecting an appropriate function node. This embodiment can determine the function node to be executed based on calibration requirements, and has a certain degree of flexibility and universality. For example, refer to... Figure 4 From function nodes 401 to 405, the function nodes to be executed are determined to be function nodes 401, 402, and 403. Then, based on the function names corresponding to the function nodes to be executed, the function names of the calibration functions to be called are obtained, including FunctorJ1, FunctorJ2, and FunctorJ3.
[0116] The automated calibration function library is a database containing multiple general-purpose functor structures. (See reference...) Figure 5The automated calibration function library contains five general functor structures: H1 for FunctorJ1, H2 for FunctorJ2, H3 for FunctorJ3, H4 for FunctorJ4, and H5 for FunctorJ5. Referring to the example above, if the function name to be called includes FunctorJ1, FunctorJ2, and FunctorJ3, the general functor structures H1, H2, and H3 can be obtained from the automated calibration function library.
[0117] The advantage of the above embodiments for obtaining a general functor structure is that it improves the flexibility of obtaining the structure while still being able to do so.
[0118] In one embodiment, the automated calibration function library is constructed by the following steps:
[0119] Establish an initial function library;
[0120] Obtain multiple calibration functions and determine the function of each calibration function;
[0121] Based on the function of each calibration function, determine the mnemonic for the calling parameters and the mnemonic for the returning parameters of each calibration function;
[0122] For each calibration function, a corresponding general functor structure is generated based on the mnemonic for the calling parameters and the mnemonic for the returning parameters;
[0123] Based on the function name of each calibration function, the general functor structure corresponding to each calibration function is saved to the initial function library to obtain the automated calibration function library.
[0124] The initial function library is a database used to store data. It can be created on the terminal or on a server. For example, the terminal can create the initial function library on its local storage. Calibration functions are used to calibrate qubits. Generally, one qubit calibration map corresponds to multiple calibration functions, but in reality, multiple qubit calibration maps exist. Therefore, the multiple calibration functions in this embodiment may correspond to one qubit calibration map or multiple qubit calibration maps. Each calibration function performs a specific operation when calibrating a qubit, i.e., it has a specific functionality (such as calibration, rotation, measurement, etc.). Although each calibration function has a specific functionality, different calibration functions may have the same functionality, such as all being rotation functions.
[0125] Referring to the above, each calibration function to be called performs a specific function based on the calling parameters and outputs a return parameter. Furthermore, the return parameter of the preceding calibration function is the calling parameter of the following calibration function. In this embodiment, the processing mainly involves the calling parameters and return parameters of each calibration function. Specifically, since calibration functions with different functions should have different calling parameters and return parameters, it is necessary to determine the calling parameter mnemonic and return parameter mnemonic for each calibration function based on its function. The calling parameter mnemonic is the mnemonic used to replace the calling parameters. The return parameter mnemonic is the mnemonic used to replace the return parameters. Mnemonics are a technique used in programming to simplify the reference of function parameters in code. By using mnemonics, the calling parameters and return parameters of calibration functions can be effectively replaced, making the code clearer, more concise, and easier to understand while retaining the function's functionality.
[0126] It should be noted that two calibration functions with different functionalities correspond to different call parameter mnemonics and return parameter mnemonics. Conversely, two calibration functions with the same functionalities correspond to the same call parameter mnemonics and return parameter mnemonics.
[0127] After determining the mnemonics for the calling and returning parameters, a general functor structure corresponding to each calibration function can be generated. The specific generation process will be described in detail in the examples below, and will be omitted here.
[0128] In one example, such as Figure 6 As shown, the functions of calibration functions J1 to J5 are different, thus generating five distinct general functor structures: general functor structures H1, H2, H3, H4, and H5. General functor structure H1 is added to the initial function library based on the function name corresponding to calibration function J1 (e.g., FunctorJ1); general functor structure H2 is added based on the function name corresponding to calibration function J2 (e.g., FunctorJ2); general functor structure H3 is added based on the function name corresponding to calibration function J3 (e.g., FunctorJ3); general functor structure H4 is added based on the function name corresponding to calibration function J4 (e.g., FunctorJ4); and general functor structure H5 is added based on the function name corresponding to calibration function J5 (e.g., FunctorJ5). After all general functor structures are added to the initial function library, the automated calibration function library is obtained.
[0129] The advantage of the above-described embodiment of building an automated calibration function library is that it reduces the complexity of building the library while still enabling its construction.
[0130] In one embodiment, the process of generating the corresponding general functor structure based on the calling parameter mnemonic and the return parameter mnemonic may include:
[0131] Based on the mnemonic for the calling parameters and the mnemonic for the returning parameters, the main structure of the functor corresponding to the calibration function is generated. The main structure of the functor includes the mnemonic for the calling parameters and the mnemonic for the returning parameters.
[0132] Determine the first data type and first data structure supported by the calling parameter mnemonic, generate a first calling parameter substructure based on the first data type, and generate a second calling parameter substructure based on the first data structure;
[0133] Determine the second data type and second data structure supported by the mnemonic for the return parameter, generate a first return parameter substructure based on the second data type, and generate a second return parameter substructure based on the second data structure;
[0134] Based on the main functor structure, the first call parameter substructure, the second call parameter substructure, the first return parameter substructure, and the second return parameter substructure, the general functor structure corresponding to the calibration function is obtained.
[0135] The functor main structure is a metafunction definition structure. Metafunctions require handles, which have two forms: a numeric handle `functor_id` for ABI interface use and a mnemonic handle `name` for upper-level code use. To support open function definitions, this embodiment supports functions with multiple parameters and multiple return values, and both the number of parameters and the number of return values are variable.
[0136] In one embodiment, the process of generating the functor main structure corresponding to the calibration function based on the calling parameter mnemonic and the return parameter mnemonic may include:
[0137] Create an empty struct;
[0138] Obtain the functor identifier of the general functor structure corresponding to the calibration function, as well as the function name of the calibration function;
[0139] Set the corresponding parameter types for the function name, functor identifier, call parameter mnemonic, and return parameter mnemonic, respectively;
[0140] Fill the blank structure with the function name, functor identifier, call parameter mnemonic, return parameter mnemonic, and their respective parameter types to obtain the functor main structure corresponding to the calibration function.
[0141] Specifically, an empty structure refers to a structure without any member variables. For example, an empty structure is `message Functor{}`. For each calibration function, the function name (`name`) and the functor identifier (`functor_id`) of the corresponding general functor structure should be obtained. Taking calibration function J1 as an example, its corresponding general functor structure is general functor structure H1. Therefore, the function name of calibration function J1 (e.g., `name` is J1) and the functor identifier of general functor structure H1 (e.g., `functor_id` is H1) should be obtained. The parameter type is a specific data type, such as integer (`uint32`), string (`string`), or user-defined type (`repeated ArgumentValuePair`).
[0142] In one example, the functor main structure can be as follows:
[0143]
[0144] In this example, uint32, string, and repeated ArgumentValuePair are all parameter types. functor_id refers to the functor identifier of the generic functor structure. name refers to the function name of the corresponding calibration function. param represents the call parameter mnemonic. ret represents the return parameter mnemonic.
[0145] The advantage of the above embodiment for generating the functor principal structure corresponding to the calibration function is that it reduces the complexity of generating the functor principal structure.
[0146] After generating the functor main structure, the following sections will elaborate on the meta-definition of the calling parameter mnemonic and the return parameter mnemonic, based on the data type and data structure.
[0147] For call parameter mnemonics, first determine the first data type and the first data structure. The first data type refers to the data type supported by the call parameter mnemonics. The first data structure refers to the data structure supported by the call parameter mnemonics. Then, generate a first call parameter substructure based on the first data type, and generate a second call parameter substructure based on the first data structure. In one example, the first call parameter substructure is shown below:
[0148]
[0149]
[0150] In the example above, `enum AtomicDataType` represents an enumerated atomic data type, that is, an indivisible data type. `UNKNOWN_DataType`, `BYTES`, `BOOL`, `INT`, `STRING`, `FLOAT`, `NONE`, and `ARRAY1D` all represent a field type. The numbers mentioned above (e.g., 0 to 7) all represent a field type identifier.
[0151] In one example, the second call parameter substructure is shown below:
[0152]
[0153] In the example above, `messageValueList` and `messageValue` represent a data structure. `repeatedValue`, `NullValue`, `double`, `int64`, `string`, `bytes`, `bool`, `Array1D`, and `ValueList` all represent field types. `null_value`, `double_value`, `int_value`, `string_value`, `byte_value`, `bool_value`, `array_value`, and `list_value` all represent field names. The numbers (e.g., 1 to 8) represent field identifiers. `oneof kind{}` means that only one field in `messageValue{}` can be serialized. This ensures that only one field is set to a non-zero value, while other fields are automatically cleared to zero.
[0154] For the return parameter mnemonic, first determine the second data type and the second data structure. The second data type refers to the data type supported by the return parameter mnemonic. The second data structure refers to the data structure supported by the return parameter mnemonic. Then, generate the first return parameter substructure based on the second data type, and generate the second return parameter substructure based on the second data structure. In one example, the first return parameter substructure is shown below:
[0155] enum NullValue{
[0156] NULL_VALUE = 0;
[0157] }
[0158] In the example above, `enum NullValue` represents an enumerated atomic data type, that is, an indivisible data type. `NULL_VALUE` represents a field type. The numbers mentioned above (such as 0) represent a field type identifier.
[0159] In one example, the second return parameter substructure is shown below:
[0160]
[0161]
[0162] In the example above, `message SingleValue` represents a data structure. `AtomicDataType` and `Value` both represent field types. `type` and `value` both represent field names.
[0163] The following are the mnemonic definitions and pass-by-value storage definitions for leaf parameters:
[0164]
[0165] Pass-by-value storage is a programming concept, particularly relevant to function calls and parameter passing. In pass-by-value storage, when a function is called with an argument passed to it, the value of that argument is copied inside the function. This means that any modifications made to the argument inside the function will not affect the original variable or object.
[0166] After obtaining the main functor structure, the first call parameter substructure, the second call parameter substructure, the first return parameter substructure, and the second return parameter substructure, the general functor structure corresponding to the calibration function can be obtained by integrating these structures.
[0167] In one embodiment, the process of saving the general functor structure corresponding to each calibration function to the initial function library based on the function name of each calibration function to obtain the automated calibration function library may include:
[0168] For each calibration function, the function name of the calibration function is used as a handle, and the structure name of the general functor structure corresponding to the calibration function is used as a pointer to the general functor structure to establish a mapping relationship between each calibration function and the corresponding general functor structure.
[0169] The general functor structure and mapping relationship corresponding to each calibration function are saved to the initial function library to obtain the automated calibration function library.
[0170] In computer programming, a handle typically refers to an identifier or reference used to identify the association between a function and a database. A handle can be an integer, a pointer, or other unique identifier. In this embodiment, the function name of the calibration function is used as the handle. In one example, handle B1 is obtained based on the function name of calibration function J1 (FunctorJ1), handle B2 is obtained based on the function name of calibration function J2 (FunctorJ2), handle B3 is obtained based on the function name of calibration function J3 (FunctorJ3), handle B4 is obtained based on the function name of calibration function J4 (FunctorJ4), and handle B5 is obtained based on the function name of calibration function J5 (FunctorJ5).
[0171] The structure name of the general functor structure corresponding to each calibration function is used as a pointer to the general functor structure. In one example, pointer F1 is obtained based on the structure name of the general functor structure H1 corresponding to calibration function J1, pointer F2 is obtained based on the structure name of the general functor structure H2 corresponding to calibration function J2, pointer F3 is obtained based on the structure name of the general functor structure H3 corresponding to calibration function J3, pointer F4 is obtained based on the structure name of the general functor structure H4 corresponding to calibration function J4, and pointer F5 is obtained based on the structure name of the general functor structure H5 corresponding to calibration function J5.
[0172] Based on handles and pointers, establish a mapping relationship between each calibration function and its corresponding general functor structure. (Refer to...) Figure 7 In one example, based on handle B1 and pointer F1, a mapping relationship Y1 is established between calibration function J1 and general functor structure H1; based on handle B2 and pointer F2, a mapping relationship Y2 is established between calibration function J2 and general functor structure H2; based on handle B3 and pointer F3, a mapping relationship Y3 is established between calibration function J3 and general functor structure H3; based on handle B4 and pointer F4, a mapping relationship Y4 is established between calibration function J4 and general functor structure H4; and based on handle B5 and pointer F5, a mapping relationship Y5 is established between calibration function J5 and general functor structure H5.
[0173] Then, the general functor structure and mapping formula corresponding to each calibration function are saved to the initial function library to obtain the automated calibration function library. In one example, such as... Figure 8As shown, the general functor structure H1 and mapping relation Y1 are saved to the initial function library; the general functor structure H2 and mapping relation Y2 are saved to the initial function library; the general functor structure H3 and mapping relation Y3 are saved to the initial function library; the general functor structure H4 and mapping relation Y4 are saved to the initial function library; and the general functor structure H5 and mapping relation Y5 are saved to the initial function library. After all the general functor structures are placed in the initial function library, the automatic calibration function library can be obtained.
[0174] The advantage of the above embodiment, which uses function names and structure names to establish a mapping relationship and saves it to the initial function library to finally obtain the automated calibration function library, is that it facilitates the retrieval of the general functor structure corresponding to the calibration function to be called from the automated calibration function library based on the mapping relationship, which helps to improve the retrieval efficiency.
[0175] In one embodiment, the process of obtaining the general functor structure corresponding to the calibration function to be called from a preset automated calibration function library based on the function name of the calibration function to be called may include: first, obtaining the corresponding target mapping expression from the preset automated calibration function library based on the function name of the calibration function to be called; second, obtaining the structure name corresponding to the calibration function to be called based on the target mapping expression; and then obtaining the general functor structure corresponding to the calibration function to be called from the automated calibration function library based on the structure name.
[0176] Reference Figure 8 For example, the calibration function to be called is calibration function J1. Based on the function name of calibration function J1 (e.g., FunctorJ1), a handle B1 is obtained. Since the mapping expression Y1 indicates the relationship between handle B1 and pointer F1, the target mapping expression Y1 is obtained from the automated calibration function library based on handle B1. Based on pointer F1 in mapping expression Y1, the structure name corresponding to the calibration function to be called, the general functor structure H1, can be obtained. Based on the structure name of the general functor structure H1, the general functor structure corresponding to calibration function J1, i.e., the general functor structure H1, is obtained from the automated calibration function library.
[0177] The advantage of this embodiment is that it can improve the efficiency of obtaining the general functor structure corresponding to the calibration function to be called from the automated calibration function library based on the mapping relationship.
[0178] In step 220, a general function prototype structure corresponding to the calibration function to be called is constructed based on the general functor structure. Referring to the above, the general functor structure includes call parameter mnemonics and return parameter mnemonics. Different behaviors of the general functor structure can be achieved by defining different member functions or operator overloads, such as function object calls, composition, and mapping operations. The calibration function to be called has specific functionalities; the member functions or operators in the general functor structure can be overloaded based on these functionalities to obtain the general function prototype structure.
[0179] It should be noted that two calibration functions with different functionalities correspond to different general function prototype structures. Conversely, two calibration functions with the same functionalities correspond to the same general function prototype structure.
[0180] In addition, the generic function prototype structure contains a function pointer, which points to the calibration function to be called. A function pointer is a pointer to a function; it can store the address of the calibration function, allowing the program to execute the calibration function through the function pointer. The declaration and use of function pointers are similar to ordinary pointers, but it is important to note that the parameter types and return types of the function must match the function pointer.
[0181] In one embodiment, the process of constructing the general function prototype structure corresponding to the calibration function to be called based on the general functor structure may include:
[0182] Construct a blank function prototype structure;
[0183] Generate call parameter structure blocks and return parameter structure blocks based on the call parameter mnemonic and return parameter mnemonic of the general functor structure;
[0184] Fill the call parameter structure block and return parameter structure block into the blank function prototype structure to obtain the general function prototype structure corresponding to the calibration function to be called.
[0185] Specifically, a blank function prototype structure refers to a structure without any member variables. For example, a blank function prototype structure is: Func<>. Assuming the calibration function to be called is calibration function J1, the corresponding general functor structure is general functor structure H1. Based on the calling parameter mnemonics and return parameter mnemonics of general functor structure H1, calling parameter structure blocks and return parameter structure blocks are generated. The calling parameter structure blocks and return parameter structure blocks of general functor structure H1 are then filled into the blank function prototype structure to obtain the general function prototype structure corresponding to calibration function J1. For example, the general function prototype structure is: Func<PARAM,PARAM,…> PARAM represents a call parameter structure block or a return parameter structure block.
[0186] In one embodiment, the calibration function to be called includes input parameter names and output parameter names. Therefore, the process of generating the call parameter structure block and the return parameter structure block based on the call parameter mnemonic and return parameter mnemonic of the general functor structure can include:
[0187] Generate a call parameter structure block based on the input parameter name of the calibration function to be called and the call parameter mnemonic of the general functor structure;
[0188] Generate a return parameter structure block based on the output parameter name of the calibration function to be called and the return parameter mnemonic of the general functor structure.
[0189] Referring to the above, calibrating a qubit calibration map generally requires multiple calibration functions to be called, and typically the return parameter of the preceding calibration function becomes the calling parameter of the following calibration function. In this embodiment, the input parameter name refers to the name of the calling parameter, and the output parameter name refers to the name of the returned parameter.
[0190] The input parameter name is a customized name within the calibration function to be called, while the calling parameter mnemonic is a universal symbol used within the general functor structure. Similarly, the output parameter name is a customized name within the calibration function to be called, while the return parameter mnemonic is a universal symbol used within the general functor structure. Therefore, generating a calling parameter structure block based on the input parameter name and calling parameter mnemonic, and generating a return parameter structure block based on the output parameter name and return parameter mnemonic, ensures that the functionality of the calibration function to be called is not affected, and that subsequent calibration functions to be called can use the return parameter of the previous calibration function as their calling parameter.
[0191] The advantage of the above embodiments is that they reduce the difficulty of generating call parameter structure blocks and return parameter structure blocks while still being able to generate them.
[0192] In step 230, the actual calibration function corresponding to the calibration function to be called is constructed based on the general function prototype structure. The actual calibration function has a function pointer.
[0193] It is understandable that the function pointer in the actual call to the calibration function is the same as the function pointer in the general function prototype structure, both pointing to the calibration function to be called.
[0194] The actual calibration function call is a piece of program code, specifically the program code / code block that performs calibration on the function node corresponding to the qubit calibration diagram. The connection between the actual calibration function call and the calibration function to be called is that the actual calibration function call is generated based on the calibration function to be called, and the actual calibration function call has the same functionalities as the calibration function to be called. The difference between the actual calibration function call and the calibration function to be called is that the call parameters and return parameters of the actual calibration function call are more general than those of the calibration function to be called, which can reduce the possibility that the latter calibration function cannot use the return parameters of the former calibration function as its call parameters.
[0195] In one embodiment, the general function prototype structure includes a call parameter structure block. The process of constructing the actual call calibration function corresponding to the calibration function to be called based on the general function prototype structure may include:
[0196] Based on the call parameter structure block of the general function prototype structure, obtain the corresponding input parameters to be called the calibration function;
[0197] Generate an input parameter structure block based on the input parameters;
[0198] The input parameter structure block is filled into the position corresponding to the call parameter structure block in the general function prototype structure to obtain the actual call calibration function corresponding to the calibration function to be called.
[0199] Specifically, the general function prototype structure has been described above and will not be repeated here. The call parameter structure block is a code block / segment that constitutes the general function prototype structure. The call parameter structure block mainly includes the call parameter names.
[0200] In one embodiment, the process of obtaining the corresponding input parameters to the calibration function to be called based on the call parameter structure block of the general function prototype structure may include: obtaining multiple return parameters corresponding to the call parameter name based on the call parameter name, thereby obtaining multiple input parameters.
[0201] An input parameter structure block is a code block / segment primarily used to represent a code block formed from input parameters. In one embodiment, the input parameters include input parameter type and input parameter value. The process of generating an input parameter structure block based on the input parameters described above may include:
[0202] Create an empty parameter substructure block;
[0203] Generate parameter type definition statements based on the input parameter types;
[0204] Generate parameter assignment statements based on input parameter values;
[0205] Fill the parameter type definition statement and parameter assignment statement into the parameter substructure block to obtain the input parameter structure block.
[0206] An empty parameter substructure block refers to a code block without any member variables. For example, an empty parameter substructure block is: `param{}`. Assuming the input parameter type includes `INT`, the parameter type definition statement is: `type: INT`. Assuming the input parameter value is 102, the parameter assignment statement is: `int_val: 102`. Finally, the input parameter structure block is: `val{type: INT, int_val: 102}`. Here, `val` represents the parameter block name, `type` represents the type name of the input parameter, `INT` represents the input parameter type, `int_val` represents the parameter name of the input parameter value, and `102` represents the input parameter value.
[0207] The advantage of the above embodiments is that, based on the ability to generate input parameter structure blocks, the generation complexity can be reduced because corresponding statements are generated based on the input parameter type and input parameter value to obtain the input parameter structure blocks.
[0208] After obtaining the input parameter structure block, it can be filled into the corresponding positions in the general function prototype structure to obtain the actual calibration function to be called. For example, the general function prototype structure might be: `param{param: "sample_uuid"}`, `param{param: "measure"}`, etc. Here, `param: "sample_uuid"` and `param: "measure"` both represent the call parameter structure block. After filling the input parameter structure block into the corresponding positions in the general function prototype structure, the resulting actual calibration function is as follows: Figure 9 As shown. (Refer to...) Figure 9 Functor represents the actual call to the calibration function, name represents the name of the actual call to the calibration function, and the remaining part is a general function prototype structure, which will not be described in detail.
[0209] In one example, taking the calibration of the qubit relaxation time T1 as an example (return values are ignored in this example), the calibration function is: T1(int32 sample_uuid, repeated string measure, Array delay_us, int32 stats, Status state, string name, bool save, bool update, bool noisy, bool reset, boolplot). Abstracting T1, we can obtain the following instance:
[0210]
[0211]
[0212]
[0213] The explanation of each parameter in the example above can be found in the text above. Figure 9 The explanation of the parameters will not be repeated here.
[0214] In step 240, the actual calibration functions are invoked to complete the qubit calibration based on the qubit calibration map. As mentioned above, qubit calibration based on the qubit calibration map generally requires multiple calibration functions to be invoked. In one example, assuming three calibration functions are needed, including calibration function J1, calibration function J2, and calibration function J3, the actual calibration functions invoked include the actual calibration function S1 corresponding to calibration function J1, the actual calibration function S2 corresponding to calibration function J2, and the actual calibration function S3 corresponding to calibration function J3. The actual calibration functions S1, S2, and S3 are invoked to complete the qubit calibration based on the qubit calibration map.
[0215] It should be noted that when the actual calibration function is called, the actual caller invokes the calibration function J1 through a function pointer to execute the function body of the calibration function to be invoked. For example, when the actual calibration function S1 is called, the actual caller S1 invokes the calibration function J1 through a function pointer to execute the function body of the calibration function to be invoked S1.
[0216] The following reference Figure 10 The implementation details of the quantum bit calibration method in the embodiments of this application are described in detail.
[0217] (1) Among the multiple function nodes in the qubit calibration diagram, determine the function node to be executed, determine the calibration function corresponding to the function node to be executed as the calibration function to be called, and obtain the function name of the calibration function to be called based on the function name corresponding to the function node to be executed;
[0218] (2) Based on the function name of the calibration function to be called, obtain the corresponding target mapping relationship from the preset automatic calibration function library, obtain the structure name corresponding to the calibration function to be called based on the target mapping relationship, and obtain the general functor structure corresponding to the calibration function to be called from the automatic calibration function library based on the structure name.
[0219] (3) Construct a blank function prototype structure. Based on the input parameter name of the calibration function to be called and the calling parameter mnemonic of the general functor structure, generate a calling parameter structure block. Based on the output parameter name of the calibration function to be called and the return parameter mnemonic of the general functor structure, generate a return parameter structure block. Fill the calling parameter structure block and the return parameter structure block into the blank function prototype structure to obtain the general function prototype structure corresponding to the calibration function to be called. The general function prototype structure includes the calling parameter structure block.
[0220] (4) Based on the call parameter structure block of the general function prototype structure, obtain the corresponding input parameters to be called calibration function, create a blank parameter sub-structure block, generate parameter type definition statement based on input parameter type, generate parameter assignment statement based on input parameter value, fill the parameter type definition statement and parameter assignment statement into the parameter sub-structure block to obtain the input parameter structure block;
[0221] (5) Fill the input parameter structure block into the position corresponding to the call parameter structure block in the general function prototype structure to obtain the actual call calibration function corresponding to the calibration function to be called;
[0222] (6) Call the actual calibration function to complete the qubit calibration based on the qubit calibration diagram. When the actual calibration function is called, it calls the calibration function to be called through the function pointer to run the function body of the calibration function to be called.
[0223] The following reference Figure 11 The system architecture for implementing the quantum bit calibration method of the embodiments of this application is described in detail.
[0224] Figure 11 The system architecture shown includes a console, a control center, and an experimental platform. The console includes an MDI View, a Model, a Controller, and a gRPC Client. The control center includes a first server (gRPC Service), a configuration center, a multi-calibration session scheduling engine, a single-calibration session scheduling engine, and a calibration node engine. The experimental platform includes a second server (gRPC Service), calibration session management, a data acquisition function library, an analysis function library, a registry, a data channel, and an automation system (LabRAD system).
[0225] The aforementioned qubit calibration method primarily operates within the calibration node engine of the control center, with other modules forming a complete automated calibration system built around this method. For example... Figure 11 The calibration log shown is used to record log data during the calibration process. For example...Figure 11 The calibration database shown is used to store calibration data during the calibration process.
[0226] The experimental platform is an early manual calibration console that can store experimental data. It can also be used to build a standardized automated calibration function library using a general functor structure, and a console interaction module is introduced to control and display the automated process.
[0227] It is understood that this application provides a reflective functor call algorithm (i.e., a qubit calibration method) for a smooth transition from calibration functions to an automated system during the construction of an automated chip calibration system. By using a general functor structure and generic mechanisms, it balances the conflict between the openness of the calibration process and the consistency of calibration automation, greatly reducing the construction cost and improving the efficiency of automated calibration. The automated calibration system built in the quantum laboratory uses this reflective functor call algorithm as its core structure, achieving an upgrade from the previously piecemeal manual calibration process to a fully automated system calibration. The entire calibration process can be reduced from several months to several days, significantly improving calibration efficiency.
[0228] Reference Figure 12 This application also discloses a qubit calibration device 1200, which can implement a qubit calibration method in the preceding embodiments. The qubit calibration device 1200 includes:
[0229] The structure acquisition unit 1210 is used to acquire the general functor structure corresponding to the calibration function to be called in the qubit calibration diagram.
[0230] The structure construction unit 1220 is used to construct a general function prototype structure corresponding to the calibration function to be called based on the general functor structure. The general function prototype structure has a function pointer, which points to the calibration function to be called.
[0231] The function construction unit 1230 is used to construct the actual call calibration function corresponding to the calibration function to be called based on the general function prototype structure, wherein the actual call calibration function has a function pointer;
[0232] The function call unit 1240 is used to call the actual call calibration function to complete the qubit calibration based on the qubit calibration diagram. When the actual call calibration function is called, it calls the calibration function to be called through the function pointer to run the function body of the calibration function to be called.
[0233] In one embodiment, the qubit calibration diagram includes multiple function nodes, each corresponding to a calibration function used for qubit calibration. The function nodes are named in the qubit calibration diagram after the function name of the calibration function. The structure acquisition unit 1210 is specifically used for:
[0234] Among the multiple function nodes in the qubit calibration graph, determine the function node to be executed;
[0235] The calibration function corresponding to the function node to be executed is determined as the calibration function to be called, and the function name of the calibration function to be called is obtained according to the function name corresponding to the function node to be executed;
[0236] Based on the function name of the calibration function to be called, obtain the general functor structure corresponding to the calibration function to be called from the preset automatic calibration function library.
[0237] In one embodiment, the qubit calibration device further includes a function library construction unit (not shown), which is used for:
[0238] Establish an initial function library;
[0239] Obtain multiple calibration functions and determine the function of each calibration function;
[0240] Based on the function of each calibration function, determine the mnemonic for the calling parameters and the mnemonic for the returning parameters of each calibration function;
[0241] For each calibration function, a corresponding general functor structure is generated based on the mnemonic for the calling parameters and the mnemonic for the returning parameters;
[0242] Based on the function name of each calibration function, the general functor structure corresponding to each calibration function is saved to the initial function library to obtain the automated calibration function library.
[0243] In one embodiment, the function library construction unit (not shown) is specifically used for:
[0244] Based on the mnemonic for the calling parameters and the mnemonic for the returning parameters, the main structure of the functor corresponding to the calibration function is generated. The main structure of the functor includes the mnemonic for the calling parameters and the mnemonic for the returning parameters.
[0245] Determine the first data type and first data structure supported by the calling parameter mnemonic, generate a first calling parameter substructure based on the first data type, and generate a second calling parameter substructure based on the first data structure;
[0246] Determine the second data type and second data structure supported by the mnemonic for the return parameter, generate a first return parameter substructure based on the second data type, and generate a second return parameter substructure based on the second data structure;
[0247] Based on the main functor structure, the first call parameter substructure, the second call parameter substructure, the first return parameter substructure, and the second return parameter substructure, the general functor structure corresponding to the calibration function is obtained.
[0248] In one embodiment, the function library construction unit (not shown) is specifically used for:
[0249] Create an empty struct;
[0250] Obtain the structure name and functor identifier of the general functor structure corresponding to the calibration function;
[0251] Set the corresponding parameter types for the structure name, functor identifier, calling parameter mnemonic, and return parameter mnemonic, respectively;
[0252] Fill the blank structure with the structure name, functor identifier, call parameter mnemonic, return parameter mnemonic, and their respective parameter types to obtain the functor main structure corresponding to the calibration function.
[0253] In one embodiment, the function library construction unit (not shown) is specifically used for:
[0254] For each calibration function, the function name of the calibration function is used as a handle, and the structure name of the general functor structure corresponding to the calibration function is used as a pointer to the general functor structure to establish a mapping relationship between each calibration function and the corresponding general functor structure.
[0255] The general functor structure and mapping relationship corresponding to each calibration function are saved to the initial function library to obtain the automated calibration function library.
[0256] In one embodiment, the structure acquisition unit (not shown) is specifically used for:
[0257] Based on the function name of the calibration function to be called, the corresponding target mapping formula is obtained from the preset automated calibration function library;
[0258] The structure name corresponding to the calibration function to be called is obtained based on the target mapping formula;
[0259] Based on the structure name, retrieve the general functor structure corresponding to the calibration function to be called from the automated calibration function library.
[0260] In one embodiment, the general functor structure includes call parameter mnemonics and return parameter mnemonics; the structure construction unit 1220 is specifically used for:
[0261] Construct a blank function prototype structure;
[0262] Generate call parameter structure blocks and return parameter structure blocks based on the call parameter mnemonic and return parameter mnemonic of the general functor structure;
[0263] Fill the call parameter structure block and return parameter structure block into the blank function prototype structure to obtain the general function prototype structure corresponding to the calibration function to be called.
[0264] In one embodiment, the calibration function to be invoked includes an input parameter name and an output parameter name; the structure building unit 1220 is specifically used for:
[0265] Generate a call parameter structure block based on the input parameter name of the calibration function to be called and the call parameter mnemonic of the general functor structure;
[0266] Generate a return parameter structure block based on the output parameter name of the calibration function to be called and the return parameter mnemonic of the general functor structure.
[0267] In one embodiment, the generic function prototype structure includes a call parameter structure block; the function construction unit 1230 is specifically used for:
[0268] Based on the call parameter structure block of the general function prototype structure, obtain the corresponding input parameters to be called the calibration function;
[0269] Generate an input parameter structure block based on the input parameters;
[0270] The input parameter structure block is filled into the position corresponding to the call parameter structure block in the general function prototype structure to obtain the actual call calibration function corresponding to the calibration function to be called.
[0271] In one embodiment, the input parameters include input parameter type and input parameter value; the function construction unit 1230 is specifically used for:
[0272] Create an empty parameter substructure block;
[0273] Generate parameter type definition statements based on the input parameter types;
[0274] Generate parameter assignment statements based on input parameter values;
[0275] Fill the parameter type definition statement and parameter assignment statement into the parameter substructure block to obtain the input parameter structure block.
[0276] Reference Figure 13 This application also discloses an electronic device, the electronic device 1300 comprising:
[0277] At least one processor 1310;
[0278] At least one memory 1320 is used to store at least one program;
[0279] When at least one program is executed by at least one processor 1310, the qubit calibration method described above is implemented.
[0280] This application also discloses a computer-readable storage medium storing a processor-executable computer program, which, when executed by a processor, is used to implement the aforementioned quantum bit calibration method.
[0281] This application also discloses a computer program product, including a computer program or computer instructions, which are stored in a computer-readable storage medium. The processor of the electronic device reads the computer program or computer instructions from the computer-readable storage medium and executes the computer program or computer instructions to cause the electronic device to perform the aforementioned quantum bit calibration method.
[0282] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatuses.
[0283] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0284] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, apparatuses, or units, and may be electrical, mechanical, or other forms.
[0285] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0286] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0287] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0288] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0289] The step numbers in the above method embodiments are set only for ease of explanation and do not impose any restrictions on the order of the steps. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.
Claims
1. A quantum bit calibration method, characterized in that, Includes the following steps: For the calibration function to be called in the qubit calibration diagram, obtain the general functor structure corresponding to the calibration function to be called; Based on the general functor structure, a general function prototype structure corresponding to the calibration function to be called is constructed, wherein the general function prototype structure has a function pointer, and the function pointer points to the calibration function to be called; Based on the general function prototype structure, construct the actual call calibration function corresponding to the calibration function to be called, wherein the actual call calibration function has the function pointer; The actual calibration function is invoked to complete the qubit calibration based on the qubit calibration diagram. When the actual calibration function is invoked, it calls the calibration function to be invoked through the function pointer to run the function body of the calibration function to be invoked.
2. The method according to claim 1, characterized in that, The qubit calibration diagram includes multiple function nodes, each corresponding to a calibration function used to perform the qubit calibration. The function nodes are named in the qubit calibration diagram with the function name of the calibration function. The process of obtaining the general functor structure corresponding to the calibration function to be called in the qubit calibration diagram includes: Among the multiple function nodes in the quantum bit calibration diagram, the function node to be executed is determined; The calibration function corresponding to the function node to be executed is determined as the calibration function to be called, and the function name of the calibration function to be called is obtained according to the function name corresponding to the function node to be executed; Based on the function name of the calibration function to be called, obtain the general functor structure corresponding to the calibration function to be called from the preset automatic calibration function library.
3. The method according to claim 2, characterized in that, The automated calibration function library is constructed through the following steps: Establish an initial function library; Obtain multiple calibration functions and determine the function of each calibration function; Based on the function of each calibration function, determine the calling parameter mnemonic and the return parameter mnemonic for each calibration function; For each calibration function, a corresponding general functor structure is generated based on the calling parameter mnemonic and the return parameter mnemonic. Based on the function name of each calibration function, the general functor structure corresponding to each calibration function is saved to the initial function library to obtain the automated calibration function library.
4. The method according to claim 3, characterized in that, The step of generating the corresponding general functor structure based on the calling parameter mnemonic and the returning parameter mnemonic includes: Based on the calling parameter mnemonic and the return parameter mnemonic, a functor main structure corresponding to the calibration function is generated, wherein the functor main structure includes the calling parameter mnemonic and the return parameter mnemonic; Determine the first data type and first data structure supported by the mnemonic for the calling parameters, generate a first calling parameter substructure based on the first data type, and generate a second calling parameter substructure based on the first data structure; Determine the second data type and second data structure supported by the mnemonic for the return parameter, generate a first return parameter substructure based on the second data type, and generate a second return parameter substructure based on the second data structure; Based on the main functor structure, the first call parameter substructure, the second call parameter substructure, the first return parameter substructure, and the second return parameter substructure, the general functor structure corresponding to the calibration function is obtained.
5. The method according to claim 4, characterized in that, The step of generating the functor main structure corresponding to the calibration function based on the calling parameter mnemonic and the returning parameter mnemonic includes: Create an empty struct; Obtain the functor identifier of the general functor structure corresponding to the calibration function, and the function name of the calibration function; Set corresponding parameter types for the function name, the functor identifier, the calling parameter mnemonic, and the return parameter mnemonic, respectively; The function name, the functor identifier, the calling parameter mnemonic, the return parameter mnemonic, and their respective parameter types are filled into the blank structure to obtain the functor main structure corresponding to the calibration function.
6. The method according to claim 3, characterized in that, The step of saving the general functor structure corresponding to each calibration function to the initial function library according to the function name of each calibration function to obtain the automated calibration function library includes: For each calibration function, the function name of the calibration function is used as a handle, and the structure name of the general functor structure corresponding to the calibration function is used as a pointer to the general functor structure, thus establishing a mapping relationship between each calibration function and the corresponding general functor structure; The general functor structure and the mapping relationship corresponding to each calibration function are saved to the initial function library to obtain the automated calibration function library.
7. The method according to claim 6, characterized in that, The step of retrieving the general functor structure corresponding to the calibration function to be called from a preset automated calibration function library based on the function name of the calibration function to be called includes: Based on the function name of the calibration function to be called, the corresponding target mapping formula is obtained from the preset automated calibration function library; The structure name corresponding to the calibration function to be called is obtained according to the target mapping formula; Based on the structure name, obtain the general functor structure corresponding to the calibration function to be called from the automated calibration function library.
8. The method according to claim 1, characterized in that, The general functor structure includes call parameter mnemonics and return parameter mnemonics; the step of constructing the general function prototype structure corresponding to the calibration function to be called based on the general functor structure includes: Construct a blank function prototype structure; Based on the calling parameter mnemonic and the return parameter mnemonic of the general functor structure, generate the calling parameter structure block and the return parameter structure block; The call parameter structure block and the return parameter structure block are filled into the blank function prototype structure to obtain the general function prototype structure corresponding to the calibration function to be called.
9. The method according to claim 8, characterized in that, The calibration function to be called includes input parameter names and output parameter names; the step of generating a call parameter structure block and a return parameter structure block based on the call parameter mnemonic and the return parameter mnemonic of the general functor structure includes: Generate a call parameter structure block based on the input parameter name of the calibration function to be called and the call parameter mnemonic of the general functor structure; A return parameter structure block is generated based on the output parameter name of the calibration function to be called and the return parameter mnemonic of the general functor structure.
10. The method according to claim 1, characterized in that, The general function prototype structure includes a call parameter structure block; the step of constructing the actual call calibration function corresponding to the calibration function to be called based on the general function prototype structure includes: Based on the call parameter structure block of the general function prototype structure, obtain the corresponding input parameters input to the calibration function to be called; Generate an input parameter structure block based on the input parameters; The input parameter structure block is filled into the position in the general function prototype structure corresponding to the call parameter structure block to obtain the actual call calibration function corresponding to the calibration function to be called.
11. The method according to claim 10, characterized in that, The input parameters include the input parameter type and the input parameter value; The step of generating the input parameter structure block based on the input parameters includes: Create an empty parameter substructure block; Generate parameter type definition statements based on the input parameter types; Generate parameter assignment statements based on the input parameter values; The parameter type definition statement and the parameter assignment statement are filled into the parameter substructure block to obtain the input parameter structure block.
12. A quantum bit calibration device, characterized in that, include: The structure acquisition unit is used to acquire the general functor structure corresponding to the calibration function to be called in the qubit calibration diagram. The structure construction unit is used to construct a general function prototype structure corresponding to the calibration function to be called based on the general functor structure, wherein the general function prototype structure has a function pointer, and the function pointer points to the calibration function to be called; The function construction unit is used to construct the actual call calibration function corresponding to the calibration function to be called based on the general function prototype structure, wherein the actual call calibration function has the function pointer; The function call unit is used to call the actual call calibration function to complete the qubit calibration based on the qubit calibration diagram. When the actual call calibration function is called, it calls the calibration function to be called through the function pointer to run the function body of the calibration function to be called.
13. An electronic device, characterized in that, include: At least one processor; At least one memory for storing at least one program; The qubit calibration method as described in any one of claims 1 to 11 is implemented when at least one of the programs is executed by at least one of the processors.
14. A computer-readable storage medium, characterized in that, It contains a processor-executable computer program, which, when executed by the processor, is used to implement the quantum bit calibration method as described in any one of claims 1 to 11.
15. A computer program product, comprising a computer program or computer instructions, characterized in that, The computer program or the computer instructions are stored in a computer-readable storage medium. The processor of the electronic device reads the computer program or the computer instructions from the computer-readable storage medium and executes the computer program or the computer instructions to cause the electronic device to perform the quantum bit calibration method as described in any one of claims 1 to 11.
