Optimization method of Shor's algorithm based on data stream grouping linear transformation

By optimizing the quantum circuit of Shor's algorithm and utilizing linear transformation of data stream groups, the hardware limitations of quantum computers are reduced, the high-complexity prime factor decomposition problem is solved, and the calculation accuracy and reliability are improved.

CN120373488BActive Publication Date: 2025-09-12中电信量子信息科技集团有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510862167.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-25
Publication Date
2025-09-12
Estimated Expiration
2045-06-25

AI Technical Summary

Technical Problem

Current quantum computers find it difficult to effectively solve the highly complex prime factorization problem. Due to factors such as the limited number of quantum bits, short coherence time, and high gate operation error rate, the calculation results of the Shor algorithm are prone to errors in practical applications.

Method used

Through the Shor algorithm optimization method based on data stream grouping linear transformation, the initial quantum circuit, quantum basis vector data stream and target quantum basis vector group are determined, and the target quantum gate is used to replace complex operations to reduce the quantum circuit complexity of the Shor algorithm modular exponential operation.

Benefits of technology

The quantum circuit complexity of Shor's algorithm is reduced to adapt it to the hardware limitations of current quantum computers, thereby improving calculation accuracy and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120373488B_ABST
    Figure CN120373488B_ABST
Patent Text Reader

Abstract

This application discloses an optimization method for the Shor algorithm based on linear transformation of data stream groups. The method includes: determining an initial quantum circuit based on the target problem to be processed based on the Shor algorithm. Then, calculating the initial basis vectors of the initial quantum circuit based on the modular exponential operator in the initial quantum circuit to determine the quantum basis vector data stream. Then, based on the quantum basis vector data stream, determining the target quantum basis vector group. Finally, determining the target quantum circuit based on the target quantum basis vector group and the target quantum gate to optimize the Shor algorithm. In this way, by analyzing the evolution of the basis vectors of the initial quantum circuit, determining the quantum basis vector data stream, and obtaining the target quantum basis vector group from the quantum basis vector data stream, and then replacing complex operations with target quantum gates, the quantum circuit complexity of the modular exponential operation of the Shor algorithm is reduced, making it compatible with the hardware limitations of current quantum computers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of quantum computing, and more specifically, to an optimization method for Shor's algorithm based on linear transformation of data stream groups. Background Art

[0002] Based on the unique physical properties of qubits, such as quantum superposition and quantum entanglement, quantum computing demonstrates significant theoretical advantages over classical computing paradigms when solving certain complex problems. In related technologies, the Shor algorithm uses quantum computing to transform prime factorization into a periodic detection problem, using quantum Fourier transforms to exponentially accelerate the periodic solution. However, due to the performance limitations of current quantum computers, it is often difficult to use the Shor algorithm to solve complex prime factorization problems. Summary of the Invention

[0003] The present application provides an optimization method for Shor's algorithm based on linear transformation of data stream groups.

[0004] The present application provides an optimization method for Shor's algorithm based on linear transformation of data stream groups, the method comprising:

[0005] Based on the Shor algorithm, an initial quantum circuit is determined according to the target problem to be processed;

[0006] calculating an initial basis vector of the initial quantum circuit according to a modular exponential operator in the initial quantum circuit to determine a quantum basis vector data stream;

[0007] determining a target quantum basis vector group according to the quantum basis vector data stream;

[0008] According to the target quantum basis vector group and the target quantum gate, a target quantum circuit is determined to optimize the Shor algorithm.

[0009] In this way, based on the Shor algorithm, the computer device determines an initial quantum circuit based on the target problem to be solved. Next, the computer device calculates the initial basis vectors of the initial quantum circuit based on the modular exponential operator in the initial quantum circuit, determining the quantum basis vector data stream. Then, based on the quantum basis vector data stream, the computer device determines the target quantum basis vector group. Finally, based on the target quantum basis vector group and the target quantum gate, the computer device determines the target quantum circuit to optimize the Shor algorithm. In this way, by analyzing the evolution of the basis vectors of the initial quantum circuit, the quantum basis vector data stream is determined, and the target quantum basis vector group is obtained from the quantum basis vector data stream. The complex operations in the target quantum basis vector group are then replaced with the target quantum gate, reducing the quantum circuit complexity of the modular exponential operation of the Shor algorithm and adapting it to the hardware limitations of current quantum computers.

[0010] In certain embodiments, determining an initial quantum circuit based on the Shor algorithm and a target problem to be processed includes:

[0011] Based on the Shor algorithm and the target problem, determining a basis, where the basis is coprime to the integer to be decomposed in the target problem and is smaller than the integer to be decomposed;

[0012] Determining the number of phase qubits according to the target problem, wherein the number of phase qubits is used to record phase information generated by running the Shor algorithm;

[0013] Determining the number of operation qubits according to the target problem, where the number of operation qubits is used to record quantum state information generated by running the modular exponential operator;

[0014] The initial quantum circuit is determined according to the basis, the number of phase quantum bits, and the number of operation quantum bits.

[0015] In this way, the computer determines a basis based on the target problem. The basis is coprime to the integer to be factored in the target problem and is smaller than the integer to be factored. Next, the computer determines the number of phase qubits based on the target problem. These phase qubits are used to record the phase information generated by running the Shor algorithm. Furthermore, the computer determines the number of operation qubits based on the target problem. These operation qubits are used to record the quantum state information generated by running the modular exponential operator. Finally, the computer determines the initial quantum circuit based on the basis, the number of phase qubits, and the number of operation qubits. In this way, a quantized mapping of the Shor algorithm is achieved through parameterized design, ensuring mathematical correctness while keeping resource consumption within the quantum computer's capacity and laying the foundation for subsequent optimization.

[0016] In some embodiments, determining the initial quantum circuit based on the basis, the number of phase qubits, and the number of operation qubits includes:

[0017] Determining the modular exponential operator according to the basis, the number of phase qubits, and the integer to be decomposed;

[0018] The initial quantum circuit is determined according to the basis, the number of phase quantum bits, the number of operation quantum bits, and the modular exponential operator.

[0019] In this way, the computer determines the modular exponential operator based on the basis, the number of phase qubits, and the integer to be factored. Next, the computer determines the initial quantum circuit based on the basis, the number of phase qubits, the number of operation qubits, and the modular exponential operator. This rigorous number-theoretic transformation ensures that the initial quantum circuit mathematically correctly maps to the theoretical framework of Shor's algorithm, avoiding decomposition anomalies caused by incorrect parameters.

[0020] In certain embodiments, the method further comprises:

[0021] Determining the temporary quantum circuit according to the basis, the number of phase qubits, the number of operation qubits, and the modular exponential operator;

[0022] According to the commutativity of the modular exponential operator in the temporary quantum circuit, the operation order of the modular exponential operator is adjusted to determine the initial quantum circuit.

[0023] In this way, the computer device determines a temporary quantum circuit based on the basis, the number of phase qubits, the number of operation qubits, and the modular exponentiation operator. Next, the computer device adjusts the order of modular exponentiation operations based on the commutativity of the modular exponentiation operator in the temporary quantum circuit to determine the initial quantum circuit. By leveraging the commutativity of the modular exponentiation operator and adjusting the order of modular exponentiation operations, the subsequently determined quantum basis vector groups can be executed serially according to the quantum basis vector data stream order, reducing the number of parallel quantum gate operations.

