Method and apparatus for obtaining operation result of quantum circuit, and electronic device

By carrying the target rotation parameters in the quantum subroutine to adjust the rotation angle of the rotating gate, the problem of insufficient flexibility in quantum circuit design is solved, realizing flexible quantum circuit design and an efficient development process.

CN117744811BActive Publication Date: 2026-05-12BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING BAIDU NETCOM SCI & TECH CO LTD
Filing Date
2023-12-05
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing quantum programs cannot meet the personalized design requirements of quantum circuits, limiting the design flexibility of quantum circuits, especially the rotation angle of the rotating door cannot be adjusted after nesting.

Method used

By carrying target rotation parameters in the quantum subroutine, the rotation angle of the rotating gate in the quantum circuit can be adjusted, enabling flexible design of quantum circuits.

Benefits of technology

It improves the design flexibility and development efficiency of quantum circuits, supports the modular construction of complex quantum algorithms, and can meet personalized design needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117744811B_ABST
    Figure CN117744811B_ABST
Patent Text Reader

Abstract

The present disclosure provides a quantum circuit running result acquisition method and device and electronic equipment, relates to the field of computers, and particularly relates to the field of quantum computing. The specific implementation scheme is as follows: obtaining a target quantum program used to implement a quantum circuit; wherein the target quantum program is nested with a quantum subprogram used to implement a target circuit unit in the quantum circuit, the target circuit unit contains a rotation gate, and the quantum subprogram carries a target rotation parameter used to adjust a rotation angle of the rotation gate in the target circuit unit; obtaining an execution result of the target quantum program; wherein the execution result of the target quantum program is used to represent a running result of the quantum circuit, and the rotation angle of the rotation gate in the target circuit unit can be adjusted through the target rotation parameter to change the running result of the quantum circuit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer science, and more particularly to the field of quantum computing. Background Technology

[0002] Quantum programs are program codes written in quantum programming languages ​​based on pre-designed quantum algorithms to implement quantum circuits (such as parameterized quantum circuits). However, existing quantum programs cannot meet the personalized design requirements of quantum circuits, limiting the design flexibility of quantum circuits. Summary of the Invention

[0003] This disclosure provides a method, apparatus, and electronic device for obtaining the operating results of a quantum circuit.

[0004] According to one aspect of this disclosure, a method for obtaining the operating results of a quantum circuit is provided, comprising:

[0005] A target quantum program for implementing a quantum circuit is obtained; wherein, the target quantum program is nested with a quantum subroutine for implementing a target circuit unit in the quantum circuit, the target circuit unit contains a rotating gate, and the quantum subroutine carries a target rotation parameter for adjusting the rotation angle of the rotating gate in the target circuit unit;

[0006] The execution result of the target quantum program is obtained; the execution result of the target quantum program is used to represent the operation result of the quantum circuit. The rotation angle of the rotating gate in the target circuit unit can be adjusted by the target rotation parameter to change the operation result of the quantum circuit.

[0007] According to one aspect of this disclosure, a device for obtaining the operating results of a quantum circuit is provided, comprising:

[0008] The first acquisition unit is used to obtain a target quantum program for implementing a quantum circuit; wherein the target quantum program is nested with a quantum subroutine for implementing a target circuit unit in the quantum circuit, the target circuit unit contains a rotating gate, and the quantum subroutine carries a target rotation parameter for adjusting the rotation angle of the rotating gate in the target circuit unit.

[0009] The second acquisition unit is used to obtain the execution result of the target quantum program; wherein, the execution result of the target quantum program is used to represent the operation result of the quantum circuit, and the rotation angle of the rotating gate in the target circuit unit can be adjusted by the target rotation parameter to change the operation result of the quantum circuit.

[0010] According to a third aspect of this disclosure, an electronic device is provided, comprising:

[0011] At least one processor;

[0012] Memory that is communicatively connected to at least one processor;

[0013] The memory stores instructions that can be executed by at least one processor, such that at least one processor can perform the methods described above.

[0014] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause a computer to perform the methods described above.

[0015] According to a fifth aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the methods described above.

[0016] Thus, because the target quantum program in this disclosure contains nested quantum subroutines for implementing the target circuit unit in the quantum circuit, and these quantum subroutines carry target rotation parameters for adjusting the rotation angle of the rotating gates contained in the target circuit unit, the rotation angle of the rotating gates in the target circuit unit can be flexibly adjusted through the target rotation parameters to change the operating result of the quantum circuit. Therefore, this disclosure provides a target quantum program for implementing any quantum circuit; in other words, this disclosure is applicable to any quantum circuit, has strong versatility, and can meet the personalized design needs of quantum circuits, thereby improving the design flexibility of quantum circuits. Attached Figure Description

[0017] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0018] Figure 1 A schematic diagram of the implementation process of a method for obtaining the operation results of a quantum circuit provided in this embodiment of the present disclosure. Figure 1 ;

[0019] Figure 2 A schematic diagram of the implementation process of a method for obtaining the operation results of a quantum circuit provided in this embodiment of the present disclosure. Figure 2 ;

[0020] Figure 3 A schematic diagram of the implementation process of a method for obtaining the operation results of a quantum circuit provided in this embodiment of the present disclosure. Figure 3 ;

[0021] Figures 4A-4D A flowchart illustrating a method for obtaining the operation results of a quantum circuit provided in an embodiment of this disclosure;

[0022] Figure 5 A schematic diagram of an executable program provided in an embodiment of this disclosure;

[0023] Figure 6A schematic structural block diagram of a device for obtaining the operation results of a quantum circuit provided in an embodiment of this disclosure;

[0024] Figure 7 This is a schematic structural block diagram of an electronic device used to implement the method for obtaining the operating results of a quantum circuit provided in the embodiments of this disclosure. Detailed Implementation

[0025] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0026] Quantum programs are program code written in quantum programming languages ​​to implement quantum circuits (such as parameterized quantum circuits) based on pre-designed quantum algorithms. Quantum programming languages ​​provide a high-level, abstract way to describe and manipulate quantum algorithms, allowing users to focus on the design and implementation of quantum algorithms without needing to worry about the underlying quantum hardware. Furthermore, quantum programming languages ​​lower the barrier to learning and using quantum computing by providing syntax and structures similar to classical programming languages. In addition, regarding the reusability and scalability of quantum programs, quantum programming languages ​​offer a modular concept for constructing complex quantum algorithms; for example, breaking down complex quantum algorithms into smaller, more manageable parts helps users write reusable quantum subroutines.

[0027] Here, the functions and applications of quantum subroutines can be summarized in the following three points: (1) Encapsulation of quantum subroutines. After decomposing a complex quantum operation or quantum algorithm into multiple parts, multiple quantum subroutines are used to encapsulate different parts. Each quantum subroutine is used to handle a specific function or task, thereby improving the readability of quantum circuits and simplifying the design process of quantum circuits. For example, quantum state preparation, quantum logic gates and measurement operations can be defined as different quantum subroutines, and then combined to realize a complete quantum circuit. (2) Reuse of quantum subroutines. By combining multiple commonly used quantum operations into a quantum subroutine, it can be used multiple times in different quantum circuits, thereby improving the readability and reusability of quantum subroutines. (3) Parameterization of quantum subroutines. Quantum subroutines can have parameters, so that quantum circuit units with the same circuit structure can have different running results due to different parameters. For example, the parameter register (formal parameter) of the quantum subroutine can be used to pass the rotation angle of the rotating gate in the target circuit unit implemented by the quantum subroutine, so that the target circuit unit has a running result corresponding to the rotation angle.

[0028] However, in one scenario, after parameterization, quantum subroutines only allow actual parameters to be passed into the parameter register. This leads to a problem where, after a quantum subroutine is nested once, the rotation angle of the rotating gate in the target circuit unit implemented by the quantum subroutine cannot be adjusted. This problem greatly limits the design flexibility of quantum circuits.

[0029] Based on this, the present disclosure provides a method for obtaining the operating results of a quantum circuit, which can improve the design flexibility of quantum circuits.

[0030] Specifically, Figure 1 This is a schematic diagram of the implementation flow of a method for obtaining the operation results of a quantum circuit provided in this embodiment. Figure 1 This method can be applied to electronic devices, which can be quantum computing devices with classical computing capabilities, classical computing devices with quantum computing capabilities, or classical computing devices with only classical computing capabilities, such as personal computers, servers, and server clusters.

[0031] Furthermore, the method includes at least some of the following: (e.g.) Figure 1 As shown, the method for obtaining the operating results of the quantum circuit includes:

[0032] Step S101 yields the target quantum program for implementing the quantum circuit.

[0033] Here, the target quantum program is nested with a quantum subroutine for implementing a target circuit unit in a quantum circuit (such as a parameterized quantum circuit). The target circuit unit contains a rotating gate, and the quantum subroutine carries a target rotation parameter for adjusting the rotation angle of the rotating gate in the target circuit unit.

[0034] Here, the target circuit unit can be a multi-control gate containing a rotating gate, or other quantum circuit units containing rotating gates. A rotating gate is a gate used to change the state of a qubit; it can evolve the qubit associated with the rotating gate in the target circuit unit from one state to another by adjusting the rotation angle.

[0035] Step S102: Obtain the execution result of the target quantum program.

[0036] Here, the execution result of the target quantum program is used to represent the operating result of the quantum circuit. In practical applications, the rotation angle of the rotating gate in the target circuit unit can be adjusted by using the target rotation parameters to change the operating result of the quantum circuit.

[0037] Thus, because the target quantum program in this disclosure contains nested quantum subroutines for implementing the target circuit unit in the quantum circuit, and these quantum subroutines carry target rotation parameters for adjusting the rotation angle of the rotating gates contained in the target circuit unit, the rotation angle of the rotating gates in the target circuit unit can be flexibly adjusted through the target rotation parameters to change the operating result of the quantum circuit. Therefore, this disclosure provides a target quantum program for implementing any quantum circuit; in other words, this disclosure is applicable to any quantum circuit, has strong versatility, and can meet the personalized design needs of quantum circuits, thereby improving the design flexibility of quantum circuits.

