Quantum State Preparation Method, Apparatus, Medium and Device Based on Sparse Real Vectors

By performing non-zero element and zero element position migration and dimensionality reduction processing on the sparse real vector, the third transform real vector with the smallest number of quantum gates is formed, which solves the problem of low efficiency in the amplitude encoding process, and realizes the efficient amplitude encoding quantum state preparation of sparse real vectors, ensuring 100% fidelity and high efficiency.

CN119416902BActive Publication Date: 2025-05-27GUOKAIKE QUANTUM TECH (ANHUI) CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510034619.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-09
Publication Date
2025-05-27
Estimated Expiration
2045-01-09

AI Technical Summary

Technical Problem

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.

Method used

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 formed, and amplitude encoding is performed based on this to construct quantum circuits to achieve efficient quantum state preparation.

Benefits of technology

The high-efficiency amplitude-encoded quantum state preparation of sparse real vectors is realized, the number of quantum gates is used is reduced, the complexity of quantum lines is optimized, and the fidelity and high efficiency are ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119416902B_ABST
    Figure CN119416902B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, apparatus, medium, and device for preparing a quantum state based on a sparse real vector. The method includes: performing non-zero element position migration on the sparse real vector to obtain a first transformed real vector; obtaining a second transformed real vector that includes all non-zero elements and has the least number of required qubits by performing dimensionality reduction processing on the first transformed real vector; performing zero element position migration on the second transformed real vector to obtain a third transformed real vector with the least number of required quantum gates; performing amplitude encoding based on the third transformed real vector to construct a third quantum circuit to obtain a third quantum state; applying a second unitary gate to the third quantum circuit to construct a second quantum circuit to obtain a second quantum state; performing tensor zero state construction on the second quantum circuit to construct a first quantum circuit, and performing dimensionality increase to obtain a first quantum state; applying a first unitary gate to the first quantum circuit to construct a target quantum circuit to obtain the target quantum state of the sparse real vector. The present invention can efficiently implement the preparation of an amplitude encoding quantum state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of quantum computing, and in particular, to a method, apparatus, medium, and device for preparing a quantum state based on a sparse real vector. Background Art

[0002] Quantum algorithms are cutting-edge computing paradigms based on the principles of quantum mechanics. Using qubits as the basic units for information encoding, they utilize quantum mechanical properties such as quantum superposition and quantum entanglement to achieve efficient processing of computational tasks. In specific computational scenarios, quantum algorithms exhibit significant performance advantages compared to traditional algorithms. For example, the Shor algorithm provides exponential acceleration relative to classical algorithms in the problem of factoring large integers, while the Grover algorithm achieves a quadratic efficiency improvement over classical search algorithms in the task of searching an unordered database. These advancements not only highlight the potential of quantum algorithms in handling complex problems but also provide a solid theoretical foundation and practical guidance for the continuous development and application of quantum computing technology.

[0003] In the field of quantum machine learning, one of the key steps in enabling quantum algorithms to effectively process classical data is to map classical data to quantum states. Amplitude encoding, as a widely used encoding strategy in quantum information processing, realizes data representation by leveraging the amplitude attributes of quantum states. The advantage of amplitude encoding technology lies in its ability to fully utilize the high-dimensional data representation capabilities conferred by the principle of quantum superposition, enabling quantum systems to efficiently process large-scale data sets even when the scale is limited. The amplitude encoding method provides important technical support for quantum machine learning algorithms when dealing with high-dimensional data.

[0004] Currently, a series of amplitude encoding technologies have been developed for different requirements, including top-down Top-down amplitude encoding, which directly utilizes the superposition characteristics of quantum states to achieve precise encoding of data without introducing auxiliary qubits. In contrast, bottom-up Bottom-up amplitude encoding requires the introduction of auxiliary qubits and realizes data encoding by gradually constructing quantum states. For sparse data, double-sparse encoding provides an efficient strategy for optimizing the use of quantum resources. In addition, MPS approximate encoding, as an approximation technique, although it cannot guarantee 100% fidelity, can provide effective data encoding approximations in certain cases.

[0005] The preparation of quantum states is a specific and extensive problem in the field of quantum computing. The preparation of quantum states refers to the process of transforming a quantum system from an initial state to a target state. In quantum computing, it is usually necessary to transform qubits 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 processing by quantum algorithms, which is defined as the preparation of quantum states.

