Quantum storage compression structure supporting online calculation
By using an online compression method based on the RepeatCounter structure, the problem of low efficiency of quantum computing simulators on memory-constrained devices is solved, enabling efficient simulation of larger-scale quantum computing on low-configuration devices, supporting parallel computing, and improving computational efficiency and compression rate.
Patent Information
- Application Number
- CN202610147974.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-03
- Publication Date
- 2026-05-15
AI Technical Summary
Existing quantum computing simulators are inefficient on memory-constrained personal computers and cannot effectively simulate larger-scale quantum circuits. Furthermore, the frequent compression and decompression of offline compression methods result in long computation times and frequent exchanges between internal and external memory, making it difficult to perform efficient simulations on low-configuration devices.
The RepeatCounter architecture, consisting of an input module, a compression module, a conversion module, a calculation module, and a decompression module, utilizes a cursor algorithm and a sliding window method to provide online compression, support parallel computing, reduce frequent compression and decompression, optimize storage space, and reduce redundant intermediate states and computation time.
It enables efficient simulation of large-scale quantum computing on low-configuration devices, reduces frequent internal and external memory swapping, improves computing efficiency and compression rate, supports parallel computing, and is suitable for lightweight devices for personal users.
Smart Images

Figure CN122047535A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of quantum computing and quantum compression technology, and in particular to RepeatCounter, a structure that supports efficient and parallel online computation quantum storage compression to accelerate computation and optimize storage. Background Technology
[0002] Currently, quantum computing has demonstrated its advantages in specific scenarios and applications, such as Shor's algorithm for integer factorization, Grover's algorithm for database searching, and advanced variable quantum circuits. Furthermore, several fields are considered potential targets for quantum computing optimization, including machine learning, materials science, chemistry, and cryptography. Quantum computing is a technology that manipulates qubits (qubits) based on the principles of quantum mechanics. The unique characteristic of qubits is that two or more qubits can be correlated, meaning that an operation on one qubit can affect the state of other qubits associated with it. Based on the superposition and entanglement properties of qubits, quantum computers can simultaneously compute multiple possible results, exhibiting far greater parallel information processing capabilities compared to classical computers.
[0003] Current quantum computer development is limited by the scarcity of publicly available quantum computing resources, which only support a small number of qubits, failing to meet researchers' needs. Therefore, the design of quantum algorithms largely relies on building and simulating quantum circuits on classical computers, which helps to better understand quantum behavior and verify quantum algorithms. The most mainstream quantum circuit simulation method is the Schrödinger-style full-state quantum circuit simulation, which calculates all operation matrices and updates the state vector at each time step. In full-state simulation, the simulation time complexity is polynomial rather than exponential as the quantum circuit depth increases, allowing it to accommodate deeper and larger quantum circuits. However, the memory usage of full-state simulation increases exponentially with the number of qubits. Therefore, current research on full-state quantum circuit simulation mainly focuses on improving its space utilization efficiency to simulate higher numbers of qubits. To overcome the memory capacity limitation, deploying quantum circuit simulators on supercomputers is considered an intuitive approach. Li et al. implemented this scheme on the Sunway TaihuLight supercomputer, which has nearly 1PB of memory, and simulated a 49-qubit quantum circuit with a depth of 39. However, the hardware and software platforms of supercomputers are not easily accessible to anyone, and deploying quantum circuit simulators on personal workstations is always limited by memory capacity and bandwidth.
[0004] While existing research has employed distributed clusters to simulate larger-scale quantum circuits, these hardware resources are not readily available. As the demand for easily accessible quantum algorithm development and teaching tools continues to grow, the development of simulators for individual users on lightweight devices becomes essential. Meanwhile, other research methods utilize data compression to achieve larger-scale in-memory simulations. Compressors are highly effective for certain quantum algorithms that generate regular data, but not all quantum algorithms produce data with regularity. Currently, offline compression is the mainstream approach, with BDD compression being the most advanced, followed by a method using decision graphs to represent state vectors. This method recursively decomposes the state vector into two sub-vectors: the first half includes the amplitude when the current qubit is |0>, and the second half includes the amplitude when the current qubit is |1>. In the decision graph, the qubit is represented as a node, and two outgoing edges point to the decomposed sub-vectors until the sub-vector has a size of 1. Finally, the outgoing edges point to a terminal node, which stores the amplitude value of the ground state. During the decomposition process, identical subvectors can be represented by identical nodes, thus reducing representation complexity through redundancy. However, BDD compression in quantum computing is offline; each computation requires decompression and the generation of a new compressed value. This means it cannot be entirely stored in memory and must be broken down into blocks for frequent external storage reads. Furthermore, the extensive decompression and compression significantly impacts computational efficiency. Another issue with compressors designed for redundant structures is that the compression ratio drops significantly when the data volume is small. Since quantum computing is inherently suited for parallel computation, the block partitioning of such data also affects the compression ratio, making it difficult to strike a balance between compression ratio and operational efficiency.
[0005] In summary, existing offline compression technologies require frequent compression and decompression, as well as frequent exchanges between internal and external memory, resulting in redundant intermediate states and long computation times. Consequently, the compression efficiency and compression rate of quantum computing simulations are poor, making it impossible to better simulate large-scale quantum computing on low-configuration machines. Summary of the Invention
[0006] The purpose of this invention is to provide a quantum storage compression structure that supports online computation, addressing the shortcomings of existing technologies. It employs a compression structure called RepeatCounter, composed of an online processing linked list consisting of an input module, a compression module, a conversion module, a computation module, and an output module. This parallel online compressor utilizes a cursor algorithm and a sliding window method to provide a fully online computation compression form, optimizing storage space, reducing computational overhead, and providing efficient parallel support. Quantum computation can be performed entirely online without frequent compression and decompression, while also reducing the frequent internal and external memory swapping caused by offline compression. It also strongly supports parallel decomposition with minimal impact on structure and computational complexity. For specific quantum circuit structures, it supports abstraction into functional modules, significantly reducing intermediate redundant states and computation time. Ultimately, this enables better simulation of larger-scale quantum computations on lower-configuration machines. It effectively solves the problem of poor compression efficiency and compression rate in quantum computing simulations under memory constraints, providing better parallel support for individual users to develop simulators on lightweight devices with less space, faster computational efficiency, and better parallelism, demonstrating promising application prospects and commercial development value.
[0007] The specific technical solution to achieve the purpose of this invention is: a quantum storage compression structure supporting online computation, characterized in that the quantum storage compression structure consists of an input module, a compression module, a conversion module, a computation module, and a decompression module. It employs a cursor algorithm and a sliding window approach to provide a fully online computation compression format. The input module receives the user's initial state vector and the quantum circuit input; the compression module accepts state vectors or qubits, converts the state vectors into linked list storage using cursor compression, and identifies frequently occurring periodic data in quantum computing, further compressing and storing the periodic data within a preset processing range; the conversion module converts the input quantum circuit into a form that can be processed by RepeatCounter; the computation module is responsible for simulating various computational methods used in quantum computing; and the decompression module decompresses the data in the output stream or memory as needed.
[0008] The input module includes the following functions:
[0009] 1) After a new RepeatCounter class is generated, a complete quantum algorithm calculation is performed by accepting user input;
[0010] 2) The initial state vector can support array-based state vector input and line input in the form of (gate, target position) pairs;
[0011] The compression module includes the following functions:
[0012] 1) The compression module uses a cursor algorithm to collect redundant information in the initial data, establishes it as a linked list, and finds nodes with continuous periodicity by setting the upper limit of the sliding window, and establishes new nodes to replace them.
[0013] The conversion module includes the following functions:
[0014] 1) Accept and analyze the input quantum circuit.
[0015] For quantum gates that can form known functions (e.g., applying a quantum H gate to all bits of an all-zero quantum bit is equivalent to averaging its state vector), the conversion module can extract features and accelerate the calculation in subsequent calculations by calling the function calculation module, and supports users to directly input function blocks; for quantum gates that are not pre-set or cannot form specific functions, the conversion module will complete the calculation in the form of mathematical calculations in sequence.
[0016] The calculation module includes the following sub-modules:
[0017] 1) Parallel Computing Submodule: State vector simulation of quantum computing is naturally suited for parallel computing because two elements at a certain distance will not affect each other. Therefore, simply selecting a bit larger than the target bit of the quantum gate for partitioning will not affect the computation process. Furthermore, since the compression ratio of the compressed structure depends only on adjacent elements, the impact on the spatial compression ratio of the compressed structure is limited. When the target bit of the quantum gate is received, the parallel computing module selects an appropriate number of blocks for parallel computation and merges the results after the computation is completed.
[0018] 2) Position Calculation Submodule: Performs the conversion of position coordinates between the state vector space and the RepeatCounter space.
[0019] 3) Mathematical computation module: Implementing a quantum gate on a qubit at position x is equivalent to performing a quantum gate on all intervals of the state vector. Matrix operations are performed on element pairs. This compressed structure supports this form of computation without decompression, and benefits from the fact that adjacent identical elements only need to be operated on once, greatly reducing computation time. Continuously merging executed linked list blocks during execution ensures controllable length. Furthermore, by conditionally judging possible situations, the additional time loss from recursion is greatly reduced, especially when the target is a low number of qubits; batch processing significantly improves computation speed. For example, the case of a single-qubit gate might be as follows:
[0020] a) When a linked list contains data from its nearest neighbors If there are multiple values to be calculated, then all of them will be processed at once.
[0021] b. When the length of a linked list is between and In between, you can leave only the middle section empty and process the front and back sections in batches;
[0022] c. When the length of a linked list is less than Two pointers can be used to find the corresponding data block in this linked list and perform calculations on both blocks simultaneously. Furthermore, if the search continues... If the bit is greater than 1, then before subsequent operations reach the aforementioned later data block, there will no longer be any bits greater than 1. In this case, where the two pointers only need to search once, it can still guarantee that... Within the actual length, only the data of the later segment needs to be searched once, ensuring that the computational complexity is only positively correlated with the length of the linked list.
[0023] 4) Functional Computation Module: Just as high-level programming languages are used instead of assembly language, high-level languages can encapsulate multiple instructions into a single function instead of frequently manipulating simple AND / OR gates and registers. Similarly, in quantum computing, consecutive quantum gates may perform predictable computations. For example, applying an H-gate to each bit of an initially all-zero qubit is equivalent to transforming the initial state vector into a uniform state vector. In this case, the result can be obtained directly instead of performing quantum computations on each gate individually, significantly reducing time and space efficiency. Another example is the target flipping in Grover's algorithm, where the functional computation module can completely reduce the complexity to O(len(link)) and eliminate potential storage spikes caused by intermediate computations. Functional modules can be added later as needed, and as quantum algorithms expand, they can be fully extended to adapt to different algorithms.
[0024] The decompression module includes the following functions:
[0025] 1) When you need to see the results but do not want to destroy the compressed structure, due to memory constraints, you cannot directly decompress to obtain the state vector unless you destroy RepeatCounter. In this case, you can decompress and output to the stream as needed for consumption, which reduces the efficiency consumption of compression and decompression.
[0026] 2) After the calculation is completed, decompress and destroy RepeatCounter to obtain the final calculation result. Since RepeatCounter and decompressed state vector cannot exist at the same time, RepeatCounter can be destroyed node by node while decompressing.
[0027] Compared with the prior art, the present invention has the following beneficial technical effects and significant technical progress:
[0028] 1) The proposed compression structure enables quantum computing to be performed entirely online without frequent compression and decompression. It also reduces the frequent internal and external memory swapping caused by offline compression and supports efficient parallel decomposition with virtually no impact on the structure and computational complexity.
[0029] 2) For specific quantum circuit structures, it supports abstracting them into functional modules, which significantly reduces redundant intermediate states and computation time. Because the Grover algorithm can be implemented entirely by functional computation gates, it can be used to implement Grover's algorithm for infinitely large qubits.
[0030] 3) Running random quantum circuits on a virtual machine with 8GB of memory, a comparison of RepeatCounter with tensor product simulation and State Vector Simulation shows that RepeatCounter has a significant improvement in both time and space performance on limited devices.
[0031] 4) This invention enables better simulation of large-scale quantum computing on machines with lower configurations, and has good application prospects. Attached Figure Description
[0032] Figure 1 This is a schematic diagram of the structure of the present invention;
[0033] Figure 2 This is a circuit diagram illustrating Example 1.
[0034] Figure 3 This is an example diagram illustrating the advantages of the functional gates in Embodiment 1;
[0035] Figure 4 This is an example diagram of the mathematical calculation process in Example 1;
[0036] Figure 5 The diagram shows three examples of single-qubit gates in Example 1. Detailed Implementation
[0037] The following example uses a 20-qubit quantum bit. Specific embodiments will be described in further detail below.
[0038] Example 1
[0039] See Figure 1 A quantum storage compression structure that supports online computation includes: an input module, a compression module, a conversion module, a computation module, and a decompression module.
[0040] See Figure 2This embodiment uses the quantum circuit shown in the figure to demonstrate the operation of a 20-bit quantum circuit, further introducing the various modules of RepeatCounter. Taking the input state vector and quantum circuit as an example (in the form of an array of state vectors), other necessary settings are also input (parallel calculation is performed by 4 threads simultaneously).
[0041] 1) Input Module: Receives the initial quantum state vector and quantum circuit. The input must be in a recognized, valid form, which the input module will prepare for subsequent processing.
[0042] 2) Compression Module: Based on the received initial quantum state vector, it begins processing and compressing the state vector. The state vector is The cursor algorithm (which adapts consecutive identical quantities into value-quantity pairs) calculates as follows: and The data is stored as a linked list. No compressible consecutive repeating value-count pairs were found during subsequent periodic identification; therefore, the current linked list node is retained.
[0043] 3) Conversion Module: First, considering the first layer's full H-gates and initial ground state, it can be determined that the function of the first layer gates is "average initial state vector," so it is converted to a "uniform vector" function instead of storing the 20 H-gates that need to be calculated. In the second... The X-gate and the third one targeting The phase gate H has no matching function, so it is converted into computation gate X and computation gate H, and all gates are loaded into the computation queue.
[0044] 4) Calculation Module: Completes the calculation of the result. First, the parallel calculation module sets the number of parallel threads according to the user's needs. For example, if the user inputs 4 parallel threads, the subsequent calculation gate will first divide the linked list into four segments, and then hand them over to different programs for calculation. When dividing into four segments, the position calculation module is called to divide all state vectors into four segments on an average basis.
[0045] Since for the example quantum circuit, all the gates (all H gates) that are loaded into the computation queue in the first layer are combined into a "uniform vector" function gate, and a batch processing method is directly adopted.
[0046] See Figure 3 Directly based on mathematical formulas This allows you to obtain the values of all elements and directly process the linked list.
[0047] The second gate is computation gate X, and it is processed in parallel using four threads. Because it is for... The computation gate X does not involve inter-block computation after partitioning; the four blocks can be merged after the intra-block computation is completed.
[0048] See Figure 4 The calculation process within the block is equivalent to finding two elements with a stride interval based on the step size, calculating the AND gate matrix, and performing multiplication. The calculation result is then returned to the original position.
[0049] Since all elements have the same value, the X gate will produce the same result for identical elements, and the block length will be double the step size. If the value is a multiple of 131.07, then the entire block of values can be calculated at once to obtain the result, compared to the traditional SVSim's 131.07. The number of operations has been greatly reduced.
[0050] Finally, when processing the computation gate H, since the same value processed by the H gate will become different values, it is necessary to calculate step by step.
[0051] See Figure 5 The RepeatCounter structure allows for batch processing of elements based on the number of elements in a node. In the calculation of the H gate in this example, one step is... This is also far greater than the traditional SVSim, which can only process one element at a time.
[0052] Furthermore, because the linked list merges identical nodes while performing calculations, the result will at most have two more nodes than the final calculation (eight more nodes for four threads), which will not affect the memory usage and ensures the smooth execution of the calculation. And for... After the H-gate is calculated, the state vector will exhibit a periodic pattern: 0.022097 and A zero-crossing loop. When two adjacent zeros are found during the calculation... and When, it will be compressed to Ultimately, it will be compressed into a single linked list node. .
[0053] 5) Output Module (Decompression Module): This module can monitor intermediate or final results. If you want to view the result at any computation gate, you can retrieve linked list nodes one by one and write them to a file or display them elsewhere in a streaming format. After the calculation is complete, you can choose to destroy RepeatCounter while storing the result in memory for later use.
[0054] The efficiency comparison of this invention with RepeatCounter, tensor product simulation, and State Vector Simulation is detailed in Table 1 below, showing the efficiency comparison results of the three methods:
[0055] Table 1. Efficiency comparison results of the present invention and three other methods.
[0056]
[0057] As shown in Table 1 above, RepeatCounter offers significant improvements in both time and space performance on limited devices. This ultimately enables better simulation of larger-scale quantum computing on lower-configuration machines.
[0058] The above is merely a further description of the present invention and is not intended to limit the scope of this patent. Any equivalent implementation of the present invention should be included within the scope of the claims of this patent.
Claims
1. A quantum storage compression structure supporting online computation, characterized in that, The following are included: An input module, a compression module, a conversion module, a calculation module, and a decompression module constitute an online quantum storage compression structure to accelerate computation and optimize storage. The input module converts the user's required initial state vector and quantum circuit input into a recognized valid form. The compression module accepts state vector form or qubit form, converts the state vector into linked list storage through cursor compression, and identifies periodic data that frequently occurs in quantum computing, compressing and transferring the periodic data within a preset processing range. The conversion module includes state vector conversion and quantum gate conversion, which converts the input quantum circuit into a form that can be processed by RepeatCounter. The computation module is a simulated quantum computation module including a parallel computation submodule, a position computation submodule, a mathematical computation submodule, and a functional computation submodule. The decompression module includes: displaying intermediate states in the stream and decompressing and destroying them. The output module decompresses the data in the output stream or memory as needed, and can decompress and output the data to the stream for consumption as needed. When memory is limited, RepeatCounter is decompressed and destroyed.
2. The quantum storage compression structure supporting online computation according to claim 1, characterized in that, After the input module generates a new RepeatCounter class, it performs a complete quantum algorithm calculation by accepting user input. For the initial state vector, it supports array-based state vector input and line input in the form of gate / target position pairs.
3. The quantum storage compression structure supporting online computation according to claim 1, characterized in that, The compression module uses a cursor algorithm to collect redundant information in the initial data, establishes it as a linked list, and then searches for nodes with continuous periodic properties by using a set upper limit value for the sliding window.
4. The quantum storage compression structure supporting online computation according to claim 1, characterized in that, The conversion module accepts and parses the input quantum circuits. For quantum gates that form known functions, the conversion module extracts features and accelerates the calculation by calling the function calculation module in subsequent calculations. It also supports users to directly input function blocks. For quantum gates that are not pre-set or cannot form specific functions, the conversion module will complete the calculation in the form of mathematical calculations in sequence. The conversion module pushes all the above calculation gates into the calculation queue in sequence to wait for the calculation module to process.
5. The quantum storage compression structure supporting online computation according to claim 1, characterized in that, The parallel computing submodule divides RepeatCounter into blocks and performs parallel computation using quantum computing, then merges the results after completion. The position calculation submodule establishes a mapping between linked list distances and absolute distances, transforming the position coordinates between the state vector space and the RepeatCounter space. The mathematical calculation submodule directly calculates according to the mathematical form of quantum computing. Implementing a quantum gate on the qubit at position x is equivalent to performing quantum gates on all intervals of the state vector. The element pairs are subjected to matrix operations; the functional calculation submodule directly processes quantum gates in batches according to the original functional meaning of a series of quantum gates.
6. The quantum storage compression structure supporting online computation according to claim 1, characterized in that, When memory is limited, the decompression module can decompress and output to the stream for consumption as needed, thereby reducing the efficiency consumption of compression / decompression. After the calculation is completed, the RepeatCounter is decompressed and destroyed to obtain the final calculation result. The decompression and destruction is performed in a way that destroys RepeatRepeatCounter node by node while decompressing.