[0024] In certain embodiments, calculating the initial basis vectors of the initial quantum circuit according to the modular exponential operator in the initial quantum circuit to determine the quantum basis vector data stream includes:

[0025] Calculating the initial basis vector according to the modular exponential operator to determine a first basis vector of the current stage;

[0026] Calculating the first basis vector according to the modular exponential operator to determine a second basis vector for the next stage;

[0027] The quantum basis vector data stream is determined according to the first basis vector and the second basis vector.

[0028] In this way, the computer device calculates the initial basis vectors using the modular exponential operator to determine the first basis vector for the current stage. Next, the computer device calculates the first basis vector using the modular exponential operator to determine the second basis vector for the next stage. Finally, the computer device determines the quantum basis vector data stream based on the first and second basis vectors. This stage-by-stage evolution of the basis vectors allows for intuitive analysis of the evolutionary path of the modular exponential operation, facilitating subsequent optimization of the quantum circuit.

[0029] In some embodiments, determining a target quantum basis vector group based on the quantum basis vector data stream includes:

[0030] Identifying the quantum basis vector data stream based on a preset identification rule to determine whether a linear relationship exists in the quantum basis vector data stream;

[0031] Determining, from the quantum basis vector data stream, a first sub-vector group and a second sub-vector group according to whether the linear relationship exists, wherein the first sub-vector group is used to indicate a linear quantum basis vector group that can be mapped through a linear transformation, and the second sub-vector group is used to indicate a nonlinear quantum basis vector group that cannot be mapped through a linear transformation;

[0032] The target quantum basis vector group is determined according to the first sub-vector group.

[0033] In this way, based on preset identification rules, the computer device identifies the quantum basis vector data stream and determines whether linear relationships exist within the quantum basis vector data stream. Next, based on the presence of linear relationships, the computer device determines a first sub-vector group and a second sub-vector group from the quantum basis vector data stream. The first sub-vector group indicates a linear quantum basis vector group that can be mapped via linear transformation, while the second sub-vector group indicates a nonlinear quantum basis vector group that cannot be mapped via linear transformation. Finally, the computer device determines a target quantum basis vector group based on the first sub-vector group. In this way, through linear relationship identification and group isolation, the complexity of modular exponential operations is reduced, thereby breaking through the hardware performance limitations of current quantum computers.

[0034] In some embodiments, determining the target quantum basis vector group based on the first sub-vector group includes:

[0035] The target quantum basis vector group is determined according to the periodicity of the first sub-vector group.

[0036] In this way, the computer device determines the target quantum basis vector group based on the periodicity of the first sub-vector group. This transforms the modular exponential operation from a successive high-complexity multiplication into a cyclic linear transformation, and only needs to process the quantum basis vectors within a period, reducing the complexity of the quantum circuit.

[0037] In certain embodiments, the method further comprises:

[0038] The target quantum basis vector group is determined according to the auxiliary quantum bits and the second sub-vector group.

[0039] In this way, the computer device determines the target quantum basis vector group based on the auxiliary qubit and the second sub-vector group. This way, the auxiliary bit transforms the nonlinear problem into a hybrid process of linear operations and conditional control, allowing the quantum basis vectors of the second sub-vector group to be mapped to the target basis vector group.

[0040] In some embodiments, determining the target quantum basis vector group based on the auxiliary quantum bit and the second sub-vector group includes:

[0041] Determining the number of auxiliary quantum bits according to the second sub-vector group;

[0042] The second sub-vector group is split according to the auxiliary quantum bits and the number of bits to determine the target quantum basis vector group.

[0043] In this way, the computer device determines the number of auxiliary qubits based on the second sub-vector group. Next, the computer device splits the second sub-vector group based on the auxiliary qubits and the number of bits to determine the target quantum basis vector group. This dynamic determination of the number of auxiliary bits and the splitting of the second sub-vector group enables efficient processing of the second sub-vector group, which ultimately forms the target quantum basis vector group together with the first sub-vector group for subsequent quantum circuit optimization.

[0044] In some embodiments, determining a target quantum circuit according to the target quantum basis vector group and the target quantum gate includes:

[0045] The modular exponential operator in the target quantum basis vector group is replaced with the target quantum gate to determine the target quantum circuit.

[0046] In this way, the computer device replaces the modular exponential operator in the target quantum basis vector group with the target quantum gate and determines the target quantum circuit. In this way, by replacing the modular exponential operator in the target quantum basis vector group with the target quantum gate, the theoretical logic of the Shor algorithm is converted into a hardware-executable gate sequence, thus achieving the optimization of the Shor algorithm.

[0047] 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

[0048] 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:

[0049] Figure 1 This is one of the flow charts of the optimization method of the Shor algorithm in the embodiment of the present application;

[0050] Figure 2 is a schematic diagram of a controlled switching gate according to an embodiment of the present application;

[0051] Figure 3 This is one of the quantum circuit diagrams of the Shor algorithm according to the embodiment of the present application;

[0052] Figure 4 This is a schematic diagram of the initial quantum circuit of the embodiment of the present application;

[0053] Figure 5 This is the second flow chart of the optimization method of the Shor algorithm in the embodiment of the present application;

[0054] Figure 6 This is the third flow chart of the optimization method of the Shor algorithm in the embodiment of the present application;

[0055] Figure 7 This is the fourth flow chart of the optimization method of the Shor algorithm in the embodiment of the present application;

[0056] Figure 8 This is the second quantum circuit diagram of the Shor algorithm in the embodiment of the present application;

[0057] Figure 9 This is the fifth flow chart of the optimization method of the Shor algorithm according to the embodiment of the present application;

[0058] Figure 10 This is one of the schematic diagrams of the quantum circuit that realizes the modular exponential operation function in the embodiment of the present application;

[0059] Figure 11 This is the second schematic diagram of a quantum circuit for realizing modular exponential operation according to an embodiment of the present application;

[0060] Figure 12 This is the third schematic diagram of a quantum circuit for realizing modular exponential operation according to an embodiment of the present application;

[0061] Figure 13 This is the fourth schematic diagram of a quantum circuit for realizing modular exponential operation according to an embodiment of the present application;

[0062] Figure 14 This is the sixth flow chart of the optimization method of the Shor algorithm in the embodiment of the present application;

[0063] Figure 15 This is the seventh flow chart of the optimization method of the Shor algorithm according to the embodiment of the present application;

[0064] Figure 16 This is the eighth flow chart of the optimization method of the Shor algorithm according to the embodiment of the present application;

[0065] Figure 17 This is a ninth flow chart of the optimization method of the Shor algorithm according to the embodiment of the present application;

[0066] Figure 18 This is a schematic diagram of auxiliary bit introduction in an embodiment of the present application;

[0067] Figure 19 This is the tenth flow chart of the optimization method of the Shor algorithm in the implementation mode of the present application. DETAILED DESCRIPTION

[0068] 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.