[0006] The efficiency of amplitude encoding is a key factor affecting the performance of algorithms and often becomes a bottleneck restricting the improvement of algorithm performance. Taking the HHL algorithm as an example, this algorithm theoretically has the potential for exponential acceleration in dealing with linear algebra problems. However, if the efficiency of the amplitude encoding process is not high, this potential may be greatly reduced due to complex encoding steps, resulting in the actual performance of the algorithm not meeting expectations. Therefore, achieving efficient amplitude encoding is crucial for the performance of quantum machine learning algorithms. Efficient amplitude encoding can not only reduce the consumption of quantum resources, reduce the cumulative error of quantum operations, but also improve the fidelity and robustness of the algorithm, thus giving full play to the advantages of quantum machine learning algorithms in dealing with complex problems.

[0007] Therefore, how to efficiently implement the preparation of quantum states by amplitude encoding has become a technical problem to be solved. Summary of the Invention

[0008] The purpose of the present invention is to provide a method, device, medium and equipment for preparing quantum states based on sparse real vectors, to realize the transformation of sparse real vectors and efficiently complete the preparation of quantum states by amplitude encoding.

[0009] According to one aspect of the present invention, a method for preparing quantum states based on sparse real vectors is provided, including:

[0010] By performing non-zero element position migration on the sparse real vector, a first transformed real vector is obtained;

[0011] By performing dimensionality reduction processing on the first transformed real vector, a second transformed real vector including all non-zero elements and having the least number of required qubits is obtained;

[0012] 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;

[0013] Based on the third transformed real vector, an amplitude encoding is performed to construct a third quantum circuit to obtain a third quantum state;

[0014] A second unitary gate is applied to the third quantum circuit to construct a second quantum circuit to obtain a second quantum state;

[0015] Construct the first quantum circuit in the second quantum circuit to execute the tensor zero state and elevate the dimension to obtain the first quantum state;

[0016] Apply the first unitary gate in the first quantum circuit to construct the target quantum circuit and obtain the target quantum state of the sparse real vector.

[0017] According to an embodiment of the present invention, the obtaining of the first transformed real vector by performing non-zero element position migration on the sparse real vector includes: obtaining the 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.

[0018] According to an embodiment of the present invention, the operation of applying the first unitary gate in the first quantum circuit to construct the target quantum circuit 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 a non-zero element, exchanging the corresponding front and back positions based on the identity matrix.

[0019] According to an embodiment of the present invention, the obtaining of the second transformed real vector including all non-zero elements and having the minimum required number of qubits by performing dimensionality reduction processing on the first transformed real vector includes:

[0020] Determine the first number of qubits n according to the dimension of the sparse real vector, determine the second number of qubits t according to the number of non-zero elements m in the sparse real vector, and the dimension of the second transformed real vector is 2 to the power of t; extract m non-zero elements into the second transformed real vector and supplement the remaining elements of the second transformed real vector with 0.

[0021] According to an embodiment of the present invention, the obtaining of the third transformed real vector having the minimum required number of quantum gates by performing zero element position migration on the second transformed real vector includes:

[0022] Calculate the required number of quantum gates for each parameter corresponding to the controlled RY gate group after converting the second transformed real vector into a quantum circuit according to the amplitude encoding method;

[0023] After arranging in descending order of the required number of quantum gates, select some controlled RY gate groups and obtain the corresponding parameter index positions;

[0024] Migrate the zero elements in the second transformed real vector to the parameter index positions to obtain the third transformed real vector and the zero element position migration combination.

[0025] According to an embodiment of the present invention, the operation of applying the second unitary gate in the third quantum circuit to construct the second quantum circuit includes:

[0026] Traverse the zero-element position migration combinations. For each pair of positions before and after the zero-element migration, swap the corresponding index positions based on the identity matrix.

[0027] According to an embodiment of the present invention, constructing the first quantum circuit in the second quantum circuit to obtain the first quantum state by dimension elevation includes: applying a tensor of n - t qubits to the second quantum state, where 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.

[0028] According to another aspect of the present invention, there is provided a quantum state preparation device based on a sparse real vector, including:

[0029] A first migration unit configured to obtain a first transformed real vector by performing non-zero element position migration on the sparse real vector;

