A quantum state encoding method and related apparatus

By constructing quantum circuits through singular value decomposition of classical data, the problem of low encoding rate in existing technologies is solved, efficient quantum state encoding is achieved, the complexity of quantum circuits is simplified, and encoding efficiency is improved.

CN116862005BActive Publication Date: 2026-01-06ORIGIN QUANTUM COMPUTING TECH (HEFEI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310724841.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-16
Publication Date
2026-01-06
Estimated Expiration
2043-06-16

AI Technical Summary

Technical Problem

In existing technologies, amplitude encoding schemes for classical data require a huge number of bits and lengthy encoding time, resulting in low encoding rates and an inability to effectively utilize the high-efficiency processing power of quantum computers.

Method used

Singular value decomposition is used to encode classical data, and quantum circuits are constructed using the results of singular value decomposition, which simplifies the complexity of quantum circuits and reduces encoding time.

Benefits of technology

Singular value decomposition simplifies quantum circuits, improves the efficiency of quantum state encoding, reduces encoding time, decreases the number of CNOT gates, and improves encoding fidelity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116862005B_ABST
    Figure CN116862005B_ABST
Patent Text Reader

Abstract

This invention discloses a quantum state encoding method and related apparatus, applied in the field of quantum computing technology. The method includes: acquiring classical data to be encoded; if the density of the classical data is greater than a preset density, performing singular value decomposition (SVD) on a first matrix constructed based on the classical data to obtain the SVD result; and constructing a first quantum circuit based on the SVD result to realize the quantum state encoding of the classical data. By processing the classical data to be encoded through singular value decomposition, the classical data can be approximated, retaining only its main features. This simplifies the complexity of the quantum circuit, reduces the encoding time, and greatly improves the efficiency of quantum state encoding.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of quantum computing technology, specifically a quantum state encoding method and related apparatus. Background Technology

[0002] A quantum computer is a physical device that performs high-speed mathematical and logical operations, stores and processes quantum information in accordance with the laws of quantum mechanics. When a device processes and calculates quantum information and runs quantum algorithms, it is a quantum computer. Because of its ability to process mathematical problems more efficiently than ordinary computers—for example, reducing the time to crack RSA keys from hundreds of years to hours—quantum computers have become a key technology under research.

[0003] In all real-world quantum computing scenarios, classical data needs to be encoded into quantum states required for quantum computing. The most common method for preparing these quantum states is amplitude encoding. However, since the dimensionality of classical data often far exceeds the number of qubits that current hardware can support, basic amplitude encoding schemes not only require an extremely large number of bits but also have a long encoding time, resulting in low encoding rates. Summary of the Invention

[0004] The purpose of this invention is to provide a quantum state encoding method and related apparatus, which aims to simplify the complexity of quantum circuits, reduce encoding time, and thus improve the efficiency of quantum state encoding.

[0005] One embodiment of the present invention provides a quantum state encoding method, the method comprising:

[0006] Obtain the classic data to be encoded;

[0007] If the density of the classical data is greater than the preset density, then singular value decomposition is performed on the first matrix constructed based on the classical data to obtain the singular value decomposition result.

[0008] A first quantum circuit is constructed based on the singular value decomposition results to realize the quantum state encoding of the classical data.

[0009] Optionally, the method further includes:

[0010] If the density of the classical data is not greater than the preset density, a second quantum circuit is constructed based on the classical data and the sparse coding method to realize the quantum state encoding of the classical data.

[0011] Optionally, the preset density is determined based on the number of qubits in the quantum system running the first quantum circuit, the number of elements in the classical data, and the number of non-zero elements.

[0012] Optionally, before performing singular value decomposition on the first matrix constructed based on the classical data, the method further includes:

[0013] The target number of qubits N is determined based on the number of elements in the classical data;

[0014] Pad the elements of the classic data with zeros until the number of elements in the classic data equals 2. N ;

[0015] Based on the elements of the classic data after zero-padding, construct the first matrix.

[0016] Optionally, the number of target qubits N is even and the first matrix is ​​a square matrix, wherein the number of rows or columns n of the first matrix satisfies:

[0017]

[0018] Where N is the number of target qubits.

[0019] Optionally, performing singular value decomposition on the first matrix constructed based on the classical data includes:

[0020] Singular value decomposition is performed on the first matrix constructed from the classical data to obtain a multiplied left singular vector matrix, a singular value matrix, and a right singular vector matrix.

[0021] A second matrix is ​​constructed based on the elements of the singular value matrix. Singular value decomposition is performed multiple times and iterated until the number of non-zero elements in the resulting singular value matrix is ​​no greater than 2.

[0022] Optionally, constructing the first quantum circuit based on the singular value decomposition result includes:

[0023] Determine the target qubit in the quantum system and divide the target qubit into two groups;

[0024] The first quantum logic gate is applied to one of the target qubits, and the first quantum logic gate corresponds to the matrix obtained by the second matrix decomposition.

[0025] The CNOT gate is applied to two sets of target qubits, where the control bit of the CNOT gate is the target qubit in one set, and the controlled bit of the CNOT gate is the target qubit in the other set.

[0026] The second quantum logic gate is applied to one set of target qubits, and the third quantum logic gate is applied to another set of target qubits to obtain the first quantum circuit. The second quantum logic gate corresponds to the left singular vector matrix, and the third quantum logic gate corresponds to the right singular vector matrix.

[0027] Another embodiment of the present invention provides a quantum state encoding device, the device comprising:

[0028] The acquisition unit is used to acquire the classic data to be encoded.

[0029] The singular value decomposition unit is used to perform singular value decomposition on the first matrix constructed based on the classical data if the density of the classical data is greater than a preset density, and to obtain the singular value decomposition result.

[0030] The encoding unit is used to construct a first quantum circuit based on the singular value decomposition result to realize the quantum state encoding of the classical data.

[0031] Another embodiment of the present invention provides a storage medium storing a computer program, wherein the computer program is configured to execute the method described in any of the preceding claims when running.

[0032] Another embodiment of the present invention provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the method described in any of the preceding claims.

[0033] Compared with the prior art, the present invention provides a quantum state encoding method and related apparatus. The method includes: acquiring classical data to be encoded; if the density of the classical data is greater than a preset density, performing singular value decomposition on a first matrix constructed based on the classical data to obtain a singular value decomposition result; and constructing a first quantum circuit based on the singular value decomposition result to realize quantum state encoding of the classical data.

[0034] By processing classical data to be encoded using singular value decomposition, we can approximate the encoding of classical data, retaining only its main features. This simplifies the complexity of quantum circuits, reduces encoding time, and significantly improves the efficiency of quantum state encoding. Attached Figure Description

[0035] Figure 1 A network block diagram of a quantum state coding system provided in an embodiment of the present invention;

[0036] Figure 2 A schematic flowchart of a quantum state encoding method provided in an embodiment of the present invention;

[0037] Figure 3 A graph showing the relationship between the density of classical data and the number of quantum logic gates required for encoding, provided in an embodiment of the present invention;

[0038] Figure 4A flowchart illustrating the process of constructing a first matrix based on classical data, provided for an embodiment of the present invention;

[0039] Figure 5 A schematic diagram of a process for constructing a first quantum circuit based on singular value decomposition results, provided for an embodiment of the present invention;

[0040] Figure 6 This is a schematic diagram of the structure of a quantum state encoding device provided in an embodiment of the present invention;

[0041] Figure 7 This is a schematic diagram of another quantum state encoding device provided in an embodiment of the present invention;

[0042] Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Detailed Implementation

[0043] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0044] Figure 1 This is a network block diagram of a quantum state coding system provided in an embodiment of the present invention. The quantum state coding system may include a network 110, a server 120, a wireless device 130, a client 140, a storage 150, a classical computing unit 160, a quantum computing unit 170, and may also include additional memory, a classical processor, a quantum processor, and other devices not shown.

