Method and device for processing data

Through the unitary transformation and Hermi operator measurement technology of quantum computers, quantum circuits are simplified, and the problem of large resource consumption and long time when traditional computers process data is solved, and fast and low-complexity data processing is achieved, which is suitable for machine learning and other field.

CN112884153BActive Publication Date: 2024-11-22HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911208970.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-30
Publication Date
2024-11-22
Estimated Expiration
2039-11-30

AI Technical Summary

Technical Problem

The prior art consumes a lot of computing resources and takes a long time to process data, making it difficult to quickly obtain task results. Especially in the field of machine learning, traditional computers are difficult to efficiently process complex data.

Method used

The quantum computer uses unitary transformation and Hermi operator to measure the target quantum state, simplify the quantum circuit, reduce the computational complexity, and achieve rapid task results.

Benefits of technology

It realizes rapid processing of data on quantum computers, simplifies quantum circuits, reduces computing complexity, improves processing efficiency, and is suitable for machine learning and other fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112884153B_ABST
    Figure CN112884153B_ABST
Patent Text Reader

Abstract

The present application relates to the field of quantum computers, and provides a method and related device for processing data, the method comprising: a quantum computer generates an initial state corresponding to the first part of the data of a target task through a first quantum circuit; the quantum computer performs a unitary transformation on the initial state through a second quantum circuit corresponding to a target operator to obtain a target quantum state, wherein the target operator corresponds to the second part of the data of the target task, and the target operator includes a first diagonal matrix and a second diagonal matrix; the quantum computer measures the first part of the target quantum state to obtain a measurement result; the quantum computer uses a Hermitian operator to measure the second part of the target quantum state to obtain the result of the target task when the measurement result meets a predetermined condition. The above technical solution can quickly obtain the result of the task to be processed, and the implementation complexity is low.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of quantum computers, and more specifically, to methods and related devices for processing data. Background Art

[0002] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making. Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, basic AI theory, etc.

[0003] Machine learning is a means of achieving artificial intelligence. The general process of machine learning is to first use training data to obtain a model, and then input the data to be processed into the model to obtain the processing results. However, usually, the amount of training data is very large, requiring a large amount of computing resources to process, and it takes a long time.

[0004] Quantum computing is a new computing model that follows the laws of quantum mechanics to control quantum information units for computing. Compared with traditional general-purpose computers, its theoretical model is a universal Turing machine; the theoretical model of a general-purpose quantum computer is a universal Turing machine reinterpreted using the laws of quantum mechanics. From the perspective of computable problems, quantum computers can only solve problems that traditional computers can solve, but from the perspective of computing efficiency, due to the existence of quantum mechanics superposition, some currently known quantum algorithms are faster than traditional general-purpose computers in processing problems. Summary of the invention

[0005] The present application provides a method and related device for processing data, which can quickly obtain task results and have low implementation complexity.

[0006] In a first aspect, an embodiment of the present application provides a method for processing data, including: a quantum computer generates an initial state corresponding to a first part of data of a target task through a first quantum circuit; the quantum computer performs a unitary transformation on the initial state through a second quantum circuit corresponding to a target operator to obtain a target quantum state, wherein the target operator corresponds to the second part of data of the target task, and the target operator includes a first diagonal matrix and a second diagonal matrix; the quantum computer measures the first part of the target quantum state to obtain a measurement result; and when the measurement result satisfies a predetermined condition, the quantum computer uses a Hermitian operator to measure the second part of the target quantum state to obtain a result of the target task.

[0007] The above technical solution uses a quantum computer to process data and can quickly obtain task results. In addition, when the quantum computer processes the data, the operator used for unitary transformation includes a diagonal matrix. This can simplify the quantum circuit, reduce the complexity of quantum computing, and reduce the workload of the quantum computer.

[0008] In combination with the first aspect, in a possible implementation of the first aspect, the second part of data is a sparse matrix. In the case where the second part of data is a sparse matrix, the above technical solution can obtain the result of the target task more quickly.

[0009] In combination with the first aspect, in a possible implementation of the first aspect, the initial state includes a first initial state element, a second initial state element, and a third initial state element, the first initial state element is a constant term |b> determined based on the first part of the data, the second initial state element corresponds to the first diagonal matrix, and the third initial state element corresponds to the second diagonal matrix.

[0010] In combination with the first aspect, in a possible implementation of the first aspect, the initial state is Where |b> is the first initial element, is the second initial element, is the third initial state element, where m represents the sequence number of the vector corresponding to the second initial state element, m' represents the sequence number of the vector corresponding to the third initial state element, L is 2 to the Pth power, T is 2 to the Qth power, and P and Q are positive integers greater than or equal to 1.

[0011] In combination with the first aspect, in a possible implementation manner of the first aspect, the target operator is Where j represents the imaginary unit, γ represents the calculation parameter, is the square of the second part of the data, represents the Kronecker product, the first diagonal matrix is ​​a 2L+1 square matrix, and the second diagonal matrix is ​​a 2T+1 square matrix.

[0012] In combination with the first aspect, in a possible implementation of the first aspect,

[0013]

