A quantum state preparation method and system based on an arbitrary real vector

By optimizing the control gate sequence through outlier detection, dynamic zero-padding, and top-down amplitude encoding, the problems of increased quantum circuit depth and loss of small amplitude element information in existing technologies are solved, achieving high-precision quantum state preparation and hardware adaptation.

CN121390339BActive Publication Date: 2026-05-12SHENZHEN Y& D ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN Y& D ELECTRONICS CO LTD
Filing Date
2025-12-22
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing technologies for preparing quantum states of arbitrary real vectors suffer from problems such as increased quantum circuit depth and loss of information from small-amplitude elements, and do not adequately consider the number of quantum gates to be executed by controlling the qubits and vector preprocessing.

Method used

By optimizing the control gate sequence through outlier detection and calibration, dynamic zero-padding strategy, top-down amplitude encoding, and heuristic search algorithm, quantum circuits are constructed to improve encoding accuracy and reduce quantum circuit complexity.

Benefits of technology

It significantly improves the encoding accuracy of quantum state preparation, reduces the complexity of quantum circuits, adapts to hardware characteristics, and improves the efficiency of result extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121390339B_ABST
    Figure CN121390339B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of quantum computing, and provides a quantum state preparation method and system based on an arbitrary real vector. Abnormal value detection is performed on an input original vector, and abnormal value calibration processing is performed on the identified abnormal values; the vector length is expanded to an integer power of 2 through dynamic zero filling and internal sorting strategy, and optimized sorting is performed to obtain a final processed vector. A quantum construction system is based on the vector, adopts a top-down hierarchical amplitude coding mode, calculates required quantum rotation gate angles, optimizes control bit order through heuristic search, determines quantum gate execution order, constructs a quantum circuit based on the quantum gate execution order, constructs an optimized quantum circuit based on the quantum circuit, and runs the circuit to obtain a quantum state. Through multiple optimization technologies, the coding accuracy of quantum state preparation is significantly improved, the complexity of the quantum circuit is reduced, the hardware characteristics are better adapted, and the result extraction efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of quantum computing technology, and more specifically, to a method and system for preparing quantum states based on arbitrary real vectors. Background Technology

[0002] In the prior art, the quantum state preparation method for arbitrary real vectors (such as CN119443297B) realizes the quantum state preparation of arbitrary dimension real vectors through the process of normalization, dimension judgment, zero-padding expansion, top-down algorithm encoding and result extraction, and solves the encoding problem of non-integer power dimension vectors. However, this method still has the following shortcomings: (1) Zero-padding strategy: only based on controlled R Y The gate size selection of the zero position did not fully consider the number of quantum gates executed by the control qubit, resulting in the increased depth of the quantum circuit in the quantum circuit; (2) The vector preprocessing problem was not considered: Directly normalizing the magnitude of the vector containing extreme values ​​will cause the accuracy of small amplitude elements to be lower than the quantum hardware threshold, resulting in the loss of key information.

[0003] To address the aforementioned issues, existing technologies urgently need improvement. Summary of the Invention

[0004] The purpose of this application is to provide a method and system for preparing quantum states based on arbitrary real vectors, which has the advantages of improving the encoding accuracy of quantum state preparation, reducing the complexity of quantum circuits, and better adapting to hardware characteristics.

[0005] In a first aspect, this application provides a method for preparing quantum states based on arbitrary real vectors, the method comprising:

[0006] Outlier detection is performed on the real vector X, and outlier calibration is performed on the detected outliers to obtain the real vector X'.

[0007] Normalize the real vector X' to obtain the real vector X1;

[0008] The real vector X1 is expanded according to the dynamic zero-padding strategy to obtain 2 n A real vector X2 with n elements;

[0009] The revolving door R is calculated based on the real vector X2 according to the top-down amplitude encoding. Y From this perspective, the states of the control gate quantum states are sorted based on a heuristic search algorithm, and quantum circuits are constructed accordingly.

[0010] The constructed quantum circuit is run to obtain the output quantum state corresponding to the real vector X2; wherein the amplitude of the output quantum state is the real vector X2.

