CN116187464A - Blind quantum computing processing method and device and electronic equipment - Google Patents

Blind quantum computing processing method and device and electronic equipment Download PDF

Info

Publication number
CN116187464A
CN116187464A CN202310185005.5A CN202310185005A CN116187464A CN 116187464 A CN116187464 A CN 116187464A CN 202310185005 A CN202310185005 A CN 202310185005A CN 116187464 A CN116187464 A CN 116187464A
Authority
CN
China
Prior art keywords
instruction
list
target
measurement
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202310185005.5A
Other languages
Chinese (zh)
Other versions
CN116187464B (en
Inventor
方堃
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202310185005.5A priority Critical patent/CN116187464B/en
Publication of CN116187464A publication Critical patent/CN116187464A/en
Application granted granted Critical
Publication of CN116187464B publication Critical patent/CN116187464B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N10/00Quantum computing, i.e. information processing based on quantum-mechanical phenomena
    • G06N10/80Quantum programming, e.g. interfaces, languages or software-development kits for creating or handling programs capable of running on quantum computers; Platforms for simulating or accessing quantum computers, e.g. cloud-based quantum computing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N10/00Quantum computing, i.e. information processing based on quantum-mechanical phenomena
    • G06N10/20Models of quantum computing, e.g. quantum circuits or universal quantum computers
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computational Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Condensed Matter Physics & Semiconductors (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Tests Of Electronic Circuits (AREA)
  • Superconductor Devices And Manufacturing Methods Thereof (AREA)

Abstract

The disclosure provides a blind quantum computing processing method, a blind quantum computing processing device and electronic equipment, and relates to the technical field of quantum, in particular to the technical field of blind quantum computing. The specific implementation scheme is as follows: acquiring a first instruction list of a target measurement mode, wherein the first instruction list comprises measurement instructions, and the target measurement mode is a measurement mode of a unidirectional quantum computer model related to a blind quantum computing protocol; reordering the measurement instructions in the first instruction list according to a sequence priority principle to obtain a second instruction list of the target measurement mode, wherein the sequence priority principle indicates that the measurement instructions of the target measurement mode are ordered according to the sequence from the node sequence mark to the node sequence mark; and based on the second instruction list, performing equivalent compiling on the target measurement mode to obtain a third instruction list of the quantum circuit equivalent to the target measurement mode.

Description

Blind quantum computing processing method and device and electronic equipment
Technical Field
The disclosure relates to the technical field of quantum computing, in particular to the technical field of blind quantum computing, and specifically relates to a blind quantum computing processing method, a blind quantum computing processing device and electronic equipment.
Background
In the use of classical Internet, when the self computing resource is insufficient, the user can submit the task to the remote server agent for execution; after the server performs the task, the result is returned to the user. The service in this scenario may be referred to as a "cloud computing service" (or "proxy computing service"). Although cloud computing services are widely used in the internet, there are significant potential hazards in the privacy and information security of users.
The quantum computing provides a brand new and very promising information processing mode by utilizing the specific operation rule in the quantum world. Compared with classical data, the quantum bit is taken as a basic unit of the data, and has unique properties in the processing and transmission of information. By utilizing quantum characteristics, a blind quantum computing protocol can be used, and computing tasks are completed by a cloud server while user data and algorithm privacy are protected. The user can drive the remote server to complete the proxy calculation according to the protocol by only a simple device capable of preparing and transmitting single-bit quantum states. On the basis of following the law of quantum mechanics, the protocol proves to have the safety in the information theory sense, namely the probability of occurrence of the privacy revealing event of the user can be arbitrarily small.
Blind quantum computing protocols are typically designed and developed based on one-way quantum computer (one-way quantumcomputer,1 WQC) models.
Disclosure of Invention
The disclosure provides a blind quantum computing processing method, a blind quantum computing processing device and electronic equipment.
According to a first aspect of the present disclosure, there is provided a blind quantum computing processing method, including:
Obtaining a first instruction list of a target measurement mode, wherein the first instruction list comprises measurement instructions, and the target measurement mode is a measurement mode of a unidirectional quantum computer model related to a blind quantum computing protocol;
the measurement instructions in the first instruction list are reordered according to a sequence priority principle, a second instruction list of the target measurement mode is obtained, the sequence priority principle indicates that the measurement instructions of the target measurement mode are ordered according to the sequence of node ranks from small to large, in the second instruction list, for the same node rank indicated by the measurement instructions, the node rank indicated by the measurement instruction ranked ahead is smaller than the node rank indicated by the measurement instruction ranked behind, and for the same node rank indicated by the measurement instructions, the node rank indicated by the measurement instruction ranked ahead is smaller than the node rank indicated by the measurement instruction ranked behind;
and based on the second instruction list, performing equivalent compiling on the target measurement mode to obtain a third instruction list of the quantum circuit equivalent to the target measurement mode.
According to a second aspect of the present disclosure, there is provided a blind quantum computing processing apparatus comprising:
The device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a first instruction list of a target measurement mode, the first instruction list comprises measurement instructions, and the target measurement mode is a measurement mode of a unidirectional quantum computer model related to a blind quantum computing protocol;
the reordering module is used for reordering the measurement instructions in the first instruction list according to a sequence priority principle to obtain a second instruction list of the target measurement mode, the sequence priority principle indicates that the measurement instructions of the target measurement mode are ordered according to the sequence of node ranks from small to large, in the second instruction list, for the same node rank indicated by the measurement instructions, the node rank indicated by the measurement instruction ordered in front is smaller than the node rank indicated by the measurement instruction ordered in rear, and for the same node rank indicated by the measurement instructions, the node rank indicated by the measurement instruction ordered in front is smaller than the node rank indicated by the measurement instruction ordered in rear;
and the equivalent compiling module is used for carrying out equivalent compiling on the target measurement mode based on the second instruction list to obtain a third instruction list of the quantum circuit equivalent to the target measurement mode.
According to a third aspect of the present disclosure, there is provided an electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any one of the methods of the first aspect.
According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform any of the methods of the first aspect.
According to a fifth aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements any of the methods of the first aspect.
According to the technology disclosed by the invention, the problem that the measurement mode of the 1WQC model related to the blind quantum computing protocol needs a relatively large number of quantum bits, so that the operation on hardware is relatively difficult is solved, and the operation difficulty of the measurement mode of the 1WQC model on hardware can be reduced, so that the requirement of a server side on the hardware scale in blind quantum computing is greatly reduced.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
fig. 1 is a flow diagram of a blind quantum computing processing method according to a first embodiment of the present disclosure;
FIG. 2 is a schematic diagram of an exemplary quantum circuit diagram;
FIG. 3 is a schematic diagram of the structure of a quantum measurement mode of an exemplary 1WQC model;
FIG. 4 is a node diagram of measurement patterns in an example blind quantum computation;
FIG. 5 is a schematic diagram of another example quantum circuit diagram;
FIG. 6 is a schematic diagram of the structure of a quantum measurement mode of another example 1WQC model;
FIG. 7 is a schematic diagram of another exemplary dynamic quantum circuit configuration;
fig. 8 is a schematic structural view of a blind quantum computing processing device according to a second embodiment of the present disclosure;
fig. 9 is a schematic block diagram of an example electronic device used to implement embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
First embodiment
As shown in fig. 1, the present disclosure provides a blind quantum computing processing method, including the steps of:
step S101: a first list of instructions for a target measurement mode is obtained, the first list of instructions comprising measurement instructions, the target measurement mode being a measurement mode of a unidirectional quantum computer model of a blind quantum computing protocol.
In this embodiment, the blind quantum computing processing method relates to the technical field of quantum computing, in particular to the technical field of blind quantum computing, and can be widely applied to the design of a blind quantum computing protocol and the blind quantum computing service scene. The blind quantum computing processing method of the embodiment of the disclosure can be executed by the blind quantum computing processing device of the embodiment of the disclosure. The blind quantum computing processing apparatus of the embodiments of the present disclosure may be configured in any electronic device to perform the blind quantum computing processing method of the embodiments of the present disclosure. In an alternative embodiment, the electronic device may be a server-side device, such as a cloud server of a blind quantum computing service.
The blind quantum computing is an ideal quantum cloud computing proxy mode, not only can help users complete cloud computing, but also can protect privacy of user data and algorithms. Blind quantum computing will play an important role in the future quantum internet.
However, blind quantum computing protocols are usually developed based on a 1WQC model, and to directly implement an algorithm of the 1WQC model, a server may encounter at least two difficulties: 1) The 1WQC model requires a large number of qubits; 2) The current quantum computer is developed based on platforms such as superconductors and ion traps, is more suitable for running the algorithm of the quantum circuit model, and cannot directly run the algorithm of the 1WQC model.
The objective of the present embodiment is to compile a quantum measurement mode used in the blind quantum computation, i.e., a measurement mode of a 1WQC model related to a blind quantum computation protocol, into an equivalent dynamic quantum circuit, so that on one hand, the number of quantum bits required for execution can be greatly reduced, and on the other hand, the method is more conveniently executed on a superconducting and ion trap equivalent quantum hardware platform, thereby greatly reducing the requirements of a server side on the hardware scale in the blind quantum computation.
The 1WQC model and the quantum circuit model are described in detail below.
Quantum circuit models are one type of commonly used quantum computing model. And (3) completing the evolution of the quantum state by carrying out quantum gate operation on the initial quantum state, and extracting a calculation result by quantum measurement. The quantum circuit diagram shows the whole process of quantum circuit model calculation.
Fig. 2 is a schematic diagram of an exemplary quantum circuit diagram, and as shown in fig. 2, a qubit system may be represented by a horizontal line, where qubits are numbered sequentially from top to bottom, where the qubits are often numbered beginning with zero.
The time evolution direction in the quantum circuit diagram is from left to right, the leftmost end is an initial quantum state, wherein each quantum bit is initialized to be a zero state, and then different quantum gate operations are sequentially applied to the initial state to complete the evolution of the quantum state. Meanwhile, quantum measurement can be carried out on some qubits, and measurement results are obtained.
In some application scenarios, an operation in a quantum circuit may occur to perform quantum measurement on a part of the qubits, and regulate the evolution of the rest of the qubits according to the measurement result, and such an operation is called classical control quantum operation, such as classical control quantum gate 201 shown in fig. 2. The measured qubit may be reset, which may be referred to as a reset operation, such as reset operation 202 shown in FIG. 2, for continued use in subsequent computations. A quantum circuit comprising intermediate measurement, classical control quantum operations, and reset operations may be referred to as a dynamic quantum circuit, e.g. the quantum circuit shown in fig. 2 is a dynamic quantum circuit.
The remainder of the quantum circuit diagram, except for the initial state, may be generally represented by an ordered list of instructions in the order of action of the quantum gates, each element in the list representing a quantum gate, classical control quantum gate, quantum measurement or reset operation instruction. Specifically, it is possible to combine:
each single qubit gate (e.g., H, X, Y, Z, S, T, rx, ry, rz, etc.) is represented as an instruction containing four elements [ name, while_qubit, parameters, condition ]. Where name is the name of the quantum gate, while_qubit is the qubit that the quantum gate acts on, parameters are parameters of the quantum gate (no if there is no parameter), and condition indicates which of the qubits the quantum gate operation is controlled by (no if there is no parameter).
For example, [ Rx,2, pi, none ] represents acting an Rx rotation gate on the qubit on qubit 2, with a rotation angle pi. For another example, classical control quantum gate 201 in fig. 2 is a classical controlled quantum X gate, which may be denoted as [ X,2, none, 'a' ], i.e. the bery Pauli X gate acting on qubit 2, with the controlled condition that the measurement result with measurement identity ID 'a' acts as a quantum gate if the measurement result is 0 and not as a quantum gate if the measurement result is 1.
Each two-qubit gate (e.g., control not gate CNOT, CZ gate) is represented as an instruction containing four elements [ name, white_qubit, parameters, condition ]. Where name is the name of the quantum gate, while_qubit is a list of qubits that the two-qubit gate acts on (in particular, for a controlled quantum gate, a list of control bits and controlled bits), parameters is the parameter of the quantum gate (default to None if there is no parameter), and the condition indicates which quantum bit the quantum gate operation is controlled by (default to None if there is no parameter).
For example, [ CNOT, [1,3], none ] represents a control NOT acting on qubit 1 and qubit 3, where qubit 1 is the control bit and qubit 3 is the control bit. [ CZ, [1,2], none ] indicates that a CZ gate acts between qubit 1 and qubit 2.
Each single bit measurement is represented as an instruction containing four elements [ measure, white_qubit, basic, mid ]. The basic is determined by four parameters, including the measurement angle, the measurement plane, the field set s, the field set t, and mid is the identification ID identifying the current measurement.
For example, [ measure,2, [0, 'YZ', [1], [2] ], and 'a' ] indicate that the qubit 2 is measured, the measurement angle is 0, the measurement plane is the 'YZ' plane, the field set s is the qubit 1, the field set t is the qubit 2, and the identification ID of the current measurement instruction is 'a'.
Each reset operation instruction may be represented as an instruction containing four elements [ reset, while_qubit, matrix, none ]. The while_qubit is a quantum bit to be reset, the matrix is a quantum state matrix of the bit to be reset, and the quantum bit after the reset operation can be used for subsequent calculation.
The 1WQC model is another quantum computing approach than the quantum circuit model. The core idea of the model is to measure part of bits of one quantum entangled state, a quantum system which is not measured can realize corresponding evolution, and any needed evolution can be realized through controlling a measurement mode.
The calculation process under the 1WQC model mainly comprises three steps: first, a resource state, i.e., a highly entangled multi-body quantum state, is prepared, which can be prepared before computation begins and can be independent of the specific computing task; secondly, sequentially carrying out single-bit measurement on each bit of the prepared resource state, wherein the measurement mode of the subsequent bit can be correspondingly adjusted according to the measurement result of the measured bit, namely, the adaptability measurement is allowed; and thirdly, performing classical data processing on the measurement results of all bits to obtain a required calculation result.
FIG. 3 is a schematic diagram of the structure of a quantum measurement mode of an exemplary 1WQC model. As shown in FIG. 3, the grid represents a common quantum resource state, each node on the grid represents a qubit, and the entire grid represents a highly entangled quantum state.
Each bit may be measured in turn, and X, Y, Z, XY, etc. in a node represent the corresponding measurement basis. After all the nodes are measured according to preset rules, calculation tasks can be completed by counting measurement results.
An algorithm of a 1WQC model can also be described in terms of measurement modes. Each measurement mode consists of four parts: the computation space, input nodes, output nodes, and computation instructions, i.e., measurement patterns, can be expressed as: measurement pattern p= (computation space S, input node I, output node O, computation instruction C).
The "computation space" is a node set related to all the 1WQC models, "input node" is a node set of initial quantum states, "output node" is an output node set of quantum states or measurement results, "computation instructions" are an ordered list (agreed computation instructions are read from left to right) composed of three basic instructions in the following table 1, and all state preparation instructions in a standard order are arranged at the forefront, followed by entanglement instructions, and then all measurement instructions. Wherein, the state preparation instruction and the entanglement instruction jointly determine the preparation process of the multi-body entanglement state in the 1WQC model.
Table 1 storage rules and execution mode table of calculation instructions in measurement mode
Figure BDA0004104782630000071
In step S101, the target measurement mode is a measurement mode of a unidirectional quantum computer model related to the blind quantum computing protocol, that is, a quantum measurement mode used for blind quantum computing. The target measurement mode may be a brick measurement mode or a blind calculation measurement mode based on cluster state, and will not be described in detail here.
The measurement mode in blind quantum computing, i.e. the target measurement mode, is very structural. For example, a node diagram of measurement patterns in an exemplary blind quantum computation is shown in fig. 4, where the target measurement pattern indicated in the diagram is a brick measurement pattern, and similar to fig. 3, each node in the diagram represents a qubit and a corresponding state preparation instruction, each line between nodes represents an entanglement instruction, and X, Y, etc. on a node represent measurement instructions corresponding to the node. Each node may be represented by a two-dimensional coordinate, e.g., (0, 1) represents a node of row 0, column 1.
The first instruction list may be a part of calculation instructions in a quantum measurement mode used in blind quantum calculation, which is represented by an ordered list, and the list formed by the calculation instructions is the first instruction list.
The first instruction list may be an instruction list of a standard quantum measurement mode, for example, the first instruction list is: [ [ N,0], [ N,1], [ N,2], [ E, [0,1] ], [ E, [1,2] ], [ M,0], [ M,1], [ M,2] ]. In the instruction list of the standard quantum measurement mode, all state preparation instructions are arranged at the forefront, then entanglement instructions are arranged, then all measurement instructions are arranged, and only the first two parameters of the instructions are written for simplifying the expression.
Step S102: and reordering the measurement instructions in the first instruction list according to a sequence priority principle to obtain a second instruction list of the target measurement mode, wherein the sequence priority principle indicates that the measurement instructions of the target measurement mode are ordered according to the sequence of node ranks from small to large, in the second instruction list, for the same node rank indicated by the measurement instructions, the node rank indicated by the measurement instruction ranked ahead is smaller than the node rank indicated by the measurement instruction ranked behind, and for the same node rank indicated by the measurement instructions, the node rank indicated by the measurement instruction ranked ahead is smaller than the node rank indicated by the measurement instruction ranked behind.
In the step, due to the special structure of the measurement mode in the blind quantum calculation, namely the target measurement mode, in the target measurement mode, the measurement sequence among nodes in the same row is not divided, and the nodes with smaller row marks can be measured firstly among nodes in the same row. For this rule, the measurement order (i.e., the arrangement order of the measurement instructions) in the target measurement mode may be reordered so that all measurement instructions are executed in the order of the columns. The measurement instructions in the first instruction list are reordered according to a sequence priority principle, and the sequence priority principle indicates that the measurement instructions in the target measurement mode are ordered according to the sequence from the node list to the node list.
In this step, the measurement instructions may be rearranged directly through the order of the nodes, without further consideration of the dependency relationship between the measurement instructions, that is, the values of domain_s and domain_t in the measurement instructions. This is because the special structure ensures the validity of the above measurement sequence for the quantum measurement mode used for blind quantum computation. Therefore, on one hand, the equivalence with the original measurement mode is not destroyed, and on the other hand, the subsequent compiling is also preprocessed, so that the minimum bit number required by the compiled dynamic quantum circuit is ensured.
The quantum algorithm needs N quantum bits, namely N rows of nodes are arranged corresponding to the target measurement mode, and after the pretreatment of the step, the dynamic quantum circuit which is equivalently compiled can be ensured to only need at most N+1 quantum bits. The number of bits required by the server cannot be less than the number of bits (i.e., N) of the quantum algorithm that the user needs to run, so at least N, but the embodiment provides a blind quantum computing processing manner of the number of bits of n+1, so that the number of required quantum bits can reach approximately optimal, and the conclusion will be verified later.
In an alternative embodiment, the measurement instructions in the first instruction list may be reordered by exchanging between the instructions, so that the measurement instructions in the instruction list are preferably ordered according to the column labels, and for the same node column label indicated by the measurement instructions, the node row label indicated by the measurement instruction ordered before is smaller than the node row label indicated by the measurement instruction ordered after, and for the same node row label indicated by the measurement instruction, the node column label indicated by the measurement instruction ordered before is smaller than the node column label indicated by the measurement instruction ordered after, so as to obtain the second instruction list of the target measurement mode.
In another alternative embodiment, the measurement instructions in the first instruction list may be rearranged according to the ordered list of node labels in the computation space S, to obtain the second instruction list. The sorting list is preferably sorted according to labels in the node labels, and for the same label, the label row label sorted in front is smaller than the label row label sorted in back, and for the same label row label, the label column label sorted in front is smaller than the label column label sorted in back.
Step S103: and based on the second instruction list, performing equivalent compiling on the target measurement mode to obtain a third instruction list of the quantum circuit equivalent to the target measurement mode.
In this step, on the basis of preprocessing the first instruction list to obtain a second instruction list, an equivalent compiling may be performed on each instruction in the second instruction list, so as to compile the instruction into an instruction in a quantum circuit equivalent to the instruction. The quantum circuit may be a dynamic quantum circuit.
When equivalent compiling is performed, a node of an instruction in the second instruction list can be obtained, a register unit is allocated for the node, and the register unit can correspond to quantum bits in the quantum circuit. The instructions can be mapped to a dynamic quantum circuit, and specifically, the operation on each node (i.e. the node indicated by the instructions in the second instruction list) in the target measurement mode can be dynamically loaded into the register unit of the quantum circuit.
In this embodiment, a first instruction list of a target measurement mode is obtained, measurement instructions in the first instruction list are reordered according to a sequence priority principle to obtain a second instruction list of the target measurement mode, and then based on the second instruction list, the target measurement mode is equivalently compiled to obtain a third instruction list of a quantum circuit equivalent to the target measurement mode. Therefore, by reordering the measurement instructions according to the sequence priority principle, on one hand, the equivalence with the original measurement mode is not destroyed, on the other hand, the equivalent compiling is also preprocessed, and the minimum bit number required by the compiled dynamic quantum circuit is ensured, so that the operation difficulty of the measurement mode of the 1WQC model on hardware can be reduced, and the requirement of a server side on the hardware scale in blind quantum computing is greatly reduced.
Optionally, the step S102 specifically includes:
splitting the first instruction list to obtain a first list, wherein the first list is a list formed by measurement instructions in the first instruction list;
the labels of all nodes in the calculation space of the target measurement mode are ordered according to the sequence priority principle to obtain an ordered list, wherein the labels comprise row labels and column labels, in the ordered list, for the same label column label, the label row label ordered before is smaller than the label row label ordered after, and for the same label row label, the label column label ordered before is smaller than the label column label ordered after;
Rearranging the measurement instructions according to the first list and the ordered list to obtain a second list;
the second instruction list is determined based on the second list.
In this embodiment, the measurement instructions in the first instruction list may be rearranged according to the ordered list of node labels in the computation space S of the target measurement mode.
First, the first instruction list may be split to obtain a list of measurement instructions in the first instruction list, i.e. the first list. In addition, splitting may also obtain a list of state preparation instructions and entanglement instructions, such as a list of state preparation instructions and a list of entanglement instructions.
Thereafter, an ordered list may be constructed based on the computation space of the target measurement mode, and the measurement instructions reordered according to the ordered list. The specific process of measuring the reordering of the instructions is as follows:
input: instruction list commands (i.e., first instruction list) of the target measurement mode, the computation space S;
and (3) outputting: the reordered instruction list (i.e., the second instruction list).
Step 1: marking a list formed by all state preparation instructions in a first instruction list as commands_N, marking a list formed by all entanglement instructions as commands_E, and marking a list formed by all measurement instructions as commands_M;
Step 2: sequencing all node labels in the calculation space S according to a sequence priority principle, so that the row label in the same column has small priority, and the column label in the same row has small priority; and R rows and C columns of nodes are arranged, and the obtained ordered list order is as follows:
order=[(0,0),(1,0),…(R-1,0),(0,1),(1,1),…(R-1,1),…,(0,C-1),(1,C-1),…(R-1,C-1)];
step 3: rearranging the measurement instructions according to the node arrangement sequence of the ordered list, namely initializing an empty list new_commands_M, cycling through the list order, recording the currently cycled element as (i, j), finding the measurement instruction indicating the node as (i, j), and adding the measurement instruction into the new_commands_M (namely a second list);
step 4: splicing the compositions_N, the compositions_E and the new_compositions_M in sequence, and recording the obtained list as new_compositions (namely a second instruction list);
step 5: the reordered instruction list new_commands is returned as output.
In this way, the reordering of the measurement instructions in the first instruction list according to the order priority principle can be realized very simply.
Optionally, the second instruction list further includes a state preparation instruction and an entanglement instruction, and the step S103 specifically includes:
based on the second instruction list, deferring the state preparation instruction and the entanglement instruction in the target measurement mode to obtain a fourth instruction list of the target measurement mode, wherein the relative position sequence of each measurement instruction in the second instruction list and the fourth instruction list is kept unchanged, the relative position sequence of different instructions on the same node of the target measurement mode is unchanged, and the relative position sequence of the different instructions is as follows: preparing instructions, entanglement instructions and measurement instructions from front to back;
And carrying out equivalent compiling of the instructions based on the fourth instruction list to obtain the third instruction list.
In this embodiment, the state preparation instruction and the entanglement instruction in the target measurement mode are the state preparation instruction and the entanglement instruction in the second instruction list.
Since in the standard quantum measurement mode, the state preparation instruction is the forefront of all instructions, followed by the entanglement instruction, and then the measurement instruction. The state preparation instruction and the entanglement instruction of the target measurement mode may be deferred.
In an alternative embodiment, the instructions in the second instruction list may be moved to the right end of the instruction list by sequential exchange between instructions, resulting in a fourth instruction list for the target measurement mode.
In another alternative embodiment, the instructions in the second instruction list may be rearranged to achieve the effect of deferring the state preparation instruction and the entangled instruction in the second instruction list, so as to obtain the fourth instruction list.
When the deferral treatment is performed, the deferral treatment is limited as follows:
the relative position sequence of all measurement instructions needs to be kept unchanged;
different instructions on the same node need to keep the relative position sequence of the preparation instruction, the entanglement instruction and the measurement instruction unchanged from front to back.
When moving these instructions in the second instruction list to the right of the instruction list by sequential exchange between instructions, there is also a need to limit: the precondition for the exchange of different types of instructions is that the system on which the two instructions act has no intersection.
Under the premise of the limitations, the relative position sequence of each measurement instruction in the second instruction list and the fourth instruction list is kept unchanged, and the relative position sequence of the preparation instruction, the entanglement instruction and the measurement instruction of different instructions on the same node of the target measurement mode is kept unchanged from front to back.
For example, the second instruction list is: the fourth instruction list obtained after deferring the processing is [ [ N,0], [ N,1], [ N,2], [ E, [0,1] ], [ E, [1,2] ], [ M,0], [ M,1], [ M,2] ], and is [ [ N,0], [ N,1], [ E, [0,1] ], [ M,0], [ N,2], [ E, [1,2] ], [ M,2] ].
Then, for each instruction in the fourth instruction list, the instruction may be equivalently compiled to compile the instruction into an instruction in a quantum circuit equivalent to the instruction. The quantum circuit may be a dynamic quantum circuit.
The instructions in the fourth instruction list can be equivalently compiled in sequence according to the ordering sequence of the instructions in the fourth instruction list, and under the condition that compiling is completed, a third instruction list of the quantum circuit equivalent to the target measurement mode can be obtained.
When equivalent compiling is performed, a node of an instruction in the fourth instruction list can be obtained, a register unit is allocated for the node, and the register unit can correspond to a quantum bit in the quantum circuit. The instruction can be mapped to a dynamic quantum circuit, and specifically, the operation on each node (i.e. the node indicated by the instruction in the fourth instruction list) in the target measurement mode can be dynamically loaded into the register unit of the quantum circuit.
In an alternative embodiment, if the current node indicated by an instruction in the fourth instruction list has been loaded (i.e. a register unit has been allocated for that node), then the instruction may be executed on the corresponding register unit, i.e. if different instructions in the fourth instruction list indicate the same node, then the instructions may all be executed on the register unit allocated for that node. And if the current node is not loaded, it may be assigned a register unit. In this way, the number of qubits required to execute the model can be greatly reduced.
In the embodiment, a fourth instruction list of the target measurement mode is obtained by deferring the state preparation instruction and the entangled instruction in the target measurement mode based on the second instruction list; and carrying out equivalent compiling of the instructions based on a fourth instruction list to obtain the third instruction list. Therefore, compiling of the target measurement mode to the quantum circuit can be realized, and quantum bits of the compiled quantum circuit are guaranteed to be approximately optimal, so that the number of the quantum bits required by executing the model can be greatly reduced, and the quantum bits can be conveniently executed on a superconducting, ion trap and other equivalent hardware platform.
Optionally, based on the second instruction list, the deferring processing is performed on the state preparation instruction and the entanglement instruction in the target measurement mode, so as to obtain a fourth instruction list of the target measurement mode, including:
splitting the second instruction list to obtain a third list, a fourth list and a fifth list, wherein the third list is a list formed by state preparation instructions in the second instruction list, the fourth list is a list formed by entanglement instructions in the second instruction list, and the fifth list is a list formed by measurement instructions in the second instruction list;
deferring the entangled instruction in the target measurement mode based on the fourth list and the fifth list to obtain a sixth list, wherein the sixth list comprises entangled instructions in the fourth list and measurement instructions in the fifth list, and in the sixth list, different instructions on the same node of the target measurement mode keep relative position sequences of the entangled instructions and the measurement instructions from front to back;
and carrying out deferral processing on the state preparation instruction in the target measurement mode based on the third list and the sixth list to obtain the fourth instruction list.
In this embodiment, the entangled instruction in the target measurement mode may be deferred based on the second instruction list, and in the case where the deferred processing of the entangled instruction is completed, the deferred processing of the state preparation instruction in the target measurement mode may be further performed, and accordingly, the deferred processing of the state preparation instruction and the entangled instruction in the target measurement mode may be performed, to obtain a fourth instruction list.
Specifically, in the case of performing deferral processing separately, the second instruction list may be split, where the result of the splitting is that three lists are obtained, a list formed by all state preparation instructions (i.e., the third list) is denoted as commands_n, a list formed by all entangled instructions (i.e., the fourth list) is denoted as commands_e, and a list formed by all measurement instructions (i.e., the fifth list) is denoted as new_commands.
The deferral processing may be performed on the entangled instruction in the target measurement mode based on the fourth list and the fifth list, to obtain a sixth list, where the deferral processing is limited as follows:
the relative position sequence of all measurement instructions needs to be kept unchanged;
different instructions on the same node need to keep the relative position sequence of entanglement instructions and measurement instructions from front to back unchanged;
The precondition for the exchange of different types of instructions is that the system on which the two instructions act has no intersection.
Correspondingly, in the sixth list, different instructions on the same node of the target measurement mode keep the relative position sequence of the entangled instructions and the measurement instructions from front to back, and the relative position sequence of the measurement instructions in the sixth list is the same as the relative position sequence of the measurement instructions in the fifth list.
Then, in the case where the entangled instruction deferral processing is completed, the state preparation instruction in the target measurement mode may be deferred based on the third list and the sixth list, to obtain a fourth instruction list. When the deferral treatment is performed, the deferral treatment is limited as follows:
the relative position sequence of all measurement instructions needs to be kept unchanged;
different instructions on the same node need to keep the relative position sequence of the front-to-back state preparation instruction, the entanglement instruction and the measurement instruction unchanged;
the precondition for the exchange of different types of instructions is that the system on which the two instructions act has no intersection.
In this embodiment, by first deferring the entangled instruction in the target measurement mode, and then deferring the state preparation instruction in the target measurement mode when the deferring of the entangled instruction is completed, the state preparation instruction and the entangled instruction in the target measurement mode may be deferred accordingly, so as to obtain the fourth instruction list. In this way, the process of deferring the preparation instructions and entanglement instructions in the target measurement mode can be simplified.
Optionally, based on the fourth list and the fifth list, deferring the entangled instruction in the target measurement mode to obtain a sixth list, including:
traversing the fourth list aiming at the entanglement instruction, and recording the entanglement instruction of the current traversal;
traversing the fifth list aiming at the measurement instruction to obtain a target measurement instruction, wherein the node acted by the entanglement instruction of the current traversal comprises the node acted by the target measurement instruction;
inserting the currently traversed entanglement instruction into a first position in the fifth list, wherein the first position is the position of the target measurement instruction in the fifth list;
and determining the updated fifth list as the sixth list when the fourth list traversing is completed.
In this embodiment, the fourth list may be traversed with respect to the entangled instruction, and the entangled instruction currently traversed may be recorded, which may be denoted as cmd_e.
In the traversing process of the fourth list for the entangled instruction, the fifth list may be traversed for the measurement instruction to obtain a target measurement instruction, where a node acted by the target measurement instruction is included in a node acted by the entangled instruction cmd_e currently traversed.
In the case that the target measurement instruction is obtained through traversal, the entangled instruction cmd_E of the current traversal is inserted into the position (i.e. the ith bit) of the target measurement instruction in the fifth list, and the target measurement instruction and the instruction located after the ith bit in the fifth list are sequentially moved to the right end. Otherwise, continuing to traverse the fifth list for the measurement instruction until the target measurement instruction is traversed.
Accordingly, in the case where the traversal of the fourth list is completed, the updated fifth list is determined as the sixth list. In this way, a process of deferring processing of entangled instructions in the target measurement mode can be realized.
Optionally, based on the third list and the sixth list, deferring a state preparation instruction in the target measurement mode to obtain the fourth instruction list, where the deferring includes:
traversing the third list aiming at the state preparation instruction, and recording the state preparation instruction of the current traversal;
traversing the sixth list aiming at the entangled instruction to obtain a target entangled instruction, wherein the node acted by the target entangled instruction comprises the node acted by the currently traversed state preparation instruction;
Inserting the currently traversed state preparation instruction into a second position in the sixth list, wherein the second position is the position of the target entanglement instruction in the sixth list;
and determining the updated sixth list as the fourth instruction list under the condition that the third list traversal is completed.
In this embodiment, the third list may be traversed with respect to the state preparation instruction, and the state preparation instruction of the current traversal may be recorded, which may be denoted as cmd_n.
In the traversing process of the state preparation instruction for the third list, traversing the entangled instruction for the sixth list to obtain a target entangled instruction, where the node acted by the target entangled instruction includes the node acted by the state preparation instruction cmd_n of the current traversing.
Under the condition that the target entanglement instruction is obtained through traversing, the state preparation instruction cmd_N of the current traversing is inserted into the position (such as the j-th bit) of the target entanglement instruction in the sixth list, and the target entanglement instruction and the instructions positioned behind the j-th bit in the sixth list sequentially move to the right end. Otherwise, continuing traversing the sixth list aiming at the entanglement instruction until traversing to the target entanglement instruction.
Accordingly, in the case where the traversal of the third list is completed, the updated sixth list is determined as the fourth instruction list. In this way, a process of deferring processing of state preparation instructions in the target measurement mode may be implemented.
The process of deferring the state preparation instruction and the entangled instruction in the target measurement mode is specifically as follows:
input: a second command list command of the target measurement mode;
and (3) outputting: the reordered instruction list, the fourth instruction list.
Step 1: the list formed by all the preparation instructions in the second instruction list is marked as command_N (namely a third list), the list formed by all the entanglement instructions is marked as command_E (namely a fourth list), and the list formed by all the measurement instructions is marked as new_commands (namely a fifth list);
step 2: the list commands_E is traversed circularly, the currently circulated element is recorded as cmd_E, and the following operation a) is performed:
a) Cycling through the list new_commands, recording the currently cycled element as cmd, and the cmd is in the ith bit of new_commands; if cmd is a measurement instruction and the acted node is included in the acted node of cmd_E, then cmd_E is inserted into the ith bit of the new_commands list and the layer cycle is jumped out; otherwise, continuing to traverse the list new_commands;
Step 3: the list commands_N is traversed circularly, the element currently circulated is recorded as cmd_N, and the following operation b) is performed:
b) The list new_commands is cycled through, recording the currently cycled element as cmd, and cmd is at the j-th bit of new_commands: if cmd is an entangled instruction and the acted node contains the node acted by cmd_N, inserting cmd_N into the j-th bit of the new_commands list, and jumping out of the layer cycle; otherwise, continuing to traverse the list new_commands;
step 4: the new_commands list is returned as output, i.e., the fourth instruction list is output.
Optionally, the performing equivalent compiling of the instruction based on the fourth instruction list to obtain the third instruction list includes:
for each instruction in the fourth instruction list, performing the following operations:
obtaining a target node acted by the instruction;
determining a target identifier of a register unit of the quantum circuit allocated for the target node based on the target node and a register unit dictionary, wherein the register unit dictionary comprises a corresponding relation between the register unit and the node in the target measurement mode;
based on the target identification, carrying out equivalent compiling on the instruction to obtain an instruction in a quantum circuit equivalent to the instruction;
The third instruction list comprises instructions in the quantum circuit obtained through equivalent compiling.
In this embodiment, equivalent compilation may be performed for each instruction in the fourth instruction list.
The instructions in the fourth instruction list may include instruction types and acted node labels vertex, and the target node acted by the instructions may be obtained by obtaining vertex.
The target identification of the register cell of the quantum circuit allocated for the target node may be determined based on the target node and the constructed register cell dictionary. Wherein the register unit dictionary may be used for recording the state of the register unit, i.e. the keys of the data in the register unit dictionary may be identifiers, such as labels, of the register units and the corresponding values may be which node in the target measurement mode the register unit is assigned to.
For example, the registering unit dictionary may be: {0:a,1:none,2:b }, indicating that register unit 0 is allocated to node a, register unit 1 is idle (i.e., register unit 1 is not allocated), and register unit 2 is allocated to node b.
In an alternative embodiment, before performing equivalent compiling of the fourth instruction list, an empty register unit dictionary may be constructed, and correspondingly, when performing equivalent compiling of the instruction in the fourth instruction list, a register unit may be allocated for a node indicated by the instruction based on the register unit dictionary (e.g., if the register unit dictionary is empty, a new register unit may be created and an identifier of the register unit is recorded), and the register unit dictionary may be updated based on a correspondence between the node and the register unit, so as to record a state of the register unit. Thereafter, equivalent compilation of instructions in the fourth instruction list may proceed based on the nodes indicated by the instructions in the fourth instruction list and the updated register unit dictionary.
In the case of obtaining the target identifier, the instructions in the fourth instruction list may be equivalently compiled based on the target identifier, where the target identifier may indicate a qubit of a qubit acted upon by the instruction in a quantum circuit equivalent to the instruction. The equivalent compiling process will be described in detail in the following embodiments.
In this way, an equivalent compilation of instructions for the target measurement mode can be achieved to obtain instructions in the quantum circuit equivalent to the target measurement mode.
Optionally, the determining, based on the target node and the register unit dictionary, the target identifier of the register unit of the quantum circuit allocated to the target node includes at least one of the following:
under the condition that the corresponding relation of the target node is included in the register unit dictionary, determining the identification of the register unit corresponding to the target node as the target identification;
and under the condition that the corresponding relation of the target node is not included in the register unit dictionary, distributing the register unit to the target node based on the register unit dictionary, determining the identification of the register unit distributed to the target node as the target identification, and updating the register unit dictionary based on the identification of the register unit distributed to the target node.
In this embodiment, if the current node indicated by the instruction in the fourth instruction list is already loaded (i.e. a register unit has been allocated to the node), that is, the register unit dictionary may include a correspondence relationship between target nodes (e.g. 0:a, where node a is a target node), the identifier of the register unit corresponding to the target node may be determined as the target identifier (e.g. identifier 0 is determined as the target identifier), that is, the instruction may be executed on the register unit corresponding to the target identifier.
That is, if the instruction preceding the instruction in the fourth instruction list also indicates the target node and the register unit has been allocated to the target node (i.e. the register unit dictionary records the correspondence), then the instructions may all be executed on the register unit allocated to the target node.
If the current node is not loaded (i.e. the corresponding relation of the target node is not included in the register unit dictionary), a register unit can be allocated for the current node, the identification of the register unit allocated by the target node is determined as the target identification, and meanwhile, the register unit dictionary is updated based on the identification of the register unit allocated by the target node, i.e. the corresponding relation between the label of the target node and the target identification is added into the register unit dictionary. In this way, the number of qubits required to execute the model can be greatly reduced.
Optionally, the allocating a register unit for the target node based on the register unit dictionary includes at least one of:
under the condition that the registering unit dictionary comprises the identification of a first registering unit, the first registering unit is allocated to the target node, and the first registering unit is not allocated to the node;
and under the condition that the register unit dictionary does not comprise the identification of the first register unit, acquiring the number of the register units represented by the register unit dictionary, determining the identification of the created second register unit based on the number, and distributing the second register unit to the target node.
In this embodiment, the register units are dynamically increased as required, if there are idle units (e.g. 1: none, indicating that the register unit 1 is an idle register unit), then the idle units are preferentially allocated, otherwise a new register unit is created, and based on the number of register units represented by the register unit dictionary (e.g. register unit dictionary {0: a,1: b }, the number of represented register units is 2), the identity of the created second register unit is determined, and the second register unit is allocated to the target node. Thus, the width of the compiled dynamic quantum circuit can be ensured to be as small as possible.
Optionally, the first register unit is the smallest identified register unit among the register units not allocated to the node.
In this embodiment, the node may be searched for the idle unit with the smallest address in all created register units to allocate the register units, so that the register unit allocation may be ensured to be performed accurately and orderly.
The specific process of allocating register units to nodes is as follows:
input: registering a unit dictionary qreg, and calculating a node label vertex of an instruction in a target measurement mode;
and (3) outputting: the index idx of the register unit allocated, and the updated register unit dictionary qreg.
Step 1: searching for the vertex in qreg, if the vertex is allocated with a register unit, returning the index idx of the corresponding register unit, and returning to the register unit dictionary qreg; if vertex is not allocated a register unit, then the following operation a) continues:
and searching for an idle register unit in qreg, namely, a register unit with a corresponding value of None, and recording a list formed by the labels of the register units as available_regs. If the available_regs is not an empty set, namely, an idle register unit exists currently, the smallest register unit label in the available_regs is found to be idx; if available_regs is an empty set, which indicates that no idle register unit exists currently, calculating the length of qreg to be n, creating a new register unit with a register unit label of n, and recording idx=n; updating a register unit qreg, and writing a value with a corresponding relation with idx as vertex;
Step 2: the assigned quantum register unit index idx and the updated register unit dictionary qreg are returned.
Optionally, based on the target identifier, performing equivalent compiling on the instruction to obtain an instruction in the quantum circuit equivalent to the instruction, where the instruction includes at least one of the following:
under the condition that the instruction is a state preparation instruction, based on the target identifier, equivalently compiling the instruction into a reset operation instruction in a quantum circuit, wherein the reset operation instruction is used for resetting the quantum state of a register unit corresponding to the target identifier into the quantum state indicated by the state preparation instruction;
under the condition that the instruction is an entanglement instruction, based on the target identifier, equivalently compiling the instruction into a quantum gate operation instruction in a quantum circuit, wherein the quantum gate operation instruction is used for carrying out quantum gate operation corresponding to the entanglement instruction based on a register unit corresponding to the target identifier;
and under the condition that the instruction is a measurement instruction, based on the target identifier, equivalently compiling the instruction into a quantum measurement operation instruction in a quantum circuit, wherein the quantum measurement operation instruction is used for carrying out quantum measurement operation indicated by the measurement instruction based on a register unit corresponding to the target identifier.
In this embodiment, the instructions in the fourth instruction list may include an instruction type, and the instruction type may be indicated as a state preparation instruction (e.g., N), an entanglement instruction (e.g., E), or a measurement instruction (e.g., M).
In the case that the instruction is determined to be the state preparation instruction based on the instruction type, the instruction can be equivalently compiled into a reset operation instruction in the quantum circuit based on the target identifier, wherein the reset operation instruction is used for resetting the quantum state of the register unit corresponding to the target identifier to the quantum state indicated by the state preparation instruction. For example, the state preparation instruction is [ N, vertex, matrix ], and can be equivalently compiled into [ reset, idx, matrix, none ] based on the target identifier idx. Wherein matrix is the quantum state indicated by the state preparation instructions.
In the case where the instruction is determined to be an entangled instruction based on the instruction type, the instruction is equivalently compiled into a quantum gate operation instruction in the quantum circuit based on the target identification, and the quantum gate operation instruction may be a CZ gate. For example, the entanglement instruction is [ E, [ vertex0, vertex1] ], and can be equivalently compiled into [ CZ, [ idx0, idx1], none ] based on the target identifier (vertex 0 corresponds to the target identifier idx0, vertex1 corresponds to the target identifier idx 1).
In the case where the instruction is determined to be a measurement instruction based on the instruction type, the instruction is equivalently compiled into a quantum measurement operation instruction in the quantum circuit based on the target identification. For example, the measurement instruction is [ M, vertex, angle, plane, domain_s, domain_t ], and can be equivalently compiled into [ measurement, idx, [ angle, plane, domain_s, domain_t ], vertex ] based on the target identifier idx.
In this way, an equivalent compilation of instructions of the target measurement mode into instructions of the quantum circuit can be achieved.
Optionally, in the case that the instruction is a measurement instruction, the quantum measurement operation instruction includes a measurement identifier, where the measurement identifier is a node identifier acted on by the measurement instruction.
In this embodiment, when the instruction is a measurement instruction in the equivalent compiling of the instruction, since multiple quantum measurements may occur in the same register unit, the quantum measurement operation instruction may carry a measurement identifier to identify the ID of the current measurement.
Correspondingly, the node identifier acted by the measurement instruction can be obtained, and the node identifier acted by the measurement instruction is determined to be the measurement identifier, for example, the vertex in [ angle, plane, domain_s, domain_t ], vertex ] is the node identifier of the measurement instruction, so that the accuracy of equivalent compiling can be improved.
Optionally, in the case that the instruction is a measurement instruction, after the instruction is equivalently compiled into a quantum measurement operation instruction in a quantum circuit based on the target identifier, the method further includes:
and updating the registering unit dictionary based on the target identifier, wherein the updated registering unit dictionary indicates that the registering unit corresponding to the target identifier is a registering unit which is not allocated to the node.
In this embodiment, when the instruction is a measurement instruction in the equivalent compilation of the instruction, after the equivalent compilation of the measurement instruction, the register unit denoted by idx in the register unit dictionary qreg may be recovered, that is, the value corresponding to the register unit denoted by idx is updated to None, and the register unit is indicated to be an idle unit, that is, a register unit not allocated to a node, for use by a subsequent instruction. Therefore, the width of the equivalent compiled dynamic quantum circuit can be ensured to be as small as possible, and the execution of the algorithm of the quantum circuit on hardware is facilitated.
The specific process of equivalent compiling is as follows:
input: instruction list commands (i.e., fourth instruction list) for the target measurement mode;
and (3) outputting: instruction list of dynamic quantum circuit (i.e. third instruction list).
Step 1: initializing an empty registering unit dictionary qreg for recording the allocation condition of the current registering unit; initializing an empty list cir_list for recording an instruction list of the converted quantum circuit;
step 2: cycling through an instruction list command of a target measurement mode, and recording the currently cycled element (instruction) as cmd; and executing the following operations according to the instruction type carried by the instruction:
Operation a) if cmd is a state preparation instruction, let cmd= [ N, vertex, matrix ]; taking qreg and vertex as inputs to obtain output idx and updated qreg; generating an instruction gate= [ reset, idx, matrix, none ] in the quantum circuit;
operation b) if cmd is an entangled instruction, setting cmd= [ E, [ vertex0, vertex1] ]; taking qreg and vertex0 as inputs to obtain output idx0 and updated qreg; taking qreg and vertex1 as inputs to obtain output idx1 and updated qreg; generating instructions gate= [ CZ, [ idx0, idx1], none ] in the quantum circuit;
operation c) if cmd is a measurement instruction, set cmd= [ M, vertex, angle, plane, domain_s, domain_t ]; taking qreg and vertex as inputs to obtain output idx and updated qreg; generating instructions gate= [ measure, idx, [ angle, plane, domain_s, domain_t, vertex ] in the quantum circuit; recovering a unit marked with idx in the register unit dictionary qreg, namely writing a corresponding value into None;
step 3: adding an instruction gate in the generated quantum circuit into the cir_list;
step 4: and returning the cir_list as an output result.
To facilitate understanding of the scheme in this embodiment, a specific example is given. Let a user want to perform a quantum algorithm as shown in figure 5 below, i.e. on quantum registers 0 and 1 two addition states +++ > = [ [1/≡2], [ 1/. V.2 ] ], then a CNOT gate is applied, and two qubits are subjected to X measurement. The instruction list representing the quantum algorithm is: [ [ reset,0, |+ >, none ]; [ reset,1, |+ >, none ]; [ CNOT, [0,1], none ]; [ measure,0, [0, 'XY', [ (j ],'m0' ]; [ measure,1, [0, 'XY', [ (] ] ],'m1' ] ]. The quantum algorithm requires the use of two qubits.
The brick measurement mode corresponding to the quantum algorithm is p= (calculation space S, input node I, output node O, calculation instruction C), and is shown in fig. 6. Wherein the computation space s= [ (0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4) ], the input node i= [ (0, 0), (1, 0) ], the output node o= [ (0, 4), (1, 4) ], the instruction list of the computation instruction C is: [ [ N, (0, 0), matrix00]; [ N, (0, 1), matrix01]; [ N, (0, 2), matrix02]; [ N, (0, 3), matrix03]; [ N, (0, 4), matrix04]; [ N, (1, 0), matrix10]; [ N, (1, 1), matrix11]; [ N, (1, 2), matrix12]; [ N, (1, 3), matrix13]; [ N, (1, 4), matrix14]; [ E, [ (0, 0), (0, 1) ] ]; [ E, [ (0, 1), (0, 2) ] ]; [ E, [ (0, 2), (0, 3) ] ]; [ E, [ (0, 3), (0, 4) ] ]; [ E, [ (0, 2), (1, 2) ] ]; [ E, [ (0, 4), (1, 4) ] ]; [ E, [ (1, 0), (1, 1) ] ]; [ E, [ (1, 1), (1, 2) ] ]; [ E, [ (1, 2), (1, 3) ] ]; [ E, [ (1, 3), (1, 4) ] ]; [ M, (0, 0), 0, 'XY', [ (] ] ]; [ M, (0, 1), 0, 'XY', [ (] ] ]; [ M, (0, 2), pi/2, 'XY', [ (], [ ] ] ]; [ M, (0, 3), 0, 'XY', [ (] ] ]; [ M, (0, 4), 0, 'XY', [ (] ] ]; [ M, (1, 0), 0, 'XY', [ (] ] ]; [ M, (1, 1), pi/2, 'XY', [ (], [ ] ] ]; [ M, (1, 2), 0, 'XY', [ (] ] ]; [ M, (1, 3), -pi/2, 'XY', [ (], [ ] ] ]; [ M, (1, 4), 0, 'XY', [ (] ] ] ] ].
I.e. the measurement mode requires 10 qubits. Wherein the state matrix in each state preparation instruction is determined by a blind quantum computing protocol.
After the blind quantum computing processing method of the embodiment performs equivalent compiling on the brick measurement mode, a corresponding dynamic quantum circuit is shown in fig. 7, wherein R represents reset, M represents measure, and x-Z represents CZ gate.
The instruction list is as follows: [ [ reset,0, matrix00, none ]; [ reset,1, matrix01, none ]; [ CZ, [0,1], none ]; [ measure,0, [0, 'XY', [ (] ], [ ], (0, 0) ]; [ reset,0, matrix10, none ]; [ reset,2, matrix11, none ]; [ CZ, [0,2], none ]; [ measure,0, [0, 'XY', [ (j ], (1, 0) ]; [ reset,0, matrix02, none ]; [ CZ, [1,0], none ]; [ measure,1, [0, 'XY', [ (] ], [ ], (0, 1) ]; [ reset,1, matrix12, none ]; [ CZ, [2,1], none ]; [ measure,2, [ pi/2, 'XY', [ (], [ ] ], (1, 1) ]; [ reset,2, matrix03, none ]; [ CZ, [0,2], none ]; [ CZ, [0,1], none ]; [ measure,0, [ pi/2, 'XY', [ (], [ ] ], (0, 2) ]; [ reset,0, matrix13, none ]; [ CZ, [1,0], none ]; [ measure,1, [0, 'XY', [ (j ], [ ], (1, 2) ]; [ reset,1, matrix04, none ]; [ CZ, [2,1], none ]; [ measure,2, [0, 'XY', [ (] ], [ ], (0, 3) ]; [ reset,2, matrix14, none ]; [ CZ, [0,2], none ]; [ measure,0, [ -pi/2, 'XY', [ (], [ ] ], (1, 3) ]; [ CZ, [1,2], none ]; [ measure,1, [0, 'XY', [ (] ], [ ], (0, 4) ]; [ measure,2, [0, 'XY', [ (] ], [ ], (1, 4) ] ].
Namely, the dynamic quantum circuit only needs 3 quantum bits, so that the number of the quantum bits needed by the blind quantum computing service can be approximately optimal.
Second embodiment
As shown in fig. 8, the present disclosure provides a blind quantum computing processing apparatus 800 comprising:
a first obtaining module 801, configured to obtain a first instruction list of a target measurement mode, where the first instruction list includes measurement instructions, and the target measurement mode is a measurement mode of a unidirectional quantum computer model related to a blind quantum computing protocol;
a reordering module 802, configured to reorder the measurement instructions in the first instruction list according to a priority order rule, to obtain a second instruction list of the target measurement mode, where the priority order rule indicates that the measurement instructions of the target measurement mode are ordered according to a sequence of node ranks from small to large, in the second instruction list, for a same node rank indicated by the measurement instructions, a node rank indicated by the measurement instruction ordered before is smaller than a node rank indicated by the measurement instruction ordered after, and for a same node rank indicated by the measurement instructions, a node rank indicated by the measurement instruction ordered before is smaller than a node rank indicated by the measurement instruction ordered after;
And the equivalent compiling module 803 is configured to perform equivalent compiling on the target measurement mode based on the second instruction list, so as to obtain a third instruction list of the quantum circuit equivalent to the target measurement mode.
Optionally, the reordering module 802 is specifically configured to:
splitting the first instruction list to obtain a first list, wherein the first list is a list formed by measurement instructions in the first instruction list;
the labels of all nodes in the calculation space of the target measurement mode are ordered according to the sequence priority principle to obtain an ordered list, wherein the labels comprise row labels and column labels, in the ordered list, for the same label column label, the label row label ordered before is smaller than the label row label ordered after, and for the same label row label, the label column label ordered before is smaller than the label column label ordered after;
rearranging the measurement instructions according to the first list and the ordered list to obtain a second list;
the second instruction list is determined based on the second list.
Optionally, the second instruction list further includes a state preparation instruction and an entanglement instruction, and the equivalent compiling module 803 includes:
The deferral processing sub-module is configured to defer the state preparation instruction and the entangled instruction in the target measurement mode based on the second instruction list to obtain a fourth instruction list of the target measurement mode, wherein the relative position sequence of each measurement instruction in the second instruction list and the fourth instruction list is kept unchanged, the relative position sequence of different instructions on the same node of the target measurement mode is unchanged, and the relative position sequence of the different instructions is: preparing instructions, entanglement instructions and measurement instructions from front to back;
and the equivalent compiling sub-module is used for carrying out equivalent compiling of the instructions based on the fourth instruction list to obtain the third instruction list.
Optionally, the deferral processing submodule includes:
the splitting unit is used for splitting the second instruction list to obtain a third list, a fourth list and a fifth list, wherein the third list is a list formed by state preparation instructions in the second instruction list, the fourth list is a list formed by entangled instructions in the second instruction list, and the fifth list is a list formed by measurement instructions in the second instruction list;
The first deferral processing unit is used for deferring the entangled instruction in the target measurement mode based on the fourth list and the fifth list to obtain a sixth list, wherein the sixth list comprises entangled instructions in the fourth list and measurement instructions in the fifth list, and in the sixth list, different instructions on the same node of the target measurement mode keep the relative position sequence of the entangled instructions and the measurement instructions from front to back;
and the second deferral processing unit is used for deferring the state preparation instruction in the target measurement mode based on the third list and the sixth list to obtain the fourth instruction list.
Optionally, the first deferral processing unit is specifically configured to:
traversing the fourth list aiming at the entanglement instruction, and recording the entanglement instruction of the current traversal;
traversing the fifth list aiming at the measurement instruction to obtain a target measurement instruction, wherein the node acted by the entanglement instruction of the current traversal comprises the node acted by the target measurement instruction;
inserting the currently traversed entanglement instruction into a first position in the fifth list, wherein the first position is the position of the target measurement instruction in the fifth list;
And determining the updated fifth list as the sixth list when the fourth list traversing is completed.
Optionally, the second deferral processing unit is specifically configured to:
traversing the third list aiming at the state preparation instruction, and recording the state preparation instruction of the current traversal;
traversing the sixth list aiming at the entangled instruction to obtain a target entangled instruction, wherein the node acted by the target entangled instruction comprises the node acted by the currently traversed state preparation instruction;
inserting the currently traversed state preparation instruction into a second position in the sixth list, wherein the second position is the position of the target entanglement instruction in the sixth list;
and determining the updated sixth list as the fourth instruction list under the condition that the third list traversal is completed.
Optionally, the equivalent compiling submodule includes:
the acquisition unit is used for acquiring a target node acted by each instruction in the fourth instruction list;
the determining unit is used for determining a target identifier of a registering unit of the quantum circuit distributed for the target node based on the target node and a registering unit dictionary, wherein the registering unit dictionary comprises a corresponding relation between the registering unit and the node in the target measurement mode;
And the equivalent compiling unit is used for carrying out equivalent compiling on the instruction based on the target identifier to obtain an instruction in the quantum circuit equivalent to the instruction, and the third instruction list comprises the instruction in the quantum circuit obtained by equivalent compiling.
Optionally, the determining unit includes:
a first determining subunit, configured to determine, when it is queried that the register unit dictionary includes a correspondence relationship between the target nodes, an identifier of a register unit corresponding to the target node as the target identifier;
and the second determining subunit is used for allocating a register unit to the target node based on the register unit dictionary under the condition that the corresponding relation of the target node is not included in the register unit dictionary, determining the identification of the register unit allocated to the target node as the target identification, and updating the register unit dictionary based on the identification of the register unit allocated to the target node.
Optionally, the second determining subunit is specifically configured to:
under the condition that the registering unit dictionary comprises the identification of a first registering unit, the first registering unit is allocated to the target node, and the first registering unit is not allocated to the node;
And under the condition that the register unit dictionary does not comprise the identification of the first register unit, acquiring the number of the register units represented by the register unit dictionary, determining the identification of the created second register unit based on the number, and distributing the second register unit to the target node.
Optionally, the first register unit is the smallest identified register unit among the register units not allocated to the node.
Optionally, the equivalent compiling unit is specifically configured to:
under the condition that the instruction is a state preparation instruction, based on the target identifier, equivalently compiling the instruction into a reset operation instruction in a quantum circuit, wherein the reset operation instruction is used for resetting the quantum state of a register unit corresponding to the target identifier into the quantum state indicated by the state preparation instruction;
under the condition that the instruction is an entanglement instruction, based on the target identifier, equivalently compiling the instruction into a quantum gate operation instruction in a quantum circuit, wherein the quantum gate operation instruction is used for carrying out quantum gate operation corresponding to the entanglement instruction based on a register unit corresponding to the target identifier;
and under the condition that the instruction is a measurement instruction, based on the target identifier, equivalently compiling the instruction into a quantum measurement operation instruction in a quantum circuit, wherein the quantum measurement operation instruction is used for carrying out quantum measurement operation indicated by the measurement instruction based on a register unit corresponding to the target identifier.
Optionally, in the case that the instruction is a measurement instruction, the quantum measurement operation instruction includes a measurement identifier, where the measurement identifier is a node identifier acted on by the measurement instruction.
Optionally, in the case that the instruction is a measurement instruction, the apparatus further includes:
and the updating module is used for updating the registering unit dictionary based on the target identifier, and the updated registering unit dictionary indicates that the registering unit corresponding to the target identifier is a registering unit which is not allocated to the node.
The blind quantum computing processing device 800 provided in the present disclosure can implement each process implemented by the blind quantum computing processing method embodiment, and can achieve the same beneficial effects, so that repetition is avoided, and no description is repeated here.
In the technical scheme of the disclosure, the related processes of collecting, storing, using, processing, transmitting, providing, disclosing and the like of the personal information of the user accord with the regulations of related laws and regulations, and the public order colloquial is not violated.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
FIG. 9 illustrates a schematic block diagram of an example electronic device that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 9, the apparatus 900 includes a computing unit 901 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 902 or a computer program loaded from a storage unit 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other by a bus 904. An input/output (I/O) interface 905 is also connected to the bus 904.
Various components in device 900 are connected to I/O interface 905, including: an input unit 906 such as a keyboard, a mouse, or the like; an output unit 907 such as various types of displays, speakers, and the like; a storage unit 908 such as a magnetic disk, an optical disk, or the like; and a communication unit 909 such as a network card, modem, wireless communication transceiver, or the like. The communication unit 909 allows the device 900 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunications networks.
The computing unit 901 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 901 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the respective methods and processes described above, such as a blind quantum computing processing method. For example, in some embodiments, the blind quantum computing processing method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 900 via the ROM 902 and/or the communication unit 909. When the computer program is loaded into RAM 903 and executed by the computing unit 901, one or more steps of the blind quantum computing processing method described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the blind quantum computing processing method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel, sequentially, or in a different order, provided that the desired results of the disclosed aspects are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (29)

1. A blind quantum computing processing method, comprising:
obtaining a first instruction list of a target measurement mode, wherein the first instruction list comprises measurement instructions, and the target measurement mode is a measurement mode of a unidirectional quantum computer model related to a blind quantum computing protocol;
the measurement instructions in the first instruction list are reordered according to a sequence priority principle, a second instruction list of the target measurement mode is obtained, the sequence priority principle indicates that the measurement instructions of the target measurement mode are ordered according to the sequence of node ranks from small to large, in the second instruction list, for the same node rank indicated by the measurement instructions, the node rank indicated by the measurement instruction ranked ahead is smaller than the node rank indicated by the measurement instruction ranked behind, and for the same node rank indicated by the measurement instructions, the node rank indicated by the measurement instruction ranked ahead is smaller than the node rank indicated by the measurement instruction ranked behind;
And based on the second instruction list, performing equivalent compiling on the target measurement mode to obtain a third instruction list of the quantum circuit equivalent to the target measurement mode.
2. The method of claim 1, wherein the reordering the measurement instructions in the first instruction list according to a priority of sequence to obtain the second instruction list of the target measurement mode comprises:
splitting the first instruction list to obtain a first list, wherein the first list is a list formed by measurement instructions in the first instruction list;
the labels of all nodes in the calculation space of the target measurement mode are ordered according to the sequence priority principle to obtain an ordered list, wherein the labels comprise row labels and column labels, in the ordered list, for the same label column label, the label row label ordered before is smaller than the label row label ordered after, and for the same label row label, the label column label ordered before is smaller than the label column label ordered after;
rearranging the measurement instructions according to the first list and the ordered list to obtain a second list;
the second instruction list is determined based on the second list.
3. The method of claim 1, wherein the second instruction list further includes a state preparation instruction and an entanglement instruction, and the equivalently compiling the target measurement mode based on the second instruction list, to obtain a third instruction list of a quantum circuit equivalent to the target measurement mode, includes:
based on the second instruction list, deferring the state preparation instruction and the entanglement instruction in the target measurement mode to obtain a fourth instruction list of the target measurement mode, wherein the relative position sequence of each measurement instruction in the second instruction list and the fourth instruction list is kept unchanged, the relative position sequence of different instructions on the same node of the target measurement mode is unchanged, and the relative position sequence of the different instructions is as follows: preparing instructions, entanglement instructions and measurement instructions from front to back;
and carrying out equivalent compiling of the instructions based on the fourth instruction list to obtain the third instruction list.
4. A method according to claim 3, wherein said deferring state preparation instructions and entanglement instructions in said target measurement mode based on said second instruction list, resulting in a fourth instruction list of said target measurement mode, comprises:
Splitting the second instruction list to obtain a third list, a fourth list and a fifth list, wherein the third list is a list formed by state preparation instructions in the second instruction list, the fourth list is a list formed by entanglement instructions in the second instruction list, and the fifth list is a list formed by measurement instructions in the second instruction list;
deferring the entangled instruction in the target measurement mode based on the fourth list and the fifth list to obtain a sixth list, wherein the sixth list comprises entangled instructions in the fourth list and measurement instructions in the fifth list, and in the sixth list, different instructions on the same node of the target measurement mode keep relative position sequences of the entangled instructions and the measurement instructions from front to back;
and carrying out deferral processing on the state preparation instruction in the target measurement mode based on the third list and the sixth list to obtain the fourth instruction list.
5. The method of claim 4, wherein deferring the entangled instruction in the target measurement mode based on the fourth list and the fifth list to obtain a sixth list, comprising:
Traversing the fourth list aiming at the entanglement instruction, and recording the entanglement instruction of the current traversal;
traversing the fifth list aiming at the measurement instruction to obtain a target measurement instruction, wherein the node acted by the entanglement instruction of the current traversal comprises the node acted by the target measurement instruction;
inserting the currently traversed entanglement instruction into a first position in the fifth list, wherein the first position is the position of the target measurement instruction in the fifth list;
and determining the updated fifth list as the sixth list when the fourth list traversing is completed.
6. The method of claim 4, wherein deferring a state preparation instruction in the target measurement mode based on the third list and the sixth list to obtain the fourth instruction list, comprising:
traversing the third list aiming at the state preparation instruction, and recording the state preparation instruction of the current traversal;
traversing the sixth list aiming at the entangled instruction to obtain a target entangled instruction, wherein the node acted by the target entangled instruction comprises the node acted by the currently traversed state preparation instruction;
Inserting the currently traversed state preparation instruction into a second position in the sixth list, wherein the second position is the position of the target entanglement instruction in the sixth list;
and determining the updated sixth list as the fourth instruction list under the condition that the third list traversal is completed.
7. A method according to claim 3, wherein said performing an equivalent compilation of instructions based on said fourth instruction list, resulting in said third instruction list, comprises:
for each instruction in the fourth instruction list, performing the following operations:
obtaining a target node acted by the instruction;
determining a target identifier of a register unit of the quantum circuit allocated for the target node based on the target node and a register unit dictionary, wherein the register unit dictionary comprises a corresponding relation between the register unit and the node in the target measurement mode;
based on the target identification, carrying out equivalent compiling on the instruction to obtain an instruction in a quantum circuit equivalent to the instruction;
the third instruction list comprises instructions in the quantum circuit obtained through equivalent compiling.
8. The method of claim 7, wherein the determining, based on the target node and a register unit dictionary, a target identification of a register unit of a quantum circuit allocated for the target node comprises at least one of:
Under the condition that the corresponding relation of the target node is included in the register unit dictionary, determining the identification of the register unit corresponding to the target node as the target identification;
and under the condition that the corresponding relation of the target node is not included in the register unit dictionary, distributing the register unit to the target node based on the register unit dictionary, determining the identification of the register unit distributed to the target node as the target identification, and updating the register unit dictionary based on the identification of the register unit distributed to the target node.
9. The method of claim 8, wherein the allocating a register unit for the target node based on the register unit dictionary comprises at least one of:
under the condition that the registering unit dictionary comprises the identification of a first registering unit, the first registering unit is allocated to the target node, and the first registering unit is not allocated to the node;
and under the condition that the register unit dictionary does not comprise the identification of the first register unit, acquiring the number of the register units represented by the register unit dictionary, determining the identification of the created second register unit based on the number, and distributing the second register unit to the target node.
10. The method of claim 9, wherein the first register unit is a least-identified register unit of the register units not allocated to the node.
11. The method of claim 7, wherein the equivalently compiling the instruction based on the target identifier to obtain an instruction in a quantum circuit equivalent to the instruction comprises at least one of:
under the condition that the instruction is a state preparation instruction, based on the target identifier, equivalently compiling the instruction into a reset operation instruction in a quantum circuit, wherein the reset operation instruction is used for resetting the quantum state of a register unit corresponding to the target identifier into the quantum state indicated by the state preparation instruction;
under the condition that the instruction is an entanglement instruction, based on the target identifier, equivalently compiling the instruction into a quantum gate operation instruction in a quantum circuit, wherein the quantum gate operation instruction is used for carrying out quantum gate operation corresponding to the entanglement instruction based on a register unit corresponding to the target identifier;
and under the condition that the instruction is a measurement instruction, based on the target identifier, equivalently compiling the instruction into a quantum measurement operation instruction in a quantum circuit, wherein the quantum measurement operation instruction is used for carrying out quantum measurement operation indicated by the measurement instruction based on a register unit corresponding to the target identifier.
12. The method of claim 11, wherein, in the event that the instruction is a measurement instruction, the quantum measurement operation instruction includes a measurement identity that is a node identity acted upon by the measurement instruction.
13. The method of claim 11, wherein, in the case where the instruction is a measurement instruction, after the equivalent compilation of the instruction into a quantum measurement operation instruction in a quantum circuit based on the target identification, the method further comprises:
and updating the registering unit dictionary based on the target identifier, wherein the updated registering unit dictionary indicates that the registering unit corresponding to the target identifier is a registering unit which is not allocated to the node.
14. A blind quantum computing processing device, comprising:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring a first instruction list of a target measurement mode, the first instruction list comprises measurement instructions, and the target measurement mode is a measurement mode of a unidirectional quantum computer model related to a blind quantum computing protocol;
the reordering module is used for reordering the measurement instructions in the first instruction list according to a sequence priority principle to obtain a second instruction list of the target measurement mode, the sequence priority principle indicates that the measurement instructions of the target measurement mode are ordered according to the sequence of node ranks from small to large, in the second instruction list, for the same node rank indicated by the measurement instructions, the node rank indicated by the measurement instruction ordered in front is smaller than the node rank indicated by the measurement instruction ordered in rear, and for the same node rank indicated by the measurement instructions, the node rank indicated by the measurement instruction ordered in front is smaller than the node rank indicated by the measurement instruction ordered in rear;
And the equivalent compiling module is used for carrying out equivalent compiling on the target measurement mode based on the second instruction list to obtain a third instruction list of the quantum circuit equivalent to the target measurement mode.
15. The apparatus of claim 14, wherein the reordering module is specifically configured to:
splitting the first instruction list to obtain a first list, wherein the first list is a list formed by measurement instructions in the first instruction list;
the labels of all nodes in the calculation space of the target measurement mode are ordered according to the sequence priority principle to obtain an ordered list, wherein the labels comprise row labels and column labels, in the ordered list, for the same label column label, the label row label ordered before is smaller than the label row label ordered after, and for the same label row label, the label column label ordered before is smaller than the label column label ordered after;
rearranging the measurement instructions according to the first list and the ordered list to obtain a second list;
the second instruction list is determined based on the second list.
16. The apparatus of claim 14, wherein the second instruction list further comprises a state preparation instruction and an entanglement instruction, the equivalent compilation module comprising:
The deferral processing sub-module is configured to defer the state preparation instruction and the entangled instruction in the target measurement mode based on the second instruction list to obtain a fourth instruction list of the target measurement mode, wherein the relative position sequence of each measurement instruction in the second instruction list and the fourth instruction list is kept unchanged, the relative position sequence of different instructions on the same node of the target measurement mode is unchanged, and the relative position sequence of the different instructions is: preparing instructions, entanglement instructions and measurement instructions from front to back;
and the equivalent compiling sub-module is used for carrying out equivalent compiling of the instructions based on the fourth instruction list to obtain the third instruction list.
17. The apparatus of claim 16, wherein the deferral processing submodule comprises:
the splitting unit is used for splitting the second instruction list to obtain a third list, a fourth list and a fifth list, wherein the third list is a list formed by state preparation instructions in the second instruction list, the fourth list is a list formed by entangled instructions in the second instruction list, and the fifth list is a list formed by measurement instructions in the second instruction list;
The first deferral processing unit is used for deferring the entangled instruction in the target measurement mode based on the fourth list and the fifth list to obtain a sixth list, wherein the sixth list comprises entangled instructions in the fourth list and measurement instructions in the fifth list, and in the sixth list, different instructions on the same node of the target measurement mode keep the relative position sequence of the entangled instructions and the measurement instructions from front to back;
and the second deferral processing unit is used for deferring the state preparation instruction in the target measurement mode based on the third list and the sixth list to obtain the fourth instruction list.
18. The apparatus of claim 17, wherein the first deferral processing unit is configured to:
traversing the fourth list aiming at the entanglement instruction, and recording the entanglement instruction of the current traversal;
traversing the fifth list aiming at the measurement instruction to obtain a target measurement instruction, wherein the node acted by the entanglement instruction of the current traversal comprises the node acted by the target measurement instruction;
inserting the currently traversed entanglement instruction into a first position in the fifth list, wherein the first position is the position of the target measurement instruction in the fifth list;
And determining the updated fifth list as the sixth list when the fourth list traversing is completed.
19. The apparatus of claim 17, wherein the second deferral processing unit is specifically configured to:
traversing the third list aiming at the state preparation instruction, and recording the state preparation instruction of the current traversal;
traversing the sixth list aiming at the entangled instruction to obtain a target entangled instruction, wherein the node acted by the target entangled instruction comprises the node acted by the currently traversed state preparation instruction;
inserting the currently traversed state preparation instruction into a second position in the sixth list, wherein the second position is the position of the target entanglement instruction in the sixth list;
and determining the updated sixth list as the fourth instruction list under the condition that the third list traversal is completed.
20. The apparatus of claim 16, wherein the equivalent compiling sub-module comprises:
the acquisition unit is used for acquiring a target node acted by each instruction in the fourth instruction list;
the determining unit is used for determining a target identifier of a registering unit of the quantum circuit distributed for the target node based on the target node and a registering unit dictionary, wherein the registering unit dictionary comprises a corresponding relation between the registering unit and the node in the target measurement mode;
And the equivalent compiling unit is used for carrying out equivalent compiling on the instruction based on the target identifier to obtain an instruction in the quantum circuit equivalent to the instruction, and the third instruction list comprises the instruction in the quantum circuit obtained by equivalent compiling.
21. The apparatus of claim 20, wherein the determining unit comprises:
a first determining subunit, configured to determine, when it is queried that the register unit dictionary includes a correspondence relationship between the target nodes, an identifier of a register unit corresponding to the target node as the target identifier;
and the second determining subunit is used for allocating a register unit to the target node based on the register unit dictionary under the condition that the corresponding relation of the target node is not included in the register unit dictionary, determining the identification of the register unit allocated to the target node as the target identification, and updating the register unit dictionary based on the identification of the register unit allocated to the target node.
22. The apparatus of claim 21, wherein the second determining subunit is specifically configured to:
under the condition that the registering unit dictionary comprises the identification of a first registering unit, the first registering unit is allocated to the target node, and the first registering unit is not allocated to the node;
And under the condition that the register unit dictionary does not comprise the identification of the first register unit, acquiring the number of the register units represented by the register unit dictionary, determining the identification of the created second register unit based on the number, and distributing the second register unit to the target node.
23. The apparatus of claim 22, wherein the first register unit is a least-identified register unit of the register units not allocated to the node.
24. The apparatus of claim 20, wherein the equivalent compiling unit is specifically configured to:
under the condition that the instruction is a state preparation instruction, based on the target identifier, equivalently compiling the instruction into a reset operation instruction in a quantum circuit, wherein the reset operation instruction is used for resetting the quantum state of a register unit corresponding to the target identifier into the quantum state indicated by the state preparation instruction;
under the condition that the instruction is an entanglement instruction, based on the target identifier, equivalently compiling the instruction into a quantum gate operation instruction in a quantum circuit, wherein the quantum gate operation instruction is used for carrying out quantum gate operation corresponding to the entanglement instruction based on a register unit corresponding to the target identifier;
And under the condition that the instruction is a measurement instruction, based on the target identifier, equivalently compiling the instruction into a quantum measurement operation instruction in a quantum circuit, wherein the quantum measurement operation instruction is used for carrying out quantum measurement operation indicated by the measurement instruction based on a register unit corresponding to the target identifier.
25. The apparatus of claim 24, wherein, where the instruction is a measurement instruction, the quantum measurement operation instruction includes a measurement identity that is a node identity acted upon by the measurement instruction.
26. The apparatus of claim 24, wherein, in the event that the instruction is a measurement instruction, the apparatus further comprises:
and the updating module is used for updating the registering unit dictionary based on the target identifier, and the updated registering unit dictionary indicates that the registering unit corresponding to the target identifier is a registering unit which is not allocated to the node.
27. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-13.
28. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-13.
29. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-13.
CN202310185005.5A 2023-02-20 2023-02-20 Blind quantum computing processing method and device and electronic equipment Active CN116187464B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310185005.5A CN116187464B (en) 2023-02-20 2023-02-20 Blind quantum computing processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310185005.5A CN116187464B (en) 2023-02-20 2023-02-20 Blind quantum computing processing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN116187464A true CN116187464A (en) 2023-05-30
CN116187464B CN116187464B (en) 2023-11-14

Family

ID=86446070

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310185005.5A Active CN116187464B (en) 2023-02-20 2023-02-20 Blind quantum computing processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN116187464B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111656375A (en) * 2017-11-30 2020-09-11 1Qb信息技术公司 Method and system for quantum computation enabled molecular de novo computation simulation using quantum classical computation hardware
CN113723613A (en) * 2021-08-31 2021-11-30 北京百度网讯科技有限公司 Method and device for simulating quantum circuit
CN113723612A (en) * 2021-08-31 2021-11-30 北京百度网讯科技有限公司 Method and apparatus for operating a quantum system of a one-way quantum computer computing model
US20210374307A1 (en) * 2020-05-28 2021-12-02 Microsoft Technology Licensing, Llc Separable-state simulation of quantum program code
CN114881237A (en) * 2022-03-29 2022-08-09 北京百度网讯科技有限公司 Quantum calculation processing method and device and electronic equipment
CN115169570A (en) * 2022-07-26 2022-10-11 北京百度网讯科技有限公司 Quantum network protocol simulation method and device and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111656375A (en) * 2017-11-30 2020-09-11 1Qb信息技术公司 Method and system for quantum computation enabled molecular de novo computation simulation using quantum classical computation hardware
US20210374307A1 (en) * 2020-05-28 2021-12-02 Microsoft Technology Licensing, Llc Separable-state simulation of quantum program code
CN113723613A (en) * 2021-08-31 2021-11-30 北京百度网讯科技有限公司 Method and device for simulating quantum circuit
CN113723612A (en) * 2021-08-31 2021-11-30 北京百度网讯科技有限公司 Method and apparatus for operating a quantum system of a one-way quantum computer computing model
CN114881237A (en) * 2022-03-29 2022-08-09 北京百度网讯科技有限公司 Quantum calculation processing method and device and electronic equipment
CN115169570A (en) * 2022-07-26 2022-10-11 北京百度网讯科技有限公司 Quantum network protocol simulation method and device and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王帮海;徐海茹;: "盲量子计算研究进展", 广东工业大学学报, no. 03, pages 51 - 55 *

Also Published As

Publication number Publication date
CN116187464B (en) 2023-11-14

Similar Documents

Publication Publication Date Title
CN114881237B (en) Quantum computing processing method and device and electronic equipment
CN115169570B (en) Quantum network protocol simulation method and device and electronic equipment
CN113155141A (en) Map generation method and device, electronic equipment and storage medium
CN113537502B (en) Quantum circuit processing method and device, electronic device and storage medium
CN112559007A (en) Parameter updating method and device of multitask model and electronic equipment
CN114970865B (en) Quantum circuit processing method and device on quantum chip and electronic equipment
CN106202224B (en) Search processing method and device
CN114840322A (en) Task scheduling method and device, electronic equipment and storage
CN116167445B (en) Quantum measurement mode processing method and device and electronic equipment
CN116151384B (en) Quantum circuit processing method and device and electronic equipment
CN116611527B (en) Quantum circuit processing method and device and electronic equipment
CN116167446B (en) Quantum computing processing method and device and electronic equipment
CN116151381B (en) Quantum circuit processing method and device and electronic equipment
CN116187464B (en) Blind quantum computing processing method and device and electronic equipment
CN116974249A (en) Flexible job shop scheduling method and flexible job shop scheduling device
CN116187463B (en) Quantum measurement mode-to-quantum circuit compiling method and device and electronic equipment
KR20230132369A (en) Reducing resources in quantum circuits
CN110502975A (en) A kind of batch processing system that pedestrian identifies again
CN116167447B (en) Quantum circuit processing method and device and electronic equipment
CN113408304B (en) Text translation method and device, electronic equipment and storage medium
CN116187458B (en) Quantum circuit processing method and device and electronic equipment
CN117391206A (en) Quantum circuit processing method and device and electronic equipment
CN116151383B (en) Quantum computing processing method and device and electronic equipment
CN112580803B (en) Model acquisition method, apparatus, electronic device, storage medium, and program product
CN114036313B (en) Ethnic group display method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40088347

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant