Sampling Methods for Quantum Circuit Simulation
By layering the quantum state vectors and building the accumulated function vector, the problem of excessive storage and computing complexity in large-scale quantum state vector sampling is solved, and the efficiency and sampling efficiency of quantum circuit simulation are improved.
Patent Information
- Application Number
- CN202510738451.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-06-04
AI Technical Summary
During large-scale quantum state vector sampling processing, since the dimensions of the quantum state vectors increase exponentially with the number of quantum bits, the computational complexity and storage resources increase, which affects the simulation efficiency of quantum circuits and has poor user experience.
By hierarchically processing the quantum state vectors to be sampled, quantum data blocks are determined, and accumulative function vectors are constructed. The preset algorithm is used to quickly locate the target ground state index list to reduce storage pressure and calculation complexity.
Through the application of layered processing and the application of accumulated function vectors, the data scale of storage pressure and single measurement processing is reduced, and the efficiency and sampling efficiency of quantum circuit simulation are improved.
Smart Images

Figure CN120257917B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of quantum circuit simulation, and more specifically, to a sampling method for quantum circuit simulation. Background Art
[0002] Based on the unique physical properties of quantum bits such as quantum superposition and quantum entanglement, quantum computing has demonstrated theoretical advantages that significantly surpass the classical computing paradigm when dealing with specific complex problems. In related technologies, relying on classical computing resources, quantum circuit simulation can model and simulate the quantum computing process, simulate the evolution of quantum states under quantum gate operations, and the core task is to accurately calculate the quantum state vector. As a key technology in quantum circuit simulation, the sampling algorithm of the quantum state vector aims to obtain the ground state distribution of the quantum state by simulating the quantum measurement process. However, when sampling and processing large-scale quantum state vectors, the dimension of the quantum state vector grows exponentially with the number of quantum bits, resulting in increased computational complexity and storage resources, resulting in poor efficiency of quantum circuit simulation and affecting user experience. Summary of the Invention
[0003] The present application provides a sampling method for quantum circuit simulation.
[0004] The present application provides a sampling method for quantum circuit simulation, the method comprising:
[0005] Performing hierarchical processing on the quantum state vector to be sampled to determine the quantum data block;
[0006] Determining a first accumulation function vector according to the quantum data block;
[0007] A first base state index list is determined according to the first accumulation function vector and the acquired number of sampling times to complete the sampling of the quantum circuit simulation.
[0008] In this way, the computer device performs hierarchical processing on the quantum state vector to be sampled to determine the quantum data block. Next, the computer device determines a first accumulator function vector based on the quantum data block. Finally, the computer device determines a first base state index list based on the first accumulator function vector and the acquired number of samples to complete the sampling for the quantum circuit simulation. In this way, by dividing the complete quantum state vector into multiple quantum data blocks through hierarchical processing, it is possible to reduce storage pressure and the size of the data processed for a single measurement. Furthermore, by utilizing the monotonically increasing nature of the accumulator function vector, the quantum data block containing the target ground state can be quickly located according to a preset algorithm, thereby determining the first base state index list and completing the sampling for the quantum circuit simulation. This reduces computational and storage overhead and improves the efficiency of quantum circuit simulation.
[0009] In certain embodiments, performing hierarchical processing on the quantum state vector to be sampled to determine the quantum data block includes:
[0010] When the number of quantum bits in the quantum state vector is greater than a first preset number of quantum bits, the quantum state vector is hierarchically processed to determine the quantum data block, wherein the number of the quantum data blocks is associated with a second preset number of quantum bits, and the second preset number of quantum bits is a predefined number of quantum bits in the quantum data block.
[0011] In this way, when the number of qubits in the quantum state vector is greater than the first preset number of qubits, the computer device performs hierarchical processing on the quantum state vector to determine quantum data blocks, where the number of quantum data blocks is associated with the second preset number of qubits, which is the predefined number of qubits in the quantum data block. Thus, when the number of qubits in the quantum state vector is greater than the first preset number of qubits, the complete quantum state vector is divided into multiple quantum data blocks through hierarchical processing, which can reduce storage pressure and the size of data processed in a single measurement. Furthermore, by adjusting the second preset number of qubits, it is possible to flexibly balance memory and computing power to adapt to diverse simulation needs.
[0012] In some embodiments, determining a first accumulation function vector based on the quantum data block includes:
[0013] performing a square amplitude calculation on the quantum data block to determine a first square amplitude sum;
[0014] Normalization is performed on the first amplitude square sum to determine the first accumulation function vector.
[0015] In this manner, the computer device calculates the sum of squared amplitudes on the quantum data block to determine a first sum of squared amplitudes. The computer device then normalizes the first sum of squared amplitudes to determine a first accumulator function vector. By constructing the first accumulator function vector, the continuous probability distribution can be converted into monotonically increasing discrete probability values, thereby reducing sampling complexity in subsequent processing by leveraging the algorithmic properties of a pre-set algorithm.
[0016] In some embodiments, determining a first basis state index list based on the first accumulator function vector and the obtained number of sampling times to complete the sampling of the quantum circuit simulation includes:
[0017] Determining a target quantum data block within the sampling number, based on a preset algorithm and according to the obtained first random number and the first accumulation function vector;
[0018] determining a block accumulation function vector according to a quantum basis state in the target quantum data block;
[0019] A first basis state index list is determined according to the first accumulation function vector and the block accumulation function vector to complete sampling of the quantum circuit simulation.
[0020] Thus, within the sampling times, based on a preset algorithm, the computer device determines the target quantum data block based on the obtained first random number and the first accumulator function vector. Next, the computer device determines the block accumulator function vector based on the quantum ground state in the target quantum data block. Finally, the computer device determines the first ground state index list based on the first accumulator function vector and the block accumulator function vector to complete the sampling for the quantum circuit simulation. In this way, by determining the inter-block coarse sampling of the target quantum data block and subsequently performing intra-block fine sampling based on the block accumulator function vector, the complexity of large-scale quantum state vector sampling can be reduced, thereby improving the efficiency of quantum circuit simulation.
[0021] In some embodiments, determining a block accumulation function vector based on a quantum basis state in the target quantum data block includes:
[0022] performing a square sum of amplitude calculation on a quantum ground state in a target quantum data block to determine a second square sum of amplitude corresponding to the target quantum data block;
[0023] Normalization is performed on the second amplitude square sum to determine the block accumulation function vector.
[0024] In this manner, the computer device calculates the sum of squared amplitudes of the quantum ground state in the target quantum data block to determine a second sum of squared amplitudes corresponding to the target quantum data block. The computer device then normalizes the second sum of squared amplitudes to determine a block accumulator function vector. By constructing a block accumulator function vector, a continuous probability distribution can be converted into monotonically increasing discrete probability values, thereby reducing sampling complexity in subsequent processing by leveraging the algorithmic properties of a pre-set algorithm.
[0025] In some embodiments, determining a first basis state index list based on the first accumulator function vector and the block accumulator function vector to complete the sampling of the quantum circuit simulation includes:
[0026] Based on the preset algorithm, determining an intra-block index from the target quantum data block according to the obtained second random number and the block accumulation function vector;
[0027] The first base state index list is determined according to the intra-block index.
[0028] In this manner, the computer device determines an intra-block index from the target quantum data block based on the acquired second random number and the block accumulator function vector. Next, the computer device determines a first base state index list based on the intra-block index. In this way, using the block accumulator function vector, combined with a preset algorithm, the base state position corresponding to the random number can be quickly located, thereby improving the sampling efficiency of large-scale quantum state vectors.
[0029] In certain embodiments, the method further comprises:
[0030] When the number of quantum bits in the quantum state vector is less than or equal to the first preset number of quantum bits, determining a second accumulation function vector according to the quantum state vector;
[0031] A second base state index list is determined according to the second accumulation function vector and the sampling times to complete the sampling of the quantum circuit simulation.
[0032] In this manner, when the number of qubits in the quantum state vector is less than or equal to the first predetermined number of qubits, the computer device determines a second accumulator function vector based on the quantum state vector. Next, the computer device determines a second base state index list based on the second accumulator function vector and the number of sampling times to complete sampling for the quantum circuit simulation. Thus, when the number of qubits in the quantum state vector is small, constructing and using the second accumulator function vector simplifies the sampling process. Furthermore, due to the monotonically increasing nature of the accumulator function vector, a preset algorithm can be used to quickly locate the base state position corresponding to the random number, thereby improving sampling efficiency.
[0033] In some embodiments, determining a second accumulator function vector based on the quantum state vector includes:
[0034] performing a square sum of amplitude calculation on the quantum ground state in the quantum state vector to determine a third square sum of amplitude;
[0035] Normalization is performed on the third amplitude square sum to determine the second accumulation function vector.
[0036] In this manner, the computer device calculates the sum of squared amplitudes of the quantum basis state in the quantum state vector to determine a third sum of squared amplitudes. The computer device then normalizes the third sum of squared amplitudes to determine a second accumulator function vector. By constructing the second accumulator function vector, the continuous probability distribution can be converted into monotonically increasing discrete probability values, thereby reducing sampling complexity in subsequent processing by utilizing the algorithmic properties of the preset algorithm.
[0037] In some embodiments, determining a second basis state index list according to the second accumulation function vector and the sampling number includes:
[0038] Determining a second basis state index according to the obtained third random number and the second accumulation function vector based on a preset algorithm within the sampling number;
[0039] Determine the second base state index list according to the second base state index.
[0040] In this manner, within the sampling period, the second basis state index is determined based on the obtained third random number and the second accumulation function vector using a preset algorithm. Subsequently, the computer device determines a second basis state index list based on the second basis state index. Thus, using the preset algorithm and the second accumulation function vector, the computer device can quickly locate the second basis state index, thereby improving sampling efficiency.
[0041] In certain embodiments, the method further comprises:
[0042] When a target measurement qubit is obtained, determining a target measurement state vector according to the quantum state vector based on a preset bit operation algorithm;
[0043] Determining a third accumulator function vector according to the target measurement state vector;
[0044] A third base state index list is determined according to the third accumulation function and the sampling number.
[0045] In this manner, upon acquiring the target measurement qubit, the computer device determines the target measurement state vector based on the quantum state vector based on a preset bitwise operation algorithm. Next, the computer device determines a third accumulation function vector based on the target measurement state vector. Finally, the computer device determines a third basis state index list based on the third accumulation function and the number of samplings. Thus, upon acquiring the target measurement qubit, the computer device can utilize the preset bitwise operation algorithm to determine the target measurement state vector based on the quantum state vector. Furthermore, the target measurement state vector can be used to efficiently determine the third basis state index based on the determination of the third accumulation function vector, thereby improving the overall efficiency of quantum state vector sampling.
[0046] Additional aspects and advantages of the embodiments of the present application will be given in part in the description below, and in part will become obvious from the description below, or will be learned through practice of the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0048] Figure 1 This is one of the flow charts of the sampling method for quantum circuit simulation according to the embodiment of the present application;
[0049] Figure 2 This is the second flow chart of the sampling method for quantum circuit simulation according to the embodiment of the present application;
[0050] Figure 3 This is the third flow chart of the sampling method for quantum circuit simulation according to the embodiment of the present application;
[0051] Figure 4 This is the fourth flow chart of the sampling method for quantum circuit simulation according to the embodiment of the present application;
[0052] Figure 5 This is the fifth flow chart of the sampling method for quantum circuit simulation according to the embodiment of the present application;
[0053] Figure 6 This is the sixth flow chart of the sampling method for quantum circuit simulation according to the embodiment of the present application;
[0054] Figure 7 This is the seventh flow chart of the sampling method for quantum circuit simulation according to the embodiment of the present application;
[0055] Figure 8 This is the eighth flow chart of the sampling method for quantum circuit simulation according to the embodiment of the present application;
[0056] Figure 9 This is a ninth flow chart of a sampling method for quantum circuit simulation according to an embodiment of the present application;
[0057] Figure 10 This is a tenth flowchart of a sampling method for quantum circuit simulation according to an embodiment of the present application;
[0058] Figure 11 This is a quantum circuit simulation sampling flow chart of an embodiment of the present application. DETAILED DESCRIPTION
[0059] The embodiments of the present application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of the present application, and should not be understood as limiting the embodiments of the present application.
[0060] Based on the unique physical properties of quantum bits - quantum superposition and quantum entanglement, quantum computing has shown significant theoretical advantages over classical computing paradigms in dealing with specific complex problems. Unlike classical bits that can only represent two discrete states, 0 or 1, a single quantum bit can be in and The entanglement between multiple qubits can form high-dimensional correlated states, giving quantum computing a natural parallel information processing capability. For example, the Shor algorithm uses quantum Fourier transform and superposition to complete the decomposition of large integers in polynomial time, which requires exponential time for classical algorithms, directly threatening the existing RSA encryption system; the Grover algorithm uses quantum search amplitude amplification technology to improve the search efficiency of unsorted databases to 100% of that of classical algorithms. times (N is the database size). These characteristics make quantum computing show great potential in fields such as cryptography, combinatorial optimization, and quantum chemistry simulation.
[0061] Among related technologies, quantum circuit simulation, relying on classical computing resources, is a key approach for validating quantum algorithms, testing hardware designs, and exploring the behavior of quantum systems. Quantum circuits are constructed by cascading a series of quantum gates (such as Hadamard gates, CNOT gates, and phase gates, which are unitary transformations). Their simulation essentially models the evolution of quantum state vectors in Hilbert space. In quantum circuit simulation, quantum state vector sampling is a key step in obtaining measurement results and verifying algorithm correctness. Its goal is to efficiently extract classical samples from the probability distribution of quantum states, effectively simulating the state vector collapse process caused by quantum measurements.
[0062] However, the dimension of the quantum state vector grows exponentially with the number of quantum bits n ( ). When n=30, the state vector contains about 1 billion complex elements. If double-precision floating-point storage is used (each complex number occupies 24 bytes), the state vector itself requires about 24GB of memory, which far exceeds the memory capacity of an ordinary workstation. Traditional sampling algorithms require additional storage of probability vectors and accumulation vectors of equal length, further increasing storage pressure. In addition, the time complexity of direct sampling methods (such as linear search probability matching) is O( For n = 20, a single sampling requires approximately 1 million iterations, which takes hours or even days even on a high-performance computer. However, practical quantum algorithms often require over a million samples to ensure statistical significance, resulting in unacceptable simulation times and a poor user experience.
[0063] Based on the above questions, please refer to Figure 1 , an embodiment of the present application provides a sampling method for quantum circuit simulation, the method comprising:
[0064] 011: Perform hierarchical processing on the quantum state vector to be sampled to determine the quantum data block;
[0065] 012: Determine a first accumulation function vector according to the quantum data block;
[0066] 013: Determine a first base state index list according to the first accumulation function vector and the obtained number of sampling times to complete the sampling of the quantum circuit simulation.
[0067] The present application also provides a computer device comprising a memory and a processor. The quantum circuit optimization method of the present application can be implemented by the computer device of the present application. Specifically, the memory stores a computer program, and the processor is configured to perform hierarchical processing on quantum state vectors to be sampled, determine quantum data blocks, and determine a first accumulator function vector based on the quantum data blocks. Furthermore, based on the first accumulator function vector and the acquired number of sampling times, a first base state index list is determined to complete sampling for quantum circuit simulation.
[0068] Embodiments of the present application also provide a quantum circuit simulation device. The quantum circuit optimization method of the embodiment of the present application can be implemented by the quantum circuit simulation device of the embodiment of the present application. Specifically, the quantum circuit simulation device includes a determination module. The determination module is configured to perform hierarchical processing on quantum state vectors to be sampled to determine quantum data blocks. Based on the quantum data blocks, a first accumulator function vector is determined. Furthermore, based on the first accumulator function vector and the acquired number of sampling times, a first base state index list is determined to complete sampling for quantum circuit simulation.
[0069] Specifically, quantum circuit simulation (QCS) involves modeling the execution of quantum algorithms using classical computers or specialized simulators to predict the behavior and output of quantum systems. The core goal of quantum circuit simulation is to replicate or approximate the operation of quantum computers on classical computers, thereby validating quantum algorithms, testing hardware designs, optimizing quantum programs, or studying the characteristics of quantum systems.
[0070] A quantum system refers to a physical object or set governed by the rules of quantum mechanics, such as the spin or polarization of an electron, the spin or polarization of a photon, etc.
[0071] Mathematically, the complex vector that describes the state of all quantum bits in a quantum system is called the quantum state vector, which is usually written as The length of the quantum state vector is (n is the number of quantum bits), each element represents the amplitude (complex number) of the corresponding quantum ground state (hereinafter referred to as the ground state), and its squared modulus is the measurement probability of the ground state. The mathematical expression of the quantum state vector is: , , ,in, is the i-th element of the quantum state vector, corresponding to the ground state Amplitude of the ground state is a subset of the quantum state vector, that is, the ground state is a specific quantum state with the lowest energy, and the quantum state vector covers all possible states. For example, assuming that the number of quantum bits in the quantum system D is 2, then the ground state includes 、 、 and , and set 、 、 and The corresponding amplitude Both , the quantum state vector is .
[0072] Quantum measurement is a fundamental operation in quantum mechanics, used to extract classical information from a quantum state. Its core characteristic is that it causes the quantum state to collapse to the ground state corresponding to the measurement result. Quantum measurement has the following characteristics: 1. After measurement, the quantum state vector irreversibly collapses to a certain ground state, such as After collapse, it will only become 、 、 and 2. The probability of different ground states appearing is determined by the amplitude corresponding to the ground state. 3. After collapsing to a certain ground state, the ground state is the result of quantum measurement.
[0073] Quantum sampling refers to the process of generating a series of classical results that conform to the probability distribution of a quantum measurement, typically achieved through multiple independent measurements. Quantum sampling is essentially a collection of the results of multiple quantum measurements, relying on the probabilistic rules of a single measurement. The difference is that quantum measurements are single results, while quantum sampling is a statistical distribution.
[0074] Sampling algorithms (SA) refer to techniques for generating random samples from probability distributions or data sets, which are used to estimate expected values, optimize models, or perform statistical inference. Their core goal is to use partial data to infer overall characteristics, reduce computational costs, and improve efficiency.
[0075] A quantum circuit is a sequence of operations consisting of quantum gates that are used to perform controlled transformations of quantum states to achieve computational goals.
[0076] Quantum gates refer to the basic operating units in quantum computing. They are mathematical operations that perform specific transformations on the state of quantum bits. In essence, they are unitary transformations acting on quantum states, satisfying reversibility and probability conservation. They are used to construct quantum circuits to implement the logical functions of quantum algorithms.
[0077] A qubit is the basic unit of information used to encode data in quantum computing. It can be understood as the quantum equivalent of the classical bit used by traditional computers to encode information in binary form.
[0078] The overall process of quantum circuit simulation is as follows: After an initial quantum state vector is input into the quantum circuit, quantum gates within the quantum circuit gradually perform unitary transformations on the initial quantum state vector to obtain the final quantum state vector. Subsequently, quantum measurements are performed on the final quantum state vector, collapsing it to a certain ground state and determining the classical result. After multiple quantum measurements, a set of classical results is obtained.
[0079] Hierarchical processing refers to a divide-and-conquer strategy proposed to address the high storage and computational complexity of large-scale quantum state vectors. Its core is to decompose high-dimensional quantum state vectors into multiple low-dimensional subvectors (blocks), i.e., perform hierarchical processing, to reduce storage requirements and computational complexity. The resulting multiple low-dimensional subvectors (blocks) are quantum data blocks.
[0080] The first cumulative function vector refers to the cumulative probability vector of the roughly positioned target quantum data block, and each element is the cumulative value of the squared sum of the moduli of all amplitudes in the corresponding quantum data block (ie, the block probability).
[0081] The first basis state index list refers to the final basis state index list obtained by the first accumulation function vector and other parameters, the length of which is the number of sampling times T, and each element is the selected basis state index.
[0082] After the quantum circuit performs unitary transformation on the quantum state vector, the computer device performs hierarchical processing on the quantum state vector to be sampled, obtaining multiple quantum data blocks. Each quantum data block is a part of the quantum state vector and contains information about the specific state of the quantum system. The quantum data block provides the basis for subsequent calculations. For example, the number of quantum bits n of the quantum state vector M to be sampled is 3, and the quantum state vector M is [ 、 、0、0、0、0、 、 ], let the second preset number of quantum bits in each quantum data block be After the quantum state vector M is hierarchically processed, the amplitude of the quantum data block C0 is determined to be [ 、 ], the amplitude of quantum data block C1 is [0, 0], the amplitude of quantum data block C2 is [0, 0], and the amplitude of quantum data block C3 is [ 、 ].
[0083] Next, the computer device determines a first accumulation function vector based on the quantum data block. Continuing with the above example, the first accumulation function vector is determined to be [0.5, 0.5, 0.5, 1].
[0084] Finally, the computer device combines the accumulation function vector with a preset sampling number parameter to construct a first basis state index list, thereby achieving efficient sampling operations during the quantum circuit simulation process.
[0085] In summary, the computer device performs hierarchical processing on the quantum state vector to be sampled to determine the quantum data block. Next, the computer device determines a first accumulator function vector based on the quantum data block. Finally, the computer device determines a first base state index list based on the first accumulator function vector and the acquired number of samples to complete the sampling for the quantum circuit simulation. In this way, by dividing the complete quantum state vector into multiple quantum data blocks through hierarchical processing, it is possible to reduce storage pressure and the size of the data processed for a single measurement. Furthermore, by utilizing the monotonically increasing nature of the accumulator function vector, the quantum data block containing the target ground state can be quickly located according to a preset algorithm, thereby determining the first base state index list and completing the sampling for the quantum circuit simulation, reducing computational and storage overhead and improving quantum circuit simulation efficiency.
[0086] See also Figure 2 In some embodiments, step 011 (performing hierarchical processing on the quantum state vector to be sampled to determine the quantum data block) includes:
[0087] 0111: When the number of quantum bits in the quantum state vector is greater than the first preset number of quantum bits, the quantum state vector is hierarchically processed to determine a quantum data block.
[0088] In some embodiments, the determination module is further configured to perform hierarchical processing on the quantum state vector to determine the quantum data block when the number of quantum bits in the quantum state vector is greater than a first preset number of quantum bits.
[0089] In some embodiments, the processor is further configured to perform hierarchical processing on the quantum state vector to determine the quantum data block when the number of quantum bits in the quantum state vector is greater than a first preset number of quantum bits.
[0090] Specifically, the first preset number of quantum bits is a pre-set critical value used to determine whether the quantum state vector needs to be hierarchically processed. When the dimension of the quantum state vector It is growing exponentially, and traditional processing methods will lead to excessive storage and computing complexity, requiring optimization through hierarchical dimensionality reduction.
[0091] Before performing layered processing, it is necessary to define the second preset number of quantum bits , the second preset number of quantum bits Refers to the number of quantum bits in each predefined quantum data block, which determines the size of the quantum data block. Each quantum data block includes The ground state ( qubits can be combined to form states). The number of quantum data blocks is determined by n and Jointly decided, the calculation formula is: Number of quantum data blocks = .
[0092] For example, let n=5 (number of quantum bits), =3 (first preset threshold), =2 (the second preset number of quantum bits). Then each quantum data block includes The number of quantum data blocks is = = 8 blocks. The base state index is assigned as follows: Quantum data block C0: base state 0-3 (corresponding to quantum bit combination to ); Quantum data block C1: ground state 4-7 (corresponding quantum bit combination is to ); Quantum data block C2: ground state 8-11 (corresponding quantum bit combination is to ); Quantum data block C3: ground state 12-15 (corresponding quantum bit combination is to ); Quantum data block C4: ground state 16-19 (corresponding quantum bit combination is to ); Quantum data block C5: ground state 20-23 (corresponding quantum bit combination is to ); Quantum data block C6: ground state 24-27 (corresponding quantum bit combination is to ); Quantum data block C7: ground state 28-31 (corresponding quantum bit combination is to ).
[0093] In this way, when the number of qubits in the quantum state vector is greater than the first preset number of qubits, the computer device performs hierarchical processing on the quantum state vector to determine quantum data blocks, where the number of quantum data blocks is associated with the second preset number of qubits, which is the predefined number of qubits in the quantum data block. Thus, when the number of qubits in the quantum state vector is greater than the first preset number of qubits, the complete quantum state vector is divided into multiple quantum data blocks through hierarchical processing, which can reduce storage pressure and the size of data processed in a single measurement. Furthermore, by adjusting the second preset number of qubits, it is possible to flexibly balance memory and computing power to adapt to diverse simulation needs.
[0094] See also Figure 3 In some embodiments, step 012 (determining a first accumulation function vector based on the quantum data block) includes:
[0095] 0121: Calculate the sum of squared amplitudes of the quantum data block to determine a first sum of squared amplitudes;
[0096] 0122: Normalize the first amplitude square sum to determine a first accumulation function vector.
[0097] In certain embodiments, the determination module is further configured to perform amplitude square sum calculation on the quantum data block to determine a first amplitude square sum, and perform normalization processing on the first amplitude square sum to determine a first accumulation function vector.
[0098] In certain embodiments, the processor is further configured to perform a squared amplitude calculation on the quantum data block to determine a first squared amplitude sum, and perform a normalization process on the first squared amplitude sum to determine a first accumulator function vector.
[0099] Specifically, for each quantum data block C, the sum of the squares of the amplitudes of all quantum states within it is calculated, which is recorded as (i.e., the sum of the squares of the first amplitudes). If the number of quantum bits n of the quantum state vector M to be sampled is 3, the quantum state vector M is [ 、 、0、0、0、0、 、 ], let the second preset number of quantum bits in each quantum data block be After the quantum state vector M is hierarchically processed, the amplitude of the quantum data block C0 is determined to be [ 、 ], the amplitude of quantum data block C1 is [0, 0], the amplitude of quantum data block C2 is [0, 0], and the amplitude of quantum data block C3 is [ 、 ]. Then, the first amplitude square sum of quantum data block C0 is 0.5, the first amplitude square sum of quantum data block C1 is 0, the first amplitude square sum of quantum data block C2 is 0, and the first amplitude square sum of quantum data block C3 is 0.5.
[0100] Next, the first square sum of amplitudes of each quantum data block is normalized, that is, the first square sum of amplitudes of each quantum data block is divided by the sum of the first square sums of amplitudes of all quantum data blocks to determine the normalized probability corresponding to each quantum data block. Continuing with the above example, the normalized probability of quantum data block C0 is 0.5 / (0.5+0+0+0.5)=0.5, the normalized probability of quantum data block C1 is 0 / (0.5+0+0+0.5)=0, the normalized probability of quantum data block C2 is 0 / (0.5+0+0+0.5)=0, and the normalized probability of quantum data block C3 is 0.5 / (0.5+0+0+0.5)=0.5.
[0101] Finally, based on this normalized probability, the first cumulative function vector is constructed, namely = Continuing with the above example, the first accumulation function vector is determined to be [0.5, 0.5, 0.5, 1].
[0102] In this manner, the computer device calculates the sum of squared amplitudes on the quantum data block to determine a first sum of squared amplitudes. The computer device then normalizes the first sum of squared amplitudes to determine a first accumulator function vector. By constructing the first accumulator function vector, the continuous probability distribution can be converted into monotonically increasing discrete probability values, thereby reducing sampling complexity in subsequent processing by leveraging the algorithmic properties of a pre-set algorithm.
[0103] See also Figure 4 In some embodiments, step 013 (determining a first base state index list based on the first accumulator function vector and the obtained number of sampling times to complete sampling of the quantum circuit simulation) includes:
[0104] 0131: within the sampling number, based on a preset algorithm, according to the obtained first random number and the first accumulation function vector, determine the target quantum data block;
[0105] 0132: Determine the block accumulation function vector based on the quantum basis state in the target quantum data block;
[0106] 0133: Determine a first basis state index list according to the first accumulation function vector and the block accumulation function vector to complete sampling of the quantum circuit simulation.
[0107] In certain embodiments, the determination module is configured to determine, within a sampling number, a target quantum data block based on a preset algorithm, the obtained first random number and the first accumulator function vector. Furthermore, the block accumulator function vector is determined based on the quantum ground state in the target quantum data block. Furthermore, the first accumulator function vector and the block accumulator function vector are used to determine a first ground state index list, thereby completing sampling for quantum circuit simulation.
[0108] In certain embodiments, the processor is further configured to determine, within a sampling number, a target quantum data block based on the acquired first random number and the first accumulator function vector based on a preset algorithm, determine a block accumulator function vector based on the quantum ground state in the target quantum data block, and determine a first ground state index list based on the first accumulator function vector and the block accumulator function vector to complete sampling for quantum circuit simulation.
[0109] Specifically, the preset algorithm can use the monotonicity of the cumulative function to quickly locate the target index that meets the probability conditions, including the target quantum data block index and the target ground state index. In the embodiment of the present application, the sampling method of quantum circuit simulation is described using the bisection method as the preset algorithm.
[0110] The target quantum data block refers to the sub-quantum state vector block located in the block accumulation function vector by the preset algorithm. The determination process is as follows: generate a first random number R1, use the binary search method to find the sub-quantum state vector that satisfies <R1< The quantum data block index C of the quantum data block is the target quantum data block. The starting position of the target quantum data block in the quantum state vector is C× ,include Amplitude and quantum ground state.
[0111] The block accumulator function vector is a cumulative probability vector constructed by probabilistically calculating the quantum state amplitude within each target quantum data block after the quantum state vector is divided into multiple quantum data blocks in stratified sampling. The block accumulator function vector can be used to quickly locate a specific index within the target quantum data block.
[0112] Within the sampling times T, a first random number R1 is generated for each sampling point, and a preset algorithm is used to search the first cumulative function vector for a number that satisfies <R1< The target quantum data block is determined by using the quantum data block index C. Continuing with the above example, according to the generated first random number R1=0.7, the target quantum data block is determined to be quantum data block C3.
[0113] Then, extract all quantum ground state amplitudes in the target quantum data block, calculate the square of the modulus of each ground state, and determine the block accumulation function vector. Continuing with the above example, according to the amplitude in quantum data block C3 ( , ), determine the block accumulation function vector [0.5, 1].
[0114] Finally, a first basis state index list is determined according to the first accumulation function vector and the block accumulation function vector to complete the sampling of the quantum circuit simulation.
[0115] Thus, within the sampling times, based on a preset algorithm, the computer device determines the target quantum data block based on the obtained first random number and the first accumulator function vector. Next, the computer device determines the block accumulator function vector based on the quantum ground state in the target quantum data block. Finally, the computer device determines the first ground state index list based on the first accumulator function vector and the block accumulator function vector to complete the sampling for the quantum circuit simulation. In this way, by determining the inter-block coarse sampling of the target quantum data block and subsequently performing intra-block fine sampling based on the block accumulator function vector, the complexity of large-scale quantum state vector sampling can be reduced, thereby improving the efficiency of quantum circuit simulation.
[0116] See also Figure 5 In some embodiments, step 0132 (determining a block accumulation function vector based on the quantum basis state in the target quantum data block) includes:
[0117] 01321: Calculate the sum of squared amplitudes of the quantum ground state in the target quantum data block to determine a second sum of squared amplitudes corresponding to the target quantum data block;
[0118] 01322: Normalize the second amplitude square sum and determine the block accumulation function vector.
[0119] In certain embodiments, the determination module is further configured to calculate the sum of squared amplitudes of the quantum ground state in the target quantum data block to determine a second sum of squared amplitudes corresponding to the target quantum data block, and to normalize the second sum of squared amplitudes to determine a block accumulation function vector.
[0120] In certain embodiments, the processor is further configured to calculate a sum of squared amplitudes of the quantum ground state in the target quantum data block to determine a second sum of squared amplitudes corresponding to the target quantum data block, and to perform normalization processing on the second sum of squared amplitudes to determine a block accumulation function vector.
[0121] Specifically, for each quantum basis state in the target quantum data block, the sum of the modulus squares of the quantum state amplitudes of each quantum basis state in the target quantum data block is calculated, which is recorded as (i.e., the second amplitude square sum). Continuing with the above example, according to the amplitude in quantum data block C3 ( , ), determine that the second sum of squares of the amplitudes of the first quantum basis state C3-0 in the quantum data block C3 is 0.25, and determine that the second sum of squares of the amplitudes of the second quantum basis state C3-1 in the quantum data block C3 is 0.25.
[0122] Next, the sum of the squares of the second amplitudes of each quantum basis state in the quantum data block is normalized, that is, the sum of the squares of the second amplitudes of each quantum basis state in the quantum data block is divided by the sum of the squares of the second amplitudes of all quantum data blocks, and the normalized probability corresponding to each quantum basis state in the quantum data block C3 is determined. , = Continuing with the above example, the normalized probability of the first quantum ground state C3-0 is 0.25 / (0.25+0+0+0.25)=0.5, and the normalized probability of the first quantum ground state C3-1 is 0.25 / (0.25+0+0+0.25)=0.5.
[0123] Finally, based on this normalized probability, the building block accumulates the function vector, i.e. = Continuing with the above example, the block accumulation function vector is determined to be [0.5, 1].
[0124] In this manner, the computer device calculates the sum of squared amplitudes of the quantum ground state in the target quantum data block to determine a second sum of squared amplitudes corresponding to the target quantum data block. The computer device then normalizes the second sum of squared amplitudes to determine a block accumulator function vector. By constructing a block accumulator function vector, a continuous probability distribution can be converted into monotonically increasing discrete probability values, thereby reducing sampling complexity in subsequent processing by leveraging the algorithmic properties of a pre-set algorithm.
[0125] See also Figure 6 In some embodiments, step 0133 (determining a first basis state index list based on the first accumulation function vector and the block accumulation function vector to complete sampling of quantum circuit simulation) includes:
[0126] 01331: Based on a preset algorithm, determine the intra-block index from the target quantum data block according to the obtained second random number and the block accumulation function vector;
[0127] 01332: Determine the first base state index list according to the intra-block index.
[0128] In some embodiments, the determination module is further configured to determine, based on a preset algorithm, an intra-block index from the target quantum data block according to the acquired second random number and the block accumulation function vector, and to determine a first basis state index list according to the intra-block index.
[0129] In some embodiments, the processor is further configured to determine, based on a preset algorithm and according to the obtained second random number and the block accumulation function vector, an intra-block index from the target quantum data block, and determine a first basis state index list based on the intra-block index.
[0130] Specifically, based on the preset algorithm, according to generating the second random number R2 and utilizing the monotonically increasing characteristic of the block accumulation function vector, the block accumulation function vector is searched for a random number that satisfies <R2< The quantum basis state index i of determines the index within the block.
[0131] Next, the first base state index is determined according to the index within the block and the index of the target quantum data block, that is, the first base state index = C× +i. Continuing with the above example, R2=0.8, the block index is determined to be 1. The final result of this sampling process is (The base state index is 3× +1=7).
[0132] It should be noted that in the quantum circuit simulation sampling method provided in the embodiments of this application, after the quantum state vector is layered, the parallel computing capabilities of hardware (such as GPUs and multi-core CPUs) can be utilized to accelerate the parallelizable steps in the layered sampling. For example, the calculation of the sum of squares of the first amplitudes of different quantum data blocks is completely independent, and the blocks can be assigned to different CPU threads or GPU kernel functions for parallel processing. In addition, multiple random numbers can be generated in parallel to determine multiple target quantum data blocks. In addition, the precise location of the quantum ground state can be performed in parallel in multiple different quantum data blocks. In this way, by performing parallel computing and hardware acceleration adaptation between quantum data blocks, the efficiency of the quantum circuit simulation sampling method provided in the embodiments of this application is improved.
[0133] The following is an example of the sampling method of quantum circuit simulation provided by the embodiment of the present application. It is assumed that the number of quantum bits n of the quantum state vector M to be sampled is 3, and the quantum state vector M is [ 、 、0、0、0、0、 、 The traditional method for processing the quantum state vector M is as follows: in a single sampling process, the probability vector is first calculated. Then, according to the generated random number r=0.8, the probability vector is linearly accumulated. , the results are as follows: First time: S=0.25 (0.25<0.8, continue); Second time: S=0.25+0.25=0.5 (0.5<0.8, continue); Third time: S=0.5+0=0.5 (0.5<0.8, continue); Fourth time: S=0.5+0=0.5 (0.5<0.8, continue); Fifth time: S=0.5+0=0.5 (0.5<0.8, continue); Sixth time: S=0.5+0.25=0.75 (0.5<0.8, continue); Seventh time: S=0.75+0.25 (1.0>0.8, return to base state index 7). The result of this sampling process is (The base state index is 7). Storage requirements are: the quantum state vector M and the probability vector , the storage capacity is 2× The computational complexity of a single sampling is: O( ).
[0134] The sampling method for quantum circuit simulation provided in the embodiment of the present application processes the quantum state vector M as follows: Assume that the second preset number of quantum bits is 1, in a single sampling process, the quantum state vector M is first divided into 4 quantum data blocks (block number = = ), the number of amplitudes in each quantum data block is 2. The probability of quantum data block C0 is 0.5, the probability of quantum data block C1 is 0, the probability of quantum data block C2 is 0, and the probability of quantum data block C3 is 0.5. The first accumulation vector is determined to be [0.5, 0.5, 0.5, 1]. According to the generated first random number R1=0.7, the target quantum data block is determined to be quantum data block C3. Then, according to the amplitude (0.25, 0.25) in quantum data block C3, the block accumulation function vector is determined to be [0.5, 1], and according to the randomly generated second random number R2=0.8, the index within the block is determined to be 1. The final result of this sampling process is (The base state index is 3× +1=7). Storage requirements are: it is necessary to store the quantum state vector M and the block accumulation vector, and the storage capacity is + The computational complexity of a single sampling is: O( + In this way, through the strategy of "block dimensionality reduction - coarse and fine combination", the large-scale quantum state sampling problem is transformed into a multi-level small-scale problem, significantly reducing the storage and computational complexity.
[0135] In this manner, the computer device determines an intra-block index from the target quantum data block based on the acquired second random number and the block accumulator function vector. Next, the computer device determines a first base state index list based on the intra-block index. In this way, using the block accumulator function vector, combined with a preset algorithm, the base state position corresponding to the random number can be quickly located, thereby improving the sampling efficiency of large-scale quantum state vectors.
[0136] See also Figure 7 In certain embodiments, the method further comprises:
[0137] 014: When the number of quantum bits in the quantum state vector is less than or equal to the first preset number of quantum bits, determining a second accumulation function vector according to the quantum state vector;
[0138] 015: Determine a second base state index list according to the second accumulation function vector and the number of sampling times to complete the sampling of the quantum circuit simulation.
[0139] In certain embodiments, the determination module is further configured to determine a second accumulation function vector based on the quantum state vector when the number of qubits in the quantum state vector is less than or equal to a first predetermined number of qubits. Furthermore, the determination module is configured to determine a second base state index list based on the second accumulation function vector and the number of sampling times to complete sampling for quantum circuit simulation.
[0140] In certain embodiments, the processor is further configured to determine a second accumulation function vector based on the quantum state vector when the number of qubits in the quantum state vector is less than or equal to a first predetermined number of qubits, and to determine a second base state index list based on the second accumulation function vector and the number of sampling times to complete sampling for quantum circuit simulation.
[0141] Specifically, when the number of quantum bits n of the quantum state vector is less than or equal to the first preset number of quantum bits When the quantum state vector , determine the second accumulator function vector. Assume that the number of quantum bits n of the quantum state vector M to be sampled is 3, and the quantum state vector M is [ 、 、0、0、0、0、 、 ], if the first preset number of qubits =10, then the full sampling strategy will be adopted, that is, according to the quantum state vector M is [ 、 、0、0、0、0、 、 ] Directly construct the second accumulation function vector without further hierarchical processing.
[0142] Next, the computer device determines a second basis state index list according to the second accumulation function vector and the number of sampling times to complete the sampling of the quantum circuit simulation.
[0143] In this manner, when the number of qubits in the quantum state vector is less than or equal to the first predetermined number of qubits, the computer device determines a second accumulator function vector based on the quantum state vector. Next, the computer device determines a second base state index list based on the second accumulator function vector and the number of sampling times to complete sampling for the quantum circuit simulation. Thus, when the number of qubits in the quantum state vector is small, constructing and using the second accumulator function vector simplifies the sampling process. Furthermore, due to the monotonically increasing nature of the accumulator function vector, a preset algorithm can be used to quickly locate the base state position corresponding to the random number, thereby improving sampling efficiency.
[0144] See also Figure 8 In some embodiments, step 014 (determining a second accumulator function vector based on the quantum state vector) includes:
[0145] 0141: Calculate the sum of squared amplitudes of the quantum ground state in the quantum state vector and determine the third sum of squared amplitudes;
[0146] 0142: Normalize the third amplitude square sum to determine the second accumulation function vector.
[0147] In certain embodiments, the determination module is further configured to calculate the sum of squared amplitudes of the quantum ground state in the quantum state vector to determine a third sum of squared amplitudes, and to perform normalization processing on the third sum of squared amplitudes to determine a second accumulator function vector.
[0148] In certain embodiments, the processor is further configured to calculate the sum of squared amplitudes of the quantum ground state in the quantum state vector to determine a third sum of squared amplitudes, and to perform normalization processing on the third sum of squared amplitudes to determine a second accumulator function vector.
[0149] Specifically, the sum of the modulus squares of the quantum state amplitudes of each quantum basis state in the quantum state vector is calculated, which is recorded as (i.e. the sum of the second amplitude squares). Continuing with the above example, according to the quantum state vector M being [ 、 、0、0、0、0、 、 ], determine that the third sum of the squares of the amplitudes of the first quantum ground state M0 in the quantum state vector M is 0.25, the third sum of the squares of the amplitudes of the second quantum ground state M1 in the quantum state vector M is 0.25, the third sum of the squares of the amplitudes of the third quantum ground state M2 in the quantum state vector M is 0, the third sum of the squares of the amplitudes of the fourth quantum ground state M3 in the quantum state vector M is 0, the third sum of the squares of the amplitudes of the fifth quantum ground state M4 in the quantum state vector M is 0, the third sum of the squares of the amplitudes of the sixth quantum ground state M5 in the quantum state vector M is 0, the third sum of the squares of the amplitudes of the seventh quantum ground state M6 in the quantum state vector M is 0.25, and the third sum of the squares of the amplitudes of the eighth quantum ground state M7 in the quantum state vector M is 0.25.
[0150] Next, the sum of the squares of the second amplitudes of each quantum basis state in the quantum data block is normalized, that is, the sum of the squares of the second amplitudes of each quantum basis state in the quantum data block is divided by the sum of the squares of the second amplitudes of all quantum data blocks, and the normalized probability corresponding to each quantum basis state in the quantum data block C3 is determined. , = .
[0151] Finally, based on this normalized probability, the second cumulative function vector is constructed, namely = Continuing with the above example, the second accumulation function vector is determined to be [0.25, 0.5, 0, 0, 0, 0, 0.75, 1].
[0152] In this manner, the computer device calculates the sum of squared amplitudes of the quantum basis state in the quantum state vector to determine a third sum of squared amplitudes. The computer device then normalizes the third sum of squared amplitudes to determine a second accumulator function vector. By constructing the second accumulator function vector, the continuous probability distribution can be converted into monotonically increasing discrete probability values, thereby reducing sampling complexity in subsequent processing by utilizing the algorithmic properties of the preset algorithm.
[0153] See also Figure 9 In some embodiments, step 015 (determining a second basis state index list based on the second accumulation function vector and the number of sampling times) includes:
[0154] 0151: within the sampling number, based on a preset algorithm, determine a second basis state index according to the obtained third random number and the second accumulation function vector;
[0155] 0152: Determine a second base state index list according to the second base state index.
[0156] In some embodiments, the confirmation module is further configured to determine, within the sampling number, a second basis state index based on the obtained third random number and the second accumulation function vector based on a preset algorithm, and to determine a second basis state index list based on the second basis state index.
[0157] In some embodiments, the processor is further configured to determine, within the sampling number, a second basis state index based on the obtained third random number and the second accumulation function vector based on a preset algorithm, and to determine a second basis state index list based on the second basis state index.
[0158] Specifically, within the sampling times T, a third random number R3 is generated for each sampling point, and a preset algorithm is used to search the second accumulation function vector for a random number that satisfies <R3< The second basis state index i of .
[0159] Finally, the computer device determines a second base state index list according to the second base state index.
[0160] In this manner, within the sampling period, the second basis state index is determined based on the obtained third random number and the second accumulation function vector using a preset algorithm. Subsequently, the computer device determines a second basis state index list based on the second basis state index. Thus, using the preset algorithm and the second accumulation function vector, the computer device can quickly locate the second basis state index, thereby improving sampling efficiency.
[0161] See also Figure 10 In certain embodiments, the method further comprises:
[0162] 016: When the target measurement qubit is obtained, the target measurement state vector is determined according to the quantum state vector based on the preset bit operation algorithm;
[0163] 017: Determine the third accumulation function vector according to the target measurement state vector;
[0164] 018: Determine a third basis state index list according to the third accumulation function and the number of sampling times.
[0165] In certain embodiments, the determination module is further configured to, upon acquiring a target measurement qubit, determine a target measurement state vector based on the quantum state vector using a preset bitwise operation algorithm, determine a third accumulation function vector based on the target measurement state vector, and determine a third basis state index list based on the third accumulation function and the number of sampling times.
[0166] In certain embodiments, the processor is further configured to, upon acquiring a target measurement qubit, determine a target measurement state vector based on the quantum state vector based on a preset bitwise operation algorithm, determine a third accumulation function vector based on the target measurement state vector, and determine a third basis state index list based on the third accumulation function and the number of sampling times.
[0167] Specifically, a preset bit operation algorithm refers to an algorithm that extracts the target qubit state through a bit mask or bit operation. Based on the position of the target measured qubit (e.g., bits 2 and 4), a bit mask (e.g., binary mask 00010100) is designed to filter out the substate of the target bit from the binary representation of the original ground state, while ignoring other irrelevant qubits. For example, if the target bit is bit 1 (the lowest bit is bit 0), the mask is 0b10 (binary), and the target bit value (0 or 1) is extracted through the s&mask operation.
[0168] The target measurement state vector refers to the projection of the quantum state vector on the target bit subspace, which only retains the state information of the target bit. That is, for each target bit combination, the ground state amplitudes of all the target bit positions in the original state vector that are consistent with the target bit combination are summed to form a new vector , which is the target measurement state vector.
[0169] The third basis state index list refers to a prefix sum vector constructed based on the probability of the target measurement state vector, which is used to quickly locate the sampling index.
[0170] When the target measurement quantum bit is obtained, the system will perform analytical operations on the quantum state vector according to the pre-set bit operation rules to accurately calculate the target measurement state vector.
[0171] In this manner, upon acquiring the target measurement qubit, the computer device determines the target measurement state vector based on the quantum state vector based on a preset bitwise operation algorithm. Next, the computer device determines a third accumulation function vector based on the target measurement state vector. Finally, the computer device determines a third basis state index list based on the third accumulation function and the number of samplings. Thus, upon acquiring the target measurement qubit, the computer device can utilize the preset bitwise operation algorithm to determine the target measurement state vector based on the quantum state vector, and the target measurement state vector can be used to determine the third basis state index based on the third accumulation function vector, thereby efficiently determining the third basis state index, thereby improving the overall efficiency of quantum state vector sampling.
[0172] The following is an explanation of the sampling method for the quantum circuit simulation mentioned above. Figure 11 , Figure 11This is a flow chart of quantum circuit simulation sampling, which describes the complete process from input parameters to output sampling positions. The specific steps are as follows: First, input parameters, namely the input quantum state vector V, the number of sampling times T and the measurement quantum bit position M (optional). Then, construct the accumulation function vector, that is, calculate the probability (amplitude square) of each basis state in the quantum state vector and construct the accumulation function vector. If the number of quantum bits is greater than the set maximum number of single-layer quantum bits Q', the original quantum state vector is divided into The block (Q is the number of qubits in the quantum state vector) is summed by squared amplitudes within the block to generate an accumulator function vector. Subsequently, a random number is generated, namely, sampling is performed cyclically T times, each time generating a random number r between 0 and 1. Next, the ground state position is searched, namely, the ground state position to which the random number r belongs is searched in the accumulator function vector. Since the quantum state vector V is layered, the ground state block position and the corresponding original quantum state vector value are determined based on the ground state position. The amplitudes within the block are squared to generate a block accumulator function vector. Based on the generated new random number r′, the ground state position to which r′ belongs is searched in the block accumulator function vector to calculate the final ground state position. Next, a sampling set is generated, namely, a set of sampled ground state positions. Subsequently, the ground state is relocated. If the specified measurement bit M exists, the sampled ground state is relocated based on the measurement bit M. Finally, the result is output. If the specified measurement bit M exists, the sampling position of the relocated ground state is output; if the specified measurement bit M does not exist, the calculated ground state position is directly output. In this way, by determining the number of qubits, we choose single-layer or stratified sampling, use random numbers and the accumulation function vector to determine the ground state position, and ultimately output the sampling results based on the measurement requirements, ensuring the efficiency and accuracy of quantum circuit simulation sampling. The case of not performing stratified processing on the quantum state vector V has been explained above and will not be repeated here.
[0173] The present application also provides a computer-readable storage medium containing a computer program. When the computer program is executed by one or more processors, the one or more processors execute the method of the present application.
[0174] It is understood that a computer program includes computer program code. The computer program code may be in source code form, object code form, executable file, or some intermediate form. Computer-readable storage media may include any entity or device capable of carrying computer program code, recording media, USB flash drives, removable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), and software distribution media.
[0175] In the description of this specification, the descriptions with reference to the terms "particularly", "further", "particularly", "understandably", etc. are intended to mean that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present application. In this specification, the schematic expressions of the above terms are not intended to refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0176] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may be performed out of the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present application belong.
[0177] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A sampling method for quantum circuit simulation, characterized in that: The method comprises: Performing hierarchical processing on the quantum state vector to be sampled to determine a quantum data block, wherein the hierarchical processing is a disassembly process of converting a high-dimensional quantum state vector into multiple low-dimensional quantum state sub-vectors; Determine a first cumulative function vector according to the quantum data block, wherein the first cumulative function vector is a cumulative probability vector of a coarse positioning target quantum data block, and each element in the first cumulative function vector is a cumulative value of the sum of the squares of the moduli of all amplitudes in the corresponding quantum data block; A first base state index list is determined according to the first accumulation function vector and the acquired number of sampling times to complete the sampling of the quantum circuit simulation.
2. The method according to claim 1, characterized in that The step of performing hierarchical processing on the quantum state vector to be sampled to determine the quantum data block includes: When the number of quantum bits in the quantum state vector is greater than a first preset number of quantum bits, the quantum state vector is hierarchically processed to determine the quantum data block, wherein the number of the quantum data blocks is associated with a second preset number of quantum bits, and the second preset number of quantum bits is a predefined number of quantum bits in the quantum data block.
3. The method according to claim 1, characterized in that The step of determining a first accumulation function vector according to the quantum data block includes: performing a square amplitude calculation on the quantum data block to determine a first square amplitude sum; Normalization is performed on the first amplitude square sum to determine the first accumulation function vector.
4. The method according to claim 1, wherein Determining a first base state index list according to the first accumulator function vector and the acquired number of sampling times to complete the sampling of the quantum circuit simulation includes: Determining the target quantum data block within the sampling number, based on a preset algorithm, according to the obtained first random number and the first accumulation function vector; determining a block accumulator function vector according to the quantum basis state in the target quantum data block, wherein the block accumulator function vector is an accumulated probability vector constructed by performing a probability calculation on the quantum state amplitude in the target quantum data block after the quantum state vector is divided into the plurality of quantum data blocks in stratified sampling, and the block accumulator function vector is used to locate an intra-block index in the target quantum data block; A first base state index list is determined according to the first accumulation function vector and the block accumulation function vector to complete sampling of the quantum circuit simulation.
5. The method according to claim 4, characterized in that The determining of a block accumulation function vector according to the quantum basis state in the target quantum data block includes: performing a square sum of amplitude calculation on a quantum ground state in a target quantum data block to determine a second square sum of amplitude corresponding to the target quantum data block; Normalization is performed on the second amplitude square sum to determine the block accumulation function vector.
6. The method according to claim 4, characterized in that Determining a first basis state index list according to the first accumulation function vector and the block accumulation function vector to complete the sampling of the quantum circuit simulation includes: Based on the preset algorithm, determining an intra-block index from the target quantum data block according to the obtained second random number and the block accumulation function vector; The first base state index list is determined according to the intra-block index.
7. The method according to claim 2, characterized in that The method further comprises: When the number of quantum bits in the quantum state vector is less than or equal to the first preset number of quantum bits, determining a second accumulation function vector according to the quantum state vector; A second base state index list is determined according to the second accumulation function vector and the sampling times to complete the sampling of the quantum circuit simulation.
8. The method according to claim 7, characterized in that The determining of a second accumulator function vector according to the quantum state vector includes: performing a square sum of amplitude calculation on the quantum ground state in the quantum state vector to determine a third square sum of amplitude; Normalization is performed on the third amplitude square sum to determine the second accumulation function vector.
9. The method according to claim 7, characterized in that The determining of a second basis state index list according to the second accumulation function vector and the number of sampling times includes: Determining a second basis state index according to the obtained third random number and the second accumulation function vector based on a preset algorithm within the sampling number; Determine the second base state index list according to the second base state index.
10. The method according to claim 1, characterized in that The method further comprises: When a target measurement qubit is obtained, determining a target measurement state vector according to the quantum state vector based on a preset bit operation algorithm; Determining a third accumulator function vector according to the target measurement state vector; A third base state index list is determined according to the third accumulation function and the sampling number.
Citation Information
Patent Citations
Optimizing quantum computing circuit state partitions for simulation
US20240311668A1
Efficient training of a quantum sampler
WO2024056913A1