[0038] Furthermore, in this disclosed solution, since the rotation angle of the rotating gate in the target circuit unit can be flexibly adjusted through the target rotation parameters, the quantum subroutine can support the modular construction of complex quantum algorithms, reduce the limitations of quantum algorithm development, and thus improve the development efficiency of quantum circuits.

[0039] In a specific example of the disclosed scheme, after obtaining the execution result of the target quantum program, the method for obtaining the running result of the quantum circuit may further include:

[0040] Based on the execution results of the target quantum program, performance optimization information of the quantum circuit containing the target circuit unit implemented by the target quantum program is obtained.

[0041] Here, performance optimization information is used to evaluate whether a quantum circuit containing the target circuit unit meets the design requirements.

[0042] Furthermore, if the quantum circuit containing the target circuit unit does not meet the design requirements, the rotation angle of the rotating gate in the target circuit unit can be adjusted by adjusting the target rotation parameter to obtain a new execution result of the target quantum program. Based on the new execution result of the target quantum program, new performance optimization information of the quantum circuit containing the target circuit unit implemented by the target quantum program can be obtained until the quantum circuit containing the target circuit unit is evaluated to meet the design requirements based on the new performance optimization information.

[0043] In this disclosed scheme, the performance optimization information can be the output value of a performance optimization function constructed using important metrics for evaluating the performance of quantum circuits. Here, the performance optimization function can be a loss function, an expected value calculation function, etc.

[0044] In one example, the objective function could be a loss function, used to measure the difference between the quantum circuit's operating result and the target result. In this case, by ensuring the output of the loss function satisfies a convergence condition, such as minimizing the output of the loss function, a quantum circuit that meets the design requirements can be obtained. Here, the loss function can be set according to application requirements and is not restricted.

[0045] In another example, the objective function could be an expectation value calculation function used to calculate the average energy of the quantum system described or simulated by the quantum circuit in a specific state. In this case, by ensuring the output of the expectation value calculation function satisfies a convergence condition, such as minimizing the output of the expectation value calculation function, a quantum circuit meeting the design requirements can be obtained, allowing the determination of the ground-state energy of the quantum system based on this design-compliant quantum circuit. Here, the expectation value calculation function can be set according to application requirements and is not restricted.

[0046] Thus, this disclosed scheme can obtain performance optimization information for the quantum circuit after receiving the execution result of the target quantum program, which can be used to evaluate whether the quantum circuit containing the target circuit unit meets the design requirements. In this way, performance optimization information is used as a quantifiable performance evaluation method to quickly optimize the design of the quantum circuit, thereby improving the development efficiency of quantum circuits.

[0047] Figure 2 This is a schematic diagram of the implementation flow of a method for obtaining the operation results of a quantum circuit provided in this embodiment. Figure 2 This method can be applied to electronic devices, which can be quantum computing devices with classical computing capabilities, classical computing devices with quantum computing capabilities, or classical computing devices with only classical computing capabilities, such as personal computers, servers, and server clusters.

[0048] Furthermore, the method includes at least some of the following: (e.g.) Figure 2 As shown, the method for obtaining the operating results of the quantum circuit includes:

[0049] Step S201, the initial quantum program is obtained.

[0050] Here, the initial quantum program is nested with subroutines corresponding to the target circuit units in the quantum circuit. The initial quantum program can be program code written using quantum programming languages ​​such as Python, Openqasm, or Qcompute. The target circuit unit contains rotation gates; for example, the target circuit unit can be a multi-control gate containing rotation gates, or other quantum circuit units containing rotation gates. The subroutine to be built can be an empty program without a loaded program body. A rotation gate is a gate used to change the state of a qubit; by adjusting the rotation angle, it can evolve the qubit associated with that rotation gate in the target circuit unit from one state to another.

[0051] In a specific example of the scheme disclosed herein, a quantum circuit can be obtained in response to a circuit building operation; based on the quantum circuit, an initial quantum program corresponding to the quantum circuit is obtained.

[0052] Here, the circuit setup can be triggered by the user based on electronic devices.

[0053] Thus, in this disclosed solution, a quantum circuit can be obtained in response to a circuit building operation, and an initial quantum program can be automatically obtained based on the quantum circuit, without requiring the user to write the initial quantum program. Since the circuit building operation requires less expertise from the user in the field of quantum computing compared to writing the initial quantum program, obtaining the initial quantum program through the circuit building operation reduces the professional limitations of this disclosed solution on the user in the field of quantum computing, which is conducive to the promotion and application of this disclosed solution.

[0054] Step S202: Based on the subroutine to be built, construct a quantum subroutine carrying the target rotation parameters to implement the target circuit unit.

[0055] Here, the target rotation parameter is used to adjust the rotation angle of the rotating door in the target circuit unit.

[0056] In a specific example of the disclosed solution, step S202, "building a quantum subroutine carrying the target rotation parameters for implementing the target circuit unit based on the subroutine to be built," may include:

[0057] Step S202-1: Based on the subroutine to be built, obtain the preset subroutine.

[0058] Here, the pre-defined subroutine can be a subroutine obtained after loading the program body into the program to be built. It is used to implement the equivalent circuit of the target circuit unit, which contains a native quantum gate equivalent to a rotation gate in the target circuit unit. The native quantum gate can be a quantum gate supported by the Quantum Compute Software Development Kit (QCompute SDK) and has a rotation parameter, such as at least one of the RX gate, RY gate, and RZ gate.

[0059] Furthermore, in this disclosed solution, the preset subroutine can be a subroutine with a multi-level nested structure, or it can be a linear program without any nested internal programs.

[0060] In one example, after obtaining the subroutine to be built, the program building algorithm included in the QCompute SDK can be used to obtain a preset subroutine based on the subroutine to be built. For example, the program building algorithm included in the QCompute SDK can be used to obtain the program body for implementing the equivalent circuit of the target circuit unit, and the program body can be loaded into the program to be built. Then, the subroutine to be built with the loaded program body can be used as the preset subroutine.

[0061] Step S202-2: Convert the initial rotation parameters of the native quantum gate in the preset subroutine into the target rotation parameters to obtain the processed preset subroutine; here, the processed preset subroutine is a quantum subroutine carrying the target rotation parameters used to implement the target circuit unit.

[0062] Here, the target rotation parameter can be a target expression related to the initial rotation parameter of the native quantum gate in the preset subroutine and expressed in infix notation. In this case, the calculation result of the target expression can be used as the rotation angle of the rotation gate in the target circuit unit.

[0063] Based on this, in one example, operator overloading can be used to convert the initial rotation parameters of the native quantum gate in the preset subroutine into the target expression, resulting in the processed preset subroutine. For example, after obtaining the initial expression constructed based on the initial rotation parameters of the native quantum gate in the preset subroutine, the numerical operators (such as negation, addition, subtraction, multiplication, and division operators) and / or custom operators (such as sine, cosine, and tangent operators) that may exist in the initial expression can be overloaded to convert the initial rotation parameters of the native quantum gate in the preset subroutine into the target expression, thus obtaining the processed preset subroutine.

[0064] Specifically, the above process may include:

[0065] Define a class for Procedure Parameter Expression;

[0066] In the subroutine parameter expression class, the operators (numerical operators and / or custom operators) in the initial expression constructed based on the initial rotation parameters of the native quantum gate in the preset subroutine are overloaded to obtain the target expression;

[0067] Define the target expression in the procedure parameter storage of the preset subroutine to obtain the processed preset subroutine; here, the processed preset subroutine is a quantum subroutine carrying the target expression for implementing the target circuit unit, and the target expression in the quantum subroutine is defined in the parameter storage of the quantum subroutine.

[0068] As described above, by defining the subroutine parameter expression class, unary operations (such as negation, sine, cosine, and tangent) on any type of integer (int) and floating-point (float) can be implemented through operator overloading. Furthermore, unary operations on any type of subroutine parameter expression class and parameter register class that can inherit from it can also be implemented. In addition, for binary operations (such as addition, subtraction, multiplication, and division) that the initial expression may involve, its right operand can be restricted to one of the following: integer, floating-point, subroutine parameter expression class, or parameter register class. In this case, if the left operand of the binary operator belongs to the subroutine parameter expression class or a parameter register class that can inherit from it, the binary operator can be overloaded; if the right operand of the binary operator belongs to the subroutine parameter expression class or a parameter register class that can inherit from it, the binary operator can be overloaded through negation operator overloading. In this way, unary operations can be implemented for any of the four types: integer, floating-point, subroutine parameter expression, and parameter register, as well as binary operations for any combination of these four types, through operator overloading.

[0069] Thus, in this disclosed solution, since the preset subroutine is not used to implement the target circuit unit itself, but to implement the equivalent circuit of the target circuit unit, and the equivalent circuit of the target circuit unit contains a native quantum gate equivalent to the rotating gate in the target circuit unit, this disclosed solution is not limited by the circuit structure of the target circuit unit. In other words, this disclosed solution can be applied to the design of quantum circuits containing complex target circuit units, thereby further improving the versatility of this disclosed solution and further improving the design flexibility of quantum circuits.

[0070] Step S203: Based on the quantum subroutine, obtain the target quantum program for implementing the quantum circuit.

[0071] In one example, the subroutine to be built in the initial quantum program can be replaced with a quantum subroutine to obtain the target quantum program for implementing the quantum circuit.

[0072] Step S204: Obtain the execution result of the target quantum program.

[0073] Here, the execution result of the target quantum program is used to represent the operating result of the quantum circuit. In practical applications, the rotation angle of the rotating gate in the target circuit unit can be adjusted by using the target rotation parameters to change the operating result of the quantum circuit.

[0074] Thus, this disclosure provides a specific scheme for constructing a target quantum program, which can automatically and efficiently obtain the target quantum program for implementing the quantum circuit, thereby improving the development efficiency of the quantum circuit.