[0030] A dimension reduction transformation unit configured to obtain a second transformed real vector including all non-zero elements and having the least number of required qubits by performing dimension reduction processing on the first transformed real vector;

[0031] A second migration unit configured to obtain a third transformed real vector with the least number of required quantum gates by performing zero-element position migration on the second transformed real vector;

[0032] An amplitude encoding unit configured to construct a third quantum circuit by performing amplitude encoding based on the third transformed real vector to obtain a third quantum state;

[0033] A second recovery unit configured to obtain a second quantum state by applying a second unitary gate to the third quantum circuit to construct a second quantum circuit;

[0034] A dimension elevation transformation unit configured to construct a first quantum circuit by performing tensor zero state on the second quantum circuit and obtain the first quantum state by dimension elevation;

[0035] A first recovery unit configured to obtain the target quantum state of the sparse real vector by applying a first unitary gate to the first quantum circuit to construct a target quantum circuit.

[0036] According to another aspect of the present invention, there is provided a computer-readable storage medium storing a computer program, which when executed by a processor, implements the quantum state preparation method based on a sparse real vector as described above.

[0037] According to another aspect of the present invention, there is provided a computer device, which includes: a processor; a memory storing a computer program, which when executed by the processor, implements the quantum state preparation method based on a sparse real vector as described above.

[0038] The quantum state preparation method based on sparse real vectors proposed by the technical solution of the present invention can efficiently and accurately achieve the preparation of amplitude-encoded quantum states for sparse real vectors, solving the problem of preparing quantum states of sparse real vectors. Compared with the prior art, the beneficial effects of the present invention are as follows:

[0039] (1) This method of preparing amplitude-encoded quantum states based on sparse real vectors avoids the introduction of auxiliary qubits. Compared with the traditional Top-down amplitude encoding method, it significantly reduces the use of quantum gates and optimizes the complexity of the quantum circuit.

[0040] (2) During the implementation process, it not only ensures 100% fidelity and excellent efficiency, but also is particularly suitable for actual operations in a physical experimental environment due to the reduction in the number of quantum gates.

[0041] (3) Through verification on a quantum simulator, high efficiency of amplitude encoding is achieved, and the fidelity of the encoding process is ensured to reach 100%. The realization of this high fidelity plays a crucial role in the subsequent implementation of quantum machine learning tasks.

[0042] Therefore, this method of preparing amplitude-encoded quantum states based on sparse real vectors is not only efficient in theory but also highly feasible in experiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The above objects and features of the present invention will become clearer through the following description in conjunction with the drawings.

[0044] Figure 1 Shows a schematic diagram of a Top-down amplitude encoding quantum circuit of n qubits.

[0045] Figure 2 Shows a schematic diagram of the conversion of two types of controlled RY gates in a quantum circuit.

[0046] Figure 3 Shows a flowchart of a quantum state preparation method based on sparse real vectors according to an exemplary embodiment of the present invention;

[0047] Figure 4 Shows a schematic diagram of a quantum circuit for obtaining the target quantum state |x> from the third quantum state |e> according to an exemplary embodiment of the present invention;

[0048] Figure 5 Shows a schematic diagram of a quantum state preparation device based on sparse real vectors according to an exemplary embodiment of the present invention;

[0049] Figure 6 Shows a schematic diagram of a 3-qubit quantum circuit for generating the third quantum state |e> according to an exemplary embodiment of the present invention.

[0050] Figure 7 Shown is a schematic diagram of a 4-qubit quantum circuit for generating the first quantum state |y> according to an exemplary embodiment of the present invention. Detailed implementation

[0051] For a d-dimensional normalized sparse real vector , where denotes the transpose, and simultaneously satisfies is a real number, and ... , the sparsity means that the vector x includes k non-zero elements, and satisfies , where n represents the number of qubits required for amplitude encoding of the sparse real vector x, denotes the number of qubits to be used for subsequent low-dimensional amplitude encoding.

[0052] Based on the existing Top-down amplitude encoding method, given a d-dimensional normalized real vector , if the existing Top-down amplitude encoding method is used, the real vector x is encoded onto n qubits, and the corresponding quantum circuit is as Figure 1 shown. In the Top-down amplitude encoding quantum circuit of n qubits, a total of n qubits are required, and 1 RY gate and m controlled RY gates need to be executed. Each parameter in the quantum circuit is calculated according to the vector element , where ... , and there are 1 parameter in total. Although the existing amplitude encoding method can achieve 100% fidelity amplitude encoding, as the number of qubits increases, the depth of the required quantum circuit will increase exponentially, which makes the specific physical implementation very difficult.