[0045] Network 110 is a medium used to provide communication links between various devices and computers connected together within a quantum state coding system, including but not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The connection method can be wired, wireless communication links, or fiber optic cables.

[0046] Server 120, wireless device 130, and client 140 are conventional data processing systems that may contain data and application programs or software tools that perform conventional computational processes. Client 140 may be a personal computer or a network computer, so the data may also be provided by server 120. Wireless device 130 may be a smartphone, tablet, laptop, smart wearable device, etc. Storage unit 150 may include database 151, which can be configured to store data such as qubit parameters, quantum logic gate parameters, quantum circuits, and quantum programs.

[0047] The classical computing unit 160 (quantum computing unit 170) may include a classical processor 161 (quantum processor 171) for processing classical data (quantum data) and a memory 162 (memory 172) for storing classical data (quantum data). The classical data (quantum data) may be a boot file, an operating system image, and an application program 163 (application program 173). The application program 163 (application program 173) may be used to implement a quantum algorithm compiled by the quantum state encoding method provided in the embodiments of the present invention.

[0048] Any data or information stored or generated in the classical computing unit 160 (quantum computing unit 170) can also be configured to be stored or generated in another classical (quantum) processing system in a similar manner, and any application executed therein can also be configured to be executed in another classical (quantum) processing system in a similar manner.

[0049] It should be noted that a true quantum computer has a hybrid structure, which includes at least... Figure 1 The system consists of two main parts: the classical computing unit 160, which is responsible for performing classical calculations and control; and the quantum computing unit 170, which is responsible for running quantum programs to achieve quantum computing.

[0050] The aforementioned classical computing unit 160 and quantum computing unit 170 can be integrated into a single device or distributed across two different devices. For example, a first device including the classical computing unit 160 runs a classical computer operating system, providing quantum application development tools and services, as well as the storage and network services required for quantum applications. Users develop quantum programs using the quantum application development tools and services on the second device, and send these quantum programs to a second device including the quantum computing unit 170 via the network services. The second device runs a quantum computer operating system, which parses and compiles the quantum program's code into instructions that the quantum processor 170 can recognize and execute. The quantum processor 170 then implements the quantum algorithm corresponding to the quantum program based on these instructions.

[0051] The computing units of the classic processor 161 within the classic computing unit 160 are based on CMOS transistors on a silicon chip. These computing units are not limited by time or coherence; that is, they are available at any time without time constraints. Furthermore, the number of such computing units in a silicon chip is sufficient; currently, a single classic processor 161 contains tens of thousands of computing units. Given this sufficient number of computing units and the fixed selectable computing logic of the CMOS transistors (e.g., AND logic), computational performance is achieved by combining a large number of CMOS transistors with a limited set of logic functions during operation.

[0052] In the quantum computing unit 170, the basic computing unit of the quantum processor 171 is the qubit. The input of a qubit is limited by coherence and coherence time; that is, a qubit is limited by its available usage time and is not always readily available. Making full use of qubits within their available usage time is a key challenge in quantum computing. Furthermore, the number of qubits in a quantum computer is one of the representative indicators of its performance. Each qubit performs computational functions through on-demand configured logical functions. Given the limited number of qubits and the diverse logical functions available in quantum computing, such as Hadamard gates (H gates), Pauli-X gates (X gates), Pauli-Y gates (Y gates), Pauli-Z gates (Z gates), X gates, RY gates, RZ gates, CNOT gates, CR gates, iSWAP gates, Tofoli gates, etc., quantum computing requires combining a limited number of qubits with diverse logical function combinations to achieve computational effects.

[0053] Based on these differences, the design of classical logic functions applied to CMOS transistors and the design of quantum logic functions applied to qubits are significantly and fundamentally different. The design of classical logic functions applied to CMOS transistors does not need to consider the individuality of CMOS transistors. For example, the representation of a CMOS transistor in a silicon chip is its individual identifier, location, and usable time of each CMOS transistor. Therefore, classical algorithms composed of classical logic functions only express the operational relationship of the algorithm, not the algorithm's dependence on individual CMOS transistors.

[0054] Quantum logic functions applied to qubits need to consider the individuality of each qubit, such as its position within the quantum chip, its relationship with surrounding qubits, and the duration of its usable time. Therefore, quantum algorithms composed of quantum logic functions not only express the computational relationships within the algorithm but also its dependence on the individual qubits.

[0055] For example:

[0056] Quantum Algorithm 1: H1, H2, CNOT(1,3), H3, CNOT(2,3);

[0057] Quantum Algorithm 2: H1, H2, CNOT(1,2), H3, CNOT(2,3);

[0058] Where 1 / 2 / 3 represent three sequentially connected qubits Q1, Q2, Q3 or interconnected qubits Q1, Q2, Q3, respectively;

[0059] An exemplary explanation of how quantum algorithms are affected by the coherence time of qubits is as follows:

[0060] Define the execution time of a single-qubit logic gate as t, and the execution time of two single-qubit logic gates operating on adjacent qubits as 2t; then:

[0061] When Q1, Q2, and Q3 are interconnected, the computation of Quantum Algorithm 1 requires 6t, which is divided into 4 time periods. The duration of each time period is t, 2t, t, and 2t, respectively. The operations performed in each time period are: H1, H2; CNOT(1,3); H3; CNOT(2,3);