[0069] 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 Quantum computing can process arbitrary superpositions of qubits, while entanglement between multiple qubits can form high-dimensional correlated states, giving quantum computing a natural ability to process information in parallel. In classical computing, many complex problems, such as prime factorization of large integers, have computational complexity that increases exponentially with the value, making it difficult for classical computers to solve them within a reasonable time. However, quantum computing, with its unique physical properties, demonstrates great potential in solving prime factorization problems.

[0070] Among related technologies, Shor's algorithm, as an important achievement in the field of quantum computing, is of milestone significance. It cleverly transforms the prime factorization problem, which is extremely challenging in classical computing, into a periodicity detection problem. Specifically, for a given integer N to be factored, Shor's algorithm first randomly selects an integer a that is relatively prime to N, and then solves the function through quantum computing. Once the period r is found, we can use number theory to efficiently factorize N.

[0071] The inverse quantum Fourier transform (IQFT) plays a key role in this process, exponentially accelerating the cyclical solution process. Classical algorithms often require traversing a large number of possible values, resulting in extremely high time complexity. However, the quantum Fourier transform, leveraging the properties of quantum superposition and entanglement, can simultaneously process large amounts of information at the quantum state level, significantly reducing computational time.

[0072] However, despite its significant theoretical advantages, Shor's algorithm faces numerous challenges in practical application due to the limited performance of current quantum computers. It is often difficult to use it to solve complex prime factorization problems. Current quantum computers, particularly noisy intermediate-scale quantum (NISQ) devices, suffer from a limited number of qubits, short coherence times, and high gate operation error rates. These factors make it difficult for quantum computers to accurately maintain the superposition and entanglement properties of quantum states when running Shor's algorithm, making them susceptible to noise interference and resulting in erroneous calculation results.

[0073] For example, the Shor algorithm requires a large number of qubits to construct the phase register and operation register for high-precision period detection. When faced with complex prime factorization problems, the number of qubits required increases dramatically, but current quantum computers fall far short of this requirement. Furthermore, entanglement operations between qubits require extremely high precision, and any slight error can be amplified during the calculation, leading to a failure in the final result.

[0074] Based on the above questions, please refer to Figure 1 , the embodiment of the present application provides an optimization method of Shor's algorithm based on linear transformation of data stream groups, the method comprising:

[0075] 01: Based on the Shor algorithm, determine the initial quantum circuit according to the target problem to be solved;

[0076] 02: Based on the modular exponential operator in the initial quantum circuit, the initial basis vector of the initial quantum circuit is calculated to determine the quantum basis vector data flow;

[0077] 03: Determine the target quantum basis vector group based on the quantum basis vector data stream;

[0078] 04: Determine the target quantum circuit based on the target quantum basis vector group and target quantum gate to optimize the Shor algorithm.

[0079] The present application also provides a computer device comprising a memory and a processor. The optimization method for the Shor algorithm based on linear transformation of data stream groups according to the present application can be implemented by the computer device according to the present application. Specifically, the memory stores a computer program, and the processor is configured to determine an initial quantum circuit based on the target problem to be processed, based on the Shor algorithm. Furthermore, the processor is configured to calculate the initial basis vectors of the initial quantum circuit based on the modular exponential operator in the initial quantum circuit to determine a quantum basis vector data stream. Furthermore, the processor is configured to determine a target quantum basis vector group based on the quantum basis vector data stream. Furthermore, the processor is configured to determine a target quantum circuit based on the target quantum basis vector group and a target quantum gate, thereby optimizing the Shor algorithm.

[0080] The embodiments of the present application also provide a quantum circuit optimization device. The optimization method for the Shor algorithm based on linear transformation of data stream groups in the embodiments of the present application can be implemented by the quantum circuit optimization device of the embodiments of the present application. Specifically, the quantum circuit simulation device includes a determination module. The determination module is used to determine an initial quantum circuit based on the target problem to be processed based on the Shor algorithm. The module also calculates the initial basis vectors of the initial quantum circuit based on the modular exponential operator in the initial quantum circuit to determine the quantum basis vector data stream. The determination module is also used to determine a target quantum basis vector group based on the quantum basis vector data stream. The module also determines a target quantum circuit based on the target quantum basis vector group and the target quantum gate to optimize the Shor algorithm.

[0081] Specifically, Shor's algorithm is a classical algorithm in the field of quantum computing that leverages the properties of quantum computing to solve the problem of prime factorization of large integers, a problem that classical computers struggle to efficiently solve. The key to Shor's algorithm lies in transforming the prime factorization problem into a periodicity detection problem, leveraging quantum superposition and the inverse quantum Fourier transform (IQFT) of quantum computing to achieve exponential acceleration.

[0082] Quantum circuits are tools for quantum computing, used to transform abstract quantum algorithms into sequences of physical operations executable on quantum computing hardware. Essentially, they are graphical models that describe the evolution of quantum bits (qubits), similar to logic circuits in classical computers, but operating on qubits that exhibit quantum superposition and entanglement.

[0083] Qubit refers to the basic unit of quantum circuit and is the carrier of quantum information. 、 and its superposition state.

[0084] Quantum Gates refer to the basic operation units in quantum computing. They are mathematical operations that perform specific transformations on the states of quantum bits. In essence, they are unitary transformations acting on quantum states, satisfying reversibility and probability conservation, and are used to construct quantum circuits to achieve the logical functions of quantum algorithms.

[0085] The Controlled-Swap Gate (CSWAP Gate) is an important quantum gate in quantum computing. It belongs to the category of controlled gates and determines whether to perform a swap operation by introducing a control bit. The controlled-swap gate usually acts on three quantum bits, including one control bit and two target bits. Among them, the control bit refers to the quantum bit in a quantum logic gate that controls the states of other quantum bits (controlled bits). Only when the control bit is in a specific state (usually the ground state ) will the states of the controlled bits change. The control bit itself does not change its state during the operation. It only determines whether to perform an operation on the controlled bits. The controlled bit is the quantum bit in a quantum logic gate that is affected by the control bit. When the control bit is in a specific state, the controlled bit will perform specific quantum operations, such as bit flipping, phase flipping, etc. The state change of the controlled bit depends on the state of the control bit and the specific quantum logic gate operation. Assuming the controlled-swap gate is 1-controlled, the logic of the controlled-swap gate can be described as follows: when the control bit is , swap the quantum states of the two target bits; when the control bit is , the quantum states of the two target bits remain unchanged. Please refer to Figure 2 Figure 2 for the schematic diagram of the controlled-swap gate. Among them, the controlled-swap gate is a 1-controlled controlled-swap gate. The solid dot above is the control bit, and the cross lines below are the target bits.