[0075] Figure 3 This is a schematic diagram of the implementation flow of a method for obtaining the operation results of a quantum circuit provided in this embodiment. Figure 3 This method can be applied to electronic devices, which can be quantum computing devices with classical computing capabilities, classical computing devices with quantum computing capabilities, or classical computing devices with only classical computing capabilities, such as personal computers, servers, and server clusters.

[0076] Furthermore, the method includes at least some of the following: (e.g.) Figure 3 As shown, the method for obtaining the operating results of the quantum circuit includes:

[0077] Step S301: Obtain the target quantum program for implementing the quantum circuit.

[0078] Here, the target quantum program is nested with a quantum subroutine for implementing a target circuit unit in a quantum circuit (such as a parameterized quantum circuit). The target circuit unit contains a rotating gate, and the quantum subroutine carries a target rotation parameter for adjusting the rotation angle of the rotating gate in the target circuit unit.

[0079] Here, the target circuit unit can be a multi-control gate containing a rotating gate, or other quantum circuit units containing rotating gates. A rotating gate is a gate used to change the state of a qubit; it can evolve the qubit associated with the rotating gate in the target circuit unit from one state to another by adjusting the rotation angle.

[0080] Step S302: Convert the target quantum program into serialized data compatible with quantum computing tools.

[0081] In one example, a data serialization protocol (such as Protocol Buffer, Protobuf) can be used to convert the target quantum program into serialized data compatible with quantum computing tools, so as to store the complete information of the quantum circuit implemented by the target quantum program.

[0082] Furthermore, the target rotation parameters in the target quantum program can be expressed using infix notation (e.g., the target rotation parameters in the target quantum program can be a target expression expressed using infix notation). Based on this, in a specific example of the scheme disclosed herein, step S302 may include:

[0083] Step S302-1: Convert the target rotation parameters in the target quantum program, expressed in infix notation, into a sequence of expressions that satisfy Polish Notation (PN) or Reverse Polish Notation (RPN).

[0084] In one example, the elements (such as operands and operators) of the target rotation parameters in the target quantum program, expressed in infix notation, can be pushed onto a stack to convert the target rotation parameters into a sequence of expressions that satisfy PN or RPN, and this sequence of expressions is a stack data structure.

[0085] Step S302-2: Based on the expression sequence, obtain serialized data compatible with quantum computing tools.

[0086] Since the target rotation parameters, expressed in infix notation, in the target quantum program are converted into a sequence of expressions satisfying PN or RPN, the computational priority of the target rotation parameters is no longer defined using parentheses (for example, when the expression sequence is a stack data structure, the computational priority of the target rotation parameters is defined using the stack data structure). Therefore, when deserializing and parsing the expression sequence in the serialized data to obtain the corresponding computational results, there is no need to consider complex parenthesis cases. Thus, it is easier and more accurate to parse and extract each element of the target rotation parameters to obtain the computational results corresponding to the expression sequence, thereby improving the reliability of the computational results corresponding to the expression sequence, and thus improving the reliability of the execution results of the target quantum program, and consequently, the accuracy of the quantum circuit's operating results.

[0087] Step S303: Using quantum computing tools, obtain the computation result corresponding to the serialized data; here, the computation result corresponding to the serialized data is the execution result of the target quantum program.

[0088] Here, quantum computing tools can be quantum simulators or quantum hardware (such as quantum computers).

[0089] Thus, this disclosed scheme provides a specific method for obtaining the execution result of a target quantum program. In this method, before obtaining the execution result of the target quantum program, the target quantum program is converted into serialized data compatible with quantum computing tools. This transforms the processing of the target quantum program into processing of the serialized data, and the computation result corresponding to the serialized data is used as the execution result of the target quantum program. Since serialized data has characteristics such as small data size, ease of reading, easy transmission, and easy processing, and can support cross-platform transmission, the reliability of the execution result of the target quantum program can be improved, thereby increasing the accuracy of the quantum circuit's operating results. Simultaneously, it can reduce the limitations of quantum algorithm development, thereby improving the development efficiency of quantum circuits.

[0090] In this disclosure, the quantum computing tool may include a first quantum simulator deployed on an electronic device. Based on this, in a specific example of this disclosure, step S303 may include:

[0091] Step S303-1.1: When the quantum circuit needs to run locally, the serialized data is deserialized and parsed using the local quantum processing module to obtain the executable program of the quantum computing tool.

[0092] Here, users can determine whether the quantum circuit needs to run locally based on a run selection operation triggered by an electronic device.

[0093] Here, the local quantum processing model can be the unroll procedure module carried in the QCompute SDK, and the executable program of the quantum computing tool can be a linear program without nested subroutines.

[0094] Furthermore, as mentioned above, in this disclosure, the target rotation parameters in the target quantum program can be represented using infix notation (for example, the target rotation parameters in the target quantum program can be a target expression represented using infix notation), and the serialized data can include a sequence of expressions corresponding to the target rotation parameters and satisfying PN or RPN. Based on this, in a specific example of this disclosure, step S303-1.1, "deserializing and parsing the serialized data to obtain an executable program for the quantum computing tool," can include:

[0095] Step S303-1.1-1: Based on the data restoration method for PN or RPN, deserialize and parse the expression sequence corresponding to the target rotation parameters in the serialized data to obtain the calculation results corresponding to the expression sequence.

[0096] In one example, the sequence of expressions is represented by a stack data structure. Starting from the top of the stack, each element in the expression sequence can be processed using a stack until only one result element remains. This result element is then used as the computation result corresponding to the expression sequence. For example, starting from the top of the stack, after popping each element and determining that it is a unary operator, a stack operation is performed on the top operand of the stack based on that unary operator, and the result is then pushed back onto the stack. Alternatively, starting from the top of the stack, after popping each element and determining that it is a binary operator, a stack operation is performed on the top two operands of the stack based on that binary operator, and the result is then pushed back onto the stack. This process is repeated until only one result element remains on the stack, at which point the result element is used as the computation result corresponding to the expression sequence.

[0097] Step S303-1.1-2: Based on the calculation results corresponding to the expression sequence, obtain the executable program of the quantum computing tool.

[0098] Thus, in this disclosed solution, on the one hand, since it is based on the data restoration method for PN or RPN, and deserialization and parsing are performed on the expression sequence corresponding to the target rotation parameters in the serialized data to obtain the calculation results corresponding to the expression sequence, it can be determined that the calculation priority in the target rotation parameters is not defined using parentheses in the expression sequence. Therefore, when deserializing and parsing the expression sequence in the serialized data to obtain the calculation results corresponding to the expression sequence, there is no need to consider complex parenthesis cases. This allows for easier and more accurate parsing and extraction of each element in the target rotation parameters to obtain the calculation results corresponding to the expression sequence, thereby improving the accuracy of the calculation results. The reliability of the corresponding calculation results is improved, that is, the reliability of the execution results of the target quantum program is improved, so as to improve the accuracy of the running results of the quantum circuit. On the other hand, the above method of obtaining the calculation results corresponding to the expression sequence can be applied to any expression sequence. This makes the present disclosure not limited by the sequence structure of the expression sequence. In other words, the present disclosure can support carrying target rotation parameters with more complex calculation logic in the quantum subroutine used to implement the target circuit unit in the quantum circuit. Thus, the present disclosure can be applied to the design of quantum circuits containing complex target circuit units, thereby further improving the versatility of the present disclosure and further improving the design flexibility of quantum circuits.

[0099] Step S303-1.2: Use the first quantum simulator in the quantum computing tool to obtain the execution result of the executable program; here, the execution result of the executable program is the calculation result corresponding to the serialized data.

[0100] In one example, the specific programming language used to construct the first quantum simulator can be determined, and the executable program can be converted into an executable program written in that specific programming language. Then, the execution result of the executable program can be obtained using the first quantum simulator, and the execution result of the executable program can be used as the execution result of the executable program. Here, the specific programming language can be Python, C++, Java, etc.

[0101] In this way, the disclosed solution can obtain the computational results corresponding to the serialized data on the electronic device side, that is, locally using a local quantum processing module and a first quantum simulator. The computational results corresponding to the serialized data will then serve as the execution results of the target quantum program, which will be used to represent the operating results of the quantum circuit. This avoids the need for remote transmission of the serialized data, thus avoiding the risks of data security degradation and data loss that may result from remote transmission, thereby improving the accuracy of the quantum circuit's operating results.

[0102] In this disclosure, the quantum computing tool may also include a second quantum simulator deployed on a cloud server and / or quantum hardware connected to the cloud server. Based on this, in a specific example of this disclosure, step S303 may include:

[0103] Step S303-2.1: When the quantum circuit needs to run in the cloud, the serialized data is sent to the cloud server.

[0104] Here, users can determine whether a quantum circuit needs to run in the cloud by selecting an operation triggered by an electronic device.

[0105] Here, the cloud server utilizes a cloud-based quantum processing module to deserialize and parse the serialized data, obtaining an executable program for the quantum computing tool. Then, using a second quantum simulator or quantum hardware within the quantum computing tool, the execution result of the executable program is obtained; this result corresponds to the computational result of the serialized data. The cloud-based quantum processing model can be a subroutine expansion module included in the QCompute SDK, and the executable program for the quantum computing tool can be a linear program without nested subroutines.

[0106] Furthermore, as mentioned above, in this disclosed scheme, the target rotation parameters in the target quantum program can be represented using infix notation (for example, the target rotation parameters can be a target expression represented using infix notation), and the serialized data includes a sequence of expressions corresponding to the target rotation parameters and satisfying PN or RPN. Based on this, the aforementioned "deserializing and parsing the serialized data to obtain an executable program for the quantum computing tool" can include: deserializing and parsing the expression sequence in the serialized data based on the data restoration method for the stack data structure to obtain the calculation result corresponding to the expression sequence; and obtaining the executable program for the quantum computing tool based on the calculation result corresponding to the expression sequence.

