A quantum partial search oriented expected circuit depth optimization method and system
By constructing global and local Grover operators to optimize the quantum partial search algorithm in a three-dimensional invariant subspace, the problem of the failure to uniformly consider the difference in global diffusion and local diffusion depth in the existing technology is solved, and the target block index is efficiently output on the quantum processor.
Patent Information
- Application Number
- CN202611245999.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-17
- Publication Date
- 2026-11-06
AI Technical Summary
Existing quantum partial search algorithms fail to incorporate the difference in implementation depth between global and local diffusion paths into the cost model, and lack a parameterized design framework that automatically selects the optimal depth sequence based on hardware parameters, resulting in the query optimal not being equivalent to the actual operational optimal depth.
By acquiring the Oracle implementation depth, global diffusion operator implementation depth, and local diffusion operator implementation depth of the target quantum hardware, global and local Grover operators are constructed to generate a family of candidate sequences. These sequences are then optimized in a three-dimensional invariant subspace. The expected depth and success probability of each candidate sequence are calculated, and the sequence with the smallest expected depth and its parameters are selected. The sequence is then expanded into a quantum gate circuit and submitted to the quantum processor for execution.
This approach achieves deep optimization from theoretically optimal sequences to practically hardware-executable sequences, reduces the average diffusion layer depth, and outputs the target block index on a quantum processor, thus resolving the inconsistency issue in deep optimization in existing technologies.
Smart Images