[0053] In the quantum circuit obtained by the existing amplitude encoding method, the controlled RY gates are divided into two categories: the first category is that all control bits are in the |1> state, and the second category is that some or all control bits are in the |0> state. The hollow origin in the figure represents the |0> state as the controlled bit. In actual execution, the second category of controlled RY gates needs to be indirectly implemented through the combination of X gates, the first category of controlled RY gates, and X gates.

[0054] As Figure 2 shown, for the second category of controlled RY gates on the left, it needs to be decomposed into the quantum gate combination on the right. Similar toFigure 2 The quantum gate combination on the right is defined as a controlled RY gate group, and the number of quantum gates included 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.

[0055] Next, embodiments of the present invention will be described in detail with reference to the accompanying drawings.

[0056] For a given dimensional normalized real vector , which includes non-zero elements and satisfies , only qubits are required to achieve low-dimensional amplitude encoding and can be used as a sparse real vector. Normalization means that the modulus of the real vector is 1, represents transpose, and at the same time satisfies is a real number, and ... .

[0057] As Figure 3 shown, a flowchart of a method for preparing a quantum state based on a sparse real vector is given. The method includes the following steps:

[0058] Step S1: Obtain a first transformed real vector by performing non-zero element position migration on the sparse real vector;

[0059] Step S2: Obtain a second transformed real vector that includes all non-zero elements and requires the fewest number of qubits by performing dimensionality reduction on the first transformed real vector;

[0060] Step S3: Obtain a third transformed real vector that requires the fewest number of quantum gates by performing zero element position migration on the second transformed real vector;

[0061] Step S4: Based on the third transformed real vector, perform amplitude encoding to construct a third quantum circuit to obtain a third quantum state;

[0062] Step S5: Apply a second unitary gate to the third quantum circuit to construct a second quantum circuit to obtain a second quantum state; use the second unitary gate to control the third quantum state to restore the zero element position.

[0063] Step S6: Perform tensor zero state on the second quantum circuit to construct a first quantum circuit and perform dimensionality increase to obtain a first quantum state;

[0064] Step S7: Apply a first unitary gate to the first quantum circuit to construct a target quantum circuit to obtain the target quantum state of the sparse real vector. Use the first unitary gate to control the first quantum state to restore the non-zero element position.

[0065] In step S1, perform an element transformation on the sparse real vector to obtain a first transformed real vector . The position information of the m non-zero elements in the sparse real vector can be obtained, and the m non-zero elements are migrated to the first m positions, or 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, in the first transformed real vector only the first items are non-zero elements, and the remaining items are all 0.

[0066] For this non-zero element position migration transformation operation, it is implemented through the following sub-steps:

[0067] Sub-step 1-1: Let .

[0068] Sub-step 1-2: Traverse the positions of the real vector from 0 to , and find the th position where the element is 0 ;

[0069] Sub-step 1-3: Traverse the positions of the real vector from to to , and find the th position from the end where the element is not 0 ;

[0070] Sub-step 1-4: Exchange the positions of and in the real vector , record the position exchange combination , and the superscript indicates that this is the th combination.

[0071] Sub-step 1-5: Determine whether the first items in the current vector are all non-zero elements. If so, execute sub-step 1-7; otherwise, execute sub-step 1-6.

[0072] Sub-step 1-6: Let . Loop through sub-steps 1-2 to 1-5.

[0073] Sub-step 1-7: Output the real vector at this time (the first items are all non-zero elements).

[0074] Sub-step 1-8: Save all the position exchange combinations .​

[0075] Sub-step 1-9: Let \(I = diag\{1, 1, \cdots, 1\}\), where \(diag\{1, 1, \cdots, 1\}\) represents an \(n\)-dimensional identity matrix with only the diagonal elements being 1 (there are \(n\) of them) and the other elements being 0.

[0076] Sub-step 1-10: Traverse all , according to , swap the \(j\)-th column and the \(k\)-th column of \(I\).