[0014]

[0015] In combination with the first aspect, in a possible implementation of the first aspect, the target quantum state is Where L is 2 raised to the Pth power, T is 2 raised to the Qth power, P and Q are positive integers greater than or equal to 1, γ represents the calculation parameter, and λ i represents the i-th eigenvalue of the second part of the data, b i represents the i-th element in the constant term |b> determined based on the first part of the data, e i represents the i-th basis vector, m represents the serial number of the vector corresponding to the second initial state element in the initial state, m' represents the serial number of the vector corresponding to the third initial state element in the initial state, i is a positive integer greater than or equal to 1 and less than or equal to W, |b> includes W elements, and W is a positive integer greater than or equal to 1.

[0016] In combination with the first aspect, in a possible implementation manner of the first aspect, the measurement result φ and γλ that meet the preset condition i , T and L have the following relationship:

[0017] In combination with the first aspect, in a possible implementation of the first aspect, the use of the Hermitian operator to measure the second part of the target quantum state to obtain the result of the target task includes: using the Hermitian operator to measure the second part of the target quantum state multiple times to obtain the result of the target task, wherein the result of the target task is an average of the multiple measurements, and the Hermitian operator commutes with the second part of the data.

[0018] In a second aspect, an embodiment of the present application provides a quantum computer, which includes a module for implementing the first aspect or any possible manner of the first aspect.

[0019] In a third aspect, an embodiment of the present application provides a computer system, which includes a quantum computer and a classical computer, and the classical computer is used to control the quantum computer so that the quantum computer implements the method of the first aspect or any possible implementation method of the first aspect.

[0020] In a fourth aspect, an embodiment of the present application provides a chip, comprising: a logic circuit, which is used to couple with an input / output interface and transmit data through the input / output interface to execute the method of the first aspect above or any possible implementation method of the first aspect.

[0021] In a fifth aspect, an embodiment of the present application provides a computer-readable medium, which stores a program code. When the computer program code runs on a computer, the computer executes the method of the first aspect above or any possible implementation method of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 is a schematic diagram of a computing system used to perform quantum computing.

[0023] Figure 2 It is a schematic diagram of an application scenario of a method for processing data provided in an embodiment of the present application.

[0024] Figure 3 This is a schematic flowchart of a typical quantum computing.

[0025] Figure 4 This is a schematic diagram of the quantum circuit used to generate the initial state.

[0026] Figure 5 is a target operator corresponding to Schematic diagram of a quantum circuit.

[0027] Figure 6 is a schematic diagram of the quantum circuit used to obtain the results of this target task.

[0028] Figure 7 is a schematic diagram of the quantum circuit used to determine the target task.

[0029] Figure 8 This is a schematic diagram of another sub-quantum circuit used to prepare the initial state.

[0030] Fig. 9 This is a schematic diagram of another sub-quantum circuit used to prepare the initial state.

[0031] Fig.10 is another type of operator corresponding to the target Schematic diagram of a quantum circuit.

[0032] Fig.11 is another type of operator corresponding to the target Schematic diagram of a quantum circuit.

[0033] Fig.12 It is a schematic structural block diagram of a quantum computer. DETAILED DESCRIPTION

[0034] The technical solution in this application will be described below in conjunction with the accompanying drawings.

[0035] The present application will present various aspects, embodiments or features around a system that may include multiple devices, components, modules, etc. It should be understood and appreciated that each system may include additional devices, components, modules, etc., and / or may not include all of the devices, components, modules, etc. discussed in conjunction with the figures. In addition, combinations of these schemes may also be used.

[0036] In addition, in the embodiments of the present application, words such as "exemplary" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present concepts in a concrete way.

[0037] In the embodiments of the present application, "corresponding (corresponding, relevant)" and "corresponding (corresponding)" can sometimes be used interchangeably. It should be pointed out that when the distinction between them is not emphasized, the meanings they intend to express are consistent.

[0038] In the embodiments of the present application, sometimes a subscript such as W1 may be mistakenly written as a non-subscript such as W1. When the difference is not emphasized, the meanings to be expressed are consistent.

[0039] The network architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. A person of ordinary skill in the art can appreciate that with the evolution of the network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0040] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0041] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0042] Figure 1 is a schematic diagram of a computing system used to perform quantum computing. Figure 1 The system 100 shown can be divided into a quantum computer part 110 and a classical computer part 120. The quantum computer part 110 includes a quantum processor 111, a measuring device 112, and a peripheral controller 113. The classical computer part 1200 includes a classical processor 121 and a memory 122. The memory 122 is used to store instructions and / or codes, and the classical processor 121 is used to run the instructions and / or codes running in the memory 122, and realize quantum computing in combination with the quantum computer part.

[0043] Figure 2 Schematic diagram of an application scenario of the method for processing data provided in an embodiment of the present application. Figure 2 As shown, the application scenario can be divided into three layers, namely application layer, algorithm layer and physical layer.