[0107] In one example, the sequence of expressions is represented by a stack data structure. Starting from the top of the stack, each element in the expression sequence can be processed using a stack until only one result element remains. This result element is then used as the computation result corresponding to the expression sequence. For example, starting from the top of the stack, after popping each element and determining that it is a unary operator, a stack operation is performed on the top operand of the stack based on that unary operator, and the result is then pushed back onto the stack. Alternatively, starting from the top of the stack, after popping each element and determining that it is a binary operator, a stack operation is performed on the top two operands of the stack based on that binary operator, and the result is then pushed back onto the stack. This process is repeated until only one result element remains on the stack, at which point the result element is used as the computation result corresponding to the expression sequence.

[0108] Furthermore, in one example, when obtaining the execution result of an executable program using a second quantum simulator in a quantum computing tool, the specific programming language used to construct the second quantum simulator can be determined, and the executable program can be converted into an executable program written in that specific programming language. Then, the execution result of the executable program can be obtained using the second quantum simulator, and the execution result of the executable program can be used as the execution result of the executable program. Here, the specific programming language can be Python, C++, Java, etc.

[0109] In another example, when using quantum hardware in a quantum computing tool to obtain the execution result of an executable program, the executable program can be converted into a pulse sequence, and the pulse sequence can be applied to the quantum hardware to obtain the output result corresponding to the pulse sequence. The output result corresponding to the pulse sequence is then used as the execution result of the executable program.

[0110] Step S303-2.2: Obtain the calculation result corresponding to the serialized data returned by the cloud server.

[0111] In this way, the disclosed solution can obtain the computational results corresponding to the serialized data on the cloud server side, that is, in the cloud, using a cloud quantum processing module and a second quantum simulator, or a cloud quantum processing module and quantum hardware. The computational results corresponding to the serialized data will then serve as the execution results of the target quantum program to represent the operating results of the quantum circuit. This saves local resources and improves the reliability of the quantum circuit's operating results when using cloud quantum processing modules and quantum hardware to obtain the computational results corresponding to the serialized data as the execution results of the target quantum program.

[0112] The following detailed explanation of this disclosure will be provided with specific examples.

[0113] This disclosure provides a solution for adding computational support to the parameter registers (formal parameters) of quantum subroutines, based on the QCompute SDK. Specifically, this disclosure allows users to pre-prepare computational operations that will utilize the actual parameters passed to the parameter registers when implementing the quantum subroutine by defining the target expression in the parameter registers. More specifically, this disclosure embeds the target expression into the quantum subroutine processing framework of the QCompute SDK architecture using a circuit intermediate language (such as serialized data) written in Protobuf, so as to pre-prepare computational operations that will utilize the actual parameters passed to the parameter registers when implementing the quantum subroutine.

[0114] The following sections will describe this disclosed solution in detail in three parts. The first part introduces the implementation framework of this disclosed solution; the second part, in conjunction with the implementation framework, describes the organization process of this disclosed solution; and the third part introduces the practical application of this disclosed solution.

[0115] The first part introduces the implementation framework of this disclosed solution.

[0116] First, in order to embed the target expression into the quantum subroutine processing framework of the QCompute SDK architecture, a three-layer framework including a program construction layer, an intermediate language layer, and a program conversion layer needs to be created. This three-layer framework is the implementation framework of the disclosed solution.

[0117] (1) Program construction layer

[0118] The program construction layer is a quantum programming framework provided by the QCompute SDK. It supports the creation of quantum subroutines (such as quantum subroutines with target expressions defined on parameter registers) through operations such as quantum register declaration and quantum gate calling, and obtains the target quantum program for implementing quantum circuits based on the quantum subroutines.

[0119] Currently, when creating a quantum subroutine at the program construction layer, the quantum subroutine's parameter pool is initialized. When the quantum subroutine's parameter register is used, the actual parameters passed to the parameter register are automatically generated in the quantum subroutine's parameter pool and used as the rotation angle of the rotating gate in the target circuit unit implemented by the quantum subroutine. Therefore, after a quantum subroutine is nested once, the rotation angle of the rotating gate in the target circuit unit implemented by the quantum subroutine cannot be adjusted. In this disclosed solution, although the calculation of the target expression depends on the actual parameters passed to the parameter register, the definition of the target expression does not depend on the quantum subroutine's parameter pool, and the defined target expression is only used to adjust the rotation angle of the rotating gate in the target circuit unit implemented by the quantum subroutine, and not used to control other properties of the quantum subroutine. Therefore, by defining the target expression, the rotation angle of the rotating gate in the target circuit unit implemented by the quantum subroutine can be flexibly adjusted. The following will further introduce the method of defining the target expression in the parameter register of the quantum subroutine when creating a quantum subroutine at the program construction layer.

[0120] First, a subroutine parameter expression class is defined to construct expression objects (target expressions). Specifically, within this class, numerical operators (such as unary operators like negation, positive number, and absolute value operators, and / or binary operators like addition, subtraction, multiplication, and division operators) and / or user-defined operators (such as sine, cosine, and tangent operators) from the user's initial expression can be overloaded to construct expression objects. Here, the initial expression can be a user-constructed expression related to the initial rotation parameters of the native quantum gate equivalent to the rotation gate in the target circuit unit, expressed in infix notation. Correspondingly, the target expression can also be an expression expressed in infix notation.

[0121] Taking a quantum subroutine as an example of program code written in Python, when creating a quantum subroutine in the program construction layer, it may be necessary to overload operators, construct expression objects, and the data representation language corresponding to the constructed expression objects in the quantum subroutine, as shown in Table 1, but not limited to Table 1.

[0122] Table 1

[0123]

[0124] In Table 1, each row of data represents a set of overloaded data, including the overloaded operator, the constructed expression object, and the data representation language corresponding to the constructed expression object in the quantum subroutine. For example, if the initial expression is used to perform addition, the operator "__add__(1,2)" can be overloaded to construct the expression object "expr1+expr2", and the data representation language corresponding to the expression object "expr1+expr2" in the quantum subroutine is "ADD".

[0125] As described above, by defining the subroutine parameter expression class, unary operations (such as negation, sine, cosine, and tangent) on any type of integer and floating-point number can be implemented through operator overloading. Furthermore, unary operations on any type of subroutine parameter expression class and parameter register class that can inherit from it can also be implemented. In addition, for binary operations (such as addition, subtraction, multiplication, and division) that the initial expression may involve, its right operand (expr2) can be restricted to one of the following: integer, floating-point, subroutine parameter expression class, or parameter register class. In this case, if the left operand of the binary operator belongs to the subroutine parameter expression class or a parameter register class that can inherit from it, the binary operator can be overloaded; if the right operand of the binary operator belongs to the subroutine parameter expression class or a parameter register class that can inherit from it, the binary operator can be overloaded through inversion operator overloading. In this way, unary operations can be implemented for any of the four types: integer, floating-point, subroutine parameter expression, and parameter register, as well as binary operations for any combination of these four types, through operator overloading.

[0126] Furthermore, the four types—integer, floating-point, subroutine parameter expression, and parameter register—can be used as the set of rotation parameters for the rotation gate in the target circuit unit implemented through quantum subroutines. That is, let the rotation parameter Rotation Argument = Union[int, float, Procedure Parameter Expression, Procedure Parameter Storage], and use operators with rotation parameters as parameter types in the QCompute SDK, including rotation gate operators (Rotation Gate OP) and quantum subroutine operators (QProcedure OP). In this way, when creating a quantum subroutine in the program construction layer, the target expression can be defined on the parameter register of the quantum subroutine, thus enabling expression computation on the parameter register.

[0127] (2) Intermediate Language Layer

[0128] In the QCompute SDK, the target quantum program can be converted into a circuit intermediate language compatible with quantum computing tools based on Protobuf. For example, it can serialize data so that the serialized data can be transmitted and deserialized end-to-end (e.g., converting the serialized data into an executable program for quantum computing tools). Therefore, the core role of the intermediate language layer is to store the complete information of the quantum circuit implemented by the target quantum program.

[0129] When creating a quantum subroutine in the program construction layer, after defining the target expression (e.g., an expression represented in infix notation) in the parameter register of the quantum subroutine, it is essential to add expression generation support to the intermediate language of the circuit. The challenge here lies in how to store the target expression involving unary and / or binary operations on the serialized data, so that the correct order of operations can be obtained after deserializing the serialized data. To solve this problem, in this disclosure, the target expression can be stored according to a stack data structure. For example, each element in the target expression (e.g., operands and operators) is pushed onto the stack, converting the target expression into an expression sequence that satisfies PN or RPN and is in a stack data structure. Based on this expression sequence, serialized data compatible with quantum computing tools is obtained. The advantage of PN or RPN is that after converting the target expression into an expression sequence that satisfies PN or RPN and is in a stack data structure, the computational priority in the target expression changes from being defined using parentheses to being defined using a stack data structure. Thus, when it is necessary to deserialize and parse the expression sequence in serialized data to obtain the calculation result corresponding to the expression sequence, there is no need to consider complex bracket cases. Therefore, it is easier and more accurate to parse and extract each element in the target expression to obtain the calculation result corresponding to the expression sequence.

[0130] (3) Program conversion layer

[0131] The program conversion layer includes a subroutine expansion module provided by the QCompute SDK. This module supports taking serialized data obtained from converting the target quantum program as input and parsing the executable program of the quantum computing tool (e.g., a linear program without nested quantum subroutines) from the serialized data according to a preset parsing protocol. Specifically, when the quantum subroutines nested within the target quantum program have a multi-level nested structure, during the process of parsing the executable program of the quantum computing tool from the serialized data, the nested quantum subroutines will be expanded layer by layer from the outside in strict accordance with the nesting order. Correspondingly, if the target expression is not defined in the parameter register of the quantum subroutine, the actual parameters passed to the parameter register will also be passed in layer by layer from the outside in as the quantum subroutine expands. However, in this disclosed scheme, the parameter register is used not only to receive the passed actual parameters but also to define the target expression. Therefore, it is essential to add deserialization parsing support for the expression part to the quantum processing module, which will be the main problem to be solved by the program conversion layer.