[0062] The computation of Quantum Algorithm 1 requires 5t, which is divided into 3 time periods. The duration of each time period is t, 2t, and 2t respectively. The operations performed in each time period are: H1, H2, H3; CNOT(1,2); CNOT(2,3);

[0063] When Q1, Q2, and Q3 are connected sequentially, Quantum Algorithm 1 needs to be equivalent to: H1, H2; swap(1,2), CNOT(2,3), swap(1,2); H3; CNOT(2,3). The computation of the equivalent Quantum Algorithm 1 requires 10t, divided into 4 time periods, with each time period requiring durations of t, 6t, t, and 2t respectively. The operations performed in each time period are: H1, H2; swap(1,2), CNOT(2,3), swap(1,2); H3; CNOT(2,3).

[0064] A quantum chip consists only of qubits and channels for controlling them. Quantum logic gates are implemented using analog signals. Different combinations of analog signals are applied to the qubits through these channels, thus creating quantum circuits with different functions to process data. Therefore, the design of quantum logic functions applied to qubits (including the design of whether qubits are used and the design of the efficiency of each qubit) is crucial for improving the computational performance of quantum computers and requires special design. This is the unique characteristic of quantum algorithms based on quantum logic functions, and it is fundamentally different from classical algorithms based on classical logic functions. The aforementioned design of qubits is a technical problem that ordinary computing devices do not need to consider or address. This invention proposes a quantum state encoding method and related apparatus, aiming to simplify the complexity of quantum circuits, reduce encoding time, and thus improve the efficiency of quantum state encoding.

[0065] See Figure 2 , Figure 2 This is a flowchart illustrating a quantum state encoding method provided in an embodiment of the present invention. The method includes:

[0066] Step 201: Obtain the classic data to be encoded.

[0067] Quantum computing is a computational method that utilizes the principles of quantum mechanics for information processing and computation. Unlike classical computing, quantum computing uses qubits as the basic unit of information. By initializing the qubits to a desired initial state, quantum logic gates are applied to the qubits to allow them to evolve, and the computation result is obtained by measuring the qubits. Since quantum computers cannot directly perform computations based on classical data, classical data must be encoded into quantum states.

[0068] Commonly used quantum state encoding techniques can be categorized into basis encoding, amplitude encoding, sampling encoding, and Hamiltonian encoding. Among these, amplitude encoding is the most common method for quantum state preparation due to its low requirement for classical data and wide applicability. The technical solution provided in this embodiment of the invention also employs amplitude encoding.

[0069] In this embodiment, the classical data to be encoded can be in the form of numerical sequences, matrices, etc. The types of numbers can include integers, floating-point numbers, complex numbers, binary numbers, etc., all of which are reasonable and not specifically limited here. In one implementation, classical computing units can also be used to perform classical encoding on data of types such as images, text, and time series. For example, through grayscale conversion, ASCII codes, etc., it can be encoded into a matrix form, and then the matrix obtained from classical encoding can be used as the classical data to be encoded.

[0070] Step 202: If the density of the classical data is greater than the preset density, then perform singular value decomposition on the first matrix constructed based on the classical data to obtain the singular value decomposition result.

[0071] Data density represents the proportion of non-missing values ​​in the data, and can be used to describe how much of the dataset contains valid, non-missing data. If the density of the classical data to be encoded is greater than the preset density, it indicates that the classical data is dense, meaning that the amount of data requiring quantum state preparation is large and has high dimensionality.

[0072] For example, facing 2 n Given a set of classical data to be encoded, if a common amplitude encoding method is used for quantum state encoding, employing n bits of amplitude encoding, the quantum circuit has a total of O(2^n) bits. n ) controlled single-bit gates; if 2 nFor each qubit, the circuit requires O(n) controlled gates. It can be seen that the low number of bits and low encoding time of this encoding scheme are contradictory. If more qubits are used, too many computing resources will be consumed. If more quantum logic gates are used to save qubits, not only will the preparation time be long, but also, because the fidelity of single-bit logic gates is high while the fidelity of CNOT gates is insufficient, large circuit errors will be generated.

[0073] Singular value decomposition (SVD) not only preserves the main features of the matrix, achieving approximate encoding, but also simplifies the encoding process by providing orthogonal matrices, thereby reducing the number of CNOT gates in quantum circuits. Therefore, a first matrix can be constructed based on the classical data to be encoded, and SVD can then be performed on this matrix.

[0074] Regarding the fundamental principles of singular value decomposition, those skilled in the art will understand that for any quantum state... It can always be expressed in the following form:

[0075]

[0076] in, For computational basis, it can be defined by coefficients C. ij If the resulting matrix is ​​C, then matrix C can always be subjected to SVD (Singular Value Decomposition) in the following form:

[0077]

[0078] Due to matrix U, If it is a unitary matrix, then the quantum state |φ> can be represented using another set of computational bases:

[0079]

[0080] Where |α i >=|e i >,

[0081] In practical encoding, to obtain the best encoding performance, the computational basis can be divided as equally as possible. For example, a 2-qubit quantum system can be decomposed into the Krock inner product of the following two computational basis:

[0082]

[0083] If it is a quantum system with 2+1 qubits, it can be decomposed as follows:

[0084]

[0085] In fact, whether the number of qubits in a quantum system is odd or even does not affect SVD encoding. Therefore, we can take a quantum system with 2 qubits as an example to explain the process of constructing the first matrix based on classical data and performing singular value decomposition on the first matrix to obtain the singular value decomposition result.

[0086] For example, you can first use a classical computing unit to obtain a column of classical data to be processed:

[0087]

[0088] Based on the element C at each position ij We can construct an n×n matrix, which is the first matrix C:

[0089]

[0090] Then, the first matrix C is decomposed using SVD to obtain the singular value decomposition result, which is the compact matrix multiplication form of the quantum state as follows:

[0091]

[0092] Where e,f are the computational basis sets of the first N qubit subsystem and the last N qubit subsystem of a 2-qubit quantum system, and U, Let Σ be the unitary matrix obtained from the SVD decomposition, and let Σ be the diagonal matrix obtained from the SVD decomposition, with its diagonal element values ​​σ. ii Let α be the singular values ​​of matrix C, and e be the singular values ​​of matrix C. T U, This is the new computational basis set.

[0093] Step 203: Construct a first quantum circuit based on the singular value decomposition result to realize the quantum state encoding of the classical data.