[0077] Sub-step 1-11: Output \(U_1\) after exchanges. Obviously, \(U_1\) is a unitary operation for realizing quantum state transformation.

[0078] The first transformed real vector , can be used to realize the amplitude encoding of the first -dimensional elements through qubits, and then by tensoring qubits in the state \(|0\rangle\), the amplitude encoding of the first transformed real vector of dimensions can be realized. After obtaining the first quantum state by realizing the amplitude encoding of the first transformed real vector, then according to the position migration combination in step S1, the corresponding \(U_1\) quantum gate operation is determined. The \(U_1\) quantum gate is a unitary gate. By applying the \(U_1\) unitary gate operation, the amplitude encoding of the sparse real vector of dimensions can be realized to obtain the final target quantum state.

[0079] To use fewer quantum gates, continue to perform dimensionality reduction processing.

[0080] In step S2, a second transformed real vector \(z\) is extracted from the first transformed real vector \(y\), expressed as:

[0081] , including \(m\) non-zero elements and \(-m\) zero elements.

[0082] According to the principle of the Top-down amplitude encoding technology, the second transformed real vector \(z\) has a total of parameters, which are respectively , and then calculate the sizes of the controlled RY gate groups with parameters , that is, calculate the number of quantum gates included in each parameter's controlled RY gate group. The calculation formula for the size of the controlled RY gate group with parameter is as follows:

[0083]

[0084] Among them, an operation in the form of binary(int, length) represents converting a decimal integer int into a binary number with the number of digits being length. When the number of digits is insufficient, zeros are filled on the left side of the binary number; an operation in the form of count(bin, 0) represents calculating the number of 0s in the binary number bin.

[0085] Select the largest groups from the controlled RY gate groups with the parameter and mark the corresponding parameter subscripts as set A.

[0086] According to the method of calculating the RY gate parameters by Top-down amplitude encoding, if the element at a specific subscript in the vector is 0, it can directly make the parameter be 0. Then, calculate the subscript h of the vector element that makes the parameter ( ∈A) be 0, and denote it as set B. The calculation formula is as follows:

[0087] For each vector subscript h (h ∈ B) in set B.

[0088] Perform position migration on the zero elements of the second transformation real vector to obtain the third transformation real vector . In the third transformation real vector , the elements at the positions h (h ∈ B) are all 0, and the remaining positions are in turn (or one of the permutations of ). If there is no requirement to minimize the number of quantum gates, arbitrary can be made 0.

[0089] For the position migration transformation operation in step S3, it is similar to the position migration in step S1. Obviously, this is also a quantum unitary gate operation for realizing quantum state transformation, and the position recovery operation is realized through the second unitary gate U2, that is, the quantum state of the third transformation real vector can be obtained by applying the second unitary gate operation to the quantum state of the second transformation real vector: |e>=U2|z>. Conversely, during the recovery operation, |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 in steps S1 and S3, it can be restored from the migrated position to the original position through the unitary gate operation. For easy understanding, this process can be regarded as applying two unitary operations. For example, U1U1 = I, U2U2 = I, which means migrating the position and then performing the same position migration again, equivalent to the position not changing, that is, restoring to the original position before migration.

[0090] In step S4, for the third transformed real vector e, set the initial state of t qubits to , generate the third quantum circuit corresponding to the Top-down amplitude encoding. At this time, the controlled RY gate group with parameter being 0 does not need to be generated, thus saving the quantum gates to be executed. Execute the generated third quantum circuit to encode the third transformed real vector onto t qubits, and then the third quantum state |e> can be obtained.

[0091] In step S5, perform the second unitary gate U2 operation on the third quantum state |e>, that is, apply the second unitary gate to the third quantum circuit to construct the second quantum circuit. Executing the second quantum circuit can obtain the second quantum state |z> of t qubits, that is, |z> = U2|e>.

[0092] In step S6, perform the tensor product on the second quantum state |z> with qubits state, and then the first quantum state |y> of n qubits can be obtained, that is, .

[0093] In step S7, perform the first unitary gate U1 operation on the first quantum state |y>, and then the target quantum state |x> of the sparse real vector x of n qubits can be obtained, that is, |x> = U1|y>.

[0094] As Figure 4 shows, a schematic diagram of the quantum circuit for obtaining the target quantum state |x> from the third quantum state |e> is given. Amplitude encoding is performed using t qubits, reducing the number of quantum gates, and position transformation and restoration are achieved by applying unitary gates.