[0132] Since the defined target expression has been converted into an expression sequence that satisfies PN or RPN and is in a stack data structure in the intermediate language layer, when deserializing the serialized data, it is only necessary to deserialize the expression sequence in the serialized data based on the data restoration method for PN or RPN, obtain the calculation result corresponding to the expression sequence, and obtain the executable program of the quantum computing tool based on the calculation result corresponding to the expression sequence.

[0133] The above method of obtaining the calculation results corresponding to the expression sequence can be applied to any expression sequence. This allows the present invention to be applied in practice without being limited by the sequence structure of the expression sequence. In other words, the present invention can support carrying more complex target rotation parameters in the quantum subroutine used to implement the target circuit unit in the quantum circuit. Thus, the present invention can be applied to the design of quantum circuits containing complex target circuit units.

[0134] The second part introduces the process of organizing this publicly disclosed solution, in conjunction with the implementation framework.

[0135] Specifically, please combine Figure 4A , Figure 4B , Figure 4C and Figure 4D The overall process of this disclosed solution includes:

[0136] Step S401 yields the target quantum program for implementing the quantum circuit.

[0137] Here, step S401 can be executed by a program construction layer created in the electronic device.

[0138] Here, the target quantum program is nested with quantum subroutines for implementing target circuit units in quantum circuits (such as parameterized quantum circuits). The target circuit units contain rotating gates, and the quantum subroutines carry target expressions for adjusting the rotation angle of the rotating gates in the target circuit units.

[0139] Here, the target circuit unit can be a multi-control gate, or other quantum circuit unit containing a rotating gate.

[0140] In one example, the objective expression can be defined on the parameter register of the quantum subroutine, and the objective expression can be an expression expressed in infix notation.

[0141] like Figure 4B As shown, in a specific example of the scheme disclosed herein, step S401 may include:

[0142] Step S401-1 yields the initial quantum program.

[0143] Here, the initial quantum program contains nested subroutines corresponding to the target circuit units in the quantum circuit. The initial quantum program can be program code written using quantum programming languages ​​such as Python, Openqasm, or Qcompute, while the subroutines to be built can be empty programs without a program body.

[0144] In a specific example of the scheme disclosed herein, a quantum circuit can be obtained in response to a circuit building operation; based on the quantum circuit, an initial quantum program corresponding to the quantum circuit is obtained.

[0145] Here, the circuit setup can be triggered by the user based on electronic devices.

[0146] Step S401-2: Based on the subroutine to be built, obtain the preset subroutine.

[0147] Here, the pre-defined subroutine can be a subroutine obtained after loading the program body into the program to be built. It is used to implement the equivalent circuit of the target circuit unit, which contains a native quantum gate equivalent to the rotation gate in the target circuit unit. The native quantum gate can be a quantum gate supported by the QCompute SDK and having rotation parameters, such as at least one of the RX gate, RY gate, and RZ gate.

[0148] Furthermore, in this disclosed solution, the preset subroutine can be a subroutine with a multi-level nested structure, or it can be a linear program without any nested internal programs.

[0149] In one example, after obtaining the subroutine to be built, the program building algorithm included in the QCompute SDK can be used to obtain a preset subroutine based on the subroutine to be built. For example, the program building algorithm included in the QCompute SDK can be used to obtain the program body for implementing the equivalent circuit of the target circuit unit, and the program body can be loaded into the program to be built. Then, the subroutine to be built with the loaded program body can be used as the preset subroutine.

[0150] Step S401-3: Determine whether the rotation angle of the rotating door in the target circuit unit needs to be adjusted.

[0151] Here, based on the user's angle adjustment operation triggered by the electronic device, it can be determined whether the rotation angle of the revolving door in the target circuit unit needs to be adjusted.

[0152] Step S401-4: When it is necessary to adjust the rotation angle of the rotating gate in the target circuit unit, the initial rotation parameters of the native quantum gate in the preset subroutine are converted into the target expression to obtain the processed preset subroutine; here, the processed preset subroutine is a quantum subroutine carrying the target expression used to implement the target circuit unit.

[0153] Here, the target expression can be an expression related to the initial rotation parameters of the native quantum gate in the preset subroutine and expressed in infix notation. In this case, the calculation result of the target expression can be used as the rotation angle of the rotation gate in the target circuit unit.

[0154] In one example, operator overloading can be used to convert the initial rotation parameters of the native quantum gates in a predefined subroutine into a target expression, resulting in a processed predefined subroutine. For instance, after obtaining an initial expression constructed based on the initial rotation parameters of the native quantum gates in the predefined subroutine, the numerical operators (such as negation, addition, subtraction, multiplication, and division operators) and / or custom operators (such as sine, cosine, and tangent operators) in the initial expression can be overloaded to convert the initial rotation parameters of the native quantum gates in the predefined subroutine into the target expression, thus obtaining the processed predefined subroutine. Here, the initial expression can be a user-constructed expression expressed in infix notation.

[0155] Specifically, the above process may include:

[0156] Define a subroutine parameter expression class;

[0157] In the subroutine parameter expression class, the operators (numerical operators and / or custom operators) in the initial expression constructed based on the initial rotation parameters of the native quantum gate in the preset subroutine are overloaded to obtain the target expression;

[0158] Define the target expression in the parameter register of the preset subroutine to obtain the processed preset subroutine; here, the processed preset subroutine is a quantum subroutine carrying the target expression for constructing the target circuit unit, and the target expression in the quantum subroutine is defined in the parameter register of the quantum subroutine.

[0159] As described above, by defining the subroutine parameter expression class, unary operations (such as negation, sine, cosine, and tangent) on any type of integer and floating-point number can be implemented through operator overloading. Furthermore, unary operations on any type of subroutine parameter expression class and parameter register class that can inherit from it can also be implemented. In addition, for binary operations (such as addition, subtraction, multiplication, and division) that the initial expression may involve, its right operand can be restricted to one of the following: integer, floating-point, subroutine parameter expression class, or parameter register class. In this case, if the left operand of the binary operator belongs to the subroutine parameter expression class or a parameter register class that can inherit from it, the binary operator can be overloaded; if the right operand of the binary operator belongs to the subroutine parameter expression class or a parameter register class that can inherit from it, the binary operator can be overloaded using the negation operator overloading. In this way, unary operations can be implemented for any of the four types: integer, floating-point, subroutine parameter expression, and parameter register, as well as binary operations for any combination of these four types, through operator overloading.

[0160] Step S401-5: If it is not necessary to adjust the rotation angle of the rotating door in the target circuit unit, the preset subroutine is used as the quantum subroutine.

[0161] Step S401-6: Based on the quantum subroutine, obtain the target quantum program for implementing the quantum circuit.

[0162] In one example, the subroutine to be built in the initial quantum program can be replaced with a quantum subroutine to obtain the target quantum program for implementing the quantum circuit.

[0163] Step S402: Convert the target quantum program into serialized data compatible with quantum computing tools.

[0164] Here, step S402 can be performed by an intermediate language layer created in the electronic device.

[0165] In one example, Protobuf can be used to convert the target quantum program into serialized data compatible with quantum computing tools, so as to store the complete information of the quantum circuit implemented by the target quantum program.

[0166] like Figure 4C As shown, in a specific example of the scheme disclosed herein, step S402 may include:

[0167] Step S402-1: Determine whether the target quantum program carries the target expression.

[0168] As mentioned above, in this disclosure, when the target expression is carried in the target quantum program, the target expression can be an expression represented using infix notation. Based on this, in this disclosure, after step S402-1, step S402 may further include:

[0169] Step S402-2: If the target expression is carried in the target quantum program, convert the target expression in the target quantum program into a sequence of expressions that satisfy PN or RPN.

[0170] In one example, the elements (such as operands and operators) of the target expression in the target quantum program can be pushed onto a stack to convert the target expression into a sequence of expressions that satisfy PN or RPN, and this sequence of expressions is a stack data structure.

[0171] Step S402-3: Based on the expression sequence, obtain serialized data compatible with quantum computing tools.

[0172] Furthermore, in this disclosed solution, the following may also be included after step S402-1:

[0173] Step S402-4: If the target quantum program does not carry the target expression, directly convert the target quantum program into serialized data compatible with quantum computing tools.

[0174] Step S403: Using quantum computing tools, obtain the computation result corresponding to the serialized data; here, the computation result corresponding to the serialized data is the execution result of the target quantum program.

[0175] Here, step S403 can be performed by a program conversion layer created in the electronic device.

[0176] Here, quantum computing tools can be quantum simulators or quantum hardware (such as quantum computers).

[0177] In this disclosed scheme, the quantum computing tool may include a first quantum simulator deployed on an electronic device, and may also include a second quantum simulator deployed on an electronic device and / or quantum hardware connected to a cloud server. Based on this, such as Figure 4D As shown, in a specific example of the scheme disclosed herein, step S403 may include:

[0178] Step S403-1: Determine whether the quantum circuit needs to run in the cloud.

[0179] Here, users can determine whether a quantum circuit needs to run in the cloud by selecting an operation triggered by an electronic device.

[0180] Step S403-2: When the quantum circuit does not need to run in the cloud, the serialized data is deserialized and parsed using the local quantum processing module to obtain the executable program of the quantum computing tool.

[0181] Here, the local quantum processing model can be a subroutine expansion module carried in the QCompute SDK, and the executable program of the quantum computing tool can be a linear program without nested subroutines.

[0182] Furthermore, as mentioned above, in this disclosure, the target expression can be an expression represented using infix notation, and the serialized data includes a sequence of expressions corresponding to the target expression and satisfying PN or RPN. Based on this, in a specific example of this disclosure, step S403-2, "deserializing and parsing the serialized data to obtain an executable program for the quantum computing tool," may include:

[0183] Step S403-2-1: Based on the data restoration method for PN or RPN, deserialize and parse the expression sequence in the serialized data to obtain the calculation result corresponding to the expression sequence.