[0094] For example, in the above singular value decomposition results, e,f are known computational basis sets, U, For unitary matrices, to construct the first quantum circuit, U, This is transformed into the form of quantum logic gates, which are then applied to the qubits in the first N qubit subsystem and the last N qubit subsystem, respectively. It should be noted that whether the diagonal matrix Σ is a unitary matrix is ​​not fixed. If the diagonal matrix Σ is unitary, it can be encoded into the qubits of the first N qubit subsystem; if the diagonal matrix Σ is not unitary, in one implementation, the values ​​σ of the diagonal elements in the diagonal matrix Σ can be used as the basis for encoding. iiThe constructed matrix is ​​decomposed and iterated multiple times using SVD. Finally, the singular values ​​are encoded into the amplitude of a qubit through quantum logic gates. The process of SVD decomposition and iteration will be explained in detail below.

[0095] After the first quantum circuit is constructed, the classical computing unit can send the first quantum circuit to the quantum computing unit. The quantum computing unit can then initialize the qubits to an initial quantum state based on this quantum circuit, and manipulate the qubits in the initial quantum state using the aforementioned quantum logic gates, causing their quantum state to evolve into the quantum state corresponding to the classical data to be encoded, thereby realizing the quantum state encoding of classical data. Specifically, the quantum computing unit can generate a first pulse modulation signal, which is used to drive the qubits to excite to the initial quantum state, and generate a second pulse modulation signal based on the first quantum circuit, which is used to drive the qubits to evolve from the initial quantum state to the quantum state corresponding to the classical data.

[0096] Compared with existing technologies, this invention provides a quantum state encoding method. It acquires classical data to be encoded. If the density of the classical data is greater than a preset density, singular value decomposition (SVD) is performed on a first matrix constructed based on the classical data to obtain the SVD result. A first quantum circuit is then constructed based on the SVD result to realize the quantum state encoding of the classical data. By processing the classical data to be encoded through SVD, the classical data can be approximated, retaining only its main features. This simplifies the complexity of the quantum circuit, reduces encoding time, and significantly improves the efficiency of quantum state encoding. Furthermore, since the fidelity of current single-bit logic gates is high, while the fidelity of CNOT gates is insufficient, the orthogonal matrix characteristics after SVD simplify the encoding process, thereby reducing the number of CNOT gates in the quantum circuit and improving the circuit's fidelity.

[0097] Optionally, the method further includes:

[0098] If the density of the classical data is not greater than the preset density, a second quantum circuit is constructed based on the classical data and the sparse coding method to realize the quantum state encoding of the classical data.

[0099] If the density of classical data is no greater than a preset density, it indicates that the classical data is sparse, meaning that the amount of data requiring quantum state preparation is small and the dimensionality is low. If conventional amplitude encoding is used to encode all elements of classical data into quantum states, the amplitudes of multiple computational bases in the resulting quantum states will be zero, and the constructed quantum circuit will have an extremely large depth and extremely long runtime, which is clearly unsuitable. Compared to the exponential time required for conventional amplitude encoding to prepare quantum states with a large number of bits, an efficient sparse data encoding scheme can reduce the circuit runtime to the polynomial level in terms of the number of bits, and the number of CNOT gates in the circuit will also be significantly reduced.

[0100] In this embodiment, it is understood that the sparse encoding method in the solution provided by this invention can be any of the existing sparse quantum state encoding methods. For example, dual sparse quantum state encoding can use n auxiliary bits to assist in constructing a circuit to encode classical data. Sparse equidistant quantum state encoding differs from dual sparse quantum state encoding in that it does not require auxiliary bits to construct a circuit. First, the non-zero elements x in the sparse data are uniformly encoded onto the first log2len(x) qubits, and then controlled transformation is performed through a controlled X gate. In the polynomial sparse quantum state encoding method, the number of non-zero elements in the sparse data vector is linearly related to the number of qubits, and its circuit encoding depth is O(|S|). 2 log(|S|)n), where,

[0101] |S| represents the number of non-zero elements, n represents the required number of qubits (log₂N), and N represents the sparse data length. The sparse coding method used in this scheme only needs to reduce the circuit depth; no specific limitations are imposed here.

[0102] For example, for a 2 n Vectors composed of classic dimensional data:

[0103]

[0104] It is now encoded as a quantum state of an n-qubit system:

[0105] |υ>=Σ x∈s c x |x>

[0106] Among them, c x for Let |x> be the normalized coefficients of the non-zero components, |x> be the corresponding basis, and S be the set of all bases with non-zero coefficients. Here, |S| represents the number of bases in the set. Obviously, according to the sparsity condition, |S| << 2. n .

[0107] Constructing a second quantum circuit based on classical data and sparse coding can be understood as transforming a qubit from its initial quantum state |00…0> through a quantum logic gate to |φ>. According to the reversibility principle of quantum computing, this is equivalent to the problem: constructing a quantum circuit whose initial quantum state is |φ>, and whose quantum state changes to |00…0> after passing through a certain quantum circuit.

[0108] In one implementation, sparse quantum state encoding combined with path search can be used. Specifically, a path search strategy is preset to search for the branching points (qubits) of different paths (i.e., different quantum states). A controlled rotation gate is applied to each qubit, merging the different paths at that branching point, thus turning the branching point into a non-branching point. This process can be repeated until the top-level branching point is reached. Compared to conventional amplitude encoding, which uses a controlled rotation gate on each qubit to merge paths, this scheme allows the two merged paths to not initially be left and right branches of the same node, meaning they can be quantum states corresponding to different qubits, thereby improving the efficiency of sparse quantum state encoding. Furthermore, the quantum circuit complexity of conventional amplitude encoding can reach exponential levels with the number of qubits, while the complexity of the quantum circuit generated by this sparse encoding method is only polynomial level with the number of qubits, significantly reducing circuit depth and improving encoding quality.

[0109] In one specific implementation, the classical data to be encoded in practical quantum computing is often dynamic, meaning its density changes over time. For example, in the QFVM (Quantum Finite Volume Method) of CFD (Computational Fluid Dynamics), if the solution to a linear problem is a change in macroscopic quantities of the flow, then during steady-state iterative solutions, the right-hand side of the linear equation will gradually transition from dense to sparse data. At this point, a single encoding technique will be insufficient. The quantum state encoding technique proposed in this invention can be based on a preset density, allowing for the selection of a more efficient quantum state encoding method regardless of how the density of the classical data to be encoded changes. This achieves high encoding efficiency regardless of whether the classical data to be encoded is dense or sparse.

