# Grover算法

**Grover算法**是一种量子算法，由贝尔实验室的Lov K. Grover于1996年提出，它能在N个条目的非结构化空间中，仅用O(√N)次对预言机的查询找到被标记的条目，相较于经典搜索所需的O(N)次查询，实现了二次加速。<sup>[1](https://arxiv.org/abs/quant-ph/9605043)</sup> 在Grover最初的表述中，一个经典算法——无论确定性还是概率性的——平均需要查看随机电话簿中约N/2个名字，才能以50%的概率找到某个给定号码，而量子算法在O(√N)步内即可得到答案，且与所能实现的最快量子算法仅相差一个小常数因子。<sup>[1](https://arxiv.org/abs/quant-ph/9605043)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | 由Lov K. Grover（贝尔实验室，新泽西州默里山）提出；1996年5月29日提交；在第28届ACM计算理论研讨会（STOC）上宣读，1996年5月，第212–219页<sup>[1](https://arxiv.org/abs/quant-ph/9605043)</sup> |
| 查询复杂度 | N个条目需O(√N)次预言机查询，而经典算法要达到50%成功率平均需N/2次查询<sup>[1](https://arxiv.org/abs/quant-ph/9605043)</sup> |
| 核心操作 | Grover算子 \( \mathcal{Q} = H^{\otimes n} \mathcal{S}_0 H^{\otimes n} \mathcal{S}_f = D \, \mathcal{S}_f \)，即相位预言机后接扩散算子 \( D = 2\lvert\psi\rangle\langle\psi\rvert - I \)<sup>[2](https://quantum.cloud.ibm.com/docs/en/api/qiskit/0.46/qiskit.algorithms.Grover)</sup> |
| 最优迭代次数 | \( t = \lfloor \pi/(4\theta) \rfloor \)，其中 \( \theta = \sin^{-1}\sqrt{s/N} \)；对于N个条目中的一个解，\( t \approx \frac{\pi}{4}\sqrt{N} \)<sup>[3](https://quantum.cloud.ibm.com/learning/en/courses/fundamentals-of-quantum-algorithms/grover-algorithm/number-of-iterations)</sup> |
| 最优性 | Christof Zalka（洛斯阿拉莫斯国家实验室T-6组）于1997年证明，Grover算法对任意成功率都是精确最优的，近乎确定的成功需要约 \( \frac{\pi}{4}\sqrt{N} \) 次查询<sup>[4](https://arxiv.org/abs/quant-ph/9711070)</sup> |
| 推广 | 量子振幅放大（Brassard、Høyer、Mosca和Tapp，2000年）在O(1/√a)次应用态制备算法 \( \mathcal{A} \) 及其逆之后找到一个好元素，其中a为成功概率<sup>[5](https://arxiv.org/abs/quant-ph/0005055)</sup> |
| 硬件现状 | 已在囚禁离子、超导和硅自旋平台上演示了多达几个量子比特；一个四量子比特硅处理器达到了（94.57 ± 2.63）%的平均成功概率<sup>[6](https://www.nature.com/articles/s41565-024-01853-5)</sup> |

## 算法工作原理

该算法作用于n个量子比特，因此搜索空间有 \( N = 2^{n} \) 个基态。它分为四个阶段：初始化、预言机、放大和测量。<sup>[7](https://www.nature.com/articles/s41467-017-01904-7)</sup>

**初始化。** 对每个量子比特施加Hadamard门，产生等权叠加态 \( \frac{1}{\sqrt{N}} \sum_{x=0}^{N-1} \lvert x \rangle \)，其中每个条目的振幅相同。<sup>[8](https://quantum.cloud.ibm.com/learning/en/courses/utility-scale-quantum-computing/grovers-algorithm)</sup>

**预言机。** 预言机是一个量子子程序，通过翻转目标态振幅的符号来标记它，通常借助相位回踢（量子比特因与受控操作相互作用而产生的相位变化）实现；数学上，它对满足布尔函数f(x) = 1的态x施加−1的相位。<sup>[8](https://quantum.cloud.ibm.com/learning/en/courses/utility-scale-quantum-computing/grovers-algorithm)</sup> 此时，被标记的态被测量到的概率并不比其他态更高；只有相位不同。<sup>[9](https://quantum.cloud.ibm.com/learning/en/modules/computer-science/grovers)</sup>

**扩散。** 扩散算子 \( D = 2\lvert\psi\rangle\langle\psi\rvert - I \) 执行关于平均振幅的反演，增大被标记态的振幅。<sup>[2](https://quantum.cloud.ibm.com/docs/en/api/qiskit/0.46/qiskit.algorithms.Grover)</sup><sup> • </sup><sup>[8](https://quantum.cloud.ibm.com/learning/en/courses/utility-scale-quantum-computing/grovers-algorithm)</sup> 在电路形式中，它是 \( H^{\otimes n} \mathcal{S}_0 H^{\otimes n} \)，其中 \( \mathcal{S}_0 \) 翻转全零态的相位；前后的Hadamard层将反射轴从 \( \lvert 0 \rangle^{\otimes n} \) 变为均匀叠加态 \( \lvert u \rangle \)。<sup>[2](https://quantum.cloud.ibm.com/docs/en/api/qiskit/0.46/qiskit.algorithms.Grover)</sup><sup> • </sup><sup>[9](https://quantum.cloud.ibm.com/learning/en/modules/computer-science/grovers)</sup>

**几何图像。** 态位于由未标记态的均匀叠加 \( \lvert A_0 \rangle \) 和解的叠加 \( \lvert A_1 \rangle \) 张成的二维平面中。预言机和扩散步骤都是该平面内的反射，两次反射合成为一个旋转，每次迭代将态朝 \( \lvert A_1 \rangle \) 方向移动角度 \( 2\theta \)。<sup>[9](https://quantum.cloud.ibm.com/learning/en/modules/computer-science/grovers)</sup>

## 选择迭代次数

每次Grover迭代将态旋转一个固定角度，因此迭代次数必须仔细选择：应用太多次会旋转越过目标，成功概率反而下降。<sup>[9](https://quantum.cloud.ibm.com/learning/en/modules/computer-science/grovers)</sup> 设N个条目中有s个解，旋转角为 \( \theta = \sin^{-1}\sqrt{s/N} \)，推荐的迭代次数为 \( t = \lfloor \pi/(4\theta) \rfloor \)，成功概率为 \( p = \sin^{2}((2t+1)\theta) \)。<sup>[3](https://quantum.cloud.ibm.com/learning/en/courses/fundamentals-of-quantum-algorithms/grover-algorithm/number-of-iterations)</sup> 对于唯一解，这变为 \( t \approx \frac{\pi}{4}\sqrt{N} \)，且对所有N，成功概率满足 \( p(N,1) \geq 1 - 1/N \)。<sup>[3](https://quantum.cloud.ibm.com/learning/en/courses/fundamentals-of-quantum-algorithms/grover-algorithm/number-of-iterations)</sup>

**解的数量未知。** 如果s未知，一种简单方法是从 \( \{1, \ldots, \lfloor \pi\sqrt{N}/4 \rfloor \} \) 中均匀随机选取t，只要存在解，就能以大于40%的概率找到它；重复该过程可使概率接近1。<sup>[3](https://quantum.cloud.ibm.com/learning/en/courses/fundamentals-of-quantum-algorithms/grover-algorithm/number-of-iterations)</sup> 一种改进方法即使在s未知时也能以O(√(N/s))次查询找到解，而在s = 0时需要O(√N)次查询来确认不存在解。<sup>[3](https://quantum.cloud.ibm.com/learning/en/courses/fundamentals-of-quantum-algorithms/grover-algorithm/number-of-iterations)</sup>

## 最优性与并行化

Boyer、Brassard、Høyer和Tapp建立了量子搜索的紧致下界，Christof Zalka将其改进为匹配的界，证明对于任意成功概率，Grover算法都是精确最优的，而不仅仅是渐近最优的；对于近乎确定的成功，预言机必须被查询约 \( \frac{\pi}{4}\sqrt{N} \) 次。<sup>[4](https://arxiv.org/abs/quant-ph/9711070)</sup> Zalka还证明，量子搜索的并行化效果不可能优于将搜索空间的不同部分分配给独立的量子计算机。<sup>[4](https://arxiv.org/abs/quant-ph/9711070)</sup> 因此，这种二次加速是量子计算机上非结构化搜索所能达到的最佳结果。<sup>[10](https://www.sciencedirect.com/science/article/pii/S0377221725001705)</sup>

## 推广

**振幅放大。** Brassard、Høyer、Mosca和Tapp于2000年推广了Grover算法。给定一个以概率a产生好元素的量子算法 \( \mathcal{A} \)，振幅放大通过应用 \( \mathcal{A} \) 和 \( \mathcal{A}^{-1} \) 找到一个好元素，所需应用次数的期望值正比于 \( 1/\sqrt{a} \)，而经典过程期望需要1/a次重复；无论a是否预先已知，它都有效。<sup>[5](https://arxiv.org/abs/quant-ph/0005055)</sup> 在此框架中，Grover算法是 \( \mathcal{A} \) 产生均匀叠加且保证恰好有一个解的特殊情形。<sup>[5](https://arxiv.org/abs/quant-ph/0005055)</sup> 同一研究组还证明，二次加速可扩展到一大类具有良好经典启发式的搜索问题，并将Grover算法和Shor算法的思想结合为振幅估计，应用于近似计数。<sup>[5](https://arxiv.org/abs/quant-ph/0005055)</sup>

**灵活的态制备。** 在Qiskit实现中，态制备 \( \mathcal{A} \) 不必是一层Hadamard门，这正是振幅放大与普通Grover搜索的区别所在。<sup>[11](https://docs.quantum.ibm.com/api/qiskit/qiskit.circuit.library.GroverOperator)</sup> 当解的数量未知时，算法尝试Grover算子的不同幂次，并在每次之后检查是否测量到了好态。<sup>[2](https://quantum.cloud.ibm.com/docs/en/api/qiskit/0.46/qiskit.algorithms.Grover)</sup>

## 硬件演示

该算法的小规模实例已在多个平台上运行。2017年，在一串五个囚禁的 \( ^{171}\mathrm{Yb}^{+} \) 离子上完成了完整的三量子比特Grover搜索，同时使用了相位预言机和带辅助量子比特的布尔预言机。<sup>[7](https://www.nature.com/articles/s41467-017-01904-7)</sup> 对于单解情形，理论算法成功概率为78.1%，而最优经典策略（一次查询后随机猜测）为25%；布尔预言机的测量平均值为38.9%，相位预言机为43.7%，均高于经典的25%。<sup>[7](https://www.nature.com/articles/s41467-017-01904-7)</sup> 在双解情形中，理论量子成功概率为100%，经典约为46.4%，测量平均值分别为67.9%和75.3%。<sup>[7](https://www.nature.com/articles/s41467-017-01904-7)</sup> 一个四量子比特硅自旋处理器在三个核自旋量子比特上执行了该算法，平均成功概率为（94.57 ± 2.63）%。<sup>[6](https://www.nature.com/articles/s41565-024-01853-5)</sup> Grover搜索也已在超导架构、硅中的自旋量子比特、使用核磁共振技术的分子以及囚禁离子多能级量子系统上实现。<sup>[12](https://www.nature.com/articles/s41467-026-68533-x)</sup><sup> • </sup><sup>[13](https://www.nature.com/articles/s41467-026-68746-0)</sup>

## 实际限制

这种加速是查询模型的结果：它只计算对预言机的调用次数，并将预言机的内部结构视为黑箱。<sup>[14](https://doi.org/10.1103/PhysRevX.14.041029)</sup> 有几个条件限制了实际应用。

**预言机成本与结构。** 一旦获得预言机的源代码（这可能揭示问题的内部结构），Grover算法就没有先验的量子加速；Stoudenmire和Waintal构造了一种受量子启发的经典算法，对布尔可满足性问题以线性次数的预言机模拟完成Grover的任务，比Grover约 \( \sqrt{2^{n}} \) 次调用指数级地少。<sup>[14](https://doi.org/10.1103/PhysRevX.14.041029)</sup>

**噪声。** 只有在容错机制下电路以可忽略的噪声运行时，才能保证这种加速。<sup>[15](https://www.mdpi.com/2673-8392/6/4/89)</sup> 由于预言机和扩散算子依赖于多控Z门，而其二量子比特门深度随量子比特数增加而急剧上升，Grover算法本质上适合容错执行。<sup>[16](https://qiskit.qotlabs.org/docs/tutorials/grovers-algorithm)</sup> 根据《物理评论X》的分析，在存在噪声的情况下，成功概率随量子比特数的指数的指数衰减，这使得即使在对硬件乐观的假设下，实际加速也不现实。<sup>[14](https://doi.org/10.1103/PhysRevX.14.041029)</sup>

**数据访问。** 要搜索数据库，数据必须存储在量子可访问存储器中并能以叠加态访问；对于像Grover搜索这样的超多项式查询算法，量子随机存取存储器需要纠错组件。<sup>[15](https://www.mdpi.com/2673-8392/6/4/89)</sup><sup> • </sup><sup>[17](https://pmc.ncbi.nlm.nih.gov/articles/PMC5806018/)</sup> 将经典仿真与详细复杂度界相结合的实证研究发现，一些经典启发式算法尽管有理论上的每步加速，却并未提供显著的量子加速。<sup>[18](https://quantum-journal.org/papers/q-2023-10-10-1133/)</sup>

## References

1. [Lov K. Grover (1996). A fast quantum mechanical algorithm for database search. arXiv:quant-ph/9605043; STOC 1996, pp. 212–219.](https://arxiv.org/abs/quant-ph/9605043)
2. [Grover (v0.46), Qiskit API documentation, IBM Quantum](https://quantum.cloud.ibm.com/docs/en/api/qiskit/0.46/qiskit.algorithms.Grover)
3. [Choosing the number of iterations, Fundamentals of Quantum Algorithms, IBM Quantum Learning](https://quantum.cloud.ibm.com/learning/en/courses/fundamentals-of-quantum-algorithms/grover-algorithm/number-of-iterations)
4. [Christof Zalka (1997). Grover's quantum searching algorithm is optimal. arXiv:quant-ph/9711070; Phys. Rev. A 60, 2746 (1999).](https://arxiv.org/abs/quant-ph/9711070)
5. [Gilles Brassard, Peter Høyer, Michele Mosca, Alain Tapp (2000). Quantum Amplitude Amplification and Estimation. arXiv:quant-ph/0005055.](https://arxiv.org/abs/quant-ph/0005055)
6. [Grover's algorithm in a four-qubit silicon processor above the fault-tolerant threshold, Nature Nanotechnology (2024)](https://www.nature.com/articles/s41565-024-01853-5)
7. [Figgatt, C., Maslov, D., Landsman, K.A. et al. (2017). Complete 3-Qubit Grover search on a programmable quantum computer. Nature Communications 8, 1918.](https://www.nature.com/articles/s41467-017-01904-7)
8. [Grover's algorithm, Utility-Scale Quantum Computing course, IBM Quantum Learning](https://quantum.cloud.ibm.com/learning/en/courses/utility-scale-quantum-computing/grovers-algorithm)
9. [Grover's algorithm, IBM Quantum Learning module](https://quantum.cloud.ibm.com/learning/en/modules/computer-science/grovers)
10. [Speeding up Grover's algorithm, Computers & Operations Research / ScienceDirect (2025)](https://www.sciencedirect.com/science/article/pii/S0377221725001705)
11. [GroverOperator, Qiskit circuit library documentation, IBM Quantum](https://docs.quantum.ibm.com/api/qiskit/qiskit.circuit.library.GroverOperator)
12. [Demonstration of measurement-free universal logical quantum computation, Nature Communications (2026)](https://www.nature.com/articles/s41467-026-68533-x)
13. [Efficient implementation of a quantum algorithm with a trapped ion qudit, Nature Communications (2026)](https://www.nature.com/articles/s41467-026-68746-0)
14. [E. M. Stoudenmire, Xavier Waintal (2024). Opening the Black Box inside Grover's Algorithm. Phys. Rev. X 14, 041029.](https://doi.org/10.1103/PhysRevX.14.041029)
15. [Grover Quantum Algorithm: Applications and Limits, Engineering (MDPI, 2024)](https://www.mdpi.com/2673-8392/6/4/89)
16. [Grover's algorithm tutorial, Qiskit documentation](https://qiskit.qotlabs.org/docs/tutorials/grovers-algorithm)
17. [Quantum machine learning: a classical perspective, Quantum Science and Technology / PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC5806018/)
18. [Cade, C., Folkertsma, M., Niesen, I., Weggemans, J. (2023). Quantifying Grover speed-ups beyond asymptotic analysis. Quantum 7, 1133.](https://quantum-journal.org/papers/q-2023-10-10-1133/)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 物理学 › 量子物理学 › Quantum information science › Quantum computing and algorithms › Quantum algorithms › Quantum search and amplitude amplification

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/grovers-algorithm

English original: https://www.edgepedia.org/grovers-algorithm
