CN111461336B - MPI multi-process-based noise-containing double-quantum logic gate implementation method and device - Google Patents

MPI multi-process-based noise-containing double-quantum logic gate implementation method and device Download PDF

Info

Publication number
CN111461336B
CN111461336B CN202010263599.3A CN202010263599A CN111461336B CN 111461336 B CN111461336 B CN 111461336B CN 202010263599 A CN202010263599 A CN 202010263599A CN 111461336 B CN111461336 B CN 111461336B
Authority
CN
China
Prior art keywords
quantum
logic gate
double
state
noise
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.)
Active
Application number
CN202010263599.3A
Other languages
Chinese (zh)
Other versions
CN111461336A (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.)
Benyuan Quantum Computing Technology Hefei Co ltd
Original Assignee
Benyuan Quantum Computing Technology Hefei 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 Benyuan Quantum Computing Technology Hefei Co ltd filed Critical Benyuan Quantum Computing Technology Hefei Co ltd
Priority to CN202010263599.3A priority Critical patent/CN111461336B/en
Publication of CN111461336A publication Critical patent/CN111461336A/en
Application granted granted Critical
Publication of CN111461336B publication Critical patent/CN111461336B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Condensed Matter Physics & Semiconductors (AREA)
  • Computational Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Optical Modulation, Optical Deflection, Nonlinear Optics, Optical Demodulation, Optical Logic Elements (AREA)
  • Logic Circuits (AREA)

Abstract

The invention belongs to the field of quantum computation, and particularly discloses a method and a device for realizing a noise-containing double-quantum logic gate based on MPI (multi-process interface), wherein the method comprises the following steps: configuring N qubits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M In the processes, the number of each quantum bit is bit n, and the value of a first quantum state in a first process is set to be 1; setting a designated noise model for the double quantum logic gate; determining the double quantum logic gate noise operators to be executed by calculating the probabilities of the corresponding double quantum logic gate noise operators in the appointed noise model; and obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out the transformation operation of the quantum state by the process according to the transformation matrix. The invention can improve the computing capacity and the computing efficiency of the noise-containing double-quantum logic gate.

Description