[0184] In one example, the sequence of expressions is represented by a stack data structure. Starting from the top of the stack, each element in the expression sequence can be processed using a stack until only one result element remains. This result element is then used as the computation result corresponding to the expression sequence. For example, starting from the top of the stack, after popping each element and determining that it is a unary operator, a stack operation is performed on the top operand of the stack based on that unary operator, and the result is then pushed back onto the stack. Alternatively, starting from the top of the stack, after popping each element and determining that it is a binary operator, a stack operation is performed on the top two operands of the stack based on that binary operator, and the result is then pushed back onto the stack. This process is repeated until only one result element remains on the stack, at which point the result element is used as the computation result corresponding to the expression sequence.

[0185] Step S403-2-2: Based on the calculation results corresponding to the expression sequence, obtain the executable program of the quantum computing tool.

[0186] Step S403-3: Use the first quantum simulator in the quantum computing tool to obtain the execution result of the executable program; here, the execution result of the executable program is the calculation result corresponding to the serialized data.

[0187] In one example, the specific programming language used to construct the first quantum simulator can be determined, and the executable program can be converted into an executable program written in that specific programming language. Then, the execution result of the executable program can be obtained using the first quantum simulator, and the execution result of the executable program can be used as the execution result of the executable program. Here, the specific programming language can be Python, C++, Java, etc.

[0188] After obtaining the computation result corresponding to the serialized data, the computation result corresponding to the serialized data can be sent to the program construction layer as the execution result of the target quantum program, so that the program construction layer can use the execution result of the target quantum program to represent the running result of the quantum circuit.

[0189] Step S403-4: If the quantum circuit needs to run in the cloud, send the serialized data to the cloud server.

[0190] Here, the cloud server utilizes a cloud-based quantum processing module to deserialize and parse the serialized data, obtaining an executable program for the quantum computing tool. Then, using a second quantum simulator or quantum hardware within the quantum computing tool, the execution result of the executable program is obtained; this result corresponds to the computational result of the serialized data. The cloud-based quantum processing model can be a subroutine expansion module included in the QCompute SDK, and the executable program for the quantum computing tool can be a linear program without nested subroutines.

[0191] Step S403-5: Obtain the calculation results corresponding to the serialized data returned by the cloud server.

[0192] After obtaining the computation result corresponding to the serialized data, the computation result corresponding to the serialized data can be sent to the program construction layer as the execution result of the target quantum program, so that the program construction layer can use the execution result of the target quantum program to represent the running result of the quantum circuit.

[0193] The following describes the process described above, where the target expression is an expression represented using infix notation, and the serialized data includes a sequence of expressions corresponding to the target expression and satisfying PN or RPN. This process, performed by the cloud server, involves "deserializing and parsing the serialized data to obtain an executable program for the quantum computing tool." This process may include:

[0194] (1) Based on the data restoration method for stack data structure, the expression sequence in serialized data is deserialized and parsed to obtain the calculation result corresponding to the expression sequence.

[0195] In one example, the sequence of expressions is represented by a stack data structure. Starting from the top of the stack, each element in the expression sequence can be processed using a stack until only one result element remains. This result element is then used as the computation result corresponding to the expression sequence. For example, starting from the top of the stack, after popping each element and determining that it is a unary operator, a stack operation is performed on the top operand of the stack based on that unary operator, and the result is then pushed back onto the stack. Alternatively, starting from the top of the stack, after popping each element and determining that it is a binary operator, a stack operation is performed on the top two operands of the stack based on that binary operator, and the result is then pushed back onto the stack. This process is repeated until only one result element remains on the stack, at which point the result element is used as the computation result corresponding to the expression sequence.

[0196] (2) Based on the calculation results corresponding to the expression sequence, the executable program of the quantum computing tool is obtained.

[0197] (3) Use the second quantum simulator or quantum hardware in the quantum computing tool to obtain the execution result of the executable program.

[0198] In one example, when obtaining the execution result of an executable program using a second quantum simulator in a quantum computing tool, the specific programming language used to construct the second quantum simulator can be determined. The executable program is then converted into an executable program written in that specific programming language. The execution result of the executable program is then obtained using the second quantum simulator, and this result is used as the execution result of the executable program. Here, the specific programming language could be Python, C++, Java, etc.

[0199] In another example, when using quantum hardware in a quantum computing tool to obtain the execution result of an executable program, the executable program can be converted into a pulse sequence, and the pulse sequence can be applied to the quantum hardware to obtain the output result corresponding to the pulse sequence. The output result corresponding to the pulse sequence is then used as the execution result of the executable program.

[0200] Part Three introduces the practical application of this disclosed solution.

[0201] The following section will use a multi-control gate C4RZ containing a rotation gate as an example to illustrate the practical application of the scheme disclosed herein. In this example, the initial value of the initial rotation parameter (θ) of the native quantum gate, which is equivalent to the rotation gate in the multi-control gate C4RZ, is set to 1.

[0202] (1) Obtain the initial quantum program.

[0203] Here, the initial quantum program contains a nested subroutine corresponding to the target circuit unit in the quantum circuit—the multiple control gate C4RZ. The subroutine to be built can be an empty program without a loaded program body, and the initial quantum program can be represented by the following pseudo-program:

[0204] Main

[0205]

[0206]

[0207] Here, Q0 is used to represent borrowed qubits, Q1, Q2, Q3 and Q4 are used to represent control qubits, Q5 is used to represent controlled qubits, and |C4RZ| is used to represent the subroutine to be built corresponding to the multiple control gates C4RZ in the quantum circuit, and the subroutine to be built is an empty program without a loaded program body.

[0208] (2) Based on the subroutine to be built, the preset subroutine is obtained.

[0209] Here, the preset subroutine can be a subroutine obtained after loading the program body into the program to be built |C4RZ|. It is used to implement the equivalent circuit of the multi-control gate C4RZ. The equivalent circuit of the multi-control gate C4RZ contains the native quantum gate, which is equivalent to the rotating gate in the multi-control gate C4RZ.

[0210] Here, the predefined subroutine has a multi-level nested structure, which can be represented by the following pseudo-program:

[0211] Procedure C4RZ

[0212]

[0213] The internal subroutine |procedure1| in |C4RZ| can be represented by the following pseudo-program:

[0214] Procedure procedure1

[0215]

[0216]

[0217] The internal subroutine |RZ| in |procedure1| is used to construct an RZ gate, which is a native quantum gate supported by the QCompute SDK and has an initial rotation parameter (θ). In other words, the RZ gate implemented by the internal subroutine |RZ| in |procedure1| is the native quantum gate equivalent to the rotation gate in the multi-control gate C4RZ, contained in the equivalent circuit of the multi-control gate C4RZ. Furthermore, since there are two nested internal subroutines |procedure1| in |C4RZ|, the equivalent circuit of the multi-control gate C4RZ will ultimately contain two RZ gates. For ease of distinction, the RZ gate obtained from the first nested internal subroutine |procedure1| in |C4RZ| is defined as the first RZ gate, and the RZ gate obtained from the second nested internal subroutine |procedure1| in |C4RZ| is defined as the second RZ gate.

[0218] The internal subroutine C4X in procedure1 is used to construct the multi-control gate C4X.

[0219] Based on the above, assuming that the initial expression corresponding to the initial rotation parameter (θ) of the first RZ gate is "-θ / 2" and the initial expression corresponding to the initial rotation parameter (θ) of the second RZ gate is "θ / 2", then the multi-control gate C4RZ can be represented by the following logical expression:

[0220]

[0221] Where n = 4, corresponding to the multi-control gate C4RZ, i represents the imaginary unit, e represents the natural constant, and θ represents the initial rotation parameter of the original quantum gate (RZ gate) which is equivalent to the rotation gate in the multi-control gate C4RZ.

[0222] In addition, the multiple control gate C4X can be represented by the following logical expression:

[0223]

[0224] Therefore, through calculation, we have:

[0225]

[0226] in, Used to represent 2 n 3D identity matrix This indicates that an RZ(θ / 2) gate (the second RZ gate) is applied to the last qubit of the quantum circuit unit implemented only by the second inner subroutine |procedure1| nested within |C4RZ|. θ / 2 represents the initial expression corresponding to the initial rotation parameter (θ) of the second RZ gate. Similarly, This indicates that an RZ (-θ / 2) gate (the first RZ gate) is applied to the last qubit of the quantum circuit unit implemented by the first inner subroutine |procedure1| nested in |C4RZ|. -θ / 2 is used to represent the initial expression corresponding to the initial rotation parameter (θ) of the first RZ gate.

[0227] Furthermore, the internal subroutine |C4X| within |procedure1| can be represented by the following pseudo-program:

[0228] Procedure C4X

[0229]

[0230] The internal subroutine |procedure_3| in |C4X| can be represented by the following pseudo-program:

[0231] Procedure_3

[0232]

[0233] The internal subroutine |subprocedure_3| within |procedure_3| can be represented by the following pseudo-program:

[0234] Procedure subprocedure_3

[0235]

[0236] The internal subroutine |CCX| in |subprocedure_3| is used to construct CCX gates, and CCX gates are native quantum gates supported by QComputeSDK.

[0237] The internal subroutine |procedure_5| in |C4X| can be represented by the following pseudo-program:

[0238] Procedure_3

[0239]

[0240]

[0241] The internal subroutine |subprocedure_5| within |procedure_5| can be represented by the following pseudo-program:

[0242] Procedure subprocedure_3

[0243]

[0244] The internal subroutine |CCX| in |subprocedure_5| is used to construct CCX gates, and CCX gates are native quantum gates supported by QComputeSDK.

[0245] (3) Convert the initial rotation parameters of the native quantum gate in the preset subroutine into the target expression to obtain the processed preset subroutine; here, the processed preset subroutine is a quantum subroutine carrying the target expression used to implement the target circuit unit.

