Quantum circuit construction method, modular multiplication quantum circuit and related system and device

By constructing quantum circuits using the Karatsuba algorithm and replacing the Toffoli gate with the CNOT gate, the problem of high complexity in polynomial multiplication quantum circuits is solved, achieving efficient and concise polynomial computation.

CN121766467APending Publication Date: 2026-03-31ORIGIN QUANTUM COMPUTING TECH (HEFEI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311489922.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-07
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing polynomial multiplication quantum circuits require complex quantum gates such as Toffoli gates, which makes implementation on practical quantum computers difficult and inefficient.

Method used

The Karatsuba algorithm is used to construct quantum circuits, reducing the use of Tofoli gates and implementing polynomial multiplication and addition operations only through CNOT gates, thereby reducing the quantum gate depth.

Benefits of technology

It lowers the physical implementation requirements of quantum computers, improves the efficiency and simplicity of polynomial multiplication and addition operations, and reduces operational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121766467A_ABST
    Figure CN121766467A_ABST
Patent Text Reader

Abstract

The invention provides a quantum circuit construction method, a modular multiplication quantum circuit and a related system and device. The method comprises the steps that a first quantum circuit used for achieving calculation of h (x) + f (x) g (x) is constructed; wherein the polynomials f (x), g (x) and h (x) all belong to F2 [x], the F2 [x] is a polynomial ring defined on a binary field F2, and the quantum operation in the first quantum circuit comprises a CNOT operation. According to the quantum circuit, the construction of the quantum circuit is simplified by using the CN OT gate in the quantum circuit, and the use of the Tofli gate is reduced, so that the physical implementation requirement of the quantum computer is reduced, the implementation of polynomial multiplication and addition becomes efficient and concise, and the required quantum gate depth and operation complexity are reduced to a great extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of quantum computing, and in particular to quantum circuit construction methods, modular multiplication quantum circuits, quantum chip systems, quantum computers, and classical computers. Background Technology

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

[0003] Existing polynomial multiplication quantum circuits typically require complex quantum gates, such as Toffoli gates, and the depth of these gates can reach exponential levels, making their implementation on practical quantum computers difficult and inefficient.

[0004] Based on this, this application provides a method for constructing quantum circuits, modular multiplication quantum circuits, quantum chip systems, quantum computers, and classical computers to improve related technologies. Summary of the Invention

[0005] This application provides a method for constructing quantum circuits, modular multiplication quantum circuits, quantum chip systems, quantum computers, and classical computers, which reduces the use of Toffoli gates and lowers the required quantum gate depth and physical implementation requirements of quantum computers.

[0006] In a first aspect, this application provides a method for constructing quantum circuits, the method comprising:

[0007] Construct the first quantum circuit for computing h(x) + f(x)g(x);

[0008] Wherein, the polynomials f(x), g(x) and h(x) are all ∈ F2[x], F2[x] is a polynomial ring defined on the binary field F2, and the quantum operations in the first quantum circuit include the CNOT operation.

[0009] Secondly, this application provides a modular multiplication quantum circuit, which includes:

[0010] The first quantum circuit is used to calculate h(x) + f(x)g(x);

[0011] The second quantum circuit is used to realize H(x)+(1+x) k Calculation of F(x)G(x);

[0012] The third quantum circuit is used to calculate s(x)q(x)mod m(x);

[0013] The fourth quantum circuit is used to calculate r(x)t(x)mod m(x);

[0014] Where s(x) = 1 + x k r(x) = x, k is a positive integer; polynomials f(x), g(x), h(x), F(x), G(x), H(x), q(x) and t(x) all ∈ F2[x], F2[x] is a polynomial ring defined on the binary field F2; the quantum operations in the first quantum circuit include CNOT operations, the quantum operations in the second quantum circuit include CNOT operations, the quantum operations in the third quantum circuit include CNOT operations and SWAP operations, and the quantum operations in the fourth quantum circuit include CNOT operations and SWAP operations.

[0015] Thirdly, this application provides a quantum chip system, including at least one quantum processor, which is used to execute quantum operations corresponding to a quantum program to achieve the following steps:

[0016] The calculation of h(x) + f(x)g(x) mod m(x) is performed using a modular multiplication quantum circuit.

[0017] Among them, the polynomials f(x), g(x) and h(x) are all ∈ F2[x], and F2[x] is a polynomial ring defined on the binary field F2.

[0018] Fourthly, this application provides a quantum computer, the quantum computer comprising:

[0019] A quantum chip system includes at least one quantum processor, which executes quantum operations corresponding to a quantum program to process qubits, thereby calculating h(x) + f(x)g(x)mod m(x) via a modular multiplication quantum circuit; wherein the polynomials f(x), g(x) and h(x) are all ∈ F2[x], and F2[x] is a polynomial ring defined on the binary field F2;

[0020] The measurement and control system includes a control device and a measurement device. The control device is used to convert the quantum program corresponding to the modular multiplication quantum circuit into a corresponding control signal and send it to the quantum processor. The measurement device is used to measure the qubits.

[0021] A support system is provided to provide the operating environment conditions to ensure the operation of the quantum chip system;

[0022] An operating system is provided to offer software that enables interaction between the user and the quantum chip system and the measurement and control system.

[0023] Fifthly, this application provides a classic computer, the classic computer comprising:

[0024] Memory, used to store computer programs;

[0025] At least one processor is configured to execute the computer program to perform the following steps:

[0026] Obtain the coefficient arrays of f(x), g(x), and h(x); wherein the polynomials f(x), g(x), and h(x) are all ∈ F2[x], F2[x] is a polynomial ring defined on the binary field F2, and the polynomial coefficients in the coefficient array are arranged in descending order of degree.

[0027] According to the quantum circuit construction method, modular multiplication quantum circuit, quantum chip system, quantum computer and classical computer provided in this application, the use of CNOT gates in quantum circuits simplifies the construction of quantum circuits, reduces the use of Toffoli gates, thereby reducing the physical implementation requirements of quantum computers. This not only makes the implementation of polynomial multiplication and addition more efficient and concise, but also greatly reduces the required quantum gate depth and operational complexity. Attached Figure Description

[0028] This application will be further described below with reference to the accompanying drawings and specific embodiments.

[0029] Figure 1 This is a flowchart illustrating a quantum circuit construction method provided in an embodiment of this application.

[0030] Figure 2 This is an example diagram of a constant modular multiplication quantum circuit provided in an embodiment of this application.

[0031] Figure 3 This is an example diagram of a quantum circuit corresponding to an L matrix provided in an embodiment of this application.

[0032] Figure 4 This is an example diagram of a fourth quantum circuit provided in an embodiment of this application.

[0033] Figure 5 This is a schematic diagram of the structure of a quantum chip system provided in an embodiment of this application.

[0034] Figure 6 This is a schematic diagram of the structure of a quantum computer provided in an embodiment of this application. Detailed Implementation

[0035] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0036] In the description of the embodiments of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, features defined with "first" and "second" may explicitly or implicitly include one or more of the stated features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0037] Quantum computers have a hybrid architecture, comprising two main parts: a classical computing component responsible for performing classical calculations and control, and a quantum computing component responsible for running quantum programs to achieve quantum computation. A quantum program is a sequence of instructions written in a quantum language such as QRunes that can run on a quantum computer, supporting operations on quantum logic gates and ultimately enabling quantum computation. Specifically, a quantum program is a sequence of instructions that operates on quantum logic gates according to a specific timing order.

[0038] Quantum circuits, also known as quantum logic circuits, are a manifestation of quantum programming and are the most commonly used general-purpose quantum computing model. They represent circuits that operate on qubits under an abstract concept. They consist of qubits, circuits (timelines), and various quantum logic gates. Finally, the results are often read out through quantum measurement operations.

[0039] Unlike traditional circuits that use metal wires to transmit voltage or current signals, in quantum circuits, the circuits can be seen as being connected by time. That is, the state of a quantum bit evolves naturally over time, following the instructions of the Hamiltonian operator until it encounters a logic gate and is operated on.

[0040] A quantum program corresponds to a single quantum circuit, where the total number of qubits in the quantum circuit is the same as the total number of qubits in the quantum program. This can be understood as follows: a quantum program can consist of a quantum circuit, measurement operations on the qubits within that circuit, registers to store the measurement results, and control flow nodes (jump instructions). A single quantum circuit can contain dozens, hundreds, or even thousands of quantum logic gate operations. The execution of a quantum program is the process of executing all the quantum logic gates in a specific timing order. It should be noted that the timing order refers to the chronological sequence in which individual quantum logic gates are executed.

[0041] It's important to note that in classical computing, the most basic unit is the bit, and the most fundamental control mode is the logic gate. Circuit control can be achieved through combinations of logic gates. Similarly, the way to process qubits is through quantum logic gates. Quantum logic gates enable the evolution of quantum states and are the foundation of quantum circuits. Quantum logic gates include: single-qubit quantum logic gates, such as Hadamard gates (H-gates), Pauli-X gates (X-gates), Pauli-Y gates (Y-gates), Pauli-Z gates (Z-gates), RX gates, RY gates, RZ gates, etc.; and multi-qubit quantum logic gates, such as CNOT gates, CR gates, iSWAP gates, Tofoli gates, etc. Quantum logic gates are generally represented using unitary matrices, which are not only matrix forms but also operations and transformations. Generally, the effect of a quantum logic gate on a quantum state is calculated by left-multiplying the unitary matrix by the matrix corresponding to the right vector of the quantum state.

[0042] With the advancement of quantum computing technology, the efficiency and feasibility of quantum algorithms have become particularly important. In the field of polynomial computing, how to construct efficient quantum circuits, especially for polynomial multiplication, has become a research hotspot. Existing polynomial multiplication quantum circuits typically require complex quantum gates, such as Toffoli gates, and the gate depth can reach exponential levels, making their implementation on practical quantum computers difficult and inefficient.

[0043] The Karatsuba algorithm is a classic algorithm for solving polynomial multiplication. Its basic idea is to divide the two polynomials to be multiplied into two parts for multiplication and addition, thus reducing the complexity of the multiplication. This application proposes a quantum circuit implementation based on the Karatsuba algorithm for solving the quantum circuit of h + f*g. Specifically, a quantum circuit based on Karatsuba polynomial multiplication is designed, whose Toffoli gates have a depth n fewer than that of a typical polynomial multiplication quantum circuit. 1 / 3The magnitude is reduced; furthermore, quantum circuits based on Karatsuba polynomial modular multiplication can be constructed. Here, the Karatsuba algorithm is transformed into quantum circuit construction, and the required quantum gate depth is reduced by n compared to the previous polynomial multiplication. 1 / 3 The magnitude is enormous. Furthermore, building this quantum circuit only requires simple CNOT gates.

[0044] This application provides a method for constructing quantum circuits, modular multiplication quantum circuits, a quantum chip system, a quantum computer, and a classical computer to improve related technologies. This application implements a quantum circuit based on the Karatsuba algorithm, requiring only CNOT gates, which significantly reduces the gate depth compared to previous polynomial multiplication quantum circuits. Furthermore, modular multiplication quantum circuits can be further implemented based on the polynomial multiplication quantum circuits.

[0045] It should be noted that this application uses finite fields in cryptography as an example, such as the Diffie-Hellman cryptographic algorithm over finite fields, elliptic curve cryptography over finite fields, and the application of binary field towers in block ciphers. In addition, this application can also be applied to computing scenarios in other technical fields, such as digital signal processing, computer graphics, sound and image compression, polynomial kernel methods in machine learning, efficient neural network weight training in deep learning, efficient operation of complex data structures in big data analysis, celestial trajectory calculation in astronomy, DNA sequence matching and gene editing in bioinformatics, risk model construction and high-frequency trading strategies in financial mathematics, seismic data processing and analysis in geophysics, and high-resolution image reconstruction in medical imaging. This application does not set any limitations in these areas.

[0046] This application relates to quantum computers, whose system operating environments are suitable for high-performance computing centers, research laboratories, or specialized quantum technology companies.

[0047] This application does not limit the type of quantum computer, which may include, but is not limited to, the following types.

[0048] Quantum computers based on superconducting circuits: These computers use superconducting circuits to realize qubits, resulting in high integration and fast operation speed.

[0049] Ion trap-based quantum computers: These use ion traps to realize qubits, resulting in high fidelity and long coherence time.

[0050] Quantum computers based on optical systems: These computers use optical systems to implement qubits, resulting in high parallelism and fast operation speed.

[0051] Quantum computers based on topological systems: These computers use topological systems to realize qubits, which have higher fault tolerance and longer coherence time.

[0052] (Quantum circuit construction method)

[0053] See Figure 1 , Figure 1 This is a flowchart illustrating a quantum circuit construction method provided in an embodiment of this application.

[0054] This application provides a method for constructing quantum circuits, the method including step S101.

[0055] Step S101: Construct a first quantum circuit for implementing the computation of h(x) + f(x)g(x); wherein the polynomials f(x), g(x) and h(x) are all ∈ F2[x], F2[x] is a polynomial ring defined on the binary field F2, and the quantum operations in the first quantum circuit include the CNOT operation.

[0056] It should be noted that the calculation results of polynomial multiplication, addition, modular multiplication, etc. in the embodiments of this application are also ∈ F2[x], such as h(x)+f(x)g(x), H(x)+(1+x)g(x), etc. k F(x)G(x) are both ∈ F2[x].

[0057] Quantum circuit construction refers to the process of combining various quantum gates and operations in a specific order according to a particular algorithm or problem during quantum computing. For example, applying a Hadamard gate (H gate) to |0> can construct a superposition state of |0>+|1>. Quantum circuit construction is the most fundamental aspect of quantum computing, much like logic gates in classical computing, and it forms the basis for implementing various quantum algorithms. Appropriate quantum circuit design can efficiently solve many problems that are traditionally difficult to handle, exhibiting low error rates and high speed.

[0058] Constructing the first quantum circuit for computing h(x) + f(x)g(x) refers to a specific quantum circuit design aimed at computing the polynomial h(x) plus the product of f(x) and g(x). Multiplication and addition of polynomials in finite fields are crucial operations in cryptography and coding theory. Utilizing the linear superposition and entanglement properties of quantum computing, such complex polynomial operations can be implemented more efficiently, exhibiting higher parallelism and efficiency compared to classical methods. This is particularly true for large-scale polynomial operations, significantly improving the speed of polynomial computation and making it easier to extend and adapt to more complex polynomial structures.

[0059] A field having a finite number of elements is a finite field. In cryptographic applications, finite fields can be divided into prime fields F. p (where p is a very large prime number) and binary extended field The binary field F2 is a finite field containing two elements (e.g., 0 and 1). Extending the binary field n times yields the extended binary field. The following is a brief introduction to binary extension domains. One way to represent it:

[0060] Let F2[x] be a polynomial ring defined on the binary field F2, with elements being the polynomial f(x) = a. n x n +a n-1 x n-1 +…+a1x+a0. Furthermore, the binary extended field is realized by a polynomial ring. Where m(x) is an irreducible polynomial on F2[x], and the degree of m(x) is n (i.e., deg(m(x) = n), ideal<m(x)> It can be considered as a maximal ideal of F2[x]. Let... Since m(x) is an irreducible polynomial, it is necessary that c0 = c n =1. The modular polynomial m(x) is represented by an n-dimensional array, with the highest bit defaulting to 1. This facilitates unified processing and representation on quantum circuits and saves one bit. Generally, the binary extended field is represented as:

[0061] Where a i =0 or 1, i = 0, 1, ..., n-1}.

[0062] Here you can Viewed as an n-dimensional vector space defined on F2, we choose {1, x, x...} 2 , ..., x n-1 As A basis set on the polynomial is called a polynomial basis. Therefore, The element f(x) on the vector can be represented by a vector, that is:

[0063]

[0064] Therefore, a polynomial f(x) ∈ F2[x] means that each coefficient of the polynomial f(x) is either 0 or 1. Similarly, each coefficient of the polynomials g(x) and h(x) is either 0 or 1. Polynomial operations in F2[x] have wide applications in cryptography, communications, and other fields. Their operation rules are simple, convenient for practical applications, and compatible with the binary representation of computers.

[0065] The quantum operations in the first quantum circuit include the CNOT operation, also known as the controlled NOT gate, which is a two-qubit quantum logic gate in quantum computing. In the quantum circuit, the CNOT gate can realize entanglement and logical operations between qubits.

[0066] The quantum circuit construction method provided in this application is based on the Karatsuba algorithm. Utilizing the piecewise approach of this algorithm, polynomials f(x) and g(x) are multiplied piecewise, and then added piecewise to h(x). The quantum operations used in this process include CN-OT operations, which can achieve conditional flipping between quantum states. This quantum circuit construction method not only makes the implementation of polynomial multiplication and addition efficient and concise, but also significantly reduces the required quantum gate depth and operational complexity. The use of CN-OT gates in the quantum circuit simplifies the construction, thereby achieving higher execution efficiency and stability on practical quantum computers. Compared with traditional polynomial multiplication quantum circuits, this method reduces the use of Toffoli gates, thus lowering the physical implementation requirements of quantum computers. This method provides an efficient and feasible quantum solution for complex polynomial operations. The quantum circuit construction method based on the Karatsuba algorithm provides a new computational tool for cryptography and coding theory in finite fields, enabling more efficient processing of operations in these areas. Furthermore, this method has a wide range of applications, and in addition to cryptography, it can be extended to other technical fields, such as digital signal processing and computer graphics.

[0067] For example, suppose we have three polynomials, f(x) = x, g(x) = x + 1, and h(x) = 1, where all polynomial coefficients lie in the binary field F2, meaning the coefficients can only be 0 or 1. We use the first quantum circuit constructed using this method to compute h(x) + f(x)g(x). According to the Karatsuba algorithm, f(x), g(x), and h(x) are segmented, and then subjected to corresponding quantum operations to obtain the final result, for example, h(x) + f(x)g(x) = 1 + x(x + 1) = 1 + x + x. 2 .

[0068] See also Figure 1 In some embodiments, the method further includes step S102.

[0069] Step S102: Construct a system for implementing H(x) + (1 + x) k The second quantum circuit for the computation of F(x)G(x); wherein the polynomials F(x), G(x) and H(x) are all ∈ F2[x], k is a positive integer, and the quantum operations in the second quantum circuit include the CNOT operation.

[0070] Construct a system to implement H(x)+(1+x) k The second quantum circuit for calculating f(x)g(x) is a special quantum circuit designed to perform the polynomial operation H(x) + (1 + x)g(x). kThe second quantum circuit is designed based on F(x)G(x). It provides an efficient framework for implementing polynomial operations by combining quantum gates to perform the required computations directly on the quantum state. This method can significantly accelerate polynomial operations, especially in large-scale data processing or high-complexity computations. Furthermore, because it primarily employs CNOT operations, this method simplifies the construction of the quantum circuit and improves the stability of the operation.

[0071] The method used to construct quantum circuits offers significant advantages for cryptography and other fields of high-complexity computing. First, compared to classical computers, quantum computing can process vast amounts of information in a shorter time. Second, the primary use of CNOT operations greatly simplifies quantum circuit construction, reduces error rates, and increases computational accuracy. Furthermore, this method provides the foundation for more advanced quantum algorithms, such as quantum cryptography algorithms and complex quantum simulations, advancing the commercial application of quantum computing technology and contributing to advancements in areas such as data security, financial modeling, and advanced research.

[0072] For example, suppose we have a polynomial F(x) = x 2 +1, G(x)=x 3 +1, H(x)=x 5 +1, where all polynomial coefficients lie over the binary field F2, and k = 2. Calculate H(x) + (1 + x) through the second quantum circuit. k The result obtained by f(x)G(x) is: H(x)+(1+x) k F(x)G(x)=x 7 +x 5 +x 4 +x 3 .

[0073] In some embodiments, the quantum operations in both the first and second quantum circuits include only the CNOT operation and one TOFFOLI operation.

[0074] Constructing the first and second quantum circuits using only the CNOT operation and a single TOFFOLI operation simplifies circuit complexity, improves the stability of quantum computing, reduces errors, and provides a foundation for the optimization and improvement of subsequent quantum algorithms.

[0075] In a given quantum circuit, CNOT gates are used to manipulate the states of the corresponding qubits, thereby splitting, multiplying, and merging polynomials according to the Karatsuba algorithm. The entire circuit does not introduce other types of quantum gates, ensuring computational simplicity and efficiency. Furthermore, due to the inherent properties of CNOT gates, this design fully utilizes the superposition and entanglement properties of quantum mechanics, enabling direct computation on the quantum state, avoiding the intermediate transformation steps involved in classical computation. Using only CNOT operations and one TOFF OLI operation simplifies the structure of the entire quantum circuit, reducing the complexity of implementation and maintenance. The absence of other types of quantum gates also reduces the system's error rate, thereby increasing computational stability and accuracy.

[0076] In some embodiments, the process of constructing the first quantum circuit includes: storing the coefficient arrays of f(x), g(x), and h(x) in quantum registers A to C respectively; wherein the degree of f(x) and g(x) is less than n, the degree of h(x) is less than 2n-1, the polynomial coefficients in the coefficient arrays are arranged in descending order of degree, and n is a positive integer; the number of bits in quantum registers A to C are n, n, and 2n-1 respectively; constructing the first quantum circuit using the input and output of the first quantum circuit and the CNOT operation; wherein the input of the first quantum circuit includes the coefficient arrays stored in quantum registers A to C, and the output of the first quantum circuit includes the calculation result of h(x) + f(x)g(x) stored in quantum register C.

[0077] Storing the coefficient arrays of f(x), g(x), and h(x) in quantum registers A through C respectively means storing the coefficient arrays of the polynomials f(x), g(x), and h(x) in specific quantum storage structures, namely quantum registers. The coefficient array of a polynomial is an array representing the coefficients of each term of the polynomial, arranged in descending order of the polynomial's degree. For example, for f(x) = x... 3 +x 2+1, whose coefficient array is [1,1,0,1]. The coefficient array provides a compact representation, making the storage and processing of polynomials more efficient. A quantum register is a set of qubits, similar to a register in a classical computer, but used to store and manipulate quantum information. For example, a 2-bit quantum register can store four results: |00>, |01>, |10>, or |11>. This storage method provides a quantum representation of polynomials for quantum computing, laying the foundation for subsequent quantum operations. Converting the coefficients of a polynomial into quantum form allows for efficient complex computations using quantum machines. In quantum computing, storing and processing quantum information avoids additional data conversion steps and enables efficient parallel operations using quantum superposition and entanglement.

[0078] The input of the first quantum circuit includes a coefficient array stored in quantum registers A to C. This means that the input of the first quantum circuit is determined by n and the polynomial coefficients stored in quantum registers A, B, and C, which determines the quantum state at the beginning of the quantum circuit, providing a clear starting state for the first quantum circuit and ensuring the accuracy of the calculation.

[0079] The output of the first quantum circuit includes the calculation result of h(x) + f(x)g(x) stored in the quantum register C. This means that after the calculation by the first quantum circuit, the result is stored in the quantum register C to facilitate subsequent calculations or measurements. For example, the result stored in the quantum register C is 11000.

[0080] In this embodiment, the coefficient arrays of polynomials f(x), g(x), and h(x) are first stored in quantum registers A, B, and C, respectively. Next, polynomial operations are performed through specific quantum operations, such as CNOT operations. After processing by the first quantum circuit, the result of calculating h(x) + f(x)g(x) is stored in quantum register C. This method combines the ideas of the Karatsuba algorithm with quantum computing, efficiently implementing polynomial multiplication.

[0081] Using the aforementioned quantum circuit construction method, a first quantum circuit can be constructed to rapidly and efficiently perform polynomial calculations in a quantum environment. This efficiency far surpasses classical computation methods, especially when the polynomial degree is very large. By storing the polynomial coefficients in a quantum register, the parallelism and entanglement of quantum computing can be directly utilized to complete the calculation, significantly reducing computation time. Furthermore, this method is highly scalable; it can adapt to polynomials of different degrees and complexities by adjusting the quantum circuit, demonstrating significant application potential in complex computational scenarios such as cryptography.

[0082] In some embodiments, the process of the first quantum circuit calculating h(x) + f(x)g(x) includes:

[0083] S1: Use n, A[0,…,n-1], B[0,…,n-1], and C[0,…,2n-2] as inputs to the first quantum circuit; when n>1, let... The decomposition yields f(x) = f0(x) + f1(x)x k g(x) = g0(x) + g1(x)x k ,α(x)=f0(x)g0(x)=α0(x)+α1(x)x k , β(x)=f1(x)g1(x)=β0(x)+β1(x)x k , γ(x)=(f0(x)+f1(x))(g0(x)+g1(x))=γ0(x)+γ1(x)x k h(x) = h0(x) + h1(x)x k +h2(x)x 2k +h3(x)x 3k Execute S2; when n=1, let k=0 and execute S6;

[0084] S2: Invoke the second quantum circuit so that C[0,…,k-1] stores h0(x)+α0(x), C[k,…,2k-1] stores h1(x)+α0(x)+α1(x)+β0(x), C[2k,…,3k-1] stores h2(x)+α1(x)+β0(x)+β1(x), and C[3k,…,2n-2] stores h3(x)+β1(x);

[0085] S3: Perform a CNOT operation so that A[0,…,nk-1] stores f0(x)+f1(x) and B[0,…,nk-1] stores g0(x)+g1(x);

[0086] S4: Invoke the first quantum circuit so that C[k,…,2k-1] stores h1(x)+α0(x)+α1(x)+β0(x)+γ0(x), and C[2k,…,3k-1] stores h2(x)+α1(x)+β0(x)+β1(x)+γ1(x); where, A[0,…,k-1], B[0,…,k-1], and C[k,…,3k-1] are used as inputs to the first quantum circuit, and C[k,…,3k-1] is used as the output of the first quantum circuit.

[0087] S5: Perform a CNOT operation so that B[0,…,nk-1] stores g0(x)+g1(x) and A[0,…,nk-1] stores f0(x)+f1(x);

[0088] S6: Perform the TOFFOLI operation and use C[0,…,2n-2] as the output of the first quantum circuit.

[0089] In some embodiments, the process of invoking the second quantum circuit in step S2 includes:

[0090] The second quantum circuit is invoked so that C[0,…,k-1] stores h0(x)+α0(x), C[k,…,2k-1] stores h1(x)+α0(x)+α1(x), and C[2k,…,3k-1] stores h2(x)+α1(x); wherein k, A[0,…,k-1], B[0,…,k-1], and C[0,…,3k-1] are used as inputs to the second quantum circuit, and C[0,…,3k-1] is used as the output of the second quantum circuit.

[0091] The second quantum circuit is invoked so that C[k,…,2k-1] stores h1(x)+α0(x)+α1(x)+β0(x), C[2k,…,3k-1] stores h2(x)+α1(x)+β0(x)+β1(x), and C[3k,…,2n-2] stores h3(x)+β1(x); wherein nk, A[k,…,n-1], B[k,…,n-1], and C[k,…,2n-2] are used as inputs to the second quantum circuit, and C[k,…,2n-2] is used as the output of the second quantum circuit.

[0092] In some embodiments, the process of performing the CNOT operation in step S3 includes:

[0093] Perform a CNOT operation to store f0(x)+f1(x) in A[0,…,nk-1]; where A[k,…,n-1] is used as the control bit and A[0,…,nk-1] is used as the destination bit.

[0094] Perform a CNOT operation to store g0(x)+g1(x) in B[0,…,nk-1]; where B[k,…,n-1] is used as the control bit and B[0,…,nk-1] is used as the destination bit.

[0095] In some embodiments, the process of performing the CNOT operation in step S5 includes:

[0096] Perform a CNOT operation to store g0(x)+g1(x) in B[0,…,nk-1]; where B[k,…,n-1] is used as the control bit and B[0,…,nk-1] is used as the destination bit.

[0097] Perform a CNOT operation to store f0(x)+f1(x) in A[0,…,nk-1]; where A[k,…,n-1] is used as the control bit and A[0,…,nk-1] is used as the destination bit.

[0098] In a specific application scenario, the process of the first quantum circuit calculating h(x)+f(x)g(x) includes steps U1 to U9.

[0099] U1: n, A[0,…,n-1], B[0,…,n-1], C[0,…,2n-2] are used as inputs to the first quantum circuit; when n>1, let... The decomposition yields f(x) = f0(x) + f1(x)x k g(x) = g0(x) + g1(x)x k ,α(x)=f0(x)g0(x)=α0(x)+α1(x)x k , β(x)=f1(x)g1(x)=β0(x)+β1(x)x k , γ(x)=(f0(x)+f1(x))(g0(x)+g1(x))=γ0(x)+γ1(x)x k h(x) = h0(x) + h1(x)x k +h2(x)x 2k +h3(x)x 3k Execute U2; when n=1, set k=0 and execute U9;

[0100] U2: Call the second quantum circuit so that C[0,…,k-1] stores h0(x)+α0(x), C[k,…,2k-1] stores h1(x)+α0(x)+α1(x), and C[2k,…,3k-1] stores h2(x)+α1(x); wherein k, A[0,…,k-1], B[0,…,k-1], and C[0,…,3k-1] are used as inputs to the second quantum circuit, and C[0,…,3k-1] is used as the output of the second quantum circuit;

[0101] U3: Call the second quantum circuit so that C[k,…,2k-1] stores h1(x)+α0(x)+α1(x)+β0(x), C[2k,…,3k-1] stores h2(x)+α1(x)+β0(x)+β1(x), and C[3k,…,2n-2] stores h3(x)+β1(x); wherein nk, A[k,…,n-1], B[k,…,n-1], and C[k,…,2n-2] are used as inputs to the second quantum circuit, and C[k,…,2n-2] is used as the output of the second quantum circuit;

[0102] U4: Perform a CNOT operation to store f0(x)+f1(x) in A[0,…,nk-1]; where A[k,…,n-1] is used as the control bit and A[0,…,nk-1] is used as the destination bit;

[0103] U5: Perform a CNOT operation to store g0(x)+g1(x) in B[0,…,nk-1]; where B[k,…,n-1] is used as the control bit and B[0,…,nk-1] is used as the destination bit.

[0104] U6: Invoke the first quantum circuit so that C[k,…,2k-1] stores h1(x)+α0(x)+α1(x)+β0(x)+γ0(x), and C[2k,…,3k-1] stores h2(x)+α1(x)+β0(x)+β1(x)+γ1(x); where, A[0,…,k-1], B[0,…,k-1], and C[k,…,3k-1] are used as inputs to the first quantum circuit, and C[k,…,3k-1] is used as the output of the first quantum circuit.

[0105] U7: Perform a CNOT operation to store g0(x)+g1(x) in B[0,…,nk-1]; where B[k,…,n-1] is used as the control bit and B[0,…,nk-1] is used as the destination bit;

[0106] U8: Perform a CNOT operation to store f0(x)+f1(x) in A[0,…,nk-1]; where A[k,…,n-1] is used as the control bit and A[0,…,nk-1] is used as the destination bit;

[0107] U9: Perform the TOFFOLI operation, where A[0] and B[0] are used as control bits, C[0] is used as the target bit, and C[0,…,2n-2] is used as the output of the first quantum circuit.

[0108] The first quantum circuit is used to calculate the sum of the products of polynomials h(x) and f(x) and g(x). It utilizes quantum parallelism to compute the sum of polynomial products. The first quantum circuit can be denoted as KMult, for example.

[0109] Calling a second quantum circuit refers to using a second quantum circuit to complete a specific subtask in a particular step (U2, U3) of the first quantum circuit, providing a modular solution for complex quantum computing tasks. The advantages include improved computational efficiency and reusability, and a simplified problem structure.

[0110] Calling the first quantum circuit refers to using the first quantum circuit in a specific step (U6) to complete a specific subtask, providing a recursive solution for larger computational tasks. The advantage lies in efficiently solving complex problems and improving the reusability of quantum circuits through recursion.

[0111] The TOFFOLI operation is a three-qubit quantum logic gate where the third target bit is flipped when the first two control bits are in the |1> state. For example, for an input |110>, the output after the TOFFOLI operation is |111>.

[0112] The quantum circuit in this embodiment utilizes the parallelism of quantum computing to efficiently perform polynomial multiplication and summation. By storing the polynomial coefficient array in a quantum register, product and addition operations are implemented through specific quantum operations (such as CNOT and TOFFOLI operations). The first quantum circuit needs to call the second quantum circuit and recursively call itself, processing a portion of the polynomial calculation each time until the complex computational task is completed.

[0113] This design enables efficient and accurate polynomial computation. First, utilizing this quantum circuit, polynomial products and sums can be computed in parallel in a short time, fully leveraging the properties of quantum computing, such as superposition and entanglement, thereby significantly improving computational speed and efficiency. In cryptography, fast polynomial computation is crucial for some algorithms, such as those based on elliptic curve cryptography. Second, this method provides a modular computation approach, making the algorithm clearer and easier to understand. The modular and recursive design of this method makes it highly reusable and applicable to various complex computational tasks. Furthermore, since only CNOT operations, TOFFOLI operations, and basic quantum circuit calls are used throughout the process, the possibility of errors is reduced, and the stability of the computation is improved. Applying it to cryptography enables faster and more accurate data processing and analysis, meeting the high standards required for complex computational scenarios such as modern cryptography.

[0114] As an example, suppose n = 4, f(x) = x + x2 g(x) = x + x 3 h(x) = 1 + x 6 The powers of f(x) and g(x) are both less than 4, and the power of h(x) is less than 7. The number of bits in quantum registers A through C are 4, 4, and 7, respectively. Store the f(x) coefficient array [0,1,1,0] in quantum register A, A[3]=0, A[2]=1, A[1]=1, A[0]=0, A[0,…,3]=0110; store the g(x) coefficient array [1,0,1,0] in quantum register B, B[3]=1, B[2]=0, B[1]=1, B[0]=0, B[0,…,3]=0101; store the h(x) coefficient array [1,0,0,0,0,0,1] in quantum register C, C[6]=1, C[5]=0, C[4]=0, C[3]=0, C[2]=0, C[1]=0, C[0]=1, C[0,…,6]=1000001.

[0115] Since n = 4 > 1, let We get the following breakdown: f0(x) = x, f1(x) = 1; g0(x) = x, g1(x) = x; α(x) = x 2 , α0(x)=0, α1(x)=1; β(x)=x, β0(x)=x, β1(x)=0; γ(x)=0, γ0(x)=0, γ1(x)=0; h0(x)=1, h1(x)=0, h2(x)=0, h3(x)=1.

[0116] The second quantum circuit is invoked so that C[0,1] stores 01, C[2,3] stores 01, and C[4,5] stores 01; wherein k=2, A[0,1], B[0,1], and C[0,…,5] are used as inputs to the second quantum circuit, and C[0,…,5] is used as output of the second quantum circuit;

[0117] The second quantum circuit is invoked so that C[2,3] stores 11, C[4,5] stores 11, and C[6] stores 1; wherein nk=2, A[2,3], B[2,3], and C[2,…,6] are used as inputs to the second quantum circuit, and C[2,…,6] is used as output of the second quantum circuit;

[0118] Perform a CNOT operation to store 11 in A[0,1]; where A[2,3] is used as the control bit and A[0,1] is used as the target bit;

[0119] Perform a CNOT operation to store 00 in B[0,1]; where B[2,3] is used as the control bit and B[0,1] is used as the destination bit;

[0120] Call the first quantum circuit so that C[2,3] stores 11 and C[4,5] stores 11; where, A[0,1], B[0,1], and C[2,…,5] are used as inputs to the first quantum circuit, and C[2,…,5] is used as the output of the first quantum circuit. During the continuous use of the first quantum circuit, when n>1, the change in n is a continuous decrease from n to... Finally, n=1 is reached. When n=1, k=0 is set and TOFFOLI operation is performed, where A[0] and B[0] are used as control bits and C[0] is used as target bits.

[0121] Perform a CNOT operation to store 0 and 1 in B[0,1]; where B[2,3] is used as the control bit and B[0,1] is used as the target bit;

[0122] Perform a CNOT operation to store 01 in A[0,1]; where A[2,3] is used as the control bit and A[0,1] is used as the target bit.

[0123] After completing the above calculations, C[0,…,6] stores 1011111, and the result stored in the quantum register C corresponds to the calculation result 1+x of h(x)+f(x)g(x). 2 +x 3 +x 4 +x 5 +x 6 .

[0124] As another example, suppose n = 2, f(x) = x, g(x) = 1 + x, h(x) = x 2 The powers of f(x) and g(x) are both less than 2, and the power of h(x) is less than 3. The number of bits in quantum registers A to C are 2, 2, and 3, respectively. The coefficient array [0,1] of f(x) is stored in quantum register A, A[0,1] = 01; the coefficient array [1,1] of g(x) is stored in quantum register B, B[0,1] = 11; and the coefficient array [0,0,1] of h(x) is stored in quantum register C, C[0,1,2] = 001.

[0125] Since n = 2 > 1, let Split into: f0(x)=0, f1(x)=1; g0(x)=1, g1(x)=1; α(x)=0, α0(x)=0, α1(x)=0; β(x)=1, β0 (x)=1, β1(x)=0; γ(x)=0, γ0(x)=0, γ1(x)=0; h0(x)=0, h1(x)=0, h2(x)=1, h3(x)=0.

[0126] The second quantum circuit is invoked so that C[0] stores 0, C[1] stores 0, and C[2] stores 1; wherein k=1, A[0], B[0], and C[0,1,2] are used as inputs to the second quantum circuit, and C[0,1,2] is used as output of the second quantum circuit;

[0127] The second quantum circuit is invoked so that C[1] stores 1 and C[2] stores 0; wherein nk=1, A[1], B[1], C[1,2] are used as inputs to the second quantum circuit and C[1,2] is used as output of the second quantum circuit;

[0128] Perform a CNOT operation to store 1 in A[0]; where A[1] is used as the control bit and A[0] is used as the target bit;

[0129] Perform a CNOT operation to store 0 in B[0]; where B[1] is used as the control bit and B[0] is used as the target bit;

[0130] Invoke the first quantum circuit, wherein, A[0], B[0], and C[1,2] are used as inputs to the first quantum circuit, and C[1,2] is used as the output of the first quantum circuit. Since n=1, let k=0 and perform a TOFFOLI operation to make C[0] store 0, where A[0] and B[0] are used as control bits and C[0] is used as the target bit.

[0131] Perform a CNOT operation to store 1 in B[0]; where B[1] is used as the control bit and B[0] is used as the target bit;

[0132] Perform a CNOT operation to store 0 in A[0]; where A[1] is used as the control bit and A[0] is used as the target bit.

[0133] After completing the above calculations, C[0,1,2] stores 010, and the result stored in the quantum register C corresponds to the calculation result x of h(x)+f(x)g(x).

[0134] In some embodiments, the process of constructing the second quantum circuit includes: storing the coefficient arrays of F(x), G(x), and H(x) in quantum registers A to C respectively; wherein the degree of F(x) and G(x) is less than m, the degree of H(x) is less than k+2m-1, the polynomial coefficients in the coefficient arrays are arranged in descending order of degree, m and k are positive integers, and k≥m; the number of bits in quantum registers A to C are m, m, and k+2m-1 respectively; constructing the second quantum circuit using the input and output of the second quantum circuit and the CNOT operation; wherein the input of the second quantum circuit includes the coefficient arrays stored in quantum registers A to C, and the output of the second quantum circuit includes H(x)+(1+x) stored in quantum register C. k The calculation results of F(x)G(x).

[0135] In some embodiments, the second quantum circuit calculates H(x) + (1 + x) k The process of F(x)G(x) includes:

[0136] R1: Take k, A[0,…,m-1], B[0,…,m-1], and C[0,…,k+2m-2] as inputs to the second quantum circuit; when m>1, decompose to obtain (FG)(x)=F(x)G(x)=(FG)0(x)+(FG)1(x)x k H(x) = H0(x) + H1(x)x k +H2(x)x 2k Execute R2; when m = 1, execute R5;

[0137] R2: Perform a CNOT operation so that C[k,…,k+l-1] stores H1(x)+H2(x) and C[0,…,k-1] stores H0(x)+H1(x)+H2(x);

[0138] R3: Call the first quantum circuit so that C[k,…,2k-1] stores H1(x)+H2(x)+(FG)0(x) and C[2k,…,2k+l-1] stores H2(x)+(FG)1(x); wherein A[0,…,m-1], B[0,…,m-1], and C[k,…,2k+l-1] are used as inputs to the first quantum circuit, and C[k,…,2k+l-1] is used as the output of the first quantum circuit;

[0139] R4: Perform a CNOT operation so that C[0,…,k-1] stores H0(x)+(FG)0(x) and C[k,…,k+l-1] stores H1(x)+(FG)0(x)+(FG)1(x);

[0140] R5: Perform CNOT and TOFFOLI operations, and use C[0,…,k+2m-2] as the output of the second quantum circuit.

[0141] In some embodiments, the process of performing the CNOT operation in step R2 includes:

[0142] Perform a CNOT operation to store H1(x)+H2(x) in C[k,…,k+l-1]; where C[2k,…,2k+l-1] is used as the control bit and C[k,…,k+l-1] is used as the target bit; l=max{0,2m-1-k};

[0143] Perform a CNOT operation to store H0(x)+H1(x)+H2(x) in C[0,…,k-1]; where C[k,…,2k-1] is used as the control bit and C[0,…,k-1] is used as the destination bit.

[0144] In some embodiments, the process of performing the CNOT operation in step R4 includes:

[0145] Perform a CNOT operation to store H0(x)+(FG)0(x) in C[0,…,k-1]; where C[k,…,2k-1] is used as the control bit and C[0,…,k-1] is used as the destination bit.

[0146] Perform a CNOT operation to store H1(x)+(FG)0(x)+(FG)1(x) in C[k,…,k+l-1]; wherein C[2k,…,2k+l-1] is used as the control bit, C[k,…,k+l-1] is used as the target bit, and C[0,…,k+2m-2] is used as the output of the second quantum circuit.

[0147] In some embodiments, the process of performing the CNOT operation and the TOFFOLI operation in step R5 includes:

[0148] Perform a CNOT operation; where C[k] is used as the control bit and C[0] is used as the target bit;

[0149] Perform the TOFFOLI operation; where A[0] and B[0] are used as control bits and C[k] is used as the target bit;

[0150] Perform a CNOT operation, where C[k] is used as the control bit, C[0] is used as the target bit, and C[0,…,k+2m-2] is used as the output of the second quantum circuit.

[0151] In a specific application scenario, the second quantum circuit calculates H(x) + (1 + x)k The process of F(x)G(x) includes steps W1 to W9.

[0152] W1: Take k, A[0,…,m-1], B[0,…,m-1], and C[0,…,k+2m-2] as inputs to the second quantum circuit; when m>1, decompose to obtain (FG)(x)=F(x)G(x)=(FG)0(x)+(FG)1(x)x k H(x) = H0(x) + H1(x)x k +H2(x)x 2k Execute W2; when m=1, execute W7;

[0153] W2: Perform a CNOT operation to store H1(x)+H2(x) in C[k,…,k+l-1]; where C[2k,…,2k+l-1] is used as the control bit and C[k,…,k+l-1] is used as the target bit; l=max{0,2m-1-k};

[0154] W3: Perform a CNOT operation to store H0(x)+H1(x)+H2(x) in C[0,…,k-1]; where C[k,…,2k-1] is used as the control bit and C[0,…,k-1] is used as the destination bit.

[0155] W4: Call the first quantum circuit so that C[k,…,2k-1] stores H1(x)+H2(x)+(FG)0(x) and C[2k,…,2k+l-1] stores H2(x)+(FG)1(x); wherein A[0,…,m-1], B[0,…,m-1], and C[k,…,2k+l-1] are used as inputs to the first quantum circuit, and C[k,…,2k+l-1] is used as the output of the first quantum circuit;

[0156] W5: Perform a CNOT operation to store H0(x)+(FG)0(x) in C[0,…,k-1]; where C[k,…,2k-1] is used as the control bit and C[0,…,k-1] is used as the destination bit;

[0157] W6: Perform a CNOT operation to store H1(x)+(FG)0(x)+(FG)1(x) in C[k,…,k+l-1]; where C[2k,…,2k+l-1] is used as the control bit, C[k,…,k+l-1] is used as the target bit, and C[0,…,k+2m-2] is used as the output of the second quantum circuit;

[0158] W7: Perform CNOT operation; where C[k] is used as the control bit and C[0] is used as the target bit;

[0159] W8: Perform TOFFOLI operation; where A[0] and B[0] are used as control bits and C[k] is used as the target bit;

[0160] W9: Perform CNOT operation, where C[k] is used as the control bit, C[0] is used as the target bit, and C[0,…,k+2m-2] is used as the output of the second quantum circuit.

[0161] In this embodiment, quantum registers A, B, and C are used to store the coefficient arrays of polynomials F(x), G(x), and H(x). A second quantum circuit is designed to accept specific inputs and perform computations through a series of CNOT and TOFFOLI operations. This second quantum circuit utilizes the parallelism of quantum computing to process multiple parts of the polynomial simultaneously, decomposing the complex polynomial computation problem into smaller, more manageable subtasks through a hierarchical and modular approach. The second quantum circuit can be, for example, denoted as Multxk.

[0162] The advantages of this approach are severalfold. First, it leverages the powerful parallelism of quantum computing, allowing the simultaneous computation of multiple polynomial coefficients and significantly increasing computational speed. Second, this decomposition strategy makes the problem more modular, improving algorithm reusability and providing room for future optimization and expansion. For example, from a cryptographic perspective, it offers higher computational efficiency for polynomial-based cryptographic algorithms, thereby increasing the speed of encryption, decryption, and key exchange. Furthermore, by breaking down multiple tasks into smaller subtasks, this method provides a better platform for error correction, as errors in any subtask can potentially be corrected in subsequent steps. Finally, the modular nature of this approach makes it easily compatible with other quantum computing or cryptographic methods, providing flexibility and adaptability for applications across multiple fields.

[0163] For example, suppose k = 2, m = 2, l = 1, F(x) = x, G(x) = 1 + x, H(x) = x 4 The exponents of F(x) and G(x) are both less than 2, and the exponent of H(x) is less than 5. The number of bits in quantum registers A to C are 2, 2, and 5, respectively. The coefficient array [0,1] of F(x) is stored in quantum register A, A[0,1]=01; the coefficient array [1,1] of G(x) is stored in quantum register B, B[0,1]=11; and the coefficient array [1,0,0,0,0] of H(x) is stored in quantum register C, C[0,1,2,3,4]=00001.

[0164] Since m = 2 > 1, we can decompose it to obtain: (FG)(x) = x + x 2, (FG)0(x)=x, (FG)1(x)=1; H0(x)=0, H1(x)=0, H2(x)=1.

[0165] Perform a CNOT operation to store 1 in C[2]; where C[4] is used as the control bit and C[2] is used as the target bit;

[0166] Perform a CNOT operation to store 10 in C[0,1]; where C[2,3] is used as the control bit and C[0,1] is used as the target bit;

[0167] The first quantum circuit is invoked so that C[2,3] stores 11 and C[4] stores 0; wherein A[0,1], B[0,1], and C[2,3,4] are used as inputs to the first quantum circuit and C[2,3,4] is used as output of the first quantum circuit.

[0168] Perform a CNOT operation to store 0 and 1 in C[0,1]; where C[2,3] is used as the control bit and C[0,1] is used as the target bit.

[0169] Perform a CNOT operation to store 1 in C[2]; wherein C[4] is used as the control bit, C[2] is used as the target bit, and C[0, ..., 4] is used as the output of the second quantum circuit.

[0170] After completing the above calculations, C[0, 1, 2, 3, 4] stores 01110, and the result stored in the quantum register C corresponds to H(x) + (1 + x k The calculation results of F(x)G(x)x 3 +x 2 +x.

[0171] See Figure 2 , Figure 2 This is an example diagram of a constant modular multiplication quantum circuit provided in an embodiment of this application.

[0172] Since polynomial operations on the binary extended field F2[x] / (m(x)) can all be represented by vectors, and multiplying any polynomial q(x) by a fixed polynomial s(x) is equivalent to a linear transformation, i.e. Where Z is a matrix, and q is the column vector representation of q(x). Z is a polynomial basis {1, x, x} consisting of polynomial s(x) multiplied by F2[x] / (m(x)). 2 , ...x n-1 The generated matrix. To correspond to the order of high-order bits to low-order bits in the quantum circuit, the vector representation of the polynomial is also set to high-order bits to low-order bits from top to bottom. The specific steps for generating Z are as follows: calculate s(x)·x respectively. n-1mod m(x), s(x)·x n-2 mod m(x), ..., s(x)·1 mod m(x); The calculated results are sequentially arranged into column vectors {v n-1 v n-2 The constant modular multiplication (V0, ..., V0) is arranged from left to right, resulting in an n*n square matrix. Therefore, calculating the constant modular multiplication is equivalent to writing it as a matrix, and this matrix is ​​a linear transformation matrix. We can perform LUP decomposition on the matrix and decompose the resulting L / U / P matrix onto the quantum circuit. Only CNOT and SWAP gates are needed to implement the constant modular multiplication quantum circuit. The specific quantum circuit implementation is as follows... Figure 2 As shown.

[0173] See also Figure 1 In some embodiments, the method further includes step S103.

[0174] Step S103: Construct a third quantum circuit for calculating s(x)q(x)mod m(x); where s(x) = 1 + x k The quantum operations in the third quantum circuit include CNOT and SWAP operations.

[0175] The quantum operations in the third quantum circuit include the CNOT and SWAP operations, meaning these two quantum operations are used when constructing the quantum circuit. The CNOT operation is a controlled NOT gate; for two qubits, one is the control qubit and the other is the target qubit. When the control qubit is 1, the target qubit is flipped. The SWAP operation is used to swap the states of the two qubits. The third quantum circuit is used to perform multiplication (1+x). k The inverse operation of the third quantum circuit is used to perform division (1+x). k ) operation (that is, multiplying by (1+x) k ) -1 (Operation). The third quantum circuit can be denoted as ConstModMult, for example.

[0176] In some embodiments, the process of constructing the third quantum circuit includes generating a matrix Z such that s(x)q(x)mod m(x) is transformed into Zq; where q is the column vector representation of q(x); performing LUP decomposition on matrix Z to obtain L matrix, U matrix and P matrix; and setting the P matrix, U matrix and L matrix in sequence to obtain the third quantum circuit.

[0177] Matrix Z is decomposed using LUP (Low Triangular Protection) to obtain matrices L, U, and P. LUP is a matrix decomposition technique used to decompose a matrix into three components: a lower triangular matrix L, an upper triangular matrix U, and a permutation matrix P. LUP decomposition provides an efficient method for solving systems of linear equations, calculating matrix inverses and determinants, and other linear algebra problems, enabling more efficient handling of systems of linear equations and inverse matrix calculations in quantum computing. The order of matrices P, U, and L ensures the correct operational order of these three matrices in the quantum circuit, guaranteeing that the quantum circuit can accurately and efficiently compute the desired results.

[0178] The third quantum circuit leverages the parallel nature of quantum computing to compute s(x)q(x)mod m(x). First, the generating matrix Z transforms polynomial multiplication into matrix-vector multiplication, making the computation more intuitive and efficient. Next, to further simplify and optimize the computation process, LUP decomposition is used to decompose matrix Z into L, U, and P matrices. This decomposition provides a framework for efficiently handling linear equations and inverse matrix calculations in the quantum circuit. Finally, by properly setting the order of these three matrices, the accuracy of the quantum circuit's computation is ensured.

[0179] In this embodiment, due to the use of matrix and vector multiplication, this method is more intuitive and faster than traditional polynomial multiplication. Furthermore, LUP decomposition provides a powerful tool that not only makes computation more efficient but also improves its stability and accuracy. For applications requiring frequent polynomial multiplication, such as cryptography and quantum algorithm design, this method can significantly improve performance.

[0180] For example, suppose m(x) = x 3 +x+1, q(x) represents Given a polynomial s(x) = 1 + x k , k = 2, calculate (1 + x 2 )q(x)mod m(x).

[0181] Step 1: Generate matrix Z. First, calculate (1+x) 2 )mod m(x), (1+x) 2 )*x mod m(x), (1+x 2 )mod m(x). Represented as vectors [0,1,0], [0,0,1], [1,0,1].

[0182] Step 2: Arrange the vectors from left to right according to their column vectors, resulting in:

[0183]

[0184] Step 3: Perform LUP decomposition on Z to obtain Z = LUP:

[0185]

[0186] Step 4: Decompose L, U, and P onto the quantum circuit, where L / U only requires CNOT gate operations and P only requires SWAP gate operations.

[0187] By performing quantum operations corresponding to the P / U / L matrices on the quantum state, we can obtain (1+x) 2 The result of q(x) mod m(x).

[0188] The process of decomposing L, U, and P onto a quantum circuit can be illustrated as follows.

[0189] Since the elements of the P-type, L-type, and U-type matrices are all taken from {0,1}, the permutation matrix P can be implemented in a quantum circuit using SWAP gates, while the lower triangular matrix L and the upper triangular matrix U can be implemented in a quantum circuit using CNOT gates. Furthermore, for an n*n triangular matrix, converting it into a quantum circuit requires at most n*(n-1) / 2 CNOT gates.

[0190] See Figure 3 , Figure 3 This is an example diagram of a quantum circuit corresponding to an L matrix provided in an embodiment of this application.

[0191] For example, the L matrix is:

[0192]

[0193] The corresponding quantum circuit can be transformed as follows: find all non-zero elements excluding the diagonal, and list these elements in lexicographical order with the horizontal axis as the priority:

[0194] a 20 =a 21 =a 30 =1.

[0195] Where a 20 =1 indicates that a CNOT gate is established between the first and third qubits, a 21 =1 indicates that a CNOT gate is established between the second and third qubits, and so on for the remaining elements. ij =1 indicates that the (i+1)th qubit and the (j+1)th qubit will form a CNOT gate, with the control bit always on top and the target bit always on the bottom. The above L matrix can be fully implemented as a quantum circuit, as shown below. Figure 3 As shown.

[0196] The function of the L-shaped matrix mentioned above is:

[0197]

[0198] Correspondingly, the quantum circuit above can achieve the transformation between quantum states as follows:

[0199]

[0200] Therefore, the quantum circuit above is consistent with the left multiplication of the L-type matrix.

[0201] Similarly, the U-shaped matrix can also be decomposed into the aforementioned quantum circuits. The difference from the L-shaped decomposition is that in the U-shaped decomposition into CNOT gates, the control bit is always at the bottom and the target bit is always at the top. Furthermore, the decomposition of the permutation matrix P is, for example, for non-zero a... ij This is equivalent to establishing a SWAP gate between the (i+1)th and (j+1)th qubits. By sequentially concatenating the quantum circuits corresponding to the P, U, and L matrices, the L, U, and P can be decomposed into quantum circuits.

[0202] See also Figure 1 In some embodiments, the method further includes steps S104 to S105.

[0203] Step S104: Construct a fourth quantum circuit for implementing the calculation of r(x)t(x)mod m(x); where r(x) = x, and the quantum operations in the fourth quantum circuit include the CNOT operation and the SWAP operation.

[0204] Step S105: Based on the first quantum circuit, the second quantum circuit, the third quantum circuit, and the fourth quantum circuit, construct a modular multiplication quantum circuit for calculating h(x) + f(x)g(x)mod m(x).

[0205] The fourth quantum circuit is used to perform multiplication by x, and its inverse operation is used to perform division by x. The fourth quantum circuit can be denoted as BinaryShift, for example.

[0206] The left shift *x modular multiplication operation can be implemented using simple CNOT and SWAP gates, requiring only n bits of local circuitry. The specific implementation idea is as follows: Let... Since m(x) is an irreducible polynomial, let c have t positions besides the highest and lowest bits. i =1, let c be 1. i Redefining it as {c it}, where t is an even number and less than n-1.

[0207]

[0208] According to the above formula, the non-zero i bits (excluding the highest and lowest bits) of the modular polynomial can be used to perform CNOT gate operations on the (i-1) bits of the polynomial g(x), and then SWAP gate operations are performed from left to right.

[0209] See Figure 4 , Figure 4 This is an example diagram of a fourth quantum circuit provided in an embodiment of this application.

[0210] For example, the polynomial t(x) = m(x) = x 3 +x+1,m(x)=x 4 +x 3 +x 2 The expression `+x+1` achieves `t(x)*x mod m(x)`. Using an array, this can be represented as: `t(x) = [1,0,1,1]`, `m(x) = [1,1,1,1]` (the highest bit is assumed to be 1 and omitted), thus `t(x)*x mod m(x) = [1,0,1,0]`. The specific implementation steps are as follows: Given the x-values ​​of `m(x)`... 3 ,x 2 If the coefficients of all terms x are 1, then for each x term in t(x), the coefficients of x are successively... 2 ,x 1 ,x 0 The terms are respectively with respect to t(x) and x 3 A controlled addition operation is performed on the term coefficient (which is 1 at this point) to obtain [1,1,0,0]; subsequently, [1,1,0,0] is swapped from left to right to obtain the result [1,0,0,1]. Its quantum circuit diagram is as follows: Figure 4 As shown.

[0211] In some embodiments, the process of constructing the modular multiplication quantum circuit includes: storing the coefficient arrays of f(x), g(x), and h(x) in quantum registers A to C respectively; wherein the degrees of f(x), g(x), and h(x) are all less than n, the polynomial coefficients in the coefficient arrays are arranged in descending order of degree, and n is a positive integer; the number of bits in quantum registers A to C is n; the modular multiplication quantum circuit is constructed using the input and output of the modular multiplication quantum circuit, the first quantum circuit to the fourth quantum circuit, and the CNOT and SWAP operations; wherein the input of the modular multiplication quantum circuit includes the coefficient arrays stored in quantum registers A to C, and the output of the modular multiplication quantum circuit includes the calculation result of h(x) + f(x)g(x)mod m(x) stored in quantum register C.

[0212] In some embodiments, the computation process of the modular multiplication quantum circuit includes steps T1 to T11.

[0213] T1: Invoke the inverse operation of the fourth quantum circuit k times to perform k division by x operations, so that C[0,…,n-1] stores h(x) / x k mod m(x); where,

[0214] T2: Perform CNOT operation; where A[k,…,n-1] is used as the control bit and A[0,…,nk-1] is used as the target bit;

[0215] T3: Perform CNOT operation; where B[k,…,n-1] is used as the control bit and B[0,…,nk-1] is used as the target bit;

[0216] T4: Invoke the first quantum circuit to store h(x) / x in C[0,…,n-1]. k +γ(x)mod m(x); where k, A[0,…,k-1], B[0,…,k-1], C[0,…,n-1] are used as inputs to the first quantum circuit, and C[0,…,n-1] is used as the output of the first quantum circuit;

[0217] T5: Perform CNOT operation; where B[k,…,n-1] is used as the control bit and B[0,…,nk-1] is used as the target bit;

[0218] T6: Perform CNOT operation; where A[k,…,n-1] is used as the control bit and A[0,…,nk-1] is used as the target bit;

[0219] T7: Invoke the inverse operation of the third quantum circuit to perform division (1+x) k ) operation, so that C[0,…,n-1] stores (h(x) / x k +γ(x))(1+x k ) -1 mod m(x);

[0220] T8: Invoke the first quantum circuit to make C[0,…,n-1] store (h(x) / x) k +γ(x))(1+x k ) -1 +βmod m(x); where nk, A[k,…,n-1], B[k,…,n-1], and C[0,…,n-1] are used as inputs to the first quantum circuit, and C[0,…,n-1] is used as the output of the first quantum circuit;

[0221] T9: Call the fourth quantum circuit k times to perform k multiplications of x, so that C[0,…,n-1] stores ((h(x) / x) k +γ(x))(1+x k ) -1 +β)x k mod m(x);

[0222] T10: Invoke the first quantum circuit to store α+((h(x) / x) in C[0,…,n-1]. k +γ(x))(1+x k ) -1 +β)x k mod m(x); where k, A[0,…,k-1], B[0,…,k-1], C[0,…,n-1] are used as inputs to the first quantum circuit, and C[0,…,n-1] is used as the output of the first quantum circuit;

[0223] T11: Invoke the third quantum circuit to perform multiplication (1+x) k Operations are performed to make C[0,…,n-1] store (1+x) k )(α+((h(x) / x k +γ(x))(1+x k ) -1 +β)x k )mod m(x), that is, h(x)+f(x)g(x)mod m(x).

[0224] Therefore, modular multiplication quantum circuits can compute modular multiplication and modular addition of polynomials over a binary field. If only f(x)g(x)mod m(x) is considered, step T1 can be omitted.

[0225] See also Figure 1 In a specific application scenario, this application embodiment also provides a quantum circuit construction method, the method comprising:

[0226] Step S101: Construct a first quantum circuit for implementing the computation of h(x) + f(x)g(x); wherein the polynomials f(x), g(x) and h(x) are all ∈ F2[x], F2[x] is a polynomial ring defined on the binary field F2, and the quantum operations in the first quantum circuit include the CNOT operation;

[0227] Step S102: Construct a system for implementing H(x) + (1 + x) k The second quantum circuit for the computation of F(x)G(x); wherein the polynomials F(x), G(x) and H(x) are all ∈ F2[x], k is a positive integer, and the quantum operations in the second quantum circuit include the CNOT operation;

[0228] Step S103: Construct a third quantum circuit for calculating s(x)q(x)mod m(x); where s(x) = 1 + x k The quantum operations in the third quantum circuit include CNOT and SWAP operations;

[0229] Step S104: Construct a fourth quantum circuit for calculating r(x)t(x)mod m(x); where r(x) = x, and the quantum operations in the fourth quantum circuit include CNOT and SWAP operations;

[0230] Step S105: Based on the first quantum circuit, the second quantum circuit, the third quantum circuit, and the fourth quantum circuit, construct a modular multiplication quantum circuit for calculating h(x) + f(x)g(x)mod m(x).

[0231] The process of constructing the first quantum circuit includes: storing the coefficient arrays of f(x), g(x), and h(x) in quantum registers A to C respectively; wherein the degree of f(x) and g(x) is less than n, and the degree of h(x) is less than 2n-1, and the polynomial coefficients in the coefficient arrays are arranged in descending order of degree, where n is a positive integer; the number of bits in quantum registers A to C are n, n, and 2n-1 respectively; constructing the first quantum circuit using the input and output of the first quantum circuit and the CNOT operation; wherein the input of the first quantum circuit includes the coefficient arrays stored in quantum registers A to C, and the output of the first quantum circuit includes the calculation result of h(x) + f(x)g(x) stored in quantum register C.

[0232] The process of constructing the second quantum circuit includes: storing the coefficient arrays of F(x), G(x), and H(x) in quantum registers A to C respectively; wherein the degrees of F(x) and G(x) are both less than m, and the degree of H(x) is less than k+2m-1, the polynomial coefficients in the coefficient arrays are arranged in descending order of degree, m and k are positive integers, and k≥m; the number of bits in quantum registers A to C are m, m, and k+2m-1 respectively; the second quantum circuit is constructed using the input and output of the second quantum circuit and the CNOT operation; wherein the input of the second quantum circuit includes the coefficient arrays stored in quantum registers A to C, and the output of the second quantum circuit includes H(x)+(1+x) stored in quantum register C. k The calculation results of F(x)G(x).

[0233] The process of constructing the third quantum circuit includes: generating a matrix Z such that s(x)q(x)mod m(x) is transformed into Zq; where q is the column vector representation of q(x); performing LUP decomposition on matrix Z to obtain L matrix, U matrix and P matrix; and setting the P matrix, U matrix and L matrix in order to obtain the third quantum circuit.

[0234] The quantum circuit construction method provided in this application employs four quantum circuits to achieve efficient computation of specific polynomial operations, while maintaining the operation on the binary field F2 throughout the computation process. In both the first and second quantum circuits, the CNOT operation is used to perform polynomial multiplication. The first quantum circuit handles the computation of h(x) + f(x)g(x), while the second quantum circuit handles H(x) + (1 + x)g(x). k The calculation of F(x)G(x) is performed. For the third and fourth quantum circuits, in addition to the CNOT operation, a SWAP operation is added to perform the modulo operation. The third quantum circuit is used to calculate s(x)q(x)mod m(x), where s(x) is a fixed polynomial 1+x. k The fourth quantum circuit handles the calculation of r(x)t(x)mod m(x), where r(x) is x. The specific idea is to use a combination of these four quantum circuits to ultimately calculate h(x) + f(x)g(x)mod m(x), i.e., to construct the modular multiplication quantum circuit. To ensure the accuracy of the calculation, each quantum circuit involves storing and processing the polynomial coefficient array during its construction.

[0235] The quantum circuit construction method proposed in this application enables the efficient and accurate implementation of complex polynomial multiplication and modular multiplication operations. This not only optimizes the performance of quantum computing but also reduces the complexity of such computations in cryptography and other applications. On one hand, by decomposing polynomial multiplication and modular multiplication into multiple subproblems and constructing specialized quantum circuits for each subproblem, the overall computation process is significantly accelerated. On the other hand, this method fully utilizes the parallelism of quantum computing, allowing multiple operations to be performed simultaneously. This parallelism gives quantum calculators a significant performance advantage when handling such problems.

[0236] As an example, constructing a variable modular multiplication quantum circuit based on the Karatsuba algorithm to calculate h(x) + f(x)g(x) mod m(x) requires four components: the first quantum circuit KMult, used to implement the polynomial multiplication h(x) + f(x)g(x) based on the Karatsuba algorithm; the second quantum circuit Multxk, used to implement the polynomial multiplication H(x) + (1 + x)g(x) based on the Karatsuba algorithm; and the third quantum circuit Multxk, used to implement the polynomial multiplication H(x) + (1 + x)g(x) mod m(x) based on the Karatsuba algorithm. k)F(x)G(x); The third quantum circuit ConstModMult, i.e., constant modular multiplication (1+x) k The quantum circuit of q(x)mod m(x); the fourth quantum circuit, BinaryShift, is the quantum circuit of constant modulo multiplication (x)t(x)mod m(x).

[0237] Let f(x), g(x), h(x) ∈ F2[x], and let the degrees of f(x) and g(x) be less than n, and the degree of h(x) be less than 2n-1. The polynomial is represented using an array, which stores the coefficients of the polynomial. It is agreed that the array stores the coefficients of the polynomial from left to right, from the most significant bit to the least significant bit, for ease of implementation on quantum circuits. The solution h(x) + f(x) * g(x) can be obtained using the Karatsuba algorithm, the specific implementation idea of ​​which is as follows:

[0238] Let k ≤ n < 2k, usually take Divide f(x) and g(x) into two parts: f(x) = f0 + f1x k g(x) = g0 + g1x k h(x) can be written as h(x) = h0 + h1x k +h2x 2k +h3x 3k From the above decomposition, we can see that the exponents of f0, f1, g0, g1, h0, h1, h2, and h3 are all less than k.

[0239] By calculating α=f0*g0, β=f1*g1 and γ=(f0+f1)*(g1+g1), we have h+f*g=h+α+(γ+α+β)x k +βx 2k .

[0240] If we divide α, β, and γ into two parts in the same way as f and g, we can obtain: h + f*g = (h0 + α0) + (h2 + α1 + β0 + β1 + γ0)x k +(h2+α1+β0+β1+γ1)x 2k +(h3+β1)x 2k Furthermore, the above formula can also be written as: h + f*g = h + (1 + x k )α+γx k +βx k (1+x k ).

[0241] Therefore, solving for h + f*g requires completing part (1 + x) k )*α or (1+x kThe calculation of 1+x*β. Therefore, implementing h+f*g requires two components: given n, f(x), g(x), h(x), calculate h+f*g; given k, f(x), g(x), h(x), where k > max{deg(f), deg(g)}, calculate h+(1+x)*β. k )*f*g. deg(f) represents the degree of a polynomial f(x), that is, the exponent of the highest power in the polynomial f(x). The quantum circuits implemented by the two components mentioned above are introduced in turn below. During the implementation process, the two need to call each other.

[0242] The second quantum circuit calculates H(x) + (1 + x) k The code flow for F(x)G(x) is as follows: (labeled as Multxk)

[0243] Given k, F(x), G(x), H(x), where deg(F), deg(G) < m, k ≥ m. Let l = max{0, 2m-1-k}, store the coefficient arrays of F(x) and G(x) in m-bit quantum registers A and B respectively. Store the coefficient array of H(x) in a k+2m-2-bit quantum register C. Note that k+2m-2 = 2k+l-1.

[0244] Algorithm 1. Implement H(x) + (1 + x) k The pseudocode for F(x)G(x) is Multxk.

[0245]

[0246] The following table shows in detail the results of each step of Algorithm 1.

[0247]

[0248] Table 1. Changes in C at each step in Algorithm 1

[0249] In Algorithm 1, C is divided into three parts with corresponding bit sizes of k, k, and l, respectively, and the corresponding H(x) = h0 + h1x. k +h2x 2k According to Table 1, the final result is: h0+(fg)0+(h1+(fg)0+(fg)1)x k +(h2+(fg)1)x 2k =h0+h1x k +h2x 2k +fg+fgx k =h+(1+x) k )fg.

[0250] Where (fg)0 is the first k terms of fg, and (fg)1 is the last nk terms of fg. Therefore, according to Algorithm 1, h + (1 + x) can be calculated. k When m=1, only 2 CNOT gates and 1 Tofoli gate are needed. Algorithm 1 requires one call to Algorithm 2. Algorithm 2 is described below.

[0251] The code flow for calculating h(x) + f(x)g(x) using the first quantum circuit is as follows: (labeled KMult)

[0252] Given that deg(f) and deg(g) < n, the coefficient arrays of f(x) and g(x) are stored in n-bit quantum registers A and B, respectively. The degree of h(x) is less than 2n-1, and the coefficient array of h(x) is stored in a 2n-1 bit quantum register C. If n > 1, let... If n = 1, k = 0.

[0253] Algorithm 2. Pseudocode for implementing h(x) + f(x)g(x): KMult.

[0254]

[0255]

[0256] The following table shows the results of each step in Algorithm 2:

[0257]

[0258] Table 2. Changes in C at each step in Algorithm 2

[0259] Based on the changes in C in Table 2 and the splitting formula of h(x), we can see that by continuously calling Algorithm 2 and Algorithm 1, we can calculate h(x) + f(x)g(x).

[0260] The basic principle of Algorithm 2 is that when it continuously calls its own algorithm KMult, the change of n is a continuous decrease from n to n. …, finally reaching n=1. When n=1, h(x)+f(x)g(x) can be realized using the Toffoli gate.

[0261] The construction process of the third quantum circuit (labeled ConstModMult) (not detailed here) is used to calculate (1+x k )q(x)mod m(x).

[0262] The construction process of the fourth quantum circuit (labeled BinaryShift) (not described here) is used to calculate (x)t(x)mod m(x).

[0263] Based on the above four components, a modular multiplication quantum circuit (labeled ModMult) is constructed for calculating h(x) + f(x)g(x)mod m(x). The coefficient arrays of f(x), g(x), and h(x) are stored in n-bit quantum registers A, B, and C, respectively.

[0264] Algorithm 3. Pseudocode ModMult for implementing h(x)+f(x)g(x)mod m(x).

[0265]

[0266]

[0267] The following table shows the results of each step in Algorithm 3 in detail:

[0268] The correctness of the algorithm can be verified by the results obtained from each step of Algorithm 3.

[0269]

[0270] Table 3. Changes in C at each step of Algorithm 3

[0271] Simplifying the last step of Algorithm 3, we know that: (1+x k )*(α+((h / x k +γ)*(1+x k ) ―1 +β)*x k )mod m=h+(1+x k )α+γx k +βx k (1+x k )mod m=h+f*g mod m.

[0272] Therefore, Algorithm 3 can calculate the modular multiplication and modular addition / modular multiplication of polynomials over a binary field. If only f*gmod m is to be calculated, the first two steps in Algorithm 3 can be omitted.

[0273] (Modal multiplication quantum circuit)

[0274] This application embodiment also provides a modular multiplication quantum circuit, which includes: a first quantum circuit for calculating h(x) + f(x)g(x); wherein the polynomials f(x), g(x) and h(x) are all ∈ F2[x], F2[x] is a polynomial ring defined on the binary field F2, and the quantum operations in the first quantum circuit include the CNOT operation.

[0275] In some embodiments, the modular multiplication quantum circuit further includes: a second quantum circuit for realizing H(x) + (1 + x)k The calculation of F(x)G(x); where the polynomials F(x), G(x) and H(x) are all ∈ F2[x], k is a positive integer, and the quantum operations in the second quantum circuit include the CNOT operation.

[0276] In some embodiments, the modular multiplication quantum circuit further includes: a third quantum circuit for calculating s(x)q(x)mod m(x); where s(x) = 1 + x k The quantum operations in the third quantum circuit include CNOT and SWAP operations.

[0277] In some embodiments, the modular multiplication quantum circuit further includes a fourth quantum circuit for calculating r(x)t(x)mod m(x); wherein r(x) = x, and the quantum operations in the fourth quantum circuit include the CNOT operation and the SWAP operation.

[0278] In some embodiments, h(x) / x is calculated via the fourth quantum circuit in the modular multiplication quantum circuit. k mod m(x), calculate h(x) / x through the first quantum circuit and the CNOT gate. k +γ(x)mod m(x), calculated via the third quantum circuit (h(x) / x) k +γ(x))(1+x k ) -1 mod m(x), calculate (h(x) / x) through the first quantum circuit. k +γ(x))(1+x k ) -1 +β(x)mod m(x), calculated via the fourth quantum circuit ((h(x) / x) k +γ(x))(1+x k ) -1 +β(x))x k mod m(x), calculate α(x)+((h(x) / x) through the first quantum circuit. k +γ(x))(1+x k ) -1 +β(x))x k mod m(x), calculated via the third quantum circuit (1+x) k )(α(x)+((h(x) / x k +γ(x))(1+x k ) -1 +β(x))x k ) mod m(x), we get h(x) + f(x)g(x) mod m(x); where f(x) = f0(x) + f1(x)xk g(x) = g0(x) + g1(x)x k ,α(x)=f0(x)g0(x)=α0(x)+α1(x)x k , β(x)=f1(x)g1(x)=β0(x)+β1(x)x k , γ(x)=(f0(x)+f1(x))(g0(x)+g1(x))=γ0(x)+γ1(x)x k The powers of f(x) and g(x) are both less than n, and the power of h(x) is less than 2n-1, where n is a positive integer.

[0279] (Quantum chip system)

[0280] See Figure 5 , Figure 5 This is a schematic diagram of the structure of a quantum chip system provided in an embodiment of this application.

[0281] This application also provides a quantum chip system, the specific implementation of which is consistent with the implementation method and the technical effects achieved in the above-described quantum circuit construction method embodiments, and some contents will not be repeated.

[0282] The quantum chip system includes at least one quantum processor, which is used to execute quantum operations corresponding to a quantum program to achieve the following steps:

[0283] The calculation of h(x) + f(x)g(x) mod m(x) is performed using a modular multiplication quantum circuit.

[0284] Among them, the polynomials f(x), g(x) and h(x) are all ∈ F2[x], and F2[x] is a polynomial ring defined on the binary field F2.

[0285] A quantum chip system is a miniature device for processing quantum information, capable of executing quantum operations corresponding to quantum programs. In this embodiment, the quantum chip system is used as the core computing component for performing polynomial modular multiplication calculations, leveraging its parallel processing capabilities to achieve efficient computation. As an example, the quantum chip system can be a superconducting quantum chip system, an ion trap quantum chip system, an optical quantum chip system, etc., including a quantum processor and peripheral devices providing quantum chip packaging.

[0286] A quantum processor is a specific hardware device that uses the principles of quantum mechanics to perform computations. Unlike traditional classical computer processors, quantum processors process qubits, not classical bits. A quantum processor, for example, has 72 qubits. The superposition capabilities and quantum entanglement of quantum processors make them more efficient than traditional computers for certain tasks, such as factorization and search problems.

[0287] A quantum program is a set of instructions written for a quantum computer to guide the quantum processor in performing specific quantum operations. Quantum programs allow researchers and engineers to operate and control quantum computers in detail, providing efficient solutions to complex problems.

[0288] Quantum operations are the fundamental operations performed on qubits, including various quantum gates and measurements. For example, applying a Pauli-X gate to a qubit flips it from the |0> state to the |1> state. Quantum operations form the basis of quantum computing, allowing users to manipulate and read quantum information, thereby enabling quantum algorithms.

[0289] (Quantum computer)

[0290] See Figure 6 , Figure 6 This is a schematic diagram of the structure of a quantum computer provided in an embodiment of this application.

[0291] This application also provides a quantum computer, the specific implementation of which is consistent with the implementation method and the technical effects achieved in the above-described quantum core method embodiments, and some contents will not be repeated.

[0292] The quantum computer includes any one of the aforementioned quantum chip system 1, measurement and control system 2, support system 3, and operating system 4. For example, a superconducting quantum computer includes components such as a 24-qubit superconducting quantum chip system 1, a quantum computing measurement and control system 2, a quantum computer operating system 3, and a quantum computing environment support system 4. Figure 6 As shown.

[0293] The quantum chip system 1 includes at least one quantum processor, which executes quantum operations corresponding to a quantum program to process qubits, thereby calculating h(x) + f(x)g(x)mod m(x) via a modular multiplication quantum circuit; wherein the polynomials f(x), g(x), and h(x) all ∈ F2[x], and F2[x] is a polynomial ring defined on the binary field F2. For example, in a superconducting quantum computer, the superconducting quantum chip system 1 based on a superconducting quantum processor is the computational core of the quantum computer, capable of executing quantum programs. This application embodiment does not limit the number of quantum processors in the quantum chip system 1; it can be, for example, one or more.

[0294] The measurement and control system 2 includes a control device and a measurement device. The control device converts the quantum program corresponding to the modular multiplication quantum circuit into corresponding control signals and sends them to the quantum processor. The measurement device measures the qubits. The quantum computing measurement and control system 2 is the control system of the quantum computer, used to control the operation of the quantum chip system 1. The quantum chip system 1 receives control signals from the measurement and control system 2, executes the quantum operations corresponding to the quantum program to process the qubits, thereby realizing the execution of the quantum program.

[0295] This application does not limit the measuring device, which may be any one or a combination of the following devices.

[0296] Superconducting measurement device: This device utilizes the properties of superconducting materials at low temperatures to measure the state of qubits. It can accurately detect changes in the quantum state in a very short time.

[0297] Optical interferometer: It measures quantum states by interfering with light, and is especially suitable for photonic qubits.

[0298] Ion trap detector: For ion trap qubit systems, this device can detect the quantum state of ions by measuring their electromagnetic frequency.

[0299] Magnetic resonance measurement device: Using magnetic resonance technology, it is possible to measure the state of specific qubits, such as spin-based qubits.

[0300] Charge measurement device: This device can detect the charge state in quantum dots or other tiny structures, thereby determining their quantum state.

[0301] Quantum dot measurement device: For quantum dot-based quantum computing systems, this device is able to measure the electronic states in the quantum dots.

[0302] Quantum state discriminator: It can identify and classify a given quantum state, thereby determining the specific state.

[0303] Environmental monitor: Since quantum computing requires specific environmental conditions (such as low temperature and low noise), this device can monitor and control the computing environment in real time to ensure the accuracy of measurements.

[0304] Error correction module: Since errors may occur in quantum computing, the error correction module can correct and optimize the measurement results.

[0305] The measurement devices listed above can be used independently or in combination with other devices to meet specific quantum computing needs.

[0306] The support system 3 provides the necessary working environment conditions to ensure the operation of the quantum chip system 1. The support system 3 may include an ultra-low temperature refrigeration system and a host active vibration damping system, providing a stable working environment for the quantum computer.

[0307] The operating system 4 provides a software system to enable interaction between the user and the quantum chip system 1 and the measurement and control system 2. The quantum computer operating system 4 can, for example, employ the Sinan system, providing a quantum computing software framework for the quantum computer, and possessing functions such as parallel execution of multiple quantum computing tasks, automatic calibration of the quantum chip, and efficient management of quantum resources.

[0308] (Quantum memory)

[0309] This application also provides a quantum memory, the specific implementation of which is consistent with the implementation method and the technical effects achieved in the above method embodiments, and some contents will not be repeated.

[0310] The quantum memory stores a quantum program, which, when executed by at least one quantum processor, implements the functions of any of the aforementioned quantum chip systems or the steps of any of the aforementioned methods.

[0311] By introducing quantum memories, quantum computers can store a complex number of quantum programs, which can then be executed by quantum processors, thus greatly expanding the functionality and application scope of quantum computing. Compared to classical memories, quantum memories can store and process vast amounts of quantum state information, meaning quantum computers can execute more complex and advanced quantum algorithms and tasks. Due to the nature of quantum programs, quantum processors can handle multiple computational tasks simultaneously, significantly accelerating computation compared to classical computing. Quantum memories can store quantum keys and other information related to quantum communication and quantum cryptography, providing a higher level of security than classical technologies. The design of quantum memories allows for dynamic expansion of memory capacity to adapt to ever-increasing computational demands. Quantum memories can work alongside traditional classical memories and other computing resources, enabling collaborative work between quantum and classical computers. Because quantum memories can store multiple quantum states at superlocations, data redundancy can be effectively reduced, and storage efficiency improved. By storing quantum programs specifically designed for quantum processors, the potential of quantum computing, such as quantum machine learning and quantum simulation, can be better utilized. Users can load and execute different quantum programs according to their needs, enabling quantum computers to perform a wide variety of tasks. Efficient management and allocation of quantum storage resources ensures the efficient operation of quantum computers. The introduction of quantum memories creates conditions for further research and application of quantum computing, quantum communication, and other quantum technologies, thereby driving technological progress in the entire field of quantum information science.

[0312] (Quantum program products)

[0313] This application also provides a quantum program product, the specific implementation of which is consistent with the implementation method and the technical effect achieved in the above method embodiments, and some contents will not be repeated.

[0314] The quantum program product includes a quantum program that, when executed by at least one quantum processor, implements the functions of any of the aforementioned quantum chip systems or the steps of any of the aforementioned methods.

[0315] Quantum program products provide specific operating and functional guidelines for quantum computers, allowing quantum processors to efficiently perform complex tasks. This enables a variety of quantum computing tasks to be performed in a modular and repeatable manner. Similar to classical software applications, quantum programs can be shared and deployed by multiple users or devices, thus expanding their application scope. Optimized quantum programs can improve the computational efficiency of quantum processors, reduce error rates, and ensure accurate computational results. Quantum program products can include complex algorithms and processes, supporting various advanced quantum computing tasks such as optimization, simulation, encryption, and machine learning. Users can customize or adjust quantum programs to meet specific computing tasks or business needs. Quantum programs can work in conjunction with classical computing programs, allowing for seamless integration between quantum and classical computers. For non-specialist users, quantum program products provide a simple and easy-to-use interface, enabling users to easily leverage the power of quantum computing without needing to delve into its complex underlying principles. Quantum program products can include various testing and verification tools to help users ensure the accuracy and reliability of quantum computing. As quantum computing technology develops, more and more quantum program products are entering the market, providing users with various functions and services, thereby driving the commercialization process of the entire quantum computing field. Quantum program products can also be used as educational and training tools to help students and researchers better understand and master the principles and applications of quantum computing.

[0316] This application does not limit the users. Taking the field of cryptography as an example, users may include national security departments, intelligence agencies, military research departments, cybersecurity companies, information security departments of large enterprises, technical security teams of financial institutions, telecommunications companies, network service providers, hardware and software development companies, digital currency and blockchain organizations, independent cryptography researchers, university computer science and cryptography departments, technology research institutes, digital rights management organizations, regulatory agencies related to digital communications, standards-setting bodies, security certification bodies, etc. These users can utilize the aforementioned quantum computing technology solutions to conduct various cryptographic research and practices, such as quantum-secure key exchange, the development of post-quantum cryptographic algorithms, quantum attack simulation of traditional cryptographic systems, efficient digital signature schemes, secure data encryption and transmission, deep cryptanalysis, privacy enhancement technologies, anonymous communication, digital identity verification, two-way authentication, and multi-party secure computation. For example, cybersecurity companies can utilize the capabilities of quantum computing to develop more secure encryption algorithms to address potential quantum attack threats. Telecommunications companies and network service providers can use this technology to protect their communication networks and ensure the security and privacy of data transmission. Digital currency and blockchain organizations can leverage quantum cryptography to enhance the security of their systems and prevent future security threats. In summary, all types of users can leverage the powerful capabilities of quantum computing in the field of cryptography to improve their information security and defense capabilities.

[0317] (Classic Computer)

[0318] This application also provides a classic computer, including a memory and at least one processor.

[0319] The memory is used to store a computer program; the at least one processor is used to execute the computer program to implement the following steps: obtaining a coefficient array of f(x), g(x) and h(x); wherein the polynomials f(x), g(x) and h(x) are all ∈ F2[x], F2[x] is a polynomial ring defined on the binary field F2, and the polynomial coefficients in the coefficient array are arranged in descending order of degree.

[0320] The classical computer in this embodiment includes a memory and a processor. The memory stores a computer program designed to obtain arrays of coefficients for polynomials f(x), g(x), and h(x). When this program is executed, the processor first reads the coefficients of each polynomial and then organizes these coefficients into an array according to the polynomial degree from highest to lowest. This yields the polynomial coefficient array, where all coefficients are either 0 or 1. This classical computer provides a fast and accurate method for obtaining polynomial coefficient arrays, which lays the foundation for further processing and manipulation in quantum computing. By accurately representing polynomials, the accuracy and efficiency of quantum algorithms can be ensured. Furthermore, the introduction of this method increases the automation of the entire computation process, reducing manual operations and potential errors.

[0321] There are several ways to obtain the coefficient arrays of polynomials f(x), g(x), and h(x), depending on the source of the polynomials and their representation in the computer. Here are some possible methods.

[0322] Direct parsing: If the polynomial is given in text form, the coefficient of each term can be obtained directly by parsing the text.

[0323] Algebraic software packages: Use algebraic software packages such as Mathematica, MATLAB, or SageMath, which can automatically read and parse polynomials and output their coefficient arrays.

[0324] Programming language libraries: For example, in Python, you can use the poly function from the numpy library to return the coefficients of a polynomial from its roots.

[0325] Database lookup: If there is a database that stores pre-computed polynomial coefficients, the coefficients of the desired polynomial can be retrieved directly from the database.

[0326] Polynomial interpolation: If the values ​​of a polynomial at different points are given, polynomial interpolation can be used to recover the coefficients of the polynomial.

[0327] Using FFT: For large-scale polynomial multiplication, the Fast Fourier Transform (FFT) can be used to obtain the coefficients.

[0328] Polynomial decomposition: For a specific polynomial form, such as a piecewise polynomial or a recursively defined polynomial, its coefficients can be obtained through polynomial decomposition.

[0329] Obtaining the coefficient array of a polynomial is an important step in polynomial processing, polynomial algorithms, and other applications. It provides a structured way to manipulate and store polynomials, making computation more efficient and manageable.

[0330] It is understood that the specific examples in this document are only intended to help those skilled in the art better understand the implementation methods of this application, and are not intended to limit the scope of this application.

[0331] It is understood that in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

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

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

[0334] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0335] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the quantum computer, performance improvement method, quantum memory, and quantum program product described above can be referred to the corresponding processes in the aforementioned quantum chip system implementation methods, and will not be repeated here.

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

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

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

[0339] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium (e.g., a classical computer or a quantum computer). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

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

Claims

1. A method for constructing quantum circuits, characterized in that, The method comprises: constructing a first quantum circuit for implementing calculation of h(x)+f(x)g(x); wherein, polynomials f(x), g(x) and h(x) are all in F2[x], F2[x] is a polynomial ring defined on binary field F2, and quantum operations in the first quantum circuit include CNOT operations.

2. The quantum circuit construction method according to claim 1, wherein, The process of constructing the first quantum circuit comprises: storing coefficient arrays of f(x), g(x) and h(x) in quantum registers A to C respectively; wherein, degrees of f(x) and g(x) are both less than n, degree of h(x) is less than 2n-1, polynomial coefficients in the coefficient arrays are arranged in order from high to low degree, and n is a positive integer; bit numbers of quantum registers A to C are n, n and 2n-1 respectively; constructing the first quantum circuit by using inputs and outputs of the first quantum circuit and CNOT operations; wherein, the inputs of the first quantum circuit include the coefficient arrays stored in quantum registers A to C, and the outputs of the first quantum circuit include a calculation result of h(x)+f(x)g(x) stored in quantum register C.

3. The quantum circuit construction method according to claim 2, wherein, The process of calculating h(x)+f(x)g(x) by the first quantum circuit comprises: S1 : take n, A [0,..., n-1], B [0,..., n-1], C [0,..., 2n-2] as inputs of the first quantum circuit; when n > 1, let Splitting gives f(x) = f0(x) + f1(x)x k , g(x) = g0(x) + g1(x)x k , a(x) = f0(x)g0(x) = a0(x) + a1(x)x k , b(x) = f1(x)g1(x) = b0(x) + b1(x)x k , g(x) = (f0(x) + f1(x))(g0(x) + g1(x)) = g0(x) + g1(x)x k , h(x) = h0(x) + h1(x)x k + h2(x)x 2k + h3(x)x 3k , execute S2; when n = 1, let k = 0, execute S6; S2: calling a second quantum circuit to make C[0,…,k-1] store h0(x)+α0(x), C[k,…,2k-1] store h1(x)+α0(x)+α1(x)+β0(x), C[2k,…,3k-1] store h2(x)+α1(x)+β0(x)+β1(x), and C[3k,…,2n-2] store h3(x)+β1(x); S3: performing CNOT operations to make A[0,…,n-k-1] store f0(x)+f1(x) and B[0,…,n-k-1] store g0(x)+g1(x); S4: call the first quantum circuit to make C[k,...,2k-1] store h1(x)+a0(x)+a1(x)+b0(x)+g0(x), C[2k,...,3k-1] store h2(x)+a1(x)+b0(x)+b1(x)+g1(x); wherein A[0,...,k-1], B[0,...,k-1], C[k,...,3k-1] as the input of the first quantum circuit, C[k,...,3k-1] as the output of the first quantum circuit; S5: performing CNOT operations to make B[0,…,n-k-1] store g0(x)+g1(x) and A[0,…,n-k-1] store f0(x)+f1(x); S6: performing TOFFOLI operations and taking C[0,…,2n-2] as the output of the first quantum circuit.

4. The quantum circuit construction method according to claim 3, wherein, In step S2, the process of calling the second quantum circuit comprises: calling the second quantum circuit to make C[0,…,k-1] store h0(x)+α0(x), C[k,…,2k-1] store h1(x)+α0(x)+α1(x), and C[2k,…,3k-1] store h2(x)+α1(x); wherein, k, A[0,…,k-1], B[0,…,k-1] and C[0,…,3k-1] are taken as inputs of the second quantum circuit, and C[0,…,3k-1] is taken as the output of the second quantum circuit; The second quantum circuit is called to make C[k,…,2k-1] store h1(x)+α0(x)+α1(x)+β0(x), C[2k,…,3k-1] store h2(x)+α1(x)+β0(x)+β1(x), and C[3k,…,2n-2] store h3(x)+β1(x); wherein n-k, A[k,…,n-1], B[k,…,n-1], and C[k,…,2n-2] are input of the second quantum circuit, and C[k,…,2n-2] is output of the second quantum circuit.

5. The quantum circuit construction method according to claim 3, wherein, In step S3, the process of CNOT operation includes: CNOT operation is performed to make A[0,…,n-k-1] store f0(x)+f1(x); wherein A[k,…,n-1] is control bit, and A[0,…,n-k-1] is target bit; CNOT operation is performed to make B[0,…,n-k-1] store g0(x)+g1(x); wherein B[k,…,n-1] is control bit, and B[0,…,n-k-1] is target bit.

6. The quantum circuit construction method according to claim 3, wherein, In step S5, the process of CNOT operation includes: CNOT operation is performed to make B[0,…,n-k-1] store g0(x)+g1(x); wherein B[k,…,n-1] is control bit, and B[0,…,n-k-1] is target bit; CNOT operation is performed to make A[0,…,n-k-1] store f0(x)+f1(x); wherein A[k,…,n-1] is control bit, and A[0,…,n-k-1] is target bit.

7. The quantum circuit construction method according to claim 3, wherein, The method further includes: constructing a second quantum circuit for implementing the computation of H(x) + (1 + x k )F(x)G(x); Wherein, polynomials F(x), G(x) and H(x) are all in F2[x], k is a positive integer, and quantum operation in the second quantum circuit includes CNOT operation.

8. The quantum circuit construction method according to claim 7, wherein, The process of constructing the second quantum circuit includes: Coefficient arrays of F(x), G(x) and H(x) are stored in quantum registers A to C respectively; wherein, degrees of F(x) and G(x) are both less than m, degree of H(x) is less than k+2m-1, polynomial coefficients in the coefficient array are arranged in order from high to low, m is a positive integer, and k≥m; bit numbers of quantum registers A to C are m, m and k+2m-1 respectively; The second quantum circuit is constructed by using the input and output of the second quantum circuit and a CNOT operation, wherein the input of the second quantum circuit comprises a coefficient array stored in quantum registers A to C, the output of the second quantum circuit comprises a calculation result of H(x)+(1+x k )F(x)G(x) stored in the quantum register C.

9. The quantum circuit construction method according to claim 8, wherein, The second quantum circuit calculates H(x) + (1 + x)F(x)G(x) k The process of calculating H(x) + (1 + x)F(x)G(x) includes: R1 : take k, A[0,...,m-1], B[0,...,m-1], C[0,...,k+2m-2] as inputs of the second quantum circuit; when m > 1, split to get (FG)(x) = F(x)G(x) = (FG)0(x) + (FG)1(x)x k , H(x) = H0(x) + H1(x)x k + H2(x)x 2k , execute R2; when m = 1, execute R5; R2: CNOT operation is performed to make C[k,…,k+l-1] store H1(x)+H2(x), and C[0,…,k-1] store H0(x)+H1(x)+H2(x); R3: invoke the first quantum circuit to make C[k,...,2k-1] store H1(x)+H2(x)+(FG)0(x), C[2k,...,2k+l-1] store H2(x)+(FG)1(x); wherein A[0,...,m-1], B[0,...,m-1], C[k,...,2k+l-1] are input of the first quantum circuit, C[k,...,2k+l-1] are output of the first quantum circuit; R4: perform CNOT operation to make C[0,...,k-1] store H0(x)+(FG)0(x), C[k,...,k+l-1] store H1(x)+(FG)0(x)+(FG)1(x); R5: perform CNOT operation and TOFFOLI operation, and C[0,...,k+2m-2] are output of the second quantum circuit.

10. The quantum circuit construction method of claim 9, wherein, In step R2, the process of performing CNOT operation includes: perform CNOT operation to make C[k,...,k+l-1] store H1(x)+H2(x); wherein C[2k,...,2k+l-1] are control bits, C[k,...,k+l-1] are target bits; l=max{0,2m-1-k}; perform CNOT operation to make C[0,...,k-1] store H0(x)+H1(x)+H2(x); wherein C[k,...,2k-1] are control bits, C[0,...,k-1] are target bits.

11. The quantum circuit construction method of claim 9, wherein, In step R4, the process of performing CNOT operation includes: perform CNOT operation to make C[0,...,k-1] store H0(x)+(FG)0(x); wherein C[k,...,2k-1] are control bits, C[0,...,k-1] are target bits; perform CNOT operation to make C[k,...,k+l-1] store H1(x)+(FG)0(x)+(FG)1(x); wherein C[2k,...,2k+l-1] are control bits, C[k,...,k+l-1] are target bits, and C[0,...,k+2m-2] are output of the second quantum circuit.

12. The quantum circuit construction method of claim 9, wherein, In step R5, the process of performing CNOT operation and TOFFOLI operation includes: perform CNOT operation; wherein C[k] are control bits, C[0] are target bits; perform TOFFOLI operation; wherein A[0] and B[0] are control bits, C[k] are target bits; perform CNOT operation; wherein C[k] are control bits, C[0] are target bits, and C[0,...,k+2m-2] are output of the second quantum circuit.

13. The quantum circuit construction method according to claim 7, wherein, The method further includes: constructing a third quantum circuit for implementing the calculation of s(x)q(x) mod m(x); wherein s(x) = 1 + x k , the quantum operations in the third quantum circuit include CNOT operations and SWAP operations; constructing a fourth quantum circuit for implementing calculation of r(x)t(x)mod m(x); wherein r(x)=x, quantum operations in the fourth quantum circuit include CNOT operation and SWAP operation; According to the first quantum circuit, the second quantum circuit, the third quantum circuit and the fourth quantum circuit, a modular multiplication quantum circuit for implementing calculation of h(x)+f(x)g(x)mod m(x) is constructed.

14. The quantum circuit construction method of claim 13, wherein, The process of constructing the third quantum circuit comprises: A matrix Z is generated to convert s(x)q(x)mod m(x) into Zq; wherein q is a column vector representation of q(x); The matrix Z is subjected to LUP decomposition to obtain L matrix, U matrix and P matrix; The P matrix, the U matrix and the L matrix are sequentially arranged to obtain the third quantum circuit.

15. A modular multiplication quantum circuit, comprising: The modular multiplication quantum circuit comprises: A first quantum circuit for implementing calculation of h(x)+f(x)g(x); a second quantum circuit for implementing a computation of H(x) + (1 + x k )F(x)G(x); A third quantum circuit for implementing calculation of s(x)q(x)mod m(x); A fourth quantum circuit for implementing calculation of r(x)t(x)mod m(x); wherein s(x) = 1 + x k r(x) = x, k is a positive integer; polynomials f(x), g(x), h(x), F(x), G(x), H(x), q(x) and t(x) are all in F2[x], F2[x] is a polynomial ring defined on a binary field F2; the quantum operation in the first quantum circuit comprises a CNOT operation, the quantum operation in the second quantum circuit comprises a CNOT operation, the quantum operation in the third quantum circuit comprises a CNOT operation and a SWAP operation, and the quantum operation in the fourth quantum circuit comprises a CNOT operation and a SWAP operation.

16. The modular multiplication quantum circuit of claim 15, wherein, In the modular multiplication quantum circuit, h(x) / x is calculated by the fourth quantum circuit k mod m(x), h(x) / x is calculated by the first quantum circuit and the CNOT gate k + γ(x) mod m(x), (h(x) / x k + γ(x))(1+x k ) is calculated by the third quantum circuit -1 mod m(x), (h(x) / x k + γ(x))(1+x k ) is calculated by the first quantum circuit -1 + β(x) mod m(x), ((h(x) / x k + γ(x))(1+x k ) is calculated by the fourth quantum circuit -1 + β(x))x k mod m(x), α(x) + ((h(x) / x k + γ(x))(1+x k ) is calculated by the first quantum circuit -1 + β(x))x k mod m(x), (1+x k )(α(x) + ((h(x) / x k + γ(x))(1+x k ) is calculated by the third quantum circuit -1 + β(x))x k mod m(x), h(x) + f(x)g(x) mod m(x) is obtained; where f(x) = f0(x) + f1(x)x k g(x) = g0(x) + g1(x)x k α(x) = f0(x)g0(x) = α0(x) + α1(x)x k β(x) = f1(x)g1(x) = β0(x) + β1(x)x k γ(x) = (f0(x) + f1(x))(g0(x) + g1(x)) = γ0(x) + γ1(x)x k The degrees of f(x) and g(x) are less than n, the degree of h(x) is less than 2n-1, and n is a positive integer.

17. A quantum chip system, comprising: The quantum computer comprises: A quantum chip system comprising at least one quantum processor for executing quantum operations corresponding to a quantum program to process quantum bits, thereby calculating h(x)+f(x)g(x)mod m(x) through a modular multiplication quantum circuit; wherein polynomials f(x), g(x) and h(x) are all ∈F2[x], and F2[x] is a polynomial ring defined on a binary field F2. The quantum computer comprises:

18. A quantum computer, comprising: A quantum chip system comprising at least one quantum processor for executing quantum operations corresponding to a quantum program to process quantum bits, thereby calculating h(x)+f(x)g(x)mod m(x) through a modular multiplication quantum circuit; wherein polynomials f(x), g(x) and h(x) are all ∈F2[x], and F2[x] is a polynomial ring defined on a binary field F2. A measurement and control system comprising a control device and a measurement device, the control device being used to convert a quantum program corresponding to the modular multiplication quantum circuit into a corresponding control signal and send it to the quantum processor, and the measurement device being used to measure quantum bits; A support system for providing working environmental conditions to ensure the operation of the quantum chip system; An operating system for providing a software system to realize the interaction between a user and the quantum chip system and the measurement and control system. The classical computer comprises:

19. A classical computer, comprising: A memory for storing a computer program; At least one processor for executing the computer program to implement the following steps: Obtaining a coefficient array of f(x), g(x) and h(x); wherein polynomials f(x), g(x) and h(x) are all ∈F2[x], and F2[x] is a polynomial ring defined on a binary field F2, and the polynomial coefficients in the coefficient array are arranged in order from high to low. ​