# 量子电路

**量子电路**是一种计算例程，在量子处理单元上每次运行一次，其中酉（保持长度的变换，因而可逆）门、测量和重置作用于量子数据，并结合经典实时计算与控制流。<sup>[1](https://quantum.cloud.ibm.com/docs/api/qiskit/circuit)</sup>

| 关键事实 | 详情 |
|---|---|
| 模型 | 量子比特上酉门的序列（在双量子比特形式中每个为4×4酉矩阵），加上测量、重置和经典控制；理想电路是可逆的。<sup>[1](https://quantum.cloud.ibm.com/docs/api/qiskit/circuit)</sup><sup> • </sup><sup>[2](https://fenix.tecnico.ulisboa.pt/downloadFile/1407993358931418/Classical%20and%20Quantum%20Computation%20[Kitaev-Shen-Vyalyi]%20(2002).pdf)</sup><sup> • </sup><sup>[3](https://opencourse.inf.ed.ac.uk/sites/default/files/https/opencourse.inf.ed.ac.uk/iqc/2024/lecture-6-quantum-circuit-model.pdf)</sup> |
| 通用性 | U + gphase + CNOT 是通用的，可表示一般的 n 量子比特酉操作，尽管在最坏情况下此类酉操作至少需要 (4^n - 3n - 1)/4 个 CNOT 门，因此描述不是 O(2^n)；Clifford+T 是最常用的实用通用门集。<sup>[4](https://openqasm.com/language/gates.html)</sup><sup> • </sup><sup>[5](https://arxiv.org/html/2407.00736v2)</sup><sup> • </sup><sup>[19](https://www.nist.gov/publications/minimal-universal-two-qubit-controlled-not-based-circuits)</sup> |
| 近似合成 | Solovay–Kitaev：一个有限通用、对逆封闭的门集可在 O(log^c(1/ε)) 个门内将任意酉操作近似到误差 ε，c ≈ 3.97。<sup>[6](https://arxiv.org/html/2505.00683)</sup> |
| 主导成本 | 在容错方案中，非 Clifford 的 T 门占主导：表面码的时空成本常数对 Clifford 门为单位量级，但对 T 门约为 160–310。<sup>[5](https://arxiv.org/html/2407.00736v2)</sup> |
| 因数分解成本 | Kunihiro 式模幂运算需要 3n+2 个量子比特和 270n³ + O(n²) 个 Toffoli 门；分解一个 2048 位合数估计需要 6146 个量子比特和 3.04 × 10¹² 个 Toffoli 门。<sup>[7](https://link.springer.com/chapter/10.1007/978-981-15-5191-8_7)</sup> |
| 浅深度分离 | 二维隐藏线性函数问题可由常数深度量子电路（QNC⁰）精确求解，但不能由多项式大小、无界扇入的常数深度经典电路（AC⁰）求解。<sup>[8](https://dl.acm.org/doi/10.1145/3313276.3316404)</sup> |
| 编译 | IBM 的转译器运行六个阶段（初始化、布局、路由、翻译、优化、调度）；最小 SWAP 路由是 NP 难的。<sup>[9](https://quantum.cloud.ibm.com/docs/en/guides/transpile)</sup> |
| 2024 里程碑 | Google 的 Willow 展示了距离-7 表面码，其逻辑错误率相比距离-5 被抑制了 2.14 倍，表明在阈值以下实现了指数抑制。<sup>[10](https://www.nature.com/articles/s41586-024-08449-y)</sup> |

## 定义与电路模型

形式上，量子电路是一系列基本操作的序列，每个操作由一对整数确定，这对整数索引了它所作用的量子比特，并由一个任意的 4×4 酉矩阵表示；电路可以像计算机程序一样写成文本。<sup>[2](https://fenix.tecnico.ulisboa.pt/downloadFile/1407993358931418/Classical%20and%20Quantum%20Computation%20[Kitaev-Shen-Vyalyi]%20(2002).pdf)</sup> 该模型建立在通用的一组单量子比特门和双量子比特门之上，理想的量子电路是可逆的。<sup>[3](https://opencourse.inf.ed.ac.uk/sites/default/files/https/opencourse.inf.ed.ac.uk/iqc/2024/lecture-6-quantum-circuit-model.pdf)</sup> 真实电路还包含非酉元素：测量、重置，以及根据先前测量结果引导后续门的经典控制流。<sup>[1](https://quantum.cloud.ibm.com/docs/api/qiskit/circuit)</sup>

Qiskit 区分抽象电路与物理（ISA）电路：抽象电路定义在虚拟量子比特和高级操作之上，物理电路则定义在某个后端的硬件量子比特之上，且只包含原生支持的操作。<sup>[1](https://quantum.cloud.ibm.com/docs/api/qiskit/circuit)</sup>

## 门、通用性与合成

OpenQASM 规范固定了一个最小通用基：内置门 U 和 gphase 与双量子比特纠缠门 CNOT 一起可以表示一般的 n 量子比特酉操作，其最坏情况下的合成至少需要 (4^n - 3n - 1)/4 个 CNOT 门，尽管这个基并不是强制性的编译目标。<sup>[4](https://openqasm.com/language/gates.html)</sup><sup> • </sup><sup>[19](https://www.nist.gov/publications/minimal-universal-two-qubit-controlled-not-based-circuits)</sup> 实践中，最常用的通用门集是 Clifford+T，选择它是因为 Clifford 门在超导硬件上相对容易实现，而 T 门实现起来更具挑战性。<sup>[5](https://arxiv.org/html/2407.00736v2)</sup>

**精确合成与近似合成。** 许多有实际意义的门具有多项式大小的单量子比特和双量子比特分解，比完整的 2^n × 2^n 矩阵更紧凑；在最坏情况下，一个一般的 n 量子比特门需要指数多个这样的门。<sup>[4](https://openqasm.com/language/gates.html)</sup> 在有限离散门集上的有限长度电路只能近似实现任意的多量子比特酉操作，在适当度量下误差不超过 ε。<sup>[6](https://arxiv.org/html/2505.00683)</sup> Solovay–Kitaev 定理量化了代价：对于一个有限通用、对称（对逆封闭）的门集 S ⊂ U(d)，所需的电路长度为 ℓ(S, ε) = O(log^c(1/ε))，标准证明中 c ≈ 3.97，在精细论证中 c = 3 + α 对任意 α > 0 成立。<sup>[6](https://arxiv.org/html/2505.00683)</sup> 该定理还意味着，在相关场景中会出现需要 Ω(2^n log(1/ε)/log(n)) 个门的量子电路，这呼应了 Shannon 的经典计数论证——几乎所有的布尔函数都需要约 2^n 个门。<sup>[3](https://opencourse.inf.ed.ac.uk/sites/default/files/https/opencourse.inf.ed.ac.uk/iqc/2024/lecture-6-quantum-circuit-model.pdf)</sup>

## 复杂度度量

电路**大小**是门的数量；**深度**与电路的执行时间相关，因为优化深度能增强并行性并减少总执行时间。**宽度**是量子比特的数量，但这只对仅含量子比特的电路成立：有了经典寄存器和受经典控制的门，这种等价关系就失效了，因此严谨的处理避免将宽度等同于量子比特数。<sup>[1](https://quantum.cloud.ibm.com/docs/api/qiskit/circuit)</sup>

**T 计数与 T 深度。** 在容错情形下，Eastin–Knill 定理意味着资源昂贵的非横截门数量往往构成瓶颈，因此减少 T 计数——即非横截 P(π/4) 门的数量——能改善错误率、运行时间和量子比特数。<sup>[6](https://arxiv.org/html/2505.00683)</sup> 容错量子算法的成本主要由通过魔法态实现非 Clifford 门所主导。<sup>[11](https://www.frontiersin.org/journals/quantum-science-and-technology/articles/10.3389/frqst.2023.1232624/full)</sup> 定量地说，在表面码方案中，Clifford 门产生 O(c_T d³) 的时空成本，其中 c_T 为单位量级，而 T 门需要 O(C_T d³)，其中 C_T ≈ 160–310，昂贵了数个数量级。<sup>[5](https://arxiv.org/html/2407.00736v2)</sup> 一个相关的说法认为，T 门的成本比相邻量子比特间 CNOT 的成本高约两个数量级；两种描述在性质上一致但精确常数不同，此处按原文分别报告。<sup>[12](https://www.nature.com/articles/s42256-025-01001-1)</sup> T 计数优化是 NP 难的。<sup>[12](https://www.nature.com/articles/s42256-025-01001-1)</sup> 随着硬件获得并行门执行能力，优化目标从 T 计数转向 T 深度——即顺序 T 门层的数量——并提出了一种多项式时间算法，在大多数情况下保证最小 T 深度。<sup>[5](https://arxiv.org/html/2407.00736v2)</sup>

## 用数字说话

Shor 因数分解算法的资源估计展示了这些度量如何被使用。模幂运算在标准构造中需要 O(n³) 次门操作。<sup>[7](https://link.springer.com/chapter/10.1007/978-981-15-5191-8_7)</sup> Kunihiro 2005 年的构造需要 3n+2 个量子比特和 270n³ + O(n²) 个 Toffoli 门，对于一个 2048 位合数给出 6146 个量子比特和 3.04 × 10¹² 个 Toffoli 门；作为参照，经典因数分解记录是 768 位（Kleinjung 2010），而当前 RSA 建议使用 2048 位合数。<sup>[7](https://link.springer.com/chapter/10.1007/978-981-15-5191-8_7)</sup> 一个使用 2n+2 个量子比特的基于 Toffoli 的电路，其 Toffoli 总数为 T_Shor(n) = 64n³ log₂ n + O(n³)，在合成开销之前门数和深度分别为 Θ(n³ log n) 和 Θ(n³)，每个 Toffoli 使用 7 个 T 门精确分解为 Clifford 和 T 门，若忽略全局相位则更少。<sup>[13](https://www.microsoft.com/en-us/research/wp-content/uploads/2017/05/1611.07995.pdf)</sup>

不同的构造给出不同的数字，而这种差异本身就有信息量。一项基于模拟器的估计报告，对于 1024 位整数为 2.78 × 10¹¹ 个门、深度 2.24 × 10¹¹，对于 2048 位整数为 2.23 × 10¹² 个门、深度 1.80 × 10¹²，<sup>[14](https://eprint.iacr.org/2023/092.pdf)</sup> 而一项基于 Ekerå–Håstad 的估计将 RSA-2048 定为 1730 个逻辑量子比特和 2³⁶ 个 Toffoli 门。<sup>[15](https://link.springer.com/chapter/10.1007/978-3-032-01878-6_13)</sup> 这些估计在量子比特数和门总数上不一致，因为它们假设了不同的算法和电路构造；没有单一数字是权威的。

资源估计工具直接使用这些度量。QREChem 使用 Clifford+T 旋转合成来估计 T 门数量，合成误差 ε 设为 10⁻⁹，并通过一个表面码纠错模块计算总运行时间，该模块以循环时间、物理错误率和 Toffoli 门数为输入。<sup>[11](https://www.frontiersin.org/journals/quantum-science-and-technology/articles/10.3389/frqst.2023.1232624/full)</sup>

## 电路复杂度与复杂度类

常数深度量子电路定义了类 QNC⁰，即 NC⁰ 的量子类比。Bravyi、Gosset 和 Konig（Science，2018）展示了二维隐藏线性函数问题，它可由有界扇入门的常数深度量子电路精确求解，但不能由任何使用有界扇入 AND、OR 和 NOT 门的常数深度经典电路求解。<sup>[8](https://dl.acm.org/doi/10.1145/3313276.3316404)</sup> 一篇 STOC 2019 的论文通过奇偶减半问题强化了这一点，证明了二维 HLF 不在 AC⁰ 中——AC⁰ 是多项式大小、常数深度、无界扇入 AND/OR 和 NOT 的经典电路类——并包含一个平均情况下的下界。<sup>[8](https://dl.acm.org/doi/10.1145/3313276.3316404)</sup>

近期的下界表明，深度-3 的 QAC⁰ 电路无论大小如何都无法计算 PARITY，并且对于 MAJORITY 至少需要 Ω(exp(√n)) 个门，即使有多项式多个辅助比特和门。<sup>[16](https://dl.acm.org/doi/10.1145/3798129.3800922)</sup> 深度-2 的 QAC⁰ 电路无论大小如何都无法以不可忽略的优势近似高影响布尔函数如 PARITY，而经典常数深度电路可以使用指数大小在深度 2 中精确计算 PARITY；这些证明技术表明，对于布尔全函数，常数深度量子电路不一定优于经典电路。<sup>[16](https://dl.acm.org/doi/10.1145/3798129.3800922)</sup>

## 编译与硬件约束

编译，或称转译，将抽象电路映射到特定设备上。IBM 的转译器流水线运行六个阶段：初始化、布局（将虚拟量子比特映射到物理量子比特）、路由、翻译、优化和调度。<sup>[9](https://quantum.cloud.ibm.com/docs/en/guides/transpile)</sup> 路由阶段注入 SWAP 门以使电路与设备耦合图兼容；每个 SWAP 都昂贵且有噪声，而寻找最少 SWAP 数是 NP 难的，且最优求解代价过高。<sup>[9](https://quantum.cloud.ibm.com/docs/en/guides/transpile)</sup> 更一般地说，编译将硬件无关的目标电路近似为特定机器的原生门集，并优化深度和门数；在没有纠错的 NISQ 机器上，减少深度和有噪声的纠缠门具有特别的实践重要性。<sup>[6](https://arxiv.org/html/2505.00683)</sup>

真实硬件暴露有限的原生门集，通常包括绕至少两个轴的单量子比特旋转加上一个纠缠双量子比特门，如 CX、CZ 或 Mølmer–Sørensen 门；任何其他操作都必须通过合成分解为原生门。<sup>[17](https://www.cda.cit.tum.de/files/eda/2026-05_Hardware-aware_Compilation_for_Different_Quantum_Computing_Platforms.pdf)</sup> 在可通过 SWAP 或 MOVE 操作物理重构量子比特连接的动态架构上，仅门数不足以作为性能指标，取而代之的是结合时间和操作方面的近似成功概率。<sup>[17](https://www.cda.cit.tum.de/files/eda/2026-05_Hardware-aware_Compilation_for_Different_Quantum_Computing_Platforms.pdf)</sup>

## 度量如何比较

每种度量针对不同的瓶颈。门数追踪总工作量，并且通过 Shannon 的计数论证，几乎所有布尔函数经典上都需要约 2^n 个门，量子电路有类似的 Ω(2^n log(1/ε)/log n) 下界。<sup>[3](https://opencourse.inf.ed.ac.uk/sites/default/files/https/opencourse.inf.ed.ac.uk/iqc/2024/lecture-6-quantum-circuit-model.pdf)</sup> 深度追踪并行下的实际耗时，并受量子比特相干时间约束，这使得深度优化在 NISQ 时代具有实际意义。<sup>[5](https://arxiv.org/html/2407.00736v2)</sup> T 计数和 T 深度追踪容错成本，其中 T 门的成本比相邻量子比特间 CNOT 的成本高约两个数量级。<sup>[12](https://www.nature.com/articles/s42256-025-01001-1)</sup> 哪种度量决定成功取决于平台：对于动态架构，成功概率取代门数成为操作性指标。<sup>[17](https://www.cda.cit.tum.de/files/eda/2026-05_Hardware-aware_Compilation_for_Different_Quantum_Computing_Platforms.pdf)</sup> 一个形式化对象——量子电路开销——捕捉了一个相关问题：在构成 ε-网的门集上的最小电路长度与同等大小的门集所能达到的最优长度之间的比率；谱上界与精确合成成本之间的关系仍是一个开放问题。<sup>[6](https://arxiv.org/html/2505.00683)</sup>

## 近期进展

**纠错跨过了阈值。** Google 2024 年的 Willow 实验展示了一个距离-7 表面码逻辑量子比特，其错误率相比距离-5 被抑制了 2.14 倍，并将距离-27 的逻辑性能提升了四个数量级，进入算法相关的错误率范围；扩展表面码使逻辑错误率指数下降，在实时实验中跨到了容错阈值以下。<sup>[10](https://www.nature.com/articles/s41586-024-08449-y)</sup> 随着纠错协议和解码的进步，开销预计会下降。<sup>[10](https://www.nature.com/articles/s41586-024-08449-y)</sup> Google Research 还报告了基于 iSWAP 门的动态表面码，该门在交换量子比特状态的同时执行受控-Z 操作，其实现不依赖非计算态。<sup>[18](https://research.google/blog/dynamic-surface-codes-open-new-avenues-for-quantum-error-correction/)</sup>

**优化目标转移了。** 随着并行门执行成为可能，目标从最小化 T 计数转向最小化 T 深度。<sup>[5](https://arxiv.org/html/2407.00736v2)</sup> 机器学习进入了该领域：AlphaTensor-Quantum 是一种深度强化学习方法，能减少 T 计数，在算术基准上优于现有的 T 计数优化方法。<sup>[12](https://www.nature.com/articles/s42256-025-01001-1)</sup>

## References

1. [Circuit — Qiskit API documentation, IBM Quantum](https://quantum.cloud.ibm.com/docs/api/qiskit/circuit)
2. [Kitaev, Shen, Vyalyi (2002). Classical and Quantum Computation](https://fenix.tecnico.ulisboa.pt/downloadFile/1407993358931418/Classical%20and%20Quantum%20Computation%20[Kitaev-Shen-Vyalyi]%20(2002).pdf)
3. [Introduction to Quantum Computing, Lecture 6: Quantum Circuit Model, University of Edinburgh](https://opencourse.inf.ed.ac.uk/sites/default/files/https/opencourse.inf.ed.ac.uk/iqc/2024/lecture-6-quantum-circuit-model.pdf)
4. [Gates — OpenQASM Live Specification](https://openqasm.com/language/gates.html)
5. [Quantum Circuit Synthesis and Compilation Optimization: Overview and Prospects (arXiv)](https://arxiv.org/html/2407.00736v2)
6. [Quantum Circuit Overhead (arXiv)](https://arxiv.org/html/2505.00683)
7. [Quantum Factoring Algorithm: Resource Estimation and Survey of Experiments, Springer](https://link.springer.com/chapter/10.1007/978-981-15-5191-8_7)
8. [Exponential separation between shallow quantum circuits and unbounded fan-in shallow classical circuits, STOC 2019](https://dl.acm.org/doi/10.1145/3313276.3316404)
9. [Introduction to transpilation, IBM Quantum Documentation](https://quantum.cloud.ibm.com/docs/en/guides/transpile)
10. [Quantum error correction below the surface code threshold, Nature (2024)](https://www.nature.com/articles/s41586-024-08449-y)
11. [QREChem: quantum resource estimation software for chemistry applications, Frontiers in Quantum Science and Technology](https://www.frontiersin.org/journals/quantum-science-and-technology/articles/10.3389/frqst.2023.1232624/full)
12. [Quantum circuit optimization with AlphaTensor, Nature Machine Intelligence](https://www.nature.com/articles/s42256-025-01001-1)
13. [Factoring using 2n + 2 qubits with Toffoli based modular multiplication](https://www.microsoft.com/en-us/research/wp-content/uploads/2017/05/1611.07995.pdf)
14. [Estimation of Shor's Circuit for 2048-bit Integers based on Quantum Simulator, IACR eprint 2023/092](https://eprint.iacr.org/2023/092.pdf)
15. [Reducing the Number of Qubits in Quantum Factoring, Springer](https://link.springer.com/chapter/10.1007/978-3-032-01878-6_13)
16. [Improved Lower Bounds for QAC0, STOC 2025](https://dl.acm.org/doi/10.1145/3798129.3800922)
17. [Hardware-aware Compilation for Different Quantum Computing Platforms, TUM](https://www.cda.cit.tum.de/files/eda/2026-05_Hardware-aware_Compilation_for_Different_Quantum_Computing_Platforms.pdf)
18. [Dynamic surface codes open new avenues for quantum error correction, Google Research blog](https://research.google/blog/dynamic-surface-codes-open-new-avenues-for-quantum-error-correction/)
19. [Minimal Universal Two-Qubit Controlled-NOT-Based Circuits](https://www.nist.gov/publications/minimal-universal-two-qubit-controlled-not-based-circuits)

---
*Initially written Sep 17, 2026 · Reviewed: 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 gates and circuits › Quantum circuit complexity measures

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/quantum-circuit

English original: https://www.edgepedia.org/quantum-circuit