[0246] As mentioned earlier, the initial expression corresponding to the rotation parameter (θ) of the first RZ gate is "-θ / 2". If the preset subroutine is program code written in Python, then firstly, the operator "__truediv__(1,2)" can be overloaded in the subroutine parameter expression class to implement the target expression "expr1 / expr2", and the data representation language corresponding to the target expression "expr1 / expr2" in the preset subroutine is "TRUEDIV". Here, "expr1" in the target expression "expr1 / expr2" is used to represent the left operand "θ", and "expr2" in the target expression "expr1 / expr2" is used to represent the right operand "2". Subsequently, the operator "__neg__(1)" can also be overloaded in the subroutine parameter expression class to implement the target expression "-expr", and the data representation language corresponding to the target expression "-expr" in the preset subroutine is "NEG". Here, "expr" in the target expression "-expr" is used to represent the operand "θ / 2".

[0247] The initial expression corresponding to the rotation parameter (θ) of the second RZ gate is "θ / 2". If the default subroutine is program code written in Python, the operator "__truediv__(1,2)" can be overloaded in the subroutine parameter expression class to achieve the target expression "expr1 / expr2". The data representation language corresponding to the target expression "expr1 / expr2" in the default subroutine is "TRUEDIV". Here, "expr1" in the target expression "expr1 / expr2" represents the left operand "θ", and "expr2" in the target expression "expr1 / expr2" represents the right operand "2".

[0248] (4) Based on the quantum subroutine, the target quantum program for implementing the quantum circuit is obtained.

[0249] (5) Convert the target expression in the target quantum program into a sequence of expressions that satisfy PN or RPN and are in a stack data structure.

[0250] For the target expression corresponding to the initial expression "-θ / 2", it is transformed into an expression sequence "θ2 / -" that satisfies PN or RPN, such as an expression sequence "θ2 / -" that satisfies RPN and is a stack data structure. Here, the numeric operator "-" is located at the top of the stack data structure, and the operand "θ" is located at the bottom of the stack data structure.

[0251] For the target expression corresponding to the initial expression "θ / 2", it is transformed into an expression sequence "θ2 / " that satisfies PN or RPN, for example, an expression sequence "θ2 / " that satisfies RPN and is a stack data structure. Here, the numeric operator " / " is located at the top of the stack data structure, and the operand "θ" is located at the bottom of the stack data structure.

[0252] (6) Based on the expression sequence, obtain serialized data compatible with quantum computing tools.

[0253] (7) When the quantum circuit does not need to run in the cloud, the serialized data is deserialized and parsed using the local quantum processing module to obtain the executable program of the quantum computing tool, and the execution result of the executable program is obtained using the first quantum simulator in the quantum computing tool; here, the execution result of the executable program is the calculation result corresponding to the serialized data.

[0254] Specifically, based on the data restoration method for stack data structures, the expression sequence in serialized data can be deserialized and parsed to obtain the calculation result corresponding to the expression sequence. Based on the calculation result corresponding to the expression sequence, the executable program of the quantum computing tool can be obtained.

[0255] For example, the calculation result corresponding to the expression sequence "θ2 / -" is -0.5, and the calculation result corresponding to the expression sequence "θ2 / " is 0.5.

[0256] Finally, based on the calculation results corresponding to the expression sequence, the executable program of the obtained quantum computing tool can be used as follows: Figure 5 The pseudo-program representation shown is as follows. Wherein, the first RZ gate ( Figure 5 The rotation angle of the left-hand RZ gate is -0.5, instead of the initial value of 1 for the initial rotation parameter (θ) of the original quantum gate, which is equivalent to the rotation gate in the multi-control gate C4RZ. The second RZ gate's ( Figure 5 The rotation angle of the RZ gate on the right is 0.5, instead of the initial value of 1 for the initial rotation parameter (θ) of the original quantum gate, which is equivalent to the rotation gate in the multi-control gate C4RZ. Thus, the rotation angle of the rotation gate in the multi-control gate C4RZ can be adjusted through the objective expression.

[0257] After obtaining the computation result corresponding to the serialized data, the computation result corresponding to the serialized data can be sent to the program construction layer as the execution result of the target quantum program, so that the program construction layer can use the execution result of the target quantum program to represent the running result of the quantum circuit.

[0258] After obtaining the execution result of the target quantum program, performance optimization information of the quantum circuit containing multiple control gates (C4RZ) implemented by the target quantum program can be obtained based on the execution result. This information can be used to evaluate whether the quantum circuit containing multiple control gates (C4RZ) meets the design requirements. If the quantum circuit containing multiple control gates (C4RZ) does not meet the design requirements, the rotation angle of the rotating gates in the multiple control gates (C4RZ) can be adjusted by adjusting the target rotation parameters to obtain a new execution result of the target quantum program. Based on this new execution result, new performance optimization information of the quantum circuit containing multiple control gates (C4RZ) implemented by the target quantum program can be obtained, until the quantum circuit containing multiple control gates (C4RZ) is evaluated to meet the design requirements based on the new performance optimization information.

[0259] In summary, this disclosed solution provides a method for adding computational support to the parameter register of a quantum subroutine, enabling a more flexible and scalable modular construction scheme for quantum circuits. It helps overcome the pain point that after parameterization, quantum subroutines only allow actual parameters to be passed into the parameter register, which leads to the inability to adjust the rotation angle of the rotating gate in the target circuit unit implemented by the quantum subroutine after one nesting. This greatly improves the design flexibility of quantum circuits and enhances their development efficiency.

[0260] This disclosure also provides a device for obtaining the operation results of a quantum circuit, such as... Figure 6 As shown, the quantum circuit operation result acquisition device 600 includes:

[0261] The first acquisition unit 601 is used to obtain a target quantum program for implementing a quantum circuit; wherein, the target quantum program is nested with a quantum subroutine for implementing a target circuit unit in the quantum circuit, the target circuit unit includes a rotating gate, and the quantum subroutine carries a target rotation parameter for adjusting the rotation angle of the rotating gate in the target circuit unit.

[0262] The second acquisition unit 602 is used to obtain the execution result of the target quantum program; wherein, the execution result of the target quantum program is used to represent the operation result of the quantum circuit, and the rotation angle of the rotating gate in the target circuit unit can be adjusted by the target rotation parameter to change the operation result of the quantum circuit.

[0263] In a specific example of the disclosed scheme, the quantum circuit operation result acquisition device 600 further includes:

[0264] The third acquisition unit is used to obtain the performance optimization information of the quantum circuit containing the target circuit unit implemented by the target quantum program, based on the execution result of the target quantum program. The performance optimization information is used to evaluate whether the quantum circuit containing the target circuit unit meets the design requirements.

[0265] In a specific example of the disclosed solution, the first acquisition unit 601 is used for:

[0266] An initial quantum program is obtained; wherein, the initial quantum program contains nested subroutines to be built corresponding to the target circuit units in the quantum circuit;

[0267] Based on the subroutine to be built, construct a quantum subroutine carrying the target rotation parameters to implement the target circuit unit;

[0268] Based on quantum subroutines, a target quantum program for implementing quantum circuits is obtained.

[0269] In a specific example of the disclosed solution, the first acquisition unit 601 is used for:

[0270] Based on the subroutine to be built, a preset subroutine is obtained; wherein, the preset subroutine is used to implement the equivalent circuit of the target circuit unit, and the equivalent circuit of the target circuit unit contains a native quantum gate equivalent to the rotating gate in the target circuit unit.

[0271] The rotation parameters of the native quantum gate in the preset subroutine are converted into the target rotation parameters to obtain the processed preset subroutine; wherein, the processed preset subroutine is a quantum subroutine carrying the target rotation parameters used to implement the target circuit unit.

[0272] In a specific example of the disclosed solution, the first acquisition unit 601 is used for:

[0273] A quantum circuit is obtained in response to a circuit building operation;

[0274] Based on quantum circuits, an initial quantum program corresponding to the quantum circuits is obtained.

[0275] In a specific example of the disclosed solution, the second acquisition unit 602 is used for:

[0276] Convert the target quantum program into serialized data compatible with quantum computing tools;

[0277] Quantum computing tools are used to obtain computational results corresponding to serialized data; where the computational results corresponding to serialized data are the execution results of the target quantum program.

[0278] In a specific example of the disclosed solution, the second acquisition unit 602 is used for:

[0279] The target rotation parameters in the target quantum program, expressed in infix notation, are converted into a sequence of expressions that satisfy PN or RPN.

[0280] Based on the expression sequence, serialized data compatible with quantum computing tools is obtained.

[0281] In a specific example of the disclosed solution, the second acquisition unit 602 is used for:

[0282] When quantum circuits need to run locally, the local quantum processing module is used to deserialize and parse the serialized data to obtain the executable program of the quantum computing tool.

[0283] The execution result of the executable program is obtained using the first quantum simulator in the quantum computing tool; wherein, the execution result of the executable program is the calculation result corresponding to the serialized data.

[0284] In a specific example of the disclosed solution, the second acquisition unit 602 is used for:

[0285] Based on the data restoration method for PN or RPN, the expression sequence corresponding to the target rotation parameter in the serialized data is deserialized and parsed to obtain the calculation result corresponding to the expression sequence.

[0286] Based on the calculation results corresponding to the expression sequence, the executable program of the quantum computing tool is obtained.

[0287] In a specific example of the disclosed solution, the second acquisition unit 602 is used for:

[0288] When quantum circuits need to run in the cloud, serialized data is sent to a cloud server. The cloud server uses a cloud-based quantum processing module to deserialize and parse the serialized data to obtain an executable program for a quantum computing tool. Then, using a second quantum simulator or quantum hardware in the quantum computing tool, the execution result of the executable program is obtained. The execution result of the executable program is the calculation result corresponding to the serialized data.

[0289] Obtain the calculation results corresponding to the serialized data returned by the cloud server.

[0290] The specific functions and examples of each module and sub-module of the apparatus in this disclosure can be found in the relevant descriptions of the corresponding steps in the above method embodiments, and will not be repeated here.

[0291] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0292] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0293] Figure 6 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0294] like Figure 7 As shown, device 700 includes a computing unit 701, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 702 or loaded from storage unit 708 into random access memory (RAM) 703. The RAM 703 may also store various programs and data required for the operation of device 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via bus 704. An input / output (I / O) interface 705 is also connected to bus 704.