[0110] It should be noted that compared to basic amplitude encoding, SVD encoding requires a significantly reduced number of quantum logic gates. Furthermore, SVD encoding can be used for both approximate and exact encoding. When exact encoding is not required, only the main features of the classical data can be retained for approximate encoding, thus simplifying quantum circuits. For sparse classical data, sparse quantum state encoding is more efficient than SVD encoding.

[0111] Optionally, the preset density is determined based on the number of qubits in the quantum system running the first quantum circuit, the number of elements in the classical data, and the number of non-zero elements.

[0112] In the solution provided by the embodiments of the present invention, the first quantum circuit can operate on a quantum system, and the quantum system can also operate on the second quantum circuit. In one possible implementation, the first quantum circuit and the second quantum circuit can also operate on different quantum systems, which are all feasible.

[0113] The description assumes that the first and second quantum circuits operate on the same quantum system. Based on the above embodiments, those skilled in the art will understand that quantum state encoding schemes based on singular value decomposition and those based on sparse encoding each have their advantages and disadvantages when encoding quantum states for classical data of varying density. And according to the definition of data density:

[0114]

[0115] Where n is the number of elements in the classic data, and m is the number of 0 elements in the classic data.

[0116] The above formula shows that the preset density needs to be related to the number of elements and the number of non-zero elements in the classic data in order to accurately determine which encoding method is more advantageous.

[0117] Correspondingly, if two quantum systems contain different numbers of qubits, their performance in quantum state encoding may also differ. For example, the larger the number of qubits a quantum system contains, the stronger its ability to perform classical amplitude encoding. Therefore, when setting the preset density, the influence of the number of qubits in the quantum system should also be considered.

[0118] In one specific implementation, by setting an adjustable parameter h based on the number of qubits in the quantum system, when determining whether the density of classical data is greater than a preset density, the number of non-zero elements m in the classical data can be compared with... The size relationship is given by n, where n is the number of elements in the classic data. If This indicates that the classical data has a high density, containing many non-zero elements, and can be quantum-state encoded using a quantum state encoding method based on singular value decomposition; if This indicates that the density of the classical data is not high, and it contains relatively few non-zero elements. Therefore, the classical data can be quantum-state encoded using sparse coding.

[0119] For example, see Figure 3 , Figure 3 This diagram illustrates the relationship between the density of classical data and the number of quantum logic gates required for encoding, as provided in an embodiment of the present invention. The horizontal axis represents the density of the classical data to be encoded, and the vertical axis represents the number of quantum logic gates required for encoding. The quantum system comprises 6 qubits. In the diagram, Distributed encoding represents composite encoding technology, i.e., the encoding scheme provided in this embodiment; General encoding represents basic amplitude encoding technology; Sparse encoding represents sparse encoding technology; and SVD encoding represents singular value decomposition encoding technology.

[0120] As can be seen from the figure:

[0121] (1) Regardless of whether the classical data to be encoded is dense or sparse, the number of quantum logic gates in the quantum circuit of the basic amplitude encoding remains unchanged and is the maximum, which is consistent with the theory.

[0122] (2) The number of quantum logic gates in sparse coding increases linearly with the density of classical data. When the classical data is completely dense, the number of quantum logic gates is comparable to the number of quantum logic gates required for basic amplitude coding.

[0123] (3) The number of quantum logic gates will be significantly reduced only when the data is very sparse. In other cases, the number of logic gates required by the circuit remains basically stable and is significantly less than that of the basic amplitude encoding case.

[0124] (4) The encoding scheme provided in the embodiments of the present invention uses sparse encoding technology when the classic data is sparse and SVD encoding technology when the classic data is dense. Therefore, in most cases, the encoding circuit can be kept to be the simplest.

[0125] As can be seen from conclusions (2) and (3), there must exist a specific density such that classical data with a density lower than this density is more efficiently encoded using sparse coding, while classical data with a density higher than this density is more efficiently encoded using SVD coding. This specific density is the selection criterion for parameter h in the technical solution provided in this embodiment of the invention. For example, for a quantum system containing 6 qubits, the optimal h≈2.7 can be obtained when encoding quantum states. Combining actual calculation requirements, h can be set to 2.5 to determine the preset density. When the density of classical data is greater than the preset density, the SVD coding scheme is used; when it is not greater than the preset density, the Sparse coding scheme is used.

[0126] Optional, such as Figure 4 As shown, before performing singular value decomposition on the first matrix constructed based on the classical data, the method further includes:

[0127] Step 401: Determine the target number of qubits N based on the number of elements in the classical data.

[0128] Step 402: Pad the elements of the classic data with zeros until the number of elements in the classic data equals 2. N .

[0129] Step 403: Construct the first matrix based on the elements of the zero-padded classic data.

[0130] In the solution provided by this embodiment of the invention, the first matrix is ​​constructed based on the classical data to be encoded. However, the number of qubits in a quantum system actually limits the maximum amount of classical data it can encode. For a quantum system with N qubits, the maximum amount of classical data it can encode is 2^N. N For example, a quantum system contains 4 qubits, which can encode up to 16 classical data.

[0131] Therefore, the target number of qubits needs to be determined first based on the number of elements in classical data. In one implementation, the target number of qubits can be determined using the following formula:

[0132] N = [logC]

[0133] Where N is the number of target qubits, C is the number of elements in the classical data, and [] indicates rounding up.

[0134] Therefore, 2 will appear. N ≥C, when 2 N When the expression is greater than C, zeros need to be padded to the elements of the classic data. Specifically, zeros can be added to the end of the classic data. Of course, padding with zeros at the beginning or some positions in the middle of the classic data is also possible, and no specific limitation is made here.

[0135] For example, when the classical data is a set of data [C1, C2, C3, C4, C5], C = 5. Using the formula above, the target number of qubits N can be calculated to be 3. Therefore, zeros can be padded to the classical data, resulting in [C1, C2, C3, C4, C5, 0, 0, 0]. Similarly, the target number of qubits can also be other integers greater than [log C]. For example, the target number of qubits could be 4, in which case 2 bits need to be padded to the classical data. 4 -5 = 11 zeros. These solutions are all feasible and will not be specifically limited here.

[0136] Those skilled in the art will understand that, in order to encode the basis states in compact multiplication into the ground states in quantum states, the dimensions of matrices U and V obtained from SVD decomposition must both be powers of 2. That is, the number of rows and columns of the first matrix used for SVD decomposition must both be powers of 2. Therefore, a first matrix can be constructed based on the zero-padded elements of the classical data. For example, the first n elements of the classical data can be taken as the first row of the first matrix, and then n elements can be taken sequentially as the second, third, ..., nth row of the first matrix, until the first matrix is ​​constructed. Taking the example of padding 5 classical data points to 8 zeros, a 2*4 matrix or a 4*2 matrix can be constructed based on these 8 classical data points as the first matrix.

[0137] It should be noted that in SVD decomposition, A = U∑V T The dimensions of matrices U and V in the system are not required to be the same; that is, the first matrix A to be decomposed does not need to be a square matrix, and therefore ∑ is also not necessarily a square matrix. Furthermore, the number of qubits in a quantum system can be odd or even. When the target number of qubits is even, i.e., 2N qubits, the first matrix A can be written as 2... N ×2 N The square matrix is ​​such that the matrices U and V obtained by decomposition are also square matrices of the same dimension.

[0138] Optionally, the number of target qubits N is even and the first matrix is ​​a square matrix, wherein the number of rows or columns n of the first matrix satisfies:

[0139]

[0140] Where N is the number of target qubits.

[0141] In the quantum state encoding process based on singular value decomposition, for the sake of simplicity in quantum computing and quantum circuit design, and to obtain optimal encoding performance, the qubits used for encoding need to be divided into two groups. Therefore, an even number of qubits is usually used for quantum state encoding. Correspondingly, if the target number of qubits N is even, the first matrix can be set as a square matrix, and the number of rows or columns of this square matrix is...

[0142] Understandably, before SVD decomposition, it's necessary to construct the compact multiplicative form of the first matrix A. At this point, the form of A is uncertain; optimally, A is constructed as a square matrix. For example, when the target number of qubits is 2n, the worst-case form of the first matrix A is 2×2. 2n-1 In this case, performing SVD quantum state encoding would result in a circuit complexity of O ~ O(V) >> O(U), leading to very low efficiency for quantum state encoding.

[0143] Similarly, when using an even number of qubits (2n) for SVD quantum state encoding, if the first matrix A constructed is 2... n ×2 m If the decomposition results in matrices U and V, then the resulting matrices are also square matrices of the same dimension. At this point, the line depth is O ~ O(U) ~ O(V), meaning that the U and V parts are essentially in balance. Since the quantum logic gates corresponding to matrices U and V can act on different bits, the two lines can run in parallel, thus maximizing the efficiency of quantum state encoding. Therefore, it is necessary to ensure that U and V have the same dimension as much as possible, that is, to construct the first matrix as a square matrix.

[0144] Optionally, performing singular value decomposition on the first matrix constructed based on the classical data includes:

[0145] Singular value decomposition is performed on the first matrix constructed from the classical data to obtain a multiplied left singular vector matrix, a singular value matrix, and a right singular vector matrix.

[0146] A second matrix is ​​constructed based on the elements of the singular value matrix. Singular value decomposition is performed multiple times and iterated until the number of non-zero elements in the resulting singular value matrix is ​​no greater than 2.

[0147] For example, in Example 1, if the target number of qubits is 2, the classical data to be encoded is... Through the above steps, the first matrix can be obtained as follows: The corresponding computational basis is Performing singular value decomposition on the first matrix C yields:

[0148]

[0149] in, It is a left singular vector matrix; It is a singular value matrix; It is a right singular vector matrix.

[0150] To obtain the quantum state in the Schmitt decomposition form:

[0151]

[0152] Using SVD encoding technology, we first want to obtain the following quantum state:

[0153]

[0154] Here, λ represents the singular values ​​obtained after SVD decomposition, which are the diagonal elements of the singular value matrix Σ. Clearly, in this embodiment, λ1 = 1, λ2 = 0. That is, the singular values ​​can be directly... It is encoded into the amplitude of the previous qubit.

[0155] In one possible implementation, the singular value matrix Σ obtained by performing singular value decomposition on the first matrix is ​​non-unitary, and obviously, the singular value λ cannot be directly encoded into the amplitude of the qubit. In this case, a second matrix can be constructed based on the elements in the singular value matrix, and singular value decomposition can be performed multiple times and iterated until the number of non-zero elements in the resulting singular value matrix is ​​no greater than 2.

[0156] Example 2: The target number of qubits is 4, and the quantum state to be encoded is:

[0157]

[0158] Performing singular value decomposition on the matrix formed by the above coefficients, we can obtain:

[0159]

[0160]

[0161] First, the singular value matrix Σ needs to be encoded into the first two qubits, which means implementing the following process:

[0162] |0000>→(λ1|00>+2|01>+3|10>+4|11>)|00>

[0163] As can be seen, this step essentially involves encoding the first two qubits while leaving the last two qubits unchanged. Therefore, the following changes are made to the first two qubits:

[0164] |00>→λ1|00>+2|01>+3|10>+4|11>

[0165] Since the singular value matrix Σ is non-unitary, it cannot be directly encoded into the amplitudes of the first two qubits. Therefore, a second matrix needs to be constructed based on the elements of the singular value matrix Σ, and then singular value decomposition is performed again. That is, a second matrix is ​​constructed based on the diagonal elements of the singular value matrix Σ. Then, by performing singular value decomposition on the second matrix C1 again, we can obtain: At this point, the number of non-zero elements in the resulting singular value matrix Σ1 is 1, which is no greater than 2, so there is no need to perform singular value decomposition again.

[0166] It can be seen that through this singular value decomposition, the same matrix form as the quantum state encoding of the two qubits in Example 1 is obtained. Therefore, the singular values ​​in Σ1 can be encoded into the amplitude of the previous qubit, and then U1 can be encoded. The corresponding matrix completes the encoding of the singular value matrix Σ. Then, by encoding the matrices corresponding to U and V, the quantum state encoding of this classical data can be completed.

[0167] See Figure 5 , Figure 5 A flowchart for constructing a first quantum circuit based on the singular value decomposition result, provided as an embodiment of the present invention, includes:

[0168] Step 501: Determine the target qubit in the quantum system and divide the target qubit into two groups.

[0169] In the process of quantum state encoding, N qubits can encode at most 2^n qubits. N Since the classical data is 16 elements, to avoid wasting computational resources, after performing singular value decomposition on the first matrix constructed based on the classical data, multiple qubits in the quantum system can be selected as target qubits for quantum state encoding. For example, if the classical data to be encoded has 16 elements, the first four qubits in a quantum system containing six qubits can be selected as target qubits for this quantum state encoding task, while the remaining qubits can be used for other computational tasks simultaneously, thus saving quantum computing resources.