[0011] Further, the outlier detection for the real vector X includes:

[0012] For any real vector X = [x0, x1,..., x N-1 , calculate the lower quartile Q1, upper quartile Q3, median Q2, mean μ = mean(X), standard deviation σ = std(X) of the real vector X, and define the coefficient of variation CV = σ / μ; when CV ≥ k, the element x i > T*Q2 is determined as an outlier; when 0.15 ≤ CV < k, the element x i < Q1 - 1.5(Q3 - Q1) or x i > Q3 + 1.5(Q3 - Q1) is determined as an outlier. Here, T measures the deviation degree of the outlier, with the default T = 3, and k is set according to the sensitivity of the outlier in the actual application scenario, with the default: k = 1.5.

[0013] Further, the expansion of the real vector X1 according to the dynamic zero-padding strategy to obtain a real vector X2 with 2 n elements includes:

[0014] Obtain the number of elements N of the real vector X1, and solve for the number of qubits n according to the formula That is ; n is a positive integer;

[0015] Expand the vector X1 into a real vector X2 with dimension 2 n and supplement 2 n -N zero elements; through the dynamic zero-padding strategy, minimize the number of quantum gates with many anti-control bits;

[0016] Optimize the control bit order through heuristic search to maximize the X-gate sharing benefit, reduce the number of quantum gates and the circuit depth, and obtain the optimized real vector X2.

[0017] Further, the minimizing the number of quantum gates with many anti-control bits through the dynamic zero-padding strategy includes:

[0018] Convert the zero-padding position selection problem into a dynamic programming problem; where, define the state to represent the minimum number of quantum gates when j zero elements have been inserted when processing to vector position i;

[0019] State transition equation: ; where i represents the current vector position being processed, j represents the number of inserted zero elements, and cost(i, j) represents the increment of the number of quantum gates generated after inserting a zero element at position i;

[0020] Determine the initial state , and initialize other states to infinity; by traversing all possible states, find Find the minimum value and backtrack to obtain the optimal zero-padding position.

[0021] Furthermore, the revolving door R is calculated based on the real vector X2 according to the top-down amplitude encoding. Y From this perspective, a heuristic search algorithm is used to sort the states of the control gate quantum states, and quantum circuits are constructed based on this sorting, including:

[0022] Following the encoding rules of top-down amplitude coding, the R of the revolving door is solved sequentially. Y rotation angle ;

[0023] By manipulating n qubits according to the quantum circuit, a quantum state can be obtained. ;in, It is the ground state of n qubits. It is a real vector The i-th element is then used to obtain the elements of the real vector X. .

[0024] Furthermore, the rotation angle is solved sequentially according to the encoding rules of Top-down amplitude encoding. ,include:

[0025] vector Divide into two equal parts, the left half of which is denoted as Its modulus length is denoted as The right half is denoted as Its modulus length is denoted as ,but , , ;

[0026] The two equally divided parts , Divide each part into four equal parts, and denote them as follows: , , , Among them, rotation angle , ;

[0027] Repeat the bisection operation until X2 is divided into 2. n-1 Each binary part yields all rotation angles. .

[0028] Furthermore, the constructed quantum circuit is run to obtain the output quantum state corresponding to the real vector X2, including:

[0029] The constructed quantum circuit is represented as a unitary operator U, with the initial quantum state being... The prepared quantum state is: ;in It is the i-th element of vector X2. It is the ground state of an n-bit quantum bit system.

[0030] Secondly, it also relates to a quantum state preparation system based on arbitrary real vectors, including:

[0031] The outlier detection module performs outlier detection on the real vector X and performs outlier calibration processing on the detected outliers to obtain the real vector X'.

[0032] The normalization module normalizes the real vector X' to obtain the real vector X1;

[0033] The optimization module expands the real vector X1 according to the dynamic zero-padding strategy, resulting in 2... n A real vector X2 with n elements;

[0034] The quantum circuit construction module calculates the rotating gate R based on the real vector X2 according to the top-down amplitude encoding. Y From this perspective, the states of the control gate quantum states are sorted based on a heuristic search algorithm, and quantum circuits are constructed accordingly.

[0035] The quantum state preparation module runs the constructed quantum circuit to obtain the output quantum state corresponding to the real vector X2; wherein the amplitude of the output quantum state is the real vector X2.

[0036] Thirdly, a computer-readable storage medium is provided, characterized in that the computer-readable storage medium stores computer instructions that, when executed by a processor, implement the quantum state preparation method based on arbitrary real vectors as described in the first aspect.

[0037] Fourthly, a computing device, characterized in that it includes a processor and a memory storing computer program instructions; the processor, when executing the computer program instructions, implements the quantum state preparation method based on arbitrary real vectors as described in the first aspect.

[0038] As described above, the quantum state preparation method and system based on arbitrary real vectors provided in this application involves outlier detection on the input original vector and outlier calibration processing for the identified outliers; normalization of the processed vector to bring it within the standard range; expansion of the vector length to an integer power of 2 through dynamic zero-padding and internal sorting strategies, followed by optimized sorting to obtain the final processed vector. Based on this vector, the quantum construction system uses a top-down hierarchical amplitude encoding method to calculate the required quantum rotation gate angle, optimizes the control bit order through heuristic search to determine the quantum gate execution order, and constructs a quantum circuit accordingly. Running this optimized quantum circuit yields the quantum state. Through multiple optimization techniques, the encoding accuracy of quantum state preparation is significantly improved, the complexity of the quantum circuit is reduced, hardware characteristics are better adapted, and the efficiency of result extraction is increased. Attached Figure Description

[0039] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 This is a flowchart illustrating the steps of the quantum state preparation method based on arbitrary real vectors disclosed in an embodiment of the present invention.

[0041] Figure 2 This is a description of the reverse-controlled R in a practical circuit disclosed in the embodiments of the present invention. y Door structure diagram;

[0042] Figure 3 This is a schematic diagram of a quantum circuit structure with n qubits disclosed in an embodiment of the present invention;

[0043] Figure 4 This is a schematic diagram of a quantum circuit structure with 3 qubits disclosed in an embodiment of the present invention;

[0044] Figure 5 This is a schematic diagram of the quantum circuit structure for the last three qubits of the sorting strategy disclosed in an embodiment of the present invention;

[0045] Figure 6 This is a schematic diagram of a quantum circuit structure obtained by sorting control qubits using a heuristic search algorithm, as disclosed in an embodiment of the present invention.

[0046] Figure 7 This is a schematic diagram of the unordered structure disclosed in the embodiments of the present invention. Detailed Implementation

[0047] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which these embodiments belong; the terminology used herein and in the specification of the application is for the purpose of describing particular embodiments only and is not intended to limit these embodiments; the terms "comprising" and "having," and any variations thereof, in the specification of these embodiments and the foregoing drawings, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification of these embodiments and the foregoing drawings are used to distinguish different objects, not to describe a particular order.

[0048] The implementation details of the technical solution in this embodiment are described in detail below:

[0049] The existing quantum state preparation methods have the following core technical defects: (1) a fixed zero-padding strategy, where the zero-padding position is selected based on the size of the quantum gate group. (2) the lack of a vector preprocessing step, which leads to the loss of key information of small amplitude elements. The vector containing extreme values ​​is directly normalized in terms of magnitude, without handling the "suppression effect" of extreme values ​​on small amplitude elements. For example, when the original vector is X=[100,0.1,0.2,0.3], the normalized vector is X norm≈[0.999995,0.000999,0.001999,0.002999]. When solving for the parameters of the RY gate or the controlled RY gate, the angle corresponding to the region where the outlier is located [0.999995,0.000999] is 0, and the information of the second element associated with it is ignored, which damages the integrity of the input features of subsequent quantum algorithms (such as quantum classification and quantum regression).

[0050] This application proposes a method for preparing quantum states based on arbitrary real vectors, such as... Figure 1 As shown, the method includes:

[0051] S101, perform outlier detection on the real vector X, and perform outlier calibration on the detected outliers to obtain the real vector X';

[0052] Furthermore, the outlier detection of the real vector X includes: for any real vector X... Calculate the lower quartile Q1, upper quartile Q3, and interquartile range IQR = Q3 - Q1 of the real vector X; when the vector elements or When this occurs, it is considered an outlier.

[0053] Specifically, in this embodiment, the outlier detection and processing steps are mainly divided into outlier detection and outlier processing.

[0054] Outlier detection is performed using the box-line method, as follows: For any real vector Calculate the interquartile range (IQR) of vector X: Q1 (lower quartile), Q3 (upper quartile), and QR = Q3 - Q1. or When this occurs, it is considered an outlier.

[0055] Outlier handling employs an adaptive percentile truncation-reversible outlier handling method, specifically as follows: Solve for the lower quartile Q1, upper quartile Q3, median Q2, mean μ = mean(X), and standard deviation σ = std(X) of the real vector X, and define the coefficient of variation CV = σ / μ;

[0056] x a =Trunc(X), 1≤CV<3;

[0057] x a =Q2,CV≥3;

[0058] Where Trunc(X) = Q(X, 0.8), that is, using the 80th percentile of X instead.

[0059] S102, normalize the real vector X' to obtain the real vector X1;

[0060] Specifically, in this embodiment, the vector X' after outlier detection and processing is normalized to obtain the real vector X1. ,and For example, using modulus normalization, i.e. .

[0061] S103, the real vector X1 is expanded according to the dynamic zero-padding strategy to obtain 2 n A real vector X2 with n elements;

[0062] Furthermore, the real vector X1 is expanded and optimized according to the dynamic zero-padding and sorting strategy to obtain 2 n A real vector X2 with n elements, including:

[0063] 1. Obtain the number of elements N of the real vector X1 using the formula. Solving for the number of qubits n, we get the number of qubits n, i.e. n is a positive integer;

[0064] In this embodiment, wherein Not less than " The smallest positive integer of , where n is the number of qubits in the quantum system.

[0065] 2. Expand vector X1 to dimension 2. n The real vector X2, Supplement 2 n-N zero elements; minimize the number of quantum gates with many anti-control bits through a dynamic zero-padding strategy;

[0066] In this embodiment, the dynamic zero-padding strategy refers to expanding vector X1 to dimension 2. n The vector X2, Supplement 2 n -N zero elements. A dynamic zero-padding strategy is used to minimize the number of quantum gates with excessive anti-control bits. This strategy comprises three core modules: a vector feature extraction unit, a quantum gate number prediction unit, and a zero-padding position optimization unit.

[0067] (a) Vector feature extraction unit

[0068] The vector feature extraction unit is responsible for analyzing the statistical and structural features of the input vector X1, providing input for the prediction of the number of quantum gates. Specifically, it includes a feature extraction algorithm based on quantum state distribution entropy, vector sparsity analysis, and vector pattern recognition.

[0069] The feature extraction algorithm based on quantum state distribution entropy: It characterizes the features by calculating the distribution entropy value of the input vector. The specific calculation formula is as follows: ,in , is used to measure the uncertainty of a vector.

[0070] Vector sparsity analysis: By calculating the proportion of non-zero elements in a vector and the distribution pattern of these elements, the system divides the vector into multiple regions, analyzes the non-zero elements in each region, and forms a sparsity feature vector.

[0071] Vector pattern recognition: The system maintains a vector pattern library with an initial capacity of 50-100 typical patterns. By matching the input vector with typical patterns in the library based on similarity, the system identifies the pattern category to which the input vector belongs. The similarity calculation uses a weighted combination of cosine similarity and Euclidean distance. Where α is the weighting coefficient, α∈[0.4,0.6], Cosine similarity This represents the normalized Euclidean distance. N represents the number of elements in the vector.

[0072] (b) Quantum gate quantity prediction unit

[0073] The quantum gate count prediction unit employs a machine learning model to predict the number of quantum gates in a quantum circuit under different zero-padding strategies based on vector features. The detailed design of this module is as follows:

[0074] The prediction model architecture adopts a multilayer perceptron (MLP) structure: the input layer receives the feature vectors output by the vector feature extraction unit; the hidden layer adopts a 2-3 layer structure, with the number of nodes in each layer being 1.5-2 times the input dimension; the output layer outputs the number of predicted quantum gates and the corresponding zero-padding strategy; the activation function adopts ReLU to avoid the gradient vanishing problem.

[0075] The gradient descent optimization weight adjustment mechanism uses a stochastic gradient descent algorithm with a driving term to optimize the model weights. η is the learning rate (suggested range 0.01-0.05), μ is the momentum coefficient (suggested range 0.8-0.9), and L is the loss function, using mean squared error (MSE).

[0076] Model training and update strategy. Initial training: Use historical data (known pattern vectors and corresponding number of quantum gates) for batch training, with a recommended batch size of 32-64 samples; Incremental learning: After processing 100-200 new samples, use these samples to perform an incremental update on the model, with the learning rate gradually decreasing (a decay rate of 0.95-0.98 is recommended).

[0077] (c) Zero-padding position optimization unit

[0078] In this embodiment, the zero-padding optimization algorithm utilizes the output of the quantum gate number prediction module to select the optimal zero-padding position through dynamic programming, thereby minimizing the number of quantum gates. The specific steps are as follows:

[0079] First, a position selection strategy based on dynamic programming. Problem modeling: The zero-padding position selection problem is transformed into a dynamic programming problem. The state is defined as the minimum number of quantum gates required to process vector position i when j zero elements have been inserted. State transition equation: , where i represents the current vector position being processed, j represents the number of zero elements already inserted, and cost(i,j) represents the increment in the number of quantum gates after inserting a zero element at position i. Initial state: Other states are initialized to infinity; Result extraction: Traverse all possible states and find Find the minimum value and backtrack to obtain the optimal zero-padding position.

[0080] Second, configuration of computation depth parameters. The system supports configurable computation depth parameters (3-7 layers), allowing users to balance accuracy and speed according to their actual needs.

[0081] Lower computation depth (3-4 layers) – suitable for scenarios with high real-time requirements, with fast computation speed but potentially slightly worse optimization effect;

[0082] Higher computational depth (5-7 layers) is suitable for scenarios with high requirements for optimization results. It requires more computation but can obtain better solutions.

[0083] Third, pruning optimization techniques. To further improve algorithm efficiency, pruning optimization techniques are introduced into the dynamic programming process. The pruning condition is: if If the state is removed, then the threshold is the pruning threshold (suggested range 1.2-1.5), and min_cost is the currently known minimum cost; Effect: Reduces computation and accelerates the search for the optimal solution.

[0084] S104, Calculate the revolving door R based on the real vector X2 according to the top-down amplitude encoding. Y From this perspective, the states of the control gate quantum states are sorted based on a heuristic search algorithm, and quantum circuits are constructed accordingly.

[0085] In this embodiment, the control bit order is optimized through heuristic search, the X-gate sharing benefit is maximized, the number of quantum gates and circuit depth are reduced, and the optimized real vector X2 is obtained.

[0086] The heuristic search algorithm is used to sort the states of the control gate quantum states, specifically including the following steps:

[0087] Step 1: State set construction: Extract all control states of the system that require the execution of control quantum gate operations;

[0088] Step 2: Generate a random state execution order as the initial solution;

[0089] Step 3: Cost calculation, calculate the total number of sub-gates based on the current order;

[0090] Step 4: Heuristic search optimization (using simulated annealing as an example) (initialization parameters: initial temperature T, cooling coefficient α (α∈(0,1)), number of iterations;

[0091] Iterative loop:

[0092] Randomly swap the positions of two states in the current order to generate a new order; calculate the total number of quantum gates in the new order; if the number of quantum gates in the new order is less, accept the new order;

[0093] Otherwise, accept the new order with a certain probability;

[0094] Cooling: Reduce the temperature according to the cooling strategy;

[0095] Termination condition: The iteration terminates when the temperature drops to the threshold or the number of iterations is reached.

[0096] Step 5: Output the results.

[0097] Specifically, in this embodiment, the control bit order is optimized through heuristic search (such as a genetic algorithm) to maximize the X-gate sharing benefit and reduce the number of quantum gates and circuit depth. Detailed process:

[0098] First, the cost model is constructed. The cost function is defined as follows: ,in It is an anti-controlled gate R y quantity, It is the number of X gates. It is the circuit depth. These are weighting coefficients. For example... Figure 2 The diagram shown is a schematic of the inversely controlled Ry gate structure in a practical circuit, as illustrated in this example.

[0099] Secondly, control bit patterns are grouped. Control bit patterns are grouped according to similarity, with similar bits based on the Hamming distance of the control bit states and the gate operation timing. Grouping criteria: ,in It is the similarity threshold.

[0100] Another approach is sequential search algorithms. These employ genetic algorithms or simulated annealing algorithms to search for the optimal order.

[0101] like Figure 3 The diagram shown is a schematic of the quantum circuit structure with n qubits in this embodiment; as shown... Figure 4 The diagram shown is a schematic of the quantum circuit structure with 3 qubits in this embodiment; as shown Figure 5 The diagram shown is a schematic of the quantum circuit structure of the last three qubits of the sorting strategy in this embodiment.

[0102] S105, run the constructed quantum circuit to obtain the output quantum state corresponding to the real vector X2; wherein the amplitude of the output quantum state is the real vector X2.

[0103] Furthermore, the revolving door R is calculated based on the real vector X2 according to the top-down amplitude encoding. Y From this perspective, we can construct optimized quantum circuits, including:

[0104] Following the encoding rules of top-down amplitude coding, the rotation angles are solved sequentially. By manipulating n qubits according to the quantum circuit, a quantum state can be obtained. ;in, It is the ground state of n qubits. It is a real vector The i-th element is then used to obtain the elements of the real vector X. .

[0105] Furthermore, rotation angle The solution process is as follows:

[0106] (1) Transform the vector Divide into two equal parts, the left half of which is denoted as Its modulus length is denoted as The right half is denoted as Its modulus length is denoted as ,but , , ;

[0107] (2) Divide the two parts equally , Divide each part into four equal parts, and denote them as follows: , , , Among them, rotation angle , ;

[0108] (3) Repeat the bisection operation until X2 is divided into 2. n-1 Each binary part yields all rotation angles. .

[0109] Explanation of n: n represents the number of qubits. In this embodiment... , where N is the number of elements in the input vector. It rounds up. If N=2, then n=1, and only one RY quantum gate coefficient needs to be solved. If N=4, then n=2, and it is only necessary to solve for 3 RY quantum gate coefficients. , , .

[0110] S105, run the constructed quantum circuit to obtain the output quantum state corresponding to the real vector X2; wherein, the amplitude of the output quantum state is the vector after the real vector X2 is reversibly transformed.

[0111] Specifically, in this embodiment, quantum state preparation refers to the process of encoding classical vector information into a quantum state by running the constructed quantum circuit. Let the constructed quantum circuit be represented by a unitary operator U, and the initial quantum state be... The prepared quantum state is: ,in It is the i-th element of vector X2. It is the ground state of an n-bit quantum bit system.

[0112] Specific implementation case: X=[100,0.1,0.2,0.3,0.4,0.5,0.6,0.7], k=1.5, T=3, Q1 =0.275, Q2=0.45, Q3 =0.625, mean μ = 12.85, standard deviation σ = 35.2145, CV=σ / μ=35.2145 / 12.85=2.7404, CV = 2.7404>1.5(k), triggering outlier handling. Since 100>3*0.45, it is determined to be an outlier. According to the outlier handling method:

[0113] X ‘ =[0.45,0.1,0.2,0.3,0.4,0.5,0.6,0.7], modulus-normalized vector X1= [0.36,0.08,0.16,0.24,0.32,0.4,0.47,0.55]. N=8=2 3 Therefore, no expansion is needed, i.e., X2=X1=[0.36,0.08,0.16,0.24,0.32,0.4,0.47,0.55]. The rotation angles of the RY gate based on X2 are solved using Top-down amplitude encoding: α0=2.168, α1=1.328, α2=1.91, α3=1.04, α4=1.966, α5=1.792, α6=1.728.

[0114] The control qubits were sorted using a heuristic search algorithm, resulting in {1, 0, 01, 00, 10, 11}. A schematic diagram of the corresponding quantum circuit structure is shown below. Figure 6 ), unsorted structural diagram ( Figure 7 Reducing the number of quantum gates ( Figure 6 ,11; Figure 7 ,15), Quantum circuit depth ( Figure 6 ,11; Figure 7 ,13).

[0115] Secondly, this application also proposes a quantum state preparation system based on arbitrary real vectors, comprising:

[0116] The outlier detection module is used to detect outliers in the real vector X and perform outlier calibration processing on the detected outliers to obtain the real vector X'.

[0117] The normalization processing module is used to normalize the real vector X' to obtain the real vector X1;

[0118] The optimization module is used to expand the real vector X1 according to the dynamic zero-padding strategy to obtain 2 n A real vector X2 with n elements;

[0119] A quantum circuit construction module is used to calculate the revolving door R based on the real vector X2 according to the top-down amplitude encoding. Y From this perspective, the states of the control gate quantum states are sorted based on a heuristic search algorithm, and quantum circuits are constructed accordingly.

[0120] A quantum state preparation module is used to run the constructed quantum circuit to obtain the output quantum state corresponding to the real vector X2; wherein the amplitude of the output quantum state is the real vector X2.

[0121] Specifically, in this embodiment, the corresponding outlier detection module, normalization processing module, optimization module, quantum circuit construction module, and quantum state preparation module are also used to execute the quantum state preparation method based on arbitrary real vectors as described in the first aspect.

[0122] Thirdly, this application also proposes a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the quantum state preparation method based on arbitrary real vectors described in the first aspect.

[0123] Fourthly, this application also proposes a computing device, including a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, it implements the quantum state preparation method based on arbitrary real vectors as described in the first aspect.

[0124] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for preparing quantum states based on arbitrary real vectors, characterized in that, include: Outlier detection is performed on the real vector X, and outlier calibration is performed on the detected outliers to obtain the real vector X'. Normalize the real vector X' to obtain the real vector X1; The real vector X1 is expanded according to the dynamic zero-padding strategy to obtain 2 n The real vector X2 with n elements includes: obtaining the number of elements N of the real vector X1 according to the formula Solving for the number of qubits n, we get the number of qubits n, i.e. n is a positive integer; expand vector X1 to dimension 2. n The real vector X2, Supplement 2 n -N zero elements; minimize the number of quantum gates with many anti-control bits through a dynamic zero-padding strategy; optimize the control bit order through heuristic search to maximize the X-gate sharing benefit, reduce the number of quantum gates and circuit depth, and obtain the optimized real vector X2; The revolving door R is calculated based on the real vector X2 according to the top-down amplitude encoding. Y From this perspective, the states of the control gate quantum states are sorted based on a heuristic search algorithm, and quantum circuits are constructed accordingly. The constructed quantum circuit is run to obtain the output quantum state corresponding to the real vector X2; wherein the amplitude of the output quantum state is the real vector X2. The method of minimizing the number of quantum gates with many anti-control bits through a dynamic zero-padding strategy includes: transforming the zero-padding position selection problem into a dynamic programming problem; wherein, the state is defined. This represents the minimum number of quantum gates required to process vector position i after inserting j zero elements; the state transition equation is: Where i represents the current vector position being processed, j represents the number of zero elements already inserted, and cost(i,j) represents the increment in the number of quantum gates generated after inserting a zero element at position i; determine the initial state. Other states are initialized to infinity; by traversing all possible states, find Find the minimum value and backtrack to obtain the optimal zero-padding position.

2. The method for preparing quantum states based on arbitrary real vectors according to claim 1, characterized in that, The outlier detection of the real vector X includes: For any real vector X = [x0, x1,..., x N-1 , calculate the lower quartile Q1, upper quartile Q3, median Q2 of the real vector X, the mean μ = mean(X), the standard deviation σ = std(X), and define the coefficient of variation CV = σ / μ; when CV ≥ k, the element x i > T*Q2 is determined as an outlier; when 0.15 ≤ CV < k, the element x i < Q1 - 1.5(Q3 - Q1) or x i > Q3 + 1.5(Q3 - Q1) is determined as an outlier; where T measures the degree of deviation of the outlier, by default T = 3, and k is set according to the sensitivity of the outlier in the actual application scenario, by default: k = 1.

5.

3. The method for preparing quantum states based on arbitrary real vectors according to claim 1, characterized in that, The revolving door R is calculated based on the real vector X2 according to the top-down amplitude encoding. Y From this perspective, a heuristic search algorithm is used to sort the states of the control gate quantum states, and quantum circuits are constructed based on this sorting, including: Following the encoding rules of top-down amplitude coding, the R of the revolving door is solved sequentially. Y rotation angle ; By manipulating n qubits according to the quantum circuit, a quantum state can be obtained. ;in, It is the ground state of n qubits. It is a real vector The i-th element is then used to obtain the elements of the real vector X. .

4. The method for preparing quantum states based on arbitrary real vectors according to claim 3, characterized in that, The rotation angle is solved sequentially according to the encoding rules of Top-down amplitude encoding. ,include: vector Divide into two equal parts, the left half of which is denoted as Its modulus length is denoted as The right half is denoted as Its modulus length is denoted as ,but , , ; The two equally divided parts , Divide each part into four equal parts, and denote them as follows: , , , Among them, rotation angle , ; Repeat the bisection operation until X2 is divided into 2. n-1 Each binary part yields all rotation angles. .

5. The method for preparing quantum states based on arbitrary real vectors according to claim 1, characterized in that, Running the constructed quantum circuit to obtain the output quantum state corresponding to the real vector X2 includes: The constructed quantum circuit is represented as a unitary operator U, with the initial quantum state being... The prepared quantum state is: ;in It is the i-th element of vector X2. It is the ground state of an n-bit quantum bit system.

6. A quantum state preparation system based on arbitrary real vectors, characterized in that, include: The outlier detection module performs outlier detection on the real vector X and performs outlier calibration processing on the detected outliers to obtain the real vector X'. The normalization module normalizes the real vector X' to obtain the real vector X1; The optimization module expands the real vector X1 according to the dynamic zero-padding strategy, resulting in 2... n The real vector X2 with n elements includes: obtaining the number of elements N of the real vector X1 according to the formula Solving for the number of qubits n, we get the number of qubits n, i.e. n is a positive integer; expand vector X1 to dimension 2. n The real vector X2, Supplement 2 n -N zero elements; minimize the number of quantum gates with many anti-control bits through a dynamic zero-padding strategy; optimize the control bit order through heuristic search to maximize the X-gate sharing benefit, reduce the number of quantum gates and circuit depth, and obtain the optimized real vector X2; The quantum circuit construction module calculates the rotating gate R based on the real vector X2 according to the top-down amplitude encoding. Y From this perspective, the states of the control gate quantum states are sorted based on a heuristic search algorithm, and quantum circuits are constructed accordingly. The quantum state preparation module runs the constructed quantum circuit to obtain the output quantum state corresponding to the real vector X2; wherein the amplitude of the output quantum state is the real vector X2. The method of minimizing the number of quantum gates with many anti-control bits through a dynamic zero-padding strategy includes: transforming the zero-padding position selection problem into a dynamic programming problem; wherein, the state is defined. This represents the minimum number of quantum gates required to process vector position i after inserting j zero elements; the state transition equation is: Where i represents the current vector position being processed, j represents the number of zero elements already inserted, and cost(i,j) represents the increment in the number of quantum gates generated after inserting a zero element at position i; determine the initial state. Other states are initialized to infinity; by traversing all possible states, find Find the minimum value and backtrack to obtain the optimal zero-padding position.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the quantum state preparation method based on any one of claims 1-5.

8. A computing device, characterized in that, It includes a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, it implements the quantum state preparation method based on any one of claims 1-5.