[0295] Multiple components in device 700 are connected to I / O interface 705, including: input unit 706, such as keyboard, mouse, etc.; output unit 707, such as various types of monitors, speakers, etc.; storage unit 708, such as disk, optical disk, etc.; and communication unit 709, such as network card, modem, wireless transceiver, etc. Communication unit 709 allows device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0296] The computing unit 701 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as the method for obtaining the operating results of a quantum circuit. For example, in some embodiments, the method for obtaining the operating results of a quantum circuit can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the method for obtaining the operating results of a quantum circuit described above can be performed. Alternatively, in other embodiments, computing unit 701 may be configured by any other suitable means (e.g., by means of firmware) to perform a method for obtaining the results of quantum circuit operation.

[0297] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transferring data and instructions to the storage system, the at least one input device, and the at least one output device.

[0298] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data acquisition device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0299] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, erasable programmable read-only memory (EPROM) or flash memory, optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

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

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

[0302] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0303] This disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute a method for obtaining the results of a quantum circuit.

[0304] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements a method for obtaining the operating results of a quantum circuit.

[0305] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure is achieved, and this is not limited herein. Furthermore, in this disclosure, relational terms such as "first," "second," and "third" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Additionally, "multiple" in this disclosure can be understood as at least two.

[0306] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for obtaining the operating results of a quantum circuit, comprising: A target quantum program for implementing a quantum circuit is obtained; wherein the target quantum program is nested with a quantum subroutine for implementing a target circuit unit in the quantum circuit, the target circuit unit includes a rotating gate, and the quantum subroutine carries a target rotation parameter for adjusting the rotation angle of the rotating gate in the target circuit unit; The execution result of the target quantum program is obtained; wherein, the execution result of the target quantum program is used to represent the operating result of the quantum circuit, and the rotation angle of the rotating gate in the target circuit unit can be adjusted by the target rotation parameter to change the operating result of the quantum circuit; Wherein, obtaining the execution result of the target quantum program includes: The target quantum program is converted into serialized data compatible with quantum computing tools; Using the quantum computing tool, a computational result corresponding to the serialized data is obtained; wherein, the computational result corresponding to the serialized data is the execution result of the target quantum program.

2. The method according to claim 1, wherein, The obtained target quantum program for implementing quantum circuits includes: An initial quantum program is obtained; wherein, the initial quantum program contains nested subroutines to be built corresponding to the target circuit units in the quantum circuit; Based on the subroutine to be built, a quantum subroutine carrying the target rotation parameters is built to implement the target circuit unit; Based on the quantum subroutine, a target quantum program for implementing the quantum circuit is obtained.

3. The method according to claim 2, wherein, The step of constructing a quantum subroutine carrying the target rotation parameters for implementing the target circuit unit based on the subroutine to be constructed includes: Based on the subroutine to be built, a preset subroutine is obtained; wherein, the preset subroutine is used to implement the equivalent circuit of the target circuit unit, and the equivalent circuit of the target circuit unit includes a native quantum gate equivalent to the rotating gate in the target circuit unit; The initial rotation parameters of the native quantum gate in the preset subroutine are converted into the target rotation parameters to obtain the processed preset subroutine; wherein, the processed preset subroutine is a quantum subroutine carrying the target rotation parameters for implementing the target circuit unit.

4. The method according to claim 2 or 3, wherein, The process of obtaining the initial quantum program includes: The quantum circuit is obtained in response to the circuit building operation; Based on the quantum circuit, an initial quantum program corresponding to the quantum circuit is obtained.

5. The method according to claim 1, wherein, The process of converting the target quantum program into serialized data compatible with quantum computing tools includes: The target rotation parameters in the target quantum program, expressed in infix notation, are converted into a sequence of expressions that satisfy Polish notation or inverse Polish notation. Based on the expression sequence, quantum computing tool-compatible serialized data is obtained.

6. The method according to claim 1 or 5, wherein, The process of obtaining the computational result corresponding to the serialized data using the quantum computing tool includes: When the quantum circuit needs to run locally, the serialized data is deserialized and parsed using a local quantum processing module to obtain the executable program of the quantum computing tool; The execution result of the executable program is obtained using the first quantum simulator in the quantum computing tool; wherein the execution result of the executable program is the calculation result corresponding to the serialized data.

7. The method according to claim 6, wherein, The step of deserializing and parsing the serialized data to obtain the executable program of the quantum computing tool includes: Based on the data restoration method for Polish notation or reverse Polish notation, the expression sequence corresponding to the target rotation parameter in the serialized data is deserialized and parsed to obtain the calculation result corresponding to the expression sequence; Based on the calculation results corresponding to the expression sequence, the executable program of the quantum computing tool is obtained.

8. The method according to claim 1 or 5, wherein, The process of obtaining the computational result corresponding to the serialized data using the quantum computing tool includes: When the quantum circuit needs to run in the cloud, the serialized data is sent to the cloud server; wherein, the cloud server is used to deserialize and parse the serialized data using a cloud quantum processing module to obtain an executable program of the quantum computing tool, and uses a second quantum simulator or quantum hardware in the quantum computing tool to obtain the execution result of the executable program, wherein the execution result of the executable program is the calculation result corresponding to the serialized data; The calculation result corresponding to the serialized data is returned by the cloud server.

9. The method according to any one of claims 1 to 8, further comprising: Based on the execution results of the target quantum program, performance optimization information of the quantum circuit containing the target circuit unit implemented by the target quantum program is obtained; wherein, the performance optimization information is used to evaluate whether the quantum circuit containing the target circuit unit meets the design requirements.

10. A device for obtaining the operation results of a quantum circuit, comprising: The first acquisition unit is used to obtain a target quantum program for implementing a quantum circuit; wherein the target quantum program is nested with a quantum subroutine for implementing a target circuit unit in the quantum circuit, the target circuit unit includes a rotating gate, and the quantum subroutine carries a target rotation parameter for adjusting the rotation angle of the rotating gate in the target circuit unit; The second acquisition unit is used to obtain the execution result of the target quantum program; wherein the execution result of the target quantum program is used to represent the operating result of the quantum circuit, and the rotation angle of the rotating gate in the target circuit unit can be adjusted by the target rotation parameter to change the operating result of the quantum circuit; The second acquisition unit is used for: The target quantum program is converted into serialized data compatible with quantum computing tools; Using the quantum computing tool, a computational result corresponding to the serialized data is obtained; wherein, the computational result corresponding to the serialized data is the execution result of the target quantum program.

11. The apparatus according to claim 10, wherein, The first acquisition unit is used for: An initial quantum program is obtained; wherein, the initial quantum program contains nested subroutines to be built corresponding to the target circuit units in the quantum circuit; Based on the subroutine to be built, a quantum subroutine carrying the target rotation parameters is built to implement the target circuit unit; Based on the quantum subroutine, a target quantum program for implementing the quantum circuit is obtained.

12. The apparatus according to claim 11, wherein, The first acquisition unit is used for: Based on the subroutine to be built, a preset subroutine is obtained; wherein, the preset subroutine is used to implement the equivalent circuit of the target circuit unit, and the equivalent circuit of the target circuit unit includes a native quantum gate equivalent to the rotating gate in the target circuit unit; The initial rotation parameters of the native quantum gate in the preset subroutine are converted into the target rotation parameters to obtain the processed preset subroutine; wherein, the processed preset subroutine is a quantum subroutine carrying the target rotation parameters for implementing the target circuit unit.

13. The apparatus according to claim 11 or 12, wherein, The first acquisition unit is used for: The quantum circuit is obtained in response to the circuit building operation; Based on the quantum circuit, an initial quantum program corresponding to the quantum circuit is obtained.

14. The apparatus according to claim 10, wherein, The second acquisition unit is used for: The target rotation parameters in the target quantum program, expressed in infix notation, are converted into a sequence of expressions that satisfy Polish notation or inverse Polish notation. Based on the expression sequence, quantum computing tool-compatible serialized data is obtained.

15. The apparatus according to claim 10 or 14, wherein, The second acquisition unit is used for: When the quantum circuit needs to run locally, the serialized data is deserialized and parsed using a local quantum processing module to obtain the executable program of the quantum computing tool; The execution result of the executable program is obtained using the first quantum simulator in the quantum computing tool; wherein the execution result of the executable program is the calculation result corresponding to the serialized data.

16. The apparatus according to claim 15, wherein, The second acquisition unit is used for: Based on the data restoration method for Polish notation or reverse Polish notation, the expression sequence corresponding to the target rotation parameter in the serialized data is deserialized and parsed to obtain the calculation result corresponding to the expression sequence; Based on the calculation results corresponding to the expression sequence, the executable program of the quantum computing tool is obtained.

17. The apparatus according to claim 10 or 14, wherein, The second acquisition unit is used for: When the quantum circuit needs to run in the cloud, the serialized data is sent to the cloud server; wherein, the cloud server is used to deserialize and parse the serialized data using a cloud quantum processing module to obtain an executable program of the quantum computing tool, and uses a second quantum simulator or quantum hardware in the quantum computing tool to obtain the execution result of the executable program, wherein the execution result of the executable program is the calculation result corresponding to the serialized data; The calculation result corresponding to the serialized data is returned by the cloud server.

18. The apparatus according to any one of claims 10 to 17, further comprising: The third acquisition unit is used to obtain performance optimization information of the quantum circuit containing the target circuit unit implemented by the target quantum program based on the execution result of the target quantum program; wherein the performance optimization information is used to evaluate whether the quantum circuit containing the target circuit unit meets the design requirements.

19. An electronic device comprising: At least one processor; A memory that is communicatively connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 9.

20. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 9.

21. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 9.