[0044] The application layer represents some fields to which the method for processing data provided by the embodiment of the present application can be applied. The method for processing data provided by the present application can be applied to the field of machine learning. For example, the method for processing data provided by the present application can be used to determine a support vector machine (Support Vector Machine, SVM) model. The SVM model can be used to solve problems such as image processing (such as image recognition, image classification, etc.) or speech processing (such as semantic recognition, sentiment analysis, etc.).

[0045] The algorithm layer is used to determine the strategy for solving the task, process the data of the task according to the determined strategy, and determine the algorithm used to process the task data.

[0046] Different tasks can correspond to different strategies. The strategy matching module in the algorithm layer can determine the strategy that can solve the task according to the task to be solved. The strategy can be a mathematical model or a method. For example, if the task to be solved is pattern recognition, the corresponding strategy can be a support vector machine model.

[0047] The algorithm design module in the algorithm layer can process the task data according to the strategy of the task to be solved.

[0048] Taking supervised learning as an example, if the task to be solved is to determine an image classification model based on training data using a supervised learning method. The training data set used to train the image classification model may include multiple training data, and each of the multiple training data may include an image data and label information corresponding to the image data. The algorithm design module may divide the training data set into two parts: the first part includes the label information in the training data set, and the second part includes the image data in the training data set. The label information in the first part corresponds one-to-one with the image data in the second part. For example, assuming that the training data set includes a total of W training data, in this case, the first part of the training data set can be represented as a column vector, which includes a total of W elements, and the W elements correspond one-to-one with the labels of the W training data. For ease of description, it is assumed that the image data in each training data includes W vectors. In this case, the second part of the training data set can be a W×W matrix. For ease of description, A can be used to represent the second part of the data, and b can be used to represent the first part of the data. In this case, A and b can be represented as...

[0049]

[0050] Where [a 11 ,a 12 ,…,a 1w ] is the image data in the first training data in the training data set, b1 is the label in the first training data, [a 21 ,a 22 ,…,a 2w ] is the image data in the second training data in the training data set, b2 is the label in the second training data, and so on.

[0051] In addition to being used to train image classification models, the technical solution of the present application can also be used to train other types of models in image processing and speech processing, such as image recognition models, semantic recognition models, sentiment analysis models, etc.

[0052] The quantum computing simulator module in the algorithm layer can be used to determine the parameters required to solve the algorithm and send the parameters to the classical computer in the physical layer.

[0053] For example, the input information input into the quantum computing simulator module may include processed task data (e.g., the first portion of data and / or the second portion of data). The input information input into the quantum computing simulation module may also include an algorithm determined by the algorithm design module for processing the first portion of data and the second portion of data.

[0054] Optionally, in some embodiments, the quantum computing simulator can verify the algorithm. Verification here refers to analyzing and statistically analyzing the success probability of a determined algorithm, and optimizing the algorithm based on the statistical results. Finally, the optimal algorithm for solving the task is obtained, and the optimal algorithm is input into the quantum computing simulator. The quantum computing simulator can determine the parameters required by the algorithm based on the optimal algorithm, and send the parameters to the classical computer.

[0055] The physical layer processes the first part of data and the second part of data according to the parameters determined by the quantum computing simulator to determine the optimal output, which is the result of the task.

[0056] A classical computer (also called a classical control computer) can determine the corresponding quantum circuit based on the acquired parameters. Based on the determined quantum circuit, the classical computer can control the peripheral controller in the quantum computer to generate control signals such as microwaves or lasers, operate on the quantum processor, implement quantum gate operations on the quantum processor, and control the measurement equipment in the quantum computer to measure the quantum state generated by the quantum processor.

[0057] Optionally, in some embodiments, a classical computer can execute a classical optimization algorithm (such as gradient descent) to obtain an optimal output. Before executing the optimization algorithm, the classical computer needs to obtain the measurement result of the quantum computer and determine the optimal output based on the measurement result.

[0058] Optionally, in other embodiments, the quantum computer can use the prepared quantum state for optimization and execute quantum optimization algorithms such as quantum gradient descent to determine the optimal output.

[0059] The optimal output obtained using a classical computer or a quantum computer can be fed back to the application layer.

[0060] Figure 3 This is a typical schematic flow chart of quantum computing. Figure 3 As shown, quantum computing usually includes the following steps:

[0061] 301, generating an initial state corresponding to a first part of data of a target task through a first quantum circuit.

[0062] 302. Perform a unitary transformation on the initial state through a second quantum circuit corresponding to a target operator to obtain a target quantum state. The target operator corresponds to a second part of data of the target task, and the target operator includes a first diagonal matrix and a second diagonal matrix.

[0063] The target task may be to determine a machine learning model based on supervised learning (e.g., an image classification model, a semantic recognition model, an image recognition model, a sentiment analysis model, etc.). The second part of the data of the target task may be the training data in the training data set, and the first part of the data may be the label corresponding to the training data.

[0064] 303, measuring the first part of the target quantum state to obtain a measurement result.

[0065] 304, determine whether the measurement result meets a preset condition.

[0066] If the measurement result meets the preset condition, step 305 is executed.

[0067] If the measurement result does not meet the preset condition, step 301 to step 304 are re-executed until the measurement result meets the preset condition.