[0086] The target problem refers to the computational problem targeted by Shor's algorithm, that is, the problem of factoring large integers. That is, given a large integer N (usually the product of two prime numbers), find its prime factors p and q (i.e., N = p×q, and p, q≠1 or N). In the traditional method, the steps to solve the target problem using Shor's algorithm are as follows: First, input the composite number N to be factored. Then, select a random integer a that satisfies 1 < a < N and gcd(a, N) = 1. Then, solve the period r of the function , that is, the smallest positive integer r that satisfies . If the period r is even and , then and are likely to be non-trivial factors (i.e., prime factors) of N. In the process of solving the function , the superposition state can be prepared through a quantum register, where x can take multiple integer values simultaneously (such as 0, 1, 2, , enabling parallel computation of all possible values ​​of f(x). Furthermore, the inverse quantum Fourier transform can be used to operate on the superposition state, converting the function's periodic information from the time domain to the frequency domain, thereby rapidly extracting the probability amplitude of the period r. Finally, after obtaining an estimate of the period r through quantum computation, classical algorithms (such as continued fraction expansion) are used to accurately calculate r, and number theory methods are combined to decompose the prime factors of N.

[0087] The initial quantum circuit is a combination of quantum gates designed to solve the large integer prime factorization problem (the target problem), based on the principles of Shor's algorithm. It directly corresponds to the algorithm's mathematical logic and serves as the starting point for subsequent optimization. It includes a quantum register, an inverse quantum Fourier transform module, and a modular exponential operation module.

[0088] Among them, the quantum register includes a phase register and an operation register, and the phase register is used to store the phase information of the quantum inverse Fourier transform. In the Shor algorithm, by performing an inverse Fourier transform operation on the phase register, the target information in the phase register can be transformed from the phase to the basis vector, thereby converting the periodic information encoded in the phase register into a measurable probability distribution for subsequent processing. When performing a controlled modular exponential operation, each bit of the phase register serves as a control bit to control the modular exponential operation on the operation register. Through the combination of different bits, modular operation control of different exponential powers of data in the operation register is achieved. The operation register is used to store the intermediate and final results of the modular exponential operation. Its initial state is usually set to a specific value, which is in most cases (i.e. binary representation ). During the execution of the Shor algorithm, the operation register will continuously update the data stored therein according to the control of the phase register. In the controlled modular exponential operation phase, the data in the operation register will undergo corresponding modular exponential operations according to the control of each bit of the phase register. The quantum inverse Fourier transform module is used to extract periodic information. The modular exponential operation module is used to calculate .

[0089] The modular exponentiation operator refers to the implementation function The quantum circuit module is the core component of the initial quantum circuit. Its essence is to convert classical modular exponentiation operations into quantum reversible operations.

[0090] The initial basis vector refers to the initial quantum state basis vector of the operation register, which is the input starting point of the modular exponential operation and is used to derive the subsequent quantum state evolution path. The initial basis vector is always , does not change with the target problem.

[0091] The quantum basis vector data flow refers to the basis vector evolution path of the quantum state of the operation register, that is, from the initial basis vector Starting from the sequence of basis vector superposition states generated after each modular exponential operation. It should be noted that the quantum basis vector data flow is centered on the numerical transformation rules of the basis vectors, rather than aiming to achieve a fixed function (different from the traditional function flow design).

[0092] The target quantum basis vector group refers to the set of basis vectors that are extracted from the quantum basis vector data stream and actually participate in the transformation. It can serve as the actual input and output state set of modular exponential operations, replacing the full-space basis vectors in traditional schemes and reducing the number of transformation pairs that need to be processed.

[0093] The target quantum gate refers to a simple quantum gate used to replace the original modular exponential operator. It is designed based on the linear relationship of the basis vector group and can replace the traditional high-complexity multiplication gate. It converts the modular exponential operation into a low-depth linear transformation combination, thereby reducing circuit complexity and adapting to the hardware limitations of current quantum computers.

[0094] First, the computer equipment constructs the basic quantum circuit to solve the target problem to be processed based on the mathematical principles of Shor's algorithm, namely the initial quantum circuit, which includes a phase register, an operation register and a modular exponential operation module.

[0095] Then, the computer device operates on the register initial basis vector As a starting point, through the mathematical relationship of modular exponential operation , derive the basis vector superposition state sequence after each step of modular exponential operator operation to form a quantum basis vector data stream.

[0096] Next, the basis vector set actually participating in the transformation is obtained from the quantum basis vector data stream to determine the target quantum basis vector group.

[0097] Finally, the computer equipment designs a simple quantum gate combination based on the linear relationship of the target basis vector group, determines the target quantum gate, and determines the target quantum circuit based on the target quantum gate and the target quantum basis vector group to optimize the Shor algorithm.

[0098] The following uses the integer decomposition of 21=3×7 as an example to illustrate the optimization method of Shor's algorithm based on linear transformation of data stream grouping provided by the embodiment of the present application. Figure 3 , Figure 3 is the quantum circuit diagram of Shor's algorithm, where to The folded horizontal line below is the operation register, which is used to store the intermediate and final results of the modular exponential operation. Its initial state is usually set to a specific value, which is usually IQFT refers to the inverse quantum Fourier transform module. U represents a controlled U gate. In quantum circuits, modular exponential operations are usually implemented through a series of controlled U gates, each of which corresponds to The t in the superscript of U represents the number of qubits in the phase register. M identifies the measurement operation.

[0099] from Figure 3 It can be seen that in quantum computing, modular exponential operation (i.e. calculation , corresponding to the exponential operation of the U gate, is a core step in quantum algorithms such as Shor's algorithm. For the exponent x (assuming it has n qubits), each bit (t = n in total) controls the execution of a modular operation. Each qubit undergoes two multiplications, resulting in a total of approximately 4n^2 multiplications (including additional operations such as modular reduction). Since the quantum circuit complexity of a single multiplication operation is O(n^2) (e.g., a Toffoli gate-based multiplier), the total arithmetic complexity is O(n^4).

[0100] First, the computer equipment constructs the initial quantum circuit to solve the integer decomposition of 21=3×7 based on the mathematical principles of Shor's algorithm.

[0101] Then, the computer device operates on the register initial basis vector As a starting point, through the mathematical relationship of modular exponential operation (The selected basis a=2, the range of x is to ), derive the basis vector superposition state sequence after each step of the modular exponential operator operation to form a quantum basis vector data stream.

[0102] Next, the basis vector set actually participating in the transformation is obtained from the quantum basis vector data stream to determine the target quantum basis vector group.

[0103] Finally, the computer equipment designs a simple quantum gate combination based on the linear relationship of the target basis vector group, determines the target quantum gate, and determines the target quantum circuit based on the target quantum gate and the target quantum basis vector group to optimize the Shor algorithm.

[0104] In summary, in the optimization method of the Shor algorithm based on data stream grouped linear transformation provided by the embodiments of the present application, based on the Shor algorithm, a computer device determines an initial quantum circuit according to a target problem to be processed. Then, the computer device calculates an initial basis vector of the initial quantum circuit according to a modular exponentiation operator in the initial quantum circuit to determine a quantum basis vector data stream. Next, the computer device determines a target quantum basis vector group according to the quantum basis vector data stream. Finally, the computer device determines a target quantum circuit according to the target quantum basis vector group and a target quantum gate to optimize the Shor algorithm. In this way, by analyzing the evolution of the basis vectors of the initial quantum circuit, the quantum basis vector data stream is determined, and a target quantum basis vector group is obtained from the quantum basis vector data stream. Then, complex operations are replaced with target quantum gates, reducing the quantum circuit complexity of the modular exponentiation operation of the Shor algorithm to make it adapt to the hardware limitations of the current quantum computer.

[0105] Please refer to Figure 5 , in some embodiments, step 01 (based on the Shor algorithm, determining an initial quantum circuit according to a target problem to be processed) includes:

[0106] 011: Based on the Shor algorithm, determining a basis according to the target problem;

[0107] 012: Determining the number of phase qubits according to the target problem;

[0108] 013: Determining the number of operation qubits according to the target problem;

[0109] 014: Determining an initial quantum circuit according to the basis, the number of phase qubits, and the number of operation qubits.

[0110] In some embodiments, the determining module is further configured to determine a basis based on the Shor algorithm according to the target problem. And determine the number of phase qubits according to the target problem. The determining module is further configured to determine the number of operation qubits according to the target problem. And determine an initial quantum circuit according to the basis, the number of phase qubits, and the number of operation qubits.

[0111] In some embodiments, the processor is further configured to determine a basis based on the Shor algorithm according to the target problem. And determine the number of phase qubits according to the target problem. The processor is further configured to determine the number of operation qubits according to the target problem. And determine an initial quantum circuit according to the basis, the number of phase qubits, and the number of operation qubits.

[0112] Specifically, in the Shor algorithm, the basis refers to a positive integer a that is relatively prime to the integer N to be factored and less than N (i.e., 1 < a < N and gcd(a, N) = 1). The basis is the core input of the modular exponentiation operation and is used to construct a periodic function The Shor algorithm uses the inverse quantum Fourier transform (IQFT) to analyze the period r of the function and then uses number theory to decompose N. It should be noted that the randomness of the basis affects the efficiency of the algorithm. In practical applications, multiple bases are usually randomly selected to ensure successful decomposition.

[0113] The number of phase qubits, typically denoted as t, refers to the number of qubits used in Shor's algorithm to store the phase information of the period measurement result. These qubits constitute the phase register. In the quantum circuit, the phase qubits are initialized to a superposition state via a Hadamard gate. They are then entangled with the operation qubits via a modular exponential operation circuit. Ultimately, the period information is encoded as the phase (i.e., the argument of the quantum state) via the QFT. Furthermore, the number of phase qubits, t, directly determines the accuracy of the period measurement: the larger t, the higher the resolution of the measurement result, making it easier to infer the true period r using classical algorithms.

[0114] The number of qubits used to perform modular exponential operations (i.e., calculations) The number of quantum bits that constitute the operation register is usually recorded as n (n is the number of bits of the integer N to be decomposed, that is, The operation qubit is used to store the intermediate results of modular exponential operations (such as ), its quantum state gradually evolves along the modular exponential operation circuit. Furthermore, each operational qubit corresponds to a binary bit of the value, and iterative calculations of the value are achieved through operations such as controlled gates (such as controlled multiplication gates) and SWAP gates.

[0115] It's important to note that the basis is an input parameter to the algorithm, determining the periodic function to be analyzed. The number of phase qubits, t, and the number of operation qubits, n, are hardware parameters for circuit design, corresponding to phase measurement accuracy and numerical representation precision, respectively. In the initial quantum circuit design, n must be determined based on the size of N, t based on the expected period, r, and a suitable basis, a. These three factors together determine the scale of the quantum circuit and the feasibility of the algorithm.

[0116] In this way, the computer determines a basis based on the target problem. The basis is coprime to the integer to be factored in the target problem and is smaller than the integer to be factored. Next, the computer determines the number of phase qubits based on the target problem. These phase qubits are used to record the phase information generated by running the Shor algorithm. Furthermore, the computer determines the number of operation qubits based on the target problem. These operation qubits are used to record the quantum state information generated by running the modular exponential operator. Finally, the computer determines the initial quantum circuit based on the basis, the number of phase qubits, and the number of operation qubits. In this way, a quantized mapping of the Shor algorithm is achieved through parameterized design, ensuring mathematical correctness while keeping resource consumption within the quantum computer's capacity and laying the foundation for subsequent optimization.

[0117] See also Figure 6 In some embodiments, step 014 (determining the initial quantum circuit based on the basis, the number of phase qubits, and the number of operation qubits) includes:

[0118] 0141: Determine the modular exponential operator based on the basis, the number of phase qubits, and the integer to be factored;

[0119] 0142: Determine the initial quantum circuit based on the basis, number of phase qubits, number of operation qubits, and modular exponential operator.

[0120] In certain embodiments, the determination module is further configured to determine a modular exponential operator based on the basis, the number of phase qubits, and the integer to be factored, and to determine an initial quantum circuit based on the basis, the number of phase qubits, the number of operation qubits, and the modular exponential operator.

[0121] In certain embodiments, the processor is further configured to determine a modular exponential operator based on the basis, the number of phase qubits, and the integer to be factored, and to determine an initial quantum circuit based on the basis, the number of phase qubits, the number of operation qubits, and the modular exponential operator.

[0122] Specifically, the construction of the modular exponential operator depends on the basis a, the number of phase quantum bits t and the integer to be decomposed N. The modular exponential operator is equivalent to the modular exponential operation in the classical algorithm (such as the fast power algorithm), but it achieves parallel computing through quantum gate operations. It can use quantum superposition states to simultaneously calculate the corresponding values ​​of multiple x. , which is the key to achieving exponential acceleration of Shor's algorithm.

[0123] After determining the modular exponential operator, the computer device determines an initial quantum circuit based on the basis, the number of phase qubits, the number of operation qubits, and the modular exponential operator.

[0124] In this way, the computer determines the modular exponential operator based on the basis, the number of phase qubits, and the integer to be factored. Next, the computer determines the initial quantum circuit based on the basis, the number of phase qubits, the number of operation qubits, and the modular exponential operator. This rigorous number-theoretic transformation ensures that the initial quantum circuit mathematically correctly maps to the theoretical framework of Shor's algorithm, avoiding decomposition anomalies caused by incorrect parameters.

[0125] See also Figure 7 In certain embodiments, the method further comprises:

[0126] 0143: Determine a temporary quantum circuit based on the basis, number of phase qubits, number of operation qubits, and modular exponential operator;

[0127] 0144: According to the commutativity of the modular exponential operator in the temporary quantum circuit, adjust the operation order of the modular exponential operator and determine the initial quantum circuit.

[0128] In certain embodiments, the determination module is further configured to determine a temporary quantum circuit based on the basis, the number of phase qubits, the number of operation qubits, and the modular exponential operator, and to adjust the order of operations of the modular exponential operator based on the commutativity of the modular exponential operator in the temporary quantum circuit to determine the initial quantum circuit.

[0129] In certain embodiments, the processor is further configured to determine a temporary quantum circuit based on the basis, the number of phase qubits, the number of operation qubits, and the modular exponential operator, and to adjust the order of operations of the modular exponential operator based on the commutativity of the modular exponential operator in the temporary quantum circuit to determine the initial quantum circuit.

[0130] Specifically, a temporary quantum circuit is an unoptimized quantum circuit constructed directly based on the basic parameters of the target problem (basis, number of phase quantum bits, number of operation quantum bits, modular exponential operator). Its structure only reflects the mathematical mapping of the parameters and does not consider the optimization of the order of operations.

[0131] Operational commutativity means that two quantum gates A and B satisfy AB=BA, meaning the order of operations can be swapped without affecting the final quantum state. For example, two single-qubit gates acting on different qubits must commutate.

[0132] The initial quantum circuit here refers to the optimized circuit obtained by adjusting the order of modular exponential operators in the temporary circuit by utilizing operation commutativity, which optimizes the circuit structure while maintaining the modular exponential operation function.

[0133] See also Figure 3 and Figure 8 , Figure 8 This is a schematic diagram of the quantum circuit of Shor's algorithm. Figure 3The controlled modular exponential operations in commutate with each other, so we can move the controlled modular exponential operations back and forth arbitrarily to form Figure 8 The quantum circuit shown, Figure 3 and Figure 8 The quantum circuit shown is equivalent. In the above content, Figure 3 is a temporary quantum circuit, Figure 8 is the initial quantum circuit.

[0134] In this way, the computer device determines a temporary quantum circuit based on the basis, the number of phase qubits, the number of operation qubits, and the modular exponentiation operator. Next, the computer device adjusts the order of modular exponentiation operations based on the commutativity of the modular exponentiation operator in the temporary quantum circuit to determine the initial quantum circuit. By leveraging the commutativity of the modular exponentiation operator and adjusting the order of modular exponentiation operations, the subsequently determined quantum basis vector groups can be executed serially according to the quantum basis vector data stream order, reducing the number of parallel quantum gate operations.

[0135] See also Figure 9 In certain embodiments, step 02 (calculating the initial basis vectors of the initial quantum circuit according to the modular exponential operator in the initial quantum circuit to determine the quantum basis vector data stream) includes:

[0136] 021: Calculate the initial basis vector according to the modular exponential operator to determine the first basis vector of the current stage;

[0137] 022: Calculate the first basis vector according to the modular exponential operator to determine the second basis vector for the next stage;

[0138] 023: Determine a quantum basis vector data stream based on the first basis vector and the second basis vector.

[0139] In certain embodiments, the determination module is further configured to calculate an initial basis vector using a modular exponential operator to determine a first basis vector for a current phase, calculate the first basis vector using a modular exponential operator to determine a second basis vector for a next phase, and determine a quantum basis vector data stream based on the first basis vector and the second basis vector.

[0140] In certain embodiments, the processor is further configured to calculate an initial basis vector using a modular exponential operator to determine a first basis vector for a current phase, calculate the first basis vector using a modular exponential operator to determine a second basis vector for a next phase, and determine a quantum basis vector data stream based on the first basis vector and the second basis vector.

[0141] Specifically, the first basis vector refers to the output basis vector of the modular exponential operation at the current stage, that is, the result of a modular exponential operation on the initial basis vector.

[0142] The second basis vector refers to the output basis vector of the modular exponential operation in the next stage, that is, the result of the modular exponential operation on the first basis vector again.

[0143] The quantum basis vector data flow refers to the basis vector sequence and its superposition relationship generated by successive modular exponential operations starting from the initial basis vector, reflecting the evolution path of the data in the operation register.

[0144] Continuing with the above example, please refer to Figure 8 , in the integer decomposition of 21=3×7, the mathematical relationship of modular exponential operation (The selected basis a=2, the range of x is to Then, the first module The function implemented is , the result is 4, that is, when the control bit =1, controlled The result of the operation output is a binary string corresponding to 4, that is, , so the execution is completed under control The quantum state after that is .therefore, The realization is from arrive The transformation is simple, such as Figure 10 The data flow circuit represented by the swap gate shown is completed, that is, the third bit and the fifth bit are exchanged; note that this does not include Control bit , in the actual realization of quantum circuits, it is necessary to Figure 10 The circuit shown is added with the control bit, the same below, and will not be repeated here.

[0145] Then, the second step is to execute the controlled , whose input includes and In fact, State contains The quantum state of the bit state is According to the control bit The quantum state evolves into That is, when the control bit When it is 0, no change occurs, and it is still 00001 and 00100; When it is 1, 00001 passes is transformed into 10000, while 00100 is transformed into 10000. Transformed to 00001, this is The transformations that need to be completed are no longer one, but two. Figure 11As shown, this circuit completes the synchronous transformation of these two basis vectors.

[0146] Then, the third step is executed , similar to the above two steps, at this time It is necessary to synchronize 1, 4, and 16 respectively. , , Transformed to 4,16,1, its circuit is as follows Figure 12 shown.

[0147] Then, the fourth step is to execute , similarly, 1,4,16 pass , , Transformed to 16,1,4, the circuit is as follows Figure 13 shown.

[0148] Then, the fifth to seventh steps are executed respectively 、 and , their lines are respectively Figure 12 , Figure 13 , Figure 12 Same, the difference is only in the control bit, such as Figure 3 shown.

[0149] Finally, the last step is to execute , 1, 4, and 16 are transformed into 2, 8, and 11 respectively. Figure 10 、 Figure 11 、 Figure 12 and Figure 13 These are all schematic diagrams of quantum circuits that implement modular exponential operations, where the solid circle represents 1 control.

[0150] In this way, the computer device calculates the initial basis vectors using the modular exponential operator to determine the first basis vector for the current stage. Next, the computer device calculates the first basis vector using the modular exponential operator to determine the second basis vector for the next stage. Finally, the computer device determines the quantum basis vector data stream based on the first and second basis vectors. This stage-by-stage evolution of the basis vectors allows for intuitive analysis of the evolutionary path of the modular exponential operation, facilitating subsequent optimization of the quantum circuit.

[0151] See also Figure 14 In some embodiments, step 03 (determining a target quantum basis vector group based on the quantum basis vector data stream) includes:

[0152] 031: Based on the preset identification rules, the quantum basis vector data stream is identified to determine whether there is a linear relationship in the quantum basis vector data stream;

[0153] 032: Determine the first sub-vector group and the second sub-vector group from the quantum basis vector data stream based on the existence of the linear relationship;

[0154] 033: Determine the target quantum basis vector group based on the first sub-vector group.

[0155] In certain embodiments, the determination module is further configured to identify the quantum basis vector data stream based on a preset identification rule, determine whether a linear relationship exists in the quantum basis vector data stream, and determine a first sub-vector group and a second sub-vector group from the quantum basis vector data stream based on the presence of the linear relationship. Furthermore, the target quantum basis vector group is determined based on the first sub-vector group.

[0156] In certain embodiments, the processor is further configured to identify the quantum basis vector data stream based on a preset identification rule, determine whether a linear relationship exists in the quantum basis vector data stream, and determine a first sub-vector group and a second sub-vector group from the quantum basis vector data stream based on the presence of the linear relationship. Furthermore, the processor is configured to determine a target quantum basis vector group based on the first sub-vector group.

[0157] Specifically, the preset identification rules refer to the criteria for judging whether there is a linear relationship between quantum basis vectors in the quantum basis vector data stream, including bit swapping, small coefficient multiplication / addition, and periodic transformation. Among them, bit swapping means that the binary string corresponding to the quantum basis vector can be obtained by directly exchanging bits through the swap gate. Small coefficient multiplication / addition means that the value of the quantum basis vector satisfies y=(kx+b)modN (k is a small integer, such as 2, 4, etc.; b is a constant). Periodic transformation refers to the formation of a closed loop after the quantum basis vector is linearly transformed, such as → → → .

[0158] A linear relationship refers to a relationship in which quantum basis vectors can be mapped through linear algebra operations (such as matrix transformation and linear combinations in vector space) through preset identification rules.

[0159] The existence of a linear relationship refers to the result of judging the linear relationship between adjacent basis vector pairs in the quantum basis vector data stream, which is used to determine the grouping strategy of the basis vectors.

[0160] The first sub-vector group refers to the set of basis vectors in the quantum basis vector data stream that can be mapped through linear transformation, that is, there is a clear linear relationship between the basis vectors in the group (such as bit swapping, small coefficient multiplication / addition, etc.), and the transformation can be achieved through simple quantum gates (such as swap gates and adders).

[0161] The second sub-vector group refers to the set of basis vectors in the quantum basis vector data stream that cannot be mapped through linear transformation, that is, there is no obvious linear relationship between the basis vectors in the group, and it is necessary to introduce auxiliary bits or complex conditional gates for processing.

[0162] The target quantum basis vector group includes a first sub-vector group and a processed second sub-vector group. A linear relationship exists within the target quantum basis vector group, and a linear relationship does not exist or is not obvious between different target quantum basis vector groups.

[0163] First, based on a preset identification rule, the existence of a linear relationship is identified. Then, based on the linear relationship, a first sub-vector group and a second sub-vector group are determined. Finally, based on the first sub-vector group, a target quantum basis vector group is determined.

[0164] Continuing with the above example, in the integer factorization of 21=3×7, the linear transformations from 1,4,16 to 4,16,1 or 1,4,16 to 16,1,4 implemented in steps 1 to 7 have very obvious periodic characteristics. They can be implemented through simple bit shifting. The circuit only needs swap gates, and conventional compilation functions can be completed efficiently.

[0165] In this way, based on preset identification rules, the computer device identifies the quantum basis vector data stream and determines whether linear relationships exist within the quantum basis vector data stream. Next, based on the presence of linear relationships, the computer device determines a first sub-vector group and a second sub-vector group from the quantum basis vector data stream. The first sub-vector group indicates a nonlinear quantum basis vector group that can be mapped via linear transformation, while the second sub-vector group indicates a nonlinear quantum basis vector group that cannot be mapped via linear transformation. Finally, the computer device determines a target quantum basis vector group based on the first sub-vector group. In this way, through linear relationship identification and group isolation, the complexity of modular exponential operations is reduced, thereby breaking through the hardware performance limitations of current quantum computers.

[0166] See also Figure 15 In some embodiments, step 033 (determining a target quantum basis vector group based on the first sub-vector group) includes:

[0167] 0331: Determine the target quantum basis vector group based on the periodicity of the first sub-vector group.

[0168] In some embodiments, the determination module is further configured to determine a target quantum basis vector group based on the periodicity of the first sub-vector group.

[0169] In some embodiments, the processor is further configured to determine a target quantum basis vector group based on the periodicity of the first sub-vector group.

[0170] Specifically, the periodicity of the first sub-vector group refers to the fact that the values ​​of the base vectors in the first sub-vector group repeat regularly as the operator index i increases under the modular exponential operation. Starting from (i=1), the basis vector values ​​have a cycle of "4→16→4→16".

[0171] The target quantum basis vector group consists of the set of basis vectors within a period determined after detecting the periodicity of the first sub-vector group. In other words, if periodic quantum basis vectors exist, only all basis vectors within a period need to be retained, ignoring repeated cyclic states. This periodicity allows the design of cyclic quantum gates (such as the cyclic application of swap gates). The same set of gates can be repeatedly applied to basis vectors within a period, replacing traditional successive multiplication gates.

[0172] In this way, the computer device determines the target quantum basis vector group based on the periodicity of the first sub-vector group. This transforms the modular exponential operation from a successive high-complexity multiplication into a cyclic linear transformation, and only needs to process the quantum basis vectors within a period, reducing the complexity of the quantum circuit.

[0173] See also Figure 16 In certain embodiments, the method further comprises:

[0174] 034: Determine the target quantum basis vector group based on the auxiliary quantum bit and the second sub-vector group.

[0175] In some embodiments, the determination module is further configured to determine a target quantum basis vector group based on the auxiliary quantum bits and the second sub-vector group.

[0176] In some embodiments, the processor is further configured to determine a target quantum basis vector group based on the auxiliary quantum bit and the second sub-vector group.

[0177] Specifically, continuing with the above example, in the integer factorization of 21=3×7, the last step, 1, 4, and 16, is transformed into 2, 8, and 11, respectively. However, 11 does not have an obvious linear relationship with 2 and 8, so 2, 8, and 11 are divided into the second sub-vector group. For this nonlinear quantum basis vector group that cannot be mapped to each other through linear transformation, it is necessary to introduce an auxiliary qubit to introduce nonlinear operations (such as measurement and combination of quantum gates under classical feedback control) to indirectly handle it.

[0178] Ancillary qubits are additional qubits introduced into quantum computing to assist in completing specific operations (such as nonlinear transformations, quantum error correction, and state preparation). They do not directly participate in the target computation, but indirectly control it through interaction with the target qubit. The interaction between the ancillary qubit and the target qubit includes classical feedback control, quantum state preparation, and conversion. Classical feedback control involves measuring the ancillary qubit and applying different quantum gate operations to the quantum state of the second sub-vector group based on the measurement results (classical information) to achieve nonlinear transformations. Quantum state preparation and conversion involves using the ancillary qubit as a catalyst to transform the state of the second sub-vector group into the target basis vector group through protocols such as entanglement swapping and quantum teleportation.

[0179] In this way, the computer device determines the target quantum basis vector group based on the auxiliary qubit and the second sub-vector group. This way, the auxiliary bit transforms the nonlinear problem into a hybrid process of linear operations and conditional control, allowing the quantum basis vectors of the second sub-vector group to be mapped to the target basis vector group.

[0180] See also Figure 17 In some embodiments, step 034 (determining a target quantum basis vector group based on the auxiliary qubit and the second sub-vector group) includes:

[0181] 0341: Determine the number of auxiliary qubits based on the second sub-vector group;

[0182] 0342: Split the second sub-vector group according to the auxiliary quantum bits and the number of bits to determine the target quantum basis vector group.

[0183] In some embodiments, the determination module is further configured to determine the number of auxiliary qubits based on the second sub-vector group, and to split the second sub-vector group based on the auxiliary qubits and the number of bits to determine the target quantum basis vector group.

[0184] In some embodiments, the processor is further configured to determine the number of auxiliary qubits based on the second sub-vector group, and to split the second sub-vector group based on the auxiliary qubits and the number of bits to determine a target quantum basis vector group.

[0185] Specifically, the number of auxiliary qubits is dynamically determined by the characteristics of the second sub-vector group (such as the number of basis vectors m in the group and the complexity of the nonlinear mapping), and usually satisfies the number of auxiliary qubits = .

[0186] The splitting process refers to using auxiliary quantum bits to split the second sub-vector group into multiple small-dimensional sub-groups, and these small-dimensional sub-groups have linear relationships within the groups.

[0187] It should be noted that in some embodiments, it is also necessary to conditionally separate the first sub-vector group and the second sub-vector group, that is, by the state of the auxiliary quantum bit (such as or ) as a "conditional switch" to control the quantum gate to act only on the first sub-vector group (linear basis vector group) or the second sub-vector group (nonlinear basis vector group), thereby isolating the transformation operations of the two groups and avoiding cross-interference.

[0188] See also Figure 18 , Figure 18 Schematic diagram for introducing auxiliary bits, where solid circles represent 1 control and hollow circles represent 0 control. Continuing with the above example, in the integer decomposition of 21=3×7, the first sub-vector group → → With the second sub-vector group → Conditional separation is achieved through 1 auxiliary bit. That is, the auxiliary bit is When the swap gate acts on the linear group, the → → The auxiliary bits are When the controlled multiplication gate acts on the nonlinear group, the → transformation.

[0189] In this way, the computer device determines the number of auxiliary qubits based on the second sub-vector group. Next, the computer device splits the second sub-vector group based on the auxiliary qubits and the number of bits to determine the target quantum basis vector group. This dynamic determination of the number of auxiliary bits and the splitting of the second sub-vector group enables efficient processing of the second sub-vector group, which ultimately forms the target quantum basis vector group together with the first sub-vector group for subsequent quantum circuit optimization.

[0190] See also Figure 19 In some embodiments, step 04 (determining a target quantum circuit based on a target quantum basis vector group and a target quantum gate) includes:

[0191] 041: Replace the modular exponential operator in the target quantum basis vector group with the target quantum gate to determine the target quantum circuit.

[0192] In certain embodiments, the confirmation module is further configured to replace the modular exponential operator in the target quantum basis vector group with a target quantum gate to determine the target quantum circuit.

[0193] In certain embodiments, the processor is further configured to replace a modular exponential operator in a target quantum basis vector group with a target quantum gate to determine a target quantum circuit.

[0194] Specifically, the target quantum circuit refers to a sequence of quantum gate operations that can be directly executed on actual quantum hardware (such as superconducting quantum chips, photonic quantum devices, etc.) after optimization.

[0195] Target quantum gates refer to simple quantum gates that can be implemented in quantum computing hardware, including swap gates and controlled NOT gates.

[0196] The computer device replaces the modular exponential operator in the target quantum basis vector group with the target quantum gate to determine the target quantum circuit.

[0197] In this way, the computer device replaces the modular exponential operator in the target quantum basis vector group with the target quantum gate and determines the target quantum circuit. In this way, by replacing the modular exponential operator in the target quantum basis vector group with the target quantum gate, the theoretical logic of the Shor algorithm is converted into a hardware-executable gate sequence, thus achieving the optimization of the Shor algorithm.

[0198] 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.

[0199] 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.

[0200] 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.

[0201] 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.

[0202] 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. An optimization method of Shor's algorithm based on linear transformation of data stream groups, characterized in that: The method comprises: Based on the Shor algorithm, an initial quantum circuit is determined according to the target problem to be processed; calculating an initial basis vector of the initial quantum circuit according to a modular exponential operator in the initial quantum circuit to determine a quantum basis vector data stream; Dividing the quantum basis vector data stream into a first sub-vector group and a second sub-vector group according to whether a linear relationship exists in the quantum basis vector data stream, wherein the first sub-vector group is used to indicate a linear quantum basis vector group that can be mapped through a linear transformation, and the second sub-vector group is used to indicate a nonlinear quantum basis vector group that cannot be mapped through a linear transformation; Determining a target quantum basis vector group according to the first sub-vector group and the second sub-vector group; According to the target quantum basis vector group and the target quantum gate, a target quantum circuit is determined to optimize the Shor algorithm.

2. The method according to claim 1, characterized in that The method of determining an initial quantum circuit based on the Shor algorithm and the target problem to be processed includes: Based on the Shor algorithm and the target problem, determining a basis, where the basis is coprime to the integer to be decomposed in the target problem and is smaller than the integer to be decomposed; Determining the number of phase qubits according to the target problem, wherein the number of phase qubits is used to record phase information generated by running the Shor algorithm; Determining the number of operation qubits according to the target problem, where the number of operation qubits is used to record quantum state information generated by running the modular exponential operator; The initial quantum circuit is determined according to the basis, the number of phase quantum bits, and the number of operation quantum bits.

3. The method according to claim 2, characterized in that The determining of the initial quantum circuit according to the basis, the number of phase qubits, and the number of operation qubits includes: Determining the modular exponential operator according to the basis, the number of phase qubits, and the integer to be decomposed; The initial quantum circuit is determined according to the basis, the number of phase quantum bits, the number of operation quantum bits, and the modular exponential operator.

4. The method according to claim 3, characterized in that The method further comprises: determining a temporary quantum circuit according to the basis, the number of phase qubits, the number of operation qubits, and the modular exponential operator; According to the commutativity of the modular exponential operator in the temporary quantum circuit, the operation order of the modular exponential operator is adjusted to determine the initial quantum circuit.

5. The method according to claim 1, wherein The step of calculating the initial basis vector of the initial quantum circuit according to the modular exponential operator in the initial quantum circuit to determine the quantum basis vector data stream includes: Calculating the initial basis vector according to the modular exponential operator to determine a first basis vector of the current stage; Calculating the first basis vector according to the modular exponential operator to determine a second basis vector for the next stage; The quantum basis vector data stream is determined according to the first basis vector and the second basis vector.

6. The method according to claim 1, wherein The method further comprises: Based on a preset identification rule, the quantum basis vector data stream is identified to determine whether a linear relationship exists in the quantum basis vector data stream.

7. The method according to claim 1, characterized in that Determining a target quantum basis vector group according to the first sub-vector group and the second sub-vector group includes: The target quantum basis vector group is determined according to the periodicity of the first sub-vector group.

8. The method according to claim 1, characterized in that Determining a target quantum basis vector group according to the first sub-vector group and the second sub-vector group includes: The target quantum basis vector group is determined according to the auxiliary quantum bits and the second sub-vector group.

9. The method according to claim 8, characterized in that The step of determining the target quantum basis vector group according to the auxiliary quantum bit and the second sub-vector group includes: Determining the number of auxiliary quantum bits according to the second sub-vector group; The second sub-vector group is split according to the auxiliary quantum bits and the number of bits to determine the target quantum basis vector group.

10. The method according to claim 1, characterized in that Determining a target quantum circuit according to the target quantum basis vector group and the target quantum gate includes: The modular exponential operator in the target quantum basis vector group is replaced with the target quantum gate to determine the target quantum circuit.

Citation Information

Patent Citations

  • Quantum computer performance benchmark test method and device

    CN115829045A

  • Quantum chip system, quantum computer, performance improvement method of quantum computer and related device

    CN117494824A