[0170] Furthermore, for the sake of simplicity in the design of quantum computing and quantum circuits, and to obtain optimal coding performance, the target qubits can be divided into two groups. For example, if the first four qubits of the quantum system have been selected as the target qubits, these four target qubits can be divided into pairs, that is, the first two target qubits can be grouped into one group and the last two target qubits into another group, or the first and last two target qubits can be grouped into one group and the middle two target qubits into another group. These grouping methods are all feasible and are not specifically limited here.

[0171] Step 502: Apply the first quantum logic gate to one of the target qubits;

[0172] The first quantum logic gate corresponds to the matrix obtained by the second matrix decomposition.

[0173] Step 503: Apply the CNOT gate to two sets of target qubits, where the control bit of the CNOT gate is the target qubit in one set, and the controlled bit of the CNOT gate is the target qubit in the other set.

[0174] Step 504: Apply the second quantum logic gate to one set of target qubits and apply the third quantum logic gate to another set of target qubits to obtain the first quantum circuit;

[0175] The second quantum logic gate corresponds to the left singular vector matrix, and the third quantum logic gate corresponds to the right singular vector matrix.

[0176] The purpose of step 502 is to encode singular values ​​into the amplitude of the target qubits, causing a group of target qubits to rotate according to the singular value matrix, that is, to achieve the following operation:

[0177]

[0178] Among them | i > represents all computational bases for one of the target qubits.

[0179] In one case, the singular value matrix Σ does not need to be decomposed again. Taking the 2-qubit quantum system example 1 from the above singular value decomposition as an example, assuming that the quantum state of the 2-qubit is |00> before the encoding begins, this step is as follows:

[0180] |00>→∑σ i |α>|0>,|α1>=|0>,|α2>=|1>

[0181] The singular value matrix Σ at this point does not need to be decomposed again. The first quantum logic gate is the rotation gate corresponding to the singular value matrix Σ. For example, the rotation gate R(θ) can be defined as follows:

[0182]

[0183] A rotation gate R(θ1) can be applied to the first target qubit, with the angle determined by the following formula:

[0184]

[0185] In this specific example, θ1 = 0 is equivalent to no operation. In the general case (θ1 ≠ 0), this step corresponds to the following quantum state change:

[0186]

[0187] In another case, the singular value matrix Σ is non-unitary, requiring further decomposition. Taking the 4-qubit quantum system example 2 from the singular value decomposition above as an example, a second matrix is ​​constructed using the elements of the singular value matrix Σ. The matrix obtained from the second matrix decomposition above is simply a series of matrices multiplied together: At this point, one set of target qubits can be the first two target qubits. The first quantum logic gate corresponds to the three matrices obtained from the second matrix decomposition, specifically including three rotation gates and a CNOT gate. The first rotation gate is used to encode Σ1 onto the first target qubit, the CNOT gate is used to controllably entangle the first and second target qubits, the second rotation gate is used to encode U1 onto the first target qubit, and the second rotation gate is used to... Encode it into the second target qubit.

[0188] If the number of non-zero elements in the singular value matrix obtained by the singular value decomposition of the second matrix is ​​still greater than 2, the matrix can be constructed again based on the diagonal elements of the decomposed singular value matrix according to the element combination method of the singular value matrix described above, and singular value decomposition can be performed again until the number of non-zero elements in the decomposed singular value matrix is ​​no greater than 2. Obviously, this process is a continuous recursive process. In the first quantum circuit, this is reflected in the fact that during the recursive process, the rotation gates corresponding to the new U and V matrices generated by the decomposition are continuously applied to one set of target qubits.

[0189] After encoding the singular values ​​onto the amplitude of the target qubit through the above steps, a CNOT gate needs to be applied to the two sets of target qubits to achieve controlled entanglement between one set and the other. In the scheme provided by this embodiment, one set of target qubits—that is, the qubits whose amplitudes have already been encoded with singular values—can be used as the control bits of the CNOT gate, and the other set of target qubits can be used as the controlled bits of the CNOT gate. The positions of the control bits and controlled bits within their respective groups can be in a one-to-one correspondence. The mathematical representation of this step is as follows:

[0190]

[0191] Furthermore, the basis sets of one set of target qubits can be transformed with the basis sets of another set of target qubits to form the desired basis set, thereby obtaining the final quantum state. The basis set transformation follows the formula α = e^(-α / α). T U, That is, the second quantum logic gate corresponding to the left singular vector matrix U is applied to one set of target qubits, and the third quantum logic gate corresponding to the right singular vector matrix V is applied to the other set of target qubits, thereby performing the following operations:

[0192]

[0193] Based on the target qubit, the first quantum logic gate, the CNOT gate, the second quantum logic gate, and the third quantum logic gate, a first quantum circuit can be obtained. The quantum computing unit can encode the quantum state corresponding to the classical data to be encoded based on the first quantum circuit.

[0194] Let's take the 2-qubit quantum system example 1 from the singular value decomposition above as an example for illustration and verification. Through step 501, two target qubits can be determined. After dividing them into two groups, in step 502, the first quantum logic gate, i.e., the rotation gate R(θ1), is applied to the first target qubit. Since θ1 = 0, this is equivalent to no operation. In step 503, the first and second target qubits are controlled to become entangled, that is, the following operation is achieved:

[0195] ∑σ i |α>|0<→∑σ i |α<|α<

[0196] The quantum state change corresponding to this step is:

[0197]

[0198] Then, in step 504, a matrix U can be applied to the first target qubit, that is, a rotation gate R(θ2) can be applied, as in the example above. The quantum state change corresponding to this step is as follows:

[0199]

[0200] And apply matrix V to the second target qubit, that is, apply a rotation gate R(θ3), where θ3 = sin -1 (1 / 2), the quantum state change corresponding to this step is as follows:

[0201]

[0202] For the specific example given above, substituting θ1 = 0, 3 = sin -1 (1 / 2), the final quantum state is obtained as:

[0203]

[0204] Clearly, the encoding result is correct, and the above scheme achieves quantum state encoding of classical data.

[0205] See Figure 6 , Figure 6 This is a schematic diagram of a quantum state encoding device provided in an embodiment of the present invention. The device includes:

[0206] Acquisition unit 601 is used to acquire classic data to be encoded.

[0207] The singular value decomposition unit 602 is used to perform singular value decomposition on the first matrix constructed based on the classical data if the density of the classical data is greater than a preset density, and to obtain the singular value decomposition result.

[0208] The encoding unit 603 is used to construct a first quantum circuit based on the singular value decomposition result to realize the quantum state encoding of the classical data.

[0209] See Figure 7 , Figure 7 This is a schematic diagram of another quantum state encoding device provided in an embodiment of the present invention. The device includes:

[0210] The sparse coding unit 701 is used to construct a second quantum circuit based on the classical data and the sparse coding method if the density of the classical data is not greater than the preset density, so as to realize the quantum state encoding of the classical data.

[0211] The specific functions and effects of the quantum state encoding device can be explained by referring to other embodiments in this specification, and will not be repeated here. Each module in the quantum state encoding device can be implemented entirely or partially through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in a computer device in hardware form, or it can be stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0212] Please see Figure 8 This specification also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the quantum state encoding method in any of the above embodiments. Please refer to... Figure 8 The computer device can be a classical computer or a quantum computer.

[0213] This specification also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer, causes the computer to perform the quantum state encoding method in any of the above embodiments.

[0214] This specification also provides a computer program product containing instructions that, when executed by a computer, cause the computer to perform the quantum state encoding method in any of the above embodiments.

[0215] It is understood that the specific examples in this specification are only intended to help those skilled in the art better understand the implementation methods described herein, and are not intended to limit the scope of the invention.

[0216] It is understood that in the various embodiments of this specification, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not limit the implementation process of the embodiments of this specification in any way.

[0217] It is understood that the various implementation methods described in this specification can be implemented individually or in combination, and the implementation methods in this specification are not limited in this respect.

[0218] Unless otherwise stated, all technical and scientific terms used in the embodiments of this specification have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this specification. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items. The singular forms "a," "the," and "the" as used in the embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0219] It is understood that the processor in the embodiments of this specification can be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this specification. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this specification can be directly implemented by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above methods.

[0220] It is understood that the memory in the embodiments of this specification may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM). It should be noted that the memory in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0221] Those skilled in the art will recognize that the units and algorithm steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this specification.

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

[0223] In the several embodiments provided in this specification, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

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

[0225] In addition, the functional units in the various embodiments of this specification can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0226] If the aforementioned functions are implemented as 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 solutions of this specification, in essence, or the parts that contribute to the prior art, or parts of the technical solutions, can be embodied in the form of software products. These computer software products are stored in a storage medium and include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this specification. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0227] The above description is merely a specific embodiment of this specification, but the scope of protection of this invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this specification should be included within the scope of protection of this specification. Therefore, the scope of protection of this invention should be determined by the scope of the claims.

Claims

1. A quantum state encoding method, characterized in that, The method comprises: acquiring classical data to be encoded; if the density of the classical data is greater than a preset density, performing singular value decomposition on a first matrix constructed based on the classical data to obtain a singular value decomposition result; wherein the singular value decomposition on the first matrix constructed based on the classical data obtains a left singular vector matrix, a singular value matrix and a right singular vector matrix which are multiplied; constructing a second matrix based on elements of the singular value matrix, performing singular value decomposition multiple times and iterating until the number of non-zero elements of the singular value matrix obtained by decomposition is not greater than 2; constructing a first quantum circuit based on the singular value decomposition result to realize quantum state encoding of the classical data; wherein the construction of the first quantum circuit based on the singular value decomposition result comprises: determining target qubits in a quantum system running the first quantum circuit, and dividing the target qubits into two groups; applying a first quantum logic gate to one group of target qubits, the first quantum logic gate corresponding to a matrix obtained by decomposition of the second matrix; applying a CNOT gate to the two groups of target qubits, the control bit of the CNOT gate being the target qubits in one group, and the controlled bit of the CNOT gate being the target qubits in the other group; applying a second quantum logic gate to one group of target qubits and a third quantum logic gate to the other group of target qubits to obtain the first quantum circuit, the second quantum logic gate corresponding to the left singular vector matrix, and the third quantum logic gate corresponding to the right singular vector matrix.

2. The method of claim 1, wherein, The method further comprises: if the density of the classical data is not greater than the preset density, constructing a second quantum circuit based on the classical data and a sparse encoding mode to realize quantum state encoding of the classical data.

3. The method of claim 1, wherein, The preset density is determined based on the number of qubits included in the quantum system running the first quantum circuit, the number of elements of the classical data and the number of non-zero elements.

4. The method of claim 3, wherein, Before the singular value decomposition on the first matrix constructed based on the classical data, the method further comprises: Determining a number of target qubits based on a number of elements of classical data ; padded in the element of the classical data until the number of elements of the classical data equals ; constructing a first matrix based on the elements of the classical data after zero padding.

5. The method of claim 4, wherein, The target number of qubits is even and the first matrix is a square matrix, the number of rows or columns of the first matrix n satisfies: wherein, N is the target number of qubits.

6. A quantum state encoding device, comprising: The apparatus comprises: an acquisition unit configured to acquire classical data to be encoded; a singular value decomposition unit configured to, if the density of the classical data is greater than a preset density, perform singular value decomposition on a first matrix constructed based on the classical data to obtain a singular value decomposition result; wherein the singular value decomposition on the first matrix constructed based on the classical data obtains a left singular vector matrix, a singular value matrix and a right singular vector matrix which are multiplied; a second matrix is constructed based on elements of the singular value matrix, singular value decomposition is performed multiple times and iterated until the number of non-zero elements of the singular value matrix obtained by decomposition is not greater than 2; an encoding unit configured to construct a first quantum circuit based on the singular value decomposition result to realize quantum state encoding of the classical data; wherein the construction of the first quantum circuit based on the singular value decomposition result comprises: determining target qubits in a quantum system running the first quantum circuit, and dividing the target qubits into two groups; applying a first quantum logic gate to one group of the target qubits, the first quantum logic gate corresponding to a matrix obtained by the second matrix decomposition; applying a CNOT gate to the two groups of the target qubits, the control bit of the CNOT gate being a target qubit in one group, and the controlled bit of the CNOT gate being a target qubit in the other group; applying a second quantum logic gate to one group of the target qubits and a third quantum logic gate to the other group of the target qubits to obtain the first quantum circuit, the second quantum logic gate corresponding to the left singular vector matrix, and the third quantum logic gate corresponding to the right singular vector matrix.

7. A storage medium, characterized by The storage medium has a computer program stored therein, wherein the computer program is configured to execute the method in any one of claims 1 to 5 when executed. 8.An electronic device comprising a memory and a processor, the electronic device comprising: The memory has a computer program stored therein, and the processor is configured to execute the computer program to execute the method in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Data processing method and system

    CN114219092A

  • Method and apparatus for automated design of quantum circuits

    US20060123363A1