A hamming weight calculation and constant-depth quantum circuit construction method, system, terminal and storage medium of symmetric boolean function
Patent Information
- Application Number
- CN202611103065.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-23
- Publication Date
- 2026-10-23
AI Technical Summary
[0006]本发明的主要目的在于提供一种汉明权重计算及对称布尔函数的常数深度量子线路构造方法、系统、终端及计算机可读存储介质,旨在解决现有技术中汉明权重计算量子线路的线路深度与辅助量子比特开销之间难以平衡的问题
[0017]本发明的有益效果为:本发明将各带权输入的信息并行分发至多个计算分支,使后续计数操作在各分支中同时进行,由此将线性顺序累积过程压缩为常数级线路深度;并行加权计数在各分支中同步累积计数贡献,中间编码结果以紧凑形式承载全部带权输入的总权重信息,解码后直接得到二进制形式的汉明权重,使输出结果可直接用于后续量子算法子程序;修正操作根据中途测量反馈清除临时信息并恢复辅助量子比特,输入寄存器保持原始输入量子态的相干性不受破坏,权重寄存器独立保留汉明权重结果,使该量子线路模块在整体深度保持常数级的同时,辅助量子比特数量得到有效控制,输出结果准确且线路可重复调用。
Smart Images

Figure CN122965711A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of quantum computing technology, and in particular to a method, system, terminal, and computer-readable storage medium for constructing constant-depth quantum circuits using Hamming weight calculation and symmetric Boolean functions. Background Technology
[0002] Quantum algorithms are typically implemented using quantum circuits. The circuit depth is limited by the coherence time of the qubits and the gate operation error, while the number of auxiliary qubits is limited by the size of the quantum processor. Therefore, in the design of the basic subroutines of quantum algorithms, reducing circuit depth and controlling the overhead of auxiliary qubits are two key constraints that need to be balanced.
[0003] Hamming weight calculation is an important fundamental subroutine used to write the number of bits with a value of 1 in the input bit string to a weight register. It can be applied to tasks such as quantum counting, Hamming distance calculation, quantum state preparation, quantum machine learning, and the construction of symmetric Boolean functions. Symmetric Boolean functions are a class of Boolean functions whose function value depends only on the Hamming weights of the input bit string, including OR functions, AND functions, parity functions, majority functions, threshold functions, and exact counting functions. Therefore, an efficient Hamming weight calculation circuit can serve as a general basic module for constructing quantum circuits for symmetric Boolean functions.
[0004] Existing Hamming weighted computation quantum circuits suffer from limitations in both depth and auxiliary qubit overhead. Standard quantum circuits only allow single-qubit and two-qubit gates and cannot utilize mid-course measurement results to control subsequent operations, resulting in significant circuit depth. While the idealized infinite fan-out model can compress the depth, practical quantum hardware requires a large number of auxiliary qubits to achieve global parallel fan-out, leading to excessive auxiliary qubit overhead.
[0005] Therefore, existing technologies still need to be improved and developed. Summary of the Invention
[0006] The main objective of this invention is to provide a method, system, terminal, and computer-readable storage medium for constructing constant-depth quantum circuits using Hamming weight calculation and symmetric Boolean functions, aiming to solve the problem of balancing the circuit depth and auxiliary qubit overhead of Hamming weight calculation quantum circuits in the prior art.
[0007] To achieve the above objectives, this invention provides a method for constructing constant-depth quantum circuits using Hamming weights and symmetric Boolean functions. This method includes the following steps: An input register and a weight register are provided. The quantum states corresponding to the input bit string to be calculated are loaded into each input qubit in the input register to obtain an input register storing the input quantum states. Obtain each of the input qubits, and use each of the input qubits as weighted inputs to obtain a weighted input set; Perform a measurement-based fan-out operation on the weighted input set to obtain a parallel fan-out branch structure; A weighted counting operation is performed in each parallel computation branch of the parallel fan-out branch structure to obtain intermediate encoding results; The intermediate encoding result is decoded to obtain a weighted counting result in binary form. The weighted counting result is written as a Hamming weight into the weight register to obtain a weight register storing the Hamming weights. Based on the intermediate measurement results and classical feedback information, a correction operation is performed to clear the temporary information in the intermediate register, resulting in an input register that maintains the input quantum state and a weight register that retains the Hamming weights.
[0008] Furthermore, the provision of an input register and a weight register, loading the quantum states corresponding to the input bit string to be calculated into each input qubit in the input register to obtain an input register storing the input quantum states, specifically includes: It provides input registers, weight registers, and classic control registers; The quantum states corresponding to the input bit string to be calculated are loaded into each input qubit in the input register to obtain the input register storing the input quantum states; The intermediate measurement results generated during the calculation process are saved to the classical control register, and a feedback control signal is generated based on the intermediate measurement results.
[0009] Furthermore, the step of acquiring each of the input qubits and using each of the input qubits as weighted inputs to obtain a weighted input set specifically includes: Obtain each input qubit, determine the current computing task type, and obtain the current computing task type determination result; When the current computing task type determination result is a normal Hamming weighted computing task, the weight of each input qubit is set to 1, resulting in a weighted input set with a weight of 1. When the current computation task type is determined to be a block summary task or a recursive summary task, each binary bit in the local weight register is obtained as an intermediate quantity, and the corresponding binary weight is determined according to the number of bits of each binary bit, so as to obtain a weighted input set with different fixed weights.
[0010] Furthermore, the step of performing a measurement-based fan-out operation on the weighted input set to obtain a parallel fan-out branch structure specifically includes: Select an auxiliary qubit or a temporary qubit in a fan-out branch as the qubit to be measured, perform an intermediate measurement operation on the qubit to be measured, and obtain the intermediate measurement result. Based on the intermediate measurement results, classical feedback information is determined, and subsequent correction operations are determined based on the classical feedback information. A coherent fan-out structure corresponding to the computational basis value of each weighted input in the weighted input set is established using the auxiliary qubit, the intermediate measurement results, and the classical feedback information. The counting information corresponding to each weighted input is distributed to multiple parallel computing branches to obtain a parallel fan-out branch structure.
[0011] Furthermore, the step of performing a weighted counting operation in each parallel computing branch of the parallel fan-out branch structure to obtain intermediate encoding results specifically includes: Obtain the parallel fan-out branch structure, determine the computational basis value of the corresponding weighted input qubit in each parallel computation branch of the parallel fan-out branch structure, and obtain the judgment result of each parallel computation branch. Based on the judgment results of each parallel computing branch, when the computing base value is 1, a controlled operation related to the fixed weight is applied in the corresponding parallel branch, and the count contribution corresponding to the fixed weight is accumulated to obtain the accumulated count contribution result of each parallel computing branch. By summing up the cumulative results of the count contributions described above, the total weight of all weighted inputs is obtained; The total weight is encoded into an intermediate register or a phase register to obtain an intermediate encoding result.
[0012] Further, the step of performing a decoding operation on the intermediate encoding result to obtain a weighted counting result in binary form, and writing the weighted counting result as a Hamming weight into the weight register to obtain a weight register storing the Hamming weights, specifically includes: Obtain the intermediate encoding result, perform a decoding operation on the intermediate encoding result, convert the intermediate encoding result into a weighted counting result in binary form, and obtain a weighted counting result in binary form; Obtain the task type identifier of the current computing task, and determine whether the current computing task is the final global Hamming weight calculation task based on the task type identifier; When the current calculation task is the final global Hamming weight calculation task, the weighted count result in binary form is written as the Hamming weight into the weight register to obtain the weight register storing the final global Hamming weight. When the current computation task is an intermediate layer aggregation task, the weighted counting result in binary form is written into the local weight register to obtain a local weight register storing local Hamming weights.
[0013] Furthermore, the step of performing a correction operation based on the intermediate measurement results and classical feedback information to clear temporary information in the intermediate registers and obtain an input register that maintains the input quantum state and a weight register that retains the Hamming weights specifically includes: Acquire intermediate measurement results and classical feedback information, determine the correction operation type based on the intermediate measurement results and classical feedback information, and generate a correction operation instruction based on the correction operation type; The target correction operation is determined based on the correction operation instruction, which may be a Pauli correction operation, a gate selection operation, a phase correction operation, a decoding correction operation, or a subsequent line control operation. The target correction operation is performed on the temporary information in the intermediate register generated during the measurement fan-out operation and the weighted counting operation to clear the temporary information in the intermediate register, resulting in a cleared intermediate register; Perform a measurement release operation, reset operation, recovery operation, or reuse tag operation on the auxiliary quantum bit to set the auxiliary quantum bit to a specified state or a reusable state, thereby obtaining the recovered auxiliary quantum bit; Read the current state of the input register, confirm that the input register maintains the input quantum state unchanged, and obtain the input register that maintains the input quantum state unchanged; Read the current state of the weight register, confirm that the weight register retains the Hamming weight, and obtain the weight register that retains the Hamming weight.
[0014] Furthermore, to achieve the above objectives, the present invention also provides a constant-depth quantum circuit construction system for Hamming weight calculation and symmetric Boolean functions. This system is used to implement the Hamming weight calculation and symmetric Boolean function constant-depth quantum circuit construction method described above. The system comprises: A register providing module is used to provide an input register and a weight register, and to load the quantum state corresponding to the input bit string to be calculated into each input qubit in the input register to obtain an input register storing the input quantum state; A weighted input module is used to acquire each of the input qubits and use each of the input qubits as weighted inputs to obtain a weighted input set. The fan-out module is used to perform a measurement-based fan-out operation on the weighted input set to obtain a parallel fan-out branch structure; The weighted counting module is used to perform weighted counting operations in each parallel computing branch of the parallel fan-out branch structure to obtain intermediate encoding results; The decoding output module is used to perform a decoding operation on the intermediate encoding result to obtain a weighted counting result in binary form, and write the weighted counting result as a Hamming weight into the weight register to obtain a weight register storing the Hamming weights. The correction and recovery module is used to perform correction operations based on the intermediate measurement results and classical feedback information, clear the temporary information in the intermediate register, and obtain the input register that keeps the input quantum state unchanged and the weight register that retains the Hamming weight.
[0015] Furthermore, to achieve the above objectives, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a Hamming weight calculation and constant-depth quantum circuit construction program for symmetric Boolean functions stored in the memory and executable on the processor, wherein when the Hamming weight calculation and constant-depth quantum circuit construction program for symmetric Boolean functions is executed by the processor, it implements the steps of the Hamming weight calculation and constant-depth quantum circuit construction method for symmetric Boolean functions as described above.
[0016] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a Hamming weight calculation and constant-depth quantum circuit construction program for symmetric Boolean functions, wherein when the Hamming weight calculation and constant-depth quantum circuit construction program for symmetric Boolean functions is executed by a processor, it implements the steps of the Hamming weight calculation and constant-depth quantum circuit construction method for symmetric Boolean functions as described above.
[0017] The beneficial effects of this invention are as follows: This invention distributes the information of each weighted input to multiple computation branches in parallel, so that subsequent counting operations are performed simultaneously in each branch, thereby compressing the linear sequential accumulation process to a constant-level circuit depth; parallel weighted counting synchronously accumulates the counting contribution in each branch, and the intermediate encoding result carries the total weight information of all weighted inputs in a compact form. After decoding, the Hamming weights in binary form are directly obtained, so that the output results can be directly used for subsequent quantum algorithm subroutines; the correction operation clears temporary information and restores auxiliary qubits based on mid-course measurement feedback, the input register maintains the coherence of the original input quantum state without damage, and the weight register independently retains the Hamming weight results, so that the quantum circuit module maintains a constant level of overall depth while effectively controlling the number of auxiliary qubits, and the output results are accurate and the circuit can be reused. Attached Figure Description
[0018] Figure 1 This is a flowchart of a preferred embodiment of the method for constructing constant-depth quantum circuits using Hamming weights and symmetric Boolean functions according to the present invention; Figure 2 This is a flowchart illustrating the overall process of dynamic Hamming weight calculation in this invention. Figure 3 This is a schematic diagram of the measurement fan-out and weighted counting module of the present invention; Figure 4 This is a schematic diagram of the block and recursive summarization structure of the present invention; Figure 5 This is a schematic diagram of the regional layout of the present invention under the two-dimensional nearest neighbor dynamic quantum circuit model; Figure 6 This is a schematic diagram of the present invention used to construct symmetric Boolean function quantum circuits or quantum oracles; Figure 7 This is a structural diagram of a preferred embodiment of the constant-depth quantum circuit construction system for Hamming weight calculation and symmetric Boolean functions of the present invention; Figure 8 This is a structural diagram of a preferred embodiment of the terminal of the present invention. Detailed Implementation
[0019] This application provides a method, system, terminal, and storage medium for constructing constant-depth quantum circuits using Hamming weight calculation and symmetric Boolean functions. To make the objectives, technical solutions, and effects of this application clearer and more explicit, the following detailed description, with reference to the accompanying drawings and embodiments, further illustrates this application. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0020] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0021] Furthermore, if the embodiments of this invention involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0022] The preferred embodiment of the present invention describes a method for constructing constant-depth quantum circuits using Hamming weights and symmetric Boolean functions, such as... Figure 1As shown, the constant-depth quantum circuit construction method for Hamming weight calculation and symmetric Boolean functions includes the following steps: S10. Provide an input register and a weight register, load the quantum state corresponding to the input bit string to be calculated into each input qubit in the input register, and obtain an input register storing the input quantum state.
[0023] The purpose of this step is to establish register resources for storing input quantum states and output computation results, providing a data carrier for subsequent measurement fan-out operations, weighted counting operations, and decoding operations.
[0024] Furthermore, the provision of an input register and a weight register, loading the quantum states corresponding to the input bit string to be calculated into each input qubit in the input register to obtain an input register storing the input quantum states, specifically includes: S11 provides an input register, a weight register, auxiliary qubits, and a classical control register.
[0025] S12. Load the quantum state corresponding to the input bit string to be calculated into each input qubit in the input register to obtain the input register storing the input quantum state.
[0026] S13. Set the auxiliary qubit to the initial state to obtain the auxiliary qubit in the initial state.
[0027] S14. Save the intermediate measurement results generated during the calculation process to the classic control register, and generate a feedback control signal based on the intermediate measurement results.
[0028] In this embodiment, the input register is denoted as X, containing n input qubits, used to store the input bit string x. The weight register is denoted as W, used to store the Hamming weights of the input x. The auxiliary qubits are denoted as A, used to implement measurement fan-out, weighted counting, phase accumulation, decoding, and recovery operations. The classical control register is denoted as C, used to save intermediate measurement results and control subsequent correction operations.
[0029] The quantum state corresponding to the n-bit input bit string x to be calculated is loaded onto the n input qubits in the input register X, resulting in an input register storing the input quantum state. The input bit string x can be represented as x1x2…x i , where x i This represents the i-th input bit, which can be either 0 or 1. The corresponding quantum state is the tensor product of the quantum states of each input bit.
[0030] The weight register W is used to receive the final Hamming weighting result. The auxiliary qubit A is used to perform measurement fan-out operation, weighted counting operation, phase accumulation operation, decoding operation, and recovery operation. Its initial number can be determined according to the input size, block parameters, and available hardware resources. The classical control register C is used to store the intermediate measurement results generated in the measurement fan-out operation and to generate feedback control signals based on the intermediate measurement results.
[0031] It should be noted that this invention relates to dynamic quantum circuits, which allow for mid-process measurements during computation and enable subsequent classical feedback control operations based on the measurement results. These classical feedback control operations include, but are not limited to, Pauli correction operations, gate selection operations, phase correction operations, decoding correction operations, and subsequent circuit control operations. The classical control register C can store mid-process measurement results during circuit execution and generate feedback control signals based on these results to control subsequent correction operations.
[0032] S20. Obtain each of the input qubits and use each of the input qubits as weighted inputs to obtain a weighted input set.
[0033] The purpose of this step is to uniformly represent the input qubits as weighted inputs, thereby establishing a standardized input data structure for weighted counting operations.
[0034] Furthermore, the step of acquiring each of the input qubits and using each of the input qubits as weighted inputs to obtain a weighted input set specifically includes: S21. Obtain each input qubit, determine the current computing task type, and obtain the current computing task type determination result.
[0035] S22. When the current computing task type determination result is a normal Hamming weighted computing task, the weight of each input qubit is set to 1 to obtain a weighted input set with a weight of 1.
[0036] S23. When the current calculation task type determination result is a block summary task or a recursive summary task, obtain each binary bit in the local weight register as an intermediate quantity, determine the corresponding binary weight according to the number of bits of each binary bit, and obtain a weighted input set with different fixed weights.
[0037] In this embodiment, for ordinary Hamming weight calculation, n input qubits are obtained from the input register X. Each input qubit is considered a weighted input, and the weight of each input qubit is 1, meaning that the weight of all inputs is 1. The goal of the weighted counting operation is to calculate the total weight of all weighted inputs.
[0038] The weighted counting operation is calculated as follows: the total weight of all weighted inputs is equal to the sum of the products of the calculation basis value of each weighted input and its fixed weight, i.e., the weighted counting formula: T=Σ i z i ·a i ; Where T represents the total weight of all weighted inputs; i represents the index of the weighted input in the set; z i This represents the computational basis value of the i-th weighted input qubit, which can be either 0 or 1; a i This represents the fixed weight corresponding to the i-th weighted input.
[0039] For a typical Hamming weight calculation task, all weighted inputs have a fixed weight equal to 1. In this case, the total weight of all weighted inputs equals the number of input qubits with a value of 1 in the input register, i.e., the Hamming weight. The Hamming weight is calculated as follows: the Hamming weight equals the sum of the computational basis values of each input qubit, i.e., the Hamming weight formula: H(x) = Σ i z i ; Where H(x) represents the number of bits with a value of 1 in the input bit string x, i.e., the Hamming weight; i represents the index of the input qubit in the input register; z i This represents the computational basis value of the i-th input qubit, which can be either 0 or 1.
[0040] When the current computation task is a block aggregation task, each binary bit in the already computed local weight register is obtained as an intermediate quantity. Let the binary representation of a local weight register be a number of bits, where the weight of the j-th bit is 2 to the power of j. Then its contribution to the total weight is the value of that bit multiplied by 2 to the power of j. The weight of each intermediate quantity is its corresponding binary weight, thus obtaining a weighted input set with different fixed weights.
[0041] It should be noted that "weighted input" in this invention is a generalized concept. In ordinary Hamming weight calculation tasks, the input qubits are used as weighted inputs, and each input qubit has a weight of 1. In block summarization or recursive summarization tasks, each binary bit in the local weight register is used as a weighted input, and the weight of each binary bit is its corresponding binary weight. Through this unified weighted input representation, this invention can uniformly convert counting tasks at different levels into weighted counting operations for processing.
[0042] S30. Perform a measurement-type fan-out operation on the weighted input set to obtain a parallel fan-out branch structure.
[0043] The purpose of this step is to distribute the weighted input information in parallel to multiple computation branches, so that subsequent weighted counting operations can be executed in parallel across multiple branches, thereby reducing the circuit depth.
[0044] Furthermore, the step of performing a measurement-based fan-out operation on the weighted input set to obtain a parallel fan-out branch structure specifically includes: S31. Select an auxiliary qubit or a temporary qubit in a fan-out branch as the qubit to be measured, perform an intermediate measurement operation on the qubit to be measured, and obtain the intermediate measurement result.
[0045] S32. Based on the intermediate measurement results, determine the classical feedback information, and based on the classical feedback information, determine the subsequent correction operation. Through the auxiliary qubit, the intermediate measurement results, and the classical feedback information, establish a coherent fan-out structure corresponding to the computational basis value of each weighted input in the weighted input set. Distribute the counting information corresponding to each weighted input to multiple parallel computing branches to obtain a parallel fan-out branch structure.
[0046] In this embodiment, a measurement-based fan-out operation is performed on each weighted input qubit in the weighted input set. The measurement-based fan-out operation establishes a coherent fan-out structure corresponding to the computational basis values of each weighted input through an auxiliary qubit A, mid-course measurement, and classical feedback.
[0047] Taking a single weighted input qubit as an example, its computational basis value is either 0 or 1. The specific process of performing a measurement-based fan-out operation is as follows: Several auxiliary qubits in auxiliary qubit A or temporary qubits in the fan-out branch are selected as the qubits to be measured. Information from the weighted input qubit is transferred to the auxiliary qubits through controlled operations, such that the state of the auxiliary qubits is associated with the computational basis value of the weighted input qubits. Subsequently, an intermediate measurement operation is performed on the auxiliary qubits to obtain the intermediate measurement result.
[0048] The intermediate measurement results are classical bits and are stored in the classical control register C. Classical feedback information is determined based on these intermediate measurement results, and this feedback information is used to determine the subsequent correction operations to be performed. These correction operations include Pauli X correction operations and Pauli Z correction operations, etc.
[0049] It is worth noting that the measurement-based fan-out does not directly measure the values of each input qubit in the input register X. The input register can be in a quantum superposition state, and the circuit should maintain its coherence. The measurement-based fan-out achieves a coherent fan-out structure related to the computational basis values through auxiliary qubits, mid-course measurements, and classical feedback; the measured qubits are mainly auxiliary qubits or temporary qubits in the fan-out branches, and the measurement results are used to determine subsequent correction operations, thereby achieving parallel counting without compromising the coherence of the input register.
[0050] Through the aforementioned measurement-based fan-out operation, the counting information corresponding to each weighted input is distributed to multiple parallel computing branches. Each branch contains information related to the weighted input's computational basis value, thus obtaining a parallel fan-out branch structure. This parallel fan-out branch structure can be used for subsequent parallel weighted counting operations.
[0051] It should be noted that measurement-based fan-out operations can be applied to both fully connected qubit models and two-dimensional nearest-neighbor qubit models. In the fully connected model, measurement-based fan-out allows for the direct placement of controlled gate operations between the desired qubits. In the two-dimensional nearest-neighbor model, auxiliary structures can be built segment by segment through local paths or local channels, and the same fan-out function can be achieved through mid-path measurements and classical feedback. The aforementioned two-dimensional nearest-neighbor dynamic quantum circuit model refers to a connection model where qubits are arranged on a two-dimensional grid, and two-qubit gates can only act on adjacent grid points.
[0052] S40. Perform a weighted counting operation in each parallel computing branch of the parallel fan-out branch structure to obtain intermediate encoding results.
[0053] The purpose of this step is to perform the counting accumulation operation simultaneously in multiple parallel computing branches, so that the weight contributions of all weighted inputs are aggregated and encoded into a decodable form.
[0054] Furthermore, the step of performing a weighted counting operation in each parallel computation branch of the parallel fan-out branch structure to obtain intermediate encoding results specifically includes: S41. Obtain the parallel fan-out branch structure, determine the computational basis value of the corresponding weighted input qubit in each parallel computing branch of the parallel fan-out branch structure, and obtain the judgment result of each parallel computing branch.
[0055] S42. Based on the judgment results of each parallel computing branch, when the computational base value is 1, a controlled operation related to the fixed weight is applied in the corresponding parallel branch, and the count contribution corresponding to the fixed weight is accumulated to obtain the accumulated count contribution result of each parallel computing branch. When the computational base value is 0, the corresponding parallel branch does not generate a count contribution.
[0056] S43. Summarize the cumulative results of the count contributions of each input to obtain the total weight of all weighted inputs.
[0057] S44. Encode the total weight into an intermediate register or a phase register to obtain the intermediate encoding result.
[0058] In this embodiment, the parallel fan-out branch structure obtained in step S30 is acquired, and a weighted counting operation is performed in parallel in each parallel computing branch according to the fixed weight of the corresponding weighted input. The core of this step is to accumulate the counting contribution of the weighted input in parallel across multiple branches, thereby reducing the overall circuit depth.
[0059] The goal of the weighted counting operation is to calculate the total weight of all weighted inputs, i.e., the aforementioned Formula 1 (Weighted Counting Formula). In each parallel computing branch of the parallel fan-out branch structure, the computational basis value of the corresponding weighted input qubit is determined, yielding the determination result for each parallel computing branch. When the computational basis value is 1, a controlled operation related to the fixed weight is applied in the corresponding parallel branch, accumulating the counting contribution corresponding to the fixed weight; when the computational basis value is 0, the corresponding parallel branch does not generate a counting contribution.
[0060] In one specific implementation, the weighted counting operation described above is implemented through phase accumulation. For the weighted sum to be calculated, several phase branches or phase registers are prepared. Each weighted input qubit is connected to these branches via a measurement fan-out, and a controlled phase operation related to its weight is applied to the corresponding branch. After all controlled phase operations are executed in parallel, the weighted sum is encoded into the phase information. In the phase accumulation method, the total weight of all weighted inputs is encoded as a phase factor, which corresponds one-to-one with the total weight. Subsequent decoding operations can restore the phase information to a binary representation of the total weight.
[0061] Specifically, for each fixed weight, it can be decomposed into a binary representation, and a controlled phase rotation gate can be applied to the corresponding phase branch. In this way, the contribution of each weighted input is accumulated in parallel into the phase information.
[0062] In another specific implementation, the weighted counting operation is implemented through parallel Boolean counting or lookup table decoding. For local modules with small input sizes, multiple counting branches that can be used in parallel are first obtained through measurement fan-out, and then the counting result is generated using constant-level or low-depth combinational logic modules.
[0063] The cumulative count contributions of each parallel computing branch are summarized to obtain the total weight of all weighted inputs. This total weight is then encoded into an intermediate register or phase register to obtain an intermediate encoding result. The intermediate encoding result can employ binary encoding, phase encoding, or other equivalent decodeable encoding methods.
[0064] It should be noted that the intermediate encoding result does not directly output the final weight value, but rather saves the total weight information in a decodable form. In the subsequent step S50, by performing a decoding operation on the intermediate encoding result, the weighted counting result in binary form, i.e., the required Hamming weights, can be obtained.
[0065] S50. Perform a decoding operation on the intermediate encoding result to obtain a weighted counting result in binary form. Write the weighted counting result as a Hamming weight into the weight register to obtain a weight register storing the Hamming weight.
[0066] The purpose of this step is to decode the counting information encoded in the intermediate register or phase register into a directly readable binary weight value and store it in the specified weight register.
[0067] Further, the step of performing a decoding operation on the intermediate encoding result to obtain a weighted counting result in binary form, and writing the weighted counting result as a Hamming weight into the weight register to obtain a weight register storing the Hamming weights, specifically includes: S51. Obtain the intermediate encoding result, perform a decoding operation on the intermediate encoding result, convert the intermediate encoding result into a weighted counting result in binary form, and obtain a weighted counting result in binary form.
[0068] S52. Obtain the task type identifier of the current computing task, and determine whether the current computing task is the final global Hamming weight calculation task based on the task type identifier.
[0069] S53. When the current calculation task is the final global Hamming weight calculation task, the weighted count result in binary form is written as the Hamming weight into the weight register to obtain the weight register storing the final global Hamming weight.
[0070] S54. When the current calculation task is an intermediate layer summary task, the weighted counting result in binary form is written into the local weight register to obtain a local weight register storing local Hamming weights.
[0071] In this embodiment, the intermediate encoding result obtained in step S44 is acquired. This intermediate encoding result is stored in an intermediate register or phase register and contains the total weight information of all weighted inputs, but it has not yet been converted into a directly readable binary form. A decoding operation is performed on the intermediate encoding result to convert it into a weighted counting result in binary form.
[0072] In the phase accumulation method, the decoding operation can convert the phase information into a binary output using a quantum Fourier transform. Specifically, the intermediate encoding result encodes the total weight of all weighted inputs into phase form, i.e., the phase factor e^{2πi·T / M}, where M is the encoding modulus, T is the total weight of all weighted inputs, i is the imaginary unit, and e is the base of the natural logarithm. This phase information can be converted into a weighted count result in binary state form using a quantum Fourier transform or inverse quantum Fourier transform. Alternatively, it can be implemented using classical decoding methods such as lookup table decoding or parallel Boolean decoding.
[0073] For a typical Hamming weight calculation task, this result is the number of qubits with a value of 1 in the input bit string, which is the result calculated by the aforementioned Hamming weight formula.
[0074] After obtaining the weighted count result in binary form, the task type identifier of the current computation task is obtained. Based on the task type identifier, it is determined whether the current computation task is the final global Hamming weight calculation task. When the current computation task is the final global Hamming weight calculation task, the weighted count result in binary form is written as the Hamming weight to the weight register W. When the current computation task is an intermediate layer aggregation task, the weighted count result in binary form is written to the local weight register for subsequent recursive aggregation at higher layers.
[0075] It should be noted that this invention can employ a block-based and recursive aggregation structure to reduce the overhead of auxiliary qubits. In the block-based structure, the input register X is first divided into several data blocks, each containing at most B input qubits. Local Hamming weights are calculated for each data block and written to the corresponding local weight register. Then, the binary bits in each local weight register are aggregated as new weighted inputs to finally obtain the global Hamming weights.
[0076] In a multi-layer recursive aggregation structure, each layer only needs to process the local weight information at its corresponding level, rather than processing all input qubits simultaneously in a single module. By increasing the number of recursive aggregation layers to a constant level, the number of auxiliary qubits required at each layer can be further reduced, and the total auxiliary qubit overhead can be made close to the input size, while the overall circuit depth remains constant.
[0077] S60. Perform a correction operation based on the intermediate measurement results and classical feedback information, clear the temporary information in the intermediate register, and obtain the input register that keeps the input quantum state unchanged and the weight register that retains the Hamming weight.
[0078] The purpose of this step is to eliminate the side effects of intermediate information generated during measurement fan-out and weighted counting operations, restore the state of the auxiliary qubit, and confirm that the final states of the input register and weight register are correct.
[0079] Furthermore, the step of performing a correction operation based on the intermediate measurement results and classical feedback information to clear temporary information in the intermediate registers and obtain an input register that maintains the input quantum state and a weight register that retains the Hamming weights specifically includes: S61. Obtain intermediate measurement results and classical feedback information, determine the correction operation type based on the intermediate measurement results and classical feedback information, and generate a correction operation instruction based on the correction operation type.
[0080] S62. Based on the correction operation instruction, determine the Pauli correction operation, gate selection operation, phase correction operation, decoding correction operation, or subsequent line control operation as the target correction operation.
[0081] S63. Perform the target correction operation on the temporary information in the intermediate register generated during the measurement fan-out operation and the weighted counting operation to clear the temporary information in the intermediate register and obtain the cleared intermediate register.
[0082] S64. Perform a measurement release operation, reset operation, recovery operation, or reuse marking operation on the auxiliary quantum bit to set the auxiliary quantum bit to a specified state or a reusable state, thereby obtaining the recovered auxiliary quantum bit.
[0083] S65. Read the current state of the input register, confirm that the input register maintains the input quantum state unchanged, and obtain the input register that maintains the input quantum state unchanged.
[0084] S66. Read the current state of the weight register, confirm that the weight register retains the Hamming weight, and obtain the weight register that retains the Hamming weight.
[0085] In this embodiment, after step S50 is executed, temporary information is still stored in the intermediate register, and the auxiliary qubit may be in a non-initial state. To ensure the reusability of the circuit and keep the input register unchanged, the intermediate information needs to be cleared and the auxiliary qubit needs to be restored.
[0086] First, the mid-course measurement results obtained in step S32 and the classical feedback information generated in steps S14 and S32 are acquired. The mid-course measurement results include, but are not limited to, the results of mid-course measurements of the auxiliary qubit during the measurement-type fan-out operation. The classical feedback information includes classical control signals determined based on the mid-course measurement results.
[0087] The correction operation type is determined based on the intermediate measurement results and the classical feedback information. Correction operation types include Pauli correction operations (such as Pauli X correction operations and Pauli Z correction operations), gate selection operations, phase correction operations, decoding correction operations, and subsequent line control operations.
[0088] A correction operation instruction is generated based on the correction operation type. The correction operation instruction is a specific quantum gate operation sequence or a classical control signal sequence, used to execute the correction operation. A target correction operation is determined based on the correction operation instruction. The target correction operation is at least one of a Pauli correction operation, a gate selection operation, a phase correction operation, a decoding correction operation, or a subsequent line control operation.
[0089] Then, the target correction operation is performed on the temporary information in the intermediate registers generated during the measurement fan-out operation and the weighted counting operation. The intermediate registers include, but are not limited to, the register used to store the intermediate encoding result in the weighted counting operation in step S40, and the register used to store temporary information in the measurement fan-out operation in step S30. By performing the target correction operation, the temporary information in the intermediate registers is cleared, and the intermediate registers are restored to their initial state or a specified state, resulting in cleared intermediate registers.
[0090] Simultaneously, a measurement release operation, a reset operation, a recovery operation, or a reuse marking operation is performed on auxiliary qubit A. The measurement release operation releases the measured auxiliary qubit, preventing it from participating in subsequent circuit operations. The reset operation resets the auxiliary qubit to its initial state. The recovery operation restores the auxiliary qubit to its initial state by reversing the previous quantum gate operation. The reuse marking operation marks the auxiliary qubit as reusable for subsequent circuit operations. Through these operations, auxiliary qubit A is set to a specified state or a reusable state, resulting in the recovered auxiliary qubit A.
[0091] Then, the current state of input register X is read to confirm that input register X maintains the input quantum state unchanged in step S12. Since the measurement-type fan-out operation of this invention does not directly measure the value of the input register, the coherence of input register X is maintained throughout the calculation process. After confirming that the input register maintains the input quantum state unchanged, the input register X that maintains the input quantum state unchanged is obtained.
[0092] The current state of the weight register W is read to confirm that it retains the Hamming weights written in step S53. In step S50, the weight register W is written with the weighted count result in binary form, i.e., the required Hamming weights. During the correction operation, the weight register W remains undisturbed, and its stored Hamming weights are preserved.
[0093] Finally, an input register X is obtained that maintains the input quantum state unchanged, and a weight register W retains the Hamming weights. The auxiliary qubit A is measured to be released, reset, restored to a specified state, or a reusable state.
[0094] At this point, the Hamming weight calculation operation is complete. The input register X remains unchanged, the weight register W stores the Hamming weights of the input bit string x, the auxiliary qubit A is restored to a reusable state, and the temporary information in the intermediate registers is cleared.
[0095] Furthermore, this invention can be used to construct dynamic quantum circuits with symmetric Boolean functions. A symmetric Boolean function is a class of Boolean functions whose function value depends only on the Hamming weights of the input bit string. Let the input register X store n-bit input x, let the weight register W store the Hamming weights of input x, and let the target qubit be T. For any symmetric Boolean function f, there exists a function g such that the function value f(x) is equal to the result of function g acting on the Hamming weights H(x) of input x.
[0096] The mathematical expression for a symmetric Boolean function is: f(x) = g(H(x)); Where f(x) represents the value of the symmetric Boolean function at input x; H(x) represents the Hamming weight of the input bit string x; and g represents the function that maps the Hamming weight to the function value. This formula shows that the value of the symmetric Boolean function is completely determined by its input Hamming weight, which is the theoretical basis for constructing quantum circuits with symmetric Boolean functions.
[0097] In the extended implementation of the symmetric Boolean function, the specific steps include: calculating the Hamming weight H(x) of the input register X using the above steps S10 to S60, and writing the Hamming weight into the weight register W; calculating the function g in the weight register W, where the function g can be implemented using a reversible Boolean circuit, a lookup table circuit, a threshold judgment circuit, a comparison circuit, or a modulo counting circuit; writing the calculation result of the function g into the target qubit T to realize the label oracle form of the symmetric Boolean function f; or applying the corresponding phase to the input state according to g(H(x)) through a phase kickback method to form a phase oracle.
[0098] This invention can be applied to various common symmetric Boolean functions, including OR functions, AND functions, parity functions, majority functions, threshold functions, exact counting functions, interval judgment functions, and modulo counting functions. For different functions, only the function g calculation module needs to be replaced or adjusted, without changing the dynamic Hamming weight calculation module.
[0099] It should be noted that steps S10 to S60 above can be directly applied to all input qubits to obtain the global Hamming weights. In another implementation, a block-based and recursive aggregation structure can be used first to calculate the local Hamming weights within each data block using the above process, and then the local Hamming weights can be used as new weighted inputs to continue aggregation.
[0100] In the block-based and recursive summarization extended implementation, the specific steps include: dividing the input register X into several data blocks, each containing at most B input qubits, where B is an adjustable parameter. The aforementioned measurement-based fan-out and weighted counting module is called in parallel for each data block to calculate the local Hamming weight of that data block, and the local Hamming weight is written to the corresponding local weight register. The binary bits in each local weight register are considered as new weighted inputs. If the j-th bit of a local weight register is 1, its corresponding weight is 2 to the power of j. The weighted counting module is called again for all local weight binary bits to perform a global weighted summation, obtaining the sum of the local Hamming weights of all data blocks, and the result is written to the weight register W.
[0101] The overall scheme described above can be applied to both fully connected qubit models and two-dimensional nearest-neighbor qubit models. In the fully connected model, the measurement fan-out and weighted counting modules can be directly arranged between the required qubits; in the two-dimensional nearest-neighbor model, the input qubits, auxiliary qubits, measurement fan-out structures, and summing regions can be arranged in a two-dimensional local region, and the same weighted counting function can be achieved through local operations and classical feedback.
[0102] right Figures 2 to 6 The explanation is as follows: Figure 2 This is a flowchart illustrating the overall process of dynamic Hamming weight calculation according to the present invention. Figure 2 As shown, the input qubits in input register X enter the dynamic quantum circuit module. With the assistance of auxiliary qubit register A, they sequentially complete measurement-based fan-out, weighted counting, and decoding, and the resulting Hamming weights are written to weight register W. The classical control register is used to store intermediate measurement results and generate feedback control signals to implement relevant correction operations. In the diagram, solid lines represent the flow of quantum information, and dashed lines represent the flow of measurement results and classical feedback information.
[0103] Figure 3 This is a schematic diagram of the measurement-type fan-out and weighted counting module of the present invention. Figure 3As shown, the weighted input register Z contains several weighted input qubits, each with a corresponding fixed weight. The measurement-based fan-out module establishes multiple parallel-usable counting or phase branches. The weighted counting module accumulates count information in parallel within these branches. The decoding module converts the intermediate encoded results into a binary weighted sum and writes it to the output register S. The classical control register stores the intermediate measurement results and generates feedback control signals.
[0104] Figure 4 This is a schematic diagram of the block-based and recursive summarization structure of the present invention. Figure 4 As shown, the input register X is divided into multiple data blocks. Each data block first undergoes parallel calculation of local Hamming weights through the first-layer dynamic counting module. These local Hamming weights are then used as new weighted inputs to the second or higher-layer weighted counting modules, obtaining intermediate weights layer by layer, and finally summing them into the global Hamming weights. The block size B and the number of recursion layers r can be adjusted according to the circuit depth and auxiliary qubit overhead requirements.
[0105] Figure 5 This is a schematic diagram of the region layout of the present invention under a two-dimensional nearest-neighbor dynamic quantum circuit model. For example... Figure 5 As shown, multiple local computation regions are set up in the two-dimensional mesh. Each local computation region contains an input block, a measurement-type fan-out structure, and a local weighted counting module. The local computation results enter the local summarization region, then the final summarization region, and are finally written to the weight register W. The classical control register stores the intermediate measurement results and generates feedback control signals. This figure emphasizes that under two-dimensional local connectivity constraints, dynamic Hamming weight calculation is achieved through local computation regions, summarization regions, and classical feedback.
[0106] Figure 6 This is a schematic diagram illustrating the invention's application in constructing symmetric Boolean function quantum circuits or quantum oracles. Figure 6 As shown, the input register X first enters the dynamic Hamming weight calculation module, and the obtained Hamming weights are stored in the weight register W. Subsequently, the function g calculation module calculates the function value based on the Hamming weights in W, where f(x) = g(|x|). The function value is written to the target qubit T, or a phase oracle is formed through phase kickback. After the function calculation is completed, the weight register W and the auxiliary qubit register A can be cleared or restored, while the output on the target qubit T is retained.
[0107] In summary, this invention utilizes the mid-course measurement and classical feedback capabilities of dynamic quantum circuits to transform the global counting process in Hamming weight calculation into a parallel-executable measurement-based fan-out and weighted counting process, achieving Hamming weight calculation at constant depth or constant-level depth. It effectively controls the overhead of auxiliary qubits through a block-based recursive approach; it is adaptable to both fully connected and two-dimensional nearest neighbor qubit connection structures; and it can serve as a general-purpose basic module for constructing quantum circuits or quantum oracles with arbitrary symmetric Boolean functions.
[0108] Furthermore, such as Figure 7 As shown, based on the above-described method for constructing constant-depth quantum circuits using Hamming weight calculation and symmetric Boolean functions, this invention also provides a system for constructing constant-depth quantum circuits using Hamming weight calculation and symmetric Boolean functions. This system includes: The register providing module 51 is used to provide an input register and a weight register, and load the quantum state corresponding to the input bit string to be calculated into each input qubit in the input register to obtain an input register storing the input quantum state; The weighted input module 52 is used to acquire each of the input qubits and use each of the input qubits as weighted inputs to obtain a weighted input set. Fan-out module 53 is used to perform a measurement-type fan-out operation on the weighted input set to obtain a parallel fan-out branch structure; The weighted counting module 54 is used to perform weighted counting operations in each parallel computing branch of the parallel fan-out branch structure to obtain intermediate encoding results; The decoding output module 55 is used to perform a decoding operation on the intermediate encoding result to obtain a weighted counting result in binary form, and write the weighted counting result as a Hamming weight into the weight register to obtain a weight register storing the Hamming weight. The correction and recovery module 56 is used to perform correction operations based on the intermediate measurement results and classical feedback information, clear the temporary information in the intermediate register, and obtain an input register that keeps the input quantum state unchanged and a weight register that retains the Hamming weight.
[0109] Furthermore, such as Figure 8 As shown, based on the above-mentioned Hamming weight calculation and constant-depth quantum circuit construction method and system of symmetric Boolean function, the present invention also provides a terminal, which includes a processor 10, a memory 20 and a display 30. Figure 8 Only some of the terminal components are shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0110] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory. In other embodiments, the memory 20 may be an external storage device of the terminal, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc. Further, the memory 20 may include both internal and external storage devices. The memory 20 is used to store application software and various types of data installed on the terminal, such as the program code installed on the terminal. The memory 20 can also be used to temporarily store data that has been output or will be output. In one embodiment, the memory 20 stores a Hamming weight calculation and constant-depth quantum circuit construction program 40 for symmetric Boolean functions. This Hamming weight calculation and constant-depth quantum circuit construction program 40 can be executed by the processor 10 to implement the Hamming weight calculation and constant-depth quantum circuit construction method for symmetric Boolean functions in this application.
[0111] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor, or other data processing chip, used to run program code stored in the memory 20 or process data, such as performing the Hamming weight calculation and the constant-depth quantum circuit construction method of symmetric Boolean functions.
[0112] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display 30 is used to display information on the terminal and to display a visual user interface. The components of the terminal communicate with each other via a system bus.
[0113] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a Hamming weight calculation and constant-depth quantum circuit construction program for symmetric Boolean functions, wherein when the Hamming weight calculation and constant-depth quantum circuit construction program for symmetric Boolean functions is executed by a processor, it implements the steps of the Hamming weight calculation and constant-depth quantum circuit construction method for symmetric Boolean functions as described above.
[0114] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal. Unless otherwise specified, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or terminal that includes that element.
[0115] Of course, those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0116] It should be understood that the application of the present invention is not limited to the examples above. Those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.
Claims
1. A method for calculating Hamming weights and constructing constant-depth quantum circuits using symmetric Boolean functions, characterized in that, The method for calculating Hamming weights and constructing constant-depth quantum circuits using symmetric Boolean functions includes the following steps: An input register and a weight register are provided. The quantum states corresponding to the input bit string to be calculated are loaded into each input qubit in the input register to obtain an input register storing the input quantum states. Obtain each of the input qubits, and use each of the input qubits as weighted inputs to obtain a weighted input set; Perform a measurement-based fan-out operation on the weighted input set to obtain a parallel fan-out branch structure; A weighted counting operation is performed in each parallel computation branch of the parallel fan-out branch structure to obtain intermediate encoding results; The intermediate encoding result is decoded to obtain a weighted counting result in binary form. The weighted counting result is written as a Hamming weight into the weight register to obtain a weight register storing the Hamming weights. Based on the intermediate measurement results and classical feedback information, a correction operation is performed to clear the temporary information in the intermediate register, resulting in an input register that maintains the input quantum state and a weight register that retains the Hamming weights.
2. The method for calculating Hamming weights and constructing constant-depth quantum circuits using symmetric Boolean functions according to claim 1, characterized in that, The provision of an input register and a weight register, loading the quantum states corresponding to the input bit string to be calculated into each input qubit in the input register to obtain an input register storing the input quantum states, specifically includes: It provides input registers, weight registers, and classic control registers; The quantum states corresponding to the input bit string to be calculated are loaded into each input qubit in the input register to obtain the input register storing the input quantum states; The intermediate measurement results generated during the calculation process are saved to the classical control register, and a feedback control signal is generated based on the intermediate measurement results.
3. The method for calculating Hamming weights and constructing constant-depth quantum circuits using symmetric Boolean functions according to claim 1, characterized in that, The step of acquiring each of the input qubits and using each of the input qubits as weighted inputs to obtain a weighted input set specifically includes: Obtain each input qubit, determine the current computing task type, and obtain the current computing task type determination result; When the current computing task type determination result is a normal Hamming weighted computing task, the weight of each input qubit is set to 1, resulting in a weighted input set with a weight of 1. When the current computation task type is determined to be a block summary task or a recursive summary task, each binary bit in the local weight register is obtained as an intermediate quantity, and the corresponding binary weight is determined according to the number of bits of each binary bit, so as to obtain a weighted input set with different fixed weights.
4. The method for calculating Hamming weights and constructing constant-depth quantum circuits using symmetric Boolean functions according to claim 1, characterized in that, The step of performing a measurement-based fan-out operation on the weighted input set to obtain a parallel fan-out branch structure specifically includes: Select an auxiliary qubit or a temporary qubit in a fan-out branch as the qubit to be measured, perform an intermediate measurement operation on the qubit to be measured, and obtain the intermediate measurement result. Based on the intermediate measurement results, classical feedback information is determined, and subsequent correction operations are determined based on the classical feedback information. A coherent fan-out structure corresponding to the computational basis value of each weighted input in the weighted input set is established using the auxiliary qubit, the intermediate measurement results, and the classical feedback information. The counting information corresponding to each weighted input is distributed to multiple parallel computing branches to obtain a parallel fan-out branch structure.
5. The method for calculating Hamming weights and constructing constant-depth quantum circuits using symmetric Boolean functions according to claim 1, characterized in that, The step of performing a weighted counting operation in each parallel computation branch of the parallel fan-out branch structure to obtain intermediate encoding results specifically includes: Obtain the parallel fan-out branch structure, determine the computational basis value of the corresponding weighted input qubit in each parallel computation branch of the parallel fan-out branch structure, and obtain the judgment result of each parallel computation branch. Based on the judgment results of each parallel computing branch, when the computing base value is 1, a controlled operation related to the fixed weight is applied in the corresponding parallel branch, and the count contribution corresponding to the fixed weight is accumulated to obtain the accumulated count contribution result of each parallel computing branch. By summing up the cumulative results of the count contributions described above, the total weight of all weighted inputs is obtained; The total weight is encoded into an intermediate register or a phase register to obtain an intermediate encoding result.
6. The method for calculating Hamming weights and constructing constant-depth quantum circuits using symmetric Boolean functions according to claim 1, characterized in that, The process of decoding the intermediate encoding result to obtain a weighted counting result in binary form, and writing the weighted counting result as a Hamming weight into the weight register to obtain a weight register storing the Hamming weights, specifically includes: Obtain the intermediate encoding result, perform a decoding operation on the intermediate encoding result, convert the intermediate encoding result into a weighted counting result in binary form, and obtain a weighted counting result in binary form; Obtain the task type identifier of the current computing task, and determine whether the current computing task is the final global Hamming weight calculation task based on the task type identifier; When the current calculation task is the final global Hamming weight calculation task, the weighted count result in binary form is written as the Hamming weight into the weight register to obtain the weight register storing the final global Hamming weight. When the current computation task is an intermediate layer aggregation task, the weighted counting result in binary form is written into the local weight register to obtain a local weight register storing local Hamming weights.
7. The method for calculating Hamming weights and constructing constant-depth quantum circuits using symmetric Boolean functions according to claim 1, characterized in that, The step of performing a correction operation based on the intermediate measurement results and classical feedback information, clearing temporary information in the intermediate registers, and obtaining an input register that maintains the input quantum state and a weight register that retains the Hamming weights, specifically includes: Acquire intermediate measurement results and classical feedback information, determine the correction operation type based on the intermediate measurement results and classical feedback information, and generate a correction operation instruction based on the correction operation type; The target correction operation is determined based on the correction operation instruction, which may be a Pauli correction operation, a gate selection operation, a phase correction operation, a decoding correction operation, or a subsequent line control operation. The target correction operation is performed on the temporary information in the intermediate register generated during the measurement fan-out operation and the weighted counting operation to clear the temporary information in the intermediate register, resulting in a cleared intermediate register; Perform a measurement release operation, reset operation, recovery operation, or reuse tag operation on the auxiliary quantum bit to set the auxiliary quantum bit to a specified state or a reusable state, thereby obtaining the recovered auxiliary quantum bit; Read the current state of the input register, confirm that the input register maintains the input quantum state unchanged, and obtain the input register that maintains the input quantum state unchanged; Read the current state of the weight register, confirm that the weight register retains the Hamming weight, and obtain the weight register that retains the Hamming weight.
8. A constant-depth quantum circuit construction system for Hamming weight calculation and symmetric Boolean functions, characterized in that, The Hamming weight calculation and constant-depth quantum circuit construction system for symmetric Boolean functions is used to implement the Hamming weight calculation and constant-depth quantum circuit construction method for symmetric Boolean functions as described in any one of claims 1-7. The Hamming weight calculation and constant-depth quantum circuit construction system for symmetric Boolean functions comprises: A register providing module is used to provide an input register and a weight register, and to load the quantum state corresponding to the input bit string to be calculated into each input qubit in the input register to obtain an input register storing the input quantum state; A weighted input module is used to acquire each of the input qubits and use each of the input qubits as weighted inputs to obtain a weighted input set. The fan-out module is used to perform a measurement-based fan-out operation on the weighted input set to obtain a parallel fan-out branch structure; The weighted counting module is used to perform weighted counting operations in each parallel computing branch of the parallel fan-out branch structure to obtain intermediate encoding results; The decoding output module is used to perform a decoding operation on the intermediate encoding result to obtain a weighted counting result in binary form, and write the weighted counting result as a Hamming weight into the weight register to obtain a weight register storing the Hamming weights. The correction and recovery module is used to perform correction operations based on the intermediate measurement results and classical feedback information, clear the temporary information in the intermediate register, and obtain the input register that keeps the input quantum state unchanged and the weight register that retains the Hamming weight.
9. A terminal, characterized in that, The terminal includes: a memory, a processor, and a Hamming weight calculation and constant-depth quantum circuit construction program for symmetric Boolean functions stored in the memory and executable on the processor. When the Hamming weight calculation and constant-depth quantum circuit construction program for symmetric Boolean functions is executed by the processor, it implements the steps of the Hamming weight calculation and constant-depth quantum circuit construction method for symmetric Boolean functions as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program for constructing constant-depth quantum circuits using Hamming weights and symmetric Boolean functions. When executed by a processor, the program implements the steps of the method for constructing constant-depth quantum circuits using Hamming weights and symmetric Boolean functions as described in any one of claims 1-7.