[0068] Optionally, in some embodiments, during the process of re-executing step 302 , the target operator in step 302 may be an updated target operator.

[0069] 305, using the Hermitian operator to measure the second part of the target quantum state

[0070] 306 , determining the result of the target task according to the measurement result.

[0071] Optionally, in some embodiments, Figure 3 As shown, step 301, step 302, step 303 and step 305 can be performed as follows Figure 1 The quantum computer 110 in the system 100 shown in FIG. 304 and step 306 may be implemented by Figure 1 The system 100 is shown implemented as a classical computer 120 .

[0072] Optionally, in other embodiments, such as Figure 3 Steps 301, 302, 303 and 305 shown in FIG. Figure 1 The quantum computer 110 in the system 100 shown in FIG. 304 and / or step 306 may also be implemented by Figure 1 The quantum computer 110 in the system 100 is shown implemented.

[0073] For ease of description, the first part of the data and the second part of the data of the target task can be described in the form of a linear equation system. The first part of the data b and the second part of the data A can be expressed as a linear equation system

[0074] The following will be combined Figure 3 The steps shown are used to describe the embodiments of the present application in detail.

[0075] Linear Equations The quantum state representation of The symbol | > represents the right arrow, (i.e. the second part of the target task data) is the coefficient matrix of the linear system of equations, |b> (i.e. the first part of the target task data) is the constant term of the linear system of equations, |b> is a column vector, and |x> represents the solution of the linear system of equations.

[0076] Optionally, in some embodiments, (i.e. the second part of the target task data) is a sparse matrix.

[0077] Optionally, in some embodiments, The sparsity is less than or equal to Where N represents the coefficient matrix In other words, the matrix The row with the most non-zero elements is non-zero elements.

[0078] The initial state corresponding to the target task is the linear equation system The corresponding initial state.

[0079] Optionally, in some embodiments, the initial state may include three initial state elements, namely a first initial state element, a second initial state element and a third initial state element. The first initial state element may be |b>. Assuming |b> includes W elements (W is a positive integer greater than 1), the first initial state element can be prepared by log2W quantum bits.

[0080] Optionally, in some embodiments, the second initial state element may be The third initial element can be The number of components of the quantum state of the second initial state element is 2L+1, and the number of components of the quantum state of the third initial state element is 2T+1, m represents the serial number of the vector corresponding to the second initial state element, and m' represents the serial number of the vector corresponding to the third initial state element. In other words, |m> is the mth quantum bit in the second initial state element of the initial state, and |m'> is the m'th quantum bit in the third initial state element of the initial state. L is 2 to the Pth power, T is 2 to the Qth power, and P and Q are positive integers greater than or equal to 1. Optionally, in some embodiments, P and Q are positive integers greater than or equal to 4.

[0081] In this case, the initial state |Ψ0> can be expressed as:

[0082]

[0083] Figure 4 is a schematic diagram of a quantum circuit for generating an initial state. A classical computer can generate the following according to formula 1.1: Figure 4 The quantum circuit shown in the figure controls the quantum computer to achieve Figure 4 The gate operation in the quantum circuit shown in Figure 2 is shown in Figure 2. For ease of description, the following will be Figure 4 The quantum circuit shown is called the first quantum circuit.

[0084] like Figure 4 The first quantum circuit 400 shown can be divided into a sub-quantum circuit 410 , a sub-quantum circuit 420 and a sub-quantum circuit 430 .

[0085] The sub-quantum circuit 410 includes a quantum random access memory (QRAM) 411. The QRAM 411 is used to realize the preparation of the first initial state element |b> in the initial state.

[0086] The sub-quantum circuit 420 includes a Hadamard gate (also referred to as an H gate) 421 , an H gate 422 , a phase reversal gate (also referred to as a Z gate) 423 , an H gate 424 and a measurement port 425 .

[0087] log2(L)+1 qubit|0> can be prepared into the following quantum state through the action of H gate 421:

[0088]

[0089] If the components |1>|0> in |ψ1> are flipped, the following quantum state can be obtained:

[0090]

[0091] The quantum bit |0> can be prepared into the following quantum state through the action of H gate 422

[0092] Z gate 423 pairs of quantum states |ψ1> and The following quantum state is obtained:

[0093] |0>|ψ1>+|1>|ψ2>, (Formula 1.3).

[0094] |0>|ψ1>+|1>|ψ2> After the action of H gate 425, the following quantum state can be prepared:

[0095] |0>(|ψ1>+|ψ2>)+|1>(|ψ1>-|ψ2>), (Formula 1.4).

[0096] The quantum state |0>(|ψ1>+|ψ2>)+|1>(|ψ1>-|ψ2>) is measured at the measurement port 425. If the measurement result is |0>, it means that the sub-quantum circuit 420 has realized the second initial state element of the initial state. If the measurement result is |1>, it means that the sub-quantum circuit 420 has not realized the second initial state element of the initial state In this case, the measurement is continued at the measurement port 425 until the measurement result |0> is obtained.

[0097] The sub-quantum circuit 430 includes an H gate 431 , an H gate 432 , a Z gate 433 , an H gate 434 and a measurement port 435 .

[0098] Sub-quantum circuit 430 realizes the third element in the initial state The preparation process is similar to the preparation process of the second initial state element realized by the sub-quantum circuit 420, except that the number of |0> input to the H gate 431 is log2(T)+1, which will not be described here for brevity.

[0099] After the initial state |Ψ0> is prepared, the initial state |Ψ0> can be evolved to obtain a target quantum state. Specifically, the target operator can be used to perform a unitary transformation on the initial state to obtain the target quantum state.

[0100] The target operator corresponds to the target task. The target operator may include the second part of the data of the target task, namely the coefficient matrix in the linear equation system

[0101] The target operator may also include a first diagonal matrix and a second diagonal matrix. The first diagonal matrix corresponds to the second initial state element. The first diagonal matrix corresponds to the third initial state element.

[0102] The first diagonal matrix It can be a 2L+1 square matrix.

[0103] Optionally, in some embodiments, the first diagonal matrix It can be expressed as:

[0104]

[0105] It can be seen that the first diagonal matrix The elements on the main diagonal are [-L,-L+1,…,-1,0,1,…,L-1,L].

[0106] Formula 1.5 is the first diagonal matrix when the value of m ranges from -L to L

[0107] If the value of m ranges from L to -L, then the first diagonal matrix It can be expressed as:

[0108]

[0109] It can be seen that the first diagonal matrix The elements on the main diagonal are [L,L-1,…,1,0,-1,…,-L+1,-L].

[0110] The second diagonal matrix It can be a 2T+1 square matrix.

[0111] Optionally, in some embodiments, the second diagonal matrix It can be expressed as:

[0112]

[0113] It can be seen that the second diagonal matrix The elements on the main diagonal are [-T,-T+1,…,-1,0,1,…,T-1,T].

[0114] Formula 1.5 is the second diagonal matrix when the value range of m' is -T to T

[0115] If the value range of m' is from L to -L, then the second diagonal matrix It can be expressed as:

[0116]

[0117] It can be seen that the second diagonal matrix The elements on the main diagonal are [T,T-1,…,1,0,-1,…,-T+1,-T].

[0118] Optionally, in some embodiments, the target operator may be Among them, j represents the imaginary unit, γ represents the calculation parameter, represents the coefficient matrix of the linear equation system (i.e. the second part of the target task data), represents the square of the matrix, represents the first diagonal matrix, represents the second diagonal matrix, represents the Kronecker product.

[0119] Using the target operator By performing a unitary transformation on the initial state |Ψ0> in formula 1.1, we can obtain the target quantum state as shown below:

[0120]

[0121] Where L, T, m and m' have the same meanings as above, γ represents the calculation parameter, λ i The coefficient matrix represented by The i-th eigenvalue of i represents the i-th element in |b>, e i represents the i-th basis vector. i is a positive integer greater than or equal to 1 and less than or equal to W. The constant term |b> of the linear equation system (i.e., the first part of the data of the target task) includes W elements, and W is a positive integer greater than or equal to 1.

[0122] Figure 5 is a target operator corresponding to Schematic diagram of a quantum circuit. A classical computer can use the target operator Generate as Figure 5 The quantum circuit shown in the figure controls the quantum computer to achieve Figure 5 The gate operation in the quantum circuit shown in Figure 2 is shown in Figure 2. For ease of description, the following will be Figure 5 The quantum circuit shown is called the second quantum circuit. The second quantum circuit can be divided into log2(L)×log2(T) sub-quantum circuits.

[0123] like Figure 5The second quantum circuit 500 shown only shows three of the log2(L)×log2(T) sub-quantum circuits, namely sub-quantum circuit 510, sub-quantum circuit 520 and sub-quantum circuit 530, wherein sub-quantum circuit 510 is the first sub-quantum circuit of the log2(L)×log2(T) sub-quantum circuit, sub-quantum circuit 520 is the (n1+1)×(n2+1)th sub-quantum circuit of the log2(L)×log2(T) sub-quantum circuit, and sub-quantum circuit 530 is the log2(L)×log2(T)th sub-quantum circuit of the log2(L)×log2(T) sub-quantum circuit. The operators of the intermediate control U gates (513, 523, 533) in different sub-quantum circuits of the log2(L)×log2(T) sub-quantum circuits are different.

[0124] like Figure 5 As shown, the sub-quantum circuit 510 includes four bit flip gates (also called X gates), namely X gate 511, X gate 512, X gate 514 and X gate 515. The sub-quantum circuit 510 also includes a control U gate 513. Figure 5 The operator in the control U gate 513 is shown as U2 0+0 .

[0125] The sub-quantum circuit 520 includes four X gates, namely X gate 521, X gate 522, X gate 524 and X gate 525. The sub-quantum circuit 520 also includes a control U gate 523. Figure 5 The operator in the control U gate 523 is shown as U The quantum bits in the middle group of lines in the circuit diagram (i.e., the group of lines connected to the sub-quantum circuit 420) are sorted according to {0, 1, 2,, log2(L)-1} except the first one as the sign bit, n1 represents the arrangement number of the control bit, and n2 represents the arrangement number of the quantum bits in the group of lines connected to the sub-quantum circuit 430.

[0126] The sub-quantum circuit 530 includes four X gates, namely X gate 531, X gate 532, X gate 534 and X gate 535. The sub-quantum circuit 510 also includes a control U gate 533. Figure 5 The operator in the control U gate 533 is shown as U L+T , L and T have the same meanings as those mentioned above.

[0127] The U in the control U gate 513, the control U gate 523 and the control U gate 533 is

[0128] like Figure 5As shown, the four X gates in each sub-quantum circuit are symmetrical with respect to the control U gate. Taking sub-quantum circuit 510 as an example, X gates 511 and 515 are controlled by the quantum circuit at 516 being in the 0 state and the quantum circuit at 517 being in the 1 state, and X gates 512 and 514 are controlled by the quantum circuit at 516 being in the 1 state and the quantum circuit at 517 being in the 0 state, and they all act on a group of wires connected to sub-quantum circuit 410.

[0129] like Figure 5 The input of the second quantum circuit shown is the initial state |Ψ0> as shown in formula 1.1, and the output is the target quantum state as shown in formula 2.1. The unitary transformation of the initial state to obtain the target quantum state is as follows Figure 5 The second quantum circuit shown is realized.

[0130] After obtaining the target quantum state as shown in Formula 2.1, the first part of the target quantum state can be measured to determine whether the measurement result meets the preset conditions. For example, in some embodiments, it can be determined whether the measurement result φ obtained by measuring the first part of the target quantum state satisfies the following conditions:

[0131]

[0132] If the measurement result φ satisfies Formula 3.1, the second part of the target quantum state can be determined. If the measurement result φ does not satisfy Formula 3.1, steps 301 to 303 can be repeated until the measurement result φ of step 303 satisfies Formula 3.1. Optionally, in some embodiments, during the process of repeating steps 301 to 303, the target operator is updated. The calculation parameter γ in is used, and the quantum circuit corresponding to the updated target operator is used to re-perform unitary transformation on the initial state shown in Formula 1.1 to obtain the updated target quantum state, and continue to measure the first part of the updated target quantum state until the measurement result φ satisfies Formula 3.1.

[0133] Optionally, in some embodiments, the target operator is updated The calculation parameter γ in can be an estimate of the eigenvalue range of the adjustment coefficient matrix of the probability of successful measurement, and then the size of γ is optimized through the constraints of formula 3.1 to ultimately increase the probability of success in the future.

[0134] The results of this target task can be used as Figure 6 The quantum circuit shown is obtained. Figure 6The quantum circuit 600 shown can be divided into three sub-quantum circuits, namely sub-quantum circuit 601, sub-quantum circuit 602 and sub-quantum circuit 603. Among them, sub-quantum circuit 601 is used to measure the target quantum state and output the measurement result. If the measurement result meets the preset conditions, the ρ output by sub-quantum circuit 601 is the second part of the target quantum state, and the output of sub-quantum circuit 603 is the third part of the target quantum state.

[0135] like Figure 6 The sub-quantum circuit 602 shown includes a quantum Fourier transform (QFT) module and a plurality of measurement ports.

[0136] After obtaining the second part of the target quantum state, the Hermitian operator can be used to measure the second part of the target quantum state. The measurement result is Tr[ρM], where Tr represents the trace, M represents the Hermitian operator, and ρ represents the second part of the target quantum state. The second part of the target quantum state is measured multiple times using the Hermitian operator, and the average of the multiple measurements is the result of the target task. The result of the target task can be expressed as x T Mx. This Hermitian operator is To be commutative,

[0137] The second part of the target quantum state can be expressed as:

[0138]

[0139] Arranging the numerator part in formula 3.2, we can get:

[0140]

[0141] The second part ρ of the target quantum state can be expressed as:

[0142]

[0143] The symbol ∝ indicates direct proportion.

[0144] It can be proved that:

[0145]

[0146] The symbol ~ indicates approximate proportionality.

[0147] Based on formula 3.5, Substituting in formula 3.4 get:

[0148]

[0149] like Figure 5 The number of quantum gates and quantum bits of the second quantum circuit shown in the figure are polynomially related. Therefore, the complexity of solving the target task using the above technical solution is where ∈ represents the operation accuracy of U in the second quantum circuit, Represented by vector is the characteristic polynomial of the equation to be solved.

[0150] Figure 7 is a quantum circuit used to determine the target task. Figure 7 The quantum circuit 700 shown includes Figure 4 The first quantum circuit 400 shown in FIG. Figure 5 The second quantum circuit 500 shown in FIG. Figure 6 A third quantum circuit 600 is shown.

[0151] Those skilled in the art will appreciate that formula 1.1 only shows one way of expressing the initial state. Optionally, in other embodiments, the initial state can also be expressed as Correspondingly, when the generated initial state is formula 4.1, the target operator for unitary transformation of the initial state is Among them U a is any unitary matrix in the dimension of the quantum state space.

[0152] Correspondingly, such as Figure 4 The quantum circuit shown is a possible quantum circuit corresponding to the initial state of formula 1.1. Those skilled in the art will appreciate that other quantum circuits can also be used to generate the initial state shown in formula 1.1. For example, Figure 4 The sub-quantum circuit 420 and / or sub-quantum circuit 430 shown can be replaced by Figure 8 The quantum circuit shown. Figure 4 The sub-quantum circuit 420 and / or sub-quantum circuit 430 shown can be replaced by Fig. 9 The quantum circuit shown.

[0153] Similarly, in the target operator In addition to using Figure 5 In addition to the quantum circuit shown in FIG. 1 , other quantum circuits can also be determined to obtain the target quantum state by unitary transformation of the initial state. For example, the following can be used: Fig.10 The quantum circuit shown in the figure performs a unitary transformation on the initial state shown in formula 1.1 to obtain the target quantum state shown in formula 2.1. For another example, we can use Fig.11 The quantum circuit shown performs a unitary transformation on the initial state shown in formula 1.1 to obtain the target quantum state shown in formula 2.1.

[0154] The target task in the above embodiment is a machine learning model that needs to be obtained through supervised learning, and the data of the corresponding task is the training data set.

[0155] Optionally, the embodiment of the present application can also be used for multimedia data decoding. In this case, the first part of the task data is the data to be decoded (or can also be called encoded data), and the second part of the task data is the transformation matrix corresponding to the encoding method.

[0156] Optionally, the embodiment of the present application can also be applied to statistical or machine learning problems that can be based on the least squares method. In this case, the task data is a plurality of groups of observed data. Each group of data in the plurality of groups of data can be divided into two parts, the first part of the task data is composed of the first part of the data in the plurality of groups of data, and the second part of the task data is composed of the second part of the data in the plurality of groups of data. For example, the first part of the data may include the score of the image, and the second part of the data may include the size of the image, the contrast of the image, the resolution of the image, etc. For another example, the first part of the data may include a speech score, and the second part of the data may include the frequency range of the speech, the highest frequency of the speech, the lowest frequency of the speech, etc.

[0157] Fig.12 is a schematic structural block diagram of a quantum computer provided according to an embodiment of the present application. Fig.12 As shown, the quantum computer 1200 includes an initial state preparation module 1201, a unitary transformation module 1202, and a measurement module 1203.

[0158] The initial state preparation module 1201 is used to generate an initial state corresponding to the first part of data of the target task through the first quantum circuit.

[0159] The unitary transformation module 1202 is used to perform a unitary transformation on the initial state through a second quantum circuit corresponding to a target operator to obtain a target quantum state, wherein the target operator corresponds to the second part of the data of the target task, and the target operator includes a first diagonal matrix and a second diagonal matrix.

[0160] The measuring module 1203 is used to measure the first part of the target quantum state to obtain a measurement result.

[0161] The measurement module 1203 is further configured to measure the second part of the target quantum state using a Hermitian operator to obtain a result of the target task when the measurement result satisfies a predetermined condition.

[0162] The initial state preparation module 1201, the unitary transformation module 1202 and the measurement module 1203 can be implemented by a quantum processor. The specific functions and beneficial effects of the initial state preparation module 1201, the unitary transformation module 1202 and the measurement module 1203 can be found in the above embodiments, and will not be described in detail for the sake of brevity.

[0163] The chip in the embodiments of the present application may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or other integrated chips.

[0164] In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software. The steps of the method disclosed in conjunction with the embodiment of the present application can be directly embodied as a hardware processor for execution, or a combination of hardware and software modules in a processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in conjunction with its hardware. To avoid repetition, it is not described in detail here.

[0165] It should be noted that the processor in the embodiment of the present application can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiment can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor to be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0166] It can be understood that the memory in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0167] According to the method provided in the embodiment of the present application, the present application also provides a computer program product, which includes: a computer program code, when the computer program code is run on a computer, the computer executes Figure 3A method according to any one of the embodiments shown.

[0168] According to the method provided in the embodiment of the present application, the present application also provides a computer-readable medium, which stores a program code, and when the program code is run on a computer, the computer executes Figure 3 A method according to any one of the embodiments shown.

[0169] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0170] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0171] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0172] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0173] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0174] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0175] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for processing data, characterized in that: include: The quantum computer generates an initial state corresponding to the first part of the data of the target task through the first quantum circuit; The quantum computer performs a unitary transformation on the initial state through a second quantum circuit corresponding to a target operator to obtain a target quantum state, wherein the target operator corresponds to the second part of the data of the target task, and the target operator includes a first diagonal matrix and a second diagonal matrix, wherein the first part of the data and the second part of the data satisfy the following relationship A represents the second part of data, Indicates that the first part of data is, or the second part of data is training data, and the first part of data is a label corresponding to the training data; The quantum computer measures a first part of the target quantum state to obtain a measurement result; When the measurement result satisfies a predetermined condition, the quantum computer uses the Hermitian operator to measure the second part of the target quantum state to obtain the result of the target task, wherein: The target operator is Where j represents the imaginary unit, γ represents the calculation parameter, is the square of the second part of the data, represents the Kronecker product, the first diagonal matrix is ​​a 2L+1 square matrix, and the second diagonal matrix is ​​a 2T+1 square matrix. The target quantum state is Where L is 2 raised to the Pth power, T is 2 raised to the Qth power, P and Q are positive integers greater than or equal to 1, γ represents the calculation parameter, and λ i represents the i-th eigenvalue of the second part of the data, b i represents the i-th element in the constant term |b> determined based on the first part of the data, e i represents the i-th basis vector, m represents the serial number of the vector corresponding to the second initial state element in the initial state, m' represents the serial number of the vector corresponding to the third initial state element in the initial state, i is a positive integer greater than or equal to 1 and less than or equal to W, |b> includes W elements, and W is a positive integer greater than or equal to 1; The measurement results φ and γλ that meet the preset conditions i , T and L have the following relationship:

2. The method according to claim 1, characterized in that The second part of data is a sparse matrix.

3. The method according to claim 1 or 2, characterized in that: The initial state includes a first initial state element, a second initial state element and a third initial state element, wherein the first initial state element is a constant term b> determined according to the first part of the data, the second initial state element corresponds to the first diagonal matrix, and the third initial state element corresponds to the second diagonal matrix, wherein the initial state is Where |b> is the first initial element, is the second initial element, is the third initial element, Wherein m represents the serial number of the vector corresponding to the second initial state element, m' represents the serial number of the vector corresponding to the third initial state element, L is 2 to the Pth power, T is 2 to the Qth power, and P and Q are positive integers greater than or equal to 1.

4. The method according to claim 1, characterized in that 5. The method according to claim 1, characterized in that The measuring the second part of the target quantum state by using the Hermitian operator to obtain the result of the target task includes: The Hermitian operator is used to perform multiple measurements on the second part of the target quantum state to obtain a result of the target task, wherein the result of the target task is an average value of the multiple measurements, and the Hermitian operator commutes with the second part of data.

6. A quantum computer, characterized in that: The quantum computer comprises: An initial state preparation module, used to generate an initial state corresponding to the first part of data of a target task through a first quantum circuit; A unitary transformation module is used to perform a unitary transformation on the initial state through a second quantum circuit corresponding to a target operator to obtain a target quantum state, wherein the target operator corresponds to the second part of the data of the target task, and the target operator includes a first diagonal matrix and a second diagonal matrix, wherein the first part of the data and the second part of the data satisfy the following relationship A represents the second part of data, Indicates that the first part of data is, or the second part of data is training data, and the first part of data is a label corresponding to the training data; A measuring module, used to measure the first part of the target quantum state to obtain a measurement result; The measurement module is further configured to measure the second part of the target quantum state using a Hermitian operator to obtain a result of the target task when the measurement result satisfies a predetermined condition, wherein: The target operator is Where j represents the imaginary unit, γ represents the calculation parameter, is the square of the second part of the data, represents the Kronecker product, the first diagonal matrix is ​​a 2L+1 square matrix, and the second diagonal matrix is ​​a 2T+1 square matrix. The target quantum state is Where L is 2 raised to the Pth power, T is 2 raised to the Qth power, P and Q are positive integers greater than or equal to 1, γ represents the calculation parameter, and λ i represents the i-th eigenvalue of the second part of the data, b i represents the i-th element in the constant term |b> determined based on the first part of the data, e i represents the i-th basis vector, m represents the serial number of the vector corresponding to the second initial state element in the initial state, m' represents the serial number of the vector corresponding to the third initial state element in the initial state, i is a positive integer greater than or equal to 1 and less than or equal to W, |b> includes W elements, and W is a positive integer greater than or equal to 1; The measurement results φ and γλ that meet the preset conditions i , T and L have the following relationship:

7. The quantum computer according to claim 6, characterized in that The second part of data is a sparse matrix.

8. The quantum computer according to claim 6 or 7, characterized in that: The initial state includes a first initial state element, a second initial state element and a third initial state element, wherein the first initial state element is a constant term |b> determined according to the first part of the data, the second initial state element corresponds to the first diagonal matrix, and the third initial state element corresponds to the second diagonal matrix, wherein the initial state is Where |b> is the first initial element, is the second initial element, is the third initial element, Wherein m represents the serial number of the vector corresponding to the second initial state element, m' represents the serial number of the vector corresponding to the third initial state element, L is 2 to the Pth power, T is 2 to the Qth power, and P and Q are positive integers greater than or equal to 1.

9. The quantum computer according to claim 6, characterized in that 10. The quantum computer according to claim 6, characterized in that The measurement module is specifically used to use the Hermitian operator to perform multiple measurements on the second part of the target quantum state to obtain the result of the target task, wherein the result of the target task is the average value of the multiple measurements, and the Hermitian operator commutes with the second part of data.

11. A chip, characterized in that: include: A logic circuit, wherein the logic circuit is used to be coupled to an input / output interface and transmit data through the input / output interface to execute the method according to any one of claims 1 to 5.

12. A computer readable medium, characterized in that The computer readable medium stores a program code, and when the computer program code is executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 5.