Quantum state preparation method and device based on sparse real vector, medium and equipment
By performing non-zero element and zero element position migration on sparse real vectors, combined with dimensionality reduction processing, efficient amplitude coding quantum state preparation is achieved, solving the problem of low amplitude coding efficiency in the existing technology, and significantly optimizing the quantum line complexity and fidelity.
Patent Information
- Application Number
- CN202510034619.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-09
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2045-01-09
AI Technical Summary
The amplitude encoding process is not efficient in the prior art, which limits the performance of quantum machine learning algorithms, especially when processing sparse real vectors.
By performing non-zero element position migration, dimensionality reduction processing and zero element position migration on sparse real vectors, the third transform real vector with the smallest number of quantum gates is obtained. Based on this, amplitude encoding is performed to construct quantum circuits to achieve efficient quantum state preparation .
The high-efficiency amplitude-encoded quantum state preparation of sparse real vectors is realized, which significantly reduces the use of quantum gates, optimizes the complexity of quantum lines, and ensures 100% fidelity and high efficiency.
Smart Images

Figure CN119416902A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of quantum computing technology, and in particular to a method, device, medium and equipment for preparing a quantum state based on sparse real vectors. Background Art
[0002] Quantum algorithms are cutting-edge computing paradigms based on the principles of quantum mechanics. They use quantum bits (Qubits) as the basic unit of information encoding and use quantum mechanical properties such as quantum superposition and quantum entanglement to achieve efficient processing of computing tasks. In specific computing scenarios, quantum algorithms show significant performance advantages over traditional algorithms. For example, Shor's algorithm provides exponential acceleration over classical algorithms in the problem of large integer prime factorization, while Grover's algorithm achieves a quadratic efficiency improvement over classical search algorithms in unordered database search tasks. These advances not only highlight the potential of quantum algorithms in dealing with complex problems, but also provide a solid theoretical foundation and practical guidance for the continued development and application of quantum computing technology.
[0003] In the field of quantum machine learning, one of the key steps to achieve effective processing of classical data by quantum algorithms is to map classical data to quantum states. Amplitude coding, as a widely used coding strategy in quantum information processing, represents data by utilizing the amplitude properties of quantum states. The advantage of amplitude coding technology is that it can make full use of the high-dimensional data representation capability given by the quantum superposition principle, so that quantum systems can efficiently process large-scale data sets even when the scale is limited. The amplitude coding method provides important technical support for quantum machine learning algorithms when processing high-dimensional data.
[0004] At present, a series of amplitude coding technologies have been developed to meet different needs, including top-down amplitude coding, which directly utilizes the superposition characteristics of quantum states to achieve accurate encoding of data without the introduction of auxiliary quantum bits. In contrast, bottom-up amplitude coding requires the introduction of auxiliary quantum bits to achieve data encoding by gradually constructing quantum states. For sparse data, double sparse coding provides an efficient strategy to optimize the use of quantum resources. In addition, as an approximate technology, MPS approximate coding cannot guarantee 100% fidelity, but it can provide effective data coding approximation under certain circumstances.
[0005] The preparation of quantum states is a specific and widespread problem in the field of quantum computing. The preparation of quantum states refers to the process of converting a quantum system from a certain initial state to a target state. In quantum computing, it is usually necessary to convert quantum bits from a known initial state (such as the ground state |0>) to a specific target state for subsequent quantum operations and calculations. In the process of using quantum computing to solve classical problems, it is first necessary to convert classical information into corresponding quantum states for subsequent quantum algorithm processing, which is defined as quantum state preparation.
[0006] The efficiency of amplitude coding is a key factor affecting the performance of the algorithm and often becomes a bottleneck that limits the improvement of algorithm performance. Taking the HHL algorithm as an example, the algorithm theoretically has the potential for exponential acceleration in processing linear algebra problems. However, if the amplitude coding process is not efficient, this potential may be greatly reduced due to complex coding steps, resulting in the actual performance of the algorithm failing to meet expectations. Therefore, achieving efficient amplitude coding is crucial to the performance of quantum machine learning algorithms. Efficient amplitude coding can not only reduce the consumption of quantum resources and reduce the cumulative error of quantum operations, but also improve the fidelity and robustness of the algorithm, thereby giving full play to the advantages of quantum machine learning algorithms in processing complex problems.
[0007] Therefore, how to efficiently realize amplitude-coded quantum state preparation becomes a technical problem that needs to be solved. Summary of the invention
[0008] The purpose of the present invention is to provide a quantum state preparation method, device, medium and equipment based on sparse real vectors, so as to realize the conversion of sparse real vectors and efficiently complete the amplitude-coded quantum state preparation.
[0009] According to one aspect of the present invention, there is provided a method for preparing a quantum state based on a sparse real vector, comprising: Obtain a first transformed real vector by performing non-zero element position migration on the sparse real vector; By performing dimensionality reduction processing on the first transformed real vector, a second transformed real vector including all non-zero elements and requiring the least number of quantum bits is obtained; By performing zero element position migration on the second transformed real vector, a third transformed real vector with the least number of required quantum gates is obtained; Performing amplitude coding based on the third transformed real vector to construct a third quantum circuit and obtain a third quantum state; Applying a second unitary gate to the third quantum circuit constructs a second quantum circuit to obtain a second quantum state; Execute the tensor zero state in the second quantum circuit to construct the first quantum circuit, and obtain the first quantum state by dimension upgrading; A first unitary gate is applied to the first quantum circuit to construct a target quantum circuit, and a target quantum state of a sparse real vector is obtained.
[0010] According to one embodiment of the present invention, the method of obtaining a first transformed real vector by performing non-zero element position migration on a sparse real vector includes: obtaining position information of m non-zero elements in the sparse real vector, migrating the m non-zero elements to the first m positions, or the last m positions, or the middle m positions of the first transformed real vector, and recording the position exchange combinations before and after the migration of the m non-zero elements.
[0011] According to one embodiment of the present invention, the first unitary gate is applied to the first quantum circuit to construct the target quantum circuit, and the operation of applying the first unitary gate includes: traversing the position exchange combinations before and after the migration of the m non-zero elements, and for each pair of positions before and after the migration of the non-zero elements, exchanging the corresponding front and back positions based on the unit matrix.
[0012] According to one embodiment of the present invention, the step of performing dimensionality reduction processing on the first transformed real vector to obtain a second transformed real vector including all non-zero elements and requiring the least number of quantum bits includes: A first quantum bit number n is determined according to the dimension of the sparse real vector, and a second quantum bit number t is determined according to the number m of non-zero elements in the sparse real vector, where the dimension of the second transformed real vector is 2 to the power of t; m non-zero elements are extracted to the second transformed real vector, and the remaining elements of the second transformed real vector are supplemented to 0.
[0013] According to one embodiment of the present invention, the step of performing zero element position migration on the second transformed real vector to obtain a third transformed real vector requiring the least number of quantum gates includes: Calculate the required number of quantum gates of the controlled RY gate group corresponding to each parameter after the second transformed real vector is converted into a quantum circuit according to the amplitude coding method; After arranging the required quantum gate numbers from large to small, select some controlled RY gate groups and obtain the corresponding parameter index positions; The zero elements in the second transformed real vector are migrated to the parameter index position to obtain a third transformed real vector and a zero element position migration combination.
[0014] According to one embodiment of the present invention, the second unitary gate is applied to the third quantum circuit to construct the second quantum circuit, and the operation of applying the second unitary gate includes: Traverse the zero element position migration combinations, and for each pair of positions before and after zero element migration, exchange the corresponding index positions based on the unit matrix.
[0015] According to one embodiment of the present invention, the method of executing the tensor zero state in the second quantum circuit to construct the first quantum circuit and upgrading the dimension to obtain the first quantum state includes: applying a tensor nt quantum bits to the second quantum state state, n is the number of qubits required for the sparse real vector, and t is the number of qubits required for the first transformed real vector.
[0016] According to another aspect of the present invention, there is provided a quantum state preparation device based on sparse real vectors, comprising: A first migration unit is configured to obtain a first transformed real vector by performing non-zero element position migration on the sparse real vector; A dimension reduction transformation unit is configured to obtain a second transformed real vector including all non-zero elements and requiring the least number of quantum bits by performing dimension reduction processing on the first transformed real vector; A second migration unit is configured to obtain a third transformed real vector requiring the least number of quantum gates by performing zero element position migration on the second transformed real vector; an amplitude coding unit, configured to perform amplitude coding based on the third transformed real vector to construct a third quantum circuit and obtain a third quantum state; A second recovery unit is configured to apply a second unitary gate to the third quantum circuit to construct a second quantum circuit and obtain a second quantum state; A dimension-upgrading transformation unit is configured to execute the tensor zero state in the second quantum circuit to construct the first quantum circuit, and to obtain the first quantum state by dimension-upgrading; The first recovery unit is configured to apply a first unitary gate to the first quantum circuit to construct a target quantum circuit and obtain a target quantum state of a sparse real vector.
[0017] According to another aspect of the present invention, a computer-readable storage medium storing a computer program is provided. When the computer program is executed by a processor, the method for preparing a quantum state based on a sparse real vector as described above is implemented.
[0018] According to another aspect of the present invention, a computer device is provided, comprising: a processor; and a memory storing a computer program, wherein when the computer program is executed by the processor, the quantum state preparation method based on sparse real vectors as described above is implemented.
[0019] The quantum state preparation method based on sparse real vectors proposed in the technical solution of the present invention can efficiently and accurately realize the preparation of amplitude-coded quantum states for sparse real vectors, solving the problem of quantum state preparation of sparse real vectors. Compared with the prior art, the beneficial effects of the present invention are: (1) This method of preparing amplitude-coded quantum states based on sparse real vectors avoids the introduction of auxiliary quantum bits. Compared with the traditional top-down amplitude coding method, it significantly reduces the use of quantum gates and optimizes the complexity of quantum circuits.
[0020] (2) The implementation process not only ensures 100% fidelity and excellent efficiency, but also reduces the number of quantum gates, making it particularly suitable for actual operations in physical experimental environments.
[0021] (3) The high efficiency of amplitude coding was verified on a quantum simulator, and the fidelity of the encoding process was ensured to reach 100%. This high fidelity is crucial for the realization of subsequent quantum machine learning tasks.
[0022] Therefore, this method of preparing amplitude-coded quantum states based on sparse real vectors is not only efficient in theory, but also highly feasible in experiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above objects and features of the present invention will become more apparent from the following description in conjunction with the accompanying drawings.
[0024] Figure 1 Shown is a schematic diagram of a top-down amplitude coded quantum circuit with n quantum bits.
[0025] Figure 2 Shown is a schematic diagram of the conversion of two types of controlled RY gates in quantum circuits.
[0026] Figure 3 Shown is a flow chart of a method for preparing a quantum state based on a sparse real vector according to an exemplary embodiment of the present invention; Figure 4 Shown is a schematic diagram of a quantum circuit for obtaining a target quantum state |x> from a third quantum state |e> according to an exemplary embodiment of the present invention; Figure 5 Shown is a schematic diagram of a quantum state preparation device based on sparse real vectors according to an exemplary embodiment of the present invention; Figure 6 Shown is a schematic diagram of a 3-qubit quantum circuit for generating a third quantum state |e> according to an exemplary embodiment of the present invention.
[0027] Figure 7 Shown is a schematic diagram of a 4-qubit quantum circuit for generating a first quantum state |y> according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0028] for dimensional normalized sparse real vector ,in represents transpose, and satisfies is a real number, and ... , the sparsity means that the vector x includes non-zero elements, and satisfy , where n represents the number of qubits required for amplitude encoding of the sparse real vector x, Represents the number of quantum bits required for subsequent low-dimensional amplitude encoding.
[0029] Based on the existing Top-down amplitude coding method, given a dimensional normalized real vector , if the existing Top-down amplitude coding method is used, the real vector x is encoded into On qubits, the corresponding quantum circuit is as follows Figure 1 As shown. In the Top-down amplitude coding quantum circuit of qubits, a total of qubits, and needs to execute 1 RY gate and A controlled RY gate. Each parameter in the quantum circuit It is based on the vector elements Calculated, where ... , a total of 1 parameter. Although the existing amplitude coding method can achieve 100% fidelity amplitude coding, as the number of quantum bits increases As the number of quantum nodes increases, the depth of the required quantum circuit will increase exponentially, which makes the specific physical implementation very difficult.
[0030] In the quantum circuit obtained by the existing amplitude coding method, the controlled RY gates are divided into two categories: the first category is that all the control bits are in the |1> state, and the second category is that some or all of the control bits are in the |0> state. The hollow origin in the figure represents the |0> state as a controlled bit. In actual implementation, the second type of controlled RY gate needs to be indirectly realized through the combination of X gate, the first type of controlled RY gate, and X gate.
[0031] like Figure 2 As shown, for the second type of controlled RY gate on the left, it needs to be decomposed into a combination of quantum gates on the right. Figure 2 The quantum gate combination on the right is defined as a controlled RY gate group, and the number of quantum gates contained in the combination is defined as the size of the group. For example, Figure 2 The size of the controlled RY gate group on the right is 3, including two X gates and one RY gate.
[0032] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
[0033] For a given dimensional normalized real vector , which includes non-zero elements, and satisfy , just The low-dimensional amplitude coding can be realized with qubits and can be used as a sparse real vector. Normalization means that the real vector The modulus length is 1, represents transpose, and satisfies is a real number, and ... .
[0034] like Figure 3 As shown, a flow chart of a method for preparing a quantum state based on a sparse real vector is given, and the method comprises the following steps: Step S1: Obtain a first transformed real vector by performing non-zero element position migration on the sparse real vector; Step S2: performing dimensionality reduction processing on the first transformed real vector to obtain a second transformed real vector including all non-zero elements and requiring the least number of quantum bits; Step S3: obtaining a third transformed real vector requiring the least number of quantum gates by performing zero element position migration on the second transformed real vector; Step S4: Perform amplitude coding based on the third transformed real vector to construct a third quantum circuit to obtain a third quantum state; Step S5: applying a second unitary gate to the third quantum circuit to construct a second quantum circuit and obtain a second quantum state; and using the second unitary gate to control the third quantum state to restore the zero element position.
[0035] Step S6: Execute the tensor zero state in the second quantum circuit to construct the first quantum circuit, and obtain the first quantum state by dimension upgrading; Step S7: Apply the first unitary gate to the first quantum circuit to construct a target quantum circuit, and obtain a target quantum state of a sparse real vector. Use the first unitary gate to control the first quantum state to restore the position of non-zero elements.
[0036] In step S1, the sparse real vector Transform the elements to get the first transformed real vector , the position information of m non-zero elements in the sparse real vector can be obtained, and the m non-zero elements are transferred to the first m positions, the last m positions, or the middle m positions of the first transformed real vector, and the position exchange combination before and after the migration of the m non-zero elements is recorded. For example, the first transformed real vector Only the front The items are non-zero elements, and the remaining All items are 0.
[0037] The non-zero element position migration transformation operation is implemented through the following sub-steps: Sub-step 1-1: Let .
[0038] Sub-step 1-2: Traverse the real vector Location From 0 to , find the The element is 0 ; Substep 1-3: Traverse the real vector Location from arrive , find the last Elements are not 0 ; Substeps 1-4: Swapping real vectors middle and , and record the position exchange combination , the upper right corner Indicates that this is the combinations.
[0039] Sub-step 1-5: Determine the front of the current vector Are all items non-zero? If yes, execute sub-steps 1-7; otherwise, execute sub-steps 1-6.
[0040] Sub-steps 1-6: Let . Loop through sub-steps 1-2 to 1-5.
[0041] Sub-step 1-7: Output the real vector at this time (forward items are all non-zero elements).
[0042] Sub-step 1-8: Save all position swap combinations .
[0043] Sub-step 1-9: Let I = diag{1,1,...,1}, where diag{1,1,...,1} represents an n-dimensional identity matrix with only 1s on the diagonal (there are n of them) and all other positions 0.
[0044] Sub-steps 1-10: Traverse all ,according to , exchange I's columns and the kth column.
[0045] Sub-step 1-11: Output the process U1, which is exchanged once, is obviously a unitary operation that realizes quantum state transformation.
[0046] First transform real vector , can be Quantum bits can realize the dimensional element amplitude encoding, then tensor The quantum bit|0> state can realize The first transformed real vector of dimension After the amplitude encoding of the first transformed real vector is realized to obtain the first quantum state, the corresponding U1 quantum gate operation is determined according to the position migration combination in step S1. The U1 quantum gate is a unitary gate. By applying the U1 unitary gate operation, the amplitude encoding of the first transformed real vector can be realized. dimensional sparse real vector The amplitude encoding is used to obtain the final target quantum state.
[0047] In order to use fewer quantum gates, dimensionality reduction is continued.
[0048] In step S2, a second transformed real vector z is extracted from the first transformed real vector y, which is expressed as: , including m non-zero elements and -m zero elements.
[0049] According to the principle of Top-down amplitude coding technology, the second transformed real vector z has parameters, respectively , and then calculate the parameters as The size of the controlled RY gate group is the number of quantum gates included in the controlled RY gate group for each parameter. The size of the controlled Ry gate group is calculated as follows:
[0050] Among them, operations such as binary(int,length) represent converting the decimal integer int into a binary number with length digits, and padding the left side of the binary number with zeros if the number of digits is insufficient; operations such as count(bin,0) represent calculating the number of 0s in the binary number bin.
[0051] From the parameter Select the largest one from the group of controlled RY gates groups and mark the corresponding parameters as set A.
[0052] According to the method of calculating the RY gate parameters based on Top-down amplitude coding, the vector The element at a specific subscript in is 0, which can directly make the parameter is 0, so the calculation makes the parameter ( ∈A) is 0, denoted as set B, and the calculation formula is as follows:
[0053] For each vector subscript h in the set B (h∈B).
[0054] The second transform real vector Perform position migration of zero elements to obtain the third transformed real vector . In the third transformation real vector The element at position h (h∈B) are all 0, and the remaining positions are (or If the number of quantum gates is not required to be as small as possible, we can let Any is 0.
[0055] In step S3, the position migration transformation operation is similar to the position migration in step S1. Obviously, this is also a quantum unitary gate operation to realize quantum state transformation. The position recovery operation is realized through the second unitary gate U2, that is, the quantum state of the third transformed real vector can be obtained by applying the second unitary gate operation to the quantum state of the second transformed real vector: |e>=U2|z>. On the contrary, when the operation is restored, |z>=U2|e>. The unitary gate operation is a reversible process. Since the quantum state can be represented by a column vector, after the position migration of step S1 and step S3, the unitary gate operation can be used to restore the position before the migration from the position after the migration. For ease of understanding, this process can be regarded as applying two unitary operations, for example, U1U1=I, U2U2=I, which means that the position is migrated first and then the same position migration is performed again, which is equivalent to the position not changing, that is, it is restored to the position before the migration.
[0056] In step S4, for the third transformed real vector e, the initial state of t qubits is set to , generate the third quantum circuit corresponding to the Top-down amplitude coding, at this time the parameter The controlled RY gate group with a value of 0 does not need to be generated, thereby saving the quantum gates required to be executed. The generated third quantum circuit is executed to realize the transformation of the third real vector Encoding it onto t quantum bits yields the third quantum state |e>.
[0057] In step S5, the second unitary gate U2 operation is performed on the third quantum state |e>, that is, the second unitary gate is applied to the third quantum circuit to construct a second quantum circuit. The second quantum circuit can be executed to obtain the second quantum state |z> of t quantum bits, that is, |z>=U2|e>.
[0058] In step S6, a tensor transformation is performed on the second quantum state |z> qubit state, we can get the first quantum state of n quantum bits |y>, that is .
[0059] In step S7, the first unitary gate U1 operation is performed on the first quantum state |y> to obtain the target quantum state |x> of the sparse real vector x of n quantum bits, that is, |x>=U1|y>.
[0060] like Figure 4 As shown, a schematic diagram of the quantum circuit for obtaining the target quantum state |x> from the third quantum state |e> is given. T quantum bits are used for amplitude encoding, which reduces the number of quantum gates, and position transformation and recovery are achieved by applying unitary gates.
[0061] like Figure 5 As shown, a quantum state preparation device based on sparse real vectors is given, including: A first migration unit 201 is configured to obtain a first transformed real vector y by performing non-zero element position migration on the sparse real vector x; A dimensionality reduction transformation unit 202 is configured to obtain a second transformed real vector z including all non-zero elements and requiring the least number of quantum bits by performing dimensionality reduction processing on the first transformed real vector y; The second migration unit 203 is configured to obtain a third transformed real vector e with the minimum number of required quantum gates by performing zero element position migration on the second transformed real vector z; The amplitude coding unit 204 is configured to perform amplitude coding based on the third transformed real vector e to construct a third quantum circuit and obtain a third quantum state |e>; The second recovery unit 205 is configured to apply a second unitary gate U2 to the third quantum circuit to construct a second quantum circuit and obtain a second quantum state |z>. The second unitary gate is used to control the third quantum state |e> to recover the zero element position.
[0062] A dimension-upgrading unit 206 is configured to perform a tensor zero state on the second quantum circuit to construct a first quantum circuit, and to obtain a first quantum state |y> by dimension-upgrading; The first recovery unit 207 is configured to apply the first unitary gate U1 to the first quantum circuit to construct a target quantum circuit, obtain a target quantum state |x> of a sparse real vector, and use the first unitary gate to control the first quantum state |y> to recover the position of non-zero elements.
[0063] Example 1: Implementation Quantum Amplitude Coding of a 1-dimensional Normalized Sparse Real Vector x For a randomly generated 16-dimensional normalized real vector , the number of quantum bits required to achieve amplitude coding is n=4. The randomly generated x is represented as: x=[0.37739145, 0., 0., 0.55843641, 0., 0., 0., 0.,0.69085068, 0., 0., 0.20602013, 0., 0., 0., 0.16126227] T , dimension is 2 n , where the real vector include non-zero elements. Normalized real vector The modulus length is 1 and satisfies .
[0064] Normalized real vector The m non-zero elements in are adjusted by swapping the non-zero elements with the zero elements. The 16-dimensional real vector y=[0.37739145, 0.16126227,0.20602013, 0.55843641, 0.69085068, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,0., 0.,0.,] is obtained by position adjustment. T , where the m non-zero elements are adjusted to the first m positions of the real vector y.
[0065] Extract the first 8 elements from the real vector y ( elements) to obtain the reduced-dimensional real vector z=[0.37739145,0.16126227, 0.20602013, 0.55843641, 0.69085068, 0., 0., 0.,] T . The real vector z includes all m non-zero elements.
[0066] Relocate the zero elements in the real vector z and get the real vector e=[0.37739145, 0.,0.16126227, 0., 0.20602013, 0., 0.55843641, 0.69085068] T .
[0067] The specific process of zero element position migration is as follows: For the real vector z, the parameters are calculated as The size of the controlled RY gate group is obtained, and group_size is: [5, 3, 3, 1]; Select the group with the largest group_size in the controlled RY door group groups, and mark the corresponding parameters as set A, i.e. max_group_size: [5, 3, 3]; Command Parameters is 0, corresponding to the vector The elements with subscript h of 1, 3, and 5 should be set to 0, that is, zeros_idx: [1, 3, 5], denoted as B; By transforming the above real vector z, we obtain a real vector e with subscripts h of 1, 3, and 5 and elements of 0.
[0068] For the real vector e, the required number of quantum bits is t=3, so the initial state of the three quantum bits is set to , generating the quantum circuit corresponding to the Top-down amplitude coding. The controlled RY gate group with 0 does not need to be generated, which can save the quantum gates required to be executed. The resulting quantum circuit is as follows Figure 6 As shown, the corresponding parameters are: 2.2958* + 0.8076* + 2.6858* + + + + 1.782* Among them, the parameters If is 0, no quantum gate is needed.
[0069] Executing the quantum circuit obtained based on the real vector e can realize the conversion of the real vector Encoding it onto three quantum bits, we can get the corresponding quantum state |e>, namely:
[0070] By continuing to perform the U2 unitary gate operation on the quantum state |e>, we can obtain the quantum state |z> represented by 3 quantum bits, that is:
[0071] Tensor 1 (i.e. 4-3) qubits The quantum circuit obtained is Figure 7 As shown in the figure, the I gate in the figure can be ignored. Its purpose is only to show the existence of the fourth quantum bit, and it is not actually necessary to execute this quantum gate. Figure 7 The quantum circuit shown can obtain |y>=|0>|z> for n=4 quantum bits, that is:
[0072] By performing the U1 unitary gate operation on the quantum state |y>, we can obtain the quantum state |x> of 4 qubits, namely:
[0073] The corresponding column vector is x=[0.37739145, 0., 0., 0.55843641, 0., 0., 0., 0.,0.69085068, 0., 0., 0.20602013, 0., 0., 0., 0.16126227] T Through calculation, it can be found that in this embodiment, only 6 quantum gates need to be executed, together with 1 U1 gate and 1 U2 gate, a total of 8 quantum gates, and the fidelity of the above amplitude encoding is 100%.
[0074] Reference Figure 1 If the existing method of obtaining quantum circuits by amplitude coding is adopted, a total of 49 quantum gates are required to prepare a quantum circuit of amplitude-coded quantum states for the real vector x of this embodiment. If the quantum circuit is further optimized by canceling adjacent X gates, 37 quantum gates are still required. In addition, 15 quantum gates in the generated quantum circuit are parameter gates, and multiple quantum gate bit gates such as C^3RY gates and C^2RY gates need to be executed multiple times.
[0075] The technical solution of the present invention cleverly transforms the position in the original vector and sets the elements at specific positions to 0, so that fewer quantum gates can be used to construct a quantum circuit for implementing amplitude coding, reducing the depth of the quantum circuit and further improving the execution efficiency of amplitude coding.
[0076] Through the above comparative analysis results, it can be seen that compared with the original amplitude coding method, the quantum state preparation method for sparse real vectors of this embodiment can greatly reduce the number of quantum gates used, and achieve 100% fidelity amplitude coding, so it is more efficient and easier to implement in actual physical experiments. The technical solution of the present invention can efficiently and accurately output the amplitude-coded quantum state corresponding to the normalized sparse real vector x. Based on this result, various computing tasks of further quantum machine learning can be performed.
[0077] In addition, a computer-readable storage medium storing a computer program may also be provided according to an exemplary embodiment of the present invention. The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform a quantum state preparation method based on sparse real vectors according to an exemplary embodiment of the present invention. The computer-readable recording medium is any data storage device that can store data read out by a computer system. Examples of computer-readable recording media include: read-only memory, random access memory, read-only optical disk, magnetic tape, floppy disk, optical data storage device, and carrier wave (such as data transmission through the Internet via a wired or wireless transmission path).
[0078] In addition, a computing device may be provided according to an exemplary embodiment of the present invention. The computing device includes a processor and a memory. The memory is used to store a computer program. The computer program is executed by the processor so that the processor executes the computer program of the quantum state preparation method based on sparse real vectors according to an exemplary embodiment of the present invention.
[0079] It should be noted that the first, second, third, fourth, etc. in the above description are to distinguish features with the same name in the same or different embodiments, and are not quantitatively limited. And the present invention is not limited to the specific configurations and processes described above or shown in the figures. The above is only a specific embodiment of the present invention. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the described system, device, module or unit can refer to the corresponding process in the method embodiment without further description. It should be understood that the scope of protection of the present invention is not limited to this. Any technician familiar with the technical field can think of various equivalent modifications or substitutions within the technical scope disclosed by the present invention, and these modifications or substitutions should be covered within the scope of protection of the present invention.
Claims
1. A method for preparing a quantum state based on a sparse real vector, characterized in that: include: Obtain a first transformed real vector by performing non-zero element position migration on the sparse real vector; By performing dimensionality reduction processing on the first transformed real vector, a second transformed real vector including all non-zero elements and requiring the least number of quantum bits is obtained; By performing zero element position migration on the second transformed real vector, a third transformed real vector with the least number of required quantum gates is obtained; Performing amplitude coding based on the third transformed real vector to construct a third quantum circuit and obtain a third quantum state; Applying a second unitary gate to the third quantum circuit constructs a second quantum circuit to obtain a second quantum state; Execute the tensor zero state in the second quantum circuit to construct the first quantum circuit, and obtain the first quantum state by dimension upgrading; A first unitary gate is applied to the first quantum circuit to construct a target quantum circuit, and a target quantum state of a sparse real vector is obtained.
2. The method according to claim 1, characterized in that The method obtains a first transformed real vector by performing non-zero element position migration on a sparse real vector, including: obtaining position information of m non-zero elements in the sparse real vector, migrating the m non-zero elements to the first m positions, or the last m positions, or the middle m positions of the first transformed real vector, and recording the position exchange combination before and after the migration of the m non-zero elements.
3. The method according to claim 2, characterized in that The first unitary gate is applied to the first quantum circuit to construct the target quantum circuit, and the operation of applying the first unitary gate includes: traversing the position exchange combinations before and after the migration of the m non-zero elements, and for each pair of positions before and after the migration of the non-zero elements, exchanging the corresponding front and back positions based on the unit matrix.
4. The method according to claim 1, characterized in that: The second transformed real vector including all non-zero elements and requiring the least number of quantum bits is obtained by performing dimensionality reduction processing on the first transformed real vector, including: A first quantum bit number n is determined according to the dimension of the sparse real vector, and a second quantum bit number t is determined according to the number m of non-zero elements in the sparse real vector, where the dimension of the second transformed real vector is 2 to the power of t; m non-zero elements are extracted to the second transformed real vector, and the remaining elements of the second transformed real vector are supplemented to 0.
5. The method according to claim 1, characterized in that The method of performing zero element position migration on the second transformed real vector to obtain a third transformed real vector requiring the least number of quantum gates comprises: Calculate the required number of quantum gates of the controlled RY gate group corresponding to each parameter after the second transformed real vector is converted into a quantum circuit according to the amplitude coding method; After arranging the required quantum gate numbers from large to small, select some controlled RY gate groups and obtain the corresponding parameter index positions; The zero elements in the second transformed real vector are migrated to the parameter index position to obtain a third transformed real vector and a zero element position migration combination.
6. The method according to claim 5, characterized in that The second unitary gate is applied to the third quantum circuit to construct the second quantum circuit, and the operation of applying the second unitary gate includes: Traverse the zero element position migration combinations, and for each pair of positions before and after zero element migration, exchange the corresponding index positions based on the unit matrix.
7. The method according to claim 1, characterized in that The method of executing the tensor zero state in the second quantum circuit to construct the first quantum circuit and upgrading the dimension to obtain the first quantum state includes: applying a tensor nt quantum bits to the second quantum state state, n is the number of qubits required for the sparse real vector, and t is the number of qubits required for the first transformed real vector.
8. A quantum state preparation device based on sparse real vectors, characterized in that: include: A first migration unit is configured to obtain a first transformed real vector by performing non-zero element position migration on the sparse real vector; A dimension reduction transformation unit is configured to obtain a second transformed real vector including all non-zero elements and requiring the least number of quantum bits by performing dimension reduction processing on the first transformed real vector; A second migration unit is configured to obtain a third transformed real vector requiring the least number of quantum gates by performing zero element position migration on the second transformed real vector; an amplitude coding unit, configured to perform amplitude coding based on the third transformed real vector to construct a third quantum circuit and obtain a third quantum state; A second recovery unit is configured to apply a second unitary gate to the third quantum circuit to construct a second quantum circuit and obtain a second quantum state; A dimension-upgrading transformation unit is configured to execute the tensor zero state in the second quantum circuit to construct the first quantum circuit, and to obtain the first quantum state by dimension-upgrading; The first recovery unit is configured to apply a first unitary gate to the first quantum circuit to construct a target quantum circuit and obtain a target quantum state of a sparse real vector.
9. A computer-readable storage medium storing a computer program, wherein: When the computer program is executed by a processor, the quantum state preparation method based on sparse real vectors described in any one of claims 1 to 7 is implemented.
10. A computing device comprising: processor; A memory storing a computer program, which, when executed by a processor, implements the quantum state preparation method based on sparse real vectors according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for encoding complex vector to quantum circuit
CN112633507A
Data processing method and system
CN114219092A
Preparation method and device of quantum state
CN116822643A
Quantum state determination method and device
CN116933879A
Quantum state coding circuit, quantum calculation method and related device
CN117787428A