[0095] As Figure 5 shows, a quantum state preparation device based on a sparse real vector is given, including:

[0096] The first migration unit 201 is configured to obtain the first transformed real vector y by performing non-zero element position migration on the sparse real vector x;

[0097] The dimensionality reduction transformation unit 202 is configured to obtain the second transformed real vector z including all non-zero elements and having the minimum number of required qubits by performing dimensionality reduction processing on the first transformed real vector y;

[0098] The second migration unit 203 is configured to obtain the 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;

[0099] The amplitude encoding unit 204 is configured to perform amplitude encoding based on the third transformed real vector e to construct the third quantum circuit and obtain the third quantum state |e>;

[0100] 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, obtaining a second quantum state |z>. The second unitary gate is used to control the third quantum state |e> to recover the zero element positions.

[0101] The dimension-raising transformation unit 206 is configured to perform a tensor zero state on the second quantum circuit to construct a first quantum circuit, and raise the dimension to obtain a first quantum state |y>;

[0102] The first recovery unit 207 is configured to apply a first unitary gate U1 to the first quantum circuit to construct a target quantum circuit, obtaining a target quantum state |x> of the sparse real vector. The first unitary gate is used to control the first quantum state |y> to recover the non-zero element positions.

[0103] Embodiment 1: Implementation Quantum amplitude encoding of a d-dimensional normalized sparse real vector x

[0104] For a randomly generated 16-dimensional normalized real vector , the number of qubits n required to implement amplitude encoding is 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 , with dimension 2 n , where the real vector includes non-zero elements. The modulus length of the normalized real vector is 1 and satisfies .

[0105] Perform position adjustment on m non-zero elements in the normalized real vector by swapping the positions of non-zero elements with zero elements. Through position adjustment, a 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.,] is obtained T , where the m non-zero elements are adjusted to the first m positions of the real vector y.