MPI multi-process-based noise-containing double-quantum logic gate implementation method and device
Technical Field
The invention belongs to the field of quantum computation, and particularly relates to a method and a device for realizing a noise-containing double-quantum logic gate based on MPI multiprocessing.
Background
Quantum computation is achieved by changing the logic state of a qubit by acting on the qubit through a quantum logic gate, wherein the logic state of the qubit may be an superposition of the |0> state, the |1> state, the |0> state and the |1> state, and the superposition causes the computation amount of the quantum computation to increase exponentially with the increase of the qubit.
At present, in a real quantum computer, due to the physical characteristics of a quantum bit, unavoidable design errors often exist, and in order to better simulate the errors in a quantum virtual machine, a noise-containing double-quantum logic gate is required.
Under the prior art, the noise-containing double-quantum logic gate is based on one process, the memory of the single process is limited, and the computing capacity and the computing efficiency of the double-quantum logic gate are greatly reduced along with the increase of the number of the quantum bits, so that more quantum bits cannot be simulated.
Based on this, it is necessary to implement a method for implementing a multi-process noisy double quantum logic gate.
Disclosure of Invention
The invention aims to provide a method and a device for realizing a noise-containing double-quantum logic gate based on MPI multi-process, which are used for solving the defects in the prior art and improving the computing capacity and the computing efficiency of quantum computation based on the double-quantum logic gate.
One embodiment of the application provides a method for realizing a noise-containing double-quantum logic gate based on MPI multiprocessing, which comprises the following steps:
configuring N qubits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M In the processes, the number of each quantum bit is bit n, and the value of a first quantum state in a first process is set to be 1; wherein: n, M is a positive integer, N is more than or equal to 0 and less than or equal to N-1, M is more than or equal to 1, and N is more than or equal to M+2;
setting a designated noise model for the double quantum logic gate;
determining the double quantum logic gate noise operators to be executed by calculating the probabilities of the corresponding double quantum logic gate noise operators in the appointed noise model;
and obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out the transformation operation of the quantum state by the process according to the transformation matrix.
The method for implementing the noise-containing double-quantum logic gate based on the MPI multiprocess preferably includes the steps of calculating probabilities that each double-quantum logic gate noise operator in the specified noise model corresponds to each other, and determining the double-quantum logic gate noise operator to be executed, wherein the method includes:
Determining the progress distribution of each pairing quantum state;
according to the noise operators in the appointed noise model, calculating each double-quantum logic gate noise operator through a first preset rule;
for each double-quantum logic gate noise operator, respectively calculating quantum states of paired quantum states in the process after the double-quantum logic gate noise operators are operated;
calculating the probability of the quantum state operated by the double-quantum logic gate noise operator, wherein the probability is the square sum of the real part and the imaginary part of the quantum state operated by the double-quantum logic gate noise operator;
reducing probability distribution corresponding to each process to a root node; the probability distribution corresponding to each process is { p1, p1+p2, }, p1 is the probability corresponding to the first two-quantum logic gate noise operator in the process, and p2 is the probability corresponding to the second two-quantum logic gate noise operator; the probability corresponding to the noise operator of the double quantum logic gate is as follows: the sum of the probabilities of quantum states after the operation of the double quantum logic gate noise operator in the process;
and comparing the random number with the reduced probability distribution according to the random number acquired by the root node, and determining a double-quantum logic gate noise operator to be executed.
The method for implementing the noise-containing double-quantum logic gate based on the MPI multi-process preferably includes the steps of:
comparing the control bit n1 of the double quantum logic gate with the bit value of the target bit n 2;
if N1 is greater than N2 and N1 is less than N-M, determining that the paired quantum states are distributed in the same process; if the initial quantum state index paired in the same process is i, the quantum state index paired in the same process is { i, i+2 }, respectively n2 ,i+2 n1 ,i+2 n1 +2 n2 0.ltoreq.i.ltoreq.2 M -2 n1 -2 n2 -1;
If N-M is smaller than or equal to N1 and larger than N2, determining two matched associated processes, wherein the matched quantum states are distributed in the two associated processes;
if N1 is greater than N2 and N2 is greater than or equal to N-M, four associated processes of the pairing are determined, wherein the quantum states of the pairing are distributed among the four associated processes.
A method for implementing a noise-containing two-quantum logic gate based on MPI multiprocessing as described above, wherein preferably the determining two associated processes of a pairing comprises:
determining the current process number S1 and the process number offset Q 1 =2 n1-(N-M)
According to the current process number S1 and the process number offset Q 1 Determining an intermediate value l=s1&Q 1
If L > 0, the process number S2 paired with the current process number is S1-Q 1
If l=0, the process number S2 paired with the current process number is s1+q 1
A method for implementing a noise-containing two-quantum logic gate based on MPI multiprocessing as described above, wherein preferably the paired quantum states are distributed between the two associated processes, comprising:
the paired quantum states are uniformly distributed in two paired processes, and the subscript offset of the paired quantum states in one process is Q 2 =2 n2
A method for implementing a noise-containing two-quantum logic gate based on MPI multiprocessing as described above, wherein preferably, the determining four associated processes of a pairing includes:
determining a process number as T1;
calculation of T1&2 n2-(N-M) And T1&2 n1-(N-M) Is a value of (2);
if T1&2 n2-(N-M) And T1&2 n1-(N-M) If the values of (2) are greater than 0, the other three process numbers T2, T3, T4 associated with said process number T1 are respectively determined as t2=t1-2 n1-(N-M) -2 n2-(N-M) ,T3=T1-2 n1-(N-M) ,T4=T1-2 n2 -(N-M)
If T1&2 n2-(N-M) Has a value of 0 and T1&2 n1-(N-M) If the value of (1) is greater than 0, the other three process numbers T2, T3, T4 associated with said process number T1 are respectively determined as t2=t1-2 n1-(N-M) ,T3=T1-2 n1-(N-M) +2 n2-(N-M) ,T4=T1+2 n2-(N-M)
If T1&2 n2-(N-M) Is greater than 0 and T1 &2 n1-(N-M) If the value of (1) is equal to 0, the other three process numbers T2, T3, T4 associated with said process number T1 are respectively determined as t2=t1-2 n2-(N-M) ,T3=T1-2 n2-(N-M) +2 n1-(N-M) ,T4=T1+2 n1-(N-M)
If T1&2 n2-(N-M) And T1&2 n1-(N-M) If the value of (2) is equal to 0, the other three process numbers T2, T3, T4 associated with the process number T1 are respectively determined as t2=t1+2 n2-(N-M) ,T3=T1+2 n1-(N-M) ,T4=T1+2 n2-(N-M) +2 n1 -(N-M)
The method for implementing the noise-containing double-quantum logic gate based on MPI multi-process as described above, wherein preferably, the paired quantum states are distributed in the four associated processes, including:
the process numbers T1, T2, T3, and T4 pair with each other and the quantum state subscript is the same in the four associated processes.
The method for implementing the noise-containing double-quantum logic gate based on MPI multiprocessing as described above, wherein preferably, the obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate includes:
broadcasting the noise operator or the operator index of the double quantum logic gate to be executed to all processes;
and performing matrix multiplication operation on the unitary matrix corresponding to the double-quantum logic gate and the matrix corresponding to the double-quantum logic gate noise operator obtained by each process to obtain a transformation matrix for executing quantum state operation.
The method for implementing the noise-containing double-quantum logic gate based on the MPI multi-process as described above, wherein preferably, the process performs the quantum state transformation operation according to the transformation matrix, and the method comprises the following steps:
performing the operation of the paired quantum state and the transformation matrix to obtain a new quantum state;
respectively calculating the sum of probabilities of all the new quantum states in each process, wherein the probability of the new quantum states is the square sum of the real part and the imaginary part of the new quantum states;
calculating the sum of probabilities in all processes, and calculating a normalization factor based on the sum of the probabilities;
broadcasting the normalization factors to each process and acting on each new quantum state to obtain normalized new quantum states.
The method for implementing the noise-containing double-quantum logic gate based on MPI multiprocessing as described above, preferably further comprises:
if n1 is smaller than n2, exchanging the values corresponding to both n1 and n2, converting the unitary matrix corresponding to the double-quantum logic gate according to a second preset rule, and returning to the step of executing the bit value of the control bit n1 and the target bit n2 of the comparison double-quantum logic gate.
The method for implementing the noise-containing double quantum logic gate based on MPI multiprocessing as described above, wherein preferably, the specified noise model comprises:
one of a bit-reversed noise model, a phase-reversed noise model, a bit-phase-reversed noise model, a depolarization noise model, an amplitude damping noise model, and a phase damping noise model.
Still another embodiment of the present application provides a device for implementing a noise-containing double quantum logic gate based on MPI multiprocessing, including:
a configuration module for configuring N qubits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M In the processes, the number of each quantum bit is bit n, and the value of a first quantum state in a first process is set to be 1; wherein: n, M is a positive integer, N is more than or equal to 0 and less than or equal to N-1, M is more than or equal to 1, and N is more than or equal to M+2;
the setting module is used for setting the double-quantum logic gate to a specified noise model;
the determining module is used for determining the double quantum logic gate noise operators to be executed by calculating the probability of the corresponding double quantum logic gate noise operators in the appointed noise model;
and the operation module is used for obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out the quantum state transformation operation by the process according to the transformation matrix.
A further embodiment of the application provides a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the method of any of the preceding claims when run.
Yet another embodiment of the application provides an electronic device comprising a memory having a computer program stored therein and a processor configured to run the computer program to perform the method described in any of the above.
Compared with the prior art, the application firstly configures N quantum bits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M Setting the value of the first quantum state in the first process as 1 in the processes, and setting a designated noise model for the double-quantum logic gate; and determining a double-quantum logic gate noise operator to be executed through calculation, obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out quantum state transformation operation according to the transformation matrix. Through the realization method of the noise-containing double-quantum logic gate based on MPI multi-process, not only is the design error of better simulating the physical characteristics of quantum bits in a quantum virtual machine solved, but also the defects that the computing capacity and the computing efficiency are greatly reduced along with the increase of the number of the quantum bits due to the limited in a single process are overcome, and the computing capacity and the computing efficiency of quantum computation based on the noise-containing double-quantum logic gate are improved.
Drawings
FIG. 1 is a hardware block diagram of a computer terminal based on an MPI multi-process noisy double quantum logic gate implementation method provided by an embodiment of the application;
FIG. 2 is a schematic flow chart of a method for implementing a noise-containing double quantum logic gate based on MPI multiprocessing according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of an implementation device of an MPI multiprocessing-based noise-containing double quantum logic gate according to an embodiment of the present application.
Detailed Description
The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the application.
It should be noted that the terms "first," "second," and the like in the description and in the claims are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
The embodiment of the application provides an MPI multi-process-based noisy double-quantum logic gate implementation method for simulating the operation on quantum bits in a quantum program, which can be applied to a computer cluster.
The following describes the operation of the computer terminal in detail by taking it as an example. Fig. 1 is a hardware structural block diagram of a computer terminal of a noise-containing double quantum logic gate implementation method based on MPI multiprocessing provided by an embodiment of the present application. As shown in fig. 1, the computer terminal 10 may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 104 for storing data, and optionally, a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the configuration shown in fig. 1 is merely illustrative and is not intended to limit the configuration of the computer terminal described above. For example, the computer terminal 10 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store software programs and modules of application software, such as program instructions/modules corresponding to the quantum computing simulation method in the embodiment of the present application, and the processor 102 executes the software programs and modules stored in the memory 104 to perform various functional applications and data processing, i.e., implement the method described above. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission means 106 is arranged to receive or transmit data via a network. The specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module for communicating with the internet wirelessly.
It should be noted that a real quantum computer is a hybrid structure, which includes two major parts: part of the computers are classical computers and are responsible for performing classical computation and control; the other part is quantum equipment, which is responsible for running quantum programs so as to realize quantum computation. The quantum program is a series of instruction sequences written by a quantum language such as the qlunes language and capable of running on a quantum computer, so that the support of quantum logic gate operation is realized, and finally, quantum computing is realized. Specifically, the quantum program is a series of instruction sequences for operating the quantum logic gate according to a certain time sequence.
In practical applications, quantum computing simulations are often required to verify quantum algorithms, quantum applications, etc., due to the development of quantum device hardware. Quantum computing simulation is a process of realizing simulated operation of a quantum program corresponding to a specific problem by means of a virtual architecture (namely a quantum virtual machine) built by resources of a common computer. In general, it is necessary to construct a quantum program corresponding to a specific problem. The quantum program, namely the program for representing the quantum bit and the evolution thereof written in the classical language, wherein the quantum bit, the quantum logic gate and the like related to quantum computation are all represented by corresponding classical codes.
Quantum circuits, which are one embodiment of quantum programs, also weigh sub-logic circuits, are the most commonly used general quantum computing models, representing circuits that operate on qubits under an abstract concept, the composition of which includes qubits, circuits (timelines), and various quantum logic gates, and finally the results often need to be read out by quantum measurement operations.
Unlike conventional circuits, which are connected by metal lines to carry voltage or current signals, in a quantum circuit, the circuit can be seen as being connected by time, i.e., the state of the qubit naturally evolves over time, as indicated by the hamiltonian operator, during which it is operated until a logic gate is encountered.
One quantum program is corresponding to one total quantum circuit, and the quantum program refers to the total quantum circuit, wherein the total number of quantum bits in the total quantum circuit is the same as the total number of quantum bits of the quantum program. It can be understood that: one quantum program may consist of a quantum circuit, a measurement operation for the quantum bits in the quantum circuit, a register to hold the measurement results, and a control flow node (jump instruction), and one quantum circuit may contain several tens to hundreds or even thousands of quantum logic gate operations. The execution process of the quantum program is a process of executing all quantum logic gates according to a certain time sequence. Note that the timing is the time sequence in which a single quantum logic gate is executed.
It should be noted that in classical computation, the most basic unit is a bit, and the most basic control mode is a logic gate, and the purpose of the control circuit can be achieved by a combination of logic gates. Similarly, the way in which the qubits are handled is a quantum logic gate. Quantum logic gates are used, which are the basis for forming a quantum circuit, and comprise single-bit quantum logic gates, such as Hadamard gates (H gates), pauli-X gates, pauli-Y gates, pauli-Z gates, RX gates, RY gates and RZ gates; multi-bit quantum logic gates such as CNOT gate, CR gate, iSWAP gate, toffoli gate. Quantum logic gates are typically represented using unitary matrices, which are not only in matrix form, but also an operation and transformation.
As shown in fig. 2, an embodiment of the present invention provides a flow chart of a noise-containing double quantum logic gate implementation method based on MPI multiprocessing, including:
step S201: configuring N qubits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M In the processes, the number of each quantum bit is bit n, and the value of a first quantum state in a first process is set to be 1; wherein: n, M is a positive integer, N is more than or equal to 0 and less than or equal to N-1, M is more than or equal to 1, and N is more than or equal to M+2;
Specifically, N qubits and 2 are configured M Number of processes based on MPI communication, and will be 2 N The quantum states are equally divided and stored in 2 M In the process, wherein: n, M is a positive integer, M is more than or equal to 1, N is more than or equal to M+2, and quantum states are uniformly distributed in each process. The number of each quantum bit is bit N, N is not less than 0 and not more than N-1, the value of the first quantum state in the first process is initialized to be 1, the rest quantum states are 0, the initialization quantum state refers to the amplitude of the initialization quantum state, the value of the first quantum state in the first process is initialized to be 1 in consideration of the fact that the amplitude of the quantum state is complex, the initial value of the amplitude of the quantum state with the lower standard value of 0 is initialized to be 1+0i, and the rest quantum states with the lower standard value of 0 are initialized to be 0+0i.
MPI is a cross-language communication protocol for writing parallel computers, supporting point-to-point and broadcasting. And MPI is an information delivery application program interface that includes protocols and semantic descriptions that specify how it performs its features in various implementations. MPI is used as a main model of high-performance calculation and has the characteristics of high performance, large scale and portability. MPI is used for parallel processes, with message passing between the processes through communication. MPI defines libraries of functions that can be called by C, C ++ and Fortran programs, the main concern of these libraries being the functions that communicate between two processes. MPI can have corresponding libraries in Windows and Linux environments, and corresponding algorithm can be designed to call the API interface in MPI to realize multi-process or operation in cluster. MPI runs quite equivalent to multiple processes in simultaneous calculation after the number of the processes is configured, and therefore calculation efficiency can be effectively improved. The MPI operates as follows:
mpiexec-n NUMBER./program
Wherein mpiexec-n is a command in MPI operation, NUMBER is the NUMBER of processes set, and program is an operation program.
For example: n has a value of 4 and M has a value of 2, i.e. 4 qubits and 2 are arranged 2 The number of processes based on MPI multi-process and 2 4 The quantum states are equally divided and stored in 2 2 In the processes, namely, 16 quantum states are equally divided and stored in 4 processes, each process comprises 4 quantum states, the value of the first quantum state in the first process is initialized to be 1, the rest of the quantum states are initialized to be 0, namely, the value of the first quantum state in the first process is initialized to be 1, namely, the initial value of the amplitude of the quantum state with the subscript value of 0 is initialized to be 1+0i, and the rest of the quantum states are initialized to be 0+0i. It should be noted that, the quantum state subscripts in each process are renumbered from 0.
Step S202: the two-quantum logic gate is set to a specified noise model.
Specifically, the quantum program is executed by the quantum virtual machine containing noise, before each double quantum logic gate is executed, a designated noise model in which the current logic gate is set needs to be searched, one noise model comprises a plurality of noise operators, a common noise model generally comprises two noise operators, and in fact, the mathematical expression form of the noise operators can be understood as a noise matrix. Wherein the specified noise model includes one of a bit-reversed noise model, a phase-reversed noise model, a bit-phase-reversed noise model, a depolarization noise model, an amplitude damping noise model, and a phase damping noise model.
Step S203: and determining the double-quantum logic gate noise operators to be executed by calculating the probability of the corresponding double-quantum logic gate noise operators in the appointed noise model.
Specifically, it may include:
step S2031: and determining the progress distribution of each pairing quantum state.
Step S2031-a: the bit values of the control bit n1 and the target bit n2 of the double quantum logic gate are compared.
It should be noted that the double-quantum logic gate is one of the quantum logic gates, and the double-quantum logic gate has two parameters, namely a control bit and a target bit, and the matrix corresponding to the double-quantum logic gate is represented as a 4*4 matrix, and may be specifically represented asWherein U00 represents an element of a first row and a first column of the matrix; u01 represents an element of a first row and a second column of the matrix; u02 represents elements of the third column of the first row of the matrix; u03 represents elements of the fourth column of the first row of the matrix; u10 represents an element of a first column of a second row of the matrix; u11 represents an element of a second column of a second row of the matrix; u12 represents elements of a second row and a third column of the matrix; u13 represents elements of a fourth column of the second row of the matrix; u20 represents an element of the first column of the third row of the matrix; u21 represents an element of a second column of a third row of the matrix; u22 represents an element of a third row and a third column of the matrix; u23 represents an element of a third row and a fourth column of the matrix; u30 represents an element of the first column of the fourth row of the matrix; u31 represents elements of the fourth row and the second column of the matrix; u32 represents an element of a third column of a fourth row of the matrix; u33 represents the elements of the fourth row and column of the matrix.
The common double quantum logic gate is a CNOT gate (control NOT gate), n1 in CNOT (n 1, n 2) is a control bit, n2 is a target bit, and the function is as follows: when the control bit is in the state of |0>, the quantum state of the target bit n2 is unchanged, and when the control bit is in the state of |1>, the quantum state of the target bit n2 is inverted. n1 is equal to n2, which means that the control bit and the target bit are the same qubit, which is not allowed when constructing a quantum wire, so that n1 and n2 are both positive integers and n1 is not equal to n2.
The paired quantum state distribution progress situation is determined by comparing the bit values of the control bit n1 and the target bit n2 of the double quantum logic gate.
Step S2031-b: if N1 is greater than N2 and N1 is less than N-M, determining that the paired quantum states are distributed in the same process; if the initial quantum state index paired in the same process is i, the quantum state index paired in the same process is { i, i+2 }, respectively n2 ,i+2 n1 ,i+2 n1 +2 n2 0.ltoreq.i.ltoreq.2 M -2 n1 -2 n2 -1。
The determination of the paired quantum state distribution according to the bit value of the control bit n1 and the target bit n2 of the double quantum logic gate means that all quantum state paired quantum states satisfying the |0> state or the |1> state of the quantum bit of the control bit n1 and the |0> state or the |1> state of the quantum bit of the target bit n2 are determined. The paired quantum states are formed in groups, each group comprises four quantum states which are determined by superposition of the quantum states (namely, the quantum states can be in a superposition state of a state |0> and a state |1>, and the four quantum states obtained by combining the state |0> or the state |1> of the quantum bit of the control bit n1 and the state |0> or the state |1> of the quantum bit of the target bit n2 are formed into a group.
Specifically, if N1 is greater than N2 and N1 is less than N-M, determining that the paired quantum states are distributed in the same process; if the initial quantum state index paired in the same process is i, the quantum state index paired in the same process is { i, i+2 }, respectively n2 ,i+2 n1 ,i+2 n1 +2 n2 0.ltoreq.i.ltoreq.2 M -2 n1 -2 n2 -1。
For example, if the control bit n1 is 1, the target bit n2 is 0, the difference between n and M is 2, and if 1 > 0 and 1 < 2 are determined, the paired quantum states are determined to be distributed in the same process; if the initial quantum state index i=0 paired in the same process, the quantum state index paired in the same process is {0,1,2,3}, respectively.
Step S2031-c: if N-M is smaller than N1 and greater than or equal to N2, two associated processes of pairing are determined, wherein quantum states of pairing are distributed in the two associated processes.
Specifically, if N-M is less than or equal to N1 and greater than N2, determining two associated processes of the pairing, and further determining two associated processes of the pairing, including the steps of:
step a: determining the current process number S1 and the process number offset Q 1 =2 n1-(N-M)
Step b: according to the current process number S1 and the process number offset Q 1 Determining an intermediate value l=s1&Q 1
If L > 0, the process number S2 paired with the current process number is S1-Q 1
If l=0, the process number S2 paired with the current process number is s1+q 1
Wherein "&"is a bit manipulation operator in the C language, called a" bit and "symbol, and operates on binary bits. The paired quantum states are uniformly distributed in two paired processes, and the subscript offset of the paired quantum states in one process is Q 2 =2 n2
For example, if the control bit N1 is 2, the target bit N2 is 1, the difference between N-M is 2, i.e. N-M is smaller than or equal to N1 and larger than N2, the paired quantum states are distributed in two paired processes and have the same quantum state index value, and the index offset of the quantum states is Q 2 Wherein Q is 2 =2 n2 =2。
If the pairing condition of the specific process number bit is to be determined, the following steps are further executed:
if the value of the current process number (S1) is 1, determining the process number paired with the process with the number 1; according to the current process number S1 and the process number offset Q 1 Determining an intermediate value L; wherein Q is 1 =2 n1-(N-M) =1,L=S1&Q 1 =1&1=1; because L=1 > 0, it can be judged that the process number paired with the current process number bit is S1-Q 1 I.e. the process number paired with the current number bit 1 is 0 (1-1=0).
If the value of the current process number (S1) is 2, determining the process number paired with the process with the number of 2; according to the instituteThe current process number S1 and the process number offset Q 1 Determining an intermediate value L; wherein Q is 1 =2 n1-(N-M) =1,L=S1&Q 1 =2&1=0; because L=0, it can be determined that the process number paired with the current process number bit is S1+Q 1 I.e. the process number paired with the current number bit 2 is 3 (2+1=3).
Thus, process 0 pairs with process 1 and process 2 pairs with process 3, where process 0 pairs with process 1 and process 2 pairs with process 3 have the same quantum state index value and the quantum state index offset is 2.
Step S2031-d: if N1 is greater than N2 and N2 is greater than or equal to N-M, four associated processes of the pairing are determined, wherein the quantum states of the pairing are distributed among the four associated processes.
Specifically, if N1 is greater than N2 and N2 is greater than or equal to N-M, determining four associated processes of the pairing, and further, determining four associated processes of the pairing, including the following steps:
step a1: a process number T1 is determined.
Step b1: calculation of T1&2 n2-(N-M) And T1&2 n1-(N-M) Is a value of (2).
If T1&2 n2-(N-M) And T1&2 n1-(N-M) If the values of (2) are greater than 0, the other three process numbers T2, T3, T4 associated with said process number T1 are respectively determined as t2=t1-2 n1-(N-M) --2 n2-(N-M) ,T3=T1-2 n1-(N-M) .T4=T1-2 n2 -(N-M)
If T1&2 n2-(N-M) Has a value of 0 and T1&2 n1-(N-M) If the value of (1) is greater than 0, the other three process numbers T2, T3, T4 associated with said process number T1 are respectively determined as t2=t1-2 n1-(N-M) ,T3=T1-2 n1-(N-M) +2 n2-(N-M) ,T4=T1+2 n2-(N-M)
If T1&2 n2-(N-M) Is greater than 0 and T1&2 n1-(N-M) If the value of (1) is equal to 0, the other three process numbers T2, T3, T4 associated with said process number T1 are respectively determined as t2=t1-2 n2-(N-M) ,T3=T1-2 n2-(N-M) +2 n1-(N-M) ,T4=T1+2 n1-(N-M)
If T1&2 n2-(N-M) And T1&2 n1-(N-M) If the value of (2) is equal to 0, the other three process numbers T2, T3, T4 associated with the process number T1 are respectively determined as t2=t1+2 n2-(N-M) ,T3=T1+2 n1-(N-M) ,T4=T1+2 n2-(N-M) +2 n1 -(N-M)
Illustratively, the control bit N1 is 3, the target bit N2 is 2, the difference of N-M is 2, i.e., N1 is greater than N2 and N2 is greater than or equal to N-M,
the paired quantum states are distributed in four paired processes, and it can be understood that if the paired situation of the specific process number bit is to be determined, the following steps are further required to be executed:
if it is determined that the value of a current process number (T1) is 0, T1 is calculated&2 n2-(N-M) And T1&2 n1-(N-M) The values of (1) are respectively T1&2 n2-(N-M) =0&1=0 and T1&2 n1-(N-M) =0&2=0, T1&2 n2-(N-M) And T1&2 n1-(N-M) If the value of (2) is equal to 0, the other three process numbers T2, T3, T4 associated with the process number 0 (T1) are respectively determined as:
T2=T1+2 n2-(N-M) =0+1=1;
T3=T1+2 n1-(N-M) =0+2=2;
T4=T1+2 n2-(N-M) +2 n1-(N-M) =0+1+2=3。
if it is determined that the value of a current process number (T1) is 1, T1 is calculated&2 n2-(N-M) And T1&2 n1-(N-M) The values of (1) are respectively T1&2 n2-(N-M) =1&1=1 and T1&2 n1-(N-M) =1&2=0, T1 &2 n2-(N-M) Is greater than 0 and T1&2 n1-(N-M) The value of (2) is equal to 0, so the other three process numbers T2, T3, T4 associated with process number 1 (T1) are respectively determined as:
T2=T1-2 n2-(N-M) =1-1=0;
T3=T1-2 n2-(N-M) +2 n1-(N-M) =1-1+2=2;
T4=T1+2 n1-(N-M) =1+2=3。
if it is determined that the value of a current process number (T1) is 2, T1 is calculated&2 n2-(N-M) And T1&2 n1-(N-M) The values of (1) are respectively T1&2 n2-(N-M) =2&1=0 and T1&2 n1-(N-M) =2&2=2, T1&2 n2-(N-M) Has a value of 0 and T1&2 n1-(N-M) The value of (2) is greater than 0, so the three other process numbers T2, T3, T4 associated with said process number T1 are respectively determined as:
T2=T1-2 n1-(N-M) =2-2=0;
T3=T1-2 n1-(N-M) +2 n2-(N-M) =2-2+1=1;
T4=T1+2 n2-(N-M) =2+1=3。
if it is determined that the value of a current process number (T1) is 3, T1 is calculated&2 n2-(N-M) And T1&2 n1-(N-M) The values of (1) are respectively T1&2 n2-(N-M) =3&1=1 and T1&2 n1-(N-M) =3&2=2, T1&2 n2-(N-M) And T1&2 n1-(N-M) The other three process numbers T2, T3, T4 associated with said process number T1 are thus determined as:
T2=T1-2 n1-(N-M) -2 n2-(N-M) =3-2-1=0;
T3=T1-2 n1-(N-M) =3-2=1;
T4=T1-2 n2-(N-M) =3-1=2。
thus, process numbers T1, T2, T3, and T4 pair with each other and quantum state subscripts are the same in the four associated processes.
If n1 is smaller than n2, exchanging the values corresponding to both n1 and n2, converting the unitary matrix corresponding to the double-quantum logic gate according to a second preset rule, and returning to the step of comparing the bit values of the control bit n1 and the target bit n2 of the double-quantum logic gate.
Specifically, if n1 is less than n2, the values corresponding to both n1 and n2 are exchanged, and converted according to the following second preset rule Unitary matrix: unitary matrix corresponding to double-quantum logic gateConversion into according to a second preset ruleAnd then returns to step S2031-a.
Step S2032: and calculating each double-quantum logic gate noise operator according to the noise operator in the appointed noise model and through a first preset rule.
Specifically, firstly, determining the type of a designated noise model, then determining the number of noise operators contained in the designated noise model, and calculating each double-quantum logic gate noise operator through a first preset rule.
For example, the noise model is designated as an amplitude damping noise model, which includes two noise operators, noise operator K 0 And K 1 The specific matrix form is as follows:
and calculating the noise operators of the two-quantum logic gates through a first preset rule, namely, the expression form of a certain specified noise model in the two-quantum logic gates is the tensor product combination of different Kraus operators of the noise. For example, the expression of a certain noise under a single gate is K= { K 0 ,K 1 Then the Kraus operator corresponding to the double quantum logic gate isTherefore, each two-quantum logic gate noise operator is calculated by the following first preset rule: />
Step S2033: and respectively calculating quantum states of paired quantum states in the process after the operation of the double-quantum logic gate noise operators aiming at each double-quantum logic gate noise operator.
Specifically, for the double quantum logic gate noise operator K 00 、K 01 、K 10 、K 11 And respectively calculating quantum states of paired quantum states a, b, c, d in the process after the operation of the double-quantum logic gate noise operator.
Exemplary, paired quantum state a, b, c, d is passed through the two-quantum logic gate noise operator K 00 After the operation, the quantum state (specifically, the amplitude value of the quantum state, the following is the same) obtained after the operation of the noise operator is:
a 1 =a*K 00 [0]+b*K 00 [1]+c*K 00 [2]+d*K 00 [3]
b 1 =a*K 00 [4]+b*K 00 [5]+c*K 00 [6]+d*K 00 [7]
c 1 =a*K 00 [8]+b*K 00 [9]+c*K 00 [10]+d*K 00 [11]
d 1 =a*K 00 [12]+b*K 00 [13]+c*K 00 [14]+d*K 00 [15]
wherein K is 00 []The values within represent the noise operator K 00 Matrix element values of (1), in particular, at K 00 In the corresponding 4*4 matrix, K 00 [0]Elements representing a first row and a first column; k (K) 00 [1]Elements representing a first row and a second column; k (K) 00 [2]Elements representing a third column of the first row; k (K) 00 [3]Elements representing a fourth column of the first row; the remaining operators continue with this rule representation and will not be described here.
The noise operator K of the double quantum logic gate can be calculated by the same method and principle 01 、K 10 、K 11 The quantum state after the operation is not described in detail herein.
Step S2034: and calculating the probability of the quantum state operated by the double-quantum logic gate noise operator, wherein the probability is the square sum of the real part and the imaginary part of the quantum state operated by the double-quantum logic gate noise operator.
Specifically, the probability of the quantum state operated by the double-quantum logic gate noise operator, such as the paired quantum state a, b, c, d, is calculated, and the quantum state a operated by the double-quantum logic gate noise operator 1 、b 1 、c 1 、d 1 Then the quantum state a 1 、b 1 、c 1 、d 1 The probabilities of (a) are a respectively 1 Sum of squares, b of real and imaginary parts of amplitude values 1 Sum of squares, c, of the real and imaginary parts of the amplitude values 1 Sum of squares, d of real and imaginary parts of amplitude values 1 The sum of squares of the real and imaginary parts of the amplitude values.
Step S2035: reducing probability distribution corresponding to each process to a root node; the probability distribution corresponding to each process is { p1, p1+p2, }, p1 is the probability corresponding to the first two-quantum logic gate noise operator in the process, and p2 is the probability corresponding to the second two-quantum logic gate noise operator; the probability corresponding to the noise operator of the double quantum logic gate is as follows: the sum of the probabilities of the quantum states in the process after the operation by the two-quantum logic gate noise operator.
Specifically, the probability distribution corresponding to each process is reduced to the root node, where the root node is the process of selecting and processing data by the user, and generally selects the process with the subscript value of 0, but other processes with subscript values are also possible, and the process is not limited herein.
The probability distribution corresponding to each process is { p1, p1+p2, &.}, and p1 is the probability corresponding to the first noise operator in the process, namely:
p1=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2
+…+state[2 N-M -1].real 2 +state[2 N - M -1].imag 2
wherein state represents the quantum state, the number in [ ] represents the subscript value of the quantum state in one pass, real represents the real part of the quantum state, and imag represents the imaginary part of the quantum state. The probability p2 of the quantum state after the second noise operator operation can be obtained by the same method, and so on, if there are four noise operators, the probability distribution corresponding to each process is { p1, p1+p2, p1+p2+p3, p1+p2+p3+p4}, and the description thereof is omitted here.
For example, if M has a value of 2 and N has a value of 4, then a total of 16 quantum states are equally stored in 4 processes, and the subscript values (i.e., process numbers) of the 4 processes are 0, 1, 2, and 3, respectively, if the specified noise model contains two noise operators, K 0 And K 1 The noise operators of the double quantum logic gate are respectively K 00 、K 01 、K 10 、K 11 After the steps S2033-S2034, the noise operator K in each process is obtained 00 、K 01 、K 10 、K 11 The probability of the calculated quantum state is shown in table 1:
table 1: through noise operator K in each process 00 、K 01 、K 10 、K 11 Probability of calculated quantum state
The probability distribution among the 4 processes is:
process 0: { p000, p000+p010, p000+p010+p100, p000+p010+p100+p110}
Process 1: { p001, p001+p011+p101+p111}
Process 2: { p002, p002+p12, p002+p012+p102, p002+p012+p102+p112}
Process 3: { p003, p003+p013, p003+p013+p103, p003+p013+p103+p113}
The probability distribution corresponding to the processes 0, 1, 2, 3 is reduced to the root node, for example, the probability distribution corresponding to the processes 0, 1, 2, 3 is reduced to the process 0, the reduced value is { p000+p001+p002+p003, p000+p010+p001+p011+p002+p12+p003+p013, p000+p010+p100+p001+p011+p101+p002+p012+p102+p003+p013+p103, p000+p010+p100+p110+p001+p011+p101+p111+p002+p012+p102+p112+p003+p013+p103+p113}, the reduced value is denoted as { R1, R2, R3, R4}.
Step S2036: and comparing the random number with the reduced probability distribution according to the random number acquired by the root node, and determining a double-quantum logic gate noise operator to be executed.
Specifically, in order to ensure the uniqueness of the random number, the random number is acquired only according to the root node, and other processes do not perform the operation of acquiring the random number, wherein the value range of the acquired random number is between 0 and 1. And comparing the random number with the reduced probability distribution to determine a double-quantum logic gate noise operator to be executed.
Illustratively, the random number obtained from the root node is J, where 0 < J < 1.
If J is less than or equal to R1, determining that the noise operator to be executed is K 00
If R1 is less than J and less than or equal to R2, determining that the noise operator to be executed is K 01
If R2 is less than J and less than or equal to R3, determining that the noise operator to be executed is K 10
If R3 is less than J and less than or equal to R4, determining that the noise operator to be executed is K 11
If there are still multiple noise operators and multiple reduced probabilities, the noise operators to be executed are determined according to the above method, which is not described herein.
Step S204: and obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out the transformation operation of the quantum state by the process according to the transformation matrix.
Specifically, obtaining the transformation matrix based on the two-quantum logic gate noise operator and the two-quantum logic gate may include:
step S2041: broadcasting the noise operator or the operator index of the double quantum logic gate to be executed to all processes.
Specifically, the noise operator or the operator index which needs to be executed is broadcasted to all processes, so that the uniqueness of the noise operator used for subsequent operation in all processes is ensured.
Exemplary, if it is determined that the noise operator to be performed is K 00 Then the noise operator K can be used 00 Broadcasting to all processes, the noise operator K can also be used for 00 The subscript value 00 of (1) is broadcast to all processes, which determine the noise operator that needs to be executed based on the subscript value of the noise operator.
Step S2042: and performing matrix multiplication operation on the unitary matrix corresponding to the double-quantum logic gate and the matrix corresponding to the double-quantum logic gate noise operator obtained by each process to obtain a transformation matrix for executing quantum state operation.
Specifically, a unitary matrix corresponding to the double-quantum logic gate and a matrix corresponding to a noise operator obtained by broadcasting to each process, that is, a noise matrix, may be subjected to matrix multiplication operation, so as to obtain a transformation matrix for executing quantum state operation.
For example, if the two-quantum logic gate is M and the noise operator obtained by broadcasting to each process is K, the unitary matrix corresponding to the two-quantum logic gate M performs matrix multiplication operation on the matrix corresponding to the noise operator K to obtain a transformation matrix M for executing quantum state operation n The method comprises the following steps:
M n =M*K
step S2043: and executing the operation of the paired quantum state and the transformation matrix to obtain a new quantum state.
Specifically, the quantum state a, b, c, d of the pairing is matched with the transformation matrix M n To obtain a new quantum state.
Exemplary, paired Quantum states a, b, c, d and transformation matrix M n After the operation, a new quantum state is obtained:
a 1 =a*M n [0]+b*M n [1]+c*M n [2]+d*M n [3]
b 1 =a*M n [4]+b*M n [5]+c*M n [6]+d*M n [7]
c 1 =a*M n [8]+b*M n [9]+c*M n [10]+d*M n [11]
d 1 =a*M n [12]+b*M n [13]+c*M n [14]+d*M n [15]
wherein M is n [0]、M n [1]、M n [2]、M n [3]Representing a transformation matrix M n Matrix element values of (a). Specifically, at M n In the corresponding 4*4 matrix, M n [0]Elements representing a first row and a first column; m is M n [1]Elements representing a first row and a second column; m is M n [2]Elements representing a third column of the first row; m is M n [3]Elements representing a fourth column of the first row; and continue to be expressed in accordance with this rule and will not be described again here.
Other paired quantum states and transformation matrices M can be respectively calculated by the same method n The new quantum state after the operation is not described here again.
Step S2044: and respectively calculating the sum of probabilities of all the new quantum states in each process, wherein the probability of the new quantum states is the square sum of the real part and the imaginary part of the new quantum states.
Those skilled in the art will appreciate that the probability of a new quantum state is specifically the sum of the squares of the real and imaginary parts of the amplitude of the new quantum state.
Exemplary, paired quantum state a, b, c, d, the new quantum state after the transformation matrix operation is a 1 、b 1 、c 1 、d 1 Then the new quantum state a 1 、b 1 、c 1 、d 1 The probabilities of (a) are a respectively 1 Sum of squares, b of real and imaginary parts of amplitude values 1 Sum of squares, c, of the real and imaginary parts of the amplitude values 1 Sum of squares, d of real and imaginary parts of amplitude values 1 The sum of squares of the real and imaginary parts of the amplitude values.
Step S2045: the sum of the probabilities in all the processes is calculated and a normalization factor is calculated based on the sum of the probabilities.
Specifically, the probability corresponding to a process is: the sum of probabilities of the new quantum states after operation in the process is:
P 1 =state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2
+…+state[2 N-M -1].real 2 +state[2 N-M -1].imag 2
wherein state represents the quantum state, the number in [ ] represents the subscript value of the quantum state in one pass, real represents the real part of the quantum state, and imag represents the imaginary part of the quantum state. The probability P of the new quantum state in other processes can be found by the same method, and will not be described here. And then, adding the probabilities corresponding to the processes respectively to obtain a probability sum.
For example, if the value of M is 2 and the value of n is 4, a total of 16 quantum states are equally stored in 4 processes, and the subscript values of the 4 processes are respectively 0, 1, 2, and 3, probabilities of the 4 processes are respectively calculated, and the sum of the probabilities of the processes is calculated, as shown in table 2, specifically:
Table 2: quantum state probability for each process
Thus, the sum of the process probabilities: p (P) T =P 1 +P 2 +P 3 +P 4
Sum of process probabilities P T Reduce to root node, based on sum P of the probabilities T Calculating a normalization factor, wherein the calculation mode of the normalization factor (component) is as follows:
step S2046: broadcasting the normalization factors to each process and acting on each new quantum state to obtain normalized new quantum states.
Specifically, the normalization factors are broadcast to each process to ensure the uniqueness of the normalization factors for subsequent operation in all processes, so that new normalized quantum states can be obtained in each subsequent process. Wherein, the new quantum state normalized by each process is:
state new [i]=state[i]*component
where state is the meaning of "state," the numbers in [ i ] represent the new quantum states normalized in each pass. Other quantum states can be obtained by the same method and are not described herein.
For example, if the value of the normalization factor is determined to be 1.04, the value of the normalization factor may be broadcast to all processes, so as to obtain new normalized quantum states in each subsequent process, that is, the new normalized quantum states of each process are:
state new [i]=state[i]*1.04
Compared with the prior art, the invention firstly configures N quantum bits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M Setting the value of the first quantum state in the first process as 1 in the processes, and setting a designated noise model for the double-quantum logic gate; and determining a double-quantum logic gate noise operator to be executed through calculation, obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out quantum state transformation operation according to the transformation matrix. Through the realization method of the noise-containing double-quantum logic gate based on MPI multi-process, not only is the design error of better simulating the physical characteristics of quantum bits in a quantum virtual machine solved, but also the defects that the computing capacity and the computing efficiency are greatly reduced along with the increase of the number of the quantum bits due to the limited in a single process are overcome, and the computing capacity and the computing efficiency of quantum computation based on the noise-containing double-quantum logic gate are improved.
The above process completely shows the implementation method of the multi-process noise-containing double-quantum logic gate based on MPI multi-process, and all the implementation methods of the multi-process noise-containing double-quantum logic gate according to the principle and the method of the scheme are within the protection scope of the scheme.
Example 1:
the following describes a noisy two-quantum logic gate implementation method based on MPI multiprocessing in connection with specific embodiments. The method comprises the following steps:
configuration 4 (i.e. N equals 4) qubits and 2 2 (i.e., M equals 2) MPI communication-based processes, and will be 2 4 The quantum states are equally divided and stored in 2 2 In each process, the number of each quantum bit is bit n, and the amplitude value of the first quantum state in the first process is set to be 1, so that the average storage condition of the quantum states in 4 processes is shown in table 3, wherein the numbers in () represent the subscript values of the quantum states.
Table 3: equipartition storage of 16 quantum states in 4 processes
The matrix corresponding to the double-quantum logic gate isIn this embodiment, taking a CNOT gate as an example, the matrix corresponding to the CNOT gate is +.>Namely: u00=1, u01=0, u02=0, u03=0, u10=0, u11=1, u12=0, u13=0, u20=0, u21=0, u22=0, u23=1, u30=0, u31=0, u32=1, u33=0.
Setting a designated noise model of the CNOT gate as an amplitude damping (Amplitude Damping) noise model, wherein the noise model comprises two noise operators, namely noise operator K 0 And K 1 The specific matrix form is as follows:
setting p=0.2, the value of the resulting operator is:
the operator corresponding to the CNOT gate is
After being unfolded, the method can obtain:
/>
in order to better show the change of the quantum state amplitude value, the initial value of the quantum state amplitude can be changed, the quantum state amplitude value in each process can be any amplitude value, and the sum of squares of the amplitudes of all quantum states is only required to be 1.
For example, the amplitude value of the initial quantum state as shown in table 3 may be changed to the amplitude value of the quantum state as shown in table 4 below:
table 4: equipartition storage of 16 quantum states in 4 processes
First, through CNOT (q [0], q [1 ]), n1=0, n2=1 can be found.
Specifically, 0 < 1, the value of n1 is exchanged with the value of n2, i.en1=1, n2=0; and matrix corresponding to CNOTBecome->At this time, 1 is greater than 0 and 1 is less than 4-2, that is, N1 is greater than N2 and N1 is less than N-M, the paired quantum states are distributed in the same process, the initial quantum state index of pairing in the same process is 0, the quantum state index of pairing in the same process is {0,1,2,3}, that is, 4 quantum states in process 0 are paired, and it is to be noted that the pairing conditions of quantum states in processes 1,2 and 3 are the same as the pairing relationship of process 0, and no further description is given here.
In the process 0, a quantum state with a subscript value of 0 (amplitude of 0.707107+0i (0)), a quantum state with a subscript value of 1 (amplitude of 0.707107+0i (0)), a quantum state with a subscript value of 2 (amplitude of 0+0i (2)), and a quantum state with a subscript value of 3 (amplitude of 0+0i (0)) are paired with K, respectively 00 Performing operation to obtain the following quantum states:
a 1 =a*K 00 [0]+b*K 00 [1]+c*K 00 [2]+d*K 00 [3]=0.707107
b 1 =a*K 00 [4]+b*K 00 [5]+c*K 00 [6]+d*K 00 [7]=0.632456
c 1 =a*K 00 [8]+b*K 00 [9]+c*K 00 [10]+d*K 00 [11]=0
d 1 =a*K 00 [12]+b*K 00 [13]+c*K 00 [14]+d*K 00 [15]=0
similarly, respectively with K 01 Performing operation to obtain the following quantum states:
a 1 =a*K 01 [0]+b*K 01 [1]+c*K 01 [2]+d*K 01 [3]=0.316228
b 1 =a*K 01 [4]+b*K 01 [5]+c*K 01 [6]+d*K 01 [7]=0
c 1 =a*K 01 [8]+b*K 01 [9]+c*K 01 [10]+d*K 01 [11]=0
d 1 =a*K 01 [12]+b*K 01 [13]+c*K 01 [14]+d*K 01 [15]=0
respectively with K 10 Performing operation to obtain the following quantum states:
a 1 =a*K 10 [0]+b*K 10 [1]+c*K 10 [2]+d*K 10 [3]=0
b 1 =a*K 10 [4]+b*K 10 [5]+c*K 10 [6]+d*K 10 [7]=0
c 1 =a*K 10 [8]+b*K 10 [9]+c*K 10 [10]+d*K 10 [11]=0
d 1 =a*K 10 [12]+b*K 10 [13]+c*K 10 [14]+d*K 10 [15]=0
respectively with K 11 Performing operation to obtain the following quantum states:
a 1 =a*K 11 [0]+b*K 11 [1]+c*K 11 [2]+d*K 11 [3]=0
b 1 =a*K 11 [4]+b*K 11 [5]+c*K 11 [6]+d*K 11 [7]=0
c 1 =a*K 11 [8]+b*K 11 [9]+c*K 11 [10]+d*K 11 [11]=0
d 1 =a*K 11 [12]+b*K 11 [13]+c*K 11 [14]+d*K 11 [15]=0
then, calculate K in Process 0 00 The sum of the probabilities of the calculated quantum states is:
p1=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2
+…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0.9
computing process 0 via K 01 The sum of the probabilities of the calculated quantum states is:
p2=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2
+…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0.1
computing process 0 via K 10 The sum of the probabilities of the calculated quantum states is:
p3=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2
+…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0
computing process 0 via K 11 The sum of the probabilities of the calculated quantum states is:
p4=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2
+…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0
the probability distribution of the quantum states corresponding to process 0 can be obtained as follows: { p1, p1+p2, p1+p2+p3, p1+p2+p3+p4} = {0.9,1,1,1}; the probability distributions of processes 1, 2, and 3 can be obtained by using the same steps, and are not described in detail herein.
In summary, the probability distribution of the corresponding quantum state after each process is operated by the noise operator is as follows:
process 0: {0.9,1,1,1}
Process 1: {0,0,0,0}
Process 2: {0,0,0,0}
Process 3: {0,0,0,0}
The probability distribution corresponding to the processes 0, 1, 2 and 3 is reduced to the root node such as the process 0, and the reduced probability distribution is {0.9,1,1,1}.
Obtaining a random number from the root node, process 0, assuming 0.75, comparing 0.75 with the reduced probability distribution {0.9,1,1,1}, since 0.75 < 0.9, determining the noise operator to be performed as K 00 And then K is added with 00 Broadcast to all processes, or noise operator K 00 Broadcast the subscript value 00 of (1) to all processes to transform the unitary matrix corresponding to the CNOT gate according to the preset rule with K 00 Matrix multiplication is carried out on the corresponding noise matrix to obtain a transformation matrix M for executing quantum state operation n The method comprises the following steps:
in process 0, a quantum state with a subscript value of 0 (amplitude of 0.707107+0i (0)), a quantum state with a subscript value of 1 (amplitude of 0.707107+0i (0)), a quantum state with a subscript value of 2 (amplitude of 0+0i (2)), and a quantum state with a subscript value of 3 (amplitude of 0+0i (0)) are paired, and the paired quantum state a, b, c, d is paired with the transformation matrix M n After the operation, a new quantum state is obtained:
a 1 =a*M n [0]+b*M n [1]+c*M n [2]+d*M n [3]=0.707107
b 1 =a*M n [4]+b*M n [5]+c*M n [6]+d*M n [7]=0
c 1 =a*M n [8]+b*M n [9]+c*M n [10]+d*M n [11]=0
d 1 =a*M n [12]+b*M n [13]+c*M n [14]+d*M n [15]=0.632456
similarly, the quantum states paired in the processes 1, 2 and 3 are matched with the transformation matrix M n The principle and method are the same as the 0 process described above, and are not repeated here to obtain a new quantum state, as shown in table 5:
table 5: quantum states paired in each process and transformation matrix M n Quantum state after operation
Next, in process 0, the sum of the probabilities of the new quantum state with the subscript value of 0 (amplitude of 0.707107+0i), the new quantum state with the subscript value of 1 (amplitude of 0+0i), the new quantum state with the subscript value of 2 (amplitude of 0+0i), and the new quantum state with the subscript value of 3 (amplitude of 0.632456+0i) is calculated, namely:
P1=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2
+…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0.9
the probability P of a new quantum state in processes 1, 2 and 3 can be found in the same way 2 、P 3 And P 4 And will not be described in detail herein.
The probability of each process is shown in table 6, specifically:
table 6: quantum state probability for each process
Process subscript value Quantum state probability for each process
0 P 1 =0.9
1 P 2 =0
2 P 3 =0
3 P 4 =0
Computing a summary of all processesSum of rates: p (P) T =P 1 +P 2 +P 3 +P 4 =0.9。
Will P T To reduce to the root node, a process with a subscript value of 0 can be selected, and a normalization factor is calculated:
the value of the normalization factor 1.05409 is broadcast to each process and acts on each new quantum state, resulting in a normalized new quantum state. For example, for the quantum state with subscript 3 in process 0, the amplitude is 0.632456+0i, and the new quantum state obtained after normalization operation is:
state new [i]=(0.632456+0i)*1.05409=0.666667+0i
similarly, the new normalized quantum state of other quantum states in each process is calculated in the above manner, and the new normalized quantum state shown in the following table 7 is obtained:
Table 7: new quantum state normalized by quantum state in each process
Compared with the prior art, the invention firstly configures N quantum bits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M Setting the value of the first quantum state in the first process as 1 in the processes, and setting a designated noise model for the double-quantum logic gate; and determining a double-quantum logic gate noise operator to be executed through calculation, obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out quantum state transformation operation according to the transformation matrix. Through the method for realizing the noisy double-quantum logic gate based on MPI multiprocess, not only is the design error of better simulating the physical characteristics of the quantum bits in the quantum virtual machine solved, but also the limit in single process is overcome, and the number of the quantum bits is increasedThe increase of the number of the quantum gates, the calculation capacity and the calculation efficiency of the quantum gates based on the noise-containing double quantum logic gates are improved.
Example 2:
in order to fully demonstrate the MPI multi-process-based noisy double quantum logic gate implementation method, in the above embodiment 1, embodiment 1 shows the situation that paired quantum states are distributed in the same process through CNOT (q [0], q [1 ]), and embodiment 2 shows the situation that paired quantum states are distributed in two processes through CNOT (q [1], q [2 ]) on the basis of embodiment 1.
Configuration 4 (i.e. N equals 4) qubits and 2 2 (i.e., M equals 2) MPI communication-based processes, and will be 2 4 The quantum states are equally divided and stored in 2 2 In each process, each of the qubits is numbered as bit n, which is encoded by CNOT (q [0 ]],q[1]) After that, the quantum state distribution in each process is shown in table 8:
table 8: initial distribution of 16 quantum states in 4 processes
As in example 1, n1=1 and n2=2 were found through CNOT (q [1], q [2 ]).
Specifically, 1 < 2, then the value of n1 is exchanged with the value of n2, i.e. n1=2, n2=1; and matrix corresponding to CNOTBecome->At this time, 2 is greater than 1 and 2=4-2, i.e. N-M is smaller than or equal to N1 and larger than N2, the paired quantum states are distributed in the two paired processes and the quantum state index values are the same, and the index offset of the quantum state is Q 2 Wherein Q is 2 =2 n2 =2. If the pairing condition of the specific process number bit is to be determined, the following steps are further executed:
if the value of the current process number (S1) is 1, determining the process number paired with the process with the number 1; according to the current process number S1 and the process number offset Q 1 Determining an intermediate value L; wherein Q is 1 =2 n1-(N-M) =1,L=S1&Q 1 =1&1=1; because L=1 > 0, it can be judged that the process number paired with the current process number bit is S1-Q 1 I.e. the process number paired with the current number bit 1 is 0 (1-1=0).
If the value of the current process number (S1) is 2, determining the process number paired with the process with the number of 2; according to the current process number S1 and the process number offset Q 1 Determining an intermediate value L; wherein Q is 1 =2 n1-(N-M) =1,L=S1&Q 1 =2&1=0; because L=0, it can be determined that the process number paired with the current process number bit is S1+Q 1 I.e. the process number paired with the current number bit 2 is 3 (2+1=3).
Thus, process 0 pairs with process 1 and process 2 pairs with process 3, where process 0 pairs with process 1 and process 2 pairs with process 3 have the same quantum state index value and the quantum state index offset is 2.
Process 0 and process 1 are paired, and a quantum state with a subscript value of 0 (amplitude of 0.745354+0i) and a quantum state with a subscript value of 2 (amplitude of 0+0i) are paired with a quantum state with a subscript value of 0 (amplitude of 0+0i) and a quantum state with a subscript value of 2 (amplitude of 0+0i) in process 1; quantum states with a subscript value of 1 for process 0 (amplitude 0+0i) and 3 (amplitude 0.666667+0i) are paired with quantum states with a subscript value of 1 for process 1 (amplitude 0+0i) and 3 (amplitude 0+0i).
Quantum states with a 0 subscript value of process 0 (amplitude 0.745354+0i), a 2 subscript value (amplitude 0+0i) and a 0 subscript value of process 1 (amplitude 0+0i), a 2 subscript value (amplitude 0+0i) are paired.
Paired quantum states are respectively matched with K 00 After the operation, the quantum state after the operation is obtained as follows:
a 00 =a*K 00 [0]+b*K 00 [1]+c*K 00 [2]+d*K 00 [3]=0.745354
b 00 =a*K 00 [4]+b*K 00 [5]+c*K 00 [6]+d*K 00 [7]=0
c 00 =a*K 00 [8]+b*K 00 [9]+c*K 00 [10]+d*K 00 [11]=0
d 00 =a*K 00 [12]+b*K 00 [13]+c*K 00 [14]+d*K 00 [15]=0
paired quantum states are respectively matched with K 01 After the operation, the quantum state after the operation is obtained as follows:
a 01 =a*K 01 [0]+b*K 01 [1]+c*K 01 [2]+d*K 01 [3]=0
b 01 =a*K 01 [4]+b*K 01 [5]+c*K 01 [6]+d*K 01 [7]=0
c 01 =a*K 01 [8]+b*K 01 [9]+c*K 01 [10]+d*K 01 [11]=0
d 01 =a*K 01 [12]+b*K 01 [13]+c*K 01 [14]+d*K 01 [15]=0
paired quantum states are respectively matched with K 10 After the operation, the quantum state after the operation is obtained as follows:
a 10 =a*K 10 [0]+b*K 10 [1]+c*K 10 [2]+d*K 10 [3]=0
b 10 =a*K 10 [4]+b*K 10 [5]+c*K 10 [6]+d*K 10 [7]=0
c 10 =a*K 10 [8]+b*K 10 [9]+c*K 10 [10]+d*K 10 [11]=0
d 10 =a*K 10 [12]+b*K 10 [13]+c*K 10 [14]+d*K 10 [15]=0
paired quantum states are respectively matched with K 11 After the operation, the quantum state after the operation is obtained as follows:
a 11 =a*K 11 [0]+b*K 11 [1]+c*K 11 [2]+d*K 11 [3]=0
b 11 =a*K 11 [4]+b*K 11 [5]+c*K 11 [6]+d*K 11 [7]=0
c 11 =a*K 11 [8]+b*K 11 [9]+c*K 11 [10]+d*K 11 [11]=0
d 11 =a*K 11 [12]+b*K 11 [13]+c*K 11 [14]+d*K 11 [15]=0
quantum states with a subscript value of 1 for process 0 (amplitude 0+0i) and 3 (amplitude 0.666667+0i) are paired with quantum states with a subscript value of 1 for process 1 (amplitude 0+0i) and 3 (amplitude 0+0i).
Paired quantum states are respectively matched with K 00 After the operation, the quantum state after the operation is obtained as follows:
a 00 =a*K 00 [0]+b*K 00 [1]+c*K 00 [2]+d*K 00 [3]=0
b 00 =a*K 00 [4]+b*K 00 [5]+c*K 00 [6]+d*K 00 [7]=0.596285
c 00 =a*K 00 [8]+b*K 00 [9]+c*K 00 [10]+d*K 00 [11]=0
d 00 =a*K 00 [12]+b*K 00 [13]+c*K 00 [14]+d*K 00 [15]=0
paired quantum states are respectively matched with K 01 After the operation, the quantum state after the operation is obtained as follows:
α 01 =a*K 01 [0]+b*K 01 [1]+c*K 01 [2]+d*K 01 [3]=0.298143
b 01 =a*K 01 [4]+b*K 01 [5]+c*K 01 [6]+d*K 01 [7]=0
c 01 =a*K 01 [8]+b*K 01 [9]+c*K 01 [10]+d*K 01 [11]=0
d 01 =a*K 01 [12]+b*K 01 [13]+c*K 01 [14]+d*K 01 [15]=0
paired quantum states are respectively matched with K 10 After the operation, the quantum state after the operation is obtained as follows:
a 10 =a*K 10 [0]+b*K 10 [1]+c*K 10 [2]+d*K 10 [3]=0
b 10 =a*K 10 [4]+b*K 10 [5]+c*K 10 [6]+d*K 10 [7]=0
C 10 =a*K 10 [8]+b*K 10 [9]+c*K 10 [10]+d*K 10 [11]=0
d 10 =a*K 10 [12]+b*K 10 [13]+c*K 10 [14]+d*K 10 [15]=0
paired quantum states are respectively matched with K 11 After the operation, the quantum state after the operation is obtained as follows:
a 11 =a*K 11 [0]+b*K 11 [1]+c*K 11 [2]+d*K 11 [3]=0
b 11 =a*K 11 [4]+b*K 11 [5]+c*K 11 [6]+d*K 11 [7]=0
c 11 =a*K 11 [8]+b*K 11 [9]+c*K 11 [10]+d*K 11 [11]=0
d 11 =a*K 11 [12]+b*K 11 [13]+c*K 11 [14]+d*K 11 [15]=0
process 2 and process 3 are paired, and a quantum state with a subscript value of 0 (amplitude of 0+0i) and a quantum state with a subscript value of 2 (amplitude of 0+0i) are paired with a quantum state with a subscript value of 0 (amplitude of 0+0i) and a quantum state with a subscript value of 2 (amplitude of 0+0i); quantum states with a subscript value of 1 in process 2 (amplitude 0+0i) and 3 (amplitude 0+0i) are paired with quantum states with a subscript value of 1 in process 3 (amplitude 0+0i) and 3 (amplitude 0+0i).
Similarly, the above paired quantum states are respectively matched with K 00 、K 01 、K 10 、K 11 After the operation, the quantum state after the operation is obtained, and the calculation is not repeated here.
Then, calculate K in Process 0 00 The sum of the probabilities of the calculated quantum states is:
p1=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2
+…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2
=0.911111
computing process 0 via K 01 The sum of the probabilities of the calculated quantum states is:
p2=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2 +
…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0.088889
computing process 0 via K 10 The sum of the probabilities of the calculated quantum states is:
p3=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2 +
…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0
computing process 0 via K 11 The sum of the probabilities of the calculated quantum states is:
p4=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2 +
…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0
the probability distribution of the quantum states corresponding to process 0 can be obtained as follows: { p1, p1+p2, p1+p2+p3, p1+p2+p3+p4} = {0.911111,1,1,1}; the probability distributions of processes 1, 2, and 3 can be obtained by using the same steps, and are not described in detail herein.
In summary, the probability distribution of the corresponding quantum state after each process is operated by the noise operator is as follows:
process 0: {0.911111,1,1,1}
Process 1: {0,0,0,0}
Process 2: {0,0,0,0}
Process 3: {0,0,0,0}
The probability distribution corresponding to the process 0, 1, 2, 3 is reduced to the root node, for example, the probability distribution corresponding to the process 0, 1, 2, 3 is reduced to the process 0, and the reduced probability distribution is {0.911111,1,1,1}.
Obtaining a random number from the root node, process 0, assuming 0.75, comparing 0.75 with the reduced probability distribution {0.911111,1,1,1}, since 0.75 < 0.911111, determining the noise operator to be performed as K 00 And then K is added with 00 Broadcast to all processes, or noise operator K 00 Broadcast the subscript value 00 of (1) to all processes to transform the unitary matrix corresponding to the CNOT gate according to the preset rule with K 00 Matrix multiplication is carried out on the corresponding noise matrix to obtain a transformation matrix M for executing quantum state operation n The method comprises the following steps:
in the process 0 and the process 1, a quantum state with a 0 lower scale value of the process 0 (with an amplitude of 0.745354+0i) and a quantum state with a 2 lower scale value (with an amplitude of 0+0i) are paired with a quantum state with a 0 lower scale value of the process 1 (with an amplitude of 0+0i) and a quantum state with a 2 lower scale value (with an amplitude of 0+0i); quantum states with a subscript value of 1 in process 0 (amplitude 0+0i), 3 (amplitude 0.66666667+0i) and 1 in process 1 (amplitude 0+0i), 3 (amplitude 0+0i) are paired, and the paired quantum state a, b, c, d is paired with a transformation matrix M n After the operation, a new quantum state is obtained:
a 1 =a*M n [0]+b*M n [1]+c*M n [2]+d*M n [3]=0.745354
b 1 =a*M n [4]+b*M n [5]+c*M n [6]+d*M n [7]=0
c 1 =a*M n [8]+b*M n [9]+c*M n [10]+d*M n [11]=0
d 1 =a*M n [12]+b*M n [13]+c*M n [14]+d*M n [15]=0
a 11 =a*M n [0]+b*M n [1]+c*M n [2]+d*M n [3]=0
b 11 =a*M n [4]+b*M n [5]+c*M n [6]+d*M n [7]=0
c 11 =a*M n [8]+b*M n [9]+c*M n [10]+d*M n [11]=0
d 11 =a*M n [12]+b*M n [13]+c*M n [14]+d*M n [15]=0.596285
similarly, the quantum states paired in the processes 2 and 3 are matched with the transformation matrix M n The principle and method are the same as those of processes 0 and 1, and are not described here again, so that a new quantum state is obtained, as shown in table 9:
table 9: quantum states paired in each process and transformation matrix M n Quantum state after operation
/>
Next, in process 0, the sum of probabilities of a new quantum state with a subscript value of 0 (amplitude of 0.745354+0i), a new quantum state with a subscript value of 1 (amplitude of 0+0i), a new quantum state with a subscript value of 2 (amplitude of 0+0i), and a new quantum state with a subscript value of 3 (amplitude of 0+0i) is calculated, namely:
P 1 =state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2 +
…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0.555553
next, in process 1, the sum of probabilities of a new quantum state with a subscript value of 0 (amplitude of 0+0i), a new quantum state with a subscript value of 1 (amplitude of 0+0i), a new quantum state with a subscript value of 2 (amplitude of 0+0i), and a new quantum state with a subscript value of 3 (amplitude of 0.596285+0i) is calculated, namely:
P 2 =state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2 +
…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0.355555
the probability P of a new quantum state in processes 2 and 3 can be found in the same way 3 And P 4 And will not be described in detail herein.
The probability of each process is shown in table 10, specifically:
table 10: quantum state probability for each process
Process subscript value Quantum state probability for each process
0 P 1 =0.555553
1 P 2 =0.355555
2 P 3 =0
3 P 4 =0
Calculating the sum of probabilities of all processes: p (P) T =P 1 +P 2 +P 3 +P 4 =0.911108。
Will P T To reduce to the root node, a process with a subscript value of 0 can be selected, and a normalization factor is calculated:
the value of the normalization factor 1.04765 is broadcast to each process and acts on each new quantum state, resulting in a normalized new quantum state. For example, for a quantum state with subscript 0 in process 0, the amplitude is 0.745354+0i, and the new quantum state obtained after normalization operation is:
state new [i]=(0.745354+0i)*1.04765=0.780870+0i
Similarly, the new normalized quantum state of other quantum states in each process is calculated in the above manner, and the new normalized quantum state shown in the following table 11 is obtained:
table 11: new quantum state normalized by quantum state in each process
Compared with the prior art, the invention firstly configures N quantum bits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M Setting the value of the first quantum state in the first process as 1 in the processes, and setting a designated noise model for the double-quantum logic gate; and determining a double-quantum logic gate noise operator to be executed through calculation, obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out quantum state transformation operation according to the transformation matrix. Through the implementation method of the noise-containing double-quantum logic gate based on MPI multiprocess, not only is the design error of better simulating physical characteristics of quantum bits in a quantum virtual machine solved, but also the defects that the calculation capacity and the calculation efficiency are greatly reduced along with the increase of the number of the quantum bits due to limited in a single process are overcome, and the noise-containing double-quantum logic gate based on MPI multiprocess is improvedThe computational power and computational efficiency of quantum computation of quantum logic gates.
Example 3:
in order to fully demonstrate the MPI multi-process-based noisy double quantum logic gate implementation method, following example 2 above, example 2 demonstrates the situation when paired quantum states are distributed in two associated processes via CNOT (q [1], q [2 ]), and example 3 demonstrates the situation when paired quantum states are distributed in four associated processes via CNOT (q [2], q [3 ]) on the basis of example 2.
Configuration 4 (i.e. N equals 4) qubits and 2 2 (i.e., M equals 2) MPI communication-based processes, and will be 2 4 The quantum states are equally divided and stored in 2 2 In each process, each of the qubits is numbered as bit n, which is encoded by CNOT (q 1],q[2]) Thereafter, the quantum state distribution in each process is shown in table 12:
table 12: initial distribution of 16 quantum states in 4 processes
As in example 2, n1=2 and n2=3 were found through CNOT (q [2], q [3 ]).
Specifically, 2 < 3, the value of n1 is exchanged with the value of n2, i.e., n1=3, n2=2; and matrix corresponding to CNOTBecome->At this time, 3 > 2 and 2=4-2, i.e. N1 is greater than N2 and N2 is greater than or equal to N-M, the paired quantum states are distributed in four paired processes and the quantum states have the same index value, and it will be understood that if the pairing condition of the specific process number bit is to be determined, the following steps are further required to be executed:
Exemplary, if it is determined that the value of a current process number (T1) is 0, T1 is calculated&2 n2-(N-M) And T1&2 n1-(N-M) Is divided intoAre respectively T1&2 n2-(N-M) =0&1=0 and T1&2 n1-(N-M )=0&2=0, T1&2 n2-(N-M) And T1&2 n1-(N-M) If the value of (2) is equal to 0, the other three process numbers T2, T3, T4 associated with the process number 0 (T1) are respectively determined as:
T2=T1+2 n2-(N-M) =0+1=1;
T3=T1+2 n1-(N-M) =0+2=2;
T4=T1+2 n2-(N-M) +2 n1-(N-M) =0+1+2=3。
by adopting the same principle and method, when the values of the current process number (T1) are respectively 1, 2 and 3, the values of the other three process numbers T2, T3 and T4 associated with the T1 can be calculated respectively, and are not described herein.
Thus, process 0, process 1, process 2 are paired with process 3 and the quantum state index value is the same in the four associated processes.
Quantum states with 0 subscript of course 0 (amplitude 0.780870+0i), 0 subscript of course 1 (amplitude 0+0i), 0 subscript of course 2 (amplitude 0+0i) and 0 subscript of course 3 (amplitude 0+0i) are paired.
Paired quantum states are respectively matched with K 00 After the operation, the quantum state after the operation is obtained as follows:
a 00 =a*K 00 [0]+b*K 00 [1]+c*K 00 [2]+d*K 00 [3]=0.780870
b 00 =a*K 00 [4]+b*K 00 [5]+c*K 00 [6]+d*K 00 [7]=0
c 00 =a*K 00 [8]+b*K 00 [9]+c*K 00 [10]+d*K 00 [11]=0
d 00 =a*K 00 [12]+b*K 00 [13]+c*K 00 [14]+d*K 00 [15]=0
paired quantum states are respectively matched with K 01 After the operation, the quantum state after the operation is obtained as follows:
a 01 =a*K 01 [0]+b*K 01 [1]+c*K 01 [2]+d*K 01 [3]=0
b 01 =a*K 01 [4]+b*K 01 [5]+c*K 01 [6]+d*K 01 [7]=0
c 01 =a*K 01 [8]+b*K 01 [9]+c*K 01 [10]+d*K 01 [11]=0
d 01 =a*K 01 [12]+b*K 01 [13]+c*K 01 [14]+d*K 01 [15]=0
paired quantum states are respectively matched with K 10 After the operation, the quantum state after the operation is obtained as follows:
a 10 =a*K 10 [0]+b*K 10 [1]+c*K 10 [2]+d*K 10 [3]=0
b 10 =a*K 10 [4]+b*K 10 [5]+c*K 10 [6]+d*K 10 [7]=0
c 10 =a*K 10 [8]+b*K 10 [9]+c*K 10 [10]+d*K 10 [11]=0
d 10 =a*K 10 [12]+b*K 10 [13]+c*K 10 [14]+d*K 10 [15]=0
paired quantum states are respectively matched with K 11 After the operation, the quantum state after the operation is obtained as follows:
a 11 =a*K 11 [0]+b*K 11 [1]+c*K 11 [2]+d*K 11 [3]=0
b 11 =a*K 11 [4]+b*K 11 [5]+c*K 11 [6]+d*K 11 [7]=0
c 11 =a*K 11 [8]+b*K 11 [9]+c*K 11 [10]+d*K 11 [11]=0
d 11 =a*K 11 [12]+b*K 11 [13]+c*K 11 [14]+d*K 11 [15]=0
quantum states with a process 0 subscript value of 3 (amplitude 0+0i), a process 1 subscript value of 3 (amplitude 0.624698+0i), a process 2 subscript value of 3 (amplitude 0+0i), and a process 3 subscript value of 3 (amplitude 0+0i) are paired.
Paired quantum states are respectively matched with K 00 After the operation, the quantum state after the operation is obtained as follows:
a 00 =a*K 00 [0]+b*K 00 [1]+c*K 00 [2]+d*K 00 [3]=0
b 00 =a*K 00 [4]+b*K 00 [5]+c*K 00 [6]+d*K 00 [7]=0.558747
c 00 =a*K 00 [8]+b*K 00 [9]+c*K 00 [10]+d*K 00 [11]=0
d 00 =a*K 00 [12]+b*K 00 [13]+c*K 00 [14]+d*K 00 [15]=0
paired quantum states are respectively matched with K 01 After the operation, the quantum state after the operation is obtained as follows:
a 01 =a*K 01 [0]+b*K 01 [1]+c*K 01 [2]+d*K 01 [3]=0
b 01 =a*K 01 [4]+b*K 01 [5]+c*K 01 [6]+d*K 01 [7]=0.279374
c 01 =a*K 01 [8]+b*K 01 [9]+c*K 01 [10]+d*K 01 [11]=0
d 01 =a*K 01 [12]+b*K 01 [13]+c*K 01 [14]+d*K 01 [15]=0
paired quantum states are respectively matched with K 10 After the operation, the quantum state after the operation is obtained as follows:
a 10 =a*K 10 [0]+b*K 10 [1]+c*K 10 [2]+d*K 10 [3]=0
b 10 =a*K 10 [4]+b*K 10 [5]+c*K 10 [6]+d*K 10 [7]=0
c 10 =a*K 10 [8]+b*K 10 [9]+c*K 10 [10]+d*K 10 [11]=0
d 10 =a*K 10 [12]+b*K 10 [13]+c*K 10 [14]+d*K 10 [15]=0
paired quantum states are respectively matched with K 11 After the operation, the quantum state after the operation is obtained as follows:
a 11 =a*K 11 [0]+b*K 11 [1]+c*K 11 [2]+d*K 11 [3]=0
b 11 =a*K 11 [4]+b*K 11 [5]+c*K 11 [6]+d*K 11 [7]=0
c 11 =a*K 11 [8]+b*K 11 [9]+c*K 11 [10]+d*K 11 [11]=0
d 11 =a*K 11 [12]+b*K 11 [13]+c*K 11 [14]+d*K 11 [15]=0
similarly, a quantum state with a process 0 subscript value of 1 (amplitude of 0+0i), a quantum state with a process 1 subscript value of 1 (amplitude of 0+0i), a quantum state with a process 2 subscript value of 1 (amplitude of 0+0i), and a quantum state with a process 3 subscript value of 1 (amplitude of 0+0i) are paired; quantum states with a process 0 subscript value of 2 (amplitude 0+0i), a process 1 subscript value of 2 (amplitude 0+0i), a process 2 subscript value of 2 (amplitude 0+0i) and a process 3 subscript value of 2 (amplitude 0+0i) are paired with K, respectively 00 、K 01 、K 10 、K 11 After the operation, the quantum state after the operation is obtained, and the calculation is not repeated here.
Then, calculate K in Process 0 00 The sum of the probabilities of the calculated quantum states is:
p1=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2
+…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2
=0.609758
computing process 0 via K 01 The sum of the probabilities of the calculated quantum states is:
p2=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2 +
…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0
computing process 0 via K 10 The sum of the probabilities of the calculated quantum states is:
p3=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2 +
…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0
computing process 0 via K 11 The sum of the probabilities of the calculated quantum states is:
p4=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2 +
…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0
the probability distribution of the quantum states corresponding to process 0 can be obtained as follows: { p1, p1+p2, p1+p2+p3, p1+p2+p3+p4} = {0.609758,0.609758,0.609758,0.609758};
next, calculate K in Process 1 00 The sum of the probabilities of the calculated quantum states is:
p1=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2
+…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2
=0.312198
computing process 1 via K 01 The sum of the probabilities of the calculated quantum states is:
p2=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2 +
…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0.078050
computing process 1 via K 10 The sum of the probabilities of the calculated quantum states is:
p3=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2 +
…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0
computing process 1 via K 11 The sum of the probabilities of the calculated quantum states is:
p4=state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2 +
…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0
the probability distribution of the quantum states corresponding to process 1 can be obtained as: { p1, p1+p2, p1+p2+p3, p1+p2+p3+p4} = { [0.312198,0.390248,0.390248,0.390248}.
The probability distributions of the processes 2, 3 can be determined by using the same steps, and are not described in detail here.
In summary, the probability distribution of the corresponding quantum state after each process is operated by the noise operator is as follows:
Process 0: {0.609758,0.609758,0.609758,0.609758}
Process 1: {0.312198,0.390248,0.390248,0.390248}
Process 2: {0,0,0,0}
Process 3: {0,0,0,0}
The probability distribution corresponding to the processes 0, 1, 2 and 3 is reduced to the root node, for example, to the process 0, and the reduced probability distribution is {0.921956,1,1,1}.
Obtaining a random number from the root node, process 0, assuming 0.75, comparing 0.75 with the reduced probability distribution {0.921956,1,1,1}, since 0.75 < 0.921956, determining the noise operator to be performed as K 00 And then K is added with 00 Broadcast to all processes, or noise operator K 00 Broadcast the subscript value 00 of (1) to all processes to transform the unitary matrix corresponding to the CNOT gate according to the preset rule with K 00 Matrix multiplication is carried out on the corresponding noise matrix to obtain a transformation matrix M for executing quantum state operation n The method comprises the following steps:
quantum states with 0 subscript of course 0 (amplitude 0.780870+0i), 0 subscript of course 1 (amplitude 0+0i), 0 subscript of course 2 (amplitude 0+0i) and 0 subscript of course 3 (amplitude 0+0i) are paired, and the paired quantum state a, b, c, d is paired with a transform matrix M n After the operation, a new quantum state is obtained:
a 1 =a*M n [0]+b*M n [1]+c*M n [2]+d*M n [3]=0.780870
b 1 =a*M n [4]+b*M n [5]+c*M n [6]+d*M n [7]=0
c 1 =a*M n [8]+b*M n [9]+c*M n [10]+d*M n [11]=0
d 1 =a*M n [12]+b*M n [13]+c*M n [14]+d*M n [15]=0
Quantum states with a process 0 subscript value of 3 (amplitude 0+0i), a process 1 subscript value of 3 (amplitude 0.624698+0i), a process 2 subscript value of 3 (amplitude 0+0i) and a process 3 subscript value of 3 (amplitude 0+0i) are paired, and the paired quantum state a, b, c, d is paired with a transformation matrix M n After the operation, a new quantum state is obtained:
a 1 =a*M n [0]+b*M n [1]+c*M n [2]+d*M n [3]=0
b 1 =a*M n [4]+b*M n [5]+c*M n [6]+d*M n [7]=0
c 1 =a*M n [8]+b*M n [9]+c*M n [10]+d*M n [11]=0
d 1 =a*M n [12]+b*M n [13]+c*M n [14]+d*M n [15]=0.558747
similarly, a quantum state with a process 0 subscript value of 1 (amplitude of 0+0i), quantum state with a process 1 subscript value of 1 (amplitude 0+0i), quantum state with a process 2 subscript value of 1 (amplitude 0+0i), and quantum state with a process 3 subscript value of 1 (amplitude 0+0i) are paired; quantum states with a process 0 subscript value of 2 (amplitude 0+0i), a process 1 subscript value of 2 (amplitude 0+0i), a process 2 subscript value of 2 (amplitude 0+0i) and a process 3 subscript value of 2 (amplitude 0+0i) are paired, and the paired quantum state a, b, c, d is paired with a transformation matrix M n After the calculation, a new quantum state can be obtained, and the calculation is not repeated here, so that a new quantum state is obtained, as shown in table 13:
table 13: quantum states paired in each process and transformation matrix M n Quantum state after operation
Next, in process 0, the sum of probabilities of a new quantum state with a subscript value of 0 (amplitude of 0.80870+0i), a new quantum state with a subscript value of 1 (amplitude of 0+0i), a new quantum state with a subscript value of 2 (amplitude of 0+0i), and a new quantum state with a subscript value of 3 (amplitude of 0+0i) is calculated, namely:
P 1 =state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2 +…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0.609758
Next, in process 3, the sum of probabilities of a new quantum state with a subscript value of 0 (amplitude of 0+0i), a new quantum state with a subscript value of 1 (amplitude of 0+0i), a new quantum state with a subscript value of 2 (amplitude of 0+0i), and a new quantum state with a subscript value of 3 (amplitude of 0.558747+0i) is calculated, namely:
P 4 =state[0].real 2 +state[0].imag 2 +state[1].real 2 +state[1].imag 2 +
…+state[2 4-2 -1].real 2 +state[2 4-2 -1].imag 2 =0.312198
the process can be calculated by the same methodProbability P of new quantum states in 1 and 2 2 And P 3 And will not be described in detail herein.
The probability of each process is shown in table 14, specifically:
table 14: quantum state probability for each process
Calculating the sum of probabilities of all processes: p (P) T =P 1 +P 2 +P 3 +P 4 =0.921956。
Will P T To reduce to the root node, a process with a subscript value of 0 can be selected, and a normalization factor is calculated:
the value of the normalization factor 1.04147 is broadcast to each process and acts on each new quantum state, resulting in a normalized new quantum state. For example, for the quantum state with subscript 3 in process 3, the amplitude is 0.558747+0i, and the new quantum state obtained after normalization operation is:
state new [i]=(0.558747+0i)*1.04147=0.581918+0i
similarly, the new normalized quantum state of other quantum states in each process is calculated in the above manner, and the new normalized quantum state shown in the following table 15 is obtained:
table 15: new quantum state normalized by quantum state in each process
Compared with the prior art, the invention is firstly configuredN qubits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M Setting the value of the first quantum state in the first process as 1 in the processes, and setting a designated noise model for the double-quantum logic gate; and determining a double-quantum logic gate noise operator to be executed through calculation, obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out quantum state transformation operation according to the transformation matrix. Through the realization method of the noise-containing double-quantum logic gate based on MPI multi-process, not only is the design error of better simulating the physical characteristics of quantum bits in a quantum virtual machine solved, but also the defects that the computing capacity and the computing efficiency are greatly reduced along with the increase of the number of the quantum bits due to the limited in a single process are overcome, and the computing capacity and the computing efficiency of quantum computation based on the noise-containing double-quantum logic gate are improved.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an apparatus for implementing a noise-containing double quantum logic gate based on MPI multiprocessing according to an embodiment of the present invention, which corresponds to the flow shown in fig. 2, may include:
A configuration module 301 for configuring N qubits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M In the processes, the number of each quantum bit is bit n, and the value of a first quantum state in a first process is set to be 1; wherein: n, M is a positive integer, N is more than or equal to 0 and less than or equal to N-1, M is more than or equal to 1, and N is more than or equal to M+2;
a setting module 302, configured to set a double quantum logic gate to a specified noise model;
a determining module 303, configured to determine a double quantum logic gate noise operator that needs to be executed by calculating probabilities that each double quantum logic gate noise operator in the specified noise model corresponds to each other;
the operation module 304 is configured to obtain a transformation matrix based on the two-quantum logic gate noise operator and the two-quantum logic gate, and perform the transform operation of the quantum state according to the transformation matrix by the process.
Compared with the prior artThe invention firstly configures N qubits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M Setting the value of the first quantum state in the first process as 1 in the processes, and setting a designated noise model for the double-quantum logic gate; and determining a double-quantum logic gate noise operator to be executed through calculation, obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out quantum state transformation operation according to the transformation matrix. Through the realization method of the noise-containing double-quantum logic gate based on MPI multi-process, not only is the design error of better simulating the physical characteristics of quantum bits in a quantum virtual machine solved, but also the defects that the computing capacity and the computing efficiency are greatly reduced along with the increase of the number of the quantum bits due to the limited in a single process are overcome, and the computing capacity and the computing efficiency of quantum computation based on the noise-containing double-quantum logic gate are improved.
The embodiment of the invention also provides a storage medium in which a computer program is stored, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
Specifically, in the present embodiment, the above-described storage medium may be configured to store a computer program for executing the steps of:
step S201: configuring N qubits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M In the processes, the number of each quantum bit is bit n, and the value of a first quantum state in a first process is set to be 1; wherein: n, M is a positive integer, N is more than or equal to 0 and less than or equal to N-1, M is more than or equal to 1, and N is more than or equal to M+2.
Step S202: the two-quantum logic gate is set to a specified noise model.
Step S203: and determining the double-quantum logic gate noise operators to be executed by calculating the probability of the corresponding double-quantum logic gate noise operators in the appointed noise model.
Step S204: and obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out the transformation operation of the quantum state by the process according to the transformation matrix.
Specifically, in the present embodiment, the storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
Compared with the prior art, the invention firstly configures N quantum bits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M Setting the value of the first quantum state in the first process as 1 in the processes, and setting a designated noise model for the double-quantum logic gate; and determining a double-quantum logic gate noise operator to be executed through calculation, obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out quantum state transformation operation according to the transformation matrix. Through the realization method of the noise-containing double-quantum logic gate based on MPI multi-process, not only is the design error of better simulating the physical characteristics of quantum bits in a quantum virtual machine solved, but also the defects that the computing capacity and the computing efficiency are greatly reduced along with the increase of the number of the quantum bits due to the limited in a single process are overcome, and the computing capacity and the computing efficiency of quantum computation based on the noise-containing double-quantum logic gate are improved.
The present invention also provides an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
Specifically, the electronic apparatus may further include a transmission device and an input/output device, where the transmission device is connected to the processor, and the input/output device is connected to the processor.
Specifically, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
step S201: configuring N qubits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M In the processes, the number of each quantum bit is bit n, and the value of a first quantum state in a first process is set to be 1; wherein: n, M is a positive integer, N is more than or equal to 0 and less than or equal to N-1, M is more than or equal to 1, and N is more than or equal to M+2.
Step S202: the two-quantum logic gate is set to a specified noise model.
Step S203: and determining the double-quantum logic gate noise operators to be executed by calculating the probability of the corresponding double-quantum logic gate noise operators in the appointed noise model.
Step S204: and obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out the transformation operation of the quantum state by the process according to the transformation matrix.
Specifically, in the present embodiment, the storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
Compared with the prior art, the invention firstly configures N quantum bits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M Setting the value of the first quantum state in the first process as 1 in the processes, and setting a designated noise model for the double-quantum logic gate; and determining a double-quantum logic gate noise operator to be executed through calculation, obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out quantum state transformation operation according to the transformation matrix. Through the realization method of the noise-containing double-quantum logic gate based on MPI multi-process, not only is the design error of better simulating the physical characteristics of quantum bits in a quantum virtual machine solved, but also the defects that the computing capacity and the computing efficiency are greatly reduced along with the increase of the number of the quantum bits due to the limited in a single process are overcome, and the computing capacity and the computing efficiency of quantum computation based on the noise-containing double-quantum logic gate are improved.
While the foregoing is directed to embodiments of the present invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof, and the scope thereof is determined by the claims that follow.

Claims (14)

1. The method for realizing the noise-containing double-quantum logic gate based on MPI multi-process is characterized by comprising the following steps:
configuring N qubits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M In the processes, the number of each quantum bit is bit n, and the value of a first quantum state in a first process is set to be 1; wherein: n, M is a positive integer, N is more than or equal to 0 and less than or equal to N-1, M is more than or equal to 1, and N is more than or equal to M+2;
setting a designated noise model for the double quantum logic gate;
determining a double-quantum logic gate noise operator to be executed by calculating probabilities respectively corresponding to each double-quantum logic gate noise operator in the appointed noise model, wherein the double-quantum logic gate noise operator is determined by tensor product combination calculation of a first preset rule, the probability corresponding to the double-quantum logic gate noise operator is the sum of probabilities of quantum states after the double-quantum logic gate noise operator is operated in the process, and the probability of the quantum states is the square sum of real parts and imaginary parts of the quantum states after the double-quantum logic gate noise operator is operated;
And obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out the transformation operation of the quantum state by the process according to the transformation matrix.
2. The method according to claim 1, wherein the determining the two-quantum logic gate noise operator to be executed by calculating the probability that each two-quantum logic gate noise operator corresponds to each other in the specified noise model comprises:
determining the progress distribution of each pairing quantum state;
according to the noise operators in the appointed noise model, calculating each double-quantum logic gate noise operator through a first preset rule;
for each double-quantum logic gate noise operator, respectively calculating quantum states of paired quantum states in the process after the double-quantum logic gate noise operators are operated;
calculating the probability of quantum states calculated by the double-quantum logic gate noise operator;
reducing probability distribution corresponding to each process to a root node; the probability distribution corresponding to each process is { p1, p1+p2, }, p1 is the probability corresponding to the first two-quantum logic gate noise operator in the process, and p2 is the probability corresponding to the second two-quantum logic gate noise operator;
And comparing the random number with the reduced probability distribution according to the random number acquired by the root node, and determining a double-quantum logic gate noise operator to be executed.
3. The method of claim 2, wherein determining a process distribution for each paired quantum state comprises:
comparing the control bit n1 of the double quantum logic gate with the bit value of the target bit n 2;
if N1 is greater than N2 and N1 is less than N-M, determining that the paired quantum states are distributed in the same process; if the initial quantum state index paired in the same process is i, the quantum state index paired in the same process is { i, i+2 }, respectively n2 ,i+2 n1 ,i+2 n1 +2 n2 0.ltoreq.i.ltoreq.2 M -2 n1 -2 n2 -1;
If N-M is smaller than or equal to N1 and larger than N2, determining two matched associated processes, wherein the matched quantum states are distributed in the two associated processes;
if N1 is greater than N2 and N2 is greater than or equal to N-M, four associated processes of the pairing are determined, wherein the quantum states of the pairing are distributed among the four associated processes.
4. A method according to claim 3, wherein said determining two associated processes of a pairing comprises:
determining the current process number S1 and the process number offset Q 1 =2 n1-(N-M)
According to the current process number S1 and the process number offset Q 1 Determining an intermediate value l=s1&Q 1
If L > 0, the process number S2 paired with the current process number is S1-Q 1
If l=0, the process number S2 paired with the current process number is s1+q 1
5. The method of claim 4, wherein the paired quantum states are distributed across the two associated processes, comprising:
the paired quantum states are uniformly distributed in two paired processes, and the subscript offset of the paired quantum states in one process is Q 2 =2 n2
6. A method according to claim 3, wherein said determining four associated processes of a pairing comprises:
determining a process number as T1;
calculation of T1&2 n2-(N-M) And T1&2 n1-(N-M) Is a value of (2);
if T1&2 n2-(N-M) And T1&2 n1-(N-M) If the values of (2) are greater than 0, the other three process numbers T2, T3, T4 associated with said process number T1 are respectively determined as t2=t1-2 n1-(N-M) -2 n2-(N-M) ,T3=T1-2 n1-(N-M) ,T4=T1-2 n2-(N-M)
If T1&2 n2-(N-M) Has a value of 0 and T1&2 n1-(N-M) And (2) is greater than 0, then with the saidThe other three process numbers T2, T3, T4 associated with the process number T1 are determined as t2=t1-2, respectively n1-(N-M) ,T3=T1-2 n1-(N-M) +2 n2-(N-M) ,T4=T1+2 n2 -(N-M)
If T1&2 n2-(N-M) Is greater than 0 and T1&2 n1-(N-M) If the value of (1) is equal to 0, the other three process numbers T2, T3, T4 associated with said process number T1 are respectively determined as t2=t1-2 n2-(N-M) ,T3=T1-2 n2-(N-M) +2 n1-(N-M) ,T4=T1+2 n1 -(N-M)
If T1&2 n2-(N-M) And T1&2 n1-(N-M) If the value of (2) is equal to 0, the other three process numbers T2, T3, T4 associated with the process number T1 are respectively determined as t2=t1+2 n2-(N-M) ,T3=T1+2 n1-(N-M) ,T4=T1+2 n2-(N-M) +2 n1-(N-M)
7. The method of claim 6, wherein the paired quantum states are distributed across the four associated processes, comprising:
the process numbers T1, T2, T3, and T4 pair with each other and the quantum state subscript is the same in the four associated processes.
8. The method of claim 1, wherein the obtaining a transformation matrix based on the two-quantum logic gate noise operator and the two-quantum logic gate comprises:
broadcasting the noise operator or the operator index of the double quantum logic gate to be executed to all processes;
and performing matrix multiplication operation on the unitary matrix corresponding to the double-quantum logic gate and the matrix corresponding to the double-quantum logic gate noise operator obtained by each process to obtain a transformation matrix for executing quantum state operation.
9. The method of claim 8, wherein said performing, by the process, the transform operation of the quantum state according to the transform matrix comprises:
performing the operation of the paired quantum state and the transformation matrix to obtain a new quantum state;
Respectively calculating the sum of probabilities of all the new quantum states in each process, wherein the probability of the new quantum states is the square sum of the real part and the imaginary part of the new quantum states;
calculating the sum of probabilities in all processes, and calculating a normalization factor based on the sum of the probabilities;
broadcasting the normalization factors to each process and acting on each new quantum state to obtain normalized new quantum states.
10. A method according to claim 3, further comprising:
if n1 is smaller than n2, exchanging the values corresponding to both n1 and n2, converting the unitary matrix corresponding to the double-quantum logic gate according to a second preset rule, and returning to the step of executing the bit value of the control bit n1 and the target bit n2 of the comparison double-quantum logic gate.
11. The method of claim 1, wherein the specifying the noise model comprises:
one of a bit-reversed noise model, a phase-reversed noise model, a bit-phase-reversed noise model, a depolarization noise model, an amplitude damping noise model, and a phase damping noise model.
12. An apparatus for implementing a noise-containing double quantum logic gate based on MPI multiprocessing, comprising:
A configuration module for configuring N qubits and 2 M MPI communication-based process and will be 2 N The quantum states are equally divided and stored in 2 M In the processes, the number of each quantum bit is bit n, and the value of a first quantum state in a first process is set to be 1; wherein: n, M is a positive integer, N is more than or equal to 0 and less than or equal to N-1, M is more than or equal to 1, and N is more than or equal to M+2;
the setting module is used for setting the double-quantum logic gate to a specified noise model;
the determining module is used for determining the double-quantum logic gate noise operators to be executed by calculating the probabilities respectively corresponding to the double-quantum logic gate noise operators in the appointed noise model, wherein the double-quantum logic gate noise operators are determined by tensor product combination calculation of a first preset rule, the probability corresponding to the double-quantum logic gate noise operators is the sum of the probabilities of quantum states which are positioned in the process and operated by the double-quantum logic gate noise operators, and the probability of the quantum states is the square sum of the real part and the imaginary part of the quantum states which are operated by the double-quantum logic gate noise operators;
and the operation module is used for obtaining a transformation matrix based on the double-quantum logic gate noise operator and the double-quantum logic gate, and carrying out the quantum state transformation operation by the process according to the transformation matrix.
13. A storage medium having a computer program stored therein, wherein the computer program is arranged to perform the method of any of claims 1 to 11 when run.
14. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the method of any of the claims 1 to 11.
CN202010263599.3A 2020-04-03 2020-04-03 MPI multi-process-based noise-containing double-quantum logic gate implementation method and device Active CN111461336B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010263599.3A CN111461336B (en) 2020-04-03 2020-04-03 MPI multi-process-based noise-containing double-quantum logic gate implementation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010263599.3A CN111461336B (en) 2020-04-03 2020-04-03 MPI multi-process-based noise-containing double-quantum logic gate implementation method and device

Publications (2)

Publication Number Publication Date
CN111461336A CN111461336A (en) 2020-07-28
CN111461336B true CN111461336B (en) 2023-11-03

Family

ID=71681637

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010263599.3A Active CN111461336B (en) 2020-04-03 2020-04-03 MPI multi-process-based noise-containing double-quantum logic gate implementation method and device

Country Status (1)

Country Link
CN (1) CN111461336B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112101561B (en) * 2020-08-24 2022-10-18 清华大学 Method and device for realizing quantum logic gate
WO2023125857A1 (en) * 2021-12-30 2023-07-06 本源量子计算科技(合肥)股份有限公司 Model training method based on machine learning framework system and related device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009165049A (en) * 2008-01-10 2009-07-23 Nippon Telegr & Teleph Corp <Ntt> Apparatus and method for setting calculation base axis, program and recording medium
CN108780129A (en) * 2016-02-12 2018-11-09 耶鲁大学 Technology and related system for controlling quantized system and method
CN109993309A (en) * 2019-04-09 2019-07-09 合肥本源量子计算科技有限责任公司 A kind of double Quantum logic gates implementation methods based on MPI multi-process
CN110020727A (en) * 2019-04-09 2019-07-16 合肥本源量子计算科技有限责任公司 A kind of single Quantum logic gates implementation method based on MPI multi-process
CN110188885A (en) * 2019-06-28 2019-08-30 合肥本源量子计算科技有限责任公司 A kind of quantum calculation analogy method, device, storage medium and electronic device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7451292B2 (en) * 2002-08-10 2008-11-11 Thomas J Routt Methods for transmitting data across quantum interfaces and quantum gates using same
US10565514B2 (en) * 2016-03-31 2020-02-18 Board Of Regents, The University Of Texas System System and method for emulation of a quantum computer

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009165049A (en) * 2008-01-10 2009-07-23 Nippon Telegr & Teleph Corp <Ntt> Apparatus and method for setting calculation base axis, program and recording medium
CN108780129A (en) * 2016-02-12 2018-11-09 耶鲁大学 Technology and related system for controlling quantized system and method
CN109993309A (en) * 2019-04-09 2019-07-09 合肥本源量子计算科技有限责任公司 A kind of double Quantum logic gates implementation methods based on MPI multi-process
CN110020727A (en) * 2019-04-09 2019-07-16 合肥本源量子计算科技有限责任公司 A kind of single Quantum logic gates implementation method based on MPI multi-process
CN110188885A (en) * 2019-06-28 2019-08-30 合肥本源量子计算科技有限责任公司 A kind of quantum calculation analogy method, device, storage medium and electronic device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
施教芳.量子计算机前瞻:量子门与量子电路模型.微电子技术.2002,(04),全文. *
苏晓琴 ; 王金来 ; 聂合贤 ; 辛俊丽 ; .量子计算与量子逻辑门.运城学院学报.2009,(05),全文. *

Also Published As

Publication number Publication date
CN111461336A (en) 2020-07-28

Similar Documents

Publication Publication Date Title
CN111461335B (en) MPI multi-process-based noise-containing single quantum logic gate implementation method and device
CN111582491B (en) Quantum circuit construction method and device
CN111563599B (en) Quantum circuit decomposition method and device, storage medium and electronic device
CN112633508B (en) Quantum circuit generation method and device, storage medium and electronic device
CN111461336B (en) MPI multi-process-based noise-containing double-quantum logic gate implementation method and device
CN112114776A (en) Quantum multiplication method and device, electronic device and storage medium
CN113222150A (en) Quantum state transformation method and device
CN114511094B (en) Quantum algorithm optimization method and device, storage medium and electronic device
CN113222153B (en) Quantum state simulation method and device, storage medium and electronic device
CN113222151B (en) Quantum state transformation method and device
CN113222157A (en) Quantum simulation method and device, electronic device and storage medium
CN107831823B (en) Gaussian elimination method for analyzing and optimizing power grid topological structure
CN114638366B (en) Quantum address data analysis method and device, storage medium and electronic device
CN114692879B (en) Quantum preprocessing method and device based on sparse linear system
CN114372582B (en) Quantum automatic coding method based on machine learning framework and related device
CN114626532B (en) Method and device for reading data based on address, storage medium and electronic device
CN114372583B (en) Quantum program optimization method based on machine learning framework and related equipment
WO2022110705A1 (en) Qram architecture quantum circuit construction method and apparatus, and quantum address data analysis method and apparatus
CN114819167B (en) Sparse approximate inverse quantum preprocessing method and device for sparse linear system
CN117640074A (en) Data processing method and related equipment based on quantum search algorithm
CN114764618A (en) Quantum preprocessing method and device for linear system
CN118153695A (en) Quantum state preparation method and device
CN115907024A (en) Method and device for constructing quantum program to be mapped and quantum computer
CN116822643A (en) Quantum state preparation method and device
CN114881239A (en) Method and apparatus for constructing quantum generator, medium, and electronic apparatus

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
CB02 Change of applicant information

Address after: 230088 6th floor, E2 building, phase II, innovation industrial park, 2800 innovation Avenue, high tech Zone, Hefei City, Anhui Province

Applicant after: Benyuan Quantum Computing Technology (Hefei) Co.,Ltd.

Address before: 230088 6th floor, E2 building, phase II, innovation industrial park, 2800 innovation Avenue, high tech Zone, Hefei City, Anhui Province

Applicant before: ORIGIN QUANTUM COMPUTING COMPANY, LIMITED, HEFEI

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant