The disclosure relates to the technical field of quantum computing, specifically to a quantum preprocessing method, device, storage medium and electronic device for a linear system.
Solution of a large system of linear equations is an important issue in various scientific and engineering computations. With rapid development of recent computer technologies, large-scale scientific computing has entered the era of large-scale parallel computing, and it is particularly important to conduct researches on efficient parallel algorithms for large-scale linear systems based on parallel computing environments.
Quantum computing is a new type of computing, and the principle thereof is to construct a computing framework with the theory of quantum mechanics. When solving some problems, compared with the optimal classical algorithm, quantum computing has the effect of exponential acceleration. Linear system solving is a kind of problem that can be solved by quantum computing. Quantum computing uses quantum superposition, and has an exponential acceleration effect during solution of linear systems via quantum linear solvers. Therefore, quantum linear solvers are expected to accelerate the solution process of many practical problems in the field of science and engineering.
However, complexity of a quantum linear solver is related to the polynomial of the condition number κ of the linear system. The complexity is expressed as ϑ(poly(κ)). Accordingly, there arises a problem that acceleration performance of quantum computing is under negative influence due to a large condition number of the linear system, causing difficulty on solution of equations thereof. Quantum preprocessing technology is a technology developed to solve the problem. The existing quantum preprocessing technology is too scarce, and no effective universal quantum preprocessing technology has been proposed, and the existing quantum preprocessing technology cannot satisfy different linear systems.
Based on this, it is necessary to implement a quantum preprocessing technology that can satisfy different linear systems, which can be used for the simulation of quantum computing, lower the condition number, and fill in the gaps in related technologies.
An object of the present disclosure is to provide a quantum preprocessing method and device for linear systems to address the deficiencies in the prior art. It can realize a quantum preprocessing technology that can satisfy different linear systems, and is used for simulation of quantum computing, lower the condition number, and fill the technical gap in the field of quantum computing.
According to one aspect of the present disclosure, there is provided a quantum preprocessing method for a linear system, including: acquiring element information of a first matrix A and a first vector b in a linear system Ax={right arrow over (b)}; constructing a new matrix M for linear system preprocessing; computing a second matrix A′ and a second vector b′ for constructing a quantum circuit, according to the new matrix M; and constructing, a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′, and executing a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit.
According to another aspect of the present disclosure, there is provided a quantum preprocessing device for a linear system, including modules for performing each processing in the quantum preprocessing method disclosed herein.
According to another aspect of the present disclosure, there is provided a storage medium having a computer program stored therein, the computer program being configured to perform during execution thereof the method described in any one embodiment of the above.
According to another aspect of the present disclosure, there is provided an electronic device, including a memory having a computer program stored therein, and a processor, configured to execute the computer program to perform the method described in any one embodiment of the above.
Compared with the prior art, the disclosure provides a quantum preprocessing method for a linear system. First, element information of a first matrix A and a first vector b in a linear system Ax={right arrow over (b)}is acquired. Then, a new matrix M for linear system preprocessing is constructed. Next, a second matrix A′ and a second vector b′ for constructing a quantum circuit are computed, according to the new matrix M. Next, a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′ are constructed. Finally, a quantum state evolution operation is executed respectively for the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit. It can be seen that by using the superposition characteristics of quantum, by encoding relevant information of the linear system onto quantum states, a classical data structure is linked with qubit states in the quantum field (that is, the quantum state), a quantum preprocessing technology that can satisfy different linear systems can be realized, which can be used in the simulation of quantum computing, lowers the condition number of linear systems, and fills in the technical gaps in the field of quantum computing.
Embodiments below described with reference to the accompanying drawings are exemplary and for explaining the present invention only, and shall not be construed as limiting the present invention.
Embodiments of the present disclosure firstly provide a quantum preprocessing method for a linear system, which can apply to electronic devices, such as computer terminals, specifically, general computers, quantum computers, and the like.
The embodiments will be described below in detail, taking operation thereof on a computer terminal as an example.
The memory 104 may be configured to store software programs and modules of applications, such as the program instructions/modules corresponding to the implementation of a quantum preprocessing method for a linear system in the embodiment of the present application. The processor 102 runs software programs and modules stored in the memory 104, so as to execute various functional applications and data processing, that is, to realize the above-mentioned methods. The memory 104 may include a high-speed random-access memory, and may also include a non-volatile memory, such as one or more of magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory that is remotely located relative to the processor 102, and these remote memories may be connected to a computer terminal through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is configured to receive or transmit data via a network. The specific example of the above-mentioned network may include a wireless network provided by the communication provider of the computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (Radio Frequency, RF) module, which is configured to communicate with the Internet in a wireless manner.
It should be noted that a real quantum computer is of a hybrid structure, which consists of two parts: one is a classical computer, which functions to execute classical computing and control; the other is a quantum device, which functions to run quantum programs and implements quantum computing. The quantum program is a series of instruction sequences written in a quantum language such as QRunes that can be run on a quantum computer, which supports quantum logic gate operations and finally realizes quantum computing. Specifically, a quantum program is a series of instruction sequences that operate quantum logic gates in a certain sequence.
In practical applications, due to the limitation of the development of quantum device hardware, quantum computing simulations are usually required to verify quantum algorithms, quantum applications, etc. Quantum computing simulation is the process of simulating the operation of quantum programs corresponding to specific problems using a virtual architecture built with the resources of general computers (that is, quantum virtual machines). Typically, quantum programs corresponding to specific problems need to be constructed. The quantum program referred to in the embodiments of the present disclosure is a program written in a classical language that characterizes qubits and their evolution, in which qubits, quantum logic gates, etc. related to quantum computing all have expressions with corresponding classical codes.
As an embodiment of quantum programs, quantum circuits, also known as quantum logic circuits, are the most commonly used general-purpose quantum computing models, which means circuits that operate on qubits under abstract concepts: components thereof include qubits, circuits (timelines), and various quantum logic gates; and results thereof usually need to be read out through quantum measurement operations.
Unlike traditional circuits, which are connected by metal wires to transmit voltage signals or current signals, in quantum circuits, the circuits can be regarded as connected by time, that is, the state of qubits evolves naturally with time. In this process, it follows the instruction of the Hamiltonian operator, and is operated upon its encounter with a logic gate.
A quantum program as a whole corresponds to a total quantum circuit, and the quantum program in the present disclosure refers to the total quantum circuit, wherein the total number of qubits in the total quantum circuit is the same as the total number of qubits in the quantum program. It can be understood that: a quantum program can be consisted of quantum circuits, measurement operations for qubits in quantum circuits, registers for storing measurement results, and control flow nodes (jump instructions). A quantum circuit can contain tens, hundreds or even tens of thousands of quantum logic gate operations. An execution process of a quantum program is the process of executing all quantum logic gates according to a certain time sequence. It is to be noted that “timing” refers to a time sequence in which a single quantum logic gate is executed.
It should be noted that in classical computing, the most basic unit is a bit, and the most basic control mode is a logic gate. The purpose of controlling a circuit can be achieved through the combination of logic gates. Similarly, the way to handle qubits is quantum logic gates. The use of quantum logic gates can make the quantum state evolve. Quantum logic gates are the basis of quantum circuits. Quantum logic gates include single-bit quantum logic gates, such as Hadamard gates (H gates, Hadamard gates), Pauli-X gates (X gate), Pauli-Y gate (Y gate), Pauli-Z gate (Z gate), RX gate, RY gate, RZ gate, etc.; multi-bit quantum logic gates, such as CNOT gate, CR gate, iSWAP Doors, Toffoli doors and more. Quantum logic gates are generally represented by unitary matrices, and unitary matrices are not only in the form of matrices, but also a kind of operation and transformation. Generally, the action of a quantum logic gate on a quantum state is computed by multiplying the left side of the unitary matrix by the matrix corresponding to the right vector of the quantum state.
Those skilled in the art can understand that in a classical computer, the basic unit of information is a bit, a bit having two states of 0 and 1, and the most common physical implementation method is to represent these two states through electric level. In quantum computing, the basic unit of information is the qubit. A qubit also has two states, 0 and 1, recorded as |0 and |1
, nevertheless, it can be in a superposition state of the two states of 0 and 1, which can be expressed as |φ0
=a|0
+b|1
, where “a” and “b” are complex numbers representing amplitudes of the |0
state and the |1
state (probability amplitude), which is not available in classical bits. After measurement, the qubit state will collapse to a definite state (eigenstate, here the |0
state and the |1
state), where the probability of collapsing to |0
is |a|2, and the probability of collapsing to |1
is |b|2, wherein |a|2+|b|2 is the Dirac symbol.
The “quantum state” refers to the qubit state, and its eigenstate is expressed in binary in the quantum algorithm (or quantum program). For example, a group of qubits including q0, q1, and q2 represents the 0th, 1st, and 2nd qubits, arranging from high to low as q2q1q0, the quantum states of this group of qubits being a superposition state of 23 eigenstates. The 8 eigenstates (definite states) are |000, |001
, |010
, |011
, |100
, |101
, |110
, |111
, each eigenstate consistently corresponds to a qubit: taking |000
as an example, where 000 corresponds to q2q1q0 from high to low. In short, a quantum state is a superposition state composed of eigenstates, and it is in one of the definite eigenstates when probability amplitudes of other states are all 0.
S21: Acquiring element information of a first matrix A and a first vector b in a linear system Ax={right arrow over (b)}.
S22: Constructing a new matrix M for linear system preprocessing.
S23: Computing a second matrix A′ and a second vector b′ for constructing a quantum circuit, according to the new matrix M.
S24: Constructing, a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′, and executing a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit.
Referring to
Referring to
S201: Acquiring element information of the first matrix A and the first vector b in a linear system.
Specifically, a linear system is a mathematical model that refers to a system composed of linear operators that satisfies both superposition and uniformity (also known as homogeneity). Nowadays, linear systems function as the core of various scientific and engineering fields.
Exemplarily, acquiring element information of a first matrix A and a first vector b in a linear system Ax={right arrow over (b)} specifically includes acquiring element information and dimensions of the first matrix A and the first vector b respectively. Specifically, for a first matrix A of N*N, and a first N-dimension vector b, output an n-dimension vector x which satisfies Ax={right arrow over (b)}, x=A−1{right arrow over (b)}. Therefore, the first matrix A needs to be an invertible matrix. In addition, as the data of the first vector b needs to be loaded into the quantum circuit as described below, the dimension N of the first vector b needs to be expressed as a positive integer power of 2. If the N does not conform to the form of a positive integer power of 2, then zeros must be padded in the elements of the first vector b until it satisfies the form of a positive integer power of 2. Similarly, dimension information of the first matrix A also needs to conform to the form of a positive integer power of 2; if the zero-padding operation is required, the principle and method are the same as the above-mentioned method of padding zeros in the elements of the first vector b, and is not to be repeatedly described in detail here.
Exemplarily , for a 3*3 first matrix
and a 3-dimensional first vector b=[1,2,3], acquire the element information of the first matrix A and the first vector b. Since the dimensions of the first matrix A and the first vector b do not satisfy the form of a positive integer power of 2, zero padding is required, that is, the first matrix A is to be expanded to a 4*4 matrix:
The first vector b is expanded to a 4-dimensional vector: b=[1,2,3,0].
S202: Constructing a new matrix M for linear system preprocessing according to main diagonal elements of the first matrix A.
Specifically, in an N-order matrix , the N elements positioned on the diagonal line from the upper left corner to the lower right corner is called the main diagonal elements of the N-order matrix.
Exemplarily, according to the main diagonal elements of the first matrix A, a new matrix M for linear system preprocessing is constructed. Following the above example, the first matrix
accordingly, a new matrix
for linear system preprocessing is constructed.
S203: Computing the second matrix A′ and the second vector b′ according to an inverse matrix of the new matrix M, wherein the second matrix A′=M−1A and the second vector b′=M−1b.
Specifically, the first matrix A is an N-order matrix, and if there is another N-order matrix D such that: AD=DA=I, then the first matrix A is said to be invertible, and the matrix D is said to be the inverse matrix of the first matrix A.
Exemplarily, the second matrix A′ and the second vector b′ are computed according to the inverse matrix of the new matrix M. Following the above example, the new matrix
the inverse matrix
Thus, the second matrix
and the second vector b′ can be computed according to the operational relationship between the second matrix A′=M−1A and the second vector b′=M−1b.
S204: Constructing, a first quantum circuit representing a quantum state evolution of a specific class of elements in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of elements in the second vector b′, and executing a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit.
Referring to
S211: Acquiring element information of each specific class of the second matrix A′ and the second vector b′ of the sparse linear system preprocessed by a Neumann polynomial.
A linear system is a mathematical model that refers to a system composed of linear operators that satisfies both superposition and uniformity (also known as homogeneity). Nowadays, linear systems function as the core of various scientific and engineering fields. A sparse linear system is to perform identity transformation on a linear matrix corresponding to the linear system, so that there are as many 0 elements as possible in the matrix. The purpose of doing this is to simplify system design and computing, and it is applicable to numerous fields, such as complex fluid dynamics problems, structural analysis, electromagnetic field computing, and so on.
A Neumann polynomial (or Neumann series) means that if
then I−N is an invertible matrix and satisfies (I−N)−1=I+N+N2+ . . . +Ns=Σk=0∞Nk.
Specifically, before acquiring element information of each specific class of the second matrix A′ and the second vector b′ of the sparse linear system preprocessed by the Neumann polynomial, the method further includes:
S2111: Acquiring element information of the first matrix A and the first vector b in the sparse linear system.
Exemplarily, acquiring element information of the first matrix A and the first vector b in the sparse linear system Ax={right arrow over (b)} specifically includes: acquiring element information and dimensions of the first matrix A and the first vector b respectively. Specifically, for a first matrix A of P*P and a first P-dimension vector b, output a p-dimension vector x which satisfies Ax={right arrow over (b)}, i.e., x=A−1{right arrow over (b)}. Therefore, the first matrix A needs to be an invertible matrix. In addition, as the data of the first vector b needs to be loaded into the quantum circuit as described below, the dimension P of the first vector b needs to be expressed as a positive integer power of 2. If the P does not conform to the form of a positive integer power of 2, then zeros must be padded in the elements of the first vector b until it satisfies the form of a positive integer power of 2. Similarly, dimension information of the first matrix A also needs to conform to the form of a positive integer power of 2; if the zero-padding operation is required, the principle and method are the same as the above-mentioned method of padding zeros in the elements of the first vector b, and is not to be repeatedly described in detail here.
Exemplarily, for a 3*3 first matrix
and a 3-dimensional first vector b=[1,2,3], acquire the element information of the first matrix A and the first vector b. Since the dimensions of the first matrix A and the first vector b do not satisfy the form of a positive integer power of 2, zero padding is required, that is, the first matrix A is to be expanded to a 4*4 matrix:
The first vector b is expanded to a 4-dimensional vector: b=[1,2,3,0].
In a quantum application, by constructing an Oracle or a combination of Oracles, the internal principle of the Oracle or combination is the method flow of the present disclosure. Specifically, an Oracle can be interpreted as a module (similar to a black box) that accomplishes a specific function in a quantum algorithm, wherein specific implementations may apply to specific problems.
Exemplarily, for the first matrix A and the first vector b in the sparse linear system Ax={right arrow over (b)}, given the data readout Oracles of the first matrix A and the first vector b, i.e., OA
OA=|j,f(j,l)
, f(j,l) indicating the column ordinal of the l-th non-zero element in the j-th row of the first matrix A;
OA, =|j, k, Ajk
, Ajk indicating the column ordinal of the non-zero element in the j-th row and the k-th column of the first matrix A;
Ob|0=|b
, wherein
and c is the normalization constant of the first vector b.
S112: Constructing a new matrix D for sparse linear system preprocessing according to main diagonal elements of the first matrix A.
Specifically, in an P-order matrix, the P elements positioned on the diagonal line from the upper left corner to the lower right corner is called the main diagonal elements of the P-order matrix.
Exemplarily, according to the main diagonal elements of the first matrix A, a new matrix D for sparse linear system preprocessing is constructed. Following the above example, the first matrix
accordingly, a new matrix for sparse linear system preprocessing
is constructed.
S2113: Computing the second matrix A′ and the second vector b′ using a Neumann polynomial and the inverse matrix of the new matrix D, wherein the second matrix
the second vector b′=M−1b=[I+N+ . . . +Ns]D−1b, ω is a scaling parameter, s is an integer greater than 0, and N is an invertible matrix and satisfies N=I −ωD−1A.
Specifically, the first matrix A is an P-order matrix, and if there is another P-order matrix Q such that: AQ=QA=I, then the first matrix A is said to be invertible, and the matrix Q is said to be the inverse matrix of the first matrix A.
Exemplarily, the second matrix A′ and the second vector b′ are computed according to the inverse matrix of the new matrix D. Following the above example, the new matrix
wherein, the second matrix
the second vector b′=M−1b =[I+N+ . . . +Ns]D−1b, M−1≡[I+N+ . . . +Ns]D−1, ω is a scaling parameter, for example ω=0.01, s is an integer greater than 0, and N is an invertible matrix and satisfies N=I−ωD−1A.
Optionally, in one embodiment, N1=I−ωA , ω is a scaling parameter, satisfying:
ωA=I−(I−ωA)=I−N1
Then, (ωA)−1=[I−(I−ωA)]−1=I+N1+N12+. . . +N1s.
In another implementation, ωA can also be expressed as ωA=D−(D−ωA),
where D is a matrix represented by the diagonal elements of the first matrix A.
(ωA)−1=[D(I−(I−ωD−1A))]−1=[I−(I−ωD−1A)]−1D−1.
Let N2=I−ωD−1A, then
(ωA)−1≈M−1≡[I+N2+N22+ . . . +N2s]D−1
because D−1A=ω−1[I−N2], then
M
−1
A=[I+N
2
+N
2
2
+ . . . +N
2
s
]D
−1
A
Finally got:
S212: Constructing, a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′, and executing a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit.
Specifically, the specific class of element in the second matrix A′ may be non-zero elements; and a first quantum circuit representing a quantum state evolution of a specific class of elements of the second matrix A′ and a second quantum circuit representing a quantum state evolution of a specific class of elements of the second vector b′ are constructed, wherein the first quantum circuit includes a first Oracle and a second Oracle.
The first Oracle is configured to extract position information of the non-zero elements in the second matrix A′, so as to encode the column ordinal of the l-th non-zero element in the j-th row of the second matrix A′ onto qubits of the first quantum circuit, wherein the first Oracle is O′A
O′
A
|j,l
=|j,f(j,l)
wherein the f(j,l) is a column ordinal of the l-th non-zero element in the j-th row of the second matrix A′; and encode the serial number of a non-zero element in a corresponding target row among all non-zero elements in this row onto a group of qubits, to realize quantum state transformation: |j,l→|j,f(j,l)
; wherein a transformed quantum state includes column ordinal information in the second matrix A′.
In an embodiment, a form of the quantum state after the first Oracle can be as follows:
Abbreviated as:
k=f(j,l) wherein, j is the target value, indicating the j-th row of the matrix; ⊗ means tensor product or tensor multiplication; d is the total number of non-zero elements in the j-th row; l is the ordinal of the non-zero element among all non-zero elements in the j-th row, indicating the l-th non-zero element, and the qubits corresponding to |k may be defined as the first bits.
According to matrix information and column subscript information in the second matrix A′, determine the element value of the non-zero element, and encode the element value onto a group of qubits , that is, to encode the element information of the k-th column and the j-th row of the second matrix A′ onto the qubits of the first quantum circuit.
Specifically, the second Oracle is configured to extract element information of the non-zero elements in the second matrix A′, so as to encode the element information of the k-th column and the j-th row of the second matrix A′ onto the qubits of the first quantum circuit. The second Oracle is O′A
O′
A
|j,k,0=|j,k,A′jk
wherein, the A′jk is the non-zero element in the k-th column and the j-th row of the second matrix A′.
In an embodiment, the second Oracle is implemented in the following way:
|j,k,0|0
→|j,k,Ajk
|Ajj
→|j,k,Ajk/Ajj
|Ajj
|j,k,Ajk/Ajj
|0
wherein, the Ajk is a non-zero element in the k-th column and the j-th row of the first matrix A, and the Ajj is a non-zero element on the main diagonal of the first matrix.
In an optional implementation, first of all, you may acquire 2 groups of qubits with initial states thereof being 0 states; express in binary the k-th column and the j-th row of the first matrix A; encode them respectively onto a group of qubits corresponding to the number of columns and the number of rows of the first matrix A, to obtain a quantum state |j,k,0 expressed in binary, wherein the qubits corresponding to the 0 state here are used for subsequent encoding of binary element values.
Then, encode information of the non-zero elements in the k-th column and the j-th row of the current first matrix A onto qubits corresponding to the 0 state of |j, k, 0, and encode non-zero elements on the main diagonal of the first matrix A onto another group of qubits, to obtain the quantum state |j,k,Ajk
|Ajj
expressed in binary. According to the same method and principle, continue to execute quantum state evolution operations: execute division operation on the Ajk in the state |j,k,Ajk
and the Ajj in the state |Ajj
, obtaining |j,k,Ajk/Ajj
|Ajj
, and finally restore the |Ajj
state to |0
, thus obtaining the quantum state |j,k,Ajk/Ajj
|0
of the evolved qubits, wherein the Ajk/Aj,j is the non-zero element A′jk in the k-th column and j-th row of the second matrix A′.
Exemplarily, following the above example, the first matrix
the new matrix
and the second matrix
wherein A32=2, A33=2
In another optional implementation, first of all, you may acquire one group of qubits with initial states thereof being 0 states; express in binary the k-th column and the j-th row of the second matrix A′, and encode them respectively onto a group of qubits corresponding to the number of columns and the number of rows of the second matrix A′, to obtain a quantum state |j,k,0 expressed in binary, wherein the qubits corresponding to the 0 state here are used for subsequent encoding of binary element values. Then, encode information of the non-zero elements in the k-th column and the j-th row of the current second matrix A′ onto qubits corresponding to the 0 state of |j,k,0
, so as to acquire the quantum state |j,k,A′jk
expressed in binary.
In another implementation, the form of the quantum state after the second Oracle can be as follows:
wherein A′jk is the value of the non-zero element in the k-th column and the j-th row of the matrix. In order to distinguish the qubits, the qubits corresponding to |A′jk can be defined as the second bits.
It should be noted that, if A′jk is a complex number, the real part and the imaginary part thereof may be encoded on the second bits, that is |A′jk=|real
|imag
, wherein “real” means the real part, and “imag” means the imaginary part; if A′jk is written in Euler form “reiθ”, the information of the r and the θ can be encoded to the second bits, i.e., |A′jk
=|r
|θ
.
The quantum state
after the second Oracle undergoes a predetermined transformation. The form |ψj of the final state after the transformation is predetermined by the user, that is, the specific quantum state that the user wishes to obtain, which is used in the field of quantum random walk technologies to solve the problems of Hamiltonian Simulation, linear equation solutions, etc. The predetermined form of the quantum state |ψj
may be:
wherein , the A′jk* is the conjugate of the value of the non-zero element in the k-th column and the j-th row of the second matrix A′, and the A′max is the value of the element with the largest absolute value in the second matrix A′.
It should be noted that, “to encode onto the quantum state of the qubit” specifically refers to encode onto the right vector of the quantum state. such as in the above |ψj form. A quantum state is described as a combination of a vertical line and an angle bracket, indicating that the quantum state is a vector (called the state vector, base vector, etc.), |ψj
means a right vector, and
|ψj| means a left vector.
In addition, it should be noted that: Given that the first matrix is
According to OA=|j,f(j,l)
and OA
=|j,k,Ajk
, it is possible to build:
O
N
|j,l
=|j,f
N(j,l)) and ON=|j,k,Njk|
when j≠fN(j,l), ON
wherein, the Ajk is the non-zero element at the k-th column and the j-th row of the second matrix A, and the Ajj is the non-zero element on the main diagonal of the second matrix A.
In an optional implementation, first of all, you may acquire 3 groups of qubits with initial states thereof being 0 states; express in binary the k-th column and the j-th row and −ω in the second matrix A, encode them onto a group of qubits corresponding to the number of columns and the number of rows of the second matrix A and a group of qubits with the state thereof being −ω state, to obtain a quantum state |j,k,0|0
|−ω
expressed in binary, wherein the qubits corresponding to the 0 state here are used for subsequent encoding of binary element values.
Then, encode information of the non-zero element in k-th column and the j-th row of the current second matrix A onto qubits in |j,k,0 corresponding to the 0 state, and encode non-zero elements on the main diagonal of the second matrix to another group of qubits corresponding to the 0 state, to obtain the quantum state |j,k,Ajk
|Ajj
|−ω
expressed in binary. According to the same method and principle, continue to execute quantum state evolution operations: execute division operation on the Ajk in the state |j,k,Ajk
and the Ajj in the state |Ajj
, to obtain |j,k,Ajk/Ajj
|0
|−ω
. Further continue to execute quantum state evolution operations: execute multiplication operation on the Ajk/Ajj in the |j,k,Ajk/Ajj
and the −ω
in the state |−ω, to obtain |j,k,−ωAjk/Ajj
|0
|−ω
, finally restore the state |−ω
into |0
, and obtain the quantum state of the evolved qubit as |j,k,−ωAjk/Ajj
|0
|0
.
when j=fN(j,l), ON=|j,j
, ON
=|j.j,1−ω
.
Construct Ns+1 according to ON
Specifically, first of all, in the first quantum circuit, construct the (s+1)-th power of N via quantum multiplication, then compute I−Ns+1 via quantum subtraction, and finally obtain the quantum state evolution result of the
via quantum division, thereby constructing the first matrix A′. It should be noted that the four quantum arithmetic operations are currently widely researched and applied technologies, and specific implementation process of operations of the first matrix A′ will not be described here.
Specifically, the second quantum circuit includes a third Oracle , which is Ob′ and is configured to realize:
wherein, the c′ is a normalization constant of the second vector b′, and the s is the number of elements of the second vector b′. The “Normalization” is to restrain the data to be processed to be within a preset value after processing, for example, to normalize the values of m elements so that the sum of the squares of all element values is 1. Its purpose is to facilitate subsequent data processing, and also to ensure improved efficiency of data encoding.
The third Oracle is configured to extract element information of the second vector b′, so as to encode the element information of the second vector b′ onto the qubits of the second quantum circuit, wherein the amplitudes of quantum state on the qubits in the encoded second quantum circuit are in one-to-one correspondence with the elements of the normalized second vector b′.
For example, b′=[b1,b2,b3,b4], then encode the data of the second vector b′ on the quantum state amplitudes, to obtain:
thereby realizing: data of the second vector b′ is loaded onto the amplitudes of quantum state of 2 qubits in the quantum circuit , and the amplitudes of the quantum state on the qubits in the second quantum circuit after encoding are in one-to-one correspondence with the elements of the normalized second vector b′.
In a quantum application, by constructing an Oracle or a combination of Oracles, the internal principle of the Oracle or combination is the method flow of the present disclosure. Specifically, an Oracle can be interpreted as a module (similar to a black box) that accomplishes a specific function in a quantum algorithm, wherein specific implementations may apply to specific problems.
At present, typically, existing quantum circuit constructions can only use the existing single quantum logic gate , double quantum logic gate, etc. , usually there are the following problems:
In the case of quantum circuits with relatively complex functions, a great number of qubits will be required. If a classical computer is used for simulation, a huge memory space will be consumed, and a great number of logic gates will be required, and thus the simulation can be very time-consuming. Moreover, it is difficult to implement some complex algorithms with quantum circuits.
Based on this, by using Oracle simulation, specific complex functions as well as controlled and transposed conjugate operations are realized. The parameters input by the user to the Oracle can include: Oracle name (configured to identify the functional purpose of the Oracle, such as Ob′), qubits, matrix elements, etc.
The advantage of this method is to use Oracle as a known module as a whole, and there is no need to pay attention to its internal implementation details. In quantum application scenarios such as the expression of quantum circuits, it is very simple and clear. Since the Oracle functional modules of classical simulation can be equivalent to quantum logic gates, the quantum circuits constructed can be simplified, thus saving memory space required for operation and speeding up simulation verification of quantum algorithms.
Referring to
S221: Acquiring respectively information of the first matrix A and the first vector b in a sparse linear system.
A linear system is a mathematical model that refers to a system composed of linear operators that satisfies both superposition and uniformity (also known as homogeneity) . Nowadays, linear systems function as the core of various scientific and engineering fields. A sparse linear system is to perform identity transformation on a linear matrix corresponding to the linear system, so that there are as many 0 elements as possible in the matrix. The purpose of doing this is to simplify system design and computing , and it is applicable to numerous fields, such as complex fluid dynamics problems, structural analysis, electromagnetic field computing, and so on .
Exemplarily, acquiring element information of the first matrix A and the first vector b in the sparse linear system Ax=b specifically includes: acquiring element information and dimensions of the first matrix A and the first vector b respectively. Specifically, for a first matrix of one P*P and a first P-dimension vector b, output a p-dimension vector x which satisfies Ax=b, i.e., x=A−1b. Therefore, the first matrix A needs to be an invertible matrix. In addition, as the data of the first vector b needs to be loaded into the quantum circuit as described below, the dimension P of the first vector b needs to be expressed as a positive integer power of 2. If the P does not conform to the form of a positive integer power of 2, then zeros must be padded in the elements of the first vector b until it satisfies the form of a positive integer power of 2. Similarly, dimension information of the first matrix A also needs to conform to the form of a positive integer power of 2; if the zero-padding operation is required, the principle and method are the same as the above-mentioned method of padding zeros in the elements of the first vector b, and is not to be repeatedly described in detail here.
Exemplarily, a 4-dimensional first vector b=[1,2,3,4].
It should be noted that in complex application scenarios or fields of sparse linear systems, such as fluid dynamics, electromagnetic field computing , etc., the dimensions of the above-mentioned first matrix are relatively large, and the computing thereof is relatively complicated. Therefore, in order to clearly illustrate the solution of this application, here only the above-mentioned simplified example is used for illustration, which is convenient for understanding.
S222: Constructing, according to the first matrix A, a sparse approximation matrix M used for sparse linear system preprocessing, wherein the sparse approximation matrix M is a sparse approximation of A−1 and satisfies a preset sparse structure J.
Specifically, let N={1,2,3, . . . , n}, J⊂N×N represent a given sparse structure. The sparse approximation inverse preprocessing technology aims to explicitly constructing a sparse approximation for A−1, the most basic premise thereof is that: given a first sparse matrix A, there is a sparse approximation matrix M in a certain sense for A−1, so that M≈A−1. The key to the success of the algorithm is how to quickly capture the position information of large elements of A−1 so as to determine the sparse structure of M.
It should be noted that the sparse approximation inverse preprocessing technique of F-norm minimization computes the sparse approximation M of A−1 by minimizing the residual matrix ∥AM −I|F, wherein M satisfies a certain sparse structure (M is either given in advance, or is dynamically determined during the execution of the algorithm). According to characteristics of a F-norm of a matrix, minimization of ∥AM−I∥F can be transformed into solving independently n Least Squares problems, and has naturally parallel characteristics. However, for a typical first matrix A, it is often difficult to pre-determine a reasonable and valid sparse structure for M: when there are only a few large elements in A−1, it may be ineffective to capture position information of a priori structure; alternatively, only when a priori structure is very dense, a M of higher degree of approximation can be acquired at the expense of computing and storage. In order to overcome the above difficulties, a strategy of dynamically determining the sparse structure of M is proposed: this strategy generally starts from a simple initial structure (such as a structure of an identity matrix, or a structure of a first matrix A after sparsification), and then gradually expands according to certain rules or adjusts in an adaptive way, until the residual matrix satisfies a given precision ∥AM−I∥F≤ϵ, where ϵ represents a preset precision value, or a predetermined maximum value that the number of non-zero elements of M has reached.
Specifically, constructing a sparse approximation matrix M for sparse linear system preprocessing according to the first matrix A, includes:
S2221: determining a sparse structure Jk of the k-th column of the sparse approximation matrix M, and a non-zero row index set Ik representing the first matrix A(▪, Jk), wherein the Jk is an n-dimensional vector set, the Jk={i|(i,k)ϵJ}, JϵN×N and represents the preset sparse structure;
Specifically, in the preset sparse structure J, construct: an n-dimensional vector set with a sparse structure thereof being Jk, considering the k-th column of M, let Jk represent a non-zero column index set of A(Ik,▪), and A(Ik,▪) represent a submatrix consisting of rows corresponding to indexes in Ik; and a non-zero row index set Ik of the first matrix A(▪, Jk), where A(▪, Jk) represents a submatrix consisting of rows corresponding of indexes in Jk, and Jk={i|(i,k)ϵJ}.
S2222: constructing a third matrix Ak according to the non-zero row index set Ik and the Jk, wherein the Ak=A(Ik, Jk);
Exemplarily, following the above example, obtain a 4*4 first matrix A in the sparse linear system:
It can be seen that, in the case of k=2, then Jk=[1,2]. obtaining Ik=[1,2,3] according to the matrix A. Construct a third matrix Ak, let n1=|Ik| be the number of elements of the instruction set |Ik|; similarly, let n2=|Jk|, Ak=A(Ik,Jk), then the least squares problem is simplified to a small-scale n1×n2 unconstrained least squares problem.
S2223: Computing {tilde over (m)}k=(AkTAk)−1AkT{tilde over (e)}k according to the third matrix Ak, and constructing a sparse approximation matrix M=(m1, m2, . . . , mk, . . . , mn) for sparse linear system preprocessing, wherein {tilde over (e)}k=ek(Ik), the ek represents an identity matrix, and the mk is determined by {tilde over (m)}k=mk(Jk).
Specifically, the sparse approximate matrix M=(m1, m2, . . . , mk, . . . , mn), then:
∥AM−I∥F2=Σk=1n∥(AM−I)ek∥22=Σk=1n∥Amk−ek∥22
That is to say, the above problem can be decomposed into n independent Least Squares problems with constraints, which can be processed in parallel, where minm
According to Ak=A(Ik,Jk), the Least Squares problems are simplified to a small-scale n1×n2 unconstrained Least Squares problem:
min{tilde over (m)}
wherein, R is the Real Number Set, {tilde over (m)}k=mk(Jk), {tilde over (e)}k=ek(Ik), ek representing the identity matrix.
The first matrix A is non-singular, and the third matrix Ak has full rank. Therefore, to solve the above Least Squares problem, a compact QR decomposition of the third matrix Ak can be performed according to the modified Gram-Schmidt orthogonalization process, i.e.,
A
k
=QR
wherein, R is a non-singular n2×n2 upper triangular matrix, Q is a column-orthogonal matrix, satisfying QT=Q−1. Let {tilde over (c)}=QT{tilde over (e)}k, then have {tilde over (m)}k=R−1{tilde over (c)}, get {tilde over (m)}k=R−1QT{tilde over (e)}k=(AkTAk)−1AkT{tilde over (e)}k, and thereby get the sparse approximation M of A−1.
S223: respectively constructing quantum circuits representing quantum state evolutions of specific classes of elements in the second matrix A′ and the second vector b′ in the sparse linear system, and respectively executing quantum state evolution operations to obtain quantum states of the quantum circuits after evolution, where the second matrix A′=MA, and the second vector b′=Mb.
In a quantum application, by constructing an Oracle or a combination of Oracles, the internal principle of the Oracle or combination is the method flow of the present disclosure. Specifically, an Oracle can be interpreted as a module (similar to a black box) that accomplishes a specific function in a quantum algorithm, wherein specific implementations may apply to specific problems.
Exemplarily, for the first matrix A and the first vector b in the sparse linear system Ax=b, given Oracles OA
OA=|j,f(j,l)
, where f(j,l) indicates the column ordinal of the l-th non-zero element in the j-th row of the first matrix A;
OA=|j,k,Ajk
, where Ajk indicates the column ordinal of [SW1][SW2][SW3] the non-zero element in the k-th column and in the j-th row of the first matrix A;
OA=|j,g(j,l)
, where g(j,l) indicates the row ordinal of the l-th non-zero element in the j-th column of the first matrix A; and
Ob|0=|b
, where
and c is the normalization constant of the first vector b.
Constructing quantum circuits representing quantum state evolutions of specific classes of elements in the second matrix A′ in the sparse linear system, specifically includes:
Constructing Oracle OA′=|j,f′(j,l)
, and the Oracle OA′
=|j,k,A′jk
, and the f′(j,l) is the column ordinal of the l-th non-zero element in the j-th row of the second matrix A′, the Ajk is the non-zero element in the k-th column and in the j-th row of the second matrix A′, and k=f′(j,l).
Specifically, the Oracle OA′=|j,f′(j,l)
.
wherein, ordinals of each non-zero element among all the non-zero elements in the corresponding target row of the second matrix A′ are encoded into a group of qubits, so as to realize quantum state transformation: |j,l→|j,f′(j,l)
; wherein, the transformed quantum state contains the column ordinal information in the second matrix A′.
In an embodiment, the form of the quantum state after Oracle OA′
Abbreviated as:
wherein, j is the target value, indicating the j-th row of the matrix; ⊗ means tensor product or tensor multiplication; d is the total number of non-zero elements in the j-th row; l is the ordinal of a non-zero element among all non-zero elements in the j-th row, indicating the l-th non-zero element, and the qubits corresponding to |k may be defined as the first bits.
According to the matrix information and column subscript information in the second matrix A′, determine the element value of a non-zero element, and encode the element value onto a group of qubits, that is, to encode the element information of the k-th column and the j-th row of the second matrix A′ onto the qubits of the quantum circuit.
Specifically, the Oracle OA′
The Oracle OA′
O
A′
|j,k,0=|j,k, A′jk
In an optional implementation, first of all, you may acquire one group of qubits with initial states thereof being 0 states; express in binary the k-th column and the j-th row of the second matrix A′; encode them respectively onto a group of qubits corresponding to the number of columns and the number of rows of the second matrix A′; to obtain a quantum state |j,k,0 expressed in binary, wherein the qubits corresponding to the 0 state here are used for subsequent encoding of binary element values. Then, encode information of the non-zero element in the k-th column and the j-th row of the current second matrix A′ onto qubits corresponding to the 0 state of |j,k,0
so as to obtain a quantum state |j,k,A′jk
so expressed in binary.
In another implementation, the form of the quantum state after Oracle OA′
wherein , A′jk is the value of the non-zero element in the k-th column and the j-th row of the matrix. In order to distinguish the qubits, qubits corresponding to |A′jk may be defined as the second bits.
It should be noted that, if A′jk is a complex number, the real part and the
imaginary part thereof may be encoded on the second bits, that is |A′jk=|real
|imag
, wherein “real” means the real part, and “imag” means the imaginary part ; if A′jk is written in Euler form “reiθ”, the information of the r and the θ can be encoded to the second bits, i.e., |A′jk
=|r
|θ
.
The quantum state
after the Oracle OA′ of the final state after the transformation is predetermined by the user, that is, the specific quantum state that the user wishes to obtain, which is used in the field of quantum random walk technologies to solve the problems of Hamiltonian Simulation, linear equation solutions, etc. The predetermined form of the quantum state |Ψj
may be:
wherein, the A′jk* is the conjugate of the value of the non-zero element in the k-th column and the j-th row of the second matrix A′, and the A′max is the value of the element with the largest absolute value in the second matrix A′.
It should be noted that, given the second matrix A′=MA, the {tilde over (m)}k is to be implemented by an operator Uk constructing the quantum circuit: Uk|j|0
=|j
|{tilde over (m)}k,j
, wherein the Uk specifically implements evolution of the following quantum states:
|k|j
|0
|0
→|k
|j
|Ak
|0
→|k
|j
|Ak
|{tilde over (m)}kj
|k
|j
|0
|{tilde over (m)}kj
.
Specifically, {tilde over (m)}k=({tilde over (m)}k1, . . . , {tilde over (m)}kn
In an optional implementation, first of all, you may acquire four groups of qubits with initial states thereof being 0 states; express in binary the k-th column and the j-th row of the third matrix Ak, and encode them respectively onto a group of qubits corresponding to the number of columns and the number of rows of the third matrix Ak, to obtain a quantum state |k|j
|0
|0
expressed in binary, wherein the qubits corresponding to the 0 state here are used for subsequent encoding of binary element values.
Then, encode information of the non-zero elements in the k-th column and the j-th row of the current third matrix Ak onto qubits corresponding to the 0 state of |k|j
|Ak
|Ak
|0
, to obtain the quantum state |k
|j
|Ak
|Ak
|0
expressed in binary. According to the same method and principle, continue to execute quantum state evolution operations: obtain |k
|j
|Ak
|{tilde over (m)}kj
, and finally restore the |Ak
state to |0
, thus obtaining the quantum state |k
|j
|0
|{tilde over (m)}kj
of the evolved qubits.
It should be noted that the above method is a quantum static method of constructing a sparse approximate inverse, while a quantum dynamic method of constructing a sparse approximate inverse is similar to the above method, the difference therebetween is that iteration is required for a quantum dynamic method of constructing a sparse approximate inverse. For example, in the 0-th iteration, you may construct an operation U(0) for extracting a sparse structure of M(0) and elements thereof. Assuming that the iteration has been executed for h times, an operation U(h) for extracting a sparse structure of M(h) and elements thereof has been obtained. Next, the (h+1)-th iteration will be executed. When a new sparse structure is being determined, the U(h) and the abovementioned Oracle need to be repeatedly called. Since the U(h) is derived from u(h−1) and the abovementioned Oracle, the number of calls to the U(0) and the abovementioned Oracle increases exponentially with the number of iterations. When the number of iterations is set to a certain constant, the quantum preprocessing process for sparse approximate inverse of a sparse linear system can also be achieved.
It should be noted that, in the above process, it is assumed that the k-th column mk(h) of M(h) is being constructed. Select Jk(0) to be the initial sparse structure of mk(h), and the sparse structure of mk(h) becomes Jk(h) after h times of paddling. Define Ik(h) to be an index set of non-zero rows corresponding to A(▪,Jk(h)). Let Ak=A(Ik(h), Jk(h)), {tilde over (e)}k=ek(Ik(h)), assume {tilde over (m)}k(h) to be the solution of the Least Squares problem, and the corresponding residual is
r
k
=Am
k
(h)
−e
k
where the norm of rk is exactly equal to the norm of {tilde over (r)}k=Ak{tilde over (m)}k(h)−{tilde over (e)}k.
If ∥rk∥2>ϵ, define Lk={i|rk(i)≠0}, let Nk be the index set of non-zero columns corresponding to A(Lk▪), define
Ĵ
k
=N
k
\J
k
(h)
which constitutes the candidate index set for the next padding, where the method for padding Jk(h) can be as follows:
For each one jϵĴk, consider a one-dimensional optimization problem:
minμj∥rk+μjAej∥2
whose solution may be obtained as:
wherein ej is a unit vector for the j-th column, and μj is a variable intermediate parameter.
The 2-norm ρj of the new residual rk+μjAej satisfies:
Select an index j corresponding to several smallest ρj in the set Ĵk as the most favorable index, and pad it into Jk(h) to get Jk(h+1). (a small ρj indicates that elements with the index j are effective on reduction of rk, that is, the j also needs to be added into Jk)
Constructing a quantum circuit representing quantum state evolutions of specific classes of elements in the second vector b′ in the sparse linear system, including:
Constructing an Oracle Ob′ for extracting element information of the second vector b′, so as to encode the element information of the second vector b′ onto qubits of the quantum circuit, wherein amplitudes of quantum states on the qubits of the quantum circuit after encoding are in one-to-one correspondence with elements of the second vector b′ after normalization.
the Oracle Ob′ is configured to implement:
wherein the c′ is a normalization constant of the second vector b′, and the s is a number of elements of the second vector b′.
It should be noted that the “Normalization” is to restrain the data to be processed to be within a preset value after processing, for example, to normalize the values of r elements so that the sum of the squares of all element values is 1. Its purpose is to facilitate subsequent data processing, and also to ensure improved efficiency of data encoding.
For example, b′=[b1, b2, b3, b4], then, encode the data of the first vector b′ onto the quantum state amplitudes, to obtain:
thereby realizing: data of the second vector b′ is loaded onto the amplitudes of quantum state of 2 qubits in the quantum circuit , and the amplitudes of the quantum state on the qubits in the quantum circuit after encoding are in one-to-one correspondence with the elements of the normalized second vector b′.
It should be noted that: given Oracles OA
Specifically, it can be seen from the formula WnT|b=TΓn(M)|b
+|⊥b
and |0m
|b
→|0m
⊥n(M)|b
+|Φ⊥
that, when n=1 and m=1, the formula can be transformed into WT|b
=TΓ(M)|b
+|⊥b
and |0
|b
→|0
Γ(M)|b
+Φ⊥
, where |Γ⊥
is a non-normalized quantum state, π|Φ⊥)=0 and π:=|0
0|⊗I. Therefore, in order to construct Mb via quantum walk, it is only necessary to construct the operators W and T.
Referring to into |Ψj
. In addition, a matrix taking the Module T as an input is obtained as an N-order matrix, where the N in the upper [log2 N] at |j
represents the number of rows, and the N in the lower [log2 N] represent the number of columns, and the other representations are the same as above. The constructed module T can be equivalent to a quantum logic gate in the quantum circuit, with its matrix form being Σj ϵ[N]|Ψj
j|, where
j| a left vector of the quantum state.
Specifically, use the H gate to construct a superposition state:
OF implements the transformation:
OH implements the transformation:
M1 implements the transformation:
finally, once again call the OH to perform the transpose conjugate operation, recycle the qubits encoding the A′jk, and then output |Ψj.
It should be noted that this schematic diagram only shows some of the quantum circuits related to this application, and the reference signs and connection relationships in the figure are only examples and do not constitute restriction to the present invention.
Referring to
In this application, the inverse matrix is found, which satisfies O(∥A−1−F∥)=ϵ. The linear combination is:
g(x) is 2ϵ,
where Dκ:=(−1, −1/κ)∪(1/κ, 1). 2j+1(x) is a Chebyshev polynomial of the first kind.
Quantum walks: In order to implement Chebyshev polynomials, it needs to be performed in the framework of quantum walks.
Since the quantum walk is executed on some states |φj in the space
2N⊗
2N, a mapping is defined T:=Σjϵ[N]|φj
j|, from
N to
2N⊗
2N.
and a walk operator is defined:
W=S(2TT†−I)
The inversion operation of the product state in the |φj is executed by the operator S, thus obtaining:
T
†
W
n
T|b
=|0m)n(H)|b
+|⊥b
n(λ) is a Chebyshev polynomial of the first kind.
Exemplarily, as shown in
Accordingly, TT†=|jj|⊗|ϕj
ϕj|. The operator T is a unitary operator in the quantum circuit, and it turns |j
|0
into |ψj
. It is different from the dimension 4N2×2N of T:−ΣjϵN|ψj
j|. For distinction, configured to define the quantum circuit: Tqc
T
qc(Σj|jj|⊗(2|0
0|−I2N))Tqc†=Σj|
j|⊗(2|ϕj
ϕj|−I2N)=2TT†−I4N
Also, K=2|00|−I2N.
At present, typically, existing quantum circuit constructions can only use the existing single quantum logic gate, double quantum logic gate, etc., usually there are the following problems:
In the case of quantum circuits with relatively complex functions, a great number of qubits will be required. If a classical computer is used for simulation, a huge memory space will be consumed, and a great number of logic gates will be required, and thus the simulation can be very time-consuming. Moreover, it is difficult to implement some complex algorithms with quantum circuits.
Based on this, by using Oracle simulation, specific complex functions as well as controlled and transposed conjugate operations are realized. The parameters input by the user to the Oracle can include: Oracle name (configured to identify the functional purpose of the Oracle, such as Ob′), qubits, matrix elements, etc.
The advantage of this method is to use Oracle as a known module as a whole, and there is no need to pay attention to its internal implementation details. In quantum application scenarios such as the expression of quantum circuits, it is very simple and clear. Since the Oracle functional modules of classical simulation can be equivalent to quantum logic gates, the quantum circuits constructed can be simplified, thus saving memory space required for operation and speeding up simulation verification of quantum algorithms.
Referring to
Specifically, in the schematic diagram of the quantum circuit shown in into |Ψj
. In addition, a matrix taking the Module T as an input is obtained as an N-order matrix. The constructed Module T can be equivalent to a quantum logic gate in the quantum circuit, with its matrix form being Σjϵ[N]|Ψ
j|, where
j| is a left vector of the quantum state. The quantum circuit as shown in
to |b′
, alternatively, the quantum circuit as shown in
to |D−1b
.
Construct Ne, (e=1,2,3, . . . , s), according to ON=[I+N+ . . . +N s]D−1|b
.
Specifically, first of all, in the second quantum circuit, construct the s-th power of N via quantum multiplication, then compute I+N+ . . . +Ns via quantum addition, thereby constructing a quantum evolution result of the second vector b′ on the second quantum circuit. It should be noted that the four quantum arithmetic operations are currently widely researched and applied technologies, and specific implementation process of operations of the second vector b′ will not be described here.
A quantum Oracle is a “Black Box” that represents a certain transition of a quantum state. A typical example of a quantum Oracle is a linear system: O|x|0
=|x
|f(x)
, where the computation of f(x) takes the first quantum register as input and the second quantum register as output. Another example is that a QRAM can be viewed as a kind of Oracle. Many quantum algorithms use Oracles, but they don't care about the implementation of Oracles. An Oracle may be decomposed into quantum gates, and may also implement QRAMs. In QPanda, you may use the “Oracle” function to define it. The “Oracle” is considered to be a user-provided name.
It can be seen that the present application encodes matrix and vector information of a linear system onto quantum states, links classical data structure with the quantum state in the quantum field, and performs evolution operations for encoding a classical data structure onto quantum states to obtain an evolved quantum state of the quantum circuit, which can take advantage of the quantum superposition characteristics to accelerate solution of linear systems with large condition numbers and expand the simulation application scenarios of quantum computing.
Compared with the prior art, this disclosure provides a quantum preprocessing method for a linear system. First of all, element information of a first matrix A and a first vector b in a linear system is acquired. Then, a new matrix for linear system preprocessing is constructed according to the main diagonal elements of the first matrix A. Next, a second matrix A′ and a second vector b′ for constructing a quantum circuit are computed, according to the inverse matrix of the new matrix M. Next, a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′ are constructed. Finally, a quantum state evolution operation is executed respectively for the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit. It can be seen that by using the superposition characteristics of quantum, by encoding relevant information of the linear system onto quantum states, a classical data structure is linked with qubit states in the quantum field (that is, the quantum state), a quantum preprocessing technology that can satisfy different linear systems can be realized, which can be used in the simulation of quantum computing, lowers the condition number of linear systems, and fills in the technical gaps in the field of quantum computing.
In addition, compared with prior art, the disclosure further provides a quantum preprocessing method based on a sparse linear system. First of all, acquire element information of each specific class of the second matrix A′ and the second vector b′ of the sparse linear system preprocessed by a Neumann polynomial. Then, construct a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′, and executing a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit. It can be seen that by using the superposition characteristics of quantum, by encoding relevant information of the sparse linear system onto quantum states, a classical data structure is linked with qubit states in the quantum field (that is, the quantum state), a quantum preprocessing technology that can satisfy sparse linear systems can be realized, which can be used in the simulation of quantum computing, reduces the condition number of sparse linear systems, and fills in the technical gaps in the field of quantum computing.
In addition, compared with the prior art, the present disclosure provides a sparse approximate inverse quantum preprocessing method for a sparse linear system. First of all, acquire information of the first matrix A and the first vector b in a sparse linear system. Then, construct, according to the first matrix A, a sparse approximation matrix M used for sparse linear system preprocessing, wherein the sparse approximation matrix M is a sparse approximation of A−1 and satisfies a preset sparse structure J. Next, respectively construct quantum circuits representing quantum state evolutions of specific classes of elements in the second matrix A′ and the second vector b′ in the sparse linear system, respectively executing quantum state evolution operations, and obtaining the quantum states of the quantum circuits after evolution, where the second matrix A′=MA, and the second vector b′=Mb. By using the quantum superposition characteristics, a sparse approximate inverse quantum preprocessing method for a sparse linear system is realized, which is used for the simulation of quantum computing, reduces the condition number of sparse linear systems, and fills the technical gaps in related technologies.
Referring to
For example, a quantum preprocessing device may be configured to perform the processing in the method shown in
For example, the quantum preprocessing device can also be configured to perform the processing in the method shown in
A constructing module 602, configured to construct a new matrix M for linear system preprocessing according to main diagonal elements of the first matrix A;
A computing module 603, configured to compute a second matrix A′ and a second vector b′ according to an inverse matrix of the new matrix M, wherein the second matrix A′=M−1A, and the second vector b′=M−1b;
A executing module 604, configured to construct, a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′, and executing a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit. Specifically, the specific class of element are non-zero elements.
Specifically, the executing module includes a first Oracle module and a second Oracle module:
the first Oracle module is configured to extract position information of non-zero elements in the second matrix A′, so as to encode a column ordinal of the l-th non-zero element in the j-th row of the second matrix A′ onto qubits of the first quantum circuit; and
the second Oracle module is configured to extract element information of non-zero elements in the second matrix A′, so as to encode element information of an element in the k-th column and the j-th row of the second matrix A′ onto qubits of the first quantum circuit.
Specifically, the first Oracle module is an O′A
O′
A
|j,l
=|j,f(j,l)
O′A=|j,k,A′jk
wherein, the f(j,l) is a column ordinal of the l-th non-zero element in the j-th row of the second matrix A′, and the A′jk is a non-zero element in the k-th column and the j-th row of the second matrix A′.
Specifically, the second Oracle module is implemented in the following way:
wherein the A′jk is a non-zero element in the k-th column and the j-th row of the first matrix A, and the Ajj is a non-zero element on the main diagonal of the first matrix A.
Specifically, the executing module also includes a third Oracle module:
the third Oracle is configured to extract element information of the second vector b′, so as to encode the element information of the second vector b′ onto qubits of the second quantum circuit, wherein amplitudes of quantum states on the qubits of the second quantum circuit after encoding are in one-to-one correspondence with elements of the second vector b′ after normalization.
Specifically, the third Oracle is Ob′, configured to implement:
wherein the c′ is a normalization constant of the second vector b′, and the s is a number of elements of the second vector b′.
Compared with the prior art, this disclosure provides a quantum preprocessing method for a linear system. First of all, acquire element information of a first matrix A and a first vector b in the linear system. Then, construct a new matrix M for linear system preprocessing according to main diagonal elements of the first matrix A. Next, compute a second matrix A′ and a second vector b′ according to an inverse matrix of the new matrix M. Finally, construct a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′ and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′, and execute a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit. It can be seen that by using the quantum superposition characteristics, and by encoding relevant information of a linear system onto quantum states, a classical data structure is linked with the qubit state in the quantum field, that is, the quantum state, a quantum preprocessing technology that can satisfy different linear systems can be realized, which is used for the simulation of quantum computing, reduces the condition number of sparse linear systems, and fills the technical gaps in related technologies.
For example, the quantum preprocessing device can also be configured to perform the processing in the method shown in
For example, an acquiring module 601, configured to acquire element information of each specific class of the second matrix A′ and the second vector b′ of the sparse linear system preprocessed by a Neumann polynomial;
A constructing module 602, configured to construct, a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′, and execute a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit.
Specifically, the specific class of element are: non-zero elements.
Specifically, before the acquiring module, the device also includes:
An information acquiring module, configured to acquire element information of the first matrix A and the first vector b in the sparse linear system;
A matrix constructing module, configured to construct a new matrix D for sparse linear system preprocessing according to main diagonal elements of the first matrix
A;
A computing module, configured to compute the second matrix A′ and the second vector b′ using a Neumann polynomial and the inverse matrix of the new matrix D, wherein the second matrix
the second vector b′=M−1b=[I+N+ . . . +Ns]D−1b, ω is a scaling parameter, s is an integer greater than 0, and N is an invertible matrix and satisfies N=ωD−1A.
Specifically, the constructing module includes a first Oracle and a second Oracle:
the first Oracle is configured to extract position information of non-zero elements in the second matrix A′, so as to encode a column ordinal of the l-th non-zero element in the j-th row of the second matrix A′ onto qubits of the first quantum circuit; and
the second Oracle is configured to extract element information of non-zero elements in the second matrix A′, so as to encode element information of an element in the k-th column and the j-th row of the second matrix A′ onto qubits of the first quantum circuit.
Specifically, the first Oracle module is an OA′
O
A′
|j,l
=|j,f′(j,l
O
A′
|j,k,0=|j,k,A′jk
wherein, the f(j,l)is a column ordinal of the l-th non-zero element in the j-th row of the second matrix A′, and the A′jk is a non-zero element in the k-th column and the j-th row of the second matrix A′.
Specifically, the constructing module includes a third Oracle module:
The third Oracle is configured to extract element information of the second vector b′, so as to encode the element information of the second vector b′ onto qubits of the second quantum circuit, wherein amplitudes of quantum states on the qubits of the second quantum circuit after encoding are in one-to-one correspondence with elements of the second vector b′ after normalization.
Specifically, the third Oracle module is an O h l module configured to implement:
O
b′|0=|b′
=1/c′Σtb′t|t
wherein the c′ is a normalization constant of the second vector b′, and the s is a number of elements of the second vector b′.
Compared with the prior art, this disclosure provides a quantum preprocessing method for a linear system. Firstly, acquire element information of each specific class of the second matrix A′ and the second vector b′ of the sparse linear system preprocessed by a Neumann polynomial. Then construct, a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′, and execute a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit. It can be seen that by using the superposition characteristics of quantum, by encoding relevant information of the sparse linear system onto quantum states, a classical data structure is linked with the qubit state in the quantum field, that is, the quantum state, and a quantum preprocessing technology that can satisfy the sparse linear system is realized, which is used for the simulation of quantum computing, lowers the condition number of sparse linear systems, and fills in the technical gap in the field of quantum computing.
For example, the quantum preprocessing device may be a sparse approximate inverse quantum preprocessing device of a sparse linear system, and may also be configured to perform the processing in the method shown in
An acquiring module 501, configured to acquire respectively information of the first matrix A and the first vector b in a sparse linear system;
A constructing module 502, configured to construct, according to the first matrix A, a sparse approximation matrix M used for sparse linear system preprocessing, wherein the sparse approximation matrix M is a sparse approximation of A−1 and satisfies a preset sparse structure J.
A constructing module 503, configured to respectively construct quantum circuits representing quantum state evolutions of specific classes of elements in the second matrix A′ and the second vector b′ in the sparse linear system, and respectively execute quantum state evolution operations to obtain the quantum states of the quantum circuits after evolution, where the second matrix A′=MA, and the second vector b′=Mb.
Specifically, the specific class of elements are: non-zero elements.
Specifically, the executing module includes:
A first extraction module, configured to construct Oracle OA′=|j,f′(j,l)
, and the Oracle OA′
=|j,k,A′jk
, and the f′(j, l) is the column ordinal of the l-th non-zero element in the j-th row of the second matrix A′, the Ajk is the non-zero element in the k-th column and in the j-th row of the second matrix A′, and k=f′(j,l).
Specifically, the executing module includes:
A second extraction module, configured to construct an Oracle Ob′ for extracting element information of the second vector b′, so as to encode the element information of the second vector b′ onto qubits of the quantum circuit, wherein amplitudes of quantum states on the qubits of the quantum circuit after encoding are in one-to-one correspondence with elements of the second vector b′ after normalization.
Specifically , the second extraction module includes an Oracle Ob′ module, which is configured to realize:
wherein the c′ is a normalization constant of the second vector b′, and the s is a number of elements of the second vector b′.
Specifically , the constructing module include:
A first constructing unit, configured to determining a sparse structure Jk of the k-th column of the sparse approximation matrix M, and a non-zero row index set Ik representing the first matrix A(▪, Jk), wherein the Jk is an n-dimensional vector set, the Jk={i|(i,k)ϵJ}, J⊂N×N, and represents the preset sparse structure;
A second constructing unit, configured to construct a third matrix Ak according to the non-zero row index set Ik and the Jk, wherein the Ak=A(Ik,Jk);
A third constructing unit, configured to compute {tilde over (m)}k=(AkTAk)−1AkT{tilde over (m)}k according to the third matrix Ak, and construct a sparse approximation matrix M=(m1, m2, . . . , mk, . . . , mn) for sparse linear system preprocessing, wherein {tilde over (e)}k=ek(Ik), the ek represents an identity matrix, and the mk is determined by {tilde over (m)}k=mk(Jk).
Specifically , the third construction unit includes:
An implementation unit, configured to implement the {tilde over (m)}k by an operator Uk obtained from quantum circuit construction by quantum arithmetic operations: Uk|j|0
=|j
|{tilde over (m)}kj
, and the Uk is specifically configured to implement the following quantum state evolution:
|k|j
|0
|0
→|k
|j
|Ak
|0
→|k
j
|Ak
|{tilde over (m)}kj
→|k
|0
|{tilde over (m)}kj
.
Compared with the prior art, the present disclosure provides a sparse approximate inverse quantum preprocessing method for a sparse linear system. First of all, acquire respectively information of the first matrix A and the first vector b in a sparse linear system. Then construct, according to the first matrix A, a sparse approximation matrix M used for sparse linear system preprocessing, wherein the sparse approximation matrix M is a sparse approximation of A−1 and satisfies a preset sparse structure J. Next, respectively construct quantum circuits representing quantum state evolutions of specific classes of elements in the second matrix A′ and the second vector b′ in the sparse linear system, and respectively execute quantum state evolution operations to obtain the quantum states of the quantum circuits after evolution, where the second matrix A′=MA, and the second vector b′=Mb. It can be seen that by using the superposition characteristics of quantum, a sparse approximate inverse quantum preprocessing method for a sparse linear system is realized, which is used for the simulation of quantum computing, lowers the condition number of sparse linear systems, and fills in the technical gap in related technologies.
An embodiment of the present disclosure further provides a storage medium, having a computer program stored therein, the computer program being configured to perform during execution thereof steps in any one of the abovementioned method embodiments.
Specifically, in this embodiment, the above-mentioned storage medium may be configured to store a computer program for performing the following steps:
S201: Acquiring element information of a first matrix A and a first vector b in a linear system;
S202: Constructing a new matrix M for linear system preprocessing according to main diagonal elements of the first matrix A.
S203: Computing the second matrix A′and the second vector b′ according to an inverse matrix of the new matrix M, wherein the second matrix A′=M−1A and the second vector b′=M−1b.
S204: Constructing, a first quantum circuit representing a quantum state evolution of a specific class of elements in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of elements in the second vector b′, and executing a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit.
An embodiment of the present disclosure further provides a storage medium, having a computer program stored therein, the computer program being configured to perform during execution thereof steps in any one of the abovementioned method embodiments.
Specifically, in this embodiment, the above-mentioned storage medium may be configured to store a computer program for performing the following steps:
S211: Acquiring element information of each specific class of the second matrix A′ and the second vector b′ of the sparse linear system preprocessed by a Neumann polynomial.
S212: Constructing, a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′, and executing a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit.
In addition, for example, the above-mentioned storage medium may be configured to store a computer program for performing the following steps:
S201: acquiring respectively information of the first matrix A and the first vector b in a sparse linear system;
S202: construct, according to the first matrix A, a sparse approximation matrix M used for sparse linear system preprocessing, wherein the sparse approximation matrix M is a sparse approximation of A -1 and satisfies a preset sparse structure J.
S203:respectively construct quantum circuits representing quantum state evolutions of specific classes of elements in the second matrix A′ and the second vector b′ in the sparse linear system, and respectively execute quantum state evolution operations to obtain the quantum states of the quantum circuits after evolution, where the second matrix A′=MA, and the second vector b′=Mb.
Specifically, in this embodiment, the above-mentioned storage medium may include various media that can store computer programs but not limited to: U disk, read-only memory (Read-Only Memory, ROM for short), random access memory (Random Access Memory, RAM for short), mobile hard disk, magnetic disks, or optical disks, etc.
Compared with the prior art, this disclosure provides a quantum preprocessing method for a linear system. First of all, acquire element information of a first matrix A and a first vector b in the linear system. Then, construct a new matrix M for linear system preprocessing according to main diagonal elements of the first matrix A. Next, compute a second matrix A′ and a second vector b′ according to an inverse matrix of the new matrix M. Finally, construct a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′ and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′, and execute a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit. It can be seen that by using the quantum superposition characteristics, and by encoding relevant information of a linear system onto quantum states, a classical data structure is linked with the qubit state in the quantum field, that is, the quantum state, a quantum preprocessing technology that can satisfy different linear systems can be realized, which is used for the simulation of quantum computing, lowers the condition number of sparse linear systems, and fills the technical gaps in related technologies.
In addition, compared with the prior art, the present disclosure provides a quantum preprocessing method based on a sparse linear system. Firstly, acquire element information of each specific class of the second matrix A′ and the second vector b′ of the sparse linear system preprocessed by a Neumann polynomial. Then, construct a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′ and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′, and execute a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit. It can be seen that by using the quantum superposition characteristics, and by encoding relevant information of a linear system onto quantum states, a classical data structure is linked with the qubit state in the quantum field, that is, the quantum state, a quantum preprocessing technology that can satisfy different linear systems can be realized, which is used for the simulation of quantum computing, reduces the condition number of sparse linear systems, and fills the technical gaps in related technologies.
In addition, compared with the prior art, the present disclosure provides a sparse approximate inverse quantum preprocessing method. First of all, acquire respectively information of the first matrix A and the first vector b in a sparse linear system. Then construct, according to the first matrix A, a sparse approximation matrix M used for sparse linear system preprocessing, wherein the sparse approximation matrix M is a sparse approximation of A−1 and satisfies a preset sparse structure J. Next, respectively construct quantum circuits representing quantum state evolutions of specific classes of elements in the second matrix A′ and the second vector b′ in the sparse linear system, and respectively execute quantum state evolution operations to obtain the quantum states of the quantum circuits after evolution, where the second matrix A′=MA, and the second vector b′=Mb. By using the superposition property of quantum, a sparse approximate inverse quantum preprocessing method for a sparse linear system is realized, which is used for the simulation of quantum computing, lowers the condition number of sparse linear system, and fills the gap in related technologies.
An embodiment of the present disclosure also provides an electronic device, including a memory having a computer program stored therein, and a processor, configured to execute the computer program to perform the steps in any one of the abovementioned method embodiments.
Specifically, the electronic device may further include a transmission device and an I/O device, wherein the transmission device is connected to the processor, and the I/O device is connected to the processor.
Specifically, in this embodiment, the above-mentioned processor may be configured to execute the following steps through a computer program:
S201: Acquiring element information of the first matrix A and the first vector b in a linear system;
S202: Constructing a new matrix M for linear system preprocessing according to main diagonal elements of the first matrix A;
S203: Computing the second matrix A′and the second vector b′ according to an inverse matrix of the new matrix M, wherein the second matrix A′=M−1A and the second vector b′=M−1b;
S204: Constructing, a first quantum circuit representing a quantum state evolution of a specific class of elements in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of elements in the second vector b′, and executing a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit.
Compared with the prior art, this disclosure provides a quantum preprocessing method for a linear system. First of all, acquire element information of the first matrix A and the first vector b in a linear system. Then, construct a new matrix M for linear system preprocessing according to main diagonal elements of the first matrix A. Next, compute the second matrix A′and the second vector b′ according to an inverse matrix of the new matrix M. Finally, construct a first quantum circuit representing a quantum state evolution of a specific class of elements in the second matrix A′ and a second quantum circuit representing a quantum state evolution of a specific class of elements in the second vector b′, and execute a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit. It can be seen that by using the superposition characteristics of quantum, by encoding the relevant information of the linear system onto quantum states, a classical data structure is linked with qubit states in the quantum field, that is, the quantum state, a quantum preprocessing technology that can satisfy different linear systems can be realized, which can be used in the simulation of quantum computing, lowers the condition number of linear systems, and fills in the technical gaps in the field of quantum computing.
Optionally, in this embodiment, the above-mentioned processor may be configured to execute the following steps through a computer program:
S201: Acquiring element information of each specific class of the second matrix A′ and the second vector b′ of the sparse linear system preprocessed by a Neumann polynomial;
S202: Constructing, a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′, and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′, and executing a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit, to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit.
Compared with the prior art, the disclosure provides a quantum preprocessing method based on a sparse linear system. Firstly, acquire element information of each specific class of the second matrix A′ and the second vector b′ of the sparse linear system preprocessed by a Neumann polynomial. Then construct a first quantum circuit representing a quantum state evolution of a specific class of element in the second matrix A′ and a second quantum circuit representing a quantum state evolution of a specific class of element in the second vector b′, and execute a quantum state evolution operation respectively on the first quantum circuit and the second quantum circuit to obtain an evolved quantum state of the first quantum circuit and an evolved quantum state of the second quantum circuit. It can be seen that by using the quantum superposition characteristics, and by encoding relevant information of a linear system onto quantum states, a classical data structure is linked with the qubit state in the quantum field, that is, the quantum state, a quantum preprocessing technology that can satisfy sparse linear systems can be realized, which is used for the simulation of quantum computing, lowers the condition number of sparse linear systems, and fills the technical gaps in related technologies.
Optionally, in this embodiment, the above-mentioned processor may also be configured to execute the following steps through a computer program:
S201: acquiring respectively information of the first matrix A and the first vector b in a sparse linear system;
S202: constructing, according to the first matrix A, a sparse approximation matrix M used for sparse linear system preprocessing, wherein the sparse approximation matrix M is a sparse approximation of A−1 and satisfies a preset sparse structure J.
S203: respectively constructing quantum circuits representing quantum state evolutions of specific classes of elements in the second matrix A′ and the second vector b′ in the sparse linear system, and respectively executing quantum state evolution operations to obtain the quantum states of the quantum circuits after evolution, where the second matrix A′=MA, and the second vector b′=Mb.
Compared with the prior art, the present disclosure provides a sparse approximate inverse quantum preprocessing method for a sparse linear system. Firstly, acquire respectively information of the first matrix A and the first vector b in a sparse linear system. Then construct according to the first matrix A, a sparse approximation matrix M used for sparse linear system preprocessing, wherein the sparse approximation matrix M is a sparse approximation of A−1 and satisfies a preset sparse structure J. Next, respectively construct quantum circuits representing quantum state evolutions of specific classes of elements in the second matrix A′ and the second vector b′ in the sparse linear system, and respectively execute quantum state evolution operations to obtain the quantum states of the quantum circuits after evolution, where the second matrix A′=MA, and the second vector b′=Mb. By using the quantum superposition characteristics, a quantum preprocessing technology that can satisfy sparse linear systems can be realized, which is used for the simulation of quantum computing, lowers the condition number of sparse linear systems, and fills the technical gaps in related technologies.
The structures, features and effects of the present disclosure have been described in detail above based on the embodiments shown in the drawings. Those described above are only preferred embodiments of the present disclosure, however, the present disclosure does not limit the scope of implementation as shown in the drawings. Changes made to the idea of the present invention, or modifications to equivalent embodiments that are equivalent changes, are still within the spirit covered by the description and drawings shall fall within the protection scope of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
202011633352.2 | Dec 2020 | CN | national |
202011637102.6 | Dec 2020 | CN | national |
202110122930.4 | Jan 2021 | CN | national |
The disclosure is a National Stage of International Application No. PCT/CN2021/142565, filed on Dec. 29, 2021, which claims priority to: Chinese patent application No. 202011637102.6, entitled “QUANTUM PREPROCESSING METHOD AND DEVICE FOR LINEAR SYSTEMS”, filed on Dec. 31, 2020; Chinese patent application No. 202011633352.2, entitled “QUANTUM PREPROCESSING METHOD AND DEVICE BASED ON SPARSE LINEAR SYSTEM”, filed on Dec. 31, 2020; and Chinese patent application No. 202110122930.4, entitled “SPARSE APPROXIMATE INVERSE QUANTUM PREPROCESSING METHOD AND DEVICE FOR SPARSE LINEAR SYSTEMS”, filed on Jan. 29, 2021; all of which are hereby incorporated by reference in their entireties.
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2021/142565 | 12/29/2021 | WO |