[0106] Extract the first 8 elements from the real vector y ( The dimensionality-reduced real vector z = [0.37739145, 0.16126227, 0.20602013, 0.55843641, 0.69085068, 0., 0., 0.,] is obtained from T T All m non-zero elements are included in the real vector z.

[0107] Perform position migration on the zero elements in the real vector z to obtain the real vector e = [0.37739145, 0., 0.16126227, 0., 0.20602013, 0., 0.55843641, 0.69085068] T T .

[0108] The specific process of zero element position migration is as follows:

[0109] For the real vector z, calculate the size of the controlled RY gate group with parameters respectively, and obtain group_size: [5, 3, 3, 1];

[0110] Select the groups with the largest group_size in the controlled RY gate group, and mark the corresponding parameter subscripts as set A, that is, max_group_size: [5, 3, 3];

[0111] Let the parameter be 0. For the corresponding vector , the elements with subscripts h being 1, 3, and 5 should be 0, that is, zeros_idx: [1, 3, 5], denoted as B;

[0112] By transforming the above real vector z, a real vector e with elements at subscripts h being 1, 3, and 5 equal to 0 is obtained.

[0113] For the real vector e, the required number of qubits t = 3. Therefore, set the initial state of 3 qubits to , and generate the quantum circuit corresponding to the Top-down amplitude encoding. At this time, the controlled RY gate group with Figure 6 Figure 6 equal to 0 does not need to be generated, which can save the required quantum gates. The obtained quantum circuit is as shown in + 0.8076* + 2.6858* + + + + 1.782* . Among them, the parameter is 0, so no quantum gates are required.

[0114] Execute the quantum circuit obtained from the real vector e to achieve the real vector Encoded onto three qubits, the corresponding quantum state |e> can be obtained, i.e.:

[0115]

[0116] Continuing to perform the U2 unitary gate operation on the quantum state |e>, the quantum state |z> represented by three qubits can be obtained, i.e.:

[0117]

[0118] Tensor one (i.e., 4 - 3) qubits state, and the resulting quantum circuit is as Figure 7 shown. The I gates in the figure can be ignored, and their purpose is only to show that there is a fourth qubit. In fact, this quantum gate does not need to be executed. Executing Figure 7 the shown quantum circuit, the |y> = |0>|z> of n = 4 qubits can be obtained, i.e.:

[0119]

[0120] Performing the U1 unitary gate operation on the quantum state |y>, the quantum state |x> of four qubits can be obtained, i.e.:

[0121]

[0122] Its 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%.

[0123] Referring to Figure 1 , if the existing method of obtaining a quantum circuit by amplitude encoding is adopted, to prepare a quantum circuit for the amplitude - encoded quantum state of the real vector x in this embodiment, a total of 49 quantum gates need to be used. If the quantum circuit is further optimized by canceling adjacent X gates, 37 quantum gates are still required. And 15 quantum gates in the generated quantum circuit are parameter gates, and multi - qubit gates such as the C^3RY gate and C^2RY need to be executed multiple times.

[0124] The technical solution of the present invention ingeniously changes the positions in the original vector and makes the elements at specific positions be 0, so that a quantum circuit for implementing amplitude encoding can be constructed with fewer quantum gates, reducing the depth of the quantum circuit and further improving the execution efficiency of amplitude encoding.

[0125] From the above comparative analysis results, it can be seen that compared with the original amplitude encoding method, the quantum state preparation method for sparse real vectors in this embodiment can greatly reduce the number of quantum gates used and achieve amplitude encoding with a fidelity of 100%. Therefore, it is more efficient and easier to implement in actual physical experiments. Applying the technical solution of the present invention can efficiently and accurately output the quantum state after amplitude encoding corresponding to the normalized sparse real vector x. Based on this result, various computational tasks of further quantum machine learning can be performed.

[0126] In addition, according to an exemplary embodiment of the present invention, a computer-readable storage medium storing a computer program can also be provided. The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to execute the quantum state preparation method based on sparse real vectors according to the exemplary embodiment of the present invention. The computer-readable recording medium is any data storage device that can store data read by a computer system. Examples of computer-readable recording media include: read-only memory, random access memory, compact disc read-only memory, magnetic tape, floppy disk, optical data storage device, and carrier waves (such as data transmission via the Internet through wired or wireless transmission paths).

[0127] In addition, according to an exemplary embodiment of the present invention, a computing device can also be provided. The computing device includes a processor and a memory. The memory is used to store a computer program. The computer program, when executed by the processor, causes the processor to execute the computer program of the quantum state preparation method based on sparse real vectors according to the exemplary embodiment of the present invention.

[0128] It should be noted that the first, second, third, fourth, etc. in the above description are used to distinguish features with the same name in the same or different embodiments, and are not limitations in terms of quantity. And the present invention is not limited to the specific configurations and processes described above or shown in the figures. The above is only the specific implementation manner of the present invention. Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the described system, device, module, or unit can refer to the corresponding processes in the method embodiments and will not be described in detail again. It should be understood that the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can think of various equivalent modifications or substitutions, and these modifications or substitutions should be covered within the protection scope 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; Apply the first unitary gate to the first quantum circuit to construct the target quantum circuit and obtain the target quantum state of the sparse real vector. in, The method obtains a third transformed real vector with the least number of required quantum gates by performing zero element position migration on the second transformed real vector, including: calculating the required number of quantum gates of each parameter corresponding to the controlled RY gate group after the second transformed real vector is converted into a quantum circuit according to the amplitude coding method; selecting part of the controlled RY gate groups after arranging them in descending order according to the required number of quantum gates, and obtaining the corresponding parameter index position; migrating the zero element in the second transformed real vector to the parameter index position, and obtaining the third transformed real vector and the zero element position migration combination. 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: traversing the zero element position migration combination, and for each zero element migration before and after position pair, exchanging the corresponding index position based on the unit matrix.

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 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.

6. 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. in, The second migration unit is further configured to: calculate the required number of quantum gates of each parameter corresponding to the controlled RY gate group after the second transformed real vector is converted into a quantum circuit according to the amplitude coding method; select part of the controlled RY gate groups after arranging them in order from large to small according to the required number of quantum gates, and obtain the corresponding parameter index position; migrate the zero element in the second transformed real vector to the parameter index position to obtain the third transformed real vector and the zero element position migration combination, The second recovery unit is further configured to: traverse the zero element position migration combination, and for each zero element migration front and back position pair, exchange the corresponding index position based on the unit matrix.

7. 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 5 is implemented.

8. 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 as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Preparation method and device of quantum state

    CN116822643A