Figure CN123050674A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of quantum circuit depth optimization technology, and in particular to a method and system for optimizing desired circuit depth for quantum partial search. Background Technology
[0002] In the field of quantum disordered search, Grover's algorithm and its optimal query complexity are widely recognized. However, in practical scenarios such as partitioned databases and hierarchical search, users often only need to locate the data block containing the target rather than the complete target item. Therefore, the Grover-Radhakrishnan-Korepin (GRK) quantum partial search algorithm introduces a local diffusion operator that only operates on the qubits within the block, achieving target block index identification with fewer Oracle calls. However, the optimization metrics of existing quantum partial search schemes still focus on the number of Oracle queries, failing to incorporate the differences in the implementation depth of Oracle, global diffusion operator, and local diffusion operator on real quantum devices into a unified cost function. Since the global diffusion operator operates on all n qubits, while the local diffusion operator only operates on the m qubits within the block, their compilation depth often differs significantly in actual hardware, and optimal query complexity does not equate to optimal depth complexity. Meanwhile, the fixed "global-local-global" structure of the GRK algorithm cannot adaptively utilize the advantage of shallower local diffusion. When the oracle depth and diffusion depth are comparable, there is still room to replace some global operations with more local operations to reduce the overall depth. If global and local Grover operations are simply and arbitrarily concatenated, it may disrupt the effective amplitude amplification path, leading to a decrease in the success probability. In addition, existing schemes lack a parameterized design framework that simultaneously considers the success probability, the implementation depth of the three types of operators, the cost of repeated execution, and finite size correction. It is difficult to automatically select the optimal sequence based on specific hardware parameters, resulting in a significant gap between theoretical optimality and actual engineering implementation. Summary of the Invention
[0003] This invention provides a method and system for optimizing the desired path depth for quantum partial search, which addresses the problem that existing quantum partial search algorithms only use the number of Oracle queries as the optimization metric, fail to incorporate the difference in path implementation depth between global and local diffusion into the cost model, and lack a parameterized design framework that automatically selects the optimal depth sequence based on hardware parameters, resulting in the query optimality not being equivalent to the actual running optimal depth.
[0004] The objective of this invention can be achieved through the following technical solutions:
[0005] The first aspect of this invention is to provide a method for optimizing the desired path depth for quantum partial search, comprising: Obtain the Oracle implementation depth, global diffusion operator implementation depth, and local diffusion operator implementation depth of the target quantum hardware; construct the global Grover operator and the local Grover operator based on the database size and block size; calculate the depth ratio based on the Oracle implementation depth and the global diffusion operator implementation depth. A candidate sequence family is generated based on the global Grover operator and the local Grover operator; the candidate sequence family includes at least alternating core sequences and extended sequences with finite-size edge operators; Construct a three-dimensional invariant subspace; rewrite the global Grover operator and the local Grover operator into the three-dimensional invariant subspace to obtain the corresponding O(3) real orthogonal rotation reflection matrices; based on the O(3) real orthogonal rotation reflection matrices corresponding to the global Grover operator and the local Grover operator, obtain the total transformation matrix of each candidate sequence in the three-dimensional subspace; rewrite the uniformly superimposed initial state into the three-dimensional invariant subspace to obtain the initial amplitude vector; obtain the success probability of the target block of each candidate sequence through the total transformation matrix and the initial amplitude vector; Based on the depth ratio, the global diffusion operator realization depth, and the local diffusion operator realization depth, calculate the line depth of each candidate sequence. Divide the line depth of each candidate sequence by the target block success probability to obtain the expected depth of each candidate sequence. Select the candidate sequence with the smallest expected depth and its parameters. The selected sequence is expanded into a quantum gate-level circuit and submitted to the quantum processor for execution. The block index qubits are measured and the target block index is output.
[0006] Furthermore, the construction process of the global Grover operator and the local Grover operator is as follows:
[0007]
[0008] In the formula, For global Grover operators, For local Grover operators, For global diffusion operators, For local diffusion operators, It is the target phase reversal Oracle.
[0009] Furthermore, the formula for calculating the depth ratio is:
[0010] In the formula, The implementation depth of Oracle for the target phase reversal. The implementation depth of the global diffusion operator, Indicates the depth ratio.
[0011] Furthermore, the generation process of the alternating core sequence is as follows: using the local Grover operator of Repeated and one global Grover operator Constructing basic alternating blocks Repeat the basic alternation block k times to obtain the alternation core sequence. ;in, This represents the number of repetitions of the alternating block. The number of local Grover repetitions in each alternation block; The process of generating the extended sequence with the finite-size edge operator is as follows: based on the alternating core sequence, an edge block is added to the end of the sequence. Obtain the extended sequence with finite-size edge operators. ;in, This represents the number of repetitions in the local edge region, used to correct for deviations caused by integer rounding in finite-scale applications.
[0012] Furthermore, the construction process of the three-dimensional invariant subspace is as follows: define three orthogonal ground states—target states. Uniform superposition state of non-target items within the target block Uniform superposition state of non-target block This constitutes a three-dimensional invariant subspace that forms part of the search problem.
[0013] Furthermore, the formula for calculating the success probability of the target block for each candidate sequence is as follows:
[0014] In the formula, The initial state is an n-bit uniform superposition. S represents the uniform superposition state of the non-target block, and S is the total transformation operator corresponding to the candidate sequence. Indicates the final state at Amplitude components in the direction, The probability of success for the target block for each candidate sequence.
[0015] Furthermore, the formula for calculating the line depth is:
[0016] In the formula, This represents the line depth of candidate sequence S. Indicates the depth ratio; Represents the Oracle operator in the candidate sequence Total number of calls; Represents the global diffusion operator Depth of hardware implementation Represents the global Grover operator in the candidate sequence Total number of calls, Represents the local Grover operator in the candidate sequence Total number of calls, Represents the local diffusion operator The depth of implementation in hardware.
[0017] A second aspect of the present invention is to provide a desired path depth optimization system for quantum partial search, comprising: The parameter acquisition and operator construction module is used to acquire the Oracle implementation depth, global diffusion operator implementation depth, and local diffusion operator implementation depth of the target quantum hardware; construct the global Grover operator and the local Grover operator based on the database size and block size; and calculate the depth ratio based on the Oracle implementation depth and the global diffusion operator implementation depth. Candidate sequence generation module: used to generate a family of candidate sequences based on global Grover operators and local Grover operators; the family of candidate sequences includes at least alternating core sequences and extended sequences with finite-size edge operators; Success probability assessment module: used to construct a three-dimensional invariant subspace; rewrite the global Grover operator and the local Grover operator into the three-dimensional invariant subspace to obtain the corresponding O(3) real orthogonal rotation reflection matrices; based on the O(3) real orthogonal rotation reflection matrices corresponding to the global Grover operator and the local Grover operator, obtain the total transformation matrix of each candidate sequence in the three-dimensional subspace; rewrite the uniformly superimposed initial state into the three-dimensional invariant subspace to obtain the initial amplitude vector; obtain the success probability of the target block of each candidate sequence through the total transformation matrix and the initial amplitude vector; Expected Depth Optimization Module: This module calculates the line depth of each candidate sequence based on the depth ratio, the global diffusion operator's realized depth, and the local diffusion operator's realized depth. It then divides the line depth of each candidate sequence by the target block success probability to obtain the expected depth of each candidate sequence. Finally, it selects the candidate sequence with the smallest expected depth and its parameters. Quantum circuit compilation and execution module: used to expand the selected sequence into quantum gate-level circuits and submit them to the quantum processor for execution, measure the block index qubits and output the target block index.
[0018] A third aspect of the present invention is to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the aforementioned method for optimizing desired circuit depth for quantum partial search.
[0019] A fourth aspect of the present invention is to provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned method for optimizing desired circuit depth for quantum partial search.
[0020] Compared with the prior art, the beneficial effects of the present invention are: The algorithm acquires the implementation depth of the target quantum hardware, including the Oracle implementation depth, the global diffusion operator implementation depth, and the local diffusion operator implementation depth. Based on the database size and block size, it constructs the global Grover operator and the local Grover operator. It calculates the depth ratio based on the Oracle implementation depth and the global diffusion operator implementation depth. By acquiring the hardware implementation depth of the three types of operators and calculating the depth ratio, the optimization objective is transformed from the theoretical number of queries to the actual depth cost that can be executed by the hardware, providing a precise hardware-aware foundation for subsequent depth optimization. Based on the global Grover operator and the local Grover operator, a candidate sequence family is generated; the candidate sequence family includes at least alternating core sequences and extended sequences with finite-size edge operators; by constructing a candidate family of alternating core sequences and extended sequences with edge operators, an optional structure space with theoretical amplitude amplification guarantee is provided for using shallow local operations to replace deep global operations. A three-dimensional invariant subspace is constructed; the global Grover operator and the local Grover operator are rewritten into the three-dimensional invariant subspace to obtain the corresponding O(3) real orthogonal rotation reflection matrices; based on the O(3) real orthogonal rotation reflection matrices corresponding to the global Grover operator and the local Grover operator, the total transformation matrix of each candidate sequence in the three-dimensional subspace is obtained; the uniformly superimposed initial state is rewritten into the three-dimensional invariant subspace to obtain the initial amplitude vector; the success probability of the target block of each candidate sequence is obtained through the total transformation matrix and the initial amplitude vector; by reducing the problem to the three-dimensional invariant subspace and using the O(3) rotation reflection matrix to calculate the success probability, high-dimensional simulation is avoided, and a fast and accurate evaluation of the success probability of the candidate sequence is achieved. Based on the depth ratio, the global diffusion operator realization depth, and the local diffusion operator realization depth, the path depth of each candidate sequence is calculated. The path depth of each candidate sequence is divided by the success probability of the target block to obtain the expected depth of each candidate sequence. The candidate sequence with the smallest expected depth and its parameters are selected. By using the expected depth as the optimization objective and selecting the sequence with the smallest expected depth, a quantifiable trade-off is established between the single path depth and the success probability, so that the selected sequence has the lowest average cost when actually repeated. The selected sequence is expanded into quantum gate-level circuits and submitted to a quantum processor for execution. The block index qubits are measured, and the target block index is output. The theoretically optimal sequence is transformed into a physical gate-level circuit that can be executed on a real quantum processor, and the target block is output, realizing a closed-loop process from optimization to physical execution. This solves the problem that existing quantum partial search algorithms only use the number of Oracle queries as the optimization metric, fail to incorporate the difference in implementation depth between global and local diffusion circuits into the cost model, and lack a parameterized design framework that automatically selects the depth-optimal sequence based on hardware parameters, resulting in the query optimality not being equivalent to the actual execution depth-optimal. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This invention provides a flowchart illustrating the steps of a method for optimizing the desired path depth in quantum partial search. Figure 2 A schematic diagram of the module flow of the desired path depth optimization system for quantum partial search provided by the present invention; Figure 3 For quantum partial search tasks and global diffusion Local diffusion A diagram illustrating the depth differences; Figure 4 A schematic diagram of the quantum circuitry for the GRK algorithm; Figure 5 for A schematic diagram of the quantum circuitry of the algorithm; Figure 6 The diagram illustrates the evolution of quantum states under the action of the GRK operator series and the alternating operator sequence, respectively. Figure 7 This is a graph showing the change in the expected depth reduction ratio as a function of the database size n. Detailed Implementation
[0023] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0025] To address the problems existing in the background technology, this invention studies and designs a method and system for optimizing the desired line depth for quantum partial search. Specifically, this invention expands the optimization objective from the number of Oracle queries to the desired line depth. By constructing an alternating core sequence with an effective rotational reflection structure of O(3) and an extended sequence with finite-size edge operators, the average diffusion layer depth is reduced while maintaining the amplitude amplification capability. Furthermore, a parameter selection mechanism combining analytical decision-making based on a hardware depth model and integer search is established, thereby achieving a quantizable depth reduction relative to the GRK algorithm on a practical quantum processor.
[0026] like Figure 1 As shown, the first aspect of the present invention is to provide a method for optimizing the desired path depth for quantum partial search, comprising the following steps: Step S1: Obtain the Oracle implementation depth, global diffusion operator implementation depth, and local diffusion operator implementation depth of the target quantum hardware; construct the global Grover operator and the local Grover operator based on the database size and block size; calculate the depth ratio based on the Oracle implementation depth and the global diffusion operator implementation depth.
[0027] It should be noted that in the actual hardware execution of quantum partial search, the Oracle, global diffusion operator and local diffusion operator have significantly different compilation depths due to the different number of active qubits, and this difference in depth changes with the hardware topology and gate set. Therefore, in order to use the line depth rather than just the number of queries as the optimization target, it is necessary to first quantify the actual implementation depth of these three basic operators on a given hardware, so as to provide a unified cost metric for the expected depth calculation of subsequent candidate sequences.
[0028] Specifically, the database size parameter n (i.e., the total number of qubits) and the block size m (i.e., the number of qubits within the block) are obtained, and the target Oracle is obtained. The gate-level circuit description (quantum circuit description) of ). Among them, It is the target phase reversal Oracle; ,in, The unit operator (identity operator) has a dimension of ; The target quantum state (i.e., the quantum state representation of the target item to be searched in the database); for The conjugate transpose (left vector). The projection operator for the target state projects any quantum state onto the direction of the target state.
[0029] On the target quantum hardware, respectively, Oracle ( Global diffusion operator and local diffusion operator Compilation, mapping, and scheduling are performed to obtain their respective implementation depths. , and ;in, It is Oracle depth; , is the global diffusion depth; , is the local diffusion depth; among which, It is a global diffusion operator that acts on all... One quantum bit; It is a local diffusion operator, which only operates within the block. The number of qubits; where the local diffusion depth can be obtained from actual compilation results, gate-level decomposition models, hardware topology, or empirical calibration.
[0030] The specific formula for calculating the depth ratio parameter is as follows:
[0031] In the formula, This is the depth ratio.
[0032] Global and local Grover operators are constructed for use in subsequent candidate sequence generation. The specific representations of the global and local Grover operators are as follows:
[0033]
[0034] In the formula, For global Grover operators, This is a local Grover operator.
[0035] Among them, the quantum partial search task and global diffusion Local diffusion A diagram illustrating the depth differences is shown below. Figure 3 As shown.
[0036] Step S2: Generate a candidate sequence family based on the global Grover operator and the local Grover operator; the candidate sequence family includes at least alternating core sequences and extended sequences with finite-size edge operators.
[0037] It should be noted that, due to global Grover operations... and local Grover operations Due to varying implementation depths, and the fact that local operations are typically significantly shallower than global operations, the fixed "global-local-global" structure of the existing GRK algorithm cannot flexibly adapt to diverse hardware depth ratios. Therefore, in order to maximize the use of shallow local operations to replace deep global operations and reduce the total depth while maintaining effective amplitude amplification, it is necessary to construct a system containing alternating core sequences. and edge correction sequences with finite size This provides a variety of candidate sequence families, including theoretically guaranteed amplitude amplification, thus offering an optional structure space for subsequent optimization.
[0038] Specifically, based on the global Grover operator and local Grover operator A candidate sequence family is generated; in this embodiment, the candidate sequence family includes three types of core candidate sequences; the three types of core candidate sequences include: alternating core sequences, extended sequences with edge correction (extended sequences with finite-size edge operators), and control sequences.
[0039] The generation process of the alternating core sequence is as follows: using the local Grover operator of Repeated and one global Grover operator Constructing basic alternating blocks Repeat this process k times to obtain the alternating core sequence. .in, This represents the number of repetitions of the alternating block. The number of times the local Grover repeats in each alternation block.
[0040] The process of generating the extended sequence with finite-size edge operators is as follows: based on the alternating core sequence, an edge block is added to the end of the sequence. Obtain the extended sequence with finite-size edge operators. ;in, This represents the number of repetitions in the local edge region, used to correct for deviations caused by integer rounding in finite-scale applications. The edge operator in the code is used to handle the case where the optimal total number of iterations is not divisible by the alternation block length under finite size; when Or when edge operators are ignored, Degenerate into an alternating core In the form of.
[0041] In this embodiment, the control sequence is a classic GRK sequence, which is represented as follows: This classic GRK sequence is used as a benchmark for comparison, and a single global operation is retained. As a candidate.
[0042] The quantum circuit diagram of the GRK algorithm for constructing classic GRK sequences is shown in the following figure. Figure 4 As shown, the input state is Initial state of a quantum bit (The initial state is the initial quantum state), acting sequentially Second-rate , Second-rate and 1 time Finally, projection measurements are performed.
[0043] in, The quantum circuit diagram of the algorithm is shown in the following figure. Figure 5 As shown, the input state is Initial state of a quantum bit Alternating operator sequences will Combination repetition Next, the boundary operator sequence is: Finally, projection measurements are performed.
[0044] The evolution diagrams of quantum states under the action of the GRK operator series and the alternating operator sequence are shown below. Figure 6 As shown, in contrast, the present invention also retains GRK sequences as a candidate family.
[0045] Among them, through , , and single global operation Comparison between Different depth ratios can be obtained. With block dimensions The optimal sequence under the condition of Oracle depth dominance. or It might be better when local diffusion is much shallower than global diffusion and Oracle depth is not dominant. or Better.
[0046] Wherein, parameter initialization: is the integer parameter k of the above candidate sequence, , , , Set the initial search range or analytical estimate for use in subsequent optimization phases.
[0047] Step S3: Construct a three-dimensional invariant subspace; rewrite the global Grover operator and the local Grover operator into the three-dimensional invariant subspace to obtain the corresponding O(3) real orthogonal rotation reflection matrices; based on the O(3) real orthogonal rotation reflection matrices corresponding to the global Grover operator and the local Grover operator, obtain the total transformation matrix of each candidate sequence in the three-dimensional subspace; rewrite the uniformly superimposed initial state into the three-dimensional invariant subspace to obtain the initial amplitude vector; obtain the success probability of the target block for each candidate sequence through the total transformation matrix and the initial amplitude vector.
[0048] It should be noted that, because candidate sequences (such as...) , , ) consists of multiple and The operators are composed of multiple parts, and their direct impact on the success probability of the target block in a high-dimensional Hilbert space cannot be directly determined. However, the quantum partial search problem has a symmetric structure in a three-dimensional invariant subspace. and In this subspace, each can be represented as an exact O(3) rotation reflection matrix. Therefore, in order to quickly and accurately quantify the success probability of each candidate sequence to the target block without performing high-dimensional state vector simulation, so as to provide a reliable numerical basis for the subsequent calculation and minimization of the expected depth, it is necessary to evaluate the success probability of each candidate sequence based on the three-dimensional invariant subspace representation.
[0049] Specifically, (1) construct a three-dimensional invariant subspace; specifically: define three orthogonal ground states and target states. Uniform superposition state of non-target items within the target block Uniform superposition state of non-target block This constitutes a three-dimensional invariant subspace that forms part of the search problem.
[0050] (2) The global Grover operator and local Grover operator Rewritten into a three-dimensional invariant subspace, we obtain the corresponding 3×3 O(3) real orthogonal rotation reflection matrices; (Rewriting the Grover operator into a three-dimensional invariant subspace; then the global Grover operator) and local Grover operator In this three-dimensional invariant subspace, it is represented as a 3×3 O(3) real orthogonal rotation reflection matrix.
[0051] (3) Based on the global Grover operator and local Grover operator The corresponding O(3) real orthogonal rotation reflection matrix is used to obtain the total transformation matrix of each candidate sequence in the three-dimensional subspace; specifically: based on the candidate sequence (such as... , , The operator order and repetition number of O(3) rotation reflection matrices are multiplied sequentially to obtain the total transformation matrix of the sequence in the three-dimensional subspace.
[0052] (4) Calculate the projection of the initial state onto the three-dimensional invariant subspace; specifically: uniformly superimpose the initial states Rewritten to a three-dimensional invariant subspace, the initial amplitude vector is obtained. This vector is derived from the uniformly superimposed initial states. The object is all n qubits in the main register.
[0053] Among them, the initial state is uniformly superimposed. By the initial quantum state Apply a Hadamard gate to each qubit (i.e., The initial state is obtained through operations; this is the standard method for preparing the initial state in a quantum search algorithm. Here, n represents the total number of qubits in the database address, i.e., the database size. This also represents the number of qubits in the master register of the quantum circuit. H represents the Hadamard gate, a fundamental quantum logic gate that operates on a single qubit, and its matrix representation is... Its function is to calculate the ground state. and Mapped to a superposition state with equal probability.
[0054] (5) Apply the total transformation matrix and extract the success probability; specifically, apply the total transformation matrix to the initial amplitude vector to obtain the amplitude vector of the final state in the three-dimensional invariant subspace; take the target block subspace (i.e., and The sum of the squared probabilities of the two-dimensional subspace (formed by the candidate sequence) is the probability of the target block succeeding; the specific formula for calculating the probability of the target block succeeding is as follows:
[0055] In the formula, The initial state is an n-bit uniform superposition. S represents a uniform superposition of non-target blocks (the third ground state in the three-dimensional invariant subspace), and S is a candidate sequence (e.g., , , The corresponding total transformation operator; Indicates the final state at The amplitude component in the direction of the vibration has a squared modulus that represents the probability of not being the target block; subtracting this probability from 1 gives the total success probability of the measurement result falling into the target block subspace. This formula is a universal definition for all candidate sequences and is applicable to any candidate sequence. , , and single A unified probability calculation method.
[0056] For alternating core sequences , In the three-dimensional partial search invariant subspace, belonging to Transformation whose spectrum is determined by a real eigenvalue and a pair of conjugate eigenvalues Composition. The initial state lies within a two-dimensional effective rotation subspace, therefore The repetitive action can be transformed into a two-dimensional rotation. Let... , Then the exact success probability of alternating cores can be expressed as:
[0057] in, , ; b represents the number of blocks in the database, and b represents the size of each block. Indicates the intermediate angle variable. This indicates the angle determined by the dimensions within the block. This represents the total number of repetitions of the alternating block in the alternating core sequence. Represents the local Grover operator within each alternation block. The number of repetitions, Let be the arcsine function. The entire formula represents: in a three-dimensional invariant subspace, after ... After the action, the final state is in the ground state of the non-target block. The probability of it being on is Subtracting this value from 1 gives the probability of success for the target block.
[0058] exist , and In this case, the above formula is approximated as:
[0059] The above results demonstrate that the alternating sequence is not an arbitrary splicing, but rather introduces a local block length within the effective two-dimensional rotation angle. The rotation factor is adjusted to reduce the average diffusion depth while maintaining the amplitude amplification capability.
[0060] In the context of quantum partial search, the target block refers to the database being divided into... After several blocks, the block containing the target element t has the index . (n) (m bits). The ultimate goal of the user performing a partial search is to identify and output this block index. rather than a specific location within the block. .
[0061] Step S4: Calculate the line depth of each candidate sequence based on the depth ratio, the global diffusion operator realization depth, and the local diffusion operator realization depth. Divide the line depth of each candidate sequence by the target block success probability to obtain the expected depth of each candidate sequence. Select the candidate sequence with the smallest expected depth and its parameters.
[0062] It should be noted that different parameter combinations in the candidate sequence family will lead to different line depths and success probabilities. Maximizing the success probability or minimizing the line depth alone cannot reflect the average cost required for actual repeated execution until success. Therefore, in order to establish a calculable trade-off between depth and success rate and select the sequence with the lowest expected cost in actual operation, it is necessary to use the expected depth as the objective function to search and compare the parameters of each candidate sequence, thereby determining the optimal sequence and its parameters.
[0063] Specifically, the following steps are included: Step 1: Calculate the path depth of each candidate sequence. Specifically: based on the sequence and The number of calls and depth parameters , and The line depth of each candidate sequence is calculated according to the line depth formula; the line depth formula is specifically expressed as:
[0064] In the formula, This represents the line depth of candidate sequence S. This is the ratio of Oracle depth to global diffusion depth (i.e., depth ratio). Represents the Oracle operator in the candidate sequence Total number of calls (due to each) and Each involves a single Oracle call, therefore ); Represents the global diffusion operator Depth of hardware implementation Represents the global Grover operator in the candidate sequence Total number of calls, Represents the local Grover operator in the candidate sequence Total number of calls, Represents the local diffusion operator The depth of implementation in hardware.
[0065] Step 2: Calculate the expected depth of each candidate sequence. Specifically, the expected depth of each candidate sequence is obtained by dividing the line depth of each candidate sequence by the success probability of the target block; this can be expressed by the formula:
[0066] In the formula, The line depth for each candidate sequence, This represents the success probability of the target block.
[0067] Step 3: Analyze and estimate the initial values of the optimal parameters; specifically: based on the success probability expression of the alternating core sequence. By deriving k through step-by-step minimization of the outer stopping angle and the local block length, we obtain k. The continuous approximate optimal solution is used as the initial search center for subsequent integer enumerations.
[0068] Among them, k is obtained through parsing. The specific process of obtaining the continuous approximate optimal solution is as follows: Define the depth of a local Grover operation as Define the depth saving of local substitution relative to global diffusion as and order The depth of the alternating core sequence is:
[0069] Substituting the approximate success probability formula into Then, the optimization can be decomposed into a general outer stopping angle optimization and a local block length optimization. Let:
[0070] Then fixed Minimize Its optimal For the equation The smallest positive root:
[0071] This leads to an approximate choice of the number of repetitions in the outer layer:
[0072] further, Minimize:
[0073] Determined. The continuous approximate solution under the bulk limit is:
[0074]
[0075] The above rules can be used as initial parameter values for the quantum circuit compilation front-end; in actual implementation, further adjustments will be made. , , Local enumeration of neighboring integer values, selecting The smallest valid sequence.
[0076] Step 4, Critical Depth Ratio Determination and Candidate Family Screening; specifically: based on the hardware measured depth ratio... The ratio of the boundary depth derived from n and m and the critical value compared with GRK Comparison of numerical relationships between them and The size of the set of candidate families that should be prioritized for searching or excluded is determined by the size of the set of families, thereby narrowing the search range for subsequent integer enumerations.
[0077] The specific process for obtaining the candidate family set is as follows: The benefits of introducing local operations diminish as local diffusion costs increase or Oracle costs become more dominant. In linear depth models... , Below, the boundary depth ratio at which local insertion begins to lose its advantage can be defined:
[0078] when Above the boundary depth ratio At this time, the alternating core can degenerate into a serial Grover-type structure without local operations; when Below the critical value obtained by comparing with GRK At that time, alternating or edge sequences are shallower compared to GRK. For small The branch can be approximated as follows as the initial decision:
[0079] In engineering implementation, this invention preferably adopts the method of "analytical judgment + small-range integer enumeration": first, according to... , , Determine candidate families, and then focus on analysis. , Enumeration, and finally calculation based on the actual compilation depth and success probability. And determine the optimal sequence. The parameter search range is usually taken as an integer interval of ±3 around the initial analytical estimate. Enumeration within this range can cover the global optimal solution, and the computational cost is acceptable.
[0080] Step 5: Local integer enumeration and optimal selection; enumerate k within a small range near the initial analytical value. , , , For each valid combination of parameters, repeat steps 1-2 to calculate the integer value. ,choose The smallest sequence and its parameters are used as the final output.
[0081] Thus, the optimal candidate sequence and its corresponding parameters are obtained.
[0082] Step S5: Expand the selected sequence into a quantum gate circuit and submit it to the quantum processor for execution, measure the block index qubits and output the target block index.
[0083] It should be noted that the optimal sequence selected in stage four is based on an abstract operator ( The mathematical structure represented by the number of repetitions of the quantum key cannot be directly run on a quantum processor. Quantum hardware can only recognize and execute quantum circuits composed of underlying physical gates (such as CNOT, single-qubit rotation gates, etc.). Therefore, in order to transform the theoretically optimized operator sequence into physical gate-level instructions that can be executed on real quantum devices, and finally obtain the output result of the target block index through measurement, it is necessary to expand, compile, and map the abstract sequence onto the gate set and topology of the specific hardware to generate an executable quantum circuit and submit it to the quantum processor for execution.
[0084] Specifically, the optimal candidate sequence is expanded into gate-level circuits of an Oracle and a diffusion operator according to the definition. After hardware compilation and optimization, it is submitted to the quantum processor for execution, and the block index bits are measured to output the target block index. The specific process of outputting the target block index is as follows: (1) Expand the optimal candidate sequence (abstract operator sequence) into a gate-level circuit; specifically: expand the determined optimal candidate sequence (such as ( , , Each of the following and Operator, expanded according to its definition, is an Oracle. Global diffusion Local diffusion The abstract circuit is further decomposed into the underlying quantum gates (such as Hadamard gate, multi-control Z gate, CNOT gate, single-qubit rotation gate, etc.).
[0085] (2) Hardware mapping and compilation optimization; Specifically, based on the coupling topology, native gate set, noise characteristics and number of available auxiliary bits of the target quantum processor, the obtained gate-level circuits are subjected to quantum bit mapping, gate rewriting, layout and scheduling optimization to minimize the actual execution depth or fidelity loss.
[0086] (3) Generate executable pulse / instruction sequences; specifically: convert the compiled and optimized gate-level circuits into pulse sequences or machine instructions that can be executed by the quantum processor (such as QASM code or pulse control files submitted through the cloud platform API).
[0087] (4) Submit to the quantum processor for execution; specifically: submit the generated executable circuit to a real quantum processor or a high-performance quantum simulator for execution, and repeat the execution multiple times (shots) to collect measurement statistics.
[0088] (5) Measure the block index and output the result; for the block index qubits in the line (corresponding to The first n The measurement is performed using m bits. The measurement results are statistically analyzed, and the block index with the highest frequency is output as the target block index. .
[0089] The curve showing the change in expected depth reduction ratio as a function of database size n is shown below. Figure 7 As shown.
[0090] like Figure 2 As shown, a second aspect of the present invention is to provide a desired path depth optimization system for quantum partial search, comprising: Parameter acquisition and operator construction module 101: used to acquire the Oracle implementation depth, global diffusion operator implementation depth, and local diffusion operator implementation depth of the target quantum hardware; construct the global Grover operator and the local Grover operator according to the database size and block size; calculate the depth ratio based on the Oracle implementation depth and the global diffusion operator implementation depth; Candidate sequence generation module 102: used to generate a family of candidate sequences based on global Grover operators and local Grover operators; the family of candidate sequences includes at least alternating core sequences and extended sequences with finite-size edge operators; Success probability assessment module 103: used to construct a three-dimensional invariant subspace; rewrite the global Grover operator and the local Grover operator into the three-dimensional invariant subspace to obtain the corresponding O(3) real orthogonal rotation reflection matrices; obtain the total transformation matrix of each candidate sequence in the three-dimensional subspace based on the O(3) real orthogonal rotation reflection matrices corresponding to the global Grover operator and the local Grover operator; rewrite the uniformly superimposed initial state into the three-dimensional invariant subspace to obtain the initial amplitude vector; obtain the success probability of the target block of each candidate sequence through the total transformation matrix and the initial amplitude vector; Expected Depth Optimization Module 104: Calculates the line depth of each candidate sequence based on the depth ratio, the global diffusion operator's realized depth, and the local diffusion operator's realized depth; divides the line depth of each candidate sequence by the target block success probability to obtain the expected depth of each candidate sequence; and selects the candidate sequence with the smallest expected depth and its parameters. Quantum circuit compilation and execution module 105: used to expand the selected sequence into a quantum gate-level circuit and submit it to the quantum processor for execution, measure the block index qubits and output the target block index.
[0091] A third aspect of the present invention is to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements a method for optimizing desired circuit depth for quantum partial search.
[0092] A fourth aspect of the present invention is to provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements a method for optimizing the desired circuit depth for quantum partial search.
[0093] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, etc.) containing computer-usable program code.
[0094] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, systems, and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0095] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0096] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for optimizing the desired path depth for quantum partial search, characterized in that, include: Obtain the Oracle implementation depth, global diffusion operator implementation depth, and local diffusion operator implementation depth of the target quantum hardware; construct the global Grover operator and the local Grover operator based on the database size and block size; calculate the depth ratio based on the Oracle implementation depth and the global diffusion operator implementation depth. A candidate sequence family is generated based on the global Grover operator and the local Grover operator; the candidate sequence family includes at least alternating core sequences and extended sequences with finite-size edge operators; Construct a three-dimensional invariant subspace; rewrite the global Grover operator and the local Grover operator into the three-dimensional invariant subspace to obtain the corresponding O(3) real orthogonal rotation reflection matrices; based on the O(3) real orthogonal rotation reflection matrices corresponding to the global Grover operator and the local Grover operator, obtain the total transformation matrix of each candidate sequence in the three-dimensional subspace; rewrite the uniformly superimposed initial state into the three-dimensional invariant subspace to obtain the initial amplitude vector; The success probability of the target block for each candidate sequence is obtained by using the total transformation matrix and the initial amplitude vector. Based on the depth ratio, the global diffusion operator realization depth, and the local diffusion operator realization depth, calculate the line depth of each candidate sequence. Divide the line depth of each candidate sequence by the target block success probability to obtain the expected depth of each candidate sequence. Select the candidate sequence with the smallest expected depth and its parameters. The selected sequence is expanded into a quantum gate-level circuit and submitted to the quantum processor for execution. The block index qubits are measured and the target block index is output.
2. The method for optimizing desired path depth for quantum partial search according to claim 1, characterized in that, The construction process of the global Grover operator and the local Grover operator is as follows: In the formula, For global Grover operators, For local Grover operators, For global diffusion operators, For local diffusion operators, It is the target phase reversal Oracle.
3. The method for optimizing the desired path depth for quantum partial search according to claim 1, characterized in that, The formula for calculating the depth ratio is: In the formula, The implementation depth of Oracle for the target phase reversal. The implementation depth of the global diffusion operator, Indicates the depth ratio.
4. The method for optimizing the desired path depth for quantum partial search according to claim 1, characterized in that, The generation process of the alternating core sequence is as follows: using the local Grover operator of Repeated and one global Grover operator Constructing basic alternating blocks Repeat the basic alternation block k times to obtain the alternation core sequence. ;in, This represents the number of repetitions of the alternating block. The number of local Grover repetitions in each alternation block; The process of generating the extended sequence with the finite-size edge operator is as follows: based on the alternating core sequence, an edge block is added to the end of the sequence. Obtain the extended sequence with finite-size edge operators. ;in, This represents the number of repetitions in the local edge region, used to correct for deviations caused by integer rounding in finite-scale applications.
5. The method for optimizing desired path depth for quantum partial search according to claim 1, characterized in that, The construction process of the three-dimensional invariant subspace is as follows: Define three orthogonal ground states and target states. Uniform superposition state of non-target items within the target block Uniform superposition state of non-target block This constitutes a three-dimensional invariant subspace that forms part of the search problem.
6. The method for optimizing desired path depth for quantum partial search according to claim 1, characterized in that, The formula for calculating the success probability of the target block for each candidate sequence is as follows: In the formula, The initial state is an n-bit uniform superposition. S represents the uniform superposition state of the non-target block, and S is the total transformation operator corresponding to the candidate sequence. Indicates the final state at Amplitude components in the direction, The probability of success for the target block for each candidate sequence.
7. The method for optimizing desired path depth for quantum partial search according to claim 1, characterized in that, The formula for calculating the depth of the line is: In the formula, This represents the line depth of candidate sequence S. Indicates the depth ratio; Represents the Oracle operator in the candidate sequence Total number of calls; Represents the global diffusion operator Depth of hardware implementation Represents the global Grover operator in the candidate sequence Total number of calls, Represents the local Grover operator in the candidate sequence Total number of calls, Represents the local diffusion operator The depth of implementation in hardware.
8. A system for optimizing desired path depth for quantum partial search, used to implement the method for optimizing desired path depth for quantum partial search as described in any one of claims 1-7, characterized in that, include: The parameter acquisition and operator construction module is used to acquire the Oracle implementation depth, global diffusion operator implementation depth, and local diffusion operator implementation depth of the target quantum hardware; construct the global Grover operator and the local Grover operator based on the database size and block size; and calculate the depth ratio based on the Oracle implementation depth and the global diffusion operator implementation depth. Candidate sequence generation module: used to generate a family of candidate sequences based on global Grover operators and local Grover operators; the family of candidate sequences includes at least alternating core sequences and extended sequences with finite-size edge operators; Success probability assessment module: used to construct a three-dimensional invariant subspace; rewrite the global Grover operator and the local Grover operator into the three-dimensional invariant subspace to obtain the corresponding O(3) real orthogonal rotation reflection matrix; obtain the total transformation matrix of each candidate sequence in the three-dimensional subspace based on the O(3) real orthogonal rotation reflection matrix corresponding to the global Grover operator and the local Grover operator; rewrite the uniformly superimposed initial state into the three-dimensional invariant subspace to obtain the initial amplitude vector; The success probability of the target block for each candidate sequence is obtained by using the total transformation matrix and the initial amplitude vector. Expected Depth Optimization Module: This module calculates the line depth of each candidate sequence based on the depth ratio, the global diffusion operator's realized depth, and the local diffusion operator's realized depth. It then divides the line depth of each candidate sequence by the target block success probability to obtain the expected depth of each candidate sequence. Finally, it selects the candidate sequence with the smallest expected depth and its parameters. Quantum circuit compilation and execution module: used to expand the selected sequence into quantum gate-level circuits and submit them to the quantum processor for execution, measure the block index qubits and output the target block index.
9. An electronic device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the desired line depth optimization method for quantum partial search 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 computer program that, when executed by a processor, implements the desired line depth optimization method for quantum partial search as described in any one of claims 1-7.
