[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-zh-warwick-quantum-phononic-links":3,"blog-translated-locales-warwick-quantum-phononic-links":117,"blog-all-zh":119},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"author":11,"tags":12,"readingTime":16,"body":17,"_type":111,"_id":112,"_source":113,"_file":114,"_stem":115,"_extension":116},"\u002Fblog\u002Fwarwick-quantum-phononic-links","blog",false,"","Warwick's New Chip Concept Aims to Wire Together a Million Qubits","Warwick and NRC Canada proposed Quantum Phononic Links, a way to carry quantum information across an entire chip using engineered vibrations instead of only connecting neighboring qubits.","2026-08-01","FreeQuantumComputing",[13,14,15],"Hardware","Industry","Fundamentals",6,{"type":18,"children":19,"toc":105},"root",[20,28,35,40,62,68,81,86,92],{"type":21,"tag":22,"props":23,"children":24},"element","p",{},[25],{"type":26,"value":27},"text","Today's leading quantum chips mostly connect a qubit to its immediate neighbors and nothing else. A useful large-scale quantum computer needs coordination across millions of qubits spread over an entire chip, not only clusters sitting next to each other. Researchers at the University of Warwick and NRC Canada published a proposed answer to that gap on July 29, 2026, in APL Quantum: a concept they call Quantum Phononic Links.",{"type":21,"tag":29,"props":30,"children":32},"h2",{"id":31},"what-a-phononic-link-is",[33],{"type":26,"value":34},"What a phononic link is",{"type":21,"tag":22,"props":36,"children":37},{},[38],{"type":26,"value":39},"The idea uses phonons, sound-like vibrations traveling through a solid material, to carry quantum information between qubits that sit far apart on the same chip. The material behind it, compressively strained germanium on silicon, was developed at Warwick using advanced epitaxial growth techniques. Engineered correctly, the vibrations carry information whether the qubits involved sit side by side or are separated across a full semiconductor wafer up to 300 millimeters across.",{"type":21,"tag":22,"props":41,"children":42},{},[43,45,52,54,60],{"type":26,"value":44},"That distance matters. Nearest-neighbor-only connectivity is exactly the constraint that shapes which ",{"type":21,"tag":46,"props":47,"children":49},"a",{"href":48},"\u002Fglossary\u002Fquantum-error-correction",[50],{"type":26,"value":51},"error-correcting codes",{"type":26,"value":53}," a chip even attempts. Our ",{"type":21,"tag":46,"props":55,"children":57},{"href":56},"\u002Fblog\u002Fquantinuum-helios-logical-qubits-2026",[58],{"type":26,"value":59},"companion piece on Quantinuum's Helios",{"type":26,"value":61}," covers why trapped-ion hardware's all-to-all connectivity opens up error-correction codes that a nearest-neighbor superconducting chip cannot use efficiently. A phononic link aimed at chip-scale, non-local connectivity is targeting the same structural limitation from the silicon side.",{"type":21,"tag":29,"props":63,"children":65},{"id":64},"read-the-maturity-level-accurately",[66],{"type":26,"value":67},"Read the maturity level accurately",{"type":21,"tag":22,"props":69,"children":70},{},[71,73,79],{"type":26,"value":72},"This is a concept and materials result, not an operating multi-qubit device. The paper proposes a mechanism and demonstrates the underlying material properties. It does not yet show a working chip moving quantum information between distant qubits using this method. That puts it in a different category of evidence than ",{"type":21,"tag":46,"props":74,"children":76},{"href":75},"\u002Fblog\u002Fhrl-self-operating-silicon-quantum-processor",[77],{"type":26,"value":78},"HRL's self-operating silicon processor",{"type":26,"value":80},", published the same week, which is a working 18-qubit device with a control chip already running inside its cryostat.",{"type":21,"tag":22,"props":82,"children":83},{},[84],{"type":26,"value":85},"Both results matter, and they matter for different reasons. HRL solved a real engineering problem for a small, existing device. Warwick proposed a mechanism aimed at a target two or three orders of magnitude larger, with the harder work of building and testing an actual chip still ahead of it. Neither is more important than the other. They sit at different points on the path from proposal to product, and coverage that treats them as equally proven misses that distinction.",{"type":21,"tag":29,"props":87,"children":89},{"id":88},"why-the-target-size-is-the-real-headline",[90],{"type":26,"value":91},"Why the target size is the real headline",{"type":21,"tag":22,"props":93,"children":94},{},[95,97,103],{"type":26,"value":96},"A million qubits is well beyond any current device, superconducting, trapped-ion, or silicon. Getting there needs progress on several fronts at once: qubit quality, error correction overhead, control electronics, and exactly the qubit-to-qubit communication problem this proposal addresses. No single result solves all of it. What is worth tracking is whether Warwick's group, or others building on the same cs-GoS material, demonstrates the mechanism working on an actual multi-qubit chip. That demonstration, not the concept paper, will be the point where this result earns a place next to HRL's on the list of things that shipped. See our ",{"type":21,"tag":46,"props":98,"children":100},{"href":99},"\u002Fhardware",[101],{"type":26,"value":102},"hardware overview",{"type":26,"value":104}," for how silicon-based approaches compare to the rest of the field.",{"title":7,"searchDepth":106,"depth":106,"links":107},2,[108,109,110],{"id":31,"depth":106,"text":34},{"id":64,"depth":106,"text":67},{"id":88,"depth":106,"text":91},"markdown","content:blog:warwick-quantum-phononic-links.md","content","blog\u002Fwarwick-quantum-phononic-links.md","blog\u002Fwarwick-quantum-phononic-links","md",[118],"en",[120,276,431,710,808,882,1019,1121,1359,1517,1640,1793,1910,2012,2703,2855,2920,3028,3939,7097,8839,9297,10405,10979,11478,13733,15592,15973,18075,19106,20124,20969,23437,24483,27030,28842,31580,33577,35674],{"_path":121,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":122,"description":123,"date":10,"author":11,"tags":124,"readingTime":127,"body":128,"_type":111,"_id":273,"_source":113,"_file":274,"_stem":275,"_extension":116},"\u002Fzh\u002Fblog\u002Fquantinuum-helios-logical-qubits-2026","Quantinuum Helios：2:1 编码下的48个逻辑量子比特解析","Quantinuum 最新的离子阱系统宣称仅用约96个物理量子比特就实现了48个纠错逻辑量子比特。真正值得关注的不是量子比特数量，而是这个比例。",[125,13,126],"Error Correction","Trapped-Ion",7,{"type":18,"children":129,"toc":267},[130,143,156,162,174,179,191,218,223,228,233,238],{"type":21,"tag":22,"props":131,"children":132},{},[133,135,141],{"type":26,"value":134},"Quantinuum 发布了其最新的离子阱系统 Helios，宣称实现了48个纠错逻辑量子比特，编码比例约为 ",{"type":21,"tag":136,"props":137,"children":138},"strong",{},[139],{"type":26,"value":140},"2:1",{"type":26,"value":142},"——即约96个物理量子比特完成了48个逻辑量子比特的工作。关于这一发布的报道大多聚焦于量子比特数量本身，但真正值得深入思考的数字是这个比例。",{"type":21,"tag":22,"props":144,"children":145},{},[146,148,154],{"type":26,"value":147},"如果你读过我们关于",{"type":21,"tag":46,"props":149,"children":151},{"href":150},"\u002Fblog\u002Flogical-qubits-fault-tolerance-explained",[152],{"type":26,"value":153},"逻辑量子比特与容错性",{"type":26,"value":155},"的文章，就已经知道原因了。在超导硬件上，表面码的开销估计通常是每个逻辑量子比特需要几百到几千个物理量子比特，具体取决于底层硬件距离纠错阈值有多远。厂商报告的接近2:1的比例并不是这个数字上的渐进式改进——它属于设计空间中完全不同的区域，在你把这个数字当真之前，值得先弄清楚是什么让它成为可能。",{"type":21,"tag":29,"props":157,"children":159},{"id":158},"helios-是什么",[160],{"type":26,"value":161},"Helios 是什么",{"type":21,"tag":22,"props":163,"children":164},{},[165,167,172],{"type":26,"value":166},"Helios 是 Quantinuum 最新一代的 H-Series 离子阱系统——这条产品线曾多次保持量子体积（quantum volume）纪录，而 IonQ（Quantinuum 在离子阱领域的主要竞争对手）也一直将其作为主要的对标基准。离子阱硬件通过电磁场囚禁单个离子，并用激光脉冲对其进行操控，这种方式牺牲了门操作速度（微秒到毫秒级，而超导量子比特是纳秒级），换取了两个对纠错至关重要的优势：更高的单门保真度，以及",{"type":21,"tag":136,"props":168,"children":169},{},[170],{"type":26,"value":171},"全连接性",{"type":26,"value":173},"——链中的任意一个离子都可以与任意其他离子纠缠，无需经过中间量子比特中转。",{"type":21,"tag":29,"props":175,"children":177},{"id":176},"为什么这个比例在这里成为可能",[178],{"type":26,"value":176},{"type":21,"tag":22,"props":180,"children":181},{},[182,184,189],{"type":26,"value":183},"表面码——用于谷歌 Willow 等超导芯片的主力纠错码——建立在",{"type":21,"tag":136,"props":185,"children":186},{},[187],{"type":26,"value":188},"最近邻",{"type":26,"value":190},"奇偶校验之上，因为这正是一块平面二维超导芯片在物理上所能支持的。这一限制在很大程度上解释了为何其开销如此之高：要在实际错误率下保护一个逻辑量子比特，需要相当规模的二维量子比特网格。",{"type":21,"tag":22,"props":192,"children":193},{},[194,196,201,203,208,210,216],{"type":26,"value":195},"离子阱系统不受此限制。由于任意离子都可以与任意其他离子相互作用，那些需要",{"type":21,"tag":136,"props":197,"children":198},{},[199],{"type":26,"value":200},"非局域",{"type":26,"value":202},"奇偶校验的编码方案——在平面芯片上实现这类校验的布线成本会高得令人望而却步——在这里可以直接实现。这为更节省量子比特的编码家族（大致可归为 qLDPC 类构造）打开了大门，它们用更慢的门操作换取物理量子比特到逻辑量子比特开销的大幅降低。我们的",{"type":21,"tag":46,"props":204,"children":205},{"href":99},[206],{"type":26,"value":207},"硬件概览",{"type":26,"value":209},"和",{"type":21,"tag":46,"props":211,"children":213},{"href":212},"\u002Fcompare",[214],{"type":26,"value":215},"模态对比",{"type":26,"value":217},"对这一权衡做了更一般性的介绍；而 Helios 则是目前已经交付的、对此最鲜明的具体例证。",{"type":21,"tag":29,"props":219,"children":221},{"id":220},"这个比例没有告诉你的事",[222],{"type":26,"value":220},{"type":21,"tag":22,"props":224,"children":225},{},[226],{"type":26,"value":227},"开销只是一个维度，而且不是唯一的维度——每个逻辑量子比特所需的物理量子比特数量少，并不会自动让一台机器变得更实用。正如我们在逻辑量子比特那篇文章中提到的，评价一个逻辑量子比特应当综合考量多个指标：开销、空闲逻辑错误率、逻辑门保真度、逻辑门速度，以及门集的通用性。离子阱的门操作比超导门慢好几个数量级，因此一个每次操作需要几毫秒的2:1编码逻辑量子比特，并不能简单地说就比一个运行速度快上千倍、但开销更高的逻辑量子比特\"更好\"——正确的比较完全取决于你的算法在退相干追上之前需要执行多少次逻辑操作。",{"type":21,"tag":22,"props":229,"children":230},{},[231],{"type":26,"value":232},"同样，对于这个行业中的任何硬件宣称，在被独立验证之前，都值得将其视为厂商自述的数据来看待。\"2:1 比例下的48个逻辑量子比特\"描述的是特定运行条件下的一次具体演示，而不是一种普遍可用、即插即用的能力。",{"type":21,"tag":29,"props":234,"children":236},{"id":235},"对今天正在学习的你意味着什么",[237],{"type":26,"value":235},{"type":21,"tag":22,"props":239,"children":240},{},[241,243,249,251,257,259,265],{"type":26,"value":242},"Helios 级别的硬件不像 ",{"type":21,"tag":46,"props":244,"children":246},{"href":245},"\u002Fblog\u002Fibm-quantum-free-tier-2026",[247],{"type":26,"value":248},"IBM 的 Open Plan",{"type":26,"value":250}," 那样可以在免费队列中排队使用——但无论最终哪种硬件胜出，这些理念都是通用的。Quantinuum 的 TKET 编译器是开源的，无论你面向哪种后端，今天就可以免费使用；而本文中的这些概念——编码开销、连接性限制、阈值定理——正是你评估未来任何相关公告时都会用到的同一套工具。我们的",{"type":21,"tag":46,"props":252,"children":254},{"href":253},"\u002Fblog\u002Funderstanding-quantum-error-correction",[255],{"type":26,"value":256},"纠错原理解析",{"type":26,"value":258},"介绍了其底层机制，",{"type":21,"tag":46,"props":260,"children":262},{"href":261},"\u002Flandscape",[263],{"type":26,"value":264},"量子行业全景",{"type":26,"value":266},"则追踪了各个技术路线上都有谁在做什么，而不仅仅局限于这一种。",{"title":7,"searchDepth":106,"depth":106,"links":268},[269,270,271,272],{"id":158,"depth":106,"text":161},{"id":176,"depth":106,"text":176},{"id":220,"depth":106,"text":220},{"id":235,"depth":106,"text":235},"content:zh:blog:quantinuum-helios-logical-qubits-2026.md","zh\u002Fblog\u002Fquantinuum-helios-logical-qubits-2026.md","zh\u002Fblog\u002Fquantinuum-helios-logical-qubits-2026",{"_path":277,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":278,"description":279,"date":10,"author":11,"tags":280,"readingTime":127,"body":283,"_type":111,"_id":428,"_source":113,"_file":429,"_stem":430,"_extension":116},"\u002Fzh\u002Fblog\u002Fquantum-chemistry-protein-scale-2026","量子计算机刚刚模拟了一个真实的蛋白质——这意味着什么","克利夫兰诊所与 IBM 在 IBM 的 Heron r2 芯片上运行了一个303原子迷你蛋白质的量子-经典混合模拟——相较于大多数 VQE 演示所用的玩具分子，这是一次真正的规模跃升，同时也伴随着真实的局限。",[281,282,13],"Chemistry","VQE",{"type":18,"children":284,"toc":421},[285,298,303,308,334,339,345,350,356,385,390,395,401],{"type":21,"tag":22,"props":286,"children":287},{},[288,290,296],{"type":26,"value":289},"你在网上能找到的大多数 VQE 教程——包括",{"type":21,"tag":46,"props":291,"children":293},{"href":292},"\u002Fblog\u002Fvqe-pennylane-practical-guide",[294],{"type":26,"value":295},"我们自己的",{"type":26,"value":297},"——模拟的都是氢或氢化锂：只有几个原子的分子，之所以选择它们，是因为这正是当前硬件和噪声水平真正能够处理的规模。2026年3月，克利夫兰诊所与 IBM 发布了一项性质完全不同、规模大得多的成果：使用 IBM 的 Heron r2 处理器，对一个303原子的迷你蛋白质 Trp-cage 的电子结构进行了量子-经典混合建模。",{"type":21,"tag":22,"props":299,"children":300},{},[301],{"type":26,"value":302},"这是规模上的真正跃升，值得弄清楚这为什么困难，以及这个引人注目的原子数量究竟证明了什么、又没有证明什么。",{"type":21,"tag":29,"props":304,"children":306},{"id":305},"为什么分子大小是问题的核心",[307],{"type":26,"value":305},{"type":21,"tag":22,"props":309,"children":310},{},[311,317,319,324,326,332],{"type":21,"tag":46,"props":312,"children":314},{"href":313},"\u002Fresearch\u002Ffeynman-simulating-physics-1982",[315],{"type":26,"value":316},"费曼在1982年提出量子计算的最初论证",{"type":26,"value":318},"正是这一点：在经典计算机上精确模拟量子系统，所需资源会随系统规模呈指数增长，因为电子波函数存在于一个希尔伯特空间中，其维度会随所涉及的轨道数量而急剧膨胀。化学家通常用近似方法绕过这个问题，但对于超出小分子范围的任何体系，精确解在经典计算上都是不可及的。这正是 ",{"type":21,"tag":46,"props":320,"children":322},{"href":321},"\u002Fglossary\u002Fvqe",[323],{"type":26,"value":282},{"type":26,"value":325}," 存在的全部意义——",{"type":21,"tag":46,"props":327,"children":329},{"href":328},"\u002Fresearch\u002Fperuzzo-vqe-2014",[330],{"type":26,"value":331},"Peruzzo 于2014年发表的论文",{"type":26,"value":333},"提出了 VQE，正是因为当时的近期硬件无法独立完成整个计算，才采用了量子-经典混合循环。",{"type":21,"tag":22,"props":335,"children":336},{},[337],{"type":26,"value":338},"这也是为什么\"有多少个原子？\"对于量子化学演示来说是一个真正有意义的衡量标准——这与随机电路采样基准测试之类的场景不同。从一个2原子分子跃升到一个303原子分子，并不是对同一结果的营销式夸大——而是所攻克问题规模上的真实飞跃。",{"type":21,"tag":29,"props":340,"children":342},{"id":341},"trp-cage-是什么为何选择它",[343],{"type":26,"value":344},"Trp-cage 是什么，为何选择它",{"type":21,"tag":22,"props":346,"children":347},{},[348],{"type":26,"value":349},"Trp-cage 并不是为了新闻稿而随意挑选的大分子——它是一种被充分研究过的20个残基的迷你蛋白质，多年来一直是分子动力学和蛋白质折叠研究中的标准基准体系，正是因为它足够小、易于处理，又足够真实、能够表现出真实蛋白质的行为。使用一个已被广泛验证的参考体系，而非全新的体系，使得这一结果更容易与数十年积累的经典模拟数据进行核对。",{"type":21,"tag":29,"props":351,"children":353},{"id":352},"混合工作流在这里几乎可以肯定意味着什么",[354],{"type":26,"value":355},"\"混合工作流\"在这里几乎可以肯定意味着什么",{"type":21,"tag":22,"props":357,"children":358},{},[359,361,367,369,375,377,383],{"type":26,"value":360},"请仔细审视这个原子数字。一个303原子体系的",{"type":21,"tag":362,"props":363,"children":364},"em",{},[365],{"type":26,"value":366},"完整",{"type":26,"value":368},"电子结构，远远超出当前任何量子处理器能够直接处理的范围，303个原子的所有电子极不可能真的都被表示在量子处理器上。更符合实际的情形——与 IBM 此前在类似大分子研究中公布的方法一致——是一种混合嵌入方案：精心选择的活性空间（对所研究性质最关键的电子和轨道）交由量子硬件处理，其余部分则通过经典计算处理并拼接回整体结果。这并不是在贬低这项成果——目前这个规模范围内所有\"量子计算机模拟真实分子\"的说法，实际上都是以这种方式实现的，这正是该领域在 ",{"type":21,"tag":46,"props":370,"children":372},{"href":371},"\u002Fglossary\u002Fnisq",[373],{"type":26,"value":374},"NISQ 时代",{"type":26,"value":376},"所确立的",{"type":21,"tag":46,"props":378,"children":380},{"href":379},"\u002Fglossary\u002Fhybrid-algorithm",[381],{"type":26,"value":382},"混合算法",{"type":26,"value":384},"模式。诚实的结论是：新闻标题中的数字描述的是所研究的体系，而不是量子处理器对每一个原子都做了同等工作量的证明。",{"type":21,"tag":29,"props":386,"children":388},{"id":387},"为什么它依然是一个有意义的里程碑",[389],{"type":26,"value":387},{"type":21,"tag":22,"props":391,"children":392},{},[393],{"type":26,"value":394},"抛开这些限制不谈，这确实是这类混合流水线处理能力上的一次真正进步。此前大多数\"量子计算机做化学\"的演示，最多只能处理采用最小基组、只有几个原子的分子。将同一类技术扩展到一个具有生物学意义、且已被充分表征的303原子体系——并且是在真实硬件上运行量子部分，而非作为经典的替代演示——表明的是整条流水线本身在规模上的可扩展性，而这正是各厂商都在争相攻克的真正瓶颈。它与2026年其他同方向的化学里程碑并列，包括 Qubit Pharmaceuticals 与 Pasqal 展示的、在蛋白质口袋中进行水分子量子算法定位——这是一项分子生物学级别的任务，而非教科书式的演示。",{"type":21,"tag":29,"props":396,"children":398},{"id":397},"如果你正在学习这意味着什么",[399],{"type":26,"value":400},"如果你正在学习，这意味着什么",{"type":21,"tag":22,"props":402,"children":403},{},[404,406,412,414,419],{"type":26,"value":405},"你并不需要 Heron r2 的访问权限——甚至不需要任何真实的量子处理器——就能学会这里所使用的技术。同样的 VQE 构建模块（拟设构造、活性空间选择、经典优化循环）无论你是在",{"type":21,"tag":46,"props":407,"children":409},{"href":408},"\u002Fsimulators",[410],{"type":26,"value":411},"免费本地模拟器",{"type":26,"value":413},"上拟合 H₂，还是在阅读一个303原子的蛋白质案例，都是通用的。如果你想亲自运行小分子版本，可以从我们的 ",{"type":21,"tag":46,"props":415,"children":416},{"href":292},[417],{"type":26,"value":418},"PennyLane VQE 指南",{"type":26,"value":420},"开始；而对于这类报道中出现的原子数字，应当像对待任何其他硬件宣称一样看待它：一个真实的成果，值得被准确理解，但还不是故事的全部。",{"title":7,"searchDepth":106,"depth":106,"links":422},[423,424,425,426,427],{"id":305,"depth":106,"text":305},{"id":341,"depth":106,"text":344},{"id":352,"depth":106,"text":355},{"id":387,"depth":106,"text":387},{"id":397,"depth":106,"text":400},"content:zh:blog:quantum-chemistry-protein-scale-2026.md","zh\u002Fblog\u002Fquantum-chemistry-protein-scale-2026.md","zh\u002Fblog\u002Fquantum-chemistry-protein-scale-2026",{"_path":432,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":433,"description":434,"date":10,"author":11,"tags":435,"readingTime":436,"body":437,"_type":111,"_id":707,"_source":113,"_file":708,"_stem":709,"_extension":116},"\u002Fzh\u002Fblog\u002Ftop-quantum-computing-companies-2026","2026年7月量子计算领先企业排行与解析","对2026年7月真正重要的量子计算公司进行的一份务实排名：真实营收、真实硬件里程碑、真实现金状况，而非新闻稿式的热情。IonQ的数据配得上它的位置。Rigetti的数据还没能赶上同行。",[14,13],12,{"type":18,"children":438,"toc":693},[439,444,456,462,482,488,493,499,504,525,530,536,548,554,559,565,570,575,581,586,592,597,603,608,614,619,624,662,667],{"type":21,"tag":22,"props":440,"children":441},{},[442],{"type":26,"value":443},"大多数\"顶级量子计算公司\"榜单要么按标题里的量子比特数排名，要么按公司最近一次发新闻稿的时间排名。这两者都说明不了什么。没有配套保真度数据的量子比特数，无法说明一台机器是否完成了有用的工作，而新闻稿衡量的是营销预算，不是硬件路线图。",{"type":21,"tag":22,"props":445,"children":446},{},[447,449,454],{"type":26,"value":448},"这份排名改用三项指标：已证实的技术进展（保真度、逻辑量子比特、可独立复现的结果，而不只是标题式的宣称）、商业牵引力（营收、合同、订单储备），以及财务韧性（现金状况相对于烧钱速度）。如果某个数字只来自公司自身的说法，本文会明确说明。我们的",{"type":21,"tag":46,"props":450,"children":451},{"href":261},[452],{"type":26,"value":453},"完整行业目录",{"type":26,"value":455},"收录了每个类别超过60家公司。本文正相反：一份简短、有明确立场的清单，说明谁真正领先，以及为什么一些声量最大的名字并不领先。",{"type":21,"tag":29,"props":457,"children":459},{"id":458},"_1-ibm-quantum",[460],{"type":26,"value":461},"1. IBM Quantum",{"type":21,"tag":22,"props":463,"children":464},{},[465,467,473,475,480],{"type":26,"value":466},"IBM 仍是业内覆盖面最广的平台，2026年7月是其表现最强劲的月份之一：同一天宣布了三项独立的量子优势成果，涉及三个不同的合作伙伴和三种不同的验证策略。我们",{"type":21,"tag":46,"props":468,"children":470},{"href":469},"\u002Fblog\u002Fibm-quantum-advantage-triple-announcement-2026",[471],{"type":26,"value":472},"在这里报道了完整公告",{"type":26,"value":474},"。Nighthawk 处理器（120量子比特、218个可调耦合器）已投入使用，IBM 的公开路线图通过一系列过渡系统，目标在2029年实现容错，并转向 qLDPC 类型的编码，相比表面码将纠错开销削减约90%。IBM 的 Open Plan 仍是任何人免费在真实硬件上运行电路最简单的方式，这也让 IBM 在下一代量子开发者的学习路径中占据核心位置。如果你想亲自试试，可以看看我们的 ",{"type":21,"tag":46,"props":476,"children":477},{"href":245},[478],{"type":26,"value":479},"IBM Quantum 免费套餐指南",{"type":26,"value":481},"。IBM 的弱点正是其广度的另一面：同时发生的事情太多，每个单独的结果获得的审视都会比来自更专注的小型竞争对手时更少。",{"type":21,"tag":29,"props":483,"children":485},{"id":484},"_2-google-quantum-ai",[486],{"type":26,"value":487},"2. Google Quantum AI",{"type":21,"tag":22,"props":489,"children":490},{},[491],{"type":26,"value":492},"Google 的 Willow 处理器在2025年底交出了 Quantum Echoes 成果（发表于 Nature），论文估计这项计算比现有最佳经典方法快约1.3万倍，而一年前的低于阈值纠错演示至今仍是该领域少数经过完全独立审视的里程碑之一。2026年3月，Google 在其超导工作之外新增了中性原子研究方向，以防超导传输子量子比特并非最终答案。Google 发布的频率低于竞争对手，两次发布之间披露的信息也更少，这是一种可以理解的研究策略，但也让人更难逐月追踪其进展。",{"type":21,"tag":29,"props":494,"children":496},{"id":495},"_3-ionq",[497],{"type":26,"value":498},"3. IonQ",{"type":21,"tag":22,"props":500,"children":501},{},[502],{"type":26,"value":503},"在纯量子硬件公司中，IonQ 的数据是业内最强劲的，这是一个事实陈述，而非宣传语。2026年第一季度营收达到6470万美元，同比增长755%,全年指引上调至2.6亿至2.7亿美元，剩余履约义务达到4.7亿美元，同比增长554%。这不是一家靠希望运转的公司的状态。政府方面的牵引力也印证了这一点：与导弹防御局签下上限高达1510亿美元的合同框架（这是上限而非支出保证，但仍是不寻常的规模）、2026年4月拿下的新DARPA合同，以及与韩国KISTI研究所达成的主权量子高性能计算合作。",{"type":21,"tag":22,"props":505,"children":506},{},[507,509,515,517,523],{"type":26,"value":508},"在硬件方面，IonQ 的离子阱路线受益于 Oxford Ionics 收购带来的\"平滑门\"技术，据该公司称，这项技术可将双量子比特门保真度提升到99.99%以上，且无需完整的基态冷却，如果能经受独立测试的检验，这将是一条真正的工程捷径。IonQ 还在2025年12月发布了一项解码器成果（Beam Search，面向量子 LDPC 码），宣称相较标准 BP-OSD 基线可将逻辑错误率降低5.6至17倍，并能在普通CPU核心上实现亚毫秒级解码。如果这项技术能按 IonQ 的预期扩展，相比竞争对手正在追求的 FPGA 和 ASIC 路线，这将是通往实时解码的一条成本低得多的路径，我们在",{"type":21,"tag":46,"props":510,"children":512},{"href":511},"\u002Fblog\u002Fquantum-error-decoding-bottleneck",[513],{"type":26,"value":514},"实时解码瓶颈",{"type":26,"value":516},"一文中对此有更深入的探讨。而 SkyWater Technology 代工厂的收购，",{"type":21,"tag":46,"props":518,"children":520},{"href":519},"\u002Fblog\u002Fionq-skywater-acquisition-explained",[521],{"type":26,"value":522},"我们在这篇文章中做过详细分析",{"type":26,"value":524},"，为 IonQ 围绕其量子比特的电极、光子学和控制硬件提供了一条完全本土、经过国防安全审查的供应链，无论量子比特物理本身如何，这都是面向政府买家的真实优势。",{"type":21,"tag":22,"props":526,"children":527},{},[528],{"type":26,"value":529},"以上这些都不像 Google 的低于阈值成果那样经过独立验证。IonQ 的保真度、解码器和门速度方面的宣称都是 IonQ 自己给出的数字。但其商业和政府方面的牵引力是外部报道且可核实的，这与营销宣称不同，而且一家如此年轻的硬件公司能在这样的规模上展现出真实的营收增长而非单纯依赖研究资助，这种情况并不常见。这种组合，已证实的商业拉动力加上连贯的硬件路线图，正是 IonQ 排在那些实验室成果或许相当甚至更好、但商业故事薄弱得多的竞争对手之前的原因。",{"type":21,"tag":29,"props":531,"children":533},{"id":532},"_4-quantinuum",[534],{"type":26,"value":535},"4. Quantinuum",{"type":21,"tag":22,"props":537,"children":538},{},[539,541,546],{"type":26,"value":540},"Quantinuum 的 Helios 系统宣称从约96个物理量子比特中实现了48个纠错逻辑量子比特，即2:1的比例，如果这一比例成立将具有重要意义，因为超导硬件上的表面码估算通常需要数百甚至数千个物理量子比特才能对应一个逻辑量子比特。我们",{"type":21,"tag":46,"props":542,"children":543},{"href":56},[544],{"type":26,"value":545},"在这里解释了这一比例为何可能实现",{"type":26,"value":547},"：离子阱的全连接特性支持超导平面芯片无法布线实现的非局域奇偶校验。Quantinuum 于2026年上市，估值达156亿美元，比几个月前的最后一轮私募融资高出50%以上，霍尼韦尔保留了约48%的投票权。这次IPO的反响说明市场相信这个技术故事。和 IonQ 的保真度宣称一样，这个2:1的数字也是厂商自报，尚未经过独立复现。",{"type":21,"tag":29,"props":549,"children":551},{"id":550},"_5-d-wave",[552],{"type":26,"value":553},"5. D-Wave",{"type":21,"tag":22,"props":555,"children":556},{},[557],{"type":26,"value":558},"D-Wave 属于另一个类别，退火而非门模型计算，因此很容易被低估。2026年第一季度预订量同比增长近20倍，达到3340万美元，而已确认营收相对较少，为290万美元，这说明订单储备是真实的，但确认周期很长。5.88亿美元的现金储备让公司有足够的时间等待。与佛罗里达大西洋大学和一家财富100强客户达成的量子云访问协议表明，其细分领域，即天然适合退火求解的优化问题，仍有活跃的商业需求。",{"type":21,"tag":29,"props":560,"children":562},{"id":561},"_6-rigetti-computing",[563],{"type":26,"value":564},"6. Rigetti Computing",{"type":21,"tag":22,"props":566,"children":567},{},[568],{"type":26,"value":569},"Rigetti 是本榜单中叙事与数据之间落差最大的公司。其108量子比特超导系统 Cepheus-1 在2026年4月实现全面可用，比原定的2025年第四季度目标有所推迟，原因是可调耦合器的保真度问题。系统发布后，报告的双量子比特保真度约为99%至99.1%，低于 Rigetti 自身99.5%的目标，也明显低于 IonQ 和 Quantinuum 各自平台所宣称的数字。2026年第一季度营收为440万美元，只是 IonQ 同季度6470万美元的一个零头。公开报道还提到其在一项DARPA项目里程碑上出现挫折，这给一家目前大程度依靠自我造血推进路线图的公司带来了更大压力。",{"type":21,"tag":22,"props":571,"children":572},{},[573],{"type":26,"value":574},"真正的优势只有一个：资产负债表。约5.69亿美元现金、无债务，每季度约2600万美元的烧钱速度，这换来了真实的续航能力。这一点值得直接肯定，因为强劲的现金状况本身就是真实的资产，而非安慰奖。但现金买来的是时间，不是竞争地位，而在真正预示量子计算机能否完成有用工作的指标上，保真度、逻辑量子比特进展、独立的商业牵引力，Rigetti 落后于 IBM、Google、IonQ 和 Quantinuum，并非与它们并驾齐驱。从数字上看，其自身迈向1000+量子比特的公开路线图读起来更像是一场多年的追赶，而非一条并行赛道。",{"type":21,"tag":29,"props":576,"children":578},{"id":577},"_7-psiquantum",[579],{"type":26,"value":580},"7. PsiQuantum",{"type":21,"tag":22,"props":582,"children":583},{},[584],{"type":26,"value":585},"PsiQuantum 的光子学路线以容错为首要目标，2025年9月完成10亿美元的E轮融资，并从澳大利亚和昆士兰政府获得约9.4亿澳元（约6.2亿美元）的承诺资金。其位于布里斯班的工厂于2026年6月开工建设，但交付时间表已从最初的2027年推迟到2029年。PsiQuantum 从未交付过商用系统，几乎把一切都押在一台容错机器能在大规模建成后一次成功运行上，这与本榜单中所有门模型竞争对手都截然不同的风险状况，后者如今都已有（虽然带噪声但确实在运行的）硬件投入使用。",{"type":21,"tag":29,"props":587,"children":589},{"id":588},"_8-xanadu",[590],{"type":26,"value":591},"8. Xanadu",{"type":21,"tag":22,"props":593,"children":594},{},[595],{"type":26,"value":596},"Xanadu 于2026年3月在纳斯达克和多伦多证券交易所上市，融资3.02亿美元，其模块化光子系统 Aurora 宣称具备实时纠错能力，如果得到独立验证，这将是重要的技术进步。其 PennyLane 框架仍是量子机器学习领域使用最广泛的开源工具之一，无论它面向哪家硬件，这都为 Xanadu 提供了不依赖自家芯片获胜的生态立足点。",{"type":21,"tag":29,"props":598,"children":600},{"id":599},"_9-pasqal",[601],{"type":26,"value":602},"9. Pasqal",{"type":21,"tag":22,"props":604,"children":605},{},[606],{"type":26,"value":607},"Pasqal 的中性原子路线融资3.4亿欧元，一项SPAC合并交易将其估值定为20亿美元，预计于2026年下半年完成。其公开路线图目标是在2026年展示250量子比特的优势演示，并通过 Vela 和 Centaurus 系统迈向超过1万个量子比特。中性原子在商业化阶段仍早于离子阱或超导量子比特，但 Pasqal 的融资和政府关系（尤其在欧洲）为其达到这一规模提供了真实的持续能力。",{"type":21,"tag":29,"props":609,"children":611},{"id":610},"_10-quera-computing",[612],{"type":26,"value":613},"10. QuEra Computing",{"type":21,"tag":22,"props":615,"children":616},{},[617],{"type":26,"value":618},"QuEra 在2026年1月的一篇 Nature 论文中报告，在448个物理量子比特上编码出96个逻辑量子比特，如果这一比例能经受住类似 Google 低于阈值成果那样的检验，QuEra 的逻辑量子比特数量将超过 Quantinuum 的 Helios 成果。来自 Google 和软银等投资方超过5.07亿美元的总融资，为其继续推进中性原子路线走向更大规模提供了资源。",{"type":21,"tag":29,"props":620,"children":622},{"id":621},"其余厂商简述",[623],{"type":26,"value":621},{"type":21,"tag":22,"props":625,"children":626},{},[627,632,634,639,641,646,648,653,655,660],{"type":21,"tag":136,"props":628,"children":629},{},[630],{"type":26,"value":631},"Atom Computing",{"type":26,"value":633}," 正与微软的 QuNorth 团队在纠错方面合作，目标是到2026年底在超过1200个物理量子比特上实现50个逻辑量子比特。",{"type":21,"tag":136,"props":635,"children":636},{},[637],{"type":26,"value":638},"IQM",{"type":26,"value":640}," 从贝莱德获得5000万欧元融资，SPAC估值达18亿美元，将自己定位为首家在欧盟上市的纯量子硬件公司，已向13家客户售出21套系统。",{"type":21,"tag":136,"props":642,"children":643},{},[644],{"type":26,"value":645},"Infleqtion",{"type":26,"value":647}," 于2026年2月在纽交所上市，报告拥有1600个物理量子比特，保真度为99.73%。",{"type":21,"tag":136,"props":649,"children":650},{},[651],{"type":26,"value":652},"Microsoft",{"type":26,"value":654}," 在2026年6月发布了 Majorana 2 拓扑量子比特更新，宣称量子比特寿命提升了1000倍，鉴于拓扑量子比特相关宣称历来备受争议，这一结果仍面临物理学界的真实审视。",{"type":21,"tag":136,"props":656,"children":657},{},[658],{"type":26,"value":659},"NVIDIA",{"type":26,"value":661}," 完全不制造量子比特，而是将其 NVQLink 基础设施定位为经典超级计算与来自 Rigetti、SEEQC、Quantinuum 和 IQM 的量子处理器之间的连接层，押注无论哪种硬件路线胜出，它都能掌控这条连接管道。",{"type":21,"tag":29,"props":663,"children":665},{"id":664},"如何使用这份榜单",[666],{"type":26,"value":664},{"type":21,"tag":22,"props":668,"children":669},{},[670,672,678,680,684,686,691],{"type":26,"value":671},"像这样的排名会很快过时，这里的每一个数字都来自某个特定季度或某次特定公告，一年之内就会显得陈旧。不会那么快过时的是这套方法：将营收与指引对照，将保真度与公司自己设定的目标对照，检查某项\"逻辑量子比特\"或\"量子优势\"的宣称是否经过独立复现，还是仍仅停留在厂商自己的说法上。把同样的方法用在你接下来读到的任何公告上，我们的",{"type":21,"tag":46,"props":673,"children":675},{"href":674},"\u002Fblog\u002Fquantum-benchmarking-eo-14413",[676],{"type":26,"value":677},"量子基准测试文章",{"type":26,"value":679},"更深入地探讨了为什么这个领域至今仍缺乏一种可信、不依赖厂商的硬件比较方式。如果你要决定真正在哪个平台上构建，而不只是观望哪一个，我们的",{"type":21,"tag":46,"props":681,"children":682},{"href":99},[683],{"type":26,"value":207},{"type":26,"value":685},"和 ",{"type":21,"tag":46,"props":687,"children":688},{"href":212},[689],{"type":26,"value":690},"SDK 对比",{"type":26,"value":692},"是下一步该去的地方。",{"title":7,"searchDepth":106,"depth":106,"links":694},[695,696,697,698,699,700,701,702,703,704,705,706],{"id":458,"depth":106,"text":461},{"id":484,"depth":106,"text":487},{"id":495,"depth":106,"text":498},{"id":532,"depth":106,"text":535},{"id":550,"depth":106,"text":553},{"id":561,"depth":106,"text":564},{"id":577,"depth":106,"text":580},{"id":588,"depth":106,"text":591},{"id":599,"depth":106,"text":602},{"id":610,"depth":106,"text":613},{"id":621,"depth":106,"text":621},{"id":664,"depth":106,"text":664},"content:zh:blog:top-quantum-computing-companies-2026.md","zh\u002Fblog\u002Ftop-quantum-computing-companies-2026.md","zh\u002Fblog\u002Ftop-quantum-computing-companies-2026",{"_path":711,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":712,"description":713,"date":10,"author":11,"tags":714,"readingTime":127,"body":715,"_type":111,"_id":805,"_source":113,"_file":806,"_stem":807,"_extension":116},"\u002Fblog\u002Fadapt-gqe-ai-quantum-circuit-design","AI Now Designs Quantum Chemistry Circuits Faster Than the Standard Method","Quantinuum, NVIDIA, and Pfizer built ADAPT-GQE, a transformer and reinforcement-learning system that generates VQE ansatz circuits an order of magnitude faster than ADAPT-VQE, demonstrated on a real drug molecule and run on Quantinuum's Helios hardware.",[281,282,13],{"type":18,"children":716,"toc":799},[717,728,734,739,744,750,762,768,781,787],{"type":21,"tag":22,"props":718,"children":719},{},[720,722,726],{"type":26,"value":721},"Building a good ",{"type":21,"tag":46,"props":723,"children":724},{"href":321},[725],{"type":26,"value":282},{"type":26,"value":727}," circuit for a specific molecule is itself a hard, expensive search problem, before you ever run the circuit. Researchers from Quantinuum, NVIDIA, and Pfizer published a result on July 30, 2026 that automates that search: a system called ADAPT-GQE, which learns to generate the ansatz circuit directly instead of building it one operator at a time.",{"type":21,"tag":29,"props":729,"children":731},{"id":730},"the-problem-adapt-gqe-targets",[732],{"type":26,"value":733},"The problem ADAPT-GQE targets",{"type":21,"tag":22,"props":735,"children":736},{},[737],{"type":26,"value":738},"The standard method, ADAPT-VQE, builds a molecule-specific ansatz by testing a pool of candidate operators at every step, picking the one that improves the energy estimate most, and repeating. That greedy search works, but it gets expensive fast as molecules grow, since every step re-evaluates the whole operator pool from scratch.",{"type":21,"tag":22,"props":740,"children":741},{},[742],{"type":26,"value":743},"ADAPT-GQE replaces that per-molecule greedy search with a trained model: a transformer combined with reinforcement learning, trained to generate the state-preparation circuit for a molecule's electronic ground state directly. Once trained, generating a new circuit is a forward pass through a model instead of a fresh greedy search.",{"type":21,"tag":29,"props":745,"children":747},{"id":746},"what-the-results-show",[748],{"type":26,"value":749},"What the results show",{"type":21,"tag":22,"props":751,"children":752},{},[753,755,760],{"type":26,"value":754},"The team reports a 234 times speed-up in generating training data for complex molecules, and roughly one order of magnitude reduction in circuit generation time compared to ADAPT-VQE, while matching or improving accuracy in preparing molecular ground states on their benchmarks. They demonstrated the approach on imipramine, an approved tricyclic antidepressant used here as a realistic pharmaceutical test molecule, and ran the AI-generated circuits on Quantinuum's Helios trapped-ion system, the same hardware we covered in our ",{"type":21,"tag":46,"props":756,"children":757},{"href":56},[758],{"type":26,"value":759},"piece on Helios's logical qubit encoding",{"type":26,"value":761},".",{"type":21,"tag":29,"props":763,"children":765},{"id":764},"read-the-claim-at-the-scale-it-was-tested",[766],{"type":26,"value":767},"Read the claim at the scale it was tested",{"type":21,"tag":22,"props":769,"children":770},{},[771,773,779],{"type":26,"value":772},"This result is about circuit generation, not about simulating a bigger molecule than anyone has before. It is a different kind of advance from the ",{"type":21,"tag":46,"props":774,"children":776},{"href":775},"\u002Fblog\u002Fquantum-chemistry-protein-scale-2026",[777],{"type":26,"value":778},"Cleveland Clinic and IBM protein-scale simulation",{"type":26,"value":780}," we covered separately, which pushed the size of the system being simulated. ADAPT-GQE instead pushes the speed and cost of building the circuit for a given molecule, tested here on one well-characterized drug compound. Whether the trained model generalizes to structurally different molecules without retraining, and how it performs as molecule size grows well past imipramine, are the open questions worth watching in follow-up work rather than assuming from this result alone.",{"type":21,"tag":29,"props":782,"children":784},{"id":783},"why-this-fits-a-pattern-worth-naming",[785],{"type":26,"value":786},"Why this fits a pattern worth naming",{"type":21,"tag":22,"props":788,"children":789},{},[790,792,797],{"type":26,"value":791},"Pfizer's involvement gives this a real commercial angle instead of a research-only demonstration, and it points at a broader shift already visible across 2026 quantum chemistry news: less effort spent proving quantum computers touch a toy molecule, more effort spent removing the practical bottlenecks, molecule size in IBM's case, circuit design cost here, standing between a working method and something a pharmaceutical team would use. If you want to build the small-molecule version of this yourself on a free simulator, our ",{"type":21,"tag":46,"props":793,"children":794},{"href":292},[795],{"type":26,"value":796},"PennyLane VQE guide",{"type":26,"value":798}," walks through the manual ansatz-construction approach ADAPT-GQE is trying to replace.",{"title":7,"searchDepth":106,"depth":106,"links":800},[801,802,803,804],{"id":730,"depth":106,"text":733},{"id":746,"depth":106,"text":749},{"id":764,"depth":106,"text":767},{"id":783,"depth":106,"text":786},"content:blog:adapt-gqe-ai-quantum-circuit-design.md","blog\u002Fadapt-gqe-ai-quantum-circuit-design.md","blog\u002Fadapt-gqe-ai-quantum-circuit-design",{"_path":809,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":810,"description":811,"date":10,"author":11,"tags":812,"readingTime":16,"body":813,"_type":111,"_id":879,"_source":113,"_file":880,"_stem":881,"_extension":116},"\u002Fblog\u002Fglobalfoundries-chips-silicon-photonics-award","GlobalFoundries Gets $300 Million to Build Silicon Photonics in the US","GlobalFoundries signed a letter of intent for a $300 million CHIPS Act award to scale US silicon photonics manufacturing. It is not a quantum computing grant, but the manufacturing capacity it builds matters for photonic quantum hardware and quantum networking too.",[14,13],{"type":18,"children":814,"toc":874},[815,820,826,831,837,863,869],{"type":21,"tag":22,"props":816,"children":817},{},[818],{"type":26,"value":819},"GlobalFoundries signed a letter of intent with the US Department of Commerce on July 29, 2026, for a $300 million CHIPS Act award to scale up US silicon photonics manufacturing. Read the headline carefully: this is not quantum computing funding. It is an AI-infrastructure story first. It belongs on this site because the manufacturing capacity it builds is the same capacity photonic quantum computing and quantum networking depend on.",{"type":21,"tag":29,"props":821,"children":823},{"id":822},"what-the-award-funds",[824],{"type":26,"value":825},"What the award funds",{"type":21,"tag":22,"props":827,"children":828},{},[829],{"type":26,"value":830},"Silicon photonics moves data using light instead of electrical signals, which gives AI systems more bandwidth per watt of power drawn. The funding covers co-packaged optics, an approach that places photonic circuitry directly next to processors instead of routing signals through separate optical modules, along with next-generation optical materials, wafer technology, and advanced packaging. GlobalFoundries states target performance of 400 gigabits per second in throughput and energy consumption cut to a fifth of current-generation systems. The Department of Commerce receives roughly a 1 percent equity stake in GlobalFoundries as part of the deal. Work will run through GlobalFoundries' existing facilities in Malta, New York, and Burlington, Vermont.",{"type":21,"tag":29,"props":832,"children":834},{"id":833},"why-a-chipmakers-ai-deal-shows-up-on-a-quantum-computing-site",[835],{"type":26,"value":836},"Why a chipmaker's AI deal shows up on a quantum computing site",{"type":21,"tag":22,"props":838,"children":839},{},[840,842,847,849,854,856,862],{"type":26,"value":841},"Much of today's silicon photonics and advanced optical packaging supply chain sits outside the United States, which is the same domestic-manufacturing motivation behind ",{"type":21,"tag":46,"props":843,"children":844},{"href":519},[845],{"type":26,"value":846},"IonQ's acquisition of SkyWater Technology",{"type":26,"value":848},". The connection to quantum computing is indirect but real: photonic quantum computing companies like Xanadu and PsiQuantum, tracked on our ",{"type":21,"tag":46,"props":850,"children":851},{"href":261},[852],{"type":26,"value":853},"industry landscape",{"type":26,"value":855},", depend on exactly this kind of silicon photonics fabrication and packaging capacity. So do quantum networking efforts aimed at linking separate QPUs with optical interconnects, the subject of our piece on ",{"type":21,"tag":46,"props":857,"children":859},{"href":858},"\u002Fblog\u002Fquantum-networking-distributed-computing",[860],{"type":26,"value":861},"quantum networking and distributed quantum computing",{"type":26,"value":761},{"type":21,"tag":29,"props":864,"children":866},{"id":865},"what-this-does-and-does-not-tell-you-about-quantum-hardware",[867],{"type":26,"value":868},"What this does and does not tell you about quantum hardware",{"type":21,"tag":22,"props":870,"children":871},{},[872],{"type":26,"value":873},"This award funds general-purpose silicon photonics aimed at AI data centers, not a quantum-specific fabrication line. No quantum hardware vendor is named as a direct beneficiary in the announcement. What it does tell you is that the underlying manufacturing base for photonic and optically networked quantum hardware is getting real government investment and real domestic capacity, for reasons that have nothing to do with quantum computing at all. That is worth knowing if you are trying to judge how much of the \"domestic quantum supply chain\" story making the rounds in 2026 is quantum-specific policy versus a broader chip and AI-infrastructure push that quantum hardware happens to benefit from as a side effect.",{"title":7,"searchDepth":106,"depth":106,"links":875},[876,877,878],{"id":822,"depth":106,"text":825},{"id":833,"depth":106,"text":836},{"id":865,"depth":106,"text":868},"content:blog:globalfoundries-chips-silicon-photonics-award.md","blog\u002Fglobalfoundries-chips-silicon-photonics-award.md","blog\u002Fglobalfoundries-chips-silicon-photonics-award",{"_path":883,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":884,"description":885,"date":10,"author":11,"tags":886,"readingTime":887,"body":888,"_type":111,"_id":1016,"_source":113,"_file":1017,"_stem":1018,"_extension":116},"\u002Fblog\u002Fgoogle-willow-reinforcement-learning-calibration","Google Taught Willow to Calibrate Itself While It Runs Error Correction","Google Quantum AI and DeepMind published a Nature paper showing a reinforcement learning agent recalibrates the Willow processor using the same error-detection data error correction already produces, setting a new logical error rate record for the surface code.",[13,125,14],8,{"type":18,"children":889,"toc":1010},[890,914,920,925,935,941,953,958,964,969,981,987,992],{"type":21,"tag":22,"props":891,"children":892},{},[893,895,903,905,912],{"type":26,"value":894},"Google Quantum AI and Google DeepMind published a paper in Nature on July 10, 2026 showing that a reinforcement learning agent keeps a quantum processor calibrated using data the processor was already producing, rather than pausing to run a separate tune-up routine, according to ",{"type":21,"tag":46,"props":896,"children":900},{"href":897,"rel":898},"https:\u002F\u002Fthequantuminsider.com\u002F2026\u002F07\u002F10\u002Fgoogle-study-shows-quantum-computer-can-learn-from-its-own-errors-while-it-computes\u002F",[899],"nofollow",[901],{"type":26,"value":902},"The Quantum Insider",{"type":26,"value":904}," and ",{"type":21,"tag":46,"props":906,"children":909},{"href":907,"rel":908},"https:\u002F\u002Fwww.nature.com\u002Farticles\u002Fs41586-026-10759-2",[899],[910],{"type":26,"value":911},"the paper itself",{"type":26,"value":913},". The work ran on Google's Willow superconducting processor and was led by Volodymyr Sivak and Alexis Morvan, with 299 authors credited in total.",{"type":21,"tag":29,"props":915,"children":917},{"id":916},"the-problem-this-solves",[918],{"type":26,"value":919},"The problem this solves",{"type":21,"tag":22,"props":921,"children":922},{},[923],{"type":26,"value":924},"Every quantum processor drifts. Control parameters, the microwave pulse amplitudes, frequencies, and coupling strengths that drive each qubit, slowly shift due to temperature changes, material aging, and electronic noise. The standard fix is periodic recalibration: pause the machine, run a dedicated tune-up sequence, then resume. That works, but it treats calibration and computation as separate activities competing for the same hardware time, and it only catches drift at the moments you choose to check for it.",{"type":21,"tag":22,"props":926,"children":927},{},[928,933],{"type":21,"tag":46,"props":929,"children":930},{"href":48},[931],{"type":26,"value":932},"Quantum error correction",{"type":26,"value":934}," already generates a stream of error-detection events as a normal part of running any error-corrected circuit. Google's insight was that this data is not only useful for correcting the logical qubit's state. It also tells you, continuously, how well the underlying hardware is behaving, which is exactly the signal a calibration system needs.",{"type":21,"tag":29,"props":936,"children":938},{"id":937},"what-the-reinforcement-learning-agent-does",[939],{"type":26,"value":940},"What the reinforcement learning agent does",{"type":21,"tag":22,"props":942,"children":943},{},[944,946,951],{"type":26,"value":945},"The system trains a reinforcement learning agent to read the error-detection events produced during normal error-correction cycles and use them to continuously adjust more than 1,000 control parameters, without stopping the computation to do it. Google tested the approach on distance-5 and distance-7 ",{"type":21,"tag":46,"props":947,"children":948},{"href":253},[949],{"type":26,"value":950},"surface codes",{"type":26,"value":952}," and a distance-5 color code on the 105-qubit Willow chip, and ran simulations extending to a distance-15 surface code involving roughly 40,000 parameters, to check whether the approach holds up at a scale beyond what current hardware supports.",{"type":21,"tag":22,"props":954,"children":955},{},[956],{"type":26,"value":957},"The results at the tested scale: a 20% reduction in logical error rate beyond what conventional calibration achieves, even after exhaustive manual tuning. Under artificially injected hardware drift, meant to simulate the kind of degradation a real system experiences over hours of operation, the reinforcement learning approach cut the logical error rate by 24% and made performance 2.4 times more stable than static calibration. Adding decoder-parameter adaptation on top pushed that to a 31% error reduction and 3.5 times more stability. On the distance-7 surface code specifically, the system reached a logical error rate of 7.72 × 10⁻⁴ per cycle, which the authors report as a new record for that code family.",{"type":21,"tag":29,"props":959,"children":961},{"id":960},"why-this-matters-more-than-the-specific-numbers",[962],{"type":26,"value":963},"Why this matters more than the specific numbers",{"type":21,"tag":22,"props":965,"children":966},{},[967],{"type":26,"value":968},"This is the first demonstration of reinforcement learning controlling error correction at the scale of a full error-corrected processor. Earlier experimental work applied similar reinforcement learning techniques to isolated gates or to bosonic codes, smaller, more contained systems. Running it across a full surface-code processor with over 1,000 live control parameters is a meaningfully harder engineering problem, and the fact that it improved on hand-tuned calibration rather than merely matching it is the part worth sitting with.",{"type":21,"tag":22,"props":970,"children":971},{},[972,974,979],{"type":26,"value":973},"Drift is a problem that gets worse, not better, as machines scale up. A processor with a few dozen qubits is recalibrated by hand often enough to stay ahead of drift. A processor with thousands of qubits, the scale ",{"type":21,"tag":46,"props":975,"children":976},{"href":469},[977],{"type":26,"value":978},"IBM's roadmap",{"type":26,"value":980}," and others are explicitly building toward, cannot rely on manual tune-up passes keeping pace with how many parameters need adjusting. A system that recalibrates itself continuously, using data the machine produces anyway, is a more plausible path to keeping a much larger processor stable than scaling up the current manual approach.",{"type":21,"tag":29,"props":982,"children":984},{"id":983},"what-is-still-unproven",[985],{"type":26,"value":986},"What is still unproven",{"type":21,"tag":22,"props":988,"children":989},{},[990],{"type":26,"value":991},"This result was demonstrated on Google's own Willow hardware and published in a peer-reviewed venue, which puts it on firmer ground than a vendor press release. It does not yet tell you whether the same reinforcement learning approach transfers cleanly to a different qubit modality, a different code family beyond the ones tested, or a processor an order of magnitude larger than Willow's 105 qubits. The distance-15 simulation results are exactly that: simulations, not a demonstration on real hardware at that scale.",{"type":21,"tag":22,"props":993,"children":994},{},[995,997,1002,1003,1008],{"type":26,"value":996},"What is established is narrower and still significant: on real hardware, at the scale tested, learning from the error-correction data a processor already generates beats static calibration, and does so by a wide enough margin to set a new record for the surface code. Our ",{"type":21,"tag":46,"props":998,"children":999},{"href":253},[1000],{"type":26,"value":1001},"error correction explainer",{"type":26,"value":904},{"type":21,"tag":46,"props":1004,"children":1005},{"href":150},[1006],{"type":26,"value":1007},"logical qubits and fault tolerance piece",{"type":26,"value":1009}," cover the broader context for why keeping a large processor calibrated is as hard a problem as building the qubits in the first place.",{"title":7,"searchDepth":106,"depth":106,"links":1011},[1012,1013,1014,1015],{"id":916,"depth":106,"text":919},{"id":937,"depth":106,"text":940},{"id":960,"depth":106,"text":963},{"id":983,"depth":106,"text":986},"content:blog:google-willow-reinforcement-learning-calibration.md","blog\u002Fgoogle-willow-reinforcement-learning-calibration.md","blog\u002Fgoogle-willow-reinforcement-learning-calibration",{"_path":75,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":1020,"description":1021,"date":10,"author":11,"tags":1022,"readingTime":127,"body":1023,"_type":111,"_id":1118,"_source":113,"_file":1119,"_stem":1120,"_extension":116},"HRL Built a Silicon Quantum Processor That Runs Its Own Error Correction","HRL Laboratories published a silicon quantum processor in Nature that runs error correction with a control chip inside the cryostat, cutting the room-temperature wiring that limits how many qubits a machine holds.",[13,125,14],{"type":18,"children":1024,"toc":1113},[1025,1037,1043,1048,1066,1072,1077,1082,1088,1098],{"type":21,"tag":22,"props":1026,"children":1027},{},[1028,1030,1035],{"type":26,"value":1029},"Most quantum computers depend on racks of room-temperature electronics wired down into a cryostat, one connection per control signal, per qubit. That wiring, not qubit physics, is one of the real limits on how many qubits a machine holds. On July 29, 2026, HRL Laboratories published a result in Nature that attacks this problem directly: a silicon quantum processor with its own control chip living inside the cryostat, running ",{"type":21,"tag":46,"props":1031,"children":1032},{"href":48},[1033],{"type":26,"value":1034},"error correction",{"type":26,"value":1036}," on its own.",{"type":21,"tag":29,"props":1038,"children":1040},{"id":1039},"what-hrl-built",[1041],{"type":26,"value":1042},"What HRL built",{"type":21,"tag":22,"props":1044,"children":1045},{},[1046],{"type":26,"value":1047},"The device holds 18 qubits. Next to them, inside the same cryostat, sits a custom CMOS controller operating at around minus 450 degrees Fahrenheit, close to the qubits themselves rather than at room temperature. That controller generates every signal the error-correction routine needs and runs the whole cycle with no real-time input from outside the cold chamber. A high-density ribbon cable, 296 channels of superconducting niobium on polyimide, connects the pieces while managing the heat load a control chip normally cannot tolerate at those temperatures.",{"type":21,"tag":22,"props":1049,"children":1050},{},[1051,1053,1058,1059,1064],{"type":26,"value":1052},"The controller chip itself was manufactured at a commercial foundry, the same kind of manufacturing step behind ",{"type":21,"tag":46,"props":1054,"children":1055},{"href":519},[1056],{"type":26,"value":1057},"IonQ's recent purchase of SkyWater Technology",{"type":26,"value":904},{"type":21,"tag":46,"props":1060,"children":1061},{"href":809},[1062],{"type":26,"value":1063},"GlobalFoundries' new silicon photonics funding",{"type":26,"value":1065},". None of these stories are about qubit physics. All three are about the unglamorous manufacturing and packaging work that decides whether a lab result becomes a machine you scale.",{"type":21,"tag":29,"props":1067,"children":1069},{"id":1068},"why-moving-the-controller-matters-more-than-it-sounds",[1070],{"type":26,"value":1071},"Why moving the controller matters more than it sounds",{"type":21,"tag":22,"props":1073,"children":1074},{},[1075],{"type":26,"value":1076},"Every wire running from room temperature into a cryostat carries heat with it, and heat is the enemy of a qubit that needs to stay near absolute zero. Today's largest machines manage this by keeping wiring counts down, which caps how many qubits fit on one system before the cooling and wiring overhead becomes the bottleneck rather than the qubits themselves. A control chip that lives in the cold zone and runs error correction locally removes a big share of that wiring, one wired connection per function instead of one per qubit.",{"type":21,"tag":22,"props":1078,"children":1079},{},[1080],{"type":26,"value":1081},"That is a real, checkable engineering claim, and it is a different kind of claim than a qubit count or a fidelity number. It says nothing about how good HRL's 18 qubits are compared to a superconducting or trapped-ion qubit elsewhere. It says something about whether a silicon-based approach scales its control infrastructure without the wiring problem growing linearly with qubit count.",{"type":21,"tag":29,"props":1083,"children":1085},{"id":1084},"where-this-sits-next-to-other-2026-scaling-work",[1086],{"type":26,"value":1087},"Where this sits next to other 2026 scaling work",{"type":21,"tag":22,"props":1089,"children":1090},{},[1091,1096],{"type":21,"tag":46,"props":1092,"children":1093},{"href":4},[1094],{"type":26,"value":1095},"Warwick researchers published a different answer",{"type":26,"value":1097}," to a related scaling problem the same week: how to let distant qubits on one chip communicate at all, rather than only their nearest neighbors. Read together, the two results point at the same underlying truth. Qubit count and gate fidelity get the headlines, but wiring, control electronics, and qubit-to-qubit communication are the problems that decide whether a design reaches a million qubits or stalls in the hundreds.",{"type":21,"tag":22,"props":1099,"children":1100},{},[1101,1103,1107,1108,1112],{"type":26,"value":1102},"HRL's result is a working 18-qubit device with a published, peer-reviewed result behind it, not a concept paper. That distinction is worth holding onto as you read coverage of scaling claims generally. A demonstrated device at a small scale is a different kind of evidence than a proposed mechanism aimed at a much larger one, even when both are genuine contributions. For more on how silicon-based qubits compare to the trapped-ion, superconducting, and photonic approaches competing for the same scaling problem, see our ",{"type":21,"tag":46,"props":1104,"children":1105},{"href":99},[1106],{"type":26,"value":102},{"type":26,"value":904},{"type":21,"tag":46,"props":1109,"children":1110},{"href":261},[1111],{"type":26,"value":853},{"type":26,"value":761},{"title":7,"searchDepth":106,"depth":106,"links":1114},[1115,1116,1117],{"id":1039,"depth":106,"text":1042},{"id":1068,"depth":106,"text":1071},{"id":1084,"depth":106,"text":1087},"content:blog:hrl-self-operating-silicon-quantum-processor.md","blog\u002Fhrl-self-operating-silicon-quantum-processor.md","blog\u002Fhrl-self-operating-silicon-quantum-processor",{"_path":1122,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":1123,"description":1124,"date":10,"author":11,"tags":1125,"readingTime":887,"body":1126,"_type":111,"_id":1356,"_source":113,"_file":1357,"_stem":1358,"_extension":116},"\u002Fblog\u002Fibm-hrl-laboratories-acquisition-explained","IBM Is Acquiring HRL Laboratories: What the Silicon Spin Qubit Deal Adds","IBM has signed a definitive agreement to acquire HRL Laboratories from Boeing and General Motors, days before HRL's own paper on a self-correcting 18-qubit silicon processor. Here is what the deal covers and what it does not.",[14,13,125],{"type":18,"children":1127,"toc":1349},[1128,1142,1154,1160,1187,1207,1212,1218,1223,1228,1233,1239,1244,1249,1255,1260,1265,1271,1276,1292],{"type":21,"tag":22,"props":1129,"children":1130},{},[1131,1133,1140],{"type":26,"value":1132},"IBM announced on July 23, 2026 that it signed a definitive agreement to acquire HRL Laboratories, a research institution jointly owned by Boeing and General Motors, according to ",{"type":21,"tag":46,"props":1134,"children":1137},{"href":1135,"rel":1136},"https:\u002F\u002Fnewsroom.ibm.com\u002F2026-07-23-ibm-to-acquire-hrl-laboratories-to-power-the-future-of-quantum",[899],[1138],{"type":26,"value":1139},"IBM's newsroom announcement",{"type":26,"value":1141},". Deal terms were not disclosed. The transaction is expected to close by the end of the third quarter of 2026, subject to regulatory approval. Boeing and GM will continue to partner with IBM on quantum applications after the deal closes.",{"type":21,"tag":22,"props":1143,"children":1144},{},[1145,1147,1152],{"type":26,"value":1146},"Six days later, HRL published the result that explains why IBM wanted the lab: a silicon quantum processor that runs its own error correction, ",{"type":21,"tag":46,"props":1148,"children":1149},{"href":75},[1150],{"type":26,"value":1151},"which we covered here",{"type":26,"value":1153},". The timing is not a coincidence worth over-reading, since large acquisitions and peer-reviewed papers run on separate clocks, but it does mean the acquisition announcement and the technical proof point landed in the same week.",{"type":21,"tag":29,"props":1155,"children":1157},{"id":1156},"what-hrl-brings",[1158],{"type":26,"value":1159},"What HRL brings",{"type":21,"tag":22,"props":1161,"children":1162},{},[1163,1165,1172,1174,1179,1181,1186],{"type":26,"value":1164},"HRL specializes in silicon-spin qubit engineering, quantum sensing, and quantum materials, according to ",{"type":21,"tag":46,"props":1166,"children":1169},{"href":1167,"rel":1168},"https:\u002F\u002Fresearch.ibm.com\u002Fblog\u002Fhrl-laboratories-ibm",[899],[1170],{"type":26,"value":1171},"IBM Research's own writeup",{"type":26,"value":1173},". That is a different qubit modality from IBM's existing superconducting transmon platform, the one behind ",{"type":21,"tag":46,"props":1175,"children":1176},{"href":469},[1177],{"type":26,"value":1178},"Nighthawk",{"type":26,"value":1180}," and the ",{"type":21,"tag":46,"props":1182,"children":1183},{"href":674},[1184],{"type":26,"value":1185},"Starling and Blue Jay roadmap",{"type":26,"value":761},{"type":21,"tag":22,"props":1188,"children":1189},{},[1190,1192,1198,1200,1205],{"type":26,"value":1191},"Spin qubits encode information in the spin state of individual electrons held in quantum dots, tiny confined regions on a silicon chip. IBM Research describes HRL's most recent processor as 56 quantum dots configured to run as 18 ",{"type":21,"tag":46,"props":1193,"children":1195},{"href":1194},"\u002Fglossary\u002Fqubit",[1196],{"type":26,"value":1197},"qubits",{"type":26,"value":1199},", with a CMOS control chip inside the cryostat handling error correction locally instead of routing every signal through room-temperature electronics. Our ",{"type":21,"tag":46,"props":1201,"children":1202},{"href":75},[1203],{"type":26,"value":1204},"earlier piece on that result",{"type":26,"value":1206}," goes into why moving the controller into the cold zone matters: it cuts the wiring count that otherwise limits how many qubits a machine holds.",{"type":21,"tag":22,"props":1208,"children":1209},{},[1210],{"type":26,"value":1211},"The pitch for spin qubits next to superconducting ones is manufacturing, not raw performance. Both approaches need cryogenic cooling, and both are built with silicon fabrication techniques closer to conventional chipmaking than to anything exotic. Spin qubits also occupy a smaller physical footprint per qubit than superconducting circuits, at least in principle, since a quantum dot is a nanometer-scale feature rather than a micron-scale resonator. Whether that footprint advantage survives contact with a full error-corrected system at scale is exactly the kind of claim this site treats skeptically until independent results confirm it. A demonstrated 18-qubit device is real progress. It is not yet evidence about what a 10,000-qubit spin system costs to build or run.",{"type":21,"tag":29,"props":1213,"children":1215},{"id":1214},"why-ibm-is-buying-instead-of-partnering",[1216],{"type":26,"value":1217},"Why IBM is buying instead of partnering",{"type":21,"tag":22,"props":1219,"children":1220},{},[1221],{"type":26,"value":1222},"IBM already runs the industry's broadest quantum platform on superconducting hardware. Betting on a second qubit modality by acquisition rather than an ordinary research partnership signals that IBM wants the engineering team and the intellectual property inside its own roadmap, not only access to a paper.",{"type":21,"tag":22,"props":1224,"children":1225},{},[1226],{"type":26,"value":1227},"This deal is not IBM's first move in that direction this year. In May 2026, IBM and the U.S. Department of Commerce announced Anderon, described as the first purpose-built quantum wafer foundry in the country, a 300-millimeter facility in Albany, New York, backed by a proposed $1 billion CHIPS Act award alongside $1 billion in IBM's own cash. Then on June 2, 2026, IBM committed more than $10 billion to quantum computing over five years, spanning research, manufacturing, ecosystem partnerships, and explicitly, mergers and acquisitions. The HRL deal, announced seven weeks later, is that acquisitions line item turning into an actual transaction.",{"type":21,"tag":22,"props":1229,"children":1230},{},[1231],{"type":26,"value":1232},"Read together, the sequence looks like a company building the manufacturing base first (Anderon), backing it with capital (the $10 billion commitment), and then acquiring a qubit modality it did not already have in-house (HRL). None of that guarantees the bet pays off. It does mean the acquisition fits a pattern rather than arriving as an isolated headline.",{"type":21,"tag":29,"props":1234,"children":1236},{"id":1235},"the-people-making-the-case",[1237],{"type":26,"value":1238},"The people making the case",{"type":21,"tag":22,"props":1240,"children":1241},{},[1242],{"type":26,"value":1243},"Jay Gambetta, IBM's Director of Research and an IBM Fellow, framed the deal as HRL helping IBM \"advance toward the frontiers of quantum innovation\" and strengthening its \"long-term plans to deliver quantum computing, sensing and networking advances,\" per IBM's announcement. HRL's president and CEO, Rob Vasquez, called the move the \"natural next chapter\" for a team that has spent years exploring how future quantum computers might be built at scales that seem impossible today.",{"type":21,"tag":22,"props":1245,"children":1246},{},[1247],{"type":26,"value":1248},"Those are the kinds of quotes every acquisition announcement produces, and they are worth reading as exactly that: the framing both companies agreed to put in front of the press, not an independent assessment. The parts of this deal that are checkable are the corporate facts (signed agreement, expected close date, the ownership change from Boeing and GM to IBM) and HRL's public research record. The parts that are not yet checkable are whether silicon-spin qubits reach useful scale faster inside IBM than they would have independently.",{"type":21,"tag":29,"props":1250,"children":1252},{"id":1251},"hrls-history-is-longer-than-the-quantum-story-suggests",[1253],{"type":26,"value":1254},"HRL's history is longer than the quantum story suggests",{"type":21,"tag":22,"props":1256,"children":1257},{},[1258],{"type":26,"value":1259},"HRL traces back to Hughes Research Laboratories, founded by Howard Hughes in 1948. Its best-known achievement predates quantum computing by six decades: Theodore Maiman built the world's first working laser at the lab's Malibu facility on May 16, 1960, using a synthetic ruby crystal. The lab reorganized as HRL Laboratories, LLC in 1997, after Hughes Aircraft's ownership was restructured, and has operated since under joint ownership by Boeing and General Motors, serving both commercial and U.S. government customers across sensing, communications, advanced manufacturing, and materials science, not only quantum computing.",{"type":21,"tag":22,"props":1261,"children":1262},{},[1263],{"type":26,"value":1264},"That history matters for one reason: HRL is an established, credentialed lab with a long track record of peer-reviewed, independently reproduced results, not a startup selling a roadmap. When it publishes a Nature paper, as it did on the self-operating silicon processor, the result carries the weight of that track record. That is a different kind of credibility than a press release, and it is worth distinguishing the two when reading coverage of this acquisition.",{"type":21,"tag":29,"props":1266,"children":1268},{"id":1267},"what-to-watch-once-the-deal-closes",[1269],{"type":26,"value":1270},"What to watch once the deal closes",{"type":21,"tag":22,"props":1272,"children":1273},{},[1274],{"type":26,"value":1275},"The close itself, expected by the end of Q3 2026, is the first checkable milestone. After that, watch whether IBM folds HRL's spin-qubit work into a named point on its public roadmap, the way Starling and Blue Jay are already named and dated, or keeps it as a longer-horizon research bet without a committed delivery date. Also watch whether Anderon's foundry plans expand beyond superconducting wafers to cover spin-qubit fabrication, since that would be the concrete sign that IBM intends to manufacture both modalities at scale rather than run HRL as a separate research track.",{"type":21,"tag":22,"props":1277,"children":1278},{},[1279,1281,1285,1286,1290],{"type":26,"value":1280},"For now, the honest summary is narrower than the headlines: IBM bought a credentialed silicon-spin qubit research team and its intellectual property, for an undisclosed price, weeks after committing capital to exactly this kind of move. The technology bet is real. Whether it changes IBM's timeline to a useful quantum computer is not something this announcement, or HRL's paper, answers on its own. Our ",{"type":21,"tag":46,"props":1282,"children":1283},{"href":99},[1284],{"type":26,"value":102},{"type":26,"value":904},{"type":21,"tag":46,"props":1287,"children":1288},{"href":261},[1289],{"type":26,"value":853},{"type":26,"value":1291}," are the places to track how this compares against the trapped-ion, photonic, and neutral-atom approaches other companies are betting on instead.",{"type":21,"tag":22,"props":1293,"children":1294},{},[1295,1300,1302,1308,1310,1316,1317,1324,1325,1332,1333,1340,1341,1348],{"type":21,"tag":136,"props":1296,"children":1297},{},[1298],{"type":26,"value":1299},"Sources:",{"type":26,"value":1301}," ",{"type":21,"tag":46,"props":1303,"children":1305},{"href":1135,"rel":1304},[899],[1306],{"type":26,"value":1307},"IBM newsroom announcement",{"type":26,"value":1309},", ",{"type":21,"tag":46,"props":1311,"children":1313},{"href":1167,"rel":1312},[899],[1314],{"type":26,"value":1315},"IBM Research blog",{"type":26,"value":1309},{"type":21,"tag":46,"props":1318,"children":1321},{"href":1319,"rel":1320},"https:\u002F\u002Fsiliconangle.com\u002F2026\u002F07\u002F23\u002Fibm-acquires-quantum-computing-research-lab-hrl\u002F",[899],[1322],{"type":26,"value":1323},"SiliconANGLE",{"type":26,"value":1309},{"type":21,"tag":46,"props":1326,"children":1329},{"href":1327,"rel":1328},"https:\u002F\u002Fwww.govconwire.com\u002Farticles\u002Fibm-buy-hrl-laboratories-quantum-computing",[899],[1330],{"type":26,"value":1331},"GovConWire",{"type":26,"value":1309},{"type":21,"tag":46,"props":1334,"children":1337},{"href":1335,"rel":1336},"https:\u002F\u002Fnewsroom.ibm.com\u002F2026-06-02-ibm-commits-more-than-10-billion-to-quantum-computing,-funding-its-roadmap-from-todays-leading-systems-to-the-worlds-first-fault-tolerant-quantum-computers",[899],[1338],{"type":26,"value":1339},"IBM's $10 billion quantum investment announcement",{"type":26,"value":1309},{"type":21,"tag":46,"props":1342,"children":1345},{"href":1343,"rel":1344},"https:\u002F\u002Fwww.hrl.com\u002Fabout\u002Fhistory",[899],[1346],{"type":26,"value":1347},"HRL Laboratories history",{"type":26,"value":761},{"title":7,"searchDepth":106,"depth":106,"links":1350},[1351,1352,1353,1354,1355],{"id":1156,"depth":106,"text":1159},{"id":1214,"depth":106,"text":1217},{"id":1235,"depth":106,"text":1238},{"id":1251,"depth":106,"text":1254},{"id":1267,"depth":106,"text":1270},"content:blog:ibm-hrl-laboratories-acquisition-explained.md","blog\u002Fibm-hrl-laboratories-acquisition-explained.md","blog\u002Fibm-hrl-laboratories-acquisition-explained",{"_path":469,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":1360,"description":1361,"date":10,"author":11,"tags":1362,"readingTime":1364,"body":1365,"_type":111,"_id":1514,"_source":113,"_file":1515,"_stem":1516,"_extension":116},"IBM Claimed Quantum Advantage Three Times in One Day: What Each Result Shows","On July 30, 2026, IBM announced three separate quantum advantage results with three different partners. Here is what each one demonstrated, and why the verification method matters more than the headline.",[14,13,1363],"Qiskit",9,{"type":18,"children":1366,"toc":1507},[1367,1372,1378,1391,1403,1409,1414,1419,1425,1430,1435,1441,1462,1467,1473,1478],{"type":21,"tag":22,"props":1368,"children":1369},{},[1370],{"type":26,"value":1371},"On July 30, 2026, IBM announced three quantum advantage results in a single day. Three different partners. Three different physics problems. Three different verification methods. Notice that pattern before you read any single headline. IBM Research director Jay Gambetta called this \"the quantum advantage era.\" Treat that claim the way we treat every vendor headline on this site. Take the pieces apart. Check each one. Decide what it means for you.",{"type":21,"tag":29,"props":1373,"children":1375},{"id":1374},"result-one-ibm-and-the-university-of-chicago-logical-qubits-at-scale",[1376],{"type":26,"value":1377},"Result one: IBM and the University of Chicago, logical qubits at scale",{"type":21,"tag":22,"props":1379,"children":1380},{},[1381,1383,1389],{"type":26,"value":1382},"The team ran an encoded circuit using 70 ",{"type":21,"tag":46,"props":1384,"children":1386},{"href":1385},"\u002Fglossary\u002Flogical-qubit",[1387],{"type":26,"value":1388},"logical qubits",{"type":26,"value":1390}," through thousands of logical operations, with a logical error rate roughly 10 times lower than the physical error rate underneath it. The task finished in about 15 minutes on IBM hardware. Leading classical simulation methods faced runtimes described as prohibitive for the same task.",{"type":21,"tag":22,"props":1392,"children":1393},{},[1394,1396,1401],{"type":26,"value":1395},"Notice what the coverage did not state: the physical qubit count behind those 70 logical qubits. Our ",{"type":21,"tag":46,"props":1397,"children":1398},{"href":150},[1399],{"type":26,"value":1400},"companion piece on logical qubits and fault tolerance",{"type":26,"value":1402}," covers why that ratio, not the logical qubit count alone, decides whether a result is efficient or brute-forced. Until that number surfaces, read \"70 logical qubits\" as a real result with one open question attached.",{"type":21,"tag":29,"props":1404,"children":1406},{"id":1405},"result-two-ibm-and-qedma-a-real-physics-question-checked-two-ways",[1407],{"type":26,"value":1408},"Result two: IBM and Qedma, a real physics question checked two ways",{"type":21,"tag":22,"props":1410,"children":1411},{},[1412],{"type":26,"value":1413},"This team simulated a 74-qubit two-dimensional Floquet Ising model on IBM Heron processors, using Qedma's QESEM error-mitigation software. RIKEN contributed, and BlueQubit supported the study. The team compared results against classical simulation methods, including Japan's Fugaku supercomputer, and found the quantum results held steady past the point where classical approaches stopped agreeing with each other.",{"type":21,"tag":22,"props":1415,"children":1416},{},[1417],{"type":26,"value":1418},"The trust-building step here is the part worth remembering. Two independent error-mitigation estimators, one heuristic and one rigorous, agreed with each other. The team then partially reproduced the experiment on a Quantinuum system, a competitor's hardware, and got consistent results. Cross-platform agreement is a stronger form of evidence than one vendor reporting a number from its own machine.",{"type":21,"tag":29,"props":1420,"children":1422},{"id":1421},"result-three-ibm-and-algorithmiq-checking-an-answer-nothing-else-verifies",[1423],{"type":26,"value":1424},"Result three: IBM and Algorithmiq, checking an answer nothing else verifies",{"type":21,"tag":22,"props":1426,"children":1427},{},[1428],{"type":26,"value":1429},"This is the hardest version of the problem. When no classical computer verifies a result at all, how do you know the quantum answer is right? IBM and Algorithmiq simulated a heterogeneous quantum material on IBM Heron hardware and built their case on noise modeling, error mitigation, and cross-platform testing rather than a classical ground truth.",{"type":21,"tag":22,"props":1431,"children":1432},{},[1433],{"type":26,"value":1434},"Algorithmiq also open-sourced a classical simulation package called monoprop, built specifically so outside researchers independently test future advantage claims instead of taking a press release at its word. That release matters more than it might look. It is the one part of this announcement any reader of this site is able to check directly.",{"type":21,"tag":29,"props":1436,"children":1438},{"id":1437},"why-the-trust-framing-matters-more-than-the-speed-framing",[1439],{"type":26,"value":1440},"Why the trust framing matters more than the speed framing",{"type":21,"tag":22,"props":1442,"children":1443},{},[1444,1446,1452,1454,1460],{"type":26,"value":1445},"\"Beyond classical simulation\" is not a new claim. Google made a related claim in 2019 with its ",{"type":21,"tag":46,"props":1447,"children":1449},{"href":1448},"\u002Fresearch\u002Fgoogle-quantum-supremacy-2019",[1450],{"type":26,"value":1451},"quantum supremacy result",{"type":26,"value":1453},", and better classical algorithms later closed part of that gap. IBM made a related but weaker claim in 2023 with ",{"type":21,"tag":46,"props":1455,"children":1457},{"href":1456},"\u002Fresearch\u002Fibm-quantum-utility-2023",[1458],{"type":26,"value":1459},"quantum utility",{"type":26,"value":1461},", which did not require beating classical computation outright, only being useful and comparable to it.",{"type":21,"tag":22,"props":1463,"children":1464},{},[1465],{"type":26,"value":1466},"This round targets a harder bar than either: not only \"we finished faster than classical methods,\" but \"here is independently checkable evidence for why you should trust the answer.\" That second half, the verification method, is the actual news in all three results. The raw qubit and gate counts are the part every previous announcement already led with.",{"type":21,"tag":29,"props":1468,"children":1470},{"id":1469},"what-happens-next",[1471],{"type":26,"value":1472},"What happens next",{"type":21,"tag":22,"props":1474,"children":1475},{},[1476],{"type":26,"value":1477},"Peer review and independent replication are the steps that eventually narrowed Google's 2019 claim, and they are the steps to watch for here too. Three same-day press announcements are not the same thing as three peer-reviewed, independently replicated results. Given Algorithmiq's open monoprop release, at least one path to that independent check already exists. Watch whether other research groups pick it up and whether their numbers match.",{"type":21,"tag":22,"props":1479,"children":1480},{},[1481,1483,1487,1488,1492,1494,1499,1500,1505],{"type":26,"value":1482},"For a broader sense of how IBM's hardware and error-mitigation approach compares with competing modalities, see our ",{"type":21,"tag":46,"props":1484,"children":1485},{"href":99},[1486],{"type":26,"value":102},{"type":26,"value":904},{"type":21,"tag":46,"props":1489,"children":1490},{"href":261},[1491],{"type":26,"value":853},{"type":26,"value":1493},". For the mechanics behind logical qubits and why overhead numbers matter more than headline qubit counts, our ",{"type":21,"tag":46,"props":1495,"children":1496},{"href":150},[1497],{"type":26,"value":1498},"fault tolerance explainer",{"type":26,"value":904},{"type":21,"tag":46,"props":1501,"children":1502},{"href":56},[1503],{"type":26,"value":1504},"Quantinuum Helios piece",{"type":26,"value":1506}," cover the same questions from a different vendor's claims.",{"title":7,"searchDepth":106,"depth":106,"links":1508},[1509,1510,1511,1512,1513],{"id":1374,"depth":106,"text":1377},{"id":1405,"depth":106,"text":1408},{"id":1421,"depth":106,"text":1424},{"id":1437,"depth":106,"text":1440},{"id":1469,"depth":106,"text":1472},"content:blog:ibm-quantum-advantage-triple-announcement-2026.md","blog\u002Fibm-quantum-advantage-triple-announcement-2026.md","blog\u002Fibm-quantum-advantage-triple-announcement-2026",{"_path":1518,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":1519,"description":1520,"date":10,"author":11,"tags":1521,"readingTime":127,"body":1522,"_type":111,"_id":1637,"_source":113,"_file":1638,"_stem":1639,"_extension":116},"\u002Fblog\u002Finfleqtion-sqale-illinois-quantum-park","Infleqtion Will Put a 50-Logical-Qubit Machine in Chicago by 2027","Infleqtion is deploying Sqale, a neutral-atom quantum computer targeting 50 logical qubits, at the Illinois Quantum and Microelectronics Park in 2027. The company is also opening a Chicago center aimed specifically at energy-grid optimization problems.",[13,14],{"type":18,"children":1523,"toc":1632},[1524,1545,1551,1569,1589,1595,1600,1605,1611,1616],{"type":21,"tag":22,"props":1525,"children":1526},{},[1527,1529,1536,1537,1543],{"type":26,"value":1528},"On July 21, 2026, Infleqtion announced it will deploy a fault-tolerant, neutral-atom quantum computer named Sqale at the Illinois Quantum and Microelectronics Park (IQMP), with hardware delivery planned for 2027, according to ",{"type":21,"tag":46,"props":1530,"children":1533},{"href":1531,"rel":1532},"https:\u002F\u002Finfleqtion.com\u002Finfleqtion-to-deploy-fault-tolerant-neutral-atom-quantum-computer-in-illinois\u002F",[899],[1534],{"type":26,"value":1535},"the company's own announcement",{"type":26,"value":904},{"type":21,"tag":46,"props":1538,"children":1541},{"href":1539,"rel":1540},"https:\u002F\u002Fthequantuminsider.com\u002F2026\u002F07\u002F23\u002Finfleqtion-neutral-atom-quantum-computer-illinois\u002F",[899],[1542],{"type":26,"value":902},{"type":26,"value":1544},". What makes this worth a post rather than a routine roadmap update is how specific the commitment is: a named site, a named delivery year, and a named application area the company is building toward, rather than a general statement about future ambitions.",{"type":21,"tag":29,"props":1546,"children":1548},{"id":1547},"what-sqale-is-supposed-to-do",[1549],{"type":26,"value":1550},"What Sqale is supposed to do",{"type":21,"tag":22,"props":1552,"children":1553},{},[1554,1556,1560,1562,1567],{"type":26,"value":1555},"Sqale is designed to demonstrate more than 50 ",{"type":21,"tag":46,"props":1557,"children":1558},{"href":1385},[1559],{"type":26,"value":1388},{"type":26,"value":1561}," at launch, with a stated path to 100, built on a physical architecture Infleqtion says scales beyond 1,000 physical qubits. Like other ",{"type":21,"tag":46,"props":1563,"children":1564},{"href":99},[1565],{"type":26,"value":1566},"neutral-atom systems",{"type":26,"value":1568},", it uses lasers to trap and control individual atoms, and Infleqtion says the system will couple with NVIDIA's NVQLink for low-latency communication with classical GPU hardware, a pairing several vendors are now building toward as quantum systems increasingly need fast classical co-processing for error correction and control.",{"type":21,"tag":22,"props":1570,"children":1571},{},[1572,1574,1579,1581,1587],{"type":26,"value":1573},"Fifty logical qubits would be a meaningful jump if it holds up. For comparison, ",{"type":21,"tag":46,"props":1575,"children":1576},{"href":56},[1577],{"type":26,"value":1578},"Quantinuum's Helios system claims 48 logical qubits",{"type":26,"value":1580}," from roughly 96 physical qubits, and ",{"type":21,"tag":46,"props":1582,"children":1584},{"href":1583},"\u002Fblog\u002Ftop-quantum-computing-companies-2026",[1585],{"type":26,"value":1586},"QuEra reported 96 logical qubits",{"type":26,"value":1588}," on 448 physical qubits in a January 2026 Nature paper. Sqale's ratio, more than 50 logical qubits on an architecture scaling past 1,000 physical qubits, would sit at a notably higher overhead than either of those results, at least based on the numbers disclosed so far. None of these figures are directly comparable without knowing the exact error rates and code distances each system targets, and Sqale's numbers are a 2027 target, not a measured result.",{"type":21,"tag":29,"props":1590,"children":1592},{"id":1591},"the-energy-grid-angle-is-the-more-interesting-part",[1593],{"type":26,"value":1594},"The energy grid angle is the more interesting part",{"type":21,"tag":22,"props":1596,"children":1597},{},[1598],{"type":26,"value":1599},"Infleqtion is also opening a Chicago Quantum Innovation Center focused specifically on applying quantum optimization to the electrical grid: unit commitment (deciding which power plants run when), contingency analysis (planning for equipment failures), and nuclear fuel loading. Partners named in the announcement include the National Quantum Algorithm Center, University of Chicago professor Fred Chong, Constellation Energy, and EPRI, alongside existing ARPA-E funding for a related project called ENCODE.",{"type":21,"tag":22,"props":1601,"children":1602},{},[1603],{"type":26,"value":1604},"CTO Pranav Gokhale framed the choice deliberately: \"Energy is one of the best proving grounds for quantum computing because the problems are consequential and immediate.\" That is a more specific and checkable claim than most quantum-for-industry pitches, since grid optimization problems already have well-defined classical benchmarks. If a quantum approach beats those benchmarks on a real utility's data, that is a concrete result. If it does not, that will also be visible, which is more accountability than most quantum use-case announcements carry.",{"type":21,"tag":29,"props":1606,"children":1608},{"id":1607},"what-is-confirmed-and-what-is-not",[1609],{"type":26,"value":1610},"What is confirmed and what is not",{"type":21,"tag":22,"props":1612,"children":1613},{},[1614],{"type":26,"value":1615},"The site, the delivery year, and the named partners are concrete facts. The 50-logical-qubit target and the path to 100 are Infleqtion's own projections for a system that has not shipped yet. Infleqtion does have a track record to weigh those projections against: the company already operates the only 100-physical-qubit neutral-atom system at the UK's National Quantum Computing Centre, plus a deployment in Japan, so this is a company with working hardware in the field already, not a pre-revenue startup making a first claim.",{"type":21,"tag":22,"props":1617,"children":1618},{},[1619,1621,1625,1626,1630],{"type":26,"value":1620},"CEO Matthew Kinsella called the deployment \"a landmark moment for quantum computing in Chicago,\" which is the kind of framing every regional deployment announcement uses about itself. The part worth tracking independently of that framing is whether Sqale ships on the stated 2027 timeline, and whether the energy-grid partnership produces a published result against a real utility's optimization problem rather than a simulated one. Our ",{"type":21,"tag":46,"props":1622,"children":1623},{"href":99},[1624],{"type":26,"value":102},{"type":26,"value":904},{"type":21,"tag":46,"props":1627,"children":1628},{"href":261},[1629],{"type":26,"value":853},{"type":26,"value":1631}," track how neutral-atom systems like this one compare against the trapped-ion, superconducting, and photonic platforms other companies are betting on.",{"title":7,"searchDepth":106,"depth":106,"links":1633},[1634,1635,1636],{"id":1547,"depth":106,"text":1550},{"id":1591,"depth":106,"text":1594},{"id":1607,"depth":106,"text":1610},"content:blog:infleqtion-sqale-illinois-quantum-park.md","blog\u002Finfleqtion-sqale-illinois-quantum-park.md","blog\u002Finfleqtion-sqale-illinois-quantum-park",{"_path":519,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":1641,"description":1642,"date":10,"author":11,"tags":1643,"readingTime":887,"body":1644,"_type":111,"_id":1790,"_source":113,"_file":1791,"_stem":1792,"_extension":116},"IonQ Bought a $1.8 Billion Semiconductor Foundry: Here Is What Changes","IonQ completed its acquisition of SkyWater Technology, the largest US-based semiconductor foundry, and calls itself the only vertically integrated full-stack quantum platform company. Here is what that claim means and what it does not.",[14,13,126],{"type":18,"children":1645,"toc":1782},[1646,1660,1666,1671,1677,1682,1687,1692,1698,1703,1721,1727,1732,1738,1757,1763],{"type":21,"tag":22,"props":1647,"children":1648},{},[1649,1651,1658],{"type":26,"value":1650},"IonQ completed its acquisition of SkyWater Technology on July 31, 2026. SkyWater is the largest semiconductor foundry operating entirely inside the United States. IonQ announced the deal in January 2026. Total equity value: roughly ",{"type":21,"tag":46,"props":1652,"children":1655},{"href":1653,"rel":1654},"https:\u002F\u002Finvestors.ionq.com\u002Fnews\u002Fnews-details\u002F2026\u002FIonQ-Completes-Acquisition-of-SkyWater-Technology\u002Fdefault.aspx",[899],[1656],{"type":26,"value":1657},"$1.8 billion",{"type":26,"value":1659},". SkyWater shareholders got $15.00 in cash plus IonQ stock, subject to a collar, for each share held. IonQ calls the combined company the only vertically integrated full-stack quantum platform company. That claim is specific and checkable. Read the parts separately before you accept the headline.",{"type":21,"tag":29,"props":1661,"children":1663},{"id":1662},"what-skywater-builds",[1664],{"type":26,"value":1665},"What SkyWater builds",{"type":21,"tag":22,"props":1667,"children":1668},{},[1669],{"type":26,"value":1670},"SkyWater does not chase the newest logic node against TSMC or Samsung. Its specialty is foundational semiconductor nodes and advanced packaging: mature process technology, not leading edge. Facilities sit in Minnesota, Florida, and Texas. Customers include commercial buyers and federal defense agencies. This distinction decides whether the acquisition targets what IonQ's hardware needs.",{"type":21,"tag":29,"props":1672,"children":1674},{"id":1673},"the-part-of-ionqs-stack-this-touches",[1675],{"type":26,"value":1676},"The part of IonQ's stack this touches",{"type":21,"tag":22,"props":1678,"children":1679},{},[1680],{"type":26,"value":1681},"Most coverage of this deal skipped one detail. A trapped-ion qubit is a single atom held in an electromagnetic field. Nobody fabricates the qubit. Ytterbium and barium ions occur naturally. They are identical to each other. No factory improves them. So what does a semiconductor foundry have to do with trapped-ion hardware?",{"type":21,"tag":22,"props":1683,"children":1684},{},[1685],{"type":26,"value":1686},"Everything around the ion. The ion trap chip is a microfabricated electrode structure that confines and shuttles ions across a surface. It is a real semiconductor device. So are the photonic components used for laser addressing and readout, and the cryogenic and RF control electronics that drive the whole system. None of that needs a 3-nanometer process. It needs the mature-node fabrication and advanced packaging SkyWater already sells to other industries.",{"type":21,"tag":22,"props":1688,"children":1689},{},[1690],{"type":26,"value":1691},"Read that way, the acquisition targets a real supply chain need. IonQ is pulling a piece of its existing supply chain in-house instead of buying it from a third party.",{"type":21,"tag":29,"props":1693,"children":1695},{"id":1694},"what-vertically-integrated-means-precisely",[1696],{"type":26,"value":1697},"What \"vertically integrated\" means, precisely",{"type":21,"tag":22,"props":1699,"children":1700},{},[1701],{"type":26,"value":1702},"No other quantum hardware company owns its foundry outright as a subsidiary. IBM has a long history with its own fabs and partners with Albany NanoTech. PsiQuantum's photonic chips come from a partnership with GlobalFoundries, not an owned subsidiary. Quantinuum's manufacturing traces back through Honeywell's aerospace and controls businesses. Owned-and-operated differs from having a good manufacturing partner, and IonQ's claim holds up on that narrow point.",{"type":21,"tag":22,"props":1704,"children":1705},{},[1706,1708,1712,1714,1719],{"type":26,"value":1707},"The claim does not hold up as a physics claim. Owning a foundry produces no new logical qubit and no fidelity gain by itself. Our ",{"type":21,"tag":46,"props":1709,"children":1710},{"href":99},[1711],{"type":26,"value":102},{"type":26,"value":1713}," and our ",{"type":21,"tag":46,"props":1715,"children":1716},{"href":212},[1717],{"type":26,"value":1718},"SDK and modality comparison",{"type":26,"value":1720}," cover how IonQ stacks up against competitors across every technology, not only this one.",{"type":21,"tag":29,"props":1722,"children":1724},{"id":1723},"why-the-size-of-the-deal-matters",[1725],{"type":26,"value":1726},"Why the size of the deal matters",{"type":21,"tag":22,"props":1728,"children":1729},{},[1730],{"type":26,"value":1731},"$1.8 billion is large next to IonQ's quantum computing revenue history. A large share of the payment was IonQ stock, not cash. SkyWater brings its own profitable semiconductor business, serving customers who have nothing to do with quantum computing. After this deal, IonQ is not a pure quantum computing company anymore. A real share of its revenue now comes from ordinary foundry services. Whether that helps the hardware roadmap or distracts from it is an open question. Future earnings reports will answer that, not this press release.",{"type":21,"tag":29,"props":1733,"children":1735},{"id":1734},"the-domestic-supply-chain-story-holds-up-best",[1736],{"type":26,"value":1737},"The domestic supply chain story holds up best",{"type":21,"tag":22,"props":1739,"children":1740},{},[1741,1743,1749,1750,1755],{"type":26,"value":1742},"SkyWater's federal defense customers and its US-only footprint match a pattern we track elsewhere on this site: the federal push toward domestically controlled, security-vetted quantum and cryptographic infrastructure. See our posts on the ",{"type":21,"tag":46,"props":1744,"children":1746},{"href":1745},"\u002Fblog\u002Fpost-quantum-migration-deadlines",[1747],{"type":26,"value":1748},"accelerated post-quantum migration deadlines",{"type":26,"value":1180},{"type":21,"tag":46,"props":1751,"children":1752},{"href":674},[1753],{"type":26,"value":1754},"quantum benchmarking executive order",{"type":26,"value":1756},". A quantum hardware vendor with a fully domestic, defense-cleared fabrication and packaging pipeline has a real selling point with government buyers that competitors sourcing through shared or offshore fabs do not have. This part of IonQ's case holds up under scrutiny. It addresses a real, separate requirement: supply chain security, which increasingly gates government contracts regardless of qubit count.",{"type":21,"tag":29,"props":1758,"children":1760},{"id":1759},"what-to-watch-next",[1761],{"type":26,"value":1762},"What to watch next",{"type":21,"tag":22,"props":1764,"children":1765},{},[1766,1768,1773,1775,1780],{"type":26,"value":1767},"A foundry shortens iteration cycles and cuts supply chain risk. It does not improve gate fidelity, connectivity, or logical qubit overhead on its own. Those are the numbers that show whether trapped-ion hardware is progressing. We cover them in ",{"type":21,"tag":46,"props":1769,"children":1770},{"href":150},[1771],{"type":26,"value":1772},"logical qubits and fault tolerance",{"type":26,"value":1774}," and in our look at ",{"type":21,"tag":46,"props":1776,"children":1777},{"href":56},[1778],{"type":26,"value":1779},"Quantinuum's Helios encoding ratio",{"type":26,"value":1781},". The real test of this acquisition is whether IonQ's next generation of Aria- or Forte-class systems ships faster, or with better specs, than it would have on the old supply chain. That is a multi-year claim, not a same-day one. Until the data arrives, treat \"vertically integrated full-stack quantum platform company\" the way you would treat any vendor headline. Check the structural fact first. SkyWater is now a wholly owned subsidiary. Set the framing aside until results confirm it.",{"title":7,"searchDepth":106,"depth":106,"links":1783},[1784,1785,1786,1787,1788,1789],{"id":1662,"depth":106,"text":1665},{"id":1673,"depth":106,"text":1676},{"id":1694,"depth":106,"text":1697},{"id":1723,"depth":106,"text":1726},{"id":1734,"depth":106,"text":1737},{"id":1759,"depth":106,"text":1762},"content:blog:ionq-skywater-acquisition-explained.md","blog\u002Fionq-skywater-acquisition-explained.md","blog\u002Fionq-skywater-acquisition-explained",{"_path":1794,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":1795,"description":1796,"date":10,"author":11,"tags":1797,"readingTime":127,"body":1798,"_type":111,"_id":1907,"_source":113,"_file":1908,"_stem":1909,"_extension":116},"\u002Fblog\u002Fpsiquantum-darpa-quantum-benchmarking-125-million","DARPA Is Paying PsiQuantum $125 Million to Check Its Own Claims","PsiQuantum signed an expanded $125 million agreement with DARPA's Quantum Benchmarking Initiative, its largest U.S. government contract to date. The money funds outside verification of PsiQuantum's fault-tolerance roadmap, not new research.",[14,13],{"type":18,"children":1799,"toc":1901},[1800,1821,1826,1832,1837,1842,1848,1853,1865,1871,1876,1881,1885],{"type":21,"tag":22,"props":1801,"children":1802},{},[1803,1805,1811,1812,1819],{"type":26,"value":1804},"On July 22, 2026, PsiQuantum signed an expanded $125 million agreement with the Defense Advanced Research Projects Agency, its largest U.S. government contract to date, according to ",{"type":21,"tag":46,"props":1806,"children":1809},{"href":1807,"rel":1808},"https:\u002F\u002Fthequantuminsider.com\u002F2026\u002F07\u002F22\u002Fpsiquantum-signs-125-million-agreement-with-darpa\u002F",[899],[1810],{"type":26,"value":902},{"type":26,"value":904},{"type":21,"tag":46,"props":1813,"children":1816},{"href":1814,"rel":1815},"https:\u002F\u002Fwww.psiquantum.com\u002Fnews-import\u002Fpsiquantum-signs-125-million-agreement-with-darpa",[899],[1817],{"type":26,"value":1818},"PsiQuantum's own announcement",{"type":26,"value":1820},". The money sits under DARPA's Quantum Benchmarking Initiative (QBI), a program built around a specific, unglamorous question: is a practically useful quantum computer achievable by 2033, and does any company's roadmap survive an outside party checking it.",{"type":21,"tag":22,"props":1822,"children":1823},{},[1824],{"type":26,"value":1825},"That framing matters more than the dollar figure. This is not research funding for PsiQuantum to build something new. It funds DARPA and independent evaluators testing whether what PsiQuantum has already built and claimed holds up.",{"type":21,"tag":29,"props":1827,"children":1829},{"id":1828},"what-qbi-tests",[1830],{"type":26,"value":1831},"What QBI tests",{"type":21,"tag":22,"props":1833,"children":1834},{},[1835],{"type":26,"value":1836},"DARPA started the Quantum Benchmarking Initiative's predecessor program, Underexplored Systems for Utility-Scale Quantum Computing, in January 2023, when it first selected PsiQuantum for an initial evaluation stage. The program has since progressed in stages: PsiQuantum advanced to a second stage in January 2024, then to Stage C in February 2025, the most advanced tier. In November 2025, DARPA moved 11 companies into an earlier stage of the broader QBI program, and PsiQuantum is one of only two companies reported to have reached Stage C, the tier reserved for the most credible utility-scale claims.",{"type":21,"tag":22,"props":1838,"children":1839},{},[1840],{"type":26,"value":1841},"Getting to Stage C is itself informative. DARPA does not let every company's roadmap through to detailed, funded, adversarial testing. A company that fails an earlier stage is quietly out. Reaching the final tier is a signal that PsiQuantum's claims survived scrutiny that most quantum hardware announcements never face at all.",{"type":21,"tag":29,"props":1843,"children":1845},{"id":1844},"what-the-money-funds",[1846],{"type":26,"value":1847},"What the money funds",{"type":21,"tag":22,"props":1849,"children":1850},{},[1851],{"type":26,"value":1852},"The $125 million follows a smaller $31.8 million agreement from September 2025 that funded on-site testing at PsiQuantum's facilities. This expanded agreement funds testing across PsiQuantum's hardware, software, system architecture, and infrastructure, spanning its Milpitas, California and Chicago, Illinois sites. It is structured as a performance-based award, meaning PsiQuantum gets paid for hitting defined technical milestones DARPA and its evaluators check, not simply for showing up.",{"type":21,"tag":22,"props":1854,"children":1855},{},[1856,1858,1863],{"type":26,"value":1857},"That structure is the point. ",{"type":21,"tag":46,"props":1859,"children":1860},{"href":1583},[1861],{"type":26,"value":1862},"PsiQuantum's photonic, fault-tolerance-first approach",{"type":26,"value":1864}," has never shipped a commercial system, and its timeline for a working fault-tolerant machine has already slipped once, from 2027 to 2029. A company at that stage benefits enormously from being able to say a federal agency is independently verifying its numbers rather than taking PsiQuantum's word for them.",{"type":21,"tag":29,"props":1866,"children":1868},{"id":1867},"why-this-is-a-different-kind-of-evidence-than-a-press-release",[1869],{"type":26,"value":1870},"Why this is a different kind of evidence than a press release",{"type":21,"tag":22,"props":1872,"children":1873},{},[1874],{"type":26,"value":1875},"Most of what this site covers about early-stage quantum hardware comes from company announcements: a qubit count, a fidelity number, a funding round. Those numbers are real, but they are self-reported, and this site treats them accordingly until someone outside the company checks them.",{"type":21,"tag":22,"props":1877,"children":1878},{},[1879],{"type":26,"value":1880},"A DARPA QBI contract is structurally different. The agency's stated purpose is separating hype from reality in quantum computing roadmaps, and it does that by paying independent evaluators to test specific claims rather than accepting a company's own benchmarks. That does not mean PsiQuantum's fault-tolerance timeline will hold. It means the timeline is now subject to a level of outside checking that most competitors in this space do not have applied to their own roadmaps.",{"type":21,"tag":29,"props":1882,"children":1883},{"id":1759},[1884],{"type":26,"value":1762},{"type":21,"tag":22,"props":1886,"children":1887},{},[1888,1890,1894,1895,1899],{"type":26,"value":1889},"QBI's own stated horizon is 2033, so there is no near-term result here to wait for. What is worth tracking is whether PsiQuantum publishes or DARPA discloses any of the specific benchmark results from this testing, rather than only the fact that testing is happening. A contract confirms that evaluation is underway. It does not tell you what the evaluation found. Our ",{"type":21,"tag":46,"props":1891,"children":1892},{"href":99},[1893],{"type":26,"value":102},{"type":26,"value":904},{"type":21,"tag":46,"props":1896,"children":1897},{"href":261},[1898],{"type":26,"value":853},{"type":26,"value":1900}," track how PsiQuantum's photonic approach compares with the superconducting, trapped-ion, and neutral-atom platforms other companies are betting on for the same fault-tolerance goal.",{"title":7,"searchDepth":106,"depth":106,"links":1902},[1903,1904,1905,1906],{"id":1828,"depth":106,"text":1831},{"id":1844,"depth":106,"text":1847},{"id":1867,"depth":106,"text":1870},{"id":1759,"depth":106,"text":1762},"content:blog:psiquantum-darpa-quantum-benchmarking-125-million.md","blog\u002Fpsiquantum-darpa-quantum-benchmarking-125-million.md","blog\u002Fpsiquantum-darpa-quantum-benchmarking-125-million",{"_path":1911,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":1912,"description":1913,"date":10,"author":11,"tags":1914,"readingTime":16,"body":1915,"_type":111,"_id":2009,"_source":113,"_file":2010,"_stem":2011,"_extension":116},"\u002Fblog\u002Fquantinuum-bmw-multi-year-partnership","Quantinuum and BMW Turned a Five-Year Research Project Into a Roadmap Commitment","Quantinuum and BMW Group expanded their quantum chemistry collaboration, running since 2021, into a multi-year partnership that gives BMW access to Quantinuum's Helios, Sol, and Apollo hardware generations through 2029. Here is what five years of actual results looks like next to a typical pilot announcement.",[14,13],{"type":18,"children":1916,"toc":2004},[1917,1938,1944,1949,1954,1960,1972,1977,1983,1988],{"type":21,"tag":22,"props":1918,"children":1919},{},[1920,1922,1929,1930,1936],{"type":26,"value":1921},"On May 5, 2026, Quantinuum and BMW Group announced they were expanding their quantum computing collaboration into a formal multi-year partnership, according to ",{"type":21,"tag":46,"props":1923,"children":1926},{"href":1924,"rel":1925},"https:\u002F\u002Fwww.quantinuum.com\u002Fpress-releases\u002Fquantinuum-and-bmw-group-expand-landmark-quantum-computing-collaboration-with-new-multi-year-partnership",[899],[1927],{"type":26,"value":1928},"Quantinuum's press release",{"type":26,"value":904},{"type":21,"tag":46,"props":1931,"children":1934},{"href":1932,"rel":1933},"https:\u002F\u002Fthequantuminsider.com\u002F2026\u002F05\u002F05\u002Fquantinuum-and-bmw-group-expand-quantum-computing-collaboration-with-new-multi-year-partnership\u002F",[899],[1935],{"type":26,"value":902},{"type":26,"value":1937},". This is not a new story breaking this week. It is worth covering anyway, because most quantum-for-industry partnerships announced with this much fanfare are pilots with no track record behind them, and this one has run since 2021.",{"type":21,"tag":29,"props":1939,"children":1941},{"id":1940},"five-years-is-the-actual-story-here",[1942],{"type":26,"value":1943},"Five years is the actual story here",{"type":21,"tag":22,"props":1945,"children":1946},{},[1947],{"type":26,"value":1948},"Quantinuum and BMW have collaborated on industrial chemistry problems since 2021, moving from early algorithm development to simulating real molecular systems relevant to next-generation mobility. The specific research area is electrochemistry for fuel cells and batteries, including modeling the oxygen reduction reaction at platinum catalysts, a problem that determines fuel cell efficiency and where classical simulation methods struggle with the electron correlation effects involved.",{"type":21,"tag":22,"props":1950,"children":1951},{},[1952],{"type":26,"value":1953},"That history matters more than the announcement itself. Most quantum industry partnerships get covered at the moment they are signed, before there is any way to know whether the collaboration produces results or quietly fades. A five-year run with published progress from early algorithm work to real molecular simulation is a track record, not a press release promise.",{"type":21,"tag":29,"props":1955,"children":1957},{"id":1956},"what-bmw-gets",[1958],{"type":26,"value":1959},"What BMW gets",{"type":21,"tag":22,"props":1961,"children":1962},{},[1963,1965,1970],{"type":26,"value":1964},"The expanded partnership gives BMW access to successive generations of Quantinuum's ",{"type":21,"tag":46,"props":1966,"children":1967},{"href":56},[1968],{"type":26,"value":1969},"trapped-ion",{"type":26,"value":1971}," hardware on a defined timeline: Helios (the current 96-qubit system, available now as hardware-as-a-service), Sol (planned for 2027 as Quantinuum's first commercially available system built on a two-dimensional qubit grid), and Apollo (targeted for 2029 as a fully fault-tolerant system capable of executing millions of gates).",{"type":21,"tag":22,"props":1973,"children":1974},{},[1975],{"type":26,"value":1976},"Quantinuum CEO Rajeeb Hazra framed the deal around \"driving commercial adoption of quantum computing through close collaboration with industry leaders on high-impact applications.\" BMW's Vice President of New Technologies, Martin Tietze, said the companies \"translate advances in quantum hardware into real-world applications.\" Both statements are the kind of framing a joint press release always uses. The part that is independently checkable is the hardware access itself: BMW is committed to Quantinuum's roadmap through at least 2029, which is an unusually long horizon for a customer relationship in a field where most vendor roadmaps get revised within a year or two.",{"type":21,"tag":29,"props":1978,"children":1980},{"id":1979},"why-this-is-a-useful-comparison-point",[1981],{"type":26,"value":1982},"Why this is a useful comparison point",{"type":21,"tag":22,"props":1984,"children":1985},{},[1986],{"type":26,"value":1987},"Announcements about quantum computing partnerships with automakers, banks, and pharmaceutical companies are common, and most of them describe an exploratory pilot with no committed timeline and no disclosed technical result. This partnership is a useful yardstick against those: a five-year history of published, incremental research progress, a named scientific problem (the oxygen reduction reaction) rather than a vague reference to \"materials science,\" and a hardware access commitment tied to specific, dated system generations rather than an open-ended promise to keep exploring.",{"type":21,"tag":22,"props":1989,"children":1990},{},[1991,1993,1997,1998,2002],{"type":26,"value":1992},"None of that guarantees the electrochemistry results translate into a better BMW battery or fuel cell. It does mean this collaboration has a longer, more specific paper trail than the average industry quantum pilot, and it is worth checking back against as Sol and Apollo ship, since the value of a roadmap commitment depends entirely on whether the hardware behind it arrives on schedule. Our ",{"type":21,"tag":46,"props":1994,"children":1995},{"href":99},[1996],{"type":26,"value":102},{"type":26,"value":904},{"type":21,"tag":46,"props":1999,"children":2000},{"href":261},[2001],{"type":26,"value":853},{"type":26,"value":2003}," track how Quantinuum's trapped-ion roadmap compares with the superconducting, neutral-atom, and photonic platforms other vendors are building toward the same industrial-chemistry use cases.",{"title":7,"searchDepth":106,"depth":106,"links":2005},[2006,2007,2008],{"id":1940,"depth":106,"text":1943},{"id":1956,"depth":106,"text":1959},{"id":1979,"depth":106,"text":1982},"content:blog:quantinuum-bmw-multi-year-partnership.md","blog\u002Fquantinuum-bmw-multi-year-partnership.md","blog\u002Fquantinuum-bmw-multi-year-partnership",{"_path":2013,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":2014,"description":2015,"date":10,"author":11,"tags":2016,"readingTime":1364,"body":2020,"_type":111,"_id":2700,"_source":113,"_file":2701,"_stem":2702,"_extension":116},"\u002Fblog\u002Fquantum-portfolio-optimization-business-case","How to Build a Business Case for Quantum Portfolio Optimization","PortfolioQ is a small open-source tool that runs classical, penalty-method QAOA, and constraint-preserving QAOA side by side on real portfolio data, and produces the one chart every quantum business case needs.",[2017,2018,2019],"Optimization","QAOA","Use Cases",{"type":18,"children":2021,"toc":2693},[2022,2035,2054,2060,2097,2103,2108,2118,2143,2177,2182,2188,2193,2210,2238,2244,2269,2303,2507,2605,2622,2632,2638,2650,2687],{"type":21,"tag":22,"props":2023,"children":2024},{},[2025,2027,2033],{"type":26,"value":2026},"Writing a QAOA circuit is a solved problem. Dozens of tutorials, including ",{"type":21,"tag":46,"props":2028,"children":2030},{"href":2029},"\u002Fblog\u002Fqaoa-max-cut-tutorial",[2031],{"type":26,"value":2032},"our own",{"type":26,"value":2034},", will get you there in an afternoon. Writing the two-page memo that convinces a risk committee to fund a pilot is a completely different skill, and almost nothing teaches it. Most \"quantum computing for finance\" content either stays purely technical (build a circuit, print a result) or purely promotional (quantum will transform portfolio optimization). Neither produces the artifact a real business case needs.",{"type":21,"tag":22,"props":2036,"children":2037},{},[2038,2045,2047,2052],{"type":21,"tag":46,"props":2039,"children":2042},{"href":2040,"rel":2041},"https:\u002F\u002Fgithub.com\u002FAlinDanielFerenczi\u002FPortfolioQ",[899],[2043],{"type":26,"value":2044},"PortfolioQ",{"type":26,"value":2046}," is a small, open-source FastAPI project built specifically to produce that artifact. It's worth walking through, not because it's a production optimizer (its own README says explicitly that it isn't), but because its structure is a genuinely useful template for how to evaluate ",{"type":21,"tag":362,"props":2048,"children":2049},{},[2050],{"type":26,"value":2051},"any",{"type":26,"value":2053}," quantum optimization claim honestly, portfolio selection or otherwise.",{"type":21,"tag":29,"props":2055,"children":2057},{"id":2056},"the-problem-it-solves",[2058],{"type":26,"value":2059},"The problem it solves",{"type":21,"tag":22,"props":2061,"children":2062},{},[2063,2065,2070,2072,2079,2081,2087,2089,2095],{"type":26,"value":2064},"PortfolioQ targets ",{"type":21,"tag":136,"props":2066,"children":2067},{},[2068],{"type":26,"value":2069},"cardinality-constrained portfolio selection",{"type":26,"value":2071},": pick exactly K assets out of N candidates to minimize risk and maximize expected return, using the standard Markowitz mean-variance formulation: minimize ",{"type":21,"tag":2073,"props":2074,"children":2076},"code",{"className":2075},[],[2077],{"type":26,"value":2078},"risk_factor * wᵀΣw - μᵀw",{"type":26,"value":2080}," subject to ",{"type":21,"tag":2073,"props":2082,"children":2084},{"className":2083},[],[2085],{"type":26,"value":2086},"sum(w) == budget",{"type":26,"value":2088},", with each ",{"type":21,"tag":2073,"props":2090,"children":2092},{"className":2091},[],[2093],{"type":26,"value":2094},"w",{"type":26,"value":2096}," binary. That constraint (exactly K assets, not \"up to K\") is what makes this a good test case: it's a real, common portfolio-construction requirement, and it's exactly the kind of constraint that's easy to get wrong in a naive QAOA implementation.",{"type":21,"tag":29,"props":2098,"children":2100},{"id":2099},"three-solvers-run-side-by-side",[2101],{"type":26,"value":2102},"Three solvers, run side by side",{"type":21,"tag":22,"props":2104,"children":2105},{},[2106],{"type":26,"value":2107},"This is the part most quantum finance demos skip, and it's the part that matters for a business case: PortfolioQ doesn't run one method and report a number. It runs three, on the same data, and compares them.",{"type":21,"tag":22,"props":2109,"children":2110},{},[2111,2116],{"type":21,"tag":136,"props":2112,"children":2113},{},[2114],{"type":26,"value":2115},"Classical exact enumeration.",{"type":26,"value":2117}," Brute-forces every feasible K-of-N combination directly. It's not a strawman. For portfolios in the 10-30 asset range this is fast and exact, which is precisely why it's the right baseline. Any quantum approach has to be measured against this, not against \"no answer at all.\"",{"type":21,"tag":22,"props":2119,"children":2120},{},[2121,2126,2128,2134,2136,2141],{"type":21,"tag":136,"props":2122,"children":2123},{},[2124],{"type":26,"value":2125},"Penalty-method QAOA.",{"type":26,"value":2127}," The standard textbook approach: convert the constrained problem to a QUBO via ",{"type":21,"tag":2073,"props":2129,"children":2131},{"className":2130},[],[2132],{"type":26,"value":2133},"QuadraticProgramToQubo",{"type":26,"value":2135},", encode it as an Ising Hamiltonian, run ",{"type":21,"tag":46,"props":2137,"children":2139},{"href":2138},"\u002Fglossary\u002Fqaoa",[2140],{"type":26,"value":2018},{"type":26,"value":2142},". It works, but it spends circuit depth and classical tuning effort enforcing the budget constraint through a penalty term, and some fraction of measured samples violates the constraint outright, silently scored badly rather than rejected. If you're presenting quantum results to people without an SDK background, this is the mode most likely to embarrass you: \"why does the quantum solution sometimes pick the wrong number of stocks?\"",{"type":21,"tag":22,"props":2144,"children":2145},{},[2146,2151,2153,2159,2161,2167,2169,2175],{"type":21,"tag":136,"props":2147,"children":2148},{},[2149],{"type":26,"value":2150},"Dicke-state \u002F XY-mixer QAOA.",{"type":26,"value":2152}," The constraint-preserving alternative. A Dicke-state initialization (built with a small ancilla \"running count\" register that provably lands on exactly ",{"type":21,"tag":2073,"props":2154,"children":2156},{"className":2155},[],[2157],{"type":26,"value":2158},"|budget⟩",{"type":26,"value":2160},") combined with an XY-mixer (",{"type":21,"tag":2073,"props":2162,"children":2164},{"className":2163},[],[2165],{"type":26,"value":2166},"RXX",{"type":26,"value":2168},"\u002F",{"type":21,"tag":2073,"props":2170,"children":2172},{"className":2171},[],[2173],{"type":26,"value":2174},"RYY",{"type":26,"value":2176}," gates) keeps every single measurement inside the feasible K-of-N subspace by construction. No penalty tuning, no invalid answers to explain away. It's a heavier circuit, but it's the version you'd want in front of a non-technical audience. Every result respects the constraint they asked for, because the ansatz makes anything else geometrically impossible.",{"type":21,"tag":22,"props":2178,"children":2179},{},[2180],{"type":26,"value":2181},"That comparison (one classical baseline, two structurally different quantum approaches) is the shape a credible business case needs. A single quantum result with no classical comparison and no discussion of why the encoding was chosen isn't evidence of anything.",{"type":21,"tag":29,"props":2183,"children":2185},{"id":2184},"the-chart-thats-the-actual-deliverable",[2186],{"type":26,"value":2187},"The chart that's the actual deliverable",{"type":21,"tag":22,"props":2189,"children":2190},{},[2191],{"type":26,"value":2192},"Here's the part of PortfolioQ's own documentation worth repeating verbatim, because it's the most honest sentence you'll read about applied quantum optimization this year:",{"type":21,"tag":2194,"props":2195,"children":2196},"blockquote",{},[2197],{"type":21,"tag":22,"props":2198,"children":2199},{},[2200,2202,2208],{"type":26,"value":2201},"Run the same request against a real IBM backend and chart result quality vs. gate count as you increase ",{"type":21,"tag":2073,"props":2203,"children":2205},{"className":2204},[],[2206],{"type":26,"value":2207},"reps",{"type":26,"value":2209},". This is the \"signal vs. noise crossover\" chart that's the actual deliverable for a business-case pitch.",{"type":21,"tag":22,"props":2211,"children":2212},{},[2213,2215,2221,2223,2229,2230,2236],{"type":26,"value":2214},"That's the whole exercise. Not \"we ran QAOA and it worked.\" Not \"quantum is X% faster.\" A chart with two axes: how close the quantum answer gets to the true optimum (",{"type":21,"tag":2073,"props":2216,"children":2218},{"className":2217},[],[2219],{"type":26,"value":2220},"pct_of_optimal",{"type":26,"value":2222},": 100% means it matched classical exactly), against how much circuit you had to run to get there (",{"type":21,"tag":2073,"props":2224,"children":2226},{"className":2225},[],[2227],{"type":26,"value":2228},"circuit_depth",{"type":26,"value":904},{"type":21,"tag":2073,"props":2231,"children":2233},{"className":2232},[],[2234],{"type":26,"value":2235},"two_qubit_gates",{"type":26,"value":2237},", both reported alongside every result). Run it on the simulator first, then on real hardware, and watch where the lines cross, or don't.",{"type":21,"tag":29,"props":2239,"children":2241},{"id":2240},"building-the-case-step-by-step",[2242],{"type":26,"value":2243},"Building the case, step by step",{"type":21,"tag":22,"props":2245,"children":2246},{},[2247,2252,2254,2259,2261,2267],{"type":21,"tag":136,"props":2248,"children":2249},{},[2250],{"type":26,"value":2251},"1. Cap your problem size honestly.",{"type":26,"value":2253}," PortfolioQ's own README recommends 10-30 assets for anything run on real hardware, and explains why: current ",{"type":21,"tag":46,"props":2255,"children":2256},{"href":371},[2257],{"type":26,"value":2258},"NISQ",{"type":26,"value":2260}," devices simply don't have the qubit count or gate fidelity to go further without the noise dominating the signal. A business case that quietly assumes a 500-stock universe on today's hardware isn't a business case, it's fiction. Start with the candidate universe you'd genuinely consider: real tickers, real historical prices (the tool fetches these automatically via ",{"type":21,"tag":2073,"props":2262,"children":2264},{"className":2263},[],[2265],{"type":26,"value":2266},"yfinance",{"type":26,"value":2268}," if you don't supply your own).",{"type":21,"tag":22,"props":2270,"children":2271},{},[2272,2277,2279,2285,2287,2293,2295,2301],{"type":21,"tag":136,"props":2273,"children":2274},{},[2275],{"type":26,"value":2276},"2. Establish the in-principle baseline on a simulator.",{"type":26,"value":2278}," Run ",{"type":21,"tag":2073,"props":2280,"children":2282},{"className":2281},[],[2283],{"type":26,"value":2284},"\u002Foptimize\u002Fcompare-all",{"type":26,"value":2286}," on ",{"type":21,"tag":2073,"props":2288,"children":2290},{"className":2289},[],[2291],{"type":26,"value":2292},"aer_simulator",{"type":26,"value":2294}," before touching real hardware. Check that ",{"type":21,"tag":2073,"props":2296,"children":2298},{"className":2297},[],[2299],{"type":26,"value":2300},"feasible_fraction",{"type":26,"value":2302}," on the XY-mixer result is exactly 1.0. That's your sanity check that the constraint-preserving construction works as designed, with no hardware noise yet in the picture.",{"type":21,"tag":2304,"props":2305,"children":2309},"pre",{"className":2306,"code":2307,"language":2308,"meta":7,"style":7},"language-json shiki shiki-themes github-dark","POST \u002Foptimize\u002Fcompare-all\n{\n  \"tickers\": [\"AAPL\", \"MSFT\", \"GOOGL\", \"AMZN\", \"NVDA\"],\n  \"budget\": 2,\n  \"risk_factor\": 0.5,\n  \"reps\": 2,\n  \"shots\": 1024,\n  \"backend\": \"aer_simulator\"\n}\n","json",[2310],{"type":21,"tag":2073,"props":2311,"children":2312},{"__ignoreMap":7},[2313,2325,2333,2395,2419,2441,2461,2482,2499],{"type":21,"tag":2314,"props":2315,"children":2318},"span",{"class":2316,"line":2317},"line",1,[2319],{"type":21,"tag":2314,"props":2320,"children":2322},{"style":2321},"--shiki-default:#E1E4E8",[2323],{"type":26,"value":2324},"POST \u002Foptimize\u002Fcompare-all\n",{"type":21,"tag":2314,"props":2326,"children":2327},{"class":2316,"line":106},[2328],{"type":21,"tag":2314,"props":2329,"children":2330},{"style":2321},[2331],{"type":26,"value":2332},"{\n",{"type":21,"tag":2314,"props":2334,"children":2336},{"class":2316,"line":2335},3,[2337,2343,2348,2354,2358,2363,2367,2372,2376,2381,2385,2390],{"type":21,"tag":2314,"props":2338,"children":2340},{"style":2339},"--shiki-default:#79B8FF",[2341],{"type":26,"value":2342},"  \"tickers\"",{"type":21,"tag":2314,"props":2344,"children":2345},{"style":2321},[2346],{"type":26,"value":2347},": [",{"type":21,"tag":2314,"props":2349,"children":2351},{"style":2350},"--shiki-default:#9ECBFF",[2352],{"type":26,"value":2353},"\"AAPL\"",{"type":21,"tag":2314,"props":2355,"children":2356},{"style":2321},[2357],{"type":26,"value":1309},{"type":21,"tag":2314,"props":2359,"children":2360},{"style":2350},[2361],{"type":26,"value":2362},"\"MSFT\"",{"type":21,"tag":2314,"props":2364,"children":2365},{"style":2321},[2366],{"type":26,"value":1309},{"type":21,"tag":2314,"props":2368,"children":2369},{"style":2350},[2370],{"type":26,"value":2371},"\"GOOGL\"",{"type":21,"tag":2314,"props":2373,"children":2374},{"style":2321},[2375],{"type":26,"value":1309},{"type":21,"tag":2314,"props":2377,"children":2378},{"style":2350},[2379],{"type":26,"value":2380},"\"AMZN\"",{"type":21,"tag":2314,"props":2382,"children":2383},{"style":2321},[2384],{"type":26,"value":1309},{"type":21,"tag":2314,"props":2386,"children":2387},{"style":2350},[2388],{"type":26,"value":2389},"\"NVDA\"",{"type":21,"tag":2314,"props":2391,"children":2392},{"style":2321},[2393],{"type":26,"value":2394},"],\n",{"type":21,"tag":2314,"props":2396,"children":2398},{"class":2316,"line":2397},4,[2399,2404,2409,2414],{"type":21,"tag":2314,"props":2400,"children":2401},{"style":2339},[2402],{"type":26,"value":2403},"  \"budget\"",{"type":21,"tag":2314,"props":2405,"children":2406},{"style":2321},[2407],{"type":26,"value":2408},": ",{"type":21,"tag":2314,"props":2410,"children":2411},{"style":2339},[2412],{"type":26,"value":2413},"2",{"type":21,"tag":2314,"props":2415,"children":2416},{"style":2321},[2417],{"type":26,"value":2418},",\n",{"type":21,"tag":2314,"props":2420,"children":2422},{"class":2316,"line":2421},5,[2423,2428,2432,2437],{"type":21,"tag":2314,"props":2424,"children":2425},{"style":2339},[2426],{"type":26,"value":2427},"  \"risk_factor\"",{"type":21,"tag":2314,"props":2429,"children":2430},{"style":2321},[2431],{"type":26,"value":2408},{"type":21,"tag":2314,"props":2433,"children":2434},{"style":2339},[2435],{"type":26,"value":2436},"0.5",{"type":21,"tag":2314,"props":2438,"children":2439},{"style":2321},[2440],{"type":26,"value":2418},{"type":21,"tag":2314,"props":2442,"children":2443},{"class":2316,"line":16},[2444,2449,2453,2457],{"type":21,"tag":2314,"props":2445,"children":2446},{"style":2339},[2447],{"type":26,"value":2448},"  \"reps\"",{"type":21,"tag":2314,"props":2450,"children":2451},{"style":2321},[2452],{"type":26,"value":2408},{"type":21,"tag":2314,"props":2454,"children":2455},{"style":2339},[2456],{"type":26,"value":2413},{"type":21,"tag":2314,"props":2458,"children":2459},{"style":2321},[2460],{"type":26,"value":2418},{"type":21,"tag":2314,"props":2462,"children":2463},{"class":2316,"line":127},[2464,2469,2473,2478],{"type":21,"tag":2314,"props":2465,"children":2466},{"style":2339},[2467],{"type":26,"value":2468},"  \"shots\"",{"type":21,"tag":2314,"props":2470,"children":2471},{"style":2321},[2472],{"type":26,"value":2408},{"type":21,"tag":2314,"props":2474,"children":2475},{"style":2339},[2476],{"type":26,"value":2477},"1024",{"type":21,"tag":2314,"props":2479,"children":2480},{"style":2321},[2481],{"type":26,"value":2418},{"type":21,"tag":2314,"props":2483,"children":2484},{"class":2316,"line":887},[2485,2490,2494],{"type":21,"tag":2314,"props":2486,"children":2487},{"style":2339},[2488],{"type":26,"value":2489},"  \"backend\"",{"type":21,"tag":2314,"props":2491,"children":2492},{"style":2321},[2493],{"type":26,"value":2408},{"type":21,"tag":2314,"props":2495,"children":2496},{"style":2350},[2497],{"type":26,"value":2498},"\"aer_simulator\"\n",{"type":21,"tag":2314,"props":2500,"children":2501},{"class":2316,"line":1364},[2502],{"type":21,"tag":2314,"props":2503,"children":2504},{"style":2321},[2505],{"type":26,"value":2506},"}\n",{"type":21,"tag":22,"props":2508,"children":2509},{},[2510,2521,2523,2529,2531,2537,2539,2544,2546,2551,2553,2559,2560,2565,2567,2572,2574,2579,2581,2587,2589,2595,2597,2603],{"type":21,"tag":136,"props":2511,"children":2512},{},[2513,2515,2520],{"type":26,"value":2514},"3. Move to real hardware and vary ",{"type":21,"tag":2073,"props":2516,"children":2518},{"className":2517},[],[2519],{"type":26,"value":2207},{"type":26,"value":761},{"type":26,"value":2522}," This is where the actual data comes from. Point ",{"type":21,"tag":2073,"props":2524,"children":2526},{"className":2525},[],[2527],{"type":26,"value":2528},"\"backend\"",{"type":26,"value":2530}," at a real device (",{"type":21,"tag":2073,"props":2532,"children":2534},{"className":2533},[],[2535],{"type":26,"value":2536},"\"ibm_torino\"",{"type":26,"value":2538},", for example. See our ",{"type":21,"tag":46,"props":2540,"children":2541},{"href":245},[2542],{"type":26,"value":2543},"IBM Quantum free tier guide",{"type":26,"value":2545}," if you don't have hardware access set up yet) and rerun the same comparison as you increase ",{"type":21,"tag":2073,"props":2547,"children":2549},{"className":2548},[],[2550],{"type":26,"value":2207},{"type":26,"value":2552},". ",{"type":21,"tag":2073,"props":2554,"children":2556},{"className":2555},[],[2557],{"type":26,"value":2558},"qaoa_xy_pct_of_optimal",{"type":26,"value":904},{"type":21,"tag":2073,"props":2561,"children":2563},{"className":2562},[],[2564],{"type":26,"value":2235},{"type":26,"value":2566}," climbing together across a handful of ",{"type":21,"tag":2073,"props":2568,"children":2570},{"className":2569},[],[2571],{"type":26,"value":2207},{"type":26,"value":2573}," values ",{"type":21,"tag":362,"props":2575,"children":2576},{},[2577],{"type":26,"value":2578},"is",{"type":26,"value":2580}," the chart. Because each COBYLA iteration blocks on a real hardware job, use PortfolioQ's async ",{"type":21,"tag":2073,"props":2582,"children":2584},{"className":2583},[],[2585],{"type":26,"value":2586},"\u002Fsubmit",{"type":26,"value":2588}," + ",{"type":21,"tag":2073,"props":2590,"children":2592},{"className":2591},[],[2593],{"type":26,"value":2594},"\u002Fjobs\u002F{id}",{"type":26,"value":2596}," endpoints rather than the blocking ones. A ",{"type":21,"tag":2073,"props":2598,"children":2600},{"className":2599},[],[2601],{"type":26,"value":2602},"maxiter",{"type":26,"value":2604}," of 100 means up to 100 hardware round-trips per optimization run, which will outlast most HTTP client timeouts on a queued device.",{"type":21,"tag":22,"props":2606,"children":2607},{},[2608,2613,2615,2620],{"type":21,"tag":136,"props":2609,"children":2610},{},[2611],{"type":26,"value":2612},"4. Report the noise honestly, including where it breaks the guarantee.",{"type":26,"value":2614}," Expect ",{"type":21,"tag":2073,"props":2616,"children":2618},{"className":2617},[],[2619],{"type":26,"value":2300},{"type":26,"value":2621}," to drop below 1.0 on real hardware even for the XY-mixer, despite the simulator showing a clean 1.0. That's not a bug and it's not a reason to hide the result. On real hardware, noise, not the algorithm, is what breaks the Hamming-weight preservation the Dicke-state construction guarantees in theory. That gap between simulator and hardware feasibility is itself a meaningful, quotable data point: it's a direct, measured picture of how much today's error rates cost you, expressed in a metric a risk committee reads directly.",{"type":21,"tag":22,"props":2623,"children":2624},{},[2625,2630],{"type":21,"tag":136,"props":2626,"children":2627},{},[2628],{"type":26,"value":2629},"5. Write the recommendation the data supports.",{"type":26,"value":2631}," For 10-30 assets on current hardware, that recommendation is almost never \"replace the greedy heuristic in production today\". PortfolioQ's own greedy baseline exists precisely as \"what we'd run in production today,\" and it's fast, classical, and usually close to optimal at this scale. The honest, defensible business case is: here is the exact crossover point we measured, here is what has to improve (gate fidelity, qubit count, queue economics) before it moves, and here is the monitoring plan for re-running this comparison as hardware improves. That's a real deliverable. \"We're not there yet, and here's precisely how we'll know when we are\" is a stronger memo than an inflated claim that won't survive the first follow-up question.",{"type":21,"tag":29,"props":2633,"children":2635},{"id":2634},"what-this-template-generalizes-to",[2636],{"type":26,"value":2637},"What this template generalizes to",{"type":21,"tag":22,"props":2639,"children":2640},{},[2641,2643,2648],{"type":26,"value":2642},"None of the above is specific to portfolios. The same shape (a credible classical baseline, more than one quantum encoding compared honestly, a simulator sanity check before hardware, and a quality-vs-noise chart instead of a single cherry-picked run) is exactly how you'd build a defensible case for QAOA on any other constrained optimization problem: routing, scheduling, or the Max-Cut-style problems in our ",{"type":21,"tag":46,"props":2644,"children":2645},{"href":2029},[2646],{"type":26,"value":2647},"QAOA tutorial",{"type":26,"value":2649},". The specific circuits change. The discipline of comparing against what you already have, and reporting where the noise wins, doesn't.",{"type":21,"tag":22,"props":2651,"children":2652},{},[2653,2655,2661,2663,2669,2671,2677,2679,2685],{"type":26,"value":2654},"If you want to see this pattern extended, PortfolioQ's ",{"type":21,"tag":46,"props":2656,"children":2658},{"href":2040,"rel":2657},[899],[2659],{"type":26,"value":2660},"source on GitHub",{"type":26,"value":2662}," is small enough to read end to end in an afternoon: ",{"type":21,"tag":2073,"props":2664,"children":2666},{"className":2665},[],[2667],{"type":26,"value":2668},"portfolio.py",{"type":26,"value":2670}," for the QUBO construction, ",{"type":21,"tag":2073,"props":2672,"children":2674},{"className":2673},[],[2675],{"type":26,"value":2676},"xy_mixer_solver.py",{"type":26,"value":2678}," for the constraint-preserving ansatz, and ",{"type":21,"tag":2073,"props":2680,"children":2682},{"className":2681},[],[2683],{"type":26,"value":2684},"main.py",{"type":26,"value":2686}," for how the comparison endpoints are wired together. It's explicitly a pilot and capability-building scaffold rather than a production system, which, for the purpose of building a business case rather than shipping a trading system, is exactly the point.",{"type":21,"tag":2688,"props":2689,"children":2690},"style",{},[2691],{"type":26,"value":2692},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":106,"depth":106,"links":2694},[2695,2696,2697,2698,2699],{"id":2056,"depth":106,"text":2059},{"id":2099,"depth":106,"text":2102},{"id":2184,"depth":106,"text":2187},{"id":2240,"depth":106,"text":2243},{"id":2634,"depth":106,"text":2637},"content:blog:quantum-portfolio-optimization-business-case.md","blog\u002Fquantum-portfolio-optimization-business-case.md","blog\u002Fquantum-portfolio-optimization-business-case",{"_path":2704,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":2705,"description":2706,"date":10,"author":11,"tags":2707,"readingTime":127,"body":2708,"_type":111,"_id":2852,"_source":113,"_file":2853,"_stem":2854,"_extension":116},"\u002Fblog\u002Fsaxon-q-room-temperature-diamond-quantum-computer","SAXON Q Is Selling a Quantum Computer That Skips the Cryostat Entirely","SAXON Q, a Leipzig University spinout, launched the SXQ128 and SXQ512, diamond-based nitrogen-vacancy quantum computers that run at room temperature with no cryogenic cooling. Here is how the qubits work and what the claimed numbers mean.",[13,14],{"type":18,"children":2709,"toc":2846},[2710,2731,2736,2742,2756,2761,2767,2779,2784,2790,2802,2807,2813,2825,2841],{"type":21,"tag":22,"props":2711,"children":2712},{},[2713,2715,2721,2722,2729],{"type":26,"value":2714},"On July 21, 2026, SAXON Q announced commercial availability of the SXQ128 and SXQ512, diamond-based quantum computers built around nitrogen-vacancy (NV) centers, according to ",{"type":21,"tag":46,"props":2716,"children":2719},{"href":2717,"rel":2718},"https:\u002F\u002Fthequantuminsider.com\u002F2026\u002F07\u002F21\u002Fsaxon-q-diamond-nv-center-quantum-computers\u002F",[899],[2720],{"type":26,"value":902},{"type":26,"value":904},{"type":21,"tag":46,"props":2723,"children":2726},{"href":2724,"rel":2725},"https:\u002F\u002Fwww.hpcwire.com\u002Foff-the-wire\u002Fsaxon-q-brings-room-temperature-diamond-quantum-computing-to-commercial-market\u002F",[899],[2727],{"type":26,"value":2728},"HPCwire",{"type":26,"value":2730},". The headline claim is the one worth checking first: both systems run at room temperature, with no cryostat, no vacuum chamber, and no dilution refrigerator, plugged into an ordinary electrical outlet in a standard server rack.",{"type":21,"tag":22,"props":2732,"children":2733},{},[2734],{"type":26,"value":2735},"That single fact separates NV-center qubits from every hardware modality this site usually covers. Superconducting qubits and trapped ions both need cooling to near absolute zero, and most of the engineering difficulty in scaling those platforms traces back to that requirement. A qubit that works at room temperature sidesteps an entire category of problems, if the claim holds up.",{"type":21,"tag":29,"props":2737,"children":2739},{"id":2738},"what-saxon-q-built",[2740],{"type":26,"value":2741},"What SAXON Q built",{"type":21,"tag":22,"props":2743,"children":2744},{},[2745,2747,2754],{"type":26,"value":2746},"SAXON Q is a 2021 spinout from Leipzig University, founded by physicists who spent decades researching NV centers before commercializing the work. Marius Grundmann and Frank Schlichting hold the CEO title jointly, according to ",{"type":21,"tag":46,"props":2748,"children":2751},{"href":2749,"rel":2750},"https:\u002F\u002Fwww.saxonq.com\u002Fen\u002Funternehmen\u002F",[899],[2752],{"type":26,"value":2753},"the company's own site",{"type":26,"value":2755},", alongside co-founders Jan Meijer (CTO) and Bernd Burchard (CIPO).",{"type":21,"tag":22,"props":2757,"children":2758},{},[2759],{"type":26,"value":2760},"The SXQ128 packs 128 qubits, arranged as multiple cores of eight fully entangled qubits each. The SXQ512 scales that to 512 qubits across cores of 16. Both are available to order now, with SXQ128 deliveries beginning within three months and SXQ512 shipments starting in the second quarter of 2027.",{"type":21,"tag":29,"props":2762,"children":2764},{"id":2763},"what-an-nv-center-is",[2765],{"type":26,"value":2766},"What an NV center is",{"type":21,"tag":22,"props":2768,"children":2769},{},[2770,2772,2777],{"type":26,"value":2771},"A nitrogen-vacancy center is a specific defect in a diamond's carbon lattice: a nitrogen atom sits next to an empty spot where a carbon atom should be. That defect traps a single electron whose spin state is initialized, manipulated, and read out with lasers and microwaves, and it behaves as a ",{"type":21,"tag":46,"props":2773,"children":2774},{"href":1194},[2775],{"type":26,"value":2776},"qubit",{"type":26,"value":2778}," at room temperature because diamond's rigid lattice isolates the trapped electron from the thermal noise that would otherwise destroy its quantum state.",{"type":21,"tag":22,"props":2780,"children":2781},{},[2782],{"type":26,"value":2783},"The company reports a fidelity of up to 99.92% and describes creating these defects through a proprietary sulfur co-implantation process during ion beam implantation, claiming a conversion yield above 85% (the share of implanted atoms that become working qubits) against a reported 1 to 10% for prior implantation methods. That yield number is the more interesting engineering claim here, since NV centers themselves are decades-old physics. The obstacle was always building enough of them reliably in one piece of diamond, not discovering that they exist.",{"type":21,"tag":29,"props":2785,"children":2787},{"id":2786},"what-to-treat-as-unverified",[2788],{"type":26,"value":2789},"What to treat as unverified",{"type":21,"tag":22,"props":2791,"children":2792},{},[2793,2795,2800],{"type":26,"value":2794},"Every number above comes from SAXON Q's own announcement. None of it has been independently reproduced or published in a peer-reviewed venue the way HRL's recent ",{"type":21,"tag":46,"props":2796,"children":2797},{"href":75},[2798],{"type":26,"value":2799},"self-operating silicon processor",{"type":26,"value":2801}," was. A fidelity figure is only useful next to a clearly stated definition of which operation it measures, and a yield percentage is only useful once someone outside the company that reports it gets to check the diamond.",{"type":21,"tag":22,"props":2803,"children":2804},{},[2805],{"type":26,"value":2806},"The one data point that is not only a press release is a deployment: Fraunhofer IWU installed a SAXON Q system in mid-2025 for industrial optimization work in material processing and robotics, and the company says it has run continuously at room temperature since. A working deployment at a respected applied-research institute is a stronger signal than a spec sheet, though it still says nothing about how the same architecture performs at 128 or 512 qubits.",{"type":21,"tag":29,"props":2808,"children":2810},{"id":2809},"where-room-temperature-qubits-fit-against-everything-else",[2811],{"type":26,"value":2812},"Where room-temperature qubits fit against everything else",{"type":21,"tag":22,"props":2814,"children":2815},{},[2816,2818,2823],{"type":26,"value":2817},"Room-temperature operation does not automatically mean SAXON Q's qubits outperform cryogenic ones on the metrics that decide whether a quantum computer is useful: gate fidelity under load, coherence time during a real circuit, and how the system behaves as qubit count grows. Trapped ions and superconducting qubits have a multi-year head start on demonstrating those things at scale, with ",{"type":21,"tag":46,"props":2819,"children":2820},{"href":674},[2821],{"type":26,"value":2822},"independently scrutinized results",{"type":26,"value":2824}," that NV-center systems do not yet have.",{"type":21,"tag":22,"props":2826,"children":2827},{},[2828,2830,2834,2835,2839],{"type":26,"value":2829},"What room temperature does buy, if the claims hold, is dramatically simpler infrastructure. No cryostat means no multi-week cooldown cycle, no liquid helium supply chain, and a system that fits in a standard rack instead of a dedicated lab. For applications like industrial optimization at a manufacturing site, that operational simplicity sometimes matters more than an extra order of magnitude of fidelity. Our ",{"type":21,"tag":46,"props":2831,"children":2832},{"href":99},[2833],{"type":26,"value":102},{"type":26,"value":904},{"type":21,"tag":46,"props":2836,"children":2837},{"href":261},[2838],{"type":26,"value":853},{"type":26,"value":2840}," track how each modality trades those priorities differently.",{"type":21,"tag":22,"props":2842,"children":2843},{},[2844],{"type":26,"value":2845},"The honest read on SAXON Q today: a real, shipping product from a team with a genuine research background in the underlying physics, with commercial claims that have not yet been checked by anyone outside the company. That is a normal place for a new hardware vendor to be. It is not yet evidence that diamond NV centers compete with the platforms that have already survived a decade of outside scrutiny.",{"title":7,"searchDepth":106,"depth":106,"links":2847},[2848,2849,2850,2851],{"id":2738,"depth":106,"text":2741},{"id":2763,"depth":106,"text":2766},{"id":2786,"depth":106,"text":2789},{"id":2809,"depth":106,"text":2812},"content:blog:saxon-q-room-temperature-diamond-quantum-computer.md","blog\u002Fsaxon-q-room-temperature-diamond-quantum-computer.md","blog\u002Fsaxon-q-room-temperature-diamond-quantum-computer",{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"author":11,"tags":2856,"readingTime":16,"body":2857,"_type":111,"_id":112,"_source":113,"_file":114,"_stem":115,"_extension":116},[13,14,15],{"type":18,"children":2858,"toc":2915},[2859,2863,2867,2871,2885,2889,2898,2902,2906],{"type":21,"tag":22,"props":2860,"children":2861},{},[2862],{"type":26,"value":27},{"type":21,"tag":29,"props":2864,"children":2865},{"id":31},[2866],{"type":26,"value":34},{"type":21,"tag":22,"props":2868,"children":2869},{},[2870],{"type":26,"value":39},{"type":21,"tag":22,"props":2872,"children":2873},{},[2874,2875,2879,2880,2884],{"type":26,"value":44},{"type":21,"tag":46,"props":2876,"children":2877},{"href":48},[2878],{"type":26,"value":51},{"type":26,"value":53},{"type":21,"tag":46,"props":2881,"children":2882},{"href":56},[2883],{"type":26,"value":59},{"type":26,"value":61},{"type":21,"tag":29,"props":2886,"children":2887},{"id":64},[2888],{"type":26,"value":67},{"type":21,"tag":22,"props":2890,"children":2891},{},[2892,2893,2897],{"type":26,"value":72},{"type":21,"tag":46,"props":2894,"children":2895},{"href":75},[2896],{"type":26,"value":78},{"type":26,"value":80},{"type":21,"tag":22,"props":2899,"children":2900},{},[2901],{"type":26,"value":85},{"type":21,"tag":29,"props":2903,"children":2904},{"id":88},[2905],{"type":26,"value":91},{"type":21,"tag":22,"props":2907,"children":2908},{},[2909,2910,2914],{"type":26,"value":96},{"type":21,"tag":46,"props":2911,"children":2912},{"href":99},[2913],{"type":26,"value":102},{"type":26,"value":104},{"title":7,"searchDepth":106,"depth":106,"links":2916},[2917,2918,2919],{"id":31,"depth":106,"text":34},{"id":64,"depth":106,"text":67},{"id":88,"depth":106,"text":91},{"_path":2921,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":2922,"description":2923,"date":10,"author":11,"tags":2924,"readingTime":127,"body":2925,"_type":111,"_id":3025,"_source":113,"_file":3026,"_stem":3027,"_extension":116},"\u002Fblog\u002Fzuriq-2d-trapped-ion-seed-funding","ZuriQ Wants to Fix Trapped-Ion Scaling by Going 2D Instead of 1D","ZuriQ, an ETH Zurich spinout, raised $25.5 million to scale a two-dimensional trapped-ion architecture built on Penning micro-traps, a departure from the linear ion chains IonQ and Quantinuum use. Here is what the nine-ion demonstrator shows.",[13,14,126],{"type":18,"children":2926,"toc":3020},[2927,2947,2958,2964,2976,2981,2987,2992,2997,3003,3008],{"type":21,"tag":22,"props":2928,"children":2929},{},[2930,2932,2938,2939,2945],{"type":26,"value":2931},"On July 28, 2026, ZuriQ announced a $25.5 million seed round to scale a trapped-ion architecture that departs from how every other trapped-ion company builds its qubits, according to ",{"type":21,"tag":46,"props":2933,"children":2936},{"href":2934,"rel":2935},"https:\u002F\u002Fthequantuminsider.com\u002F2026\u002F07\u002F28\u002Fzuriq-raises-25-5-million-2d-trapped-ion-quantum-processors\u002F",[899],[2937],{"type":26,"value":902},{"type":26,"value":904},{"type":21,"tag":46,"props":2940,"children":2943},{"href":2941,"rel":2942},"https:\u002F\u002Fsiliconangle.com\u002F2026\u002F07\u002F28\u002Fquantum-computing-startup-zuriq-gets-25-5m-scale-2d-trapped-ion-processor-design\u002F",[899],[2944],{"type":26,"value":1323},{"type":26,"value":2946},". The round was led by Quantonation, with Forward.one, Extantia, and Firgun Ventures joining alongside existing investors, following a $4.2 million pre-seed round in 2025.",{"type":21,"tag":22,"props":2948,"children":2949},{},[2950,2952,2956],{"type":26,"value":2951},"ZuriQ is a spinout from ETH Zurich, led by CEO Pavel Hrmo, who spent more than a decade in trapped-ion research before founding the company. Its pitch is narrow and specific: the standard way of building a ",{"type":21,"tag":46,"props":2953,"children":2954},{"href":99},[2955],{"type":26,"value":1969},{"type":26,"value":2957}," quantum computer, a linear chain of ions connected through junctions, runs into a scaling wall that a two-dimensional layout avoids.",{"type":21,"tag":29,"props":2959,"children":2961},{"id":2960},"why-linear-chains-are-the-default-and-why-they-cap-out",[2962],{"type":26,"value":2963},"Why linear chains are the default and why they cap out",{"type":21,"tag":22,"props":2965,"children":2966},{},[2967,2969,2974],{"type":26,"value":2968},"IonQ and Quantinuum, ",{"type":21,"tag":46,"props":2970,"children":2971},{"href":1583},[2972],{"type":26,"value":2973},"the two companies furthest along commercially",{"type":26,"value":2975}," with trapped ions, both build on one-dimensional ion chains. Ions sit in a line inside a trap, and moving ions between different zones of the chip requires junctions, physical structures where chains merge and split. Junctions work, but every one adds engineering complexity, and a chip built from linear segments scales roughly with how many segments you wire together, not with the raw area of the chip.",{"type":21,"tag":22,"props":2977,"children":2978},{},[2979],{"type":26,"value":2980},"ZuriQ's approach uses Penning micro-traps, which confine ions with static magnetic fields instead of the oscillating electric fields used in standard linear traps. According to the company, this lets ions move freely across two dimensions rather than being confined to a single line, so qubit density grows with the area of the chip rather than the number of chained segments. That is a real architectural difference, not a rebranding of the same idea, and it is the kind of claim worth watching for independent confirmation as the company scales past its current demonstrator.",{"type":21,"tag":29,"props":2982,"children":2984},{"id":2983},"what-has-been-built-so-far",[2985],{"type":26,"value":2986},"What has been built so far",{"type":21,"tag":22,"props":2988,"children":2989},{},[2990],{"type":26,"value":2991},"The concrete result behind the funding is a working 3-by-3 array of nine individually controlled ions, built in collaboration with ETH Zurich over 18 months and fabricated on Infineon's production lines. ZuriQ describes it as the largest two-dimensional trapped-ion array demonstrated to date, which is a claim about being first at a specific, small scale rather than a claim about being competitive with IonQ's or Quantinuum's qubit counts today.",{"type":21,"tag":22,"props":2993,"children":2994},{},[2995],{"type":26,"value":2996},"Nine ions is a long way from a useful quantum computer. What the demonstrator establishes is that the Penning-trap approach works in a real fabricated chip rather than only on paper, and that Infineon's existing manufacturing lines produce the hardware, which matters for whether the architecture eventually scales past a lab bench. Quantonation partner Nicolas Jurczak framed the round as evidence that real physics breakthroughs are still available in quantum hardware architecture, which is the kind of statement every early-stage investor makes about their own bet and is worth reading as exactly that.",{"type":21,"tag":29,"props":2998,"children":3000},{"id":2999},"what-this-does-and-does-not-tell-you",[3001],{"type":26,"value":3002},"What this does and does not tell you",{"type":21,"tag":22,"props":3004,"children":3005},{},[3006],{"type":26,"value":3007},"This is a seed-stage company with a nine-qubit demonstrator, not a commercial system. The claims about how the architecture scales are ZuriQ's own projections, not measured results at any meaningful qubit count. What makes it worth tracking rather than dismissing is the specificity: a named physical mechanism (Penning micro-traps), a working fabricated device, and an industrial manufacturing partner, rather than a roadmap slide with no hardware behind it.",{"type":21,"tag":22,"props":3009,"children":3010},{},[3011,3013,3018],{"type":26,"value":3012},"If ZuriQ's 2D architecture scales the way it projects, it would address one of the structural bottlenecks in ",{"type":21,"tag":46,"props":3014,"children":3015},{"href":858},[3016],{"type":26,"value":3017},"trapped-ion scaling",{"type":26,"value":3019}," that this site has covered before: connecting qubits without every additional connection point adding its own error budget. Whether it gets there is a multi-year question. For now, the honest summary is a well-funded, technically specific bet from a team with real trapped-ion research credentials, at a scale that proves the mechanism works and nothing more.",{"title":7,"searchDepth":106,"depth":106,"links":3021},[3022,3023,3024],{"id":2960,"depth":106,"text":2963},{"id":2983,"depth":106,"text":2986},{"id":2999,"depth":106,"text":3002},"content:blog:zuriq-2d-trapped-ion-seed-funding.md","blog\u002Fzuriq-2d-trapped-ion-seed-funding.md","blog\u002Fzuriq-2d-trapped-ion-seed-funding",{"_path":3029,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":3030,"description":3031,"date":3032,"author":11,"tags":3033,"readingTime":887,"body":3035,"_type":111,"_id":3936,"_source":113,"_file":3937,"_stem":3938,"_extension":116},"\u002Fzh\u002Fblog\u002Fquantum-benchmarking-eo-14413","新版量子行政命令揭示了该领域真正的难题","把 EO 14413 当作技术文件而非政治文件来读，它就变成了一份坦率的清单，列出量子计算至今尚未解决的问题——首当其冲的是：没有人能可靠地衡量一台量子计算机到底有多好。","2026-07-18",[14,13,3034],"Performance",{"type":18,"children":3036,"toc":3927},[3037,3049,3054,3059,3064,3069,3074,3079,3133,3138,3143,3647,3671,3676,3681,3686,3707,3719,3725,3737,3742,3768,3773,3778,3783,3788,3809,3814,3819,3824,3845,3850,3862,3867,3872,3877,3905,3910,3923],{"type":21,"tag":22,"props":3038,"children":3039},{},[3040,3042,3047],{"type":26,"value":3041},"2026 年 6 月 22 日，Executive Order 14413——",{"type":21,"tag":362,"props":3043,"children":3044},{},[3045],{"type":26,"value":3046},"Ushering in the Next Frontier of Quantum Innovation",{"type":26,"value":3048},"（开启量子创新的下一个前沿）——正式签署。相关报道几乎全都聚焦于政治层面。",{"type":21,"tag":22,"props":3050,"children":3051},{},[3052],{"type":26,"value":3053},"这很可惜，因为更有意思的其实是技术层面的解读。这类政策文件在起草时大量吸收了运营量子项目的一线人员的意见，而他们提出的诉求，相当坦率地勾勒出这个领域至今仍做不到的事情。这样读下来，EO 14413 与其说是一份公告，不如说是一份问题清单。",{"type":21,"tag":22,"props":3055,"children":3056},{},[3057],{"type":26,"value":3058},"以下是其中最值得注意的几点。",{"type":21,"tag":29,"props":3060,"children":3062},{"id":3061},"没有人能可靠地衡量一台量子计算机有多好",[3063],{"type":26,"value":3061},{"type":21,"tag":22,"props":3065,"children":3066},{},[3067],{"type":26,"value":3068},"这份命令中最不动声色却最引人注目的一句话，是要求 Department of Energy 在 180 天内建立\"一个国家级中心，以开发准确评估量子计算系统性能所需的工具与能力\"。",{"type":21,"tag":22,"props":3070,"children":3071},{},[3072],{"type":26,"value":3073},"细想一下。在 Feynman 提出量子计算机约四十五年后、在第一次量子霸权宣称的七年后，一个政府之所以要专门设立一家机构，是因为我们没有一种值得信赖的方式来回答*\"这台量子计算机到底好不好？\"*",{"type":21,"tag":22,"props":3075,"children":3076},{},[3077],{"type":26,"value":3078},"这不是官僚式的场面话。它是真实存在的问题，任何试图比较两台 QPU 的人都撞上过。问题在于每家厂商报告的数字都不一样：",{"type":21,"tag":3080,"props":3081,"children":3082},"ul",{},[3083,3094,3108,3118,3128],{"type":21,"tag":3084,"props":3085,"children":3086},"li",{},[3087,3092],{"type":21,"tag":136,"props":3088,"children":3089},{},[3090],{"type":26,"value":3091},"量子比特数量",{"type":26,"value":3093},"单独来看几乎没有意义。对于真实任务，一百个糟糕的量子比特可能还不如二十个好的。",{"type":21,"tag":3084,"props":3095,"children":3096},{},[3097,3106],{"type":21,"tag":136,"props":3098,"children":3099},{},[3100],{"type":21,"tag":46,"props":3101,"children":3103},{"href":3102},"\u002Fglossary\u002Fquantum-volume",[3104],{"type":26,"value":3105},"Quantum Volume",{"type":26,"value":3107}," 把量子比特数量、连通性和错误率打包成一个数字——但它会饱和，而且对于设备如何处理你真正关心的那些特定电路，它几乎说明不了什么。",{"type":21,"tag":3084,"props":3109,"children":3110},{},[3111,3116],{"type":21,"tag":136,"props":3112,"children":3113},{},[3114],{"type":26,"value":3115},"门保真度",{"type":26,"value":3117},"通常是针对孤立的单量子比特门和双量子比特门给出的，这系统性地美化了芯片。当多个门并行运行时，误差的累积方式截然不同，而串扰根本不会体现在那个头条数字里。",{"type":21,"tag":3084,"props":3119,"children":3120},{},[3121,3126],{"type":21,"tag":136,"props":3122,"children":3123},{},[3124],{"type":26,"value":3125},"CLOPS",{"type":26,"value":3127}," 及类似的吞吐量指标衡量的是速度，而非精度——一台快速返回噪声的机器毫无用处。",{"type":21,"tag":3084,"props":3129,"children":3130},{},[3131],{"type":26,"value":3132},"**\"算法量子比特\"**以及其他由厂商自定义的指标无法跨厂商比较，而这往往正是它们的用意所在。",{"type":21,"tag":22,"props":3134,"children":3135},{},[3136],{"type":26,"value":3137},"该命令还要求建立一套跨机构的信息共享机制，以\"提升政府评估商业量子计算能力的水平\"——这是一种委婉的说法，意思是厂商的营销宣称目前很难被独立核实。",{"type":21,"tag":22,"props":3139,"children":3140},{},[3141],{"type":26,"value":3142},"如果你要自己评估硬件，实用的经验是：不要再相信任何单一数字，而要针对你自己的工作负载做基准测试。你可以直接拉取真实的设备属性，而不必依赖新闻稿：",{"type":21,"tag":2304,"props":3144,"children":3148},{"className":3145,"code":3146,"language":3147,"meta":7,"style":7},"language-python shiki shiki-themes github-dark","from qiskit_ibm_runtime import QiskitRuntimeService\n\nservice = QiskitRuntimeService()\nbackend = service.least_busy(operational=True, simulator=False)\n\nprint(f\"Backend:  {backend.name}\")\nprint(f\"Qubits:   {backend.num_qubits}\")\nprint(f\"Basis:    {backend.basis_gates}\")\n\n# Per-qubit error rates vary enormously across a single chip\nprops = backend.properties()\nerrors = [(q, props.readout_error(q)) for q in range(backend.num_qubits)]\nworst = max(errors, key=lambda x: x[1])\nbest = min(errors, key=lambda x: x[1])\nprint(f\"Readout error — best qubit: {best[1]:.4f}, worst: {worst[1]:.4f}\")\n","python",[3149],{"type":21,"tag":2073,"props":3150,"children":3151},{"__ignoreMap":7},[3152,3176,3185,3203,3258,3265,3312,3353,3394,3401,3411,3429,3471,3519,3561],{"type":21,"tag":2314,"props":3153,"children":3154},{"class":2316,"line":2317},[3155,3161,3166,3171],{"type":21,"tag":2314,"props":3156,"children":3158},{"style":3157},"--shiki-default:#F97583",[3159],{"type":26,"value":3160},"from",{"type":21,"tag":2314,"props":3162,"children":3163},{"style":2321},[3164],{"type":26,"value":3165}," qiskit_ibm_runtime ",{"type":21,"tag":2314,"props":3167,"children":3168},{"style":3157},[3169],{"type":26,"value":3170},"import",{"type":21,"tag":2314,"props":3172,"children":3173},{"style":2321},[3174],{"type":26,"value":3175}," QiskitRuntimeService\n",{"type":21,"tag":2314,"props":3177,"children":3178},{"class":2316,"line":106},[3179],{"type":21,"tag":2314,"props":3180,"children":3182},{"emptyLinePlaceholder":3181},true,[3183],{"type":26,"value":3184},"\n",{"type":21,"tag":2314,"props":3186,"children":3187},{"class":2316,"line":2335},[3188,3193,3198],{"type":21,"tag":2314,"props":3189,"children":3190},{"style":2321},[3191],{"type":26,"value":3192},"service ",{"type":21,"tag":2314,"props":3194,"children":3195},{"style":3157},[3196],{"type":26,"value":3197},"=",{"type":21,"tag":2314,"props":3199,"children":3200},{"style":2321},[3201],{"type":26,"value":3202}," QiskitRuntimeService()\n",{"type":21,"tag":2314,"props":3204,"children":3205},{"class":2316,"line":2397},[3206,3211,3215,3220,3226,3230,3235,3239,3244,3248,3253],{"type":21,"tag":2314,"props":3207,"children":3208},{"style":2321},[3209],{"type":26,"value":3210},"backend ",{"type":21,"tag":2314,"props":3212,"children":3213},{"style":3157},[3214],{"type":26,"value":3197},{"type":21,"tag":2314,"props":3216,"children":3217},{"style":2321},[3218],{"type":26,"value":3219}," service.least_busy(",{"type":21,"tag":2314,"props":3221,"children":3223},{"style":3222},"--shiki-default:#FFAB70",[3224],{"type":26,"value":3225},"operational",{"type":21,"tag":2314,"props":3227,"children":3228},{"style":3157},[3229],{"type":26,"value":3197},{"type":21,"tag":2314,"props":3231,"children":3232},{"style":2339},[3233],{"type":26,"value":3234},"True",{"type":21,"tag":2314,"props":3236,"children":3237},{"style":2321},[3238],{"type":26,"value":1309},{"type":21,"tag":2314,"props":3240,"children":3241},{"style":3222},[3242],{"type":26,"value":3243},"simulator",{"type":21,"tag":2314,"props":3245,"children":3246},{"style":3157},[3247],{"type":26,"value":3197},{"type":21,"tag":2314,"props":3249,"children":3250},{"style":2339},[3251],{"type":26,"value":3252},"False",{"type":21,"tag":2314,"props":3254,"children":3255},{"style":2321},[3256],{"type":26,"value":3257},")\n",{"type":21,"tag":2314,"props":3259,"children":3260},{"class":2316,"line":2421},[3261],{"type":21,"tag":2314,"props":3262,"children":3263},{"emptyLinePlaceholder":3181},[3264],{"type":26,"value":3184},{"type":21,"tag":2314,"props":3266,"children":3267},{"class":2316,"line":16},[3268,3273,3278,3283,3288,3293,3298,3303,3308],{"type":21,"tag":2314,"props":3269,"children":3270},{"style":2339},[3271],{"type":26,"value":3272},"print",{"type":21,"tag":2314,"props":3274,"children":3275},{"style":2321},[3276],{"type":26,"value":3277},"(",{"type":21,"tag":2314,"props":3279,"children":3280},{"style":3157},[3281],{"type":26,"value":3282},"f",{"type":21,"tag":2314,"props":3284,"children":3285},{"style":2350},[3286],{"type":26,"value":3287},"\"Backend:  ",{"type":21,"tag":2314,"props":3289,"children":3290},{"style":2339},[3291],{"type":26,"value":3292},"{",{"type":21,"tag":2314,"props":3294,"children":3295},{"style":2321},[3296],{"type":26,"value":3297},"backend.name",{"type":21,"tag":2314,"props":3299,"children":3300},{"style":2339},[3301],{"type":26,"value":3302},"}",{"type":21,"tag":2314,"props":3304,"children":3305},{"style":2350},[3306],{"type":26,"value":3307},"\"",{"type":21,"tag":2314,"props":3309,"children":3310},{"style":2321},[3311],{"type":26,"value":3257},{"type":21,"tag":2314,"props":3313,"children":3314},{"class":2316,"line":127},[3315,3319,3323,3327,3332,3336,3341,3345,3349],{"type":21,"tag":2314,"props":3316,"children":3317},{"style":2339},[3318],{"type":26,"value":3272},{"type":21,"tag":2314,"props":3320,"children":3321},{"style":2321},[3322],{"type":26,"value":3277},{"type":21,"tag":2314,"props":3324,"children":3325},{"style":3157},[3326],{"type":26,"value":3282},{"type":21,"tag":2314,"props":3328,"children":3329},{"style":2350},[3330],{"type":26,"value":3331},"\"Qubits:   ",{"type":21,"tag":2314,"props":3333,"children":3334},{"style":2339},[3335],{"type":26,"value":3292},{"type":21,"tag":2314,"props":3337,"children":3338},{"style":2321},[3339],{"type":26,"value":3340},"backend.num_qubits",{"type":21,"tag":2314,"props":3342,"children":3343},{"style":2339},[3344],{"type":26,"value":3302},{"type":21,"tag":2314,"props":3346,"children":3347},{"style":2350},[3348],{"type":26,"value":3307},{"type":21,"tag":2314,"props":3350,"children":3351},{"style":2321},[3352],{"type":26,"value":3257},{"type":21,"tag":2314,"props":3354,"children":3355},{"class":2316,"line":887},[3356,3360,3364,3368,3373,3377,3382,3386,3390],{"type":21,"tag":2314,"props":3357,"children":3358},{"style":2339},[3359],{"type":26,"value":3272},{"type":21,"tag":2314,"props":3361,"children":3362},{"style":2321},[3363],{"type":26,"value":3277},{"type":21,"tag":2314,"props":3365,"children":3366},{"style":3157},[3367],{"type":26,"value":3282},{"type":21,"tag":2314,"props":3369,"children":3370},{"style":2350},[3371],{"type":26,"value":3372},"\"Basis:    ",{"type":21,"tag":2314,"props":3374,"children":3375},{"style":2339},[3376],{"type":26,"value":3292},{"type":21,"tag":2314,"props":3378,"children":3379},{"style":2321},[3380],{"type":26,"value":3381},"backend.basis_gates",{"type":21,"tag":2314,"props":3383,"children":3384},{"style":2339},[3385],{"type":26,"value":3302},{"type":21,"tag":2314,"props":3387,"children":3388},{"style":2350},[3389],{"type":26,"value":3307},{"type":21,"tag":2314,"props":3391,"children":3392},{"style":2321},[3393],{"type":26,"value":3257},{"type":21,"tag":2314,"props":3395,"children":3396},{"class":2316,"line":1364},[3397],{"type":21,"tag":2314,"props":3398,"children":3399},{"emptyLinePlaceholder":3181},[3400],{"type":26,"value":3184},{"type":21,"tag":2314,"props":3402,"children":3404},{"class":2316,"line":3403},10,[3405],{"type":21,"tag":2314,"props":3406,"children":3408},{"style":3407},"--shiki-default:#6A737D",[3409],{"type":26,"value":3410},"# Per-qubit error rates vary enormously across a single chip\n",{"type":21,"tag":2314,"props":3412,"children":3414},{"class":2316,"line":3413},11,[3415,3420,3424],{"type":21,"tag":2314,"props":3416,"children":3417},{"style":2321},[3418],{"type":26,"value":3419},"props ",{"type":21,"tag":2314,"props":3421,"children":3422},{"style":3157},[3423],{"type":26,"value":3197},{"type":21,"tag":2314,"props":3425,"children":3426},{"style":2321},[3427],{"type":26,"value":3428}," backend.properties()\n",{"type":21,"tag":2314,"props":3430,"children":3431},{"class":2316,"line":436},[3432,3437,3441,3446,3451,3456,3461,3466],{"type":21,"tag":2314,"props":3433,"children":3434},{"style":2321},[3435],{"type":26,"value":3436},"errors ",{"type":21,"tag":2314,"props":3438,"children":3439},{"style":3157},[3440],{"type":26,"value":3197},{"type":21,"tag":2314,"props":3442,"children":3443},{"style":2321},[3444],{"type":26,"value":3445}," [(q, props.readout_error(q)) ",{"type":21,"tag":2314,"props":3447,"children":3448},{"style":3157},[3449],{"type":26,"value":3450},"for",{"type":21,"tag":2314,"props":3452,"children":3453},{"style":2321},[3454],{"type":26,"value":3455}," q ",{"type":21,"tag":2314,"props":3457,"children":3458},{"style":3157},[3459],{"type":26,"value":3460},"in",{"type":21,"tag":2314,"props":3462,"children":3463},{"style":2339},[3464],{"type":26,"value":3465}," range",{"type":21,"tag":2314,"props":3467,"children":3468},{"style":2321},[3469],{"type":26,"value":3470},"(backend.num_qubits)]\n",{"type":21,"tag":2314,"props":3472,"children":3474},{"class":2316,"line":3473},13,[3475,3480,3484,3489,3494,3499,3504,3509,3514],{"type":21,"tag":2314,"props":3476,"children":3477},{"style":2321},[3478],{"type":26,"value":3479},"worst ",{"type":21,"tag":2314,"props":3481,"children":3482},{"style":3157},[3483],{"type":26,"value":3197},{"type":21,"tag":2314,"props":3485,"children":3486},{"style":2339},[3487],{"type":26,"value":3488}," max",{"type":21,"tag":2314,"props":3490,"children":3491},{"style":2321},[3492],{"type":26,"value":3493},"(errors, ",{"type":21,"tag":2314,"props":3495,"children":3496},{"style":3222},[3497],{"type":26,"value":3498},"key",{"type":21,"tag":2314,"props":3500,"children":3501},{"style":3157},[3502],{"type":26,"value":3503},"=lambda",{"type":21,"tag":2314,"props":3505,"children":3506},{"style":2321},[3507],{"type":26,"value":3508}," x: x[",{"type":21,"tag":2314,"props":3510,"children":3511},{"style":2339},[3512],{"type":26,"value":3513},"1",{"type":21,"tag":2314,"props":3515,"children":3516},{"style":2321},[3517],{"type":26,"value":3518},"])\n",{"type":21,"tag":2314,"props":3520,"children":3522},{"class":2316,"line":3521},14,[3523,3528,3532,3537,3541,3545,3549,3553,3557],{"type":21,"tag":2314,"props":3524,"children":3525},{"style":2321},[3526],{"type":26,"value":3527},"best ",{"type":21,"tag":2314,"props":3529,"children":3530},{"style":3157},[3531],{"type":26,"value":3197},{"type":21,"tag":2314,"props":3533,"children":3534},{"style":2339},[3535],{"type":26,"value":3536}," min",{"type":21,"tag":2314,"props":3538,"children":3539},{"style":2321},[3540],{"type":26,"value":3493},{"type":21,"tag":2314,"props":3542,"children":3543},{"style":3222},[3544],{"type":26,"value":3498},{"type":21,"tag":2314,"props":3546,"children":3547},{"style":3157},[3548],{"type":26,"value":3503},{"type":21,"tag":2314,"props":3550,"children":3551},{"style":2321},[3552],{"type":26,"value":3508},{"type":21,"tag":2314,"props":3554,"children":3555},{"style":2339},[3556],{"type":26,"value":3513},{"type":21,"tag":2314,"props":3558,"children":3559},{"style":2321},[3560],{"type":26,"value":3518},{"type":21,"tag":2314,"props":3562,"children":3564},{"class":2316,"line":3563},15,[3565,3569,3573,3577,3582,3586,3591,3595,3600,3605,3609,3614,3618,3623,3627,3631,3635,3639,3643],{"type":21,"tag":2314,"props":3566,"children":3567},{"style":2339},[3568],{"type":26,"value":3272},{"type":21,"tag":2314,"props":3570,"children":3571},{"style":2321},[3572],{"type":26,"value":3277},{"type":21,"tag":2314,"props":3574,"children":3575},{"style":3157},[3576],{"type":26,"value":3282},{"type":21,"tag":2314,"props":3578,"children":3579},{"style":2350},[3580],{"type":26,"value":3581},"\"Readout error — best qubit: ",{"type":21,"tag":2314,"props":3583,"children":3584},{"style":2339},[3585],{"type":26,"value":3292},{"type":21,"tag":2314,"props":3587,"children":3588},{"style":2321},[3589],{"type":26,"value":3590},"best[",{"type":21,"tag":2314,"props":3592,"children":3593},{"style":2339},[3594],{"type":26,"value":3513},{"type":21,"tag":2314,"props":3596,"children":3597},{"style":2321},[3598],{"type":26,"value":3599},"]",{"type":21,"tag":2314,"props":3601,"children":3602},{"style":3157},[3603],{"type":26,"value":3604},":.4f",{"type":21,"tag":2314,"props":3606,"children":3607},{"style":2339},[3608],{"type":26,"value":3302},{"type":21,"tag":2314,"props":3610,"children":3611},{"style":2350},[3612],{"type":26,"value":3613},", worst: ",{"type":21,"tag":2314,"props":3615,"children":3616},{"style":2339},[3617],{"type":26,"value":3292},{"type":21,"tag":2314,"props":3619,"children":3620},{"style":2321},[3621],{"type":26,"value":3622},"worst[",{"type":21,"tag":2314,"props":3624,"children":3625},{"style":2339},[3626],{"type":26,"value":3513},{"type":21,"tag":2314,"props":3628,"children":3629},{"style":2321},[3630],{"type":26,"value":3599},{"type":21,"tag":2314,"props":3632,"children":3633},{"style":3157},[3634],{"type":26,"value":3604},{"type":21,"tag":2314,"props":3636,"children":3637},{"style":2339},[3638],{"type":26,"value":3302},{"type":21,"tag":2314,"props":3640,"children":3641},{"style":2350},[3642],{"type":26,"value":3307},{"type":21,"tag":2314,"props":3644,"children":3645},{"style":2321},[3646],{"type":26,"value":3257},{"type":21,"tag":22,"props":3648,"children":3649},{},[3650,3652,3657,3659,3663,3664,3669],{"type":26,"value":3651},"在几乎任何一台当前设备上运行这段代码，你都会看到",{"type":21,"tag":362,"props":3653,"children":3654},{},[3655],{"type":26,"value":3656},"同一块芯片",{"type":26,"value":3658},"上最好与最差量子比特之间的差距常常达到五倍甚至更多。这种差异在任何汇总统计量中都是看不见的，而这也正是转译（transpilation）和量子比特选择如此重要的原因。我们的 ",{"type":21,"tag":46,"props":3660,"children":3661},{"href":212},[3662],{"type":26,"value":690},{"type":26,"value":209},{"type":21,"tag":46,"props":3665,"children":3666},{"href":99},[3667],{"type":26,"value":3668},"硬件指南",{"type":26,"value":3670},"对如何挑选后端有更深入的讲解。",{"type":21,"tag":29,"props":3672,"children":3674},{"id":3673},"这个领域还没有选出胜出的量子比特技术",[3675],{"type":26,"value":3673},{"type":21,"tag":22,"props":3677,"children":3678},{},[3679],{"type":26,"value":3680},"有一点因其缺席而格外醒目：这份命令自始至终没有点名任何一种量子比特技术路线。它没有偏向超导电路、离子阱、光子学、中性原子或自旋量子比特，而是笼统地提到\"量子使能组件技术\"。",{"type":21,"tag":22,"props":3682,"children":3683},{},[3684],{"type":26,"value":3685},"这是一个有意义的信号。当一项技术走向成熟时，采购文件会变得具体。没有人会为\"基于某种开关元件的计算设备\"制定国家战略。这种刻意的含糊反映了真实的现状：截至 2026 年年中，还没有哪条技术路线明确胜出。",{"type":21,"tag":22,"props":3687,"children":3688},{},[3689,3691,3697,3699,3705],{"type":26,"value":3690},"各条路线在不同维度上各自领先——超导芯片在门速度和制造规模上占优，离子阱在保真度和全连通性上占优，中性原子在量子比特数量上占优，光子学则在室温运行和网络互联上占优。2026 年的",{"type":21,"tag":46,"props":3692,"children":3694},{"href":3693},"\u002Fresearch\u002Fholographic-codes-quantum-gravity-2026",[3695],{"type":26,"value":3696},"全息码实验",{"type":26,"value":3698},"是在离子阱上完成的；",{"type":21,"tag":46,"props":3700,"children":3702},{"href":3701},"\u002Fresearch\u002Fgoogle-below-threshold-2024",[3703],{"type":26,"value":3704},"Google 的低于阈值纠错成果",{"type":26,"value":3706},"则运行在超导硬件上。两者都是里程碑式的结果，却出自完全不同的平台。",{"type":21,"tag":22,"props":3708,"children":3709},{},[3710,3712,3717],{"type":26,"value":3711},"对于任何正在学习量子计算的人来说，这其实是好消息，而且有一个具体的启示：",{"type":21,"tag":136,"props":3713,"children":3714},{},[3715],{"type":26,"value":3716},"不要过度专精于某一家厂商的技术栈。",{"type":26,"value":3718}," 那些抽象概念——电路、门、测量、错误缓解——是可以跨硬件迁移的，而厂商专有的 API 细节则未必。",{"type":21,"tag":29,"props":3720,"children":3722},{"id":3721},"超越当前经典计算能力如今成了标尺",[3723],{"type":26,"value":3724},"\"超越当前经典计算能力\"如今成了标尺",{"type":21,"tag":22,"props":3726,"children":3727},{},[3728,3730,3735],{"type":26,"value":3729},"该命令设立了 ",{"type":21,"tag":136,"props":3731,"children":3732},{},[3733],{"type":26,"value":3734},"Quantum Computer for Application Development and Discovery Science (QC-ADDS)",{"type":26,"value":3736}," 计划，目标是向 Department of Energy 的某个设施交付至少一台机器，并向科学界开放使用。Secretary of Energy 有 90 天时间来确定这类系统的规格，要求其能够支撑\"变革性的科学应用……并走在通往具有显著经济价值的应用、以及超越当前经典计算机能力的道路上\"。",{"type":21,"tag":22,"props":3738,"children":3739},{},[3740],{"type":26,"value":3741},"这段措辞里有两点值得注意。",{"type":21,"tag":22,"props":3743,"children":3744},{},[3745,3747,3752,3754,3759,3761,3766],{"type":26,"value":3746},"第一，它的立足点是",{"type":21,"tag":136,"props":3748,"children":3749},{},[3750],{"type":26,"value":3751},"发现型科学",{"type":26,"value":3753},"，而不是商业优势。目标是一台科学仪器——研究人员用来认识世界的机器——而不是一款在商业任务上击败经典计算机的产品。这与证据实际指向的方向是一致的：",{"type":21,"tag":46,"props":3755,"children":3756},{"href":1456},[3757],{"type":26,"value":3758},"IBM 2023 年的量子实用性成果",{"type":26,"value":3760},"和全息码工作，本质上都是",{"type":21,"tag":362,"props":3762,"children":3763},{},[3764],{"type":26,"value":3765},"物理",{"type":26,"value":3767},"实验。",{"type":21,"tag":22,"props":3769,"children":3770},{},[3771],{"type":26,"value":3772},"第二，\"走在通往……的道路上\"这个说法在句中承担了真正的分量。它等于承认：正在规划的这台机器是一个阶段性台阶，而非终点。",{"type":21,"tag":29,"props":3774,"children":3776},{"id":3775},"分布式量子计算作为一项严肃目标出现",[3777],{"type":26,"value":3775},{"type":21,"tag":22,"props":3779,"children":3780},{},[3781],{"type":26,"value":3782},"在关于网络的章节中，藏着一项要求：DOE 需就服务于\"分布式量子计算\"的量子网络制定规划。",{"type":21,"tag":22,"props":3784,"children":3785},{},[3786],{"type":26,"value":3787},"这一点很重要，因为它是对扩展性问题的一次坦承。造一台超大规模的量子处理器难度极高——随着芯片变大，布线、制冷、串扰和良率都会变得更糟。把若干台较小的处理器连接成一台逻辑上的机器，是另一条可行路线，而它依赖于在彼此独立的设备之间分发保真度足够高、足以真正可用的纠缠。",{"type":21,"tag":22,"props":3789,"children":3790},{},[3791,3793,3799,3801,3807],{"type":26,"value":3792},"其底层原语是",{"type":21,"tag":46,"props":3794,"children":3796},{"href":3795},"\u002Fresearch\u002Fbennett-teleportation-1993",[3797],{"type":26,"value":3798},"量子隐形传态",{"type":26,"value":3800},"，它借助共享",{"type":21,"tag":46,"props":3802,"children":3804},{"href":3803},"\u002Fglossary\u002Fentanglement",[3805],{"type":26,"value":3806},"纠缠",{"type":26,"value":3808},"加上两个经典比特，把一个量子比特的状态从一处传到另一处。多年来这在实验上已是常规操作——但要做到足够快、足够干净，从而把多台处理器编织在一起，就完全是另一回事了。它被列为五年规划目标，说明\"单块大芯片\"策略并没有被默认为足够。",{"type":21,"tag":29,"props":3810,"children":3812},{"id":3811},"人才缺口被当作瓶颈来对待",[3813],{"type":26,"value":3811},{"type":21,"tag":22,"props":3815,"children":3816},{},[3817],{"type":26,"value":3818},"该命令要求 NSF 在 180 天内启动\"一个 National QIST Workforce Development Institutes 网络\"，并同步制定招募与留才策略。",{"type":21,"tag":22,"props":3820,"children":3821},{},[3822],{"type":26,"value":3823},"人才相关的章节很容易被一眼略过，但它被写进来这件事本身就说明了一个具体问题：制约量子进展的因素并不只是硬件。能够编写、调试并推理量子程序的人手不够——而这一短缺如今已被认为严重到需要设立专门机构来应对。",{"type":21,"tag":22,"props":3825,"children":3826},{},[3827,3829,3835,3837,3843],{"type":26,"value":3828},"对本站的读者来说，这是整份文件中最具可操作性的部分。文件中被描述为稀缺的这些技能，现在就可以免费学习，而且能在真实硬件上练习。我们的",{"type":21,"tag":46,"props":3830,"children":3832},{"href":3831},"\u002Fcourses",[3833],{"type":26,"value":3834},"课程页面",{"type":26,"value":3836},"汇集了最优质的结构化学习选项，而",{"type":21,"tag":46,"props":3838,"children":3840},{"href":3839},"\u002Fblog\u002Fgetting-started-free-quantum-computing",[3841],{"type":26,"value":3842},"入门指南",{"type":26,"value":3844},"能让你在一个下午之内在真实 QPU 上跑通一个电路。",{"type":21,"tag":29,"props":3846,"children":3848},{"id":3847},"它没有包含什么",[3849],{"type":26,"value":3847},{"type":21,"tag":22,"props":3851,"children":3852},{},[3853,3855,3860],{"type":26,"value":3854},"为了准确起见，有必要明说：这份命令",{"type":21,"tag":136,"props":3856,"children":3857},{},[3858],{"type":26,"value":3859},"没有给出任何金额数字",{"type":26,"value":3861},"。它确定方向、分派职责、设定期限——各章节分布着 90 天、120 天、180 天和 210 天的时限——但拨款要另行安排。而且，行政命令中的期限也不等于交付的保证。",{"type":21,"tag":22,"props":3863,"children":3864},{},[3865],{"type":26,"value":3866},"请把这些时间表当作意图的表达，而不是可以据以规划的日程。",{"type":21,"tag":29,"props":3868,"children":3870},{"id":3869},"结论",[3871],{"type":26,"value":3869},{"type":21,"tag":22,"props":3873,"children":3874},{},[3875],{"type":26,"value":3876},"剥去政治色彩，EO 14413 读起来就像一份异常坦率的技术评估：",{"type":21,"tag":3080,"props":3878,"children":3879},{},[3880,3885,3890,3895,3900],{"type":21,"tag":3084,"props":3881,"children":3882},{},[3883],{"type":26,"value":3884},"我们无法可靠地衡量量子计算机的性能，而这件事如今紧迫到需要设立专门机构。",{"type":21,"tag":3084,"props":3886,"children":3887},{},[3888],{"type":26,"value":3889},"没有哪种量子比特技术胜出，因此各方都在对冲下注。",{"type":21,"tag":3084,"props":3891,"children":3892},{},[3893],{"type":26,"value":3894},"近期目标是科学发现，而不是商业优势。",{"type":21,"tag":3084,"props":3896,"children":3897},{},[3898],{"type":26,"value":3899},"扩展规模可能需要把芯片联网，而不是造一块巨型芯片。",{"type":21,"tag":3084,"props":3901,"children":3902},{},[3903],{"type":26,"value":3904},"受过训练的人才不够，而这是一个一阶瓶颈。",{"type":21,"tag":22,"props":3906,"children":3907},{},[3908],{"type":26,"value":3909},"这些结论都算不上悲观。这是一个已经越过\"这东西究竟能不能用\"、进入\"我们该如何衡量它、扩展它、为它配备人手\"阶段的领域——这大致相当于经典计算在 1950 年代经历的那次转变。",{"type":21,"tag":22,"props":3911,"children":3912},{},[3913,3915,3921],{"type":26,"value":3914},"真正值得关注的是衡量问题。跟量子比特数量的纪录相比，基准测试听起来乏味，但你无法工程化你无法衡量的东西，而每一项关于量子优势的严肃宣称，最终都建立在它之上。如果你想了解这个领域实际的走向，请学会读懂错误率，而不是头条新闻——不妨从我们的",{"type":21,"tag":46,"props":3916,"children":3918},{"href":3917},"\u002Fglossary",[3919],{"type":26,"value":3920},"关键术语表",{"type":26,"value":3922},"开始。",{"type":21,"tag":2688,"props":3924,"children":3925},{},[3926],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":3928},[3929,3930,3931,3932,3933,3934,3935],{"id":3061,"depth":106,"text":3061},{"id":3673,"depth":106,"text":3673},{"id":3721,"depth":106,"text":3724},{"id":3775,"depth":106,"text":3775},{"id":3811,"depth":106,"text":3811},{"id":3847,"depth":106,"text":3847},{"id":3869,"depth":106,"text":3869},"content:zh:blog:quantum-benchmarking-eo-14413.md","zh\u002Fblog\u002Fquantum-benchmarking-eo-14413.md","zh\u002Fblog\u002Fquantum-benchmarking-eo-14413",{"_path":3940,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":3941,"description":3942,"date":3032,"author":11,"tags":3943,"readingTime":3403,"body":3944,"_type":111,"_id":7094,"_source":113,"_file":7095,"_stem":7096,"_extension":116},"\u002Fblog\u002Ferror-mitigation-practical-guide","Quantum Error Mitigation: A Practical Guide (And When It Lies to You)","Hands-on error mitigation for NISQ hardware: readout calibration, zero-noise extrapolation, Pauli twirling, and dynamical decoupling, plus the ZNE failure mode that manufactures fake improvements.",[125,1363,3034],{"type":18,"children":3945,"toc":7083},[3946,3951,3956,3962,3967,3993,4014,4019,4134,4153,4159,4164,4209,5602,5612,5620,5648,5675,5681,5702,5715,5910,5915,5921,5933,5938,5950,5956,5968,5996,6738,6748,6756,6761,6767,6772,6780,6792,6819,6831,6841,6847,6852,6870,6902,6918,6924,6936,6949,6955,6960,7014,7038,7051,7079],{"type":21,"tag":22,"props":3947,"children":3948},{},[3949],{"type":26,"value":3950},"You ran your circuit on real hardware. The answer is wrong. Not catastrophically wrong. Wrong enough to be useless. Error mitigation is the set of tricks that gets you from \"wrong\" to \"usable\" without waiting a decade for fault tolerance.",{"type":21,"tag":22,"props":3952,"children":3953},{},[3954],{"type":26,"value":3955},"This guide covers what works, in the order you should try it, with runnable Qiskit code. It also covers the part most tutorials skip: how the most popular mitigation technique sometimes produces a convincing improvement that is entirely fictitious, and the one-line sanity check that catches it.",{"type":21,"tag":29,"props":3957,"children":3959},{"id":3958},"mitigation-is-not-correction",[3960],{"type":26,"value":3961},"Mitigation Is Not Correction",{"type":21,"tag":22,"props":3963,"children":3964},{},[3965],{"type":26,"value":3966},"These get conflated constantly, so let's be precise.",{"type":21,"tag":22,"props":3968,"children":3969},{},[3970,3977,3979,3984,3986,3991],{"type":21,"tag":136,"props":3971,"children":3972},{},[3973],{"type":21,"tag":46,"props":3974,"children":3975},{"href":48},[3976],{"type":26,"value":932},{"type":26,"value":3978}," detects and fixes errors ",{"type":21,"tag":362,"props":3980,"children":3981},{},[3982],{"type":26,"value":3983},"during",{"type":26,"value":3985}," the computation. It encodes one logical qubit across many physical qubits, measures syndromes with ancillas, and applies corrections in real time. It preserves arbitrary quantum states to arbitrary depth, but it demands hardware below the fault-tolerance threshold and roughly 1,000 times qubit overhead. Our ",{"type":21,"tag":46,"props":3987,"children":3988},{"href":253},[3989],{"type":26,"value":3990},"error correction primer",{"type":26,"value":3992}," walks through how the surface code does this.",{"type":21,"tag":22,"props":3994,"children":3995},{},[3996,4005,4007,4012],{"type":21,"tag":136,"props":3997,"children":3998},{},[3999],{"type":21,"tag":46,"props":4000,"children":4002},{"href":4001},"\u002Fglossary\u002Ferror-mitigation",[4003],{"type":26,"value":4004},"Error mitigation",{"type":26,"value":4006}," does nothing during the computation. It runs the noisy circuit, collects noisy results, and applies classical statistics afterwards to ",{"type":21,"tag":362,"props":4008,"children":4009},{},[4010],{"type":26,"value":4011},"estimate",{"type":26,"value":4013}," what a noiseless machine would have said.",{"type":21,"tag":22,"props":4015,"children":4016},{},[4017],{"type":26,"value":4018},"The practical differences matter:",{"type":21,"tag":4020,"props":4021,"children":4022},"table",{},[4023,4045],{"type":21,"tag":4024,"props":4025,"children":4026},"thead",{},[4027],{"type":21,"tag":4028,"props":4029,"children":4030},"tr",{},[4031,4035,4040],{"type":21,"tag":4032,"props":4033,"children":4034},"th",{},[],{"type":21,"tag":4032,"props":4036,"children":4037},{},[4038],{"type":26,"value":4039},"Correction",{"type":21,"tag":4032,"props":4041,"children":4042},{},[4043],{"type":26,"value":4044},"Mitigation",{"type":21,"tag":4046,"props":4047,"children":4048},"tbody",{},[4049,4080,4098,4116],{"type":21,"tag":4028,"props":4050,"children":4051},{},[4052,4058,4069],{"type":21,"tag":4053,"props":4054,"children":4055},"td",{},[4056],{"type":26,"value":4057},"Cost",{"type":21,"tag":4053,"props":4059,"children":4060},{},[4061,4063,4067],{"type":26,"value":4062},"Extra ",{"type":21,"tag":136,"props":4064,"children":4065},{},[4066],{"type":26,"value":1197},{"type":26,"value":4068}," (~1000×)",{"type":21,"tag":4053,"props":4070,"children":4071},{},[4072,4073,4078],{"type":26,"value":4062},{"type":21,"tag":136,"props":4074,"children":4075},{},[4076],{"type":26,"value":4077},"shots",{"type":26,"value":4079}," (2–100×)",{"type":21,"tag":4028,"props":4081,"children":4082},{},[4083,4088,4093],{"type":21,"tag":4053,"props":4084,"children":4085},{},[4086],{"type":26,"value":4087},"Recovers",{"type":21,"tag":4053,"props":4089,"children":4090},{},[4091],{"type":26,"value":4092},"The quantum state",{"type":21,"tag":4053,"props":4094,"children":4095},{},[4096],{"type":26,"value":4097},"An expectation value",{"type":21,"tag":4028,"props":4099,"children":4100},{},[4101,4106,4111],{"type":21,"tag":4053,"props":4102,"children":4103},{},[4104],{"type":26,"value":4105},"Scales to",{"type":21,"tag":4053,"props":4107,"children":4108},{},[4109],{"type":26,"value":4110},"Arbitrary depth",{"type":21,"tag":4053,"props":4112,"children":4113},{},[4114],{"type":26,"value":4115},"Shallow-to-moderate depth only",{"type":21,"tag":4028,"props":4117,"children":4118},{},[4119,4124,4129],{"type":21,"tag":4053,"props":4120,"children":4121},{},[4122],{"type":26,"value":4123},"Available today",{"type":21,"tag":4053,"props":4125,"children":4126},{},[4127],{"type":26,"value":4128},"Barely",{"type":21,"tag":4053,"props":4130,"children":4131},{},[4132],{"type":26,"value":4133},"Yes, right now",{"type":21,"tag":22,"props":4135,"children":4136},{},[4137,4139,4144,4146,4151],{"type":26,"value":4138},"That last row is why mitigation dominates ",{"type":21,"tag":46,"props":4140,"children":4141},{"href":371},[4142],{"type":26,"value":4143},"NISQ-era",{"type":26,"value":4145}," work. But note row three: mitigation's overhead grows ",{"type":21,"tag":362,"props":4147,"children":4148},{},[4149],{"type":26,"value":4150},"exponentially",{"type":26,"value":4152}," with circuit depth and error rate. There is a depth beyond which no amount of shots rescues you. Knowing where that wall is (for your circuit, on your device) is the entire skill.",{"type":21,"tag":29,"props":4154,"children":4156},{"id":4155},"step-1-readout-error-mitigation-do-this-first",[4157],{"type":26,"value":4158},"Step 1: Readout Error Mitigation (Do This First)",{"type":21,"tag":22,"props":4160,"children":4161},{},[4162],{"type":26,"value":4163},"Measurement errors are the cheapest thing to fix and often the biggest single contributor. A superconducting qubit typically misreads 1–5% of the time. On 4 qubits at 3% each, you're losing ~11% of your signal before any gate error is counted.",{"type":21,"tag":22,"props":4165,"children":4166},{},[4167,4169,4175,4177,4183,4185,4191,4193,4199,4201,4207],{"type":26,"value":4168},"The fix: characterize the readout with calibration circuits, then invert. Prepare each computational basis state, measure it, and record where the counts land. That gives you an assignment matrix ",{"type":21,"tag":2073,"props":4170,"children":4172},{"className":4171},[],[4173],{"type":26,"value":4174},"M",{"type":26,"value":4176}," where ",{"type":21,"tag":2073,"props":4178,"children":4180},{"className":4179},[],[4181],{"type":26,"value":4182},"M[i][j]",{"type":26,"value":4184}," is the probability of reading ",{"type":21,"tag":2073,"props":4186,"children":4188},{"className":4187},[],[4189],{"type":26,"value":4190},"i",{"type":26,"value":4192}," when the true state was ",{"type":21,"tag":2073,"props":4194,"children":4196},{"className":4195},[],[4197],{"type":26,"value":4198},"j",{"type":26,"value":4200},". Your observed distribution is ",{"type":21,"tag":2073,"props":4202,"children":4204},{"className":4203},[],[4205],{"type":26,"value":4206},"M @ p_true",{"type":26,"value":4208},", so apply the pseudo-inverse.",{"type":21,"tag":2304,"props":4210,"children":4212},{"code":4211,"language":3147,"meta":7,"className":3145,"style":7},"import numpy as np\nfrom qiskit import QuantumCircuit, transpile\nfrom qiskit_aer import AerSimulator\nfrom qiskit_aer.noise import NoiseModel, depolarizing_error, ReadoutError\n\ndef build_noise(p1=0.002, p2=0.02, p_read=0.05):\n    nm = NoiseModel()\n    nm.add_all_qubit_quantum_error(depolarizing_error(p1, 1), [\"rz\", \"sx\", \"x\", \"h\"])\n    nm.add_all_qubit_quantum_error(depolarizing_error(p2, 2), [\"cx\", \"cz\", \"ecr\"])\n    nm.add_all_qubit_readout_error(\n        ReadoutError([[1 - p_read, p_read], [p_read, 1 - p_read]])\n    )\n    return nm\n\nbackend = AerSimulator(noise_model=build_noise())\nSHOTS = 40000\n\ndef calibration_matrix(n, backend, shots=20000):\n    M = np.zeros((2**n, 2**n))\n    for i in range(2**n):\n        qc = QuantumCircuit(n, n)\n        bits = format(i, f\"0{n}b\")[::-1]      # Qiskit is little-endian\n        for q, b in enumerate(bits):\n            if b == \"1\":\n                qc.x(q)\n        qc.measure(range(n), range(n))\n        counts = backend.run(transpile(qc, backend), shots=shots).result().get_counts()\n        for key, v in counts.items():\n            M[int(key, 2), i] = v \u002F shots\n    return M\n\nn = 2\nMinv = np.linalg.pinv(calibration_matrix(n, backend))\n\nbell = QuantumCircuit(2, 2)\nbell.h(0)\nbell.cx(0, 1)\nbell.measure([0, 1], [0, 1])\n\nraw = backend.run(transpile(bell, backend), shots=SHOTS).result().get_counts()\nvec = np.array([raw.get(format(i, f\"0{n}b\"), 0) for i in range(2**n)], float) \u002F SHOTS\n\nmit = np.clip(Minv @ vec, 0, None)\nmit \u002F= mit.sum()\n\nprint(\"raw      :\", {format(i, \"02b\"): round(vec[i], 4) for i in range(4)})\nprint(\"mitigated:\", {format(i, \"02b\"): round(mit[i], 4) for i in range(4)})\n",[4213],{"type":21,"tag":2073,"props":4214,"children":4215},{"__ignoreMap":7},[4216,4238,4259,4280,4301,4308,4369,4386,4439,4482,4490,4525,4533,4546,4553,4583,4602,4610,4641,4686,4725,4743,4817,4845,4874,4883,4911,4942,4964,5010,5023,5031,5049,5067,5075,5109,5127,5152,5194,5202,5237,5353,5361,5406,5424,5432,5520],{"type":21,"tag":2314,"props":4217,"children":4218},{"class":2316,"line":2317},[4219,4223,4228,4233],{"type":21,"tag":2314,"props":4220,"children":4221},{"style":3157},[4222],{"type":26,"value":3170},{"type":21,"tag":2314,"props":4224,"children":4225},{"style":2321},[4226],{"type":26,"value":4227}," numpy ",{"type":21,"tag":2314,"props":4229,"children":4230},{"style":3157},[4231],{"type":26,"value":4232},"as",{"type":21,"tag":2314,"props":4234,"children":4235},{"style":2321},[4236],{"type":26,"value":4237}," np\n",{"type":21,"tag":2314,"props":4239,"children":4240},{"class":2316,"line":106},[4241,4245,4250,4254],{"type":21,"tag":2314,"props":4242,"children":4243},{"style":3157},[4244],{"type":26,"value":3160},{"type":21,"tag":2314,"props":4246,"children":4247},{"style":2321},[4248],{"type":26,"value":4249}," qiskit ",{"type":21,"tag":2314,"props":4251,"children":4252},{"style":3157},[4253],{"type":26,"value":3170},{"type":21,"tag":2314,"props":4255,"children":4256},{"style":2321},[4257],{"type":26,"value":4258}," QuantumCircuit, transpile\n",{"type":21,"tag":2314,"props":4260,"children":4261},{"class":2316,"line":2335},[4262,4266,4271,4275],{"type":21,"tag":2314,"props":4263,"children":4264},{"style":3157},[4265],{"type":26,"value":3160},{"type":21,"tag":2314,"props":4267,"children":4268},{"style":2321},[4269],{"type":26,"value":4270}," qiskit_aer ",{"type":21,"tag":2314,"props":4272,"children":4273},{"style":3157},[4274],{"type":26,"value":3170},{"type":21,"tag":2314,"props":4276,"children":4277},{"style":2321},[4278],{"type":26,"value":4279}," AerSimulator\n",{"type":21,"tag":2314,"props":4281,"children":4282},{"class":2316,"line":2397},[4283,4287,4292,4296],{"type":21,"tag":2314,"props":4284,"children":4285},{"style":3157},[4286],{"type":26,"value":3160},{"type":21,"tag":2314,"props":4288,"children":4289},{"style":2321},[4290],{"type":26,"value":4291}," qiskit_aer.noise ",{"type":21,"tag":2314,"props":4293,"children":4294},{"style":3157},[4295],{"type":26,"value":3170},{"type":21,"tag":2314,"props":4297,"children":4298},{"style":2321},[4299],{"type":26,"value":4300}," NoiseModel, depolarizing_error, ReadoutError\n",{"type":21,"tag":2314,"props":4302,"children":4303},{"class":2316,"line":2421},[4304],{"type":21,"tag":2314,"props":4305,"children":4306},{"emptyLinePlaceholder":3181},[4307],{"type":26,"value":3184},{"type":21,"tag":2314,"props":4309,"children":4310},{"class":2316,"line":16},[4311,4316,4322,4327,4331,4336,4341,4345,4350,4355,4359,4364],{"type":21,"tag":2314,"props":4312,"children":4313},{"style":3157},[4314],{"type":26,"value":4315},"def",{"type":21,"tag":2314,"props":4317,"children":4319},{"style":4318},"--shiki-default:#B392F0",[4320],{"type":26,"value":4321}," build_noise",{"type":21,"tag":2314,"props":4323,"children":4324},{"style":2321},[4325],{"type":26,"value":4326},"(p1",{"type":21,"tag":2314,"props":4328,"children":4329},{"style":3157},[4330],{"type":26,"value":3197},{"type":21,"tag":2314,"props":4332,"children":4333},{"style":2339},[4334],{"type":26,"value":4335},"0.002",{"type":21,"tag":2314,"props":4337,"children":4338},{"style":2321},[4339],{"type":26,"value":4340},", p2",{"type":21,"tag":2314,"props":4342,"children":4343},{"style":3157},[4344],{"type":26,"value":3197},{"type":21,"tag":2314,"props":4346,"children":4347},{"style":2339},[4348],{"type":26,"value":4349},"0.02",{"type":21,"tag":2314,"props":4351,"children":4352},{"style":2321},[4353],{"type":26,"value":4354},", p_read",{"type":21,"tag":2314,"props":4356,"children":4357},{"style":3157},[4358],{"type":26,"value":3197},{"type":21,"tag":2314,"props":4360,"children":4361},{"style":2339},[4362],{"type":26,"value":4363},"0.05",{"type":21,"tag":2314,"props":4365,"children":4366},{"style":2321},[4367],{"type":26,"value":4368},"):\n",{"type":21,"tag":2314,"props":4370,"children":4371},{"class":2316,"line":127},[4372,4377,4381],{"type":21,"tag":2314,"props":4373,"children":4374},{"style":2321},[4375],{"type":26,"value":4376},"    nm ",{"type":21,"tag":2314,"props":4378,"children":4379},{"style":3157},[4380],{"type":26,"value":3197},{"type":21,"tag":2314,"props":4382,"children":4383},{"style":2321},[4384],{"type":26,"value":4385}," NoiseModel()\n",{"type":21,"tag":2314,"props":4387,"children":4388},{"class":2316,"line":887},[4389,4394,4398,4403,4408,4412,4417,4421,4426,4430,4435],{"type":21,"tag":2314,"props":4390,"children":4391},{"style":2321},[4392],{"type":26,"value":4393},"    nm.add_all_qubit_quantum_error(depolarizing_error(p1, ",{"type":21,"tag":2314,"props":4395,"children":4396},{"style":2339},[4397],{"type":26,"value":3513},{"type":21,"tag":2314,"props":4399,"children":4400},{"style":2321},[4401],{"type":26,"value":4402},"), [",{"type":21,"tag":2314,"props":4404,"children":4405},{"style":2350},[4406],{"type":26,"value":4407},"\"rz\"",{"type":21,"tag":2314,"props":4409,"children":4410},{"style":2321},[4411],{"type":26,"value":1309},{"type":21,"tag":2314,"props":4413,"children":4414},{"style":2350},[4415],{"type":26,"value":4416},"\"sx\"",{"type":21,"tag":2314,"props":4418,"children":4419},{"style":2321},[4420],{"type":26,"value":1309},{"type":21,"tag":2314,"props":4422,"children":4423},{"style":2350},[4424],{"type":26,"value":4425},"\"x\"",{"type":21,"tag":2314,"props":4427,"children":4428},{"style":2321},[4429],{"type":26,"value":1309},{"type":21,"tag":2314,"props":4431,"children":4432},{"style":2350},[4433],{"type":26,"value":4434},"\"h\"",{"type":21,"tag":2314,"props":4436,"children":4437},{"style":2321},[4438],{"type":26,"value":3518},{"type":21,"tag":2314,"props":4440,"children":4441},{"class":2316,"line":1364},[4442,4447,4451,4455,4460,4464,4469,4473,4478],{"type":21,"tag":2314,"props":4443,"children":4444},{"style":2321},[4445],{"type":26,"value":4446},"    nm.add_all_qubit_quantum_error(depolarizing_error(p2, ",{"type":21,"tag":2314,"props":4448,"children":4449},{"style":2339},[4450],{"type":26,"value":2413},{"type":21,"tag":2314,"props":4452,"children":4453},{"style":2321},[4454],{"type":26,"value":4402},{"type":21,"tag":2314,"props":4456,"children":4457},{"style":2350},[4458],{"type":26,"value":4459},"\"cx\"",{"type":21,"tag":2314,"props":4461,"children":4462},{"style":2321},[4463],{"type":26,"value":1309},{"type":21,"tag":2314,"props":4465,"children":4466},{"style":2350},[4467],{"type":26,"value":4468},"\"cz\"",{"type":21,"tag":2314,"props":4470,"children":4471},{"style":2321},[4472],{"type":26,"value":1309},{"type":21,"tag":2314,"props":4474,"children":4475},{"style":2350},[4476],{"type":26,"value":4477},"\"ecr\"",{"type":21,"tag":2314,"props":4479,"children":4480},{"style":2321},[4481],{"type":26,"value":3518},{"type":21,"tag":2314,"props":4483,"children":4484},{"class":2316,"line":3403},[4485],{"type":21,"tag":2314,"props":4486,"children":4487},{"style":2321},[4488],{"type":26,"value":4489},"    nm.add_all_qubit_readout_error(\n",{"type":21,"tag":2314,"props":4491,"children":4492},{"class":2316,"line":3413},[4493,4498,4502,4507,4512,4516,4520],{"type":21,"tag":2314,"props":4494,"children":4495},{"style":2321},[4496],{"type":26,"value":4497},"        ReadoutError([[",{"type":21,"tag":2314,"props":4499,"children":4500},{"style":2339},[4501],{"type":26,"value":3513},{"type":21,"tag":2314,"props":4503,"children":4504},{"style":3157},[4505],{"type":26,"value":4506}," -",{"type":21,"tag":2314,"props":4508,"children":4509},{"style":2321},[4510],{"type":26,"value":4511}," p_read, p_read], [p_read, ",{"type":21,"tag":2314,"props":4513,"children":4514},{"style":2339},[4515],{"type":26,"value":3513},{"type":21,"tag":2314,"props":4517,"children":4518},{"style":3157},[4519],{"type":26,"value":4506},{"type":21,"tag":2314,"props":4521,"children":4522},{"style":2321},[4523],{"type":26,"value":4524}," p_read]])\n",{"type":21,"tag":2314,"props":4526,"children":4527},{"class":2316,"line":436},[4528],{"type":21,"tag":2314,"props":4529,"children":4530},{"style":2321},[4531],{"type":26,"value":4532},"    )\n",{"type":21,"tag":2314,"props":4534,"children":4535},{"class":2316,"line":3473},[4536,4541],{"type":21,"tag":2314,"props":4537,"children":4538},{"style":3157},[4539],{"type":26,"value":4540},"    return",{"type":21,"tag":2314,"props":4542,"children":4543},{"style":2321},[4544],{"type":26,"value":4545}," nm\n",{"type":21,"tag":2314,"props":4547,"children":4548},{"class":2316,"line":3521},[4549],{"type":21,"tag":2314,"props":4550,"children":4551},{"emptyLinePlaceholder":3181},[4552],{"type":26,"value":3184},{"type":21,"tag":2314,"props":4554,"children":4555},{"class":2316,"line":3563},[4556,4560,4564,4569,4574,4578],{"type":21,"tag":2314,"props":4557,"children":4558},{"style":2321},[4559],{"type":26,"value":3210},{"type":21,"tag":2314,"props":4561,"children":4562},{"style":3157},[4563],{"type":26,"value":3197},{"type":21,"tag":2314,"props":4565,"children":4566},{"style":2321},[4567],{"type":26,"value":4568}," AerSimulator(",{"type":21,"tag":2314,"props":4570,"children":4571},{"style":3222},[4572],{"type":26,"value":4573},"noise_model",{"type":21,"tag":2314,"props":4575,"children":4576},{"style":3157},[4577],{"type":26,"value":3197},{"type":21,"tag":2314,"props":4579,"children":4580},{"style":2321},[4581],{"type":26,"value":4582},"build_noise())\n",{"type":21,"tag":2314,"props":4584,"children":4586},{"class":2316,"line":4585},16,[4587,4592,4597],{"type":21,"tag":2314,"props":4588,"children":4589},{"style":2339},[4590],{"type":26,"value":4591},"SHOTS",{"type":21,"tag":2314,"props":4593,"children":4594},{"style":3157},[4595],{"type":26,"value":4596}," =",{"type":21,"tag":2314,"props":4598,"children":4599},{"style":2339},[4600],{"type":26,"value":4601}," 40000\n",{"type":21,"tag":2314,"props":4603,"children":4605},{"class":2316,"line":4604},17,[4606],{"type":21,"tag":2314,"props":4607,"children":4608},{"emptyLinePlaceholder":3181},[4609],{"type":26,"value":3184},{"type":21,"tag":2314,"props":4611,"children":4613},{"class":2316,"line":4612},18,[4614,4618,4623,4628,4632,4637],{"type":21,"tag":2314,"props":4615,"children":4616},{"style":3157},[4617],{"type":26,"value":4315},{"type":21,"tag":2314,"props":4619,"children":4620},{"style":4318},[4621],{"type":26,"value":4622}," calibration_matrix",{"type":21,"tag":2314,"props":4624,"children":4625},{"style":2321},[4626],{"type":26,"value":4627},"(n, backend, shots",{"type":21,"tag":2314,"props":4629,"children":4630},{"style":3157},[4631],{"type":26,"value":3197},{"type":21,"tag":2314,"props":4633,"children":4634},{"style":2339},[4635],{"type":26,"value":4636},"20000",{"type":21,"tag":2314,"props":4638,"children":4639},{"style":2321},[4640],{"type":26,"value":4368},{"type":21,"tag":2314,"props":4642,"children":4644},{"class":2316,"line":4643},19,[4645,4650,4654,4659,4663,4668,4673,4677,4681],{"type":21,"tag":2314,"props":4646,"children":4647},{"style":2321},[4648],{"type":26,"value":4649},"    M ",{"type":21,"tag":2314,"props":4651,"children":4652},{"style":3157},[4653],{"type":26,"value":3197},{"type":21,"tag":2314,"props":4655,"children":4656},{"style":2321},[4657],{"type":26,"value":4658}," np.zeros((",{"type":21,"tag":2314,"props":4660,"children":4661},{"style":2339},[4662],{"type":26,"value":2413},{"type":21,"tag":2314,"props":4664,"children":4665},{"style":3157},[4666],{"type":26,"value":4667},"**",{"type":21,"tag":2314,"props":4669,"children":4670},{"style":2321},[4671],{"type":26,"value":4672},"n, ",{"type":21,"tag":2314,"props":4674,"children":4675},{"style":2339},[4676],{"type":26,"value":2413},{"type":21,"tag":2314,"props":4678,"children":4679},{"style":3157},[4680],{"type":26,"value":4667},{"type":21,"tag":2314,"props":4682,"children":4683},{"style":2321},[4684],{"type":26,"value":4685},"n))\n",{"type":21,"tag":2314,"props":4687,"children":4689},{"class":2316,"line":4688},20,[4690,4695,4700,4704,4708,4712,4716,4720],{"type":21,"tag":2314,"props":4691,"children":4692},{"style":3157},[4693],{"type":26,"value":4694},"    for",{"type":21,"tag":2314,"props":4696,"children":4697},{"style":2321},[4698],{"type":26,"value":4699}," i ",{"type":21,"tag":2314,"props":4701,"children":4702},{"style":3157},[4703],{"type":26,"value":3460},{"type":21,"tag":2314,"props":4705,"children":4706},{"style":2339},[4707],{"type":26,"value":3465},{"type":21,"tag":2314,"props":4709,"children":4710},{"style":2321},[4711],{"type":26,"value":3277},{"type":21,"tag":2314,"props":4713,"children":4714},{"style":2339},[4715],{"type":26,"value":2413},{"type":21,"tag":2314,"props":4717,"children":4718},{"style":3157},[4719],{"type":26,"value":4667},{"type":21,"tag":2314,"props":4721,"children":4722},{"style":2321},[4723],{"type":26,"value":4724},"n):\n",{"type":21,"tag":2314,"props":4726,"children":4728},{"class":2316,"line":4727},21,[4729,4734,4738],{"type":21,"tag":2314,"props":4730,"children":4731},{"style":2321},[4732],{"type":26,"value":4733},"        qc ",{"type":21,"tag":2314,"props":4735,"children":4736},{"style":3157},[4737],{"type":26,"value":3197},{"type":21,"tag":2314,"props":4739,"children":4740},{"style":2321},[4741],{"type":26,"value":4742}," QuantumCircuit(n, n)\n",{"type":21,"tag":2314,"props":4744,"children":4746},{"class":2316,"line":4745},22,[4747,4752,4756,4761,4766,4770,4775,4779,4784,4788,4793,4798,4803,4807,4812],{"type":21,"tag":2314,"props":4748,"children":4749},{"style":2321},[4750],{"type":26,"value":4751},"        bits ",{"type":21,"tag":2314,"props":4753,"children":4754},{"style":3157},[4755],{"type":26,"value":3197},{"type":21,"tag":2314,"props":4757,"children":4758},{"style":2339},[4759],{"type":26,"value":4760}," format",{"type":21,"tag":2314,"props":4762,"children":4763},{"style":2321},[4764],{"type":26,"value":4765},"(i, ",{"type":21,"tag":2314,"props":4767,"children":4768},{"style":3157},[4769],{"type":26,"value":3282},{"type":21,"tag":2314,"props":4771,"children":4772},{"style":2350},[4773],{"type":26,"value":4774},"\"0",{"type":21,"tag":2314,"props":4776,"children":4777},{"style":2339},[4778],{"type":26,"value":3292},{"type":21,"tag":2314,"props":4780,"children":4781},{"style":2321},[4782],{"type":26,"value":4783},"n",{"type":21,"tag":2314,"props":4785,"children":4786},{"style":2339},[4787],{"type":26,"value":3302},{"type":21,"tag":2314,"props":4789,"children":4790},{"style":2350},[4791],{"type":26,"value":4792},"b\"",{"type":21,"tag":2314,"props":4794,"children":4795},{"style":2321},[4796],{"type":26,"value":4797},")[::",{"type":21,"tag":2314,"props":4799,"children":4800},{"style":3157},[4801],{"type":26,"value":4802},"-",{"type":21,"tag":2314,"props":4804,"children":4805},{"style":2339},[4806],{"type":26,"value":3513},{"type":21,"tag":2314,"props":4808,"children":4809},{"style":2321},[4810],{"type":26,"value":4811},"]      ",{"type":21,"tag":2314,"props":4813,"children":4814},{"style":3407},[4815],{"type":26,"value":4816},"# Qiskit is little-endian\n",{"type":21,"tag":2314,"props":4818,"children":4820},{"class":2316,"line":4819},23,[4821,4826,4831,4835,4840],{"type":21,"tag":2314,"props":4822,"children":4823},{"style":3157},[4824],{"type":26,"value":4825},"        for",{"type":21,"tag":2314,"props":4827,"children":4828},{"style":2321},[4829],{"type":26,"value":4830}," q, b ",{"type":21,"tag":2314,"props":4832,"children":4833},{"style":3157},[4834],{"type":26,"value":3460},{"type":21,"tag":2314,"props":4836,"children":4837},{"style":2339},[4838],{"type":26,"value":4839}," enumerate",{"type":21,"tag":2314,"props":4841,"children":4842},{"style":2321},[4843],{"type":26,"value":4844},"(bits):\n",{"type":21,"tag":2314,"props":4846,"children":4848},{"class":2316,"line":4847},24,[4849,4854,4859,4864,4869],{"type":21,"tag":2314,"props":4850,"children":4851},{"style":3157},[4852],{"type":26,"value":4853},"            if",{"type":21,"tag":2314,"props":4855,"children":4856},{"style":2321},[4857],{"type":26,"value":4858}," b ",{"type":21,"tag":2314,"props":4860,"children":4861},{"style":3157},[4862],{"type":26,"value":4863},"==",{"type":21,"tag":2314,"props":4865,"children":4866},{"style":2350},[4867],{"type":26,"value":4868}," \"1\"",{"type":21,"tag":2314,"props":4870,"children":4871},{"style":2321},[4872],{"type":26,"value":4873},":\n",{"type":21,"tag":2314,"props":4875,"children":4877},{"class":2316,"line":4876},25,[4878],{"type":21,"tag":2314,"props":4879,"children":4880},{"style":2321},[4881],{"type":26,"value":4882},"                qc.x(q)\n",{"type":21,"tag":2314,"props":4884,"children":4886},{"class":2316,"line":4885},26,[4887,4892,4897,4902,4906],{"type":21,"tag":2314,"props":4888,"children":4889},{"style":2321},[4890],{"type":26,"value":4891},"        qc.measure(",{"type":21,"tag":2314,"props":4893,"children":4894},{"style":2339},[4895],{"type":26,"value":4896},"range",{"type":21,"tag":2314,"props":4898,"children":4899},{"style":2321},[4900],{"type":26,"value":4901},"(n), ",{"type":21,"tag":2314,"props":4903,"children":4904},{"style":2339},[4905],{"type":26,"value":4896},{"type":21,"tag":2314,"props":4907,"children":4908},{"style":2321},[4909],{"type":26,"value":4910},"(n))\n",{"type":21,"tag":2314,"props":4912,"children":4914},{"class":2316,"line":4913},27,[4915,4920,4924,4929,4933,4937],{"type":21,"tag":2314,"props":4916,"children":4917},{"style":2321},[4918],{"type":26,"value":4919},"        counts ",{"type":21,"tag":2314,"props":4921,"children":4922},{"style":3157},[4923],{"type":26,"value":3197},{"type":21,"tag":2314,"props":4925,"children":4926},{"style":2321},[4927],{"type":26,"value":4928}," backend.run(transpile(qc, backend), ",{"type":21,"tag":2314,"props":4930,"children":4931},{"style":3222},[4932],{"type":26,"value":4077},{"type":21,"tag":2314,"props":4934,"children":4935},{"style":3157},[4936],{"type":26,"value":3197},{"type":21,"tag":2314,"props":4938,"children":4939},{"style":2321},[4940],{"type":26,"value":4941},"shots).result().get_counts()\n",{"type":21,"tag":2314,"props":4943,"children":4945},{"class":2316,"line":4944},28,[4946,4950,4955,4959],{"type":21,"tag":2314,"props":4947,"children":4948},{"style":3157},[4949],{"type":26,"value":4825},{"type":21,"tag":2314,"props":4951,"children":4952},{"style":2321},[4953],{"type":26,"value":4954}," key, v ",{"type":21,"tag":2314,"props":4956,"children":4957},{"style":3157},[4958],{"type":26,"value":3460},{"type":21,"tag":2314,"props":4960,"children":4961},{"style":2321},[4962],{"type":26,"value":4963}," counts.items():\n",{"type":21,"tag":2314,"props":4965,"children":4967},{"class":2316,"line":4966},29,[4968,4973,4978,4983,4987,4992,4996,5001,5005],{"type":21,"tag":2314,"props":4969,"children":4970},{"style":2321},[4971],{"type":26,"value":4972},"            M[",{"type":21,"tag":2314,"props":4974,"children":4975},{"style":2339},[4976],{"type":26,"value":4977},"int",{"type":21,"tag":2314,"props":4979,"children":4980},{"style":2321},[4981],{"type":26,"value":4982},"(key, ",{"type":21,"tag":2314,"props":4984,"children":4985},{"style":2339},[4986],{"type":26,"value":2413},{"type":21,"tag":2314,"props":4988,"children":4989},{"style":2321},[4990],{"type":26,"value":4991},"), i] ",{"type":21,"tag":2314,"props":4993,"children":4994},{"style":3157},[4995],{"type":26,"value":3197},{"type":21,"tag":2314,"props":4997,"children":4998},{"style":2321},[4999],{"type":26,"value":5000}," v ",{"type":21,"tag":2314,"props":5002,"children":5003},{"style":3157},[5004],{"type":26,"value":2168},{"type":21,"tag":2314,"props":5006,"children":5007},{"style":2321},[5008],{"type":26,"value":5009}," shots\n",{"type":21,"tag":2314,"props":5011,"children":5013},{"class":2316,"line":5012},30,[5014,5018],{"type":21,"tag":2314,"props":5015,"children":5016},{"style":3157},[5017],{"type":26,"value":4540},{"type":21,"tag":2314,"props":5019,"children":5020},{"style":2321},[5021],{"type":26,"value":5022}," M\n",{"type":21,"tag":2314,"props":5024,"children":5026},{"class":2316,"line":5025},31,[5027],{"type":21,"tag":2314,"props":5028,"children":5029},{"emptyLinePlaceholder":3181},[5030],{"type":26,"value":3184},{"type":21,"tag":2314,"props":5032,"children":5034},{"class":2316,"line":5033},32,[5035,5040,5044],{"type":21,"tag":2314,"props":5036,"children":5037},{"style":2321},[5038],{"type":26,"value":5039},"n ",{"type":21,"tag":2314,"props":5041,"children":5042},{"style":3157},[5043],{"type":26,"value":3197},{"type":21,"tag":2314,"props":5045,"children":5046},{"style":2339},[5047],{"type":26,"value":5048}," 2\n",{"type":21,"tag":2314,"props":5050,"children":5052},{"class":2316,"line":5051},33,[5053,5058,5062],{"type":21,"tag":2314,"props":5054,"children":5055},{"style":2321},[5056],{"type":26,"value":5057},"Minv ",{"type":21,"tag":2314,"props":5059,"children":5060},{"style":3157},[5061],{"type":26,"value":3197},{"type":21,"tag":2314,"props":5063,"children":5064},{"style":2321},[5065],{"type":26,"value":5066}," np.linalg.pinv(calibration_matrix(n, backend))\n",{"type":21,"tag":2314,"props":5068,"children":5070},{"class":2316,"line":5069},34,[5071],{"type":21,"tag":2314,"props":5072,"children":5073},{"emptyLinePlaceholder":3181},[5074],{"type":26,"value":3184},{"type":21,"tag":2314,"props":5076,"children":5078},{"class":2316,"line":5077},35,[5079,5084,5088,5093,5097,5101,5105],{"type":21,"tag":2314,"props":5080,"children":5081},{"style":2321},[5082],{"type":26,"value":5083},"bell ",{"type":21,"tag":2314,"props":5085,"children":5086},{"style":3157},[5087],{"type":26,"value":3197},{"type":21,"tag":2314,"props":5089,"children":5090},{"style":2321},[5091],{"type":26,"value":5092}," QuantumCircuit(",{"type":21,"tag":2314,"props":5094,"children":5095},{"style":2339},[5096],{"type":26,"value":2413},{"type":21,"tag":2314,"props":5098,"children":5099},{"style":2321},[5100],{"type":26,"value":1309},{"type":21,"tag":2314,"props":5102,"children":5103},{"style":2339},[5104],{"type":26,"value":2413},{"type":21,"tag":2314,"props":5106,"children":5107},{"style":2321},[5108],{"type":26,"value":3257},{"type":21,"tag":2314,"props":5110,"children":5112},{"class":2316,"line":5111},36,[5113,5118,5123],{"type":21,"tag":2314,"props":5114,"children":5115},{"style":2321},[5116],{"type":26,"value":5117},"bell.h(",{"type":21,"tag":2314,"props":5119,"children":5120},{"style":2339},[5121],{"type":26,"value":5122},"0",{"type":21,"tag":2314,"props":5124,"children":5125},{"style":2321},[5126],{"type":26,"value":3257},{"type":21,"tag":2314,"props":5128,"children":5130},{"class":2316,"line":5129},37,[5131,5136,5140,5144,5148],{"type":21,"tag":2314,"props":5132,"children":5133},{"style":2321},[5134],{"type":26,"value":5135},"bell.cx(",{"type":21,"tag":2314,"props":5137,"children":5138},{"style":2339},[5139],{"type":26,"value":5122},{"type":21,"tag":2314,"props":5141,"children":5142},{"style":2321},[5143],{"type":26,"value":1309},{"type":21,"tag":2314,"props":5145,"children":5146},{"style":2339},[5147],{"type":26,"value":3513},{"type":21,"tag":2314,"props":5149,"children":5150},{"style":2321},[5151],{"type":26,"value":3257},{"type":21,"tag":2314,"props":5153,"children":5155},{"class":2316,"line":5154},38,[5156,5161,5165,5169,5173,5178,5182,5186,5190],{"type":21,"tag":2314,"props":5157,"children":5158},{"style":2321},[5159],{"type":26,"value":5160},"bell.measure([",{"type":21,"tag":2314,"props":5162,"children":5163},{"style":2339},[5164],{"type":26,"value":5122},{"type":21,"tag":2314,"props":5166,"children":5167},{"style":2321},[5168],{"type":26,"value":1309},{"type":21,"tag":2314,"props":5170,"children":5171},{"style":2339},[5172],{"type":26,"value":3513},{"type":21,"tag":2314,"props":5174,"children":5175},{"style":2321},[5176],{"type":26,"value":5177},"], [",{"type":21,"tag":2314,"props":5179,"children":5180},{"style":2339},[5181],{"type":26,"value":5122},{"type":21,"tag":2314,"props":5183,"children":5184},{"style":2321},[5185],{"type":26,"value":1309},{"type":21,"tag":2314,"props":5187,"children":5188},{"style":2339},[5189],{"type":26,"value":3513},{"type":21,"tag":2314,"props":5191,"children":5192},{"style":2321},[5193],{"type":26,"value":3518},{"type":21,"tag":2314,"props":5195,"children":5197},{"class":2316,"line":5196},39,[5198],{"type":21,"tag":2314,"props":5199,"children":5200},{"emptyLinePlaceholder":3181},[5201],{"type":26,"value":3184},{"type":21,"tag":2314,"props":5203,"children":5205},{"class":2316,"line":5204},40,[5206,5211,5215,5220,5224,5228,5232],{"type":21,"tag":2314,"props":5207,"children":5208},{"style":2321},[5209],{"type":26,"value":5210},"raw ",{"type":21,"tag":2314,"props":5212,"children":5213},{"style":3157},[5214],{"type":26,"value":3197},{"type":21,"tag":2314,"props":5216,"children":5217},{"style":2321},[5218],{"type":26,"value":5219}," backend.run(transpile(bell, backend), ",{"type":21,"tag":2314,"props":5221,"children":5222},{"style":3222},[5223],{"type":26,"value":4077},{"type":21,"tag":2314,"props":5225,"children":5226},{"style":3157},[5227],{"type":26,"value":3197},{"type":21,"tag":2314,"props":5229,"children":5230},{"style":2339},[5231],{"type":26,"value":4591},{"type":21,"tag":2314,"props":5233,"children":5234},{"style":2321},[5235],{"type":26,"value":5236},").result().get_counts()\n",{"type":21,"tag":2314,"props":5238,"children":5240},{"class":2316,"line":5239},41,[5241,5246,5250,5255,5260,5264,5268,5272,5276,5280,5284,5288,5293,5297,5302,5306,5310,5314,5318,5322,5326,5330,5335,5340,5344,5348],{"type":21,"tag":2314,"props":5242,"children":5243},{"style":2321},[5244],{"type":26,"value":5245},"vec ",{"type":21,"tag":2314,"props":5247,"children":5248},{"style":3157},[5249],{"type":26,"value":3197},{"type":21,"tag":2314,"props":5251,"children":5252},{"style":2321},[5253],{"type":26,"value":5254}," np.array([raw.get(",{"type":21,"tag":2314,"props":5256,"children":5257},{"style":2339},[5258],{"type":26,"value":5259},"format",{"type":21,"tag":2314,"props":5261,"children":5262},{"style":2321},[5263],{"type":26,"value":4765},{"type":21,"tag":2314,"props":5265,"children":5266},{"style":3157},[5267],{"type":26,"value":3282},{"type":21,"tag":2314,"props":5269,"children":5270},{"style":2350},[5271],{"type":26,"value":4774},{"type":21,"tag":2314,"props":5273,"children":5274},{"style":2339},[5275],{"type":26,"value":3292},{"type":21,"tag":2314,"props":5277,"children":5278},{"style":2321},[5279],{"type":26,"value":4783},{"type":21,"tag":2314,"props":5281,"children":5282},{"style":2339},[5283],{"type":26,"value":3302},{"type":21,"tag":2314,"props":5285,"children":5286},{"style":2350},[5287],{"type":26,"value":4792},{"type":21,"tag":2314,"props":5289,"children":5290},{"style":2321},[5291],{"type":26,"value":5292},"), ",{"type":21,"tag":2314,"props":5294,"children":5295},{"style":2339},[5296],{"type":26,"value":5122},{"type":21,"tag":2314,"props":5298,"children":5299},{"style":2321},[5300],{"type":26,"value":5301},") ",{"type":21,"tag":2314,"props":5303,"children":5304},{"style":3157},[5305],{"type":26,"value":3450},{"type":21,"tag":2314,"props":5307,"children":5308},{"style":2321},[5309],{"type":26,"value":4699},{"type":21,"tag":2314,"props":5311,"children":5312},{"style":3157},[5313],{"type":26,"value":3460},{"type":21,"tag":2314,"props":5315,"children":5316},{"style":2339},[5317],{"type":26,"value":3465},{"type":21,"tag":2314,"props":5319,"children":5320},{"style":2321},[5321],{"type":26,"value":3277},{"type":21,"tag":2314,"props":5323,"children":5324},{"style":2339},[5325],{"type":26,"value":2413},{"type":21,"tag":2314,"props":5327,"children":5328},{"style":3157},[5329],{"type":26,"value":4667},{"type":21,"tag":2314,"props":5331,"children":5332},{"style":2321},[5333],{"type":26,"value":5334},"n)], ",{"type":21,"tag":2314,"props":5336,"children":5337},{"style":2339},[5338],{"type":26,"value":5339},"float",{"type":21,"tag":2314,"props":5341,"children":5342},{"style":2321},[5343],{"type":26,"value":5301},{"type":21,"tag":2314,"props":5345,"children":5346},{"style":3157},[5347],{"type":26,"value":2168},{"type":21,"tag":2314,"props":5349,"children":5350},{"style":2339},[5351],{"type":26,"value":5352}," SHOTS\n",{"type":21,"tag":2314,"props":5354,"children":5356},{"class":2316,"line":5355},42,[5357],{"type":21,"tag":2314,"props":5358,"children":5359},{"emptyLinePlaceholder":3181},[5360],{"type":26,"value":3184},{"type":21,"tag":2314,"props":5362,"children":5364},{"class":2316,"line":5363},43,[5365,5370,5374,5379,5384,5389,5393,5397,5402],{"type":21,"tag":2314,"props":5366,"children":5367},{"style":2321},[5368],{"type":26,"value":5369},"mit ",{"type":21,"tag":2314,"props":5371,"children":5372},{"style":3157},[5373],{"type":26,"value":3197},{"type":21,"tag":2314,"props":5375,"children":5376},{"style":2321},[5377],{"type":26,"value":5378}," np.clip(Minv ",{"type":21,"tag":2314,"props":5380,"children":5381},{"style":3157},[5382],{"type":26,"value":5383},"@",{"type":21,"tag":2314,"props":5385,"children":5386},{"style":2321},[5387],{"type":26,"value":5388}," vec, ",{"type":21,"tag":2314,"props":5390,"children":5391},{"style":2339},[5392],{"type":26,"value":5122},{"type":21,"tag":2314,"props":5394,"children":5395},{"style":2321},[5396],{"type":26,"value":1309},{"type":21,"tag":2314,"props":5398,"children":5399},{"style":2339},[5400],{"type":26,"value":5401},"None",{"type":21,"tag":2314,"props":5403,"children":5404},{"style":2321},[5405],{"type":26,"value":3257},{"type":21,"tag":2314,"props":5407,"children":5409},{"class":2316,"line":5408},44,[5410,5414,5419],{"type":21,"tag":2314,"props":5411,"children":5412},{"style":2321},[5413],{"type":26,"value":5369},{"type":21,"tag":2314,"props":5415,"children":5416},{"style":3157},[5417],{"type":26,"value":5418},"\u002F=",{"type":21,"tag":2314,"props":5420,"children":5421},{"style":2321},[5422],{"type":26,"value":5423}," mit.sum()\n",{"type":21,"tag":2314,"props":5425,"children":5427},{"class":2316,"line":5426},45,[5428],{"type":21,"tag":2314,"props":5429,"children":5430},{"emptyLinePlaceholder":3181},[5431],{"type":26,"value":3184},{"type":21,"tag":2314,"props":5433,"children":5435},{"class":2316,"line":5434},46,[5436,5440,5444,5449,5454,5458,5462,5467,5472,5477,5482,5487,5491,5495,5499,5503,5507,5511,5515],{"type":21,"tag":2314,"props":5437,"children":5438},{"style":2339},[5439],{"type":26,"value":3272},{"type":21,"tag":2314,"props":5441,"children":5442},{"style":2321},[5443],{"type":26,"value":3277},{"type":21,"tag":2314,"props":5445,"children":5446},{"style":2350},[5447],{"type":26,"value":5448},"\"raw      :\"",{"type":21,"tag":2314,"props":5450,"children":5451},{"style":2321},[5452],{"type":26,"value":5453},", {",{"type":21,"tag":2314,"props":5455,"children":5456},{"style":2339},[5457],{"type":26,"value":5259},{"type":21,"tag":2314,"props":5459,"children":5460},{"style":2321},[5461],{"type":26,"value":4765},{"type":21,"tag":2314,"props":5463,"children":5464},{"style":2350},[5465],{"type":26,"value":5466},"\"02b\"",{"type":21,"tag":2314,"props":5468,"children":5469},{"style":2321},[5470],{"type":26,"value":5471},"): ",{"type":21,"tag":2314,"props":5473,"children":5474},{"style":2339},[5475],{"type":26,"value":5476},"round",{"type":21,"tag":2314,"props":5478,"children":5479},{"style":2321},[5480],{"type":26,"value":5481},"(vec[i], ",{"type":21,"tag":2314,"props":5483,"children":5484},{"style":2339},[5485],{"type":26,"value":5486},"4",{"type":21,"tag":2314,"props":5488,"children":5489},{"style":2321},[5490],{"type":26,"value":5301},{"type":21,"tag":2314,"props":5492,"children":5493},{"style":3157},[5494],{"type":26,"value":3450},{"type":21,"tag":2314,"props":5496,"children":5497},{"style":2321},[5498],{"type":26,"value":4699},{"type":21,"tag":2314,"props":5500,"children":5501},{"style":3157},[5502],{"type":26,"value":3460},{"type":21,"tag":2314,"props":5504,"children":5505},{"style":2339},[5506],{"type":26,"value":3465},{"type":21,"tag":2314,"props":5508,"children":5509},{"style":2321},[5510],{"type":26,"value":3277},{"type":21,"tag":2314,"props":5512,"children":5513},{"style":2339},[5514],{"type":26,"value":5486},{"type":21,"tag":2314,"props":5516,"children":5517},{"style":2321},[5518],{"type":26,"value":5519},")})\n",{"type":21,"tag":2314,"props":5521,"children":5523},{"class":2316,"line":5522},47,[5524,5528,5532,5537,5541,5545,5549,5553,5557,5561,5566,5570,5574,5578,5582,5586,5590,5594,5598],{"type":21,"tag":2314,"props":5525,"children":5526},{"style":2339},[5527],{"type":26,"value":3272},{"type":21,"tag":2314,"props":5529,"children":5530},{"style":2321},[5531],{"type":26,"value":3277},{"type":21,"tag":2314,"props":5533,"children":5534},{"style":2350},[5535],{"type":26,"value":5536},"\"mitigated:\"",{"type":21,"tag":2314,"props":5538,"children":5539},{"style":2321},[5540],{"type":26,"value":5453},{"type":21,"tag":2314,"props":5542,"children":5543},{"style":2339},[5544],{"type":26,"value":5259},{"type":21,"tag":2314,"props":5546,"children":5547},{"style":2321},[5548],{"type":26,"value":4765},{"type":21,"tag":2314,"props":5550,"children":5551},{"style":2350},[5552],{"type":26,"value":5466},{"type":21,"tag":2314,"props":5554,"children":5555},{"style":2321},[5556],{"type":26,"value":5471},{"type":21,"tag":2314,"props":5558,"children":5559},{"style":2339},[5560],{"type":26,"value":5476},{"type":21,"tag":2314,"props":5562,"children":5563},{"style":2321},[5564],{"type":26,"value":5565},"(mit[i], ",{"type":21,"tag":2314,"props":5567,"children":5568},{"style":2339},[5569],{"type":26,"value":5486},{"type":21,"tag":2314,"props":5571,"children":5572},{"style":2321},[5573],{"type":26,"value":5301},{"type":21,"tag":2314,"props":5575,"children":5576},{"style":3157},[5577],{"type":26,"value":3450},{"type":21,"tag":2314,"props":5579,"children":5580},{"style":2321},[5581],{"type":26,"value":4699},{"type":21,"tag":2314,"props":5583,"children":5584},{"style":3157},[5585],{"type":26,"value":3460},{"type":21,"tag":2314,"props":5587,"children":5588},{"style":2339},[5589],{"type":26,"value":3465},{"type":21,"tag":2314,"props":5591,"children":5592},{"style":2321},[5593],{"type":26,"value":3277},{"type":21,"tag":2314,"props":5595,"children":5596},{"style":2339},[5597],{"type":26,"value":5486},{"type":21,"tag":2314,"props":5599,"children":5600},{"style":2321},[5601],{"type":26,"value":5519},{"type":21,"tag":22,"props":5603,"children":5604},{},[5605,5610],{"type":21,"tag":136,"props":5606,"children":5607},{},[5608],{"type":26,"value":5609},"Actual output from running this",{"type":26,"value":5611}," (Qiskit 2.5.0, Aer 0.17.2, 5% readout error):",{"type":21,"tag":2304,"props":5613,"children":5615},{"code":5614},"raw      : {'00': 0.4456, '01': 0.053, '10': 0.0501, '11': 0.4513}\nmitigated: {'00': 0.4931, '01': 0.0048, '10': 0.0033, '11': 0.4988}\n",[5616],{"type":21,"tag":2073,"props":5617,"children":5618},{"__ignoreMap":7},[5619],{"type":26,"value":5614},{"type":21,"tag":22,"props":5621,"children":5622},{},[5623,5625,5631,5632,5638,5640,5646],{"type":26,"value":5624},"A Bell state should produce only ",{"type":21,"tag":2073,"props":5626,"children":5628},{"className":5627},[],[5629],{"type":26,"value":5630},"00",{"type":26,"value":904},{"type":21,"tag":2073,"props":5633,"children":5635},{"className":5634},[],[5636],{"type":26,"value":5637},"11",{"type":26,"value":5639},". The raw run leaks 10.3% into forbidden outcomes. After mitigation, 0.8%. That is a 13× reduction in spurious counts for the cost of ",{"type":21,"tag":2073,"props":5641,"children":5643},{"className":5642},[],[5644],{"type":26,"value":5645},"2^n",{"type":26,"value":5647}," short calibration circuits.",{"type":21,"tag":22,"props":5649,"children":5650},{},[5651,5653,5658,5660,5666,5668,5673],{"type":26,"value":5652},"Two caveats. The ",{"type":21,"tag":2073,"props":5654,"children":5656},{"className":5655},[],[5657],{"type":26,"value":5645},{"type":26,"value":5659}," scaling means full calibration matrices die above ~10 qubits. Beyond that, use tensored (per-qubit) or correlated-subset calibration. And matrix inversion amplifies ",{"type":21,"tag":46,"props":5661,"children":5663},{"href":5662},"\u002Fglossary\u002Fshot-noise",[5664],{"type":26,"value":5665},"shot noise",{"type":26,"value":5667},", which is why the code clips negatives. Run your calibration circuits with ",{"type":21,"tag":362,"props":5669,"children":5670},{},[5671],{"type":26,"value":5672},"more",{"type":26,"value":5674}," shots than your actual experiment, not fewer.",{"type":21,"tag":29,"props":5676,"children":5678},{"id":5677},"step-2-dynamical-decoupling-nearly-free",[5679],{"type":26,"value":5680},"Step 2: Dynamical Decoupling (Nearly Free)",{"type":21,"tag":22,"props":5682,"children":5683},{},[5684,5686,5692,5694,5700],{"type":26,"value":5685},"Idle qubits are not safe qubits. While one part of your circuit executes, everything else is dephasing at its ",{"type":21,"tag":46,"props":5687,"children":5689},{"href":5688},"\u002Fglossary\u002Ft1-t2-time",[5690],{"type":26,"value":5691},"T2 rate",{"type":26,"value":5693},". Dynamical decoupling inserts pulse sequences (typically ",{"type":21,"tag":2073,"props":5695,"children":5697},{"className":5696},[],[5698],{"type":26,"value":5699},"X–delay–X–delay",{"type":26,"value":5701},") into idle windows, echoing away slow, low-frequency noise.",{"type":21,"tag":22,"props":5703,"children":5704},{},[5705,5707,5713],{"type":26,"value":5706},"In Qiskit this is a ",{"type":21,"tag":46,"props":5708,"children":5710},{"href":5709},"\u002Fglossary\u002Ftranspilation",[5711],{"type":26,"value":5712},"transpilation",{"type":26,"value":5714}," pass, not an algorithm change:",{"type":21,"tag":2304,"props":5716,"children":5718},{"code":5717,"language":3147,"meta":7,"className":3145,"style":7},"from qiskit.transpiler import PassManager\nfrom qiskit.transpiler.passes import ALAPScheduleAnalysis, PadDynamicalDecoupling\nfrom qiskit.circuit.library import XGate\n\npm = PassManager([\n    ALAPScheduleAnalysis(durations=backend.instruction_durations),\n    PadDynamicalDecoupling(\n        durations=backend.instruction_durations,\n        dd_sequence=[XGate(), XGate()],   # XX sequence\n    ),\n])\ndd_circuit = pm.run(transpiled_circuit)\n",[5719],{"type":21,"tag":2073,"props":5720,"children":5721},{"__ignoreMap":7},[5722,5743,5764,5785,5792,5809,5831,5839,5856,5878,5886,5893],{"type":21,"tag":2314,"props":5723,"children":5724},{"class":2316,"line":2317},[5725,5729,5734,5738],{"type":21,"tag":2314,"props":5726,"children":5727},{"style":3157},[5728],{"type":26,"value":3160},{"type":21,"tag":2314,"props":5730,"children":5731},{"style":2321},[5732],{"type":26,"value":5733}," qiskit.transpiler ",{"type":21,"tag":2314,"props":5735,"children":5736},{"style":3157},[5737],{"type":26,"value":3170},{"type":21,"tag":2314,"props":5739,"children":5740},{"style":2321},[5741],{"type":26,"value":5742}," PassManager\n",{"type":21,"tag":2314,"props":5744,"children":5745},{"class":2316,"line":106},[5746,5750,5755,5759],{"type":21,"tag":2314,"props":5747,"children":5748},{"style":3157},[5749],{"type":26,"value":3160},{"type":21,"tag":2314,"props":5751,"children":5752},{"style":2321},[5753],{"type":26,"value":5754}," qiskit.transpiler.passes ",{"type":21,"tag":2314,"props":5756,"children":5757},{"style":3157},[5758],{"type":26,"value":3170},{"type":21,"tag":2314,"props":5760,"children":5761},{"style":2321},[5762],{"type":26,"value":5763}," ALAPScheduleAnalysis, PadDynamicalDecoupling\n",{"type":21,"tag":2314,"props":5765,"children":5766},{"class":2316,"line":2335},[5767,5771,5776,5780],{"type":21,"tag":2314,"props":5768,"children":5769},{"style":3157},[5770],{"type":26,"value":3160},{"type":21,"tag":2314,"props":5772,"children":5773},{"style":2321},[5774],{"type":26,"value":5775}," qiskit.circuit.library ",{"type":21,"tag":2314,"props":5777,"children":5778},{"style":3157},[5779],{"type":26,"value":3170},{"type":21,"tag":2314,"props":5781,"children":5782},{"style":2321},[5783],{"type":26,"value":5784}," XGate\n",{"type":21,"tag":2314,"props":5786,"children":5787},{"class":2316,"line":2397},[5788],{"type":21,"tag":2314,"props":5789,"children":5790},{"emptyLinePlaceholder":3181},[5791],{"type":26,"value":3184},{"type":21,"tag":2314,"props":5793,"children":5794},{"class":2316,"line":2421},[5795,5800,5804],{"type":21,"tag":2314,"props":5796,"children":5797},{"style":2321},[5798],{"type":26,"value":5799},"pm ",{"type":21,"tag":2314,"props":5801,"children":5802},{"style":3157},[5803],{"type":26,"value":3197},{"type":21,"tag":2314,"props":5805,"children":5806},{"style":2321},[5807],{"type":26,"value":5808}," PassManager([\n",{"type":21,"tag":2314,"props":5810,"children":5811},{"class":2316,"line":16},[5812,5817,5822,5826],{"type":21,"tag":2314,"props":5813,"children":5814},{"style":2321},[5815],{"type":26,"value":5816},"    ALAPScheduleAnalysis(",{"type":21,"tag":2314,"props":5818,"children":5819},{"style":3222},[5820],{"type":26,"value":5821},"durations",{"type":21,"tag":2314,"props":5823,"children":5824},{"style":3157},[5825],{"type":26,"value":3197},{"type":21,"tag":2314,"props":5827,"children":5828},{"style":2321},[5829],{"type":26,"value":5830},"backend.instruction_durations),\n",{"type":21,"tag":2314,"props":5832,"children":5833},{"class":2316,"line":127},[5834],{"type":21,"tag":2314,"props":5835,"children":5836},{"style":2321},[5837],{"type":26,"value":5838},"    PadDynamicalDecoupling(\n",{"type":21,"tag":2314,"props":5840,"children":5841},{"class":2316,"line":887},[5842,5847,5851],{"type":21,"tag":2314,"props":5843,"children":5844},{"style":3222},[5845],{"type":26,"value":5846},"        durations",{"type":21,"tag":2314,"props":5848,"children":5849},{"style":3157},[5850],{"type":26,"value":3197},{"type":21,"tag":2314,"props":5852,"children":5853},{"style":2321},[5854],{"type":26,"value":5855},"backend.instruction_durations,\n",{"type":21,"tag":2314,"props":5857,"children":5858},{"class":2316,"line":1364},[5859,5864,5868,5873],{"type":21,"tag":2314,"props":5860,"children":5861},{"style":3222},[5862],{"type":26,"value":5863},"        dd_sequence",{"type":21,"tag":2314,"props":5865,"children":5866},{"style":3157},[5867],{"type":26,"value":3197},{"type":21,"tag":2314,"props":5869,"children":5870},{"style":2321},[5871],{"type":26,"value":5872},"[XGate(), XGate()],   ",{"type":21,"tag":2314,"props":5874,"children":5875},{"style":3407},[5876],{"type":26,"value":5877},"# XX sequence\n",{"type":21,"tag":2314,"props":5879,"children":5880},{"class":2316,"line":3403},[5881],{"type":21,"tag":2314,"props":5882,"children":5883},{"style":2321},[5884],{"type":26,"value":5885},"    ),\n",{"type":21,"tag":2314,"props":5887,"children":5888},{"class":2316,"line":3413},[5889],{"type":21,"tag":2314,"props":5890,"children":5891},{"style":2321},[5892],{"type":26,"value":3518},{"type":21,"tag":2314,"props":5894,"children":5895},{"class":2316,"line":436},[5896,5901,5905],{"type":21,"tag":2314,"props":5897,"children":5898},{"style":2321},[5899],{"type":26,"value":5900},"dd_circuit ",{"type":21,"tag":2314,"props":5902,"children":5903},{"style":3157},[5904],{"type":26,"value":3197},{"type":21,"tag":2314,"props":5906,"children":5907},{"style":2321},[5908],{"type":26,"value":5909}," pm.run(transpiled_circuit)\n",{"type":21,"tag":22,"props":5911,"children":5912},{},[5913],{"type":26,"value":5914},"Cost: zero extra shots. Typical gain: 5–20% fidelity improvement on circuits with heterogeneous qubit usage. Circuits where every qubit is busy every cycle see nothing. Try it. It's the best effort-to-payoff ratio in the whole toolkit.",{"type":21,"tag":29,"props":5916,"children":5918},{"id":5917},"step-3-pauli-twirling-randomized-compiling",[5919],{"type":26,"value":5920},"Step 3: Pauli Twirling \u002F Randomized Compiling",{"type":21,"tag":22,"props":5922,"children":5923},{},[5924,5926,5931],{"type":26,"value":5925},"Coherent errors are the nasty kind. A systematic over-rotation of 0.5° per gate doesn't average out. It accumulates ",{"type":21,"tag":362,"props":5927,"children":5928},{},[5929],{"type":26,"value":5930},"linearly",{"type":26,"value":5932}," in amplitude, so error in the expectation value grows quadratically with depth. Stochastic errors merely accumulate additively.",{"type":21,"tag":22,"props":5934,"children":5935},{},[5936],{"type":26,"value":5937},"Twirling converts the former into the latter. You compile many logically equivalent copies of your circuit, each wrapping the two-qubit gates in randomly chosen Pauli operators (with compensating Paulis so the ideal unitary is unchanged), then average the results. Coherent error terms average toward zero. What survives is a well-behaved stochastic Pauli channel.",{"type":21,"tag":22,"props":5939,"children":5940},{},[5941,5943,5948],{"type":26,"value":5942},"Twirling rarely improves accuracy much on its own. Its real value is that it makes the noise ",{"type":21,"tag":362,"props":5944,"children":5945},{},[5946],{"type":26,"value":5947},"model-able",{"type":26,"value":5949},", and every other technique on this list (ZNE, PEC) assumes a stochastic noise channel. Twirling is what makes that assumption true. Run it underneath your other mitigation, not instead of it.",{"type":21,"tag":29,"props":5951,"children":5953},{"id":5952},"step-4-zero-noise-extrapolation",[5954],{"type":26,"value":5955},"Step 4: Zero-Noise Extrapolation",{"type":21,"tag":22,"props":5957,"children":5958},{},[5959,5961,5966],{"type":26,"value":5960},"ZNE is the technique behind most headline NISQ results, including IBM's ",{"type":21,"tag":46,"props":5962,"children":5963},{"href":1456},[5964],{"type":26,"value":5965},"quantum utility demonstration",{"type":26,"value":5967}," on a 127-qubit Eagle processor.",{"type":21,"tag":22,"props":5969,"children":5970},{},[5971,5973,5978,5980,5986,5988,5994],{"type":26,"value":5972},"The idea: you can't reduce hardware noise, but you ",{"type":21,"tag":362,"props":5974,"children":5975},{},[5976],{"type":26,"value":5977},"increase",{"type":26,"value":5979}," it in a controlled way. Run the same circuit at noise scale factors λ = 1, 3, 5 (via unitary folding: replace ",{"type":21,"tag":2073,"props":5981,"children":5983},{"className":5982},[],[5984],{"type":26,"value":5985},"U",{"type":26,"value":5987}," with ",{"type":21,"tag":2073,"props":5989,"children":5991},{"className":5990},[],[5992],{"type":26,"value":5993},"U(U†U)^k",{"type":26,"value":5995},", which is logically identity-preserving but physically 3× or 5× as noisy), then fit a curve through the results and extrapolate back to λ = 0.",{"type":21,"tag":2304,"props":5997,"children":5999},{"code":5998,"language":3147,"meta":7,"className":3145,"style":7},"def fold_global(qc, scale):\n    \"\"\"Odd integer scale: U -> U (U^dag U)^k\"\"\"\n    k = (scale - 1) \u002F\u002F 2\n    out, inv = qc.copy(), qc.inverse()\n    for _ in range(k):\n        out = out.compose(inv).compose(qc)\n    return out\n\ndef expval_parity(qc, backend, shots=40000):\n    c = qc.copy()\n    c.measure_all()\n    counts = backend.run(\n        transpile(c, backend, optimization_level=0), shots=shots\n    ).result().get_counts()\n    return sum((-1) ** (k.replace(\" \", \"\").count(\"1\") % 2) * v\n               for k, v in counts.items()) \u002F shots\n\n# 4-qubit GHZ padded with cancelling CX pairs, ideal \u003CZZZZ> = +1.0\nbase = QuantumCircuit(4)\nbase.h(0)\nfor q in range(3):\n    base.cx(q, q + 1)\nfor _ in range(4):\n    for q in range(3):\n        base.cx(q, q + 1)\n        base.cx(q, q + 1)\n\nscales = [1, 3, 5]\nvals = [expval_parity(fold_global(base, s), backend) for s in scales]\nzne = np.polyval(np.polyfit(scales, vals, 2), 0)   # Richardson, order 2\nprint(vals, \"->\", zne)\n",[6000],{"type":21,"tag":2073,"props":6001,"children":6002},{"__ignoreMap":7},[6003,6020,6028,6067,6084,6109,6126,6138,6145,6175,6192,6200,6217,6255,6263,6353,6383,6390,6398,6422,6438,6470,6491,6522,6553,6573,6592,6599,6642,6677,6716],{"type":21,"tag":2314,"props":6004,"children":6005},{"class":2316,"line":2317},[6006,6010,6015],{"type":21,"tag":2314,"props":6007,"children":6008},{"style":3157},[6009],{"type":26,"value":4315},{"type":21,"tag":2314,"props":6011,"children":6012},{"style":4318},[6013],{"type":26,"value":6014}," fold_global",{"type":21,"tag":2314,"props":6016,"children":6017},{"style":2321},[6018],{"type":26,"value":6019},"(qc, scale):\n",{"type":21,"tag":2314,"props":6021,"children":6022},{"class":2316,"line":106},[6023],{"type":21,"tag":2314,"props":6024,"children":6025},{"style":2350},[6026],{"type":26,"value":6027},"    \"\"\"Odd integer scale: U -> U (U^dag U)^k\"\"\"\n",{"type":21,"tag":2314,"props":6029,"children":6030},{"class":2316,"line":2335},[6031,6036,6040,6045,6049,6054,6058,6063],{"type":21,"tag":2314,"props":6032,"children":6033},{"style":2321},[6034],{"type":26,"value":6035},"    k ",{"type":21,"tag":2314,"props":6037,"children":6038},{"style":3157},[6039],{"type":26,"value":3197},{"type":21,"tag":2314,"props":6041,"children":6042},{"style":2321},[6043],{"type":26,"value":6044}," (scale ",{"type":21,"tag":2314,"props":6046,"children":6047},{"style":3157},[6048],{"type":26,"value":4802},{"type":21,"tag":2314,"props":6050,"children":6051},{"style":2339},[6052],{"type":26,"value":6053}," 1",{"type":21,"tag":2314,"props":6055,"children":6056},{"style":2321},[6057],{"type":26,"value":5301},{"type":21,"tag":2314,"props":6059,"children":6060},{"style":3157},[6061],{"type":26,"value":6062},"\u002F\u002F",{"type":21,"tag":2314,"props":6064,"children":6065},{"style":2339},[6066],{"type":26,"value":5048},{"type":21,"tag":2314,"props":6068,"children":6069},{"class":2316,"line":2397},[6070,6075,6079],{"type":21,"tag":2314,"props":6071,"children":6072},{"style":2321},[6073],{"type":26,"value":6074},"    out, inv ",{"type":21,"tag":2314,"props":6076,"children":6077},{"style":3157},[6078],{"type":26,"value":3197},{"type":21,"tag":2314,"props":6080,"children":6081},{"style":2321},[6082],{"type":26,"value":6083}," qc.copy(), qc.inverse()\n",{"type":21,"tag":2314,"props":6085,"children":6086},{"class":2316,"line":2421},[6087,6091,6096,6100,6104],{"type":21,"tag":2314,"props":6088,"children":6089},{"style":3157},[6090],{"type":26,"value":4694},{"type":21,"tag":2314,"props":6092,"children":6093},{"style":2321},[6094],{"type":26,"value":6095}," _ ",{"type":21,"tag":2314,"props":6097,"children":6098},{"style":3157},[6099],{"type":26,"value":3460},{"type":21,"tag":2314,"props":6101,"children":6102},{"style":2339},[6103],{"type":26,"value":3465},{"type":21,"tag":2314,"props":6105,"children":6106},{"style":2321},[6107],{"type":26,"value":6108},"(k):\n",{"type":21,"tag":2314,"props":6110,"children":6111},{"class":2316,"line":16},[6112,6117,6121],{"type":21,"tag":2314,"props":6113,"children":6114},{"style":2321},[6115],{"type":26,"value":6116},"        out ",{"type":21,"tag":2314,"props":6118,"children":6119},{"style":3157},[6120],{"type":26,"value":3197},{"type":21,"tag":2314,"props":6122,"children":6123},{"style":2321},[6124],{"type":26,"value":6125}," out.compose(inv).compose(qc)\n",{"type":21,"tag":2314,"props":6127,"children":6128},{"class":2316,"line":127},[6129,6133],{"type":21,"tag":2314,"props":6130,"children":6131},{"style":3157},[6132],{"type":26,"value":4540},{"type":21,"tag":2314,"props":6134,"children":6135},{"style":2321},[6136],{"type":26,"value":6137}," out\n",{"type":21,"tag":2314,"props":6139,"children":6140},{"class":2316,"line":887},[6141],{"type":21,"tag":2314,"props":6142,"children":6143},{"emptyLinePlaceholder":3181},[6144],{"type":26,"value":3184},{"type":21,"tag":2314,"props":6146,"children":6147},{"class":2316,"line":1364},[6148,6152,6157,6162,6166,6171],{"type":21,"tag":2314,"props":6149,"children":6150},{"style":3157},[6151],{"type":26,"value":4315},{"type":21,"tag":2314,"props":6153,"children":6154},{"style":4318},[6155],{"type":26,"value":6156}," expval_parity",{"type":21,"tag":2314,"props":6158,"children":6159},{"style":2321},[6160],{"type":26,"value":6161},"(qc, backend, shots",{"type":21,"tag":2314,"props":6163,"children":6164},{"style":3157},[6165],{"type":26,"value":3197},{"type":21,"tag":2314,"props":6167,"children":6168},{"style":2339},[6169],{"type":26,"value":6170},"40000",{"type":21,"tag":2314,"props":6172,"children":6173},{"style":2321},[6174],{"type":26,"value":4368},{"type":21,"tag":2314,"props":6176,"children":6177},{"class":2316,"line":3403},[6178,6183,6187],{"type":21,"tag":2314,"props":6179,"children":6180},{"style":2321},[6181],{"type":26,"value":6182},"    c ",{"type":21,"tag":2314,"props":6184,"children":6185},{"style":3157},[6186],{"type":26,"value":3197},{"type":21,"tag":2314,"props":6188,"children":6189},{"style":2321},[6190],{"type":26,"value":6191}," qc.copy()\n",{"type":21,"tag":2314,"props":6193,"children":6194},{"class":2316,"line":3413},[6195],{"type":21,"tag":2314,"props":6196,"children":6197},{"style":2321},[6198],{"type":26,"value":6199},"    c.measure_all()\n",{"type":21,"tag":2314,"props":6201,"children":6202},{"class":2316,"line":436},[6203,6208,6212],{"type":21,"tag":2314,"props":6204,"children":6205},{"style":2321},[6206],{"type":26,"value":6207},"    counts ",{"type":21,"tag":2314,"props":6209,"children":6210},{"style":3157},[6211],{"type":26,"value":3197},{"type":21,"tag":2314,"props":6213,"children":6214},{"style":2321},[6215],{"type":26,"value":6216}," backend.run(\n",{"type":21,"tag":2314,"props":6218,"children":6219},{"class":2316,"line":3473},[6220,6225,6230,6234,6238,6242,6246,6250],{"type":21,"tag":2314,"props":6221,"children":6222},{"style":2321},[6223],{"type":26,"value":6224},"        transpile(c, backend, ",{"type":21,"tag":2314,"props":6226,"children":6227},{"style":3222},[6228],{"type":26,"value":6229},"optimization_level",{"type":21,"tag":2314,"props":6231,"children":6232},{"style":3157},[6233],{"type":26,"value":3197},{"type":21,"tag":2314,"props":6235,"children":6236},{"style":2339},[6237],{"type":26,"value":5122},{"type":21,"tag":2314,"props":6239,"children":6240},{"style":2321},[6241],{"type":26,"value":5292},{"type":21,"tag":2314,"props":6243,"children":6244},{"style":3222},[6245],{"type":26,"value":4077},{"type":21,"tag":2314,"props":6247,"children":6248},{"style":3157},[6249],{"type":26,"value":3197},{"type":21,"tag":2314,"props":6251,"children":6252},{"style":2321},[6253],{"type":26,"value":6254},"shots\n",{"type":21,"tag":2314,"props":6256,"children":6257},{"class":2316,"line":3521},[6258],{"type":21,"tag":2314,"props":6259,"children":6260},{"style":2321},[6261],{"type":26,"value":6262},"    ).result().get_counts()\n",{"type":21,"tag":2314,"props":6264,"children":6265},{"class":2316,"line":3563},[6266,6270,6275,6280,6284,6288,6292,6296,6301,6306,6310,6315,6320,6325,6329,6334,6339,6343,6348],{"type":21,"tag":2314,"props":6267,"children":6268},{"style":3157},[6269],{"type":26,"value":4540},{"type":21,"tag":2314,"props":6271,"children":6272},{"style":2339},[6273],{"type":26,"value":6274}," sum",{"type":21,"tag":2314,"props":6276,"children":6277},{"style":2321},[6278],{"type":26,"value":6279},"((",{"type":21,"tag":2314,"props":6281,"children":6282},{"style":3157},[6283],{"type":26,"value":4802},{"type":21,"tag":2314,"props":6285,"children":6286},{"style":2339},[6287],{"type":26,"value":3513},{"type":21,"tag":2314,"props":6289,"children":6290},{"style":2321},[6291],{"type":26,"value":5301},{"type":21,"tag":2314,"props":6293,"children":6294},{"style":3157},[6295],{"type":26,"value":4667},{"type":21,"tag":2314,"props":6297,"children":6298},{"style":2321},[6299],{"type":26,"value":6300}," (k.replace(",{"type":21,"tag":2314,"props":6302,"children":6303},{"style":2350},[6304],{"type":26,"value":6305},"\" \"",{"type":21,"tag":2314,"props":6307,"children":6308},{"style":2321},[6309],{"type":26,"value":1309},{"type":21,"tag":2314,"props":6311,"children":6312},{"style":2350},[6313],{"type":26,"value":6314},"\"\"",{"type":21,"tag":2314,"props":6316,"children":6317},{"style":2321},[6318],{"type":26,"value":6319},").count(",{"type":21,"tag":2314,"props":6321,"children":6322},{"style":2350},[6323],{"type":26,"value":6324},"\"1\"",{"type":21,"tag":2314,"props":6326,"children":6327},{"style":2321},[6328],{"type":26,"value":5301},{"type":21,"tag":2314,"props":6330,"children":6331},{"style":3157},[6332],{"type":26,"value":6333},"%",{"type":21,"tag":2314,"props":6335,"children":6336},{"style":2339},[6337],{"type":26,"value":6338}," 2",{"type":21,"tag":2314,"props":6340,"children":6341},{"style":2321},[6342],{"type":26,"value":5301},{"type":21,"tag":2314,"props":6344,"children":6345},{"style":3157},[6346],{"type":26,"value":6347},"*",{"type":21,"tag":2314,"props":6349,"children":6350},{"style":2321},[6351],{"type":26,"value":6352}," v\n",{"type":21,"tag":2314,"props":6354,"children":6355},{"class":2316,"line":4585},[6356,6361,6366,6370,6375,6379],{"type":21,"tag":2314,"props":6357,"children":6358},{"style":3157},[6359],{"type":26,"value":6360},"               for",{"type":21,"tag":2314,"props":6362,"children":6363},{"style":2321},[6364],{"type":26,"value":6365}," k, v ",{"type":21,"tag":2314,"props":6367,"children":6368},{"style":3157},[6369],{"type":26,"value":3460},{"type":21,"tag":2314,"props":6371,"children":6372},{"style":2321},[6373],{"type":26,"value":6374}," counts.items()) ",{"type":21,"tag":2314,"props":6376,"children":6377},{"style":3157},[6378],{"type":26,"value":2168},{"type":21,"tag":2314,"props":6380,"children":6381},{"style":2321},[6382],{"type":26,"value":5009},{"type":21,"tag":2314,"props":6384,"children":6385},{"class":2316,"line":4604},[6386],{"type":21,"tag":2314,"props":6387,"children":6388},{"emptyLinePlaceholder":3181},[6389],{"type":26,"value":3184},{"type":21,"tag":2314,"props":6391,"children":6392},{"class":2316,"line":4612},[6393],{"type":21,"tag":2314,"props":6394,"children":6395},{"style":3407},[6396],{"type":26,"value":6397},"# 4-qubit GHZ padded with cancelling CX pairs, ideal \u003CZZZZ> = +1.0\n",{"type":21,"tag":2314,"props":6399,"children":6400},{"class":2316,"line":4643},[6401,6406,6410,6414,6418],{"type":21,"tag":2314,"props":6402,"children":6403},{"style":2321},[6404],{"type":26,"value":6405},"base ",{"type":21,"tag":2314,"props":6407,"children":6408},{"style":3157},[6409],{"type":26,"value":3197},{"type":21,"tag":2314,"props":6411,"children":6412},{"style":2321},[6413],{"type":26,"value":5092},{"type":21,"tag":2314,"props":6415,"children":6416},{"style":2339},[6417],{"type":26,"value":5486},{"type":21,"tag":2314,"props":6419,"children":6420},{"style":2321},[6421],{"type":26,"value":3257},{"type":21,"tag":2314,"props":6423,"children":6424},{"class":2316,"line":4688},[6425,6430,6434],{"type":21,"tag":2314,"props":6426,"children":6427},{"style":2321},[6428],{"type":26,"value":6429},"base.h(",{"type":21,"tag":2314,"props":6431,"children":6432},{"style":2339},[6433],{"type":26,"value":5122},{"type":21,"tag":2314,"props":6435,"children":6436},{"style":2321},[6437],{"type":26,"value":3257},{"type":21,"tag":2314,"props":6439,"children":6440},{"class":2316,"line":4727},[6441,6445,6449,6453,6457,6461,6466],{"type":21,"tag":2314,"props":6442,"children":6443},{"style":3157},[6444],{"type":26,"value":3450},{"type":21,"tag":2314,"props":6446,"children":6447},{"style":2321},[6448],{"type":26,"value":3455},{"type":21,"tag":2314,"props":6450,"children":6451},{"style":3157},[6452],{"type":26,"value":3460},{"type":21,"tag":2314,"props":6454,"children":6455},{"style":2339},[6456],{"type":26,"value":3465},{"type":21,"tag":2314,"props":6458,"children":6459},{"style":2321},[6460],{"type":26,"value":3277},{"type":21,"tag":2314,"props":6462,"children":6463},{"style":2339},[6464],{"type":26,"value":6465},"3",{"type":21,"tag":2314,"props":6467,"children":6468},{"style":2321},[6469],{"type":26,"value":4368},{"type":21,"tag":2314,"props":6471,"children":6472},{"class":2316,"line":4745},[6473,6478,6483,6487],{"type":21,"tag":2314,"props":6474,"children":6475},{"style":2321},[6476],{"type":26,"value":6477},"    base.cx(q, q ",{"type":21,"tag":2314,"props":6479,"children":6480},{"style":3157},[6481],{"type":26,"value":6482},"+",{"type":21,"tag":2314,"props":6484,"children":6485},{"style":2339},[6486],{"type":26,"value":6053},{"type":21,"tag":2314,"props":6488,"children":6489},{"style":2321},[6490],{"type":26,"value":3257},{"type":21,"tag":2314,"props":6492,"children":6493},{"class":2316,"line":4819},[6494,6498,6502,6506,6510,6514,6518],{"type":21,"tag":2314,"props":6495,"children":6496},{"style":3157},[6497],{"type":26,"value":3450},{"type":21,"tag":2314,"props":6499,"children":6500},{"style":2321},[6501],{"type":26,"value":6095},{"type":21,"tag":2314,"props":6503,"children":6504},{"style":3157},[6505],{"type":26,"value":3460},{"type":21,"tag":2314,"props":6507,"children":6508},{"style":2339},[6509],{"type":26,"value":3465},{"type":21,"tag":2314,"props":6511,"children":6512},{"style":2321},[6513],{"type":26,"value":3277},{"type":21,"tag":2314,"props":6515,"children":6516},{"style":2339},[6517],{"type":26,"value":5486},{"type":21,"tag":2314,"props":6519,"children":6520},{"style":2321},[6521],{"type":26,"value":4368},{"type":21,"tag":2314,"props":6523,"children":6524},{"class":2316,"line":4847},[6525,6529,6533,6537,6541,6545,6549],{"type":21,"tag":2314,"props":6526,"children":6527},{"style":3157},[6528],{"type":26,"value":4694},{"type":21,"tag":2314,"props":6530,"children":6531},{"style":2321},[6532],{"type":26,"value":3455},{"type":21,"tag":2314,"props":6534,"children":6535},{"style":3157},[6536],{"type":26,"value":3460},{"type":21,"tag":2314,"props":6538,"children":6539},{"style":2339},[6540],{"type":26,"value":3465},{"type":21,"tag":2314,"props":6542,"children":6543},{"style":2321},[6544],{"type":26,"value":3277},{"type":21,"tag":2314,"props":6546,"children":6547},{"style":2339},[6548],{"type":26,"value":6465},{"type":21,"tag":2314,"props":6550,"children":6551},{"style":2321},[6552],{"type":26,"value":4368},{"type":21,"tag":2314,"props":6554,"children":6555},{"class":2316,"line":4876},[6556,6561,6565,6569],{"type":21,"tag":2314,"props":6557,"children":6558},{"style":2321},[6559],{"type":26,"value":6560},"        base.cx(q, q ",{"type":21,"tag":2314,"props":6562,"children":6563},{"style":3157},[6564],{"type":26,"value":6482},{"type":21,"tag":2314,"props":6566,"children":6567},{"style":2339},[6568],{"type":26,"value":6053},{"type":21,"tag":2314,"props":6570,"children":6571},{"style":2321},[6572],{"type":26,"value":3257},{"type":21,"tag":2314,"props":6574,"children":6575},{"class":2316,"line":4885},[6576,6580,6584,6588],{"type":21,"tag":2314,"props":6577,"children":6578},{"style":2321},[6579],{"type":26,"value":6560},{"type":21,"tag":2314,"props":6581,"children":6582},{"style":3157},[6583],{"type":26,"value":6482},{"type":21,"tag":2314,"props":6585,"children":6586},{"style":2339},[6587],{"type":26,"value":6053},{"type":21,"tag":2314,"props":6589,"children":6590},{"style":2321},[6591],{"type":26,"value":3257},{"type":21,"tag":2314,"props":6593,"children":6594},{"class":2316,"line":4913},[6595],{"type":21,"tag":2314,"props":6596,"children":6597},{"emptyLinePlaceholder":3181},[6598],{"type":26,"value":3184},{"type":21,"tag":2314,"props":6600,"children":6601},{"class":2316,"line":4944},[6602,6607,6611,6616,6620,6624,6628,6632,6637],{"type":21,"tag":2314,"props":6603,"children":6604},{"style":2321},[6605],{"type":26,"value":6606},"scales ",{"type":21,"tag":2314,"props":6608,"children":6609},{"style":3157},[6610],{"type":26,"value":3197},{"type":21,"tag":2314,"props":6612,"children":6613},{"style":2321},[6614],{"type":26,"value":6615}," [",{"type":21,"tag":2314,"props":6617,"children":6618},{"style":2339},[6619],{"type":26,"value":3513},{"type":21,"tag":2314,"props":6621,"children":6622},{"style":2321},[6623],{"type":26,"value":1309},{"type":21,"tag":2314,"props":6625,"children":6626},{"style":2339},[6627],{"type":26,"value":6465},{"type":21,"tag":2314,"props":6629,"children":6630},{"style":2321},[6631],{"type":26,"value":1309},{"type":21,"tag":2314,"props":6633,"children":6634},{"style":2339},[6635],{"type":26,"value":6636},"5",{"type":21,"tag":2314,"props":6638,"children":6639},{"style":2321},[6640],{"type":26,"value":6641},"]\n",{"type":21,"tag":2314,"props":6643,"children":6644},{"class":2316,"line":4966},[6645,6650,6654,6659,6663,6668,6672],{"type":21,"tag":2314,"props":6646,"children":6647},{"style":2321},[6648],{"type":26,"value":6649},"vals ",{"type":21,"tag":2314,"props":6651,"children":6652},{"style":3157},[6653],{"type":26,"value":3197},{"type":21,"tag":2314,"props":6655,"children":6656},{"style":2321},[6657],{"type":26,"value":6658}," [expval_parity(fold_global(base, s), backend) ",{"type":21,"tag":2314,"props":6660,"children":6661},{"style":3157},[6662],{"type":26,"value":3450},{"type":21,"tag":2314,"props":6664,"children":6665},{"style":2321},[6666],{"type":26,"value":6667}," s ",{"type":21,"tag":2314,"props":6669,"children":6670},{"style":3157},[6671],{"type":26,"value":3460},{"type":21,"tag":2314,"props":6673,"children":6674},{"style":2321},[6675],{"type":26,"value":6676}," scales]\n",{"type":21,"tag":2314,"props":6678,"children":6679},{"class":2316,"line":5012},[6680,6685,6689,6694,6698,6702,6706,6711],{"type":21,"tag":2314,"props":6681,"children":6682},{"style":2321},[6683],{"type":26,"value":6684},"zne ",{"type":21,"tag":2314,"props":6686,"children":6687},{"style":3157},[6688],{"type":26,"value":3197},{"type":21,"tag":2314,"props":6690,"children":6691},{"style":2321},[6692],{"type":26,"value":6693}," np.polyval(np.polyfit(scales, vals, ",{"type":21,"tag":2314,"props":6695,"children":6696},{"style":2339},[6697],{"type":26,"value":2413},{"type":21,"tag":2314,"props":6699,"children":6700},{"style":2321},[6701],{"type":26,"value":5292},{"type":21,"tag":2314,"props":6703,"children":6704},{"style":2339},[6705],{"type":26,"value":5122},{"type":21,"tag":2314,"props":6707,"children":6708},{"style":2321},[6709],{"type":26,"value":6710},")   ",{"type":21,"tag":2314,"props":6712,"children":6713},{"style":3407},[6714],{"type":26,"value":6715},"# Richardson, order 2\n",{"type":21,"tag":2314,"props":6717,"children":6718},{"class":2316,"line":5025},[6719,6723,6728,6733],{"type":21,"tag":2314,"props":6720,"children":6721},{"style":2339},[6722],{"type":26,"value":3272},{"type":21,"tag":2314,"props":6724,"children":6725},{"style":2321},[6726],{"type":26,"value":6727},"(vals, ",{"type":21,"tag":2314,"props":6729,"children":6730},{"style":2350},[6731],{"type":26,"value":6732},"\"->\"",{"type":21,"tag":2314,"props":6734,"children":6735},{"style":2321},[6736],{"type":26,"value":6737},", zne)\n",{"type":21,"tag":22,"props":6739,"children":6740},{},[6741,6746],{"type":21,"tag":136,"props":6742,"children":6743},{},[6744],{"type":26,"value":6745},"Real measured output",{"type":26,"value":6747},", same versions, readout error switched off to isolate gate noise. With a 0.4% two-qubit error rate:",{"type":21,"tag":2304,"props":6749,"children":6751},{"code":6750},"scale 1: 0.8973   scale 3: 0.7286   scale 5: 0.5767\nZNE estimate: 0.988   (exact: 1.000)\n",[6752],{"type":21,"tag":2073,"props":6753,"children":6754},{"__ignoreMap":7},[6755],{"type":26,"value":6750},{"type":21,"tag":22,"props":6757,"children":6758},{},[6759],{"type":26,"value":6760},"Raw error 0.103, mitigated error 0.012. ZNE removed 88% of the bias. This is what the technique looks like when it works.",{"type":21,"tag":29,"props":6762,"children":6764},{"id":6763},"when-zne-lies",[6765],{"type":26,"value":6766},"When ZNE Lies",{"type":21,"tag":22,"props":6768,"children":6769},{},[6770],{"type":26,"value":6771},"Now turn the two-qubit error rate up to 4% and rerun the identical code:",{"type":21,"tag":2304,"props":6773,"children":6775},{"code":6774},"scale 1: 0.3311   scale 3: 0.0320   scale 5: 0.0008\nZNE estimate: 0.581   (exact: 1.000)\n",[6776],{"type":21,"tag":2073,"props":6777,"children":6778},{"__ignoreMap":7},[6779],{"type":26,"value":6774},{"type":21,"tag":22,"props":6781,"children":6782},{},[6783,6785,6790],{"type":26,"value":6784},"Look at what a results table would show: raw 0.33, mitigated 0.58, ideal 1.00. Mitigation \"recovered\" 76% more signal! It looks like a triumph. It is garbage. The λ=5 point is 0.0008. The signal is ",{"type":21,"tag":362,"props":6786,"children":6787},{},[6788],{"type":26,"value":6789},"gone",{"type":26,"value":6791},". The fit is being driven by two nearly-zero numbers and one noisy one, and it happens to land somewhere between raw and truth because the curve shape forces it to.",{"type":21,"tag":22,"props":6793,"children":6794},{},[6795,6797,6803,6805,6810,6812,6817],{"type":26,"value":6796},"This is precisely the failure mode Köster and Mauerer characterize in ",{"type":21,"tag":46,"props":6798,"children":6800},{"href":6799},"\u002Fresearch\u002Fzne-artefactual-improvements-2026",[6801],{"type":26,"value":6802},"Artefactual Improvements in Zero-Noise Extrapolation",{"type":26,"value":6804}," (2026). Their finding: once noise amplification pushes past usable signal, ",{"type":21,"tag":136,"props":6806,"children":6807},{},[6808],{"type":26,"value":6809},"Richardson extrapolation degenerates into a fixed rescaling of a single noisy measurement",{"type":26,"value":6811},". The output is no longer a function of the noise amplification it supposedly corrects for. The amplified points contribute nothing but their own vanishing. On real hardware they measured runs that ",{"type":21,"tag":362,"props":6813,"children":6814},{},[6815],{"type":26,"value":6816},"overshot",{"type":26,"value":6818}," the ideal value by up to 21%.",{"type":21,"tag":22,"props":6820,"children":6821},{},[6822,6824,6829],{"type":26,"value":6823},"Their sharpest result is a negative control. They defined \"garbage folding\" (circuit modifications with no relationship to the identity-insertion ZNE requires, i.e. deliberately meaningless) and pushed those through the same pipeline. It produced ",{"type":21,"tag":362,"props":6825,"children":6826},{},[6827],{"type":26,"value":6828},"larger",{"type":26,"value":6830}," apparent improvements than legitimate folding. If nonsense scores better than the real method, the score is not measuring what you think it is.",{"type":21,"tag":22,"props":6832,"children":6833},{},[6834,6839],{"type":21,"tag":136,"props":6835,"children":6836},{},[6837],{"type":26,"value":6838},"The operational lesson: improvement magnitude never validates a mitigation result.",{"type":26,"value":6840}," A number moving toward the expected answer is not evidence the method worked. It might instead be evidence the method collapsed into a rescaling that happens to move numbers in that direction.",{"type":21,"tag":29,"props":6842,"children":6844},{"id":6843},"the-sanity-checks-that-catch-this",[6845],{"type":26,"value":6846},"The Sanity Checks That Catch This",{"type":21,"tag":22,"props":6848,"children":6849},{},[6850],{"type":26,"value":6851},"Three of them, none expensive:",{"type":21,"tag":22,"props":6853,"children":6854},{},[6855,6860,6862,6868],{"type":21,"tag":136,"props":6856,"children":6857},{},[6858],{"type":26,"value":6859},"1. Inspect the raw scale-factor points, always.",{"type":26,"value":6861}," If your highest-λ value has collapsed toward the fully-depolarized value (0 for a parity observable, 1\u002F2^n for a probability), discard it. Fitting through dead points is fitting noise. In the failing run above, one glance at ",{"type":21,"tag":2073,"props":6863,"children":6865},{"className":6864},[],[6866],{"type":26,"value":6867},"0.0008",{"type":26,"value":6869}," tells you the extrapolation is unsupported.",{"type":21,"tag":22,"props":6871,"children":6872},{},[6873,6878,6880,6885,6887,6893,6895,6900],{"type":21,"tag":136,"props":6874,"children":6875},{},[6876],{"type":26,"value":6877},"2. Run a negative control.",{"type":26,"value":6879}," Build a variant of your folding that ",{"type":21,"tag":362,"props":6881,"children":6882},{},[6883],{"type":26,"value":6884},"shouldn't",{"type":26,"value":6886}," work (random gates of comparable depth instead of ",{"type":21,"tag":2073,"props":6888,"children":6890},{"className":6889},[],[6891],{"type":26,"value":6892},"U†U",{"type":26,"value":6894}," pairs) and push it through the identical pipeline. In my failing case, garbage folding returned 0.186 against a raw value of 0.329: it moved the answer ",{"type":21,"tag":362,"props":6896,"children":6897},{},[6898],{"type":26,"value":6899},"away",{"type":26,"value":6901}," from truth. That divergence is the flag. Whether your control produces spurious improvement or spurious degradation, any large response to meaningless input means your pipeline is fitting artifacts.",{"type":21,"tag":22,"props":6903,"children":6904},{},[6905,6916],{"type":21,"tag":136,"props":6906,"children":6907},{},[6908,6910,6914],{"type":26,"value":6909},"3. Verify against a ",{"type":21,"tag":46,"props":6911,"children":6912},{"href":408},[6913],{"type":26,"value":3243},{"type":26,"value":6915}," at small scale.",{"type":26,"value":6917}," Run the same mitigation pipeline on a problem size you compute exactly. If ZNE doesn't recover the known answer at 6 qubits, nothing about 60 qubits will be trustworthy.",{"type":21,"tag":29,"props":6919,"children":6921},{"id":6920},"probabilistic-error-cancellation-briefly",[6922],{"type":26,"value":6923},"Probabilistic Error Cancellation (Briefly)",{"type":21,"tag":22,"props":6925,"children":6926},{},[6927,6929,6934],{"type":26,"value":6928},"PEC is the rigorous option. Characterize the noise channel precisely, express the ",{"type":21,"tag":362,"props":6930,"children":6931},{},[6932],{"type":26,"value":6933},"inverse",{"type":26,"value":6935}," channel as a quasi-probability distribution over implementable operations, then sample from it with signed weights. It's unbiased in principle. No extrapolation guesswork.",{"type":21,"tag":22,"props":6937,"children":6938},{},[6939,6941,6947],{"type":26,"value":6940},"The cost is brutal. Sampling overhead scales as γ², where γ grows exponentially in circuit depth × error rate. A modest circuit sometimes needs 100-10,000 times more shots than the unmitigated run, on top of an expensive noise-characterization phase (gate set tomography or cycle benchmarking). PEC is appropriate for small, high-value circuits where you need a trustworthy number and afford the ",{"type":21,"tag":46,"props":6942,"children":6944},{"href":6943},"\u002Fglossary\u002Fshot-budget",[6945],{"type":26,"value":6946},"shot budget",{"type":26,"value":6948},". For most work, it isn't.",{"type":21,"tag":29,"props":6950,"children":6952},{"id":6951},"what-to-do",[6953],{"type":26,"value":6954},"What To Do",{"type":21,"tag":22,"props":6956,"children":6957},{},[6958],{"type":26,"value":6959},"In order:",{"type":21,"tag":6961,"props":6962,"children":6963},"ol",{},[6964,6974,6984,6994,7004],{"type":21,"tag":3084,"props":6965,"children":6966},{},[6967,6972],{"type":21,"tag":136,"props":6968,"children":6969},{},[6970],{"type":26,"value":6971},"Readout mitigation",{"type":26,"value":6973},": always. Cheap, bounded, low-risk.",{"type":21,"tag":3084,"props":6975,"children":6976},{},[6977,6982],{"type":21,"tag":136,"props":6978,"children":6979},{},[6980],{"type":26,"value":6981},"Dynamical decoupling",{"type":26,"value":6983},": always, if your circuit has idle qubits. Free.",{"type":21,"tag":3084,"props":6985,"children":6986},{},[6987,6992],{"type":21,"tag":136,"props":6988,"children":6989},{},[6990],{"type":26,"value":6991},"Twirling",{"type":26,"value":6993},": if you plan to use ZNE or PEC, so the noise is stochastic.",{"type":21,"tag":3084,"props":6995,"children":6996},{},[6997,7002],{"type":21,"tag":136,"props":6998,"children":6999},{},[7000],{"type":26,"value":7001},"ZNE",{"type":26,"value":7003},": only with scale-factor inspection and a negative control.",{"type":21,"tag":3084,"props":7005,"children":7006},{},[7007,7012],{"type":21,"tag":136,"props":7008,"children":7009},{},[7010],{"type":26,"value":7011},"PEC",{"type":26,"value":7013},": only when the circuit is small and the answer matters more than the cost.",{"type":21,"tag":22,"props":7015,"children":7016},{},[7017,7022,7024,7029,7031,7037],{"type":21,"tag":136,"props":7018,"children":7019},{},[7020],{"type":26,"value":7021},"Skip mitigation entirely when:",{"type":26,"value":7023}," your raw signal is already below ~0.2 of its ideal magnitude (nothing to extrapolate from), your circuit is deep enough that the λ=3 run is fully depolarized, or you're doing variational optimization where the optimizer only needs the ",{"type":21,"tag":362,"props":7025,"children":7026},{},[7027],{"type":26,"value":7028},"gradient direction",{"type":26,"value":7030},": bias that's roughly constant across parameter space often cancels out, and you're better off spending those shots on more iterations. Techniques for that are in ",{"type":21,"tag":46,"props":7032,"children":7034},{"href":7033},"\u002Fblog\u002Freduce-shot-count",[7035],{"type":26,"value":7036},"cutting your shot count",{"type":26,"value":761},{"type":21,"tag":22,"props":7039,"children":7040},{},[7041,7043,7049],{"type":26,"value":7042},"Mitigation buys you a few years of useful computation on machines that shouldn't be useful yet. It does not buy you fault tolerance, and it will happily hand you a confident wrong answer if you skip the controls. Get comfortable with the ",{"type":21,"tag":46,"props":7044,"children":7046},{"href":7045},"\u002Fsdks\u002Fqiskit",[7047],{"type":26,"value":7048},"Qiskit tooling",{"type":26,"value":7050},", always sanity-check against exact simulation, and treat any unvalidated improvement as a hypothesis rather than a result.",{"type":21,"tag":22,"props":7052,"children":7053},{},[7054,7059,7060,7065,7067,7072,7073],{"type":21,"tag":136,"props":7055,"children":7056},{},[7057],{"type":26,"value":7058},"Related:",{"type":26,"value":1301},{"type":21,"tag":46,"props":7061,"children":7062},{"href":253},[7063],{"type":26,"value":7064},"Error correction explained",{"type":26,"value":7066}," · ",{"type":21,"tag":46,"props":7068,"children":7069},{"href":6799},[7070],{"type":26,"value":7071},"ZNE artefacts paper",{"type":26,"value":7066},{"type":21,"tag":46,"props":7074,"children":7076},{"href":7075},"\u002Fglossary\u002Fquantum-utility",[7077],{"type":26,"value":7078},"Quantum utility",{"type":21,"tag":2688,"props":7080,"children":7081},{},[7082],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":7084},[7085,7086,7087,7088,7089,7090,7091,7092,7093],{"id":3958,"depth":106,"text":3961},{"id":4155,"depth":106,"text":4158},{"id":5677,"depth":106,"text":5680},{"id":5917,"depth":106,"text":5920},{"id":5952,"depth":106,"text":5955},{"id":6763,"depth":106,"text":6766},{"id":6843,"depth":106,"text":6846},{"id":6920,"depth":106,"text":6923},{"id":6951,"depth":106,"text":6954},"content:blog:error-mitigation-practical-guide.md","blog\u002Ferror-mitigation-practical-guide.md","blog\u002Ferror-mitigation-practical-guide",{"_path":7098,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":7099,"description":7100,"date":3032,"author":11,"tags":7101,"readingTime":3403,"body":7104,"_type":111,"_id":8836,"_source":113,"_file":8837,"_stem":8838,"_extension":116},"\u002Fblog\u002Fgrover-algorithm-tutorial","Grover's Algorithm in Qiskit: A Practical Tutorial","Build Grover's search algorithm from scratch in Qiskit: oracle, diffuser, and the optimal iteration count, with complete runnable code and honest limits on the quadratic speedup.",[7102,1363,7103],"Algorithms","Beginners",{"type":18,"children":7105,"toc":8824},[7106,7117,7122,7128,7133,7138,7150,7156,7161,7191,7196,7202,7215,7367,7380,7386,7391,7412,7733,7761,7767,7772,7994,8007,8013,8018,8026,8036,8041,8459,8464,8472,8484,8490,8502,8507,8515,8527,8539,8545,8550,8568,8578,8602,8614,8620,8632,8700,8719,8738,8744,8820],{"type":21,"tag":22,"props":7107,"children":7108},{},[7109,7115],{"type":21,"tag":46,"props":7110,"children":7112},{"href":7111},"\u002Fglossary\u002Fgrover-algorithm",[7113],{"type":26,"value":7114},"Grover's algorithm",{"type":26,"value":7116}," is the second-most-famous quantum algorithm after Shor's, and it is by far the easier one to build. You implement a working version in about forty lines of Qiskit and watch the marked state emerge from the noise floor.",{"type":21,"tag":22,"props":7118,"children":7119},{},[7120],{"type":26,"value":7121},"It's also the algorithm most commonly misunderstood. This guide builds it step by step, shows the mistake that almost every beginner makes, and is honest about what the speedup does and does not buy you.",{"type":21,"tag":29,"props":7123,"children":7125},{"id":7124},"the-problem-unstructured-search",[7126],{"type":26,"value":7127},"The Problem: Unstructured Search",{"type":21,"tag":22,"props":7129,"children":7130},{},[7131],{"type":26,"value":7132},"You have N possibilities. Exactly one of them (or a few) satisfies some condition. You have no structure to exploit: no sorting, no index, no gradient, nothing that lets you rule out half the space with one look. Your only tool is a checker function: hand it a candidate, it tells you yes or no.",{"type":21,"tag":22,"props":7134,"children":7135},{},[7136],{"type":26,"value":7137},"Classically, you have no choice but to try candidates one at a time. On average that's N\u002F2 checks, and N in the worst case. Grover's algorithm finds the answer in roughly (π\u002F4)√N checks. For N = 1,000,000 that's about 785 instead of 500,000.",{"type":21,"tag":22,"props":7139,"children":7140},{},[7141,7143,7148],{"type":26,"value":7142},"The word ",{"type":21,"tag":136,"props":7144,"children":7145},{},[7146],{"type":26,"value":7147},"unstructured",{"type":26,"value":7149}," is doing enormous work here. It does not mean \"hard\". It means \"the only thing you do is test candidates\". If your problem has any exploitable structure (sorted data, a hash index, a metric that lets you prune), classical algorithms will use it and will crush Grover. The classic \"search a database of N records\" framing is genuinely misleading, and we'll come back to why.",{"type":21,"tag":29,"props":7151,"children":7153},{"id":7152},"the-core-idea-amplitude-amplification",[7154],{"type":26,"value":7155},"The Core Idea: Amplitude Amplification",{"type":21,"tag":22,"props":7157,"children":7158},{},[7159],{"type":26,"value":7160},"Start with every state equally likely. Then repeat two operations:",{"type":21,"tag":6961,"props":7162,"children":7163},{},[7164,7181],{"type":21,"tag":3084,"props":7165,"children":7166},{},[7167,7172,7174,7179],{"type":21,"tag":136,"props":7168,"children":7169},{},[7170],{"type":26,"value":7171},"The oracle",{"type":26,"value":7173}," flips the ",{"type":21,"tag":362,"props":7175,"children":7176},{},[7177],{"type":26,"value":7178},"sign",{"type":26,"value":7180}," of the amplitude of the marked state, leaving everything else alone. Probabilities don't change (all amplitudes are still ±1\u002F√N) but the marked one now points the other way.",{"type":21,"tag":3084,"props":7182,"children":7183},{},[7184,7189],{"type":21,"tag":136,"props":7185,"children":7186},{},[7187],{"type":26,"value":7188},"The diffusion operator",{"type":26,"value":7190}," reflects every amplitude about their mean. Since the marked amplitude is negative it sits far below the mean, so reflecting it sends it well above. Every other amplitude drops slightly.",{"type":21,"tag":22,"props":7192,"children":7193},{},[7194],{"type":26,"value":7195},"Each round is a rotation of the state vector toward the target by a fixed angle. That's the whole algorithm. The rotation angle is fixed, which is exactly why overshooting is possible. More on that shortly.",{"type":21,"tag":29,"props":7197,"children":7199},{"id":7198},"step-1-uniform-superposition",[7200],{"type":26,"value":7201},"Step 1: Uniform Superposition",{"type":21,"tag":22,"props":7203,"children":7204},{},[7205,7207,7213],{"type":26,"value":7206},"Apply a ",{"type":21,"tag":46,"props":7208,"children":7210},{"href":7209},"\u002Fglossary\u002Fhadamard-gate",[7211],{"type":26,"value":7212},"Hadamard gate",{"type":26,"value":7214}," to every qubit. Three qubits give eight basis states each with amplitude 1\u002F√8.",{"type":21,"tag":2304,"props":7216,"children":7218},{"code":7217,"language":3147,"meta":7,"className":3145,"style":7},"from qiskit import QuantumCircuit, transpile\nfrom qiskit_aer import AerSimulator\nimport math\n\nn = 3                # 3 qubits -> N = 8 states\nmarked = \"101\"       # the state we want to find\n\nqc = QuantumCircuit(n, n)\nqc.h(range(n))       # uniform superposition\n",[7219],{"type":21,"tag":2073,"props":7220,"children":7221},{"__ignoreMap":7},[7222,7241,7260,7272,7279,7300,7322,7329,7345],{"type":21,"tag":2314,"props":7223,"children":7224},{"class":2316,"line":2317},[7225,7229,7233,7237],{"type":21,"tag":2314,"props":7226,"children":7227},{"style":3157},[7228],{"type":26,"value":3160},{"type":21,"tag":2314,"props":7230,"children":7231},{"style":2321},[7232],{"type":26,"value":4249},{"type":21,"tag":2314,"props":7234,"children":7235},{"style":3157},[7236],{"type":26,"value":3170},{"type":21,"tag":2314,"props":7238,"children":7239},{"style":2321},[7240],{"type":26,"value":4258},{"type":21,"tag":2314,"props":7242,"children":7243},{"class":2316,"line":106},[7244,7248,7252,7256],{"type":21,"tag":2314,"props":7245,"children":7246},{"style":3157},[7247],{"type":26,"value":3160},{"type":21,"tag":2314,"props":7249,"children":7250},{"style":2321},[7251],{"type":26,"value":4270},{"type":21,"tag":2314,"props":7253,"children":7254},{"style":3157},[7255],{"type":26,"value":3170},{"type":21,"tag":2314,"props":7257,"children":7258},{"style":2321},[7259],{"type":26,"value":4279},{"type":21,"tag":2314,"props":7261,"children":7262},{"class":2316,"line":2335},[7263,7267],{"type":21,"tag":2314,"props":7264,"children":7265},{"style":3157},[7266],{"type":26,"value":3170},{"type":21,"tag":2314,"props":7268,"children":7269},{"style":2321},[7270],{"type":26,"value":7271}," math\n",{"type":21,"tag":2314,"props":7273,"children":7274},{"class":2316,"line":2397},[7275],{"type":21,"tag":2314,"props":7276,"children":7277},{"emptyLinePlaceholder":3181},[7278],{"type":26,"value":3184},{"type":21,"tag":2314,"props":7280,"children":7281},{"class":2316,"line":2421},[7282,7286,7290,7295],{"type":21,"tag":2314,"props":7283,"children":7284},{"style":2321},[7285],{"type":26,"value":5039},{"type":21,"tag":2314,"props":7287,"children":7288},{"style":3157},[7289],{"type":26,"value":3197},{"type":21,"tag":2314,"props":7291,"children":7292},{"style":2339},[7293],{"type":26,"value":7294}," 3",{"type":21,"tag":2314,"props":7296,"children":7297},{"style":3407},[7298],{"type":26,"value":7299},"                # 3 qubits -> N = 8 states\n",{"type":21,"tag":2314,"props":7301,"children":7302},{"class":2316,"line":16},[7303,7308,7312,7317],{"type":21,"tag":2314,"props":7304,"children":7305},{"style":2321},[7306],{"type":26,"value":7307},"marked ",{"type":21,"tag":2314,"props":7309,"children":7310},{"style":3157},[7311],{"type":26,"value":3197},{"type":21,"tag":2314,"props":7313,"children":7314},{"style":2350},[7315],{"type":26,"value":7316}," \"101\"",{"type":21,"tag":2314,"props":7318,"children":7319},{"style":3407},[7320],{"type":26,"value":7321},"       # the state we want to find\n",{"type":21,"tag":2314,"props":7323,"children":7324},{"class":2316,"line":127},[7325],{"type":21,"tag":2314,"props":7326,"children":7327},{"emptyLinePlaceholder":3181},[7328],{"type":26,"value":3184},{"type":21,"tag":2314,"props":7330,"children":7331},{"class":2316,"line":887},[7332,7337,7341],{"type":21,"tag":2314,"props":7333,"children":7334},{"style":2321},[7335],{"type":26,"value":7336},"qc ",{"type":21,"tag":2314,"props":7338,"children":7339},{"style":3157},[7340],{"type":26,"value":3197},{"type":21,"tag":2314,"props":7342,"children":7343},{"style":2321},[7344],{"type":26,"value":4742},{"type":21,"tag":2314,"props":7346,"children":7347},{"class":2316,"line":1364},[7348,7353,7357,7362],{"type":21,"tag":2314,"props":7349,"children":7350},{"style":2321},[7351],{"type":26,"value":7352},"qc.h(",{"type":21,"tag":2314,"props":7354,"children":7355},{"style":2339},[7356],{"type":26,"value":4896},{"type":21,"tag":2314,"props":7358,"children":7359},{"style":2321},[7360],{"type":26,"value":7361},"(n))       ",{"type":21,"tag":2314,"props":7363,"children":7364},{"style":3407},[7365],{"type":26,"value":7366},"# uniform superposition\n",{"type":21,"tag":22,"props":7368,"children":7369},{},[7370,7372,7378],{"type":26,"value":7371},"If you ",{"type":21,"tag":46,"props":7373,"children":7375},{"href":7374},"\u002Fglossary\u002Fmeasurement",[7376],{"type":26,"value":7377},"measure",{"type":26,"value":7379}," here you get a uniform random bitstring: 12.5% for each of the eight outcomes. That's the baseline to beat.",{"type":21,"tag":29,"props":7381,"children":7383},{"id":7382},"step-2-the-oracle",[7384],{"type":26,"value":7385},"Step 2: The Oracle",{"type":21,"tag":22,"props":7387,"children":7388},{},[7389],{"type":26,"value":7390},"The oracle must apply a phase of −1 to |101⟩ and +1 to everything else. The trick is a multi-controlled Z gate: it flips the sign of |111⟩ only. To mark a different pattern, sandwich it with X gates on the qubits that should be 0.",{"type":21,"tag":22,"props":7392,"children":7393},{},[7394,7396,7402,7404,7410],{"type":26,"value":7395},"Qiskit has no ",{"type":21,"tag":2073,"props":7397,"children":7399},{"className":7398},[],[7400],{"type":26,"value":7401},"mcz",{"type":26,"value":7403},", so we build it the standard way: an H on the target, a multi-controlled X (",{"type":21,"tag":46,"props":7405,"children":7407},{"href":7406},"\u002Fglossary\u002Ftoffoli-gate",[7408],{"type":26,"value":7409},"Toffoli",{"type":26,"value":7411}," generalized), an H back:",{"type":21,"tag":2304,"props":7413,"children":7415},{"code":7414,"language":3147,"meta":7,"className":3145,"style":7},"def oracle(n, marked):\n    \"\"\"Phase-flip the marked basis state.\"\"\"\n    qc = QuantumCircuit(n, name=\"Oracle\")\n    rev = marked[::-1]              # Qiskit is little-endian\n    for i, bit in enumerate(rev):\n        if bit == \"0\":\n            qc.x(i)\n    qc.h(n - 1)                     # multi-controlled Z\n    qc.mcx(list(range(n - 1)), n - 1)\n    qc.h(n - 1)\n    for i, bit in enumerate(rev):\n        if bit == \"0\":\n            qc.x(i)\n    return qc\n",[7416],{"type":21,"tag":2073,"props":7417,"children":7418},{"__ignoreMap":7},[7419,7436,7444,7479,7513,7538,7564,7572,7598,7649,7668,7691,7714,7721],{"type":21,"tag":2314,"props":7420,"children":7421},{"class":2316,"line":2317},[7422,7426,7431],{"type":21,"tag":2314,"props":7423,"children":7424},{"style":3157},[7425],{"type":26,"value":4315},{"type":21,"tag":2314,"props":7427,"children":7428},{"style":4318},[7429],{"type":26,"value":7430}," oracle",{"type":21,"tag":2314,"props":7432,"children":7433},{"style":2321},[7434],{"type":26,"value":7435},"(n, marked):\n",{"type":21,"tag":2314,"props":7437,"children":7438},{"class":2316,"line":106},[7439],{"type":21,"tag":2314,"props":7440,"children":7441},{"style":2350},[7442],{"type":26,"value":7443},"    \"\"\"Phase-flip the marked basis state.\"\"\"\n",{"type":21,"tag":2314,"props":7445,"children":7446},{"class":2316,"line":2335},[7447,7452,7456,7461,7466,7470,7475],{"type":21,"tag":2314,"props":7448,"children":7449},{"style":2321},[7450],{"type":26,"value":7451},"    qc ",{"type":21,"tag":2314,"props":7453,"children":7454},{"style":3157},[7455],{"type":26,"value":3197},{"type":21,"tag":2314,"props":7457,"children":7458},{"style":2321},[7459],{"type":26,"value":7460}," QuantumCircuit(n, ",{"type":21,"tag":2314,"props":7462,"children":7463},{"style":3222},[7464],{"type":26,"value":7465},"name",{"type":21,"tag":2314,"props":7467,"children":7468},{"style":3157},[7469],{"type":26,"value":3197},{"type":21,"tag":2314,"props":7471,"children":7472},{"style":2350},[7473],{"type":26,"value":7474},"\"Oracle\"",{"type":21,"tag":2314,"props":7476,"children":7477},{"style":2321},[7478],{"type":26,"value":3257},{"type":21,"tag":2314,"props":7480,"children":7481},{"class":2316,"line":2397},[7482,7487,7491,7496,7500,7504,7509],{"type":21,"tag":2314,"props":7483,"children":7484},{"style":2321},[7485],{"type":26,"value":7486},"    rev ",{"type":21,"tag":2314,"props":7488,"children":7489},{"style":3157},[7490],{"type":26,"value":3197},{"type":21,"tag":2314,"props":7492,"children":7493},{"style":2321},[7494],{"type":26,"value":7495}," marked[::",{"type":21,"tag":2314,"props":7497,"children":7498},{"style":3157},[7499],{"type":26,"value":4802},{"type":21,"tag":2314,"props":7501,"children":7502},{"style":2339},[7503],{"type":26,"value":3513},{"type":21,"tag":2314,"props":7505,"children":7506},{"style":2321},[7507],{"type":26,"value":7508},"]              ",{"type":21,"tag":2314,"props":7510,"children":7511},{"style":3407},[7512],{"type":26,"value":4816},{"type":21,"tag":2314,"props":7514,"children":7515},{"class":2316,"line":2421},[7516,7520,7525,7529,7533],{"type":21,"tag":2314,"props":7517,"children":7518},{"style":3157},[7519],{"type":26,"value":4694},{"type":21,"tag":2314,"props":7521,"children":7522},{"style":2321},[7523],{"type":26,"value":7524}," i, bit ",{"type":21,"tag":2314,"props":7526,"children":7527},{"style":3157},[7528],{"type":26,"value":3460},{"type":21,"tag":2314,"props":7530,"children":7531},{"style":2339},[7532],{"type":26,"value":4839},{"type":21,"tag":2314,"props":7534,"children":7535},{"style":2321},[7536],{"type":26,"value":7537},"(rev):\n",{"type":21,"tag":2314,"props":7539,"children":7540},{"class":2316,"line":16},[7541,7546,7551,7555,7560],{"type":21,"tag":2314,"props":7542,"children":7543},{"style":3157},[7544],{"type":26,"value":7545},"        if",{"type":21,"tag":2314,"props":7547,"children":7548},{"style":2321},[7549],{"type":26,"value":7550}," bit ",{"type":21,"tag":2314,"props":7552,"children":7553},{"style":3157},[7554],{"type":26,"value":4863},{"type":21,"tag":2314,"props":7556,"children":7557},{"style":2350},[7558],{"type":26,"value":7559}," \"0\"",{"type":21,"tag":2314,"props":7561,"children":7562},{"style":2321},[7563],{"type":26,"value":4873},{"type":21,"tag":2314,"props":7565,"children":7566},{"class":2316,"line":127},[7567],{"type":21,"tag":2314,"props":7568,"children":7569},{"style":2321},[7570],{"type":26,"value":7571},"            qc.x(i)\n",{"type":21,"tag":2314,"props":7573,"children":7574},{"class":2316,"line":887},[7575,7580,7584,7588,7593],{"type":21,"tag":2314,"props":7576,"children":7577},{"style":2321},[7578],{"type":26,"value":7579},"    qc.h(n ",{"type":21,"tag":2314,"props":7581,"children":7582},{"style":3157},[7583],{"type":26,"value":4802},{"type":21,"tag":2314,"props":7585,"children":7586},{"style":2339},[7587],{"type":26,"value":6053},{"type":21,"tag":2314,"props":7589,"children":7590},{"style":2321},[7591],{"type":26,"value":7592},")                     ",{"type":21,"tag":2314,"props":7594,"children":7595},{"style":3407},[7596],{"type":26,"value":7597},"# multi-controlled Z\n",{"type":21,"tag":2314,"props":7599,"children":7600},{"class":2316,"line":1364},[7601,7606,7611,7615,7619,7624,7628,7632,7637,7641,7645],{"type":21,"tag":2314,"props":7602,"children":7603},{"style":2321},[7604],{"type":26,"value":7605},"    qc.mcx(",{"type":21,"tag":2314,"props":7607,"children":7608},{"style":2339},[7609],{"type":26,"value":7610},"list",{"type":21,"tag":2314,"props":7612,"children":7613},{"style":2321},[7614],{"type":26,"value":3277},{"type":21,"tag":2314,"props":7616,"children":7617},{"style":2339},[7618],{"type":26,"value":4896},{"type":21,"tag":2314,"props":7620,"children":7621},{"style":2321},[7622],{"type":26,"value":7623},"(n ",{"type":21,"tag":2314,"props":7625,"children":7626},{"style":3157},[7627],{"type":26,"value":4802},{"type":21,"tag":2314,"props":7629,"children":7630},{"style":2339},[7631],{"type":26,"value":6053},{"type":21,"tag":2314,"props":7633,"children":7634},{"style":2321},[7635],{"type":26,"value":7636},")), n ",{"type":21,"tag":2314,"props":7638,"children":7639},{"style":3157},[7640],{"type":26,"value":4802},{"type":21,"tag":2314,"props":7642,"children":7643},{"style":2339},[7644],{"type":26,"value":6053},{"type":21,"tag":2314,"props":7646,"children":7647},{"style":2321},[7648],{"type":26,"value":3257},{"type":21,"tag":2314,"props":7650,"children":7651},{"class":2316,"line":3403},[7652,7656,7660,7664],{"type":21,"tag":2314,"props":7653,"children":7654},{"style":2321},[7655],{"type":26,"value":7579},{"type":21,"tag":2314,"props":7657,"children":7658},{"style":3157},[7659],{"type":26,"value":4802},{"type":21,"tag":2314,"props":7661,"children":7662},{"style":2339},[7663],{"type":26,"value":6053},{"type":21,"tag":2314,"props":7665,"children":7666},{"style":2321},[7667],{"type":26,"value":3257},{"type":21,"tag":2314,"props":7669,"children":7670},{"class":2316,"line":3413},[7671,7675,7679,7683,7687],{"type":21,"tag":2314,"props":7672,"children":7673},{"style":3157},[7674],{"type":26,"value":4694},{"type":21,"tag":2314,"props":7676,"children":7677},{"style":2321},[7678],{"type":26,"value":7524},{"type":21,"tag":2314,"props":7680,"children":7681},{"style":3157},[7682],{"type":26,"value":3460},{"type":21,"tag":2314,"props":7684,"children":7685},{"style":2339},[7686],{"type":26,"value":4839},{"type":21,"tag":2314,"props":7688,"children":7689},{"style":2321},[7690],{"type":26,"value":7537},{"type":21,"tag":2314,"props":7692,"children":7693},{"class":2316,"line":436},[7694,7698,7702,7706,7710],{"type":21,"tag":2314,"props":7695,"children":7696},{"style":3157},[7697],{"type":26,"value":7545},{"type":21,"tag":2314,"props":7699,"children":7700},{"style":2321},[7701],{"type":26,"value":7550},{"type":21,"tag":2314,"props":7703,"children":7704},{"style":3157},[7705],{"type":26,"value":4863},{"type":21,"tag":2314,"props":7707,"children":7708},{"style":2350},[7709],{"type":26,"value":7559},{"type":21,"tag":2314,"props":7711,"children":7712},{"style":2321},[7713],{"type":26,"value":4873},{"type":21,"tag":2314,"props":7715,"children":7716},{"class":2316,"line":3473},[7717],{"type":21,"tag":2314,"props":7718,"children":7719},{"style":2321},[7720],{"type":26,"value":7571},{"type":21,"tag":2314,"props":7722,"children":7723},{"class":2316,"line":3521},[7724,7728],{"type":21,"tag":2314,"props":7725,"children":7726},{"style":3157},[7727],{"type":26,"value":4540},{"type":21,"tag":2314,"props":7729,"children":7730},{"style":2321},[7731],{"type":26,"value":7732}," qc\n",{"type":21,"tag":22,"props":7734,"children":7735},{},[7736,7738,7743,7745,7751,7753,7759],{"type":26,"value":7737},"Watch the endianness. Qiskit orders bitstrings with qubit 0 on the ",{"type":21,"tag":136,"props":7739,"children":7740},{},[7741],{"type":26,"value":7742},"right",{"type":26,"value":7744},", so ",{"type":21,"tag":2073,"props":7746,"children":7748},{"className":7747},[],[7749],{"type":26,"value":7750},"marked[::-1]",{"type":26,"value":7752}," maps the string to qubit indices. Getting this backwards is the second most common bug in Grover implementations and it fails silently. You'll amplify ",{"type":21,"tag":2073,"props":7754,"children":7756},{"className":7755},[],[7757],{"type":26,"value":7758},"101",{"type":26,"value":7760}," reversed and wonder why.",{"type":21,"tag":29,"props":7762,"children":7764},{"id":7763},"step-3-the-diffusion-operator",[7765],{"type":26,"value":7766},"Step 3: The Diffusion Operator",{"type":21,"tag":22,"props":7768,"children":7769},{},[7770],{"type":26,"value":7771},"Inversion about the mean is H⊗n, then X⊗n, then a multi-controlled Z, then X⊗n, then H⊗n. Structurally it's a reflection about the uniform superposition state:",{"type":21,"tag":2304,"props":7773,"children":7775},{"code":7774,"language":3147,"meta":7,"className":3145,"style":7},"def diffuser(n):\n    \"\"\"Inversion about the mean.\"\"\"\n    qc = QuantumCircuit(n, name=\"Diffuser\")\n    qc.h(range(n))\n    qc.x(range(n))\n    qc.h(n - 1)\n    qc.mcx(list(range(n - 1)), n - 1)\n    qc.h(n - 1)\n    qc.x(range(n))\n    qc.h(range(n))\n    return qc\n",[7776],{"type":21,"tag":2073,"props":7777,"children":7778},{"__ignoreMap":7},[7779,7796,7804,7836,7852,7868,7887,7934,7953,7968,7983],{"type":21,"tag":2314,"props":7780,"children":7781},{"class":2316,"line":2317},[7782,7786,7791],{"type":21,"tag":2314,"props":7783,"children":7784},{"style":3157},[7785],{"type":26,"value":4315},{"type":21,"tag":2314,"props":7787,"children":7788},{"style":4318},[7789],{"type":26,"value":7790}," diffuser",{"type":21,"tag":2314,"props":7792,"children":7793},{"style":2321},[7794],{"type":26,"value":7795},"(n):\n",{"type":21,"tag":2314,"props":7797,"children":7798},{"class":2316,"line":106},[7799],{"type":21,"tag":2314,"props":7800,"children":7801},{"style":2350},[7802],{"type":26,"value":7803},"    \"\"\"Inversion about the mean.\"\"\"\n",{"type":21,"tag":2314,"props":7805,"children":7806},{"class":2316,"line":2335},[7807,7811,7815,7819,7823,7827,7832],{"type":21,"tag":2314,"props":7808,"children":7809},{"style":2321},[7810],{"type":26,"value":7451},{"type":21,"tag":2314,"props":7812,"children":7813},{"style":3157},[7814],{"type":26,"value":3197},{"type":21,"tag":2314,"props":7816,"children":7817},{"style":2321},[7818],{"type":26,"value":7460},{"type":21,"tag":2314,"props":7820,"children":7821},{"style":3222},[7822],{"type":26,"value":7465},{"type":21,"tag":2314,"props":7824,"children":7825},{"style":3157},[7826],{"type":26,"value":3197},{"type":21,"tag":2314,"props":7828,"children":7829},{"style":2350},[7830],{"type":26,"value":7831},"\"Diffuser\"",{"type":21,"tag":2314,"props":7833,"children":7834},{"style":2321},[7835],{"type":26,"value":3257},{"type":21,"tag":2314,"props":7837,"children":7838},{"class":2316,"line":2397},[7839,7844,7848],{"type":21,"tag":2314,"props":7840,"children":7841},{"style":2321},[7842],{"type":26,"value":7843},"    qc.h(",{"type":21,"tag":2314,"props":7845,"children":7846},{"style":2339},[7847],{"type":26,"value":4896},{"type":21,"tag":2314,"props":7849,"children":7850},{"style":2321},[7851],{"type":26,"value":4910},{"type":21,"tag":2314,"props":7853,"children":7854},{"class":2316,"line":2421},[7855,7860,7864],{"type":21,"tag":2314,"props":7856,"children":7857},{"style":2321},[7858],{"type":26,"value":7859},"    qc.x(",{"type":21,"tag":2314,"props":7861,"children":7862},{"style":2339},[7863],{"type":26,"value":4896},{"type":21,"tag":2314,"props":7865,"children":7866},{"style":2321},[7867],{"type":26,"value":4910},{"type":21,"tag":2314,"props":7869,"children":7870},{"class":2316,"line":16},[7871,7875,7879,7883],{"type":21,"tag":2314,"props":7872,"children":7873},{"style":2321},[7874],{"type":26,"value":7579},{"type":21,"tag":2314,"props":7876,"children":7877},{"style":3157},[7878],{"type":26,"value":4802},{"type":21,"tag":2314,"props":7880,"children":7881},{"style":2339},[7882],{"type":26,"value":6053},{"type":21,"tag":2314,"props":7884,"children":7885},{"style":2321},[7886],{"type":26,"value":3257},{"type":21,"tag":2314,"props":7888,"children":7889},{"class":2316,"line":127},[7890,7894,7898,7902,7906,7910,7914,7918,7922,7926,7930],{"type":21,"tag":2314,"props":7891,"children":7892},{"style":2321},[7893],{"type":26,"value":7605},{"type":21,"tag":2314,"props":7895,"children":7896},{"style":2339},[7897],{"type":26,"value":7610},{"type":21,"tag":2314,"props":7899,"children":7900},{"style":2321},[7901],{"type":26,"value":3277},{"type":21,"tag":2314,"props":7903,"children":7904},{"style":2339},[7905],{"type":26,"value":4896},{"type":21,"tag":2314,"props":7907,"children":7908},{"style":2321},[7909],{"type":26,"value":7623},{"type":21,"tag":2314,"props":7911,"children":7912},{"style":3157},[7913],{"type":26,"value":4802},{"type":21,"tag":2314,"props":7915,"children":7916},{"style":2339},[7917],{"type":26,"value":6053},{"type":21,"tag":2314,"props":7919,"children":7920},{"style":2321},[7921],{"type":26,"value":7636},{"type":21,"tag":2314,"props":7923,"children":7924},{"style":3157},[7925],{"type":26,"value":4802},{"type":21,"tag":2314,"props":7927,"children":7928},{"style":2339},[7929],{"type":26,"value":6053},{"type":21,"tag":2314,"props":7931,"children":7932},{"style":2321},[7933],{"type":26,"value":3257},{"type":21,"tag":2314,"props":7935,"children":7936},{"class":2316,"line":887},[7937,7941,7945,7949],{"type":21,"tag":2314,"props":7938,"children":7939},{"style":2321},[7940],{"type":26,"value":7579},{"type":21,"tag":2314,"props":7942,"children":7943},{"style":3157},[7944],{"type":26,"value":4802},{"type":21,"tag":2314,"props":7946,"children":7947},{"style":2339},[7948],{"type":26,"value":6053},{"type":21,"tag":2314,"props":7950,"children":7951},{"style":2321},[7952],{"type":26,"value":3257},{"type":21,"tag":2314,"props":7954,"children":7955},{"class":2316,"line":1364},[7956,7960,7964],{"type":21,"tag":2314,"props":7957,"children":7958},{"style":2321},[7959],{"type":26,"value":7859},{"type":21,"tag":2314,"props":7961,"children":7962},{"style":2339},[7963],{"type":26,"value":4896},{"type":21,"tag":2314,"props":7965,"children":7966},{"style":2321},[7967],{"type":26,"value":4910},{"type":21,"tag":2314,"props":7969,"children":7970},{"class":2316,"line":3403},[7971,7975,7979],{"type":21,"tag":2314,"props":7972,"children":7973},{"style":2321},[7974],{"type":26,"value":7843},{"type":21,"tag":2314,"props":7976,"children":7977},{"style":2339},[7978],{"type":26,"value":4896},{"type":21,"tag":2314,"props":7980,"children":7981},{"style":2321},[7982],{"type":26,"value":4910},{"type":21,"tag":2314,"props":7984,"children":7985},{"class":2316,"line":3413},[7986,7990],{"type":21,"tag":2314,"props":7987,"children":7988},{"style":3157},[7989],{"type":26,"value":4540},{"type":21,"tag":2314,"props":7991,"children":7992},{"style":2321},[7993],{"type":26,"value":7732},{"type":21,"tag":22,"props":7995,"children":7996},{},[7997,7999,8005],{"type":26,"value":7998},"Note the diffuser knows nothing about the marked state. It is the same ",{"type":21,"tag":46,"props":8000,"children":8002},{"href":8001},"\u002Fglossary\u002Fquantum-circuit",[8003],{"type":26,"value":8004},"circuit",{"type":26,"value":8006}," for every search problem. Only the oracle changes.",{"type":21,"tag":29,"props":8008,"children":8010},{"id":8009},"step-4-iterate-the-right-number-of-times",[8011],{"type":26,"value":8012},"Step 4: Iterate the Right Number of Times",{"type":21,"tag":22,"props":8014,"children":8015},{},[8016],{"type":26,"value":8017},"This is where people go wrong. The optimal count is:",{"type":21,"tag":2304,"props":8019,"children":8021},{"code":8020},"k = floor( (π\u002F4) · √(N\u002FM) )\n",[8022],{"type":21,"tag":2073,"props":8023,"children":8024},{"__ignoreMap":7},[8025],{"type":26,"value":8020},{"type":21,"tag":22,"props":8027,"children":8028},{},[8029,8031,8035],{"type":26,"value":8030},"where N = 2ⁿ and M is the number of marked states. For N = 8, M = 1: k = floor(2.22) = ",{"type":21,"tag":136,"props":8032,"children":8033},{},[8034],{"type":26,"value":2413},{"type":26,"value":761},{"type":21,"tag":22,"props":8037,"children":8038},{},[8039],{"type":26,"value":8040},"Here's the complete program:",{"type":21,"tag":2304,"props":8042,"children":8044},{"code":8043,"language":3147,"meta":7,"className":3145,"style":7},"def grover(n, marked, iterations):\n    qc = QuantumCircuit(n, n)\n    qc.h(range(n))                       # uniform superposition\n    orc, dif = oracle(n, marked), diffuser(n)\n    for _ in range(iterations):\n        qc.compose(orc, inplace=True)    # phase-flip the target\n        qc.compose(dif, inplace=True)    # amplify it\n    qc.measure(range(n), range(n))\n    return qc\n\nN = 2 ** n\noptimal = math.floor(math.pi \u002F 4 * math.sqrt(N))\nprint(f\"N = {N}, optimal iterations = {optimal}\")\n\nsim = AerSimulator()\nqc = grover(n, marked, optimal)\ncounts = sim.run(transpile(qc, sim), shots=4096).result().get_counts()\nprint(sorted(counts.items()))\n",[8045],{"type":21,"tag":2073,"props":8046,"children":8047},{"__ignoreMap":7},[8048,8065,8080,8100,8117,8141,8172,8201,8225,8236,8243,8269,8305,8364,8371,8388,8404,8438],{"type":21,"tag":2314,"props":8049,"children":8050},{"class":2316,"line":2317},[8051,8055,8060],{"type":21,"tag":2314,"props":8052,"children":8053},{"style":3157},[8054],{"type":26,"value":4315},{"type":21,"tag":2314,"props":8056,"children":8057},{"style":4318},[8058],{"type":26,"value":8059}," grover",{"type":21,"tag":2314,"props":8061,"children":8062},{"style":2321},[8063],{"type":26,"value":8064},"(n, marked, iterations):\n",{"type":21,"tag":2314,"props":8066,"children":8067},{"class":2316,"line":106},[8068,8072,8076],{"type":21,"tag":2314,"props":8069,"children":8070},{"style":2321},[8071],{"type":26,"value":7451},{"type":21,"tag":2314,"props":8073,"children":8074},{"style":3157},[8075],{"type":26,"value":3197},{"type":21,"tag":2314,"props":8077,"children":8078},{"style":2321},[8079],{"type":26,"value":4742},{"type":21,"tag":2314,"props":8081,"children":8082},{"class":2316,"line":2335},[8083,8087,8091,8096],{"type":21,"tag":2314,"props":8084,"children":8085},{"style":2321},[8086],{"type":26,"value":7843},{"type":21,"tag":2314,"props":8088,"children":8089},{"style":2339},[8090],{"type":26,"value":4896},{"type":21,"tag":2314,"props":8092,"children":8093},{"style":2321},[8094],{"type":26,"value":8095},"(n))                       ",{"type":21,"tag":2314,"props":8097,"children":8098},{"style":3407},[8099],{"type":26,"value":7366},{"type":21,"tag":2314,"props":8101,"children":8102},{"class":2316,"line":2397},[8103,8108,8112],{"type":21,"tag":2314,"props":8104,"children":8105},{"style":2321},[8106],{"type":26,"value":8107},"    orc, dif ",{"type":21,"tag":2314,"props":8109,"children":8110},{"style":3157},[8111],{"type":26,"value":3197},{"type":21,"tag":2314,"props":8113,"children":8114},{"style":2321},[8115],{"type":26,"value":8116}," oracle(n, marked), diffuser(n)\n",{"type":21,"tag":2314,"props":8118,"children":8119},{"class":2316,"line":2421},[8120,8124,8128,8132,8136],{"type":21,"tag":2314,"props":8121,"children":8122},{"style":3157},[8123],{"type":26,"value":4694},{"type":21,"tag":2314,"props":8125,"children":8126},{"style":2321},[8127],{"type":26,"value":6095},{"type":21,"tag":2314,"props":8129,"children":8130},{"style":3157},[8131],{"type":26,"value":3460},{"type":21,"tag":2314,"props":8133,"children":8134},{"style":2339},[8135],{"type":26,"value":3465},{"type":21,"tag":2314,"props":8137,"children":8138},{"style":2321},[8139],{"type":26,"value":8140},"(iterations):\n",{"type":21,"tag":2314,"props":8142,"children":8143},{"class":2316,"line":16},[8144,8149,8154,8158,8162,8167],{"type":21,"tag":2314,"props":8145,"children":8146},{"style":2321},[8147],{"type":26,"value":8148},"        qc.compose(orc, ",{"type":21,"tag":2314,"props":8150,"children":8151},{"style":3222},[8152],{"type":26,"value":8153},"inplace",{"type":21,"tag":2314,"props":8155,"children":8156},{"style":3157},[8157],{"type":26,"value":3197},{"type":21,"tag":2314,"props":8159,"children":8160},{"style":2339},[8161],{"type":26,"value":3234},{"type":21,"tag":2314,"props":8163,"children":8164},{"style":2321},[8165],{"type":26,"value":8166},")    ",{"type":21,"tag":2314,"props":8168,"children":8169},{"style":3407},[8170],{"type":26,"value":8171},"# phase-flip the target\n",{"type":21,"tag":2314,"props":8173,"children":8174},{"class":2316,"line":127},[8175,8180,8184,8188,8192,8196],{"type":21,"tag":2314,"props":8176,"children":8177},{"style":2321},[8178],{"type":26,"value":8179},"        qc.compose(dif, ",{"type":21,"tag":2314,"props":8181,"children":8182},{"style":3222},[8183],{"type":26,"value":8153},{"type":21,"tag":2314,"props":8185,"children":8186},{"style":3157},[8187],{"type":26,"value":3197},{"type":21,"tag":2314,"props":8189,"children":8190},{"style":2339},[8191],{"type":26,"value":3234},{"type":21,"tag":2314,"props":8193,"children":8194},{"style":2321},[8195],{"type":26,"value":8166},{"type":21,"tag":2314,"props":8197,"children":8198},{"style":3407},[8199],{"type":26,"value":8200},"# amplify it\n",{"type":21,"tag":2314,"props":8202,"children":8203},{"class":2316,"line":887},[8204,8209,8213,8217,8221],{"type":21,"tag":2314,"props":8205,"children":8206},{"style":2321},[8207],{"type":26,"value":8208},"    qc.measure(",{"type":21,"tag":2314,"props":8210,"children":8211},{"style":2339},[8212],{"type":26,"value":4896},{"type":21,"tag":2314,"props":8214,"children":8215},{"style":2321},[8216],{"type":26,"value":4901},{"type":21,"tag":2314,"props":8218,"children":8219},{"style":2339},[8220],{"type":26,"value":4896},{"type":21,"tag":2314,"props":8222,"children":8223},{"style":2321},[8224],{"type":26,"value":4910},{"type":21,"tag":2314,"props":8226,"children":8227},{"class":2316,"line":1364},[8228,8232],{"type":21,"tag":2314,"props":8229,"children":8230},{"style":3157},[8231],{"type":26,"value":4540},{"type":21,"tag":2314,"props":8233,"children":8234},{"style":2321},[8235],{"type":26,"value":7732},{"type":21,"tag":2314,"props":8237,"children":8238},{"class":2316,"line":3403},[8239],{"type":21,"tag":2314,"props":8240,"children":8241},{"emptyLinePlaceholder":3181},[8242],{"type":26,"value":3184},{"type":21,"tag":2314,"props":8244,"children":8245},{"class":2316,"line":3413},[8246,8251,8255,8259,8264],{"type":21,"tag":2314,"props":8247,"children":8248},{"style":2321},[8249],{"type":26,"value":8250},"N ",{"type":21,"tag":2314,"props":8252,"children":8253},{"style":3157},[8254],{"type":26,"value":3197},{"type":21,"tag":2314,"props":8256,"children":8257},{"style":2339},[8258],{"type":26,"value":6338},{"type":21,"tag":2314,"props":8260,"children":8261},{"style":3157},[8262],{"type":26,"value":8263}," **",{"type":21,"tag":2314,"props":8265,"children":8266},{"style":2321},[8267],{"type":26,"value":8268}," n\n",{"type":21,"tag":2314,"props":8270,"children":8271},{"class":2316,"line":436},[8272,8277,8281,8286,8290,8295,8300],{"type":21,"tag":2314,"props":8273,"children":8274},{"style":2321},[8275],{"type":26,"value":8276},"optimal ",{"type":21,"tag":2314,"props":8278,"children":8279},{"style":3157},[8280],{"type":26,"value":3197},{"type":21,"tag":2314,"props":8282,"children":8283},{"style":2321},[8284],{"type":26,"value":8285}," math.floor(math.pi ",{"type":21,"tag":2314,"props":8287,"children":8288},{"style":3157},[8289],{"type":26,"value":2168},{"type":21,"tag":2314,"props":8291,"children":8292},{"style":2339},[8293],{"type":26,"value":8294}," 4",{"type":21,"tag":2314,"props":8296,"children":8297},{"style":3157},[8298],{"type":26,"value":8299}," *",{"type":21,"tag":2314,"props":8301,"children":8302},{"style":2321},[8303],{"type":26,"value":8304}," math.sqrt(N))\n",{"type":21,"tag":2314,"props":8306,"children":8307},{"class":2316,"line":3473},[8308,8312,8316,8320,8325,8329,8334,8338,8343,8347,8352,8356,8360],{"type":21,"tag":2314,"props":8309,"children":8310},{"style":2339},[8311],{"type":26,"value":3272},{"type":21,"tag":2314,"props":8313,"children":8314},{"style":2321},[8315],{"type":26,"value":3277},{"type":21,"tag":2314,"props":8317,"children":8318},{"style":3157},[8319],{"type":26,"value":3282},{"type":21,"tag":2314,"props":8321,"children":8322},{"style":2350},[8323],{"type":26,"value":8324},"\"N = ",{"type":21,"tag":2314,"props":8326,"children":8327},{"style":2339},[8328],{"type":26,"value":3292},{"type":21,"tag":2314,"props":8330,"children":8331},{"style":2321},[8332],{"type":26,"value":8333},"N",{"type":21,"tag":2314,"props":8335,"children":8336},{"style":2339},[8337],{"type":26,"value":3302},{"type":21,"tag":2314,"props":8339,"children":8340},{"style":2350},[8341],{"type":26,"value":8342},", optimal iterations = ",{"type":21,"tag":2314,"props":8344,"children":8345},{"style":2339},[8346],{"type":26,"value":3292},{"type":21,"tag":2314,"props":8348,"children":8349},{"style":2321},[8350],{"type":26,"value":8351},"optimal",{"type":21,"tag":2314,"props":8353,"children":8354},{"style":2339},[8355],{"type":26,"value":3302},{"type":21,"tag":2314,"props":8357,"children":8358},{"style":2350},[8359],{"type":26,"value":3307},{"type":21,"tag":2314,"props":8361,"children":8362},{"style":2321},[8363],{"type":26,"value":3257},{"type":21,"tag":2314,"props":8365,"children":8366},{"class":2316,"line":3521},[8367],{"type":21,"tag":2314,"props":8368,"children":8369},{"emptyLinePlaceholder":3181},[8370],{"type":26,"value":3184},{"type":21,"tag":2314,"props":8372,"children":8373},{"class":2316,"line":3563},[8374,8379,8383],{"type":21,"tag":2314,"props":8375,"children":8376},{"style":2321},[8377],{"type":26,"value":8378},"sim ",{"type":21,"tag":2314,"props":8380,"children":8381},{"style":3157},[8382],{"type":26,"value":3197},{"type":21,"tag":2314,"props":8384,"children":8385},{"style":2321},[8386],{"type":26,"value":8387}," AerSimulator()\n",{"type":21,"tag":2314,"props":8389,"children":8390},{"class":2316,"line":4585},[8391,8395,8399],{"type":21,"tag":2314,"props":8392,"children":8393},{"style":2321},[8394],{"type":26,"value":7336},{"type":21,"tag":2314,"props":8396,"children":8397},{"style":3157},[8398],{"type":26,"value":3197},{"type":21,"tag":2314,"props":8400,"children":8401},{"style":2321},[8402],{"type":26,"value":8403}," grover(n, marked, optimal)\n",{"type":21,"tag":2314,"props":8405,"children":8406},{"class":2316,"line":4604},[8407,8412,8416,8421,8425,8429,8434],{"type":21,"tag":2314,"props":8408,"children":8409},{"style":2321},[8410],{"type":26,"value":8411},"counts ",{"type":21,"tag":2314,"props":8413,"children":8414},{"style":3157},[8415],{"type":26,"value":3197},{"type":21,"tag":2314,"props":8417,"children":8418},{"style":2321},[8419],{"type":26,"value":8420}," sim.run(transpile(qc, sim), ",{"type":21,"tag":2314,"props":8422,"children":8423},{"style":3222},[8424],{"type":26,"value":4077},{"type":21,"tag":2314,"props":8426,"children":8427},{"style":3157},[8428],{"type":26,"value":3197},{"type":21,"tag":2314,"props":8430,"children":8431},{"style":2339},[8432],{"type":26,"value":8433},"4096",{"type":21,"tag":2314,"props":8435,"children":8436},{"style":2321},[8437],{"type":26,"value":5236},{"type":21,"tag":2314,"props":8439,"children":8440},{"class":2316,"line":4612},[8441,8445,8449,8454],{"type":21,"tag":2314,"props":8442,"children":8443},{"style":2339},[8444],{"type":26,"value":3272},{"type":21,"tag":2314,"props":8446,"children":8447},{"style":2321},[8448],{"type":26,"value":3277},{"type":21,"tag":2314,"props":8450,"children":8451},{"style":2339},[8452],{"type":26,"value":8453},"sorted",{"type":21,"tag":2314,"props":8455,"children":8456},{"style":2321},[8457],{"type":26,"value":8458},"(counts.items()))\n",{"type":21,"tag":22,"props":8460,"children":8461},{},[8462],{"type":26,"value":8463},"Real output from this exact code (Qiskit 2.5, Aer 0.17):",{"type":21,"tag":2304,"props":8465,"children":8467},{"code":8466},"N = 8, optimal iterations = 2\n[('000', 35), ('001', 34), ('010', 33), ('011', 27),\n ('100', 33), ('101', 3866), ('110', 35), ('111', 33)]\n",[8468],{"type":21,"tag":2073,"props":8469,"children":8470},{"__ignoreMap":7},[8471],{"type":26,"value":8466},{"type":21,"tag":22,"props":8473,"children":8474},{},[8475,8477,8482],{"type":26,"value":8476},"94.4% on ",{"type":21,"tag":2073,"props":8478,"children":8480},{"className":8479},[],[8481],{"type":26,"value":7758},{"type":26,"value":8483},", versus 12.5% by chance. Two oracle calls where classical search would need 4.5 on average.",{"type":21,"tag":29,"props":8485,"children":8487},{"id":8486},"the-mistake-more-iterations-make-it-worse",[8488],{"type":26,"value":8489},"The Mistake: More Iterations Make It Worse",{"type":21,"tag":22,"props":8491,"children":8492},{},[8493,8495,8500],{"type":26,"value":8494},"The intuition \"more amplification is better\" is wrong, and it's the single biggest trap in Grover's algorithm. Each iteration rotates the state by a ",{"type":21,"tag":136,"props":8496,"children":8497},{},[8498],{"type":26,"value":8499},"fixed",{"type":26,"value":8501}," angle θ where sin(θ\u002F2) = √(M\u002FN). After the optimal number of rounds you're aligned with the target. Keep going and you rotate straight past it, back down toward the unmarked states, and eventually back to where you started. Success probability oscillates as sin²((2k+1)·θ\u002F2).",{"type":21,"tag":22,"props":8503,"children":8504},{},[8505],{"type":26,"value":8506},"Loop the iteration count and watch. Measured counts over 4096 shots each:",{"type":21,"tag":2304,"props":8508,"children":8510},{"code":8509},"iters=0  P(101)=0.127   \u003C- uniform, no better than guessing\niters=1  P(101)=0.779\niters=2  P(101)=0.944   \u003C- optimal\niters=3  P(101)=0.320   \u003C- overshooting\niters=4  P(101)=0.013   \u003C- worse than random guessing!\niters=5  P(101)=0.556\niters=6  P(101)=1.000   \u003C- period brings it back around\niters=7  P(101)=0.586\n",[8511],{"type":21,"tag":2073,"props":8512,"children":8513},{"__ignoreMap":7},[8514],{"type":26,"value":8509},{"type":21,"tag":22,"props":8516,"children":8517},{},[8518,8520,8525],{"type":26,"value":8519},"Four iterations gives you a 1.3% success rate. You did ",{"type":21,"tag":362,"props":8521,"children":8522},{},[8523],{"type":26,"value":8524},"twice",{"type":26,"value":8526}," the optimal work and ended up nine times worse than doing nothing at all. This is not noise or a bug. It is exactly what the math says should happen, and it's the reason you must compute k in advance rather than \"running it a while\".",{"type":21,"tag":22,"props":8528,"children":8529},{},[8530,8532,8537],{"type":26,"value":8531},"The awkward corollary: computing k requires knowing M, the number of solutions. If you don't know how many marked states exist, you need ",{"type":21,"tag":136,"props":8533,"children":8534},{},[8535],{"type":26,"value":8536},"quantum counting",{"type":26,"value":8538}," (an amplitude-estimation routine) first, or you use randomized iteration counts, which costs you a constant factor. Textbook presentations tend to skip this.",{"type":21,"tag":29,"props":8540,"children":8542},{"id":8541},"what-the-speedup-buys-you",[8543],{"type":26,"value":8544},"What the Speedup Buys You",{"type":21,"tag":22,"props":8546,"children":8547},{},[8548],{"type":26,"value":8549},"Be precise about this, because a lot of writing on Grover is not.",{"type":21,"tag":22,"props":8551,"children":8552},{},[8553,8558,8560,8566],{"type":21,"tag":136,"props":8554,"children":8555},{},[8556],{"type":26,"value":8557},"It is quadratic, not exponential.",{"type":26,"value":8559}," √N versus N. ",{"type":21,"tag":46,"props":8561,"children":8563},{"href":8562},"\u002Fresearch\u002Fshor-factoring-1994",[8564],{"type":26,"value":8565},"Shor's factoring algorithm",{"type":26,"value":8567}," is exponential. That's a categorically different thing. A quadratic speedup is real and provably optimal (no quantum algorithm beats √N for unstructured search), but it is fragile: error correction's constant-factor overhead often eats it entirely, and that overhead is substantial.",{"type":21,"tag":22,"props":8569,"children":8570},{},[8571,8576],{"type":21,"tag":136,"props":8572,"children":8573},{},[8574],{"type":26,"value":8575},"It does not make NP-hard problems easy.",{"type":26,"value":8577}," Apply Grover to brute-force SAT and go from 2ⁿ to 2^(n\u002F2). That's a genuine improvement, and it is also still exponential. NP-hard problems remain NP-hard. Real SAT solvers use clause learning and structure that Grover, by definition, cannot exploit. That is why classical solvers routinely handle instances with millions of variables.",{"type":21,"tag":22,"props":8579,"children":8580},{},[8581,8586,8588,8593,8595,8600],{"type":21,"tag":136,"props":8582,"children":8583},{},[8584],{"type":26,"value":8585},"The \"database search\" framing is misleading.",{"type":26,"value":8587}," Grover needs an ",{"type":21,"tag":362,"props":8589,"children":8590},{},[8591],{"type":26,"value":8592},"oracle",{"type":26,"value":8594}," (a circuit that recognizes the answer), not a stored database. If you had N records in memory, you would first need to load them into quantum superposition, which costs O(N) and destroys the speedup outright. Grover is useful when the marked item is ",{"type":21,"tag":362,"props":8596,"children":8597},{},[8598],{"type":26,"value":8599},"defined by a computable property",{"type":26,"value":8601}," (this key decrypts the ciphertext, this input hashes to that digest) rather than looked up in a table.",{"type":21,"tag":22,"props":8603,"children":8604},{},[8605,8607,8613],{"type":26,"value":8606},"The real applications: cryptanalysis (Grover halves the effective key length of symmetric ciphers, which is exactly why AES-256 is recommended over AES-128 for post-quantum security), and as a subroutine inside larger algorithms via amplitude amplification. Grover's original 1996 paper is worth reading directly. See our ",{"type":21,"tag":46,"props":8608,"children":8610},{"href":8609},"\u002Fresearch\u002Fgrover-search-1996",[8611],{"type":26,"value":8612},"breakdown of the paper",{"type":26,"value":761},{"type":21,"tag":29,"props":8615,"children":8617},{"id":8616},"running-on-real-hardware",[8618],{"type":26,"value":8619},"Running on Real Hardware",{"type":21,"tag":22,"props":8621,"children":8622},{},[8623,8625,8630],{"type":26,"value":8624},"Moving to a QPU, the picture changes fast. Multi-controlled X gates are not native to any hardware. ",{"type":21,"tag":46,"props":8626,"children":8627},{"href":5709},[8628],{"type":26,"value":8629},"Transpilation",{"type":26,"value":8631}," decomposes each one into a cascade of CNOTs and single-qubit rotations, and the cost grows steeply with the number of controls. A 4-qubit MCX becomes 20+ two-qubit gates. Multiply that by two per Grover iteration, times k iterations, and depth explodes.",{"type":21,"tag":2304,"props":8633,"children":8635},{"code":8634,"language":3147,"meta":7,"className":3145,"style":7},"# Check what your circuit costs before submitting\nqc = grover(3, \"101\", 2)\nprint(qc.decompose().count_ops())\n",[8636],{"type":21,"tag":2073,"props":8637,"children":8638},{"__ignoreMap":7},[8639,8647,8688],{"type":21,"tag":2314,"props":8640,"children":8641},{"class":2316,"line":2317},[8642],{"type":21,"tag":2314,"props":8643,"children":8644},{"style":3407},[8645],{"type":26,"value":8646},"# Check what your circuit costs before submitting\n",{"type":21,"tag":2314,"props":8648,"children":8649},{"class":2316,"line":106},[8650,8654,8658,8663,8667,8671,8676,8680,8684],{"type":21,"tag":2314,"props":8651,"children":8652},{"style":2321},[8653],{"type":26,"value":7336},{"type":21,"tag":2314,"props":8655,"children":8656},{"style":3157},[8657],{"type":26,"value":3197},{"type":21,"tag":2314,"props":8659,"children":8660},{"style":2321},[8661],{"type":26,"value":8662}," grover(",{"type":21,"tag":2314,"props":8664,"children":8665},{"style":2339},[8666],{"type":26,"value":6465},{"type":21,"tag":2314,"props":8668,"children":8669},{"style":2321},[8670],{"type":26,"value":1309},{"type":21,"tag":2314,"props":8672,"children":8673},{"style":2350},[8674],{"type":26,"value":8675},"\"101\"",{"type":21,"tag":2314,"props":8677,"children":8678},{"style":2321},[8679],{"type":26,"value":1309},{"type":21,"tag":2314,"props":8681,"children":8682},{"style":2339},[8683],{"type":26,"value":2413},{"type":21,"tag":2314,"props":8685,"children":8686},{"style":2321},[8687],{"type":26,"value":3257},{"type":21,"tag":2314,"props":8689,"children":8690},{"class":2316,"line":2335},[8691,8695],{"type":21,"tag":2314,"props":8692,"children":8693},{"style":2339},[8694],{"type":26,"value":3272},{"type":21,"tag":2314,"props":8696,"children":8697},{"style":2321},[8698],{"type":26,"value":8699},"(qc.decompose().count_ops())\n",{"type":21,"tag":22,"props":8701,"children":8702},{},[8703,8705,8711,8713,8717],{"type":26,"value":8704},"On ",{"type":21,"tag":46,"props":8706,"children":8708},{"href":8707},"\u002Fresearch\u002Fpreskill-nisq-2018",[8709],{"type":26,"value":8710},"NISQ devices",{"type":26,"value":8712},", two-qubit gate error sits around 0.5–1%. A few hundred entangling gates and your output is indistinguishable from uniform random. Published hardware demonstrations of Grover are almost all 2–3 qubits, and they are demonstrations, not useful computations. Add ",{"type":21,"tag":46,"props":8714,"children":8715},{"href":5662},[8716],{"type":26,"value":5665},{"type":26,"value":8718}," on top and you need enough samples to distinguish a modest peak from the floor.",{"type":21,"tag":22,"props":8720,"children":8721},{},[8722,8724,8729,8731,8736],{"type":26,"value":8723},"The practical advice: develop and debug on ",{"type":21,"tag":46,"props":8725,"children":8726},{"href":408},[8727],{"type":26,"value":8728},"simulators",{"type":26,"value":8730},", where you verify correctness exactly. Only move to ",{"type":21,"tag":46,"props":8732,"children":8733},{"href":99},[8734],{"type":26,"value":8735},"real hardware",{"type":26,"value":8737}," when you understand what your circuit costs in native gates, and expect degraded results.",{"type":21,"tag":29,"props":8739,"children":8741},{"id":8740},"next-steps",[8742],{"type":26,"value":8743},"Next Steps",{"type":21,"tag":3080,"props":8745,"children":8746},{},[8747,8760,8772,8793],{"type":21,"tag":3084,"props":8748,"children":8749},{},[8750,8758],{"type":21,"tag":136,"props":8751,"children":8752},{},[8753],{"type":21,"tag":46,"props":8754,"children":8755},{"href":7045},[8756],{"type":26,"value":8757},"Qiskit SDK guide",{"type":26,"value":8759},": full setup, backends, and transpiler options",{"type":21,"tag":3084,"props":8761,"children":8762},{},[8763,8770],{"type":21,"tag":136,"props":8764,"children":8765},{},[8766],{"type":21,"tag":46,"props":8767,"children":8768},{"href":2029},[8769],{"type":26,"value":2647},{"type":26,"value":8771},": the other big near-term algorithm, applied to Max-Cut",{"type":21,"tag":3084,"props":8773,"children":8774},{},[8775,8783,8785,8791],{"type":21,"tag":136,"props":8776,"children":8777},{},[8778],{"type":21,"tag":46,"props":8779,"children":8780},{"href":212},[8781],{"type":26,"value":8782},"Compare the SDKs",{"type":26,"value":8784},": the same Grover circuit in ",{"type":21,"tag":46,"props":8786,"children":8788},{"href":8787},"\u002Fsdks\u002Fcirq",[8789],{"type":26,"value":8790},"Cirq",{"type":26,"value":8792}," or PennyLane",{"type":21,"tag":3084,"props":8794,"children":8795},{},[8796,8804,8805,8811,8812,8818],{"type":21,"tag":136,"props":8797,"children":8798},{},[8799],{"type":21,"tag":46,"props":8800,"children":8801},{"href":3917},[8802],{"type":26,"value":8803},"Glossary",{"type":26,"value":2408},{"type":21,"tag":46,"props":8806,"children":8808},{"href":8807},"\u002Fglossary\u002Fsuperposition",[8809],{"type":26,"value":8810},"superposition",{"type":26,"value":1309},{"type":21,"tag":46,"props":8813,"children":8815},{"href":8814},"\u002Fglossary\u002Fquantum-advantage",[8816],{"type":26,"value":8817},"quantum advantage",{"type":26,"value":8819},", and the rest of the vocabulary",{"type":21,"tag":2688,"props":8821,"children":8822},{},[8823],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":8825},[8826,8827,8828,8829,8830,8831,8832,8833,8834,8835],{"id":7124,"depth":106,"text":7127},{"id":7152,"depth":106,"text":7155},{"id":7198,"depth":106,"text":7201},{"id":7382,"depth":106,"text":7385},{"id":7763,"depth":106,"text":7766},{"id":8009,"depth":106,"text":8012},{"id":8486,"depth":106,"text":8489},{"id":8541,"depth":106,"text":8544},{"id":8616,"depth":106,"text":8619},{"id":8740,"depth":106,"text":8743},"content:blog:grover-algorithm-tutorial.md","blog\u002Fgrover-algorithm-tutorial.md","blog\u002Fgrover-algorithm-tutorial",{"_path":150,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8840,"description":8841,"date":3032,"author":11,"tags":8842,"readingTime":887,"body":8844,"_type":111,"_id":9294,"_source":113,"_file":9295,"_stem":9296,"_extension":116},"Logical Qubits and Fault Tolerance: What the Qubit Count Doesn't Tell You","A physical qubit is hardware. A logical qubit is an error-protected qubit built out of many of them. Understanding the difference is the fastest way to see through quantum computing headlines.",[125,13,8843],"QPU",{"type":18,"children":8845,"toc":9284},[8846,8851,8863,8869,8896,8910,8937,8943,8955,8960,8973,8991,8997,9002,9013,9026,9031,9036,9042,9054,9059,9078,9083,9089,9094,9104,9114,9137,9143,9148,9158,9168,9178,9188,9193,9199,9204,9209,9235,9254,9260,9272],{"type":21,"tag":22,"props":8847,"children":8848},{},[8849],{"type":26,"value":8850},"Every few months a press release announces a new record qubit count. Almost none of them tell you the number that decides whether the machine does anything: the error rate.",{"type":21,"tag":22,"props":8852,"children":8853},{},[8854,8856,8861],{"type":26,"value":8855},"This is not a pedantic complaint. The relationship between qubit count and computational power in quantum computing is not merely noisy. It sometimes inverts. Under the right conditions, a machine with more qubits is ",{"type":21,"tag":362,"props":8857,"children":8858},{},[8859],{"type":26,"value":8860},"worse",{"type":26,"value":8862}," than one with fewer. Understanding why requires one distinction, and once you have it, most quantum computing news becomes far easier to read.",{"type":21,"tag":29,"props":8864,"children":8866},{"id":8865},"two-things-called-qubit",[8867],{"type":26,"value":8868},"Two things called \"qubit\"",{"type":21,"tag":22,"props":8870,"children":8871},{},[8872,8874,8879,8881,8887,8889,8894],{"type":26,"value":8873},"A ",{"type":21,"tag":136,"props":8875,"children":8876},{},[8877],{"type":26,"value":8878},"physical qubit",{"type":26,"value":8880}," is a piece of hardware: a superconducting circuit on a chip, a trapped ion held in an electromagnetic field, a neutral atom in an optical tweezer. It is a real object subject to real physics, which means it drifts, absorbs stray energy, and loses its quantum state on a timescale measured in microseconds to seconds. That decay is ",{"type":21,"tag":46,"props":8882,"children":8884},{"href":8883},"\u002Fglossary\u002Fdecoherence",[8885],{"type":26,"value":8886},"decoherence",{"type":26,"value":8888},", and the ",{"type":21,"tag":46,"props":8890,"children":8891},{"href":5688},[8892],{"type":26,"value":8893},"T1 and T2 times",{"type":26,"value":8895}," that quantify it are among the few hardware specs worth reading closely.",{"type":21,"tag":22,"props":8897,"children":8898},{},[8899,8900,8908],{"type":26,"value":8873},{"type":21,"tag":136,"props":8901,"children":8902},{},[8903],{"type":21,"tag":46,"props":8904,"children":8905},{"href":1385},[8906],{"type":26,"value":8907},"logical qubit",{"type":26,"value":8909}," is not hardware. It is a qubit's worth of quantum information spread across many physical qubits, arranged so that errors on individual members are detected and undone without ever measuring, and thereby destroying, the encoded state. IonQ describes logical qubits as software-defined, and that framing is a good one: the logical qubit is a construction that hardware supports rather than a thing you point to.",{"type":21,"tag":22,"props":8911,"children":8912},{},[8913,8915,8920,8922,8927,8929,8935],{"type":26,"value":8914},"The technique is ",{"type":21,"tag":46,"props":8916,"children":8917},{"href":48},[8918],{"type":26,"value":8919},"quantum error correction",{"type":26,"value":8921},", and our ",{"type":21,"tag":46,"props":8923,"children":8924},{"href":253},[8925],{"type":26,"value":8926},"companion post on QEC",{"type":26,"value":8928}," covers the mechanics: parity checks, ",{"type":21,"tag":46,"props":8930,"children":8932},{"href":8931},"\u002Fglossary\u002Fancilla-qubit",[8933],{"type":26,"value":8934},"ancilla qubits",{"type":26,"value":8936},", the surface code lattice. This post is about the accounting: what encoding costs, when it pays off, and what else fault tolerance demands beyond the encoding itself.",{"type":21,"tag":29,"props":8938,"children":8940},{"id":8939},"why-how-many-qubits-is-nearly-meaningless",[8941],{"type":26,"value":8942},"Why \"how many qubits?\" is nearly meaningless",{"type":21,"tag":22,"props":8944,"children":8945},{},[8946,8948,8953],{"type":26,"value":8947},"Here is the uncomfortable arithmetic. If your physical error rate is above the threshold of your error-correcting code, encoding does not help. The extra qubits and the extra gates needed to perform parity checks each introduce errors of their own. Add more of them and you add more noise than you remove. A headline of 1,000 physical qubits with mediocre fidelity is compatible with ",{"type":21,"tag":136,"props":8949,"children":8950},{},[8951],{"type":26,"value":8952},"zero",{"type":26,"value":8954}," logical qubits, not few, zero.",{"type":21,"tag":22,"props":8956,"children":8957},{},[8958],{"type":26,"value":8959},"Meanwhile a smaller, cleaner machine is sometimes strictly more useful. IonQ argues this point aggressively, claiming that a system of 100 physical qubits at 99.99% two-qubit gate fidelity would likely outperform a 10,000-qubit system of lower-quality qubits encoding 100 logical ones: on overhead, gate speed, universality, and energy. That's a vendor making a case for its own architecture and should be read as such, but the underlying logic is sound and widely accepted: quality compounds in a way that quantity does not.",{"type":21,"tag":22,"props":8961,"children":8962},{},[8963,8965,8971],{"type":26,"value":8964},"The compounding is the key mechanism. In a code that corrects one error, roughly speaking, halving the physical error rate quarters the logical error rate. In a code correcting two errors the same improvement gives about an eight-fold gain. IonQ makes this multiplicative argument explicitly, and it explains why hardware teams chase ",{"type":21,"tag":46,"props":8966,"children":8968},{"href":8967},"\u002Fglossary\u002Ffidelity",[8969],{"type":26,"value":8970},"fidelity",{"type":26,"value":8972}," improvements that look small in isolation. A 2x hardware win is a 4x or 8x win after encoding.",{"type":21,"tag":22,"props":8974,"children":8975},{},[8976,8978,8982,8984,8989],{"type":26,"value":8977},"This is also why single-number benchmarks keep failing the field. ",{"type":21,"tag":46,"props":8979,"children":8980},{"href":3102},[8981],{"type":26,"value":3105},{"type":26,"value":8983},", algorithmic qubits, gate counts: each captures a slice and hides the rest. We wrote about that measurement problem ",{"type":21,"tag":46,"props":8985,"children":8986},{"href":674},[8987],{"type":26,"value":8988},"in the context of EO 14413",{"type":26,"value":8990},", and it applies with full force here.",{"type":21,"tag":29,"props":8992,"children":8994},{"id":8993},"the-overhead-is-the-whole-story",[8995],{"type":26,"value":8996},"The overhead is the whole story",{"type":21,"tag":22,"props":8998,"children":8999},{},[9000],{"type":26,"value":9001},"How many physical qubits does one logical qubit cost? The honest answer is that it depends on two numbers you have to state together: your physical error rate and the logical error rate you're targeting.",{"type":21,"tag":22,"props":9003,"children":9004},{},[9005,9011],{"type":21,"tag":46,"props":9006,"children":9008},{"href":9007},"\u002Fresearch\u002Fshor-error-correction-1995",[9009],{"type":26,"value":9010},"Shor's 1995 code",{"type":26,"value":9012},", the first quantum error-correcting code ever written down, used nine physical qubits to protect one logical qubit against an arbitrary single-qubit error. That was a proof that the thing was possible at all. Before it, many physicists believed no-cloning made quantum computing hopeless in principle.",{"type":21,"tag":22,"props":9014,"children":9015},{},[9016,9018,9024],{"type":26,"value":9017},"Nine turned out to be optimistic for practical machines. ",{"type":21,"tag":46,"props":9019,"children":9021},{"href":9020},"\u002Fresearch\u002Fkitaev-anyons-1997",[9022],{"type":26,"value":9023},"Kitaev's 1997 work on anyons",{"type":26,"value":9025}," introduced topological codes, including the surface code, which stores information in global properties of a 2D lattice rather than in any individual site. Its great virtue is that every parity check involves only neighbouring qubits, which maps cleanly onto flat chips, and it tolerates physical error rates around 1%, high enough that real hardware plausibly reaches it.",{"type":21,"tag":22,"props":9027,"children":9028},{},[9029],{"type":26,"value":9030},"The price is scale. Surface code overhead grows with code distance, and realistic estimates for running a cryptographically relevant algorithm land at hundreds to a few thousand physical qubits per logical qubit, with total system requirements often quoted in the millions. Push your physical error rate down and that ratio falls fast. Let it drift up toward threshold and the ratio explodes. Overhead is not a fixed constant of the technology. It is a function of how good your hardware is.",{"type":21,"tag":22,"props":9032,"children":9033},{},[9034],{"type":26,"value":9035},"Newer code families are attacking the ratio directly. IonQ has promoted a bivariate bicycle variant it calls BB5, claiming an idle logical error rate around 5x10⁻⁵ using 50 physical qubits, roughly four times smaller than standard BB codes. Vendor-reported figures like that are worth tracking but not worth treating as settled until independently reproduced.",{"type":21,"tag":29,"props":9037,"children":9039},{"id":9038},"the-threshold-theorem-and-why-2024-mattered",[9040],{"type":26,"value":9041},"The threshold theorem, and why 2024 mattered",{"type":21,"tag":22,"props":9043,"children":9044},{},[9045,9047,9052],{"type":26,"value":9046},"The theoretical foundation under all of this is the ",{"type":21,"tag":136,"props":9048,"children":9049},{},[9050],{"type":26,"value":9051},"threshold theorem",{"type":26,"value":9053},". It says there exists a critical physical error rate. Below it, increasing the size of your code suppresses logical errors exponentially. You make them as small as you like by spending more qubits. Above it, the opposite: bigger codes are worse codes.",{"type":21,"tag":22,"props":9055,"children":9056},{},[9057],{"type":26,"value":9058},"For decades this was a theorem without an experiment. Every roadmap in the industry assumed the crossing was achievable. None had demonstrated it.",{"type":21,"tag":22,"props":9060,"children":9061},{},[9062,9064,9069,9071,9076],{"type":26,"value":9063},"That changed with ",{"type":21,"tag":46,"props":9065,"children":9066},{"href":3701},[9067],{"type":26,"value":9068},"Google's below-threshold result in 2024",{"type":26,"value":9070},". Running surface codes at distances 3, 5, and 7 on its 105-qubit Willow processor, the team observed each increase in code distance roughly ",{"type":21,"tag":136,"props":9072,"children":9073},{},[9074],{"type":26,"value":9075},"halving",{"type":26,"value":9077}," the logical error rate, the direction fault tolerance requires. Critically, the encoded logical qubit outlived the best individual physical qubit on the chip, which is the concrete test of whether error correction is a net win rather than an expensive way to add noise.",{"type":21,"tag":22,"props":9079,"children":9080},{},[9081],{"type":26,"value":9082},"It's hard to overstate the significance. That experiment converted large-scale quantum computing from an open physics question into a scaling and engineering problem. Engineering problems are hard, but they are a different category of hard.",{"type":21,"tag":29,"props":9084,"children":9086},{"id":9085},"different-hardware-different-arithmetic",[9087],{"type":26,"value":9088},"Different hardware, different arithmetic",{"type":21,"tag":22,"props":9090,"children":9091},{},[9092],{"type":26,"value":9093},"The threshold is not a single universal number. It depends on the code, and which codes are practical depends on your hardware's connectivity. This is where modality differences stop being trivia.",{"type":21,"tag":22,"props":9095,"children":9096},{},[9097,9102],{"type":21,"tag":136,"props":9098,"children":9099},{},[9100],{"type":26,"value":9101},"Superconducting",{"type":26,"value":9103}," processors offer fast gates (nanoseconds) and mature fabrication, but qubits interact only with their planar neighbours and fidelities are typically lower. That planar constraint is precisely what the surface code was designed around, which is why superconducting roadmaps are built on it.",{"type":21,"tag":22,"props":9105,"children":9106},{},[9107,9112],{"type":21,"tag":136,"props":9108,"children":9109},{},[9110],{"type":26,"value":9111},"Trapped ions",{"type":26,"value":9113}," invert the trade: gates are far slower (microseconds to milliseconds), but fidelities are the highest of any modality and connectivity is effectively all-to-all: any ion in a chain is entangled with any other without a chain of intervening swap operations. IonQ argues this connectivity is a structural advantage for error correction, because codes requiring non-local checks become implementable rather than prohibitively expensive, and it has claimed 99.99% physical two-qubit gate fidelity via its Oxford Ionics acquisition. Again: vendor claim, vendor benchmark conditions.",{"type":21,"tag":22,"props":9115,"children":9116},{},[9117,9119,9123,9124,9129,9131,9135],{"type":26,"value":9118},"Neither is obviously winning. Our ",{"type":21,"tag":46,"props":9120,"children":9121},{"href":99},[9122],{"type":26,"value":102},{"type":26,"value":904},{"type":21,"tag":46,"props":9125,"children":9126},{"href":212},[9127],{"type":26,"value":9128},"modality comparison",{"type":26,"value":9130}," go into the specifics, and the broader ",{"type":21,"tag":46,"props":9132,"children":9133},{"href":261},[9134],{"type":26,"value":853},{"type":26,"value":9136}," tracks who is betting on what. The practical takeaway for anyone learning is that connectivity and fidelity, not qubit count, are the specs that determine which error-correction strategies a machine even attempts.",{"type":21,"tag":29,"props":9138,"children":9140},{"id":9139},"encoding-is-necessary-not-sufficient",[9141],{"type":26,"value":9142},"Encoding is necessary, not sufficient",{"type":21,"tag":22,"props":9144,"children":9145},{},[9146],{"type":26,"value":9147},"A subtlety that gets lost in coverage: storing a logical qubit is the easy part of fault tolerance. Computing on one is harder. A genuinely fault-tolerant machine needs all of the following:",{"type":21,"tag":22,"props":9149,"children":9150},{},[9151,9156],{"type":21,"tag":136,"props":9152,"children":9153},{},[9154],{"type":26,"value":9155},"Fault-tolerant gate operations.",{"type":26,"value":9157}," Logical gates must be implemented so that a single physical fault cannot propagate into an uncorrectable logical error. Some gates are cheap in a given code. Others are not.",{"type":21,"tag":22,"props":9159,"children":9160},{},[9161,9166],{"type":21,"tag":136,"props":9162,"children":9163},{},[9164],{"type":26,"value":9165},"Continuous syndrome extraction.",{"type":26,"value":9167}," Parity checks run constantly, in rounds, throughout the computation. The measurement circuits are themselves noisy, so the scheme has to tolerate faults in its own error detection.",{"type":21,"tag":22,"props":9169,"children":9170},{},[9171,9176],{"type":21,"tag":136,"props":9172,"children":9173},{},[9174],{"type":26,"value":9175},"Magic state distillation.",{"type":26,"value":9177}," Surface codes give you Clifford gates relatively cheaply, but Clifford gates alone are classically simulable. Universality needs a non-Clifford gate, typically T, and those are produced by distilling noisy \"magic states\" into clean ones. Distillation factories consume a large fraction of the total qubit budget in realistic architectures.",{"type":21,"tag":22,"props":9179,"children":9180},{},[9181,9186],{"type":21,"tag":136,"props":9182,"children":9183},{},[9184],{"type":26,"value":9185},"Real-time decoding.",{"type":26,"value":9187}," Syndrome data must be interpreted and corrections applied faster than errors accumulate. This is a classical computing problem, running at microsecond latency alongside the QPU, and it's a serious engineering constraint in its own right.",{"type":21,"tag":22,"props":9189,"children":9190},{},[9191],{"type":26,"value":9192},"IonQ's framing here is useful regardless of the vendor context: a logical qubit should be characterised by several attributes together: overhead, idle logical error rate, logical gate fidelity, logical gate speed, and gate-set universality, rather than counted. A logical qubit that is stored but not usefully operated on is not much of a logical qubit.",{"type":21,"tag":29,"props":9194,"children":9196},{"id":9195},"where-the-field-stands",[9197],{"type":26,"value":9198},"Where the field stands",{"type":21,"tag":22,"props":9200,"children":9201},{},[9202],{"type":26,"value":9203},"Honest summary as of mid-2026: logical qubits are real, demonstrated, and few.",{"type":21,"tag":22,"props":9205,"children":9206},{},[9207],{"type":26,"value":9208},"Multiple groups have encoded them. Google has shown error suppression scaling in the right direction. Trapped-ion and neutral-atom teams have run algorithms on small numbers of encoded qubits. These are genuine milestones, not marketing.",{"type":21,"tag":22,"props":9210,"children":9211},{},[9212,9214,9219,9221,9226,9228,9233],{"type":26,"value":9213},"But useful fault-tolerant computation needs hundreds to thousands of logical qubits executing millions of logical operations, and that means physical qubit counts several orders of magnitude beyond anything running today, with error rates comfortably below threshold across the whole device rather than on the best-behaved corner of a chip. Most working hardware remains firmly in the ",{"type":21,"tag":46,"props":9215,"children":9216},{"href":371},[9217],{"type":26,"value":9218},"NISQ regime",{"type":26,"value":9220}," that ",{"type":21,"tag":46,"props":9222,"children":9223},{"href":8707},[9224],{"type":26,"value":9225},"Preskill named in 2018",{"type":26,"value":9227},", where ",{"type":21,"tag":46,"props":9229,"children":9230},{"href":4001},[9231],{"type":26,"value":9232},"error mitigation",{"type":26,"value":9234}," (statistical post-processing rather than true correction) is the practical tool.",{"type":21,"tag":22,"props":9236,"children":9237},{},[9238,9240,9245,9247,9252],{"type":26,"value":9239},"None of which means waiting around. The abstractions transfer: circuits, gates, measurement, and noise behave the same way whether you're on a simulator or a fault-tolerant machine a decade out. You start on ",{"type":21,"tag":46,"props":9241,"children":9242},{"href":408},[9243],{"type":26,"value":9244},"free simulators",{"type":26,"value":9246}," or real QPUs today, and the ",{"type":21,"tag":46,"props":9248,"children":9249},{"href":3831},[9250],{"type":26,"value":9251},"courses page",{"type":26,"value":9253}," collects structured routes in.",{"type":21,"tag":29,"props":9255,"children":9257},{"id":9256},"the-one-habit-worth-forming",[9258],{"type":26,"value":9259},"The one habit worth forming",{"type":21,"tag":22,"props":9261,"children":9262},{},[9263,9265,9270],{"type":26,"value":9264},"When you next see a qubit-count headline, ask three questions: what is the two-qubit gate fidelity, is it below the relevant threshold, and how many ",{"type":21,"tag":362,"props":9266,"children":9267},{},[9268],{"type":26,"value":9269},"logical",{"type":26,"value":9271}," qubits does that imply?",{"type":21,"tag":22,"props":9273,"children":9274},{},[9275,9277,9282],{"type":26,"value":9276},"Frequently the answer to the third is zero, and the article won't have mentioned it. Learning to notice that gap is most of what separates informed reading from press-release reading. The ",{"type":21,"tag":46,"props":9278,"children":9279},{"href":3917},[9280],{"type":26,"value":9281},"glossary",{"type":26,"value":9283}," is a decent place to build the vocabulary for it.",{"title":7,"searchDepth":106,"depth":106,"links":9285},[9286,9287,9288,9289,9290,9291,9292,9293],{"id":8865,"depth":106,"text":8868},{"id":8939,"depth":106,"text":8942},{"id":8993,"depth":106,"text":8996},{"id":9038,"depth":106,"text":9041},{"id":9085,"depth":106,"text":9088},{"id":9139,"depth":106,"text":9142},{"id":9195,"depth":106,"text":9198},{"id":9256,"depth":106,"text":9259},"content:blog:logical-qubits-fault-tolerance-explained.md","blog\u002Flogical-qubits-fault-tolerance-explained.md","blog\u002Flogical-qubits-fault-tolerance-explained",{"_path":1745,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":9298,"description":9299,"date":3032,"author":11,"tags":9300,"readingTime":887,"body":9304,"_type":111,"_id":10402,"_source":113,"_file":10403,"_stem":10404,"_extension":116},"The Post-Quantum Migration Clock: Real Deadlines and How to Plan Against Them","NIST says RSA and ECC are deprecated after 2030 and disallowed after 2035. NSA's CNSA 2.0 moves faster. Here's what the published timelines require, and how to build a migration plan that survives them.",[9301,9302,9303],"Post-Quantum","Security","Cryptography",{"type":18,"children":9305,"toc":10392},[9306,9326,9339,9345,9350,9460,9465,9484,9490,9495,9525,9535,9545,9557,9562,9568,9588,9593,9619,9630,9636,9641,9684,9690,9695,10115,10127,10133,10145,10157,10207,10212,10218,10223,10332,10338,10350,10355,10388],{"type":21,"tag":22,"props":9307,"children":9308},{},[9309,9311,9317,9319,9324],{"type":26,"value":9310},"Most discussions of ",{"type":21,"tag":46,"props":9312,"children":9314},{"href":9313},"\u002Fglossary\u002Fpost-quantum-cryptography",[9315],{"type":26,"value":9316},"post-quantum cryptography",{"type":26,"value":9318}," stall at the same place: ",{"type":21,"tag":362,"props":9320,"children":9321},{},[9322],{"type":26,"value":9323},"when do we have to do this?",{"type":26,"value":9325}," The honest answer used to be \"nobody knows.\" That's no longer true. Not because anyone predicts when a cryptographically relevant quantum computer arrives, but because regulators stopped waiting for that prediction and published dates anyway.",{"type":21,"tag":22,"props":9327,"children":9328},{},[9329,9331,9337],{"type":26,"value":9330},"If you already understand what PQC is and which algorithms replace which, our ",{"type":21,"tag":46,"props":9332,"children":9334},{"href":9333},"\u002Fblog\u002Fpost-quantum-cryptography-guide",[9335],{"type":26,"value":9336},"guide to post-quantum cryptography",{"type":26,"value":9338}," covers that ground. This post is about the calendar and the project plan.",{"type":21,"tag":29,"props":9340,"children":9342},{"id":9341},"the-standards-are-settled",[9343],{"type":26,"value":9344},"The standards are settled",{"type":21,"tag":22,"props":9346,"children":9347},{},[9348],{"type":26,"value":9349},"NIST finalized three post-quantum standards on August 13, 2024, after an eight-year competition:",{"type":21,"tag":4020,"props":9351,"children":9352},{},[9353,9379],{"type":21,"tag":4024,"props":9354,"children":9355},{},[9356],{"type":21,"tag":4028,"props":9357,"children":9358},{},[9359,9364,9369,9374],{"type":21,"tag":4032,"props":9360,"children":9361},{},[9362],{"type":26,"value":9363},"Standard",{"type":21,"tag":4032,"props":9365,"children":9366},{},[9367],{"type":26,"value":9368},"Algorithm",{"type":21,"tag":4032,"props":9370,"children":9371},{},[9372],{"type":26,"value":9373},"Formerly",{"type":21,"tag":4032,"props":9375,"children":9376},{},[9377],{"type":26,"value":9378},"Replaces",{"type":21,"tag":4046,"props":9380,"children":9381},{},[9382,9408,9434],{"type":21,"tag":4028,"props":9383,"children":9384},{},[9385,9393,9398,9403],{"type":21,"tag":4053,"props":9386,"children":9387},{},[9388],{"type":21,"tag":136,"props":9389,"children":9390},{},[9391],{"type":26,"value":9392},"FIPS 203",{"type":21,"tag":4053,"props":9394,"children":9395},{},[9396],{"type":26,"value":9397},"ML-KEM",{"type":21,"tag":4053,"props":9399,"children":9400},{},[9401],{"type":26,"value":9402},"CRYSTALS-Kyber",{"type":21,"tag":4053,"props":9404,"children":9405},{},[9406],{"type":26,"value":9407},"RSA key transport, ECDH",{"type":21,"tag":4028,"props":9409,"children":9410},{},[9411,9419,9424,9429],{"type":21,"tag":4053,"props":9412,"children":9413},{},[9414],{"type":21,"tag":136,"props":9415,"children":9416},{},[9417],{"type":26,"value":9418},"FIPS 204",{"type":21,"tag":4053,"props":9420,"children":9421},{},[9422],{"type":26,"value":9423},"ML-DSA",{"type":21,"tag":4053,"props":9425,"children":9426},{},[9427],{"type":26,"value":9428},"CRYSTALS-Dilithium",{"type":21,"tag":4053,"props":9430,"children":9431},{},[9432],{"type":26,"value":9433},"ECDSA, RSA-PSS signatures",{"type":21,"tag":4028,"props":9435,"children":9436},{},[9437,9445,9450,9455],{"type":21,"tag":4053,"props":9438,"children":9439},{},[9440],{"type":21,"tag":136,"props":9441,"children":9442},{},[9443],{"type":26,"value":9444},"FIPS 205",{"type":21,"tag":4053,"props":9446,"children":9447},{},[9448],{"type":26,"value":9449},"SLH-DSA",{"type":21,"tag":4053,"props":9451,"children":9452},{},[9453],{"type":26,"value":9454},"SPHINCS+",{"type":21,"tag":4053,"props":9456,"children":9457},{},[9458],{"type":26,"value":9459},"Conservative hash-based signing",{"type":21,"tag":22,"props":9461,"children":9462},{},[9463],{"type":26,"value":9464},"Use the FIPS names in procurement documents and internal specs. \"Kyber\" and \"Dilithium\" refer to the competition submissions, which differ in small but real ways from the standardized versions. A vendor claiming \"Kyber support\" does or doesn't mean FIPS 203 compliance, and that ambiguity has already caused interop problems.",{"type":21,"tag":22,"props":9466,"children":9467},{},[9468,9470,9475,9477,9482],{"type":26,"value":9469},"Two more are in flight. NIST selected ",{"type":21,"tag":136,"props":9471,"children":9472},{},[9473],{"type":26,"value":9474},"HQC",{"type":26,"value":9476}," in March 2025 as a code-based backup KEM with different mathematical foundations from ML-KEM, with a draft standard expected around 2026 and finalization targeted for 2027. ",{"type":21,"tag":136,"props":9478,"children":9479},{},[9480],{"type":26,"value":9481},"FN-DSA",{"type":26,"value":9483}," (FALCON) remains slated for standardization as a compact-signature option. Neither should hold up your migration. ML-KEM and ML-DSA are the workhorses.",{"type":21,"tag":29,"props":9485,"children":9487},{"id":9486},"the-deadlines-that-exist-on-paper",[9488],{"type":26,"value":9489},"The deadlines that exist on paper",{"type":21,"tag":22,"props":9491,"children":9492},{},[9493],{"type":26,"value":9494},"Three separate sets of dates matter, and they don't line up.",{"type":21,"tag":22,"props":9496,"children":9497},{},[9498,9503,9505,9510,9512,9517,9518,9523],{"type":21,"tag":136,"props":9499,"children":9500},{},[9501],{"type":26,"value":9502},"NIST IR 8547",{"type":26,"value":9504}," (",{"type":21,"tag":362,"props":9506,"children":9507},{},[9508],{"type":26,"value":9509},"Transition to Post-Quantum Cryptography Standards",{"type":26,"value":9511},", initial public draft November 2024) is the broadest. It proposes that RSA, ECDSA, EdDSA, ECDH, DSA, and finite-field Diffie-Hellman become ",{"type":21,"tag":136,"props":9513,"children":9514},{},[9515],{"type":26,"value":9516},"deprecated after 2030",{"type":26,"value":904},{"type":21,"tag":136,"props":9519,"children":9520},{},[9521],{"type":26,"value":9522},"disallowed after 2035",{"type":26,"value":9524},". Deprecated means continued use requires the data owner to document a risk acceptance. Disallowed means the option to accept that risk goes away.",{"type":21,"tag":22,"props":9526,"children":9527},{},[9528,9533],{"type":21,"tag":136,"props":9529,"children":9530},{},[9531],{"type":26,"value":9532},"NSA's CNSA 2.0",{"type":26,"value":9534}," applies to National Security Systems and moves faster, with a staged schedule by product category. As published and updated through May 2025, software and firmware signing is the leading edge (exclusive use of CNSA 2.0 algorithms from January 1, 2027), with networking equipment following around 2030, and operating systems, custom applications, and cloud services around 2033. Full quantum resistance across NSS is expected by 2035.",{"type":21,"tag":22,"props":9536,"children":9537},{},[9538,9543],{"type":21,"tag":136,"props":9539,"children":9540},{},[9541],{"type":26,"value":9542},"OMB M-23-02",{"type":26,"value":9544}," (November 2022) is the one that already bit. It directed federal agencies to inventory cryptography on prioritized systems, produce funding estimates, and report annually, with full federal migration targeted for 2035.",{"type":21,"tag":22,"props":9546,"children":9547},{},[9548,9550,9555],{"type":26,"value":9549},"Two things follow from this. First, if you sell to the US federal government, especially anything involving signed firmware, your effective deadline is ",{"type":21,"tag":136,"props":9551,"children":9552},{},[9553],{"type":26,"value":9554},"2027, not 2035",{"type":26,"value":9556},". Second, even for purely commercial work, NIST's deprecation calendar becomes the de facto compliance baseline the moment auditors and insurers start citing it, which historically happens well before the date itself.",{"type":21,"tag":22,"props":9558,"children":9559},{},[9560],{"type":26,"value":9561},"Note that none of these dates are predictions about quantum hardware. They are engineering schedules working backward from the migration itself taking a decade.",{"type":21,"tag":29,"props":9563,"children":9565},{"id":9564},"why-the-threat-model-has-no-start-date",[9566],{"type":26,"value":9567},"Why the threat model has no start date",{"type":21,"tag":22,"props":9569,"children":9570},{},[9571,9573,9578,9580,9586],{"type":26,"value":9572},"The reason a 2030 deadline is defensible even though nobody expects a code-breaking quantum computer by 2030 is ",{"type":21,"tag":136,"props":9574,"children":9575},{},[9576],{"type":26,"value":9577},"harvest now, decrypt later",{"type":26,"value":9579},". An adversary records encrypted traffic today and decrypts it whenever ",{"type":21,"tag":46,"props":9581,"children":9583},{"href":9582},"\u002Fglossary\u002Fshor-algorithm",[9584],{"type":26,"value":9585},"Shor's algorithm",{"type":26,"value":9587}," becomes runnable at scale. Any data whose confidentiality must outlive that moment is already exposed.",{"type":21,"tag":22,"props":9589,"children":9590},{},[9591],{"type":26,"value":9592},"The practical calculation is Mosca's inequality: if the time your data must stay secret plus the time your migration takes exceeds the time until a capable quantum computer exists, you are already late. For medical records with a 50-year sensitivity horizon and a five-year migration, you needed to start before the standards existed.",{"type":21,"tag":22,"props":9594,"children":9595},{},[9596,9598,9603,9605,9609,9611,9617],{"type":26,"value":9597},"What makes this hard to plan against is that the hardware estimate keeps moving. ",{"type":21,"tag":46,"props":9599,"children":9600},{"href":8562},[9601],{"type":26,"value":9602},"Shor's 1994 paper",{"type":26,"value":9604}," established the algorithm. The resource question (how many ",{"type":21,"tag":46,"props":9606,"children":9607},{"href":1385},[9608],{"type":26,"value":1388},{"type":26,"value":9610}," and how many gates to break RSA-2048) has been re-estimated downward repeatedly as compilation techniques improved. Recent work ",{"type":21,"tag":46,"props":9612,"children":9614},{"href":9613},"\u002Fresearch\u002Fshor-lean-formalization-2026",[9615],{"type":26,"value":9616},"machine-checking those estimates in Lean",{"type":26,"value":9618}," is valuable precisely because it removes hand-waving from a number that security planning depends on. The estimates remain far beyond current devices, but \"far\" has been shrinking, and the direction of travel is one-way.",{"type":21,"tag":22,"props":9620,"children":9621},{},[9622,9624,9628],{"type":26,"value":9623},"For the record: symmetric cryptography is fine. ",{"type":21,"tag":46,"props":9625,"children":9626},{"href":7111},[9627],{"type":26,"value":7114},{"type":26,"value":9629}," gives only a quadratic speedup, so AES-256 retains 128-bit effective security. The migration is an asymmetric-crypto migration.",{"type":21,"tag":29,"props":9631,"children":9633},{"id":9632},"why-this-takes-years",[9634],{"type":26,"value":9635},"Why this takes years",{"type":21,"tag":22,"props":9637,"children":9638},{},[9639],{"type":26,"value":9640},"Migration is slow for reasons that have nothing to do with the algorithms:",{"type":21,"tag":3080,"props":9642,"children":9643},{},[9644,9654,9664,9674],{"type":21,"tag":3084,"props":9645,"children":9646},{},[9647,9652],{"type":21,"tag":136,"props":9648,"children":9649},{},[9650],{"type":26,"value":9651},"You don't know where your crypto is.",{"type":26,"value":9653}," It's in TLS terminators, JWT libraries, database TDE, backup encryption, VPN tunnels, code-signing pipelines, HSMs, IoT firmware, and vendor SDKs you don't control.",{"type":21,"tag":3084,"props":9655,"children":9656},{},[9657,9662],{"type":21,"tag":136,"props":9658,"children":9659},{},[9660],{"type":26,"value":9661},"Key and signature sizes change.",{"type":26,"value":9663}," ML-DSA public keys are roughly 1.3 KB versus 32 bytes for Ed25519, and SLH-DSA signatures sometimes run tens of kilobytes. Protocols with fixed-size fields, embedded devices with constrained flash, and certificate chains with MTU assumptions all break.",{"type":21,"tag":3084,"props":9665,"children":9666},{},[9667,9672],{"type":21,"tag":136,"props":9668,"children":9669},{},[9670],{"type":26,"value":9671},"Both endpoints must upgrade.",{"type":26,"value":9673}," You migrate at the speed of your slowest counterparty.",{"type":21,"tag":3084,"props":9675,"children":9676},{},[9677,9682],{"type":21,"tag":136,"props":9678,"children":9679},{},[9680],{"type":26,"value":9681},"Hardware has a decade-long tail.",{"type":26,"value":9683}," HSMs and embedded devices deployed today will still be running in 2035.",{"type":21,"tag":29,"props":9685,"children":9687},{"id":9686},"inventory-first-a-starting-point",[9688],{"type":26,"value":9689},"Inventory first: a starting point",{"type":21,"tag":22,"props":9691,"children":9692},{},[9693],{"type":26,"value":9694},"You cannot migrate an unknown. Start with automated discovery of what's negotiated in production, not what your architecture diagram claims.",{"type":21,"tag":2304,"props":9696,"children":9700},{"className":9697,"code":9698,"language":9699,"meta":7,"style":7},"language-bash shiki shiki-themes github-dark","# What key exchange and signature algorithms is this endpoint using?\nopenssl s_client -connect example.com:443 -brief \u003C\u002Fdev\u002Fnull 2>&1 \\\n  | grep -Ei 'protocol|ciphersuite|group|peer signature'\n\n# Does the endpoint support hybrid post-quantum key exchange?\n# Requires OpenSSL 3.5+, which ships ML-KEM natively.\nopenssl s_client -connect example.com:443 \\\n  -groups X25519MLKEM768 \u003C\u002Fdev\u002Fnull 2>&1 | grep -i 'group\\|error'\n\n# Inventory certificate signature algorithms across an internal fleet\nwhile read -r host; do\n  alg=$(echo | openssl s_client -connect \"$host:443\" 2>\u002Fdev\u002Fnull \\\n    | openssl x509 -noout -text 2>\u002Fdev\u002Fnull \\\n    | awk '\u002FSignature Algorithm\u002F {print $3; exit}')\n  printf '%s\\t%s\\n' \"$host\" \"${alg:-UNREACHABLE}\"\ndone \u003C hosts.txt\n","bash",[9701],{"type":21,"tag":2073,"props":9702,"children":9703},{"__ignoreMap":7},[9704,9712,9760,9783,9790,9798,9806,9829,9873,9880,9888,9921,9988,10027,10048,10098],{"type":21,"tag":2314,"props":9705,"children":9706},{"class":2316,"line":2317},[9707],{"type":21,"tag":2314,"props":9708,"children":9709},{"style":3407},[9710],{"type":26,"value":9711},"# What key exchange and signature algorithms is this endpoint using?\n",{"type":21,"tag":2314,"props":9713,"children":9714},{"class":2316,"line":106},[9715,9720,9725,9730,9735,9740,9745,9750,9755],{"type":21,"tag":2314,"props":9716,"children":9717},{"style":4318},[9718],{"type":26,"value":9719},"openssl",{"type":21,"tag":2314,"props":9721,"children":9722},{"style":2350},[9723],{"type":26,"value":9724}," s_client",{"type":21,"tag":2314,"props":9726,"children":9727},{"style":2339},[9728],{"type":26,"value":9729}," -connect",{"type":21,"tag":2314,"props":9731,"children":9732},{"style":2350},[9733],{"type":26,"value":9734}," example.com:443",{"type":21,"tag":2314,"props":9736,"children":9737},{"style":2339},[9738],{"type":26,"value":9739}," -brief",{"type":21,"tag":2314,"props":9741,"children":9742},{"style":3157},[9743],{"type":26,"value":9744}," \u003C",{"type":21,"tag":2314,"props":9746,"children":9747},{"style":2350},[9748],{"type":26,"value":9749},"\u002Fdev\u002Fnull",{"type":21,"tag":2314,"props":9751,"children":9752},{"style":3157},[9753],{"type":26,"value":9754}," 2>&1",{"type":21,"tag":2314,"props":9756,"children":9757},{"style":2339},[9758],{"type":26,"value":9759}," \\\n",{"type":21,"tag":2314,"props":9761,"children":9762},{"class":2316,"line":2335},[9763,9768,9773,9778],{"type":21,"tag":2314,"props":9764,"children":9765},{"style":3157},[9766],{"type":26,"value":9767},"  |",{"type":21,"tag":2314,"props":9769,"children":9770},{"style":4318},[9771],{"type":26,"value":9772}," grep",{"type":21,"tag":2314,"props":9774,"children":9775},{"style":2339},[9776],{"type":26,"value":9777}," -Ei",{"type":21,"tag":2314,"props":9779,"children":9780},{"style":2350},[9781],{"type":26,"value":9782}," 'protocol|ciphersuite|group|peer signature'\n",{"type":21,"tag":2314,"props":9784,"children":9785},{"class":2316,"line":2397},[9786],{"type":21,"tag":2314,"props":9787,"children":9788},{"emptyLinePlaceholder":3181},[9789],{"type":26,"value":3184},{"type":21,"tag":2314,"props":9791,"children":9792},{"class":2316,"line":2421},[9793],{"type":21,"tag":2314,"props":9794,"children":9795},{"style":3407},[9796],{"type":26,"value":9797},"# Does the endpoint support hybrid post-quantum key exchange?\n",{"type":21,"tag":2314,"props":9799,"children":9800},{"class":2316,"line":16},[9801],{"type":21,"tag":2314,"props":9802,"children":9803},{"style":3407},[9804],{"type":26,"value":9805},"# Requires OpenSSL 3.5+, which ships ML-KEM natively.\n",{"type":21,"tag":2314,"props":9807,"children":9808},{"class":2316,"line":127},[9809,9813,9817,9821,9825],{"type":21,"tag":2314,"props":9810,"children":9811},{"style":4318},[9812],{"type":26,"value":9719},{"type":21,"tag":2314,"props":9814,"children":9815},{"style":2350},[9816],{"type":26,"value":9724},{"type":21,"tag":2314,"props":9818,"children":9819},{"style":2339},[9820],{"type":26,"value":9729},{"type":21,"tag":2314,"props":9822,"children":9823},{"style":2350},[9824],{"type":26,"value":9734},{"type":21,"tag":2314,"props":9826,"children":9827},{"style":2339},[9828],{"type":26,"value":9759},{"type":21,"tag":2314,"props":9830,"children":9831},{"class":2316,"line":887},[9832,9837,9842,9846,9850,9854,9859,9863,9868],{"type":21,"tag":2314,"props":9833,"children":9834},{"style":2339},[9835],{"type":26,"value":9836},"  -groups",{"type":21,"tag":2314,"props":9838,"children":9839},{"style":2350},[9840],{"type":26,"value":9841}," X25519MLKEM768",{"type":21,"tag":2314,"props":9843,"children":9844},{"style":3157},[9845],{"type":26,"value":9744},{"type":21,"tag":2314,"props":9847,"children":9848},{"style":2350},[9849],{"type":26,"value":9749},{"type":21,"tag":2314,"props":9851,"children":9852},{"style":3157},[9853],{"type":26,"value":9754},{"type":21,"tag":2314,"props":9855,"children":9856},{"style":3157},[9857],{"type":26,"value":9858}," |",{"type":21,"tag":2314,"props":9860,"children":9861},{"style":4318},[9862],{"type":26,"value":9772},{"type":21,"tag":2314,"props":9864,"children":9865},{"style":2339},[9866],{"type":26,"value":9867}," -i",{"type":21,"tag":2314,"props":9869,"children":9870},{"style":2350},[9871],{"type":26,"value":9872}," 'group\\|error'\n",{"type":21,"tag":2314,"props":9874,"children":9875},{"class":2316,"line":1364},[9876],{"type":21,"tag":2314,"props":9877,"children":9878},{"emptyLinePlaceholder":3181},[9879],{"type":26,"value":3184},{"type":21,"tag":2314,"props":9881,"children":9882},{"class":2316,"line":3403},[9883],{"type":21,"tag":2314,"props":9884,"children":9885},{"style":3407},[9886],{"type":26,"value":9887},"# Inventory certificate signature algorithms across an internal fleet\n",{"type":21,"tag":2314,"props":9889,"children":9890},{"class":2316,"line":3413},[9891,9896,9901,9906,9911,9916],{"type":21,"tag":2314,"props":9892,"children":9893},{"style":3157},[9894],{"type":26,"value":9895},"while",{"type":21,"tag":2314,"props":9897,"children":9898},{"style":2339},[9899],{"type":26,"value":9900}," read",{"type":21,"tag":2314,"props":9902,"children":9903},{"style":2339},[9904],{"type":26,"value":9905}," -r",{"type":21,"tag":2314,"props":9907,"children":9908},{"style":2350},[9909],{"type":26,"value":9910}," host",{"type":21,"tag":2314,"props":9912,"children":9913},{"style":2321},[9914],{"type":26,"value":9915},"; ",{"type":21,"tag":2314,"props":9917,"children":9918},{"style":3157},[9919],{"type":26,"value":9920},"do\n",{"type":21,"tag":2314,"props":9922,"children":9923},{"class":2316,"line":436},[9924,9929,9933,9938,9943,9947,9952,9956,9960,9965,9970,9975,9980,9984],{"type":21,"tag":2314,"props":9925,"children":9926},{"style":2321},[9927],{"type":26,"value":9928},"  alg",{"type":21,"tag":2314,"props":9930,"children":9931},{"style":3157},[9932],{"type":26,"value":3197},{"type":21,"tag":2314,"props":9934,"children":9935},{"style":2321},[9936],{"type":26,"value":9937},"$(",{"type":21,"tag":2314,"props":9939,"children":9940},{"style":2339},[9941],{"type":26,"value":9942},"echo",{"type":21,"tag":2314,"props":9944,"children":9945},{"style":3157},[9946],{"type":26,"value":9858},{"type":21,"tag":2314,"props":9948,"children":9949},{"style":4318},[9950],{"type":26,"value":9951}," openssl",{"type":21,"tag":2314,"props":9953,"children":9954},{"style":2350},[9955],{"type":26,"value":9724},{"type":21,"tag":2314,"props":9957,"children":9958},{"style":2339},[9959],{"type":26,"value":9729},{"type":21,"tag":2314,"props":9961,"children":9962},{"style":2350},[9963],{"type":26,"value":9964}," \"",{"type":21,"tag":2314,"props":9966,"children":9967},{"style":2321},[9968],{"type":26,"value":9969},"$host",{"type":21,"tag":2314,"props":9971,"children":9972},{"style":2350},[9973],{"type":26,"value":9974},":443\"",{"type":21,"tag":2314,"props":9976,"children":9977},{"style":3157},[9978],{"type":26,"value":9979}," 2>",{"type":21,"tag":2314,"props":9981,"children":9982},{"style":2350},[9983],{"type":26,"value":9749},{"type":21,"tag":2314,"props":9985,"children":9986},{"style":2339},[9987],{"type":26,"value":9759},{"type":21,"tag":2314,"props":9989,"children":9990},{"class":2316,"line":3473},[9991,9996,10000,10005,10010,10015,10019,10023],{"type":21,"tag":2314,"props":9992,"children":9993},{"style":3157},[9994],{"type":26,"value":9995},"    |",{"type":21,"tag":2314,"props":9997,"children":9998},{"style":4318},[9999],{"type":26,"value":9951},{"type":21,"tag":2314,"props":10001,"children":10002},{"style":2350},[10003],{"type":26,"value":10004}," x509",{"type":21,"tag":2314,"props":10006,"children":10007},{"style":2339},[10008],{"type":26,"value":10009}," -noout",{"type":21,"tag":2314,"props":10011,"children":10012},{"style":2339},[10013],{"type":26,"value":10014}," -text",{"type":21,"tag":2314,"props":10016,"children":10017},{"style":3157},[10018],{"type":26,"value":9979},{"type":21,"tag":2314,"props":10020,"children":10021},{"style":2350},[10022],{"type":26,"value":9749},{"type":21,"tag":2314,"props":10024,"children":10025},{"style":2339},[10026],{"type":26,"value":9759},{"type":21,"tag":2314,"props":10028,"children":10029},{"class":2316,"line":3521},[10030,10034,10039,10044],{"type":21,"tag":2314,"props":10031,"children":10032},{"style":3157},[10033],{"type":26,"value":9995},{"type":21,"tag":2314,"props":10035,"children":10036},{"style":4318},[10037],{"type":26,"value":10038}," awk",{"type":21,"tag":2314,"props":10040,"children":10041},{"style":2350},[10042],{"type":26,"value":10043}," '\u002FSignature Algorithm\u002F {print $3; exit}'",{"type":21,"tag":2314,"props":10045,"children":10046},{"style":2321},[10047],{"type":26,"value":3257},{"type":21,"tag":2314,"props":10049,"children":10050},{"class":2316,"line":3563},[10051,10056,10061,10065,10069,10073,10078,10083,10088,10093],{"type":21,"tag":2314,"props":10052,"children":10053},{"style":2339},[10054],{"type":26,"value":10055},"  printf",{"type":21,"tag":2314,"props":10057,"children":10058},{"style":2350},[10059],{"type":26,"value":10060}," '%s\\t%s\\n'",{"type":21,"tag":2314,"props":10062,"children":10063},{"style":2350},[10064],{"type":26,"value":9964},{"type":21,"tag":2314,"props":10066,"children":10067},{"style":2321},[10068],{"type":26,"value":9969},{"type":21,"tag":2314,"props":10070,"children":10071},{"style":2350},[10072],{"type":26,"value":3307},{"type":21,"tag":2314,"props":10074,"children":10075},{"style":2350},[10076],{"type":26,"value":10077}," \"${",{"type":21,"tag":2314,"props":10079,"children":10080},{"style":2321},[10081],{"type":26,"value":10082},"alg",{"type":21,"tag":2314,"props":10084,"children":10085},{"style":3157},[10086],{"type":26,"value":10087},":-",{"type":21,"tag":2314,"props":10089,"children":10090},{"style":2321},[10091],{"type":26,"value":10092},"UNREACHABLE",{"type":21,"tag":2314,"props":10094,"children":10095},{"style":2350},[10096],{"type":26,"value":10097},"}\"\n",{"type":21,"tag":2314,"props":10099,"children":10100},{"class":2316,"line":4585},[10101,10106,10110],{"type":21,"tag":2314,"props":10102,"children":10103},{"style":3157},[10104],{"type":26,"value":10105},"done",{"type":21,"tag":2314,"props":10107,"children":10108},{"style":3157},[10109],{"type":26,"value":9744},{"type":21,"tag":2314,"props":10111,"children":10112},{"style":2321},[10113],{"type":26,"value":10114}," hosts.txt\n",{"type":21,"tag":22,"props":10116,"children":10117},{},[10118,10120,10125],{"type":26,"value":10119},"Feed the results into a register that records, per system: the algorithm, key size, protocol, certificate authority, library and version, the owner, and, most importantly, ",{"type":21,"tag":136,"props":10121,"children":10122},{},[10123],{"type":26,"value":10124},"how long the data it protects must stay confidential",{"type":26,"value":10126},". That last column is what turns an inventory into a prioritized migration order.",{"type":21,"tag":29,"props":10128,"children":10130},{"id":10129},"hybrid-deployment-is-the-low-risk-path",[10131],{"type":26,"value":10132},"Hybrid deployment is the low-risk path",{"type":21,"tag":22,"props":10134,"children":10135},{},[10136,10138,10143],{"type":26,"value":10137},"The consensus deployment pattern is hybrid: run a classical and a post-quantum key exchange together and combine both shared secrets, so the connection is safe unless ",{"type":21,"tag":362,"props":10139,"children":10140},{},[10141],{"type":26,"value":10142},"both",{"type":26,"value":10144}," are broken. This hedges against implementation bugs and undiscovered cryptanalysis in the newer lattice schemes.",{"type":21,"tag":22,"props":10146,"children":10147},{},[10148,10150,10155],{"type":26,"value":10149},"This is no longer experimental. ",{"type":21,"tag":136,"props":10151,"children":10152},{},[10153],{"type":26,"value":10154},"X25519MLKEM768",{"type":26,"value":10156}," is the standardized hybrid group, enabled by default in Chrome since version 131 and Firefox since 132, and OpenSSL 3.5 (April 2025) ships ML-KEM natively. Its default group list prefers the hybrid, meaning two OpenSSL 3.5 endpoints negotiate post-quantum key exchange with no configuration at all.",{"type":21,"tag":2304,"props":10158,"children":10160},{"className":9697,"code":10159,"language":9699,"meta":7,"style":7},"# nginx with OpenSSL 3.5+: explicit hybrid preference, classical fallback\nssl_protocols TLSv1.3;\nssl_ecdh_curve X25519MLKEM768:X25519:P-256;\n",[10161],{"type":21,"tag":2073,"props":10162,"children":10163},{"__ignoreMap":7},[10164,10172,10190],{"type":21,"tag":2314,"props":10165,"children":10166},{"class":2316,"line":2317},[10167],{"type":21,"tag":2314,"props":10168,"children":10169},{"style":3407},[10170],{"type":26,"value":10171},"# nginx with OpenSSL 3.5+: explicit hybrid preference, classical fallback\n",{"type":21,"tag":2314,"props":10173,"children":10174},{"class":2316,"line":106},[10175,10180,10185],{"type":21,"tag":2314,"props":10176,"children":10177},{"style":4318},[10178],{"type":26,"value":10179},"ssl_protocols",{"type":21,"tag":2314,"props":10181,"children":10182},{"style":2350},[10183],{"type":26,"value":10184}," TLSv1.3",{"type":21,"tag":2314,"props":10186,"children":10187},{"style":2321},[10188],{"type":26,"value":10189},";\n",{"type":21,"tag":2314,"props":10191,"children":10192},{"class":2316,"line":2335},[10193,10198,10203],{"type":21,"tag":2314,"props":10194,"children":10195},{"style":4318},[10196],{"type":26,"value":10197},"ssl_ecdh_curve",{"type":21,"tag":2314,"props":10199,"children":10200},{"style":2350},[10201],{"type":26,"value":10202}," X25519MLKEM768:X25519:P-256",{"type":21,"tag":2314,"props":10204,"children":10205},{"style":2321},[10206],{"type":26,"value":10189},{"type":21,"tag":22,"props":10208,"children":10209},{},[10210],{"type":26,"value":10211},"Signatures are further behind. Public CAs are not yet issuing ML-DSA certificates at scale, so key exchange is where you get real HNDL protection today, and it's the cheapest win available.",{"type":21,"tag":29,"props":10213,"children":10215},{"id":10214},"what-to-do-this-quarter",[10216],{"type":26,"value":10217},"What to do this quarter",{"type":21,"tag":22,"props":10219,"children":10220},{},[10221],{"type":26,"value":10222},"A realistic 90-day slice:",{"type":21,"tag":6961,"props":10224,"children":10225},{},[10226,10236,10275,10285,10295,10305,10322],{"type":21,"tag":3084,"props":10227,"children":10228},{},[10229,10234],{"type":21,"tag":136,"props":10230,"children":10231},{},[10232],{"type":26,"value":10233},"Appoint an owner.",{"type":26,"value":10235}," Migrations without a named accountable person do not happen. This is a multi-year program, not a ticket.",{"type":21,"tag":3084,"props":10237,"children":10238},{},[10239,10244,10246,10252,10253,10259,10260,10266,10267,10273],{"type":21,"tag":136,"props":10240,"children":10241},{},[10242],{"type":26,"value":10243},"Run automated discovery",{"type":26,"value":10245}," across external endpoints, internal service mesh, and code repositories. Grep your codebases for ",{"type":21,"tag":2073,"props":10247,"children":10249},{"className":10248},[],[10250],{"type":26,"value":10251},"RSA",{"type":26,"value":1309},{"type":21,"tag":2073,"props":10254,"children":10256},{"className":10255},[],[10257],{"type":26,"value":10258},"ECDSA",{"type":26,"value":1309},{"type":21,"tag":2073,"props":10261,"children":10263},{"className":10262},[],[10264],{"type":26,"value":10265},"secp256",{"type":26,"value":1309},{"type":21,"tag":2073,"props":10268,"children":10270},{"className":10269},[],[10271],{"type":26,"value":10272},"PKCS1",{"type":26,"value":10274},", and hardcoded algorithm identifiers.",{"type":21,"tag":3084,"props":10276,"children":10277},{},[10278,10283],{"type":21,"tag":136,"props":10279,"children":10280},{},[10281],{"type":26,"value":10282},"Classify by data lifetime.",{"type":26,"value":10284}," Sort systems by how long their data must stay secret. Anything over ten years is priority one.",{"type":21,"tag":3084,"props":10286,"children":10287},{},[10288,10293],{"type":21,"tag":136,"props":10289,"children":10290},{},[10291],{"type":26,"value":10292},"Turn on hybrid TLS where it's free.",{"type":26,"value":10294}," Upgrade to OpenSSL 3.5+ or a TLS terminator that supports X25519MLKEM768. For many organizations this is a load-balancer config change covering the majority of traffic.",{"type":21,"tag":3084,"props":10296,"children":10297},{},[10298,10303],{"type":21,"tag":136,"props":10299,"children":10300},{},[10301],{"type":26,"value":10302},"Send the vendor questionnaire.",{"type":26,"value":10304}," Ask every crypto-touching vendor for their FIPS 203\u002F204\u002F205 roadmap with dates. Slow answers are your long pole. You need them on record now.",{"type":21,"tag":3084,"props":10306,"children":10307},{},[10308,10313,10315,10320],{"type":21,"tag":136,"props":10309,"children":10310},{},[10311],{"type":26,"value":10312},"Fix crypto-agility in new code.",{"type":26,"value":10314}," Stop hardcoding algorithms. Route every operation through an abstraction that takes the algorithm from configuration, so the ",{"type":21,"tag":362,"props":10316,"children":10317},{},[10318],{"type":26,"value":10319},"next",{"type":26,"value":10321}," transition (HQC, FN-DSA, or whatever follows) is a config change rather than a rewrite. This is the single highest-leverage engineering change, because the 2035 deadline is not the last one.",{"type":21,"tag":3084,"props":10323,"children":10324},{},[10325,10330],{"type":21,"tag":136,"props":10326,"children":10327},{},[10328],{"type":26,"value":10329},"Move code signing early.",{"type":26,"value":10331}," It has the earliest federal deadline, the longest verification tail, and signatures that must remain verifiable for decades.",{"type":21,"tag":29,"props":10333,"children":10335},{"id":10334},"the-bottom-line",[10336],{"type":26,"value":10337},"The bottom line",{"type":21,"tag":22,"props":10339,"children":10340},{},[10341,10343,10348],{"type":26,"value":10342},"The deadlines are published, they're closer than the hardware timeline suggests, and they were set by people who assume migration takes ten years. Two dates are worth memorizing: ",{"type":21,"tag":136,"props":10344,"children":10345},{},[10346],{"type":26,"value":10347},"after 2030, classical asymmetric crypto is deprecated, and after 2035, it's disallowed",{"type":26,"value":10349},", with federal national-security systems running years ahead of that.",{"type":21,"tag":22,"props":10351,"children":10352},{},[10353],{"type":26,"value":10354},"The work that pays off regardless of when quantum hardware arrives is the boring part: knowing where your cryptography lives and being able to change it without a rewrite. Everything else is a config flag.",{"type":21,"tag":22,"props":10356,"children":10357},{},[10358,10363,10364,10369,10370,10375,10376,10381,10382],{"type":21,"tag":136,"props":10359,"children":10360},{},[10361],{"type":26,"value":10362},"Further reading:",{"type":26,"value":1301},{"type":21,"tag":46,"props":10365,"children":10366},{"href":9333},[10367],{"type":26,"value":10368},"What PQC is",{"type":26,"value":7066},{"type":21,"tag":46,"props":10371,"children":10372},{"href":674},[10373],{"type":26,"value":10374},"Reading policy documents as technical assessments",{"type":26,"value":7066},{"type":21,"tag":46,"props":10377,"children":10378},{"href":3917},[10379],{"type":26,"value":10380},"Quantum computing glossary",{"type":26,"value":7066},{"type":21,"tag":46,"props":10383,"children":10385},{"href":10384},"\u002Fnews",[10386],{"type":26,"value":10387},"Latest developments",{"type":21,"tag":2688,"props":10389,"children":10390},{},[10391],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":10393},[10394,10395,10396,10397,10398,10399,10400,10401],{"id":9341,"depth":106,"text":9344},{"id":9486,"depth":106,"text":9489},{"id":9564,"depth":106,"text":9567},{"id":9632,"depth":106,"text":9635},{"id":9686,"depth":106,"text":9689},{"id":10129,"depth":106,"text":10132},{"id":10214,"depth":106,"text":10217},{"id":10334,"depth":106,"text":10337},"content:blog:post-quantum-migration-deadlines.md","blog\u002Fpost-quantum-migration-deadlines.md","blog\u002Fpost-quantum-migration-deadlines",{"_path":10406,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":10407,"description":10408,"date":3032,"author":11,"tags":10409,"readingTime":1364,"body":10410,"_type":111,"_id":10976,"_source":113,"_file":10977,"_stem":10978,"_extension":116},"\u002Fblog\u002Fq-day-breaking-rsa-2048","Q-Day and What Breaking RSA-2048 Requires","Q-Day is one of the most abused terms in quantum computing. Here's a precise definition, the published resource estimates for factoring RSA-2048 with Shor's algorithm, and why those estimates disagree by orders of magnitude.",[9301,9302,9303],{"type":18,"children":10411,"toc":10966},[10412,10417,10422,10428,10452,10464,10469,10475,10493,10505,10511,10531,10570,10599,10605,10639,10666,10692,10718,10723,10776,10786,10792,10816,10828,10834,10839,10851,10857,10862,10888,10900,10906,10911,10923,10935],{"type":21,"tag":22,"props":10413,"children":10414},{},[10415],{"type":26,"value":10416},"\"Q-Day\" appears in vendor decks, government strategy documents, and newspaper headlines, usually with a countdown clock attached. It is rarely defined. That vagueness is doing a lot of work, because the term is used to mean at least two different things, and the gap between them is measured in years and billions of dollars of engineering.",{"type":21,"tag":22,"props":10418,"children":10419},{},[10420],{"type":26,"value":10421},"This post does the part that most coverage skips: what a machine capable of breaking RSA-2048 would have to be, according to published estimates, and why those estimates have ranged from twenty million qubits to under one million within six years.",{"type":21,"tag":29,"props":10423,"children":10425},{"id":10424},"defining-the-term-precisely",[10426],{"type":26,"value":10427},"Defining the term precisely",{"type":21,"tag":22,"props":10429,"children":10430},{},[10431,10437,10439,10444,10446,10450],{"type":21,"tag":46,"props":10432,"children":10434},{"href":10433},"\u002Fglossary\u002Fq-day",[10435],{"type":26,"value":10436},"Q-Day",{"type":26,"value":10438}," is most usefully defined as ",{"type":21,"tag":136,"props":10440,"children":10441},{},[10442],{"type":26,"value":10443},"the day a cryptographically relevant quantum computer (CRQC) first exists",{"type":26,"value":10445},": a machine that runs ",{"type":21,"tag":46,"props":10447,"children":10448},{"href":9582},[10449],{"type":26,"value":9585},{"type":26,"value":10451}," against real-world key sizes within an operationally useful time.",{"type":21,"tag":22,"props":10453,"children":10454},{},[10455,10457,10462],{"type":26,"value":10456},"The looseness creeps in around \"real-world key sizes.\" Some writers use Q-Day to mean specifically ",{"type":21,"tag":362,"props":10458,"children":10459},{},[10460],{"type":26,"value":10461},"RSA-2048 is broken",{"type":26,"value":10463},". Others use it for any CRQC, which would include a machine that breaks NIST P-256 elliptic-curve keys, a meaningfully easier target, since ECC uses far smaller keys for equivalent classical security, and the elliptic-curve variant of Shor's needs a smaller register. A third group uses it loosely for \"quantum computers become scary,\" which is not a technical claim at all.",{"type":21,"tag":22,"props":10465,"children":10466},{},[10467],{"type":26,"value":10468},"Precision matters because these events do not happen on the same day. If P-256 falls before RSA-2048, the practical consequences differ sharply: ECDSA underpins TLS certificates, SSH, code signing, and most cryptocurrency, while RSA-2048 still guards a large installed base of older infrastructure. A plan built around one date risks being badly calibrated for the other.",{"type":21,"tag":29,"props":10470,"children":10472},{"id":10471},"why-the-date-matters-less-than-youd-think",[10473],{"type":26,"value":10474},"Why the date matters less than you'd think",{"type":21,"tag":22,"props":10476,"children":10477},{},[10478,10480,10484,10486,10491],{"type":26,"value":10479},"The instinct on hearing \"Q-Day\" is to ask when. That question is less decision-relevant than it feels, because of ",{"type":21,"tag":136,"props":10481,"children":10482},{},[10483],{"type":26,"value":9577},{"type":26,"value":10485},": an adversary records encrypted traffic today and stores it until a CRQC exists. Any data whose confidentiality must outlive Q-Day is exposed ",{"type":21,"tag":362,"props":10487,"children":10488},{},[10489],{"type":26,"value":10490},"now",{"type":26,"value":10492},", regardless of when Q-Day lands.",{"type":21,"tag":22,"props":10494,"children":10495},{},[10496,10498,10503],{"type":26,"value":10497},"So the question that drives decisions is not \"when is Q-Day\" but \"how long must this data stay secret, and how long will my migration take.\" Regulators have already answered on organizations' behalf with published deprecation dates. We cover those in detail in ",{"type":21,"tag":46,"props":10499,"children":10500},{"href":1745},[10501],{"type":26,"value":10502},"the post-quantum migration clock",{"type":26,"value":10504},", and they are deliberately independent of any hardware forecast.",{"type":21,"tag":29,"props":10506,"children":10508},{"id":10507},"the-core-question-what-would-the-machine-look-like",[10509],{"type":26,"value":10510},"The core question: what would the machine look like?",{"type":21,"tag":22,"props":10512,"children":10513},{},[10514,10516,10521,10523,10529],{"type":26,"value":10515},"Shor's algorithm, ",{"type":21,"tag":46,"props":10517,"children":10518},{"href":8562},[10519],{"type":26,"value":10520},"introduced in 1994",{"type":26,"value":10522},", reduces factoring to period-finding, which it solves using ",{"type":21,"tag":46,"props":10524,"children":10526},{"href":10525},"\u002Fglossary\u002Fphase-estimation",[10527],{"type":26,"value":10528},"quantum phase estimation",{"type":26,"value":10530}," over a modular exponentiation circuit. The algorithmic cost is polynomial. The engineering cost is where the difficulty lives, and it splits into two different numbers.",{"type":21,"tag":22,"props":10532,"children":10533},{},[10534,10539,10541,10547,10549,10553,10555,10560,10562,10568],{"type":21,"tag":136,"props":10535,"children":10536},{},[10537],{"type":26,"value":10538},"Logical qubits",{"type":26,"value":10540}," are the idealized, error-free qubits the algorithm is written against. Gidney and Ekerå's 2019 construction expresses this as ",{"type":21,"tag":2073,"props":10542,"children":10544},{"className":10543},[],[10545],{"type":26,"value":10546},"3n + 0.002·n·lg n",{"type":26,"value":10548}," logical qubits for an ",{"type":21,"tag":362,"props":10550,"children":10551},{},[10552],{"type":26,"value":4783},{"type":26,"value":10554},"-bit modulus. For RSA-2048 that works out to roughly ",{"type":21,"tag":136,"props":10556,"children":10557},{},[10558],{"type":26,"value":10559},"6,200 logical qubits",{"type":26,"value":10561},", alongside a Toffoli gate count on the order of ",{"type":21,"tag":2073,"props":10563,"children":10565},{"className":10564},[],[10566],{"type":26,"value":10567},"0.3n³",{"type":26,"value":10569},", billions of gates.",{"type":21,"tag":22,"props":10571,"children":10572},{},[10573,10578,10580,10584,10586,10590,10592,10597],{"type":21,"tag":136,"props":10574,"children":10575},{},[10576],{"type":26,"value":10577},"Physical qubits",{"type":26,"value":10579}," are what you build. The ratio between them is the overhead imposed by ",{"type":21,"tag":46,"props":10581,"children":10582},{"href":48},[10583],{"type":26,"value":8919},{"type":26,"value":10585},", and it is brutal. Under the surface code, each ",{"type":21,"tag":46,"props":10587,"children":10588},{"href":1385},[10589],{"type":26,"value":8907},{"type":26,"value":10591}," is encoded across a patch of physical qubits whose size grows with the ",{"type":21,"tag":362,"props":10593,"children":10594},{},[10595],{"type":26,"value":10596},"code distance",{"type":26,"value":10598},", which must be chosen large enough that the total error across billions of gates stays below one. Getting from ~6,200 logical qubits to a working machine is where the millions come from.",{"type":21,"tag":29,"props":10600,"children":10602},{"id":10601},"the-published-estimates-and-why-they-moved",[10603],{"type":26,"value":10604},"The published estimates, and why they moved",{"type":21,"tag":22,"props":10606,"children":10607},{},[10608,10610,10615,10617,10622,10623,10630,10632,10637],{"type":26,"value":10609},"The most-cited figure comes from ",{"type":21,"tag":136,"props":10611,"children":10612},{},[10613],{"type":26,"value":10614},"Gidney and Ekerå (2019)",{"type":26,"value":10616},": factoring a 2048-bit RSA integer in ",{"type":21,"tag":136,"props":10618,"children":10619},{},[10620],{"type":26,"value":10621},"8 hours using 20 million noisy physical qubits",{"type":26,"value":9504},{"type":21,"tag":46,"props":10624,"children":10627},{"href":10625,"rel":10626},"https:\u002F\u002Farxiv.org\u002Fabs\u002F1905.09749",[899],[10628],{"type":26,"value":10629},"arXiv:1905.09749",{"type":26,"value":10631},", later published in ",{"type":21,"tag":362,"props":10633,"children":10634},{},[10635],{"type":26,"value":10636},"Quantum",{"type":26,"value":10638},"). That was already a hundredfold reduction in spacetime volume over prior proposals.",{"type":21,"tag":22,"props":10640,"children":10641},{},[10642,10644,10649,10651,10656,10657,10664],{"type":26,"value":10643},"In May 2025, ",{"type":21,"tag":136,"props":10645,"children":10646},{},[10647],{"type":26,"value":10648},"Gidney",{"type":26,"value":10650}," published a revised analysis: ",{"type":21,"tag":136,"props":10652,"children":10653},{},[10654],{"type":26,"value":10655},"fewer than one million noisy physical qubits, running for under a week",{"type":26,"value":9504},{"type":21,"tag":46,"props":10658,"children":10661},{"href":10659,"rel":10660},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2505.15917",[899],[10662],{"type":26,"value":10663},"arXiv:2505.15917",{"type":26,"value":10665},"). That is roughly a 20× reduction in qubit count against his own earlier number, traded for a longer runtime.",{"type":21,"tag":22,"props":10667,"children":10668},{},[10669,10671,10676,10678,10683,10685,10690],{"type":26,"value":10670},"Both papers assume broadly the same hardware model: a planar square grid of superconducting qubits with nearest-neighbour connectivity, a ",{"type":21,"tag":136,"props":10672,"children":10673},{},[10674],{"type":26,"value":10675},"0.1% gate error rate",{"type":26,"value":10677},", a ",{"type":21,"tag":136,"props":10679,"children":10680},{},[10681],{"type":26,"value":10682},"1 microsecond",{"type":26,"value":10684}," surface code cycle, and a ",{"type":21,"tag":136,"props":10686,"children":10687},{},[10688],{"type":26,"value":10689},"10 microsecond",{"type":26,"value":10691}," control-system reaction time.",{"type":21,"tag":22,"props":10693,"children":10694},{},[10695,10697,10702,10704,10709,10711,10716],{"type":26,"value":10696},"That is the key insight about the discrepancy: ",{"type":21,"tag":136,"props":10698,"children":10699},{},[10700],{"type":26,"value":10701},"the hardware assumptions barely changed. The algorithms and codes did.",{"type":26,"value":10703}," The 2025 reduction comes from three specific advances: approximate residue arithmetic (fewer operations), ",{"type":21,"tag":362,"props":10705,"children":10706},{},[10707],{"type":26,"value":10708},"yoked surface codes",{"type":26,"value":10710}," (roughly tripling storage density for idle logical qubits), and ",{"type":21,"tag":362,"props":10712,"children":10713},{},[10714],{"type":26,"value":10715},"magic state cultivation",{"type":26,"value":10717},", which makes producing the high-fidelity non-Clifford resource states that dominate the cost far cheaper than traditional distillation.",{"type":21,"tag":22,"props":10719,"children":10720},{},[10721],{"type":26,"value":10722},"This is why estimates in the wild vary so wildly. Any published number is a function of at least five assumptions:",{"type":21,"tag":3080,"props":10724,"children":10725},{},[10726,10736,10746,10756,10766],{"type":21,"tag":3084,"props":10727,"children":10728},{},[10729,10734],{"type":21,"tag":136,"props":10730,"children":10731},{},[10732],{"type":26,"value":10733},"Physical error rate.",{"type":26,"value":10735}," The required code distance depends on how far below threshold the hardware sits. A 10× better physical error rate cuts the overhead dramatically.",{"type":21,"tag":3084,"props":10737,"children":10738},{},[10739,10744],{"type":21,"tag":136,"props":10740,"children":10741},{},[10742],{"type":26,"value":10743},"Code choice.",{"type":26,"value":10745}," Surface codes are the conservative baseline. Higher-rate qLDPC codes are likely to reduce overhead substantially, at the cost of harder connectivity requirements.",{"type":21,"tag":3084,"props":10747,"children":10748},{},[10749,10754],{"type":21,"tag":136,"props":10750,"children":10751},{},[10752],{"type":26,"value":10753},"Cycle and reaction time.",{"type":26,"value":10755}," These set wall-clock runtime, and runtime feeds back into how much error correction you need.",{"type":21,"tag":3084,"props":10757,"children":10758},{},[10759,10764],{"type":21,"tag":136,"props":10760,"children":10761},{},[10762],{"type":26,"value":10763},"Magic state strategy.",{"type":26,"value":10765}," Distillation factories historically consumed the majority of the machine's footprint. Cultivation changes that budget.",{"type":21,"tag":3084,"props":10767,"children":10768},{},[10769,10774],{"type":21,"tag":136,"props":10770,"children":10771},{},[10772],{"type":26,"value":10773},"Space–time tradeoff.",{"type":26,"value":10775}," You nearly always buy fewer qubits with more hours, which is exactly what happened between the 2019 and 2025 papers. Quoting a qubit count without a runtime is meaningless.",{"type":21,"tag":22,"props":10777,"children":10778},{},[10779,10784],{"type":21,"tag":136,"props":10780,"children":10781},{},[10782],{"type":26,"value":10783},"The direction of travel is the important dynamic.",{"type":26,"value":10785}," Over three decades, published estimates have moved consistently downward, driven by compilation and error-correction improvements rather than by hardware surprises. A migration plan that assumes today's estimate is the floor is planning against a number that has never yet stopped falling.",{"type":21,"tag":29,"props":10787,"children":10789},{"id":10788},"where-hardware-stands",[10790],{"type":26,"value":10791},"Where hardware stands",{"type":21,"tag":22,"props":10793,"children":10794},{},[10795,10797,10802,10804,10808,10810,10814],{"type":26,"value":10796},"Current devices carry roughly 100 to 1,000 physical qubits. Google's Willow processor, used in the 2024 ",{"type":21,"tag":46,"props":10798,"children":10799},{"href":3701},[10800],{"type":26,"value":10801},"below-threshold demonstration",{"type":26,"value":10803},", has 105. Even against the optimistic 2025 estimate, that is three orders of magnitude short in qubit count, before accounting for the ",{"type":21,"tag":46,"props":10805,"children":10806},{"href":8967},[10807],{"type":26,"value":8970},{"type":26,"value":10809},", connectivity, and control requirements those papers assume. Our ",{"type":21,"tag":46,"props":10811,"children":10812},{"href":99},[10813],{"type":26,"value":102},{"type":26,"value":10815}," tracks what is available.",{"type":21,"tag":22,"props":10817,"children":10818},{},[10819,10821,10826],{"type":26,"value":10820},"But the 2024 result matters more than the raw gap suggests. Google ran surface codes at distances 3, 5, and 7 and showed each increase roughly ",{"type":21,"tag":362,"props":10822,"children":10823},{},[10824],{"type":26,"value":10825},"halved",{"type":26,"value":10827}," the logical error rate: the logical qubit outperformed its best constituent physical qubit. Every fault-tolerance roadmap assumes that adding qubits makes the encoded qubit better rather than worse. Until that experiment, it was an assumption. Crossing the threshold converted the remaining problem from an open physics question into a scaling and manufacturing one. Scaling problems are still extremely hard and sometimes take decades. They are a different category of hard.",{"type":21,"tag":29,"props":10829,"children":10831},{"id":10830},"machine-checking-the-numbers",[10832],{"type":26,"value":10833},"Machine-checking the numbers",{"type":21,"tag":22,"props":10835,"children":10836},{},[10837],{"type":26,"value":10838},"A subtlety that rarely surfaces: these resource estimates are long, detailed, hand-written analyses, and migration budgets running into the billions are set on the basis of them. An arithmetic slip or an unstated assumption in a compilation argument propagates straight into policy.",{"type":21,"tag":22,"props":10840,"children":10841},{},[10842,10844,10849],{"type":26,"value":10843},"That is why the 2026 ",{"type":21,"tag":46,"props":10845,"children":10846},{"href":9613},[10847],{"type":26,"value":10848},"Lean formalization of Shor's algorithm",{"type":26,"value":10850}," is worth attention beyond its novelty. It formalizes order finding and the reversible circuits for modular and elliptic-curve arithmetic in a proof assistant, and machine-checks the logical resource estimates for both RSA-2048 and P-256. It does not settle the physical-qubit question (that still depends on the hardware assumptions above), but it puts the logical layer on an auditable footing. When a number drives a budget, \"a machine verified this derivation\" is a meaningfully stronger claim than \"several experts read the appendix.\"",{"type":21,"tag":29,"props":10852,"children":10854},{"id":10853},"the-vendor-perspective-clearly-labelled",[10855],{"type":26,"value":10856},"The vendor perspective, clearly labelled",{"type":21,"tag":22,"props":10858,"children":10859},{},[10860],{"type":26,"value":10861},"Quantum hardware companies publish extensively on Q-Day, and their framing deserves an explicit caveat: they sell the machines whose urgency they are describing.",{"type":21,"tag":22,"props":10863,"children":10864},{},[10865,10867,10872,10874,10879,10881,10886],{"type":26,"value":10866},"IonQ's December 2024 post ",{"type":21,"tag":362,"props":10868,"children":10869},{},[10870],{"type":26,"value":10871},"Q-Day and the Impact of Breaking RSA2048",{"type":26,"value":10873},", by SVP of Product and Applications Ariel Braunstein, is a reasonable example. ",{"type":21,"tag":136,"props":10875,"children":10876},{},[10877],{"type":26,"value":10878},"IonQ argues",{"type":26,"value":10880}," that harvest-now-decrypt-later is already underway, describing nation states collecting encrypted data in anticipation of future decryption capability, and that the unpredictability of algorithmic breakthroughs is itself a reason not to wait. To its credit, the post declines to name a year, presenting a spread of estimates across research organizations instead, and ",{"type":21,"tag":136,"props":10882,"children":10883},{},[10884],{"type":26,"value":10885},"IonQ's recommendation",{"type":26,"value":10887}," (that organizations begin exploring quantum-resistant algorithms now, while acknowledging urgency varies with the timeline one assumes) is close to the mainstream security-community position.",{"type":21,"tag":22,"props":10889,"children":10890},{},[10891,10893,10898],{"type":26,"value":10892},"Note also what it does not contain. ",{"type":21,"tag":136,"props":10894,"children":10895},{},[10896],{"type":26,"value":10897},"The IonQ post cites no qubit count or resource estimate for RSA-2048 at all.",{"type":26,"value":10899}," Its one concrete figure is an unrelated materials-simulation algorithm reduced from 1.5 trillion gate operations to 410,000. That is a genuine result about a different workload, and it is not evidence about factoring. Treat vendor content as a directionally useful signal about industry expectations, not as a neutral source for the resource question.",{"type":21,"tag":29,"props":10901,"children":10903},{"id":10902},"how-to-reason-about-it-yourself",[10904],{"type":26,"value":10905},"How to reason about it yourself",{"type":21,"tag":22,"props":10907,"children":10908},{},[10909],{"type":26,"value":10910},"The framing that survives contact with the uncertainty is Mosca's inequality: if your data's required confidentiality lifetime plus your migration time exceeds the time until a CRQC exists, you are already late. Only the third term is unknown, and the first two are usually large enough that the third barely changes the answer.",{"type":21,"tag":22,"props":10912,"children":10913},{},[10914,10916,10921],{"type":26,"value":10915},"So the honest conclusion is an uncomfortable one: ",{"type":21,"tag":136,"props":10917,"children":10918},{},[10919],{"type":26,"value":10920},"nobody credible gives you a date, and anyone who does is telling you about their business model or their priors, not about physics.",{"type":26,"value":10922}," What we say precisely is what the machine would need to be, that the requirement has been revised downward repeatedly, and that the error-correction threshold has been crossed.",{"type":21,"tag":22,"props":10924,"children":10925},{},[10926,10928,10933],{"type":26,"value":10927},"The responsible posture is to migrate on a schedule that does not depend on knowing the date. Start with ",{"type":21,"tag":46,"props":10929,"children":10930},{"href":9333},[10931],{"type":26,"value":10932},"what PQC is",{"type":26,"value":10934},", then work the calendar. If your plan breaks when the estimate drops another 10×, it was never a plan.",{"type":21,"tag":22,"props":10936,"children":10937},{},[10938,10942,10943,10948,10949,10954,10955,10961,10962],{"type":21,"tag":136,"props":10939,"children":10940},{},[10941],{"type":26,"value":10362},{"type":26,"value":1301},{"type":21,"tag":46,"props":10944,"children":10945},{"href":1745},[10946],{"type":26,"value":10947},"Post-quantum migration deadlines",{"type":26,"value":7066},{"type":21,"tag":46,"props":10950,"children":10951},{"href":253},[10952],{"type":26,"value":10953},"Quantum error correction explained",{"type":26,"value":7066},{"type":21,"tag":46,"props":10956,"children":10958},{"href":10957},"\u002Fresearch",[10959],{"type":26,"value":10960},"Landmark research papers",{"type":26,"value":7066},{"type":21,"tag":46,"props":10963,"children":10964},{"href":10384},[10965],{"type":26,"value":10387},{"title":7,"searchDepth":106,"depth":106,"links":10967},[10968,10969,10970,10971,10972,10973,10974,10975],{"id":10424,"depth":106,"text":10427},{"id":10471,"depth":106,"text":10474},{"id":10507,"depth":106,"text":10510},{"id":10601,"depth":106,"text":10604},{"id":10788,"depth":106,"text":10791},{"id":10830,"depth":106,"text":10833},{"id":10853,"depth":106,"text":10856},{"id":10902,"depth":106,"text":10905},"content:blog:q-day-breaking-rsa-2048.md","blog\u002Fq-day-breaking-rsa-2048.md","blog\u002Fq-day-breaking-rsa-2048",{"_path":511,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":10980,"description":10981,"date":3032,"author":11,"tags":10982,"readingTime":1364,"body":10983,"_type":111,"_id":11475,"_source":113,"_file":11476,"_stem":11477,"_extension":116},"The Real-Time Decoding Bottleneck: Quantum Error Correction's Classical Problem","Syndrome measurement tells you something broke, not what broke. Working that out is decoding, and if your classical decoder can't keep pace with the syndrome stream, the whole error-correction scheme collapses.",[125,13,3034],{"type":18,"children":10984,"toc":11465},[10985,11002,11014,11020,11032,11045,11057,11069,11075,11080,11085,11090,11102,11114,11126,11138,11144,11149,11159,11169,11179,11185,11190,11195,11207,11226,11231,11236,11242,11254,11259,11290,11302,11308,11313,11345,11350,11356,11368,11373,11392,11398,11403,11408,11419],{"type":21,"tag":22,"props":10986,"children":10987},{},[10988,10990,10994,10996,11000],{"type":26,"value":10989},"Most explanations of ",{"type":21,"tag":46,"props":10991,"children":10992},{"href":48},[10993],{"type":26,"value":8919},{"type":26,"value":10995}," end at the same place. You encode a logical qubit across many physical ones, you run parity checks with ",{"type":21,"tag":46,"props":10997,"children":10998},{"href":8931},[10999],{"type":26,"value":8934},{"type":26,"value":11001},", you detect errors without collapsing the state, and then the article stops, having implied that detection is correction.",{"type":21,"tag":22,"props":11003,"children":11004},{},[11005,11007,11012],{"type":26,"value":11006},"It isn't. In our ",{"type":21,"tag":46,"props":11008,"children":11009},{"href":150},[11010],{"type":26,"value":11011},"companion post on logical qubits and fault tolerance",{"type":26,"value":11013},", we listed real-time decoding as one of four things a fault-tolerant machine needs, and then moved on. This post picks up that thread, because it is the requirement least likely to be explained anywhere else, and it has a property the others don't: it is not fundamentally a quantum problem at all. It is a classical computing problem sitting inside the quantum computer, and it is currently one of the harder ones.",{"type":21,"tag":29,"props":11015,"children":11017},{"id":11016},"what-syndrome-measurement-gives-you",[11018],{"type":26,"value":11019},"What syndrome measurement gives you",{"type":21,"tag":22,"props":11021,"children":11022},{},[11023,11025,11030],{"type":26,"value":11024},"The ",{"type":21,"tag":46,"props":11026,"children":11027},{"href":253},[11028],{"type":26,"value":11029},"QEC basics post",{"type":26,"value":11031}," covers the mechanics of parity checks, so we won't re-derive them. The relevant point is what comes out.",{"type":21,"tag":22,"props":11033,"children":11034},{},[11035,11037,11043],{"type":26,"value":11036},"A round of syndrome extraction hands you a list of bits. Each bit says whether one particular parity check agreed with its previous value or flipped. A flipped check means an error touched at least one of the qubits it monitors. That's it. You do not learn which qubit. You do not learn whether it was an X, Z, or Y error. See the ",{"type":21,"tag":46,"props":11038,"children":11040},{"href":11039},"\u002Fglossary\u002Fpauli-operators",[11041],{"type":26,"value":11042},"Pauli operator",{"type":26,"value":11044}," breakdown for why those are the only cases that matter. You learn only that the parity structure has been violated somewhere in the neighbourhood of that check.",{"type":21,"tag":22,"props":11046,"children":11047},{},[11048,11050,11055],{"type":26,"value":11049},"Worse, the ",{"type":21,"tag":46,"props":11051,"children":11052},{"href":7374},[11053],{"type":26,"value":11054},"measurement",{"type":26,"value":11056}," circuits are themselves noisy, so some flipped checks correspond to no data error at all. The check itself misfired. And errors that happen to straddle two checks flip both, while an error in the middle of a chain of errors sometimes flips nothing, because two violations cancel.",{"type":21,"tag":22,"props":11058,"children":11059},{},[11060,11062,11067],{"type":26,"value":11061},"So the syndrome is not a diagnosis. It is a constraint. The job is to find the most probable physical error consistent with that constraint, then apply (or, more often, simply record) the correction. That inference step is ",{"type":21,"tag":136,"props":11063,"children":11064},{},[11065],{"type":26,"value":11066},"decoding",{"type":26,"value":11068},", and it is a genuine combinatorial optimisation problem.",{"type":21,"tag":29,"props":11070,"children":11072},{"id":11071},"the-part-that-makes-it-urgent",[11073],{"type":26,"value":11074},"The part that makes it urgent",{"type":21,"tag":22,"props":11076,"children":11077},{},[11078],{"type":26,"value":11079},"Here is where it stops being an interesting algorithms question and becomes an engineering crisis.",{"type":21,"tag":22,"props":11081,"children":11082},{},[11083],{"type":26,"value":11084},"Syndrome extraction is not a one-off. It runs continuously, in rounds, for the entire duration of the computation. On superconducting hardware a round takes roughly a microsecond. Google's Willow experiments ran a cycle time of about 1.1 µs. Every one of those cycles emits a fresh syndrome frame from every logical qubit on the chip. For a machine of any interesting size, the syndrome data rate runs into millions of measurements per second.",{"type":21,"tag":22,"props":11086,"children":11087},{},[11088],{"type":26,"value":11089},"Your decoder has to consume that stream at least as fast as it arrives. Not \"reasonably fast.\" At least as fast, sustained, forever.",{"type":21,"tag":22,"props":11091,"children":11092},{},[11093,11095,11100],{"type":26,"value":11094},"If it doesn't, you get the ",{"type":21,"tag":136,"props":11096,"children":11097},{},[11098],{"type":26,"value":11099},"backlog problem",{"type":26,"value":11101},", and the backlog problem does not degrade gracefully. Suppose your decoder processes each round 10% slower than rounds are produced. Undecoded frames pile up. The queue grows linearly in wall-clock time, which sounds survivable until you remember why you needed the decode result in the first place.",{"type":21,"tag":22,"props":11103,"children":11104},{},[11105,11107,11112],{"type":26,"value":11106},"Certain operations in a fault-tolerant computation are ",{"type":21,"tag":362,"props":11108,"children":11109},{},[11110],{"type":26,"value":11111},"conditional",{"type":26,"value":11113},": what gate you apply next depends on the decoded outcome of measurements already taken. The canonical case is a non-Clifford gate implemented via magic state injection, where a correction is applied or not depending on a measurement result that must first be decoded. At each such branch point, the machine must stop and wait for the decoder to catch up to the present moment. But while it waits, more syndrome rounds are being produced. The qubits don't stop decohering only because the classical side is busy. So the wait itself extends the backlog, which lengthens the next wait, which extends the backlog further.",{"type":21,"tag":22,"props":11115,"children":11116},{},[11117,11119,11124],{"type":26,"value":11118},"The result is an ",{"type":21,"tag":136,"props":11120,"children":11121},{},[11122],{"type":26,"value":11123},"exponential slowdown",{"type":26,"value":11125},". Each conditional operation takes longer than the last by a compounding factor, and the computation grinds to a halt long before it finishes. A decoder that is 10% too slow doesn't cost you 10%. It costs you the entire computation. The requirement is a hard throughput threshold, not a performance preference.",{"type":21,"tag":22,"props":11127,"children":11128},{},[11129,11131,11136],{"type":26,"value":11130},"This is why the word \"real-time\" is load-bearing. Offline decoding (recording the syndrome stream and analysing it afterwards) is perfectly fine for a ",{"type":21,"tag":362,"props":11132,"children":11133},{},[11134],{"type":26,"value":11135},"memory",{"type":26,"value":11137}," experiment, where you only want to know whether the stored state survived. It is useless for computation.",{"type":21,"tag":29,"props":11139,"children":11141},{"id":11140},"the-decoder-families-and-their-bargains",[11142],{"type":26,"value":11143},"The decoder families, and their bargains",{"type":21,"tag":22,"props":11145,"children":11146},{},[11147],{"type":26,"value":11148},"The decoding problem has a beautiful structure in the surface code, and a much uglier one elsewhere.",{"type":21,"tag":22,"props":11150,"children":11151},{},[11152,11157],{"type":21,"tag":136,"props":11153,"children":11154},{},[11155],{"type":26,"value":11156},"Minimum-weight perfect matching (MWPM).",{"type":26,"value":11158}," In the surface code, errors have a geometric signature: a chain of errors flips exactly the two checks at its endpoints. Syndrome violations therefore come in pairs, and finding the most likely error reduces to pairing up the flipped checks so that the total length of the connecting paths is minimised. That's a classic graph problem with a classic polynomial-time solution, Edmonds' blossom algorithm. MWPM has long been the accuracy benchmark for surface-code decoding: roughly a 0.94% threshold on weighted decoder graphs in commonly cited comparisons. Its problem is speed: polynomial time is not the same as fast enough, and the constant factors are unfriendly at microsecond deadlines.",{"type":21,"tag":22,"props":11160,"children":11161},{},[11162,11167],{"type":21,"tag":136,"props":11163,"children":11164},{},[11165],{"type":26,"value":11166},"Union-find.",{"type":26,"value":11168}," The pragmatic answer. Union-find grows clusters around syndrome violations until each cluster is explained by an internal error, using disjoint-set data structures that run in almost-linear time. It's a fast approximation of what matching does, and the accuracy cost is real but modest, with reported thresholds around 0.83% weighted versus MWPM's 0.94%. That trade has made it the workhorse for hardware implementations, particularly FPGA ones.",{"type":21,"tag":22,"props":11170,"children":11171},{},[11172,11177],{"type":21,"tag":136,"props":11173,"children":11174},{},[11175],{"type":26,"value":11176},"Belief propagation plus ordered statistics (BP-OSD).",{"type":26,"value":11178}," This is what you reach for when the matching trick stops working, which is exactly what happens with quantum LDPC codes.",{"type":21,"tag":29,"props":11180,"children":11182},{"id":11181},"why-qldpc-decoding-is-genuinely-harder",[11183],{"type":26,"value":11184},"Why qLDPC decoding is genuinely harder",{"type":21,"tag":22,"props":11186,"children":11187},{},[11188],{"type":26,"value":11189},"The surface code's decoding advantage comes from a property most codes don't share: each error chain flips precisely two checks, so the syndrome maps onto a matching problem. Take that away and you're back to general belief propagation over a Tanner graph: the same message-passing machinery used for classical LDPC codes in modern telecoms.",{"type":21,"tag":22,"props":11191,"children":11192},{},[11193],{"type":26,"value":11194},"Except it works worse in the quantum case, for two structural reasons.",{"type":21,"tag":22,"props":11196,"children":11197},{},[11198,11200,11205],{"type":26,"value":11199},"First, ",{"type":21,"tag":136,"props":11201,"children":11202},{},[11203],{"type":26,"value":11204},"short cycles",{"type":26,"value":11206},". Belief propagation assumes the graph is locally tree-like. The loops in quantum code Tanner graphs break that assumption and hurt convergence.",{"type":21,"tag":22,"props":11208,"children":11209},{},[11210,11212,11217,11219,11224],{"type":26,"value":11211},"Second, and more fundamentally, ",{"type":21,"tag":136,"props":11213,"children":11214},{},[11215],{"type":26,"value":11216},"degeneracy",{"type":26,"value":11218},". In a quantum code, genuinely different physical error patterns are sometimes ",{"type":21,"tag":362,"props":11220,"children":11221},{},[11222],{"type":26,"value":11223},"equivalent",{"type":26,"value":11225},": they differ by a stabilizer and therefore have identical syndromes and identical effects on the logical state. Classically, this doesn't happen. Each syndrome points toward one most likely error. Quantum mechanically, belief propagation gets stuck oscillating between equally valid candidates it has no basis to choose between. It's not that the decoder can't find the answer. It's that there are several answers and the algorithm's tie-breaking machinery wasn't designed for that.",{"type":21,"tag":22,"props":11227,"children":11228},{},[11229],{"type":26,"value":11230},"The standard fix is to bolt ordered statistics decoding onto the back: when BP fails to converge, OSD solves a linear system to pick a candidate. It works, and it costs you. Plain BP scales roughly linearly in code size. The OSD post-processing step is around O(N³). For a decoder on a microsecond budget, cubic scaling is precisely the wrong shape.",{"type":21,"tag":22,"props":11232,"children":11233},{},[11234],{"type":26,"value":11235},"So qLDPC codes present the field with an awkward bargain: better codes, worse decoders.",{"type":21,"tag":29,"props":11237,"children":11239},{"id":11238},"why-anyone-puts-up-with-it",[11240],{"type":26,"value":11241},"Why anyone puts up with it",{"type":21,"tag":22,"props":11243,"children":11244},{},[11245,11247,11252],{"type":26,"value":11246},"Because the encoding rate is dramatically better. Surface codes are extravagant: the ",{"type":21,"tag":46,"props":11248,"children":11249},{"href":1385},[11250],{"type":26,"value":11251},"logical qubit overhead",{"type":26,"value":11253}," runs to hundreds or thousands of physical qubits each, and the fault-tolerance estimates that produce headline figures of millions of physical qubits are mostly surface-code estimates. qLDPC codes, including the bivariate bicycle family, promise far more logical qubits per physical qubit. If that holds up, it moves the timeline for useful fault tolerance by a large margin. That is a prize worth accepting a harder decoding problem for.",{"type":21,"tag":22,"props":11255,"children":11256},{},[11257],{"type":26,"value":11258},"This is where vendors have entered the picture, and where the claims need careful handling.",{"type":21,"tag":22,"props":11260,"children":11261},{},[11262,11267,11269,11274,11276,11281,11283,11288],{"type":21,"tag":136,"props":11263,"children":11264},{},[11265],{"type":26,"value":11266},"IonQ reports",{"type":26,"value":11268}," having developed a \"Beam Search\" decoder intended to replace BP-OSD for quantum LDPC codes. On bivariate bicycle codes, ",{"type":21,"tag":136,"props":11270,"children":11271},{},[11272],{"type":26,"value":11273},"IonQ claims",{"type":26,"value":11275}," a 17x reduction in logical error rate relative to standard BP-OSD, along with a 26x reduction in worst-case (99.9th percentile) runtime, which ",{"type":21,"tag":136,"props":11277,"children":11278},{},[11279],{"type":26,"value":11280},"IonQ states",{"type":26,"value":11282}," it brought under one millisecond on a single core of a commercial CPU. ",{"type":21,"tag":136,"props":11284,"children":11285},{},[11286],{"type":26,"value":11287},"IonQ further estimates",{"type":26,"value":11289}," that three 32-core CPUs would suffice to decode 1,000 logical qubits in its trapped-ion architecture, contrasting that with roughly 1,000 FPGAs for surface-code approaches and 84 FPGAs for superconducting LDPC implementations.",{"type":21,"tag":22,"props":11291,"children":11292},{},[11293,11295,11300],{"type":26,"value":11294},"Those are vendor-reported figures, measured under vendor-chosen conditions, on vendor-selected codes and noise models, and IonQ is a hardware company with a commercial interest in the conclusion that its architecture needs less classical support than its competitors'. The direction of the work is credible and the problem is real. The specific multipliers should be treated as claims pending independent reproduction, in the same way we'd treat any ",{"type":21,"tag":46,"props":11296,"children":11297},{"href":674},[11298],{"type":26,"value":11299},"benchmark",{"type":26,"value":11301}," that hasn't been replicated by a disinterested party.",{"type":21,"tag":29,"props":11303,"children":11305},{"id":11304},"why-you-cant-simply-pick-the-fast-decoder",[11306],{"type":26,"value":11307},"Why you can't simply pick the fast decoder",{"type":21,"tag":22,"props":11309,"children":11310},{},[11311],{"type":26,"value":11312},"The obvious response to a latency problem is to accept a worse answer faster. In decoding, that instinct is sometimes fatal.",{"type":21,"tag":22,"props":11314,"children":11315},{},[11316,11318,11323,11325,11330,11332,11337,11339,11343],{"type":26,"value":11317},"A less accurate decoder produces a higher logical error rate for the same physical error rate. And the logical error rate is exactly the quantity the threshold theorem is about. ",{"type":21,"tag":46,"props":11319,"children":11320},{"href":3701},[11321],{"type":26,"value":11322},"Google's 2024 below-threshold result",{"type":26,"value":11324}," (the first experimental demonstration that increasing code distance suppresses logical errors rather than amplifying them, descending from ",{"type":21,"tag":46,"props":11326,"children":11327},{"href":9020},[11328],{"type":26,"value":11329},"Kitaev's topological codes",{"type":26,"value":11331}," and ultimately ",{"type":21,"tag":46,"props":11333,"children":11334},{"href":9007},[11335],{"type":26,"value":11336},"Shor's original 1995 code",{"type":26,"value":11338},") was a narrow win. Each distance increase roughly halved the error rate. A decoder that degrades logical ",{"type":21,"tag":46,"props":11340,"children":11341},{"href":8967},[11342],{"type":26,"value":8970},{"type":26,"value":11344}," enough eats that margin entirely and puts you back above threshold, at which point adding qubits makes things worse and the whole exercise inverts.",{"type":21,"tag":22,"props":11346,"children":11347},{},[11348],{"type":26,"value":11349},"So the decoder isn't a peripheral. It sits inside the threshold calculation. You cannot report a threshold crossing without saying which decoder produced it, and a below-threshold result obtained with an offline MWPM decoder is a weaker claim than the same result obtained in real time. Notably, Google's experiment did decode in real time, reporting average decoder latency around 63 µs at distance 5 while sustaining below-threshold performance across up to a million cycles, using an ensemble of neural-network and matching approaches rather than a single clean algorithm.",{"type":21,"tag":29,"props":11351,"children":11353},{"id":11352},"where-the-decoder-physically-lives",[11354],{"type":26,"value":11355},"Where the decoder physically lives",{"type":21,"tag":22,"props":11357,"children":11358},{},[11359,11361,11366],{"type":26,"value":11360},"The last constraint is a plumbing one. Syndrome bits have to travel from the ",{"type":21,"tag":46,"props":11362,"children":11364},{"href":11363},"\u002Fglossary\u002Fqpu",[11365],{"type":26,"value":8843},{"type":26,"value":11367}," to whatever computes on them, and the answer has to travel back, inside the error-correction cycle time.",{"type":21,"tag":22,"props":11369,"children":11370},{},[11371],{"type":26,"value":11372},"That budget covers readout, digitisation, transmission over the classical link, the decode itself, and the return trip. On superconducting hardware the qubits sit in a dilution refrigerator and the classical processor generally doesn't, so the link crosses a temperature boundary. Implementations split roughly three ways: software decoders on CPUs or GPUs (flexible and easy to iterate on, but carrying OS-level latency jitter), FPGA decoders (the current sweet spot for real-time surface-code work), and ASICs (fastest, but freezing your algorithm into silicon in a field where decoding algorithms are still actively improving).",{"type":21,"tag":22,"props":11374,"children":11375},{},[11376,11378,11383,11385,11390],{"type":26,"value":11377},"Slower gate speeds change the maths considerably. Trapped-ion systems operate on microsecond-to-millisecond gate timescales rather than nanoseconds, which relaxes the per-round decoding deadline by orders of magnitude. Part of why a sub-millisecond software decoder is a plausible proposition in that setting and not in a superconducting one. This is another place where ",{"type":21,"tag":46,"props":11379,"children":11380},{"href":212},[11381],{"type":26,"value":11382},"modality differences",{"type":26,"value":11384}," drive architecture rather than being incidental, and it's visible in the ",{"type":21,"tag":46,"props":11386,"children":11387},{"href":261},[11388],{"type":26,"value":11389},"hardware landscape",{"type":26,"value":11391}," if you know to look for it.",{"type":21,"tag":29,"props":11393,"children":11395},{"id":11394},"the-honest-state-of-things",[11396],{"type":26,"value":11397},"The honest state of things",{"type":21,"tag":22,"props":11399,"children":11400},{},[11401],{"type":26,"value":11402},"Real-time decoding is not solved. It is an active, competitive, genuinely open engineering problem, and it scales in an uncomfortable direction: more logical qubits means more syndrome streams, and the classical side has to grow with the quantum side.",{"type":21,"tag":22,"props":11404,"children":11405},{},[11406],{"type":26,"value":11407},"What makes it worth understanding is what it reveals about the shape of the machine. A fault-tolerant quantum computer is not a QPU with a control rack attached. It is a quantum processor and a substantial classical real-time computing system operating as one device, where the classical half's throughput is a hard constraint on whether the quantum half works at all. The decoder is not support equipment. It is part of the computer.",{"type":21,"tag":22,"props":11409,"children":11410},{},[11411,11413,11418],{"type":26,"value":11412},"That framing also explains why progress here is slower to make headlines than qubit counts. There is no satisfying number to announce. But if you're tracking whether fault tolerance is arriving, decoder latency and accuracy under real-time conditions are among the more informative things to watch, more so than most of what appears in ",{"type":21,"tag":46,"props":11414,"children":11415},{"href":10384},[11416],{"type":26,"value":11417},"quantum news",{"type":26,"value":761},{"type":21,"tag":22,"props":11420,"children":11421},{},[11422,11424,11428,11430,11434,11436,11440,11442,11447,11449,11455,11457,11463],{"type":26,"value":11423},"None of this is a reason to wait. The concepts underneath (noise, ",{"type":21,"tag":46,"props":11425,"children":11426},{"href":8883},[11427],{"type":26,"value":8886},{"type":26,"value":11429},", what a ",{"type":21,"tag":46,"props":11431,"children":11432},{"href":1194},[11433],{"type":26,"value":2776},{"type":26,"value":11435}," does under measurement) are the same ones you'd work with on a fault-tolerant machine, and you build that intuition now on ",{"type":21,"tag":46,"props":11437,"children":11438},{"href":408},[11439],{"type":26,"value":9244},{"type":26,"value":11441},". The ",{"type":21,"tag":46,"props":11443,"children":11444},{"href":10957},[11445],{"type":26,"value":11446},"research library",{"type":26,"value":11448}," has the primary sources, ",{"type":21,"tag":46,"props":11450,"children":11452},{"href":11451},"\u002Fglossary\u002Fsyndrome-decoding",[11453],{"type":26,"value":11454},"syndrome decoding",{"type":26,"value":11456}," has the compact definition, and if you want to see what problems this infrastructure is ultimately being built for, the ",{"type":21,"tag":46,"props":11458,"children":11460},{"href":11459},"\u002Fuse-cases",[11461],{"type":26,"value":11462},"use cases page",{"type":26,"value":11464}," is the place to start.",{"title":7,"searchDepth":106,"depth":106,"links":11466},[11467,11468,11469,11470,11471,11472,11473,11474],{"id":11016,"depth":106,"text":11019},{"id":11071,"depth":106,"text":11074},{"id":11140,"depth":106,"text":11143},{"id":11181,"depth":106,"text":11184},{"id":11238,"depth":106,"text":11241},{"id":11304,"depth":106,"text":11307},{"id":11352,"depth":106,"text":11355},{"id":11394,"depth":106,"text":11397},"content:blog:quantum-error-decoding-bottleneck.md","blog\u002Fquantum-error-decoding-bottleneck.md","blog\u002Fquantum-error-decoding-bottleneck",{"_path":11479,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":11480,"description":11481,"date":3032,"author":11,"tags":11482,"readingTime":3403,"body":11483,"_type":111,"_id":13730,"_source":113,"_file":13731,"_stem":13732,"_extension":116},"\u002Fblog\u002Fquantum-fourier-transform-tutorial","The Quantum Fourier Transform: Build It Yourself in Qiskit","A hands-on tutorial that builds the QFT gate by gate in Qiskit, verifies it against the library implementation, and explains why an exponentially faster Fourier transform gives you no speedup on its own.",[7102,1363,15],{"type":18,"children":11484,"toc":13719},[11485,11497,11502,11510,11516,11528,11533,11541,11569,11580,11586,11598,11603,11626,11638,11644,11649,11700,11717,11723,11734,11764,11769,12335,12340,12348,12353,12359,12372,12554,12558,12566,12586,12592,12603,12945,12949,12957,12969,12974,13148,13152,13160,13165,13171,13194,13204,13230,13235,13241,13253,13557,13562,13654,13665,13671,13710,13715],{"type":21,"tag":22,"props":11486,"children":11487},{},[11488,11489,11495],{"type":26,"value":11024},{"type":21,"tag":46,"props":11490,"children":11492},{"href":11491},"\u002Fglossary\u002Fqft",[11493],{"type":26,"value":11494},"Quantum Fourier Transform",{"type":26,"value":11496}," is the single most important subroutine in quantum computing. It's the engine inside Shor's factoring algorithm, quantum phase estimation, and order finding. It's also the most commonly misunderstood algorithm in the field, because on paper it looks like an exponentially faster FFT, and it absolutely is not.",{"type":21,"tag":22,"props":11498,"children":11499},{},[11500],{"type":26,"value":11501},"This tutorial builds the QFT from scratch in Qiskit, proves the implementation is correct against Qiskit's own, and then explains carefully where the speedup goes.",{"type":21,"tag":22,"props":11503,"children":11504},{},[11505],{"type":21,"tag":136,"props":11506,"children":11507},{},[11508],{"type":26,"value":11509},"All code in this post was executed against Qiskit 2.5.0 and Qiskit Aer 0.17.2 on Python 3.11. The outputs shown are real.",{"type":21,"tag":29,"props":11511,"children":11513},{"id":11512},"what-the-qft-does",[11514],{"type":26,"value":11515},"What the QFT does",{"type":21,"tag":22,"props":11517,"children":11518},{},[11519,11521,11526],{"type":26,"value":11520},"The classical Discrete Fourier Transform takes a vector of N numbers and returns N Fourier coefficients. The QFT does exactly the same linear map, but the input vector is the ",{"type":21,"tag":362,"props":11522,"children":11523},{},[11524],{"type":26,"value":11525},"amplitude vector",{"type":26,"value":11527}," of an n-qubit state, so N = 2ⁿ.",{"type":21,"tag":22,"props":11529,"children":11530},{},[11531],{"type":26,"value":11532},"On basis states it acts as:",{"type":21,"tag":2304,"props":11534,"children":11536},{"code":11535},"QFT |x⟩ = (1\u002F√N) Σ_{k=0}^{N-1} e^{2πi·xk\u002FN} |k⟩\n",[11537],{"type":21,"tag":2073,"props":11538,"children":11539},{"__ignoreMap":7},[11540],{"type":26,"value":11535},{"type":21,"tag":22,"props":11542,"children":11543},{},[11544,11546,11551,11553,11559,11561,11567],{"type":26,"value":11545},"Notice what's on the right: every basis state gets amplitude of the ",{"type":21,"tag":362,"props":11547,"children":11548},{},[11549],{"type":26,"value":11550},"same magnitude",{"type":26,"value":11552}," (1\u002F√N), and all the information about ",{"type":21,"tag":2073,"props":11554,"children":11556},{"className":11555},[],[11557],{"type":26,"value":11558},"x",{"type":26,"value":11560}," lives in the complex phase ",{"type":21,"tag":2073,"props":11562,"children":11564},{"className":11563},[],[11565],{"type":26,"value":11566},"e^{2πi·xk\u002FN}",{"type":26,"value":11568},". The QFT takes information that was sitting in the computational basis and pushes it into the phases.",{"type":21,"tag":22,"props":11570,"children":11571},{},[11572,11574,11578],{"type":26,"value":11573},"That single fact is the whole story of the QFT. It's a perfectly uniform state, as far as any ",{"type":21,"tag":46,"props":11575,"children":11576},{"href":7374},[11577],{"type":26,"value":11054},{"type":26,"value":11579}," in the computational basis is concerned. If you QFT a basis state and measure, you get a uniformly random n-bit string. Every time. You learn nothing.",{"type":21,"tag":29,"props":11581,"children":11583},{"id":11582},"the-readout-problem-stated-plainly",[11584],{"type":26,"value":11585},"The readout problem, stated plainly",{"type":21,"tag":22,"props":11587,"children":11588},{},[11589,11591,11596],{"type":26,"value":11590},"Here's the trap. The QFT on n qubits takes O(n²) gates. Classically, an FFT on the same 2ⁿ amplitudes takes O(n·2ⁿ) operations. That is a genuine exponential gap in ",{"type":21,"tag":362,"props":11592,"children":11593},{},[11594],{"type":26,"value":11595},"gate count",{"type":26,"value":11597},", and it's the number everybody quotes.",{"type":21,"tag":22,"props":11599,"children":11600},{},[11601],{"type":26,"value":11602},"But it isn't a usable speedup, for two reasons:",{"type":21,"tag":6961,"props":11604,"children":11605},{},[11606,11616],{"type":21,"tag":3084,"props":11607,"children":11608},{},[11609,11614],{"type":21,"tag":136,"props":11610,"children":11611},{},[11612],{"type":26,"value":11613},"You can't load the input.",{"type":26,"value":11615}," Getting 2ⁿ arbitrary classical amplitudes into a quantum register generally costs O(2ⁿ) gates, wiping out the advantage before you start.",{"type":21,"tag":3084,"props":11617,"children":11618},{},[11619,11624],{"type":21,"tag":136,"props":11620,"children":11621},{},[11622],{"type":26,"value":11623},"You can't read the output.",{"type":26,"value":11625}," The Fourier coefficients are amplitudes. You cannot look at amplitudes. You only sample from their squared magnitudes, one n-bit string per shot. Extracting all 2ⁿ coefficients would take exponentially many repetitions.",{"type":21,"tag":22,"props":11627,"children":11628},{},[11629,11631,11636],{"type":26,"value":11630},"So the QFT is never a drop-in replacement for the FFT. It is a ",{"type":21,"tag":362,"props":11632,"children":11633},{},[11634],{"type":26,"value":11635},"transform you apply in the middle of a larger circuit",{"type":26,"value":11637},", where the goal isn't to read the spectrum but to convert a periodicity that was hidden in phases into a peak you sample directly. That's the shape every real application takes.",{"type":21,"tag":29,"props":11639,"children":11641},{"id":11640},"the-circuit-hadamard-rotate-recurse-swap",[11642],{"type":26,"value":11643},"The circuit: Hadamard, rotate, recurse, swap",{"type":21,"tag":22,"props":11645,"children":11646},{},[11647],{"type":26,"value":11648},"The construction follows directly from factoring the exponential above into a product over qubits. For the most significant qubit:",{"type":21,"tag":6961,"props":11650,"children":11651},{},[11652,11669,11690,11695],{"type":21,"tag":3084,"props":11653,"children":11654},{},[11655,11656,11661,11663,11667],{"type":26,"value":7206},{"type":21,"tag":46,"props":11657,"children":11658},{"href":7209},[11659],{"type":26,"value":11660},"Hadamard",{"type":26,"value":11662},". This creates a ",{"type":21,"tag":46,"props":11664,"children":11665},{"href":8807},[11666],{"type":26,"value":8810},{"type":26,"value":11668}," whose relative phase encodes one bit of the input.",{"type":21,"tag":3084,"props":11670,"children":11671},{},[11672,11674,11680,11682,11688],{"type":26,"value":11673},"Apply controlled-phase gates ",{"type":21,"tag":2073,"props":11675,"children":11677},{"className":11676},[],[11678],{"type":26,"value":11679},"CP(π\u002F2^k)",{"type":26,"value":11681}," from each less significant qubit, controlled onto that same qubit. Qubit distance ",{"type":21,"tag":2073,"props":11683,"children":11685},{"className":11684},[],[11686],{"type":26,"value":11687},"k",{"type":26,"value":11689}," contributes a rotation of π\u002F2^k: the further away, the smaller the correction.",{"type":21,"tag":3084,"props":11691,"children":11692},{},[11693],{"type":26,"value":11694},"Recurse on the remaining n−1 qubits.",{"type":21,"tag":3084,"props":11696,"children":11697},{},[11698],{"type":26,"value":11699},"Swap the qubit order at the end.",{"type":21,"tag":22,"props":11701,"children":11702},{},[11703,11708,11710,11715],{"type":21,"tag":136,"props":11704,"children":11705},{},[11706],{"type":26,"value":11707},"Why the swaps?",{"type":26,"value":11709}," The recursion naturally produces the output register in reverse bit order. Qubit 0 ends up holding what should be the most significant output bit, and vice versa. This is a real bug, not a bookkeeping convention. If you feed an unswapped QFT into phase estimation you get a bit-reversed answer. The swaps fix it. (In hardware-aware compilation you sometimes ",{"type":21,"tag":362,"props":11711,"children":11712},{},[11713],{"type":26,"value":11714},"do",{"type":26,"value":11716}," drop the swaps and relabel the wires downstream instead, which is free. But if your QFT is a standalone reusable block, keep them.)",{"type":21,"tag":29,"props":11718,"children":11720},{"id":11719},"building-it-in-qiskit",[11721],{"type":26,"value":11722},"Building it in Qiskit",{"type":21,"tag":22,"props":11724,"children":11725},{},[11726,11728,11732],{"type":26,"value":11727},"Make sure you have ",{"type":21,"tag":46,"props":11729,"children":11730},{"href":7045},[11731],{"type":26,"value":1363},{"type":26,"value":11733}," and the Aer simulator installed:",{"type":21,"tag":2304,"props":11735,"children":11737},{"code":11736,"language":9699,"meta":7,"className":9697,"style":7},"pip install qiskit qiskit-aer\n",[11738],{"type":21,"tag":2073,"props":11739,"children":11740},{"__ignoreMap":7},[11741],{"type":21,"tag":2314,"props":11742,"children":11743},{"class":2316,"line":2317},[11744,11749,11754,11759],{"type":21,"tag":2314,"props":11745,"children":11746},{"style":4318},[11747],{"type":26,"value":11748},"pip",{"type":21,"tag":2314,"props":11750,"children":11751},{"style":2350},[11752],{"type":26,"value":11753}," install",{"type":21,"tag":2314,"props":11755,"children":11756},{"style":2350},[11757],{"type":26,"value":11758}," qiskit",{"type":21,"tag":2314,"props":11760,"children":11761},{"style":2350},[11762],{"type":26,"value":11763}," qiskit-aer\n",{"type":21,"tag":22,"props":11765,"children":11766},{},[11767],{"type":26,"value":11768},"Now the construction, written recursively so it mirrors the math:",{"type":21,"tag":2304,"props":11770,"children":11772},{"code":11771,"language":3147,"meta":7,"className":3145,"style":7},"import numpy as np\nfrom qiskit import QuantumCircuit, transpile\nfrom qiskit.quantum_info import Statevector, Operator\nfrom qiskit_aer import AerSimulator\n\n\ndef qft_rotations(circuit, n):\n    \"\"\"Hadamard + controlled phases on the top qubit, then recurse.\"\"\"\n    if n == 0:\n        return circuit\n    n -= 1                      # index of the most significant qubit\n    circuit.h(n)\n    for qubit in range(n):\n        # qubit is (n - qubit) positions below the target\n        circuit.cp(np.pi \u002F 2 ** (n - qubit), qubit, n)\n    qft_rotations(circuit, n)   # recurse on the rest\n    return circuit\n\n\ndef swap_registers(circuit, n):\n    \"\"\"Reverse the qubit order to undo the bit reversal.\"\"\"\n    for qubit in range(n \u002F\u002F 2):\n        circuit.swap(qubit, n - qubit - 1)\n    return circuit\n\n\ndef qft(n):\n    qc = QuantumCircuit(n, name=\"QFT\")\n    qft_rotations(qc, n)\n    swap_registers(qc, n)\n    return qc\n\n\nmy_qft = qft(4)\nprint(my_qft.draw(output=\"text\"))\nprint(my_qft.count_ops())\n",[11773],{"type":21,"tag":2073,"props":11774,"children":11775},{"__ignoreMap":7},[11776,11795,11814,11835,11854,11861,11868,11885,11893,11919,11932,11954,11962,11986,11994,12028,12041,12052,12059,12066,12082,12090,12125,12153,12164,12171,12178,12194,12226,12234,12242,12253,12260,12267,12292,12323],{"type":21,"tag":2314,"props":11777,"children":11778},{"class":2316,"line":2317},[11779,11783,11787,11791],{"type":21,"tag":2314,"props":11780,"children":11781},{"style":3157},[11782],{"type":26,"value":3170},{"type":21,"tag":2314,"props":11784,"children":11785},{"style":2321},[11786],{"type":26,"value":4227},{"type":21,"tag":2314,"props":11788,"children":11789},{"style":3157},[11790],{"type":26,"value":4232},{"type":21,"tag":2314,"props":11792,"children":11793},{"style":2321},[11794],{"type":26,"value":4237},{"type":21,"tag":2314,"props":11796,"children":11797},{"class":2316,"line":106},[11798,11802,11806,11810],{"type":21,"tag":2314,"props":11799,"children":11800},{"style":3157},[11801],{"type":26,"value":3160},{"type":21,"tag":2314,"props":11803,"children":11804},{"style":2321},[11805],{"type":26,"value":4249},{"type":21,"tag":2314,"props":11807,"children":11808},{"style":3157},[11809],{"type":26,"value":3170},{"type":21,"tag":2314,"props":11811,"children":11812},{"style":2321},[11813],{"type":26,"value":4258},{"type":21,"tag":2314,"props":11815,"children":11816},{"class":2316,"line":2335},[11817,11821,11826,11830],{"type":21,"tag":2314,"props":11818,"children":11819},{"style":3157},[11820],{"type":26,"value":3160},{"type":21,"tag":2314,"props":11822,"children":11823},{"style":2321},[11824],{"type":26,"value":11825}," qiskit.quantum_info ",{"type":21,"tag":2314,"props":11827,"children":11828},{"style":3157},[11829],{"type":26,"value":3170},{"type":21,"tag":2314,"props":11831,"children":11832},{"style":2321},[11833],{"type":26,"value":11834}," Statevector, Operator\n",{"type":21,"tag":2314,"props":11836,"children":11837},{"class":2316,"line":2397},[11838,11842,11846,11850],{"type":21,"tag":2314,"props":11839,"children":11840},{"style":3157},[11841],{"type":26,"value":3160},{"type":21,"tag":2314,"props":11843,"children":11844},{"style":2321},[11845],{"type":26,"value":4270},{"type":21,"tag":2314,"props":11847,"children":11848},{"style":3157},[11849],{"type":26,"value":3170},{"type":21,"tag":2314,"props":11851,"children":11852},{"style":2321},[11853],{"type":26,"value":4279},{"type":21,"tag":2314,"props":11855,"children":11856},{"class":2316,"line":2421},[11857],{"type":21,"tag":2314,"props":11858,"children":11859},{"emptyLinePlaceholder":3181},[11860],{"type":26,"value":3184},{"type":21,"tag":2314,"props":11862,"children":11863},{"class":2316,"line":16},[11864],{"type":21,"tag":2314,"props":11865,"children":11866},{"emptyLinePlaceholder":3181},[11867],{"type":26,"value":3184},{"type":21,"tag":2314,"props":11869,"children":11870},{"class":2316,"line":127},[11871,11875,11880],{"type":21,"tag":2314,"props":11872,"children":11873},{"style":3157},[11874],{"type":26,"value":4315},{"type":21,"tag":2314,"props":11876,"children":11877},{"style":4318},[11878],{"type":26,"value":11879}," qft_rotations",{"type":21,"tag":2314,"props":11881,"children":11882},{"style":2321},[11883],{"type":26,"value":11884},"(circuit, n):\n",{"type":21,"tag":2314,"props":11886,"children":11887},{"class":2316,"line":887},[11888],{"type":21,"tag":2314,"props":11889,"children":11890},{"style":2350},[11891],{"type":26,"value":11892},"    \"\"\"Hadamard + controlled phases on the top qubit, then recurse.\"\"\"\n",{"type":21,"tag":2314,"props":11894,"children":11895},{"class":2316,"line":1364},[11896,11901,11906,11910,11915],{"type":21,"tag":2314,"props":11897,"children":11898},{"style":3157},[11899],{"type":26,"value":11900},"    if",{"type":21,"tag":2314,"props":11902,"children":11903},{"style":2321},[11904],{"type":26,"value":11905}," n ",{"type":21,"tag":2314,"props":11907,"children":11908},{"style":3157},[11909],{"type":26,"value":4863},{"type":21,"tag":2314,"props":11911,"children":11912},{"style":2339},[11913],{"type":26,"value":11914}," 0",{"type":21,"tag":2314,"props":11916,"children":11917},{"style":2321},[11918],{"type":26,"value":4873},{"type":21,"tag":2314,"props":11920,"children":11921},{"class":2316,"line":3403},[11922,11927],{"type":21,"tag":2314,"props":11923,"children":11924},{"style":3157},[11925],{"type":26,"value":11926},"        return",{"type":21,"tag":2314,"props":11928,"children":11929},{"style":2321},[11930],{"type":26,"value":11931}," circuit\n",{"type":21,"tag":2314,"props":11933,"children":11934},{"class":2316,"line":3413},[11935,11940,11945,11949],{"type":21,"tag":2314,"props":11936,"children":11937},{"style":2321},[11938],{"type":26,"value":11939},"    n ",{"type":21,"tag":2314,"props":11941,"children":11942},{"style":3157},[11943],{"type":26,"value":11944},"-=",{"type":21,"tag":2314,"props":11946,"children":11947},{"style":2339},[11948],{"type":26,"value":6053},{"type":21,"tag":2314,"props":11950,"children":11951},{"style":3407},[11952],{"type":26,"value":11953},"                      # index of the most significant qubit\n",{"type":21,"tag":2314,"props":11955,"children":11956},{"class":2316,"line":436},[11957],{"type":21,"tag":2314,"props":11958,"children":11959},{"style":2321},[11960],{"type":26,"value":11961},"    circuit.h(n)\n",{"type":21,"tag":2314,"props":11963,"children":11964},{"class":2316,"line":3473},[11965,11969,11974,11978,11982],{"type":21,"tag":2314,"props":11966,"children":11967},{"style":3157},[11968],{"type":26,"value":4694},{"type":21,"tag":2314,"props":11970,"children":11971},{"style":2321},[11972],{"type":26,"value":11973}," qubit ",{"type":21,"tag":2314,"props":11975,"children":11976},{"style":3157},[11977],{"type":26,"value":3460},{"type":21,"tag":2314,"props":11979,"children":11980},{"style":2339},[11981],{"type":26,"value":3465},{"type":21,"tag":2314,"props":11983,"children":11984},{"style":2321},[11985],{"type":26,"value":7795},{"type":21,"tag":2314,"props":11987,"children":11988},{"class":2316,"line":3521},[11989],{"type":21,"tag":2314,"props":11990,"children":11991},{"style":3407},[11992],{"type":26,"value":11993},"        # qubit is (n - qubit) positions below the target\n",{"type":21,"tag":2314,"props":11995,"children":11996},{"class":2316,"line":3563},[11997,12002,12006,12010,12014,12019,12023],{"type":21,"tag":2314,"props":11998,"children":11999},{"style":2321},[12000],{"type":26,"value":12001},"        circuit.cp(np.pi ",{"type":21,"tag":2314,"props":12003,"children":12004},{"style":3157},[12005],{"type":26,"value":2168},{"type":21,"tag":2314,"props":12007,"children":12008},{"style":2339},[12009],{"type":26,"value":6338},{"type":21,"tag":2314,"props":12011,"children":12012},{"style":3157},[12013],{"type":26,"value":8263},{"type":21,"tag":2314,"props":12015,"children":12016},{"style":2321},[12017],{"type":26,"value":12018}," (n ",{"type":21,"tag":2314,"props":12020,"children":12021},{"style":3157},[12022],{"type":26,"value":4802},{"type":21,"tag":2314,"props":12024,"children":12025},{"style":2321},[12026],{"type":26,"value":12027}," qubit), qubit, n)\n",{"type":21,"tag":2314,"props":12029,"children":12030},{"class":2316,"line":4585},[12031,12036],{"type":21,"tag":2314,"props":12032,"children":12033},{"style":2321},[12034],{"type":26,"value":12035},"    qft_rotations(circuit, n)   ",{"type":21,"tag":2314,"props":12037,"children":12038},{"style":3407},[12039],{"type":26,"value":12040},"# recurse on the rest\n",{"type":21,"tag":2314,"props":12042,"children":12043},{"class":2316,"line":4604},[12044,12048],{"type":21,"tag":2314,"props":12045,"children":12046},{"style":3157},[12047],{"type":26,"value":4540},{"type":21,"tag":2314,"props":12049,"children":12050},{"style":2321},[12051],{"type":26,"value":11931},{"type":21,"tag":2314,"props":12053,"children":12054},{"class":2316,"line":4612},[12055],{"type":21,"tag":2314,"props":12056,"children":12057},{"emptyLinePlaceholder":3181},[12058],{"type":26,"value":3184},{"type":21,"tag":2314,"props":12060,"children":12061},{"class":2316,"line":4643},[12062],{"type":21,"tag":2314,"props":12063,"children":12064},{"emptyLinePlaceholder":3181},[12065],{"type":26,"value":3184},{"type":21,"tag":2314,"props":12067,"children":12068},{"class":2316,"line":4688},[12069,12073,12078],{"type":21,"tag":2314,"props":12070,"children":12071},{"style":3157},[12072],{"type":26,"value":4315},{"type":21,"tag":2314,"props":12074,"children":12075},{"style":4318},[12076],{"type":26,"value":12077}," swap_registers",{"type":21,"tag":2314,"props":12079,"children":12080},{"style":2321},[12081],{"type":26,"value":11884},{"type":21,"tag":2314,"props":12083,"children":12084},{"class":2316,"line":4727},[12085],{"type":21,"tag":2314,"props":12086,"children":12087},{"style":2350},[12088],{"type":26,"value":12089},"    \"\"\"Reverse the qubit order to undo the bit reversal.\"\"\"\n",{"type":21,"tag":2314,"props":12091,"children":12092},{"class":2316,"line":4745},[12093,12097,12101,12105,12109,12113,12117,12121],{"type":21,"tag":2314,"props":12094,"children":12095},{"style":3157},[12096],{"type":26,"value":4694},{"type":21,"tag":2314,"props":12098,"children":12099},{"style":2321},[12100],{"type":26,"value":11973},{"type":21,"tag":2314,"props":12102,"children":12103},{"style":3157},[12104],{"type":26,"value":3460},{"type":21,"tag":2314,"props":12106,"children":12107},{"style":2339},[12108],{"type":26,"value":3465},{"type":21,"tag":2314,"props":12110,"children":12111},{"style":2321},[12112],{"type":26,"value":7623},{"type":21,"tag":2314,"props":12114,"children":12115},{"style":3157},[12116],{"type":26,"value":6062},{"type":21,"tag":2314,"props":12118,"children":12119},{"style":2339},[12120],{"type":26,"value":6338},{"type":21,"tag":2314,"props":12122,"children":12123},{"style":2321},[12124],{"type":26,"value":4368},{"type":21,"tag":2314,"props":12126,"children":12127},{"class":2316,"line":4819},[12128,12133,12137,12141,12145,12149],{"type":21,"tag":2314,"props":12129,"children":12130},{"style":2321},[12131],{"type":26,"value":12132},"        circuit.swap(qubit, n ",{"type":21,"tag":2314,"props":12134,"children":12135},{"style":3157},[12136],{"type":26,"value":4802},{"type":21,"tag":2314,"props":12138,"children":12139},{"style":2321},[12140],{"type":26,"value":11973},{"type":21,"tag":2314,"props":12142,"children":12143},{"style":3157},[12144],{"type":26,"value":4802},{"type":21,"tag":2314,"props":12146,"children":12147},{"style":2339},[12148],{"type":26,"value":6053},{"type":21,"tag":2314,"props":12150,"children":12151},{"style":2321},[12152],{"type":26,"value":3257},{"type":21,"tag":2314,"props":12154,"children":12155},{"class":2316,"line":4847},[12156,12160],{"type":21,"tag":2314,"props":12157,"children":12158},{"style":3157},[12159],{"type":26,"value":4540},{"type":21,"tag":2314,"props":12161,"children":12162},{"style":2321},[12163],{"type":26,"value":11931},{"type":21,"tag":2314,"props":12165,"children":12166},{"class":2316,"line":4876},[12167],{"type":21,"tag":2314,"props":12168,"children":12169},{"emptyLinePlaceholder":3181},[12170],{"type":26,"value":3184},{"type":21,"tag":2314,"props":12172,"children":12173},{"class":2316,"line":4885},[12174],{"type":21,"tag":2314,"props":12175,"children":12176},{"emptyLinePlaceholder":3181},[12177],{"type":26,"value":3184},{"type":21,"tag":2314,"props":12179,"children":12180},{"class":2316,"line":4913},[12181,12185,12190],{"type":21,"tag":2314,"props":12182,"children":12183},{"style":3157},[12184],{"type":26,"value":4315},{"type":21,"tag":2314,"props":12186,"children":12187},{"style":4318},[12188],{"type":26,"value":12189}," qft",{"type":21,"tag":2314,"props":12191,"children":12192},{"style":2321},[12193],{"type":26,"value":7795},{"type":21,"tag":2314,"props":12195,"children":12196},{"class":2316,"line":4944},[12197,12201,12205,12209,12213,12217,12222],{"type":21,"tag":2314,"props":12198,"children":12199},{"style":2321},[12200],{"type":26,"value":7451},{"type":21,"tag":2314,"props":12202,"children":12203},{"style":3157},[12204],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12206,"children":12207},{"style":2321},[12208],{"type":26,"value":7460},{"type":21,"tag":2314,"props":12210,"children":12211},{"style":3222},[12212],{"type":26,"value":7465},{"type":21,"tag":2314,"props":12214,"children":12215},{"style":3157},[12216],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12218,"children":12219},{"style":2350},[12220],{"type":26,"value":12221},"\"QFT\"",{"type":21,"tag":2314,"props":12223,"children":12224},{"style":2321},[12225],{"type":26,"value":3257},{"type":21,"tag":2314,"props":12227,"children":12228},{"class":2316,"line":4966},[12229],{"type":21,"tag":2314,"props":12230,"children":12231},{"style":2321},[12232],{"type":26,"value":12233},"    qft_rotations(qc, n)\n",{"type":21,"tag":2314,"props":12235,"children":12236},{"class":2316,"line":5012},[12237],{"type":21,"tag":2314,"props":12238,"children":12239},{"style":2321},[12240],{"type":26,"value":12241},"    swap_registers(qc, n)\n",{"type":21,"tag":2314,"props":12243,"children":12244},{"class":2316,"line":5025},[12245,12249],{"type":21,"tag":2314,"props":12246,"children":12247},{"style":3157},[12248],{"type":26,"value":4540},{"type":21,"tag":2314,"props":12250,"children":12251},{"style":2321},[12252],{"type":26,"value":7732},{"type":21,"tag":2314,"props":12254,"children":12255},{"class":2316,"line":5033},[12256],{"type":21,"tag":2314,"props":12257,"children":12258},{"emptyLinePlaceholder":3181},[12259],{"type":26,"value":3184},{"type":21,"tag":2314,"props":12261,"children":12262},{"class":2316,"line":5051},[12263],{"type":21,"tag":2314,"props":12264,"children":12265},{"emptyLinePlaceholder":3181},[12266],{"type":26,"value":3184},{"type":21,"tag":2314,"props":12268,"children":12269},{"class":2316,"line":5069},[12270,12275,12279,12284,12288],{"type":21,"tag":2314,"props":12271,"children":12272},{"style":2321},[12273],{"type":26,"value":12274},"my_qft ",{"type":21,"tag":2314,"props":12276,"children":12277},{"style":3157},[12278],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12280,"children":12281},{"style":2321},[12282],{"type":26,"value":12283}," qft(",{"type":21,"tag":2314,"props":12285,"children":12286},{"style":2339},[12287],{"type":26,"value":5486},{"type":21,"tag":2314,"props":12289,"children":12290},{"style":2321},[12291],{"type":26,"value":3257},{"type":21,"tag":2314,"props":12293,"children":12294},{"class":2316,"line":5077},[12295,12299,12304,12309,12313,12318],{"type":21,"tag":2314,"props":12296,"children":12297},{"style":2339},[12298],{"type":26,"value":3272},{"type":21,"tag":2314,"props":12300,"children":12301},{"style":2321},[12302],{"type":26,"value":12303},"(my_qft.draw(",{"type":21,"tag":2314,"props":12305,"children":12306},{"style":3222},[12307],{"type":26,"value":12308},"output",{"type":21,"tag":2314,"props":12310,"children":12311},{"style":3157},[12312],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12314,"children":12315},{"style":2350},[12316],{"type":26,"value":12317},"\"text\"",{"type":21,"tag":2314,"props":12319,"children":12320},{"style":2321},[12321],{"type":26,"value":12322},"))\n",{"type":21,"tag":2314,"props":12324,"children":12325},{"class":2316,"line":5111},[12326,12330],{"type":21,"tag":2314,"props":12327,"children":12328},{"style":2339},[12329],{"type":26,"value":3272},{"type":21,"tag":2314,"props":12331,"children":12332},{"style":2321},[12333],{"type":26,"value":12334},"(my_qft.count_ops())\n",{"type":21,"tag":22,"props":12336,"children":12337},{},[12338],{"type":26,"value":12339},"Real output:",{"type":21,"tag":2304,"props":12341,"children":12343},{"code":12342},"                                                                          ┌───┐»\nq_0: ──────■───────────────────────────────■──────────────────────■───────┤ H ├»\n           │                               │                ┌───┐ │P(π\u002F2) └───┘»\nq_1: ──────┼────────■──────────────────────┼────────■───────┤ H ├─■─────────X──»\n           │        │                ┌───┐ │P(π\u002F4)  │P(π\u002F2) └───┘           │  »\nq_2: ──────┼────────┼────────■───────┤ H ├─■────────■───────────────────────X──»\n     ┌───┐ │P(π\u002F8)  │P(π\u002F4)  │P(π\u002F2) └───┘                                     »\nq_3: ┤ H ├─■────────■────────■─────────────────────────────────────────────────»\n     └───┘\n\nOrderedDict([('cp', 6), ('h', 4), ('swap', 2)])\n",[12344],{"type":21,"tag":2073,"props":12345,"children":12346},{"__ignoreMap":7},[12347],{"type":26,"value":12342},{"type":21,"tag":22,"props":12349,"children":12350},{},[12351],{"type":26,"value":12352},"Four Hadamards, six controlled-phase gates, two swaps. That matches the count: n Hadamards and n(n−1)\u002F2 = 6 rotations. The angles descend π\u002F2, π\u002F4, π\u002F8 as the control qubit gets further from the target, exactly as expected.",{"type":21,"tag":29,"props":12354,"children":12356},{"id":12355},"proving-its-correct",[12357],{"type":26,"value":12358},"Proving it's correct",{"type":21,"tag":22,"props":12360,"children":12361},{},[12362,12364,12370],{"type":26,"value":12363},"Never trust a hand-built QFT. Compare the full unitary against Qiskit's ",{"type":21,"tag":2073,"props":12365,"children":12367},{"className":12366},[],[12368],{"type":26,"value":12369},"QFTGate",{"type":26,"value":12371},":",{"type":21,"tag":2304,"props":12373,"children":12375},{"code":12374,"language":3147,"meta":7,"className":3145,"style":7},"from qiskit.circuit.library import QFTGate\n\nn = 4\nmine = qft(n)\n\nreference = QuantumCircuit(n)\nreference.append(QFTGate(n), range(n))\n\na, b = Operator(mine), Operator(reference)\nprint(\"Equivalent:\", a.equiv(b))\nprint(\"Max element difference:\", np.abs(a.data - b.data).max())\n",[12376],{"type":21,"tag":2073,"props":12377,"children":12378},{"__ignoreMap":7},[12379,12399,12406,12422,12439,12446,12463,12479,12486,12503,12524],{"type":21,"tag":2314,"props":12380,"children":12381},{"class":2316,"line":2317},[12382,12386,12390,12394],{"type":21,"tag":2314,"props":12383,"children":12384},{"style":3157},[12385],{"type":26,"value":3160},{"type":21,"tag":2314,"props":12387,"children":12388},{"style":2321},[12389],{"type":26,"value":5775},{"type":21,"tag":2314,"props":12391,"children":12392},{"style":3157},[12393],{"type":26,"value":3170},{"type":21,"tag":2314,"props":12395,"children":12396},{"style":2321},[12397],{"type":26,"value":12398}," QFTGate\n",{"type":21,"tag":2314,"props":12400,"children":12401},{"class":2316,"line":106},[12402],{"type":21,"tag":2314,"props":12403,"children":12404},{"emptyLinePlaceholder":3181},[12405],{"type":26,"value":3184},{"type":21,"tag":2314,"props":12407,"children":12408},{"class":2316,"line":2335},[12409,12413,12417],{"type":21,"tag":2314,"props":12410,"children":12411},{"style":2321},[12412],{"type":26,"value":5039},{"type":21,"tag":2314,"props":12414,"children":12415},{"style":3157},[12416],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12418,"children":12419},{"style":2339},[12420],{"type":26,"value":12421}," 4\n",{"type":21,"tag":2314,"props":12423,"children":12424},{"class":2316,"line":2397},[12425,12430,12434],{"type":21,"tag":2314,"props":12426,"children":12427},{"style":2321},[12428],{"type":26,"value":12429},"mine ",{"type":21,"tag":2314,"props":12431,"children":12432},{"style":3157},[12433],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12435,"children":12436},{"style":2321},[12437],{"type":26,"value":12438}," qft(n)\n",{"type":21,"tag":2314,"props":12440,"children":12441},{"class":2316,"line":2421},[12442],{"type":21,"tag":2314,"props":12443,"children":12444},{"emptyLinePlaceholder":3181},[12445],{"type":26,"value":3184},{"type":21,"tag":2314,"props":12447,"children":12448},{"class":2316,"line":16},[12449,12454,12458],{"type":21,"tag":2314,"props":12450,"children":12451},{"style":2321},[12452],{"type":26,"value":12453},"reference ",{"type":21,"tag":2314,"props":12455,"children":12456},{"style":3157},[12457],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12459,"children":12460},{"style":2321},[12461],{"type":26,"value":12462}," QuantumCircuit(n)\n",{"type":21,"tag":2314,"props":12464,"children":12465},{"class":2316,"line":127},[12466,12471,12475],{"type":21,"tag":2314,"props":12467,"children":12468},{"style":2321},[12469],{"type":26,"value":12470},"reference.append(QFTGate(n), ",{"type":21,"tag":2314,"props":12472,"children":12473},{"style":2339},[12474],{"type":26,"value":4896},{"type":21,"tag":2314,"props":12476,"children":12477},{"style":2321},[12478],{"type":26,"value":4910},{"type":21,"tag":2314,"props":12480,"children":12481},{"class":2316,"line":887},[12482],{"type":21,"tag":2314,"props":12483,"children":12484},{"emptyLinePlaceholder":3181},[12485],{"type":26,"value":3184},{"type":21,"tag":2314,"props":12487,"children":12488},{"class":2316,"line":1364},[12489,12494,12498],{"type":21,"tag":2314,"props":12490,"children":12491},{"style":2321},[12492],{"type":26,"value":12493},"a, b ",{"type":21,"tag":2314,"props":12495,"children":12496},{"style":3157},[12497],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12499,"children":12500},{"style":2321},[12501],{"type":26,"value":12502}," Operator(mine), Operator(reference)\n",{"type":21,"tag":2314,"props":12504,"children":12505},{"class":2316,"line":3403},[12506,12510,12514,12519],{"type":21,"tag":2314,"props":12507,"children":12508},{"style":2339},[12509],{"type":26,"value":3272},{"type":21,"tag":2314,"props":12511,"children":12512},{"style":2321},[12513],{"type":26,"value":3277},{"type":21,"tag":2314,"props":12515,"children":12516},{"style":2350},[12517],{"type":26,"value":12518},"\"Equivalent:\"",{"type":21,"tag":2314,"props":12520,"children":12521},{"style":2321},[12522],{"type":26,"value":12523},", a.equiv(b))\n",{"type":21,"tag":2314,"props":12525,"children":12526},{"class":2316,"line":3413},[12527,12531,12535,12540,12545,12549],{"type":21,"tag":2314,"props":12528,"children":12529},{"style":2339},[12530],{"type":26,"value":3272},{"type":21,"tag":2314,"props":12532,"children":12533},{"style":2321},[12534],{"type":26,"value":3277},{"type":21,"tag":2314,"props":12536,"children":12537},{"style":2350},[12538],{"type":26,"value":12539},"\"Max element difference:\"",{"type":21,"tag":2314,"props":12541,"children":12542},{"style":2321},[12543],{"type":26,"value":12544},", np.abs(a.data ",{"type":21,"tag":2314,"props":12546,"children":12547},{"style":3157},[12548],{"type":26,"value":4802},{"type":21,"tag":2314,"props":12550,"children":12551},{"style":2321},[12552],{"type":26,"value":12553}," b.data).max())\n",{"type":21,"tag":22,"props":12555,"children":12556},{},[12557],{"type":26,"value":12339},{"type":21,"tag":2304,"props":12559,"children":12561},{"code":12560},"Equivalent: True\nMax element difference: 2.285583597498884e-15\n",[12562],{"type":21,"tag":2073,"props":12563,"children":12564},{"__ignoreMap":7},[12565],{"type":26,"value":12560},{"type":21,"tag":22,"props":12567,"children":12568},{},[12569,12571,12577,12578,12584],{"type":26,"value":12570},"Identical to floating-point precision, not merely equal up to a global phase. If you're on an older Qiskit, use ",{"type":21,"tag":2073,"props":12572,"children":12574},{"className":12573},[],[12575],{"type":26,"value":12576},"from qiskit.circuit.library import QFT",{"type":26,"value":904},{"type":21,"tag":2073,"props":12579,"children":12581},{"className":12580},[],[12582],{"type":26,"value":12583},"QFT(n).decompose()",{"type":26,"value":12585}," instead.",{"type":21,"tag":29,"props":12587,"children":12589},{"id":12588},"seeing-it-find-a-period",[12590],{"type":26,"value":12591},"Seeing it find a period",{"type":21,"tag":22,"props":12593,"children":12594},{},[12595,12597,12601],{"type":26,"value":12596},"This is the one demonstration that shows what the QFT is ",{"type":21,"tag":362,"props":12598,"children":12599},{},[12600],{"type":26,"value":3450},{"type":26,"value":12602},". Prepare a state that's a uniform superposition over multiples of 4 (a comb with period 4) and transform it:",{"type":21,"tag":2304,"props":12604,"children":12606},{"code":12605,"language":3147,"meta":7,"className":3145,"style":7},"n = 4\npsi = np.zeros(2 ** n, dtype=complex)\nfor x in range(0, 2 ** n, 4):   # |0> + |4> + |8> + |12>\n    psi[x] = 1\npsi \u002F= np.linalg.norm(psi)\n\nout = Statevector(psi).evolve(qft(n))\nfor i, p in enumerate(out.probabilities()):\n    if p > 1e-6:\n        print(f\"|{i:0{n}b}> = {i:2d}   p = {p:.4f}\")\n",[12607],{"type":21,"tag":2073,"props":12608,"children":12609},{"__ignoreMap":7},[12610,12625,12673,12731,12748,12764,12771,12788,12813,12839],{"type":21,"tag":2314,"props":12611,"children":12612},{"class":2316,"line":2317},[12613,12617,12621],{"type":21,"tag":2314,"props":12614,"children":12615},{"style":2321},[12616],{"type":26,"value":5039},{"type":21,"tag":2314,"props":12618,"children":12619},{"style":3157},[12620],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12622,"children":12623},{"style":2339},[12624],{"type":26,"value":12421},{"type":21,"tag":2314,"props":12626,"children":12627},{"class":2316,"line":106},[12628,12633,12637,12642,12646,12650,12655,12660,12664,12669],{"type":21,"tag":2314,"props":12629,"children":12630},{"style":2321},[12631],{"type":26,"value":12632},"psi ",{"type":21,"tag":2314,"props":12634,"children":12635},{"style":3157},[12636],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12638,"children":12639},{"style":2321},[12640],{"type":26,"value":12641}," np.zeros(",{"type":21,"tag":2314,"props":12643,"children":12644},{"style":2339},[12645],{"type":26,"value":2413},{"type":21,"tag":2314,"props":12647,"children":12648},{"style":3157},[12649],{"type":26,"value":8263},{"type":21,"tag":2314,"props":12651,"children":12652},{"style":2321},[12653],{"type":26,"value":12654}," n, ",{"type":21,"tag":2314,"props":12656,"children":12657},{"style":3222},[12658],{"type":26,"value":12659},"dtype",{"type":21,"tag":2314,"props":12661,"children":12662},{"style":3157},[12663],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12665,"children":12666},{"style":2339},[12667],{"type":26,"value":12668},"complex",{"type":21,"tag":2314,"props":12670,"children":12671},{"style":2321},[12672],{"type":26,"value":3257},{"type":21,"tag":2314,"props":12674,"children":12675},{"class":2316,"line":2335},[12676,12680,12685,12689,12693,12697,12701,12705,12709,12713,12717,12721,12726],{"type":21,"tag":2314,"props":12677,"children":12678},{"style":3157},[12679],{"type":26,"value":3450},{"type":21,"tag":2314,"props":12681,"children":12682},{"style":2321},[12683],{"type":26,"value":12684}," x ",{"type":21,"tag":2314,"props":12686,"children":12687},{"style":3157},[12688],{"type":26,"value":3460},{"type":21,"tag":2314,"props":12690,"children":12691},{"style":2339},[12692],{"type":26,"value":3465},{"type":21,"tag":2314,"props":12694,"children":12695},{"style":2321},[12696],{"type":26,"value":3277},{"type":21,"tag":2314,"props":12698,"children":12699},{"style":2339},[12700],{"type":26,"value":5122},{"type":21,"tag":2314,"props":12702,"children":12703},{"style":2321},[12704],{"type":26,"value":1309},{"type":21,"tag":2314,"props":12706,"children":12707},{"style":2339},[12708],{"type":26,"value":2413},{"type":21,"tag":2314,"props":12710,"children":12711},{"style":3157},[12712],{"type":26,"value":8263},{"type":21,"tag":2314,"props":12714,"children":12715},{"style":2321},[12716],{"type":26,"value":12654},{"type":21,"tag":2314,"props":12718,"children":12719},{"style":2339},[12720],{"type":26,"value":5486},{"type":21,"tag":2314,"props":12722,"children":12723},{"style":2321},[12724],{"type":26,"value":12725},"):   ",{"type":21,"tag":2314,"props":12727,"children":12728},{"style":3407},[12729],{"type":26,"value":12730},"# |0> + |4> + |8> + |12>\n",{"type":21,"tag":2314,"props":12732,"children":12733},{"class":2316,"line":2397},[12734,12739,12743],{"type":21,"tag":2314,"props":12735,"children":12736},{"style":2321},[12737],{"type":26,"value":12738},"    psi[x] ",{"type":21,"tag":2314,"props":12740,"children":12741},{"style":3157},[12742],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12744,"children":12745},{"style":2339},[12746],{"type":26,"value":12747}," 1\n",{"type":21,"tag":2314,"props":12749,"children":12750},{"class":2316,"line":2421},[12751,12755,12759],{"type":21,"tag":2314,"props":12752,"children":12753},{"style":2321},[12754],{"type":26,"value":12632},{"type":21,"tag":2314,"props":12756,"children":12757},{"style":3157},[12758],{"type":26,"value":5418},{"type":21,"tag":2314,"props":12760,"children":12761},{"style":2321},[12762],{"type":26,"value":12763}," np.linalg.norm(psi)\n",{"type":21,"tag":2314,"props":12765,"children":12766},{"class":2316,"line":16},[12767],{"type":21,"tag":2314,"props":12768,"children":12769},{"emptyLinePlaceholder":3181},[12770],{"type":26,"value":3184},{"type":21,"tag":2314,"props":12772,"children":12773},{"class":2316,"line":127},[12774,12779,12783],{"type":21,"tag":2314,"props":12775,"children":12776},{"style":2321},[12777],{"type":26,"value":12778},"out ",{"type":21,"tag":2314,"props":12780,"children":12781},{"style":3157},[12782],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12784,"children":12785},{"style":2321},[12786],{"type":26,"value":12787}," Statevector(psi).evolve(qft(n))\n",{"type":21,"tag":2314,"props":12789,"children":12790},{"class":2316,"line":887},[12791,12795,12800,12804,12808],{"type":21,"tag":2314,"props":12792,"children":12793},{"style":3157},[12794],{"type":26,"value":3450},{"type":21,"tag":2314,"props":12796,"children":12797},{"style":2321},[12798],{"type":26,"value":12799}," i, p ",{"type":21,"tag":2314,"props":12801,"children":12802},{"style":3157},[12803],{"type":26,"value":3460},{"type":21,"tag":2314,"props":12805,"children":12806},{"style":2339},[12807],{"type":26,"value":4839},{"type":21,"tag":2314,"props":12809,"children":12810},{"style":2321},[12811],{"type":26,"value":12812},"(out.probabilities()):\n",{"type":21,"tag":2314,"props":12814,"children":12815},{"class":2316,"line":1364},[12816,12820,12825,12830,12835],{"type":21,"tag":2314,"props":12817,"children":12818},{"style":3157},[12819],{"type":26,"value":11900},{"type":21,"tag":2314,"props":12821,"children":12822},{"style":2321},[12823],{"type":26,"value":12824}," p ",{"type":21,"tag":2314,"props":12826,"children":12827},{"style":3157},[12828],{"type":26,"value":12829},">",{"type":21,"tag":2314,"props":12831,"children":12832},{"style":2339},[12833],{"type":26,"value":12834}," 1e-6",{"type":21,"tag":2314,"props":12836,"children":12837},{"style":2321},[12838],{"type":26,"value":4873},{"type":21,"tag":2314,"props":12840,"children":12841},{"class":2316,"line":3403},[12842,12847,12851,12855,12860,12864,12868,12873,12877,12881,12885,12890,12894,12899,12903,12907,12912,12916,12921,12925,12929,12933,12937,12941],{"type":21,"tag":2314,"props":12843,"children":12844},{"style":2339},[12845],{"type":26,"value":12846},"        print",{"type":21,"tag":2314,"props":12848,"children":12849},{"style":2321},[12850],{"type":26,"value":3277},{"type":21,"tag":2314,"props":12852,"children":12853},{"style":3157},[12854],{"type":26,"value":3282},{"type":21,"tag":2314,"props":12856,"children":12857},{"style":2350},[12858],{"type":26,"value":12859},"\"|",{"type":21,"tag":2314,"props":12861,"children":12862},{"style":2339},[12863],{"type":26,"value":3292},{"type":21,"tag":2314,"props":12865,"children":12866},{"style":2321},[12867],{"type":26,"value":4190},{"type":21,"tag":2314,"props":12869,"children":12870},{"style":3157},[12871],{"type":26,"value":12872},":0",{"type":21,"tag":2314,"props":12874,"children":12875},{"style":2339},[12876],{"type":26,"value":3292},{"type":21,"tag":2314,"props":12878,"children":12879},{"style":2321},[12880],{"type":26,"value":4783},{"type":21,"tag":2314,"props":12882,"children":12883},{"style":2339},[12884],{"type":26,"value":3302},{"type":21,"tag":2314,"props":12886,"children":12887},{"style":3157},[12888],{"type":26,"value":12889},"b",{"type":21,"tag":2314,"props":12891,"children":12892},{"style":2339},[12893],{"type":26,"value":3302},{"type":21,"tag":2314,"props":12895,"children":12896},{"style":2350},[12897],{"type":26,"value":12898},"> = ",{"type":21,"tag":2314,"props":12900,"children":12901},{"style":2339},[12902],{"type":26,"value":3292},{"type":21,"tag":2314,"props":12904,"children":12905},{"style":2321},[12906],{"type":26,"value":4190},{"type":21,"tag":2314,"props":12908,"children":12909},{"style":3157},[12910],{"type":26,"value":12911},":2d",{"type":21,"tag":2314,"props":12913,"children":12914},{"style":2339},[12915],{"type":26,"value":3302},{"type":21,"tag":2314,"props":12917,"children":12918},{"style":2350},[12919],{"type":26,"value":12920},"   p = ",{"type":21,"tag":2314,"props":12922,"children":12923},{"style":2339},[12924],{"type":26,"value":3292},{"type":21,"tag":2314,"props":12926,"children":12927},{"style":2321},[12928],{"type":26,"value":22},{"type":21,"tag":2314,"props":12930,"children":12931},{"style":3157},[12932],{"type":26,"value":3604},{"type":21,"tag":2314,"props":12934,"children":12935},{"style":2339},[12936],{"type":26,"value":3302},{"type":21,"tag":2314,"props":12938,"children":12939},{"style":2350},[12940],{"type":26,"value":3307},{"type":21,"tag":2314,"props":12942,"children":12943},{"style":2321},[12944],{"type":26,"value":3257},{"type":21,"tag":22,"props":12946,"children":12947},{},[12948],{"type":26,"value":12339},{"type":21,"tag":2304,"props":12950,"children":12952},{"code":12951},"|0000> =  0   p = 0.2500\n|0100> =  4   p = 0.2500\n|1000> =  8   p = 0.2500\n|1100> = 12   p = 0.2500\n",[12953],{"type":21,"tag":2073,"props":12954,"children":12955},{"__ignoreMap":7},[12956],{"type":26,"value":12951},{"type":21,"tag":22,"props":12958,"children":12959},{},[12960,12962,12967],{"type":26,"value":12961},"The input had period 4 in position space. The output is concentrated on multiples of 16\u002F4 = 4 in frequency space. Sample this a few times, take the greatest common divisor of the outcomes, and you recover the period. ",{"type":21,"tag":136,"props":12963,"children":12964},{},[12965],{"type":26,"value":12966},"That",{"type":26,"value":12968}," is the readable signal: not the coefficients, but a periodicity converted into a sampling distribution.",{"type":21,"tag":22,"props":12970,"children":12971},{},[12972],{"type":26,"value":12973},"Confirm it on the simulator with actual shots:",{"type":21,"tag":2304,"props":12975,"children":12977},{"code":12976,"language":3147,"meta":7,"className":3145,"style":7},"qc = QuantumCircuit(n)\nqc.initialize(psi, range(n))\nqc.compose(qft(n), inplace=True)\nqc.measure_all()\n\nsim = AerSimulator()\ncounts = sim.run(transpile(qc, sim), shots=4096).result().get_counts()\nprint(sorted(counts.items(), key=lambda kv: -kv[1]))\n",[12978],{"type":21,"tag":2073,"props":12979,"children":12980},{"__ignoreMap":7},[12981,12996,13012,13036,13044,13051,13066,13097],{"type":21,"tag":2314,"props":12982,"children":12983},{"class":2316,"line":2317},[12984,12988,12992],{"type":21,"tag":2314,"props":12985,"children":12986},{"style":2321},[12987],{"type":26,"value":7336},{"type":21,"tag":2314,"props":12989,"children":12990},{"style":3157},[12991],{"type":26,"value":3197},{"type":21,"tag":2314,"props":12993,"children":12994},{"style":2321},[12995],{"type":26,"value":12462},{"type":21,"tag":2314,"props":12997,"children":12998},{"class":2316,"line":106},[12999,13004,13008],{"type":21,"tag":2314,"props":13000,"children":13001},{"style":2321},[13002],{"type":26,"value":13003},"qc.initialize(psi, ",{"type":21,"tag":2314,"props":13005,"children":13006},{"style":2339},[13007],{"type":26,"value":4896},{"type":21,"tag":2314,"props":13009,"children":13010},{"style":2321},[13011],{"type":26,"value":4910},{"type":21,"tag":2314,"props":13013,"children":13014},{"class":2316,"line":2335},[13015,13020,13024,13028,13032],{"type":21,"tag":2314,"props":13016,"children":13017},{"style":2321},[13018],{"type":26,"value":13019},"qc.compose(qft(n), ",{"type":21,"tag":2314,"props":13021,"children":13022},{"style":3222},[13023],{"type":26,"value":8153},{"type":21,"tag":2314,"props":13025,"children":13026},{"style":3157},[13027],{"type":26,"value":3197},{"type":21,"tag":2314,"props":13029,"children":13030},{"style":2339},[13031],{"type":26,"value":3234},{"type":21,"tag":2314,"props":13033,"children":13034},{"style":2321},[13035],{"type":26,"value":3257},{"type":21,"tag":2314,"props":13037,"children":13038},{"class":2316,"line":2397},[13039],{"type":21,"tag":2314,"props":13040,"children":13041},{"style":2321},[13042],{"type":26,"value":13043},"qc.measure_all()\n",{"type":21,"tag":2314,"props":13045,"children":13046},{"class":2316,"line":2421},[13047],{"type":21,"tag":2314,"props":13048,"children":13049},{"emptyLinePlaceholder":3181},[13050],{"type":26,"value":3184},{"type":21,"tag":2314,"props":13052,"children":13053},{"class":2316,"line":16},[13054,13058,13062],{"type":21,"tag":2314,"props":13055,"children":13056},{"style":2321},[13057],{"type":26,"value":8378},{"type":21,"tag":2314,"props":13059,"children":13060},{"style":3157},[13061],{"type":26,"value":3197},{"type":21,"tag":2314,"props":13063,"children":13064},{"style":2321},[13065],{"type":26,"value":8387},{"type":21,"tag":2314,"props":13067,"children":13068},{"class":2316,"line":127},[13069,13073,13077,13081,13085,13089,13093],{"type":21,"tag":2314,"props":13070,"children":13071},{"style":2321},[13072],{"type":26,"value":8411},{"type":21,"tag":2314,"props":13074,"children":13075},{"style":3157},[13076],{"type":26,"value":3197},{"type":21,"tag":2314,"props":13078,"children":13079},{"style":2321},[13080],{"type":26,"value":8420},{"type":21,"tag":2314,"props":13082,"children":13083},{"style":3222},[13084],{"type":26,"value":4077},{"type":21,"tag":2314,"props":13086,"children":13087},{"style":3157},[13088],{"type":26,"value":3197},{"type":21,"tag":2314,"props":13090,"children":13091},{"style":2339},[13092],{"type":26,"value":8433},{"type":21,"tag":2314,"props":13094,"children":13095},{"style":2321},[13096],{"type":26,"value":5236},{"type":21,"tag":2314,"props":13098,"children":13099},{"class":2316,"line":887},[13100,13104,13108,13112,13117,13121,13125,13130,13134,13139,13143],{"type":21,"tag":2314,"props":13101,"children":13102},{"style":2339},[13103],{"type":26,"value":3272},{"type":21,"tag":2314,"props":13105,"children":13106},{"style":2321},[13107],{"type":26,"value":3277},{"type":21,"tag":2314,"props":13109,"children":13110},{"style":2339},[13111],{"type":26,"value":8453},{"type":21,"tag":2314,"props":13113,"children":13114},{"style":2321},[13115],{"type":26,"value":13116},"(counts.items(), ",{"type":21,"tag":2314,"props":13118,"children":13119},{"style":3222},[13120],{"type":26,"value":3498},{"type":21,"tag":2314,"props":13122,"children":13123},{"style":3157},[13124],{"type":26,"value":3503},{"type":21,"tag":2314,"props":13126,"children":13127},{"style":2321},[13128],{"type":26,"value":13129}," kv: ",{"type":21,"tag":2314,"props":13131,"children":13132},{"style":3157},[13133],{"type":26,"value":4802},{"type":21,"tag":2314,"props":13135,"children":13136},{"style":2321},[13137],{"type":26,"value":13138},"kv[",{"type":21,"tag":2314,"props":13140,"children":13141},{"style":2339},[13142],{"type":26,"value":3513},{"type":21,"tag":2314,"props":13144,"children":13145},{"style":2321},[13146],{"type":26,"value":13147},"]))\n",{"type":21,"tag":22,"props":13149,"children":13150},{},[13151],{"type":26,"value":12339},{"type":21,"tag":2304,"props":13153,"children":13155},{"code":13154},"[('0100', 1079), ('1000', 1030), ('0000', 1018), ('1100', 969)]\n",[13156],{"type":21,"tag":2073,"props":13157,"children":13158},{"__ignoreMap":7},[13159],{"type":26,"value":13154},{"type":21,"tag":22,"props":13161,"children":13162},{},[13163],{"type":26,"value":13164},"Four peaks, roughly 1024 counts each. Nothing else appears.",{"type":21,"tag":29,"props":13166,"children":13168},{"id":13167},"where-the-qft-earns-its-keep",[13169],{"type":26,"value":13170},"Where the QFT earns its keep",{"type":21,"tag":22,"props":13172,"children":13173},{},[13174,13179,13181,13185,13187,13193],{"type":21,"tag":136,"props":13175,"children":13176},{},[13177],{"type":26,"value":13178},"Quantum phase estimation (QPE).",{"type":26,"value":13180}," Given a unitary U and an eigenstate |ψ⟩ with U|ψ⟩ = e^{2πiθ}|ψ⟩, QPE writes θ into a register's phases using controlled-U powers, then applies the ",{"type":21,"tag":362,"props":13182,"children":13183},{},[13184],{"type":26,"value":6933},{"type":26,"value":13186}," QFT to convert those phases into a binary number you measure. Note the direction: QPE uses QFT⁻¹, because the phases are already there and the job is to pull them out. In Qiskit that's ",{"type":21,"tag":2073,"props":13188,"children":13190},{"className":13189},[],[13191],{"type":26,"value":13192},"qft(n).inverse()",{"type":26,"value":761},{"type":21,"tag":22,"props":13195,"children":13196},{},[13197,13202],{"type":21,"tag":136,"props":13198,"children":13199},{},[13200],{"type":26,"value":13201},"Order finding.",{"type":26,"value":13203}," Given a and N, find the smallest r with a^r ≡ 1 (mod N). Modular exponentiation creates a register periodic in r. The QFT turns that period into measurable peaks, exactly as in the demo above.",{"type":21,"tag":22,"props":13205,"children":13206},{},[13207,13215,13217,13222,13224,13228],{"type":21,"tag":136,"props":13208,"children":13209},{},[13210,13214],{"type":21,"tag":46,"props":13211,"children":13212},{"href":9582},[13213],{"type":26,"value":9585},{"type":26,"value":761},{"type":26,"value":13216}," Factoring reduces to order finding, so Shor's is order finding plus classical post-processing (continued fractions and a GCD). The ",{"type":21,"tag":46,"props":13218,"children":13219},{"href":8562},[13220],{"type":26,"value":13221},"1994 paper",{"type":26,"value":13223}," is worth reading precisely because the QFT is the only quantum part: everything else is number theory. This is also why the algorithm threatens RSA, and why ",{"type":21,"tag":46,"props":13225,"children":13226},{"href":9333},[13227],{"type":26,"value":9316},{"type":26,"value":13229}," migration is happening now rather than later.",{"type":21,"tag":22,"props":13231,"children":13232},{},[13233],{"type":26,"value":13234},"In all three cases the QFT is doing the same job: turning phase information into position information so a measurement sees it.",{"type":21,"tag":29,"props":13236,"children":13238},{"id":13237},"approximate-qft-drop-the-tiny-rotations",[13239],{"type":26,"value":13240},"Approximate QFT: drop the tiny rotations",{"type":21,"tag":22,"props":13242,"children":13243},{},[13244,13246,13251],{"type":26,"value":13245},"On real hardware, ",{"type":21,"tag":2073,"props":13247,"children":13249},{"className":13248},[],[13250],{"type":26,"value":11679},{"type":26,"value":13252}," for large k is a rotation smaller than your gate error. Executing it adds noise and buys nothing. The Approximate QFT (AQFT) simply skips every rotation with k above a cutoff, reducing the gate count from O(n²) to O(n log n):",{"type":21,"tag":2304,"props":13254,"children":13256},{"code":13255,"language":3147,"meta":7,"className":3145,"style":7},"def aqft(n, k_max):\n    qc = QuantumCircuit(n, name=\"AQFT\")\n    for size in range(n, 0, -1):\n        m = size - 1\n        qc.h(m)\n        for qubit in range(m):\n            k = m - qubit\n            if k \u003C= k_max:\n                qc.cp(np.pi \u002F 2 ** k, qubit, m)\n    for q in range(n \u002F\u002F 2):\n        qc.swap(q, n - q - 1)\n    return qc\n",[13257],{"type":21,"tag":2073,"props":13258,"children":13259},{"__ignoreMap":7},[13260,13277,13309,13354,13378,13386,13410,13436,13458,13483,13518,13546],{"type":21,"tag":2314,"props":13261,"children":13262},{"class":2316,"line":2317},[13263,13267,13272],{"type":21,"tag":2314,"props":13264,"children":13265},{"style":3157},[13266],{"type":26,"value":4315},{"type":21,"tag":2314,"props":13268,"children":13269},{"style":4318},[13270],{"type":26,"value":13271}," aqft",{"type":21,"tag":2314,"props":13273,"children":13274},{"style":2321},[13275],{"type":26,"value":13276},"(n, k_max):\n",{"type":21,"tag":2314,"props":13278,"children":13279},{"class":2316,"line":106},[13280,13284,13288,13292,13296,13300,13305],{"type":21,"tag":2314,"props":13281,"children":13282},{"style":2321},[13283],{"type":26,"value":7451},{"type":21,"tag":2314,"props":13285,"children":13286},{"style":3157},[13287],{"type":26,"value":3197},{"type":21,"tag":2314,"props":13289,"children":13290},{"style":2321},[13291],{"type":26,"value":7460},{"type":21,"tag":2314,"props":13293,"children":13294},{"style":3222},[13295],{"type":26,"value":7465},{"type":21,"tag":2314,"props":13297,"children":13298},{"style":3157},[13299],{"type":26,"value":3197},{"type":21,"tag":2314,"props":13301,"children":13302},{"style":2350},[13303],{"type":26,"value":13304},"\"AQFT\"",{"type":21,"tag":2314,"props":13306,"children":13307},{"style":2321},[13308],{"type":26,"value":3257},{"type":21,"tag":2314,"props":13310,"children":13311},{"class":2316,"line":2335},[13312,13316,13321,13325,13329,13334,13338,13342,13346,13350],{"type":21,"tag":2314,"props":13313,"children":13314},{"style":3157},[13315],{"type":26,"value":4694},{"type":21,"tag":2314,"props":13317,"children":13318},{"style":2321},[13319],{"type":26,"value":13320}," size ",{"type":21,"tag":2314,"props":13322,"children":13323},{"style":3157},[13324],{"type":26,"value":3460},{"type":21,"tag":2314,"props":13326,"children":13327},{"style":2339},[13328],{"type":26,"value":3465},{"type":21,"tag":2314,"props":13330,"children":13331},{"style":2321},[13332],{"type":26,"value":13333},"(n, ",{"type":21,"tag":2314,"props":13335,"children":13336},{"style":2339},[13337],{"type":26,"value":5122},{"type":21,"tag":2314,"props":13339,"children":13340},{"style":2321},[13341],{"type":26,"value":1309},{"type":21,"tag":2314,"props":13343,"children":13344},{"style":3157},[13345],{"type":26,"value":4802},{"type":21,"tag":2314,"props":13347,"children":13348},{"style":2339},[13349],{"type":26,"value":3513},{"type":21,"tag":2314,"props":13351,"children":13352},{"style":2321},[13353],{"type":26,"value":4368},{"type":21,"tag":2314,"props":13355,"children":13356},{"class":2316,"line":2397},[13357,13362,13366,13370,13374],{"type":21,"tag":2314,"props":13358,"children":13359},{"style":2321},[13360],{"type":26,"value":13361},"        m ",{"type":21,"tag":2314,"props":13363,"children":13364},{"style":3157},[13365],{"type":26,"value":3197},{"type":21,"tag":2314,"props":13367,"children":13368},{"style":2321},[13369],{"type":26,"value":13320},{"type":21,"tag":2314,"props":13371,"children":13372},{"style":3157},[13373],{"type":26,"value":4802},{"type":21,"tag":2314,"props":13375,"children":13376},{"style":2339},[13377],{"type":26,"value":12747},{"type":21,"tag":2314,"props":13379,"children":13380},{"class":2316,"line":2421},[13381],{"type":21,"tag":2314,"props":13382,"children":13383},{"style":2321},[13384],{"type":26,"value":13385},"        qc.h(m)\n",{"type":21,"tag":2314,"props":13387,"children":13388},{"class":2316,"line":16},[13389,13393,13397,13401,13405],{"type":21,"tag":2314,"props":13390,"children":13391},{"style":3157},[13392],{"type":26,"value":4825},{"type":21,"tag":2314,"props":13394,"children":13395},{"style":2321},[13396],{"type":26,"value":11973},{"type":21,"tag":2314,"props":13398,"children":13399},{"style":3157},[13400],{"type":26,"value":3460},{"type":21,"tag":2314,"props":13402,"children":13403},{"style":2339},[13404],{"type":26,"value":3465},{"type":21,"tag":2314,"props":13406,"children":13407},{"style":2321},[13408],{"type":26,"value":13409},"(m):\n",{"type":21,"tag":2314,"props":13411,"children":13412},{"class":2316,"line":127},[13413,13418,13422,13427,13431],{"type":21,"tag":2314,"props":13414,"children":13415},{"style":2321},[13416],{"type":26,"value":13417},"            k ",{"type":21,"tag":2314,"props":13419,"children":13420},{"style":3157},[13421],{"type":26,"value":3197},{"type":21,"tag":2314,"props":13423,"children":13424},{"style":2321},[13425],{"type":26,"value":13426}," m ",{"type":21,"tag":2314,"props":13428,"children":13429},{"style":3157},[13430],{"type":26,"value":4802},{"type":21,"tag":2314,"props":13432,"children":13433},{"style":2321},[13434],{"type":26,"value":13435}," qubit\n",{"type":21,"tag":2314,"props":13437,"children":13438},{"class":2316,"line":887},[13439,13443,13448,13453],{"type":21,"tag":2314,"props":13440,"children":13441},{"style":3157},[13442],{"type":26,"value":4853},{"type":21,"tag":2314,"props":13444,"children":13445},{"style":2321},[13446],{"type":26,"value":13447}," k ",{"type":21,"tag":2314,"props":13449,"children":13450},{"style":3157},[13451],{"type":26,"value":13452},"\u003C=",{"type":21,"tag":2314,"props":13454,"children":13455},{"style":2321},[13456],{"type":26,"value":13457}," k_max:\n",{"type":21,"tag":2314,"props":13459,"children":13460},{"class":2316,"line":1364},[13461,13466,13470,13474,13478],{"type":21,"tag":2314,"props":13462,"children":13463},{"style":2321},[13464],{"type":26,"value":13465},"                qc.cp(np.pi ",{"type":21,"tag":2314,"props":13467,"children":13468},{"style":3157},[13469],{"type":26,"value":2168},{"type":21,"tag":2314,"props":13471,"children":13472},{"style":2339},[13473],{"type":26,"value":6338},{"type":21,"tag":2314,"props":13475,"children":13476},{"style":3157},[13477],{"type":26,"value":8263},{"type":21,"tag":2314,"props":13479,"children":13480},{"style":2321},[13481],{"type":26,"value":13482}," k, qubit, m)\n",{"type":21,"tag":2314,"props":13484,"children":13485},{"class":2316,"line":3403},[13486,13490,13494,13498,13502,13506,13510,13514],{"type":21,"tag":2314,"props":13487,"children":13488},{"style":3157},[13489],{"type":26,"value":4694},{"type":21,"tag":2314,"props":13491,"children":13492},{"style":2321},[13493],{"type":26,"value":3455},{"type":21,"tag":2314,"props":13495,"children":13496},{"style":3157},[13497],{"type":26,"value":3460},{"type":21,"tag":2314,"props":13499,"children":13500},{"style":2339},[13501],{"type":26,"value":3465},{"type":21,"tag":2314,"props":13503,"children":13504},{"style":2321},[13505],{"type":26,"value":7623},{"type":21,"tag":2314,"props":13507,"children":13508},{"style":3157},[13509],{"type":26,"value":6062},{"type":21,"tag":2314,"props":13511,"children":13512},{"style":2339},[13513],{"type":26,"value":6338},{"type":21,"tag":2314,"props":13515,"children":13516},{"style":2321},[13517],{"type":26,"value":4368},{"type":21,"tag":2314,"props":13519,"children":13520},{"class":2316,"line":3413},[13521,13526,13530,13534,13538,13542],{"type":21,"tag":2314,"props":13522,"children":13523},{"style":2321},[13524],{"type":26,"value":13525},"        qc.swap(q, n ",{"type":21,"tag":2314,"props":13527,"children":13528},{"style":3157},[13529],{"type":26,"value":4802},{"type":21,"tag":2314,"props":13531,"children":13532},{"style":2321},[13533],{"type":26,"value":3455},{"type":21,"tag":2314,"props":13535,"children":13536},{"style":3157},[13537],{"type":26,"value":4802},{"type":21,"tag":2314,"props":13539,"children":13540},{"style":2339},[13541],{"type":26,"value":6053},{"type":21,"tag":2314,"props":13543,"children":13544},{"style":2321},[13545],{"type":26,"value":3257},{"type":21,"tag":2314,"props":13547,"children":13548},{"class":2316,"line":436},[13549,13553],{"type":21,"tag":2314,"props":13550,"children":13551},{"style":3157},[13552],{"type":26,"value":4540},{"type":21,"tag":2314,"props":13554,"children":13555},{"style":2321},[13556],{"type":26,"value":7732},{"type":21,"tag":22,"props":13558,"children":13559},{},[13560],{"type":26,"value":13561},"Measured fidelity against the exact 4-qubit QFT:",{"type":21,"tag":4020,"props":13563,"children":13564},{},[13565,13586],{"type":21,"tag":4024,"props":13566,"children":13567},{},[13568],{"type":21,"tag":4028,"props":13569,"children":13570},{},[13571,13576,13581],{"type":21,"tag":4032,"props":13572,"children":13573},{},[13574],{"type":26,"value":13575},"k_max",{"type":21,"tag":4032,"props":13577,"children":13578},{},[13579],{"type":26,"value":13580},"CP gates",{"type":21,"tag":4032,"props":13582,"children":13583},{},[13584],{"type":26,"value":13585},"Fidelity",{"type":21,"tag":4046,"props":13587,"children":13588},{},[13589,13605,13621,13638],{"type":21,"tag":4028,"props":13590,"children":13591},{},[13592,13596,13600],{"type":21,"tag":4053,"props":13593,"children":13594},{},[13595],{"type":26,"value":3513},{"type":21,"tag":4053,"props":13597,"children":13598},{},[13599],{"type":26,"value":6465},{"type":21,"tag":4053,"props":13601,"children":13602},{},[13603],{"type":26,"value":13604},"0.8456",{"type":21,"tag":4028,"props":13606,"children":13607},{},[13608,13612,13616],{"type":21,"tag":4053,"props":13609,"children":13610},{},[13611],{"type":26,"value":2413},{"type":21,"tag":4053,"props":13613,"children":13614},{},[13615],{"type":26,"value":6636},{"type":21,"tag":4053,"props":13617,"children":13618},{},[13619],{"type":26,"value":13620},"0.9856",{"type":21,"tag":4028,"props":13622,"children":13623},{},[13624,13628,13633],{"type":21,"tag":4053,"props":13625,"children":13626},{},[13627],{"type":26,"value":6465},{"type":21,"tag":4053,"props":13629,"children":13630},{},[13631],{"type":26,"value":13632},"6",{"type":21,"tag":4053,"props":13634,"children":13635},{},[13636],{"type":26,"value":13637},"1.0000",{"type":21,"tag":4028,"props":13639,"children":13640},{},[13641,13646,13650],{"type":21,"tag":4053,"props":13642,"children":13643},{},[13644],{"type":26,"value":13645},"exact",{"type":21,"tag":4053,"props":13647,"children":13648},{},[13649],{"type":26,"value":13632},{"type":21,"tag":4053,"props":13651,"children":13652},{},[13653],{"type":26,"value":13637},{"type":21,"tag":22,"props":13655,"children":13656},{},[13657,13659,13663],{"type":26,"value":13658},"Keeping rotations down to π\u002F4 recovers 98.6% fidelity with 17% fewer two-qubit gates. On larger registers the saving is dramatic: keeping only k ≤ O(log n) rotations is provably enough for Shor's algorithm to succeed, and on a noisy device the AQFT often outperforms the exact QFT because the errors you avoid outweigh the approximation you introduce. Always benchmark both on a ",{"type":21,"tag":46,"props":13660,"children":13661},{"href":408},[13662],{"type":26,"value":3243},{"type":26,"value":13664}," with a realistic noise model before committing.",{"type":21,"tag":29,"props":13666,"children":13668},{"id":13667},"try-this-next",[13669],{"type":26,"value":13670},"Try this next",{"type":21,"tag":3080,"props":13672,"children":13673},{},[13674,13686,13699],{"type":21,"tag":3084,"props":13675,"children":13676},{},[13677,13679,13684],{"type":26,"value":13678},"Build ",{"type":21,"tag":2073,"props":13680,"children":13682},{"className":13681},[],[13683],{"type":26,"value":13192},{"type":26,"value":13685}," and use it to implement phase estimation on a T gate. You should recover θ = 1\u002F8 exactly with 3 counting qubits.",{"type":21,"tag":3084,"props":13687,"children":13688},{},[13689,13691,13697],{"type":26,"value":13690},"Run the 4-qubit QFT through ",{"type":21,"tag":2073,"props":13692,"children":13694},{"className":13693},[],[13695],{"type":26,"value":13696},"transpile(qc, backend, optimization_level=3)",{"type":26,"value":13698}," for a real device and watch the CP gates decompose into CNOTs. The depth increase is sobering.",{"type":21,"tag":3084,"props":13700,"children":13701},{},[13702,13704,13708],{"type":26,"value":13703},"Compare against a variational algorithm like ",{"type":21,"tag":46,"props":13705,"children":13706},{"href":2029},[13707],{"type":26,"value":2018},{"type":26,"value":13709}," to see the contrast between structured algorithms with proven speedups and heuristic NISQ ones.",{"type":21,"tag":22,"props":13711,"children":13712},{},[13713],{"type":26,"value":13714},"The takeaway to keep: the QFT is fast, exact, and useless by itself. Its power is entirely in what you wrap around it.",{"type":21,"tag":2688,"props":13716,"children":13717},{},[13718],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":13720},[13721,13722,13723,13724,13725,13726,13727,13728,13729],{"id":11512,"depth":106,"text":11515},{"id":11582,"depth":106,"text":11585},{"id":11640,"depth":106,"text":11643},{"id":11719,"depth":106,"text":11722},{"id":12355,"depth":106,"text":12358},{"id":12588,"depth":106,"text":12591},{"id":13167,"depth":106,"text":13170},{"id":13237,"depth":106,"text":13240},{"id":13667,"depth":106,"text":13670},"content:blog:quantum-fourier-transform-tutorial.md","blog\u002Fquantum-fourier-transform-tutorial.md","blog\u002Fquantum-fourier-transform-tutorial",{"_path":13734,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":13735,"description":13736,"date":3032,"author":11,"tags":13737,"readingTime":1364,"body":13740,"_type":111,"_id":15589,"_source":113,"_file":15590,"_stem":15591,"_extension":116},"\u002Fblog\u002Fquantum-machine-learning-reality-check","Quantum Machine Learning: A Reality Check","What QML is, what the evidence currently shows about whether it beats classical models, and which parts of it are genuinely promising: grounded in the Biamonte review, the barren plateaus result, and a 2026 head-to-head comparison.",[13738,13739,7102],"QML","PennyLane",{"type":18,"children":13741,"toc":15580},[13742,13747,13759,13764,13770,13775,13806,13816,13832,13842,13848,13860,13872,13877,13887,13893,13905,13917,13928,13933,13939,13944,13955,13960,13993,13998,14010,14016,14028,15361,15374,15429,15441,15460,15466,15471,15494,15504,15514,15520,15536,15548,15558,15576],{"type":21,"tag":22,"props":13743,"children":13744},{},[13745],{"type":26,"value":13746},"\"Quantum computing will supercharge AI\" is the single most repeated claim in quantum marketing. It is also the claim with the weakest evidence behind it.",{"type":21,"tag":22,"props":13748,"children":13749},{},[13750,13752,13757],{"type":26,"value":13751},"This isn't a takedown. Quantum machine learning is a real research area with real results and a handful of genuinely interesting open directions. But the gap between what QML is often ",{"type":21,"tag":362,"props":13753,"children":13754},{},[13755],{"type":26,"value":13756},"said",{"type":26,"value":13758}," to do and what has been demonstrated is wider than in almost any other corner of the field. If you're deciding whether to invest time here, you deserve the honest version.",{"type":21,"tag":22,"props":13760,"children":13761},{},[13762],{"type":26,"value":13763},"So: what QML is, what the evidence shows, and what's still worth watching.",{"type":21,"tag":29,"props":13765,"children":13767},{"id":13766},"what-quantum-machine-learning-means",[13768],{"type":26,"value":13769},"What quantum machine learning means",{"type":21,"tag":22,"props":13771,"children":13772},{},[13773],{"type":26,"value":13774},"The term covers several quite different things that get blurred together.",{"type":21,"tag":22,"props":13776,"children":13777},{},[13778,13783,13785,13791,13793,13798,13800,13804],{"type":21,"tag":136,"props":13779,"children":13780},{},[13781],{"type":26,"value":13782},"Variational circuits as trainable models.",{"type":26,"value":13784}," This is what most people building QML today are doing. You write a parameterized quantum circuit, a ",{"type":21,"tag":46,"props":13786,"children":13788},{"href":13787},"\u002Fglossary\u002Fvariational-circuit",[13789],{"type":26,"value":13790},"variational circuit",{"type":26,"value":13792},", feed data in, measure an output, and use a classical optimizer to adjust the parameters until the output matches your labels. Structurally it's the same ",{"type":21,"tag":46,"props":13794,"children":13795},{"href":379},[13796],{"type":26,"value":13797},"hybrid algorithm",{"type":26,"value":13799}," pattern as ",{"type":21,"tag":46,"props":13801,"children":13802},{"href":321},[13803],{"type":26,"value":282},{"type":26,"value":13805},", only with a loss function instead of an energy. The circuit is the model. The rotation angles are the weights.",{"type":21,"tag":22,"props":13807,"children":13808},{},[13809,13814],{"type":21,"tag":136,"props":13810,"children":13811},{},[13812],{"type":26,"value":13813},"Quantum kernels.",{"type":26,"value":13815}," Instead of training a quantum model directly, you use the quantum computer only to compute similarities between data points: encode two inputs into quantum states and measure their overlap. That similarity matrix then feeds an entirely classical support vector machine. The quantum device does one narrow job, which makes this approach far more resilient to noise than end-to-end variational training.",{"type":21,"tag":22,"props":13817,"children":13818},{},[13819,13824,13826,13830],{"type":21,"tag":136,"props":13820,"children":13821},{},[13822],{"type":26,"value":13823},"Data encoding.",{"type":26,"value":13825}," Both approaches need classical numbers turned into quantum states, and this choice matters more than anything else in the pipeline. Angle encoding maps each feature to a rotation angle. Simple, but it needs one ",{"type":21,"tag":46,"props":13827,"children":13828},{"href":1194},[13829],{"type":26,"value":2776},{"type":26,"value":13831}," per feature. Amplitude encoding packs 2ⁿ values into n qubits, which sounds magical until you look at the circuit depth required to prepare that state.",{"type":21,"tag":22,"props":13833,"children":13834},{},[13835,13840],{"type":21,"tag":136,"props":13836,"children":13837},{},[13838],{"type":26,"value":13839},"Quantum-accelerated linear algebra.",{"type":26,"value":13841}," The original, most theoretically ambitious branch: algorithms like HHL for solving linear systems with exponential speedups on paper. This is where the big speedup numbers in QML pitches come from, and where the caveats bite hardest.",{"type":21,"tag":29,"props":13843,"children":13845},{"id":13844},"the-data-loading-bottleneck",[13846],{"type":26,"value":13847},"The data-loading bottleneck",{"type":21,"tag":22,"props":13849,"children":13850},{},[13851,13852,13858],{"type":26,"value":11024},{"type":21,"tag":46,"props":13853,"children":13855},{"href":13854},"\u002Fresearch\u002Fbiamonte-quantum-machine-learning-2017",[13856],{"type":26,"value":13857},"Biamonte et al. review",{"type":26,"value":13859},", still the standard reference for the field, is unusually direct about the central problem, and it applies to that fourth category above.",{"type":21,"tag":22,"props":13861,"children":13862},{},[13863,13865,13870],{"type":26,"value":13864},"Many quantum ML algorithms with proven exponential speedups assume your data is ",{"type":21,"tag":362,"props":13866,"children":13867},{},[13868],{"type":26,"value":13869},"already",{"type":26,"value":13871}," sitting in quantum RAM, in a convenient superposition, ready to be operated on. That's a big assumption. If you have to load N classical data points into a quantum state, and loading takes time proportional to N, then an algorithm that runs in log(N) time once loaded still costs you O(N) overall. The speedup evaporates in the preprocessing step.",{"type":21,"tag":22,"props":13873,"children":13874},{},[13875],{"type":26,"value":13876},"This isn't a hardware engineering problem that better devices will fix. It's structural. And it got worse: over the past decade, a series of \"dequantization\" results showed that several proposed quantum ML speedups had classical algorithms achieving comparable scaling once you granted the classical side similar sampling access to the data. The quantum advantage in those cases turned out to be an artifact of comparing a quantum algorithm with quantum data access against a classical algorithm without equivalent access.",{"type":21,"tag":22,"props":13878,"children":13879},{},[13880,13882],{"type":26,"value":13881},"The practical rule: ",{"type":21,"tag":136,"props":13883,"children":13884},{},[13885],{"type":26,"value":13886},"be suspicious of any quantum ML speedup claim that doesn't account for how the data got in.",{"type":21,"tag":29,"props":13888,"children":13890},{"id":13889},"barren-plateaus",[13891],{"type":26,"value":13892},"Barren plateaus",{"type":21,"tag":22,"props":13894,"children":13895},{},[13896,13898,13904],{"type":26,"value":13897},"The variational approach (the one most people build with) has its own structural obstacle, and it's the one described in ",{"type":21,"tag":46,"props":13899,"children":13901},{"href":13900},"\u002Fresearch\u002Fmcclean-barren-plateaus-2018",[13902],{"type":26,"value":13903},"McClean et al.",{"type":26,"value":761},{"type":21,"tag":22,"props":13906,"children":13907},{},[13908,13910,13915],{"type":26,"value":13909},"Training a variational model means computing gradients and stepping downhill. McClean and colleagues showed that for randomly initialized circuits, the ",{"type":21,"tag":362,"props":13911,"children":13912},{},[13913],{"type":26,"value":13914},"variance",{"type":26,"value":13916}," of the gradient shrinks exponentially as you add qubits. The optimization terrain flattens into a featureless plain (a barren plateau) where every direction looks the same.",{"type":21,"tag":22,"props":13918,"children":13919},{},[13920,13922,13926],{"type":26,"value":13921},"Why this is fatal rather than merely annoying: gradients on quantum hardware are estimated from measurement statistics, so they come with ",{"type":21,"tag":46,"props":13923,"children":13924},{"href":5662},[13925],{"type":26,"value":5665},{"type":26,"value":13927},". Once the true gradient is smaller than your sampling error, you need exponentially many shots only to tell which way is down. At a few dozen qubits with a generic ansatz, the training signal is gone.",{"type":21,"tag":22,"props":13929,"children":13930},{},[13931],{"type":26,"value":13932},"Mitigations exist and are actively researched: structured problem-informed ansätze, layerwise training, smart initialization, local rather than global cost functions. None is a general solution. Any claim that a variational quantum model scales to useful problem sizes has to explain how it escapes this, and most don't.",{"type":21,"tag":29,"props":13934,"children":13936},{"id":13935},"the-2026-head-to-head-comparison",[13937],{"type":26,"value":13938},"The 2026 head-to-head comparison",{"type":21,"tag":22,"props":13940,"children":13941},{},[13942],{"type":26,"value":13943},"Theoretical caveats are one thing. The more useful question is what happens when someone runs the models side by side, and that's rarer than you'd expect. QML papers usually benchmark against other QML papers.",{"type":21,"tag":22,"props":13945,"children":13946},{},[13947,13953],{"type":21,"tag":46,"props":13948,"children":13950},{"href":13949},"\u002Fresearch\u002Fquantum-vs-classical-ml-2026",[13951],{"type":26,"value":13952},"Yu et al. (2026)",{"type":26,"value":13954}," did the like-for-like version: seven matched quantum\u002Fclassical model pairs, spanning both supervised learning and reinforcement learning, run on the same problems with the comparison held as fair as possible.",{"type":21,"tag":22,"props":13956,"children":13957},{},[13958],{"type":26,"value":13959},"The quantum models lost. Not on one axis: on three:",{"type":21,"tag":3080,"props":13961,"children":13962},{},[13963,13973,13983],{"type":21,"tag":3084,"props":13964,"children":13965},{},[13966,13971],{"type":21,"tag":136,"props":13967,"children":13968},{},[13969],{"type":26,"value":13970},"Prediction performance.",{"type":26,"value":13972}," Classical baselines were more accurate.",{"type":21,"tag":3084,"props":13974,"children":13975},{},[13976,13981],{"type":21,"tag":136,"props":13977,"children":13978},{},[13979],{"type":26,"value":13980},"Policy stability.",{"type":26,"value":13982}," In the reinforcement learning tasks, the quantum models produced less stable policies.",{"type":21,"tag":3084,"props":13984,"children":13985},{},[13986,13991],{"type":21,"tag":136,"props":13987,"children":13988},{},[13989],{"type":26,"value":13990},"Training time.",{"type":26,"value":13992}," The quantum models were slower to train.",{"type":21,"tag":22,"props":13994,"children":13995},{},[13996],{"type":26,"value":13997},"That last one deserves emphasis, because \"quantum is slower\" is the opposite of the entire pitch. Circuit execution overhead, the shot counts needed for gradient estimation, and the classical-quantum round trips add up.",{"type":21,"tag":22,"props":13999,"children":14000},{},[14001,14003,14008],{"type":26,"value":14002},"One careful negative result doesn't close a research field. But it's the right kind of evidence, and it points the same direction as the theory. ",{"type":21,"tag":136,"props":14004,"children":14005},{},[14006],{"type":26,"value":14007},"As of mid-2026, \"quantum will make AI faster\" is not supported by the evidence.",{"type":26,"value":14009}," If someone tells you otherwise, ask them for the head-to-head benchmark.",{"type":21,"tag":29,"props":14011,"children":14013},{"id":14012},"try-it-yourself",[14014],{"type":26,"value":14015},"Try it yourself",{"type":21,"tag":22,"props":14017,"children":14018},{},[14019,14021,14026],{"type":26,"value":14020},"The best way to develop intuition here is to build one. This is a complete variational quantum classifier in ",{"type":21,"tag":46,"props":14022,"children":14024},{"href":14023},"\u002Fsdks\u002Fpennylane",[14025],{"type":26,"value":13739},{"type":26,"value":14027},": angle encoding, a trainable entangling ansatz, and a gradient-descent loop:",{"type":21,"tag":2304,"props":14029,"children":14031},{"className":3145,"code":14030,"language":3147,"meta":7,"style":7},"import pennylane as qml\nfrom pennylane import numpy as np\nfrom sklearn.datasets import make_moons\nfrom sklearn.model_selection import train_test_split\n\nn_qubits = 2\nn_layers = 3\n\ndev = qml.device(\"default.qubit\", wires=n_qubits)\n\n@qml.qnode(dev)\ndef circuit(weights, x):\n    # Data encoding: each feature becomes a rotation angle\n    qml.AngleEmbedding(x, wires=range(n_qubits), rotation=\"Y\")\n\n    # Trainable ansatz: rotations plus entangling CNOTs\n    qml.BasicEntanglerLayers(weights, wires=range(n_qubits))\n\n    return qml.expval(qml.PauliZ(0))\n\ndef variational_classifier(weights, bias, x):\n    return circuit(weights, x) + bias\n\ndef square_loss(labels, preds):\n    return np.mean((labels - qml.math.stack(preds)) ** 2)\n\ndef cost(weights, bias, X, Y):\n    preds = [variational_classifier(weights, bias, x) for x in X]\n    return square_loss(Y, preds)\n\n# Two-moons dataset, labels mapped to -1 \u002F +1 to match \u003CZ>\nX, y = make_moons(n_samples=200, noise=0.15, random_state=42)\ny = 2 * y - 1\nX_train, X_test, y_train, y_test = train_test_split(\n    X, y, test_size=0.3, random_state=42\n)\n\nshape = qml.BasicEntanglerLayers.shape(n_layers=n_layers, n_wires=n_qubits)\nrng = np.random.default_rng(42)\nweights = np.array(rng.normal(0, 0.1, shape), requires_grad=True)\nbias = np.array(0.0, requires_grad=True)\n\nopt = qml.AdamOptimizer(stepsize=0.1)\nbatch_size = 20\n\nfor step in range(60):\n    idx = np.random.randint(0, len(X_train), (batch_size,))\n    X_batch, y_batch = X_train[idx], y_train[idx]\n    weights, bias, _, _ = opt.step(cost, weights, bias, X_batch, y_batch)\n\n    if step % 15 == 0:\n        preds = [np.sign(variational_classifier(weights, bias, x)) for x in X_train]\n        acc = np.mean(np.array(preds) == y_train)\n        print(f\"Step {step:2d} | cost {cost(weights, bias, X_train, y_train):.4f} | acc {acc:.3f}\")\n\ntest_preds = [np.sign(variational_classifier(weights, bias, x)) for x in X_test]\nprint(f\"\\nTest accuracy: {np.mean(np.array(test_preds) == y_test):.3f}\")\n",[14032],{"type":21,"tag":2073,"props":14033,"children":14034},{"__ignoreMap":7},[14035,14056,14083,14104,14125,14132,14148,14165,14172,14212,14219,14232,14249,14257,14300,14307,14315,14340,14347,14367,14374,14391,14412,14419,14436,14469,14476,14493,14527,14539,14546,14554,14625,14658,14675,14714,14721,14728,14772,14797,14849,14891,14898,14932,14949,14956,14989,15024,15042,15060,15068,15102,15137,15164,15255,15263,15297],{"type":21,"tag":2314,"props":14036,"children":14037},{"class":2316,"line":2317},[14038,14042,14047,14051],{"type":21,"tag":2314,"props":14039,"children":14040},{"style":3157},[14041],{"type":26,"value":3170},{"type":21,"tag":2314,"props":14043,"children":14044},{"style":2321},[14045],{"type":26,"value":14046}," pennylane ",{"type":21,"tag":2314,"props":14048,"children":14049},{"style":3157},[14050],{"type":26,"value":4232},{"type":21,"tag":2314,"props":14052,"children":14053},{"style":2321},[14054],{"type":26,"value":14055}," qml\n",{"type":21,"tag":2314,"props":14057,"children":14058},{"class":2316,"line":106},[14059,14063,14067,14071,14075,14079],{"type":21,"tag":2314,"props":14060,"children":14061},{"style":3157},[14062],{"type":26,"value":3160},{"type":21,"tag":2314,"props":14064,"children":14065},{"style":2321},[14066],{"type":26,"value":14046},{"type":21,"tag":2314,"props":14068,"children":14069},{"style":3157},[14070],{"type":26,"value":3170},{"type":21,"tag":2314,"props":14072,"children":14073},{"style":2321},[14074],{"type":26,"value":4227},{"type":21,"tag":2314,"props":14076,"children":14077},{"style":3157},[14078],{"type":26,"value":4232},{"type":21,"tag":2314,"props":14080,"children":14081},{"style":2321},[14082],{"type":26,"value":4237},{"type":21,"tag":2314,"props":14084,"children":14085},{"class":2316,"line":2335},[14086,14090,14095,14099],{"type":21,"tag":2314,"props":14087,"children":14088},{"style":3157},[14089],{"type":26,"value":3160},{"type":21,"tag":2314,"props":14091,"children":14092},{"style":2321},[14093],{"type":26,"value":14094}," sklearn.datasets ",{"type":21,"tag":2314,"props":14096,"children":14097},{"style":3157},[14098],{"type":26,"value":3170},{"type":21,"tag":2314,"props":14100,"children":14101},{"style":2321},[14102],{"type":26,"value":14103}," make_moons\n",{"type":21,"tag":2314,"props":14105,"children":14106},{"class":2316,"line":2397},[14107,14111,14116,14120],{"type":21,"tag":2314,"props":14108,"children":14109},{"style":3157},[14110],{"type":26,"value":3160},{"type":21,"tag":2314,"props":14112,"children":14113},{"style":2321},[14114],{"type":26,"value":14115}," sklearn.model_selection ",{"type":21,"tag":2314,"props":14117,"children":14118},{"style":3157},[14119],{"type":26,"value":3170},{"type":21,"tag":2314,"props":14121,"children":14122},{"style":2321},[14123],{"type":26,"value":14124}," train_test_split\n",{"type":21,"tag":2314,"props":14126,"children":14127},{"class":2316,"line":2421},[14128],{"type":21,"tag":2314,"props":14129,"children":14130},{"emptyLinePlaceholder":3181},[14131],{"type":26,"value":3184},{"type":21,"tag":2314,"props":14133,"children":14134},{"class":2316,"line":16},[14135,14140,14144],{"type":21,"tag":2314,"props":14136,"children":14137},{"style":2321},[14138],{"type":26,"value":14139},"n_qubits ",{"type":21,"tag":2314,"props":14141,"children":14142},{"style":3157},[14143],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14145,"children":14146},{"style":2339},[14147],{"type":26,"value":5048},{"type":21,"tag":2314,"props":14149,"children":14150},{"class":2316,"line":127},[14151,14156,14160],{"type":21,"tag":2314,"props":14152,"children":14153},{"style":2321},[14154],{"type":26,"value":14155},"n_layers ",{"type":21,"tag":2314,"props":14157,"children":14158},{"style":3157},[14159],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14161,"children":14162},{"style":2339},[14163],{"type":26,"value":14164}," 3\n",{"type":21,"tag":2314,"props":14166,"children":14167},{"class":2316,"line":887},[14168],{"type":21,"tag":2314,"props":14169,"children":14170},{"emptyLinePlaceholder":3181},[14171],{"type":26,"value":3184},{"type":21,"tag":2314,"props":14173,"children":14174},{"class":2316,"line":1364},[14175,14180,14184,14189,14194,14198,14203,14207],{"type":21,"tag":2314,"props":14176,"children":14177},{"style":2321},[14178],{"type":26,"value":14179},"dev ",{"type":21,"tag":2314,"props":14181,"children":14182},{"style":3157},[14183],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14185,"children":14186},{"style":2321},[14187],{"type":26,"value":14188}," qml.device(",{"type":21,"tag":2314,"props":14190,"children":14191},{"style":2350},[14192],{"type":26,"value":14193},"\"default.qubit\"",{"type":21,"tag":2314,"props":14195,"children":14196},{"style":2321},[14197],{"type":26,"value":1309},{"type":21,"tag":2314,"props":14199,"children":14200},{"style":3222},[14201],{"type":26,"value":14202},"wires",{"type":21,"tag":2314,"props":14204,"children":14205},{"style":3157},[14206],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14208,"children":14209},{"style":2321},[14210],{"type":26,"value":14211},"n_qubits)\n",{"type":21,"tag":2314,"props":14213,"children":14214},{"class":2316,"line":3403},[14215],{"type":21,"tag":2314,"props":14216,"children":14217},{"emptyLinePlaceholder":3181},[14218],{"type":26,"value":3184},{"type":21,"tag":2314,"props":14220,"children":14221},{"class":2316,"line":3413},[14222,14227],{"type":21,"tag":2314,"props":14223,"children":14224},{"style":4318},[14225],{"type":26,"value":14226},"@qml.qnode",{"type":21,"tag":2314,"props":14228,"children":14229},{"style":2321},[14230],{"type":26,"value":14231},"(dev)\n",{"type":21,"tag":2314,"props":14233,"children":14234},{"class":2316,"line":436},[14235,14239,14244],{"type":21,"tag":2314,"props":14236,"children":14237},{"style":3157},[14238],{"type":26,"value":4315},{"type":21,"tag":2314,"props":14240,"children":14241},{"style":4318},[14242],{"type":26,"value":14243}," circuit",{"type":21,"tag":2314,"props":14245,"children":14246},{"style":2321},[14247],{"type":26,"value":14248},"(weights, x):\n",{"type":21,"tag":2314,"props":14250,"children":14251},{"class":2316,"line":3473},[14252],{"type":21,"tag":2314,"props":14253,"children":14254},{"style":3407},[14255],{"type":26,"value":14256},"    # Data encoding: each feature becomes a rotation angle\n",{"type":21,"tag":2314,"props":14258,"children":14259},{"class":2316,"line":3521},[14260,14265,14269,14273,14277,14282,14287,14291,14296],{"type":21,"tag":2314,"props":14261,"children":14262},{"style":2321},[14263],{"type":26,"value":14264},"    qml.AngleEmbedding(x, ",{"type":21,"tag":2314,"props":14266,"children":14267},{"style":3222},[14268],{"type":26,"value":14202},{"type":21,"tag":2314,"props":14270,"children":14271},{"style":3157},[14272],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14274,"children":14275},{"style":2339},[14276],{"type":26,"value":4896},{"type":21,"tag":2314,"props":14278,"children":14279},{"style":2321},[14280],{"type":26,"value":14281},"(n_qubits), ",{"type":21,"tag":2314,"props":14283,"children":14284},{"style":3222},[14285],{"type":26,"value":14286},"rotation",{"type":21,"tag":2314,"props":14288,"children":14289},{"style":3157},[14290],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14292,"children":14293},{"style":2350},[14294],{"type":26,"value":14295},"\"Y\"",{"type":21,"tag":2314,"props":14297,"children":14298},{"style":2321},[14299],{"type":26,"value":3257},{"type":21,"tag":2314,"props":14301,"children":14302},{"class":2316,"line":3563},[14303],{"type":21,"tag":2314,"props":14304,"children":14305},{"emptyLinePlaceholder":3181},[14306],{"type":26,"value":3184},{"type":21,"tag":2314,"props":14308,"children":14309},{"class":2316,"line":4585},[14310],{"type":21,"tag":2314,"props":14311,"children":14312},{"style":3407},[14313],{"type":26,"value":14314},"    # Trainable ansatz: rotations plus entangling CNOTs\n",{"type":21,"tag":2314,"props":14316,"children":14317},{"class":2316,"line":4604},[14318,14323,14327,14331,14335],{"type":21,"tag":2314,"props":14319,"children":14320},{"style":2321},[14321],{"type":26,"value":14322},"    qml.BasicEntanglerLayers(weights, ",{"type":21,"tag":2314,"props":14324,"children":14325},{"style":3222},[14326],{"type":26,"value":14202},{"type":21,"tag":2314,"props":14328,"children":14329},{"style":3157},[14330],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14332,"children":14333},{"style":2339},[14334],{"type":26,"value":4896},{"type":21,"tag":2314,"props":14336,"children":14337},{"style":2321},[14338],{"type":26,"value":14339},"(n_qubits))\n",{"type":21,"tag":2314,"props":14341,"children":14342},{"class":2316,"line":4612},[14343],{"type":21,"tag":2314,"props":14344,"children":14345},{"emptyLinePlaceholder":3181},[14346],{"type":26,"value":3184},{"type":21,"tag":2314,"props":14348,"children":14349},{"class":2316,"line":4643},[14350,14354,14359,14363],{"type":21,"tag":2314,"props":14351,"children":14352},{"style":3157},[14353],{"type":26,"value":4540},{"type":21,"tag":2314,"props":14355,"children":14356},{"style":2321},[14357],{"type":26,"value":14358}," qml.expval(qml.PauliZ(",{"type":21,"tag":2314,"props":14360,"children":14361},{"style":2339},[14362],{"type":26,"value":5122},{"type":21,"tag":2314,"props":14364,"children":14365},{"style":2321},[14366],{"type":26,"value":12322},{"type":21,"tag":2314,"props":14368,"children":14369},{"class":2316,"line":4688},[14370],{"type":21,"tag":2314,"props":14371,"children":14372},{"emptyLinePlaceholder":3181},[14373],{"type":26,"value":3184},{"type":21,"tag":2314,"props":14375,"children":14376},{"class":2316,"line":4727},[14377,14381,14386],{"type":21,"tag":2314,"props":14378,"children":14379},{"style":3157},[14380],{"type":26,"value":4315},{"type":21,"tag":2314,"props":14382,"children":14383},{"style":4318},[14384],{"type":26,"value":14385}," variational_classifier",{"type":21,"tag":2314,"props":14387,"children":14388},{"style":2321},[14389],{"type":26,"value":14390},"(weights, bias, x):\n",{"type":21,"tag":2314,"props":14392,"children":14393},{"class":2316,"line":4745},[14394,14398,14403,14407],{"type":21,"tag":2314,"props":14395,"children":14396},{"style":3157},[14397],{"type":26,"value":4540},{"type":21,"tag":2314,"props":14399,"children":14400},{"style":2321},[14401],{"type":26,"value":14402}," circuit(weights, x) ",{"type":21,"tag":2314,"props":14404,"children":14405},{"style":3157},[14406],{"type":26,"value":6482},{"type":21,"tag":2314,"props":14408,"children":14409},{"style":2321},[14410],{"type":26,"value":14411}," bias\n",{"type":21,"tag":2314,"props":14413,"children":14414},{"class":2316,"line":4819},[14415],{"type":21,"tag":2314,"props":14416,"children":14417},{"emptyLinePlaceholder":3181},[14418],{"type":26,"value":3184},{"type":21,"tag":2314,"props":14420,"children":14421},{"class":2316,"line":4847},[14422,14426,14431],{"type":21,"tag":2314,"props":14423,"children":14424},{"style":3157},[14425],{"type":26,"value":4315},{"type":21,"tag":2314,"props":14427,"children":14428},{"style":4318},[14429],{"type":26,"value":14430}," square_loss",{"type":21,"tag":2314,"props":14432,"children":14433},{"style":2321},[14434],{"type":26,"value":14435},"(labels, preds):\n",{"type":21,"tag":2314,"props":14437,"children":14438},{"class":2316,"line":4876},[14439,14443,14448,14452,14457,14461,14465],{"type":21,"tag":2314,"props":14440,"children":14441},{"style":3157},[14442],{"type":26,"value":4540},{"type":21,"tag":2314,"props":14444,"children":14445},{"style":2321},[14446],{"type":26,"value":14447}," np.mean((labels ",{"type":21,"tag":2314,"props":14449,"children":14450},{"style":3157},[14451],{"type":26,"value":4802},{"type":21,"tag":2314,"props":14453,"children":14454},{"style":2321},[14455],{"type":26,"value":14456}," qml.math.stack(preds)) ",{"type":21,"tag":2314,"props":14458,"children":14459},{"style":3157},[14460],{"type":26,"value":4667},{"type":21,"tag":2314,"props":14462,"children":14463},{"style":2339},[14464],{"type":26,"value":6338},{"type":21,"tag":2314,"props":14466,"children":14467},{"style":2321},[14468],{"type":26,"value":3257},{"type":21,"tag":2314,"props":14470,"children":14471},{"class":2316,"line":4885},[14472],{"type":21,"tag":2314,"props":14473,"children":14474},{"emptyLinePlaceholder":3181},[14475],{"type":26,"value":3184},{"type":21,"tag":2314,"props":14477,"children":14478},{"class":2316,"line":4913},[14479,14483,14488],{"type":21,"tag":2314,"props":14480,"children":14481},{"style":3157},[14482],{"type":26,"value":4315},{"type":21,"tag":2314,"props":14484,"children":14485},{"style":4318},[14486],{"type":26,"value":14487}," cost",{"type":21,"tag":2314,"props":14489,"children":14490},{"style":2321},[14491],{"type":26,"value":14492},"(weights, bias, X, Y):\n",{"type":21,"tag":2314,"props":14494,"children":14495},{"class":2316,"line":4944},[14496,14501,14505,14510,14514,14518,14522],{"type":21,"tag":2314,"props":14497,"children":14498},{"style":2321},[14499],{"type":26,"value":14500},"    preds ",{"type":21,"tag":2314,"props":14502,"children":14503},{"style":3157},[14504],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14506,"children":14507},{"style":2321},[14508],{"type":26,"value":14509}," [variational_classifier(weights, bias, x) ",{"type":21,"tag":2314,"props":14511,"children":14512},{"style":3157},[14513],{"type":26,"value":3450},{"type":21,"tag":2314,"props":14515,"children":14516},{"style":2321},[14517],{"type":26,"value":12684},{"type":21,"tag":2314,"props":14519,"children":14520},{"style":3157},[14521],{"type":26,"value":3460},{"type":21,"tag":2314,"props":14523,"children":14524},{"style":2321},[14525],{"type":26,"value":14526}," X]\n",{"type":21,"tag":2314,"props":14528,"children":14529},{"class":2316,"line":4966},[14530,14534],{"type":21,"tag":2314,"props":14531,"children":14532},{"style":3157},[14533],{"type":26,"value":4540},{"type":21,"tag":2314,"props":14535,"children":14536},{"style":2321},[14537],{"type":26,"value":14538}," square_loss(Y, preds)\n",{"type":21,"tag":2314,"props":14540,"children":14541},{"class":2316,"line":5012},[14542],{"type":21,"tag":2314,"props":14543,"children":14544},{"emptyLinePlaceholder":3181},[14545],{"type":26,"value":3184},{"type":21,"tag":2314,"props":14547,"children":14548},{"class":2316,"line":5025},[14549],{"type":21,"tag":2314,"props":14550,"children":14551},{"style":3407},[14552],{"type":26,"value":14553},"# Two-moons dataset, labels mapped to -1 \u002F +1 to match \u003CZ>\n",{"type":21,"tag":2314,"props":14555,"children":14556},{"class":2316,"line":5033},[14557,14562,14566,14571,14576,14580,14585,14589,14594,14598,14603,14607,14612,14616,14621],{"type":21,"tag":2314,"props":14558,"children":14559},{"style":2321},[14560],{"type":26,"value":14561},"X, y ",{"type":21,"tag":2314,"props":14563,"children":14564},{"style":3157},[14565],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14567,"children":14568},{"style":2321},[14569],{"type":26,"value":14570}," make_moons(",{"type":21,"tag":2314,"props":14572,"children":14573},{"style":3222},[14574],{"type":26,"value":14575},"n_samples",{"type":21,"tag":2314,"props":14577,"children":14578},{"style":3157},[14579],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14581,"children":14582},{"style":2339},[14583],{"type":26,"value":14584},"200",{"type":21,"tag":2314,"props":14586,"children":14587},{"style":2321},[14588],{"type":26,"value":1309},{"type":21,"tag":2314,"props":14590,"children":14591},{"style":3222},[14592],{"type":26,"value":14593},"noise",{"type":21,"tag":2314,"props":14595,"children":14596},{"style":3157},[14597],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14599,"children":14600},{"style":2339},[14601],{"type":26,"value":14602},"0.15",{"type":21,"tag":2314,"props":14604,"children":14605},{"style":2321},[14606],{"type":26,"value":1309},{"type":21,"tag":2314,"props":14608,"children":14609},{"style":3222},[14610],{"type":26,"value":14611},"random_state",{"type":21,"tag":2314,"props":14613,"children":14614},{"style":3157},[14615],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14617,"children":14618},{"style":2339},[14619],{"type":26,"value":14620},"42",{"type":21,"tag":2314,"props":14622,"children":14623},{"style":2321},[14624],{"type":26,"value":3257},{"type":21,"tag":2314,"props":14626,"children":14627},{"class":2316,"line":5051},[14628,14633,14637,14641,14645,14650,14654],{"type":21,"tag":2314,"props":14629,"children":14630},{"style":2321},[14631],{"type":26,"value":14632},"y ",{"type":21,"tag":2314,"props":14634,"children":14635},{"style":3157},[14636],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14638,"children":14639},{"style":2339},[14640],{"type":26,"value":6338},{"type":21,"tag":2314,"props":14642,"children":14643},{"style":3157},[14644],{"type":26,"value":8299},{"type":21,"tag":2314,"props":14646,"children":14647},{"style":2321},[14648],{"type":26,"value":14649}," y ",{"type":21,"tag":2314,"props":14651,"children":14652},{"style":3157},[14653],{"type":26,"value":4802},{"type":21,"tag":2314,"props":14655,"children":14656},{"style":2339},[14657],{"type":26,"value":12747},{"type":21,"tag":2314,"props":14659,"children":14660},{"class":2316,"line":5069},[14661,14666,14670],{"type":21,"tag":2314,"props":14662,"children":14663},{"style":2321},[14664],{"type":26,"value":14665},"X_train, X_test, y_train, y_test ",{"type":21,"tag":2314,"props":14667,"children":14668},{"style":3157},[14669],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14671,"children":14672},{"style":2321},[14673],{"type":26,"value":14674}," train_test_split(\n",{"type":21,"tag":2314,"props":14676,"children":14677},{"class":2316,"line":5077},[14678,14683,14688,14692,14697,14701,14705,14709],{"type":21,"tag":2314,"props":14679,"children":14680},{"style":2321},[14681],{"type":26,"value":14682},"    X, y, ",{"type":21,"tag":2314,"props":14684,"children":14685},{"style":3222},[14686],{"type":26,"value":14687},"test_size",{"type":21,"tag":2314,"props":14689,"children":14690},{"style":3157},[14691],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14693,"children":14694},{"style":2339},[14695],{"type":26,"value":14696},"0.3",{"type":21,"tag":2314,"props":14698,"children":14699},{"style":2321},[14700],{"type":26,"value":1309},{"type":21,"tag":2314,"props":14702,"children":14703},{"style":3222},[14704],{"type":26,"value":14611},{"type":21,"tag":2314,"props":14706,"children":14707},{"style":3157},[14708],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14710,"children":14711},{"style":2339},[14712],{"type":26,"value":14713},"42\n",{"type":21,"tag":2314,"props":14715,"children":14716},{"class":2316,"line":5111},[14717],{"type":21,"tag":2314,"props":14718,"children":14719},{"style":2321},[14720],{"type":26,"value":3257},{"type":21,"tag":2314,"props":14722,"children":14723},{"class":2316,"line":5129},[14724],{"type":21,"tag":2314,"props":14725,"children":14726},{"emptyLinePlaceholder":3181},[14727],{"type":26,"value":3184},{"type":21,"tag":2314,"props":14729,"children":14730},{"class":2316,"line":5154},[14731,14736,14740,14745,14750,14754,14759,14764,14768],{"type":21,"tag":2314,"props":14732,"children":14733},{"style":2321},[14734],{"type":26,"value":14735},"shape ",{"type":21,"tag":2314,"props":14737,"children":14738},{"style":3157},[14739],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14741,"children":14742},{"style":2321},[14743],{"type":26,"value":14744}," qml.BasicEntanglerLayers.shape(",{"type":21,"tag":2314,"props":14746,"children":14747},{"style":3222},[14748],{"type":26,"value":14749},"n_layers",{"type":21,"tag":2314,"props":14751,"children":14752},{"style":3157},[14753],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14755,"children":14756},{"style":2321},[14757],{"type":26,"value":14758},"n_layers, ",{"type":21,"tag":2314,"props":14760,"children":14761},{"style":3222},[14762],{"type":26,"value":14763},"n_wires",{"type":21,"tag":2314,"props":14765,"children":14766},{"style":3157},[14767],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14769,"children":14770},{"style":2321},[14771],{"type":26,"value":14211},{"type":21,"tag":2314,"props":14773,"children":14774},{"class":2316,"line":5196},[14775,14780,14784,14789,14793],{"type":21,"tag":2314,"props":14776,"children":14777},{"style":2321},[14778],{"type":26,"value":14779},"rng ",{"type":21,"tag":2314,"props":14781,"children":14782},{"style":3157},[14783],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14785,"children":14786},{"style":2321},[14787],{"type":26,"value":14788}," np.random.default_rng(",{"type":21,"tag":2314,"props":14790,"children":14791},{"style":2339},[14792],{"type":26,"value":14620},{"type":21,"tag":2314,"props":14794,"children":14795},{"style":2321},[14796],{"type":26,"value":3257},{"type":21,"tag":2314,"props":14798,"children":14799},{"class":2316,"line":5204},[14800,14805,14809,14814,14818,14822,14827,14832,14837,14841,14845],{"type":21,"tag":2314,"props":14801,"children":14802},{"style":2321},[14803],{"type":26,"value":14804},"weights ",{"type":21,"tag":2314,"props":14806,"children":14807},{"style":3157},[14808],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14810,"children":14811},{"style":2321},[14812],{"type":26,"value":14813}," np.array(rng.normal(",{"type":21,"tag":2314,"props":14815,"children":14816},{"style":2339},[14817],{"type":26,"value":5122},{"type":21,"tag":2314,"props":14819,"children":14820},{"style":2321},[14821],{"type":26,"value":1309},{"type":21,"tag":2314,"props":14823,"children":14824},{"style":2339},[14825],{"type":26,"value":14826},"0.1",{"type":21,"tag":2314,"props":14828,"children":14829},{"style":2321},[14830],{"type":26,"value":14831},", shape), ",{"type":21,"tag":2314,"props":14833,"children":14834},{"style":3222},[14835],{"type":26,"value":14836},"requires_grad",{"type":21,"tag":2314,"props":14838,"children":14839},{"style":3157},[14840],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14842,"children":14843},{"style":2339},[14844],{"type":26,"value":3234},{"type":21,"tag":2314,"props":14846,"children":14847},{"style":2321},[14848],{"type":26,"value":3257},{"type":21,"tag":2314,"props":14850,"children":14851},{"class":2316,"line":5239},[14852,14857,14861,14866,14871,14875,14879,14883,14887],{"type":21,"tag":2314,"props":14853,"children":14854},{"style":2321},[14855],{"type":26,"value":14856},"bias ",{"type":21,"tag":2314,"props":14858,"children":14859},{"style":3157},[14860],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14862,"children":14863},{"style":2321},[14864],{"type":26,"value":14865}," np.array(",{"type":21,"tag":2314,"props":14867,"children":14868},{"style":2339},[14869],{"type":26,"value":14870},"0.0",{"type":21,"tag":2314,"props":14872,"children":14873},{"style":2321},[14874],{"type":26,"value":1309},{"type":21,"tag":2314,"props":14876,"children":14877},{"style":3222},[14878],{"type":26,"value":14836},{"type":21,"tag":2314,"props":14880,"children":14881},{"style":3157},[14882],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14884,"children":14885},{"style":2339},[14886],{"type":26,"value":3234},{"type":21,"tag":2314,"props":14888,"children":14889},{"style":2321},[14890],{"type":26,"value":3257},{"type":21,"tag":2314,"props":14892,"children":14893},{"class":2316,"line":5355},[14894],{"type":21,"tag":2314,"props":14895,"children":14896},{"emptyLinePlaceholder":3181},[14897],{"type":26,"value":3184},{"type":21,"tag":2314,"props":14899,"children":14900},{"class":2316,"line":5363},[14901,14906,14910,14915,14920,14924,14928],{"type":21,"tag":2314,"props":14902,"children":14903},{"style":2321},[14904],{"type":26,"value":14905},"opt ",{"type":21,"tag":2314,"props":14907,"children":14908},{"style":3157},[14909],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14911,"children":14912},{"style":2321},[14913],{"type":26,"value":14914}," qml.AdamOptimizer(",{"type":21,"tag":2314,"props":14916,"children":14917},{"style":3222},[14918],{"type":26,"value":14919},"stepsize",{"type":21,"tag":2314,"props":14921,"children":14922},{"style":3157},[14923],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14925,"children":14926},{"style":2339},[14927],{"type":26,"value":14826},{"type":21,"tag":2314,"props":14929,"children":14930},{"style":2321},[14931],{"type":26,"value":3257},{"type":21,"tag":2314,"props":14933,"children":14934},{"class":2316,"line":5408},[14935,14940,14944],{"type":21,"tag":2314,"props":14936,"children":14937},{"style":2321},[14938],{"type":26,"value":14939},"batch_size ",{"type":21,"tag":2314,"props":14941,"children":14942},{"style":3157},[14943],{"type":26,"value":3197},{"type":21,"tag":2314,"props":14945,"children":14946},{"style":2339},[14947],{"type":26,"value":14948}," 20\n",{"type":21,"tag":2314,"props":14950,"children":14951},{"class":2316,"line":5426},[14952],{"type":21,"tag":2314,"props":14953,"children":14954},{"emptyLinePlaceholder":3181},[14955],{"type":26,"value":3184},{"type":21,"tag":2314,"props":14957,"children":14958},{"class":2316,"line":5434},[14959,14963,14968,14972,14976,14980,14985],{"type":21,"tag":2314,"props":14960,"children":14961},{"style":3157},[14962],{"type":26,"value":3450},{"type":21,"tag":2314,"props":14964,"children":14965},{"style":2321},[14966],{"type":26,"value":14967}," step ",{"type":21,"tag":2314,"props":14969,"children":14970},{"style":3157},[14971],{"type":26,"value":3460},{"type":21,"tag":2314,"props":14973,"children":14974},{"style":2339},[14975],{"type":26,"value":3465},{"type":21,"tag":2314,"props":14977,"children":14978},{"style":2321},[14979],{"type":26,"value":3277},{"type":21,"tag":2314,"props":14981,"children":14982},{"style":2339},[14983],{"type":26,"value":14984},"60",{"type":21,"tag":2314,"props":14986,"children":14987},{"style":2321},[14988],{"type":26,"value":4368},{"type":21,"tag":2314,"props":14990,"children":14991},{"class":2316,"line":5522},[14992,14997,15001,15006,15010,15014,15019],{"type":21,"tag":2314,"props":14993,"children":14994},{"style":2321},[14995],{"type":26,"value":14996},"    idx ",{"type":21,"tag":2314,"props":14998,"children":14999},{"style":3157},[15000],{"type":26,"value":3197},{"type":21,"tag":2314,"props":15002,"children":15003},{"style":2321},[15004],{"type":26,"value":15005}," np.random.randint(",{"type":21,"tag":2314,"props":15007,"children":15008},{"style":2339},[15009],{"type":26,"value":5122},{"type":21,"tag":2314,"props":15011,"children":15012},{"style":2321},[15013],{"type":26,"value":1309},{"type":21,"tag":2314,"props":15015,"children":15016},{"style":2339},[15017],{"type":26,"value":15018},"len",{"type":21,"tag":2314,"props":15020,"children":15021},{"style":2321},[15022],{"type":26,"value":15023},"(X_train), (batch_size,))\n",{"type":21,"tag":2314,"props":15025,"children":15027},{"class":2316,"line":15026},48,[15028,15033,15037],{"type":21,"tag":2314,"props":15029,"children":15030},{"style":2321},[15031],{"type":26,"value":15032},"    X_batch, y_batch ",{"type":21,"tag":2314,"props":15034,"children":15035},{"style":3157},[15036],{"type":26,"value":3197},{"type":21,"tag":2314,"props":15038,"children":15039},{"style":2321},[15040],{"type":26,"value":15041}," X_train[idx], y_train[idx]\n",{"type":21,"tag":2314,"props":15043,"children":15045},{"class":2316,"line":15044},49,[15046,15051,15055],{"type":21,"tag":2314,"props":15047,"children":15048},{"style":2321},[15049],{"type":26,"value":15050},"    weights, bias, _, _ ",{"type":21,"tag":2314,"props":15052,"children":15053},{"style":3157},[15054],{"type":26,"value":3197},{"type":21,"tag":2314,"props":15056,"children":15057},{"style":2321},[15058],{"type":26,"value":15059}," opt.step(cost, weights, bias, X_batch, y_batch)\n",{"type":21,"tag":2314,"props":15061,"children":15063},{"class":2316,"line":15062},50,[15064],{"type":21,"tag":2314,"props":15065,"children":15066},{"emptyLinePlaceholder":3181},[15067],{"type":26,"value":3184},{"type":21,"tag":2314,"props":15069,"children":15071},{"class":2316,"line":15070},51,[15072,15076,15080,15084,15089,15094,15098],{"type":21,"tag":2314,"props":15073,"children":15074},{"style":3157},[15075],{"type":26,"value":11900},{"type":21,"tag":2314,"props":15077,"children":15078},{"style":2321},[15079],{"type":26,"value":14967},{"type":21,"tag":2314,"props":15081,"children":15082},{"style":3157},[15083],{"type":26,"value":6333},{"type":21,"tag":2314,"props":15085,"children":15086},{"style":2339},[15087],{"type":26,"value":15088}," 15",{"type":21,"tag":2314,"props":15090,"children":15091},{"style":3157},[15092],{"type":26,"value":15093}," ==",{"type":21,"tag":2314,"props":15095,"children":15096},{"style":2339},[15097],{"type":26,"value":11914},{"type":21,"tag":2314,"props":15099,"children":15100},{"style":2321},[15101],{"type":26,"value":4873},{"type":21,"tag":2314,"props":15103,"children":15105},{"class":2316,"line":15104},52,[15106,15111,15115,15120,15124,15128,15132],{"type":21,"tag":2314,"props":15107,"children":15108},{"style":2321},[15109],{"type":26,"value":15110},"        preds ",{"type":21,"tag":2314,"props":15112,"children":15113},{"style":3157},[15114],{"type":26,"value":3197},{"type":21,"tag":2314,"props":15116,"children":15117},{"style":2321},[15118],{"type":26,"value":15119}," [np.sign(variational_classifier(weights, bias, x)) ",{"type":21,"tag":2314,"props":15121,"children":15122},{"style":3157},[15123],{"type":26,"value":3450},{"type":21,"tag":2314,"props":15125,"children":15126},{"style":2321},[15127],{"type":26,"value":12684},{"type":21,"tag":2314,"props":15129,"children":15130},{"style":3157},[15131],{"type":26,"value":3460},{"type":21,"tag":2314,"props":15133,"children":15134},{"style":2321},[15135],{"type":26,"value":15136}," X_train]\n",{"type":21,"tag":2314,"props":15138,"children":15140},{"class":2316,"line":15139},53,[15141,15146,15150,15155,15159],{"type":21,"tag":2314,"props":15142,"children":15143},{"style":2321},[15144],{"type":26,"value":15145},"        acc ",{"type":21,"tag":2314,"props":15147,"children":15148},{"style":3157},[15149],{"type":26,"value":3197},{"type":21,"tag":2314,"props":15151,"children":15152},{"style":2321},[15153],{"type":26,"value":15154}," np.mean(np.array(preds) ",{"type":21,"tag":2314,"props":15156,"children":15157},{"style":3157},[15158],{"type":26,"value":4863},{"type":21,"tag":2314,"props":15160,"children":15161},{"style":2321},[15162],{"type":26,"value":15163}," y_train)\n",{"type":21,"tag":2314,"props":15165,"children":15167},{"class":2316,"line":15166},54,[15168,15172,15176,15180,15185,15189,15194,15198,15202,15207,15211,15216,15220,15224,15229,15233,15238,15243,15247,15251],{"type":21,"tag":2314,"props":15169,"children":15170},{"style":2339},[15171],{"type":26,"value":12846},{"type":21,"tag":2314,"props":15173,"children":15174},{"style":2321},[15175],{"type":26,"value":3277},{"type":21,"tag":2314,"props":15177,"children":15178},{"style":3157},[15179],{"type":26,"value":3282},{"type":21,"tag":2314,"props":15181,"children":15182},{"style":2350},[15183],{"type":26,"value":15184},"\"Step ",{"type":21,"tag":2314,"props":15186,"children":15187},{"style":2339},[15188],{"type":26,"value":3292},{"type":21,"tag":2314,"props":15190,"children":15191},{"style":2321},[15192],{"type":26,"value":15193},"step",{"type":21,"tag":2314,"props":15195,"children":15196},{"style":3157},[15197],{"type":26,"value":12911},{"type":21,"tag":2314,"props":15199,"children":15200},{"style":2339},[15201],{"type":26,"value":3302},{"type":21,"tag":2314,"props":15203,"children":15204},{"style":2350},[15205],{"type":26,"value":15206}," | cost ",{"type":21,"tag":2314,"props":15208,"children":15209},{"style":2339},[15210],{"type":26,"value":3292},{"type":21,"tag":2314,"props":15212,"children":15213},{"style":2321},[15214],{"type":26,"value":15215},"cost(weights, bias, X_train, y_train)",{"type":21,"tag":2314,"props":15217,"children":15218},{"style":3157},[15219],{"type":26,"value":3604},{"type":21,"tag":2314,"props":15221,"children":15222},{"style":2339},[15223],{"type":26,"value":3302},{"type":21,"tag":2314,"props":15225,"children":15226},{"style":2350},[15227],{"type":26,"value":15228}," | acc ",{"type":21,"tag":2314,"props":15230,"children":15231},{"style":2339},[15232],{"type":26,"value":3292},{"type":21,"tag":2314,"props":15234,"children":15235},{"style":2321},[15236],{"type":26,"value":15237},"acc",{"type":21,"tag":2314,"props":15239,"children":15240},{"style":3157},[15241],{"type":26,"value":15242},":.3f",{"type":21,"tag":2314,"props":15244,"children":15245},{"style":2339},[15246],{"type":26,"value":3302},{"type":21,"tag":2314,"props":15248,"children":15249},{"style":2350},[15250],{"type":26,"value":3307},{"type":21,"tag":2314,"props":15252,"children":15253},{"style":2321},[15254],{"type":26,"value":3257},{"type":21,"tag":2314,"props":15256,"children":15258},{"class":2316,"line":15257},55,[15259],{"type":21,"tag":2314,"props":15260,"children":15261},{"emptyLinePlaceholder":3181},[15262],{"type":26,"value":3184},{"type":21,"tag":2314,"props":15264,"children":15266},{"class":2316,"line":15265},56,[15267,15272,15276,15280,15284,15288,15292],{"type":21,"tag":2314,"props":15268,"children":15269},{"style":2321},[15270],{"type":26,"value":15271},"test_preds ",{"type":21,"tag":2314,"props":15273,"children":15274},{"style":3157},[15275],{"type":26,"value":3197},{"type":21,"tag":2314,"props":15277,"children":15278},{"style":2321},[15279],{"type":26,"value":15119},{"type":21,"tag":2314,"props":15281,"children":15282},{"style":3157},[15283],{"type":26,"value":3450},{"type":21,"tag":2314,"props":15285,"children":15286},{"style":2321},[15287],{"type":26,"value":12684},{"type":21,"tag":2314,"props":15289,"children":15290},{"style":3157},[15291],{"type":26,"value":3460},{"type":21,"tag":2314,"props":15293,"children":15294},{"style":2321},[15295],{"type":26,"value":15296}," X_test]\n",{"type":21,"tag":2314,"props":15298,"children":15300},{"class":2316,"line":15299},57,[15301,15305,15309,15313,15317,15322,15327,15331,15336,15340,15345,15349,15353,15357],{"type":21,"tag":2314,"props":15302,"children":15303},{"style":2339},[15304],{"type":26,"value":3272},{"type":21,"tag":2314,"props":15306,"children":15307},{"style":2321},[15308],{"type":26,"value":3277},{"type":21,"tag":2314,"props":15310,"children":15311},{"style":3157},[15312],{"type":26,"value":3282},{"type":21,"tag":2314,"props":15314,"children":15315},{"style":2350},[15316],{"type":26,"value":3307},{"type":21,"tag":2314,"props":15318,"children":15319},{"style":2339},[15320],{"type":26,"value":15321},"\\n",{"type":21,"tag":2314,"props":15323,"children":15324},{"style":2350},[15325],{"type":26,"value":15326},"Test accuracy: ",{"type":21,"tag":2314,"props":15328,"children":15329},{"style":2339},[15330],{"type":26,"value":3292},{"type":21,"tag":2314,"props":15332,"children":15333},{"style":2321},[15334],{"type":26,"value":15335},"np.mean(np.array(test_preds) ",{"type":21,"tag":2314,"props":15337,"children":15338},{"style":3157},[15339],{"type":26,"value":4863},{"type":21,"tag":2314,"props":15341,"children":15342},{"style":2321},[15343],{"type":26,"value":15344}," y_test)",{"type":21,"tag":2314,"props":15346,"children":15347},{"style":3157},[15348],{"type":26,"value":15242},{"type":21,"tag":2314,"props":15350,"children":15351},{"style":2339},[15352],{"type":26,"value":3302},{"type":21,"tag":2314,"props":15354,"children":15355},{"style":2350},[15356],{"type":26,"value":3307},{"type":21,"tag":2314,"props":15358,"children":15359},{"style":2321},[15360],{"type":26,"value":3257},{"type":21,"tag":22,"props":15362,"children":15363},{},[15364,15366,15372],{"type":26,"value":15365},"Running it (PennyLane 0.45, ",{"type":21,"tag":2073,"props":15367,"children":15369},{"className":15368},[],[15370],{"type":26,"value":15371},"default.qubit",{"type":26,"value":15373},") gives:",{"type":21,"tag":2304,"props":15375,"children":15378},{"className":15376,"code":15377,"language":26,"meta":7,"style":7},"language-text shiki shiki-themes github-dark","Step  0 | cost 1.6158 | acc 0.336\nStep 15 | cost 0.6775 | acc 0.764\nStep 30 | cost 0.6466 | acc 0.779\nStep 45 | cost 0.6372 | acc 0.850\n\nTest accuracy: 0.817\n",[15379],{"type":21,"tag":2073,"props":15380,"children":15381},{"__ignoreMap":7},[15382,15390,15398,15406,15414,15421],{"type":21,"tag":2314,"props":15383,"children":15384},{"class":2316,"line":2317},[15385],{"type":21,"tag":2314,"props":15386,"children":15387},{},[15388],{"type":26,"value":15389},"Step  0 | cost 1.6158 | acc 0.336\n",{"type":21,"tag":2314,"props":15391,"children":15392},{"class":2316,"line":106},[15393],{"type":21,"tag":2314,"props":15394,"children":15395},{},[15396],{"type":26,"value":15397},"Step 15 | cost 0.6775 | acc 0.764\n",{"type":21,"tag":2314,"props":15399,"children":15400},{"class":2316,"line":2335},[15401],{"type":21,"tag":2314,"props":15402,"children":15403},{},[15404],{"type":26,"value":15405},"Step 30 | cost 0.6466 | acc 0.779\n",{"type":21,"tag":2314,"props":15407,"children":15408},{"class":2316,"line":2397},[15409],{"type":21,"tag":2314,"props":15410,"children":15411},{},[15412],{"type":26,"value":15413},"Step 45 | cost 0.6372 | acc 0.850\n",{"type":21,"tag":2314,"props":15415,"children":15416},{"class":2316,"line":2421},[15417],{"type":21,"tag":2314,"props":15418,"children":15419},{"emptyLinePlaceholder":3181},[15420],{"type":26,"value":3184},{"type":21,"tag":2314,"props":15422,"children":15423},{"class":2316,"line":16},[15424],{"type":21,"tag":2314,"props":15425,"children":15426},{},[15427],{"type":26,"value":15428},"Test accuracy: 0.817\n",{"type":21,"tag":22,"props":15430,"children":15431},{},[15432,15434,15439],{"type":26,"value":15433},"So it trains, and 82% on two moons is respectable. It is also worth noting what it doesn't do: an RBF-kernel SVM from scikit-learn scores ",{"type":21,"tag":136,"props":15435,"children":15436},{},[15437],{"type":26,"value":15438},"0.983",{"type":26,"value":15440}," on the identical split, and fits in under a millisecond on your laptop. That comparison isn't a criticism of the code. It's the honest baseline that a lot of QML demos quietly omit.",{"type":21,"tag":22,"props":15442,"children":15443},{},[15444,15446,15452,15454,15458],{"type":26,"value":15445},"Try scaling it. Push ",{"type":21,"tag":2073,"props":15447,"children":15449},{"className":15448},[],[15450],{"type":26,"value":15451},"n_qubits",{"type":26,"value":15453}," up, widen the ansatz, and watch the gradients shrink. You reproduce the barren-plateau effect on a ",{"type":21,"tag":46,"props":15455,"children":15456},{"href":408},[15457],{"type":26,"value":3243},{"type":26,"value":15459}," in an afternoon, which is a far better education than reading about it.",{"type":21,"tag":29,"props":15461,"children":15463},{"id":15462},"whats-genuinely-promising",[15464],{"type":26,"value":15465},"What's genuinely promising",{"type":21,"tag":22,"props":15467,"children":15468},{},[15469],{"type":26,"value":15470},"None of the above means QML is a dead end. Three directions look genuinely worth pursuing, and they share a feature: they avoid the problems above rather than hoping to power through them.",{"type":21,"tag":22,"props":15472,"children":15473},{},[15474,15479,15481,15486,15488,15492],{"type":21,"tag":136,"props":15475,"children":15476},{},[15477],{"type":26,"value":15478},"Quantum data instead of classical data.",{"type":26,"value":15480}," The data-loading bottleneck exists because we're forcing classical numbers into quantum states. If your data is ",{"type":21,"tag":362,"props":15482,"children":15483},{},[15484],{"type":26,"value":15485},"already quantum",{"type":26,"value":15487}," (states produced by a physics experiment, molecular ground states, outputs of a quantum sensor), there's nothing to load. Learning tasks on quantum data have the cleanest theoretical case for advantage, and unlike most QML claims, the argument survives scrutiny. This overlaps heavily with where quantum computing is delivering results generally: physics and chemistry, not business analytics. Our ",{"type":21,"tag":46,"props":15489,"children":15490},{"href":11459},[15491],{"type":26,"value":11462},{"type":26,"value":15493}," covers the distinction.",{"type":21,"tag":22,"props":15495,"children":15496},{},[15497,15502],{"type":21,"tag":136,"props":15498,"children":15499},{},[15500],{"type":26,"value":15501},"Quantum kernels for structured data.",{"type":26,"value":15503}," Because the quantum device only computes similarities, kernel methods sidestep barren plateaus entirely. There's no deep variational terrain to descend. For data with structure that maps naturally onto a quantum feature space (group-theoretic structure, certain periodic problems), there are constructed examples with provable separations. The honest caveat is that these are usually engineered problems rather than datasets anyone had lying around.",{"type":21,"tag":22,"props":15505,"children":15506},{},[15507,15512],{"type":21,"tag":136,"props":15508,"children":15509},{},[15510],{"type":26,"value":15511},"Noise filtering.",{"type":26,"value":15513}," Notably, the Yu et al. comparison that found quantum models losing on every headline metric also identified noise filtering and false-positive control as areas where quantum approaches still looked promising. That's a narrow, specific niche, and narrow, specific niches are how technologies gain footholds.",{"type":21,"tag":29,"props":15515,"children":15517},{"id":15516},"where-this-leaves-you",[15518],{"type":26,"value":15519},"Where this leaves you",{"type":21,"tag":22,"props":15521,"children":15522},{},[15523,15525,15529,15530,15534],{"type":26,"value":15524},"If you're learning quantum computing, QML is still worth your time, only for the right reasons. The techniques transfer. Data encoding, ansatz design, gradient estimation, and the hybrid loop are the same skills that ",{"type":21,"tag":46,"props":15526,"children":15527},{"href":292},[15528],{"type":26,"value":282},{"type":26,"value":904},{"type":21,"tag":46,"props":15531,"children":15532},{"href":2029},[15533],{"type":26,"value":2018},{"type":26,"value":15535}," need, and those have clearer near-term paths. Learning QML makes you better at variational quantum computing generally.",{"type":21,"tag":22,"props":15537,"children":15538},{},[15539,15541,15546],{"type":26,"value":15540},"What to avoid is building a business case on a speedup that hasn't been demonstrated. The same discipline applies here as in ",{"type":21,"tag":46,"props":15542,"children":15543},{"href":674},[15544],{"type":26,"value":15545},"benchmarking hardware claims",{"type":26,"value":15547},": ask what the classical baseline was, ask whether data loading was counted, ask how many qubits the result scales to.",{"type":21,"tag":22,"props":15549,"children":15550},{},[15551,15556],{"type":21,"tag":46,"props":15552,"children":15553},{"href":8707},[15554],{"type":26,"value":15555},"Preskill's NISQ paper",{"type":26,"value":15557}," set the tone for this kind of honesty about near-term devices, and it has aged well precisely because it under-promised. QML would benefit from the same posture.",{"type":21,"tag":22,"props":15559,"children":15560},{},[15561,15563,15568,15570,15574],{"type":26,"value":15562},"The field is more interesting when you stop needing it to be revolutionary. Start with the ",{"type":21,"tag":46,"props":15564,"children":15565},{"href":14023},[15566],{"type":26,"value":15567},"PennyLane SDK guide",{"type":26,"value":15569},", keep the ",{"type":21,"tag":46,"props":15571,"children":15572},{"href":3917},[15573],{"type":26,"value":9281},{"type":26,"value":15575}," open, and run the experiments yourself. The evidence is more useful than the pitch.",{"type":21,"tag":2688,"props":15577,"children":15578},{},[15579],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":15581},[15582,15583,15584,15585,15586,15587,15588],{"id":13766,"depth":106,"text":13769},{"id":13844,"depth":106,"text":13847},{"id":13889,"depth":106,"text":13892},{"id":13935,"depth":106,"text":13938},{"id":14012,"depth":106,"text":14015},{"id":15462,"depth":106,"text":15465},{"id":15516,"depth":106,"text":15519},"content:blog:quantum-machine-learning-reality-check.md","blog\u002Fquantum-machine-learning-reality-check.md","blog\u002Fquantum-machine-learning-reality-check",{"_path":858,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":15593,"description":15594,"date":3032,"author":11,"tags":15595,"readingTime":1364,"body":15596,"_type":111,"_id":15970,"_source":113,"_file":15971,"_stem":15972,"_extension":116},"Quantum Networking and Distributed Quantum Computing: Wiring QPUs Together","Building one enormous quantum processor gets harder the bigger it gets. Linking smaller ones is the alternative, and it depends on distributing entanglement between machines, which is far harder than it sounds.",[13,8843,14],{"type":18,"children":15597,"toc":15961},[15598,15603,15608,15628,15633,15639,15644,15654,15685,15695,15700,15706,15711,15722,15727,15757,15775,15781,15793,15798,15810,15815,15821,15826,15831,15836,15847,15853,15858,15867,15884,15895,15901,15906,15911,15916,15921,15927,15932,15949],{"type":21,"tag":22,"props":15599,"children":15600},{},[15601],{"type":26,"value":15602},"There is a ceiling problem in quantum hardware that doesn't get discussed as often as qubit counts do.",{"type":21,"tag":22,"props":15604,"children":15605},{},[15606],{"type":26,"value":15607},"Every approach to building a quantum processor gets harder as the device grows. Superconducting chips need a control line for essentially every qubit, and those lines carry heat into a dilution refrigerator that has a finite cooling budget. Trapped-ion chains get slower and more fragile as you add ions to a single trap. Crosstalk between neighbouring qubits rises with density. Fabrication yield (the probability that every qubit on a chip is good) falls off a cliff as area increases. None of these are fundamental physics barriers. They are engineering walls, and engineering walls have a habit of arriving sooner than expected.",{"type":21,"tag":22,"props":15609,"children":15610},{},[15611,15613,15619,15621,15626],{"type":26,"value":15612},"The alternative is the one classical computing took decades ago: stop building one bigger machine and start connecting smaller ones. That is what ",{"type":21,"tag":46,"props":15614,"children":15616},{"href":15615},"\u002Fglossary\u002Fdistributed-quantum-computing",[15617],{"type":26,"value":15618},"distributed quantum computing",{"type":26,"value":15620}," means, and it is why quantum networking has moved from a communications curiosity to a scaling strategy. When we ",{"type":21,"tag":46,"props":15622,"children":15623},{"href":674},[15624],{"type":26,"value":15625},"read EO 14413 as a technical document",{"type":26,"value":15627},", distributed quantum computing showed up as a named five-year planning target, which is a fairly direct admission that nobody is confident the single-big-chip route gets all the way there.",{"type":21,"tag":22,"props":15629,"children":15630},{},[15631],{"type":26,"value":15632},"The catch is that connecting quantum computers is nothing like connecting classical ones.",{"type":21,"tag":29,"props":15634,"children":15636},{"id":15635},"three-different-things-people-call-quantum-networking",[15637],{"type":26,"value":15638},"Three different things people call \"quantum networking\"",{"type":21,"tag":22,"props":15640,"children":15641},{},[15642],{"type":26,"value":15643},"Before anything else, a disambiguation, because these get conflated constantly and the confusion makes most coverage of the topic unreadable.",{"type":21,"tag":22,"props":15645,"children":15646},{},[15647,15652],{"type":21,"tag":136,"props":15648,"children":15649},{},[15650],{"type":26,"value":15651},"(a) Quantum networking for distributed computation.",{"type":26,"value":15653}," Linking two or more QPUs with a quantum channel so they behave as one larger computer. Quantum information genuinely moves between them. This is the subject of this post.",{"type":21,"tag":22,"props":15655,"children":15656},{},[15657,15662,15664,15669,15671,15677,15679,15683],{"type":21,"tag":136,"props":15658,"children":15659},{},[15660],{"type":26,"value":15661},"(b) Quantum key distribution and the \"quantum internet.\"",{"type":26,"value":15663}," Using quantum states to establish a shared secret key whose security rests on physics rather than on computational hardness. This is a ",{"type":21,"tag":362,"props":15665,"children":15666},{},[15667],{"type":26,"value":15668},"communications security",{"type":26,"value":15670}," technology, descending from ",{"type":21,"tag":46,"props":15672,"children":15674},{"href":15673},"\u002Fresearch\u002Fbennett-brassard-bb84-1984",[15675],{"type":26,"value":15676},"Bennett and Brassard's BB84 protocol",{"type":26,"value":15678},". It does not make any computer faster. It's also frequently misrepresented as the answer to the quantum threat against public-key cryptography. In practice that threat is being addressed by ",{"type":21,"tag":46,"props":15680,"children":15681},{"href":9333},[15682],{"type":26,"value":9316},{"type":26,"value":15684},", which is software you deploy today, not hardware that needs new fibre.",{"type":21,"tag":22,"props":15686,"children":15687},{},[15688,15693],{"type":21,"tag":136,"props":15689,"children":15690},{},[15691],{"type":26,"value":15692},"(c) Classical networking of quantum computers.",{"type":26,"value":15694}," Running one circuit on a QPU in Maryland from a laptop in Berlin. This is what every cloud quantum service already does. It is ordinary TCP\u002FIP carrying circuit descriptions and measurement results, and nothing quantum crosses the wire.",{"type":21,"tag":22,"props":15696,"children":15697},{},[15698],{"type":26,"value":15699},"Press releases blur (a) and (c) especially often. If a headline says \"networked quantum computers\" and the mechanism is an API, it's (c).",{"type":21,"tag":29,"props":15701,"children":15703},{"id":15702},"why-you-cannot-simply-amplify-a-qubit",[15704],{"type":26,"value":15705},"Why you cannot simply amplify a qubit",{"type":21,"tag":22,"props":15707,"children":15708},{},[15709],{"type":26,"value":15710},"Classical networking works because signals are copied. A repeater reads a degraded bit, decides whether it was a 0 or a 1, and transmits a fresh clean copy. Errors are stripped out at every hop, which is why a fibre link spans an ocean.",{"type":21,"tag":22,"props":15712,"children":15713},{},[15714,15716,15720],{"type":26,"value":15715},"Quantum information forbids this. The no-cloning theorem says there is no operation that duplicates an arbitrary unknown quantum state. There is no such thing as reading a qubit to see what it is and sending a fresh one, because measurement collapses the state and destroys the ",{"type":21,"tag":46,"props":15717,"children":15718},{"href":8807},[15719],{"type":26,"value":8810},{"type":26,"value":15721}," you were trying to preserve. A quantum repeater that worked like a classical repeater would be a quantum repeater that deletes your data.",{"type":21,"tag":22,"props":15723,"children":15724},{},[15725],{"type":26,"value":15726},"Meanwhile the physical channel is brutally lossy. Photons in optical fibre attenuate exponentially with distance, and unlike classical light you can't compensate by turning up the power. A single photon either arrives or it doesn't. Beyond a few hundred kilometres, the odds of a photon surviving the trip get small enough that you'd wait a long time for one success.",{"type":21,"tag":22,"props":15728,"children":15729},{},[15730,15732,15740,15742,15747,15749,15755],{"type":26,"value":15731},"Quantum repeaters solve this by a genuinely different mechanism. Rather than relaying the qubit, they relay ",{"type":21,"tag":362,"props":15733,"children":15734},{},[15735],{"type":21,"tag":46,"props":15736,"children":15737},{"href":3803},[15738],{"type":26,"value":15739},"entanglement",{"type":26,"value":15741},". Split a long link into short segments. Establish an entangled pair across each segment independently: short hops, so the loss per hop is manageable, and success is heralded, meaning you know when it worked and simply retry when it didn't. Then perform ",{"type":21,"tag":136,"props":15743,"children":15744},{},[15745],{"type":26,"value":15746},"entanglement swapping",{"type":26,"value":15748},": at each intermediate node, jointly measure the two local halves of two adjacent pairs in the ",{"type":21,"tag":46,"props":15750,"children":15752},{"href":15751},"\u002Fglossary\u002Fbell-state",[15753],{"type":26,"value":15754},"Bell basis",{"type":26,"value":15756},". That measurement consumes both short pairs and leaves the two far-end qubits entangled with each other, despite never having interacted. Chain this along the route and you have entanglement spanning the whole distance.",{"type":21,"tag":22,"props":15758,"children":15759},{},[15760,15762,15766,15768,15773],{"type":26,"value":15761},"The ingredients this demands are exactly the hard parts: heralded entanglement generation, quantum memories that hold a half-pair coherently while the neighbouring segment keeps retrying, and some form of purification or error correction to keep ",{"type":21,"tag":46,"props":15763,"children":15764},{"href":8967},[15765],{"type":26,"value":8970},{"type":26,"value":15767}," from degrading across hops. ",{"type":21,"tag":46,"props":15769,"children":15770},{"href":8883},[15771],{"type":26,"value":15772},"Decoherence",{"type":26,"value":15774}," in the memory sets a hard clock on the whole procedure. If a stored qubit dies while its partner segment is still failing, the attempt is wasted.",{"type":21,"tag":29,"props":15776,"children":15778},{"id":15777},"teleportation-is-the-transport-primitive",[15779],{"type":26,"value":15780},"Teleportation is the transport primitive",{"type":21,"tag":22,"props":15782,"children":15783},{},[15784,15786,15791],{"type":26,"value":15785},"Once two nodes share an entangled pair, moving an actual qubit between them is a solved protocol: ",{"type":21,"tag":46,"props":15787,"children":15788},{"href":3795},[15789],{"type":26,"value":15790},"quantum teleportation",{"type":26,"value":15792},", from Bennett and colleagues in 1993.",{"type":21,"tag":22,"props":15794,"children":15795},{},[15796],{"type":26,"value":15797},"The sender performs a joint measurement on the qubit to be transmitted and their half of the entangled pair, obtaining two classical bits. Those bits are sent over an ordinary classical channel. The receiver applies one of four corrections determined by those bits, and their half of the pair becomes the original state. One entangled pair and two classical bits per qubit transported.",{"type":21,"tag":22,"props":15799,"children":15800},{},[15801,15803,15808],{"type":26,"value":15802},"Two consequences are worth stating explicitly because both get mangled in popular coverage. First, the original state is destroyed by the sender's measurement. Teleportation moves a qubit, it does not copy one, which is precisely how it stays consistent with no-cloning. Second, ",{"type":21,"tag":136,"props":15804,"children":15805},{},[15806],{"type":26,"value":15807},"the classical channel is mandatory",{"type":26,"value":15809},". Without those two bits the receiver's qubit is in a completely random state and useless. Entanglement alone signals nothing. Nothing travels faster than light, and no amount of entanglement between two labs lets them communicate without a conventional link.",{"type":21,"tag":22,"props":15811,"children":15812},{},[15813],{"type":26,"value":15814},"That second point is the whole reason quantum networks are not a physics loophole. They are a way to move fragile information, not a way to move it instantly.",{"type":21,"tag":29,"props":15816,"children":15818},{"id":15817},"the-interconnect-is-the-bottleneck",[15819],{"type":26,"value":15820},"The interconnect is the bottleneck",{"type":21,"tag":22,"props":15822,"children":15823},{},[15824],{"type":26,"value":15825},"Now the engineering reality of stitching QPUs together.",{"type":21,"tag":22,"props":15827,"children":15828},{},[15829],{"type":26,"value":15830},"Inside a single processor, two-qubit gates take microseconds or less and land fidelities that, on good hardware, exceed 99.9%. Between two processors, you must first generate a shared entangled pair over a photonic link (a probabilistic, lossy process) and only then teleport a gate or a qubit across it. Inter-node entanglement generation is currently orders of magnitude slower than local gates, and arrives at meaningfully lower fidelity.",{"type":21,"tag":22,"props":15832,"children":15833},{},[15834],{"type":26,"value":15835},"This changes how you have to think about programming such a machine. A distributed QPU is not a flat pool of qubits. It is a strongly non-uniform architecture where some pairs of qubits are cheap to entangle and others are extremely expensive, and where the expensive operations also happen to be the noisy ones. Circuit compilers have to partition algorithms to minimise cross-node operations, in much the same spirit as minimising communication in classical HPC, except the penalty for getting it wrong is not only latency but error accumulation. And because entanglement must be produced faster than the memories holding it decohere, a slow interconnect doesn't merely reduce throughput. Past a certain point it stops working at all.",{"type":21,"tag":22,"props":15837,"children":15838},{},[15839,15841,15845],{"type":26,"value":15840},"There is a genuinely appealing upside, though, and it's the reason serious people pursue this: ",{"type":21,"tag":46,"props":15842,"children":15843},{"href":150},[15844],{"type":26,"value":1034},{"type":26,"value":15846}," needs physical qubit counts in the millions for useful algorithms, and no one has a credible plan to put a million high-quality qubits in one enclosure. Modularity is one of the few routes to that number that doesn't require a single manufacturing miracle.",{"type":21,"tag":29,"props":15848,"children":15850},{"id":15849},"modality-matters-here-more-than-usual",[15851],{"type":26,"value":15852},"Modality matters here more than usual",{"type":21,"tag":22,"props":15854,"children":15855},{},[15856],{"type":26,"value":15857},"The photonic interface is where hardware platforms diverge sharply.",{"type":21,"tag":22,"props":15859,"children":15860},{},[15861,15865],{"type":21,"tag":136,"props":15862,"children":15863},{},[15864],{"type":26,"value":9111},{"type":26,"value":15866}," have a natural optical interface. An ion is excited with a laser and made to emit a single photon whose polarisation or frequency is entangled with the ion's internal state. The qubit is already coupled to light at optical wavelengths that fibre transmits well. IonQ argues that this photonic compatibility was a central reason it chose trapped ions in the first place, and that the platform is particularly suited to multi-QPU networking. That is an architectural argument from a vendor whose commercial strategy depends on modular scaling, and should be read as advocacy rather than a neutral survey, but the underlying physics of atom-photon coupling is standard, well-studied quantum optics and is not in dispute.",{"type":21,"tag":22,"props":15868,"children":15869},{},[15870,15875,15877,15882],{"type":21,"tag":136,"props":15871,"children":15872},{},[15873],{"type":26,"value":15874},"Superconducting qubits",{"type":26,"value":15876}," face a harder problem. They operate at microwave frequencies inside a millikelvin refrigerator, and microwave photons cannot travel any meaningful distance at room temperature. Thermal noise swamps them. Networking them optically requires ",{"type":21,"tag":136,"props":15878,"children":15879},{},[15880],{"type":26,"value":15881},"microwave-to-optical transduction",{"type":26,"value":15883},": coherently converting a gigahertz photon into a telecom-wavelength one without destroying the quantum state. This is an active and legitimate research field, with electro-optic, optomechanical, magneto-optic and atomic-ensemble approaches all under investigation, but efficiency and added noise remain the limiting factors. IonQ makes this contrast a talking point, characterising the conversion process as slow and not yet well matched to quantum computers. The general difficulty is widely acknowledged in the literature, though the framing is naturally sharper coming from a competitor. NIST, among others, is building optical channels for remote microwave entanglement precisely because the problem is considered tractable rather than hopeless.",{"type":21,"tag":22,"props":15885,"children":15886},{},[15887,15889,15893],{"type":26,"value":15888},"Neutral atoms sit closer to the ion story optically. Photonic qubits are their own case, since the information is already in flight. Our ",{"type":21,"tag":46,"props":15890,"children":15891},{"href":212},[15892],{"type":26,"value":9128},{"type":26,"value":15894}," covers the broader trade-offs.",{"type":21,"tag":29,"props":15896,"children":15898},{"id":15897},"where-this-stands",[15899],{"type":26,"value":15900},"Where this stands",{"type":21,"tag":22,"props":15902,"children":15903},{},[15904],{"type":26,"value":15905},"Plainly: early.",{"type":21,"tag":22,"props":15907,"children":15908},{},[15909],{"type":26,"value":15910},"The building blocks are real. Ion-photon entanglement (the first milestone, where a photon leaves a trapped ion carrying entanglement with it) has been demonstrated, and IonQ reports having done so outside an academic setting. Remote ion-ion entanglement has followed, with IonQ describing a setup that collects photons from two separate trap wells, interferes them at a shared detection hub, and leaves the two distant ions entangled. IonQ frames these as the first and second of four milestones on its own roadmap to photonic interconnects, with the remaining two being the transfer of that remote entanglement onto computation qubits via swap gates, and programmable multi-QPU entanglement using single-photon switching. In 2026 the company announced it had photonically interconnected two independent trapped-ion systems.",{"type":21,"tag":22,"props":15912,"children":15913},{},[15914],{"type":26,"value":15915},"Read those carefully. They are milestone announcements on a vendor's internal roadmap, and the public write-ups notably do not disclose entanglement rates, fidelities, or success probabilities: the numbers that would let anyone judge whether the link is fast and clean enough to compute across. IonQ itself acknowledges low entanglement rates as a current limitation. Its broader case (that networking is what carries quantum computing from research demos to commercial scale, and that modular systems are faster to build and easier to service than monolithic ones) is a coherent argument, but it is a company describing why its own architecture wins.",{"type":21,"tag":22,"props":15917,"children":15918},{},[15919],{"type":26,"value":15920},"What is not in doubt is that the demonstrated capability sits far below what distributed computing requires. Getting two qubits in different traps entangled occasionally is a real physics achievement. Sustaining entanglement generation at rates and fidelities that let two processors execute a single fault-tolerant algorithm together is a different order of problem, and nobody has done it.",{"type":21,"tag":29,"props":15922,"children":15924},{"id":15923},"the-takeaway",[15925],{"type":26,"value":15926},"The takeaway",{"type":21,"tag":22,"props":15928,"children":15929},{},[15930],{"type":26,"value":15931},"Quantum networking is not a faster internet and not a security product, though it shares physics with one. It is a proposed answer to a hardware scaling wall, built on entanglement distribution, entanglement swapping, and teleportation, all constrained by the fact that quantum information cannot be copied and therefore cannot be amplified.",{"type":21,"tag":22,"props":15933,"children":15934},{},[15935,15937,15942,15943,15947],{"type":26,"value":15936},"If you're evaluating claims in this space, three questions do most of the work. Is the link genuinely quantum, or is it an API? What is the entanglement generation ",{"type":21,"tag":362,"props":15938,"children":15939},{},[15940],{"type":26,"value":15941},"rate",{"type":26,"value":904},{"type":21,"tag":362,"props":15944,"children":15945},{},[15946],{"type":26,"value":8970},{"type":26,"value":15948}," between nodes, not whether entanglement was achieved once? And is the demonstration between two nodes in adjacent racks, or over a distance where photon loss genuinely bites?",{"type":21,"tag":22,"props":15950,"children":15951},{},[15952,15954,15959],{"type":26,"value":15953},"Answers to those tend to be absent from the announcements, which is itself informative. The ",{"type":21,"tag":46,"props":15955,"children":15957},{"href":15956},"\u002Fglossary\u002Fquantum-network",[15958],{"type":26,"value":9281},{"type":26,"value":15960}," covers the vocabulary if you want to read the primary sources yourself.",{"title":7,"searchDepth":106,"depth":106,"links":15962},[15963,15964,15965,15966,15967,15968,15969],{"id":15635,"depth":106,"text":15638},{"id":15702,"depth":106,"text":15705},{"id":15777,"depth":106,"text":15780},{"id":15817,"depth":106,"text":15820},{"id":15849,"depth":106,"text":15852},{"id":15897,"depth":106,"text":15900},{"id":15923,"depth":106,"text":15926},"content:blog:quantum-networking-distributed-computing.md","blog\u002Fquantum-networking-distributed-computing.md","blog\u002Fquantum-networking-distributed-computing",{"_path":15974,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":15975,"description":15976,"date":3032,"author":11,"tags":15977,"readingTime":3413,"body":15978,"_type":111,"_id":18072,"_source":113,"_file":18073,"_stem":18074,"_extension":116},"\u002Fblog\u002Fquantum-phase-estimation-tutorial","Quantum Phase Estimation: The Missing Link Between the QFT and Shor's Algorithm","A hands-on Qiskit tutorial on quantum phase estimation: phase kickback, the inverse QFT, and precision limits, with complete runnable code and real measured output.",[7102,1363,15],{"type":18,"children":15979,"toc":18060},[15980,15998,16016,16021,16029,16035,16040,16048,16053,16064,16103,16108,16120,16126,16131,16142,16150,16174,16182,16192,16197,16205,16225,16231,16242,16247,16257,16262,16290,16294,16330,17280,17284,17292,17302,17310,17315,17322,17354,17367,17375,17395,17400,17406,17411,17655,17659,17667,17679,17691,17699,17711,17723,17729,17752,17769,17797,17895,17919,17925,17936,17947,17989,17994,17999,18056],{"type":21,"tag":22,"props":15981,"children":15982},{},[15983,15985,15990,15992,15996],{"type":26,"value":15984},"Our ",{"type":21,"tag":46,"props":15986,"children":15987},{"href":11479},[15988],{"type":26,"value":15989},"QFT tutorial",{"type":26,"value":15991}," ended on a deliberately unsatisfying note: the ",{"type":21,"tag":46,"props":15993,"children":15994},{"href":11491},[15995],{"type":26,"value":11494},{"type":26,"value":15997}," is fast, exact, and useless on its own. You can't load its input efficiently and you can't read its output. Measure a transformed basis state and you get a uniformly random bitstring.",{"type":21,"tag":22,"props":15999,"children":16000},{},[16001,16003,16007,16009,16014],{"type":26,"value":16002},"This post is the sequel that resolves that. Quantum phase estimation (QPE) is the machine that turns the ",{"type":21,"tag":362,"props":16004,"children":16005},{},[16006],{"type":26,"value":6933},{"type":26,"value":16008}," QFT into a readout primitive. It's the reason the QFT matters, and it is the algorithm sitting underneath ",{"type":21,"tag":46,"props":16010,"children":16011},{"href":9582},[16012],{"type":26,"value":16013},"Shor's",{"type":26,"value":16015},": Shor's is QPE applied to modular exponentiation, plus number theory.",{"type":21,"tag":22,"props":16017,"children":16018},{},[16019],{"type":26,"value":16020},"Read the QFT post first if you haven't. This one assumes the construction and won't rebuild it.",{"type":21,"tag":22,"props":16022,"children":16023},{},[16024],{"type":21,"tag":136,"props":16025,"children":16026},{},[16027],{"type":26,"value":16028},"All code below was executed against Qiskit 2.5.0 and Qiskit Aer 0.17.2 on Python 3.11. The outputs shown are real.",{"type":21,"tag":29,"props":16030,"children":16032},{"id":16031},"the-problem-qpe-solves",[16033],{"type":26,"value":16034},"The problem QPE solves",{"type":21,"tag":22,"props":16036,"children":16037},{},[16038],{"type":26,"value":16039},"Given a unitary U and an eigenstate |ψ⟩ satisfying",{"type":21,"tag":2304,"props":16041,"children":16043},{"code":16042},"U|ψ⟩ = e^{2πiθ} |ψ⟩\n",[16044],{"type":21,"tag":2073,"props":16045,"children":16046},{"__ignoreMap":7},[16047],{"type":26,"value":16042},{"type":21,"tag":22,"props":16049,"children":16050},{},[16051],{"type":26,"value":16052},"estimate θ ∈ [0, 1).",{"type":21,"tag":22,"props":16054,"children":16055},{},[16056,16058,16063],{"type":26,"value":16057},"That sounds like a linear-algebra exercise, not an application. It is in fact one of the most consequential problems in the field, because ",{"type":21,"tag":362,"props":16059,"children":16060},{},[16061],{"type":26,"value":16062},"enormous numbers of questions are secretly eigenvalue questions",{"type":26,"value":12371},{"type":21,"tag":3080,"props":16065,"children":16066},{},[16067,16077,16087],{"type":21,"tag":3084,"props":16068,"children":16069},{},[16070,16075],{"type":21,"tag":136,"props":16071,"children":16072},{},[16073],{"type":26,"value":16074},"What is a molecule's ground-state energy?",{"type":26,"value":16076}," Build U = e^{-iHt} for the molecular Hamiltonian H. Its eigenphases are the energy levels. Estimating θ estimates the energy.",{"type":21,"tag":3084,"props":16078,"children":16079},{},[16080,16085],{"type":21,"tag":136,"props":16081,"children":16082},{},[16083],{"type":26,"value":16084},"What is the order of a mod N?",{"type":26,"value":16086}," Build U|y⟩ = |ay mod N⟩. Its eigenphases are multiples of 1\u002Fr where r is the order. Estimating θ gives you r, and factoring falls out.",{"type":21,"tag":3084,"props":16088,"children":16089},{},[16090,16095,16097,16102],{"type":21,"tag":136,"props":16091,"children":16092},{},[16093],{"type":26,"value":16094},"How many solutions does an oracle mark?",{"type":26,"value":16096}," Amplitude estimation is QPE on the Grover operator, whose eigenphase encodes the count. That's the quantum-counting subroutine we flagged as a missing piece in the ",{"type":21,"tag":46,"props":16098,"children":16099},{"href":7098},[16100],{"type":26,"value":16101},"Grover tutorial",{"type":26,"value":761},{"type":21,"tag":22,"props":16104,"children":16105},{},[16106],{"type":26,"value":16107},"One primitive, three flagship algorithms. That's why \"estimate an eigenphase\" is worth a dedicated circuit.",{"type":21,"tag":22,"props":16109,"children":16110},{},[16111,16113,16118],{"type":26,"value":16112},"Note the precondition, which people gloss over: you need to ",{"type":21,"tag":362,"props":16114,"children":16115},{},[16116],{"type":26,"value":16117},"have",{"type":26,"value":16119}," the eigenstate |ψ⟩, or at least a state with decent overlap with it. Preparing good eigenstates is its own hard problem, and in chemistry it's often the binding constraint.",{"type":21,"tag":29,"props":16121,"children":16123},{"id":16122},"phase-kickback-the-key-insight",[16124],{"type":26,"value":16125},"Phase kickback: the key insight",{"type":21,"tag":22,"props":16127,"children":16128},{},[16129],{"type":26,"value":16130},"Here's the thing that makes QPE work, and it's worth slowing down for.",{"type":21,"tag":22,"props":16132,"children":16133},{},[16134,16136,16140],{"type":26,"value":16135},"A controlled-U applied to a control ",{"type":21,"tag":46,"props":16137,"children":16138},{"href":1194},[16139],{"type":26,"value":2776},{"type":26,"value":16141}," in state |1⟩ and a target in the eigenstate |ψ⟩ gives:",{"type":21,"tag":2304,"props":16143,"children":16145},{"code":16144},"CU |1⟩|ψ⟩ = |1⟩ ⊗ U|ψ⟩ = |1⟩ ⊗ e^{2πiθ}|ψ⟩ = e^{2πiθ} |1⟩|ψ⟩\n",[16146],{"type":21,"tag":2073,"props":16147,"children":16148},{"__ignoreMap":7},[16149],{"type":26,"value":16144},{"type":21,"tag":22,"props":16151,"children":16152},{},[16153,16155,16160,16162,16166,16168,16172],{"type":26,"value":16154},"The eigenstate came out unchanged. The phase e^{2πiθ} is a scalar, so it's now attached to the whole state, and since it only appeared for the |1⟩ branch of the control, it's a ",{"type":21,"tag":362,"props":16156,"children":16157},{},[16158],{"type":26,"value":16159},"relative",{"type":26,"value":16161}," phase on the control qubit. Put the control in ",{"type":21,"tag":46,"props":16163,"children":16164},{"href":8807},[16165],{"type":26,"value":8810},{"type":26,"value":16167}," with a ",{"type":21,"tag":46,"props":16169,"children":16170},{"href":7209},[16171],{"type":26,"value":11660},{"type":26,"value":16173}," and you get:",{"type":21,"tag":2304,"props":16175,"children":16177},{"code":16176},"CU (|0⟩+|1⟩)\u002F√2 ⊗ |ψ⟩ = (|0⟩ + e^{2πiθ}|1⟩)\u002F√2 ⊗ |ψ⟩\n",[16178],{"type":21,"tag":2073,"props":16179,"children":16180},{"__ignoreMap":7},[16181],{"type":26,"value":16176},{"type":21,"tag":22,"props":16183,"children":16184},{},[16185,16190],{"type":21,"tag":136,"props":16186,"children":16187},{},[16188],{"type":26,"value":16189},"The phase kicked back from the target onto the control.",{"type":26,"value":16191}," The target register is untouched and unentangled. It's a catalyst. All of the information now lives in the control's phase.",{"type":21,"tag":22,"props":16193,"children":16194},{},[16195],{"type":26,"value":16196},"Do this with n control qubits, and give control qubit k a controlled-U^(2^k) instead, so it picks up phase e^{2πi·2^k·θ}. The counting register ends up in:",{"type":21,"tag":2304,"props":16198,"children":16200},{"code":16199},"(1\u002F√N) Σ_{x=0}^{N-1} e^{2πi·x·θ} |x⟩\n",[16201],{"type":21,"tag":2073,"props":16202,"children":16203},{"__ignoreMap":7},[16204],{"type":26,"value":16199},{"type":21,"tag":22,"props":16206,"children":16207},{},[16208,16210,16216,16218,16223],{"type":26,"value":16209},"Stare at that and compare it to the QFT formula from the previous post: ",{"type":21,"tag":2073,"props":16211,"children":16213},{"className":16212},[],[16214],{"type":26,"value":16215},"QFT|j⟩ = (1\u002F√N) Σ_x e^{2πi·jx\u002FN}|x⟩",{"type":26,"value":16217},". They are the ",{"type":21,"tag":362,"props":16219,"children":16220},{},[16221],{"type":26,"value":16222},"same state",{"type":26,"value":16224},", with j\u002FN = θ. The counting register is holding the QFT of the number j = Nθ.",{"type":21,"tag":29,"props":16226,"children":16228},{"id":16227},"why-the-inverse-qft",[16229],{"type":26,"value":16230},"Why the inverse QFT",{"type":21,"tag":22,"props":16232,"children":16233},{},[16234,16236,16240],{"type":26,"value":16235},"So the controlled-U powers have written θ into the counting register's phases, and, as the QFT post hammered, phases are invisible to ",{"type":21,"tag":46,"props":16237,"children":16238},{"href":7374},[16239],{"type":26,"value":11054},{"type":26,"value":16241},". Measure now and you get uniform noise.",{"type":21,"tag":22,"props":16243,"children":16244},{},[16245],{"type":26,"value":16246},"But we know exactly what transform produced this state. So we undo it. Apply QFT⁻¹ and the register collapses to |j⟩ where j = Nθ, a plain binary integer you read off in one shot.",{"type":21,"tag":22,"props":16248,"children":16249},{},[16250,16252,16256],{"type":26,"value":16251},"That's the payoff the QFT post set up. The QFT direction moves position information into phases. The inverse direction pulls phase information back out into a readable number. QPE is the canonical example of the pattern we described there: the QFT is never the whole algorithm, it's the readout stage of a larger ",{"type":21,"tag":46,"props":16253,"children":16254},{"href":8001},[16255],{"type":26,"value":8004},{"type":26,"value":761},{"type":21,"tag":22,"props":16258,"children":16259},{},[16260],{"type":26,"value":16261},"The full recipe:",{"type":21,"tag":6961,"props":16263,"children":16264},{},[16265,16270,16275,16280,16285],{"type":21,"tag":3084,"props":16266,"children":16267},{},[16268],{"type":26,"value":16269},"n counting qubits + enough qubits to hold |ψ⟩.",{"type":21,"tag":3084,"props":16271,"children":16272},{},[16273],{"type":26,"value":16274},"Hadamard the counting register.",{"type":21,"tag":3084,"props":16276,"children":16277},{},[16278],{"type":26,"value":16279},"For k = 0…n−1: apply controlled-U^(2^k) from counting qubit k onto the eigenstate register.",{"type":21,"tag":3084,"props":16281,"children":16282},{},[16283],{"type":26,"value":16284},"Apply the inverse QFT to the counting register.",{"type":21,"tag":3084,"props":16286,"children":16287},{},[16288],{"type":26,"value":16289},"Measure the counting register. The result, read as a binary fraction, is θ.",{"type":21,"tag":29,"props":16291,"children":16292},{"id":11719},[16293],{"type":26,"value":11722},{"type":21,"tag":22,"props":16295,"children":16296},{},[16297,16299,16305,16307,16313,16315,16320,16322,16328],{"type":26,"value":16298},"Simplest possible U with a known answer: the phase gate ",{"type":21,"tag":2073,"props":16300,"children":16302},{"className":16301},[],[16303],{"type":26,"value":16304},"P(λ)",{"type":26,"value":16306},", which maps |1⟩ → e^{iλ}|1⟩. So |1⟩ is an eigenstate, and setting λ = 2πθ makes the eigenphase exactly θ. We'll reuse the ",{"type":21,"tag":2073,"props":16308,"children":16310},{"className":16309},[],[16311],{"type":26,"value":16312},"qft",{"type":26,"value":16314}," function from the ",{"type":21,"tag":46,"props":16316,"children":16317},{"href":11479},[16318],{"type":26,"value":16319},"previous post",{"type":26,"value":16321}," and simply call ",{"type":21,"tag":2073,"props":16323,"children":16325},{"className":16324},[],[16326],{"type":26,"value":16327},".inverse()",{"type":26,"value":16329}," on it.",{"type":21,"tag":2304,"props":16331,"children":16333},{"code":16332,"language":3147,"meta":7,"className":3145,"style":7},"import numpy as np\nfrom qiskit import QuantumCircuit, transpile\nfrom qiskit_aer import AerSimulator\n\n\ndef qft_rotations(circuit, n):\n    if n == 0:\n        return circuit\n    n -= 1\n    circuit.h(n)\n    for qubit in range(n):\n        circuit.cp(np.pi \u002F 2 ** (n - qubit), qubit, n)\n    qft_rotations(circuit, n)\n    return circuit\n\n\ndef qft(n):\n    qc = QuantumCircuit(n, name=\"QFT\")\n    qft_rotations(qc, n)\n    for q in range(n \u002F\u002F 2):          # the swaps matter here, see below\n        qc.swap(q, n - q - 1)\n    return qc\n\n\ndef qpe_phase_gate(n_count, theta):\n    \"\"\"QPE for U = P(2*pi*theta), whose eigenstate is |1>.\"\"\"\n    qc = QuantumCircuit(n_count + 1, n_count)\n    qc.h(range(n_count))             # counting register in superposition\n    qc.x(n_count)                    # prepare the eigenstate |1>\n\n    for k in range(n_count):         # controlled-U^(2^k) = CP(2*pi*theta*2^k)\n        qc.cp(2 * np.pi * theta * 2 ** k, k, n_count)\n\n    qc.compose(qft(n_count).inverse(), qubits=range(n_count), inplace=True)\n    qc.measure(range(n_count), range(n_count))\n    return qc\n\n\nsim = AerSimulator()\nqc = qpe_phase_gate(4, 0.625)        # theta = 0.625 = 0.1010 in binary\ncounts = sim.run(transpile(qc, sim), shots=4096).result().get_counts()\n\nfor bits, c in sorted(counts.items(), key=lambda kv: -kv[1]):\n    est = int(bits, 2) \u002F 2 ** 4\n    print(f\"{bits} -> theta = {int(bits, 2)}\u002F16 = {est:.4f}   counts = {c}\")\n",[16334],{"type":21,"tag":2073,"props":16335,"children":16336},{"__ignoreMap":7},[16337,16356,16375,16394,16401,16408,16423,16446,16457,16472,16479,16502,16533,16541,16552,16559,16566,16581,16612,16619,16660,16687,16698,16705,16712,16729,16737,16766,16787,16800,16807,16836,16883,16890,16931,16955,16966,16973,16980,16995,17034,17065,17072,17126,17172],{"type":21,"tag":2314,"props":16338,"children":16339},{"class":2316,"line":2317},[16340,16344,16348,16352],{"type":21,"tag":2314,"props":16341,"children":16342},{"style":3157},[16343],{"type":26,"value":3170},{"type":21,"tag":2314,"props":16345,"children":16346},{"style":2321},[16347],{"type":26,"value":4227},{"type":21,"tag":2314,"props":16349,"children":16350},{"style":3157},[16351],{"type":26,"value":4232},{"type":21,"tag":2314,"props":16353,"children":16354},{"style":2321},[16355],{"type":26,"value":4237},{"type":21,"tag":2314,"props":16357,"children":16358},{"class":2316,"line":106},[16359,16363,16367,16371],{"type":21,"tag":2314,"props":16360,"children":16361},{"style":3157},[16362],{"type":26,"value":3160},{"type":21,"tag":2314,"props":16364,"children":16365},{"style":2321},[16366],{"type":26,"value":4249},{"type":21,"tag":2314,"props":16368,"children":16369},{"style":3157},[16370],{"type":26,"value":3170},{"type":21,"tag":2314,"props":16372,"children":16373},{"style":2321},[16374],{"type":26,"value":4258},{"type":21,"tag":2314,"props":16376,"children":16377},{"class":2316,"line":2335},[16378,16382,16386,16390],{"type":21,"tag":2314,"props":16379,"children":16380},{"style":3157},[16381],{"type":26,"value":3160},{"type":21,"tag":2314,"props":16383,"children":16384},{"style":2321},[16385],{"type":26,"value":4270},{"type":21,"tag":2314,"props":16387,"children":16388},{"style":3157},[16389],{"type":26,"value":3170},{"type":21,"tag":2314,"props":16391,"children":16392},{"style":2321},[16393],{"type":26,"value":4279},{"type":21,"tag":2314,"props":16395,"children":16396},{"class":2316,"line":2397},[16397],{"type":21,"tag":2314,"props":16398,"children":16399},{"emptyLinePlaceholder":3181},[16400],{"type":26,"value":3184},{"type":21,"tag":2314,"props":16402,"children":16403},{"class":2316,"line":2421},[16404],{"type":21,"tag":2314,"props":16405,"children":16406},{"emptyLinePlaceholder":3181},[16407],{"type":26,"value":3184},{"type":21,"tag":2314,"props":16409,"children":16410},{"class":2316,"line":16},[16411,16415,16419],{"type":21,"tag":2314,"props":16412,"children":16413},{"style":3157},[16414],{"type":26,"value":4315},{"type":21,"tag":2314,"props":16416,"children":16417},{"style":4318},[16418],{"type":26,"value":11879},{"type":21,"tag":2314,"props":16420,"children":16421},{"style":2321},[16422],{"type":26,"value":11884},{"type":21,"tag":2314,"props":16424,"children":16425},{"class":2316,"line":127},[16426,16430,16434,16438,16442],{"type":21,"tag":2314,"props":16427,"children":16428},{"style":3157},[16429],{"type":26,"value":11900},{"type":21,"tag":2314,"props":16431,"children":16432},{"style":2321},[16433],{"type":26,"value":11905},{"type":21,"tag":2314,"props":16435,"children":16436},{"style":3157},[16437],{"type":26,"value":4863},{"type":21,"tag":2314,"props":16439,"children":16440},{"style":2339},[16441],{"type":26,"value":11914},{"type":21,"tag":2314,"props":16443,"children":16444},{"style":2321},[16445],{"type":26,"value":4873},{"type":21,"tag":2314,"props":16447,"children":16448},{"class":2316,"line":887},[16449,16453],{"type":21,"tag":2314,"props":16450,"children":16451},{"style":3157},[16452],{"type":26,"value":11926},{"type":21,"tag":2314,"props":16454,"children":16455},{"style":2321},[16456],{"type":26,"value":11931},{"type":21,"tag":2314,"props":16458,"children":16459},{"class":2316,"line":1364},[16460,16464,16468],{"type":21,"tag":2314,"props":16461,"children":16462},{"style":2321},[16463],{"type":26,"value":11939},{"type":21,"tag":2314,"props":16465,"children":16466},{"style":3157},[16467],{"type":26,"value":11944},{"type":21,"tag":2314,"props":16469,"children":16470},{"style":2339},[16471],{"type":26,"value":12747},{"type":21,"tag":2314,"props":16473,"children":16474},{"class":2316,"line":3403},[16475],{"type":21,"tag":2314,"props":16476,"children":16477},{"style":2321},[16478],{"type":26,"value":11961},{"type":21,"tag":2314,"props":16480,"children":16481},{"class":2316,"line":3413},[16482,16486,16490,16494,16498],{"type":21,"tag":2314,"props":16483,"children":16484},{"style":3157},[16485],{"type":26,"value":4694},{"type":21,"tag":2314,"props":16487,"children":16488},{"style":2321},[16489],{"type":26,"value":11973},{"type":21,"tag":2314,"props":16491,"children":16492},{"style":3157},[16493],{"type":26,"value":3460},{"type":21,"tag":2314,"props":16495,"children":16496},{"style":2339},[16497],{"type":26,"value":3465},{"type":21,"tag":2314,"props":16499,"children":16500},{"style":2321},[16501],{"type":26,"value":7795},{"type":21,"tag":2314,"props":16503,"children":16504},{"class":2316,"line":436},[16505,16509,16513,16517,16521,16525,16529],{"type":21,"tag":2314,"props":16506,"children":16507},{"style":2321},[16508],{"type":26,"value":12001},{"type":21,"tag":2314,"props":16510,"children":16511},{"style":3157},[16512],{"type":26,"value":2168},{"type":21,"tag":2314,"props":16514,"children":16515},{"style":2339},[16516],{"type":26,"value":6338},{"type":21,"tag":2314,"props":16518,"children":16519},{"style":3157},[16520],{"type":26,"value":8263},{"type":21,"tag":2314,"props":16522,"children":16523},{"style":2321},[16524],{"type":26,"value":12018},{"type":21,"tag":2314,"props":16526,"children":16527},{"style":3157},[16528],{"type":26,"value":4802},{"type":21,"tag":2314,"props":16530,"children":16531},{"style":2321},[16532],{"type":26,"value":12027},{"type":21,"tag":2314,"props":16534,"children":16535},{"class":2316,"line":3473},[16536],{"type":21,"tag":2314,"props":16537,"children":16538},{"style":2321},[16539],{"type":26,"value":16540},"    qft_rotations(circuit, n)\n",{"type":21,"tag":2314,"props":16542,"children":16543},{"class":2316,"line":3521},[16544,16548],{"type":21,"tag":2314,"props":16545,"children":16546},{"style":3157},[16547],{"type":26,"value":4540},{"type":21,"tag":2314,"props":16549,"children":16550},{"style":2321},[16551],{"type":26,"value":11931},{"type":21,"tag":2314,"props":16553,"children":16554},{"class":2316,"line":3563},[16555],{"type":21,"tag":2314,"props":16556,"children":16557},{"emptyLinePlaceholder":3181},[16558],{"type":26,"value":3184},{"type":21,"tag":2314,"props":16560,"children":16561},{"class":2316,"line":4585},[16562],{"type":21,"tag":2314,"props":16563,"children":16564},{"emptyLinePlaceholder":3181},[16565],{"type":26,"value":3184},{"type":21,"tag":2314,"props":16567,"children":16568},{"class":2316,"line":4604},[16569,16573,16577],{"type":21,"tag":2314,"props":16570,"children":16571},{"style":3157},[16572],{"type":26,"value":4315},{"type":21,"tag":2314,"props":16574,"children":16575},{"style":4318},[16576],{"type":26,"value":12189},{"type":21,"tag":2314,"props":16578,"children":16579},{"style":2321},[16580],{"type":26,"value":7795},{"type":21,"tag":2314,"props":16582,"children":16583},{"class":2316,"line":4612},[16584,16588,16592,16596,16600,16604,16608],{"type":21,"tag":2314,"props":16585,"children":16586},{"style":2321},[16587],{"type":26,"value":7451},{"type":21,"tag":2314,"props":16589,"children":16590},{"style":3157},[16591],{"type":26,"value":3197},{"type":21,"tag":2314,"props":16593,"children":16594},{"style":2321},[16595],{"type":26,"value":7460},{"type":21,"tag":2314,"props":16597,"children":16598},{"style":3222},[16599],{"type":26,"value":7465},{"type":21,"tag":2314,"props":16601,"children":16602},{"style":3157},[16603],{"type":26,"value":3197},{"type":21,"tag":2314,"props":16605,"children":16606},{"style":2350},[16607],{"type":26,"value":12221},{"type":21,"tag":2314,"props":16609,"children":16610},{"style":2321},[16611],{"type":26,"value":3257},{"type":21,"tag":2314,"props":16613,"children":16614},{"class":2316,"line":4643},[16615],{"type":21,"tag":2314,"props":16616,"children":16617},{"style":2321},[16618],{"type":26,"value":12233},{"type":21,"tag":2314,"props":16620,"children":16621},{"class":2316,"line":4688},[16622,16626,16630,16634,16638,16642,16646,16650,16655],{"type":21,"tag":2314,"props":16623,"children":16624},{"style":3157},[16625],{"type":26,"value":4694},{"type":21,"tag":2314,"props":16627,"children":16628},{"style":2321},[16629],{"type":26,"value":3455},{"type":21,"tag":2314,"props":16631,"children":16632},{"style":3157},[16633],{"type":26,"value":3460},{"type":21,"tag":2314,"props":16635,"children":16636},{"style":2339},[16637],{"type":26,"value":3465},{"type":21,"tag":2314,"props":16639,"children":16640},{"style":2321},[16641],{"type":26,"value":7623},{"type":21,"tag":2314,"props":16643,"children":16644},{"style":3157},[16645],{"type":26,"value":6062},{"type":21,"tag":2314,"props":16647,"children":16648},{"style":2339},[16649],{"type":26,"value":6338},{"type":21,"tag":2314,"props":16651,"children":16652},{"style":2321},[16653],{"type":26,"value":16654},"):          ",{"type":21,"tag":2314,"props":16656,"children":16657},{"style":3407},[16658],{"type":26,"value":16659},"# the swaps matter here, see below\n",{"type":21,"tag":2314,"props":16661,"children":16662},{"class":2316,"line":4727},[16663,16667,16671,16675,16679,16683],{"type":21,"tag":2314,"props":16664,"children":16665},{"style":2321},[16666],{"type":26,"value":13525},{"type":21,"tag":2314,"props":16668,"children":16669},{"style":3157},[16670],{"type":26,"value":4802},{"type":21,"tag":2314,"props":16672,"children":16673},{"style":2321},[16674],{"type":26,"value":3455},{"type":21,"tag":2314,"props":16676,"children":16677},{"style":3157},[16678],{"type":26,"value":4802},{"type":21,"tag":2314,"props":16680,"children":16681},{"style":2339},[16682],{"type":26,"value":6053},{"type":21,"tag":2314,"props":16684,"children":16685},{"style":2321},[16686],{"type":26,"value":3257},{"type":21,"tag":2314,"props":16688,"children":16689},{"class":2316,"line":4745},[16690,16694],{"type":21,"tag":2314,"props":16691,"children":16692},{"style":3157},[16693],{"type":26,"value":4540},{"type":21,"tag":2314,"props":16695,"children":16696},{"style":2321},[16697],{"type":26,"value":7732},{"type":21,"tag":2314,"props":16699,"children":16700},{"class":2316,"line":4819},[16701],{"type":21,"tag":2314,"props":16702,"children":16703},{"emptyLinePlaceholder":3181},[16704],{"type":26,"value":3184},{"type":21,"tag":2314,"props":16706,"children":16707},{"class":2316,"line":4847},[16708],{"type":21,"tag":2314,"props":16709,"children":16710},{"emptyLinePlaceholder":3181},[16711],{"type":26,"value":3184},{"type":21,"tag":2314,"props":16713,"children":16714},{"class":2316,"line":4876},[16715,16719,16724],{"type":21,"tag":2314,"props":16716,"children":16717},{"style":3157},[16718],{"type":26,"value":4315},{"type":21,"tag":2314,"props":16720,"children":16721},{"style":4318},[16722],{"type":26,"value":16723}," qpe_phase_gate",{"type":21,"tag":2314,"props":16725,"children":16726},{"style":2321},[16727],{"type":26,"value":16728},"(n_count, theta):\n",{"type":21,"tag":2314,"props":16730,"children":16731},{"class":2316,"line":4885},[16732],{"type":21,"tag":2314,"props":16733,"children":16734},{"style":2350},[16735],{"type":26,"value":16736},"    \"\"\"QPE for U = P(2*pi*theta), whose eigenstate is |1>.\"\"\"\n",{"type":21,"tag":2314,"props":16738,"children":16739},{"class":2316,"line":4913},[16740,16744,16748,16753,16757,16761],{"type":21,"tag":2314,"props":16741,"children":16742},{"style":2321},[16743],{"type":26,"value":7451},{"type":21,"tag":2314,"props":16745,"children":16746},{"style":3157},[16747],{"type":26,"value":3197},{"type":21,"tag":2314,"props":16749,"children":16750},{"style":2321},[16751],{"type":26,"value":16752}," QuantumCircuit(n_count ",{"type":21,"tag":2314,"props":16754,"children":16755},{"style":3157},[16756],{"type":26,"value":6482},{"type":21,"tag":2314,"props":16758,"children":16759},{"style":2339},[16760],{"type":26,"value":6053},{"type":21,"tag":2314,"props":16762,"children":16763},{"style":2321},[16764],{"type":26,"value":16765},", n_count)\n",{"type":21,"tag":2314,"props":16767,"children":16768},{"class":2316,"line":4944},[16769,16773,16777,16782],{"type":21,"tag":2314,"props":16770,"children":16771},{"style":2321},[16772],{"type":26,"value":7843},{"type":21,"tag":2314,"props":16774,"children":16775},{"style":2339},[16776],{"type":26,"value":4896},{"type":21,"tag":2314,"props":16778,"children":16779},{"style":2321},[16780],{"type":26,"value":16781},"(n_count))             ",{"type":21,"tag":2314,"props":16783,"children":16784},{"style":3407},[16785],{"type":26,"value":16786},"# counting register in superposition\n",{"type":21,"tag":2314,"props":16788,"children":16789},{"class":2316,"line":4966},[16790,16795],{"type":21,"tag":2314,"props":16791,"children":16792},{"style":2321},[16793],{"type":26,"value":16794},"    qc.x(n_count)                    ",{"type":21,"tag":2314,"props":16796,"children":16797},{"style":3407},[16798],{"type":26,"value":16799},"# prepare the eigenstate |1>\n",{"type":21,"tag":2314,"props":16801,"children":16802},{"class":2316,"line":5012},[16803],{"type":21,"tag":2314,"props":16804,"children":16805},{"emptyLinePlaceholder":3181},[16806],{"type":26,"value":3184},{"type":21,"tag":2314,"props":16808,"children":16809},{"class":2316,"line":5025},[16810,16814,16818,16822,16826,16831],{"type":21,"tag":2314,"props":16811,"children":16812},{"style":3157},[16813],{"type":26,"value":4694},{"type":21,"tag":2314,"props":16815,"children":16816},{"style":2321},[16817],{"type":26,"value":13447},{"type":21,"tag":2314,"props":16819,"children":16820},{"style":3157},[16821],{"type":26,"value":3460},{"type":21,"tag":2314,"props":16823,"children":16824},{"style":2339},[16825],{"type":26,"value":3465},{"type":21,"tag":2314,"props":16827,"children":16828},{"style":2321},[16829],{"type":26,"value":16830},"(n_count):         ",{"type":21,"tag":2314,"props":16832,"children":16833},{"style":3407},[16834],{"type":26,"value":16835},"# controlled-U^(2^k) = CP(2*pi*theta*2^k)\n",{"type":21,"tag":2314,"props":16837,"children":16838},{"class":2316,"line":5033},[16839,16844,16848,16852,16857,16861,16866,16870,16874,16878],{"type":21,"tag":2314,"props":16840,"children":16841},{"style":2321},[16842],{"type":26,"value":16843},"        qc.cp(",{"type":21,"tag":2314,"props":16845,"children":16846},{"style":2339},[16847],{"type":26,"value":2413},{"type":21,"tag":2314,"props":16849,"children":16850},{"style":3157},[16851],{"type":26,"value":8299},{"type":21,"tag":2314,"props":16853,"children":16854},{"style":2321},[16855],{"type":26,"value":16856}," np.pi ",{"type":21,"tag":2314,"props":16858,"children":16859},{"style":3157},[16860],{"type":26,"value":6347},{"type":21,"tag":2314,"props":16862,"children":16863},{"style":2321},[16864],{"type":26,"value":16865}," theta ",{"type":21,"tag":2314,"props":16867,"children":16868},{"style":3157},[16869],{"type":26,"value":6347},{"type":21,"tag":2314,"props":16871,"children":16872},{"style":2339},[16873],{"type":26,"value":6338},{"type":21,"tag":2314,"props":16875,"children":16876},{"style":3157},[16877],{"type":26,"value":8263},{"type":21,"tag":2314,"props":16879,"children":16880},{"style":2321},[16881],{"type":26,"value":16882}," k, k, n_count)\n",{"type":21,"tag":2314,"props":16884,"children":16885},{"class":2316,"line":5051},[16886],{"type":21,"tag":2314,"props":16887,"children":16888},{"emptyLinePlaceholder":3181},[16889],{"type":26,"value":3184},{"type":21,"tag":2314,"props":16891,"children":16892},{"class":2316,"line":5069},[16893,16898,16902,16906,16910,16915,16919,16923,16927],{"type":21,"tag":2314,"props":16894,"children":16895},{"style":2321},[16896],{"type":26,"value":16897},"    qc.compose(qft(n_count).inverse(), ",{"type":21,"tag":2314,"props":16899,"children":16900},{"style":3222},[16901],{"type":26,"value":1197},{"type":21,"tag":2314,"props":16903,"children":16904},{"style":3157},[16905],{"type":26,"value":3197},{"type":21,"tag":2314,"props":16907,"children":16908},{"style":2339},[16909],{"type":26,"value":4896},{"type":21,"tag":2314,"props":16911,"children":16912},{"style":2321},[16913],{"type":26,"value":16914},"(n_count), ",{"type":21,"tag":2314,"props":16916,"children":16917},{"style":3222},[16918],{"type":26,"value":8153},{"type":21,"tag":2314,"props":16920,"children":16921},{"style":3157},[16922],{"type":26,"value":3197},{"type":21,"tag":2314,"props":16924,"children":16925},{"style":2339},[16926],{"type":26,"value":3234},{"type":21,"tag":2314,"props":16928,"children":16929},{"style":2321},[16930],{"type":26,"value":3257},{"type":21,"tag":2314,"props":16932,"children":16933},{"class":2316,"line":5077},[16934,16938,16942,16946,16950],{"type":21,"tag":2314,"props":16935,"children":16936},{"style":2321},[16937],{"type":26,"value":8208},{"type":21,"tag":2314,"props":16939,"children":16940},{"style":2339},[16941],{"type":26,"value":4896},{"type":21,"tag":2314,"props":16943,"children":16944},{"style":2321},[16945],{"type":26,"value":16914},{"type":21,"tag":2314,"props":16947,"children":16948},{"style":2339},[16949],{"type":26,"value":4896},{"type":21,"tag":2314,"props":16951,"children":16952},{"style":2321},[16953],{"type":26,"value":16954},"(n_count))\n",{"type":21,"tag":2314,"props":16956,"children":16957},{"class":2316,"line":5111},[16958,16962],{"type":21,"tag":2314,"props":16959,"children":16960},{"style":3157},[16961],{"type":26,"value":4540},{"type":21,"tag":2314,"props":16963,"children":16964},{"style":2321},[16965],{"type":26,"value":7732},{"type":21,"tag":2314,"props":16967,"children":16968},{"class":2316,"line":5129},[16969],{"type":21,"tag":2314,"props":16970,"children":16971},{"emptyLinePlaceholder":3181},[16972],{"type":26,"value":3184},{"type":21,"tag":2314,"props":16974,"children":16975},{"class":2316,"line":5154},[16976],{"type":21,"tag":2314,"props":16977,"children":16978},{"emptyLinePlaceholder":3181},[16979],{"type":26,"value":3184},{"type":21,"tag":2314,"props":16981,"children":16982},{"class":2316,"line":5196},[16983,16987,16991],{"type":21,"tag":2314,"props":16984,"children":16985},{"style":2321},[16986],{"type":26,"value":8378},{"type":21,"tag":2314,"props":16988,"children":16989},{"style":3157},[16990],{"type":26,"value":3197},{"type":21,"tag":2314,"props":16992,"children":16993},{"style":2321},[16994],{"type":26,"value":8387},{"type":21,"tag":2314,"props":16996,"children":16997},{"class":2316,"line":5204},[16998,17002,17006,17011,17015,17019,17024,17029],{"type":21,"tag":2314,"props":16999,"children":17000},{"style":2321},[17001],{"type":26,"value":7336},{"type":21,"tag":2314,"props":17003,"children":17004},{"style":3157},[17005],{"type":26,"value":3197},{"type":21,"tag":2314,"props":17007,"children":17008},{"style":2321},[17009],{"type":26,"value":17010}," qpe_phase_gate(",{"type":21,"tag":2314,"props":17012,"children":17013},{"style":2339},[17014],{"type":26,"value":5486},{"type":21,"tag":2314,"props":17016,"children":17017},{"style":2321},[17018],{"type":26,"value":1309},{"type":21,"tag":2314,"props":17020,"children":17021},{"style":2339},[17022],{"type":26,"value":17023},"0.625",{"type":21,"tag":2314,"props":17025,"children":17026},{"style":2321},[17027],{"type":26,"value":17028},")        ",{"type":21,"tag":2314,"props":17030,"children":17031},{"style":3407},[17032],{"type":26,"value":17033},"# theta = 0.625 = 0.1010 in binary\n",{"type":21,"tag":2314,"props":17035,"children":17036},{"class":2316,"line":5239},[17037,17041,17045,17049,17053,17057,17061],{"type":21,"tag":2314,"props":17038,"children":17039},{"style":2321},[17040],{"type":26,"value":8411},{"type":21,"tag":2314,"props":17042,"children":17043},{"style":3157},[17044],{"type":26,"value":3197},{"type":21,"tag":2314,"props":17046,"children":17047},{"style":2321},[17048],{"type":26,"value":8420},{"type":21,"tag":2314,"props":17050,"children":17051},{"style":3222},[17052],{"type":26,"value":4077},{"type":21,"tag":2314,"props":17054,"children":17055},{"style":3157},[17056],{"type":26,"value":3197},{"type":21,"tag":2314,"props":17058,"children":17059},{"style":2339},[17060],{"type":26,"value":8433},{"type":21,"tag":2314,"props":17062,"children":17063},{"style":2321},[17064],{"type":26,"value":5236},{"type":21,"tag":2314,"props":17066,"children":17067},{"class":2316,"line":5355},[17068],{"type":21,"tag":2314,"props":17069,"children":17070},{"emptyLinePlaceholder":3181},[17071],{"type":26,"value":3184},{"type":21,"tag":2314,"props":17073,"children":17074},{"class":2316,"line":5363},[17075,17079,17084,17088,17093,17097,17101,17105,17109,17113,17117,17121],{"type":21,"tag":2314,"props":17076,"children":17077},{"style":3157},[17078],{"type":26,"value":3450},{"type":21,"tag":2314,"props":17080,"children":17081},{"style":2321},[17082],{"type":26,"value":17083}," bits, c ",{"type":21,"tag":2314,"props":17085,"children":17086},{"style":3157},[17087],{"type":26,"value":3460},{"type":21,"tag":2314,"props":17089,"children":17090},{"style":2339},[17091],{"type":26,"value":17092}," sorted",{"type":21,"tag":2314,"props":17094,"children":17095},{"style":2321},[17096],{"type":26,"value":13116},{"type":21,"tag":2314,"props":17098,"children":17099},{"style":3222},[17100],{"type":26,"value":3498},{"type":21,"tag":2314,"props":17102,"children":17103},{"style":3157},[17104],{"type":26,"value":3503},{"type":21,"tag":2314,"props":17106,"children":17107},{"style":2321},[17108],{"type":26,"value":13129},{"type":21,"tag":2314,"props":17110,"children":17111},{"style":3157},[17112],{"type":26,"value":4802},{"type":21,"tag":2314,"props":17114,"children":17115},{"style":2321},[17116],{"type":26,"value":13138},{"type":21,"tag":2314,"props":17118,"children":17119},{"style":2339},[17120],{"type":26,"value":3513},{"type":21,"tag":2314,"props":17122,"children":17123},{"style":2321},[17124],{"type":26,"value":17125},"]):\n",{"type":21,"tag":2314,"props":17127,"children":17128},{"class":2316,"line":5408},[17129,17134,17138,17143,17148,17152,17156,17160,17164,17168],{"type":21,"tag":2314,"props":17130,"children":17131},{"style":2321},[17132],{"type":26,"value":17133},"    est ",{"type":21,"tag":2314,"props":17135,"children":17136},{"style":3157},[17137],{"type":26,"value":3197},{"type":21,"tag":2314,"props":17139,"children":17140},{"style":2339},[17141],{"type":26,"value":17142}," int",{"type":21,"tag":2314,"props":17144,"children":17145},{"style":2321},[17146],{"type":26,"value":17147},"(bits, ",{"type":21,"tag":2314,"props":17149,"children":17150},{"style":2339},[17151],{"type":26,"value":2413},{"type":21,"tag":2314,"props":17153,"children":17154},{"style":2321},[17155],{"type":26,"value":5301},{"type":21,"tag":2314,"props":17157,"children":17158},{"style":3157},[17159],{"type":26,"value":2168},{"type":21,"tag":2314,"props":17161,"children":17162},{"style":2339},[17163],{"type":26,"value":6338},{"type":21,"tag":2314,"props":17165,"children":17166},{"style":3157},[17167],{"type":26,"value":8263},{"type":21,"tag":2314,"props":17169,"children":17170},{"style":2339},[17171],{"type":26,"value":12421},{"type":21,"tag":2314,"props":17173,"children":17174},{"class":2316,"line":5426},[17175,17180,17184,17188,17192,17196,17201,17205,17210,17215,17219,17223,17228,17232,17237,17241,17246,17250,17254,17259,17263,17268,17272,17276],{"type":21,"tag":2314,"props":17176,"children":17177},{"style":2339},[17178],{"type":26,"value":17179},"    print",{"type":21,"tag":2314,"props":17181,"children":17182},{"style":2321},[17183],{"type":26,"value":3277},{"type":21,"tag":2314,"props":17185,"children":17186},{"style":3157},[17187],{"type":26,"value":3282},{"type":21,"tag":2314,"props":17189,"children":17190},{"style":2350},[17191],{"type":26,"value":3307},{"type":21,"tag":2314,"props":17193,"children":17194},{"style":2339},[17195],{"type":26,"value":3292},{"type":21,"tag":2314,"props":17197,"children":17198},{"style":2321},[17199],{"type":26,"value":17200},"bits",{"type":21,"tag":2314,"props":17202,"children":17203},{"style":2339},[17204],{"type":26,"value":3302},{"type":21,"tag":2314,"props":17206,"children":17207},{"style":2350},[17208],{"type":26,"value":17209}," -> theta = ",{"type":21,"tag":2314,"props":17211,"children":17212},{"style":2339},[17213],{"type":26,"value":17214},"{int",{"type":21,"tag":2314,"props":17216,"children":17217},{"style":2321},[17218],{"type":26,"value":17147},{"type":21,"tag":2314,"props":17220,"children":17221},{"style":2339},[17222],{"type":26,"value":2413},{"type":21,"tag":2314,"props":17224,"children":17225},{"style":2321},[17226],{"type":26,"value":17227},")",{"type":21,"tag":2314,"props":17229,"children":17230},{"style":2339},[17231],{"type":26,"value":3302},{"type":21,"tag":2314,"props":17233,"children":17234},{"style":2350},[17235],{"type":26,"value":17236},"\u002F16 = ",{"type":21,"tag":2314,"props":17238,"children":17239},{"style":2339},[17240],{"type":26,"value":3292},{"type":21,"tag":2314,"props":17242,"children":17243},{"style":2321},[17244],{"type":26,"value":17245},"est",{"type":21,"tag":2314,"props":17247,"children":17248},{"style":3157},[17249],{"type":26,"value":3604},{"type":21,"tag":2314,"props":17251,"children":17252},{"style":2339},[17253],{"type":26,"value":3302},{"type":21,"tag":2314,"props":17255,"children":17256},{"style":2350},[17257],{"type":26,"value":17258},"   counts = ",{"type":21,"tag":2314,"props":17260,"children":17261},{"style":2339},[17262],{"type":26,"value":3292},{"type":21,"tag":2314,"props":17264,"children":17265},{"style":2321},[17266],{"type":26,"value":17267},"c",{"type":21,"tag":2314,"props":17269,"children":17270},{"style":2339},[17271],{"type":26,"value":3302},{"type":21,"tag":2314,"props":17273,"children":17274},{"style":2350},[17275],{"type":26,"value":3307},{"type":21,"tag":2314,"props":17277,"children":17278},{"style":2321},[17279],{"type":26,"value":3257},{"type":21,"tag":22,"props":17281,"children":17282},{},[17283],{"type":26,"value":12339},{"type":21,"tag":2304,"props":17285,"children":17287},{"code":17286},"1010 -> theta = 10\u002F16 = 0.6250   counts = 4096\n",[17288],{"type":21,"tag":2073,"props":17289,"children":17290},{"__ignoreMap":7},[17291],{"type":26,"value":17286},{"type":21,"tag":22,"props":17293,"children":17294},{},[17295,17300],{"type":21,"tag":136,"props":17296,"children":17297},{},[17298],{"type":26,"value":17299},"4096 out of 4096 shots.",{"type":26,"value":17301}," θ = 0.625 is exactly representable in 4 bits (0.1010₂ = 1\u002F2 + 1\u002F8), so QPE returns it with certainty. Three counting qubits and θ = 0.125 behaves the same way:",{"type":21,"tag":2304,"props":17303,"children":17305},{"code":17304},"[('001', 4096)]\n",[17306],{"type":21,"tag":2073,"props":17307,"children":17308},{"__ignoreMap":7},[17309],{"type":26,"value":17304},{"type":21,"tag":22,"props":17311,"children":17312},{},[17313],{"type":26,"value":17314},"001 = 1, and 1\u002F8 = 0.125. Exact again.",{"type":21,"tag":17316,"props":17317,"children":17319},"h3",{"id":17318},"the-endianness-trap",[17320],{"type":26,"value":17321},"The endianness trap",{"type":21,"tag":22,"props":17323,"children":17324},{},[17325,17331,17333,17338,17340,17344,17346,17352],{"type":21,"tag":2073,"props":17326,"children":17328},{"className":17327},[],[17329],{"type":26,"value":17330},"int(bits, 2) \u002F 2**n",{"type":26,"value":17332}," worked above, and it is worth understanding ",{"type":21,"tag":362,"props":17334,"children":17335},{},[17336],{"type":26,"value":17337},"why",{"type":26,"value":17339}," rather than copying it. Qiskit prints bitstrings with classical bit 0 on the ",{"type":21,"tag":136,"props":17341,"children":17342},{},[17343],{"type":26,"value":7742},{"type":26,"value":17345},", and our counting qubit 0 (the one that got the smallest rotation, ",{"type":21,"tag":2073,"props":17347,"children":17349},{"className":17348},[],[17350],{"type":26,"value":17351},"U^1",{"type":26,"value":17353},") is the least significant bit of j. The QFT's final swap network is what lines those two conventions up.",{"type":21,"tag":22,"props":17355,"children":17356},{},[17357,17359,17365],{"type":26,"value":17358},"Drop the swaps from ",{"type":21,"tag":2073,"props":17360,"children":17362},{"className":17361},[],[17363],{"type":26,"value":17364},"qft()",{"type":26,"value":17366}," (a tempting \"optimization\", since they look cosmetic) and rerun the exact θ = 0.625 case. Real output over 2048 shots:",{"type":21,"tag":2304,"props":17368,"children":17370},{"code":17369},"{'1101': 1007, '0101': 470, '0001': 251, '0100': 80, '1100': 77,\n '0010': 66, '1110': 64, '0110': 16, '1010': 9, '1001': 8}\n",[17371],{"type":21,"tag":2073,"props":17372,"children":17373},{"__ignoreMap":7},[17374],{"type":26,"value":17369},{"type":21,"tag":22,"props":17376,"children":17377},{},[17378,17380,17386,17388,17393],{"type":26,"value":17379},"The correct answer ",{"type":21,"tag":2073,"props":17381,"children":17383},{"className":17382},[],[17384],{"type":26,"value":17385},"1010",{"type":26,"value":17387}," now gets ",{"type":21,"tag":136,"props":17389,"children":17390},{},[17391],{"type":26,"value":17392},"9 shots out of 2048",{"type":26,"value":17394},". The distribution smeared across the register with its largest peak at 1101, a confidently wrong 0.8125. Nothing errors. Nothing warns. You publish the wrong number, and with a θ you didn't already know you would have no way to tell. This is the same silent-failure class as the endianness bug in the Grover oracle, and it's why the QFT post insisted on keeping the swaps in a reusable block.",{"type":21,"tag":22,"props":17396,"children":17397},{},[17398],{"type":26,"value":17399},"Always sanity-check a QPE implementation against a θ you already know before pointing it at one you don't.",{"type":21,"tag":29,"props":17401,"children":17403},{"id":17402},"when-θ-doesnt-fit-in-n-bits",[17404],{"type":26,"value":17405},"When θ doesn't fit in n bits",{"type":21,"tag":22,"props":17407,"children":17408},{},[17409],{"type":26,"value":17410},"Real eigenphases are not tidy binary fractions. Try θ = 0.3, which has an infinite binary expansion, with 4 counting qubits:",{"type":21,"tag":2304,"props":17412,"children":17414},{"code":17413,"language":3147,"meta":7,"className":3145,"style":7},"qc = qpe_phase_gate(4, 0.3)\ncounts = sim.run(transpile(qc, sim), shots=4096).result().get_counts()\nfor bits, c in sorted(counts.items(), key=lambda kv: -kv[1])[:6]:\n    print(f\"{bits}  theta_est = {int(bits, 2) \u002F 2**4:.4f}   p = {c \u002F 4096:.4f}\")\n",[17415],{"type":21,"tag":2073,"props":17416,"children":17417},{"__ignoreMap":7},[17418,17449,17480,17541],{"type":21,"tag":2314,"props":17419,"children":17420},{"class":2316,"line":2317},[17421,17425,17429,17433,17437,17441,17445],{"type":21,"tag":2314,"props":17422,"children":17423},{"style":2321},[17424],{"type":26,"value":7336},{"type":21,"tag":2314,"props":17426,"children":17427},{"style":3157},[17428],{"type":26,"value":3197},{"type":21,"tag":2314,"props":17430,"children":17431},{"style":2321},[17432],{"type":26,"value":17010},{"type":21,"tag":2314,"props":17434,"children":17435},{"style":2339},[17436],{"type":26,"value":5486},{"type":21,"tag":2314,"props":17438,"children":17439},{"style":2321},[17440],{"type":26,"value":1309},{"type":21,"tag":2314,"props":17442,"children":17443},{"style":2339},[17444],{"type":26,"value":14696},{"type":21,"tag":2314,"props":17446,"children":17447},{"style":2321},[17448],{"type":26,"value":3257},{"type":21,"tag":2314,"props":17450,"children":17451},{"class":2316,"line":106},[17452,17456,17460,17464,17468,17472,17476],{"type":21,"tag":2314,"props":17453,"children":17454},{"style":2321},[17455],{"type":26,"value":8411},{"type":21,"tag":2314,"props":17457,"children":17458},{"style":3157},[17459],{"type":26,"value":3197},{"type":21,"tag":2314,"props":17461,"children":17462},{"style":2321},[17463],{"type":26,"value":8420},{"type":21,"tag":2314,"props":17465,"children":17466},{"style":3222},[17467],{"type":26,"value":4077},{"type":21,"tag":2314,"props":17469,"children":17470},{"style":3157},[17471],{"type":26,"value":3197},{"type":21,"tag":2314,"props":17473,"children":17474},{"style":2339},[17475],{"type":26,"value":8433},{"type":21,"tag":2314,"props":17477,"children":17478},{"style":2321},[17479],{"type":26,"value":5236},{"type":21,"tag":2314,"props":17481,"children":17482},{"class":2316,"line":2335},[17483,17487,17491,17495,17499,17503,17507,17511,17515,17519,17523,17527,17532,17536],{"type":21,"tag":2314,"props":17484,"children":17485},{"style":3157},[17486],{"type":26,"value":3450},{"type":21,"tag":2314,"props":17488,"children":17489},{"style":2321},[17490],{"type":26,"value":17083},{"type":21,"tag":2314,"props":17492,"children":17493},{"style":3157},[17494],{"type":26,"value":3460},{"type":21,"tag":2314,"props":17496,"children":17497},{"style":2339},[17498],{"type":26,"value":17092},{"type":21,"tag":2314,"props":17500,"children":17501},{"style":2321},[17502],{"type":26,"value":13116},{"type":21,"tag":2314,"props":17504,"children":17505},{"style":3222},[17506],{"type":26,"value":3498},{"type":21,"tag":2314,"props":17508,"children":17509},{"style":3157},[17510],{"type":26,"value":3503},{"type":21,"tag":2314,"props":17512,"children":17513},{"style":2321},[17514],{"type":26,"value":13129},{"type":21,"tag":2314,"props":17516,"children":17517},{"style":3157},[17518],{"type":26,"value":4802},{"type":21,"tag":2314,"props":17520,"children":17521},{"style":2321},[17522],{"type":26,"value":13138},{"type":21,"tag":2314,"props":17524,"children":17525},{"style":2339},[17526],{"type":26,"value":3513},{"type":21,"tag":2314,"props":17528,"children":17529},{"style":2321},[17530],{"type":26,"value":17531},"])[:",{"type":21,"tag":2314,"props":17533,"children":17534},{"style":2339},[17535],{"type":26,"value":13632},{"type":21,"tag":2314,"props":17537,"children":17538},{"style":2321},[17539],{"type":26,"value":17540},"]:\n",{"type":21,"tag":2314,"props":17542,"children":17543},{"class":2316,"line":2397},[17544,17548,17552,17556,17560,17564,17568,17572,17577,17581,17585,17589,17593,17597,17601,17605,17609,17613,17617,17621,17625,17630,17634,17639,17643,17647,17651],{"type":21,"tag":2314,"props":17545,"children":17546},{"style":2339},[17547],{"type":26,"value":17179},{"type":21,"tag":2314,"props":17549,"children":17550},{"style":2321},[17551],{"type":26,"value":3277},{"type":21,"tag":2314,"props":17553,"children":17554},{"style":3157},[17555],{"type":26,"value":3282},{"type":21,"tag":2314,"props":17557,"children":17558},{"style":2350},[17559],{"type":26,"value":3307},{"type":21,"tag":2314,"props":17561,"children":17562},{"style":2339},[17563],{"type":26,"value":3292},{"type":21,"tag":2314,"props":17565,"children":17566},{"style":2321},[17567],{"type":26,"value":17200},{"type":21,"tag":2314,"props":17569,"children":17570},{"style":2339},[17571],{"type":26,"value":3302},{"type":21,"tag":2314,"props":17573,"children":17574},{"style":2350},[17575],{"type":26,"value":17576},"  theta_est = ",{"type":21,"tag":2314,"props":17578,"children":17579},{"style":2339},[17580],{"type":26,"value":17214},{"type":21,"tag":2314,"props":17582,"children":17583},{"style":2321},[17584],{"type":26,"value":17147},{"type":21,"tag":2314,"props":17586,"children":17587},{"style":2339},[17588],{"type":26,"value":2413},{"type":21,"tag":2314,"props":17590,"children":17591},{"style":2321},[17592],{"type":26,"value":5301},{"type":21,"tag":2314,"props":17594,"children":17595},{"style":3157},[17596],{"type":26,"value":2168},{"type":21,"tag":2314,"props":17598,"children":17599},{"style":2339},[17600],{"type":26,"value":6338},{"type":21,"tag":2314,"props":17602,"children":17603},{"style":3157},[17604],{"type":26,"value":4667},{"type":21,"tag":2314,"props":17606,"children":17607},{"style":2339},[17608],{"type":26,"value":5486},{"type":21,"tag":2314,"props":17610,"children":17611},{"style":3157},[17612],{"type":26,"value":3604},{"type":21,"tag":2314,"props":17614,"children":17615},{"style":2339},[17616],{"type":26,"value":3302},{"type":21,"tag":2314,"props":17618,"children":17619},{"style":2350},[17620],{"type":26,"value":12920},{"type":21,"tag":2314,"props":17622,"children":17623},{"style":2339},[17624],{"type":26,"value":3292},{"type":21,"tag":2314,"props":17626,"children":17627},{"style":2321},[17628],{"type":26,"value":17629},"c ",{"type":21,"tag":2314,"props":17631,"children":17632},{"style":3157},[17633],{"type":26,"value":2168},{"type":21,"tag":2314,"props":17635,"children":17636},{"style":2339},[17637],{"type":26,"value":17638}," 4096",{"type":21,"tag":2314,"props":17640,"children":17641},{"style":3157},[17642],{"type":26,"value":3604},{"type":21,"tag":2314,"props":17644,"children":17645},{"style":2339},[17646],{"type":26,"value":3302},{"type":21,"tag":2314,"props":17648,"children":17649},{"style":2350},[17650],{"type":26,"value":3307},{"type":21,"tag":2314,"props":17652,"children":17653},{"style":2321},[17654],{"type":26,"value":3257},{"type":21,"tag":22,"props":17656,"children":17657},{},[17658],{"type":26,"value":12339},{"type":21,"tag":2304,"props":17660,"children":17662},{"code":17661},"0101  theta_est = 0.3125   p = 0.8823\n0100  theta_est = 0.2500   p = 0.0542\n0110  theta_est = 0.3750   p = 0.0220\n0011  theta_est = 0.1875   p = 0.0093\n0111  theta_est = 0.4375   p = 0.0063\n0010  theta_est = 0.1250   p = 0.0049\n",[17663],{"type":21,"tag":2073,"props":17664,"children":17665},{"__ignoreMap":7},[17666],{"type":26,"value":17661},{"type":21,"tag":22,"props":17668,"children":17669},{},[17670,17672,17677],{"type":26,"value":17671},"The distribution is peaked, not delta-shaped. 88% of shots land on 5\u002F16 = 0.3125, the closest 4-bit value to 0.3. The rest spread out, decaying fast as you move away from the peak. This is the generic behaviour: ",{"type":21,"tag":136,"props":17673,"children":17674},{},[17675],{"type":26,"value":17676},"you get the nearest n-bit value with high probability, not certainty.",{"type":26,"value":17678}," The standard guarantee is that the best n-bit estimate appears with probability at least 4\u002Fπ² ≈ 40.5%. Here we're comfortably above that.",{"type":21,"tag":22,"props":17680,"children":17681},{},[17682,17684,17689],{"type":26,"value":17683},"Two things improve together when you add counting qubits: finer resolution ",{"type":21,"tag":362,"props":17685,"children":17686},{},[17687],{"type":26,"value":17688},"and",{"type":26,"value":17690}," a tighter peak. Same θ = 0.3 with 8 counting qubits:",{"type":21,"tag":2304,"props":17692,"children":17694},{"code":17693},"01001101  theta_est = 0.30078   p = 0.8718\n01001100  theta_est = 0.29688   p = 0.0596\n01001110  theta_est = 0.30469   p = 0.0276\n01001111  theta_est = 0.30859   p = 0.0076\n01001011  theta_est = 0.29297   p = 0.0073\n",[17695],{"type":21,"tag":2073,"props":17696,"children":17697},{"__ignoreMap":7},[17698],{"type":26,"value":17693},{"type":21,"tag":22,"props":17700,"children":17701},{},[17702,17704,17709],{"type":26,"value":17703},"Resolution went from ±0.031 to ±0.002, and the peak stayed at 87%. In general, to get n bits of precision with success probability 1 − ε you use n + O(log(1\u002Fε)) counting qubits. A handful of extra ",{"type":21,"tag":46,"props":17705,"children":17706},{"href":8931},[17707],{"type":26,"value":17708},"ancillas",{"type":26,"value":17710}," buys you a lot of confidence.",{"type":21,"tag":22,"props":17712,"children":17713},{},[17714,17716,17721],{"type":26,"value":17715},"The cost is the part people underestimate. Counting qubit k needs U applied 2^k times. Total controlled-U applications across the register: 2ⁿ − 1. Every bit of precision ",{"type":21,"tag":136,"props":17717,"children":17718},{},[17719],{"type":26,"value":17720},"doubles",{"type":26,"value":17722}," the circuit depth. That's fine when U^(2^k) has an efficient closed form. For a phase gate it's only one gate with a bigger angle, which is why the demo above is cheap. For modular exponentiation in Shor's it's a genuine arithmetic circuit repeated exponentially many times, and the depth is brutal.",{"type":21,"tag":29,"props":17724,"children":17726},{"id":17725},"where-qpe-gets-used",[17727],{"type":26,"value":17728},"Where QPE gets used",{"type":21,"tag":22,"props":17730,"children":17731},{},[17732,17737,17739,17743,17745,17750],{"type":21,"tag":136,"props":17733,"children":17734},{},[17735],{"type":26,"value":17736},"Shor's algorithm.",{"type":26,"value":17738}," Take U|y⟩ = |ay mod N⟩. Its eigenphases are s\u002Fr for integer s, where r is the multiplicative order of a mod N. Run QPE, measure s\u002Fr as a binary fraction, recover r by continued fractions, and factor N with a GCD. That's the whole quantum part. Everything else in ",{"type":21,"tag":46,"props":17740,"children":17741},{"href":8562},[17742],{"type":26,"value":9602},{"type":26,"value":17744}," is number theory. Order finding is QPE. QPE is controlled powers plus an inverse QFT. The chain from the QFT post now closes. (The algorithm was recently ",{"type":21,"tag":46,"props":17746,"children":17747},{"href":9613},[17748],{"type":26,"value":17749},"machine-verified in Lean",{"type":26,"value":17751},", if you want the formal treatment.)",{"type":21,"tag":22,"props":17753,"children":17754},{},[17755,17760,17762,17767],{"type":21,"tag":136,"props":17756,"children":17757},{},[17758],{"type":26,"value":17759},"Quantum chemistry.",{"type":26,"value":17761}," Set U = e^{-iHt}. QPE returns the ground-state energy to whatever precision you're willing to pay depth for, and crucially, it returns it with a ",{"type":21,"tag":362,"props":17763,"children":17764},{},[17765],{"type":26,"value":17766},"provable",{"type":26,"value":17768}," error bound rather than a variational estimate. This is the long-term goal of quantum simulation, and it's the application most likely to matter commercially before cryptanalysis does.",{"type":21,"tag":22,"props":17770,"children":17771},{},[17772,17777,17778,17782,17784,17788,17790,17795],{"type":21,"tag":136,"props":17773,"children":17774},{},[17775],{"type":26,"value":17776},"Contrast with VQE.",{"type":26,"value":1301},{"type":21,"tag":46,"props":17779,"children":17780},{"href":321},[17781],{"type":26,"value":282},{"type":26,"value":17783}," attacks the same chemistry problem from the opposite direction. Instead of one deep coherent circuit, it uses a shallow ",{"type":21,"tag":46,"props":17785,"children":17786},{"href":13787},[17787],{"type":26,"value":13790},{"type":26,"value":17789}," plus a classical optimizer, as introduced in ",{"type":21,"tag":46,"props":17791,"children":17792},{"href":328},[17793],{"type":26,"value":17794},"Peruzzo et al. 2014",{"type":26,"value":17796},". The trade is explicit:",{"type":21,"tag":4020,"props":17798,"children":17799},{},[17800,17818],{"type":21,"tag":4024,"props":17801,"children":17802},{},[17803],{"type":21,"tag":4028,"props":17804,"children":17805},{},[17806,17809,17814],{"type":21,"tag":4032,"props":17807,"children":17808},{},[],{"type":21,"tag":4032,"props":17810,"children":17811},{},[17812],{"type":26,"value":17813},"QPE",{"type":21,"tag":4032,"props":17815,"children":17816},{},[17817],{"type":26,"value":282},{"type":21,"tag":4046,"props":17819,"children":17820},{},[17821,17839,17857,17875],{"type":21,"tag":4028,"props":17822,"children":17823},{},[17824,17829,17834],{"type":21,"tag":4053,"props":17825,"children":17826},{},[17827],{"type":26,"value":17828},"Circuit depth",{"type":21,"tag":4053,"props":17830,"children":17831},{},[17832],{"type":26,"value":17833},"Deep, grows as 2ⁿ in precision bits",{"type":21,"tag":4053,"props":17835,"children":17836},{},[17837],{"type":26,"value":17838},"Shallow, fixed ansatz",{"type":21,"tag":4028,"props":17840,"children":17841},{},[17842,17847,17852],{"type":21,"tag":4053,"props":17843,"children":17844},{},[17845],{"type":26,"value":17846},"Precision",{"type":21,"tag":4053,"props":17848,"children":17849},{},[17850],{"type":26,"value":17851},"Provable, arbitrary",{"type":21,"tag":4053,"props":17853,"children":17854},{},[17855],{"type":26,"value":17856},"Heuristic, ansatz-limited",{"type":21,"tag":4028,"props":17858,"children":17859},{},[17860,17865,17870],{"type":21,"tag":4053,"props":17861,"children":17862},{},[17863],{"type":26,"value":17864},"Measurements",{"type":21,"tag":4053,"props":17866,"children":17867},{},[17868],{"type":26,"value":17869},"Few shots",{"type":21,"tag":4053,"props":17871,"children":17872},{},[17873],{"type":26,"value":17874},"Many thousands per iteration",{"type":21,"tag":4028,"props":17876,"children":17877},{},[17878,17883,17888],{"type":21,"tag":4053,"props":17879,"children":17880},{},[17881],{"type":26,"value":17882},"Hardware era",{"type":21,"tag":4053,"props":17884,"children":17885},{},[17886],{"type":26,"value":17887},"Fault-tolerant",{"type":21,"tag":4053,"props":17889,"children":17890},{},[17891],{"type":21,"tag":46,"props":17892,"children":17893},{"href":371},[17894],{"type":26,"value":2258},{"type":21,"tag":22,"props":17896,"children":17897},{},[17898,17900,17905,17907,17911,17913,17917],{"type":26,"value":17899},"VQE runs today and gives you an answer you can't fully trust. QPE gives you an answer you trust and can't run today. Our ",{"type":21,"tag":46,"props":17901,"children":17902},{"href":292},[17903],{"type":26,"value":17904},"VQE walkthrough in PennyLane",{"type":26,"value":17906}," covers the near-term side. ",{"type":21,"tag":46,"props":17908,"children":17909},{"href":14023},[17910],{"type":26,"value":13739},{"type":26,"value":17912}," is generally the better fit for variational work while ",{"type":21,"tag":46,"props":17914,"children":17915},{"href":7045},[17916],{"type":26,"value":1363},{"type":26,"value":17918}," suits structured circuits like this one.",{"type":21,"tag":29,"props":17920,"children":17922},{"id":17921},"the-honest-caveat",[17923],{"type":26,"value":17924},"The honest caveat",{"type":21,"tag":22,"props":17926,"children":17927},{},[17928,17930,17934],{"type":26,"value":17929},"QPE is not a NISQ algorithm and no amount of clever ",{"type":21,"tag":46,"props":17931,"children":17932},{"href":5709},[17933],{"type":26,"value":5712},{"type":26,"value":17935}," will make it one.",{"type":21,"tag":22,"props":17937,"children":17938},{},[17939,17941,17945],{"type":26,"value":17940},"The circuit must stay coherent through 2ⁿ − 1 controlled-U applications, each of which decomposes into many native two-qubit gates. With two-qubit error around 0.5% on current hardware, a few hundred entangling gates leaves you with noise. ",{"type":21,"tag":46,"props":17942,"children":17943},{"href":8883},[17944],{"type":26,"value":15772},{"type":26,"value":17946}," sets a hard wall long before you reach chemically useful precision. Published hardware demonstrations of QPE are toy instances with 2-4 counting qubits, real, but not computations anyone needed done.",{"type":21,"tag":22,"props":17948,"children":17949},{},[17950,17952,17956,17958,17963,17965,17969,17971,17975,17977,17981,17983,17988],{"type":26,"value":17951},"QPE becomes practical when circuits run on ",{"type":21,"tag":46,"props":17953,"children":17954},{"href":1385},[17955],{"type":26,"value":1388},{"type":26,"value":17957}," rather than physical ones. Google's ",{"type":21,"tag":46,"props":17959,"children":17960},{"href":3701},[17961],{"type":26,"value":17962},"below-threshold result",{"type":26,"value":17964}," is the first real evidence that path is open, and our ",{"type":21,"tag":46,"props":17966,"children":17967},{"href":150},[17968],{"type":26,"value":1498},{"type":26,"value":17970}," covers what still has to happen. Until then: develop QPE on ",{"type":21,"tag":46,"props":17972,"children":17973},{"href":408},[17974],{"type":26,"value":8728},{"type":26,"value":17976},", where you verify it exactly, and reach for VQE or ",{"type":21,"tag":46,"props":17978,"children":17979},{"href":3940},[17980],{"type":26,"value":9232},{"type":26,"value":17982}," if you need results from ",{"type":21,"tag":46,"props":17984,"children":17985},{"href":99},[17986],{"type":26,"value":17987},"today's hardware",{"type":26,"value":761},{"type":21,"tag":22,"props":17990,"children":17991},{},[17992],{"type":26,"value":17993},"That's not a reason to skip learning it. QPE is the template for what a fault-tolerant algorithm looks like (deep, exact, and structured) and it's the piece that makes the QFT worth building.",{"type":21,"tag":29,"props":17995,"children":17996},{"id":8740},[17997],{"type":26,"value":17998},"Next steps",{"type":21,"tag":3080,"props":18000,"children":18001},{},[18002,18014,18027,18051],{"type":21,"tag":3084,"props":18003,"children":18004},{},[18005,18012],{"type":21,"tag":136,"props":18006,"children":18007},{},[18008],{"type":21,"tag":46,"props":18009,"children":18010},{"href":212},[18011],{"type":26,"value":8782},{"type":26,"value":18013},": build the same QPE circuit in Cirq or Braket",{"type":21,"tag":3084,"props":18015,"children":18016},{},[18017,18025],{"type":21,"tag":136,"props":18018,"children":18019},{},[18020],{"type":21,"tag":46,"props":18021,"children":18022},{"href":3831},[18023],{"type":26,"value":18024},"Courses",{"type":26,"value":18026},": structured paths through the algorithm canon",{"type":21,"tag":3084,"props":18028,"children":18029},{},[18030,18037,18038,18044,18045,18050],{"type":21,"tag":136,"props":18031,"children":18032},{},[18033],{"type":21,"tag":46,"props":18034,"children":18035},{"href":3917},[18036],{"type":26,"value":8803},{"type":26,"value":2408},{"type":21,"tag":46,"props":18039,"children":18041},{"href":18040},"\u002Fglossary\u002Fquantum-gate",[18042],{"type":26,"value":18043},"quantum gate",{"type":26,"value":1309},{"type":21,"tag":46,"props":18046,"children":18047},{"href":8931},[18048],{"type":26,"value":18049},"ancilla qubit",{"type":26,"value":8819},{"type":21,"tag":3084,"props":18052,"children":18053},{},[18054],{"type":26,"value":18055},"Extend the code above to a 2-qubit U with two eigenstates, feed in a superposition of both, and watch the counting register entangle with the eigenstate register. That's the mechanism behind order finding.",{"type":21,"tag":2688,"props":18057,"children":18058},{},[18059],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":18061},[18062,18063,18064,18065,18068,18069,18070,18071],{"id":16031,"depth":106,"text":16034},{"id":16122,"depth":106,"text":16125},{"id":16227,"depth":106,"text":16230},{"id":11719,"depth":106,"text":11722,"children":18066},[18067],{"id":17318,"depth":2335,"text":17321},{"id":17402,"depth":106,"text":17405},{"id":17725,"depth":106,"text":17728},{"id":17921,"depth":106,"text":17924},{"id":8740,"depth":106,"text":17998},"content:blog:quantum-phase-estimation-tutorial.md","blog\u002Fquantum-phase-estimation-tutorial.md","blog\u002Fquantum-phase-estimation-tutorial",{"_path":18076,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":18077,"description":18078,"date":18079,"author":11,"tags":18080,"readingTime":1364,"body":18082,"_type":111,"_id":19103,"_source":113,"_file":19104,"_stem":19105,"_extension":116},"\u002Fzh\u002Fblog\u002Fquantum-computing-new-vocabulary","量子计算的新词汇：16 个即将走向主流的术语","正如 AI 给我们带来了 'tokens'、'hallucinations' 和 'fine-tuning'，量子计算也正在构建自己的词汇体系。以下是开发者和企业在未来几年内将会使用的术语。","2026-03-15",[7103,14,18081],"Terminology",{"type":18,"children":18083,"toc":19084},[18084,18122,18127,18132,18136,18142,18150,18155,18181,18186,18189,18195,18203,18222,18227,18235,18240,18243,18249,18257,18269,18280,18292,18295,18301,18309,18320,18332,18335,18341,18349,18361,18451,18456,18459,18465,18473,18499,18511,18519,18524,18527,18533,18541,18553,18558,18561,18567,18575,18584,18589,18592,18598,18606,18630,18642,18647,18652,18655,18661,18669,18681,18693,18705,18708,18714,18722,18734,18739,18742,18748,18756,18775,18780,18783,18789,18797,18806,18811,18814,18820,18828,18847,18852,18855,18861,18869,18874,18884,18900,18905,18908,18914,18922,18934,18957,18970,18973,18978,18983,19056,19061,19066,19080],{"type":21,"tag":22,"props":18085,"children":18086},{},[18087,18089,18094,18096,18101,18102,18107,18108,18113,18115,18120],{"type":26,"value":18088},"当深度学习在 2022–2023 年前后进入主流时，它把一整套全新的词汇拖入了日常对话。突然之间，每个人都在谈论 ",{"type":21,"tag":362,"props":18090,"children":18091},{},[18092],{"type":26,"value":18093},"tokens",{"type":26,"value":18095},"、",{"type":21,"tag":362,"props":18097,"children":18098},{},[18099],{"type":26,"value":18100},"hallucinations",{"type":26,"value":18095},{"type":21,"tag":362,"props":18103,"children":18104},{},[18105],{"type":26,"value":18106},"context windows",{"type":26,"value":18095},{"type":21,"tag":362,"props":18109,"children":18110},{},[18111],{"type":26,"value":18112},"fine-tuning",{"type":26,"value":18114}," 和 ",{"type":21,"tag":362,"props":18116,"children":18117},{},[18118],{"type":26,"value":18119},"prompt engineering",{"type":26,"value":18121},"——这些术语在十年前几乎不存在于普通开发者的词汇表中。新一代\"AI 工程师\"应运而生，GPU 时间成了珍贵的商品，\"推理成本\"也成了工程预算中的一个条目。",{"type":21,"tag":22,"props":18123,"children":18124},{},[18125],{"type":26,"value":18126},"量子计算正走在一条相似的轨迹上。它处于曲线的更早期，但拐点正在到来——伴随而来的是一套新术语，它们将从研究论文走进职位描述、创业路演和 Stack Overflow 问答之中。其中一些术语已经存在于量子社区里。大多数在圈外还鲜为人知。而所有这些术语都值得现在就学习，趁其他人还没开始。",{"type":21,"tag":22,"props":18128,"children":18129},{},[18130],{"type":26,"value":18131},"以下是量子计算世界中 16 个有望走向主流的术语。",{"type":21,"tag":18133,"props":18134,"children":18135},"hr",{},[],{"type":21,"tag":29,"props":18137,"children":18139},{"id":18138},"_1-qpuquantum-processing-unit量子处理单元",[18140],{"type":26,"value":18141},"1. QPU（Quantum Processing Unit，量子处理单元）",{"type":21,"tag":22,"props":18143,"children":18144},{},[18145],{"type":21,"tag":136,"props":18146,"children":18147},{},[18148],{"type":26,"value":18149},"AI 对应概念：GPU",{"type":21,"tag":22,"props":18151,"children":18152},{},[18153],{"type":26,"value":18154},"\"你有 GPU 权限吗？\"成了 ML 团队中的一个标准问题。\"你有 QPU 权限吗？\"将会成为它在量子领域的对应版本。",{"type":21,"tag":22,"props":18156,"children":18157},{},[18158,18160,18165,18167,18172,18174,18179],{"type":26,"value":18159},"QPU 是执行量子电路的硬件芯片。IBM 把他们的系统称为",{"type":21,"tag":362,"props":18161,"children":18162},{},[18163],{"type":26,"value":18164},"量子计算机",{"type":26,"value":18166},"，NVIDIA 拥有用于 GPU 加速仿真的 ",{"type":21,"tag":136,"props":18168,"children":18169},{},[18170],{"type":26,"value":18171},"CUDA-Q",{"type":26,"value":18173},"，而 IonQ 的离子阱系统则是当今可用的保真度最高的 QPU。正如\"GPU 时间\"成了工程师争抢的资源一样，",{"type":21,"tag":136,"props":18175,"children":18176},{},[18177],{"type":26,"value":18178},"QPU 时间",{"type":26,"value":18180},"——即量子硬件上的实际执行周期——将会成为一种高价、可调度的资源。",{"type":21,"tag":22,"props":18182,"children":18183},{},[18184],{"type":26,"value":18185},"这个术语已经出现在云服务的定价页面上（AWS Braket、Azure Quantum）。五年之内，它将出现在职位描述里。",{"type":21,"tag":18133,"props":18187,"children":18188},{},[],{"type":21,"tag":29,"props":18190,"children":18192},{"id":18191},"_2-shot-budget发射次数预算",[18193],{"type":26,"value":18194},"2. Shot Budget（发射次数预算）",{"type":21,"tag":22,"props":18196,"children":18197},{},[18198],{"type":21,"tag":136,"props":18199,"children":18200},{},[18201],{"type":26,"value":18202},"AI 对应概念：Token budget \u002F context window",{"type":21,"tag":22,"props":18204,"children":18205},{},[18206,18208,18213,18215,18220],{"type":26,"value":18207},"当你运行一个量子电路时，你得到的不是单一答案——而是通过多次运行电路采样得到的一个",{"type":21,"tag":362,"props":18209,"children":18210},{},[18211],{"type":26,"value":18212},"概率分布",{"type":26,"value":18214},"。每一次运行称为一个 ",{"type":21,"tag":136,"props":18216,"children":18217},{},[18218],{"type":26,"value":18219},"shot",{"type":26,"value":18221},"。运行 1,000 次的电路比运行 100 次的同一电路消耗更多的 QPU 时间。",{"type":21,"tag":22,"props":18223,"children":18224},{},[18225],{"type":26,"value":18226},"\"shot budget\"——即你能负担得起的执行次数——将随着 QPU 访问规模的扩大而成为一个实实在在的优化问题。正如开发者学会精简 prompt 以控制在 token 限制之内一样，量子开发者也将学会设计电路，以最少的 shot budget 提取出最大的信号。",{"type":21,"tag":2194,"props":18228,"children":18229},{},[18230],{"type":21,"tag":22,"props":18231,"children":18232},{},[18233],{"type":26,"value":18234},"\"我们让 VQE 在 200 次 shot 内就收敛了，而不是 2,000 次——这把我们的 QPU 成本削减了 90%。\"",{"type":21,"tag":22,"props":18236,"children":18237},{},[18238],{"type":26,"value":18239},"这在诸如 VQE 和 QAOA 这样的变分算法中已经是一个真实存在的问题，因为 shot 噪声会直接影响结果质量。",{"type":21,"tag":18133,"props":18241,"children":18242},{},[],{"type":21,"tag":29,"props":18244,"children":18246},{"id":18245},"_3-quantum-advantage量子优势",[18247],{"type":26,"value":18248},"3. Quantum Advantage（量子优势）",{"type":21,"tag":22,"props":18250,"children":18251},{},[18252],{"type":21,"tag":136,"props":18253,"children":18254},{},[18255],{"type":26,"value":18256},"AI 对应概念：10 倍加速、\"超越人类\"",{"type":21,"tag":22,"props":18258,"children":18259},{},[18260,18262,18267],{"type":26,"value":18261},"\"quantum advantage\"（量子优势）指的是量子计算机在某个具体的、真实世界的问题上，比任何经典计算机都",{"type":21,"tag":362,"props":18263,"children":18264},{},[18265],{"type":26,"value":18266},"更快或更好",{"type":26,"value":18268},"地求解的那一刻。它相当于 AI 基准测试中的\"超越人类的表现\"在量子领域的对应版本。",{"type":21,"tag":22,"props":18270,"children":18271},{},[18272,18274,18278],{"type":26,"value":18273},"IBM 在 2023 年引入了相关术语 ",{"type":21,"tag":136,"props":18275,"children":18276},{},[18277],{"type":26,"value":1459},{"type":26,"value":18279},"（量子实用性），用来描述那些复杂到无法经典仿真、但又切实有用的电路——这是通向完整量子优势的一个更加务实的先导概念。随着硬件成熟，可以预期这两个术语都会出现在新闻稿、融资公告和监管讨论中。",{"type":21,"tag":22,"props":18281,"children":18282},{},[18283,18285,18290],{"type":26,"value":18284},"这个区别很重要：量子优势是",{"type":21,"tag":362,"props":18286,"children":18287},{},[18288],{"type":26,"value":18289},"问题 + 硬件组合",{"type":26,"value":18291},"的一种属性，而不是关于量子计算机\"更好\"的笼统论断。理解这一点，将把有见地的量子讨论与炒作区分开来。",{"type":21,"tag":18133,"props":18293,"children":18294},{},[],{"type":21,"tag":29,"props":18296,"children":18298},{"id":18297},"_4-quantum-utility量子实用性",[18299],{"type":26,"value":18300},"4. Quantum Utility（量子实用性）",{"type":21,"tag":22,"props":18302,"children":18303},{},[18304],{"type":21,"tag":136,"props":18305,"children":18306},{},[18307],{"type":26,"value":18308},"AI 对应概念：\"生产级 AI\" 与研究演示的对比",{"type":21,"tag":22,"props":18310,"children":18311},{},[18312,18314,18318],{"type":26,"value":18313},"与量子优势密切相关，",{"type":21,"tag":136,"props":18315,"children":18316},{},[18317],{"type":26,"value":1459},{"type":26,"value":18319},"（量子实用性）具体指的是：一个量子电路能产生对真实应用有用的结果，即便对该电路的经典仿真在原则上仍然可行，但实际操作起来并不现实。",{"type":21,"tag":22,"props":18321,"children":18322},{},[18323,18325,18330],{"type":26,"value":18324},"IBM 在 2023 年发表于 ",{"type":21,"tag":362,"props":18326,"children":18327},{},[18328],{"type":26,"value":18329},"Nature",{"type":26,"value":18331}," 的一篇论文中首次使用了这个术语，该论文证明了在其 Eagle 处理器上运行的某些量子电路所产生的结果，是经典仿真无法轻易验证的。相比完整的量子优势，这是一个更可实现、更近期的里程碑——也是我们在未来几年最有可能听到的那一个。",{"type":21,"tag":18133,"props":18333,"children":18334},{},[],{"type":21,"tag":29,"props":18336,"children":18338},{"id":18337},"_5-transpilation转译",[18339],{"type":26,"value":18340},"5. Transpilation（转译）",{"type":21,"tag":22,"props":18342,"children":18343},{},[18344],{"type":21,"tag":136,"props":18345,"children":18346},{},[18347],{"type":26,"value":18348},"AI 对应概念：模型编译 \u002F 量化",{"type":21,"tag":22,"props":18350,"children":18351},{},[18352,18354,18359],{"type":26,"value":18353},"在一个量子电路能够在真实硬件上运行之前，它必须经过",{"type":21,"tag":362,"props":18355,"children":18356},{},[18357],{"type":26,"value":18358},"转译",{"type":26,"value":18360},"（transpiled）——从抽象操作转换为硬件的原生门集合，并重新路由量子比特操作以满足物理连接性约束。这类似于深度学习模型必须针对特定芯片架构进行编译和优化。",{"type":21,"tag":2304,"props":18362,"children":18364},{"className":3145,"code":18363,"language":3147,"meta":7,"style":7},"from qiskit.compiler import transpile\n\n# Circuit written in abstract gates\ntranspiled = transpile(circuit, backend=real_qpu, optimization_level=3)\n",[18365],{"type":21,"tag":2073,"props":18366,"children":18367},{"__ignoreMap":7},[18368,18389,18396,18404],{"type":21,"tag":2314,"props":18369,"children":18370},{"class":2316,"line":2317},[18371,18375,18380,18384],{"type":21,"tag":2314,"props":18372,"children":18373},{"style":3157},[18374],{"type":26,"value":3160},{"type":21,"tag":2314,"props":18376,"children":18377},{"style":2321},[18378],{"type":26,"value":18379}," qiskit.compiler ",{"type":21,"tag":2314,"props":18381,"children":18382},{"style":3157},[18383],{"type":26,"value":3170},{"type":21,"tag":2314,"props":18385,"children":18386},{"style":2321},[18387],{"type":26,"value":18388}," transpile\n",{"type":21,"tag":2314,"props":18390,"children":18391},{"class":2316,"line":106},[18392],{"type":21,"tag":2314,"props":18393,"children":18394},{"emptyLinePlaceholder":3181},[18395],{"type":26,"value":3184},{"type":21,"tag":2314,"props":18397,"children":18398},{"class":2316,"line":2335},[18399],{"type":21,"tag":2314,"props":18400,"children":18401},{"style":3407},[18402],{"type":26,"value":18403},"# Circuit written in abstract gates\n",{"type":21,"tag":2314,"props":18405,"children":18406},{"class":2316,"line":2397},[18407,18412,18416,18421,18426,18430,18435,18439,18443,18447],{"type":21,"tag":2314,"props":18408,"children":18409},{"style":2321},[18410],{"type":26,"value":18411},"transpiled ",{"type":21,"tag":2314,"props":18413,"children":18414},{"style":3157},[18415],{"type":26,"value":3197},{"type":21,"tag":2314,"props":18417,"children":18418},{"style":2321},[18419],{"type":26,"value":18420}," transpile(circuit, ",{"type":21,"tag":2314,"props":18422,"children":18423},{"style":3222},[18424],{"type":26,"value":18425},"backend",{"type":21,"tag":2314,"props":18427,"children":18428},{"style":3157},[18429],{"type":26,"value":3197},{"type":21,"tag":2314,"props":18431,"children":18432},{"style":2321},[18433],{"type":26,"value":18434},"real_qpu, ",{"type":21,"tag":2314,"props":18436,"children":18437},{"style":3222},[18438],{"type":26,"value":6229},{"type":21,"tag":2314,"props":18440,"children":18441},{"style":3157},[18442],{"type":26,"value":3197},{"type":21,"tag":2314,"props":18444,"children":18445},{"style":2339},[18446],{"type":26,"value":6465},{"type":21,"tag":2314,"props":18448,"children":18449},{"style":2321},[18450],{"type":26,"value":3257},{"type":21,"tag":22,"props":18452,"children":18453},{},[18454],{"type":26,"value":18455},"随着量子计算走向生产环境，\"转译开销\"（transpilation overhead）和\"转译深度\"（transpilation depth）将成为标准的工程考量——就像今天的推理延迟和模型量化一样。",{"type":21,"tag":18133,"props":18457,"children":18458},{},[],{"type":21,"tag":29,"props":18460,"children":18462},{"id":18461},"_6-coherence-time相干时间t1-t2",[18463],{"type":26,"value":18464},"6. Coherence Time（相干时间，T1 \u002F T2）",{"type":21,"tag":22,"props":18466,"children":18467},{},[18468],{"type":21,"tag":136,"props":18469,"children":18470},{},[18471],{"type":26,"value":18472},"AI 对应概念：Context window \u002F 内存限制",{"type":21,"tag":22,"props":18474,"children":18475},{},[18476,18478,18483,18485,18490,18492,18497],{"type":26,"value":18477},"量子比特不会永远保持量子态。它会衰减——通过一个称为",{"type":21,"tag":362,"props":18479,"children":18480},{},[18481],{"type":26,"value":18482},"退相干",{"type":26,"value":18484},"（decoherence）的过程，在环境噪声中失去其叠加态。",{"type":21,"tag":136,"props":18486,"children":18487},{},[18488],{"type":26,"value":18489},"T1 时间",{"type":26,"value":18491},"（能量弛豫）和 ",{"type":21,"tag":136,"props":18493,"children":18494},{},[18495],{"type":26,"value":18496},"T2 时间",{"type":26,"value":18498},"（相位相干）衡量了量子比特能保持可用状态多长时间。",{"type":21,"tag":22,"props":18500,"children":18501},{},[18502,18504,18509],{"type":26,"value":18503},"这相当于量子领域的 context window：它定义了在量子比特退化为经典噪声之前，你能执行的",{"type":21,"tag":362,"props":18505,"children":18506},{},[18507],{"type":26,"value":18508},"最大电路深度",{"type":26,"value":18510},"。IBM 的超导量子比特的 T2 时间约为 100–300 微秒。IonQ 的离子阱量子比特的 T2 时间超过一秒——这正是它们的电路可以深得多的原因。",{"type":21,"tag":2194,"props":18512,"children":18513},{},[18514],{"type":21,"tag":22,"props":18515,"children":18516},{},[18517],{"type":26,"value":18518},"\"我们的电路对这个后端来说太深了——最后一个门还没执行完，我们就会撞上 T2。\"",{"type":21,"tag":22,"props":18520,"children":18521},{},[18522],{"type":26,"value":18523},"开发者将学会像预算内存那样去预算相干时间。",{"type":21,"tag":18133,"props":18525,"children":18526},{},[],{"type":21,"tag":29,"props":18528,"children":18530},{"id":18529},"_7-decoherence-budget退相干预算",[18531],{"type":26,"value":18532},"7. Decoherence Budget（退相干预算）",{"type":21,"tag":22,"props":18534,"children":18535},{},[18536],{"type":21,"tag":136,"props":18537,"children":18538},{},[18539],{"type":26,"value":18540},"AI 对应概念：延迟预算 \u002F 计算预算",{"type":21,"tag":22,"props":18542,"children":18543},{},[18544,18546,18551],{"type":26,"value":18545},"这是 T1\u002FT2 的一个自然延伸：",{"type":21,"tag":136,"props":18547,"children":18548},{},[18549],{"type":26,"value":18550},"decoherence budget",{"type":26,"value":18552},"（退相干预算）是指在误差累积到失去可用性之前，一个电路可用于完成计算的总\"相干时间\"。更长的电路会消耗更多的退相干预算。",{"type":21,"tag":22,"props":18554,"children":18555},{},[18556],{"type":26,"value":18557},"随着量子应用变得更加复杂，架构师将设计出保持在退相干预算之内的系统——在电路深度与结果保真度之间做权衡，类似于今天的后端工程师在响应延迟与计算成本之间做权衡。",{"type":21,"tag":18133,"props":18559,"children":18560},{},[],{"type":21,"tag":29,"props":18562,"children":18564},{"id":18563},"_8-circuit-fidelity电路保真度",[18565],{"type":26,"value":18566},"8. Circuit Fidelity（电路保真度）",{"type":21,"tag":22,"props":18568,"children":18569},{},[18570],{"type":21,"tag":136,"props":18571,"children":18572},{},[18573],{"type":26,"value":18574},"AI 对应概念：模型准确率 \u002F F1 分数",{"type":21,"tag":22,"props":18576,"children":18577},{},[18578,18582],{"type":21,"tag":136,"props":18579,"children":18580},{},[18581],{"type":26,"value":13585},{"type":26,"value":18583},"（保真度）衡量的是电路实际产生的量子态与理想理论态之间的接近程度。保真度为 99% 的电路是出色的。而 90% 的电路对于精密应用可能就毫无用处。",{"type":21,"tag":22,"props":18585,"children":18586},{},[18587],{"type":26,"value":18588},"保真度会随着每施加一个门（每个门都有错误率）以及电路深度的增加（更长的电路退相干更严重）而下降。它将成为 QPU 结果的首要质量指标——相当于量子领域中模型在基准测试上的准确率。",{"type":21,"tag":18133,"props":18590,"children":18591},{},[],{"type":21,"tag":29,"props":18593,"children":18595},{"id":18594},"_9-physical-vs-logical-qubit物理量子比特与逻辑量子比特",[18596],{"type":26,"value":18597},"9. Physical vs. Logical Qubit（物理量子比特与逻辑量子比特）",{"type":21,"tag":22,"props":18599,"children":18600},{},[18601],{"type":21,"tag":136,"props":18602,"children":18603},{},[18604],{"type":26,"value":18605},"AI 对应概念：原始参数量与有效模型容量的对比",{"type":21,"tag":22,"props":18607,"children":18608},{},[18609,18611,18615,18617,18621,18623,18628],{"type":26,"value":18610},"一个正在走向主流的最重要区别：",{"type":21,"tag":136,"props":18612,"children":18613},{},[18614],{"type":26,"value":8878},{"type":26,"value":18616},"（物理量子比特）是真实的硬件量子比特（有噪声、易出错）。",{"type":21,"tag":136,"props":18618,"children":18619},{},[18620],{"type":26,"value":8907},{"type":26,"value":18622},"（逻辑量子比特）则是一个",{"type":21,"tag":362,"props":18624,"children":18625},{},[18626],{"type":26,"value":18627},"经过纠错的",{"type":26,"value":18629},"量子比特，编码在许多物理量子比特之上——可靠，但代价高昂。",{"type":21,"tag":22,"props":18631,"children":18632},{},[18633,18635,18640],{"type":26,"value":18634},"如今最好的硬件（IBM、IonQ）都在用物理量子比特运行。完全容错的量子计算需要逻辑量子比特。目前的估计是，对于表面码纠错，其比例为",{"type":21,"tag":136,"props":18636,"children":18637},{},[18638],{"type":26,"value":18639},"每个逻辑量子比特需要 1,000–10,000 个物理量子比特",{"type":26,"value":18641},"。",{"type":21,"tag":22,"props":18643,"children":18644},{},[18645],{"type":26,"value":18646},"当你听到\"IBM 拥有 1,000 个量子比特\"时，那指的是物理量子比特。一台能够针对 RSA-2048 运行 Shor 算法的容错计算机将需要数百万个物理量子比特。",{"type":21,"tag":22,"props":18648,"children":18649},{},[18650],{"type":26,"value":18651},"理解这个区别，对于把量子硬件的营销宣传与技术现实区分开来至关重要。",{"type":21,"tag":18133,"props":18653,"children":18654},{},[],{"type":21,"tag":29,"props":18656,"children":18658},{"id":18657},"_10-quantum-safe-post-quantum-cryptography抗量子-后量子密码学",[18659],{"type":26,"value":18660},"10. Quantum-Safe \u002F Post-Quantum Cryptography（抗量子 \u002F 后量子密码学）",{"type":21,"tag":22,"props":18662,"children":18663},{},[18664],{"type":21,"tag":136,"props":18665,"children":18666},{},[18667],{"type":26,"value":18668},"AI 对应概念：\"抗 AI\"（不太贴切）→ 实际上更接近\"算法领域的 GDPR\"",{"type":21,"tag":22,"props":18670,"children":18671},{},[18672,18674,18679],{"type":26,"value":18673},"这个术语已经在走出研究世界。",{"type":21,"tag":136,"props":18675,"children":18676},{},[18677],{"type":26,"value":18678},"Post-quantum cryptography",{"type":26,"value":18680},"（后量子密码学，PQC）指的是被设计用来抵御量子计算机攻击的经典密码算法。威胁在于：Shor 算法能够分解支撑 RSA 的大素数，从而攻破当今大多数公钥加密。",{"type":21,"tag":22,"props":18682,"children":18683},{},[18684,18686,18691],{"type":26,"value":18685},"NIST 在 2024 年敲定了其首批后量子密码学标准（CRYSTALS-Kyber、CRYSTALS-Dilithium）。",{"type":21,"tag":136,"props":18687,"children":18688},{},[18689],{"type":26,"value":18690},"\"Quantum-safe\"",{"type":26,"value":18692},"（抗量子）将在五年之内成为一个认证与合规术语——出现在安全审计、采购要求和云服务商文档中。",{"type":21,"tag":22,"props":18694,"children":18695},{},[18696,18698,18703],{"type":26,"value":18697},"大多数组织都应该防范的攻击途径是：",{"type":21,"tag":136,"props":18699,"children":18700},{},[18701],{"type":26,"value":18702},"\"harvest now, decrypt later\"",{"type":26,"value":18704},"（先收集，后解密）——攻击者如今收集加密数据，意图在量子计算机能力足够强大时再将其解密。",{"type":21,"tag":18133,"props":18706,"children":18707},{},[],{"type":21,"tag":29,"props":18709,"children":18711},{"id":18710},"_11-hybrid-algorithm-quantum-classical-hybrid混合算法-量子-经典混合",[18712],{"type":26,"value":18713},"11. Hybrid Algorithm \u002F Quantum-Classical Hybrid（混合算法 \u002F 量子-经典混合）",{"type":21,"tag":22,"props":18715,"children":18716},{},[18717],{"type":21,"tag":136,"props":18718,"children":18719},{},[18720],{"type":26,"value":18721},"AI 对应概念：\"AI 辅助\"工作流、CPU+GPU 异构计算",{"type":21,"tag":22,"props":18723,"children":18724},{},[18725,18727,18732],{"type":26,"value":18726},"几乎所有近期的量子应用都是",{"type":21,"tag":136,"props":18728,"children":18729},{},[18730],{"type":26,"value":18731},"混合式",{"type":26,"value":18733},"的：一个经典优化器反复调用一个量子电路，把经典计算机难以处理的部分（态制备、干涉）交给量子硬件，而由经典计算机处理优化循环。",{"type":21,"tag":22,"props":18735,"children":18736},{},[18737],{"type":26,"value":18738},"VQE 和 QAOA 是典型的混合算法。随着量子编程框架的成熟，\"混合工作流编排\"——管理经典计算与量子计算之间的交接——将成为一个标准的软件工程问题。可以预期，围绕它会涌现出各种工具、框架和职位头衔。",{"type":21,"tag":18133,"props":18740,"children":18741},{},[],{"type":21,"tag":29,"props":18743,"children":18745},{"id":18744},"_12-variational-circuit变分电路parameterized-quantum-circuit",[18746],{"type":26,"value":18747},"12. Variational Circuit（变分电路，Parameterized Quantum Circuit）",{"type":21,"tag":22,"props":18749,"children":18750},{},[18751],{"type":21,"tag":136,"props":18752,"children":18753},{},[18754],{"type":26,"value":18755},"AI 对应概念：神经网络（可训练权重）",{"type":21,"tag":22,"props":18757,"children":18758},{},[18759,18761,18766,18768,18773],{"type":26,"value":18760},"一个",{"type":21,"tag":136,"props":18762,"children":18763},{},[18764],{"type":26,"value":18765},"变分电路",{"type":26,"value":18767},"（variational circuit）或",{"type":21,"tag":136,"props":18769,"children":18770},{},[18771],{"type":26,"value":18772},"参数化量子电路",{"type":26,"value":18774},"（parameterized quantum circuit，PQC）是一个带有可调旋转角度的量子电路——本质上就是一个量子神经网络层。这些参数由一个经典优化器进行调整，以最小化某个代价函数。",{"type":21,"tag":22,"props":18776,"children":18777},{},[18778],{"type":26,"value":18779},"VQE 使用变分电路作为能量估计器。QAOA 则用它来编码优化问题。随着量子机器学习的发展，\"训练一个量子电路\"将变得像\"训练一个神经网络\"一样自然。",{"type":21,"tag":18133,"props":18781,"children":18782},{},[],{"type":21,"tag":29,"props":18784,"children":18786},{"id":18785},"_13-quantum-volume量子体积qv",[18787],{"type":26,"value":18788},"13. Quantum Volume（量子体积，QV）",{"type":21,"tag":22,"props":18790,"children":18791},{},[18792],{"type":21,"tag":136,"props":18793,"children":18794},{},[18795],{"type":26,"value":18796},"AI 对应概念：FLOPS、基准测试分数（MLPerf）",{"type":21,"tag":22,"props":18798,"children":18799},{},[18800,18804],{"type":21,"tag":136,"props":18801,"children":18802},{},[18803],{"type":26,"value":3105},{"type":26,"value":18805},"（量子体积）是 IBM 引入的一个单一数值基准，它整体性地刻画了 QPU 的性能——同时兼顾量子比特数量、门保真度、连接性以及最大可执行电路深度。",{"type":21,"tag":22,"props":18807,"children":18808},{},[18809],{"type":26,"value":18810},"一台 QV 为 128（= 2^7，等价于 7 量子比特电路）的 QPU 优于一台 QV 为 64 的 QPU，即便后者拥有更多的原始量子比特。它是量子世界的\"MLPerf 分数\"——一个厂商会用来做宣传、开发者会用来比较硬件的数字。",{"type":21,"tag":18133,"props":18812,"children":18813},{},[],{"type":21,"tag":29,"props":18815,"children":18817},{"id":18816},"_14-quantum-job-quantum-queue量子作业-量子队列",[18818],{"type":26,"value":18819},"14. Quantum Job \u002F Quantum Queue（量子作业 \u002F 量子队列）",{"type":21,"tag":22,"props":18821,"children":18822},{},[18823],{"type":21,"tag":136,"props":18824,"children":18825},{},[18826],{"type":26,"value":18827},"AI 对应概念：批量推理作业、GPU 队列",{"type":21,"tag":22,"props":18829,"children":18830},{},[18831,18833,18838,18840,18845],{"type":26,"value":18832},"当你把一个电路提交给真实的 QPU 时，你提交的是一个进入",{"type":21,"tag":136,"props":18834,"children":18835},{},[18836],{"type":26,"value":18837},"量子队列",{"type":26,"value":18839},"（quantum queue）的",{"type":21,"tag":136,"props":18841,"children":18842},{},[18843],{"type":26,"value":18844},"量子作业",{"type":26,"value":18846},"（quantum job）——量子队列是一个管理共享硬件访问的调度系统。IBM Quantum 免费层的作业常常要在队列中排在付费层客户后面等待数分钟乃至数小时。",{"type":21,"tag":22,"props":18848,"children":18849},{},[18850],{"type":26,"value":18851},"\"作业吞吐量\"、\"队列深度\"和\"作业优先级\"将成为量子基础设施团队的运维指标——在本质上与今天管理 GPU 集群作业队列如出一辙。",{"type":21,"tag":18133,"props":18853,"children":18854},{},[],{"type":21,"tag":29,"props":18856,"children":18858},{"id":18857},"_15-error-mitigation-vs-error-correction错误缓解与错误纠正",[18859],{"type":26,"value":18860},"15. Error Mitigation vs. Error Correction（错误缓解与错误纠正）",{"type":21,"tag":22,"props":18862,"children":18863},{},[18864],{"type":21,"tag":136,"props":18865,"children":18866},{},[18867],{"type":26,"value":18868},"AI 对应概念：正则化（缓解）与硬件 ECC（纠正）",{"type":21,"tag":22,"props":18870,"children":18871},{},[18872],{"type":26,"value":18873},"这个区别很重要，而且一旦量子走向主流，它将被不断地误用。",{"type":21,"tag":22,"props":18875,"children":18876},{},[18877,18882],{"type":21,"tag":136,"props":18878,"children":18879},{},[18880],{"type":26,"value":18881},"Error correction",{"type":26,"value":18883},"（错误纠正）——用冗余来编码逻辑量子比特，从而能够检测并修复错误。需要约 1,000:1 的物理量子比特对逻辑量子比特的开销。目前尚无法大规模实现。",{"type":21,"tag":22,"props":18885,"children":18886},{},[18887,18891,18893,18898],{"type":21,"tag":136,"props":18888,"children":18889},{},[18890],{"type":26,"value":4004},{"type":26,"value":18892},"（错误缓解）——一种经典的后处理技术，在",{"type":21,"tag":362,"props":18894,"children":18895},{},[18896],{"type":26,"value":18897},"不",{"type":26,"value":18899},"进行物理纠正的情况下，从统计上降低噪声的影响。零噪声外推、概率性错误抵消、测量错误缓解。现已可用，运行在 NISQ 硬件上。",{"type":21,"tag":22,"props":18901,"children":18902},{},[18903],{"type":26,"value":18904},"当某个厂商声称他们的 QPU\"能处理错误\"时，一定要问清楚他们指的是哪一种。",{"type":21,"tag":18133,"props":18906,"children":18907},{},[],{"type":21,"tag":29,"props":18909,"children":18911},{"id":18910},"_16-quantum-developer-quantum-engineer量子开发者-量子工程师",[18912],{"type":26,"value":18913},"16. Quantum Developer \u002F Quantum Engineer（量子开发者 \u002F 量子工程师）",{"type":21,"tag":22,"props":18915,"children":18916},{},[18917],{"type":21,"tag":136,"props":18918,"children":18919},{},[18920],{"type":26,"value":18921},"AI 对应概念：ML Engineer、AI Engineer、Prompt Engineer",{"type":21,"tag":22,"props":18923,"children":18924},{},[18925,18927,18932],{"type":26,"value":18926},"或许是最具影响力的新术语：",{"type":21,"tag":136,"props":18928,"children":18929},{},[18930],{"type":26,"value":18931},"quantum developer",{"type":26,"value":18933},"（量子开发者）。正如\"AI 工程师\"这一角色在 2023 年前后成型——既区别于传统软件工程，也区别于 ML 研究——\"量子开发者\"这一角色也正围绕着一套特定的技能组合逐渐成形：",{"type":21,"tag":3080,"props":18935,"children":18936},{},[18937,18942,18947,18952],{"type":21,"tag":3084,"props":18938,"children":18939},{},[18940],{"type":26,"value":18941},"用 Qiskit、Cirq 或 HLQuantum 等框架编写电路",{"type":21,"tag":3084,"props":18943,"children":18944},{},[18945],{"type":26,"value":18946},"理解硬件约束（连接性、噪声、相干性）",{"type":21,"tag":3084,"props":18948,"children":18949},{},[18950],{"type":26,"value":18951},"设计混合的经典-量子工作流",{"type":21,"tag":3084,"props":18953,"children":18954},{},[18955],{"type":26,"value":18956},"解读概率性结果和保真度指标",{"type":21,"tag":22,"props":18958,"children":18959},{},[18960,18962,18968],{"type":26,"value":18961},"像 ",{"type":21,"tag":46,"props":18963,"children":18965},{"href":18964},"\u002Fhlquantum",[18966],{"type":26,"value":18967},"HLQuantum",{"type":26,"value":18969}," 这样的工具——它们提供了一个横跨所有后端的统一 API——正在加速这一进程，让开发者无需深入掌握每个 SDK 的种种特性就能编写可移植的量子代码。2028 年的\"量子开发者\"很可能会像今天的 Web 开发者使用框架那样去使用一个抽象层，而不是为每个后端编写原始电路。",{"type":21,"tag":18133,"props":18971,"children":18972},{},[],{"type":21,"tag":29,"props":18974,"children":18976},{"id":18975},"规律",[18977],{"type":26,"value":18975},{"type":21,"tag":22,"props":18979,"children":18980},{},[18981],{"type":26,"value":18982},"纵观这 16 个术语，一种规律浮现出来。每一次重大的平台变革都会催生：",{"type":21,"tag":6961,"props":18984,"children":18985},{},[18986,18996,19006,19016,19026,19036,19046],{"type":21,"tag":3084,"props":18987,"children":18988},{},[18989,18994],{"type":21,"tag":136,"props":18990,"children":18991},{},[18992],{"type":26,"value":18993},"一个新的计算单位",{"type":26,"value":18995},"——GPU → QPU，tokens → shots",{"type":21,"tag":3084,"props":18997,"children":18998},{},[18999,19004],{"type":21,"tag":136,"props":19000,"children":19001},{},[19002],{"type":26,"value":19003},"一个新的资源约束",{"type":26,"value":19005},"——VRAM、context window → 相干时间、shot budget",{"type":21,"tag":3084,"props":19007,"children":19008},{},[19009,19014],{"type":21,"tag":136,"props":19010,"children":19011},{},[19012],{"type":26,"value":19013},"一个新的质量指标",{"type":26,"value":19015},"——准确率、F1 → 保真度、量子体积",{"type":21,"tag":3084,"props":19017,"children":19018},{},[19019,19024],{"type":21,"tag":136,"props":19020,"children":19021},{},[19022],{"type":26,"value":19023},"一个新的编译步骤",{"type":26,"value":19025},"——模型量化 → 转译",{"type":21,"tag":3084,"props":19027,"children":19028},{},[19029,19034],{"type":21,"tag":136,"props":19030,"children":19031},{},[19032],{"type":26,"value":19033},"一种新的混合架构",{"type":26,"value":19035},"——CPU+GPU → 经典+量子",{"type":21,"tag":3084,"props":19037,"children":19038},{},[19039,19044],{"type":21,"tag":136,"props":19040,"children":19041},{},[19042],{"type":26,"value":19043},"一个新的安全面",{"type":26,"value":19045},"——对抗性 ML → 后量子密码学",{"type":21,"tag":3084,"props":19047,"children":19048},{},[19049,19054],{"type":21,"tag":136,"props":19050,"children":19051},{},[19052],{"type":26,"value":19053},"一个新的职位头衔",{"type":26,"value":19055},"——ML 工程师 → 量子工程师",{"type":21,"tag":22,"props":19057,"children":19058},{},[19059],{"type":26,"value":19060},"量子计算的词汇不仅仅是行话——它直接对应着真实的工程约束、真实的权衡和真实的机遇。在主流浪潮到来之前就学会它，与早期的云工程师在大多数开发者之前就开始关注\"延迟\"和\"吞吐量\"时所下的那一注是同一种赌注。",{"type":21,"tag":22,"props":19062,"children":19063},{},[19064],{"type":26,"value":19065},"最好的开始时机是五年前。第二好的时机就是现在——趁硬件还能免费访问、学习曲线还处于最低点的时候。",{"type":21,"tag":22,"props":19067,"children":19068},{},[19069,19074,19075],{"type":21,"tag":136,"props":19070,"children":19071},{},[19072],{"type":26,"value":19073},"从这里开始：",{"type":26,"value":1301},{"type":21,"tag":46,"props":19076,"children":19077},{"href":408},[19078],{"type":26,"value":19079},"免费运行你的第一个量子电路 →",{"type":21,"tag":2688,"props":19081,"children":19082},{},[19083],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":19085},[19086,19087,19088,19089,19090,19091,19092,19093,19094,19095,19096,19097,19098,19099,19100,19101,19102],{"id":18138,"depth":106,"text":18141},{"id":18191,"depth":106,"text":18194},{"id":18245,"depth":106,"text":18248},{"id":18297,"depth":106,"text":18300},{"id":18337,"depth":106,"text":18340},{"id":18461,"depth":106,"text":18464},{"id":18529,"depth":106,"text":18532},{"id":18563,"depth":106,"text":18566},{"id":18594,"depth":106,"text":18597},{"id":18657,"depth":106,"text":18660},{"id":18710,"depth":106,"text":18713},{"id":18744,"depth":106,"text":18747},{"id":18785,"depth":106,"text":18788},{"id":18816,"depth":106,"text":18819},{"id":18857,"depth":106,"text":18860},{"id":18910,"depth":106,"text":18913},{"id":18975,"depth":106,"text":18975},"content:zh:blog:quantum-computing-new-vocabulary.md","zh\u002Fblog\u002Fquantum-computing-new-vocabulary.md","zh\u002Fblog\u002Fquantum-computing-new-vocabulary",{"_path":19107,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":19108,"description":19109,"date":19110,"author":11,"tags":19111,"readingTime":1364,"body":19112,"_type":111,"_id":20121,"_source":113,"_file":20122,"_stem":20123,"_extension":116},"\u002Fzh\u002Fblog\u002Fquantum-use-cases-2026","2026 年量子计算机究竟能做什么","务实审视哪些量子计算应用现在已可投入生产、哪些属于近期可期、哪些仍是长期研究目标——把真正的进展与炒作区分开来。","2026-03-12",[14,2019,7102],{"type":18,"children":19113,"toc":20101},[19114,19119,19124,19129,19134,19167,19172,19175,19181,19187,19197,19207,19217,19227,19237,19402,19405,19411,19420,19429,19447,19457,19466,19469,19475,19484,19501,19510,19527,19530,19536,19545,19554,19571,19581,19584,19590,19595,19604,19613,19623,19633,19636,19642,19667,19676,19685,19688,19694,19703,19712,19721,19730,19733,19739,19745,19754,19764,19774,19791,19794,19800,19809,19818,19827,19830,19835,19844,19853,19862,19865,19870,20036,20054,20066,20071,20097],{"type":21,"tag":22,"props":19115,"children":19116},{},[19117],{"type":26,"value":19118},"“量子计算机将彻底变革药物研发、破解所有加密、解决气候变化。”这套说辞你已经听过。现在给出诚实的答案：在当今现有的硬件上，2026 年量子计算机究竟能做什么？",{"type":21,"tag":22,"props":19120,"children":19121},{},[19122],{"type":26,"value":19123},"诚实的答案是微妙的——而且比炒作或怀疑所暗示的都更有趣。",{"type":21,"tag":29,"props":19125,"children":19127},{"id":19126},"如何看待量子技术的成熟度",[19128],{"type":26,"value":19126},{"type":21,"tag":22,"props":19130,"children":19131},{},[19132],{"type":26,"value":19133},"量子应用分为三类：",{"type":21,"tag":3080,"props":19135,"children":19136},{},[19137,19147,19157],{"type":21,"tag":3084,"props":19138,"children":19139},{},[19140,19145],{"type":21,"tag":136,"props":19141,"children":19142},{},[19143],{"type":26,"value":19144},"NISQ 时代的应用（当下）：",{"type":26,"value":19146}," 在当今 50–1000 量子比特、电路深度有限的含噪硬件上可运行的算法。结果可能是近似的。价值在于探索性或演示性。",{"type":21,"tag":3084,"props":19148,"children":19149},{},[19150,19155],{"type":21,"tag":136,"props":19151,"children":19152},{},[19153],{"type":26,"value":19154},"近期应用（2–7 年）：",{"type":26,"value":19156}," 需要适度的纠错——数百到数千个逻辑量子比特。针对特定问题实例的实用加速开始出现。",{"type":21,"tag":3084,"props":19158,"children":19159},{},[19160,19165],{"type":21,"tag":136,"props":19161,"children":19162},{},[19163],{"type":26,"value":19164},"长期应用（7–20 年以上）：",{"type":26,"value":19166}," 需要数百万个物理量子比特和完整的容错能力。具有变革性的影响。",{"type":21,"tag":22,"props":19168,"children":19169},{},[19170],{"type":26,"value":19171},"炒作与现实之间的鸿沟，大多源于把这三类混为一谈。",{"type":21,"tag":18133,"props":19173,"children":19174},{},[],{"type":21,"tag":29,"props":19176,"children":19178},{"id":19177},"现在能做什么nisq-时代",[19179],{"type":26,"value":19180},"现在能做什么（NISQ 时代）",{"type":21,"tag":17316,"props":19182,"children":19184},{"id":19183},"量子化学模拟有限的分子",[19185],{"type":26,"value":19186},"量子化学模拟——有限的分子",{"type":21,"tag":22,"props":19188,"children":19189},{},[19190,19195],{"type":21,"tag":136,"props":19191,"children":19192},{},[19193],{"type":26,"value":19194},"是什么：",{"type":26,"value":19196}," 使用 VQE 模拟小分子的基态能量。",{"type":21,"tag":22,"props":19198,"children":19199},{},[19200,19205],{"type":21,"tag":136,"props":19201,"children":19202},{},[19203],{"type":26,"value":19204},"已演示：",{"type":26,"value":19206}," IBM 及其他团队已在真实 QPU 上计算了 H₂、LiH、BeH₂ 以及小型碳氢化合物的基态能量。对于 4–12 量子比特的问题，结果与经典方法一致。",{"type":21,"tag":22,"props":19208,"children":19209},{},[19210,19215],{"type":21,"tag":136,"props":19211,"children":19212},{},[19213],{"type":26,"value":19214},"当下的实用价值：",{"type":26,"value":19216}," 研究与基准测试。对于经典计算机也能精确模拟的分子而言，没有优势——但这些方法正在得到验证。",{"type":21,"tag":22,"props":19218,"children":19219},{},[19220,19225],{"type":21,"tag":136,"props":19221,"children":19222},{},[19223],{"type":26,"value":19224},"瓶颈：",{"type":26,"value":19226}," 扩展到具有实际制药意义的分子（50 个以上原子）需要数百个逻辑量子比特。在当前的含噪硬件上无法实现。",{"type":21,"tag":22,"props":19228,"children":19229},{},[19230,19235],{"type":21,"tag":136,"props":19231,"children":19232},{},[19233],{"type":26,"value":19234},"谁在做：",{"type":26,"value":19236}," IBM Quantum、IonQ（用于药物研发合作）、Quantinuum。",{"type":21,"tag":2304,"props":19238,"children":19240},{"className":3145,"code":19239,"language":3147,"meta":7,"style":7},"import hlquantum as hlq\n\n# VQE for H2 — works today, results match classical\nresult = hlq.algorithms.vqe(molecule='H2', basis='sto-3g', backend='qiskit')\nprint(f\"Ground state: {result.energy:.4f} Ha\")  # -1.1372 Ha\n",[19241],{"type":21,"tag":2073,"props":19242,"children":19243},{"__ignoreMap":7},[19244,19265,19272,19280,19350],{"type":21,"tag":2314,"props":19245,"children":19246},{"class":2316,"line":2317},[19247,19251,19256,19260],{"type":21,"tag":2314,"props":19248,"children":19249},{"style":3157},[19250],{"type":26,"value":3170},{"type":21,"tag":2314,"props":19252,"children":19253},{"style":2321},[19254],{"type":26,"value":19255}," hlquantum ",{"type":21,"tag":2314,"props":19257,"children":19258},{"style":3157},[19259],{"type":26,"value":4232},{"type":21,"tag":2314,"props":19261,"children":19262},{"style":2321},[19263],{"type":26,"value":19264}," hlq\n",{"type":21,"tag":2314,"props":19266,"children":19267},{"class":2316,"line":106},[19268],{"type":21,"tag":2314,"props":19269,"children":19270},{"emptyLinePlaceholder":3181},[19271],{"type":26,"value":3184},{"type":21,"tag":2314,"props":19273,"children":19274},{"class":2316,"line":2335},[19275],{"type":21,"tag":2314,"props":19276,"children":19277},{"style":3407},[19278],{"type":26,"value":19279},"# VQE for H2 — works today, results match classical\n",{"type":21,"tag":2314,"props":19281,"children":19282},{"class":2316,"line":2397},[19283,19288,19292,19297,19302,19306,19311,19315,19320,19324,19329,19333,19337,19341,19346],{"type":21,"tag":2314,"props":19284,"children":19285},{"style":2321},[19286],{"type":26,"value":19287},"result ",{"type":21,"tag":2314,"props":19289,"children":19290},{"style":3157},[19291],{"type":26,"value":3197},{"type":21,"tag":2314,"props":19293,"children":19294},{"style":2321},[19295],{"type":26,"value":19296}," hlq.algorithms.vqe(",{"type":21,"tag":2314,"props":19298,"children":19299},{"style":3222},[19300],{"type":26,"value":19301},"molecule",{"type":21,"tag":2314,"props":19303,"children":19304},{"style":3157},[19305],{"type":26,"value":3197},{"type":21,"tag":2314,"props":19307,"children":19308},{"style":2350},[19309],{"type":26,"value":19310},"'H2'",{"type":21,"tag":2314,"props":19312,"children":19313},{"style":2321},[19314],{"type":26,"value":1309},{"type":21,"tag":2314,"props":19316,"children":19317},{"style":3222},[19318],{"type":26,"value":19319},"basis",{"type":21,"tag":2314,"props":19321,"children":19322},{"style":3157},[19323],{"type":26,"value":3197},{"type":21,"tag":2314,"props":19325,"children":19326},{"style":2350},[19327],{"type":26,"value":19328},"'sto-3g'",{"type":21,"tag":2314,"props":19330,"children":19331},{"style":2321},[19332],{"type":26,"value":1309},{"type":21,"tag":2314,"props":19334,"children":19335},{"style":3222},[19336],{"type":26,"value":18425},{"type":21,"tag":2314,"props":19338,"children":19339},{"style":3157},[19340],{"type":26,"value":3197},{"type":21,"tag":2314,"props":19342,"children":19343},{"style":2350},[19344],{"type":26,"value":19345},"'qiskit'",{"type":21,"tag":2314,"props":19347,"children":19348},{"style":2321},[19349],{"type":26,"value":3257},{"type":21,"tag":2314,"props":19351,"children":19352},{"class":2316,"line":2421},[19353,19357,19361,19365,19370,19374,19379,19383,19387,19392,19397],{"type":21,"tag":2314,"props":19354,"children":19355},{"style":2339},[19356],{"type":26,"value":3272},{"type":21,"tag":2314,"props":19358,"children":19359},{"style":2321},[19360],{"type":26,"value":3277},{"type":21,"tag":2314,"props":19362,"children":19363},{"style":3157},[19364],{"type":26,"value":3282},{"type":21,"tag":2314,"props":19366,"children":19367},{"style":2350},[19368],{"type":26,"value":19369},"\"Ground state: ",{"type":21,"tag":2314,"props":19371,"children":19372},{"style":2339},[19373],{"type":26,"value":3292},{"type":21,"tag":2314,"props":19375,"children":19376},{"style":2321},[19377],{"type":26,"value":19378},"result.energy",{"type":21,"tag":2314,"props":19380,"children":19381},{"style":3157},[19382],{"type":26,"value":3604},{"type":21,"tag":2314,"props":19384,"children":19385},{"style":2339},[19386],{"type":26,"value":3302},{"type":21,"tag":2314,"props":19388,"children":19389},{"style":2350},[19390],{"type":26,"value":19391}," Ha\"",{"type":21,"tag":2314,"props":19393,"children":19394},{"style":2321},[19395],{"type":26,"value":19396},")  ",{"type":21,"tag":2314,"props":19398,"children":19399},{"style":3407},[19400],{"type":26,"value":19401},"# -1.1372 Ha\n",{"type":21,"tag":18133,"props":19403,"children":19404},{},[],{"type":21,"tag":17316,"props":19406,"children":19408},{"id":19407},"量子机器学习概念验证",[19409],{"type":26,"value":19410},"量子机器学习——概念验证",{"type":21,"tag":22,"props":19412,"children":19413},{},[19414,19418],{"type":21,"tag":136,"props":19415,"children":19416},{},[19417],{"type":26,"value":19194},{"type":26,"value":19419}," 用于分类的量子神经网络（QNN）和量子核方法。",{"type":21,"tag":22,"props":19421,"children":19422},{},[19423,19427],{"type":21,"tag":136,"props":19424,"children":19425},{},[19426],{"type":26,"value":19204},{"type":26,"value":19428}," 量子核已被证明在玩具数据集上可行。对于实际数据集，尚未证明量子相对经典 ML 具有优势。",{"type":21,"tag":22,"props":19430,"children":19431},{},[19432,19436,19438,19445],{"type":21,"tag":136,"props":19433,"children":19434},{},[19435],{"type":26,"value":19214},{"type":26,"value":19437}," 研究。“",{"type":21,"tag":46,"props":19439,"children":19442},{"href":19440,"rel":19441},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2109.01aborting",[899],[19443],{"type":26,"value":19444},"没有免费的午餐",{"type":26,"value":19446},"”问题依然适用——QML 中的量子优势（如果存在）将针对具有特定量子结构的特定数据。",{"type":21,"tag":22,"props":19448,"children":19449},{},[19450,19455],{"type":21,"tag":136,"props":19451,"children":19452},{},[19453],{"type":26,"value":19454},"正在浮现的现实用例：",{"type":26,"value":19456}," 对于源自量子物理实验的数据集，量子核可能具有内在的量子结构，量子 ML 比经典方法更善于利用这种结构。",{"type":21,"tag":22,"props":19458,"children":19459},{},[19460,19464],{"type":21,"tag":136,"props":19461,"children":19462},{},[19463],{"type":26,"value":19234},{"type":26,"value":19465}," PennyLane\u002FXanadu（专注 QML）、IBM、Google（Quantum AI）。",{"type":21,"tag":18133,"props":19467,"children":19468},{},[],{"type":21,"tag":17316,"props":19470,"children":19472},{"id":19471},"优化基准测试qaoa",[19473],{"type":26,"value":19474},"优化基准测试（QAOA）",{"type":21,"tag":22,"props":19476,"children":19477},{},[19478,19482],{"type":21,"tag":136,"props":19479,"children":19480},{},[19481],{"type":26,"value":19194},{"type":26,"value":19483}," 将 QAOA 应用于 Max-Cut、投资组合优化、车辆路径规划。",{"type":21,"tag":22,"props":19485,"children":19486},{},[19487,19491,19493,19499],{"type":21,"tag":136,"props":19488,"children":19489},{},[19490],{"type":26,"value":19204},{"type":26,"value":19492}," QAOA 电路已在真实硬件上运行。在 ",{"type":21,"tag":2073,"props":19494,"children":19496},{"className":19495},[],[19497],{"type":26,"value":19498},"p=1",{"type":26,"value":19500}," 时，NISQ 设备上可在 Max-Cut 上实现约 0.75 的近似比。",{"type":21,"tag":22,"props":19502,"children":19503},{},[19504,19508],{"type":21,"tag":136,"props":19505,"children":19506},{},[19507],{"type":26,"value":19214},{"type":26,"value":19509}," 对于真实规模的问题，尚无法与经典求解器（模拟退火、GUROBI）竞争。对研究和硬件基准测试有价值。",{"type":21,"tag":22,"props":19511,"children":19512},{},[19513,19518,19520,19525],{"type":21,"tag":136,"props":19514,"children":19515},{},[19516],{"type":26,"value":19517},"何时才重要：",{"type":26,"value":19519}," 当 ",{"type":21,"tag":2073,"props":19521,"children":19523},{"className":19522},[],[19524],{"type":26,"value":22},{"type":26,"value":19526}," 大到足以带来显著优势时，电路对 NISQ 设备来说太深了。需要纠错。",{"type":21,"tag":18133,"props":19528,"children":19529},{},[],{"type":21,"tag":17316,"props":19531,"children":19533},{"id":19532},"随机电路采样量子霸权主张",[19534],{"type":26,"value":19535},"随机电路采样（“量子霸权”主张）",{"type":21,"tag":22,"props":19537,"children":19538},{},[19539,19543],{"type":21,"tag":136,"props":19540,"children":19541},{},[19542],{"type":26,"value":19194},{"type":26,"value":19544}," 从随机量子电路中采样。",{"type":21,"tag":22,"props":19546,"children":19547},{},[19548,19552],{"type":21,"tag":136,"props":19549,"children":19550},{},[19551],{"type":26,"value":19204},{"type":26,"value":19553}," Google（2019 年，Sycamore）、IBM（2023 年，Eagle）、中国团队（2020 年、2021 年）。",{"type":21,"tag":22,"props":19555,"children":19556},{},[19557,19562,19564,19569],{"type":21,"tag":136,"props":19558,"children":19559},{},[19560],{"type":26,"value":19561},"实用价值：",{"type":26,"value":19563}," 目前没有——随机电路采样没有已知的应用。它是一项硬件基准，表明量子设备能做",{"type":21,"tag":362,"props":19565,"children":19566},{},[19567],{"type":26,"value":19568},"某些",{"type":26,"value":19570},"经典计算机难以模拟的事情。",{"type":21,"tag":22,"props":19572,"children":19573},{},[19574,19579],{"type":21,"tag":136,"props":19575,"children":19576},{},[19577],{"type":26,"value":19578},"为何重要：",{"type":26,"value":19580}," 它验证了量子硬件正在正确运行，并且对于某些电路规模，经典模拟正变得难以处理。",{"type":21,"tag":18133,"props":19582,"children":19583},{},[],{"type":21,"tag":29,"props":19585,"children":19587},{"id":19586},"近期能做什么27-年",[19588],{"type":26,"value":19589},"近期能做什么（2–7 年）",{"type":21,"tag":17316,"props":19591,"children":19593},{"id":19592},"量子辅助药物研发",[19594],{"type":26,"value":19592},{"type":21,"tag":22,"props":19596,"children":19597},{},[19598,19602],{"type":21,"tag":136,"props":19599,"children":19600},{},[19601],{"type":26,"value":19194},{"type":26,"value":19603}," 利用量子模拟来建模蛋白质-配体的结合能，预测哪些候选药物值得合成。",{"type":21,"tag":22,"props":19605,"children":19606},{},[19607,19611],{"type":21,"tag":136,"props":19608,"children":19609},{},[19610],{"type":26,"value":19578},{"type":26,"value":19612}," 每种获批药物的研发成本约为 25 亿美元。通过更好的计算筛选来减少失败的临床试验极具价值。",{"type":21,"tag":22,"props":19614,"children":19615},{},[19616,19621],{"type":21,"tag":136,"props":19617,"children":19618},{},[19619],{"type":26,"value":19620},"当前状态：",{"type":26,"value":19622}," IBM 及制药合作伙伴（Pfizer、AstraZeneca、JSR）正在量子硬件上对多达约 50 量子比特的分子运行 VQE。仍属演示性质——对于具有商业相关性的分子，经典方法仍然更准确。",{"type":21,"tag":22,"props":19624,"children":19625},{},[19626,19631],{"type":21,"tag":136,"props":19627,"children":19628},{},[19629],{"type":26,"value":19630},"何时成真：",{"type":26,"value":19632}," 当逻辑量子比特数达到约 1,000–5,000 时。届时量子模拟在关键分子类别上可超越经典方法。目前估计：5–10 年。",{"type":21,"tag":18133,"props":19634,"children":19635},{},[],{"type":21,"tag":17316,"props":19637,"children":19639},{"id":19638},"量子金融蒙特卡洛加速",[19640],{"type":26,"value":19641},"量子金融：蒙特卡洛加速",{"type":21,"tag":22,"props":19643,"children":19644},{},[19645,19649,19651,19657,19659,19665],{"type":21,"tag":136,"props":19646,"children":19647},{},[19648],{"type":26,"value":19194},{"type":26,"value":19650}," 量子振幅估计理论上可将蒙特卡洛积分从 ",{"type":21,"tag":2073,"props":19652,"children":19654},{"className":19653},[],[19655],{"type":26,"value":19656},"O(1\u002Fε²)",{"type":26,"value":19658}," 加速到 ",{"type":21,"tag":2073,"props":19660,"children":19662},{"className":19661},[],[19663],{"type":26,"value":19664},"O(1\u002Fε)",{"type":26,"value":19666},"——这种二次加速对期权定价和风险模拟极为重要。",{"type":21,"tag":22,"props":19668,"children":19669},{},[19670,19674],{"type":21,"tag":136,"props":19671,"children":19672},{},[19673],{"type":26,"value":19620},{"type":26,"value":19675}," Goldman Sachs、JPMorgan 和 BBVA 正在积极研究这一点。已完成小规模演示。尚未达到生产规模。",{"type":21,"tag":22,"props":19677,"children":19678},{},[19679,19683],{"type":21,"tag":136,"props":19680,"children":19681},{},[19682],{"type":26,"value":19630},{"type":26,"value":19684}," 需要适度的容错能力（数千个逻辑量子比特）。对于实用的金融加速，估计需要 5–15 年。",{"type":21,"tag":18133,"props":19686,"children":19687},{},[],{"type":21,"tag":17316,"props":19689,"children":19691},{"id":19690},"材料科学电池与太阳能电池设计",[19692],{"type":26,"value":19693},"材料科学：电池与太阳能电池设计",{"type":21,"tag":22,"props":19695,"children":19696},{},[19697,19701],{"type":21,"tag":136,"props":19698,"children":19699},{},[19700],{"type":26,"value":19194},{"type":26,"value":19702}," 对锂空气电池、固氮催化剂（替代哈伯-博施法）以及光伏材料的候选材料进行量子模拟。",{"type":21,"tag":22,"props":19704,"children":19705},{},[19706,19710],{"type":21,"tag":136,"props":19707,"children":19708},{},[19709],{"type":26,"value":19578},{"type":26,"value":19711}," 更好的电池 = 电动车革命。高效的 N₂ 固定 = 大幅降低化肥的能耗（目前占全球能源消耗的 1–2%）。这些都是万亿美元级的问题。",{"type":21,"tag":22,"props":19713,"children":19714},{},[19715,19719],{"type":21,"tag":136,"props":19716,"children":19717},{},[19718],{"type":26,"value":19620},{"type":26,"value":19720}," Microsoft（StationQ）、IBM，以及 QunaSys 和 Good Chemistry 等初创公司正在追求这一方向。属于早期研究阶段。",{"type":21,"tag":22,"props":19722,"children":19723},{},[19724,19728],{"type":21,"tag":136,"props":19725,"children":19726},{},[19727],{"type":26,"value":19630},{"type":26,"value":19729}," 5–20 年，取决于目标精度和分子大小。",{"type":21,"tag":18133,"props":19731,"children":19732},{},[],{"type":21,"tag":29,"props":19734,"children":19736},{"id":19735},"什么需要完整的容错能力720-年以上",[19737],{"type":26,"value":19738},"什么需要完整的容错能力（7–20 年以上）",{"type":21,"tag":17316,"props":19740,"children":19742},{"id":19741},"用-shor-算法破解-rsaecc",[19743],{"type":26,"value":19744},"用 Shor 算法破解 RSA\u002FECC",{"type":21,"tag":22,"props":19746,"children":19747},{},[19748,19752],{"type":21,"tag":136,"props":19749,"children":19750},{},[19751],{"type":26,"value":19194},{"type":26,"value":19753}," 分解 RSA-2048 背后的大素数。",{"type":21,"tag":22,"props":19755,"children":19756},{},[19757,19762],{"type":21,"tag":136,"props":19758,"children":19759},{},[19760],{"type":26,"value":19761},"所需条件：",{"type":26,"value":19763}," 约 4,000 个逻辑量子比特（每个需要约 1,000 个物理量子比特 = 约 400 万个物理量子比特）。当前状态：数百个物理量子比特，且噪声很大。",{"type":21,"tag":22,"props":19765,"children":19766},{},[19767,19772],{"type":21,"tag":136,"props":19768,"children":19769},{},[19770],{"type":26,"value":19771},"时间线：",{"type":26,"value":19773}," 大多数估计认为威胁 RSA 的量子计算机将在 2030–2040 年出现。有人说永远不会——在这种规模下，工程挑战可能无法解决。",{"type":21,"tag":22,"props":19775,"children":19776},{},[19777,19782,19784,19789],{"type":21,"tag":136,"props":19778,"children":19779},{},[19780],{"type":26,"value":19781},"现在该做什么：",{"type":26,"value":19783}," 无论时间线如何，",{"type":21,"tag":46,"props":19785,"children":19786},{"href":9333},[19787],{"type":26,"value":19788},"迁移到后量子密码学",{"type":26,"value":19790},"。这一转变需要数年时间，而 HNDL 攻击正在当下发生。",{"type":21,"tag":18133,"props":19792,"children":19793},{},[],{"type":21,"tag":17316,"props":19795,"children":19797},{"id":19796},"大规模的-grover-搜索",[19798],{"type":26,"value":19799},"大规模的 Grover 搜索",{"type":21,"tag":22,"props":19801,"children":19802},{},[19803,19807],{"type":21,"tag":136,"props":19804,"children":19805},{},[19806],{"type":26,"value":19194},{"type":26,"value":19808}," 为搜索无序数据库、解决 NP 难问题提供二次加速。",{"type":21,"tag":22,"props":19810,"children":19811},{},[19812,19816],{"type":21,"tag":136,"props":19813,"children":19814},{},[19815],{"type":26,"value":19761},{"type":26,"value":19817}," 深层的纠错电路。二次加速意味着对于大 N，√N 仍然非常庞大——常数因子必须有利于量子硬件。",{"type":21,"tag":22,"props":19819,"children":19820},{},[19821,19825],{"type":21,"tag":136,"props":19822,"children":19823},{},[19824],{"type":26,"value":19771},{"type":26,"value":19826}," 长期研究。",{"type":21,"tag":18133,"props":19828,"children":19829},{},[],{"type":21,"tag":17316,"props":19831,"children":19833},{"id":19832},"气候建模与流体动力学",[19834],{"type":26,"value":19832},{"type":21,"tag":22,"props":19836,"children":19837},{},[19838,19842],{"type":21,"tag":136,"props":19839,"children":19840},{},[19841],{"type":26,"value":19194},{"type":26,"value":19843}," 用于求解微分方程的量子算法（HHL 算法）可加速气候模拟、流体动力学和金融建模。",{"type":21,"tag":22,"props":19845,"children":19846},{},[19847,19851],{"type":21,"tag":136,"props":19848,"children":19849},{},[19850],{"type":26,"value":19761},{"type":26,"value":19852}," 完整的容错能力。HHL 算法有巨大的开销，即使在理论上，其实际优势也远不明朗。",{"type":21,"tag":22,"props":19854,"children":19855},{},[19856,19860],{"type":21,"tag":136,"props":19857,"children":19858},{},[19859],{"type":26,"value":19771},{"type":26,"value":19861}," 这是最具推测性的一类。用于求解 PDE 的量子优势在实践中仍未得到证实。",{"type":21,"tag":18133,"props":19863,"children":19864},{},[],{"type":21,"tag":29,"props":19866,"children":19868},{"id":19867},"诚实的结论",[19869],{"type":26,"value":19867},{"type":21,"tag":4020,"props":19871,"children":19872},{},[19873,19894],{"type":21,"tag":4024,"props":19874,"children":19875},{},[19876],{"type":21,"tag":4028,"props":19877,"children":19878},{},[19879,19884,19889],{"type":21,"tag":4032,"props":19880,"children":19881},{},[19882],{"type":26,"value":19883},"应用",{"type":21,"tag":4032,"props":19885,"children":19886},{},[19887],{"type":26,"value":19888},"当今是否有量子优势？",{"type":21,"tag":4032,"props":19890,"children":19891},{},[19892],{"type":26,"value":19893},"时间范围",{"type":21,"tag":4046,"props":19895,"children":19896},{},[19897,19915,19933,19950,19968,19986,20002,20019],{"type":21,"tag":4028,"props":19898,"children":19899},{},[19900,19905,19910],{"type":21,"tag":4053,"props":19901,"children":19902},{},[19903],{"type":26,"value":19904},"随机电路采样",{"type":21,"tag":4053,"props":19906,"children":19907},{},[19908],{"type":26,"value":19909},"微乎其微，无应用",{"type":21,"tag":4053,"props":19911,"children":19912},{},[19913],{"type":26,"value":19914},"当下（仅研究）",{"type":21,"tag":4028,"props":19916,"children":19917},{},[19918,19923,19928],{"type":21,"tag":4053,"props":19919,"children":19920},{},[19921],{"type":26,"value":19922},"小分子的 VQE",{"type":21,"tag":4053,"props":19924,"children":19925},{},[19926],{"type":26,"value":19927},"无经典优势",{"type":21,"tag":4053,"props":19929,"children":19930},{},[19931],{"type":26,"value":19932},"3–5 年可用于有用的分子",{"type":21,"tag":4028,"props":19934,"children":19935},{},[19936,19941,19945],{"type":21,"tag":4053,"props":19937,"children":19938},{},[19939],{"type":26,"value":19940},"用于优化的 QAOA",{"type":21,"tag":4053,"props":19942,"children":19943},{},[19944],{"type":26,"value":19927},{"type":21,"tag":4053,"props":19946,"children":19947},{},[19948],{"type":26,"value":19949},"5–10 年",{"type":21,"tag":4028,"props":19951,"children":19952},{},[19953,19958,19963],{"type":21,"tag":4053,"props":19954,"children":19955},{},[19956],{"type":26,"value":19957},"QML \u002F 量子核",{"type":21,"tag":4053,"props":19959,"children":19960},{},[19961],{"type":26,"value":19962},"对真实数据无优势",{"type":21,"tag":4053,"props":19964,"children":19965},{},[19966],{"type":26,"value":19967},"不确定",{"type":21,"tag":4028,"props":19969,"children":19970},{},[19971,19976,19981],{"type":21,"tag":4053,"props":19972,"children":19973},{},[19974],{"type":26,"value":19975},"药物研发",{"type":21,"tag":4053,"props":19977,"children":19978},{},[19979],{"type":26,"value":19980},"无",{"type":21,"tag":4053,"props":19982,"children":19983},{},[19984],{"type":26,"value":19985},"7–10 年",{"type":21,"tag":4028,"props":19987,"children":19988},{},[19989,19994,19998],{"type":21,"tag":4053,"props":19990,"children":19991},{},[19992],{"type":26,"value":19993},"金融（蒙特卡洛）",{"type":21,"tag":4053,"props":19995,"children":19996},{},[19997],{"type":26,"value":19980},{"type":21,"tag":4053,"props":19999,"children":20000},{},[20001],{"type":26,"value":19949},{"type":21,"tag":4028,"props":20003,"children":20004},{},[20005,20010,20014],{"type":21,"tag":4053,"props":20006,"children":20007},{},[20008],{"type":26,"value":20009},"材料模拟",{"type":21,"tag":4053,"props":20011,"children":20012},{},[20013],{"type":26,"value":19980},{"type":21,"tag":4053,"props":20015,"children":20016},{},[20017],{"type":26,"value":20018},"7–15 年",{"type":21,"tag":4028,"props":20020,"children":20021},{},[20022,20027,20031],{"type":21,"tag":4053,"props":20023,"children":20024},{},[20025],{"type":26,"value":20026},"密码学（Shor 算法）",{"type":21,"tag":4053,"props":20028,"children":20029},{},[20030],{"type":26,"value":19980},{"type":21,"tag":4053,"props":20032,"children":20033},{},[20034],{"type":26,"value":20035},"10–20 年以上",{"type":21,"tag":22,"props":20037,"children":20038},{},[20039,20041,20045,20047,20052],{"type":26,"value":20040},"最直接的量子价值",{"type":21,"tag":136,"props":20042,"children":20043},{},[20044],{"type":26,"value":18897},{"type":26,"value":20046},"在于运行算法——而在于",{"type":21,"tag":136,"props":20048,"children":20049},{},[20050],{"type":26,"value":20051},"尽早学习这个领域",{"type":26,"value":20053},"。IBM、Google、NVIDIA、AWS、IonQ 以及数十家初创公司都在招聘量子工程师。这套技能——电路设计、变分算法、量子-经典混合工作流——确实稀缺。这一缺口终将缩小，而那些尽早学习的人将占据有利位置。",{"type":21,"tag":22,"props":20055,"children":20056},{},[20057,20059,20064],{"type":26,"value":20058},"第二直接的价值是",{"type":21,"tag":136,"props":20060,"children":20061},{},[20062],{"type":26,"value":20063},"后量子密码学",{"type":26,"value":20065},"——这是一个带有量子威胁的经典软件问题，所需采取的行动明确而紧迫。",{"type":21,"tag":22,"props":20067,"children":20068},{},[20069],{"type":26,"value":20070},"至于其他一切：硬件是真实的，进展是真实的，炒作为时过早，而发展轨迹陡峭向上。",{"type":21,"tag":22,"props":20072,"children":20073},{},[20074,20079,20080,20085,20086,20091,20092],{"type":21,"tag":136,"props":20075,"children":20076},{},[20077],{"type":26,"value":20078},"探索硬件：",{"type":26,"value":1301},{"type":21,"tag":46,"props":20081,"children":20082},{"href":99},[20083],{"type":26,"value":20084},"免费 QPU 使用",{"type":26,"value":7066},{"type":21,"tag":46,"props":20087,"children":20088},{"href":408},[20089],{"type":26,"value":20090},"比较所有模拟器",{"type":26,"value":7066},{"type":21,"tag":46,"props":20093,"children":20094},{"href":11459},[20095],{"type":26,"value":20096},"量子用例深度解析",{"type":21,"tag":2688,"props":20098,"children":20099},{},[20100],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":20102},[20103,20104,20110,20115,20120],{"id":19126,"depth":106,"text":19126},{"id":19177,"depth":106,"text":19180,"children":20105},[20106,20107,20108,20109],{"id":19183,"depth":2335,"text":19186},{"id":19407,"depth":2335,"text":19410},{"id":19471,"depth":2335,"text":19474},{"id":19532,"depth":2335,"text":19535},{"id":19586,"depth":106,"text":19589,"children":20111},[20112,20113,20114],{"id":19592,"depth":2335,"text":19592},{"id":19638,"depth":2335,"text":19641},{"id":19690,"depth":2335,"text":19693},{"id":19735,"depth":106,"text":19738,"children":20116},[20117,20118,20119],{"id":19741,"depth":2335,"text":19744},{"id":19796,"depth":2335,"text":19799},{"id":19832,"depth":2335,"text":19832},{"id":19867,"depth":106,"text":19867},"content:zh:blog:quantum-use-cases-2026.md","zh\u002Fblog\u002Fquantum-use-cases-2026.md","zh\u002Fblog\u002Fquantum-use-cases-2026",{"_path":20125,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":20126,"description":20127,"date":20128,"author":11,"tags":20129,"readingTime":16,"body":20131,"_type":111,"_id":20966,"_source":113,"_file":20967,"_stem":20968,"_extension":116},"\u002Fzh\u002Fblog\u002Fgetting-started-free-quantum-computing","2026 年免费量子计算入门指南","一份完整的新手指南，教你如何免费运行第一个量子电路——无需昂贵的硬件，也无需付费订阅。","2026-03-10",[7103,20130,1363],"Simulators",{"type":18,"children":20132,"toc":20958},[20133,20138,20143,20148,20183,20188,20193,20198,20223,20235,20445,20479,20485,20490,20564,20583,20589,20601,20628,20714,20722,20727,20733,20847,20858,20863,20868,20917,20933,20936,20954],{"type":21,"tag":22,"props":20134,"children":20135},{},[20136],{"type":26,"value":20137},"量子计算不再被锁在价值数百万美元的研究实验室设备背后。如今，你可以在一台真正的 127 量子比特机器上编写并运行量子电路——完全免费——就在你的笔记本电脑上。本指南将带你了解当下可用的每一个选项。",{"type":21,"tag":29,"props":20139,"children":20141},{"id":20140},"你真正需要的东西",[20142],{"type":26,"value":20140},{"type":21,"tag":22,"props":20144,"children":20145},{},[20146],{"type":26,"value":20147},"要开始上手，你只需要三样东西：",{"type":21,"tag":6961,"props":20149,"children":20150},{},[20151,20161,20173],{"type":21,"tag":3084,"props":20152,"children":20153},{},[20154,20156],{"type":26,"value":20155},"在你的机器上安装 ",{"type":21,"tag":136,"props":20157,"children":20158},{},[20159],{"type":26,"value":20160},"Python 3.9+",{"type":21,"tag":3084,"props":20162,"children":20163},{},[20164,20166,20171],{"type":26,"value":20165},"在某个量子云平台上注册",{"type":21,"tag":136,"props":20167,"children":20168},{},[20169],{"type":26,"value":20170},"一个免费账户",{"type":26,"value":20172},"（IBM Quantum 是最简单的）",{"type":21,"tag":3084,"props":20174,"children":20175},{},[20176,20181],{"type":21,"tag":136,"props":20177,"children":20178},{},[20179],{"type":26,"value":20180},"五分钟",{"type":26,"value":20182},"时间来运行你的第一个贝尔态",{"type":21,"tag":22,"props":20184,"children":20185},{},[20186],{"type":26,"value":20187},"就这么多。不需要 GPU，不需要特殊硬件，不需要信用卡。",{"type":21,"tag":29,"props":20189,"children":20191},{"id":20190},"你的第一个量子电路",[20192],{"type":26,"value":20190},{"type":21,"tag":22,"props":20194,"children":20195},{},[20196],{"type":26,"value":20197},"安装 Qiskit 及其模拟器：",{"type":21,"tag":2304,"props":20199,"children":20200},{"className":9697,"code":11736,"language":9699,"meta":7,"style":7},[20201],{"type":21,"tag":2073,"props":20202,"children":20203},{"__ignoreMap":7},[20204],{"type":21,"tag":2314,"props":20205,"children":20206},{"class":2316,"line":2317},[20207,20211,20215,20219],{"type":21,"tag":2314,"props":20208,"children":20209},{"style":4318},[20210],{"type":26,"value":11748},{"type":21,"tag":2314,"props":20212,"children":20213},{"style":2350},[20214],{"type":26,"value":11753},{"type":21,"tag":2314,"props":20216,"children":20217},{"style":2350},[20218],{"type":26,"value":11758},{"type":21,"tag":2314,"props":20220,"children":20221},{"style":2350},[20222],{"type":26,"value":11763},{"type":21,"tag":22,"props":20224,"children":20225},{},[20226,20228,20233],{"type":26,"value":20227},"现在创建一个",{"type":21,"tag":136,"props":20229,"children":20230},{},[20231],{"type":26,"value":20232},"贝尔态",{"type":26,"value":20234},"——这个典型的双量子比特电路展示了叠加和纠缠：",{"type":21,"tag":2304,"props":20236,"children":20238},{"className":3145,"code":20237,"language":3147,"meta":7,"style":7},"from qiskit import QuantumCircuit\nfrom qiskit_aer import AerSimulator\n\n# Build the circuit\nqc = QuantumCircuit(2)\nqc.h(0)       # Hadamard — puts qubit 0 into superposition\nqc.cx(0, 1)   # CNOT — entangles qubit 1 with qubit 0\nqc.measure_all()\n\n# Run locally on a simulator\nresult = AerSimulator().run(qc, shots=1000).result()\nprint(result.get_counts())\n# {'00': 503, '11': 497}\n",[20239],{"type":21,"tag":2073,"props":20240,"children":20241},{"__ignoreMap":7},[20242,20262,20281,20288,20296,20319,20340,20369,20376,20383,20391,20425,20437],{"type":21,"tag":2314,"props":20243,"children":20244},{"class":2316,"line":2317},[20245,20249,20253,20257],{"type":21,"tag":2314,"props":20246,"children":20247},{"style":3157},[20248],{"type":26,"value":3160},{"type":21,"tag":2314,"props":20250,"children":20251},{"style":2321},[20252],{"type":26,"value":4249},{"type":21,"tag":2314,"props":20254,"children":20255},{"style":3157},[20256],{"type":26,"value":3170},{"type":21,"tag":2314,"props":20258,"children":20259},{"style":2321},[20260],{"type":26,"value":20261}," QuantumCircuit\n",{"type":21,"tag":2314,"props":20263,"children":20264},{"class":2316,"line":106},[20265,20269,20273,20277],{"type":21,"tag":2314,"props":20266,"children":20267},{"style":3157},[20268],{"type":26,"value":3160},{"type":21,"tag":2314,"props":20270,"children":20271},{"style":2321},[20272],{"type":26,"value":4270},{"type":21,"tag":2314,"props":20274,"children":20275},{"style":3157},[20276],{"type":26,"value":3170},{"type":21,"tag":2314,"props":20278,"children":20279},{"style":2321},[20280],{"type":26,"value":4279},{"type":21,"tag":2314,"props":20282,"children":20283},{"class":2316,"line":2335},[20284],{"type":21,"tag":2314,"props":20285,"children":20286},{"emptyLinePlaceholder":3181},[20287],{"type":26,"value":3184},{"type":21,"tag":2314,"props":20289,"children":20290},{"class":2316,"line":2397},[20291],{"type":21,"tag":2314,"props":20292,"children":20293},{"style":3407},[20294],{"type":26,"value":20295},"# Build the circuit\n",{"type":21,"tag":2314,"props":20297,"children":20298},{"class":2316,"line":2421},[20299,20303,20307,20311,20315],{"type":21,"tag":2314,"props":20300,"children":20301},{"style":2321},[20302],{"type":26,"value":7336},{"type":21,"tag":2314,"props":20304,"children":20305},{"style":3157},[20306],{"type":26,"value":3197},{"type":21,"tag":2314,"props":20308,"children":20309},{"style":2321},[20310],{"type":26,"value":5092},{"type":21,"tag":2314,"props":20312,"children":20313},{"style":2339},[20314],{"type":26,"value":2413},{"type":21,"tag":2314,"props":20316,"children":20317},{"style":2321},[20318],{"type":26,"value":3257},{"type":21,"tag":2314,"props":20320,"children":20321},{"class":2316,"line":16},[20322,20326,20330,20335],{"type":21,"tag":2314,"props":20323,"children":20324},{"style":2321},[20325],{"type":26,"value":7352},{"type":21,"tag":2314,"props":20327,"children":20328},{"style":2339},[20329],{"type":26,"value":5122},{"type":21,"tag":2314,"props":20331,"children":20332},{"style":2321},[20333],{"type":26,"value":20334},")       ",{"type":21,"tag":2314,"props":20336,"children":20337},{"style":3407},[20338],{"type":26,"value":20339},"# Hadamard — puts qubit 0 into superposition\n",{"type":21,"tag":2314,"props":20341,"children":20342},{"class":2316,"line":127},[20343,20348,20352,20356,20360,20364],{"type":21,"tag":2314,"props":20344,"children":20345},{"style":2321},[20346],{"type":26,"value":20347},"qc.cx(",{"type":21,"tag":2314,"props":20349,"children":20350},{"style":2339},[20351],{"type":26,"value":5122},{"type":21,"tag":2314,"props":20353,"children":20354},{"style":2321},[20355],{"type":26,"value":1309},{"type":21,"tag":2314,"props":20357,"children":20358},{"style":2339},[20359],{"type":26,"value":3513},{"type":21,"tag":2314,"props":20361,"children":20362},{"style":2321},[20363],{"type":26,"value":6710},{"type":21,"tag":2314,"props":20365,"children":20366},{"style":3407},[20367],{"type":26,"value":20368},"# CNOT — entangles qubit 1 with qubit 0\n",{"type":21,"tag":2314,"props":20370,"children":20371},{"class":2316,"line":887},[20372],{"type":21,"tag":2314,"props":20373,"children":20374},{"style":2321},[20375],{"type":26,"value":13043},{"type":21,"tag":2314,"props":20377,"children":20378},{"class":2316,"line":1364},[20379],{"type":21,"tag":2314,"props":20380,"children":20381},{"emptyLinePlaceholder":3181},[20382],{"type":26,"value":3184},{"type":21,"tag":2314,"props":20384,"children":20385},{"class":2316,"line":3403},[20386],{"type":21,"tag":2314,"props":20387,"children":20388},{"style":3407},[20389],{"type":26,"value":20390},"# Run locally on a simulator\n",{"type":21,"tag":2314,"props":20392,"children":20393},{"class":2316,"line":3413},[20394,20398,20402,20407,20411,20415,20420],{"type":21,"tag":2314,"props":20395,"children":20396},{"style":2321},[20397],{"type":26,"value":19287},{"type":21,"tag":2314,"props":20399,"children":20400},{"style":3157},[20401],{"type":26,"value":3197},{"type":21,"tag":2314,"props":20403,"children":20404},{"style":2321},[20405],{"type":26,"value":20406}," AerSimulator().run(qc, ",{"type":21,"tag":2314,"props":20408,"children":20409},{"style":3222},[20410],{"type":26,"value":4077},{"type":21,"tag":2314,"props":20412,"children":20413},{"style":3157},[20414],{"type":26,"value":3197},{"type":21,"tag":2314,"props":20416,"children":20417},{"style":2339},[20418],{"type":26,"value":20419},"1000",{"type":21,"tag":2314,"props":20421,"children":20422},{"style":2321},[20423],{"type":26,"value":20424},").result()\n",{"type":21,"tag":2314,"props":20426,"children":20427},{"class":2316,"line":436},[20428,20432],{"type":21,"tag":2314,"props":20429,"children":20430},{"style":2339},[20431],{"type":26,"value":3272},{"type":21,"tag":2314,"props":20433,"children":20434},{"style":2321},[20435],{"type":26,"value":20436},"(result.get_counts())\n",{"type":21,"tag":2314,"props":20438,"children":20439},{"class":2316,"line":3473},[20440],{"type":21,"tag":2314,"props":20441,"children":20442},{"style":3407},[20443],{"type":26,"value":20444},"# {'00': 503, '11': 497}\n",{"type":21,"tag":22,"props":20446,"children":20447},{},[20448,20450,20455,20456,20461,20463,20469,20471,20477],{"type":26,"value":20449},"输出结果——",{"type":21,"tag":2073,"props":20451,"children":20453},{"className":20452},[],[20454],{"type":26,"value":5630},{"type":26,"value":18114},{"type":21,"tag":2073,"props":20457,"children":20459},{"className":20458},[],[20460],{"type":26,"value":5637},{"type":26,"value":20462}," 的计数大致相等，从不出现 ",{"type":21,"tag":2073,"props":20464,"children":20466},{"className":20465},[],[20467],{"type":26,"value":20468},"01",{"type":26,"value":20470}," 或 ",{"type":21,"tag":2073,"props":20472,"children":20474},{"className":20473},[],[20475],{"type":26,"value":20476},"10",{"type":26,"value":20478},"——正是纠缠的标志。测量其中一个量子比特，你就能立即知道另一个的状态，无论它们之间相距多远。",{"type":21,"tag":29,"props":20480,"children":20482},{"id":20481},"免费模拟器无需账户",[20483],{"type":26,"value":20484},"免费模拟器：无需账户",{"type":21,"tag":22,"props":20486,"children":20487},{},[20488],{"type":26,"value":20489},"所有主流 SDK 都内置了强大的本地模拟器，可在你的 CPU 或 GPU 上运行，无需注册：",{"type":21,"tag":2304,"props":20491,"children":20493},{"className":9697,"code":20492,"language":9699,"meta":7,"style":7},"pip install qiskit qiskit-aer   # IBM Qiskit + Aer simulator\npip install cirq                 # Google Cirq\npip install pennylane            # PennyLane\n",[20494],{"type":21,"tag":2073,"props":20495,"children":20496},{"__ignoreMap":7},[20497,20522,20543],{"type":21,"tag":2314,"props":20498,"children":20499},{"class":2316,"line":2317},[20500,20504,20508,20512,20517],{"type":21,"tag":2314,"props":20501,"children":20502},{"style":4318},[20503],{"type":26,"value":11748},{"type":21,"tag":2314,"props":20505,"children":20506},{"style":2350},[20507],{"type":26,"value":11753},{"type":21,"tag":2314,"props":20509,"children":20510},{"style":2350},[20511],{"type":26,"value":11758},{"type":21,"tag":2314,"props":20513,"children":20514},{"style":2350},[20515],{"type":26,"value":20516}," qiskit-aer",{"type":21,"tag":2314,"props":20518,"children":20519},{"style":3407},[20520],{"type":26,"value":20521},"   # IBM Qiskit + Aer simulator\n",{"type":21,"tag":2314,"props":20523,"children":20524},{"class":2316,"line":106},[20525,20529,20533,20538],{"type":21,"tag":2314,"props":20526,"children":20527},{"style":4318},[20528],{"type":26,"value":11748},{"type":21,"tag":2314,"props":20530,"children":20531},{"style":2350},[20532],{"type":26,"value":11753},{"type":21,"tag":2314,"props":20534,"children":20535},{"style":2350},[20536],{"type":26,"value":20537}," cirq",{"type":21,"tag":2314,"props":20539,"children":20540},{"style":3407},[20541],{"type":26,"value":20542},"                 # Google Cirq\n",{"type":21,"tag":2314,"props":20544,"children":20545},{"class":2316,"line":2335},[20546,20550,20554,20559],{"type":21,"tag":2314,"props":20547,"children":20548},{"style":4318},[20549],{"type":26,"value":11748},{"type":21,"tag":2314,"props":20551,"children":20552},{"style":2350},[20553],{"type":26,"value":11753},{"type":21,"tag":2314,"props":20555,"children":20556},{"style":2350},[20557],{"type":26,"value":20558}," pennylane",{"type":21,"tag":2314,"props":20560,"children":20561},{"style":3407},[20562],{"type":26,"value":20563},"            # PennyLane\n",{"type":21,"tag":22,"props":20565,"children":20566},{},[20567,20569,20575,20577,20582],{"type":26,"value":20568},"每一个都能轻松处理 20–30 量子比特的电路。对于大型电路或 GPU 加速，",{"type":21,"tag":46,"props":20570,"children":20572},{"href":20571},"\u002Fsdks\u002Fcudaq",[20573],{"type":26,"value":20574},"NVIDIA CUDA-Q",{"type":26,"value":20576}," 可以在单块 GPU 上模拟 34 个以上的量子比特。详细比较请参阅完整的",{"type":21,"tag":46,"props":20578,"children":20579},{"href":408},[20580],{"type":26,"value":20581},"模拟器指南",{"type":26,"value":18641},{"type":21,"tag":29,"props":20584,"children":20586},{"id":20585},"免费的真实硬件ibm-quantum",[20587],{"type":26,"value":20588},"免费的真实硬件：IBM Quantum",{"type":21,"tag":22,"props":20590,"children":20591},{},[20592,20594,20599],{"type":26,"value":20593},"IBM Quantum 为任何拥有 IBM ID 的人提供对真实量子处理器的",{"type":21,"tag":136,"props":20595,"children":20596},{},[20597],{"type":26,"value":20598},"完全免费",{"type":26,"value":20600},"访问：",{"type":21,"tag":6961,"props":20602,"children":20603},{},[20604,20618,20623],{"type":21,"tag":3084,"props":20605,"children":20606},{},[20607,20609,20616],{"type":26,"value":20608},"访问 ",{"type":21,"tag":46,"props":20610,"children":20613},{"href":20611,"rel":20612},"https:\u002F\u002Fquantum.ibm.com\u002F",[899],[20614],{"type":26,"value":20615},"quantum.ibm.com",{"type":26,"value":20617}," 并创建一个免费账户",{"type":21,"tag":3084,"props":20619,"children":20620},{},[20621],{"type":26,"value":20622},"从账户设置中复制你的 API 令牌",{"type":21,"tag":3084,"props":20624,"children":20625},{},[20626],{"type":26,"value":20627},"用你的令牌配置 Qiskit：",{"type":21,"tag":2304,"props":20629,"children":20631},{"className":3145,"code":20630,"language":3147,"meta":7,"style":7},"from qiskit_ibm_runtime import QiskitRuntimeService\n\nQiskitRuntimeService.save_account(\n    channel=\"ibm_quantum\",\n    token=\"YOUR_TOKEN_HERE\"\n)\n",[20632],{"type":21,"tag":2073,"props":20633,"children":20634},{"__ignoreMap":7},[20635,20654,20661,20669,20690,20707],{"type":21,"tag":2314,"props":20636,"children":20637},{"class":2316,"line":2317},[20638,20642,20646,20650],{"type":21,"tag":2314,"props":20639,"children":20640},{"style":3157},[20641],{"type":26,"value":3160},{"type":21,"tag":2314,"props":20643,"children":20644},{"style":2321},[20645],{"type":26,"value":3165},{"type":21,"tag":2314,"props":20647,"children":20648},{"style":3157},[20649],{"type":26,"value":3170},{"type":21,"tag":2314,"props":20651,"children":20652},{"style":2321},[20653],{"type":26,"value":3175},{"type":21,"tag":2314,"props":20655,"children":20656},{"class":2316,"line":106},[20657],{"type":21,"tag":2314,"props":20658,"children":20659},{"emptyLinePlaceholder":3181},[20660],{"type":26,"value":3184},{"type":21,"tag":2314,"props":20662,"children":20663},{"class":2316,"line":2335},[20664],{"type":21,"tag":2314,"props":20665,"children":20666},{"style":2321},[20667],{"type":26,"value":20668},"QiskitRuntimeService.save_account(\n",{"type":21,"tag":2314,"props":20670,"children":20671},{"class":2316,"line":2397},[20672,20677,20681,20686],{"type":21,"tag":2314,"props":20673,"children":20674},{"style":3222},[20675],{"type":26,"value":20676},"    channel",{"type":21,"tag":2314,"props":20678,"children":20679},{"style":3157},[20680],{"type":26,"value":3197},{"type":21,"tag":2314,"props":20682,"children":20683},{"style":2350},[20684],{"type":26,"value":20685},"\"ibm_quantum\"",{"type":21,"tag":2314,"props":20687,"children":20688},{"style":2321},[20689],{"type":26,"value":2418},{"type":21,"tag":2314,"props":20691,"children":20692},{"class":2316,"line":2421},[20693,20698,20702],{"type":21,"tag":2314,"props":20694,"children":20695},{"style":3222},[20696],{"type":26,"value":20697},"    token",{"type":21,"tag":2314,"props":20699,"children":20700},{"style":3157},[20701],{"type":26,"value":3197},{"type":21,"tag":2314,"props":20703,"children":20704},{"style":2350},[20705],{"type":26,"value":20706},"\"YOUR_TOKEN_HERE\"\n",{"type":21,"tag":2314,"props":20708,"children":20709},{"class":2316,"line":16},[20710],{"type":21,"tag":2314,"props":20711,"children":20712},{"style":2321},[20713],{"type":26,"value":3257},{"type":21,"tag":6961,"props":20715,"children":20716},{"start":2397},[20717],{"type":21,"tag":3084,"props":20718,"children":20719},{},[20720],{"type":26,"value":20721},"向 IBM 的任意免费公共 QPU 提交作业",{"type":21,"tag":22,"props":20723,"children":20724},{},[20725],{"type":26,"value":20726},"公共系统的排队时间通常从几分钟到几小时不等。你是在与全世界的研究人员和学生共享运行时间——这是唯一的门槛。",{"type":21,"tag":29,"props":20728,"children":20730},{"id":20729},"选择你的第一个-sdk",[20731],{"type":26,"value":20732},"选择你的第一个 SDK",{"type":21,"tag":4020,"props":20734,"children":20735},{},[20736,20757],{"type":21,"tag":4024,"props":20737,"children":20738},{},[20739],{"type":21,"tag":4028,"props":20740,"children":20741},{},[20742,20747,20752],{"type":21,"tag":4032,"props":20743,"children":20744},{},[20745],{"type":26,"value":20746},"SDK",{"type":21,"tag":4032,"props":20748,"children":20749},{},[20750],{"type":26,"value":20751},"最适合",{"type":21,"tag":4032,"props":20753,"children":20754},{},[20755],{"type":26,"value":20756},"免费层级",{"type":21,"tag":4046,"props":20758,"children":20759},{},[20760,20778,20795,20812,20830],{"type":21,"tag":4028,"props":20761,"children":20762},{},[20763,20768,20773],{"type":21,"tag":4053,"props":20764,"children":20765},{},[20766],{"type":26,"value":20767},"IBM Qiskit",{"type":21,"tag":4053,"props":20769,"children":20770},{},[20771],{"type":26,"value":20772},"通用用途、真实硬件",{"type":21,"tag":4053,"props":20774,"children":20775},{},[20776],{"type":26,"value":20777},"完整——本地 + 真实 QPU",{"type":21,"tag":4028,"props":20779,"children":20780},{},[20781,20785,20790],{"type":21,"tag":4053,"props":20782,"children":20783},{},[20784],{"type":26,"value":13739},{"type":21,"tag":4053,"props":20786,"children":20787},{},[20788],{"type":26,"value":20789},"量子机器学习、梯度",{"type":21,"tag":4053,"props":20791,"children":20792},{},[20793],{"type":26,"value":20794},"完整——本地模拟器",{"type":21,"tag":4028,"props":20796,"children":20797},{},[20798,20803,20808],{"type":21,"tag":4053,"props":20799,"children":20800},{},[20801],{"type":26,"value":20802},"Google Cirq",{"type":21,"tag":4053,"props":20804,"children":20805},{},[20806],{"type":26,"value":20807},"NISQ 研究",{"type":21,"tag":4053,"props":20809,"children":20810},{},[20811],{"type":26,"value":20794},{"type":21,"tag":4028,"props":20813,"children":20814},{},[20815,20820,20825],{"type":21,"tag":4053,"props":20816,"children":20817},{},[20818],{"type":26,"value":20819},"Amazon Braket",{"type":21,"tag":4053,"props":20821,"children":20822},{},[20823],{"type":26,"value":20824},"AWS 集成",{"type":21,"tag":4053,"props":20826,"children":20827},{},[20828],{"type":26,"value":20829},"免费本地模拟，云端付费",{"type":21,"tag":4028,"props":20831,"children":20832},{},[20833,20837,20842],{"type":21,"tag":4053,"props":20834,"children":20835},{},[20836],{"type":26,"value":20574},{"type":21,"tag":4053,"props":20838,"children":20839},{},[20840],{"type":26,"value":20841},"GPU 加速",{"type":21,"tag":4053,"props":20843,"children":20844},{},[20845],{"type":26,"value":20846},"完整——本地 GPU",{"type":21,"tag":22,"props":20848,"children":20849},{},[20850,20852,20856],{"type":26,"value":20851},"对于大多数初学者来说，",{"type":21,"tag":136,"props":20853,"children":20854},{},[20855],{"type":26,"value":1363},{"type":26,"value":20857}," 是最佳起点——它拥有最大的社区、最丰富的文档，以及对真实 IBM 硬件的直接访问。",{"type":21,"tag":29,"props":20859,"children":20861},{"id":20860},"接下来构建什么",[20862],{"type":26,"value":20860},{"type":21,"tag":22,"props":20864,"children":20865},{},[20866],{"type":26,"value":20867},"一旦你的贝尔态运行成功，下面是一系列值得尝试的有趣电路，循序渐进：",{"type":21,"tag":3080,"props":20869,"children":20870},{},[20871,20889,20898,20908],{"type":21,"tag":3084,"props":20872,"children":20873},{},[20874,20879,20881,20887],{"type":21,"tag":136,"props":20875,"children":20876},{},[20877],{"type":26,"value":20878},"GHZ 态",{"type":26,"value":20880},"——一个 3 量子比特的纠缠态（",{"type":21,"tag":2073,"props":20882,"children":20884},{"className":20883},[],[20885],{"type":26,"value":20886},"h(0).cx(0,1).cx(0,2)",{"type":26,"value":20888},"）",{"type":21,"tag":3084,"props":20890,"children":20891},{},[20892,20896],{"type":21,"tag":136,"props":20893,"children":20894},{},[20895],{"type":26,"value":3798},{"type":26,"value":20897},"——利用纠缠和经典通信传输一个量子比特的状态",{"type":21,"tag":3084,"props":20899,"children":20900},{},[20901,20906],{"type":21,"tag":136,"props":20902,"children":20903},{},[20904],{"type":26,"value":20905},"Grover 搜索",{"type":26,"value":20907},"——以比暴力搜索快二次方的速度在列表中找到被标记的项",{"type":21,"tag":3084,"props":20909,"children":20910},{},[20911,20915],{"type":21,"tag":136,"props":20912,"children":20913},{},[20914],{"type":26,"value":282},{"type":26,"value":20916},"——用变分算法估计分子基态能量",{"type":21,"tag":22,"props":20918,"children":20919},{},[20920,20922,20926,20927,20931],{"type":26,"value":20921},"查看",{"type":21,"tag":46,"props":20923,"children":20924},{"href":408},[20925],{"type":26,"value":20581},{"type":26,"value":209},{"type":21,"tag":46,"props":20928,"children":20929},{"href":99},[20930],{"type":26,"value":3668},{"type":26,"value":20932},"以深入了解。",{"type":21,"tag":18133,"props":20934,"children":20935},{},[],{"type":21,"tag":22,"props":20937,"children":20938},{},[20939,20941,20946,20948,20952],{"type":26,"value":20940},"💡 ",{"type":21,"tag":136,"props":20942,"children":20943},{},[20944],{"type":26,"value":20945},"提示：",{"type":26,"value":20947}," 如果你打算在多个 SDK 之间做实验，而又不想每次都重写电路，",{"type":21,"tag":46,"props":20949,"children":20950},{"href":18964},[20951],{"type":26,"value":18967},{"type":26,"value":20953}," 提供了一个统一的 API，只需一个后端标志，就能在 Qiskit、Cirq、PennyLane、Braket、CUDA-Q 或 IonQ 上运行同一个电路。",{"type":21,"tag":2688,"props":20955,"children":20956},{},[20957],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":20959},[20960,20961,20962,20963,20964,20965],{"id":20140,"depth":106,"text":20140},{"id":20190,"depth":106,"text":20190},{"id":20481,"depth":106,"text":20484},{"id":20585,"depth":106,"text":20588},{"id":20729,"depth":106,"text":20732},{"id":20860,"depth":106,"text":20860},"content:zh:blog:getting-started-free-quantum-computing.md","zh\u002Fblog\u002Fgetting-started-free-quantum-computing.md","zh\u002Fblog\u002Fgetting-started-free-quantum-computing",{"_path":20970,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":20971,"description":20972,"date":20973,"author":11,"tags":20974,"readingTime":127,"body":20976,"_type":111,"_id":23434,"_source":113,"_file":23435,"_stem":23436,"_extension":116},"\u002Fzh\u002Fblog\u002Fhlquantum-vs-qiskit","HLQuantum 与原生 Qiskit 对比：何时该使用抽象层","对直接用 Qiskit 编写量子电路与使用 HLQuantum 统一 API 的实用比较——附并排代码以及帮助你决定使用哪一个的判断框架。","2026-03-08",[18967,1363,7103,20975],"Best Practices",{"type":18,"children":20977,"toc":23424},[20978,20983,20988,20993,21002,21011,21017,21025,21257,21265,21426,21431,21437,21445,21961,21969,22306,22311,22317,22325,22716,22724,22967,22972,22978,22983,23065,23071,23076,23151,23157,23162,23371,23376,23381,23389,23394,23420],{"type":21,"tag":22,"props":20979,"children":20980},{},[20981],{"type":26,"value":20982},"开始一个量子计算项目时会遇到一个实际问题：你应该直接用 Qiskit 编写电路，还是在其之上使用 HLQuantum 的抽象层？两者都是合理的选择，正确答案取决于你要构建什么。",{"type":21,"tag":22,"props":20984,"children":20985},{},[20986],{"type":26,"value":20987},"本文提供一个具体的、以代码为驱动的比较，帮助你做出决定。",{"type":21,"tag":29,"props":20989,"children":20991},{"id":20990},"核心区别",[20992],{"type":26,"value":20990},{"type":21,"tag":22,"props":20994,"children":20995},{},[20996,21000],{"type":21,"tag":136,"props":20997,"children":20998},{},[20999],{"type":26,"value":1363},{"type":26,"value":21001}," 是 IBM 的量子 SDK。它让你对每一个门、量子比特、测量和编译步骤都拥有直接、精确的控制。它原生面向 IBM 硬件，并且拥有针对 IBM 特定工作流最深厚的生态系统。",{"type":21,"tag":22,"props":21003,"children":21004},{},[21005,21009],{"type":21,"tag":136,"props":21006,"children":21007},{},[21008],{"type":26,"value":18967},{"type":26,"value":21010}," 是一个统一的 API，位于 Qiskit、Cirq、PennyLane、Braket、CUDA-Q 和 IonQ 之上。你编写一个电路；它会翻译并分派到你所指定的任意后端。它用一部分底层控制换取了可移植性和简洁性。",{"type":21,"tag":29,"props":21012,"children":21014},{"id":21013},"并排对比bell-态",[21015],{"type":26,"value":21016},"并排对比：Bell 态",{"type":21,"tag":22,"props":21018,"children":21019},{},[21020],{"type":21,"tag":136,"props":21021,"children":21022},{},[21023],{"type":26,"value":21024},"原生 Qiskit：",{"type":21,"tag":2304,"props":21026,"children":21028},{"code":21027,"language":3147,"meta":7,"className":3145,"style":7},"from qiskit import QuantumCircuit\nfrom qiskit_aer import AerSimulator\n\nqc = QuantumCircuit(2, 2)\nqc.h(0)\nqc.cx(0, 1)\nqc.measure([0, 1], [0, 1])\n\nsim = AerSimulator()\nresult = sim.run(qc, shots=1000).result()\nprint(result.get_counts())  # {'00': 501, '11': 499}\n",[21029],{"type":21,"tag":2073,"props":21030,"children":21031},{"__ignoreMap":7},[21032,21051,21070,21077,21108,21123,21146,21186,21193,21208,21240],{"type":21,"tag":2314,"props":21033,"children":21034},{"class":2316,"line":2317},[21035,21039,21043,21047],{"type":21,"tag":2314,"props":21036,"children":21037},{"style":3157},[21038],{"type":26,"value":3160},{"type":21,"tag":2314,"props":21040,"children":21041},{"style":2321},[21042],{"type":26,"value":4249},{"type":21,"tag":2314,"props":21044,"children":21045},{"style":3157},[21046],{"type":26,"value":3170},{"type":21,"tag":2314,"props":21048,"children":21049},{"style":2321},[21050],{"type":26,"value":20261},{"type":21,"tag":2314,"props":21052,"children":21053},{"class":2316,"line":106},[21054,21058,21062,21066],{"type":21,"tag":2314,"props":21055,"children":21056},{"style":3157},[21057],{"type":26,"value":3160},{"type":21,"tag":2314,"props":21059,"children":21060},{"style":2321},[21061],{"type":26,"value":4270},{"type":21,"tag":2314,"props":21063,"children":21064},{"style":3157},[21065],{"type":26,"value":3170},{"type":21,"tag":2314,"props":21067,"children":21068},{"style":2321},[21069],{"type":26,"value":4279},{"type":21,"tag":2314,"props":21071,"children":21072},{"class":2316,"line":2335},[21073],{"type":21,"tag":2314,"props":21074,"children":21075},{"emptyLinePlaceholder":3181},[21076],{"type":26,"value":3184},{"type":21,"tag":2314,"props":21078,"children":21079},{"class":2316,"line":2397},[21080,21084,21088,21092,21096,21100,21104],{"type":21,"tag":2314,"props":21081,"children":21082},{"style":2321},[21083],{"type":26,"value":7336},{"type":21,"tag":2314,"props":21085,"children":21086},{"style":3157},[21087],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21089,"children":21090},{"style":2321},[21091],{"type":26,"value":5092},{"type":21,"tag":2314,"props":21093,"children":21094},{"style":2339},[21095],{"type":26,"value":2413},{"type":21,"tag":2314,"props":21097,"children":21098},{"style":2321},[21099],{"type":26,"value":1309},{"type":21,"tag":2314,"props":21101,"children":21102},{"style":2339},[21103],{"type":26,"value":2413},{"type":21,"tag":2314,"props":21105,"children":21106},{"style":2321},[21107],{"type":26,"value":3257},{"type":21,"tag":2314,"props":21109,"children":21110},{"class":2316,"line":2421},[21111,21115,21119],{"type":21,"tag":2314,"props":21112,"children":21113},{"style":2321},[21114],{"type":26,"value":7352},{"type":21,"tag":2314,"props":21116,"children":21117},{"style":2339},[21118],{"type":26,"value":5122},{"type":21,"tag":2314,"props":21120,"children":21121},{"style":2321},[21122],{"type":26,"value":3257},{"type":21,"tag":2314,"props":21124,"children":21125},{"class":2316,"line":16},[21126,21130,21134,21138,21142],{"type":21,"tag":2314,"props":21127,"children":21128},{"style":2321},[21129],{"type":26,"value":20347},{"type":21,"tag":2314,"props":21131,"children":21132},{"style":2339},[21133],{"type":26,"value":5122},{"type":21,"tag":2314,"props":21135,"children":21136},{"style":2321},[21137],{"type":26,"value":1309},{"type":21,"tag":2314,"props":21139,"children":21140},{"style":2339},[21141],{"type":26,"value":3513},{"type":21,"tag":2314,"props":21143,"children":21144},{"style":2321},[21145],{"type":26,"value":3257},{"type":21,"tag":2314,"props":21147,"children":21148},{"class":2316,"line":127},[21149,21154,21158,21162,21166,21170,21174,21178,21182],{"type":21,"tag":2314,"props":21150,"children":21151},{"style":2321},[21152],{"type":26,"value":21153},"qc.measure([",{"type":21,"tag":2314,"props":21155,"children":21156},{"style":2339},[21157],{"type":26,"value":5122},{"type":21,"tag":2314,"props":21159,"children":21160},{"style":2321},[21161],{"type":26,"value":1309},{"type":21,"tag":2314,"props":21163,"children":21164},{"style":2339},[21165],{"type":26,"value":3513},{"type":21,"tag":2314,"props":21167,"children":21168},{"style":2321},[21169],{"type":26,"value":5177},{"type":21,"tag":2314,"props":21171,"children":21172},{"style":2339},[21173],{"type":26,"value":5122},{"type":21,"tag":2314,"props":21175,"children":21176},{"style":2321},[21177],{"type":26,"value":1309},{"type":21,"tag":2314,"props":21179,"children":21180},{"style":2339},[21181],{"type":26,"value":3513},{"type":21,"tag":2314,"props":21183,"children":21184},{"style":2321},[21185],{"type":26,"value":3518},{"type":21,"tag":2314,"props":21187,"children":21188},{"class":2316,"line":887},[21189],{"type":21,"tag":2314,"props":21190,"children":21191},{"emptyLinePlaceholder":3181},[21192],{"type":26,"value":3184},{"type":21,"tag":2314,"props":21194,"children":21195},{"class":2316,"line":1364},[21196,21200,21204],{"type":21,"tag":2314,"props":21197,"children":21198},{"style":2321},[21199],{"type":26,"value":8378},{"type":21,"tag":2314,"props":21201,"children":21202},{"style":3157},[21203],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21205,"children":21206},{"style":2321},[21207],{"type":26,"value":8387},{"type":21,"tag":2314,"props":21209,"children":21210},{"class":2316,"line":3403},[21211,21215,21219,21224,21228,21232,21236],{"type":21,"tag":2314,"props":21212,"children":21213},{"style":2321},[21214],{"type":26,"value":19287},{"type":21,"tag":2314,"props":21216,"children":21217},{"style":3157},[21218],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21220,"children":21221},{"style":2321},[21222],{"type":26,"value":21223}," sim.run(qc, ",{"type":21,"tag":2314,"props":21225,"children":21226},{"style":3222},[21227],{"type":26,"value":4077},{"type":21,"tag":2314,"props":21229,"children":21230},{"style":3157},[21231],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21233,"children":21234},{"style":2339},[21235],{"type":26,"value":20419},{"type":21,"tag":2314,"props":21237,"children":21238},{"style":2321},[21239],{"type":26,"value":20424},{"type":21,"tag":2314,"props":21241,"children":21242},{"class":2316,"line":3413},[21243,21247,21252],{"type":21,"tag":2314,"props":21244,"children":21245},{"style":2339},[21246],{"type":26,"value":3272},{"type":21,"tag":2314,"props":21248,"children":21249},{"style":2321},[21250],{"type":26,"value":21251},"(result.get_counts())  ",{"type":21,"tag":2314,"props":21253,"children":21254},{"style":3407},[21255],{"type":26,"value":21256},"# {'00': 501, '11': 499}\n",{"type":21,"tag":22,"props":21258,"children":21259},{},[21260],{"type":21,"tag":136,"props":21261,"children":21262},{},[21263],{"type":26,"value":21264},"HLQuantum：",{"type":21,"tag":2304,"props":21266,"children":21268},{"code":21267,"language":3147,"meta":7,"className":3145,"style":7},"import hlquantum as hlq\n\nqc = hlq.Circuit(2)\nqc.h(0).cx(0, 1).measure_all()\n\nresult = hlq.run(qc, backend='qiskit', shots=1000)\nprint(result.counts)  # {'00': 501, '11': 499}\n",[21269],{"type":21,"tag":2073,"props":21270,"children":21271},{"__ignoreMap":7},[21272,21291,21298,21322,21355,21362,21410],{"type":21,"tag":2314,"props":21273,"children":21274},{"class":2316,"line":2317},[21275,21279,21283,21287],{"type":21,"tag":2314,"props":21276,"children":21277},{"style":3157},[21278],{"type":26,"value":3170},{"type":21,"tag":2314,"props":21280,"children":21281},{"style":2321},[21282],{"type":26,"value":19255},{"type":21,"tag":2314,"props":21284,"children":21285},{"style":3157},[21286],{"type":26,"value":4232},{"type":21,"tag":2314,"props":21288,"children":21289},{"style":2321},[21290],{"type":26,"value":19264},{"type":21,"tag":2314,"props":21292,"children":21293},{"class":2316,"line":106},[21294],{"type":21,"tag":2314,"props":21295,"children":21296},{"emptyLinePlaceholder":3181},[21297],{"type":26,"value":3184},{"type":21,"tag":2314,"props":21299,"children":21300},{"class":2316,"line":2335},[21301,21305,21309,21314,21318],{"type":21,"tag":2314,"props":21302,"children":21303},{"style":2321},[21304],{"type":26,"value":7336},{"type":21,"tag":2314,"props":21306,"children":21307},{"style":3157},[21308],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21310,"children":21311},{"style":2321},[21312],{"type":26,"value":21313}," hlq.Circuit(",{"type":21,"tag":2314,"props":21315,"children":21316},{"style":2339},[21317],{"type":26,"value":2413},{"type":21,"tag":2314,"props":21319,"children":21320},{"style":2321},[21321],{"type":26,"value":3257},{"type":21,"tag":2314,"props":21323,"children":21324},{"class":2316,"line":2397},[21325,21329,21333,21338,21342,21346,21350],{"type":21,"tag":2314,"props":21326,"children":21327},{"style":2321},[21328],{"type":26,"value":7352},{"type":21,"tag":2314,"props":21330,"children":21331},{"style":2339},[21332],{"type":26,"value":5122},{"type":21,"tag":2314,"props":21334,"children":21335},{"style":2321},[21336],{"type":26,"value":21337},").cx(",{"type":21,"tag":2314,"props":21339,"children":21340},{"style":2339},[21341],{"type":26,"value":5122},{"type":21,"tag":2314,"props":21343,"children":21344},{"style":2321},[21345],{"type":26,"value":1309},{"type":21,"tag":2314,"props":21347,"children":21348},{"style":2339},[21349],{"type":26,"value":3513},{"type":21,"tag":2314,"props":21351,"children":21352},{"style":2321},[21353],{"type":26,"value":21354},").measure_all()\n",{"type":21,"tag":2314,"props":21356,"children":21357},{"class":2316,"line":2421},[21358],{"type":21,"tag":2314,"props":21359,"children":21360},{"emptyLinePlaceholder":3181},[21361],{"type":26,"value":3184},{"type":21,"tag":2314,"props":21363,"children":21364},{"class":2316,"line":16},[21365,21369,21373,21378,21382,21386,21390,21394,21398,21402,21406],{"type":21,"tag":2314,"props":21366,"children":21367},{"style":2321},[21368],{"type":26,"value":19287},{"type":21,"tag":2314,"props":21370,"children":21371},{"style":3157},[21372],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21374,"children":21375},{"style":2321},[21376],{"type":26,"value":21377}," hlq.run(qc, ",{"type":21,"tag":2314,"props":21379,"children":21380},{"style":3222},[21381],{"type":26,"value":18425},{"type":21,"tag":2314,"props":21383,"children":21384},{"style":3157},[21385],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21387,"children":21388},{"style":2350},[21389],{"type":26,"value":19345},{"type":21,"tag":2314,"props":21391,"children":21392},{"style":2321},[21393],{"type":26,"value":1309},{"type":21,"tag":2314,"props":21395,"children":21396},{"style":3222},[21397],{"type":26,"value":4077},{"type":21,"tag":2314,"props":21399,"children":21400},{"style":3157},[21401],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21403,"children":21404},{"style":2339},[21405],{"type":26,"value":20419},{"type":21,"tag":2314,"props":21407,"children":21408},{"style":2321},[21409],{"type":26,"value":3257},{"type":21,"tag":2314,"props":21411,"children":21412},{"class":2316,"line":127},[21413,21417,21422],{"type":21,"tag":2314,"props":21414,"children":21415},{"style":2339},[21416],{"type":26,"value":3272},{"type":21,"tag":2314,"props":21418,"children":21419},{"style":2321},[21420],{"type":26,"value":21421},"(result.counts)  ",{"type":21,"tag":2314,"props":21423,"children":21424},{"style":3407},[21425],{"type":26,"value":21256},{"type":21,"tag":22,"props":21427,"children":21428},{},[21429],{"type":26,"value":21430},"对于单个后端，两者的冗长程度大致相同。当你添加更多后端时，差异才会显现出来。",{"type":21,"tag":29,"props":21432,"children":21434},{"id":21433},"并排对比在多个后端上运行",[21435],{"type":26,"value":21436},"并排对比：在多个后端上运行",{"type":21,"tag":22,"props":21438,"children":21439},{},[21440],{"type":21,"tag":136,"props":21441,"children":21442},{},[21443],{"type":26,"value":21444},"原生 Qiskit（要添加第二个后端，你需要重写）：",{"type":21,"tag":2304,"props":21446,"children":21448},{"code":21447,"language":3147,"meta":7,"className":3145,"style":7},"# Qiskit Aer\nfrom qiskit import QuantumCircuit\nfrom qiskit_aer import AerSimulator\nqc_qiskit = QuantumCircuit(2, 2)\nqc_qiskit.h(0); qc_qiskit.cx(0, 1); qc_qiskit.measure_all()\nresult_qiskit = AerSimulator().run(qc_qiskit, shots=1000).result()\n\n# PennyLane — completely different API, rewrite circuit\nimport pennylane as qml\ndev = qml.device('default.qubit', wires=2)\n@qml.qnode(dev)\ndef bell():\n    qml.Hadamard(wires=0)\n    qml.CNOT(wires=[0, 1])\n    return qml.probs(wires=[0, 1])\nresult_pennylane = bell()\n\n# CUDA-Q — yet another API, rewrite again\nimport cudaq\n@cudaq.kernel\ndef bell():\n    qvec = cudaq.qvector(2)\n    h(qvec[0]); cx(qvec[0], qvec[1]); mz(qvec)\nresult_cudaq = cudaq.sample(bell, shots_count=1000)\n",[21449],{"type":21,"tag":2073,"props":21450,"children":21451},{"__ignoreMap":7},[21452,21460,21479,21498,21530,21564,21597,21604,21612,21631,21671,21682,21699,21723,21760,21800,21817,21824,21832,21844,21852,21867,21892,21927],{"type":21,"tag":2314,"props":21453,"children":21454},{"class":2316,"line":2317},[21455],{"type":21,"tag":2314,"props":21456,"children":21457},{"style":3407},[21458],{"type":26,"value":21459},"# Qiskit Aer\n",{"type":21,"tag":2314,"props":21461,"children":21462},{"class":2316,"line":106},[21463,21467,21471,21475],{"type":21,"tag":2314,"props":21464,"children":21465},{"style":3157},[21466],{"type":26,"value":3160},{"type":21,"tag":2314,"props":21468,"children":21469},{"style":2321},[21470],{"type":26,"value":4249},{"type":21,"tag":2314,"props":21472,"children":21473},{"style":3157},[21474],{"type":26,"value":3170},{"type":21,"tag":2314,"props":21476,"children":21477},{"style":2321},[21478],{"type":26,"value":20261},{"type":21,"tag":2314,"props":21480,"children":21481},{"class":2316,"line":2335},[21482,21486,21490,21494],{"type":21,"tag":2314,"props":21483,"children":21484},{"style":3157},[21485],{"type":26,"value":3160},{"type":21,"tag":2314,"props":21487,"children":21488},{"style":2321},[21489],{"type":26,"value":4270},{"type":21,"tag":2314,"props":21491,"children":21492},{"style":3157},[21493],{"type":26,"value":3170},{"type":21,"tag":2314,"props":21495,"children":21496},{"style":2321},[21497],{"type":26,"value":4279},{"type":21,"tag":2314,"props":21499,"children":21500},{"class":2316,"line":2397},[21501,21506,21510,21514,21518,21522,21526],{"type":21,"tag":2314,"props":21502,"children":21503},{"style":2321},[21504],{"type":26,"value":21505},"qc_qiskit ",{"type":21,"tag":2314,"props":21507,"children":21508},{"style":3157},[21509],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21511,"children":21512},{"style":2321},[21513],{"type":26,"value":5092},{"type":21,"tag":2314,"props":21515,"children":21516},{"style":2339},[21517],{"type":26,"value":2413},{"type":21,"tag":2314,"props":21519,"children":21520},{"style":2321},[21521],{"type":26,"value":1309},{"type":21,"tag":2314,"props":21523,"children":21524},{"style":2339},[21525],{"type":26,"value":2413},{"type":21,"tag":2314,"props":21527,"children":21528},{"style":2321},[21529],{"type":26,"value":3257},{"type":21,"tag":2314,"props":21531,"children":21532},{"class":2316,"line":2421},[21533,21538,21542,21547,21551,21555,21559],{"type":21,"tag":2314,"props":21534,"children":21535},{"style":2321},[21536],{"type":26,"value":21537},"qc_qiskit.h(",{"type":21,"tag":2314,"props":21539,"children":21540},{"style":2339},[21541],{"type":26,"value":5122},{"type":21,"tag":2314,"props":21543,"children":21544},{"style":2321},[21545],{"type":26,"value":21546},"); qc_qiskit.cx(",{"type":21,"tag":2314,"props":21548,"children":21549},{"style":2339},[21550],{"type":26,"value":5122},{"type":21,"tag":2314,"props":21552,"children":21553},{"style":2321},[21554],{"type":26,"value":1309},{"type":21,"tag":2314,"props":21556,"children":21557},{"style":2339},[21558],{"type":26,"value":3513},{"type":21,"tag":2314,"props":21560,"children":21561},{"style":2321},[21562],{"type":26,"value":21563},"); qc_qiskit.measure_all()\n",{"type":21,"tag":2314,"props":21565,"children":21566},{"class":2316,"line":16},[21567,21572,21576,21581,21585,21589,21593],{"type":21,"tag":2314,"props":21568,"children":21569},{"style":2321},[21570],{"type":26,"value":21571},"result_qiskit ",{"type":21,"tag":2314,"props":21573,"children":21574},{"style":3157},[21575],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21577,"children":21578},{"style":2321},[21579],{"type":26,"value":21580}," AerSimulator().run(qc_qiskit, ",{"type":21,"tag":2314,"props":21582,"children":21583},{"style":3222},[21584],{"type":26,"value":4077},{"type":21,"tag":2314,"props":21586,"children":21587},{"style":3157},[21588],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21590,"children":21591},{"style":2339},[21592],{"type":26,"value":20419},{"type":21,"tag":2314,"props":21594,"children":21595},{"style":2321},[21596],{"type":26,"value":20424},{"type":21,"tag":2314,"props":21598,"children":21599},{"class":2316,"line":127},[21600],{"type":21,"tag":2314,"props":21601,"children":21602},{"emptyLinePlaceholder":3181},[21603],{"type":26,"value":3184},{"type":21,"tag":2314,"props":21605,"children":21606},{"class":2316,"line":887},[21607],{"type":21,"tag":2314,"props":21608,"children":21609},{"style":3407},[21610],{"type":26,"value":21611},"# PennyLane — completely different API, rewrite circuit\n",{"type":21,"tag":2314,"props":21613,"children":21614},{"class":2316,"line":1364},[21615,21619,21623,21627],{"type":21,"tag":2314,"props":21616,"children":21617},{"style":3157},[21618],{"type":26,"value":3170},{"type":21,"tag":2314,"props":21620,"children":21621},{"style":2321},[21622],{"type":26,"value":14046},{"type":21,"tag":2314,"props":21624,"children":21625},{"style":3157},[21626],{"type":26,"value":4232},{"type":21,"tag":2314,"props":21628,"children":21629},{"style":2321},[21630],{"type":26,"value":14055},{"type":21,"tag":2314,"props":21632,"children":21633},{"class":2316,"line":3403},[21634,21638,21642,21646,21651,21655,21659,21663,21667],{"type":21,"tag":2314,"props":21635,"children":21636},{"style":2321},[21637],{"type":26,"value":14179},{"type":21,"tag":2314,"props":21639,"children":21640},{"style":3157},[21641],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21643,"children":21644},{"style":2321},[21645],{"type":26,"value":14188},{"type":21,"tag":2314,"props":21647,"children":21648},{"style":2350},[21649],{"type":26,"value":21650},"'default.qubit'",{"type":21,"tag":2314,"props":21652,"children":21653},{"style":2321},[21654],{"type":26,"value":1309},{"type":21,"tag":2314,"props":21656,"children":21657},{"style":3222},[21658],{"type":26,"value":14202},{"type":21,"tag":2314,"props":21660,"children":21661},{"style":3157},[21662],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21664,"children":21665},{"style":2339},[21666],{"type":26,"value":2413},{"type":21,"tag":2314,"props":21668,"children":21669},{"style":2321},[21670],{"type":26,"value":3257},{"type":21,"tag":2314,"props":21672,"children":21673},{"class":2316,"line":3413},[21674,21678],{"type":21,"tag":2314,"props":21675,"children":21676},{"style":4318},[21677],{"type":26,"value":14226},{"type":21,"tag":2314,"props":21679,"children":21680},{"style":2321},[21681],{"type":26,"value":14231},{"type":21,"tag":2314,"props":21683,"children":21684},{"class":2316,"line":436},[21685,21689,21694],{"type":21,"tag":2314,"props":21686,"children":21687},{"style":3157},[21688],{"type":26,"value":4315},{"type":21,"tag":2314,"props":21690,"children":21691},{"style":4318},[21692],{"type":26,"value":21693}," bell",{"type":21,"tag":2314,"props":21695,"children":21696},{"style":2321},[21697],{"type":26,"value":21698},"():\n",{"type":21,"tag":2314,"props":21700,"children":21701},{"class":2316,"line":3473},[21702,21707,21711,21715,21719],{"type":21,"tag":2314,"props":21703,"children":21704},{"style":2321},[21705],{"type":26,"value":21706},"    qml.Hadamard(",{"type":21,"tag":2314,"props":21708,"children":21709},{"style":3222},[21710],{"type":26,"value":14202},{"type":21,"tag":2314,"props":21712,"children":21713},{"style":3157},[21714],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21716,"children":21717},{"style":2339},[21718],{"type":26,"value":5122},{"type":21,"tag":2314,"props":21720,"children":21721},{"style":2321},[21722],{"type":26,"value":3257},{"type":21,"tag":2314,"props":21724,"children":21725},{"class":2316,"line":3521},[21726,21731,21735,21739,21744,21748,21752,21756],{"type":21,"tag":2314,"props":21727,"children":21728},{"style":2321},[21729],{"type":26,"value":21730},"    qml.CNOT(",{"type":21,"tag":2314,"props":21732,"children":21733},{"style":3222},[21734],{"type":26,"value":14202},{"type":21,"tag":2314,"props":21736,"children":21737},{"style":3157},[21738],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21740,"children":21741},{"style":2321},[21742],{"type":26,"value":21743},"[",{"type":21,"tag":2314,"props":21745,"children":21746},{"style":2339},[21747],{"type":26,"value":5122},{"type":21,"tag":2314,"props":21749,"children":21750},{"style":2321},[21751],{"type":26,"value":1309},{"type":21,"tag":2314,"props":21753,"children":21754},{"style":2339},[21755],{"type":26,"value":3513},{"type":21,"tag":2314,"props":21757,"children":21758},{"style":2321},[21759],{"type":26,"value":3518},{"type":21,"tag":2314,"props":21761,"children":21762},{"class":2316,"line":3563},[21763,21767,21772,21776,21780,21784,21788,21792,21796],{"type":21,"tag":2314,"props":21764,"children":21765},{"style":3157},[21766],{"type":26,"value":4540},{"type":21,"tag":2314,"props":21768,"children":21769},{"style":2321},[21770],{"type":26,"value":21771}," qml.probs(",{"type":21,"tag":2314,"props":21773,"children":21774},{"style":3222},[21775],{"type":26,"value":14202},{"type":21,"tag":2314,"props":21777,"children":21778},{"style":3157},[21779],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21781,"children":21782},{"style":2321},[21783],{"type":26,"value":21743},{"type":21,"tag":2314,"props":21785,"children":21786},{"style":2339},[21787],{"type":26,"value":5122},{"type":21,"tag":2314,"props":21789,"children":21790},{"style":2321},[21791],{"type":26,"value":1309},{"type":21,"tag":2314,"props":21793,"children":21794},{"style":2339},[21795],{"type":26,"value":3513},{"type":21,"tag":2314,"props":21797,"children":21798},{"style":2321},[21799],{"type":26,"value":3518},{"type":21,"tag":2314,"props":21801,"children":21802},{"class":2316,"line":4585},[21803,21808,21812],{"type":21,"tag":2314,"props":21804,"children":21805},{"style":2321},[21806],{"type":26,"value":21807},"result_pennylane ",{"type":21,"tag":2314,"props":21809,"children":21810},{"style":3157},[21811],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21813,"children":21814},{"style":2321},[21815],{"type":26,"value":21816}," bell()\n",{"type":21,"tag":2314,"props":21818,"children":21819},{"class":2316,"line":4604},[21820],{"type":21,"tag":2314,"props":21821,"children":21822},{"emptyLinePlaceholder":3181},[21823],{"type":26,"value":3184},{"type":21,"tag":2314,"props":21825,"children":21826},{"class":2316,"line":4612},[21827],{"type":21,"tag":2314,"props":21828,"children":21829},{"style":3407},[21830],{"type":26,"value":21831},"# CUDA-Q — yet another API, rewrite again\n",{"type":21,"tag":2314,"props":21833,"children":21834},{"class":2316,"line":4643},[21835,21839],{"type":21,"tag":2314,"props":21836,"children":21837},{"style":3157},[21838],{"type":26,"value":3170},{"type":21,"tag":2314,"props":21840,"children":21841},{"style":2321},[21842],{"type":26,"value":21843}," cudaq\n",{"type":21,"tag":2314,"props":21845,"children":21846},{"class":2316,"line":4688},[21847],{"type":21,"tag":2314,"props":21848,"children":21849},{"style":4318},[21850],{"type":26,"value":21851},"@cudaq.kernel\n",{"type":21,"tag":2314,"props":21853,"children":21854},{"class":2316,"line":4727},[21855,21859,21863],{"type":21,"tag":2314,"props":21856,"children":21857},{"style":3157},[21858],{"type":26,"value":4315},{"type":21,"tag":2314,"props":21860,"children":21861},{"style":4318},[21862],{"type":26,"value":21693},{"type":21,"tag":2314,"props":21864,"children":21865},{"style":2321},[21866],{"type":26,"value":21698},{"type":21,"tag":2314,"props":21868,"children":21869},{"class":2316,"line":4745},[21870,21875,21879,21884,21888],{"type":21,"tag":2314,"props":21871,"children":21872},{"style":2321},[21873],{"type":26,"value":21874},"    qvec ",{"type":21,"tag":2314,"props":21876,"children":21877},{"style":3157},[21878],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21880,"children":21881},{"style":2321},[21882],{"type":26,"value":21883}," cudaq.qvector(",{"type":21,"tag":2314,"props":21885,"children":21886},{"style":2339},[21887],{"type":26,"value":2413},{"type":21,"tag":2314,"props":21889,"children":21890},{"style":2321},[21891],{"type":26,"value":3257},{"type":21,"tag":2314,"props":21893,"children":21894},{"class":2316,"line":4819},[21895,21900,21904,21909,21913,21918,21922],{"type":21,"tag":2314,"props":21896,"children":21897},{"style":2321},[21898],{"type":26,"value":21899},"    h(qvec[",{"type":21,"tag":2314,"props":21901,"children":21902},{"style":2339},[21903],{"type":26,"value":5122},{"type":21,"tag":2314,"props":21905,"children":21906},{"style":2321},[21907],{"type":26,"value":21908},"]); cx(qvec[",{"type":21,"tag":2314,"props":21910,"children":21911},{"style":2339},[21912],{"type":26,"value":5122},{"type":21,"tag":2314,"props":21914,"children":21915},{"style":2321},[21916],{"type":26,"value":21917},"], qvec[",{"type":21,"tag":2314,"props":21919,"children":21920},{"style":2339},[21921],{"type":26,"value":3513},{"type":21,"tag":2314,"props":21923,"children":21924},{"style":2321},[21925],{"type":26,"value":21926},"]); mz(qvec)\n",{"type":21,"tag":2314,"props":21928,"children":21929},{"class":2316,"line":4847},[21930,21935,21939,21944,21949,21953,21957],{"type":21,"tag":2314,"props":21931,"children":21932},{"style":2321},[21933],{"type":26,"value":21934},"result_cudaq ",{"type":21,"tag":2314,"props":21936,"children":21937},{"style":3157},[21938],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21940,"children":21941},{"style":2321},[21942],{"type":26,"value":21943}," cudaq.sample(bell, ",{"type":21,"tag":2314,"props":21945,"children":21946},{"style":3222},[21947],{"type":26,"value":21948},"shots_count",{"type":21,"tag":2314,"props":21950,"children":21951},{"style":3157},[21952],{"type":26,"value":3197},{"type":21,"tag":2314,"props":21954,"children":21955},{"style":2339},[21956],{"type":26,"value":20419},{"type":21,"tag":2314,"props":21958,"children":21959},{"style":2321},[21960],{"type":26,"value":3257},{"type":21,"tag":22,"props":21962,"children":21963},{},[21964],{"type":21,"tag":136,"props":21965,"children":21966},{},[21967],{"type":26,"value":21968},"HLQuantum（一个电路，任意后端）：",{"type":21,"tag":2304,"props":21970,"children":21972},{"code":21971,"language":3147,"meta":7,"className":3145,"style":7},"import hlquantum as hlq\n\nqc = hlq.Circuit(2)\nqc.h(0).cx(0, 1).measure_all()\n\n# Switch backends with one word\nresult_qiskit    = hlq.run(qc, backend='qiskit')\nresult_pennylane = hlq.run(qc, backend='pennylane')\nresult_cudaq     = hlq.run(qc, backend='cudaq')    # GPU\nresult_cirq      = hlq.run(qc, backend='cirq')\nresult_ionq      = hlq.run(qc, backend='ionq', device='aria-1')\nresult_ibm       = hlq.run(qc, backend='qiskit', device='ibm_sherbrooke')\n",[21973],{"type":21,"tag":2073,"props":21974,"children":21975},{"__ignoreMap":7},[21976,21995,22002,22025,22056,22063,22071,22103,22135,22173,22206,22257],{"type":21,"tag":2314,"props":21977,"children":21978},{"class":2316,"line":2317},[21979,21983,21987,21991],{"type":21,"tag":2314,"props":21980,"children":21981},{"style":3157},[21982],{"type":26,"value":3170},{"type":21,"tag":2314,"props":21984,"children":21985},{"style":2321},[21986],{"type":26,"value":19255},{"type":21,"tag":2314,"props":21988,"children":21989},{"style":3157},[21990],{"type":26,"value":4232},{"type":21,"tag":2314,"props":21992,"children":21993},{"style":2321},[21994],{"type":26,"value":19264},{"type":21,"tag":2314,"props":21996,"children":21997},{"class":2316,"line":106},[21998],{"type":21,"tag":2314,"props":21999,"children":22000},{"emptyLinePlaceholder":3181},[22001],{"type":26,"value":3184},{"type":21,"tag":2314,"props":22003,"children":22004},{"class":2316,"line":2335},[22005,22009,22013,22017,22021],{"type":21,"tag":2314,"props":22006,"children":22007},{"style":2321},[22008],{"type":26,"value":7336},{"type":21,"tag":2314,"props":22010,"children":22011},{"style":3157},[22012],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22014,"children":22015},{"style":2321},[22016],{"type":26,"value":21313},{"type":21,"tag":2314,"props":22018,"children":22019},{"style":2339},[22020],{"type":26,"value":2413},{"type":21,"tag":2314,"props":22022,"children":22023},{"style":2321},[22024],{"type":26,"value":3257},{"type":21,"tag":2314,"props":22026,"children":22027},{"class":2316,"line":2397},[22028,22032,22036,22040,22044,22048,22052],{"type":21,"tag":2314,"props":22029,"children":22030},{"style":2321},[22031],{"type":26,"value":7352},{"type":21,"tag":2314,"props":22033,"children":22034},{"style":2339},[22035],{"type":26,"value":5122},{"type":21,"tag":2314,"props":22037,"children":22038},{"style":2321},[22039],{"type":26,"value":21337},{"type":21,"tag":2314,"props":22041,"children":22042},{"style":2339},[22043],{"type":26,"value":5122},{"type":21,"tag":2314,"props":22045,"children":22046},{"style":2321},[22047],{"type":26,"value":1309},{"type":21,"tag":2314,"props":22049,"children":22050},{"style":2339},[22051],{"type":26,"value":3513},{"type":21,"tag":2314,"props":22053,"children":22054},{"style":2321},[22055],{"type":26,"value":21354},{"type":21,"tag":2314,"props":22057,"children":22058},{"class":2316,"line":2421},[22059],{"type":21,"tag":2314,"props":22060,"children":22061},{"emptyLinePlaceholder":3181},[22062],{"type":26,"value":3184},{"type":21,"tag":2314,"props":22064,"children":22065},{"class":2316,"line":16},[22066],{"type":21,"tag":2314,"props":22067,"children":22068},{"style":3407},[22069],{"type":26,"value":22070},"# Switch backends with one word\n",{"type":21,"tag":2314,"props":22072,"children":22073},{"class":2316,"line":127},[22074,22079,22083,22087,22091,22095,22099],{"type":21,"tag":2314,"props":22075,"children":22076},{"style":2321},[22077],{"type":26,"value":22078},"result_qiskit    ",{"type":21,"tag":2314,"props":22080,"children":22081},{"style":3157},[22082],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22084,"children":22085},{"style":2321},[22086],{"type":26,"value":21377},{"type":21,"tag":2314,"props":22088,"children":22089},{"style":3222},[22090],{"type":26,"value":18425},{"type":21,"tag":2314,"props":22092,"children":22093},{"style":3157},[22094],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22096,"children":22097},{"style":2350},[22098],{"type":26,"value":19345},{"type":21,"tag":2314,"props":22100,"children":22101},{"style":2321},[22102],{"type":26,"value":3257},{"type":21,"tag":2314,"props":22104,"children":22105},{"class":2316,"line":887},[22106,22110,22114,22118,22122,22126,22131],{"type":21,"tag":2314,"props":22107,"children":22108},{"style":2321},[22109],{"type":26,"value":21807},{"type":21,"tag":2314,"props":22111,"children":22112},{"style":3157},[22113],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22115,"children":22116},{"style":2321},[22117],{"type":26,"value":21377},{"type":21,"tag":2314,"props":22119,"children":22120},{"style":3222},[22121],{"type":26,"value":18425},{"type":21,"tag":2314,"props":22123,"children":22124},{"style":3157},[22125],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22127,"children":22128},{"style":2350},[22129],{"type":26,"value":22130},"'pennylane'",{"type":21,"tag":2314,"props":22132,"children":22133},{"style":2321},[22134],{"type":26,"value":3257},{"type":21,"tag":2314,"props":22136,"children":22137},{"class":2316,"line":1364},[22138,22143,22147,22151,22155,22159,22164,22168],{"type":21,"tag":2314,"props":22139,"children":22140},{"style":2321},[22141],{"type":26,"value":22142},"result_cudaq     ",{"type":21,"tag":2314,"props":22144,"children":22145},{"style":3157},[22146],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22148,"children":22149},{"style":2321},[22150],{"type":26,"value":21377},{"type":21,"tag":2314,"props":22152,"children":22153},{"style":3222},[22154],{"type":26,"value":18425},{"type":21,"tag":2314,"props":22156,"children":22157},{"style":3157},[22158],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22160,"children":22161},{"style":2350},[22162],{"type":26,"value":22163},"'cudaq'",{"type":21,"tag":2314,"props":22165,"children":22166},{"style":2321},[22167],{"type":26,"value":8166},{"type":21,"tag":2314,"props":22169,"children":22170},{"style":3407},[22171],{"type":26,"value":22172},"# GPU\n",{"type":21,"tag":2314,"props":22174,"children":22175},{"class":2316,"line":3403},[22176,22181,22185,22189,22193,22197,22202],{"type":21,"tag":2314,"props":22177,"children":22178},{"style":2321},[22179],{"type":26,"value":22180},"result_cirq      ",{"type":21,"tag":2314,"props":22182,"children":22183},{"style":3157},[22184],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22186,"children":22187},{"style":2321},[22188],{"type":26,"value":21377},{"type":21,"tag":2314,"props":22190,"children":22191},{"style":3222},[22192],{"type":26,"value":18425},{"type":21,"tag":2314,"props":22194,"children":22195},{"style":3157},[22196],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22198,"children":22199},{"style":2350},[22200],{"type":26,"value":22201},"'cirq'",{"type":21,"tag":2314,"props":22203,"children":22204},{"style":2321},[22205],{"type":26,"value":3257},{"type":21,"tag":2314,"props":22207,"children":22208},{"class":2316,"line":3413},[22209,22214,22218,22222,22226,22230,22235,22239,22244,22248,22253],{"type":21,"tag":2314,"props":22210,"children":22211},{"style":2321},[22212],{"type":26,"value":22213},"result_ionq      ",{"type":21,"tag":2314,"props":22215,"children":22216},{"style":3157},[22217],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22219,"children":22220},{"style":2321},[22221],{"type":26,"value":21377},{"type":21,"tag":2314,"props":22223,"children":22224},{"style":3222},[22225],{"type":26,"value":18425},{"type":21,"tag":2314,"props":22227,"children":22228},{"style":3157},[22229],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22231,"children":22232},{"style":2350},[22233],{"type":26,"value":22234},"'ionq'",{"type":21,"tag":2314,"props":22236,"children":22237},{"style":2321},[22238],{"type":26,"value":1309},{"type":21,"tag":2314,"props":22240,"children":22241},{"style":3222},[22242],{"type":26,"value":22243},"device",{"type":21,"tag":2314,"props":22245,"children":22246},{"style":3157},[22247],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22249,"children":22250},{"style":2350},[22251],{"type":26,"value":22252},"'aria-1'",{"type":21,"tag":2314,"props":22254,"children":22255},{"style":2321},[22256],{"type":26,"value":3257},{"type":21,"tag":2314,"props":22258,"children":22259},{"class":2316,"line":436},[22260,22265,22269,22273,22277,22281,22285,22289,22293,22297,22302],{"type":21,"tag":2314,"props":22261,"children":22262},{"style":2321},[22263],{"type":26,"value":22264},"result_ibm       ",{"type":21,"tag":2314,"props":22266,"children":22267},{"style":3157},[22268],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22270,"children":22271},{"style":2321},[22272],{"type":26,"value":21377},{"type":21,"tag":2314,"props":22274,"children":22275},{"style":3222},[22276],{"type":26,"value":18425},{"type":21,"tag":2314,"props":22278,"children":22279},{"style":3157},[22280],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22282,"children":22283},{"style":2350},[22284],{"type":26,"value":19345},{"type":21,"tag":2314,"props":22286,"children":22287},{"style":2321},[22288],{"type":26,"value":1309},{"type":21,"tag":2314,"props":22290,"children":22291},{"style":3222},[22292],{"type":26,"value":22243},{"type":21,"tag":2314,"props":22294,"children":22295},{"style":3157},[22296],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22298,"children":22299},{"style":2350},[22300],{"type":26,"value":22301},"'ibm_sherbrooke'",{"type":21,"tag":2314,"props":22303,"children":22304},{"style":2321},[22305],{"type":26,"value":3257},{"type":21,"tag":22,"props":22307,"children":22308},{},[22309],{"type":26,"value":22310},"这正是 HLQuantum 发挥价值的地方——在本地模拟器上原型开发，然后无需重写电路即可部署到 QPU。",{"type":21,"tag":29,"props":22312,"children":22314},{"id":22313},"并排对比vqe",[22315],{"type":26,"value":22316},"并排对比：VQE",{"type":21,"tag":22,"props":22318,"children":22319},{},[22320],{"type":21,"tag":136,"props":22321,"children":22322},{},[22323],{"type":26,"value":22324},"原生 Qiskit VQE：",{"type":21,"tag":2304,"props":22326,"children":22328},{"code":22327,"language":3147,"meta":7,"className":3145,"style":7},"from qiskit_nature.second_q.drivers import PySCFDriver\nfrom qiskit_nature.second_q.mappers import JordanWignerMapper\nfrom qiskit_nature.second_q.circuit.library import UCCSD\nfrom qiskit_algorithms import VQE\nfrom qiskit_algorithms.optimizers import COBYLA\nfrom qiskit.primitives import Estimator\n\ndriver = PySCFDriver(atom='H .0 .0 .0; H .0 .0 0.735')\nproblem = driver.run()\nmapper = JordanWignerMapper()\nhamiltonian = mapper.map(problem.second_q_ops()[0])\n\nansatz = UCCSD(\n    problem.num_spatial_orbitals,\n    problem.num_particles,\n    mapper,\n    initial_state=problem.reference_state,\n)\n\nvqe = VQE(Estimator(), ansatz, COBYLA())\nresult = vqe.compute_minimum_eigenvalue(hamiltonian)\nprint(f\"H2 ground state: {result.eigenvalue.real:.4f} Ha\")\n",[22329],{"type":21,"tag":2073,"props":22330,"children":22331},{"__ignoreMap":7},[22332,22353,22374,22395,22416,22437,22458,22465,22500,22517,22534,22559,22566,22583,22591,22599,22607,22624,22631,22638,22655,22671],{"type":21,"tag":2314,"props":22333,"children":22334},{"class":2316,"line":2317},[22335,22339,22344,22348],{"type":21,"tag":2314,"props":22336,"children":22337},{"style":3157},[22338],{"type":26,"value":3160},{"type":21,"tag":2314,"props":22340,"children":22341},{"style":2321},[22342],{"type":26,"value":22343}," qiskit_nature.second_q.drivers ",{"type":21,"tag":2314,"props":22345,"children":22346},{"style":3157},[22347],{"type":26,"value":3170},{"type":21,"tag":2314,"props":22349,"children":22350},{"style":2321},[22351],{"type":26,"value":22352}," PySCFDriver\n",{"type":21,"tag":2314,"props":22354,"children":22355},{"class":2316,"line":106},[22356,22360,22365,22369],{"type":21,"tag":2314,"props":22357,"children":22358},{"style":3157},[22359],{"type":26,"value":3160},{"type":21,"tag":2314,"props":22361,"children":22362},{"style":2321},[22363],{"type":26,"value":22364}," qiskit_nature.second_q.mappers ",{"type":21,"tag":2314,"props":22366,"children":22367},{"style":3157},[22368],{"type":26,"value":3170},{"type":21,"tag":2314,"props":22370,"children":22371},{"style":2321},[22372],{"type":26,"value":22373}," JordanWignerMapper\n",{"type":21,"tag":2314,"props":22375,"children":22376},{"class":2316,"line":2335},[22377,22381,22386,22390],{"type":21,"tag":2314,"props":22378,"children":22379},{"style":3157},[22380],{"type":26,"value":3160},{"type":21,"tag":2314,"props":22382,"children":22383},{"style":2321},[22384],{"type":26,"value":22385}," qiskit_nature.second_q.circuit.library ",{"type":21,"tag":2314,"props":22387,"children":22388},{"style":3157},[22389],{"type":26,"value":3170},{"type":21,"tag":2314,"props":22391,"children":22392},{"style":2339},[22393],{"type":26,"value":22394}," UCCSD\n",{"type":21,"tag":2314,"props":22396,"children":22397},{"class":2316,"line":2397},[22398,22402,22407,22411],{"type":21,"tag":2314,"props":22399,"children":22400},{"style":3157},[22401],{"type":26,"value":3160},{"type":21,"tag":2314,"props":22403,"children":22404},{"style":2321},[22405],{"type":26,"value":22406}," qiskit_algorithms ",{"type":21,"tag":2314,"props":22408,"children":22409},{"style":3157},[22410],{"type":26,"value":3170},{"type":21,"tag":2314,"props":22412,"children":22413},{"style":2339},[22414],{"type":26,"value":22415}," VQE\n",{"type":21,"tag":2314,"props":22417,"children":22418},{"class":2316,"line":2421},[22419,22423,22428,22432],{"type":21,"tag":2314,"props":22420,"children":22421},{"style":3157},[22422],{"type":26,"value":3160},{"type":21,"tag":2314,"props":22424,"children":22425},{"style":2321},[22426],{"type":26,"value":22427}," qiskit_algorithms.optimizers ",{"type":21,"tag":2314,"props":22429,"children":22430},{"style":3157},[22431],{"type":26,"value":3170},{"type":21,"tag":2314,"props":22433,"children":22434},{"style":2339},[22435],{"type":26,"value":22436}," COBYLA\n",{"type":21,"tag":2314,"props":22438,"children":22439},{"class":2316,"line":16},[22440,22444,22449,22453],{"type":21,"tag":2314,"props":22441,"children":22442},{"style":3157},[22443],{"type":26,"value":3160},{"type":21,"tag":2314,"props":22445,"children":22446},{"style":2321},[22447],{"type":26,"value":22448}," qiskit.primitives ",{"type":21,"tag":2314,"props":22450,"children":22451},{"style":3157},[22452],{"type":26,"value":3170},{"type":21,"tag":2314,"props":22454,"children":22455},{"style":2321},[22456],{"type":26,"value":22457}," Estimator\n",{"type":21,"tag":2314,"props":22459,"children":22460},{"class":2316,"line":127},[22461],{"type":21,"tag":2314,"props":22462,"children":22463},{"emptyLinePlaceholder":3181},[22464],{"type":26,"value":3184},{"type":21,"tag":2314,"props":22466,"children":22467},{"class":2316,"line":887},[22468,22473,22477,22482,22487,22491,22496],{"type":21,"tag":2314,"props":22469,"children":22470},{"style":2321},[22471],{"type":26,"value":22472},"driver ",{"type":21,"tag":2314,"props":22474,"children":22475},{"style":3157},[22476],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22478,"children":22479},{"style":2321},[22480],{"type":26,"value":22481}," PySCFDriver(",{"type":21,"tag":2314,"props":22483,"children":22484},{"style":3222},[22485],{"type":26,"value":22486},"atom",{"type":21,"tag":2314,"props":22488,"children":22489},{"style":3157},[22490],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22492,"children":22493},{"style":2350},[22494],{"type":26,"value":22495},"'H .0 .0 .0; H .0 .0 0.735'",{"type":21,"tag":2314,"props":22497,"children":22498},{"style":2321},[22499],{"type":26,"value":3257},{"type":21,"tag":2314,"props":22501,"children":22502},{"class":2316,"line":1364},[22503,22508,22512],{"type":21,"tag":2314,"props":22504,"children":22505},{"style":2321},[22506],{"type":26,"value":22507},"problem ",{"type":21,"tag":2314,"props":22509,"children":22510},{"style":3157},[22511],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22513,"children":22514},{"style":2321},[22515],{"type":26,"value":22516}," driver.run()\n",{"type":21,"tag":2314,"props":22518,"children":22519},{"class":2316,"line":3403},[22520,22525,22529],{"type":21,"tag":2314,"props":22521,"children":22522},{"style":2321},[22523],{"type":26,"value":22524},"mapper ",{"type":21,"tag":2314,"props":22526,"children":22527},{"style":3157},[22528],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22530,"children":22531},{"style":2321},[22532],{"type":26,"value":22533}," JordanWignerMapper()\n",{"type":21,"tag":2314,"props":22535,"children":22536},{"class":2316,"line":3413},[22537,22542,22546,22551,22555],{"type":21,"tag":2314,"props":22538,"children":22539},{"style":2321},[22540],{"type":26,"value":22541},"hamiltonian ",{"type":21,"tag":2314,"props":22543,"children":22544},{"style":3157},[22545],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22547,"children":22548},{"style":2321},[22549],{"type":26,"value":22550}," mapper.map(problem.second_q_ops()[",{"type":21,"tag":2314,"props":22552,"children":22553},{"style":2339},[22554],{"type":26,"value":5122},{"type":21,"tag":2314,"props":22556,"children":22557},{"style":2321},[22558],{"type":26,"value":3518},{"type":21,"tag":2314,"props":22560,"children":22561},{"class":2316,"line":436},[22562],{"type":21,"tag":2314,"props":22563,"children":22564},{"emptyLinePlaceholder":3181},[22565],{"type":26,"value":3184},{"type":21,"tag":2314,"props":22567,"children":22568},{"class":2316,"line":3473},[22569,22574,22578],{"type":21,"tag":2314,"props":22570,"children":22571},{"style":2321},[22572],{"type":26,"value":22573},"ansatz ",{"type":21,"tag":2314,"props":22575,"children":22576},{"style":3157},[22577],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22579,"children":22580},{"style":2321},[22581],{"type":26,"value":22582}," UCCSD(\n",{"type":21,"tag":2314,"props":22584,"children":22585},{"class":2316,"line":3521},[22586],{"type":21,"tag":2314,"props":22587,"children":22588},{"style":2321},[22589],{"type":26,"value":22590},"    problem.num_spatial_orbitals,\n",{"type":21,"tag":2314,"props":22592,"children":22593},{"class":2316,"line":3563},[22594],{"type":21,"tag":2314,"props":22595,"children":22596},{"style":2321},[22597],{"type":26,"value":22598},"    problem.num_particles,\n",{"type":21,"tag":2314,"props":22600,"children":22601},{"class":2316,"line":4585},[22602],{"type":21,"tag":2314,"props":22603,"children":22604},{"style":2321},[22605],{"type":26,"value":22606},"    mapper,\n",{"type":21,"tag":2314,"props":22608,"children":22609},{"class":2316,"line":4604},[22610,22615,22619],{"type":21,"tag":2314,"props":22611,"children":22612},{"style":3222},[22613],{"type":26,"value":22614},"    initial_state",{"type":21,"tag":2314,"props":22616,"children":22617},{"style":3157},[22618],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22620,"children":22621},{"style":2321},[22622],{"type":26,"value":22623},"problem.reference_state,\n",{"type":21,"tag":2314,"props":22625,"children":22626},{"class":2316,"line":4612},[22627],{"type":21,"tag":2314,"props":22628,"children":22629},{"style":2321},[22630],{"type":26,"value":3257},{"type":21,"tag":2314,"props":22632,"children":22633},{"class":2316,"line":4643},[22634],{"type":21,"tag":2314,"props":22635,"children":22636},{"emptyLinePlaceholder":3181},[22637],{"type":26,"value":3184},{"type":21,"tag":2314,"props":22639,"children":22640},{"class":2316,"line":4688},[22641,22646,22650],{"type":21,"tag":2314,"props":22642,"children":22643},{"style":2321},[22644],{"type":26,"value":22645},"vqe ",{"type":21,"tag":2314,"props":22647,"children":22648},{"style":3157},[22649],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22651,"children":22652},{"style":2321},[22653],{"type":26,"value":22654}," VQE(Estimator(), ansatz, COBYLA())\n",{"type":21,"tag":2314,"props":22656,"children":22657},{"class":2316,"line":4727},[22658,22662,22666],{"type":21,"tag":2314,"props":22659,"children":22660},{"style":2321},[22661],{"type":26,"value":19287},{"type":21,"tag":2314,"props":22663,"children":22664},{"style":3157},[22665],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22667,"children":22668},{"style":2321},[22669],{"type":26,"value":22670}," vqe.compute_minimum_eigenvalue(hamiltonian)\n",{"type":21,"tag":2314,"props":22672,"children":22673},{"class":2316,"line":4745},[22674,22678,22682,22686,22691,22695,22700,22704,22708,22712],{"type":21,"tag":2314,"props":22675,"children":22676},{"style":2339},[22677],{"type":26,"value":3272},{"type":21,"tag":2314,"props":22679,"children":22680},{"style":2321},[22681],{"type":26,"value":3277},{"type":21,"tag":2314,"props":22683,"children":22684},{"style":3157},[22685],{"type":26,"value":3282},{"type":21,"tag":2314,"props":22687,"children":22688},{"style":2350},[22689],{"type":26,"value":22690},"\"H2 ground state: ",{"type":21,"tag":2314,"props":22692,"children":22693},{"style":2339},[22694],{"type":26,"value":3292},{"type":21,"tag":2314,"props":22696,"children":22697},{"style":2321},[22698],{"type":26,"value":22699},"result.eigenvalue.real",{"type":21,"tag":2314,"props":22701,"children":22702},{"style":3157},[22703],{"type":26,"value":3604},{"type":21,"tag":2314,"props":22705,"children":22706},{"style":2339},[22707],{"type":26,"value":3302},{"type":21,"tag":2314,"props":22709,"children":22710},{"style":2350},[22711],{"type":26,"value":19391},{"type":21,"tag":2314,"props":22713,"children":22714},{"style":2321},[22715],{"type":26,"value":3257},{"type":21,"tag":22,"props":22717,"children":22718},{},[22719],{"type":21,"tag":136,"props":22720,"children":22721},{},[22722],{"type":26,"value":22723},"HLQuantum VQE：",{"type":21,"tag":2304,"props":22725,"children":22727},{"code":22726,"language":3147,"meta":7,"className":3145,"style":7},"import hlquantum as hlq\n\nresult = hlq.algorithms.vqe(\n    molecule='H2',\n    basis='sto-3g',\n    backend='qiskit',\n    optimizer='COBYLA',\n)\nprint(f\"H2 ground state: {result.energy:.4f} Ha\")\n\n# Switch to GPU:\nresult_gpu = hlq.algorithms.vqe(molecule='H2', backend='cudaq')\n",[22728],{"type":21,"tag":2073,"props":22729,"children":22730},{"__ignoreMap":7},[22731,22750,22757,22773,22793,22813,22833,22854,22861,22904,22911,22919],{"type":21,"tag":2314,"props":22732,"children":22733},{"class":2316,"line":2317},[22734,22738,22742,22746],{"type":21,"tag":2314,"props":22735,"children":22736},{"style":3157},[22737],{"type":26,"value":3170},{"type":21,"tag":2314,"props":22739,"children":22740},{"style":2321},[22741],{"type":26,"value":19255},{"type":21,"tag":2314,"props":22743,"children":22744},{"style":3157},[22745],{"type":26,"value":4232},{"type":21,"tag":2314,"props":22747,"children":22748},{"style":2321},[22749],{"type":26,"value":19264},{"type":21,"tag":2314,"props":22751,"children":22752},{"class":2316,"line":106},[22753],{"type":21,"tag":2314,"props":22754,"children":22755},{"emptyLinePlaceholder":3181},[22756],{"type":26,"value":3184},{"type":21,"tag":2314,"props":22758,"children":22759},{"class":2316,"line":2335},[22760,22764,22768],{"type":21,"tag":2314,"props":22761,"children":22762},{"style":2321},[22763],{"type":26,"value":19287},{"type":21,"tag":2314,"props":22765,"children":22766},{"style":3157},[22767],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22769,"children":22770},{"style":2321},[22771],{"type":26,"value":22772}," hlq.algorithms.vqe(\n",{"type":21,"tag":2314,"props":22774,"children":22775},{"class":2316,"line":2397},[22776,22781,22785,22789],{"type":21,"tag":2314,"props":22777,"children":22778},{"style":3222},[22779],{"type":26,"value":22780},"    molecule",{"type":21,"tag":2314,"props":22782,"children":22783},{"style":3157},[22784],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22786,"children":22787},{"style":2350},[22788],{"type":26,"value":19310},{"type":21,"tag":2314,"props":22790,"children":22791},{"style":2321},[22792],{"type":26,"value":2418},{"type":21,"tag":2314,"props":22794,"children":22795},{"class":2316,"line":2421},[22796,22801,22805,22809],{"type":21,"tag":2314,"props":22797,"children":22798},{"style":3222},[22799],{"type":26,"value":22800},"    basis",{"type":21,"tag":2314,"props":22802,"children":22803},{"style":3157},[22804],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22806,"children":22807},{"style":2350},[22808],{"type":26,"value":19328},{"type":21,"tag":2314,"props":22810,"children":22811},{"style":2321},[22812],{"type":26,"value":2418},{"type":21,"tag":2314,"props":22814,"children":22815},{"class":2316,"line":16},[22816,22821,22825,22829],{"type":21,"tag":2314,"props":22817,"children":22818},{"style":3222},[22819],{"type":26,"value":22820},"    backend",{"type":21,"tag":2314,"props":22822,"children":22823},{"style":3157},[22824],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22826,"children":22827},{"style":2350},[22828],{"type":26,"value":19345},{"type":21,"tag":2314,"props":22830,"children":22831},{"style":2321},[22832],{"type":26,"value":2418},{"type":21,"tag":2314,"props":22834,"children":22835},{"class":2316,"line":127},[22836,22841,22845,22850],{"type":21,"tag":2314,"props":22837,"children":22838},{"style":3222},[22839],{"type":26,"value":22840},"    optimizer",{"type":21,"tag":2314,"props":22842,"children":22843},{"style":3157},[22844],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22846,"children":22847},{"style":2350},[22848],{"type":26,"value":22849},"'COBYLA'",{"type":21,"tag":2314,"props":22851,"children":22852},{"style":2321},[22853],{"type":26,"value":2418},{"type":21,"tag":2314,"props":22855,"children":22856},{"class":2316,"line":887},[22857],{"type":21,"tag":2314,"props":22858,"children":22859},{"style":2321},[22860],{"type":26,"value":3257},{"type":21,"tag":2314,"props":22862,"children":22863},{"class":2316,"line":1364},[22864,22868,22872,22876,22880,22884,22888,22892,22896,22900],{"type":21,"tag":2314,"props":22865,"children":22866},{"style":2339},[22867],{"type":26,"value":3272},{"type":21,"tag":2314,"props":22869,"children":22870},{"style":2321},[22871],{"type":26,"value":3277},{"type":21,"tag":2314,"props":22873,"children":22874},{"style":3157},[22875],{"type":26,"value":3282},{"type":21,"tag":2314,"props":22877,"children":22878},{"style":2350},[22879],{"type":26,"value":22690},{"type":21,"tag":2314,"props":22881,"children":22882},{"style":2339},[22883],{"type":26,"value":3292},{"type":21,"tag":2314,"props":22885,"children":22886},{"style":2321},[22887],{"type":26,"value":19378},{"type":21,"tag":2314,"props":22889,"children":22890},{"style":3157},[22891],{"type":26,"value":3604},{"type":21,"tag":2314,"props":22893,"children":22894},{"style":2339},[22895],{"type":26,"value":3302},{"type":21,"tag":2314,"props":22897,"children":22898},{"style":2350},[22899],{"type":26,"value":19391},{"type":21,"tag":2314,"props":22901,"children":22902},{"style":2321},[22903],{"type":26,"value":3257},{"type":21,"tag":2314,"props":22905,"children":22906},{"class":2316,"line":3403},[22907],{"type":21,"tag":2314,"props":22908,"children":22909},{"emptyLinePlaceholder":3181},[22910],{"type":26,"value":3184},{"type":21,"tag":2314,"props":22912,"children":22913},{"class":2316,"line":3413},[22914],{"type":21,"tag":2314,"props":22915,"children":22916},{"style":3407},[22917],{"type":26,"value":22918},"# Switch to GPU:\n",{"type":21,"tag":2314,"props":22920,"children":22921},{"class":2316,"line":436},[22922,22927,22931,22935,22939,22943,22947,22951,22955,22959,22963],{"type":21,"tag":2314,"props":22923,"children":22924},{"style":2321},[22925],{"type":26,"value":22926},"result_gpu ",{"type":21,"tag":2314,"props":22928,"children":22929},{"style":3157},[22930],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22932,"children":22933},{"style":2321},[22934],{"type":26,"value":19296},{"type":21,"tag":2314,"props":22936,"children":22937},{"style":3222},[22938],{"type":26,"value":19301},{"type":21,"tag":2314,"props":22940,"children":22941},{"style":3157},[22942],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22944,"children":22945},{"style":2350},[22946],{"type":26,"value":19310},{"type":21,"tag":2314,"props":22948,"children":22949},{"style":2321},[22950],{"type":26,"value":1309},{"type":21,"tag":2314,"props":22952,"children":22953},{"style":3222},[22954],{"type":26,"value":18425},{"type":21,"tag":2314,"props":22956,"children":22957},{"style":3157},[22958],{"type":26,"value":3197},{"type":21,"tag":2314,"props":22960,"children":22961},{"style":2350},[22962],{"type":26,"value":22163},{"type":21,"tag":2314,"props":22964,"children":22965},{"style":2321},[22966],{"type":26,"value":3257},{"type":21,"tag":22,"props":22968,"children":22969},{},[22970],{"type":26,"value":22971},"原生 Qiskit 让你对 ansatz、mapper 和 driver 拥有完全的控制。HLQuantum 的一行代码最适合用来比较后端或快速获得结果；当你需要自定义 ansatz 或算法调优时，原生 Qiskit 更胜一筹。",{"type":21,"tag":29,"props":22973,"children":22975},{"id":22974},"何时使用原生-qiskit",[22976],{"type":26,"value":22977},"何时使用原生 Qiskit",{"type":21,"tag":22,"props":22979,"children":22980},{},[22981],{"type":26,"value":22982},"在以下情况下直接使用 Qiskit：",{"type":21,"tag":6961,"props":22984,"children":22985},{},[22986,22996,23006,23045,23055],{"type":21,"tag":3084,"props":22987,"children":22988},{},[22989,22994],{"type":21,"tag":136,"props":22990,"children":22991},{},[22992],{"type":26,"value":22993},"你仅面向 IBM 硬件",{"type":26,"value":22995}," — Qiskit 的转译器和 IBM Runtime 原语在 IBM QPU 上能给你最佳性能。HLQuantum 的抽象会增加额外开销。",{"type":21,"tag":3084,"props":22997,"children":22998},{},[22999,23004],{"type":21,"tag":136,"props":23000,"children":23001},{},[23002],{"type":26,"value":23003},"你需要细粒度的电路控制",{"type":26,"value":23005}," — 自定义门分解、特定的转译器 pass、脉冲级控制、带中间电路测量的动态电路。",{"type":21,"tag":3084,"props":23007,"children":23008},{},[23009,23014,23016,23022,23023,23029,23030,23036,23037,23043],{"type":21,"tag":136,"props":23010,"children":23011},{},[23012],{"type":26,"value":23013},"你在做 IBM 生态系统的研究",{"type":26,"value":23015}," — 使用 ",{"type":21,"tag":2073,"props":23017,"children":23019},{"className":23018},[],[23020],{"type":26,"value":23021},"qiskit-nature",{"type":26,"value":18095},{"type":21,"tag":2073,"props":23024,"children":23026},{"className":23025},[],[23027],{"type":26,"value":23028},"qiskit-finance",{"type":26,"value":18095},{"type":21,"tag":2073,"props":23031,"children":23033},{"className":23032},[],[23034],{"type":26,"value":23035},"qiskit-optimization",{"type":26,"value":20470},{"type":21,"tag":2073,"props":23038,"children":23040},{"className":23039},[],[23041],{"type":26,"value":23042},"qiskit-machine-learning",{"type":26,"value":23044},"——这些与原生 Qiskit 的集成最为深入。",{"type":21,"tag":3084,"props":23046,"children":23047},{},[23048,23053],{"type":21,"tag":136,"props":23049,"children":23050},{},[23051],{"type":26,"value":23052},"性能至关重要",{"type":26,"value":23054}," — 直接的 Qiskit 代码比 HLQuantum 中的翻译层开销更小。",{"type":21,"tag":3084,"props":23056,"children":23057},{},[23058,23063],{"type":21,"tag":136,"props":23059,"children":23060},{},[23061],{"type":26,"value":23062},"你在为 Qiskit 生态系统做贡献",{"type":26,"value":23064}," — 编写 Qiskit 插件、教程或以 Qiskit 作为参考实现的研究论文。",{"type":21,"tag":29,"props":23066,"children":23068},{"id":23067},"何时使用-hlquantum",[23069],{"type":26,"value":23070},"何时使用 HLQuantum",{"type":21,"tag":22,"props":23072,"children":23073},{},[23074],{"type":26,"value":23075},"在以下情况下使用 HLQuantum：",{"type":21,"tag":6961,"props":23077,"children":23078},{},[23079,23089,23099,23109,23141],{"type":21,"tag":3084,"props":23080,"children":23081},{},[23082,23087],{"type":21,"tag":136,"props":23083,"children":23084},{},[23085],{"type":26,"value":23086},"你需要后端灵活性",{"type":26,"value":23088}," — 比较模拟器性能、在不同架构上对电路进行基准测试，或访问多个云端 QPU。",{"type":21,"tag":3084,"props":23090,"children":23091},{},[23092,23097],{"type":21,"tag":136,"props":23093,"children":23094},{},[23095],{"type":26,"value":23096},"你在为算法做原型",{"type":26,"value":23098}," — 编写一次，随处测试。从本地模拟切换到 GPU 再到真实硬件时，无需重新布线电路。",{"type":21,"tag":3084,"props":23100,"children":23101},{},[23102,23107],{"type":21,"tag":136,"props":23103,"children":23104},{},[23105],{"type":26,"value":23106},"你在教学或学习",{"type":26,"value":23108}," — 跨所有后端的统一 API 让学习更容易。无需学习 6 种不同的 API。",{"type":21,"tag":3084,"props":23110,"children":23111},{},[23112,23117,23119,23125,23126,23132,23133,23139],{"type":21,"tag":136,"props":23113,"children":23114},{},[23115],{"type":26,"value":23116},"你想要内置算法",{"type":26,"value":23118}," — ",{"type":21,"tag":2073,"props":23120,"children":23122},{"className":23121},[],[23123],{"type":26,"value":23124},"hlq.algorithms.vqe()",{"type":26,"value":18095},{"type":21,"tag":2073,"props":23127,"children":23129},{"className":23128},[],[23130],{"type":26,"value":23131},"hlq.algorithms.qaoa()",{"type":26,"value":18095},{"type":21,"tag":2073,"props":23134,"children":23136},{"className":23135},[],[23137],{"type":26,"value":23138},"hlq.algorithms.grover()",{"type":26,"value":23140}," 会处理样板代码。",{"type":21,"tag":3084,"props":23142,"children":23143},{},[23144,23149],{"type":21,"tag":136,"props":23145,"children":23146},{},[23147],{"type":26,"value":23148},"你在构建多后端应用",{"type":26,"value":23150}," — 如果你的应用需要在队列最短或成本最低的任意 QPU 上运行，HLQuantum 的分派器可以处理这一点。",{"type":21,"tag":29,"props":23152,"children":23154},{"id":23153},"迁移qiskit-hlquantum",[23155],{"type":26,"value":23156},"迁移：Qiskit → HLQuantum",{"type":21,"tag":22,"props":23158,"children":23159},{},[23160],{"type":26,"value":23161},"如果你已有现成的 Qiskit 代码，HLQuantum 可以直接使用 Qiskit 电路：",{"type":21,"tag":2304,"props":23163,"children":23165},{"code":23164,"language":3147,"meta":7,"className":3145,"style":7},"import hlquantum as hlq\nfrom qiskit import QuantumCircuit\n\n# Existing Qiskit circuit\nqc = QuantumCircuit(3)\nqc.h(0); qc.cx(0, 1); qc.cx(1, 2)\n\n# Wrap and run on any backend\nresult = hlq.run(hlq.from_qiskit(qc), backend='pennylane')\nresult_gpu = hlq.run(hlq.from_qiskit(qc), backend='cudaq')\n",[23166],{"type":21,"tag":2073,"props":23167,"children":23168},{"__ignoreMap":7},[23169,23188,23207,23214,23222,23245,23293,23300,23308,23340],{"type":21,"tag":2314,"props":23170,"children":23171},{"class":2316,"line":2317},[23172,23176,23180,23184],{"type":21,"tag":2314,"props":23173,"children":23174},{"style":3157},[23175],{"type":26,"value":3170},{"type":21,"tag":2314,"props":23177,"children":23178},{"style":2321},[23179],{"type":26,"value":19255},{"type":21,"tag":2314,"props":23181,"children":23182},{"style":3157},[23183],{"type":26,"value":4232},{"type":21,"tag":2314,"props":23185,"children":23186},{"style":2321},[23187],{"type":26,"value":19264},{"type":21,"tag":2314,"props":23189,"children":23190},{"class":2316,"line":106},[23191,23195,23199,23203],{"type":21,"tag":2314,"props":23192,"children":23193},{"style":3157},[23194],{"type":26,"value":3160},{"type":21,"tag":2314,"props":23196,"children":23197},{"style":2321},[23198],{"type":26,"value":4249},{"type":21,"tag":2314,"props":23200,"children":23201},{"style":3157},[23202],{"type":26,"value":3170},{"type":21,"tag":2314,"props":23204,"children":23205},{"style":2321},[23206],{"type":26,"value":20261},{"type":21,"tag":2314,"props":23208,"children":23209},{"class":2316,"line":2335},[23210],{"type":21,"tag":2314,"props":23211,"children":23212},{"emptyLinePlaceholder":3181},[23213],{"type":26,"value":3184},{"type":21,"tag":2314,"props":23215,"children":23216},{"class":2316,"line":2397},[23217],{"type":21,"tag":2314,"props":23218,"children":23219},{"style":3407},[23220],{"type":26,"value":23221},"# Existing Qiskit circuit\n",{"type":21,"tag":2314,"props":23223,"children":23224},{"class":2316,"line":2421},[23225,23229,23233,23237,23241],{"type":21,"tag":2314,"props":23226,"children":23227},{"style":2321},[23228],{"type":26,"value":7336},{"type":21,"tag":2314,"props":23230,"children":23231},{"style":3157},[23232],{"type":26,"value":3197},{"type":21,"tag":2314,"props":23234,"children":23235},{"style":2321},[23236],{"type":26,"value":5092},{"type":21,"tag":2314,"props":23238,"children":23239},{"style":2339},[23240],{"type":26,"value":6465},{"type":21,"tag":2314,"props":23242,"children":23243},{"style":2321},[23244],{"type":26,"value":3257},{"type":21,"tag":2314,"props":23246,"children":23247},{"class":2316,"line":16},[23248,23252,23256,23261,23265,23269,23273,23277,23281,23285,23289],{"type":21,"tag":2314,"props":23249,"children":23250},{"style":2321},[23251],{"type":26,"value":7352},{"type":21,"tag":2314,"props":23253,"children":23254},{"style":2339},[23255],{"type":26,"value":5122},{"type":21,"tag":2314,"props":23257,"children":23258},{"style":2321},[23259],{"type":26,"value":23260},"); qc.cx(",{"type":21,"tag":2314,"props":23262,"children":23263},{"style":2339},[23264],{"type":26,"value":5122},{"type":21,"tag":2314,"props":23266,"children":23267},{"style":2321},[23268],{"type":26,"value":1309},{"type":21,"tag":2314,"props":23270,"children":23271},{"style":2339},[23272],{"type":26,"value":3513},{"type":21,"tag":2314,"props":23274,"children":23275},{"style":2321},[23276],{"type":26,"value":23260},{"type":21,"tag":2314,"props":23278,"children":23279},{"style":2339},[23280],{"type":26,"value":3513},{"type":21,"tag":2314,"props":23282,"children":23283},{"style":2321},[23284],{"type":26,"value":1309},{"type":21,"tag":2314,"props":23286,"children":23287},{"style":2339},[23288],{"type":26,"value":2413},{"type":21,"tag":2314,"props":23290,"children":23291},{"style":2321},[23292],{"type":26,"value":3257},{"type":21,"tag":2314,"props":23294,"children":23295},{"class":2316,"line":127},[23296],{"type":21,"tag":2314,"props":23297,"children":23298},{"emptyLinePlaceholder":3181},[23299],{"type":26,"value":3184},{"type":21,"tag":2314,"props":23301,"children":23302},{"class":2316,"line":887},[23303],{"type":21,"tag":2314,"props":23304,"children":23305},{"style":3407},[23306],{"type":26,"value":23307},"# Wrap and run on any backend\n",{"type":21,"tag":2314,"props":23309,"children":23310},{"class":2316,"line":1364},[23311,23315,23319,23324,23328,23332,23336],{"type":21,"tag":2314,"props":23312,"children":23313},{"style":2321},[23314],{"type":26,"value":19287},{"type":21,"tag":2314,"props":23316,"children":23317},{"style":3157},[23318],{"type":26,"value":3197},{"type":21,"tag":2314,"props":23320,"children":23321},{"style":2321},[23322],{"type":26,"value":23323}," hlq.run(hlq.from_qiskit(qc), ",{"type":21,"tag":2314,"props":23325,"children":23326},{"style":3222},[23327],{"type":26,"value":18425},{"type":21,"tag":2314,"props":23329,"children":23330},{"style":3157},[23331],{"type":26,"value":3197},{"type":21,"tag":2314,"props":23333,"children":23334},{"style":2350},[23335],{"type":26,"value":22130},{"type":21,"tag":2314,"props":23337,"children":23338},{"style":2321},[23339],{"type":26,"value":3257},{"type":21,"tag":2314,"props":23341,"children":23342},{"class":2316,"line":3403},[23343,23347,23351,23355,23359,23363,23367],{"type":21,"tag":2314,"props":23344,"children":23345},{"style":2321},[23346],{"type":26,"value":22926},{"type":21,"tag":2314,"props":23348,"children":23349},{"style":3157},[23350],{"type":26,"value":3197},{"type":21,"tag":2314,"props":23352,"children":23353},{"style":2321},[23354],{"type":26,"value":23323},{"type":21,"tag":2314,"props":23356,"children":23357},{"style":3222},[23358],{"type":26,"value":18425},{"type":21,"tag":2314,"props":23360,"children":23361},{"style":3157},[23362],{"type":26,"value":3197},{"type":21,"tag":2314,"props":23364,"children":23365},{"style":2350},[23366],{"type":26,"value":22163},{"type":21,"tag":2314,"props":23368,"children":23369},{"style":2321},[23370],{"type":26,"value":3257},{"type":21,"tag":22,"props":23372,"children":23373},{},[23374],{"type":26,"value":23375},"无需重写——你可以增量式地为现有的 Qiskit 代码添加 HLQuantum 的多后端能力。",{"type":21,"tag":29,"props":23377,"children":23379},{"id":23378},"决策清单",[23380],{"type":26,"value":23378},{"type":21,"tag":2304,"props":23382,"children":23384},{"code":23383},"Starting a new project?\n├── Need IBM-specific features (Qiskit Runtime, pulse control)?  → Raw Qiskit\n├── Need to run on multiple backends or compare performance?     → HLQuantum\n├── Learning quantum computing for the first time?               → HLQuantum\n└── Building a research paper targeting IBM hardware?            → Raw Qiskit\n\nMigrating existing Qiskit code?\n├── Want to add GPU acceleration?     → HLQuantum (from_qiskit + cudaq)\n├── Want to try IonQ hardware?        → HLQuantum (from_qiskit + ionq)\n└── Want to stay IBM-only?            → Stay with Qiskit\n",[23385],{"type":21,"tag":2073,"props":23386,"children":23387},{"__ignoreMap":7},[23388],{"type":26,"value":23383},{"type":21,"tag":22,"props":23390,"children":23391},{},[23392],{"type":26,"value":23393},"两者并非互斥。许多工作流以原生 Qiskit 进行电路设计，然后用 HLQuantum 封装以实现多后端部署。",{"type":21,"tag":22,"props":23395,"children":23396},{},[23397,23402,23403,23408,23409,23414,23415],{"type":21,"tag":136,"props":23398,"children":23399},{},[23400],{"type":26,"value":23401},"开始使用：",{"type":26,"value":1301},{"type":21,"tag":46,"props":23404,"children":23405},{"href":18964},[23406],{"type":26,"value":23407},"HLQuantum 指南",{"type":26,"value":7066},{"type":21,"tag":46,"props":23410,"children":23411},{"href":7045},[23412],{"type":26,"value":23413},"Qiskit SDK 指南",{"type":26,"value":7066},{"type":21,"tag":46,"props":23416,"children":23417},{"href":212},[23418],{"type":26,"value":23419},"比较所有 SDK",{"type":21,"tag":2688,"props":23421,"children":23422},{},[23423],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":23425},[23426,23427,23428,23429,23430,23431,23432,23433],{"id":20990,"depth":106,"text":20990},{"id":21013,"depth":106,"text":21016},{"id":21433,"depth":106,"text":21436},{"id":22313,"depth":106,"text":22316},{"id":22974,"depth":106,"text":22977},{"id":23067,"depth":106,"text":23070},{"id":23153,"depth":106,"text":23156},{"id":23378,"depth":106,"text":23378},"content:zh:blog:hlquantum-vs-qiskit.md","zh\u002Fblog\u002Fhlquantum-vs-qiskit.md","zh\u002Fblog\u002Fhlquantum-vs-qiskit",{"_path":23438,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":23439,"description":23440,"date":23441,"author":11,"tags":23442,"readingTime":3403,"body":23443,"_type":111,"_id":24480,"_source":113,"_file":24481,"_stem":24482,"_extension":116},"\u002Fzh\u002Fblog\u002Fpost-quantum-cryptography-guide","后量子密码学：开发者现在需要做什么","Shor 算法威胁着 RSA 和 ECC。NIST 已经确定了其后量子标准。以下是威胁所在、标准的内容，以及开发者今天应该采取的行动。","2026-03-05",[9302,9303,9301],{"type":18,"children":23444,"toc":24464},[23445,23457,23462,23468,23481,23489,23512,23520,23543,23554,23560,23565,23583,23595,23603,23631,23639,23657,23663,23668,23674,23717,23878,23884,23923,24046,24052,24091,24103,24109,24115,24125,24148,24158,24168,24174,24192,24217,24227,24237,24243,24253,24263,24273,24278,24422,24427,24435,24440,24460],{"type":21,"tag":22,"props":23446,"children":23447},{},[23448,23450,23455],{"type":26,"value":23449},"量子计算机目前还不会威胁到你的加密。一台能够破解 RSA-2048 的量子计算机需要数百万个纠错逻辑量子比特——而我们现在只有数百个带噪声的物理量子比特。但问题在于：对手可能",{"type":21,"tag":136,"props":23451,"children":23452},{},[23453],{"type":26,"value":23454},"现在",{"type":26,"value":23456},"就在收集加密数据，意图在未来量子硬件成熟后再解密它。而迁移密码学基础设施需要数年时间。",{"type":21,"tag":22,"props":23458,"children":23459},{},[23460],{"type":26,"value":23461},"这就是为什么 2024 年 NIST 的后量子密码学标准对开发者来说，在今天就很重要，而不是等到 2035 年。",{"type":21,"tag":29,"props":23463,"children":23465},{"id":23464},"真正的威胁shor-算法",[23466],{"type":26,"value":23467},"真正的威胁：Shor 算法",{"type":21,"tag":22,"props":23469,"children":23470},{},[23471,23473,23479],{"type":26,"value":23472},"1994 年，Peter Shor 证明了量子计算机能够以多项式时间 ",{"type":21,"tag":2073,"props":23474,"children":23476},{"className":23475},[],[23477],{"type":26,"value":23478},"O((log N)³)",{"type":26,"value":23480}," 分解大整数。这破解了 RSA，因为 RSA 的安全性依赖于分解质因数的困难性。同样的算法——只需稍作修改——就能破解椭圆曲线密码学（ECC），而 ECC 是 ECDSA 和 ECDH 的基础。",{"type":21,"tag":22,"props":23482,"children":23483},{},[23484],{"type":21,"tag":136,"props":23485,"children":23486},{},[23487],{"type":26,"value":23488},"会被破解的：",{"type":21,"tag":3080,"props":23490,"children":23491},{},[23492,23497,23502,23507],{"type":21,"tag":3084,"props":23493,"children":23494},{},[23495],{"type":26,"value":23496},"RSA（加密、签名）",{"type":21,"tag":3084,"props":23498,"children":23499},{},[23500],{"type":26,"value":23501},"ECDSA（签名——用于 TLS、SSH、代码签名、比特币）",{"type":21,"tag":3084,"props":23503,"children":23504},{},[23505],{"type":26,"value":23506},"ECDH（密钥交换——用于 TLS、Signal、WhatsApp、iMessage）",{"type":21,"tag":3084,"props":23508,"children":23509},{},[23510],{"type":26,"value":23511},"Diffie-Hellman（密钥交换）",{"type":21,"tag":22,"props":23513,"children":23514},{},[23515],{"type":21,"tag":136,"props":23516,"children":23517},{},[23518],{"type":26,"value":23519},"不会被破解的：",{"type":21,"tag":3080,"props":23521,"children":23522},{},[23523,23528,23533,23538],{"type":21,"tag":3084,"props":23524,"children":23525},{},[23526],{"type":26,"value":23527},"AES-256（对称加密）——Grover 算法只提供二次方加速，将有效密钥强度从 256 位降低到 128 位。这是可以承受的。",{"type":21,"tag":3084,"props":23529,"children":23530},{},[23531],{"type":26,"value":23532},"SHA-256、SHA-3（哈希函数）——同样：Grover 提供的加速有限，安全性减半，在当前密钥长度下仍然足够强。",{"type":21,"tag":3084,"props":23534,"children":23535},{},[23536],{"type":26,"value":23537},"HMAC——安全",{"type":21,"tag":3084,"props":23539,"children":23540},{},[23541],{"type":26,"value":23542},"Argon2、bcrypt（密码哈希）——安全",{"type":21,"tag":22,"props":23544,"children":23545},{},[23546,23548,23553],{"type":26,"value":23547},"底线是：",{"type":21,"tag":136,"props":23549,"children":23550},{},[23551],{"type":26,"value":23552},"非对称密码学需要替换；对称密码学需要提升密钥长度（AES-128 → AES-256）",{"type":26,"value":18641},{"type":21,"tag":29,"props":23555,"children":23557},{"id":23556},"现在收集以后解密",[23558],{"type":26,"value":23559},"现在收集，以后解密",{"type":21,"tag":22,"props":23561,"children":23562},{},[23563],{"type":26,"value":23564},"威胁并不是\"量子计算机明年就会破解加密\"。威胁在于：",{"type":21,"tag":6961,"props":23566,"children":23567},{},[23568,23573,23578],{"type":21,"tag":3084,"props":23569,"children":23570},{},[23571],{"type":26,"value":23572},"对手在今天捕获并存储你加密的 TLS 流量",{"type":21,"tag":3084,"props":23574,"children":23575},{},[23576],{"type":26,"value":23577},"在 2032–2040 年，他们对这些流量运行 Shor 算法",{"type":21,"tag":3084,"props":23579,"children":23580},{},[23581],{"type":26,"value":23582},"他们追溯性地解密一切",{"type":21,"tag":22,"props":23584,"children":23585},{},[23586,23588,23593],{"type":26,"value":23587},"这种攻击——称为**\"现在收集，以后解密\"（harvest now, decrypt later）**或 ",{"type":21,"tag":136,"props":23589,"children":23590},{},[23591],{"type":26,"value":23592},"HNDL",{"type":26,"value":23594},"——已经在发生。NSA 和其他情报机构几乎可以肯定正在存储大量加密流量。2022 年 NSA 的公告明确警告了这一点。",{"type":21,"tag":22,"props":23596,"children":23597},{},[23598],{"type":21,"tag":136,"props":23599,"children":23600},{},[23601],{"type":26,"value":23602},"今天就需要针对 HNDL 加以保护的数据：",{"type":21,"tag":3080,"props":23604,"children":23605},{},[23606,23611,23616,23621,23626],{"type":21,"tag":3084,"props":23607,"children":23608},{},[23609],{"type":26,"value":23610},"国家机密、机密政府数据",{"type":21,"tag":3084,"props":23612,"children":23613},{},[23614],{"type":26,"value":23615},"长期有效的个人数据（医疗记录、身份证件）",{"type":21,"tag":3084,"props":23617,"children":23618},{},[23619],{"type":26,"value":23620},"有长期监管保留要求的金融数据",{"type":21,"tag":3084,"props":23622,"children":23623},{},[23624],{"type":26,"value":23625},"商业秘密和知识产权",{"type":21,"tag":3084,"props":23627,"children":23628},{},[23629],{"type":26,"value":23630},"密码数据库（尽管 bcrypt\u002FArgon2 是安全的）",{"type":21,"tag":22,"props":23632,"children":23633},{},[23634],{"type":21,"tag":136,"props":23635,"children":23636},{},[23637],{"type":26,"value":23638},"不需要立即担心的数据：",{"type":21,"tag":3080,"props":23640,"children":23641},{},[23642,23647,23652],{"type":21,"tag":3084,"props":23643,"children":23644},{},[23645],{"type":26,"value":23646},"会话令牌（短期有效，10 年后毫无价值）",{"type":21,"tag":3084,"props":23648,"children":23649},{},[23650],{"type":26,"value":23651},"临时聊天消息（除非你是高价值目标）",{"type":21,"tag":3084,"props":23653,"children":23654},{},[23655],{"type":26,"value":23656},"公开信息",{"type":21,"tag":29,"props":23658,"children":23660},{"id":23659},"nist-的后量子标准2024",[23661],{"type":26,"value":23662},"NIST 的后量子标准（2024）",{"type":21,"tag":22,"props":23664,"children":23665},{},[23666],{"type":26,"value":23667},"经过 8 年的竞赛，NIST 于 2024 年 8 月确定了三种后量子密码学算法：",{"type":21,"tag":17316,"props":23669,"children":23671},{"id":23670},"ml-kemcrystals-kyber密钥封装",[23672],{"type":26,"value":23673},"ML-KEM（CRYSTALS-Kyber）——密钥封装",{"type":21,"tag":3080,"props":23675,"children":23676},{},[23677,23687,23697,23707],{"type":21,"tag":3084,"props":23678,"children":23679},{},[23680,23685],{"type":21,"tag":136,"props":23681,"children":23682},{},[23683],{"type":26,"value":23684},"替代：",{"type":26,"value":23686}," RSA 密钥交换、ECDH",{"type":21,"tag":3084,"props":23688,"children":23689},{},[23690,23695],{"type":21,"tag":136,"props":23691,"children":23692},{},[23693],{"type":26,"value":23694},"安全基础：",{"type":26,"value":23696}," 模容错学习（MLWE）问题——被认为对经典计算机和量子计算机都很难",{"type":21,"tag":3084,"props":23698,"children":23699},{},[23700,23705],{"type":21,"tag":136,"props":23701,"children":23702},{},[23703],{"type":26,"value":23704},"性能：",{"type":26,"value":23706}," 快速，密钥小（KEM-768 约 800 字节），运算迅速",{"type":21,"tag":3084,"props":23708,"children":23709},{},[23710,23715],{"type":21,"tag":136,"props":23711,"children":23712},{},[23713],{"type":26,"value":23714},"用于：",{"type":26,"value":23716}," TLS 密钥交换、加密密钥封装、混合加密方案",{"type":21,"tag":2304,"props":23718,"children":23720},{"code":23719,"language":3147,"meta":7,"className":3145,"style":7},"# Python example using pqcrypto library\nfrom pqcrypto.kem.kyber768 import generate_keypair, encapsulate, decapsulate\n\npublic_key, secret_key = generate_keypair()\n\n# Sender encapsulates a shared secret\nciphertext, shared_secret_sender = encapsulate(public_key)\n\n# Receiver decapsulates\nshared_secret_receiver = decapsulate(secret_key, ciphertext)\n\nassert shared_secret_sender == shared_secret_receiver\n# Now use shared_secret as AES key\n",[23721],{"type":21,"tag":2073,"props":23722,"children":23723},{"__ignoreMap":7},[23724,23732,23753,23760,23777,23784,23792,23809,23816,23824,23841,23848,23870],{"type":21,"tag":2314,"props":23725,"children":23726},{"class":2316,"line":2317},[23727],{"type":21,"tag":2314,"props":23728,"children":23729},{"style":3407},[23730],{"type":26,"value":23731},"# Python example using pqcrypto library\n",{"type":21,"tag":2314,"props":23733,"children":23734},{"class":2316,"line":106},[23735,23739,23744,23748],{"type":21,"tag":2314,"props":23736,"children":23737},{"style":3157},[23738],{"type":26,"value":3160},{"type":21,"tag":2314,"props":23740,"children":23741},{"style":2321},[23742],{"type":26,"value":23743}," pqcrypto.kem.kyber768 ",{"type":21,"tag":2314,"props":23745,"children":23746},{"style":3157},[23747],{"type":26,"value":3170},{"type":21,"tag":2314,"props":23749,"children":23750},{"style":2321},[23751],{"type":26,"value":23752}," generate_keypair, encapsulate, decapsulate\n",{"type":21,"tag":2314,"props":23754,"children":23755},{"class":2316,"line":2335},[23756],{"type":21,"tag":2314,"props":23757,"children":23758},{"emptyLinePlaceholder":3181},[23759],{"type":26,"value":3184},{"type":21,"tag":2314,"props":23761,"children":23762},{"class":2316,"line":2397},[23763,23768,23772],{"type":21,"tag":2314,"props":23764,"children":23765},{"style":2321},[23766],{"type":26,"value":23767},"public_key, secret_key ",{"type":21,"tag":2314,"props":23769,"children":23770},{"style":3157},[23771],{"type":26,"value":3197},{"type":21,"tag":2314,"props":23773,"children":23774},{"style":2321},[23775],{"type":26,"value":23776}," generate_keypair()\n",{"type":21,"tag":2314,"props":23778,"children":23779},{"class":2316,"line":2421},[23780],{"type":21,"tag":2314,"props":23781,"children":23782},{"emptyLinePlaceholder":3181},[23783],{"type":26,"value":3184},{"type":21,"tag":2314,"props":23785,"children":23786},{"class":2316,"line":16},[23787],{"type":21,"tag":2314,"props":23788,"children":23789},{"style":3407},[23790],{"type":26,"value":23791},"# Sender encapsulates a shared secret\n",{"type":21,"tag":2314,"props":23793,"children":23794},{"class":2316,"line":127},[23795,23800,23804],{"type":21,"tag":2314,"props":23796,"children":23797},{"style":2321},[23798],{"type":26,"value":23799},"ciphertext, shared_secret_sender ",{"type":21,"tag":2314,"props":23801,"children":23802},{"style":3157},[23803],{"type":26,"value":3197},{"type":21,"tag":2314,"props":23805,"children":23806},{"style":2321},[23807],{"type":26,"value":23808}," encapsulate(public_key)\n",{"type":21,"tag":2314,"props":23810,"children":23811},{"class":2316,"line":887},[23812],{"type":21,"tag":2314,"props":23813,"children":23814},{"emptyLinePlaceholder":3181},[23815],{"type":26,"value":3184},{"type":21,"tag":2314,"props":23817,"children":23818},{"class":2316,"line":1364},[23819],{"type":21,"tag":2314,"props":23820,"children":23821},{"style":3407},[23822],{"type":26,"value":23823},"# Receiver decapsulates\n",{"type":21,"tag":2314,"props":23825,"children":23826},{"class":2316,"line":3403},[23827,23832,23836],{"type":21,"tag":2314,"props":23828,"children":23829},{"style":2321},[23830],{"type":26,"value":23831},"shared_secret_receiver ",{"type":21,"tag":2314,"props":23833,"children":23834},{"style":3157},[23835],{"type":26,"value":3197},{"type":21,"tag":2314,"props":23837,"children":23838},{"style":2321},[23839],{"type":26,"value":23840}," decapsulate(secret_key, ciphertext)\n",{"type":21,"tag":2314,"props":23842,"children":23843},{"class":2316,"line":3413},[23844],{"type":21,"tag":2314,"props":23845,"children":23846},{"emptyLinePlaceholder":3181},[23847],{"type":26,"value":3184},{"type":21,"tag":2314,"props":23849,"children":23850},{"class":2316,"line":436},[23851,23856,23861,23865],{"type":21,"tag":2314,"props":23852,"children":23853},{"style":3157},[23854],{"type":26,"value":23855},"assert",{"type":21,"tag":2314,"props":23857,"children":23858},{"style":2321},[23859],{"type":26,"value":23860}," shared_secret_sender ",{"type":21,"tag":2314,"props":23862,"children":23863},{"style":3157},[23864],{"type":26,"value":4863},{"type":21,"tag":2314,"props":23866,"children":23867},{"style":2321},[23868],{"type":26,"value":23869}," shared_secret_receiver\n",{"type":21,"tag":2314,"props":23871,"children":23872},{"class":2316,"line":3473},[23873],{"type":21,"tag":2314,"props":23874,"children":23875},{"style":3407},[23876],{"type":26,"value":23877},"# Now use shared_secret as AES key\n",{"type":21,"tag":17316,"props":23879,"children":23881},{"id":23880},"ml-dsacrystals-dilithium数字签名",[23882],{"type":26,"value":23883},"ML-DSA（CRYSTALS-Dilithium）——数字签名",{"type":21,"tag":3080,"props":23885,"children":23886},{},[23887,23896,23905,23914],{"type":21,"tag":3084,"props":23888,"children":23889},{},[23890,23894],{"type":21,"tag":136,"props":23891,"children":23892},{},[23893],{"type":26,"value":23684},{"type":26,"value":23895}," ECDSA、用于签名的 RSA-PSS",{"type":21,"tag":3084,"props":23897,"children":23898},{},[23899,23903],{"type":21,"tag":136,"props":23900,"children":23901},{},[23902],{"type":26,"value":23694},{"type":26,"value":23904}," MLWE + MSIS 问题",{"type":21,"tag":3084,"props":23906,"children":23907},{},[23908,23912],{"type":21,"tag":136,"props":23909,"children":23910},{},[23911],{"type":26,"value":23704},{"type":26,"value":23913}," 中等密钥长度（公钥约 1,312 字节），签名快速",{"type":21,"tag":3084,"props":23915,"children":23916},{},[23917,23921],{"type":21,"tag":136,"props":23918,"children":23919},{},[23920],{"type":26,"value":23714},{"type":26,"value":23922}," 代码签名、TLS 证书、文档签名、JWT 签名",{"type":21,"tag":2304,"props":23924,"children":23926},{"code":23925,"language":3147,"meta":7,"className":3145,"style":7},"from pqcrypto.sign.dilithium3 import generate_keypair, sign, verify\n\npublic_key, secret_key = generate_keypair()\n\nmessage = b\"Deploy to production\"\nsignature = sign(message, secret_key)\n\n# Verify\nassert verify(message, signature, public_key)\n",[23927],{"type":21,"tag":2073,"props":23928,"children":23929},{"__ignoreMap":7},[23930,23951,23958,23973,23980,24002,24019,24026,24034],{"type":21,"tag":2314,"props":23931,"children":23932},{"class":2316,"line":2317},[23933,23937,23942,23946],{"type":21,"tag":2314,"props":23934,"children":23935},{"style":3157},[23936],{"type":26,"value":3160},{"type":21,"tag":2314,"props":23938,"children":23939},{"style":2321},[23940],{"type":26,"value":23941}," pqcrypto.sign.dilithium3 ",{"type":21,"tag":2314,"props":23943,"children":23944},{"style":3157},[23945],{"type":26,"value":3170},{"type":21,"tag":2314,"props":23947,"children":23948},{"style":2321},[23949],{"type":26,"value":23950}," generate_keypair, sign, verify\n",{"type":21,"tag":2314,"props":23952,"children":23953},{"class":2316,"line":106},[23954],{"type":21,"tag":2314,"props":23955,"children":23956},{"emptyLinePlaceholder":3181},[23957],{"type":26,"value":3184},{"type":21,"tag":2314,"props":23959,"children":23960},{"class":2316,"line":2335},[23961,23965,23969],{"type":21,"tag":2314,"props":23962,"children":23963},{"style":2321},[23964],{"type":26,"value":23767},{"type":21,"tag":2314,"props":23966,"children":23967},{"style":3157},[23968],{"type":26,"value":3197},{"type":21,"tag":2314,"props":23970,"children":23971},{"style":2321},[23972],{"type":26,"value":23776},{"type":21,"tag":2314,"props":23974,"children":23975},{"class":2316,"line":2397},[23976],{"type":21,"tag":2314,"props":23977,"children":23978},{"emptyLinePlaceholder":3181},[23979],{"type":26,"value":3184},{"type":21,"tag":2314,"props":23981,"children":23982},{"class":2316,"line":2421},[23983,23988,23992,23997],{"type":21,"tag":2314,"props":23984,"children":23985},{"style":2321},[23986],{"type":26,"value":23987},"message ",{"type":21,"tag":2314,"props":23989,"children":23990},{"style":3157},[23991],{"type":26,"value":3197},{"type":21,"tag":2314,"props":23993,"children":23994},{"style":3157},[23995],{"type":26,"value":23996}," b",{"type":21,"tag":2314,"props":23998,"children":23999},{"style":2350},[24000],{"type":26,"value":24001},"\"Deploy to production\"\n",{"type":21,"tag":2314,"props":24003,"children":24004},{"class":2316,"line":16},[24005,24010,24014],{"type":21,"tag":2314,"props":24006,"children":24007},{"style":2321},[24008],{"type":26,"value":24009},"signature ",{"type":21,"tag":2314,"props":24011,"children":24012},{"style":3157},[24013],{"type":26,"value":3197},{"type":21,"tag":2314,"props":24015,"children":24016},{"style":2321},[24017],{"type":26,"value":24018}," sign(message, secret_key)\n",{"type":21,"tag":2314,"props":24020,"children":24021},{"class":2316,"line":127},[24022],{"type":21,"tag":2314,"props":24023,"children":24024},{"emptyLinePlaceholder":3181},[24025],{"type":26,"value":3184},{"type":21,"tag":2314,"props":24027,"children":24028},{"class":2316,"line":887},[24029],{"type":21,"tag":2314,"props":24030,"children":24031},{"style":3407},[24032],{"type":26,"value":24033},"# Verify\n",{"type":21,"tag":2314,"props":24035,"children":24036},{"class":2316,"line":1364},[24037,24041],{"type":21,"tag":2314,"props":24038,"children":24039},{"style":3157},[24040],{"type":26,"value":23855},{"type":21,"tag":2314,"props":24042,"children":24043},{"style":2321},[24044],{"type":26,"value":24045}," verify(message, signature, public_key)\n",{"type":21,"tag":17316,"props":24047,"children":24049},{"id":24048},"slh-dsasphincs基于哈希的签名",[24050],{"type":26,"value":24051},"SLH-DSA（SPHINCS+）——基于哈希的签名",{"type":21,"tag":3080,"props":24053,"children":24054},{},[24055,24064,24073,24082],{"type":21,"tag":3084,"props":24056,"children":24057},{},[24058,24062],{"type":21,"tag":136,"props":24059,"children":24060},{},[24061],{"type":26,"value":23684},{"type":26,"value":24063}," 作为保守备选方案替代 ECDSA",{"type":21,"tag":3084,"props":24065,"children":24066},{},[24067,24071],{"type":21,"tag":136,"props":24068,"children":24069},{},[24070],{"type":26,"value":23694},{"type":26,"value":24072}," 仅依赖哈希函数——最保守的选择",{"type":21,"tag":3084,"props":24074,"children":24075},{},[24076,24080],{"type":21,"tag":136,"props":24077,"children":24078},{},[24079],{"type":26,"value":23704},{"type":26,"value":24081}," 签名较大（约 8–50 KB），签名较慢",{"type":21,"tag":3084,"props":24083,"children":24084},{},[24085,24089],{"type":21,"tag":136,"props":24086,"children":24087},{},[24088],{"type":26,"value":23714},{"type":26,"value":24090}," 关注密钥重用的高保障签名、长期文档签名",{"type":21,"tag":22,"props":24092,"children":24093},{},[24094,24096,24101],{"type":26,"value":24095},"NIST 还标准化了 ",{"type":21,"tag":136,"props":24097,"children":24098},{},[24099],{"type":26,"value":24100},"FALCON（FN-DSA）",{"type":26,"value":24102},"——一种签名紧凑的格签名方案，适用于像 IoT 这样的受限环境。",{"type":21,"tag":29,"props":24104,"children":24106},{"id":24105},"现在该做什么分级行动计划",[24107],{"type":26,"value":24108},"现在该做什么：分级行动计划",{"type":21,"tag":17316,"props":24110,"children":24112},{"id":24111},"第一级今天就做低投入高影响",[24113],{"type":26,"value":24114},"第一级——今天就做（低投入、高影响）",{"type":21,"tag":22,"props":24116,"children":24117},{},[24118,24123],{"type":21,"tag":136,"props":24119,"children":24120},{},[24121],{"type":26,"value":24122},"审计你的密码学清单。",{"type":26,"value":24124}," 你无法迁移尚未编目的东西。记录：",{"type":21,"tag":3080,"props":24126,"children":24127},{},[24128,24133,24138,24143],{"type":21,"tag":3084,"props":24129,"children":24130},{},[24131],{"type":26,"value":24132},"你的应用在哪里使用 TLS？（大多数框架会处理这个）",{"type":21,"tag":3084,"props":24134,"children":24135},{},[24136],{"type":26,"value":24137},"你在哪里生成或验证签名？（JWT、代码签名、PDF 签名）",{"type":21,"tag":3084,"props":24139,"children":24140},{},[24141],{"type":26,"value":24142},"你在哪里使用非对称密钥交换？（RSA 封装的 AES 密钥、SSH）",{"type":21,"tag":3084,"props":24144,"children":24145},{},[24146],{"type":26,"value":24147},"你正在使用哪些库？（OpenSSL、BouncyCastle、AWS KMS 等）",{"type":21,"tag":22,"props":24149,"children":24150},{},[24151,24156],{"type":21,"tag":136,"props":24152,"children":24153},{},[24154],{"type":26,"value":24155},"将 AES-128 升级到 AES-256。",{"type":26,"value":24157}," 这是低风险且立竿见影的。AES-256 面对 Grover 时安全性减半至 128 位——仍然十分安全。",{"type":21,"tag":22,"props":24159,"children":24160},{},[24161,24166],{"type":21,"tag":136,"props":24162,"children":24163},{},[24164],{"type":26,"value":24165},"在所有地方启用 TLS 1.3。",{"type":26,"value":24167}," TLS 1.3 默认使用前向保密（ECDHE），这意味着即使长期密钥被泄露，过去的会话也无法被解密。这为 TLS 流量部分缓解了 HNDL。",{"type":21,"tag":17316,"props":24169,"children":24171},{"id":24170},"第二级为未来-618-个月做规划",[24172],{"type":26,"value":24173},"第二级——为未来 6–18 个月做规划",{"type":21,"tag":22,"props":24175,"children":24176},{},[24177,24182,24184,24190],{"type":21,"tag":136,"props":24178,"children":24179},{},[24180],{"type":26,"value":24181},"在 TLS 中采用混合密钥交换。",{"type":26,"value":24183}," TLS 工作组已经标准化了 ",{"type":21,"tag":2073,"props":24185,"children":24187},{"className":24186},[],[24188],{"type":26,"value":24189},"X25519Kyber768",{"type":26,"value":24191},"——一种同时使用经典 ECDH 和 ML-KEM 的混合方案。Google Chrome、Cloudflare 和 AWS 已经支持它。这在防范 HNDL 的同时保持了经典安全性：",{"type":21,"tag":2304,"props":24193,"children":24197},{"code":24194,"language":24195,"meta":7,"className":24196,"style":7},"# Nginx with OpenSSL 3.x + oqs-provider (Open Quantum Safe)\nssl_ecdh_curve X25519Kyber768;  # hybrid classical + PQC\n","nginx","language-nginx shiki shiki-themes github-dark",[24198],{"type":21,"tag":2073,"props":24199,"children":24200},{"__ignoreMap":7},[24201,24209],{"type":21,"tag":2314,"props":24202,"children":24203},{"class":2316,"line":2317},[24204],{"type":21,"tag":2314,"props":24205,"children":24206},{},[24207],{"type":26,"value":24208},"# Nginx with OpenSSL 3.x + oqs-provider (Open Quantum Safe)\n",{"type":21,"tag":2314,"props":24210,"children":24211},{"class":2316,"line":106},[24212],{"type":21,"tag":2314,"props":24213,"children":24214},{},[24215],{"type":26,"value":24216},"ssl_ecdh_curve X25519Kyber768;  # hybrid classical + PQC\n",{"type":21,"tag":22,"props":24218,"children":24219},{},[24220,24225],{"type":21,"tag":136,"props":24221,"children":24222},{},[24223],{"type":26,"value":24224},"在新系统中用 ML-DSA 替换 RSA\u002FECDSA。",{"type":26,"value":24226}," 对于任何全新构建的项目——新的微服务、新的 JWT 实现、新的 SSH 部署——使用 ML-DSA（Dilithium3 或 Dilithium5）而不是 ECDSA-256。",{"type":21,"tag":22,"props":24228,"children":24229},{},[24230,24235],{"type":21,"tag":136,"props":24231,"children":24232},{},[24233],{"type":26,"value":24234},"更新你的 TLS 证书流水线。",{"type":26,"value":24236}," 大多数公共 CA 尚未签发 PQC 证书，但你今天就可以将 ML-DSA 用于内部签名的证书和服务网格证书。",{"type":21,"tag":17316,"props":24238,"children":24240},{"id":24239},"第三级长期迁移15-年",[24241],{"type":26,"value":24242},"第三级——长期迁移（1–5 年）",{"type":21,"tag":22,"props":24244,"children":24245},{},[24246,24251],{"type":21,"tag":136,"props":24247,"children":24248},{},[24249],{"type":26,"value":24250},"完整的 PKI 迁移。",{"type":26,"value":24252}," 用基于 PQC 的 CA 基础设施替换你的 RSA\u002FECC 证书层次结构。这是最困难的部分——硬件安全模块（HSM）、自动化证书轮换和证书链都需要更新。",{"type":21,"tag":22,"props":24254,"children":24255},{},[24256,24261],{"type":21,"tag":136,"props":24257,"children":24258},{},[24259],{"type":26,"value":24260},"硬件和嵌入式设备。",{"type":26,"value":24262}," IoT 和嵌入式设备往往无法远程打补丁，且有 10 年以上的使用寿命。审计任何依赖 RSA 或 ECDSA 进行身份验证的此类设备。",{"type":21,"tag":22,"props":24264,"children":24265},{},[24266,24271],{"type":21,"tag":136,"props":24267,"children":24268},{},[24269],{"type":26,"value":24270},"密钥管理系统。",{"type":26,"value":24272}," AWS KMS、Azure Key Vault、HashiCorp Vault——核实它们的 PQC 路线图和迁移时间表。",{"type":21,"tag":29,"props":24274,"children":24276},{"id":24275},"库和框架支持",[24277],{"type":26,"value":24275},{"type":21,"tag":4020,"props":24279,"children":24280},{},[24281,24297],{"type":21,"tag":4024,"props":24282,"children":24283},{},[24284],{"type":21,"tag":4028,"props":24285,"children":24286},{},[24287,24292],{"type":21,"tag":4032,"props":24288,"children":24289},{},[24290],{"type":26,"value":24291},"平台",{"type":21,"tag":4032,"props":24293,"children":24294},{},[24295],{"type":26,"value":24296},"PQC 状态",{"type":21,"tag":4046,"props":24298,"children":24299},{},[24300,24313,24326,24339,24352,24365,24378,24397,24410],{"type":21,"tag":4028,"props":24301,"children":24302},{},[24303,24308],{"type":21,"tag":4053,"props":24304,"children":24305},{},[24306],{"type":26,"value":24307},"OpenSSL 3.x + oqs-provider",{"type":21,"tag":4053,"props":24309,"children":24310},{},[24311],{"type":26,"value":24312},"通过插件支持 ML-KEM、ML-DSA、FALCON",{"type":21,"tag":4028,"props":24314,"children":24315},{},[24316,24321],{"type":21,"tag":4053,"props":24317,"children":24318},{},[24319],{"type":26,"value":24320},"AWS KMS",{"type":21,"tag":4053,"props":24322,"children":24323},{},[24324],{"type":26,"value":24325},"ML-KEM 混合 TLS 处于预览阶段",{"type":21,"tag":4028,"props":24327,"children":24328},{},[24329,24334],{"type":21,"tag":4053,"props":24330,"children":24331},{},[24332],{"type":26,"value":24333},"Cloudflare",{"type":21,"tag":4053,"props":24335,"children":24336},{},[24337],{"type":26,"value":24338},"X25519Kyber768 TLS（自 2023 年起上线）",{"type":21,"tag":4028,"props":24340,"children":24341},{},[24342,24347],{"type":21,"tag":4053,"props":24343,"children":24344},{},[24345],{"type":26,"value":24346},"Chrome 124+",{"type":21,"tag":4053,"props":24348,"children":24349},{},[24350],{"type":26,"value":24351},"X25519Kyber768 TLS",{"type":21,"tag":4028,"props":24353,"children":24354},{},[24355,24360],{"type":21,"tag":4053,"props":24356,"children":24357},{},[24358],{"type":26,"value":24359},"Java（BouncyCastle）",{"type":21,"tag":4053,"props":24361,"children":24362},{},[24363],{"type":26,"value":24364},"CRYSTALS-Kyber、Dilithium",{"type":21,"tag":4028,"props":24366,"children":24367},{},[24368,24373],{"type":21,"tag":4053,"props":24369,"children":24370},{},[24371],{"type":26,"value":24372},"Python（pqcrypto）",{"type":21,"tag":4053,"props":24374,"children":24375},{},[24376],{"type":26,"value":24377},"完整的 NIST 套件",{"type":21,"tag":4028,"props":24379,"children":24380},{},[24381,24386],{"type":21,"tag":4053,"props":24382,"children":24383},{},[24384],{"type":26,"value":24385},"Go",{"type":21,"tag":4053,"props":24387,"children":24388},{},[24389,24395],{"type":21,"tag":2073,"props":24390,"children":24392},{"className":24391},[],[24393],{"type":26,"value":24394},"golang.org\u002Fx\u002Fcrypto",{"type":26,"value":24396}," PQC 开发中",{"type":21,"tag":4028,"props":24398,"children":24399},{},[24400,24405],{"type":21,"tag":4053,"props":24401,"children":24402},{},[24403],{"type":26,"value":24404},"Node.js",{"type":21,"tag":4053,"props":24406,"children":24407},{},[24408],{"type":26,"value":24409},"通过原生模块（OpenSSL 3.x 绑定）",{"type":21,"tag":4028,"props":24411,"children":24412},{},[24413,24418],{"type":21,"tag":4053,"props":24414,"children":24415},{},[24416],{"type":26,"value":24417},"Rust（pqcrypto crate）",{"type":21,"tag":4053,"props":24419,"children":24420},{},[24421],{"type":26,"value":24377},{"type":21,"tag":29,"props":24423,"children":24425},{"id":24424},"一页速览",[24426],{"type":26,"value":24424},{"type":21,"tag":2304,"props":24428,"children":24430},{"code":24429},"What breaks:    RSA, ECDSA, ECDH, classical DH\nWhat's safe:    AES-256, SHA-256, SHA-3, bcrypt, Argon2\nNew standards:  ML-KEM (Kyber) for key exchange\n                ML-DSA (Dilithium) for signatures\n                SLH-DSA (SPHINCS+) for conservative signing\n\nDo today:       Upgrade AES-128 → AES-256\n                Enable TLS 1.3 (forward secrecy)\n                Audit crypto inventory\n\nDo soon:        Hybrid TLS key exchange (X25519Kyber768)\n                ML-DSA for new signature systems\n\nDo in 1-5 yrs:  Full PKI migration to PQC\n                Firmware updates for IoT devices\n",[24431],{"type":21,"tag":2073,"props":24432,"children":24433},{"__ignoreMap":7},[24434],{"type":26,"value":24429},{"type":21,"tag":22,"props":24436,"children":24437},{},[24438],{"type":26,"value":24439},"量子计算对密码学的威胁是真实存在的，而时间线尚不确定——这恰恰是为什么现在、在量子计算机具备能力之前就采取行动，才是正确的选择。",{"type":21,"tag":22,"props":24441,"children":24442},{},[24443,24448,24449,24454,24455],{"type":21,"tag":136,"props":24444,"children":24445},{},[24446],{"type":26,"value":24447},"延伸阅读：",{"type":26,"value":1301},{"type":21,"tag":46,"props":24450,"children":24451},{"href":9582},[24452],{"type":26,"value":24453},"量子计算术语表 — Shor 算法",{"type":26,"value":7066},{"type":21,"tag":46,"props":24456,"children":24457},{"href":11459},[24458],{"type":26,"value":24459},"量子计算机今天能做什么",{"type":21,"tag":2688,"props":24461,"children":24462},{},[24463],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":24465},[24466,24467,24468,24473,24478,24479],{"id":23464,"depth":106,"text":23467},{"id":23556,"depth":106,"text":23559},{"id":23659,"depth":106,"text":23662,"children":24469},[24470,24471,24472],{"id":23670,"depth":2335,"text":23673},{"id":23880,"depth":2335,"text":23883},{"id":24048,"depth":2335,"text":24051},{"id":24105,"depth":106,"text":24108,"children":24474},[24475,24476,24477],{"id":24111,"depth":2335,"text":24114},{"id":24170,"depth":2335,"text":24173},{"id":24239,"depth":2335,"text":24242},{"id":24275,"depth":106,"text":24275},{"id":24424,"depth":106,"text":24424},"content:zh:blog:post-quantum-cryptography-guide.md","zh\u002Fblog\u002Fpost-quantum-cryptography-guide.md","zh\u002Fblog\u002Fpost-quantum-cryptography-guide",{"_path":24484,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":24485,"description":24486,"date":24487,"author":11,"tags":24488,"readingTime":887,"body":24489,"_type":111,"_id":27027,"_source":113,"_file":27028,"_stem":27029,"_extension":116},"\u002Fzh\u002Fblog\u002Freduce-shot-count","如何在变分量子算法中将采样次数削减 80%","减少 VQE 与 QAOA 所需电路执行次数的实用技巧——采样节俭型优化器、梯度估计诀窍以及测量分组。","2026-03-01",[2017,282,2018,8843],{"type":18,"children":24490,"toc":27016},[24491,24496,24501,24506,24511,24633,24645,24651,24663,24963,24971,24977,24989,25312,25323,25329,25349,25542,25569,25575,25587,25736,25746,25752,25757,26090,26095,26101,26106,26279,26285,26847,26853,26982,26987,27012],{"type":21,"tag":22,"props":24492,"children":24493},{},[24494],{"type":26,"value":24495},"每次在真实硬件上运行量子电路，都会消耗 QPU 时间和金钱。像 VQE 和 QAOA 这样的变分算法可能需要数十万次电路执行才能收敛——在云端 QPU 上每个任务的费用为 $0.075–$0.90，累加起来很快就会变得可观。",{"type":21,"tag":22,"props":24497,"children":24498},{},[24499],{"type":26,"value":24500},"好消息是：大多数默认实现的采样效率极其低下。只要采用正确的技巧，你就可以在不牺牲结果质量的前提下，将采样需求削减 50–90%。",{"type":21,"tag":29,"props":24502,"children":24504},{"id":24503},"为什么默认的采样次数如此之高",[24505],{"type":26,"value":24503},{"type":21,"tag":22,"props":24507,"children":24508},{},[24509],{"type":26,"value":24510},"VQE 计算 Pauli 算符的期望值。哈密顿量被分解为一组 Pauli 项之和，而每一项都需要单独执行一次电路。对于像 H₂（4 个量子比特）这样的分子，大约有 15 个 Pauli 项。对于更大的分子，数量则会爆炸式增长：",{"type":21,"tag":4020,"props":24512,"children":24513},{},[24514,24540],{"type":21,"tag":4024,"props":24515,"children":24516},{},[24517],{"type":21,"tag":4028,"props":24518,"children":24519},{},[24520,24525,24530,24535],{"type":21,"tag":4032,"props":24521,"children":24522},{},[24523],{"type":26,"value":24524},"分子",{"type":21,"tag":4032,"props":24526,"children":24527},{},[24528],{"type":26,"value":24529},"量子比特数",{"type":21,"tag":4032,"props":24531,"children":24532},{},[24533],{"type":26,"value":24534},"Pauli 项数",{"type":21,"tag":4032,"props":24536,"children":24537},{},[24538],{"type":26,"value":24539},"朴素方案每次迭代的采样次数",{"type":21,"tag":4046,"props":24541,"children":24542},{},[24543,24565,24588,24611],{"type":21,"tag":4028,"props":24544,"children":24545},{},[24546,24551,24555,24560],{"type":21,"tag":4053,"props":24547,"children":24548},{},[24549],{"type":26,"value":24550},"H₂",{"type":21,"tag":4053,"props":24552,"children":24553},{},[24554],{"type":26,"value":5486},{"type":21,"tag":4053,"props":24556,"children":24557},{},[24558],{"type":26,"value":24559},"15",{"type":21,"tag":4053,"props":24561,"children":24562},{},[24563],{"type":26,"value":24564},"15,000",{"type":21,"tag":4028,"props":24566,"children":24567},{},[24568,24573,24578,24583],{"type":21,"tag":4053,"props":24569,"children":24570},{},[24571],{"type":26,"value":24572},"LiH",{"type":21,"tag":4053,"props":24574,"children":24575},{},[24576],{"type":26,"value":24577},"12",{"type":21,"tag":4053,"props":24579,"children":24580},{},[24581],{"type":26,"value":24582},"631",{"type":21,"tag":4053,"props":24584,"children":24585},{},[24586],{"type":26,"value":24587},"631,000",{"type":21,"tag":4028,"props":24589,"children":24590},{},[24591,24596,24601,24606],{"type":21,"tag":4053,"props":24592,"children":24593},{},[24594],{"type":26,"value":24595},"BeH₂",{"type":21,"tag":4053,"props":24597,"children":24598},{},[24599],{"type":26,"value":24600},"14",{"type":21,"tag":4053,"props":24602,"children":24603},{},[24604],{"type":26,"value":24605},"666",{"type":21,"tag":4053,"props":24607,"children":24608},{},[24609],{"type":26,"value":24610},"666,000",{"type":21,"tag":4028,"props":24612,"children":24613},{},[24614,24619,24623,24628],{"type":21,"tag":4053,"props":24615,"children":24616},{},[24617],{"type":26,"value":24618},"H₂O",{"type":21,"tag":4053,"props":24620,"children":24621},{},[24622],{"type":26,"value":24600},{"type":21,"tag":4053,"props":24624,"children":24625},{},[24626],{"type":26,"value":24627},"1,086",{"type":21,"tag":4053,"props":24629,"children":24630},{},[24631],{"type":26,"value":24632},"1,086,000",{"type":21,"tag":22,"props":24634,"children":24635},{},[24636,24638,24643],{"type":26,"value":24637},"若进行 200 次优化器迭代，H₂O 在朴素方案下需要 ",{"type":21,"tag":136,"props":24639,"children":24640},{},[24641],{"type":26,"value":24642},"2.17 亿次采样",{"type":26,"value":24644},"。下面介绍的技巧可以将其削减 80–95%。",{"type":21,"tag":29,"props":24646,"children":24648},{"id":24647},"技巧-1测量分组收益最大",[24649],{"type":26,"value":24650},"技巧 1：测量分组（收益最大）",{"type":21,"tag":22,"props":24652,"children":24653},{},[24654,24656,24661],{"type":26,"value":24655},"许多 Pauli 项是",{"type":21,"tag":136,"props":24657,"children":24658},{},[24659],{"type":26,"value":24660},"对易的",{"type":26,"value":24662},"——它们可以在单次电路执行中同时测量，而不必分开测量。将对易的可观测量分组，是可用手段中单项收益最大的一种。",{"type":21,"tag":2304,"props":24664,"children":24666},{"className":3145,"code":24665,"language":3147,"meta":7,"style":7},"from qiskit.primitives import StatevectorEstimator\nfrom qiskit_nature.second_q.mappers import JordanWignerMapper\nfrom qiskit_algorithms import VQE\nfrom qiskit_algorithms.optimizers import COBYLA\n\n# Qiskit automatically groups commuting Paulis in the Estimator primitive\n# This reduces shots from O(n_terms) to O(n_groups) — often 5-10x reduction\nestimator = StatevectorEstimator()\n\n# With PennyLane, use grouping explicitly:\nimport pennylane as qml\n\nH = qml.Hamiltonian(coeffs, observables)\n\n# Group commuting terms — usually reduces term count by 5-10x\ngroups = qml.grouping.group_observables(observables, grouping_type='qwc')\nprint(f\"Original terms: {len(observables)}, Groups: {len(groups)}\")\n# Original terms: 631, Groups: 68  (for LiH)\n",[24667],{"type":21,"tag":2073,"props":24668,"children":24669},{"__ignoreMap":7},[24670,24690,24709,24728,24747,24754,24762,24770,24787,24794,24802,24821,24828,24845,24852,24860,24895,24955],{"type":21,"tag":2314,"props":24671,"children":24672},{"class":2316,"line":2317},[24673,24677,24681,24685],{"type":21,"tag":2314,"props":24674,"children":24675},{"style":3157},[24676],{"type":26,"value":3160},{"type":21,"tag":2314,"props":24678,"children":24679},{"style":2321},[24680],{"type":26,"value":22448},{"type":21,"tag":2314,"props":24682,"children":24683},{"style":3157},[24684],{"type":26,"value":3170},{"type":21,"tag":2314,"props":24686,"children":24687},{"style":2321},[24688],{"type":26,"value":24689}," StatevectorEstimator\n",{"type":21,"tag":2314,"props":24691,"children":24692},{"class":2316,"line":106},[24693,24697,24701,24705],{"type":21,"tag":2314,"props":24694,"children":24695},{"style":3157},[24696],{"type":26,"value":3160},{"type":21,"tag":2314,"props":24698,"children":24699},{"style":2321},[24700],{"type":26,"value":22364},{"type":21,"tag":2314,"props":24702,"children":24703},{"style":3157},[24704],{"type":26,"value":3170},{"type":21,"tag":2314,"props":24706,"children":24707},{"style":2321},[24708],{"type":26,"value":22373},{"type":21,"tag":2314,"props":24710,"children":24711},{"class":2316,"line":2335},[24712,24716,24720,24724],{"type":21,"tag":2314,"props":24713,"children":24714},{"style":3157},[24715],{"type":26,"value":3160},{"type":21,"tag":2314,"props":24717,"children":24718},{"style":2321},[24719],{"type":26,"value":22406},{"type":21,"tag":2314,"props":24721,"children":24722},{"style":3157},[24723],{"type":26,"value":3170},{"type":21,"tag":2314,"props":24725,"children":24726},{"style":2339},[24727],{"type":26,"value":22415},{"type":21,"tag":2314,"props":24729,"children":24730},{"class":2316,"line":2397},[24731,24735,24739,24743],{"type":21,"tag":2314,"props":24732,"children":24733},{"style":3157},[24734],{"type":26,"value":3160},{"type":21,"tag":2314,"props":24736,"children":24737},{"style":2321},[24738],{"type":26,"value":22427},{"type":21,"tag":2314,"props":24740,"children":24741},{"style":3157},[24742],{"type":26,"value":3170},{"type":21,"tag":2314,"props":24744,"children":24745},{"style":2339},[24746],{"type":26,"value":22436},{"type":21,"tag":2314,"props":24748,"children":24749},{"class":2316,"line":2421},[24750],{"type":21,"tag":2314,"props":24751,"children":24752},{"emptyLinePlaceholder":3181},[24753],{"type":26,"value":3184},{"type":21,"tag":2314,"props":24755,"children":24756},{"class":2316,"line":16},[24757],{"type":21,"tag":2314,"props":24758,"children":24759},{"style":3407},[24760],{"type":26,"value":24761},"# Qiskit automatically groups commuting Paulis in the Estimator primitive\n",{"type":21,"tag":2314,"props":24763,"children":24764},{"class":2316,"line":127},[24765],{"type":21,"tag":2314,"props":24766,"children":24767},{"style":3407},[24768],{"type":26,"value":24769},"# This reduces shots from O(n_terms) to O(n_groups) — often 5-10x reduction\n",{"type":21,"tag":2314,"props":24771,"children":24772},{"class":2316,"line":887},[24773,24778,24782],{"type":21,"tag":2314,"props":24774,"children":24775},{"style":2321},[24776],{"type":26,"value":24777},"estimator ",{"type":21,"tag":2314,"props":24779,"children":24780},{"style":3157},[24781],{"type":26,"value":3197},{"type":21,"tag":2314,"props":24783,"children":24784},{"style":2321},[24785],{"type":26,"value":24786}," StatevectorEstimator()\n",{"type":21,"tag":2314,"props":24788,"children":24789},{"class":2316,"line":1364},[24790],{"type":21,"tag":2314,"props":24791,"children":24792},{"emptyLinePlaceholder":3181},[24793],{"type":26,"value":3184},{"type":21,"tag":2314,"props":24795,"children":24796},{"class":2316,"line":3403},[24797],{"type":21,"tag":2314,"props":24798,"children":24799},{"style":3407},[24800],{"type":26,"value":24801},"# With PennyLane, use grouping explicitly:\n",{"type":21,"tag":2314,"props":24803,"children":24804},{"class":2316,"line":3413},[24805,24809,24813,24817],{"type":21,"tag":2314,"props":24806,"children":24807},{"style":3157},[24808],{"type":26,"value":3170},{"type":21,"tag":2314,"props":24810,"children":24811},{"style":2321},[24812],{"type":26,"value":14046},{"type":21,"tag":2314,"props":24814,"children":24815},{"style":3157},[24816],{"type":26,"value":4232},{"type":21,"tag":2314,"props":24818,"children":24819},{"style":2321},[24820],{"type":26,"value":14055},{"type":21,"tag":2314,"props":24822,"children":24823},{"class":2316,"line":436},[24824],{"type":21,"tag":2314,"props":24825,"children":24826},{"emptyLinePlaceholder":3181},[24827],{"type":26,"value":3184},{"type":21,"tag":2314,"props":24829,"children":24830},{"class":2316,"line":3473},[24831,24836,24840],{"type":21,"tag":2314,"props":24832,"children":24833},{"style":2321},[24834],{"type":26,"value":24835},"H ",{"type":21,"tag":2314,"props":24837,"children":24838},{"style":3157},[24839],{"type":26,"value":3197},{"type":21,"tag":2314,"props":24841,"children":24842},{"style":2321},[24843],{"type":26,"value":24844}," qml.Hamiltonian(coeffs, observables)\n",{"type":21,"tag":2314,"props":24846,"children":24847},{"class":2316,"line":3521},[24848],{"type":21,"tag":2314,"props":24849,"children":24850},{"emptyLinePlaceholder":3181},[24851],{"type":26,"value":3184},{"type":21,"tag":2314,"props":24853,"children":24854},{"class":2316,"line":3563},[24855],{"type":21,"tag":2314,"props":24856,"children":24857},{"style":3407},[24858],{"type":26,"value":24859},"# Group commuting terms — usually reduces term count by 5-10x\n",{"type":21,"tag":2314,"props":24861,"children":24862},{"class":2316,"line":4585},[24863,24868,24872,24877,24882,24886,24891],{"type":21,"tag":2314,"props":24864,"children":24865},{"style":2321},[24866],{"type":26,"value":24867},"groups ",{"type":21,"tag":2314,"props":24869,"children":24870},{"style":3157},[24871],{"type":26,"value":3197},{"type":21,"tag":2314,"props":24873,"children":24874},{"style":2321},[24875],{"type":26,"value":24876}," qml.grouping.group_observables(observables, ",{"type":21,"tag":2314,"props":24878,"children":24879},{"style":3222},[24880],{"type":26,"value":24881},"grouping_type",{"type":21,"tag":2314,"props":24883,"children":24884},{"style":3157},[24885],{"type":26,"value":3197},{"type":21,"tag":2314,"props":24887,"children":24888},{"style":2350},[24889],{"type":26,"value":24890},"'qwc'",{"type":21,"tag":2314,"props":24892,"children":24893},{"style":2321},[24894],{"type":26,"value":3257},{"type":21,"tag":2314,"props":24896,"children":24897},{"class":2316,"line":4604},[24898,24902,24906,24910,24915,24920,24925,24929,24934,24938,24943,24947,24951],{"type":21,"tag":2314,"props":24899,"children":24900},{"style":2339},[24901],{"type":26,"value":3272},{"type":21,"tag":2314,"props":24903,"children":24904},{"style":2321},[24905],{"type":26,"value":3277},{"type":21,"tag":2314,"props":24907,"children":24908},{"style":3157},[24909],{"type":26,"value":3282},{"type":21,"tag":2314,"props":24911,"children":24912},{"style":2350},[24913],{"type":26,"value":24914},"\"Original terms: ",{"type":21,"tag":2314,"props":24916,"children":24917},{"style":2339},[24918],{"type":26,"value":24919},"{len",{"type":21,"tag":2314,"props":24921,"children":24922},{"style":2321},[24923],{"type":26,"value":24924},"(observables)",{"type":21,"tag":2314,"props":24926,"children":24927},{"style":2339},[24928],{"type":26,"value":3302},{"type":21,"tag":2314,"props":24930,"children":24931},{"style":2350},[24932],{"type":26,"value":24933},", Groups: ",{"type":21,"tag":2314,"props":24935,"children":24936},{"style":2339},[24937],{"type":26,"value":24919},{"type":21,"tag":2314,"props":24939,"children":24940},{"style":2321},[24941],{"type":26,"value":24942},"(groups)",{"type":21,"tag":2314,"props":24944,"children":24945},{"style":2339},[24946],{"type":26,"value":3302},{"type":21,"tag":2314,"props":24948,"children":24949},{"style":2350},[24950],{"type":26,"value":3307},{"type":21,"tag":2314,"props":24952,"children":24953},{"style":2321},[24954],{"type":26,"value":3257},{"type":21,"tag":2314,"props":24956,"children":24957},{"class":2316,"line":4612},[24958],{"type":21,"tag":2314,"props":24959,"children":24960},{"style":3407},[24961],{"type":26,"value":24962},"# Original terms: 631, Groups: 68  (for LiH)\n",{"type":21,"tag":22,"props":24964,"children":24965},{},[24966],{"type":21,"tag":136,"props":24967,"children":24968},{},[24969],{"type":26,"value":24970},"预期节省：在典型的化学哈密顿量上可达 5–15×。",{"type":21,"tag":29,"props":24972,"children":24974},{"id":24973},"技巧-2采样节俭型优化器",[24975],{"type":26,"value":24976},"技巧 2：采样节俭型优化器",{"type":21,"tag":22,"props":24978,"children":24979},{},[24980,24982,24987],{"type":26,"value":24981},"像 L-BFGS-B 或 ADAM 这样的经典优化器假设函数求值无噪声——当结果带有噪声时，它们请求的梯度求值次数超过了必要的数量。",{"type":21,"tag":136,"props":24983,"children":24984},{},[24985],{"type":26,"value":24986},"采样节俭型优化器",{"type":26,"value":24988},"会根据测量方差自适应地分配采样次数。",{"type":21,"tag":2304,"props":24990,"children":24992},{"className":3145,"code":24991,"language":3147,"meta":7,"style":7},"from pennylane.optimize import AdaptiveOptimizer, ShotAdaptiveOptimizer\n\ndev = qml.device(\"default.qubit\", wires=4)\n\n@qml.qnode(dev)\ndef circuit(params):\n    # ansatz\n    ...\n    return qml.expval(H)\n\n# ShotAdaptiveOptimizer: allocates more shots to high-variance directions\nopt = ShotAdaptiveOptimizer(min_shots=10)\n\nparams = np.random.uniform(-np.pi, np.pi, n_params)\nfor i in range(100):\n    params, _, shots_used = opt.step_and_cost(circuit, params)\n    print(f\"Step {i}: shots used = {shots_used}\")\n",[24993],{"type":21,"tag":2073,"props":24994,"children":24995},{"__ignoreMap":7},[24996,25017,25024,25063,25070,25081,25097,25105,25113,25125,25132,25140,25173,25180,25206,25238,25255],{"type":21,"tag":2314,"props":24997,"children":24998},{"class":2316,"line":2317},[24999,25003,25008,25012],{"type":21,"tag":2314,"props":25000,"children":25001},{"style":3157},[25002],{"type":26,"value":3160},{"type":21,"tag":2314,"props":25004,"children":25005},{"style":2321},[25006],{"type":26,"value":25007}," pennylane.optimize ",{"type":21,"tag":2314,"props":25009,"children":25010},{"style":3157},[25011],{"type":26,"value":3170},{"type":21,"tag":2314,"props":25013,"children":25014},{"style":2321},[25015],{"type":26,"value":25016}," AdaptiveOptimizer, ShotAdaptiveOptimizer\n",{"type":21,"tag":2314,"props":25018,"children":25019},{"class":2316,"line":106},[25020],{"type":21,"tag":2314,"props":25021,"children":25022},{"emptyLinePlaceholder":3181},[25023],{"type":26,"value":3184},{"type":21,"tag":2314,"props":25025,"children":25026},{"class":2316,"line":2335},[25027,25031,25035,25039,25043,25047,25051,25055,25059],{"type":21,"tag":2314,"props":25028,"children":25029},{"style":2321},[25030],{"type":26,"value":14179},{"type":21,"tag":2314,"props":25032,"children":25033},{"style":3157},[25034],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25036,"children":25037},{"style":2321},[25038],{"type":26,"value":14188},{"type":21,"tag":2314,"props":25040,"children":25041},{"style":2350},[25042],{"type":26,"value":14193},{"type":21,"tag":2314,"props":25044,"children":25045},{"style":2321},[25046],{"type":26,"value":1309},{"type":21,"tag":2314,"props":25048,"children":25049},{"style":3222},[25050],{"type":26,"value":14202},{"type":21,"tag":2314,"props":25052,"children":25053},{"style":3157},[25054],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25056,"children":25057},{"style":2339},[25058],{"type":26,"value":5486},{"type":21,"tag":2314,"props":25060,"children":25061},{"style":2321},[25062],{"type":26,"value":3257},{"type":21,"tag":2314,"props":25064,"children":25065},{"class":2316,"line":2397},[25066],{"type":21,"tag":2314,"props":25067,"children":25068},{"emptyLinePlaceholder":3181},[25069],{"type":26,"value":3184},{"type":21,"tag":2314,"props":25071,"children":25072},{"class":2316,"line":2421},[25073,25077],{"type":21,"tag":2314,"props":25074,"children":25075},{"style":4318},[25076],{"type":26,"value":14226},{"type":21,"tag":2314,"props":25078,"children":25079},{"style":2321},[25080],{"type":26,"value":14231},{"type":21,"tag":2314,"props":25082,"children":25083},{"class":2316,"line":16},[25084,25088,25092],{"type":21,"tag":2314,"props":25085,"children":25086},{"style":3157},[25087],{"type":26,"value":4315},{"type":21,"tag":2314,"props":25089,"children":25090},{"style":4318},[25091],{"type":26,"value":14243},{"type":21,"tag":2314,"props":25093,"children":25094},{"style":2321},[25095],{"type":26,"value":25096},"(params):\n",{"type":21,"tag":2314,"props":25098,"children":25099},{"class":2316,"line":127},[25100],{"type":21,"tag":2314,"props":25101,"children":25102},{"style":3407},[25103],{"type":26,"value":25104},"    # ansatz\n",{"type":21,"tag":2314,"props":25106,"children":25107},{"class":2316,"line":887},[25108],{"type":21,"tag":2314,"props":25109,"children":25110},{"style":2339},[25111],{"type":26,"value":25112},"    ...\n",{"type":21,"tag":2314,"props":25114,"children":25115},{"class":2316,"line":1364},[25116,25120],{"type":21,"tag":2314,"props":25117,"children":25118},{"style":3157},[25119],{"type":26,"value":4540},{"type":21,"tag":2314,"props":25121,"children":25122},{"style":2321},[25123],{"type":26,"value":25124}," qml.expval(H)\n",{"type":21,"tag":2314,"props":25126,"children":25127},{"class":2316,"line":3403},[25128],{"type":21,"tag":2314,"props":25129,"children":25130},{"emptyLinePlaceholder":3181},[25131],{"type":26,"value":3184},{"type":21,"tag":2314,"props":25133,"children":25134},{"class":2316,"line":3413},[25135],{"type":21,"tag":2314,"props":25136,"children":25137},{"style":3407},[25138],{"type":26,"value":25139},"# ShotAdaptiveOptimizer: allocates more shots to high-variance directions\n",{"type":21,"tag":2314,"props":25141,"children":25142},{"class":2316,"line":436},[25143,25147,25151,25156,25161,25165,25169],{"type":21,"tag":2314,"props":25144,"children":25145},{"style":2321},[25146],{"type":26,"value":14905},{"type":21,"tag":2314,"props":25148,"children":25149},{"style":3157},[25150],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25152,"children":25153},{"style":2321},[25154],{"type":26,"value":25155}," ShotAdaptiveOptimizer(",{"type":21,"tag":2314,"props":25157,"children":25158},{"style":3222},[25159],{"type":26,"value":25160},"min_shots",{"type":21,"tag":2314,"props":25162,"children":25163},{"style":3157},[25164],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25166,"children":25167},{"style":2339},[25168],{"type":26,"value":20476},{"type":21,"tag":2314,"props":25170,"children":25171},{"style":2321},[25172],{"type":26,"value":3257},{"type":21,"tag":2314,"props":25174,"children":25175},{"class":2316,"line":3473},[25176],{"type":21,"tag":2314,"props":25177,"children":25178},{"emptyLinePlaceholder":3181},[25179],{"type":26,"value":3184},{"type":21,"tag":2314,"props":25181,"children":25182},{"class":2316,"line":3521},[25183,25188,25192,25197,25201],{"type":21,"tag":2314,"props":25184,"children":25185},{"style":2321},[25186],{"type":26,"value":25187},"params ",{"type":21,"tag":2314,"props":25189,"children":25190},{"style":3157},[25191],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25193,"children":25194},{"style":2321},[25195],{"type":26,"value":25196}," np.random.uniform(",{"type":21,"tag":2314,"props":25198,"children":25199},{"style":3157},[25200],{"type":26,"value":4802},{"type":21,"tag":2314,"props":25202,"children":25203},{"style":2321},[25204],{"type":26,"value":25205},"np.pi, np.pi, n_params)\n",{"type":21,"tag":2314,"props":25207,"children":25208},{"class":2316,"line":3563},[25209,25213,25217,25221,25225,25229,25234],{"type":21,"tag":2314,"props":25210,"children":25211},{"style":3157},[25212],{"type":26,"value":3450},{"type":21,"tag":2314,"props":25214,"children":25215},{"style":2321},[25216],{"type":26,"value":4699},{"type":21,"tag":2314,"props":25218,"children":25219},{"style":3157},[25220],{"type":26,"value":3460},{"type":21,"tag":2314,"props":25222,"children":25223},{"style":2339},[25224],{"type":26,"value":3465},{"type":21,"tag":2314,"props":25226,"children":25227},{"style":2321},[25228],{"type":26,"value":3277},{"type":21,"tag":2314,"props":25230,"children":25231},{"style":2339},[25232],{"type":26,"value":25233},"100",{"type":21,"tag":2314,"props":25235,"children":25236},{"style":2321},[25237],{"type":26,"value":4368},{"type":21,"tag":2314,"props":25239,"children":25240},{"class":2316,"line":4585},[25241,25246,25250],{"type":21,"tag":2314,"props":25242,"children":25243},{"style":2321},[25244],{"type":26,"value":25245},"    params, _, shots_used ",{"type":21,"tag":2314,"props":25247,"children":25248},{"style":3157},[25249],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25251,"children":25252},{"style":2321},[25253],{"type":26,"value":25254}," opt.step_and_cost(circuit, params)\n",{"type":21,"tag":2314,"props":25256,"children":25257},{"class":2316,"line":4604},[25258,25262,25266,25270,25274,25278,25282,25286,25291,25295,25300,25304,25308],{"type":21,"tag":2314,"props":25259,"children":25260},{"style":2339},[25261],{"type":26,"value":17179},{"type":21,"tag":2314,"props":25263,"children":25264},{"style":2321},[25265],{"type":26,"value":3277},{"type":21,"tag":2314,"props":25267,"children":25268},{"style":3157},[25269],{"type":26,"value":3282},{"type":21,"tag":2314,"props":25271,"children":25272},{"style":2350},[25273],{"type":26,"value":15184},{"type":21,"tag":2314,"props":25275,"children":25276},{"style":2339},[25277],{"type":26,"value":3292},{"type":21,"tag":2314,"props":25279,"children":25280},{"style":2321},[25281],{"type":26,"value":4190},{"type":21,"tag":2314,"props":25283,"children":25284},{"style":2339},[25285],{"type":26,"value":3302},{"type":21,"tag":2314,"props":25287,"children":25288},{"style":2350},[25289],{"type":26,"value":25290},": shots used = ",{"type":21,"tag":2314,"props":25292,"children":25293},{"style":2339},[25294],{"type":26,"value":3292},{"type":21,"tag":2314,"props":25296,"children":25297},{"style":2321},[25298],{"type":26,"value":25299},"shots_used",{"type":21,"tag":2314,"props":25301,"children":25302},{"style":2339},[25303],{"type":26,"value":3302},{"type":21,"tag":2314,"props":25305,"children":25306},{"style":2350},[25307],{"type":26,"value":3307},{"type":21,"tag":2314,"props":25309,"children":25310},{"style":2321},[25311],{"type":26,"value":3257},{"type":21,"tag":22,"props":25313,"children":25314},{},[25315,25317,25322],{"type":26,"value":25316},"该优化器起初每次求值只用很少的采样次数，只有当梯度不确定时才增加采样次数。一次典型的 VQE 运行相比固定采样次数的 COBYLA，可以",{"type":21,"tag":136,"props":25318,"children":25319},{},[25320],{"type":26,"value":25321},"减少 5–10× 的采样",{"type":26,"value":18641},{"type":21,"tag":29,"props":25324,"children":25326},{"id":25325},"技巧-3参数移位梯度使用更少的求值次数",[25327],{"type":26,"value":25328},"技巧 3：参数移位梯度（使用更少的求值次数）",{"type":21,"tag":22,"props":25330,"children":25331},{},[25332,25334,25340,25342,25347],{"type":26,"value":25333},"朴素的有限差分梯度估计 ",{"type":21,"tag":2073,"props":25335,"children":25337},{"className":25336},[],[25338],{"type":26,"value":25339},"(f(x+ε) - f(x))\u002Fε",{"type":26,"value":25341}," 在 ε 很小时方差很大，在 ε 很大时偏差很大。",{"type":21,"tag":136,"props":25343,"children":25344},{},[25345],{"type":26,"value":25346},"参数移位规则",{"type":26,"value":25348},"只需每个参数 2 次电路求值即可给出精确梯度：",{"type":21,"tag":2304,"props":25350,"children":25352},{"className":3145,"code":25351,"language":3147,"meta":7,"style":7},"# PennyLane uses parameter-shift by default for gradients\n@qml.qnode(dev, diff_method=\"parameter-shift\")  # 2 evals per param\ndef circuit(params):\n    ...\n\n# Compare to finite-difference (requires 1 eval per param but biased):\n@qml.qnode(dev, diff_method=\"finite-diff\")  # 1 eval but approximate\n\n# For large circuits, use \"best\" — PennyLane chooses adjoint on simulator,\n# parameter-shift on hardware\n@qml.qnode(dev, diff_method=\"best\")\ndef circuit(params):\n    ...\n",[25353],{"type":21,"tag":2073,"props":25354,"children":25355},{"__ignoreMap":7},[25356,25364,25399,25414,25421,25428,25436,25469,25476,25484,25492,25520,25535],{"type":21,"tag":2314,"props":25357,"children":25358},{"class":2316,"line":2317},[25359],{"type":21,"tag":2314,"props":25360,"children":25361},{"style":3407},[25362],{"type":26,"value":25363},"# PennyLane uses parameter-shift by default for gradients\n",{"type":21,"tag":2314,"props":25365,"children":25366},{"class":2316,"line":106},[25367,25371,25376,25381,25385,25390,25394],{"type":21,"tag":2314,"props":25368,"children":25369},{"style":4318},[25370],{"type":26,"value":14226},{"type":21,"tag":2314,"props":25372,"children":25373},{"style":2321},[25374],{"type":26,"value":25375},"(dev, ",{"type":21,"tag":2314,"props":25377,"children":25378},{"style":3222},[25379],{"type":26,"value":25380},"diff_method",{"type":21,"tag":2314,"props":25382,"children":25383},{"style":3157},[25384],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25386,"children":25387},{"style":2350},[25388],{"type":26,"value":25389},"\"parameter-shift\"",{"type":21,"tag":2314,"props":25391,"children":25392},{"style":2321},[25393],{"type":26,"value":19396},{"type":21,"tag":2314,"props":25395,"children":25396},{"style":3407},[25397],{"type":26,"value":25398},"# 2 evals per param\n",{"type":21,"tag":2314,"props":25400,"children":25401},{"class":2316,"line":2335},[25402,25406,25410],{"type":21,"tag":2314,"props":25403,"children":25404},{"style":3157},[25405],{"type":26,"value":4315},{"type":21,"tag":2314,"props":25407,"children":25408},{"style":4318},[25409],{"type":26,"value":14243},{"type":21,"tag":2314,"props":25411,"children":25412},{"style":2321},[25413],{"type":26,"value":25096},{"type":21,"tag":2314,"props":25415,"children":25416},{"class":2316,"line":2397},[25417],{"type":21,"tag":2314,"props":25418,"children":25419},{"style":2339},[25420],{"type":26,"value":25112},{"type":21,"tag":2314,"props":25422,"children":25423},{"class":2316,"line":2421},[25424],{"type":21,"tag":2314,"props":25425,"children":25426},{"emptyLinePlaceholder":3181},[25427],{"type":26,"value":3184},{"type":21,"tag":2314,"props":25429,"children":25430},{"class":2316,"line":16},[25431],{"type":21,"tag":2314,"props":25432,"children":25433},{"style":3407},[25434],{"type":26,"value":25435},"# Compare to finite-difference (requires 1 eval per param but biased):\n",{"type":21,"tag":2314,"props":25437,"children":25438},{"class":2316,"line":127},[25439,25443,25447,25451,25455,25460,25464],{"type":21,"tag":2314,"props":25440,"children":25441},{"style":4318},[25442],{"type":26,"value":14226},{"type":21,"tag":2314,"props":25444,"children":25445},{"style":2321},[25446],{"type":26,"value":25375},{"type":21,"tag":2314,"props":25448,"children":25449},{"style":3222},[25450],{"type":26,"value":25380},{"type":21,"tag":2314,"props":25452,"children":25453},{"style":3157},[25454],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25456,"children":25457},{"style":2350},[25458],{"type":26,"value":25459},"\"finite-diff\"",{"type":21,"tag":2314,"props":25461,"children":25462},{"style":2321},[25463],{"type":26,"value":19396},{"type":21,"tag":2314,"props":25465,"children":25466},{"style":3407},[25467],{"type":26,"value":25468},"# 1 eval but approximate\n",{"type":21,"tag":2314,"props":25470,"children":25471},{"class":2316,"line":887},[25472],{"type":21,"tag":2314,"props":25473,"children":25474},{"emptyLinePlaceholder":3181},[25475],{"type":26,"value":3184},{"type":21,"tag":2314,"props":25477,"children":25478},{"class":2316,"line":1364},[25479],{"type":21,"tag":2314,"props":25480,"children":25481},{"style":3407},[25482],{"type":26,"value":25483},"# For large circuits, use \"best\" — PennyLane chooses adjoint on simulator,\n",{"type":21,"tag":2314,"props":25485,"children":25486},{"class":2316,"line":3403},[25487],{"type":21,"tag":2314,"props":25488,"children":25489},{"style":3407},[25490],{"type":26,"value":25491},"# parameter-shift on hardware\n",{"type":21,"tag":2314,"props":25493,"children":25494},{"class":2316,"line":3413},[25495,25499,25503,25507,25511,25516],{"type":21,"tag":2314,"props":25496,"children":25497},{"style":4318},[25498],{"type":26,"value":14226},{"type":21,"tag":2314,"props":25500,"children":25501},{"style":2321},[25502],{"type":26,"value":25375},{"type":21,"tag":2314,"props":25504,"children":25505},{"style":3222},[25506],{"type":26,"value":25380},{"type":21,"tag":2314,"props":25508,"children":25509},{"style":3157},[25510],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25512,"children":25513},{"style":2350},[25514],{"type":26,"value":25515},"\"best\"",{"type":21,"tag":2314,"props":25517,"children":25518},{"style":2321},[25519],{"type":26,"value":3257},{"type":21,"tag":2314,"props":25521,"children":25522},{"class":2316,"line":436},[25523,25527,25531],{"type":21,"tag":2314,"props":25524,"children":25525},{"style":3157},[25526],{"type":26,"value":4315},{"type":21,"tag":2314,"props":25528,"children":25529},{"style":4318},[25530],{"type":26,"value":14243},{"type":21,"tag":2314,"props":25532,"children":25533},{"style":2321},[25534],{"type":26,"value":25096},{"type":21,"tag":2314,"props":25536,"children":25537},{"class":2316,"line":3473},[25538],{"type":21,"tag":2314,"props":25539,"children":25540},{"style":2339},[25541],{"type":26,"value":25112},{"type":21,"tag":22,"props":25543,"children":25544},{},[25545,25547,25552,25554,25560,25562,25567],{"type":26,"value":25546},"对于 ",{"type":21,"tag":2073,"props":25548,"children":25550},{"className":25549},[],[25551],{"type":26,"value":4783},{"type":26,"value":25553}," 个参数，参数移位每一步梯度需要 ",{"type":21,"tag":2073,"props":25555,"children":25557},{"className":25556},[],[25558],{"type":26,"value":25559},"2n",{"type":26,"value":25561}," 次求值。当 ",{"type":21,"tag":2073,"props":25563,"children":25565},{"className":25564},[],[25566],{"type":26,"value":4783},{"type":26,"value":25568}," 很大时，请使用无梯度优化器（COBYLA、SPSA、Nelder-Mead）。",{"type":21,"tag":29,"props":25570,"children":25572},{"id":25571},"技巧-4spsa随机梯度估计",[25573],{"type":26,"value":25574},"技巧 4：SPSA——随机梯度估计",{"type":21,"tag":22,"props":25576,"children":25577},{},[25578,25580,25585],{"type":26,"value":25579},"同步扰动随机逼近（SPSA）通过同时扰动所有参数，无论参数数量多少，都只需 ",{"type":21,"tag":136,"props":25581,"children":25582},{},[25583],{"type":26,"value":25584},"2 次电路求值",{"type":26,"value":25586},"即可估计出完整梯度：",{"type":21,"tag":2304,"props":25588,"children":25590},{"className":3145,"code":25589,"language":3147,"meta":7,"style":7},"from qiskit_algorithms.optimizers import SPSA\n\n# SPSA: 2 evaluations per step regardless of parameter count\n# vs parameter-shift: 2n evaluations per step\noptimizer = SPSA(maxiter=300, learning_rate=0.1, perturbation=0.05)\n\n# For 10 parameters:\n# - Parameter shift: 2×10 = 20 evals\u002Fstep × 300 steps = 6,000 total\n# - SPSA: 2 evals\u002Fstep × 300 steps = 600 total  ← 10x reduction\n",[25591],{"type":21,"tag":2073,"props":25592,"children":25593},{"__ignoreMap":7},[25594,25614,25621,25629,25637,25705,25712,25720,25728],{"type":21,"tag":2314,"props":25595,"children":25596},{"class":2316,"line":2317},[25597,25601,25605,25609],{"type":21,"tag":2314,"props":25598,"children":25599},{"style":3157},[25600],{"type":26,"value":3160},{"type":21,"tag":2314,"props":25602,"children":25603},{"style":2321},[25604],{"type":26,"value":22427},{"type":21,"tag":2314,"props":25606,"children":25607},{"style":3157},[25608],{"type":26,"value":3170},{"type":21,"tag":2314,"props":25610,"children":25611},{"style":2339},[25612],{"type":26,"value":25613}," SPSA\n",{"type":21,"tag":2314,"props":25615,"children":25616},{"class":2316,"line":106},[25617],{"type":21,"tag":2314,"props":25618,"children":25619},{"emptyLinePlaceholder":3181},[25620],{"type":26,"value":3184},{"type":21,"tag":2314,"props":25622,"children":25623},{"class":2316,"line":2335},[25624],{"type":21,"tag":2314,"props":25625,"children":25626},{"style":3407},[25627],{"type":26,"value":25628},"# SPSA: 2 evaluations per step regardless of parameter count\n",{"type":21,"tag":2314,"props":25630,"children":25631},{"class":2316,"line":2397},[25632],{"type":21,"tag":2314,"props":25633,"children":25634},{"style":3407},[25635],{"type":26,"value":25636},"# vs parameter-shift: 2n evaluations per step\n",{"type":21,"tag":2314,"props":25638,"children":25639},{"class":2316,"line":2421},[25640,25645,25649,25654,25658,25662,25667,25671,25676,25680,25684,25688,25693,25697,25701],{"type":21,"tag":2314,"props":25641,"children":25642},{"style":2321},[25643],{"type":26,"value":25644},"optimizer ",{"type":21,"tag":2314,"props":25646,"children":25647},{"style":3157},[25648],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25650,"children":25651},{"style":2321},[25652],{"type":26,"value":25653}," SPSA(",{"type":21,"tag":2314,"props":25655,"children":25656},{"style":3222},[25657],{"type":26,"value":2602},{"type":21,"tag":2314,"props":25659,"children":25660},{"style":3157},[25661],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25663,"children":25664},{"style":2339},[25665],{"type":26,"value":25666},"300",{"type":21,"tag":2314,"props":25668,"children":25669},{"style":2321},[25670],{"type":26,"value":1309},{"type":21,"tag":2314,"props":25672,"children":25673},{"style":3222},[25674],{"type":26,"value":25675},"learning_rate",{"type":21,"tag":2314,"props":25677,"children":25678},{"style":3157},[25679],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25681,"children":25682},{"style":2339},[25683],{"type":26,"value":14826},{"type":21,"tag":2314,"props":25685,"children":25686},{"style":2321},[25687],{"type":26,"value":1309},{"type":21,"tag":2314,"props":25689,"children":25690},{"style":3222},[25691],{"type":26,"value":25692},"perturbation",{"type":21,"tag":2314,"props":25694,"children":25695},{"style":3157},[25696],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25698,"children":25699},{"style":2339},[25700],{"type":26,"value":4363},{"type":21,"tag":2314,"props":25702,"children":25703},{"style":2321},[25704],{"type":26,"value":3257},{"type":21,"tag":2314,"props":25706,"children":25707},{"class":2316,"line":16},[25708],{"type":21,"tag":2314,"props":25709,"children":25710},{"emptyLinePlaceholder":3181},[25711],{"type":26,"value":3184},{"type":21,"tag":2314,"props":25713,"children":25714},{"class":2316,"line":127},[25715],{"type":21,"tag":2314,"props":25716,"children":25717},{"style":3407},[25718],{"type":26,"value":25719},"# For 10 parameters:\n",{"type":21,"tag":2314,"props":25721,"children":25722},{"class":2316,"line":887},[25723],{"type":21,"tag":2314,"props":25724,"children":25725},{"style":3407},[25726],{"type":26,"value":25727},"# - Parameter shift: 2×10 = 20 evals\u002Fstep × 300 steps = 6,000 total\n",{"type":21,"tag":2314,"props":25729,"children":25730},{"class":2316,"line":1364},[25731],{"type":21,"tag":2314,"props":25732,"children":25733},{"style":3407},[25734],{"type":26,"value":25735},"# - SPSA: 2 evals\u002Fstep × 300 steps = 600 total  ← 10x reduction\n",{"type":21,"tag":22,"props":25737,"children":25738},{},[25739,25744],{"type":21,"tag":136,"props":25740,"children":25741},{},[25742],{"type":26,"value":25743},"最适用于：",{"type":26,"value":25745}," 电路含有大量参数（> 10）时。代价是每一步的收敛更慢，但总采样次数更少。",{"type":21,"tag":29,"props":25747,"children":25749},{"id":25748},"技巧-5提前终止-方差阈值",[25750],{"type":26,"value":25751},"技巧 5：提前终止 + 方差阈值",{"type":21,"tag":22,"props":25753,"children":25754},{},[25755],{"type":26,"value":25756},"当结果已经足够好时，不要把电路运行到底：",{"type":21,"tag":2304,"props":25758,"children":25760},{"className":3145,"code":25759,"language":3147,"meta":7,"style":7},"from pennylane.optimize import AdamOptimizer\nimport numpy as np\n\nopt = AdamOptimizer(stepsize=0.02)\nparams = init_params.copy()\nprev_energy = float('inf')\n\nfor step in range(max_steps):\n    params, energy = opt.step_and_cost(circuit, params)\n\n    # Stop when change is below shot-noise floor\n    variance = 1.0 \u002F np.sqrt(shots_per_eval)  # shot noise floor\n    if abs(energy - prev_energy) \u003C variance:\n        print(f\"Converged at step {step}\")\n        break\n\n    prev_energy = energy\n",[25761],{"type":21,"tag":2073,"props":25762,"children":25763},{"__ignoreMap":7},[25764,25784,25803,25810,25842,25858,25888,25895,25919,25935,25942,25950,25982,26018,26058,26066,26073],{"type":21,"tag":2314,"props":25765,"children":25766},{"class":2316,"line":2317},[25767,25771,25775,25779],{"type":21,"tag":2314,"props":25768,"children":25769},{"style":3157},[25770],{"type":26,"value":3160},{"type":21,"tag":2314,"props":25772,"children":25773},{"style":2321},[25774],{"type":26,"value":25007},{"type":21,"tag":2314,"props":25776,"children":25777},{"style":3157},[25778],{"type":26,"value":3170},{"type":21,"tag":2314,"props":25780,"children":25781},{"style":2321},[25782],{"type":26,"value":25783}," AdamOptimizer\n",{"type":21,"tag":2314,"props":25785,"children":25786},{"class":2316,"line":106},[25787,25791,25795,25799],{"type":21,"tag":2314,"props":25788,"children":25789},{"style":3157},[25790],{"type":26,"value":3170},{"type":21,"tag":2314,"props":25792,"children":25793},{"style":2321},[25794],{"type":26,"value":4227},{"type":21,"tag":2314,"props":25796,"children":25797},{"style":3157},[25798],{"type":26,"value":4232},{"type":21,"tag":2314,"props":25800,"children":25801},{"style":2321},[25802],{"type":26,"value":4237},{"type":21,"tag":2314,"props":25804,"children":25805},{"class":2316,"line":2335},[25806],{"type":21,"tag":2314,"props":25807,"children":25808},{"emptyLinePlaceholder":3181},[25809],{"type":26,"value":3184},{"type":21,"tag":2314,"props":25811,"children":25812},{"class":2316,"line":2397},[25813,25817,25821,25826,25830,25834,25838],{"type":21,"tag":2314,"props":25814,"children":25815},{"style":2321},[25816],{"type":26,"value":14905},{"type":21,"tag":2314,"props":25818,"children":25819},{"style":3157},[25820],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25822,"children":25823},{"style":2321},[25824],{"type":26,"value":25825}," AdamOptimizer(",{"type":21,"tag":2314,"props":25827,"children":25828},{"style":3222},[25829],{"type":26,"value":14919},{"type":21,"tag":2314,"props":25831,"children":25832},{"style":3157},[25833],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25835,"children":25836},{"style":2339},[25837],{"type":26,"value":4349},{"type":21,"tag":2314,"props":25839,"children":25840},{"style":2321},[25841],{"type":26,"value":3257},{"type":21,"tag":2314,"props":25843,"children":25844},{"class":2316,"line":2421},[25845,25849,25853],{"type":21,"tag":2314,"props":25846,"children":25847},{"style":2321},[25848],{"type":26,"value":25187},{"type":21,"tag":2314,"props":25850,"children":25851},{"style":3157},[25852],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25854,"children":25855},{"style":2321},[25856],{"type":26,"value":25857}," init_params.copy()\n",{"type":21,"tag":2314,"props":25859,"children":25860},{"class":2316,"line":16},[25861,25866,25870,25875,25879,25884],{"type":21,"tag":2314,"props":25862,"children":25863},{"style":2321},[25864],{"type":26,"value":25865},"prev_energy ",{"type":21,"tag":2314,"props":25867,"children":25868},{"style":3157},[25869],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25871,"children":25872},{"style":2339},[25873],{"type":26,"value":25874}," float",{"type":21,"tag":2314,"props":25876,"children":25877},{"style":2321},[25878],{"type":26,"value":3277},{"type":21,"tag":2314,"props":25880,"children":25881},{"style":2350},[25882],{"type":26,"value":25883},"'inf'",{"type":21,"tag":2314,"props":25885,"children":25886},{"style":2321},[25887],{"type":26,"value":3257},{"type":21,"tag":2314,"props":25889,"children":25890},{"class":2316,"line":127},[25891],{"type":21,"tag":2314,"props":25892,"children":25893},{"emptyLinePlaceholder":3181},[25894],{"type":26,"value":3184},{"type":21,"tag":2314,"props":25896,"children":25897},{"class":2316,"line":887},[25898,25902,25906,25910,25914],{"type":21,"tag":2314,"props":25899,"children":25900},{"style":3157},[25901],{"type":26,"value":3450},{"type":21,"tag":2314,"props":25903,"children":25904},{"style":2321},[25905],{"type":26,"value":14967},{"type":21,"tag":2314,"props":25907,"children":25908},{"style":3157},[25909],{"type":26,"value":3460},{"type":21,"tag":2314,"props":25911,"children":25912},{"style":2339},[25913],{"type":26,"value":3465},{"type":21,"tag":2314,"props":25915,"children":25916},{"style":2321},[25917],{"type":26,"value":25918},"(max_steps):\n",{"type":21,"tag":2314,"props":25920,"children":25921},{"class":2316,"line":1364},[25922,25927,25931],{"type":21,"tag":2314,"props":25923,"children":25924},{"style":2321},[25925],{"type":26,"value":25926},"    params, energy ",{"type":21,"tag":2314,"props":25928,"children":25929},{"style":3157},[25930],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25932,"children":25933},{"style":2321},[25934],{"type":26,"value":25254},{"type":21,"tag":2314,"props":25936,"children":25937},{"class":2316,"line":3403},[25938],{"type":21,"tag":2314,"props":25939,"children":25940},{"emptyLinePlaceholder":3181},[25941],{"type":26,"value":3184},{"type":21,"tag":2314,"props":25943,"children":25944},{"class":2316,"line":3413},[25945],{"type":21,"tag":2314,"props":25946,"children":25947},{"style":3407},[25948],{"type":26,"value":25949},"    # Stop when change is below shot-noise floor\n",{"type":21,"tag":2314,"props":25951,"children":25952},{"class":2316,"line":436},[25953,25958,25962,25967,25972,25977],{"type":21,"tag":2314,"props":25954,"children":25955},{"style":2321},[25956],{"type":26,"value":25957},"    variance ",{"type":21,"tag":2314,"props":25959,"children":25960},{"style":3157},[25961],{"type":26,"value":3197},{"type":21,"tag":2314,"props":25963,"children":25964},{"style":2339},[25965],{"type":26,"value":25966}," 1.0",{"type":21,"tag":2314,"props":25968,"children":25969},{"style":3157},[25970],{"type":26,"value":25971}," \u002F",{"type":21,"tag":2314,"props":25973,"children":25974},{"style":2321},[25975],{"type":26,"value":25976}," np.sqrt(shots_per_eval)  ",{"type":21,"tag":2314,"props":25978,"children":25979},{"style":3407},[25980],{"type":26,"value":25981},"# shot noise floor\n",{"type":21,"tag":2314,"props":25983,"children":25984},{"class":2316,"line":3473},[25985,25989,25994,25999,26003,26008,26013],{"type":21,"tag":2314,"props":25986,"children":25987},{"style":3157},[25988],{"type":26,"value":11900},{"type":21,"tag":2314,"props":25990,"children":25991},{"style":2339},[25992],{"type":26,"value":25993}," abs",{"type":21,"tag":2314,"props":25995,"children":25996},{"style":2321},[25997],{"type":26,"value":25998},"(energy ",{"type":21,"tag":2314,"props":26000,"children":26001},{"style":3157},[26002],{"type":26,"value":4802},{"type":21,"tag":2314,"props":26004,"children":26005},{"style":2321},[26006],{"type":26,"value":26007}," prev_energy) ",{"type":21,"tag":2314,"props":26009,"children":26010},{"style":3157},[26011],{"type":26,"value":26012},"\u003C",{"type":21,"tag":2314,"props":26014,"children":26015},{"style":2321},[26016],{"type":26,"value":26017}," variance:\n",{"type":21,"tag":2314,"props":26019,"children":26020},{"class":2316,"line":3521},[26021,26025,26029,26033,26038,26042,26046,26050,26054],{"type":21,"tag":2314,"props":26022,"children":26023},{"style":2339},[26024],{"type":26,"value":12846},{"type":21,"tag":2314,"props":26026,"children":26027},{"style":2321},[26028],{"type":26,"value":3277},{"type":21,"tag":2314,"props":26030,"children":26031},{"style":3157},[26032],{"type":26,"value":3282},{"type":21,"tag":2314,"props":26034,"children":26035},{"style":2350},[26036],{"type":26,"value":26037},"\"Converged at step ",{"type":21,"tag":2314,"props":26039,"children":26040},{"style":2339},[26041],{"type":26,"value":3292},{"type":21,"tag":2314,"props":26043,"children":26044},{"style":2321},[26045],{"type":26,"value":15193},{"type":21,"tag":2314,"props":26047,"children":26048},{"style":2339},[26049],{"type":26,"value":3302},{"type":21,"tag":2314,"props":26051,"children":26052},{"style":2350},[26053],{"type":26,"value":3307},{"type":21,"tag":2314,"props":26055,"children":26056},{"style":2321},[26057],{"type":26,"value":3257},{"type":21,"tag":2314,"props":26059,"children":26060},{"class":2316,"line":3563},[26061],{"type":21,"tag":2314,"props":26062,"children":26063},{"style":3157},[26064],{"type":26,"value":26065},"        break\n",{"type":21,"tag":2314,"props":26067,"children":26068},{"class":2316,"line":4585},[26069],{"type":21,"tag":2314,"props":26070,"children":26071},{"emptyLinePlaceholder":3181},[26072],{"type":26,"value":3184},{"type":21,"tag":2314,"props":26074,"children":26075},{"class":2316,"line":4604},[26076,26081,26085],{"type":21,"tag":2314,"props":26077,"children":26078},{"style":2321},[26079],{"type":26,"value":26080},"    prev_energy ",{"type":21,"tag":2314,"props":26082,"children":26083},{"style":3157},[26084],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26086,"children":26087},{"style":2321},[26088],{"type":26,"value":26089}," energy\n",{"type":21,"tag":22,"props":26091,"children":26092},{},[26093],{"type":26,"value":26094},"许多 VQE 运行会提前进入平台期——继续运行只是把采样浪费在噪声波动上。",{"type":21,"tag":29,"props":26096,"children":26098},{"id":26097},"技巧-6热启动",[26099],{"type":26,"value":26100},"技巧 6：热启动",{"type":21,"tag":22,"props":26102,"children":26103},{},[26104],{"type":26,"value":26105},"用相关的经典解而非随机值来初始化 QAOA 或 VQE 参数：",{"type":21,"tag":2304,"props":26107,"children":26109},{"className":3145,"code":26108,"language":3147,"meta":7,"style":7},"# For QAOA on Max-Cut: warm start from a greedy classical solution\nimport networkx as nx\n\nG = nx.from_edgelist(edges)\nclassical_cut = nx.algorithms.approximation.one_exchange(G)\n\n# Map classical solution to initial QAOA angles\n# γ₀ ≈ π\u002F4 for a good cut, β₀ ≈ π\u002F8\ninit_gamma = [np.pi \u002F 4]\ninit_beta = [np.pi \u002F 8]\n\n# Warm-started QAOA typically converges in 30-50% fewer iterations\n",[26110],{"type":21,"tag":2073,"props":26111,"children":26112},{"__ignoreMap":7},[26113,26121,26142,26149,26166,26183,26190,26198,26206,26235,26264,26271],{"type":21,"tag":2314,"props":26114,"children":26115},{"class":2316,"line":2317},[26116],{"type":21,"tag":2314,"props":26117,"children":26118},{"style":3407},[26119],{"type":26,"value":26120},"# For QAOA on Max-Cut: warm start from a greedy classical solution\n",{"type":21,"tag":2314,"props":26122,"children":26123},{"class":2316,"line":106},[26124,26128,26133,26137],{"type":21,"tag":2314,"props":26125,"children":26126},{"style":3157},[26127],{"type":26,"value":3170},{"type":21,"tag":2314,"props":26129,"children":26130},{"style":2321},[26131],{"type":26,"value":26132}," networkx ",{"type":21,"tag":2314,"props":26134,"children":26135},{"style":3157},[26136],{"type":26,"value":4232},{"type":21,"tag":2314,"props":26138,"children":26139},{"style":2321},[26140],{"type":26,"value":26141}," nx\n",{"type":21,"tag":2314,"props":26143,"children":26144},{"class":2316,"line":2335},[26145],{"type":21,"tag":2314,"props":26146,"children":26147},{"emptyLinePlaceholder":3181},[26148],{"type":26,"value":3184},{"type":21,"tag":2314,"props":26150,"children":26151},{"class":2316,"line":2397},[26152,26157,26161],{"type":21,"tag":2314,"props":26153,"children":26154},{"style":2321},[26155],{"type":26,"value":26156},"G ",{"type":21,"tag":2314,"props":26158,"children":26159},{"style":3157},[26160],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26162,"children":26163},{"style":2321},[26164],{"type":26,"value":26165}," nx.from_edgelist(edges)\n",{"type":21,"tag":2314,"props":26167,"children":26168},{"class":2316,"line":2421},[26169,26174,26178],{"type":21,"tag":2314,"props":26170,"children":26171},{"style":2321},[26172],{"type":26,"value":26173},"classical_cut ",{"type":21,"tag":2314,"props":26175,"children":26176},{"style":3157},[26177],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26179,"children":26180},{"style":2321},[26181],{"type":26,"value":26182}," nx.algorithms.approximation.one_exchange(G)\n",{"type":21,"tag":2314,"props":26184,"children":26185},{"class":2316,"line":16},[26186],{"type":21,"tag":2314,"props":26187,"children":26188},{"emptyLinePlaceholder":3181},[26189],{"type":26,"value":3184},{"type":21,"tag":2314,"props":26191,"children":26192},{"class":2316,"line":127},[26193],{"type":21,"tag":2314,"props":26194,"children":26195},{"style":3407},[26196],{"type":26,"value":26197},"# Map classical solution to initial QAOA angles\n",{"type":21,"tag":2314,"props":26199,"children":26200},{"class":2316,"line":887},[26201],{"type":21,"tag":2314,"props":26202,"children":26203},{"style":3407},[26204],{"type":26,"value":26205},"# γ₀ ≈ π\u002F4 for a good cut, β₀ ≈ π\u002F8\n",{"type":21,"tag":2314,"props":26207,"children":26208},{"class":2316,"line":1364},[26209,26214,26218,26223,26227,26231],{"type":21,"tag":2314,"props":26210,"children":26211},{"style":2321},[26212],{"type":26,"value":26213},"init_gamma ",{"type":21,"tag":2314,"props":26215,"children":26216},{"style":3157},[26217],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26219,"children":26220},{"style":2321},[26221],{"type":26,"value":26222}," [np.pi ",{"type":21,"tag":2314,"props":26224,"children":26225},{"style":3157},[26226],{"type":26,"value":2168},{"type":21,"tag":2314,"props":26228,"children":26229},{"style":2339},[26230],{"type":26,"value":8294},{"type":21,"tag":2314,"props":26232,"children":26233},{"style":2321},[26234],{"type":26,"value":6641},{"type":21,"tag":2314,"props":26236,"children":26237},{"class":2316,"line":3403},[26238,26243,26247,26251,26255,26260],{"type":21,"tag":2314,"props":26239,"children":26240},{"style":2321},[26241],{"type":26,"value":26242},"init_beta ",{"type":21,"tag":2314,"props":26244,"children":26245},{"style":3157},[26246],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26248,"children":26249},{"style":2321},[26250],{"type":26,"value":26222},{"type":21,"tag":2314,"props":26252,"children":26253},{"style":3157},[26254],{"type":26,"value":2168},{"type":21,"tag":2314,"props":26256,"children":26257},{"style":2339},[26258],{"type":26,"value":26259}," 8",{"type":21,"tag":2314,"props":26261,"children":26262},{"style":2321},[26263],{"type":26,"value":6641},{"type":21,"tag":2314,"props":26265,"children":26266},{"class":2316,"line":3413},[26267],{"type":21,"tag":2314,"props":26268,"children":26269},{"emptyLinePlaceholder":3181},[26270],{"type":26,"value":3184},{"type":21,"tag":2314,"props":26272,"children":26273},{"class":2316,"line":436},[26274],{"type":21,"tag":2314,"props":26275,"children":26276},{"style":3407},[26277],{"type":26,"value":26278},"# Warm-started QAOA typically converges in 30-50% fewer iterations\n",{"type":21,"tag":29,"props":26280,"children":26282},{"id":26281},"综合运用一个实用的-vqe-模板",[26283],{"type":26,"value":26284},"综合运用：一个实用的 VQE 模板",{"type":21,"tag":2304,"props":26286,"children":26288},{"className":3145,"code":26287,"language":3147,"meta":7,"style":7},"import pennylane as qml\nimport numpy as np\nfrom pennylane.optimize import ShotAdaptiveOptimizer\n\ndev = qml.device(\"default.qubit\", wires=n_qubits, shots=512)\n\n# 1. Group commuting terms (5-10x reduction in circuit count)\ngrouped_H = qml.Hamiltonian(*qml.grouping.group_observables(H))\n\n@qml.qnode(dev, diff_method=\"parameter-shift\")\ndef ansatz(params):\n    # Hardware-efficient ansatz\n    for i in range(n_qubits):\n        qml.RY(params[i], wires=i)\n    for i in range(n_qubits - 1):\n        qml.CNOT(wires=[i, i + 1])\n    return qml.expval(grouped_H)\n\n# 2. Use shot-adaptive optimizer\nopt = ShotAdaptiveOptimizer(min_shots=50)\n\n# 3. Warm start\nparams = warm_start_params(H)\n\n# 4. Run with early stopping\nfor step in range(300):\n    params, energy, shots = opt.step_and_cost(ansatz, params)\n    if check_convergence(energy, shots):\n        break\n\nprint(f\"Ground state energy: {energy:.4f} Ha\")\n",[26289],{"type":21,"tag":2073,"props":26290,"children":26291},{"__ignoreMap":7},[26292,26311,26330,26350,26357,26410,26417,26425,26451,26458,26485,26501,26509,26533,26554,26590,26623,26635,26642,26650,26682,26689,26697,26713,26720,26728,26759,26776,26788,26795,26802],{"type":21,"tag":2314,"props":26293,"children":26294},{"class":2316,"line":2317},[26295,26299,26303,26307],{"type":21,"tag":2314,"props":26296,"children":26297},{"style":3157},[26298],{"type":26,"value":3170},{"type":21,"tag":2314,"props":26300,"children":26301},{"style":2321},[26302],{"type":26,"value":14046},{"type":21,"tag":2314,"props":26304,"children":26305},{"style":3157},[26306],{"type":26,"value":4232},{"type":21,"tag":2314,"props":26308,"children":26309},{"style":2321},[26310],{"type":26,"value":14055},{"type":21,"tag":2314,"props":26312,"children":26313},{"class":2316,"line":106},[26314,26318,26322,26326],{"type":21,"tag":2314,"props":26315,"children":26316},{"style":3157},[26317],{"type":26,"value":3170},{"type":21,"tag":2314,"props":26319,"children":26320},{"style":2321},[26321],{"type":26,"value":4227},{"type":21,"tag":2314,"props":26323,"children":26324},{"style":3157},[26325],{"type":26,"value":4232},{"type":21,"tag":2314,"props":26327,"children":26328},{"style":2321},[26329],{"type":26,"value":4237},{"type":21,"tag":2314,"props":26331,"children":26332},{"class":2316,"line":2335},[26333,26337,26341,26345],{"type":21,"tag":2314,"props":26334,"children":26335},{"style":3157},[26336],{"type":26,"value":3160},{"type":21,"tag":2314,"props":26338,"children":26339},{"style":2321},[26340],{"type":26,"value":25007},{"type":21,"tag":2314,"props":26342,"children":26343},{"style":3157},[26344],{"type":26,"value":3170},{"type":21,"tag":2314,"props":26346,"children":26347},{"style":2321},[26348],{"type":26,"value":26349}," ShotAdaptiveOptimizer\n",{"type":21,"tag":2314,"props":26351,"children":26352},{"class":2316,"line":2397},[26353],{"type":21,"tag":2314,"props":26354,"children":26355},{"emptyLinePlaceholder":3181},[26356],{"type":26,"value":3184},{"type":21,"tag":2314,"props":26358,"children":26359},{"class":2316,"line":2421},[26360,26364,26368,26372,26376,26380,26384,26388,26393,26397,26401,26406],{"type":21,"tag":2314,"props":26361,"children":26362},{"style":2321},[26363],{"type":26,"value":14179},{"type":21,"tag":2314,"props":26365,"children":26366},{"style":3157},[26367],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26369,"children":26370},{"style":2321},[26371],{"type":26,"value":14188},{"type":21,"tag":2314,"props":26373,"children":26374},{"style":2350},[26375],{"type":26,"value":14193},{"type":21,"tag":2314,"props":26377,"children":26378},{"style":2321},[26379],{"type":26,"value":1309},{"type":21,"tag":2314,"props":26381,"children":26382},{"style":3222},[26383],{"type":26,"value":14202},{"type":21,"tag":2314,"props":26385,"children":26386},{"style":3157},[26387],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26389,"children":26390},{"style":2321},[26391],{"type":26,"value":26392},"n_qubits, ",{"type":21,"tag":2314,"props":26394,"children":26395},{"style":3222},[26396],{"type":26,"value":4077},{"type":21,"tag":2314,"props":26398,"children":26399},{"style":3157},[26400],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26402,"children":26403},{"style":2339},[26404],{"type":26,"value":26405},"512",{"type":21,"tag":2314,"props":26407,"children":26408},{"style":2321},[26409],{"type":26,"value":3257},{"type":21,"tag":2314,"props":26411,"children":26412},{"class":2316,"line":16},[26413],{"type":21,"tag":2314,"props":26414,"children":26415},{"emptyLinePlaceholder":3181},[26416],{"type":26,"value":3184},{"type":21,"tag":2314,"props":26418,"children":26419},{"class":2316,"line":127},[26420],{"type":21,"tag":2314,"props":26421,"children":26422},{"style":3407},[26423],{"type":26,"value":26424},"# 1. Group commuting terms (5-10x reduction in circuit count)\n",{"type":21,"tag":2314,"props":26426,"children":26427},{"class":2316,"line":887},[26428,26433,26437,26442,26446],{"type":21,"tag":2314,"props":26429,"children":26430},{"style":2321},[26431],{"type":26,"value":26432},"grouped_H ",{"type":21,"tag":2314,"props":26434,"children":26435},{"style":3157},[26436],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26438,"children":26439},{"style":2321},[26440],{"type":26,"value":26441}," qml.Hamiltonian(",{"type":21,"tag":2314,"props":26443,"children":26444},{"style":3157},[26445],{"type":26,"value":6347},{"type":21,"tag":2314,"props":26447,"children":26448},{"style":2321},[26449],{"type":26,"value":26450},"qml.grouping.group_observables(H))\n",{"type":21,"tag":2314,"props":26452,"children":26453},{"class":2316,"line":1364},[26454],{"type":21,"tag":2314,"props":26455,"children":26456},{"emptyLinePlaceholder":3181},[26457],{"type":26,"value":3184},{"type":21,"tag":2314,"props":26459,"children":26460},{"class":2316,"line":3403},[26461,26465,26469,26473,26477,26481],{"type":21,"tag":2314,"props":26462,"children":26463},{"style":4318},[26464],{"type":26,"value":14226},{"type":21,"tag":2314,"props":26466,"children":26467},{"style":2321},[26468],{"type":26,"value":25375},{"type":21,"tag":2314,"props":26470,"children":26471},{"style":3222},[26472],{"type":26,"value":25380},{"type":21,"tag":2314,"props":26474,"children":26475},{"style":3157},[26476],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26478,"children":26479},{"style":2350},[26480],{"type":26,"value":25389},{"type":21,"tag":2314,"props":26482,"children":26483},{"style":2321},[26484],{"type":26,"value":3257},{"type":21,"tag":2314,"props":26486,"children":26487},{"class":2316,"line":3413},[26488,26492,26497],{"type":21,"tag":2314,"props":26489,"children":26490},{"style":3157},[26491],{"type":26,"value":4315},{"type":21,"tag":2314,"props":26493,"children":26494},{"style":4318},[26495],{"type":26,"value":26496}," ansatz",{"type":21,"tag":2314,"props":26498,"children":26499},{"style":2321},[26500],{"type":26,"value":25096},{"type":21,"tag":2314,"props":26502,"children":26503},{"class":2316,"line":436},[26504],{"type":21,"tag":2314,"props":26505,"children":26506},{"style":3407},[26507],{"type":26,"value":26508},"    # Hardware-efficient ansatz\n",{"type":21,"tag":2314,"props":26510,"children":26511},{"class":2316,"line":3473},[26512,26516,26520,26524,26528],{"type":21,"tag":2314,"props":26513,"children":26514},{"style":3157},[26515],{"type":26,"value":4694},{"type":21,"tag":2314,"props":26517,"children":26518},{"style":2321},[26519],{"type":26,"value":4699},{"type":21,"tag":2314,"props":26521,"children":26522},{"style":3157},[26523],{"type":26,"value":3460},{"type":21,"tag":2314,"props":26525,"children":26526},{"style":2339},[26527],{"type":26,"value":3465},{"type":21,"tag":2314,"props":26529,"children":26530},{"style":2321},[26531],{"type":26,"value":26532},"(n_qubits):\n",{"type":21,"tag":2314,"props":26534,"children":26535},{"class":2316,"line":3521},[26536,26541,26545,26549],{"type":21,"tag":2314,"props":26537,"children":26538},{"style":2321},[26539],{"type":26,"value":26540},"        qml.RY(params[i], ",{"type":21,"tag":2314,"props":26542,"children":26543},{"style":3222},[26544],{"type":26,"value":14202},{"type":21,"tag":2314,"props":26546,"children":26547},{"style":3157},[26548],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26550,"children":26551},{"style":2321},[26552],{"type":26,"value":26553},"i)\n",{"type":21,"tag":2314,"props":26555,"children":26556},{"class":2316,"line":3563},[26557,26561,26565,26569,26573,26578,26582,26586],{"type":21,"tag":2314,"props":26558,"children":26559},{"style":3157},[26560],{"type":26,"value":4694},{"type":21,"tag":2314,"props":26562,"children":26563},{"style":2321},[26564],{"type":26,"value":4699},{"type":21,"tag":2314,"props":26566,"children":26567},{"style":3157},[26568],{"type":26,"value":3460},{"type":21,"tag":2314,"props":26570,"children":26571},{"style":2339},[26572],{"type":26,"value":3465},{"type":21,"tag":2314,"props":26574,"children":26575},{"style":2321},[26576],{"type":26,"value":26577},"(n_qubits ",{"type":21,"tag":2314,"props":26579,"children":26580},{"style":3157},[26581],{"type":26,"value":4802},{"type":21,"tag":2314,"props":26583,"children":26584},{"style":2339},[26585],{"type":26,"value":6053},{"type":21,"tag":2314,"props":26587,"children":26588},{"style":2321},[26589],{"type":26,"value":4368},{"type":21,"tag":2314,"props":26591,"children":26592},{"class":2316,"line":4585},[26593,26598,26602,26606,26611,26615,26619],{"type":21,"tag":2314,"props":26594,"children":26595},{"style":2321},[26596],{"type":26,"value":26597},"        qml.CNOT(",{"type":21,"tag":2314,"props":26599,"children":26600},{"style":3222},[26601],{"type":26,"value":14202},{"type":21,"tag":2314,"props":26603,"children":26604},{"style":3157},[26605],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26607,"children":26608},{"style":2321},[26609],{"type":26,"value":26610},"[i, i ",{"type":21,"tag":2314,"props":26612,"children":26613},{"style":3157},[26614],{"type":26,"value":6482},{"type":21,"tag":2314,"props":26616,"children":26617},{"style":2339},[26618],{"type":26,"value":6053},{"type":21,"tag":2314,"props":26620,"children":26621},{"style":2321},[26622],{"type":26,"value":3518},{"type":21,"tag":2314,"props":26624,"children":26625},{"class":2316,"line":4604},[26626,26630],{"type":21,"tag":2314,"props":26627,"children":26628},{"style":3157},[26629],{"type":26,"value":4540},{"type":21,"tag":2314,"props":26631,"children":26632},{"style":2321},[26633],{"type":26,"value":26634}," qml.expval(grouped_H)\n",{"type":21,"tag":2314,"props":26636,"children":26637},{"class":2316,"line":4612},[26638],{"type":21,"tag":2314,"props":26639,"children":26640},{"emptyLinePlaceholder":3181},[26641],{"type":26,"value":3184},{"type":21,"tag":2314,"props":26643,"children":26644},{"class":2316,"line":4643},[26645],{"type":21,"tag":2314,"props":26646,"children":26647},{"style":3407},[26648],{"type":26,"value":26649},"# 2. Use shot-adaptive optimizer\n",{"type":21,"tag":2314,"props":26651,"children":26652},{"class":2316,"line":4688},[26653,26657,26661,26665,26669,26673,26678],{"type":21,"tag":2314,"props":26654,"children":26655},{"style":2321},[26656],{"type":26,"value":14905},{"type":21,"tag":2314,"props":26658,"children":26659},{"style":3157},[26660],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26662,"children":26663},{"style":2321},[26664],{"type":26,"value":25155},{"type":21,"tag":2314,"props":26666,"children":26667},{"style":3222},[26668],{"type":26,"value":25160},{"type":21,"tag":2314,"props":26670,"children":26671},{"style":3157},[26672],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26674,"children":26675},{"style":2339},[26676],{"type":26,"value":26677},"50",{"type":21,"tag":2314,"props":26679,"children":26680},{"style":2321},[26681],{"type":26,"value":3257},{"type":21,"tag":2314,"props":26683,"children":26684},{"class":2316,"line":4727},[26685],{"type":21,"tag":2314,"props":26686,"children":26687},{"emptyLinePlaceholder":3181},[26688],{"type":26,"value":3184},{"type":21,"tag":2314,"props":26690,"children":26691},{"class":2316,"line":4745},[26692],{"type":21,"tag":2314,"props":26693,"children":26694},{"style":3407},[26695],{"type":26,"value":26696},"# 3. Warm start\n",{"type":21,"tag":2314,"props":26698,"children":26699},{"class":2316,"line":4819},[26700,26704,26708],{"type":21,"tag":2314,"props":26701,"children":26702},{"style":2321},[26703],{"type":26,"value":25187},{"type":21,"tag":2314,"props":26705,"children":26706},{"style":3157},[26707],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26709,"children":26710},{"style":2321},[26711],{"type":26,"value":26712}," warm_start_params(H)\n",{"type":21,"tag":2314,"props":26714,"children":26715},{"class":2316,"line":4847},[26716],{"type":21,"tag":2314,"props":26717,"children":26718},{"emptyLinePlaceholder":3181},[26719],{"type":26,"value":3184},{"type":21,"tag":2314,"props":26721,"children":26722},{"class":2316,"line":4876},[26723],{"type":21,"tag":2314,"props":26724,"children":26725},{"style":3407},[26726],{"type":26,"value":26727},"# 4. Run with early stopping\n",{"type":21,"tag":2314,"props":26729,"children":26730},{"class":2316,"line":4885},[26731,26735,26739,26743,26747,26751,26755],{"type":21,"tag":2314,"props":26732,"children":26733},{"style":3157},[26734],{"type":26,"value":3450},{"type":21,"tag":2314,"props":26736,"children":26737},{"style":2321},[26738],{"type":26,"value":14967},{"type":21,"tag":2314,"props":26740,"children":26741},{"style":3157},[26742],{"type":26,"value":3460},{"type":21,"tag":2314,"props":26744,"children":26745},{"style":2339},[26746],{"type":26,"value":3465},{"type":21,"tag":2314,"props":26748,"children":26749},{"style":2321},[26750],{"type":26,"value":3277},{"type":21,"tag":2314,"props":26752,"children":26753},{"style":2339},[26754],{"type":26,"value":25666},{"type":21,"tag":2314,"props":26756,"children":26757},{"style":2321},[26758],{"type":26,"value":4368},{"type":21,"tag":2314,"props":26760,"children":26761},{"class":2316,"line":4913},[26762,26767,26771],{"type":21,"tag":2314,"props":26763,"children":26764},{"style":2321},[26765],{"type":26,"value":26766},"    params, energy, shots ",{"type":21,"tag":2314,"props":26768,"children":26769},{"style":3157},[26770],{"type":26,"value":3197},{"type":21,"tag":2314,"props":26772,"children":26773},{"style":2321},[26774],{"type":26,"value":26775}," opt.step_and_cost(ansatz, params)\n",{"type":21,"tag":2314,"props":26777,"children":26778},{"class":2316,"line":4944},[26779,26783],{"type":21,"tag":2314,"props":26780,"children":26781},{"style":3157},[26782],{"type":26,"value":11900},{"type":21,"tag":2314,"props":26784,"children":26785},{"style":2321},[26786],{"type":26,"value":26787}," check_convergence(energy, shots):\n",{"type":21,"tag":2314,"props":26789,"children":26790},{"class":2316,"line":4966},[26791],{"type":21,"tag":2314,"props":26792,"children":26793},{"style":3157},[26794],{"type":26,"value":26065},{"type":21,"tag":2314,"props":26796,"children":26797},{"class":2316,"line":5012},[26798],{"type":21,"tag":2314,"props":26799,"children":26800},{"emptyLinePlaceholder":3181},[26801],{"type":26,"value":3184},{"type":21,"tag":2314,"props":26803,"children":26804},{"class":2316,"line":5025},[26805,26809,26813,26817,26822,26826,26831,26835,26839,26843],{"type":21,"tag":2314,"props":26806,"children":26807},{"style":2339},[26808],{"type":26,"value":3272},{"type":21,"tag":2314,"props":26810,"children":26811},{"style":2321},[26812],{"type":26,"value":3277},{"type":21,"tag":2314,"props":26814,"children":26815},{"style":3157},[26816],{"type":26,"value":3282},{"type":21,"tag":2314,"props":26818,"children":26819},{"style":2350},[26820],{"type":26,"value":26821},"\"Ground state energy: ",{"type":21,"tag":2314,"props":26823,"children":26824},{"style":2339},[26825],{"type":26,"value":3292},{"type":21,"tag":2314,"props":26827,"children":26828},{"style":2321},[26829],{"type":26,"value":26830},"energy",{"type":21,"tag":2314,"props":26832,"children":26833},{"style":3157},[26834],{"type":26,"value":3604},{"type":21,"tag":2314,"props":26836,"children":26837},{"style":2339},[26838],{"type":26,"value":3302},{"type":21,"tag":2314,"props":26840,"children":26841},{"style":2350},[26842],{"type":26,"value":19391},{"type":21,"tag":2314,"props":26844,"children":26845},{"style":2321},[26846],{"type":26,"value":3257},{"type":21,"tag":29,"props":26848,"children":26850},{"id":26849},"速查表各方法的采样预算",[26851],{"type":26,"value":26852},"速查表：各方法的采样预算",{"type":21,"tag":4020,"props":26854,"children":26855},{},[26856,26877],{"type":21,"tag":4024,"props":26857,"children":26858},{},[26859],{"type":21,"tag":4028,"props":26860,"children":26861},{},[26862,26867,26872],{"type":21,"tag":4032,"props":26863,"children":26864},{},[26865],{"type":26,"value":26866},"方法",{"type":21,"tag":4032,"props":26868,"children":26869},{},[26870],{"type":26,"value":26871},"每步采样次数",{"type":21,"tag":4032,"props":26873,"children":26874},{},[26875],{"type":26,"value":26876},"最适用于",{"type":21,"tag":4046,"props":26878,"children":26879},{},[26880,26902,26924,26946,26964],{"type":21,"tag":4028,"props":26881,"children":26882},{},[26883,26888,26897],{"type":21,"tag":4053,"props":26884,"children":26885},{},[26886],{"type":26,"value":26887},"COBYLA + 固定采样",{"type":21,"tag":4053,"props":26889,"children":26890},{},[26891],{"type":21,"tag":2073,"props":26892,"children":26894},{"className":26893},[],[26895],{"type":26,"value":26896},"n_terms × shots",{"type":21,"tag":4053,"props":26898,"children":26899},{},[26900],{"type":26,"value":26901},"参数数量较少",{"type":21,"tag":4028,"props":26903,"children":26904},{},[26905,26910,26919],{"type":21,"tag":4053,"props":26906,"children":26907},{},[26908],{"type":26,"value":26909},"参数移位 + Adam",{"type":21,"tag":4053,"props":26911,"children":26912},{},[26913],{"type":21,"tag":2073,"props":26914,"children":26916},{"className":26915},[],[26917],{"type":26,"value":26918},"2n_params × shots",{"type":21,"tag":4053,"props":26920,"children":26921},{},[26922],{"type":26,"value":26923},"可微电路",{"type":21,"tag":4028,"props":26925,"children":26926},{},[26927,26932,26941],{"type":21,"tag":4053,"props":26928,"children":26929},{},[26930],{"type":26,"value":26931},"SPSA",{"type":21,"tag":4053,"props":26933,"children":26934},{},[26935],{"type":21,"tag":2073,"props":26936,"children":26938},{"className":26937},[],[26939],{"type":26,"value":26940},"2 × shots",{"type":21,"tag":4053,"props":26942,"children":26943},{},[26944],{"type":26,"value":26945},"参数数量较多",{"type":21,"tag":4028,"props":26947,"children":26948},{},[26949,26954,26959],{"type":21,"tag":4053,"props":26950,"children":26951},{},[26952],{"type":26,"value":26953},"ShotAdaptiveOptimizer",{"type":21,"tag":4053,"props":26955,"children":26956},{},[26957],{"type":26,"value":26958},"自适应",{"type":21,"tag":4053,"props":26960,"children":26961},{},[26962],{"type":26,"value":26963},"通用 VQE",{"type":21,"tag":4028,"props":26965,"children":26966},{},[26967,26972,26977],{"type":21,"tag":4053,"props":26968,"children":26969},{},[26970],{"type":26,"value":26971},"分组 Pauli",{"type":21,"tag":4053,"props":26973,"children":26974},{},[26975],{"type":26,"value":26976},"÷5–15×",{"type":21,"tag":4053,"props":26978,"children":26979},{},[26980],{"type":26,"value":26981},"始终优先应用",{"type":21,"tag":22,"props":26983,"children":26984},{},[26985],{"type":26,"value":26986},"请优先应用测量分组——它是单项收益最大的手段，而且无需改动你的优化器或电路。",{"type":21,"tag":22,"props":26988,"children":26989},{},[26990,26995,26996,27001,27002,27007,27008],{"type":21,"tag":136,"props":26991,"children":26992},{},[26993],{"type":26,"value":26994},"相关内容：",{"type":26,"value":1301},{"type":21,"tag":46,"props":26997,"children":26998},{"href":292},[26999],{"type":26,"value":27000},"VQE with PennyLane",{"type":26,"value":7066},{"type":21,"tag":46,"props":27003,"children":27004},{"href":99},[27005],{"type":26,"value":27006},"QPU access guide",{"type":26,"value":7066},{"type":21,"tag":46,"props":27009,"children":27010},{"href":18964},[27011],{"type":26,"value":18967},{"type":21,"tag":2688,"props":27013,"children":27014},{},[27015],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":27017},[27018,27019,27020,27021,27022,27023,27024,27025,27026],{"id":24503,"depth":106,"text":24503},{"id":24647,"depth":106,"text":24650},{"id":24973,"depth":106,"text":24976},{"id":25325,"depth":106,"text":25328},{"id":25571,"depth":106,"text":25574},{"id":25748,"depth":106,"text":25751},{"id":26097,"depth":106,"text":26100},{"id":26281,"depth":106,"text":26284},{"id":26849,"depth":106,"text":26852},"content:zh:blog:reduce-shot-count.md","zh\u002Fblog\u002Freduce-shot-count.md","zh\u002Fblog\u002Freduce-shot-count",{"_path":27031,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":27032,"description":27033,"date":27034,"updatedDate":10,"author":11,"tags":27035,"readingTime":887,"body":27037,"_type":111,"_id":28839,"_source":113,"_file":28840,"_stem":28841,"_extension":116},"\u002Fzh\u002Fblog\u002Fibm-quantum-free-tier-2026","IBM Quantum 免费套餐：2026 年你能使用的一切","详细解读 IBM Quantum 免费 Open Plan 包含哪些内容、排队时间如何运作，以及如何充分利用你的免费 QPU 使用权。","2026-02-20",[27036,13,1363],"IBM",{"type":18,"children":27038,"toc":28825},[27039,27044,27049,27061,27116,27121,27127,27155,27176,27196,27202,27207,27313,27318,27560,27566,27572,27584,27590,27617,27623,27628,27739,27752,27758,28402,28407,28412,28438,28446,28477,28482,28487,28566,28571,28577,28582,28811,28821],{"type":21,"tag":22,"props":27040,"children":27041},{},[27042],{"type":26,"value":27043},"IBM Quantum 拥有量子计算行业中最易获取的免费套餐。只需一个免费的 IBM ID，你就能访问最多 127 个量子比特的真实量子处理器，无需付费、无需信用卡、无需申请。下面就来说明这在实践中究竟意味着什么。",{"type":21,"tag":29,"props":27045,"children":27047},{"id":27046},"免费套餐包含哪些内容",[27048],{"type":26,"value":27046},{"type":21,"tag":22,"props":27050,"children":27051},{},[27052,27054,27059],{"type":26,"value":27053},"IBM Quantum 的 ",{"type":21,"tag":136,"props":27055,"children":27056},{},[27057],{"type":26,"value":27058},"Open Plan",{"type":26,"value":27060}," 为你提供：",{"type":21,"tag":3080,"props":27062,"children":27063},{},[27064,27074,27086,27096,27106],{"type":21,"tag":3084,"props":27065,"children":27066},{},[27067,27072],{"type":21,"tag":136,"props":27068,"children":27069},{},[27070],{"type":26,"value":27071},"无限访问",{"type":26,"value":27073},"所有公开可用的量子系统",{"type":21,"tag":3084,"props":27075,"children":27076},{},[27077,27079,27084],{"type":26,"value":27078},"每月 ",{"type":21,"tag":136,"props":27080,"children":27081},{},[27082],{"type":26,"value":27083},"10 分钟的量子时间",{"type":26,"value":27085},"（你的电路在 QPU 上实际运行的时间）",{"type":21,"tag":3084,"props":27087,"children":27088},{},[27089,27094],{"type":21,"tag":136,"props":27090,"children":27091},{},[27092],{"type":26,"value":27093},"访问 IBM 模拟器",{"type":26,"value":27095},"且无时间限制（statevector、QASM、matrix product state）",{"type":21,"tag":3084,"props":27097,"children":27098},{},[27099,27104],{"type":21,"tag":136,"props":27100,"children":27101},{},[27102],{"type":26,"value":27103},"Qiskit Runtime",{"type":26,"value":27105},"：IBM 现代化的电路执行环境",{"type":21,"tag":3084,"props":27107,"children":27108},{},[27109,27114],{"type":21,"tag":136,"props":27110,"children":27111},{},[27112],{"type":26,"value":27113},"IBM Quantum Learning",{"type":26,"value":27115}," 平台，包含教程和课程",{"type":21,"tag":22,"props":27117,"children":27118},{},[27119],{"type":26,"value":27120},"每月 10 分钟的限制听起来很受限，但实际上大多数研究电路的实际 QPU 运行时间仅为毫秒级。对于试验量子算法的个人开发者来说，很少会触及这个上限。",{"type":21,"tag":29,"props":27122,"children":27124},{"id":27123},"_2026年8月更新heron-r2-与额外计算时长",[27125],{"type":26,"value":27126},"2026年8月更新：Heron r2 与额外计算时长",{"type":21,"tag":22,"props":27128,"children":27129},{},[27130,27132,27138,27140,27145,27147,27153],{"type":26,"value":27131},"IBM 于2026年3月将其性能更强的 Heron r2 处理器（",{"type":21,"tag":2073,"props":27133,"children":27135},{"className":27134},[],[27136],{"type":26,"value":27137},"ibm_kingston",{"type":26,"value":27139},"）加入 Open Plan，使免费层用户能够获得比最初的 Heron r1 系统明显更好的双量子比特门保真度。如果你有一段时间没有运行任务了，值得检查一下 ",{"type":21,"tag":2073,"props":27141,"children":27143},{"className":27142},[],[27144],{"type":26,"value":27137},{"type":26,"value":27146}," 是否出现在你的 ",{"type":21,"tag":2073,"props":27148,"children":27150},{"className":27149},[],[27151],{"type":26,"value":27152},"service.backends()",{"type":26,"value":27154}," 列表中。",{"type":21,"tag":22,"props":27156,"children":27157},{},[27158,27160,27165,27167,27174],{"type":26,"value":27159},"IBM 还为活跃用户推出了一次性优惠：在任意12个月窗口期内累计使用过至少20分钟 QPU 时间的用户，可以选择加入一项优惠，在接下来的12个月内额外获得 ",{"type":21,"tag":136,"props":27161,"children":27162},{},[27163],{"type":26,"value":27164},"180分钟",{"type":26,"value":27166},"的计算时长，是标准月度额度的18倍。该优惠仅限于特定的报名窗口期，并非 Open Plan 每月10分钟基准的永久性调整，因此不要假设它仍然有效。请查看 ",{"type":21,"tag":46,"props":27168,"children":27171},{"href":27169,"rel":27170},"https:\u002F\u002Fquantum.cloud.ibm.com\u002Fdocs\u002Fen\u002Fguides\u002Fplans-overview",[899],[27172],{"type":26,"value":27173},"Open Plan 页面",{"type":26,"value":27175},"以了解你的账户当前的实际情况。",{"type":21,"tag":22,"props":27177,"children":27178},{},[27179,27181,27187,27189,27194],{"type":26,"value":27180},"可用系统的变化也有另一面，IBM 已于2026年4月初退役了 ",{"type":21,"tag":2073,"props":27182,"children":27184},{"className":27183},[],[27185],{"type":26,"value":27186},"ibm_torino",{"type":26,"value":27188},"，这是 Open Plan 运作的正常组成部分：随着更新的硬件上线，系统会被加入，旧系统在使用寿命结束后也会被淘汰。这正是下方 ",{"type":21,"tag":2073,"props":27190,"children":27192},{"className":27191},[],[27193],{"type":26,"value":27152},{"type":26,"value":27195}," 代码片段比任何静态表格都更重要的原因。请将本文中的列表视为某一时刻的快照，而非实时状态。",{"type":21,"tag":29,"props":27197,"children":27199},{"id":27198},"可用的免费-qpu",[27200],{"type":26,"value":27201},"可用的免费 QPU",{"type":21,"tag":22,"props":27203,"children":27204},{},[27205],{"type":26,"value":27206},"截至2026年年中，IBM 的 Open Plan 提供以下系统的访问权限：",{"type":21,"tag":4020,"props":27208,"children":27209},{},[27210,27236],{"type":21,"tag":4024,"props":27211,"children":27212},{},[27213],{"type":21,"tag":4028,"props":27214,"children":27215},{},[27216,27221,27226,27231],{"type":21,"tag":4032,"props":27217,"children":27218},{},[27219],{"type":26,"value":27220},"系统",{"type":21,"tag":4032,"props":27222,"children":27223},{},[27224],{"type":26,"value":27225},"量子比特",{"type":21,"tag":4032,"props":27227,"children":27228},{},[27229],{"type":26,"value":27230},"技术",{"type":21,"tag":4032,"props":27232,"children":27233},{},[27234],{"type":26,"value":27235},"典型排队时间",{"type":21,"tag":4046,"props":27237,"children":27238},{},[27239,27268,27291],{"type":21,"tag":4028,"props":27240,"children":27241},{},[27242,27253,27258,27263],{"type":21,"tag":4053,"props":27243,"children":27244},{},[27245,27247,27252],{"type":26,"value":27246},"IBM Heron r2（",{"type":21,"tag":2073,"props":27248,"children":27250},{"className":27249},[],[27251],{"type":26,"value":27137},{"type":26,"value":20888},{"type":21,"tag":4053,"props":27254,"children":27255},{},[27256],{"type":26,"value":27257},"156",{"type":21,"tag":4053,"props":27259,"children":27260},{},[27261],{"type":26,"value":27262},"Heron 处理器，更高保真度",{"type":21,"tag":4053,"props":27264,"children":27265},{},[27266],{"type":26,"value":27267},"30–120 分钟",{"type":21,"tag":4028,"props":27269,"children":27270},{},[27271,27276,27281,27286],{"type":21,"tag":4053,"props":27272,"children":27273},{},[27274],{"type":26,"value":27275},"IBM Eagle",{"type":21,"tag":4053,"props":27277,"children":27278},{},[27279],{"type":26,"value":27280},"127",{"type":21,"tag":4053,"props":27282,"children":27283},{},[27284],{"type":26,"value":27285},"超导",{"type":21,"tag":4053,"props":27287,"children":27288},{},[27289],{"type":26,"value":27290},"10–60 分钟",{"type":21,"tag":4028,"props":27292,"children":27293},{},[27294,27299,27304,27309],{"type":21,"tag":4053,"props":27295,"children":27296},{},[27297],{"type":26,"value":27298},"IBM Heron r1",{"type":21,"tag":4053,"props":27300,"children":27301},{},[27302],{"type":26,"value":27303},"133",{"type":21,"tag":4053,"props":27305,"children":27306},{},[27307],{"type":26,"value":27308},"Heron 处理器",{"type":21,"tag":4053,"props":27310,"children":27311},{},[27312],{"type":26,"value":27267},{"type":21,"tag":22,"props":27314,"children":27315},{},[27316],{"type":26,"value":27317},"IBM 会定期淘汰旧系统并加入新系统。请将此表视为快照，而非保证。使用 Qiskit Runtime 服务查看当前列表：",{"type":21,"tag":2304,"props":27319,"children":27321},{"className":3145,"code":27320,"language":3147,"meta":7,"style":7},"from qiskit_ibm_runtime import QiskitRuntimeService\n\nservice = QiskitRuntimeService(channel=\"ibm_quantum\")\nbackends = service.backends(\n    operational=True,\n    simulator=False,\n    min_num_qubits=1\n)\nfor b in backends:\n    print(f\"{b.name}: {b.num_qubits} qubits, status: {b.status().status_msg}\")\n",[27322],{"type":21,"tag":2073,"props":27323,"children":27324},{"__ignoreMap":7},[27325,27344,27351,27384,27401,27421,27441,27458,27465,27485],{"type":21,"tag":2314,"props":27326,"children":27327},{"class":2316,"line":2317},[27328,27332,27336,27340],{"type":21,"tag":2314,"props":27329,"children":27330},{"style":3157},[27331],{"type":26,"value":3160},{"type":21,"tag":2314,"props":27333,"children":27334},{"style":2321},[27335],{"type":26,"value":3165},{"type":21,"tag":2314,"props":27337,"children":27338},{"style":3157},[27339],{"type":26,"value":3170},{"type":21,"tag":2314,"props":27341,"children":27342},{"style":2321},[27343],{"type":26,"value":3175},{"type":21,"tag":2314,"props":27345,"children":27346},{"class":2316,"line":106},[27347],{"type":21,"tag":2314,"props":27348,"children":27349},{"emptyLinePlaceholder":3181},[27350],{"type":26,"value":3184},{"type":21,"tag":2314,"props":27352,"children":27353},{"class":2316,"line":2335},[27354,27358,27362,27367,27372,27376,27380],{"type":21,"tag":2314,"props":27355,"children":27356},{"style":2321},[27357],{"type":26,"value":3192},{"type":21,"tag":2314,"props":27359,"children":27360},{"style":3157},[27361],{"type":26,"value":3197},{"type":21,"tag":2314,"props":27363,"children":27364},{"style":2321},[27365],{"type":26,"value":27366}," QiskitRuntimeService(",{"type":21,"tag":2314,"props":27368,"children":27369},{"style":3222},[27370],{"type":26,"value":27371},"channel",{"type":21,"tag":2314,"props":27373,"children":27374},{"style":3157},[27375],{"type":26,"value":3197},{"type":21,"tag":2314,"props":27377,"children":27378},{"style":2350},[27379],{"type":26,"value":20685},{"type":21,"tag":2314,"props":27381,"children":27382},{"style":2321},[27383],{"type":26,"value":3257},{"type":21,"tag":2314,"props":27385,"children":27386},{"class":2316,"line":2397},[27387,27392,27396],{"type":21,"tag":2314,"props":27388,"children":27389},{"style":2321},[27390],{"type":26,"value":27391},"backends ",{"type":21,"tag":2314,"props":27393,"children":27394},{"style":3157},[27395],{"type":26,"value":3197},{"type":21,"tag":2314,"props":27397,"children":27398},{"style":2321},[27399],{"type":26,"value":27400}," service.backends(\n",{"type":21,"tag":2314,"props":27402,"children":27403},{"class":2316,"line":2421},[27404,27409,27413,27417],{"type":21,"tag":2314,"props":27405,"children":27406},{"style":3222},[27407],{"type":26,"value":27408},"    operational",{"type":21,"tag":2314,"props":27410,"children":27411},{"style":3157},[27412],{"type":26,"value":3197},{"type":21,"tag":2314,"props":27414,"children":27415},{"style":2339},[27416],{"type":26,"value":3234},{"type":21,"tag":2314,"props":27418,"children":27419},{"style":2321},[27420],{"type":26,"value":2418},{"type":21,"tag":2314,"props":27422,"children":27423},{"class":2316,"line":16},[27424,27429,27433,27437],{"type":21,"tag":2314,"props":27425,"children":27426},{"style":3222},[27427],{"type":26,"value":27428},"    simulator",{"type":21,"tag":2314,"props":27430,"children":27431},{"style":3157},[27432],{"type":26,"value":3197},{"type":21,"tag":2314,"props":27434,"children":27435},{"style":2339},[27436],{"type":26,"value":3252},{"type":21,"tag":2314,"props":27438,"children":27439},{"style":2321},[27440],{"type":26,"value":2418},{"type":21,"tag":2314,"props":27442,"children":27443},{"class":2316,"line":127},[27444,27449,27453],{"type":21,"tag":2314,"props":27445,"children":27446},{"style":3222},[27447],{"type":26,"value":27448},"    min_num_qubits",{"type":21,"tag":2314,"props":27450,"children":27451},{"style":3157},[27452],{"type":26,"value":3197},{"type":21,"tag":2314,"props":27454,"children":27455},{"style":2339},[27456],{"type":26,"value":27457},"1\n",{"type":21,"tag":2314,"props":27459,"children":27460},{"class":2316,"line":887},[27461],{"type":21,"tag":2314,"props":27462,"children":27463},{"style":2321},[27464],{"type":26,"value":3257},{"type":21,"tag":2314,"props":27466,"children":27467},{"class":2316,"line":1364},[27468,27472,27476,27480],{"type":21,"tag":2314,"props":27469,"children":27470},{"style":3157},[27471],{"type":26,"value":3450},{"type":21,"tag":2314,"props":27473,"children":27474},{"style":2321},[27475],{"type":26,"value":4858},{"type":21,"tag":2314,"props":27477,"children":27478},{"style":3157},[27479],{"type":26,"value":3460},{"type":21,"tag":2314,"props":27481,"children":27482},{"style":2321},[27483],{"type":26,"value":27484}," backends:\n",{"type":21,"tag":2314,"props":27486,"children":27487},{"class":2316,"line":3403},[27488,27492,27496,27500,27504,27508,27513,27517,27521,27525,27530,27534,27539,27543,27548,27552,27556],{"type":21,"tag":2314,"props":27489,"children":27490},{"style":2339},[27491],{"type":26,"value":17179},{"type":21,"tag":2314,"props":27493,"children":27494},{"style":2321},[27495],{"type":26,"value":3277},{"type":21,"tag":2314,"props":27497,"children":27498},{"style":3157},[27499],{"type":26,"value":3282},{"type":21,"tag":2314,"props":27501,"children":27502},{"style":2350},[27503],{"type":26,"value":3307},{"type":21,"tag":2314,"props":27505,"children":27506},{"style":2339},[27507],{"type":26,"value":3292},{"type":21,"tag":2314,"props":27509,"children":27510},{"style":2321},[27511],{"type":26,"value":27512},"b.name",{"type":21,"tag":2314,"props":27514,"children":27515},{"style":2339},[27516],{"type":26,"value":3302},{"type":21,"tag":2314,"props":27518,"children":27519},{"style":2350},[27520],{"type":26,"value":2408},{"type":21,"tag":2314,"props":27522,"children":27523},{"style":2339},[27524],{"type":26,"value":3292},{"type":21,"tag":2314,"props":27526,"children":27527},{"style":2321},[27528],{"type":26,"value":27529},"b.num_qubits",{"type":21,"tag":2314,"props":27531,"children":27532},{"style":2339},[27533],{"type":26,"value":3302},{"type":21,"tag":2314,"props":27535,"children":27536},{"style":2350},[27537],{"type":26,"value":27538}," qubits, status: ",{"type":21,"tag":2314,"props":27540,"children":27541},{"style":2339},[27542],{"type":26,"value":3292},{"type":21,"tag":2314,"props":27544,"children":27545},{"style":2321},[27546],{"type":26,"value":27547},"b.status().status_msg",{"type":21,"tag":2314,"props":27549,"children":27550},{"style":2339},[27551],{"type":26,"value":3302},{"type":21,"tag":2314,"props":27553,"children":27554},{"style":2350},[27555],{"type":26,"value":3307},{"type":21,"tag":2314,"props":27557,"children":27558},{"style":2321},[27559],{"type":26,"value":3257},{"type":21,"tag":29,"props":27561,"children":27563},{"id":27562},"_10-分钟完成设置",[27564],{"type":26,"value":27565},"10 分钟完成设置",{"type":21,"tag":17316,"props":27567,"children":27569},{"id":27568},"第-1-步创建你的免费账户",[27570],{"type":26,"value":27571},"第 1 步：创建你的免费账户",{"type":21,"tag":22,"props":27573,"children":27574},{},[27575,27577,27582],{"type":26,"value":27576},"前往 ",{"type":21,"tag":46,"props":27578,"children":27580},{"href":20611,"rel":27579},[899],[27581],{"type":26,"value":20615},{"type":26,"value":27583}," 创建一个免费的 IBM ID。无需提供任何支付信息。",{"type":21,"tag":17316,"props":27585,"children":27587},{"id":27586},"第-2-步安装-sdk",[27588],{"type":26,"value":27589},"第 2 步：安装 SDK",{"type":21,"tag":2304,"props":27591,"children":27593},{"className":9697,"code":27592,"language":9699,"meta":7,"style":7},"pip install qiskit qiskit-ibm-runtime\n",[27594],{"type":21,"tag":2073,"props":27595,"children":27596},{"__ignoreMap":7},[27597],{"type":21,"tag":2314,"props":27598,"children":27599},{"class":2316,"line":2317},[27600,27604,27608,27612],{"type":21,"tag":2314,"props":27601,"children":27602},{"style":4318},[27603],{"type":26,"value":11748},{"type":21,"tag":2314,"props":27605,"children":27606},{"style":2350},[27607],{"type":26,"value":11753},{"type":21,"tag":2314,"props":27609,"children":27610},{"style":2350},[27611],{"type":26,"value":11758},{"type":21,"tag":2314,"props":27613,"children":27614},{"style":2350},[27615],{"type":26,"value":27616}," qiskit-ibm-runtime\n",{"type":21,"tag":17316,"props":27618,"children":27620},{"id":27619},"第-3-步保存你的凭据",[27621],{"type":26,"value":27622},"第 3 步：保存你的凭据",{"type":21,"tag":22,"props":27624,"children":27625},{},[27626],{"type":26,"value":27627},"登录 IBM Quantum 控制台后，从 Account 页面复制你的 API token。",{"type":21,"tag":2304,"props":27629,"children":27631},{"className":3145,"code":27630,"language":3147,"meta":7,"style":7},"from qiskit_ibm_runtime import QiskitRuntimeService\n\n# Run this once to save your token locally\nQiskitRuntimeService.save_account(\n    channel=\"ibm_quantum\",\n    token=\"YOUR_API_TOKEN_HERE\",\n    overwrite=True\n)\n",[27632],{"type":21,"tag":2073,"props":27633,"children":27634},{"__ignoreMap":7},[27635,27654,27661,27669,27676,27695,27715,27732],{"type":21,"tag":2314,"props":27636,"children":27637},{"class":2316,"line":2317},[27638,27642,27646,27650],{"type":21,"tag":2314,"props":27639,"children":27640},{"style":3157},[27641],{"type":26,"value":3160},{"type":21,"tag":2314,"props":27643,"children":27644},{"style":2321},[27645],{"type":26,"value":3165},{"type":21,"tag":2314,"props":27647,"children":27648},{"style":3157},[27649],{"type":26,"value":3170},{"type":21,"tag":2314,"props":27651,"children":27652},{"style":2321},[27653],{"type":26,"value":3175},{"type":21,"tag":2314,"props":27655,"children":27656},{"class":2316,"line":106},[27657],{"type":21,"tag":2314,"props":27658,"children":27659},{"emptyLinePlaceholder":3181},[27660],{"type":26,"value":3184},{"type":21,"tag":2314,"props":27662,"children":27663},{"class":2316,"line":2335},[27664],{"type":21,"tag":2314,"props":27665,"children":27666},{"style":3407},[27667],{"type":26,"value":27668},"# Run this once to save your token locally\n",{"type":21,"tag":2314,"props":27670,"children":27671},{"class":2316,"line":2397},[27672],{"type":21,"tag":2314,"props":27673,"children":27674},{"style":2321},[27675],{"type":26,"value":20668},{"type":21,"tag":2314,"props":27677,"children":27678},{"class":2316,"line":2421},[27679,27683,27687,27691],{"type":21,"tag":2314,"props":27680,"children":27681},{"style":3222},[27682],{"type":26,"value":20676},{"type":21,"tag":2314,"props":27684,"children":27685},{"style":3157},[27686],{"type":26,"value":3197},{"type":21,"tag":2314,"props":27688,"children":27689},{"style":2350},[27690],{"type":26,"value":20685},{"type":21,"tag":2314,"props":27692,"children":27693},{"style":2321},[27694],{"type":26,"value":2418},{"type":21,"tag":2314,"props":27696,"children":27697},{"class":2316,"line":16},[27698,27702,27706,27711],{"type":21,"tag":2314,"props":27699,"children":27700},{"style":3222},[27701],{"type":26,"value":20697},{"type":21,"tag":2314,"props":27703,"children":27704},{"style":3157},[27705],{"type":26,"value":3197},{"type":21,"tag":2314,"props":27707,"children":27708},{"style":2350},[27709],{"type":26,"value":27710},"\"YOUR_API_TOKEN_HERE\"",{"type":21,"tag":2314,"props":27712,"children":27713},{"style":2321},[27714],{"type":26,"value":2418},{"type":21,"tag":2314,"props":27716,"children":27717},{"class":2316,"line":127},[27718,27723,27727],{"type":21,"tag":2314,"props":27719,"children":27720},{"style":3222},[27721],{"type":26,"value":27722},"    overwrite",{"type":21,"tag":2314,"props":27724,"children":27725},{"style":3157},[27726],{"type":26,"value":3197},{"type":21,"tag":2314,"props":27728,"children":27729},{"style":2339},[27730],{"type":26,"value":27731},"True\n",{"type":21,"tag":2314,"props":27733,"children":27734},{"class":2316,"line":887},[27735],{"type":21,"tag":2314,"props":27736,"children":27737},{"style":2321},[27738],{"type":26,"value":3257},{"type":21,"tag":22,"props":27740,"children":27741},{},[27742,27744,27750],{"type":26,"value":27743},"你的凭据会保存到 ",{"type":21,"tag":2073,"props":27745,"children":27747},{"className":27746},[],[27748],{"type":26,"value":27749},"~\u002F.qiskit\u002Fqiskit-ibm.json",{"type":26,"value":27751},"，之后无需再次执行此操作。",{"type":21,"tag":17316,"props":27753,"children":27755},{"id":27754},"第-4-步提交你的第一个任务",[27756],{"type":26,"value":27757},"第 4 步：提交你的第一个任务",{"type":21,"tag":2304,"props":27759,"children":27761},{"className":3145,"code":27760,"language":3147,"meta":7,"style":7},"from qiskit import QuantumCircuit\nfrom qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager\nfrom qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2 as Sampler\n\n# Build a Bell state\nqc = QuantumCircuit(2, 2)\nqc.h(0)\nqc.cx(0, 1)\nqc.measure([0, 1], [0, 1])\n\n# Connect and pick the least-busy free QPU\nservice = QiskitRuntimeService(channel=\"ibm_quantum\")\nbackend = service.least_busy(\n    operational=True,\n    simulator=False,\n    min_num_qubits=2\n)\nprint(f\"Submitting to: {backend.name}\")\n\n# Transpile for the target device\npm = generate_preset_pass_manager(backend=backend, optimization_level=1)\nisa_qc = pm.run(qc)\n\n# Submit\nsampler = Sampler(mode=backend)\njob = sampler.run([isa_qc], shots=1024)\n\nprint(f\"Job ID: {job.job_id()}\")\nprint(f\"Status: {job.status()}\")\nresult = job.result()\nprint(result[0].data.c.get_counts())\n",[27762],{"type":21,"tag":2073,"props":27763,"children":27764},{"__ignoreMap":7},[27765,27784,27805,27834,27841,27849,27880,27895,27918,27957,27964,27972,28003,28019,28038,28057,28073,28080,28120,28127,28135,28180,28197,28204,28212,28243,28276,28283,28324,28365,28381],{"type":21,"tag":2314,"props":27766,"children":27767},{"class":2316,"line":2317},[27768,27772,27776,27780],{"type":21,"tag":2314,"props":27769,"children":27770},{"style":3157},[27771],{"type":26,"value":3160},{"type":21,"tag":2314,"props":27773,"children":27774},{"style":2321},[27775],{"type":26,"value":4249},{"type":21,"tag":2314,"props":27777,"children":27778},{"style":3157},[27779],{"type":26,"value":3170},{"type":21,"tag":2314,"props":27781,"children":27782},{"style":2321},[27783],{"type":26,"value":20261},{"type":21,"tag":2314,"props":27785,"children":27786},{"class":2316,"line":106},[27787,27791,27796,27800],{"type":21,"tag":2314,"props":27788,"children":27789},{"style":3157},[27790],{"type":26,"value":3160},{"type":21,"tag":2314,"props":27792,"children":27793},{"style":2321},[27794],{"type":26,"value":27795}," qiskit.transpiler.preset_passmanagers ",{"type":21,"tag":2314,"props":27797,"children":27798},{"style":3157},[27799],{"type":26,"value":3170},{"type":21,"tag":2314,"props":27801,"children":27802},{"style":2321},[27803],{"type":26,"value":27804}," generate_preset_pass_manager\n",{"type":21,"tag":2314,"props":27806,"children":27807},{"class":2316,"line":2335},[27808,27812,27816,27820,27825,27829],{"type":21,"tag":2314,"props":27809,"children":27810},{"style":3157},[27811],{"type":26,"value":3160},{"type":21,"tag":2314,"props":27813,"children":27814},{"style":2321},[27815],{"type":26,"value":3165},{"type":21,"tag":2314,"props":27817,"children":27818},{"style":3157},[27819],{"type":26,"value":3170},{"type":21,"tag":2314,"props":27821,"children":27822},{"style":2321},[27823],{"type":26,"value":27824}," QiskitRuntimeService, SamplerV2 ",{"type":21,"tag":2314,"props":27826,"children":27827},{"style":3157},[27828],{"type":26,"value":4232},{"type":21,"tag":2314,"props":27830,"children":27831},{"style":2321},[27832],{"type":26,"value":27833}," Sampler\n",{"type":21,"tag":2314,"props":27835,"children":27836},{"class":2316,"line":2397},[27837],{"type":21,"tag":2314,"props":27838,"children":27839},{"emptyLinePlaceholder":3181},[27840],{"type":26,"value":3184},{"type":21,"tag":2314,"props":27842,"children":27843},{"class":2316,"line":2421},[27844],{"type":21,"tag":2314,"props":27845,"children":27846},{"style":3407},[27847],{"type":26,"value":27848},"# Build a Bell state\n",{"type":21,"tag":2314,"props":27850,"children":27851},{"class":2316,"line":16},[27852,27856,27860,27864,27868,27872,27876],{"type":21,"tag":2314,"props":27853,"children":27854},{"style":2321},[27855],{"type":26,"value":7336},{"type":21,"tag":2314,"props":27857,"children":27858},{"style":3157},[27859],{"type":26,"value":3197},{"type":21,"tag":2314,"props":27861,"children":27862},{"style":2321},[27863],{"type":26,"value":5092},{"type":21,"tag":2314,"props":27865,"children":27866},{"style":2339},[27867],{"type":26,"value":2413},{"type":21,"tag":2314,"props":27869,"children":27870},{"style":2321},[27871],{"type":26,"value":1309},{"type":21,"tag":2314,"props":27873,"children":27874},{"style":2339},[27875],{"type":26,"value":2413},{"type":21,"tag":2314,"props":27877,"children":27878},{"style":2321},[27879],{"type":26,"value":3257},{"type":21,"tag":2314,"props":27881,"children":27882},{"class":2316,"line":127},[27883,27887,27891],{"type":21,"tag":2314,"props":27884,"children":27885},{"style":2321},[27886],{"type":26,"value":7352},{"type":21,"tag":2314,"props":27888,"children":27889},{"style":2339},[27890],{"type":26,"value":5122},{"type":21,"tag":2314,"props":27892,"children":27893},{"style":2321},[27894],{"type":26,"value":3257},{"type":21,"tag":2314,"props":27896,"children":27897},{"class":2316,"line":887},[27898,27902,27906,27910,27914],{"type":21,"tag":2314,"props":27899,"children":27900},{"style":2321},[27901],{"type":26,"value":20347},{"type":21,"tag":2314,"props":27903,"children":27904},{"style":2339},[27905],{"type":26,"value":5122},{"type":21,"tag":2314,"props":27907,"children":27908},{"style":2321},[27909],{"type":26,"value":1309},{"type":21,"tag":2314,"props":27911,"children":27912},{"style":2339},[27913],{"type":26,"value":3513},{"type":21,"tag":2314,"props":27915,"children":27916},{"style":2321},[27917],{"type":26,"value":3257},{"type":21,"tag":2314,"props":27919,"children":27920},{"class":2316,"line":1364},[27921,27925,27929,27933,27937,27941,27945,27949,27953],{"type":21,"tag":2314,"props":27922,"children":27923},{"style":2321},[27924],{"type":26,"value":21153},{"type":21,"tag":2314,"props":27926,"children":27927},{"style":2339},[27928],{"type":26,"value":5122},{"type":21,"tag":2314,"props":27930,"children":27931},{"style":2321},[27932],{"type":26,"value":1309},{"type":21,"tag":2314,"props":27934,"children":27935},{"style":2339},[27936],{"type":26,"value":3513},{"type":21,"tag":2314,"props":27938,"children":27939},{"style":2321},[27940],{"type":26,"value":5177},{"type":21,"tag":2314,"props":27942,"children":27943},{"style":2339},[27944],{"type":26,"value":5122},{"type":21,"tag":2314,"props":27946,"children":27947},{"style":2321},[27948],{"type":26,"value":1309},{"type":21,"tag":2314,"props":27950,"children":27951},{"style":2339},[27952],{"type":26,"value":3513},{"type":21,"tag":2314,"props":27954,"children":27955},{"style":2321},[27956],{"type":26,"value":3518},{"type":21,"tag":2314,"props":27958,"children":27959},{"class":2316,"line":3403},[27960],{"type":21,"tag":2314,"props":27961,"children":27962},{"emptyLinePlaceholder":3181},[27963],{"type":26,"value":3184},{"type":21,"tag":2314,"props":27965,"children":27966},{"class":2316,"line":3413},[27967],{"type":21,"tag":2314,"props":27968,"children":27969},{"style":3407},[27970],{"type":26,"value":27971},"# Connect and pick the least-busy free QPU\n",{"type":21,"tag":2314,"props":27973,"children":27974},{"class":2316,"line":436},[27975,27979,27983,27987,27991,27995,27999],{"type":21,"tag":2314,"props":27976,"children":27977},{"style":2321},[27978],{"type":26,"value":3192},{"type":21,"tag":2314,"props":27980,"children":27981},{"style":3157},[27982],{"type":26,"value":3197},{"type":21,"tag":2314,"props":27984,"children":27985},{"style":2321},[27986],{"type":26,"value":27366},{"type":21,"tag":2314,"props":27988,"children":27989},{"style":3222},[27990],{"type":26,"value":27371},{"type":21,"tag":2314,"props":27992,"children":27993},{"style":3157},[27994],{"type":26,"value":3197},{"type":21,"tag":2314,"props":27996,"children":27997},{"style":2350},[27998],{"type":26,"value":20685},{"type":21,"tag":2314,"props":28000,"children":28001},{"style":2321},[28002],{"type":26,"value":3257},{"type":21,"tag":2314,"props":28004,"children":28005},{"class":2316,"line":3473},[28006,28010,28014],{"type":21,"tag":2314,"props":28007,"children":28008},{"style":2321},[28009],{"type":26,"value":3210},{"type":21,"tag":2314,"props":28011,"children":28012},{"style":3157},[28013],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28015,"children":28016},{"style":2321},[28017],{"type":26,"value":28018}," service.least_busy(\n",{"type":21,"tag":2314,"props":28020,"children":28021},{"class":2316,"line":3521},[28022,28026,28030,28034],{"type":21,"tag":2314,"props":28023,"children":28024},{"style":3222},[28025],{"type":26,"value":27408},{"type":21,"tag":2314,"props":28027,"children":28028},{"style":3157},[28029],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28031,"children":28032},{"style":2339},[28033],{"type":26,"value":3234},{"type":21,"tag":2314,"props":28035,"children":28036},{"style":2321},[28037],{"type":26,"value":2418},{"type":21,"tag":2314,"props":28039,"children":28040},{"class":2316,"line":3563},[28041,28045,28049,28053],{"type":21,"tag":2314,"props":28042,"children":28043},{"style":3222},[28044],{"type":26,"value":27428},{"type":21,"tag":2314,"props":28046,"children":28047},{"style":3157},[28048],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28050,"children":28051},{"style":2339},[28052],{"type":26,"value":3252},{"type":21,"tag":2314,"props":28054,"children":28055},{"style":2321},[28056],{"type":26,"value":2418},{"type":21,"tag":2314,"props":28058,"children":28059},{"class":2316,"line":4585},[28060,28064,28068],{"type":21,"tag":2314,"props":28061,"children":28062},{"style":3222},[28063],{"type":26,"value":27448},{"type":21,"tag":2314,"props":28065,"children":28066},{"style":3157},[28067],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28069,"children":28070},{"style":2339},[28071],{"type":26,"value":28072},"2\n",{"type":21,"tag":2314,"props":28074,"children":28075},{"class":2316,"line":4604},[28076],{"type":21,"tag":2314,"props":28077,"children":28078},{"style":2321},[28079],{"type":26,"value":3257},{"type":21,"tag":2314,"props":28081,"children":28082},{"class":2316,"line":4612},[28083,28087,28091,28095,28100,28104,28108,28112,28116],{"type":21,"tag":2314,"props":28084,"children":28085},{"style":2339},[28086],{"type":26,"value":3272},{"type":21,"tag":2314,"props":28088,"children":28089},{"style":2321},[28090],{"type":26,"value":3277},{"type":21,"tag":2314,"props":28092,"children":28093},{"style":3157},[28094],{"type":26,"value":3282},{"type":21,"tag":2314,"props":28096,"children":28097},{"style":2350},[28098],{"type":26,"value":28099},"\"Submitting to: ",{"type":21,"tag":2314,"props":28101,"children":28102},{"style":2339},[28103],{"type":26,"value":3292},{"type":21,"tag":2314,"props":28105,"children":28106},{"style":2321},[28107],{"type":26,"value":3297},{"type":21,"tag":2314,"props":28109,"children":28110},{"style":2339},[28111],{"type":26,"value":3302},{"type":21,"tag":2314,"props":28113,"children":28114},{"style":2350},[28115],{"type":26,"value":3307},{"type":21,"tag":2314,"props":28117,"children":28118},{"style":2321},[28119],{"type":26,"value":3257},{"type":21,"tag":2314,"props":28121,"children":28122},{"class":2316,"line":4643},[28123],{"type":21,"tag":2314,"props":28124,"children":28125},{"emptyLinePlaceholder":3181},[28126],{"type":26,"value":3184},{"type":21,"tag":2314,"props":28128,"children":28129},{"class":2316,"line":4688},[28130],{"type":21,"tag":2314,"props":28131,"children":28132},{"style":3407},[28133],{"type":26,"value":28134},"# Transpile for the target device\n",{"type":21,"tag":2314,"props":28136,"children":28137},{"class":2316,"line":4727},[28138,28142,28146,28151,28155,28159,28164,28168,28172,28176],{"type":21,"tag":2314,"props":28139,"children":28140},{"style":2321},[28141],{"type":26,"value":5799},{"type":21,"tag":2314,"props":28143,"children":28144},{"style":3157},[28145],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28147,"children":28148},{"style":2321},[28149],{"type":26,"value":28150}," generate_preset_pass_manager(",{"type":21,"tag":2314,"props":28152,"children":28153},{"style":3222},[28154],{"type":26,"value":18425},{"type":21,"tag":2314,"props":28156,"children":28157},{"style":3157},[28158],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28160,"children":28161},{"style":2321},[28162],{"type":26,"value":28163},"backend, ",{"type":21,"tag":2314,"props":28165,"children":28166},{"style":3222},[28167],{"type":26,"value":6229},{"type":21,"tag":2314,"props":28169,"children":28170},{"style":3157},[28171],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28173,"children":28174},{"style":2339},[28175],{"type":26,"value":3513},{"type":21,"tag":2314,"props":28177,"children":28178},{"style":2321},[28179],{"type":26,"value":3257},{"type":21,"tag":2314,"props":28181,"children":28182},{"class":2316,"line":4745},[28183,28188,28192],{"type":21,"tag":2314,"props":28184,"children":28185},{"style":2321},[28186],{"type":26,"value":28187},"isa_qc ",{"type":21,"tag":2314,"props":28189,"children":28190},{"style":3157},[28191],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28193,"children":28194},{"style":2321},[28195],{"type":26,"value":28196}," pm.run(qc)\n",{"type":21,"tag":2314,"props":28198,"children":28199},{"class":2316,"line":4819},[28200],{"type":21,"tag":2314,"props":28201,"children":28202},{"emptyLinePlaceholder":3181},[28203],{"type":26,"value":3184},{"type":21,"tag":2314,"props":28205,"children":28206},{"class":2316,"line":4847},[28207],{"type":21,"tag":2314,"props":28208,"children":28209},{"style":3407},[28210],{"type":26,"value":28211},"# Submit\n",{"type":21,"tag":2314,"props":28213,"children":28214},{"class":2316,"line":4876},[28215,28220,28224,28229,28234,28238],{"type":21,"tag":2314,"props":28216,"children":28217},{"style":2321},[28218],{"type":26,"value":28219},"sampler ",{"type":21,"tag":2314,"props":28221,"children":28222},{"style":3157},[28223],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28225,"children":28226},{"style":2321},[28227],{"type":26,"value":28228}," Sampler(",{"type":21,"tag":2314,"props":28230,"children":28231},{"style":3222},[28232],{"type":26,"value":28233},"mode",{"type":21,"tag":2314,"props":28235,"children":28236},{"style":3157},[28237],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28239,"children":28240},{"style":2321},[28241],{"type":26,"value":28242},"backend)\n",{"type":21,"tag":2314,"props":28244,"children":28245},{"class":2316,"line":4885},[28246,28251,28255,28260,28264,28268,28272],{"type":21,"tag":2314,"props":28247,"children":28248},{"style":2321},[28249],{"type":26,"value":28250},"job ",{"type":21,"tag":2314,"props":28252,"children":28253},{"style":3157},[28254],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28256,"children":28257},{"style":2321},[28258],{"type":26,"value":28259}," sampler.run([isa_qc], ",{"type":21,"tag":2314,"props":28261,"children":28262},{"style":3222},[28263],{"type":26,"value":4077},{"type":21,"tag":2314,"props":28265,"children":28266},{"style":3157},[28267],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28269,"children":28270},{"style":2339},[28271],{"type":26,"value":2477},{"type":21,"tag":2314,"props":28273,"children":28274},{"style":2321},[28275],{"type":26,"value":3257},{"type":21,"tag":2314,"props":28277,"children":28278},{"class":2316,"line":4913},[28279],{"type":21,"tag":2314,"props":28280,"children":28281},{"emptyLinePlaceholder":3181},[28282],{"type":26,"value":3184},{"type":21,"tag":2314,"props":28284,"children":28285},{"class":2316,"line":4944},[28286,28290,28294,28298,28303,28307,28312,28316,28320],{"type":21,"tag":2314,"props":28287,"children":28288},{"style":2339},[28289],{"type":26,"value":3272},{"type":21,"tag":2314,"props":28291,"children":28292},{"style":2321},[28293],{"type":26,"value":3277},{"type":21,"tag":2314,"props":28295,"children":28296},{"style":3157},[28297],{"type":26,"value":3282},{"type":21,"tag":2314,"props":28299,"children":28300},{"style":2350},[28301],{"type":26,"value":28302},"\"Job ID: ",{"type":21,"tag":2314,"props":28304,"children":28305},{"style":2339},[28306],{"type":26,"value":3292},{"type":21,"tag":2314,"props":28308,"children":28309},{"style":2321},[28310],{"type":26,"value":28311},"job.job_id()",{"type":21,"tag":2314,"props":28313,"children":28314},{"style":2339},[28315],{"type":26,"value":3302},{"type":21,"tag":2314,"props":28317,"children":28318},{"style":2350},[28319],{"type":26,"value":3307},{"type":21,"tag":2314,"props":28321,"children":28322},{"style":2321},[28323],{"type":26,"value":3257},{"type":21,"tag":2314,"props":28325,"children":28326},{"class":2316,"line":4966},[28327,28331,28335,28339,28344,28348,28353,28357,28361],{"type":21,"tag":2314,"props":28328,"children":28329},{"style":2339},[28330],{"type":26,"value":3272},{"type":21,"tag":2314,"props":28332,"children":28333},{"style":2321},[28334],{"type":26,"value":3277},{"type":21,"tag":2314,"props":28336,"children":28337},{"style":3157},[28338],{"type":26,"value":3282},{"type":21,"tag":2314,"props":28340,"children":28341},{"style":2350},[28342],{"type":26,"value":28343},"\"Status: ",{"type":21,"tag":2314,"props":28345,"children":28346},{"style":2339},[28347],{"type":26,"value":3292},{"type":21,"tag":2314,"props":28349,"children":28350},{"style":2321},[28351],{"type":26,"value":28352},"job.status()",{"type":21,"tag":2314,"props":28354,"children":28355},{"style":2339},[28356],{"type":26,"value":3302},{"type":21,"tag":2314,"props":28358,"children":28359},{"style":2350},[28360],{"type":26,"value":3307},{"type":21,"tag":2314,"props":28362,"children":28363},{"style":2321},[28364],{"type":26,"value":3257},{"type":21,"tag":2314,"props":28366,"children":28367},{"class":2316,"line":5012},[28368,28372,28376],{"type":21,"tag":2314,"props":28369,"children":28370},{"style":2321},[28371],{"type":26,"value":19287},{"type":21,"tag":2314,"props":28373,"children":28374},{"style":3157},[28375],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28377,"children":28378},{"style":2321},[28379],{"type":26,"value":28380}," job.result()\n",{"type":21,"tag":2314,"props":28382,"children":28383},{"class":2316,"line":5025},[28384,28388,28393,28397],{"type":21,"tag":2314,"props":28385,"children":28386},{"style":2339},[28387],{"type":26,"value":3272},{"type":21,"tag":2314,"props":28389,"children":28390},{"style":2321},[28391],{"type":26,"value":28392},"(result[",{"type":21,"tag":2314,"props":28394,"children":28395},{"style":2339},[28396],{"type":26,"value":5122},{"type":21,"tag":2314,"props":28398,"children":28399},{"style":2321},[28400],{"type":26,"value":28401},"].data.c.get_counts())\n",{"type":21,"tag":29,"props":28403,"children":28405},{"id":28404},"理解排队时间",[28406],{"type":26,"value":28404},{"type":21,"tag":22,"props":28408,"children":28409},{},[28410],{"type":26,"value":28411},"排队时间是免费套餐最常见的困扰。以下是背后的原理：",{"type":21,"tag":3080,"props":28413,"children":28414},{},[28415,28420,28433],{"type":21,"tag":3084,"props":28416,"children":28417},{},[28418],{"type":26,"value":28419},"你与全球所有其他 Open Plan 用户共享 QPU",{"type":21,"tag":3084,"props":28421,"children":28422},{},[28423,28425,28431],{"type":26,"value":28424},"任务按系统分别排队，",{"type":21,"tag":2073,"props":28426,"children":28428},{"className":28427},[],[28429],{"type":26,"value":28430},"least_busy()",{"type":26,"value":28432}," 有助于找到等待最短的系统",{"type":21,"tag":3084,"props":28434,"children":28435},{},[28436],{"type":26,"value":28437},"典型等待时间：视系统负载而定，从 5 分钟到 2 小时不等",{"type":21,"tag":22,"props":28439,"children":28440},{},[28441],{"type":21,"tag":136,"props":28442,"children":28443},{},[28444],{"type":26,"value":28445},"减少排队时间的技巧：",{"type":21,"tag":3080,"props":28447,"children":28448},{},[28449,28454,28467,28472],{"type":21,"tag":3084,"props":28450,"children":28451},{},[28452],{"type":26,"value":28453},"在非高峰时段运行（欧洲的早晨 = 美洲的夜晚）",{"type":21,"tag":3084,"props":28455,"children":28456},{},[28457,28459,28465],{"type":26,"value":28458},"使用 ",{"type":21,"tag":2073,"props":28460,"children":28462},{"className":28461},[],[28463],{"type":26,"value":28464},"service.least_busy()",{"type":26,"value":28466}," 而非指定某个特定系统",{"type":21,"tag":3084,"props":28468,"children":28469},{},[28470],{"type":26,"value":28471},"开发阶段在本地使用 Aer 模拟器，仅在最终验证时提交到真实硬件",{"type":21,"tag":3084,"props":28473,"children":28474},{},[28475],{"type":26,"value":28476},"使用 SamplerV2 的列表输入将多个电路批量打包到单个任务中",{"type":21,"tag":29,"props":28478,"children":28480},{"id":28479},"改用免费的云端模拟器",[28481],{"type":26,"value":28479},{"type":21,"tag":22,"props":28483,"children":28484},{},[28485],{"type":26,"value":28486},"对于大多数开发工作，IBM 的云端托管模拟器比排队等待真实硬件更快：",{"type":21,"tag":2304,"props":28488,"children":28490},{"className":3145,"code":28489,"language":3147,"meta":7,"style":7},"# IBM cloud QASM simulator (up to 32 qubits, no queue)\nbackend = service.backend(\"ibmq_qasm_simulator\")\n\n# Or use the Statevector simulator (exact simulation)\nbackend = service.backend(\"simulator_statevector\")\n",[28491],{"type":21,"tag":2073,"props":28492,"children":28493},{"__ignoreMap":7},[28494,28502,28527,28534,28542],{"type":21,"tag":2314,"props":28495,"children":28496},{"class":2316,"line":2317},[28497],{"type":21,"tag":2314,"props":28498,"children":28499},{"style":3407},[28500],{"type":26,"value":28501},"# IBM cloud QASM simulator (up to 32 qubits, no queue)\n",{"type":21,"tag":2314,"props":28503,"children":28504},{"class":2316,"line":106},[28505,28509,28513,28518,28523],{"type":21,"tag":2314,"props":28506,"children":28507},{"style":2321},[28508],{"type":26,"value":3210},{"type":21,"tag":2314,"props":28510,"children":28511},{"style":3157},[28512],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28514,"children":28515},{"style":2321},[28516],{"type":26,"value":28517}," service.backend(",{"type":21,"tag":2314,"props":28519,"children":28520},{"style":2350},[28521],{"type":26,"value":28522},"\"ibmq_qasm_simulator\"",{"type":21,"tag":2314,"props":28524,"children":28525},{"style":2321},[28526],{"type":26,"value":3257},{"type":21,"tag":2314,"props":28528,"children":28529},{"class":2316,"line":2335},[28530],{"type":21,"tag":2314,"props":28531,"children":28532},{"emptyLinePlaceholder":3181},[28533],{"type":26,"value":3184},{"type":21,"tag":2314,"props":28535,"children":28536},{"class":2316,"line":2397},[28537],{"type":21,"tag":2314,"props":28538,"children":28539},{"style":3407},[28540],{"type":26,"value":28541},"# Or use the Statevector simulator (exact simulation)\n",{"type":21,"tag":2314,"props":28543,"children":28544},{"class":2316,"line":2421},[28545,28549,28553,28557,28562],{"type":21,"tag":2314,"props":28546,"children":28547},{"style":2321},[28548],{"type":26,"value":3210},{"type":21,"tag":2314,"props":28550,"children":28551},{"style":3157},[28552],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28554,"children":28555},{"style":2321},[28556],{"type":26,"value":28517},{"type":21,"tag":2314,"props":28558,"children":28559},{"style":2350},[28560],{"type":26,"value":28561},"\"simulator_statevector\"",{"type":21,"tag":2314,"props":28563,"children":28564},{"style":2321},[28565],{"type":26,"value":3257},{"type":21,"tag":22,"props":28567,"children":28568},{},[28569],{"type":26,"value":28570},"这些模拟器没有排队时间，可即时运行。当你需要真实的噪声特性或想在真实硬件上进行基准测试时，再使用真实的 QPU。",{"type":21,"tag":29,"props":28572,"children":28574},{"id":28573},"将-hlquantum-与-ibm-quantum-配合使用",[28575],{"type":26,"value":28576},"将 HLQuantum 与 IBM Quantum 配合使用",{"type":21,"tag":22,"props":28578,"children":28579},{},[28580],{"type":26,"value":28581},"如果你使用多个 SDK，HLQuantum 提供了一个更简洁的接口来访问 IBM 硬件：",{"type":21,"tag":2304,"props":28583,"children":28585},{"className":3145,"code":28584,"language":3147,"meta":7,"style":7},"import hlquantum as hlq\n\nqc = hlq.Circuit(2)\nqc.h(0).cx(0, 1).measure_all()\n\n# Run on IBM's free QPU\nresult = hlq.run(\n    qc,\n    backend=\"qiskit\",\n    device=\"ibm_sherbrooke\",  # or use \"auto\" for least busy\n    shots=1024,\n    error_mitigation=\"zne\"\n)\nprint(result)\n",[28586],{"type":21,"tag":2073,"props":28587,"children":28588},{"__ignoreMap":7},[28589,28608,28615,28638,28669,28676,28684,28700,28708,28728,28755,28775,28792,28799],{"type":21,"tag":2314,"props":28590,"children":28591},{"class":2316,"line":2317},[28592,28596,28600,28604],{"type":21,"tag":2314,"props":28593,"children":28594},{"style":3157},[28595],{"type":26,"value":3170},{"type":21,"tag":2314,"props":28597,"children":28598},{"style":2321},[28599],{"type":26,"value":19255},{"type":21,"tag":2314,"props":28601,"children":28602},{"style":3157},[28603],{"type":26,"value":4232},{"type":21,"tag":2314,"props":28605,"children":28606},{"style":2321},[28607],{"type":26,"value":19264},{"type":21,"tag":2314,"props":28609,"children":28610},{"class":2316,"line":106},[28611],{"type":21,"tag":2314,"props":28612,"children":28613},{"emptyLinePlaceholder":3181},[28614],{"type":26,"value":3184},{"type":21,"tag":2314,"props":28616,"children":28617},{"class":2316,"line":2335},[28618,28622,28626,28630,28634],{"type":21,"tag":2314,"props":28619,"children":28620},{"style":2321},[28621],{"type":26,"value":7336},{"type":21,"tag":2314,"props":28623,"children":28624},{"style":3157},[28625],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28627,"children":28628},{"style":2321},[28629],{"type":26,"value":21313},{"type":21,"tag":2314,"props":28631,"children":28632},{"style":2339},[28633],{"type":26,"value":2413},{"type":21,"tag":2314,"props":28635,"children":28636},{"style":2321},[28637],{"type":26,"value":3257},{"type":21,"tag":2314,"props":28639,"children":28640},{"class":2316,"line":2397},[28641,28645,28649,28653,28657,28661,28665],{"type":21,"tag":2314,"props":28642,"children":28643},{"style":2321},[28644],{"type":26,"value":7352},{"type":21,"tag":2314,"props":28646,"children":28647},{"style":2339},[28648],{"type":26,"value":5122},{"type":21,"tag":2314,"props":28650,"children":28651},{"style":2321},[28652],{"type":26,"value":21337},{"type":21,"tag":2314,"props":28654,"children":28655},{"style":2339},[28656],{"type":26,"value":5122},{"type":21,"tag":2314,"props":28658,"children":28659},{"style":2321},[28660],{"type":26,"value":1309},{"type":21,"tag":2314,"props":28662,"children":28663},{"style":2339},[28664],{"type":26,"value":3513},{"type":21,"tag":2314,"props":28666,"children":28667},{"style":2321},[28668],{"type":26,"value":21354},{"type":21,"tag":2314,"props":28670,"children":28671},{"class":2316,"line":2421},[28672],{"type":21,"tag":2314,"props":28673,"children":28674},{"emptyLinePlaceholder":3181},[28675],{"type":26,"value":3184},{"type":21,"tag":2314,"props":28677,"children":28678},{"class":2316,"line":16},[28679],{"type":21,"tag":2314,"props":28680,"children":28681},{"style":3407},[28682],{"type":26,"value":28683},"# Run on IBM's free QPU\n",{"type":21,"tag":2314,"props":28685,"children":28686},{"class":2316,"line":127},[28687,28691,28695],{"type":21,"tag":2314,"props":28688,"children":28689},{"style":2321},[28690],{"type":26,"value":19287},{"type":21,"tag":2314,"props":28692,"children":28693},{"style":3157},[28694],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28696,"children":28697},{"style":2321},[28698],{"type":26,"value":28699}," hlq.run(\n",{"type":21,"tag":2314,"props":28701,"children":28702},{"class":2316,"line":887},[28703],{"type":21,"tag":2314,"props":28704,"children":28705},{"style":2321},[28706],{"type":26,"value":28707},"    qc,\n",{"type":21,"tag":2314,"props":28709,"children":28710},{"class":2316,"line":1364},[28711,28715,28719,28724],{"type":21,"tag":2314,"props":28712,"children":28713},{"style":3222},[28714],{"type":26,"value":22820},{"type":21,"tag":2314,"props":28716,"children":28717},{"style":3157},[28718],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28720,"children":28721},{"style":2350},[28722],{"type":26,"value":28723},"\"qiskit\"",{"type":21,"tag":2314,"props":28725,"children":28726},{"style":2321},[28727],{"type":26,"value":2418},{"type":21,"tag":2314,"props":28729,"children":28730},{"class":2316,"line":3403},[28731,28736,28740,28745,28750],{"type":21,"tag":2314,"props":28732,"children":28733},{"style":3222},[28734],{"type":26,"value":28735},"    device",{"type":21,"tag":2314,"props":28737,"children":28738},{"style":3157},[28739],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28741,"children":28742},{"style":2350},[28743],{"type":26,"value":28744},"\"ibm_sherbrooke\"",{"type":21,"tag":2314,"props":28746,"children":28747},{"style":2321},[28748],{"type":26,"value":28749},",  ",{"type":21,"tag":2314,"props":28751,"children":28752},{"style":3407},[28753],{"type":26,"value":28754},"# or use \"auto\" for least busy\n",{"type":21,"tag":2314,"props":28756,"children":28757},{"class":2316,"line":3413},[28758,28763,28767,28771],{"type":21,"tag":2314,"props":28759,"children":28760},{"style":3222},[28761],{"type":26,"value":28762},"    shots",{"type":21,"tag":2314,"props":28764,"children":28765},{"style":3157},[28766],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28768,"children":28769},{"style":2339},[28770],{"type":26,"value":2477},{"type":21,"tag":2314,"props":28772,"children":28773},{"style":2321},[28774],{"type":26,"value":2418},{"type":21,"tag":2314,"props":28776,"children":28777},{"class":2316,"line":436},[28778,28783,28787],{"type":21,"tag":2314,"props":28779,"children":28780},{"style":3222},[28781],{"type":26,"value":28782},"    error_mitigation",{"type":21,"tag":2314,"props":28784,"children":28785},{"style":3157},[28786],{"type":26,"value":3197},{"type":21,"tag":2314,"props":28788,"children":28789},{"style":2350},[28790],{"type":26,"value":28791},"\"zne\"\n",{"type":21,"tag":2314,"props":28793,"children":28794},{"class":2316,"line":3473},[28795],{"type":21,"tag":2314,"props":28796,"children":28797},{"style":2321},[28798],{"type":26,"value":3257},{"type":21,"tag":2314,"props":28800,"children":28801},{"class":2316,"line":3521},[28802,28806],{"type":21,"tag":2314,"props":28803,"children":28804},{"style":2339},[28805],{"type":26,"value":3272},{"type":21,"tag":2314,"props":28807,"children":28808},{"style":2321},[28809],{"type":26,"value":28810},"(result)\n",{"type":21,"tag":22,"props":28812,"children":28813},{},[28814,28816,28820],{"type":26,"value":28815},"HLQuantum 会自动处理转译、任务提交和结果解析。有关高级配置，请参阅完整的 ",{"type":21,"tag":46,"props":28817,"children":28818},{"href":7045},[28819],{"type":26,"value":23413},{"type":26,"value":18641},{"type":21,"tag":2688,"props":28822,"children":28823},{},[28824],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":28826},[28827,28828,28829,28830,28836,28837,28838],{"id":27046,"depth":106,"text":27046},{"id":27123,"depth":106,"text":27126},{"id":27198,"depth":106,"text":27201},{"id":27562,"depth":106,"text":27565,"children":28831},[28832,28833,28834,28835],{"id":27568,"depth":2335,"text":27571},{"id":27586,"depth":2335,"text":27589},{"id":27619,"depth":2335,"text":27622},{"id":27754,"depth":2335,"text":27757},{"id":28404,"depth":106,"text":28404},{"id":28479,"depth":106,"text":28479},{"id":28573,"depth":106,"text":28576},"content:zh:blog:ibm-quantum-free-tier-2026.md","zh\u002Fblog\u002Fibm-quantum-free-tier-2026.md","zh\u002Fblog\u002Fibm-quantum-free-tier-2026",{"_path":28843,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":28844,"description":28845,"date":27034,"author":11,"tags":28846,"readingTime":3413,"body":28847,"_type":111,"_id":31577,"_source":113,"_file":31578,"_stem":31579,"_extension":116},"\u002Fzh\u002Fblog\u002Fqaoa-max-cut-tutorial","QAOA 详解：一步步求解 Max-Cut","手把手讲解量子近似优化算法（QAOA）在 Max-Cut 图问题上的应用——附使用 Qiskit、PennyLane 和 HLQuantum 的完整 Python 代码。",[7102,2018,1363,13739],{"type":18,"children":28848,"toc":31567},[28849,28854,28859,28865,28870,28875,28883,28901,28907,28912,28949,28977,28983,30122,30142,30147,30152,30750,30755,30763,30781,30787,30792,31090,31095,31300,31306,31326,31420,31447,31453,31461,31479,31487,31500,31517,31522,31563],{"type":21,"tag":22,"props":28850,"children":28851},{},[28852],{"type":26,"value":28853},"QAOA（量子近似优化算法）是最受追捧的近期量子算法之一——这是有充分理由的。它是组合优化问题上实现量子优势的真正候选者，能在当今的 NISQ 硬件上运行，而且简单到可以在一个下午内实现。",{"type":21,"tag":22,"props":28855,"children":28856},{},[28857],{"type":26,"value":28858},"本指南从零开始构建完整的 QAOA 流程，以 Max-Cut 作为示例问题。读完之后，你将理解 QAOA 究竟做了什么、如何实现它，以及何时值得使用它。",{"type":21,"tag":29,"props":28860,"children":28862},{"id":28861},"什么是-max-cut",[28863],{"type":26,"value":28864},"什么是 Max-Cut？",{"type":21,"tag":22,"props":28866,"children":28867},{},[28868],{"type":26,"value":28869},"Max-Cut 是一个图划分问题：给定一个图，将节点分成两组（0 和 1），以最大化跨越两组之间的边的数量。它在一般情况下是 NP-hard 的，出现在 VLSI 芯片设计、聚类和网络分析中，并且能够干净地映射到量子硬件上。",{"type":21,"tag":22,"props":28871,"children":28872},{},[28873],{"type":26,"value":28874},"这是一个简单的 4 节点图：",{"type":21,"tag":2304,"props":28876,"children":28878},{"code":28877},"0 --- 1\n|   \\ |\n3 --- 2\n",[28879],{"type":21,"tag":2073,"props":28880,"children":28881},{"__ignoreMap":7},[28882],{"type":26,"value":28877},{"type":21,"tag":22,"props":28884,"children":28885},{},[28886,28888,28894,28895,28900],{"type":26,"value":28887},"这个图的最大割是 4（边 0-1、1-2、2-3、3-0 全部跨越）。我们的目标：找到实现这一结果的比特串 ",{"type":21,"tag":2073,"props":28889,"children":28891},{"className":28890},[],[28892],{"type":26,"value":28893},"0101",{"type":26,"value":20470},{"type":21,"tag":2073,"props":28896,"children":28898},{"className":28897},[],[28899],{"type":26,"value":17385},{"type":26,"value":18641},{"type":21,"tag":29,"props":28902,"children":28904},{"id":28903},"qaoa-的思想",[28905],{"type":26,"value":28906},"QAOA 的思想",{"type":21,"tag":22,"props":28908,"children":28909},{},[28910],{"type":26,"value":28911},"QAOA 是一种变分混合算法。它交替执行两个参数化操作：",{"type":21,"tag":6961,"props":28913,"children":28914},{},[28915,28932],{"type":21,"tag":3084,"props":28916,"children":28917},{},[28918,28923,28924,28930],{"type":21,"tag":136,"props":28919,"children":28920},{},[28921],{"type":26,"value":28922},"问题酉算子",{"type":26,"value":1301},{"type":21,"tag":2073,"props":28925,"children":28927},{"className":28926},[],[28928],{"type":26,"value":28929},"U_C(γ)",{"type":26,"value":28931}," —— 将代价函数（边的跨越）编码为相位回踢",{"type":21,"tag":3084,"props":28933,"children":28934},{},[28935,28940,28941,28947],{"type":21,"tag":136,"props":28936,"children":28937},{},[28938],{"type":26,"value":28939},"混合酉算子",{"type":26,"value":1301},{"type":21,"tag":2073,"props":28942,"children":28944},{"className":28943},[],[28945],{"type":26,"value":28946},"U_B(β)",{"type":26,"value":28948}," —— 在各个解之间进行混合（X 旋转）",{"type":21,"tag":22,"props":28950,"children":28951},{},[28952,28954,28959,28961,28967,28969,28975],{"type":26,"value":28953},"通过 ",{"type":21,"tag":2073,"props":28955,"children":28957},{"className":28956},[],[28958],{"type":26,"value":22},{"type":26,"value":28960}," 层这样交替的酉算子，QAOA 制备出一个量子态，其测量结果很可能是一个好的解。经典优化器调整这 ",{"type":21,"tag":2073,"props":28962,"children":28964},{"className":28963},[],[28965],{"type":26,"value":28966},"2p",{"type":26,"value":28968}," 个角度 ",{"type":21,"tag":2073,"props":28970,"children":28972},{"className":28971},[],[28973],{"type":26,"value":28974},"(γ, β)",{"type":26,"value":28976},"，以最大化期望的割值。",{"type":21,"tag":29,"props":28978,"children":28980},{"id":28979},"用-pennylane-构建-qaoa",[28981],{"type":26,"value":28982},"用 PennyLane 构建 QAOA",{"type":21,"tag":2304,"props":28984,"children":28986},{"code":28985,"language":3147,"meta":7,"className":3145,"style":7},"import pennylane as qml\nimport numpy as np\nfrom scipy.optimize import minimize\n\n# Graph edges\nedges = [(0, 1), (1, 2), (2, 3), (3, 0)]\nn_qubits = 4\n\ndev = qml.device(\"default.qubit\", wires=n_qubits)\n\ndef cost_unitary(gamma):\n    \"\"\"Encode the Max-Cut cost into phases.\"\"\"\n    for u, v in edges:\n        qml.CNOT(wires=[u, v])\n        qml.RZ(2 * gamma, wires=v)\n        qml.CNOT(wires=[u, v])\n\ndef mixer_unitary(beta):\n    \"\"\"Apply X-rotation mixer to all qubits.\"\"\"\n    for i in range(n_qubits):\n        qml.RX(2 * beta, wires=i)\n\n@qml.qnode(dev)\ndef qaoa_circuit(params, p=1):\n    gammas = params[:p]\n    betas = params[p:]\n    # Start in uniform superposition\n    for i in range(n_qubits):\n        qml.Hadamard(wires=i)\n    # Alternate p layers\n    for layer in range(p):\n        cost_unitary(gammas[layer])\n        mixer_unitary(betas[layer])\n    return qml.probs(wires=range(n_qubits))\n\ndef expected_cut(params, p=1):\n    \"\"\"Classical cost function: expected number of cut edges.\"\"\"\n    probs = qaoa_circuit(params, p)\n    total = 0.0\n    for bitstring_idx, prob in enumerate(probs):\n        bits = format(bitstring_idx, f'0{n_qubits}b')\n        cut = sum(1 for u, v in edges if bits[u] != bits[v])\n        total += prob * cut\n    return -total  # Minimize negative cut\n\n# Optimize p=1 QAOA\np = 1\ninit_params = np.random.uniform(0, np.pi, 2 * p)\nresult = minimize(expected_cut, init_params, method='COBYLA',\n                  options={'maxiter': 200})\n\nprint(f\"Optimized params: {result.x}\")\nprint(f\"Expected cut: {-result.fun:.3f} \u002F 4.0 maximum\")\n",[28987],{"type":21,"tag":2073,"props":28988,"children":28989},{"__ignoreMap":7},[28990,29009,29028,29049,29056,29064,29147,29162,29169,29204,29211,29228,29236,29257,29277,29311,29330,29337,29354,29362,29385,29418,29425,29436,29465,29482,29499,29507,29530,29550,29558,29583,29591,29599,29626,29633,29661,29669,29686,29703,29728,29778,29840,29867,29888,29895,29903,29919,29957,29990,30024,30031,30072],{"type":21,"tag":2314,"props":28991,"children":28992},{"class":2316,"line":2317},[28993,28997,29001,29005],{"type":21,"tag":2314,"props":28994,"children":28995},{"style":3157},[28996],{"type":26,"value":3170},{"type":21,"tag":2314,"props":28998,"children":28999},{"style":2321},[29000],{"type":26,"value":14046},{"type":21,"tag":2314,"props":29002,"children":29003},{"style":3157},[29004],{"type":26,"value":4232},{"type":21,"tag":2314,"props":29006,"children":29007},{"style":2321},[29008],{"type":26,"value":14055},{"type":21,"tag":2314,"props":29010,"children":29011},{"class":2316,"line":106},[29012,29016,29020,29024],{"type":21,"tag":2314,"props":29013,"children":29014},{"style":3157},[29015],{"type":26,"value":3170},{"type":21,"tag":2314,"props":29017,"children":29018},{"style":2321},[29019],{"type":26,"value":4227},{"type":21,"tag":2314,"props":29021,"children":29022},{"style":3157},[29023],{"type":26,"value":4232},{"type":21,"tag":2314,"props":29025,"children":29026},{"style":2321},[29027],{"type":26,"value":4237},{"type":21,"tag":2314,"props":29029,"children":29030},{"class":2316,"line":2335},[29031,29035,29040,29044],{"type":21,"tag":2314,"props":29032,"children":29033},{"style":3157},[29034],{"type":26,"value":3160},{"type":21,"tag":2314,"props":29036,"children":29037},{"style":2321},[29038],{"type":26,"value":29039}," scipy.optimize ",{"type":21,"tag":2314,"props":29041,"children":29042},{"style":3157},[29043],{"type":26,"value":3170},{"type":21,"tag":2314,"props":29045,"children":29046},{"style":2321},[29047],{"type":26,"value":29048}," minimize\n",{"type":21,"tag":2314,"props":29050,"children":29051},{"class":2316,"line":2397},[29052],{"type":21,"tag":2314,"props":29053,"children":29054},{"emptyLinePlaceholder":3181},[29055],{"type":26,"value":3184},{"type":21,"tag":2314,"props":29057,"children":29058},{"class":2316,"line":2421},[29059],{"type":21,"tag":2314,"props":29060,"children":29061},{"style":3407},[29062],{"type":26,"value":29063},"# Graph edges\n",{"type":21,"tag":2314,"props":29065,"children":29066},{"class":2316,"line":16},[29067,29072,29076,29081,29085,29089,29093,29098,29102,29106,29110,29114,29118,29122,29126,29130,29134,29138,29142],{"type":21,"tag":2314,"props":29068,"children":29069},{"style":2321},[29070],{"type":26,"value":29071},"edges ",{"type":21,"tag":2314,"props":29073,"children":29074},{"style":3157},[29075],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29077,"children":29078},{"style":2321},[29079],{"type":26,"value":29080}," [(",{"type":21,"tag":2314,"props":29082,"children":29083},{"style":2339},[29084],{"type":26,"value":5122},{"type":21,"tag":2314,"props":29086,"children":29087},{"style":2321},[29088],{"type":26,"value":1309},{"type":21,"tag":2314,"props":29090,"children":29091},{"style":2339},[29092],{"type":26,"value":3513},{"type":21,"tag":2314,"props":29094,"children":29095},{"style":2321},[29096],{"type":26,"value":29097},"), (",{"type":21,"tag":2314,"props":29099,"children":29100},{"style":2339},[29101],{"type":26,"value":3513},{"type":21,"tag":2314,"props":29103,"children":29104},{"style":2321},[29105],{"type":26,"value":1309},{"type":21,"tag":2314,"props":29107,"children":29108},{"style":2339},[29109],{"type":26,"value":2413},{"type":21,"tag":2314,"props":29111,"children":29112},{"style":2321},[29113],{"type":26,"value":29097},{"type":21,"tag":2314,"props":29115,"children":29116},{"style":2339},[29117],{"type":26,"value":2413},{"type":21,"tag":2314,"props":29119,"children":29120},{"style":2321},[29121],{"type":26,"value":1309},{"type":21,"tag":2314,"props":29123,"children":29124},{"style":2339},[29125],{"type":26,"value":6465},{"type":21,"tag":2314,"props":29127,"children":29128},{"style":2321},[29129],{"type":26,"value":29097},{"type":21,"tag":2314,"props":29131,"children":29132},{"style":2339},[29133],{"type":26,"value":6465},{"type":21,"tag":2314,"props":29135,"children":29136},{"style":2321},[29137],{"type":26,"value":1309},{"type":21,"tag":2314,"props":29139,"children":29140},{"style":2339},[29141],{"type":26,"value":5122},{"type":21,"tag":2314,"props":29143,"children":29144},{"style":2321},[29145],{"type":26,"value":29146},")]\n",{"type":21,"tag":2314,"props":29148,"children":29149},{"class":2316,"line":127},[29150,29154,29158],{"type":21,"tag":2314,"props":29151,"children":29152},{"style":2321},[29153],{"type":26,"value":14139},{"type":21,"tag":2314,"props":29155,"children":29156},{"style":3157},[29157],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29159,"children":29160},{"style":2339},[29161],{"type":26,"value":12421},{"type":21,"tag":2314,"props":29163,"children":29164},{"class":2316,"line":887},[29165],{"type":21,"tag":2314,"props":29166,"children":29167},{"emptyLinePlaceholder":3181},[29168],{"type":26,"value":3184},{"type":21,"tag":2314,"props":29170,"children":29171},{"class":2316,"line":1364},[29172,29176,29180,29184,29188,29192,29196,29200],{"type":21,"tag":2314,"props":29173,"children":29174},{"style":2321},[29175],{"type":26,"value":14179},{"type":21,"tag":2314,"props":29177,"children":29178},{"style":3157},[29179],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29181,"children":29182},{"style":2321},[29183],{"type":26,"value":14188},{"type":21,"tag":2314,"props":29185,"children":29186},{"style":2350},[29187],{"type":26,"value":14193},{"type":21,"tag":2314,"props":29189,"children":29190},{"style":2321},[29191],{"type":26,"value":1309},{"type":21,"tag":2314,"props":29193,"children":29194},{"style":3222},[29195],{"type":26,"value":14202},{"type":21,"tag":2314,"props":29197,"children":29198},{"style":3157},[29199],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29201,"children":29202},{"style":2321},[29203],{"type":26,"value":14211},{"type":21,"tag":2314,"props":29205,"children":29206},{"class":2316,"line":3403},[29207],{"type":21,"tag":2314,"props":29208,"children":29209},{"emptyLinePlaceholder":3181},[29210],{"type":26,"value":3184},{"type":21,"tag":2314,"props":29212,"children":29213},{"class":2316,"line":3413},[29214,29218,29223],{"type":21,"tag":2314,"props":29215,"children":29216},{"style":3157},[29217],{"type":26,"value":4315},{"type":21,"tag":2314,"props":29219,"children":29220},{"style":4318},[29221],{"type":26,"value":29222}," cost_unitary",{"type":21,"tag":2314,"props":29224,"children":29225},{"style":2321},[29226],{"type":26,"value":29227},"(gamma):\n",{"type":21,"tag":2314,"props":29229,"children":29230},{"class":2316,"line":436},[29231],{"type":21,"tag":2314,"props":29232,"children":29233},{"style":2350},[29234],{"type":26,"value":29235},"    \"\"\"Encode the Max-Cut cost into phases.\"\"\"\n",{"type":21,"tag":2314,"props":29237,"children":29238},{"class":2316,"line":3473},[29239,29243,29248,29252],{"type":21,"tag":2314,"props":29240,"children":29241},{"style":3157},[29242],{"type":26,"value":4694},{"type":21,"tag":2314,"props":29244,"children":29245},{"style":2321},[29246],{"type":26,"value":29247}," u, v ",{"type":21,"tag":2314,"props":29249,"children":29250},{"style":3157},[29251],{"type":26,"value":3460},{"type":21,"tag":2314,"props":29253,"children":29254},{"style":2321},[29255],{"type":26,"value":29256}," edges:\n",{"type":21,"tag":2314,"props":29258,"children":29259},{"class":2316,"line":3521},[29260,29264,29268,29272],{"type":21,"tag":2314,"props":29261,"children":29262},{"style":2321},[29263],{"type":26,"value":26597},{"type":21,"tag":2314,"props":29265,"children":29266},{"style":3222},[29267],{"type":26,"value":14202},{"type":21,"tag":2314,"props":29269,"children":29270},{"style":3157},[29271],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29273,"children":29274},{"style":2321},[29275],{"type":26,"value":29276},"[u, v])\n",{"type":21,"tag":2314,"props":29278,"children":29279},{"class":2316,"line":3563},[29280,29285,29289,29293,29298,29302,29306],{"type":21,"tag":2314,"props":29281,"children":29282},{"style":2321},[29283],{"type":26,"value":29284},"        qml.RZ(",{"type":21,"tag":2314,"props":29286,"children":29287},{"style":2339},[29288],{"type":26,"value":2413},{"type":21,"tag":2314,"props":29290,"children":29291},{"style":3157},[29292],{"type":26,"value":8299},{"type":21,"tag":2314,"props":29294,"children":29295},{"style":2321},[29296],{"type":26,"value":29297}," gamma, ",{"type":21,"tag":2314,"props":29299,"children":29300},{"style":3222},[29301],{"type":26,"value":14202},{"type":21,"tag":2314,"props":29303,"children":29304},{"style":3157},[29305],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29307,"children":29308},{"style":2321},[29309],{"type":26,"value":29310},"v)\n",{"type":21,"tag":2314,"props":29312,"children":29313},{"class":2316,"line":4585},[29314,29318,29322,29326],{"type":21,"tag":2314,"props":29315,"children":29316},{"style":2321},[29317],{"type":26,"value":26597},{"type":21,"tag":2314,"props":29319,"children":29320},{"style":3222},[29321],{"type":26,"value":14202},{"type":21,"tag":2314,"props":29323,"children":29324},{"style":3157},[29325],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29327,"children":29328},{"style":2321},[29329],{"type":26,"value":29276},{"type":21,"tag":2314,"props":29331,"children":29332},{"class":2316,"line":4604},[29333],{"type":21,"tag":2314,"props":29334,"children":29335},{"emptyLinePlaceholder":3181},[29336],{"type":26,"value":3184},{"type":21,"tag":2314,"props":29338,"children":29339},{"class":2316,"line":4612},[29340,29344,29349],{"type":21,"tag":2314,"props":29341,"children":29342},{"style":3157},[29343],{"type":26,"value":4315},{"type":21,"tag":2314,"props":29345,"children":29346},{"style":4318},[29347],{"type":26,"value":29348}," mixer_unitary",{"type":21,"tag":2314,"props":29350,"children":29351},{"style":2321},[29352],{"type":26,"value":29353},"(beta):\n",{"type":21,"tag":2314,"props":29355,"children":29356},{"class":2316,"line":4643},[29357],{"type":21,"tag":2314,"props":29358,"children":29359},{"style":2350},[29360],{"type":26,"value":29361},"    \"\"\"Apply X-rotation mixer to all qubits.\"\"\"\n",{"type":21,"tag":2314,"props":29363,"children":29364},{"class":2316,"line":4688},[29365,29369,29373,29377,29381],{"type":21,"tag":2314,"props":29366,"children":29367},{"style":3157},[29368],{"type":26,"value":4694},{"type":21,"tag":2314,"props":29370,"children":29371},{"style":2321},[29372],{"type":26,"value":4699},{"type":21,"tag":2314,"props":29374,"children":29375},{"style":3157},[29376],{"type":26,"value":3460},{"type":21,"tag":2314,"props":29378,"children":29379},{"style":2339},[29380],{"type":26,"value":3465},{"type":21,"tag":2314,"props":29382,"children":29383},{"style":2321},[29384],{"type":26,"value":26532},{"type":21,"tag":2314,"props":29386,"children":29387},{"class":2316,"line":4727},[29388,29393,29397,29401,29406,29410,29414],{"type":21,"tag":2314,"props":29389,"children":29390},{"style":2321},[29391],{"type":26,"value":29392},"        qml.RX(",{"type":21,"tag":2314,"props":29394,"children":29395},{"style":2339},[29396],{"type":26,"value":2413},{"type":21,"tag":2314,"props":29398,"children":29399},{"style":3157},[29400],{"type":26,"value":8299},{"type":21,"tag":2314,"props":29402,"children":29403},{"style":2321},[29404],{"type":26,"value":29405}," beta, ",{"type":21,"tag":2314,"props":29407,"children":29408},{"style":3222},[29409],{"type":26,"value":14202},{"type":21,"tag":2314,"props":29411,"children":29412},{"style":3157},[29413],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29415,"children":29416},{"style":2321},[29417],{"type":26,"value":26553},{"type":21,"tag":2314,"props":29419,"children":29420},{"class":2316,"line":4745},[29421],{"type":21,"tag":2314,"props":29422,"children":29423},{"emptyLinePlaceholder":3181},[29424],{"type":26,"value":3184},{"type":21,"tag":2314,"props":29426,"children":29427},{"class":2316,"line":4819},[29428,29432],{"type":21,"tag":2314,"props":29429,"children":29430},{"style":4318},[29431],{"type":26,"value":14226},{"type":21,"tag":2314,"props":29433,"children":29434},{"style":2321},[29435],{"type":26,"value":14231},{"type":21,"tag":2314,"props":29437,"children":29438},{"class":2316,"line":4847},[29439,29443,29448,29453,29457,29461],{"type":21,"tag":2314,"props":29440,"children":29441},{"style":3157},[29442],{"type":26,"value":4315},{"type":21,"tag":2314,"props":29444,"children":29445},{"style":4318},[29446],{"type":26,"value":29447}," qaoa_circuit",{"type":21,"tag":2314,"props":29449,"children":29450},{"style":2321},[29451],{"type":26,"value":29452},"(params, p",{"type":21,"tag":2314,"props":29454,"children":29455},{"style":3157},[29456],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29458,"children":29459},{"style":2339},[29460],{"type":26,"value":3513},{"type":21,"tag":2314,"props":29462,"children":29463},{"style":2321},[29464],{"type":26,"value":4368},{"type":21,"tag":2314,"props":29466,"children":29467},{"class":2316,"line":4876},[29468,29473,29477],{"type":21,"tag":2314,"props":29469,"children":29470},{"style":2321},[29471],{"type":26,"value":29472},"    gammas ",{"type":21,"tag":2314,"props":29474,"children":29475},{"style":3157},[29476],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29478,"children":29479},{"style":2321},[29480],{"type":26,"value":29481}," params[:p]\n",{"type":21,"tag":2314,"props":29483,"children":29484},{"class":2316,"line":4885},[29485,29490,29494],{"type":21,"tag":2314,"props":29486,"children":29487},{"style":2321},[29488],{"type":26,"value":29489},"    betas ",{"type":21,"tag":2314,"props":29491,"children":29492},{"style":3157},[29493],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29495,"children":29496},{"style":2321},[29497],{"type":26,"value":29498}," params[p:]\n",{"type":21,"tag":2314,"props":29500,"children":29501},{"class":2316,"line":4913},[29502],{"type":21,"tag":2314,"props":29503,"children":29504},{"style":3407},[29505],{"type":26,"value":29506},"    # Start in uniform superposition\n",{"type":21,"tag":2314,"props":29508,"children":29509},{"class":2316,"line":4944},[29510,29514,29518,29522,29526],{"type":21,"tag":2314,"props":29511,"children":29512},{"style":3157},[29513],{"type":26,"value":4694},{"type":21,"tag":2314,"props":29515,"children":29516},{"style":2321},[29517],{"type":26,"value":4699},{"type":21,"tag":2314,"props":29519,"children":29520},{"style":3157},[29521],{"type":26,"value":3460},{"type":21,"tag":2314,"props":29523,"children":29524},{"style":2339},[29525],{"type":26,"value":3465},{"type":21,"tag":2314,"props":29527,"children":29528},{"style":2321},[29529],{"type":26,"value":26532},{"type":21,"tag":2314,"props":29531,"children":29532},{"class":2316,"line":4966},[29533,29538,29542,29546],{"type":21,"tag":2314,"props":29534,"children":29535},{"style":2321},[29536],{"type":26,"value":29537},"        qml.Hadamard(",{"type":21,"tag":2314,"props":29539,"children":29540},{"style":3222},[29541],{"type":26,"value":14202},{"type":21,"tag":2314,"props":29543,"children":29544},{"style":3157},[29545],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29547,"children":29548},{"style":2321},[29549],{"type":26,"value":26553},{"type":21,"tag":2314,"props":29551,"children":29552},{"class":2316,"line":5012},[29553],{"type":21,"tag":2314,"props":29554,"children":29555},{"style":3407},[29556],{"type":26,"value":29557},"    # Alternate p layers\n",{"type":21,"tag":2314,"props":29559,"children":29560},{"class":2316,"line":5025},[29561,29565,29570,29574,29578],{"type":21,"tag":2314,"props":29562,"children":29563},{"style":3157},[29564],{"type":26,"value":4694},{"type":21,"tag":2314,"props":29566,"children":29567},{"style":2321},[29568],{"type":26,"value":29569}," layer ",{"type":21,"tag":2314,"props":29571,"children":29572},{"style":3157},[29573],{"type":26,"value":3460},{"type":21,"tag":2314,"props":29575,"children":29576},{"style":2339},[29577],{"type":26,"value":3465},{"type":21,"tag":2314,"props":29579,"children":29580},{"style":2321},[29581],{"type":26,"value":29582},"(p):\n",{"type":21,"tag":2314,"props":29584,"children":29585},{"class":2316,"line":5033},[29586],{"type":21,"tag":2314,"props":29587,"children":29588},{"style":2321},[29589],{"type":26,"value":29590},"        cost_unitary(gammas[layer])\n",{"type":21,"tag":2314,"props":29592,"children":29593},{"class":2316,"line":5051},[29594],{"type":21,"tag":2314,"props":29595,"children":29596},{"style":2321},[29597],{"type":26,"value":29598},"        mixer_unitary(betas[layer])\n",{"type":21,"tag":2314,"props":29600,"children":29601},{"class":2316,"line":5069},[29602,29606,29610,29614,29618,29622],{"type":21,"tag":2314,"props":29603,"children":29604},{"style":3157},[29605],{"type":26,"value":4540},{"type":21,"tag":2314,"props":29607,"children":29608},{"style":2321},[29609],{"type":26,"value":21771},{"type":21,"tag":2314,"props":29611,"children":29612},{"style":3222},[29613],{"type":26,"value":14202},{"type":21,"tag":2314,"props":29615,"children":29616},{"style":3157},[29617],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29619,"children":29620},{"style":2339},[29621],{"type":26,"value":4896},{"type":21,"tag":2314,"props":29623,"children":29624},{"style":2321},[29625],{"type":26,"value":14339},{"type":21,"tag":2314,"props":29627,"children":29628},{"class":2316,"line":5077},[29629],{"type":21,"tag":2314,"props":29630,"children":29631},{"emptyLinePlaceholder":3181},[29632],{"type":26,"value":3184},{"type":21,"tag":2314,"props":29634,"children":29635},{"class":2316,"line":5111},[29636,29640,29645,29649,29653,29657],{"type":21,"tag":2314,"props":29637,"children":29638},{"style":3157},[29639],{"type":26,"value":4315},{"type":21,"tag":2314,"props":29641,"children":29642},{"style":4318},[29643],{"type":26,"value":29644}," expected_cut",{"type":21,"tag":2314,"props":29646,"children":29647},{"style":2321},[29648],{"type":26,"value":29452},{"type":21,"tag":2314,"props":29650,"children":29651},{"style":3157},[29652],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29654,"children":29655},{"style":2339},[29656],{"type":26,"value":3513},{"type":21,"tag":2314,"props":29658,"children":29659},{"style":2321},[29660],{"type":26,"value":4368},{"type":21,"tag":2314,"props":29662,"children":29663},{"class":2316,"line":5129},[29664],{"type":21,"tag":2314,"props":29665,"children":29666},{"style":2350},[29667],{"type":26,"value":29668},"    \"\"\"Classical cost function: expected number of cut edges.\"\"\"\n",{"type":21,"tag":2314,"props":29670,"children":29671},{"class":2316,"line":5154},[29672,29677,29681],{"type":21,"tag":2314,"props":29673,"children":29674},{"style":2321},[29675],{"type":26,"value":29676},"    probs ",{"type":21,"tag":2314,"props":29678,"children":29679},{"style":3157},[29680],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29682,"children":29683},{"style":2321},[29684],{"type":26,"value":29685}," qaoa_circuit(params, p)\n",{"type":21,"tag":2314,"props":29687,"children":29688},{"class":2316,"line":5196},[29689,29694,29698],{"type":21,"tag":2314,"props":29690,"children":29691},{"style":2321},[29692],{"type":26,"value":29693},"    total ",{"type":21,"tag":2314,"props":29695,"children":29696},{"style":3157},[29697],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29699,"children":29700},{"style":2339},[29701],{"type":26,"value":29702}," 0.0\n",{"type":21,"tag":2314,"props":29704,"children":29705},{"class":2316,"line":5204},[29706,29710,29715,29719,29723],{"type":21,"tag":2314,"props":29707,"children":29708},{"style":3157},[29709],{"type":26,"value":4694},{"type":21,"tag":2314,"props":29711,"children":29712},{"style":2321},[29713],{"type":26,"value":29714}," bitstring_idx, prob ",{"type":21,"tag":2314,"props":29716,"children":29717},{"style":3157},[29718],{"type":26,"value":3460},{"type":21,"tag":2314,"props":29720,"children":29721},{"style":2339},[29722],{"type":26,"value":4839},{"type":21,"tag":2314,"props":29724,"children":29725},{"style":2321},[29726],{"type":26,"value":29727},"(probs):\n",{"type":21,"tag":2314,"props":29729,"children":29730},{"class":2316,"line":5239},[29731,29735,29739,29743,29748,29752,29757,29761,29765,29769,29774],{"type":21,"tag":2314,"props":29732,"children":29733},{"style":2321},[29734],{"type":26,"value":4751},{"type":21,"tag":2314,"props":29736,"children":29737},{"style":3157},[29738],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29740,"children":29741},{"style":2339},[29742],{"type":26,"value":4760},{"type":21,"tag":2314,"props":29744,"children":29745},{"style":2321},[29746],{"type":26,"value":29747},"(bitstring_idx, ",{"type":21,"tag":2314,"props":29749,"children":29750},{"style":3157},[29751],{"type":26,"value":3282},{"type":21,"tag":2314,"props":29753,"children":29754},{"style":2350},[29755],{"type":26,"value":29756},"'0",{"type":21,"tag":2314,"props":29758,"children":29759},{"style":2339},[29760],{"type":26,"value":3292},{"type":21,"tag":2314,"props":29762,"children":29763},{"style":2321},[29764],{"type":26,"value":15451},{"type":21,"tag":2314,"props":29766,"children":29767},{"style":2339},[29768],{"type":26,"value":3302},{"type":21,"tag":2314,"props":29770,"children":29771},{"style":2350},[29772],{"type":26,"value":29773},"b'",{"type":21,"tag":2314,"props":29775,"children":29776},{"style":2321},[29777],{"type":26,"value":3257},{"type":21,"tag":2314,"props":29779,"children":29780},{"class":2316,"line":5355},[29781,29786,29790,29794,29798,29802,29807,29811,29815,29820,29825,29830,29835],{"type":21,"tag":2314,"props":29782,"children":29783},{"style":2321},[29784],{"type":26,"value":29785},"        cut ",{"type":21,"tag":2314,"props":29787,"children":29788},{"style":3157},[29789],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29791,"children":29792},{"style":2339},[29793],{"type":26,"value":6274},{"type":21,"tag":2314,"props":29795,"children":29796},{"style":2321},[29797],{"type":26,"value":3277},{"type":21,"tag":2314,"props":29799,"children":29800},{"style":2339},[29801],{"type":26,"value":3513},{"type":21,"tag":2314,"props":29803,"children":29804},{"style":3157},[29805],{"type":26,"value":29806}," for",{"type":21,"tag":2314,"props":29808,"children":29809},{"style":2321},[29810],{"type":26,"value":29247},{"type":21,"tag":2314,"props":29812,"children":29813},{"style":3157},[29814],{"type":26,"value":3460},{"type":21,"tag":2314,"props":29816,"children":29817},{"style":2321},[29818],{"type":26,"value":29819}," edges ",{"type":21,"tag":2314,"props":29821,"children":29822},{"style":3157},[29823],{"type":26,"value":29824},"if",{"type":21,"tag":2314,"props":29826,"children":29827},{"style":2321},[29828],{"type":26,"value":29829}," bits[u] ",{"type":21,"tag":2314,"props":29831,"children":29832},{"style":3157},[29833],{"type":26,"value":29834},"!=",{"type":21,"tag":2314,"props":29836,"children":29837},{"style":2321},[29838],{"type":26,"value":29839}," bits[v])\n",{"type":21,"tag":2314,"props":29841,"children":29842},{"class":2316,"line":5363},[29843,29848,29853,29858,29862],{"type":21,"tag":2314,"props":29844,"children":29845},{"style":2321},[29846],{"type":26,"value":29847},"        total ",{"type":21,"tag":2314,"props":29849,"children":29850},{"style":3157},[29851],{"type":26,"value":29852},"+=",{"type":21,"tag":2314,"props":29854,"children":29855},{"style":2321},[29856],{"type":26,"value":29857}," prob ",{"type":21,"tag":2314,"props":29859,"children":29860},{"style":3157},[29861],{"type":26,"value":6347},{"type":21,"tag":2314,"props":29863,"children":29864},{"style":2321},[29865],{"type":26,"value":29866}," cut\n",{"type":21,"tag":2314,"props":29868,"children":29869},{"class":2316,"line":5408},[29870,29874,29878,29883],{"type":21,"tag":2314,"props":29871,"children":29872},{"style":3157},[29873],{"type":26,"value":4540},{"type":21,"tag":2314,"props":29875,"children":29876},{"style":3157},[29877],{"type":26,"value":4506},{"type":21,"tag":2314,"props":29879,"children":29880},{"style":2321},[29881],{"type":26,"value":29882},"total  ",{"type":21,"tag":2314,"props":29884,"children":29885},{"style":3407},[29886],{"type":26,"value":29887},"# Minimize negative cut\n",{"type":21,"tag":2314,"props":29889,"children":29890},{"class":2316,"line":5426},[29891],{"type":21,"tag":2314,"props":29892,"children":29893},{"emptyLinePlaceholder":3181},[29894],{"type":26,"value":3184},{"type":21,"tag":2314,"props":29896,"children":29897},{"class":2316,"line":5434},[29898],{"type":21,"tag":2314,"props":29899,"children":29900},{"style":3407},[29901],{"type":26,"value":29902},"# Optimize p=1 QAOA\n",{"type":21,"tag":2314,"props":29904,"children":29905},{"class":2316,"line":5522},[29906,29911,29915],{"type":21,"tag":2314,"props":29907,"children":29908},{"style":2321},[29909],{"type":26,"value":29910},"p ",{"type":21,"tag":2314,"props":29912,"children":29913},{"style":3157},[29914],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29916,"children":29917},{"style":2339},[29918],{"type":26,"value":12747},{"type":21,"tag":2314,"props":29920,"children":29921},{"class":2316,"line":15026},[29922,29927,29931,29935,29939,29944,29948,29952],{"type":21,"tag":2314,"props":29923,"children":29924},{"style":2321},[29925],{"type":26,"value":29926},"init_params ",{"type":21,"tag":2314,"props":29928,"children":29929},{"style":3157},[29930],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29932,"children":29933},{"style":2321},[29934],{"type":26,"value":25196},{"type":21,"tag":2314,"props":29936,"children":29937},{"style":2339},[29938],{"type":26,"value":5122},{"type":21,"tag":2314,"props":29940,"children":29941},{"style":2321},[29942],{"type":26,"value":29943},", np.pi, ",{"type":21,"tag":2314,"props":29945,"children":29946},{"style":2339},[29947],{"type":26,"value":2413},{"type":21,"tag":2314,"props":29949,"children":29950},{"style":3157},[29951],{"type":26,"value":8299},{"type":21,"tag":2314,"props":29953,"children":29954},{"style":2321},[29955],{"type":26,"value":29956}," p)\n",{"type":21,"tag":2314,"props":29958,"children":29959},{"class":2316,"line":15044},[29960,29964,29968,29973,29978,29982,29986],{"type":21,"tag":2314,"props":29961,"children":29962},{"style":2321},[29963],{"type":26,"value":19287},{"type":21,"tag":2314,"props":29965,"children":29966},{"style":3157},[29967],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29969,"children":29970},{"style":2321},[29971],{"type":26,"value":29972}," minimize(expected_cut, init_params, ",{"type":21,"tag":2314,"props":29974,"children":29975},{"style":3222},[29976],{"type":26,"value":29977},"method",{"type":21,"tag":2314,"props":29979,"children":29980},{"style":3157},[29981],{"type":26,"value":3197},{"type":21,"tag":2314,"props":29983,"children":29984},{"style":2350},[29985],{"type":26,"value":22849},{"type":21,"tag":2314,"props":29987,"children":29988},{"style":2321},[29989],{"type":26,"value":2418},{"type":21,"tag":2314,"props":29991,"children":29992},{"class":2316,"line":15062},[29993,29998,30002,30006,30011,30015,30019],{"type":21,"tag":2314,"props":29994,"children":29995},{"style":3222},[29996],{"type":26,"value":29997},"                  options",{"type":21,"tag":2314,"props":29999,"children":30000},{"style":3157},[30001],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30003,"children":30004},{"style":2321},[30005],{"type":26,"value":3292},{"type":21,"tag":2314,"props":30007,"children":30008},{"style":2350},[30009],{"type":26,"value":30010},"'maxiter'",{"type":21,"tag":2314,"props":30012,"children":30013},{"style":2321},[30014],{"type":26,"value":2408},{"type":21,"tag":2314,"props":30016,"children":30017},{"style":2339},[30018],{"type":26,"value":14584},{"type":21,"tag":2314,"props":30020,"children":30021},{"style":2321},[30022],{"type":26,"value":30023},"})\n",{"type":21,"tag":2314,"props":30025,"children":30026},{"class":2316,"line":15070},[30027],{"type":21,"tag":2314,"props":30028,"children":30029},{"emptyLinePlaceholder":3181},[30030],{"type":26,"value":3184},{"type":21,"tag":2314,"props":30032,"children":30033},{"class":2316,"line":15104},[30034,30038,30042,30046,30051,30055,30060,30064,30068],{"type":21,"tag":2314,"props":30035,"children":30036},{"style":2339},[30037],{"type":26,"value":3272},{"type":21,"tag":2314,"props":30039,"children":30040},{"style":2321},[30041],{"type":26,"value":3277},{"type":21,"tag":2314,"props":30043,"children":30044},{"style":3157},[30045],{"type":26,"value":3282},{"type":21,"tag":2314,"props":30047,"children":30048},{"style":2350},[30049],{"type":26,"value":30050},"\"Optimized params: ",{"type":21,"tag":2314,"props":30052,"children":30053},{"style":2339},[30054],{"type":26,"value":3292},{"type":21,"tag":2314,"props":30056,"children":30057},{"style":2321},[30058],{"type":26,"value":30059},"result.x",{"type":21,"tag":2314,"props":30061,"children":30062},{"style":2339},[30063],{"type":26,"value":3302},{"type":21,"tag":2314,"props":30065,"children":30066},{"style":2350},[30067],{"type":26,"value":3307},{"type":21,"tag":2314,"props":30069,"children":30070},{"style":2321},[30071],{"type":26,"value":3257},{"type":21,"tag":2314,"props":30073,"children":30074},{"class":2316,"line":15139},[30075,30079,30083,30087,30092,30096,30100,30105,30109,30113,30118],{"type":21,"tag":2314,"props":30076,"children":30077},{"style":2339},[30078],{"type":26,"value":3272},{"type":21,"tag":2314,"props":30080,"children":30081},{"style":2321},[30082],{"type":26,"value":3277},{"type":21,"tag":2314,"props":30084,"children":30085},{"style":3157},[30086],{"type":26,"value":3282},{"type":21,"tag":2314,"props":30088,"children":30089},{"style":2350},[30090],{"type":26,"value":30091},"\"Expected cut: ",{"type":21,"tag":2314,"props":30093,"children":30094},{"style":2339},[30095],{"type":26,"value":3292},{"type":21,"tag":2314,"props":30097,"children":30098},{"style":3157},[30099],{"type":26,"value":4802},{"type":21,"tag":2314,"props":30101,"children":30102},{"style":2321},[30103],{"type":26,"value":30104},"result.fun",{"type":21,"tag":2314,"props":30106,"children":30107},{"style":3157},[30108],{"type":26,"value":15242},{"type":21,"tag":2314,"props":30110,"children":30111},{"style":2339},[30112],{"type":26,"value":3302},{"type":21,"tag":2314,"props":30114,"children":30115},{"style":2350},[30116],{"type":26,"value":30117}," \u002F 4.0 maximum\"",{"type":21,"tag":2314,"props":30119,"children":30120},{"style":2321},[30121],{"type":26,"value":3257},{"type":21,"tag":22,"props":30123,"children":30124},{},[30125,30127,30132,30134,30140],{"type":26,"value":30126},"在 ",{"type":21,"tag":2073,"props":30128,"children":30130},{"className":30129},[],[30131],{"type":26,"value":19498},{"type":26,"value":30133}," 的情况下运行此代码通常能达到 ",{"type":21,"tag":2073,"props":30135,"children":30137},{"className":30136},[],[30138],{"type":26,"value":30139},"expected_cut ≈ 3.5",{"type":26,"value":30141},"——即最大割的 87.5%。",{"type":21,"tag":29,"props":30143,"children":30145},{"id":30144},"采样最佳解",[30146],{"type":26,"value":30144},{"type":21,"tag":22,"props":30148,"children":30149},{},[30150],{"type":26,"value":30151},"优化之后，对电路进行采样以找出最可能的好解：",{"type":21,"tag":2304,"props":30153,"children":30155},{"code":30154,"language":3147,"meta":7,"className":3145,"style":7},"@qml.qnode(dev)\ndef sample_circuit(params, p=1, shots=1000):\n    gammas = params[:p]\n    betas = params[p:]\n    for i in range(n_qubits):\n        qml.Hadamard(wires=i)\n    for layer in range(p):\n        cost_unitary(gammas[layer])\n        mixer_unitary(betas[layer])\n    return qml.sample(wires=range(n_qubits))\n\nsamples = sample_circuit(result.x, shots=1000)\n\n# Count cut values for each bitstring\nfrom collections import Counter\ncut_counts = Counter()\nfor bits in samples:\n    key = ''.join(str(b) for b in bits)\n    cut = sum(1 for u, v in edges if bits[u] != bits[v])\n    cut_counts[(key, cut)] += 1\n\n# Show top 5 most frequent bitstrings\nfor (bits, cut), count in sorted(cut_counts.items(), key=lambda x: -x[1])[:5]:\n    print(f\"{bits}  cut={cut}  frequency={count\u002F10:.1f}%\")\n",[30156],{"type":21,"tag":2073,"props":30157,"children":30158},{"__ignoreMap":7},[30159,30170,30211,30226,30241,30264,30283,30306,30313,30320,30348,30355,30388,30395,30403,30424,30441,30462,30511,30567,30583,30590,30598,30661],{"type":21,"tag":2314,"props":30160,"children":30161},{"class":2316,"line":2317},[30162,30166],{"type":21,"tag":2314,"props":30163,"children":30164},{"style":4318},[30165],{"type":26,"value":14226},{"type":21,"tag":2314,"props":30167,"children":30168},{"style":2321},[30169],{"type":26,"value":14231},{"type":21,"tag":2314,"props":30171,"children":30172},{"class":2316,"line":106},[30173,30177,30182,30186,30190,30194,30199,30203,30207],{"type":21,"tag":2314,"props":30174,"children":30175},{"style":3157},[30176],{"type":26,"value":4315},{"type":21,"tag":2314,"props":30178,"children":30179},{"style":4318},[30180],{"type":26,"value":30181}," sample_circuit",{"type":21,"tag":2314,"props":30183,"children":30184},{"style":2321},[30185],{"type":26,"value":29452},{"type":21,"tag":2314,"props":30187,"children":30188},{"style":3157},[30189],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30191,"children":30192},{"style":2339},[30193],{"type":26,"value":3513},{"type":21,"tag":2314,"props":30195,"children":30196},{"style":2321},[30197],{"type":26,"value":30198},", shots",{"type":21,"tag":2314,"props":30200,"children":30201},{"style":3157},[30202],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30204,"children":30205},{"style":2339},[30206],{"type":26,"value":20419},{"type":21,"tag":2314,"props":30208,"children":30209},{"style":2321},[30210],{"type":26,"value":4368},{"type":21,"tag":2314,"props":30212,"children":30213},{"class":2316,"line":2335},[30214,30218,30222],{"type":21,"tag":2314,"props":30215,"children":30216},{"style":2321},[30217],{"type":26,"value":29472},{"type":21,"tag":2314,"props":30219,"children":30220},{"style":3157},[30221],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30223,"children":30224},{"style":2321},[30225],{"type":26,"value":29481},{"type":21,"tag":2314,"props":30227,"children":30228},{"class":2316,"line":2397},[30229,30233,30237],{"type":21,"tag":2314,"props":30230,"children":30231},{"style":2321},[30232],{"type":26,"value":29489},{"type":21,"tag":2314,"props":30234,"children":30235},{"style":3157},[30236],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30238,"children":30239},{"style":2321},[30240],{"type":26,"value":29498},{"type":21,"tag":2314,"props":30242,"children":30243},{"class":2316,"line":2421},[30244,30248,30252,30256,30260],{"type":21,"tag":2314,"props":30245,"children":30246},{"style":3157},[30247],{"type":26,"value":4694},{"type":21,"tag":2314,"props":30249,"children":30250},{"style":2321},[30251],{"type":26,"value":4699},{"type":21,"tag":2314,"props":30253,"children":30254},{"style":3157},[30255],{"type":26,"value":3460},{"type":21,"tag":2314,"props":30257,"children":30258},{"style":2339},[30259],{"type":26,"value":3465},{"type":21,"tag":2314,"props":30261,"children":30262},{"style":2321},[30263],{"type":26,"value":26532},{"type":21,"tag":2314,"props":30265,"children":30266},{"class":2316,"line":16},[30267,30271,30275,30279],{"type":21,"tag":2314,"props":30268,"children":30269},{"style":2321},[30270],{"type":26,"value":29537},{"type":21,"tag":2314,"props":30272,"children":30273},{"style":3222},[30274],{"type":26,"value":14202},{"type":21,"tag":2314,"props":30276,"children":30277},{"style":3157},[30278],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30280,"children":30281},{"style":2321},[30282],{"type":26,"value":26553},{"type":21,"tag":2314,"props":30284,"children":30285},{"class":2316,"line":127},[30286,30290,30294,30298,30302],{"type":21,"tag":2314,"props":30287,"children":30288},{"style":3157},[30289],{"type":26,"value":4694},{"type":21,"tag":2314,"props":30291,"children":30292},{"style":2321},[30293],{"type":26,"value":29569},{"type":21,"tag":2314,"props":30295,"children":30296},{"style":3157},[30297],{"type":26,"value":3460},{"type":21,"tag":2314,"props":30299,"children":30300},{"style":2339},[30301],{"type":26,"value":3465},{"type":21,"tag":2314,"props":30303,"children":30304},{"style":2321},[30305],{"type":26,"value":29582},{"type":21,"tag":2314,"props":30307,"children":30308},{"class":2316,"line":887},[30309],{"type":21,"tag":2314,"props":30310,"children":30311},{"style":2321},[30312],{"type":26,"value":29590},{"type":21,"tag":2314,"props":30314,"children":30315},{"class":2316,"line":1364},[30316],{"type":21,"tag":2314,"props":30317,"children":30318},{"style":2321},[30319],{"type":26,"value":29598},{"type":21,"tag":2314,"props":30321,"children":30322},{"class":2316,"line":3403},[30323,30327,30332,30336,30340,30344],{"type":21,"tag":2314,"props":30324,"children":30325},{"style":3157},[30326],{"type":26,"value":4540},{"type":21,"tag":2314,"props":30328,"children":30329},{"style":2321},[30330],{"type":26,"value":30331}," qml.sample(",{"type":21,"tag":2314,"props":30333,"children":30334},{"style":3222},[30335],{"type":26,"value":14202},{"type":21,"tag":2314,"props":30337,"children":30338},{"style":3157},[30339],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30341,"children":30342},{"style":2339},[30343],{"type":26,"value":4896},{"type":21,"tag":2314,"props":30345,"children":30346},{"style":2321},[30347],{"type":26,"value":14339},{"type":21,"tag":2314,"props":30349,"children":30350},{"class":2316,"line":3413},[30351],{"type":21,"tag":2314,"props":30352,"children":30353},{"emptyLinePlaceholder":3181},[30354],{"type":26,"value":3184},{"type":21,"tag":2314,"props":30356,"children":30357},{"class":2316,"line":436},[30358,30363,30367,30372,30376,30380,30384],{"type":21,"tag":2314,"props":30359,"children":30360},{"style":2321},[30361],{"type":26,"value":30362},"samples ",{"type":21,"tag":2314,"props":30364,"children":30365},{"style":3157},[30366],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30368,"children":30369},{"style":2321},[30370],{"type":26,"value":30371}," sample_circuit(result.x, ",{"type":21,"tag":2314,"props":30373,"children":30374},{"style":3222},[30375],{"type":26,"value":4077},{"type":21,"tag":2314,"props":30377,"children":30378},{"style":3157},[30379],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30381,"children":30382},{"style":2339},[30383],{"type":26,"value":20419},{"type":21,"tag":2314,"props":30385,"children":30386},{"style":2321},[30387],{"type":26,"value":3257},{"type":21,"tag":2314,"props":30389,"children":30390},{"class":2316,"line":3473},[30391],{"type":21,"tag":2314,"props":30392,"children":30393},{"emptyLinePlaceholder":3181},[30394],{"type":26,"value":3184},{"type":21,"tag":2314,"props":30396,"children":30397},{"class":2316,"line":3521},[30398],{"type":21,"tag":2314,"props":30399,"children":30400},{"style":3407},[30401],{"type":26,"value":30402},"# Count cut values for each bitstring\n",{"type":21,"tag":2314,"props":30404,"children":30405},{"class":2316,"line":3563},[30406,30410,30415,30419],{"type":21,"tag":2314,"props":30407,"children":30408},{"style":3157},[30409],{"type":26,"value":3160},{"type":21,"tag":2314,"props":30411,"children":30412},{"style":2321},[30413],{"type":26,"value":30414}," collections ",{"type":21,"tag":2314,"props":30416,"children":30417},{"style":3157},[30418],{"type":26,"value":3170},{"type":21,"tag":2314,"props":30420,"children":30421},{"style":2321},[30422],{"type":26,"value":30423}," Counter\n",{"type":21,"tag":2314,"props":30425,"children":30426},{"class":2316,"line":4585},[30427,30432,30436],{"type":21,"tag":2314,"props":30428,"children":30429},{"style":2321},[30430],{"type":26,"value":30431},"cut_counts ",{"type":21,"tag":2314,"props":30433,"children":30434},{"style":3157},[30435],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30437,"children":30438},{"style":2321},[30439],{"type":26,"value":30440}," Counter()\n",{"type":21,"tag":2314,"props":30442,"children":30443},{"class":2316,"line":4604},[30444,30448,30453,30457],{"type":21,"tag":2314,"props":30445,"children":30446},{"style":3157},[30447],{"type":26,"value":3450},{"type":21,"tag":2314,"props":30449,"children":30450},{"style":2321},[30451],{"type":26,"value":30452}," bits ",{"type":21,"tag":2314,"props":30454,"children":30455},{"style":3157},[30456],{"type":26,"value":3460},{"type":21,"tag":2314,"props":30458,"children":30459},{"style":2321},[30460],{"type":26,"value":30461}," samples:\n",{"type":21,"tag":2314,"props":30463,"children":30464},{"class":2316,"line":4612},[30465,30470,30474,30479,30484,30489,30494,30498,30502,30506],{"type":21,"tag":2314,"props":30466,"children":30467},{"style":2321},[30468],{"type":26,"value":30469},"    key ",{"type":21,"tag":2314,"props":30471,"children":30472},{"style":3157},[30473],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30475,"children":30476},{"style":2350},[30477],{"type":26,"value":30478}," ''",{"type":21,"tag":2314,"props":30480,"children":30481},{"style":2321},[30482],{"type":26,"value":30483},".join(",{"type":21,"tag":2314,"props":30485,"children":30486},{"style":2339},[30487],{"type":26,"value":30488},"str",{"type":21,"tag":2314,"props":30490,"children":30491},{"style":2321},[30492],{"type":26,"value":30493},"(b) ",{"type":21,"tag":2314,"props":30495,"children":30496},{"style":3157},[30497],{"type":26,"value":3450},{"type":21,"tag":2314,"props":30499,"children":30500},{"style":2321},[30501],{"type":26,"value":4858},{"type":21,"tag":2314,"props":30503,"children":30504},{"style":3157},[30505],{"type":26,"value":3460},{"type":21,"tag":2314,"props":30507,"children":30508},{"style":2321},[30509],{"type":26,"value":30510}," bits)\n",{"type":21,"tag":2314,"props":30512,"children":30513},{"class":2316,"line":4643},[30514,30519,30523,30527,30531,30535,30539,30543,30547,30551,30555,30559,30563],{"type":21,"tag":2314,"props":30515,"children":30516},{"style":2321},[30517],{"type":26,"value":30518},"    cut ",{"type":21,"tag":2314,"props":30520,"children":30521},{"style":3157},[30522],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30524,"children":30525},{"style":2339},[30526],{"type":26,"value":6274},{"type":21,"tag":2314,"props":30528,"children":30529},{"style":2321},[30530],{"type":26,"value":3277},{"type":21,"tag":2314,"props":30532,"children":30533},{"style":2339},[30534],{"type":26,"value":3513},{"type":21,"tag":2314,"props":30536,"children":30537},{"style":3157},[30538],{"type":26,"value":29806},{"type":21,"tag":2314,"props":30540,"children":30541},{"style":2321},[30542],{"type":26,"value":29247},{"type":21,"tag":2314,"props":30544,"children":30545},{"style":3157},[30546],{"type":26,"value":3460},{"type":21,"tag":2314,"props":30548,"children":30549},{"style":2321},[30550],{"type":26,"value":29819},{"type":21,"tag":2314,"props":30552,"children":30553},{"style":3157},[30554],{"type":26,"value":29824},{"type":21,"tag":2314,"props":30556,"children":30557},{"style":2321},[30558],{"type":26,"value":29829},{"type":21,"tag":2314,"props":30560,"children":30561},{"style":3157},[30562],{"type":26,"value":29834},{"type":21,"tag":2314,"props":30564,"children":30565},{"style":2321},[30566],{"type":26,"value":29839},{"type":21,"tag":2314,"props":30568,"children":30569},{"class":2316,"line":4688},[30570,30575,30579],{"type":21,"tag":2314,"props":30571,"children":30572},{"style":2321},[30573],{"type":26,"value":30574},"    cut_counts[(key, cut)] ",{"type":21,"tag":2314,"props":30576,"children":30577},{"style":3157},[30578],{"type":26,"value":29852},{"type":21,"tag":2314,"props":30580,"children":30581},{"style":2339},[30582],{"type":26,"value":12747},{"type":21,"tag":2314,"props":30584,"children":30585},{"class":2316,"line":4727},[30586],{"type":21,"tag":2314,"props":30587,"children":30588},{"emptyLinePlaceholder":3181},[30589],{"type":26,"value":3184},{"type":21,"tag":2314,"props":30591,"children":30592},{"class":2316,"line":4745},[30593],{"type":21,"tag":2314,"props":30594,"children":30595},{"style":3407},[30596],{"type":26,"value":30597},"# Show top 5 most frequent bitstrings\n",{"type":21,"tag":2314,"props":30599,"children":30600},{"class":2316,"line":4819},[30601,30605,30610,30614,30618,30623,30627,30631,30636,30640,30645,30649,30653,30657],{"type":21,"tag":2314,"props":30602,"children":30603},{"style":3157},[30604],{"type":26,"value":3450},{"type":21,"tag":2314,"props":30606,"children":30607},{"style":2321},[30608],{"type":26,"value":30609}," (bits, cut), count ",{"type":21,"tag":2314,"props":30611,"children":30612},{"style":3157},[30613],{"type":26,"value":3460},{"type":21,"tag":2314,"props":30615,"children":30616},{"style":2339},[30617],{"type":26,"value":17092},{"type":21,"tag":2314,"props":30619,"children":30620},{"style":2321},[30621],{"type":26,"value":30622},"(cut_counts.items(), ",{"type":21,"tag":2314,"props":30624,"children":30625},{"style":3222},[30626],{"type":26,"value":3498},{"type":21,"tag":2314,"props":30628,"children":30629},{"style":3157},[30630],{"type":26,"value":3503},{"type":21,"tag":2314,"props":30632,"children":30633},{"style":2321},[30634],{"type":26,"value":30635}," x: ",{"type":21,"tag":2314,"props":30637,"children":30638},{"style":3157},[30639],{"type":26,"value":4802},{"type":21,"tag":2314,"props":30641,"children":30642},{"style":2321},[30643],{"type":26,"value":30644},"x[",{"type":21,"tag":2314,"props":30646,"children":30647},{"style":2339},[30648],{"type":26,"value":3513},{"type":21,"tag":2314,"props":30650,"children":30651},{"style":2321},[30652],{"type":26,"value":17531},{"type":21,"tag":2314,"props":30654,"children":30655},{"style":2339},[30656],{"type":26,"value":6636},{"type":21,"tag":2314,"props":30658,"children":30659},{"style":2321},[30660],{"type":26,"value":17540},{"type":21,"tag":2314,"props":30662,"children":30663},{"class":2316,"line":4847},[30664,30668,30672,30676,30680,30684,30688,30692,30697,30701,30706,30710,30715,30719,30724,30728,30732,30737,30741,30746],{"type":21,"tag":2314,"props":30665,"children":30666},{"style":2339},[30667],{"type":26,"value":17179},{"type":21,"tag":2314,"props":30669,"children":30670},{"style":2321},[30671],{"type":26,"value":3277},{"type":21,"tag":2314,"props":30673,"children":30674},{"style":3157},[30675],{"type":26,"value":3282},{"type":21,"tag":2314,"props":30677,"children":30678},{"style":2350},[30679],{"type":26,"value":3307},{"type":21,"tag":2314,"props":30681,"children":30682},{"style":2339},[30683],{"type":26,"value":3292},{"type":21,"tag":2314,"props":30685,"children":30686},{"style":2321},[30687],{"type":26,"value":17200},{"type":21,"tag":2314,"props":30689,"children":30690},{"style":2339},[30691],{"type":26,"value":3302},{"type":21,"tag":2314,"props":30693,"children":30694},{"style":2350},[30695],{"type":26,"value":30696},"  cut=",{"type":21,"tag":2314,"props":30698,"children":30699},{"style":2339},[30700],{"type":26,"value":3292},{"type":21,"tag":2314,"props":30702,"children":30703},{"style":2321},[30704],{"type":26,"value":30705},"cut",{"type":21,"tag":2314,"props":30707,"children":30708},{"style":2339},[30709],{"type":26,"value":3302},{"type":21,"tag":2314,"props":30711,"children":30712},{"style":2350},[30713],{"type":26,"value":30714},"  frequency=",{"type":21,"tag":2314,"props":30716,"children":30717},{"style":2339},[30718],{"type":26,"value":3292},{"type":21,"tag":2314,"props":30720,"children":30721},{"style":2321},[30722],{"type":26,"value":30723},"count",{"type":21,"tag":2314,"props":30725,"children":30726},{"style":3157},[30727],{"type":26,"value":2168},{"type":21,"tag":2314,"props":30729,"children":30730},{"style":2339},[30731],{"type":26,"value":20476},{"type":21,"tag":2314,"props":30733,"children":30734},{"style":3157},[30735],{"type":26,"value":30736},":.1f",{"type":21,"tag":2314,"props":30738,"children":30739},{"style":2339},[30740],{"type":26,"value":3302},{"type":21,"tag":2314,"props":30742,"children":30743},{"style":2350},[30744],{"type":26,"value":30745},"%\"",{"type":21,"tag":2314,"props":30747,"children":30748},{"style":2321},[30749],{"type":26,"value":3257},{"type":21,"tag":22,"props":30751,"children":30752},{},[30753],{"type":26,"value":30754},"预期输出：",{"type":21,"tag":2304,"props":30756,"children":30758},{"code":30757},"0101  cut=4  frequency=28.3%\n1010  cut=4  frequency=27.1%\n0110  cut=3  frequency=8.4%\n...\n",[30759],{"type":21,"tag":2073,"props":30760,"children":30761},{"__ignoreMap":7},[30762],{"type":26,"value":30757},{"type":21,"tag":22,"props":30764,"children":30765},{},[30766,30768,30773,30774,30779],{"type":26,"value":30767},"最优解（",{"type":21,"tag":2073,"props":30769,"children":30771},{"className":30770},[],[30772],{"type":26,"value":28893},{"type":26,"value":18114},{"type":21,"tag":2073,"props":30775,"children":30777},{"className":30776},[],[30778],{"type":26,"value":17385},{"type":26,"value":30780},"）占据主导地位——QAOA 放大了它们的概率。",{"type":21,"tag":29,"props":30782,"children":30784},{"id":30783},"用-hlquantum-解决同一问题",[30785],{"type":26,"value":30786},"用 HLQuantum 解决同一问题",{"type":21,"tag":22,"props":30788,"children":30789},{},[30790],{"type":26,"value":30791},"HLQuantum 内置的 QAOA 让你完全跳过电路构建：",{"type":21,"tag":2304,"props":30793,"children":30795},{"code":30794,"language":3147,"meta":7,"className":3145,"style":7},"import hlquantum as hlq\n\ngraph = [(0, 1), (1, 2), (2, 3), (3, 0)]\n\nresult = hlq.algorithms.qaoa(\n    graph=graph,\n    problem='max_cut',\n    p=2,\n    backend='pennylane',\n    shots=2000,\n)\n\nprint(result.best_solution)   # '0101' or '1010'\nprint(result.cut_value)       # 4\nprint(result.approximation_ratio)  # ~0.96 for p=2\n",[30796],{"type":21,"tag":2073,"props":30797,"children":30798},{"__ignoreMap":7},[30799,30818,30825,30905,30912,30928,30945,30966,30986,31005,31025,31032,31039,31056,31073],{"type":21,"tag":2314,"props":30800,"children":30801},{"class":2316,"line":2317},[30802,30806,30810,30814],{"type":21,"tag":2314,"props":30803,"children":30804},{"style":3157},[30805],{"type":26,"value":3170},{"type":21,"tag":2314,"props":30807,"children":30808},{"style":2321},[30809],{"type":26,"value":19255},{"type":21,"tag":2314,"props":30811,"children":30812},{"style":3157},[30813],{"type":26,"value":4232},{"type":21,"tag":2314,"props":30815,"children":30816},{"style":2321},[30817],{"type":26,"value":19264},{"type":21,"tag":2314,"props":30819,"children":30820},{"class":2316,"line":106},[30821],{"type":21,"tag":2314,"props":30822,"children":30823},{"emptyLinePlaceholder":3181},[30824],{"type":26,"value":3184},{"type":21,"tag":2314,"props":30826,"children":30827},{"class":2316,"line":2335},[30828,30833,30837,30841,30845,30849,30853,30857,30861,30865,30869,30873,30877,30881,30885,30889,30893,30897,30901],{"type":21,"tag":2314,"props":30829,"children":30830},{"style":2321},[30831],{"type":26,"value":30832},"graph ",{"type":21,"tag":2314,"props":30834,"children":30835},{"style":3157},[30836],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30838,"children":30839},{"style":2321},[30840],{"type":26,"value":29080},{"type":21,"tag":2314,"props":30842,"children":30843},{"style":2339},[30844],{"type":26,"value":5122},{"type":21,"tag":2314,"props":30846,"children":30847},{"style":2321},[30848],{"type":26,"value":1309},{"type":21,"tag":2314,"props":30850,"children":30851},{"style":2339},[30852],{"type":26,"value":3513},{"type":21,"tag":2314,"props":30854,"children":30855},{"style":2321},[30856],{"type":26,"value":29097},{"type":21,"tag":2314,"props":30858,"children":30859},{"style":2339},[30860],{"type":26,"value":3513},{"type":21,"tag":2314,"props":30862,"children":30863},{"style":2321},[30864],{"type":26,"value":1309},{"type":21,"tag":2314,"props":30866,"children":30867},{"style":2339},[30868],{"type":26,"value":2413},{"type":21,"tag":2314,"props":30870,"children":30871},{"style":2321},[30872],{"type":26,"value":29097},{"type":21,"tag":2314,"props":30874,"children":30875},{"style":2339},[30876],{"type":26,"value":2413},{"type":21,"tag":2314,"props":30878,"children":30879},{"style":2321},[30880],{"type":26,"value":1309},{"type":21,"tag":2314,"props":30882,"children":30883},{"style":2339},[30884],{"type":26,"value":6465},{"type":21,"tag":2314,"props":30886,"children":30887},{"style":2321},[30888],{"type":26,"value":29097},{"type":21,"tag":2314,"props":30890,"children":30891},{"style":2339},[30892],{"type":26,"value":6465},{"type":21,"tag":2314,"props":30894,"children":30895},{"style":2321},[30896],{"type":26,"value":1309},{"type":21,"tag":2314,"props":30898,"children":30899},{"style":2339},[30900],{"type":26,"value":5122},{"type":21,"tag":2314,"props":30902,"children":30903},{"style":2321},[30904],{"type":26,"value":29146},{"type":21,"tag":2314,"props":30906,"children":30907},{"class":2316,"line":2397},[30908],{"type":21,"tag":2314,"props":30909,"children":30910},{"emptyLinePlaceholder":3181},[30911],{"type":26,"value":3184},{"type":21,"tag":2314,"props":30913,"children":30914},{"class":2316,"line":2421},[30915,30919,30923],{"type":21,"tag":2314,"props":30916,"children":30917},{"style":2321},[30918],{"type":26,"value":19287},{"type":21,"tag":2314,"props":30920,"children":30921},{"style":3157},[30922],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30924,"children":30925},{"style":2321},[30926],{"type":26,"value":30927}," hlq.algorithms.qaoa(\n",{"type":21,"tag":2314,"props":30929,"children":30930},{"class":2316,"line":16},[30931,30936,30940],{"type":21,"tag":2314,"props":30932,"children":30933},{"style":3222},[30934],{"type":26,"value":30935},"    graph",{"type":21,"tag":2314,"props":30937,"children":30938},{"style":3157},[30939],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30941,"children":30942},{"style":2321},[30943],{"type":26,"value":30944},"graph,\n",{"type":21,"tag":2314,"props":30946,"children":30947},{"class":2316,"line":127},[30948,30953,30957,30962],{"type":21,"tag":2314,"props":30949,"children":30950},{"style":3222},[30951],{"type":26,"value":30952},"    problem",{"type":21,"tag":2314,"props":30954,"children":30955},{"style":3157},[30956],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30958,"children":30959},{"style":2350},[30960],{"type":26,"value":30961},"'max_cut'",{"type":21,"tag":2314,"props":30963,"children":30964},{"style":2321},[30965],{"type":26,"value":2418},{"type":21,"tag":2314,"props":30967,"children":30968},{"class":2316,"line":887},[30969,30974,30978,30982],{"type":21,"tag":2314,"props":30970,"children":30971},{"style":3222},[30972],{"type":26,"value":30973},"    p",{"type":21,"tag":2314,"props":30975,"children":30976},{"style":3157},[30977],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30979,"children":30980},{"style":2339},[30981],{"type":26,"value":2413},{"type":21,"tag":2314,"props":30983,"children":30984},{"style":2321},[30985],{"type":26,"value":2418},{"type":21,"tag":2314,"props":30987,"children":30988},{"class":2316,"line":1364},[30989,30993,30997,31001],{"type":21,"tag":2314,"props":30990,"children":30991},{"style":3222},[30992],{"type":26,"value":22820},{"type":21,"tag":2314,"props":30994,"children":30995},{"style":3157},[30996],{"type":26,"value":3197},{"type":21,"tag":2314,"props":30998,"children":30999},{"style":2350},[31000],{"type":26,"value":22130},{"type":21,"tag":2314,"props":31002,"children":31003},{"style":2321},[31004],{"type":26,"value":2418},{"type":21,"tag":2314,"props":31006,"children":31007},{"class":2316,"line":3403},[31008,31012,31016,31021],{"type":21,"tag":2314,"props":31009,"children":31010},{"style":3222},[31011],{"type":26,"value":28762},{"type":21,"tag":2314,"props":31013,"children":31014},{"style":3157},[31015],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31017,"children":31018},{"style":2339},[31019],{"type":26,"value":31020},"2000",{"type":21,"tag":2314,"props":31022,"children":31023},{"style":2321},[31024],{"type":26,"value":2418},{"type":21,"tag":2314,"props":31026,"children":31027},{"class":2316,"line":3413},[31028],{"type":21,"tag":2314,"props":31029,"children":31030},{"style":2321},[31031],{"type":26,"value":3257},{"type":21,"tag":2314,"props":31033,"children":31034},{"class":2316,"line":436},[31035],{"type":21,"tag":2314,"props":31036,"children":31037},{"emptyLinePlaceholder":3181},[31038],{"type":26,"value":3184},{"type":21,"tag":2314,"props":31040,"children":31041},{"class":2316,"line":3473},[31042,31046,31051],{"type":21,"tag":2314,"props":31043,"children":31044},{"style":2339},[31045],{"type":26,"value":3272},{"type":21,"tag":2314,"props":31047,"children":31048},{"style":2321},[31049],{"type":26,"value":31050},"(result.best_solution)   ",{"type":21,"tag":2314,"props":31052,"children":31053},{"style":3407},[31054],{"type":26,"value":31055},"# '0101' or '1010'\n",{"type":21,"tag":2314,"props":31057,"children":31058},{"class":2316,"line":3521},[31059,31063,31068],{"type":21,"tag":2314,"props":31060,"children":31061},{"style":2339},[31062],{"type":26,"value":3272},{"type":21,"tag":2314,"props":31064,"children":31065},{"style":2321},[31066],{"type":26,"value":31067},"(result.cut_value)       ",{"type":21,"tag":2314,"props":31069,"children":31070},{"style":3407},[31071],{"type":26,"value":31072},"# 4\n",{"type":21,"tag":2314,"props":31074,"children":31075},{"class":2316,"line":3563},[31076,31080,31085],{"type":21,"tag":2314,"props":31077,"children":31078},{"style":2339},[31079],{"type":26,"value":3272},{"type":21,"tag":2314,"props":31081,"children":31082},{"style":2321},[31083],{"type":26,"value":31084},"(result.approximation_ratio)  ",{"type":21,"tag":2314,"props":31086,"children":31087},{"style":3407},[31088],{"type":26,"value":31089},"# ~0.96 for p=2\n",{"type":21,"tag":22,"props":31091,"children":31092},{},[31093],{"type":26,"value":31094},"只需一个标志即可切换后端：",{"type":21,"tag":2304,"props":31096,"children":31098},{"code":31097,"language":3147,"meta":7,"className":3145,"style":7},"# Run on Qiskit Aer\nresult_qiskit = hlq.algorithms.qaoa(graph=graph, problem='max_cut', p=2, backend='qiskit')\n\n# Run on real IonQ hardware (if you have credits)\nresult_ionq = hlq.algorithms.qaoa(graph=graph, problem='max_cut', p=2,\n                                   backend='ionq', device='aria-1')\n",[31099],{"type":21,"tag":2073,"props":31100,"children":31101},{"__ignoreMap":7},[31102,31110,31189,31196,31204,31264],{"type":21,"tag":2314,"props":31103,"children":31104},{"class":2316,"line":2317},[31105],{"type":21,"tag":2314,"props":31106,"children":31107},{"style":3407},[31108],{"type":26,"value":31109},"# Run on Qiskit Aer\n",{"type":21,"tag":2314,"props":31111,"children":31112},{"class":2316,"line":106},[31113,31117,31121,31126,31131,31135,31140,31145,31149,31153,31157,31161,31165,31169,31173,31177,31181,31185],{"type":21,"tag":2314,"props":31114,"children":31115},{"style":2321},[31116],{"type":26,"value":21571},{"type":21,"tag":2314,"props":31118,"children":31119},{"style":3157},[31120],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31122,"children":31123},{"style":2321},[31124],{"type":26,"value":31125}," hlq.algorithms.qaoa(",{"type":21,"tag":2314,"props":31127,"children":31128},{"style":3222},[31129],{"type":26,"value":31130},"graph",{"type":21,"tag":2314,"props":31132,"children":31133},{"style":3157},[31134],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31136,"children":31137},{"style":2321},[31138],{"type":26,"value":31139},"graph, ",{"type":21,"tag":2314,"props":31141,"children":31142},{"style":3222},[31143],{"type":26,"value":31144},"problem",{"type":21,"tag":2314,"props":31146,"children":31147},{"style":3157},[31148],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31150,"children":31151},{"style":2350},[31152],{"type":26,"value":30961},{"type":21,"tag":2314,"props":31154,"children":31155},{"style":2321},[31156],{"type":26,"value":1309},{"type":21,"tag":2314,"props":31158,"children":31159},{"style":3222},[31160],{"type":26,"value":22},{"type":21,"tag":2314,"props":31162,"children":31163},{"style":3157},[31164],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31166,"children":31167},{"style":2339},[31168],{"type":26,"value":2413},{"type":21,"tag":2314,"props":31170,"children":31171},{"style":2321},[31172],{"type":26,"value":1309},{"type":21,"tag":2314,"props":31174,"children":31175},{"style":3222},[31176],{"type":26,"value":18425},{"type":21,"tag":2314,"props":31178,"children":31179},{"style":3157},[31180],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31182,"children":31183},{"style":2350},[31184],{"type":26,"value":19345},{"type":21,"tag":2314,"props":31186,"children":31187},{"style":2321},[31188],{"type":26,"value":3257},{"type":21,"tag":2314,"props":31190,"children":31191},{"class":2316,"line":2335},[31192],{"type":21,"tag":2314,"props":31193,"children":31194},{"emptyLinePlaceholder":3181},[31195],{"type":26,"value":3184},{"type":21,"tag":2314,"props":31197,"children":31198},{"class":2316,"line":2397},[31199],{"type":21,"tag":2314,"props":31200,"children":31201},{"style":3407},[31202],{"type":26,"value":31203},"# Run on real IonQ hardware (if you have credits)\n",{"type":21,"tag":2314,"props":31205,"children":31206},{"class":2316,"line":2421},[31207,31212,31216,31220,31224,31228,31232,31236,31240,31244,31248,31252,31256,31260],{"type":21,"tag":2314,"props":31208,"children":31209},{"style":2321},[31210],{"type":26,"value":31211},"result_ionq ",{"type":21,"tag":2314,"props":31213,"children":31214},{"style":3157},[31215],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31217,"children":31218},{"style":2321},[31219],{"type":26,"value":31125},{"type":21,"tag":2314,"props":31221,"children":31222},{"style":3222},[31223],{"type":26,"value":31130},{"type":21,"tag":2314,"props":31225,"children":31226},{"style":3157},[31227],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31229,"children":31230},{"style":2321},[31231],{"type":26,"value":31139},{"type":21,"tag":2314,"props":31233,"children":31234},{"style":3222},[31235],{"type":26,"value":31144},{"type":21,"tag":2314,"props":31237,"children":31238},{"style":3157},[31239],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31241,"children":31242},{"style":2350},[31243],{"type":26,"value":30961},{"type":21,"tag":2314,"props":31245,"children":31246},{"style":2321},[31247],{"type":26,"value":1309},{"type":21,"tag":2314,"props":31249,"children":31250},{"style":3222},[31251],{"type":26,"value":22},{"type":21,"tag":2314,"props":31253,"children":31254},{"style":3157},[31255],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31257,"children":31258},{"style":2339},[31259],{"type":26,"value":2413},{"type":21,"tag":2314,"props":31261,"children":31262},{"style":2321},[31263],{"type":26,"value":2418},{"type":21,"tag":2314,"props":31265,"children":31266},{"class":2316,"line":16},[31267,31272,31276,31280,31284,31288,31292,31296],{"type":21,"tag":2314,"props":31268,"children":31269},{"style":3222},[31270],{"type":26,"value":31271},"                                   backend",{"type":21,"tag":2314,"props":31273,"children":31274},{"style":3157},[31275],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31277,"children":31278},{"style":2350},[31279],{"type":26,"value":22234},{"type":21,"tag":2314,"props":31281,"children":31282},{"style":2321},[31283],{"type":26,"value":1309},{"type":21,"tag":2314,"props":31285,"children":31286},{"style":3222},[31287],{"type":26,"value":22243},{"type":21,"tag":2314,"props":31289,"children":31290},{"style":3157},[31291],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31293,"children":31294},{"style":2350},[31295],{"type":26,"value":22252},{"type":21,"tag":2314,"props":31297,"children":31298},{"style":2321},[31299],{"type":26,"value":3257},{"type":21,"tag":29,"props":31301,"children":31303},{"id":31302},"增大-p-以获得更好的结果",[31304],{"type":26,"value":31305},"增大 p 以获得更好的结果",{"type":21,"tag":22,"props":31307,"children":31308},{},[31309,31311,31316,31318,31324],{"type":26,"value":31310},"QAOA 的近似比会随着深度 ",{"type":21,"tag":2073,"props":31312,"children":31314},{"className":31313},[],[31315],{"type":26,"value":22},{"type":26,"value":31317}," 的增加而提升。当 ",{"type":21,"tag":2073,"props":31319,"children":31321},{"className":31320},[],[31322],{"type":26,"value":31323},"p→∞",{"type":26,"value":31325}," 时，QAOA 能精确求解问题。在实践中：",{"type":21,"tag":4020,"props":31327,"children":31328},{},[31329,31349],{"type":21,"tag":4024,"props":31330,"children":31331},{},[31332],{"type":21,"tag":4028,"props":31333,"children":31334},{},[31335,31339,31344],{"type":21,"tag":4032,"props":31336,"children":31337},{},[31338],{"type":26,"value":22},{"type":21,"tag":4032,"props":31340,"children":31341},{},[31342],{"type":26,"value":31343},"典型近似比（Max-Cut）",{"type":21,"tag":4032,"props":31345,"children":31346},{},[31347],{"type":26,"value":31348},"所需门数",{"type":21,"tag":4046,"props":31350,"children":31351},{},[31352,31369,31386,31403],{"type":21,"tag":4028,"props":31353,"children":31354},{},[31355,31359,31364],{"type":21,"tag":4053,"props":31356,"children":31357},{},[31358],{"type":26,"value":3513},{"type":21,"tag":4053,"props":31360,"children":31361},{},[31362],{"type":26,"value":31363},"~0.75",{"type":21,"tag":4053,"props":31365,"children":31366},{},[31367],{"type":26,"value":31368},"2×edges + 4n",{"type":21,"tag":4028,"props":31370,"children":31371},{},[31372,31376,31381],{"type":21,"tag":4053,"props":31373,"children":31374},{},[31375],{"type":26,"value":2413},{"type":21,"tag":4053,"props":31377,"children":31378},{},[31379],{"type":26,"value":31380},"~0.86",{"type":21,"tag":4053,"props":31382,"children":31383},{},[31384],{"type":26,"value":31385},"4×edges + 8n",{"type":21,"tag":4028,"props":31387,"children":31388},{},[31389,31393,31398],{"type":21,"tag":4053,"props":31390,"children":31391},{},[31392],{"type":26,"value":6465},{"type":21,"tag":4053,"props":31394,"children":31395},{},[31396],{"type":26,"value":31397},"~0.91",{"type":21,"tag":4053,"props":31399,"children":31400},{},[31401],{"type":26,"value":31402},"6×edges + 12n",{"type":21,"tag":4028,"props":31404,"children":31405},{},[31406,31410,31415],{"type":21,"tag":4053,"props":31407,"children":31408},{},[31409],{"type":26,"value":6636},{"type":21,"tag":4053,"props":31411,"children":31412},{},[31413],{"type":26,"value":31414},"~0.95",{"type":21,"tag":4053,"props":31416,"children":31417},{},[31418],{"type":26,"value":31419},"10×edges + 20n",{"type":21,"tag":22,"props":31421,"children":31422},{},[31423,31425,31431,31433,31438,31439,31445],{"type":26,"value":31424},"权衡在于：更深的电路在真实硬件上会累积更多噪声。在模拟器上，使用 ",{"type":21,"tag":2073,"props":31426,"children":31428},{"className":31427},[],[31429],{"type":26,"value":31430},"p=3",{"type":26,"value":31432}," 或更高。在 NISQ QPU 上，",{"type":21,"tag":2073,"props":31434,"children":31436},{"className":31435},[],[31437],{"type":26,"value":19498},{"type":26,"value":20470},{"type":21,"tag":2073,"props":31440,"children":31442},{"className":31441},[],[31443],{"type":26,"value":31444},"p=2",{"type":26,"value":31446}," 通常是实际的上限。",{"type":21,"tag":29,"props":31448,"children":31450},{"id":31449},"qaoa-何时值得使用",[31451],{"type":26,"value":31452},"QAOA 何时值得使用？",{"type":21,"tag":22,"props":31454,"children":31455},{},[31456],{"type":21,"tag":136,"props":31457,"children":31458},{},[31459],{"type":26,"value":31460},"目前适用于：",{"type":21,"tag":3080,"props":31462,"children":31463},{},[31464,31469,31474],{"type":21,"tag":3084,"props":31465,"children":31466},{},[31467],{"type":26,"value":31468},"对 NISQ 设备进行基准测试（QAOA 是一种标准的基准电路）",{"type":21,"tag":3084,"props":31470,"children":31471},{},[31472],{"type":26,"value":31473},"关于变分量子算法的学术研究",{"type":21,"tag":3084,"props":31475,"children":31476},{},[31477],{"type":26,"value":31478},"模拟器上的小型图（少于 20 个节点）",{"type":21,"tag":22,"props":31480,"children":31481},{},[31482],{"type":21,"tag":136,"props":31483,"children":31484},{},[31485],{"type":26,"value":31486},"尚不适用于：",{"type":21,"tag":3080,"props":31488,"children":31489},{},[31490,31495],{"type":21,"tag":3084,"props":31491,"children":31492},{},[31493],{"type":26,"value":31494},"大规模真实硬件上的生产级优化——经典启发式方法（模拟退火、禁忌搜索）在实际问题上仍然优于 QAOA",{"type":21,"tag":3084,"props":31496,"children":31497},{},[31498],{"type":26,"value":31499},"大型图——电路深度随图的密度而增长",{"type":21,"tag":22,"props":31501,"children":31502},{},[31503,31508,31510,31515],{"type":21,"tag":136,"props":31504,"children":31505},{},[31506],{"type":26,"value":31507},"前景展望：",{"type":26,"value":31509}," 在未来具备高深度电路的容错硬件上，大 ",{"type":21,"tag":2073,"props":31511,"children":31513},{"className":31512},[],[31514],{"type":26,"value":22},{"type":26,"value":31516}," 的 QAOA 可能为稠密的 NP-hard 优化提供真正的加速。其理论基础是扎实的；只是硬件还未跟上。",{"type":21,"tag":29,"props":31518,"children":31520},{"id":31519},"后续步骤",[31521],{"type":26,"value":31519},{"type":21,"tag":3080,"props":31523,"children":31524},{},[31525,31538,31551],{"type":21,"tag":3084,"props":31526,"children":31527},{},[31528,31536],{"type":21,"tag":136,"props":31529,"children":31530},{},[31531],{"type":21,"tag":46,"props":31532,"children":31533},{"href":14023},[31534],{"type":26,"value":31535},"PennyLane SDK 指南",{"type":26,"value":31537}," —— 设置 PennyLane 以运行更多变分算法",{"type":21,"tag":3084,"props":31539,"children":31540},{},[31541,31549],{"type":21,"tag":136,"props":31542,"children":31543},{},[31544],{"type":21,"tag":46,"props":31545,"children":31546},{"href":292},[31547],{"type":26,"value":31548},"VQE 指南",{"type":26,"value":31550}," —— 面向量子化学的姊妹算法",{"type":21,"tag":3084,"props":31552,"children":31553},{},[31554,31561],{"type":21,"tag":136,"props":31555,"children":31556},{},[31557],{"type":21,"tag":46,"props":31558,"children":31559},{"href":18964},[31560],{"type":26,"value":18967},{"type":26,"value":31562}," —— 用一套 API 在任意后端上运行 QAOA",{"type":21,"tag":2688,"props":31564,"children":31565},{},[31566],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":31568},[31569,31570,31571,31572,31573,31574,31575,31576],{"id":28861,"depth":106,"text":28864},{"id":28903,"depth":106,"text":28906},{"id":28979,"depth":106,"text":28982},{"id":30144,"depth":106,"text":30144},{"id":30783,"depth":106,"text":30786},{"id":31302,"depth":106,"text":31305},{"id":31449,"depth":106,"text":31452},{"id":31519,"depth":106,"text":31519},"content:zh:blog:qaoa-max-cut-tutorial.md","zh\u002Fblog\u002Fqaoa-max-cut-tutorial.md","zh\u002Fblog\u002Fqaoa-max-cut-tutorial",{"_path":31581,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":31582,"description":31583,"date":31584,"author":11,"tags":31585,"readingTime":127,"body":31587,"_type":111,"_id":33574,"_source":113,"_file":33575,"_stem":33576,"_extension":116},"\u002Fzh\u002Fblog\u002Fquantum-simulators-compared","免费量子模拟器对比：Qiskit Aer vs Cirq vs PennyLane vs CUDA-Q","对主流免费量子模拟器的实用对比——性能、量子比特上限、GPU 支持，以及各自的适用场景。","2026-02-10",[20130,3034,31586],"GPU",{"type":18,"children":31588,"toc":33565},[31589,31594,31599,31782,31788,31797,31850,32020,32030,32036,32052,32379,32399,32422,32470,32480,32486,32495,32732,32742,32760,32770,32776,32785,32961,32971,32977,32988,33201,33211,33217,33228,33556,33561],{"type":21,"tag":22,"props":31590,"children":31591},{},[31592],{"type":26,"value":31593},"量子模拟器让你无需在硬件排队中等待或按次付费即可测试电路。但目前有六款主流模拟器可免费使用，你该选哪一个呢？以下是一份实用的梳理。",{"type":21,"tag":29,"props":31595,"children":31597},{"id":31596},"快速答案",[31598],{"type":26,"value":31596},{"type":21,"tag":4020,"props":31600,"children":31601},{},[31602,31627],{"type":21,"tag":4024,"props":31603,"children":31604},{},[31605],{"type":21,"tag":4028,"props":31606,"children":31607},{},[31608,31613,31617,31622],{"type":21,"tag":4032,"props":31609,"children":31610},{},[31611],{"type":26,"value":31612},"模拟器",{"type":21,"tag":4032,"props":31614,"children":31615},{},[31616],{"type":26,"value":20751},{"type":21,"tag":4032,"props":31618,"children":31619},{},[31620],{"type":26,"value":31621},"最大量子比特数（CPU）",{"type":21,"tag":4032,"props":31623,"children":31624},{},[31625],{"type":26,"value":31626},"GPU？",{"type":21,"tag":4046,"props":31628,"children":31629},{},[31630,31656,31682,31708,31733,31758],{"type":21,"tag":4028,"props":31631,"children":31632},{},[31633,31641,31646,31651],{"type":21,"tag":4053,"props":31634,"children":31635},{},[31636],{"type":21,"tag":136,"props":31637,"children":31638},{},[31639],{"type":26,"value":31640},"Qiskit Aer",{"type":21,"tag":4053,"props":31642,"children":31643},{},[31644],{"type":26,"value":31645},"通用场景",{"type":21,"tag":4053,"props":31647,"children":31648},{},[31649],{"type":26,"value":31650},"~30（statevector）",{"type":21,"tag":4053,"props":31652,"children":31653},{},[31654],{"type":26,"value":31655},"✅ AerCuda",{"type":21,"tag":4028,"props":31657,"children":31658},{},[31659,31667,31672,31677],{"type":21,"tag":4053,"props":31660,"children":31661},{},[31662],{"type":21,"tag":136,"props":31663,"children":31664},{},[31665],{"type":26,"value":31666},"Cirq Simulator",{"type":21,"tag":4053,"props":31668,"children":31669},{},[31670],{"type":26,"value":31671},"Cirq 电路、密度矩阵",{"type":21,"tag":4053,"props":31673,"children":31674},{},[31675],{"type":26,"value":31676},"~25",{"type":21,"tag":4053,"props":31678,"children":31679},{},[31680],{"type":26,"value":31681},"❌",{"type":21,"tag":4028,"props":31683,"children":31684},{},[31685,31693,31698,31703],{"type":21,"tag":4053,"props":31686,"children":31687},{},[31688],{"type":21,"tag":136,"props":31689,"children":31690},{},[31691],{"type":26,"value":31692},"PennyLane default.qubit",{"type":21,"tag":4053,"props":31694,"children":31695},{},[31696],{"type":26,"value":31697},"QML、梯度",{"type":21,"tag":4053,"props":31699,"children":31700},{},[31701],{"type":26,"value":31702},"~20",{"type":21,"tag":4053,"props":31704,"children":31705},{},[31706],{"type":26,"value":31707},"✅ lightning.gpu",{"type":21,"tag":4028,"props":31709,"children":31710},{},[31711,31719,31724,31729],{"type":21,"tag":4053,"props":31712,"children":31713},{},[31714],{"type":21,"tag":136,"props":31715,"children":31716},{},[31717],{"type":26,"value":31718},"PennyLane lightning.qubit",{"type":21,"tag":4053,"props":31720,"children":31721},{},[31722],{"type":26,"value":31723},"快速 CPU 模拟",{"type":21,"tag":4053,"props":31725,"children":31726},{},[31727],{"type":26,"value":31728},"~30",{"type":21,"tag":4053,"props":31730,"children":31731},{},[31732],{"type":26,"value":31707},{"type":21,"tag":4028,"props":31734,"children":31735},{},[31736,31743,31748,31753],{"type":21,"tag":4053,"props":31737,"children":31738},{},[31739],{"type":21,"tag":136,"props":31740,"children":31741},{},[31742],{"type":26,"value":20574},{"type":21,"tag":4053,"props":31744,"children":31745},{},[31746],{"type":26,"value":31747},"大型电路、速度",{"type":21,"tag":4053,"props":31749,"children":31750},{},[31751],{"type":26,"value":31752},"~34（单 GPU）",{"type":21,"tag":4053,"props":31754,"children":31755},{},[31756],{"type":26,"value":31757},"✅ 原生",{"type":21,"tag":4028,"props":31759,"children":31760},{},[31761,31769,31774,31778],{"type":21,"tag":4053,"props":31762,"children":31763},{},[31764],{"type":21,"tag":136,"props":31765,"children":31766},{},[31767],{"type":26,"value":31768},"Braket LocalSimulator",{"type":21,"tag":4053,"props":31770,"children":31771},{},[31772],{"type":26,"value":31773},"Braket 电路、免费",{"type":21,"tag":4053,"props":31775,"children":31776},{},[31777],{"type":26,"value":31676},{"type":21,"tag":4053,"props":31779,"children":31780},{},[31781],{"type":26,"value":31681},{"type":21,"tag":29,"props":31783,"children":31785},{"id":31784},"qiskit-aer主力工具",[31786],{"type":26,"value":31787},"Qiskit Aer：主力工具",{"type":21,"tag":22,"props":31789,"children":31790},{},[31791,31795],{"type":21,"tag":46,"props":31792,"children":31793},{"href":7045},[31794],{"type":26,"value":31640},{"type":26,"value":31796}," 是功能最完备的免费模拟器。它支持多种模拟方法：",{"type":21,"tag":3080,"props":31798,"children":31799},{},[31800,31810,31820,31830,31840],{"type":21,"tag":3084,"props":31801,"children":31802},{},[31803,31808],{"type":21,"tag":136,"props":31804,"children":31805},{},[31806],{"type":26,"value":31807},"statevector_simulator",{"type":26,"value":31809},"：精确模拟最多约 30 个量子比特。内存按 2ⁿ 个复数增长（30 个量子比特需要 16 GB RAM）。",{"type":21,"tag":3084,"props":31811,"children":31812},{},[31813,31818],{"type":21,"tag":136,"props":31814,"children":31815},{},[31816],{"type":26,"value":31817},"qasm_simulator",{"type":26,"value":31819},"：基于采样（shot）的抽样，支持噪声模型",{"type":21,"tag":3084,"props":31821,"children":31822},{},[31823,31828],{"type":21,"tag":136,"props":31824,"children":31825},{},[31826],{"type":26,"value":31827},"density_matrix",{"type":26,"value":31829},"：模拟混合态和开放量子系统",{"type":21,"tag":3084,"props":31831,"children":31832},{},[31833,31838],{"type":21,"tag":136,"props":31834,"children":31835},{},[31836],{"type":26,"value":31837},"mps",{"type":26,"value":31839},"：矩阵乘积态（Matrix Product State）——可模拟纠缠受限的电路，最多可达数百个量子比特",{"type":21,"tag":3084,"props":31841,"children":31842},{},[31843,31848],{"type":21,"tag":136,"props":31844,"children":31845},{},[31846],{"type":26,"value":31847},"stabilizer",{"type":26,"value":31849},"：仅限 Clifford 电路，但能以多项式时间扩展到数千个量子比特",{"type":21,"tag":2304,"props":31851,"children":31853},{"className":3145,"code":31852,"language":3147,"meta":7,"style":7},"from qiskit_aer import AerSimulator\n\n# Default: automatic method selection\nsim = AerSimulator()\n\n# Force a specific method\nsim_sv = AerSimulator(method='statevector')\nsim_dm = AerSimulator(method='density_matrix')\nsim_mps = AerSimulator(method='matrix_product_state')\n",[31854],{"type":21,"tag":2073,"props":31855,"children":31856},{"__ignoreMap":7},[31857,31876,31883,31891,31906,31913,31921,31954,31987],{"type":21,"tag":2314,"props":31858,"children":31859},{"class":2316,"line":2317},[31860,31864,31868,31872],{"type":21,"tag":2314,"props":31861,"children":31862},{"style":3157},[31863],{"type":26,"value":3160},{"type":21,"tag":2314,"props":31865,"children":31866},{"style":2321},[31867],{"type":26,"value":4270},{"type":21,"tag":2314,"props":31869,"children":31870},{"style":3157},[31871],{"type":26,"value":3170},{"type":21,"tag":2314,"props":31873,"children":31874},{"style":2321},[31875],{"type":26,"value":4279},{"type":21,"tag":2314,"props":31877,"children":31878},{"class":2316,"line":106},[31879],{"type":21,"tag":2314,"props":31880,"children":31881},{"emptyLinePlaceholder":3181},[31882],{"type":26,"value":3184},{"type":21,"tag":2314,"props":31884,"children":31885},{"class":2316,"line":2335},[31886],{"type":21,"tag":2314,"props":31887,"children":31888},{"style":3407},[31889],{"type":26,"value":31890},"# Default: automatic method selection\n",{"type":21,"tag":2314,"props":31892,"children":31893},{"class":2316,"line":2397},[31894,31898,31902],{"type":21,"tag":2314,"props":31895,"children":31896},{"style":2321},[31897],{"type":26,"value":8378},{"type":21,"tag":2314,"props":31899,"children":31900},{"style":3157},[31901],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31903,"children":31904},{"style":2321},[31905],{"type":26,"value":8387},{"type":21,"tag":2314,"props":31907,"children":31908},{"class":2316,"line":2421},[31909],{"type":21,"tag":2314,"props":31910,"children":31911},{"emptyLinePlaceholder":3181},[31912],{"type":26,"value":3184},{"type":21,"tag":2314,"props":31914,"children":31915},{"class":2316,"line":16},[31916],{"type":21,"tag":2314,"props":31917,"children":31918},{"style":3407},[31919],{"type":26,"value":31920},"# Force a specific method\n",{"type":21,"tag":2314,"props":31922,"children":31923},{"class":2316,"line":127},[31924,31929,31933,31937,31941,31945,31950],{"type":21,"tag":2314,"props":31925,"children":31926},{"style":2321},[31927],{"type":26,"value":31928},"sim_sv ",{"type":21,"tag":2314,"props":31930,"children":31931},{"style":3157},[31932],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31934,"children":31935},{"style":2321},[31936],{"type":26,"value":4568},{"type":21,"tag":2314,"props":31938,"children":31939},{"style":3222},[31940],{"type":26,"value":29977},{"type":21,"tag":2314,"props":31942,"children":31943},{"style":3157},[31944],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31946,"children":31947},{"style":2350},[31948],{"type":26,"value":31949},"'statevector'",{"type":21,"tag":2314,"props":31951,"children":31952},{"style":2321},[31953],{"type":26,"value":3257},{"type":21,"tag":2314,"props":31955,"children":31956},{"class":2316,"line":887},[31957,31962,31966,31970,31974,31978,31983],{"type":21,"tag":2314,"props":31958,"children":31959},{"style":2321},[31960],{"type":26,"value":31961},"sim_dm ",{"type":21,"tag":2314,"props":31963,"children":31964},{"style":3157},[31965],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31967,"children":31968},{"style":2321},[31969],{"type":26,"value":4568},{"type":21,"tag":2314,"props":31971,"children":31972},{"style":3222},[31973],{"type":26,"value":29977},{"type":21,"tag":2314,"props":31975,"children":31976},{"style":3157},[31977],{"type":26,"value":3197},{"type":21,"tag":2314,"props":31979,"children":31980},{"style":2350},[31981],{"type":26,"value":31982},"'density_matrix'",{"type":21,"tag":2314,"props":31984,"children":31985},{"style":2321},[31986],{"type":26,"value":3257},{"type":21,"tag":2314,"props":31988,"children":31989},{"class":2316,"line":1364},[31990,31995,31999,32003,32007,32011,32016],{"type":21,"tag":2314,"props":31991,"children":31992},{"style":2321},[31993],{"type":26,"value":31994},"sim_mps ",{"type":21,"tag":2314,"props":31996,"children":31997},{"style":3157},[31998],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32000,"children":32001},{"style":2321},[32002],{"type":26,"value":4568},{"type":21,"tag":2314,"props":32004,"children":32005},{"style":3222},[32006],{"type":26,"value":29977},{"type":21,"tag":2314,"props":32008,"children":32009},{"style":3157},[32010],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32012,"children":32013},{"style":2350},[32014],{"type":26,"value":32015},"'matrix_product_state'",{"type":21,"tag":2314,"props":32017,"children":32018},{"style":2321},[32019],{"type":26,"value":3257},{"type":21,"tag":22,"props":32021,"children":32022},{},[32023,32028],{"type":21,"tag":136,"props":32024,"children":32025},{},[32026],{"type":26,"value":32027},"何时使用 Aer：",{"type":26,"value":32029}," 适用于任何 Qiskit 工作流、噪声建模，或当你希望紧密匹配 IBM 硬件行为时。",{"type":21,"tag":29,"props":32031,"children":32033},{"id":32032},"pennylane量子机器学习的最佳选择",[32034],{"type":26,"value":32035},"PennyLane：量子机器学习的最佳选择",{"type":21,"tag":22,"props":32037,"children":32038},{},[32039,32043,32045,32050],{"type":21,"tag":46,"props":32040,"children":32041},{"href":14023},[32042],{"type":26,"value":13739},{"type":26,"value":32044}," 在你需要可微分电路时大放异彩。它的 ",{"type":21,"tag":2073,"props":32046,"children":32048},{"className":32047},[],[32049],{"type":26,"value":15371},{"type":26,"value":32051}," 模拟器通过参数移位规则（parameter-shift rule）计算精确梯度，从而支持对量子电路进行基于梯度的优化：",{"type":21,"tag":2304,"props":32053,"children":32055},{"className":3145,"code":32054,"language":3147,"meta":7,"style":7},"import pennylane as qml\nimport numpy as np\n\ndev = qml.device(\"default.qubit\", wires=2)\n\n@qml.qnode(dev)\ndef circuit(theta):\n    qml.RX(theta[0], wires=0)\n    qml.RY(theta[1], wires=1)\n    qml.CNOT(wires=[0, 1])\n    return qml.expval(qml.PauliZ(0))\n\n# Automatic gradient computation\ngrad_fn = qml.grad(circuit)\ntheta = np.array([0.5, 1.2])\nprint(grad_fn(theta))  # exact gradient\n",[32056],{"type":21,"tag":2073,"props":32057,"children":32058},{"__ignoreMap":7},[32059,32078,32097,32104,32143,32150,32161,32177,32210,32242,32277,32296,32303,32311,32328,32362],{"type":21,"tag":2314,"props":32060,"children":32061},{"class":2316,"line":2317},[32062,32066,32070,32074],{"type":21,"tag":2314,"props":32063,"children":32064},{"style":3157},[32065],{"type":26,"value":3170},{"type":21,"tag":2314,"props":32067,"children":32068},{"style":2321},[32069],{"type":26,"value":14046},{"type":21,"tag":2314,"props":32071,"children":32072},{"style":3157},[32073],{"type":26,"value":4232},{"type":21,"tag":2314,"props":32075,"children":32076},{"style":2321},[32077],{"type":26,"value":14055},{"type":21,"tag":2314,"props":32079,"children":32080},{"class":2316,"line":106},[32081,32085,32089,32093],{"type":21,"tag":2314,"props":32082,"children":32083},{"style":3157},[32084],{"type":26,"value":3170},{"type":21,"tag":2314,"props":32086,"children":32087},{"style":2321},[32088],{"type":26,"value":4227},{"type":21,"tag":2314,"props":32090,"children":32091},{"style":3157},[32092],{"type":26,"value":4232},{"type":21,"tag":2314,"props":32094,"children":32095},{"style":2321},[32096],{"type":26,"value":4237},{"type":21,"tag":2314,"props":32098,"children":32099},{"class":2316,"line":2335},[32100],{"type":21,"tag":2314,"props":32101,"children":32102},{"emptyLinePlaceholder":3181},[32103],{"type":26,"value":3184},{"type":21,"tag":2314,"props":32105,"children":32106},{"class":2316,"line":2397},[32107,32111,32115,32119,32123,32127,32131,32135,32139],{"type":21,"tag":2314,"props":32108,"children":32109},{"style":2321},[32110],{"type":26,"value":14179},{"type":21,"tag":2314,"props":32112,"children":32113},{"style":3157},[32114],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32116,"children":32117},{"style":2321},[32118],{"type":26,"value":14188},{"type":21,"tag":2314,"props":32120,"children":32121},{"style":2350},[32122],{"type":26,"value":14193},{"type":21,"tag":2314,"props":32124,"children":32125},{"style":2321},[32126],{"type":26,"value":1309},{"type":21,"tag":2314,"props":32128,"children":32129},{"style":3222},[32130],{"type":26,"value":14202},{"type":21,"tag":2314,"props":32132,"children":32133},{"style":3157},[32134],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32136,"children":32137},{"style":2339},[32138],{"type":26,"value":2413},{"type":21,"tag":2314,"props":32140,"children":32141},{"style":2321},[32142],{"type":26,"value":3257},{"type":21,"tag":2314,"props":32144,"children":32145},{"class":2316,"line":2421},[32146],{"type":21,"tag":2314,"props":32147,"children":32148},{"emptyLinePlaceholder":3181},[32149],{"type":26,"value":3184},{"type":21,"tag":2314,"props":32151,"children":32152},{"class":2316,"line":16},[32153,32157],{"type":21,"tag":2314,"props":32154,"children":32155},{"style":4318},[32156],{"type":26,"value":14226},{"type":21,"tag":2314,"props":32158,"children":32159},{"style":2321},[32160],{"type":26,"value":14231},{"type":21,"tag":2314,"props":32162,"children":32163},{"class":2316,"line":127},[32164,32168,32172],{"type":21,"tag":2314,"props":32165,"children":32166},{"style":3157},[32167],{"type":26,"value":4315},{"type":21,"tag":2314,"props":32169,"children":32170},{"style":4318},[32171],{"type":26,"value":14243},{"type":21,"tag":2314,"props":32173,"children":32174},{"style":2321},[32175],{"type":26,"value":32176},"(theta):\n",{"type":21,"tag":2314,"props":32178,"children":32179},{"class":2316,"line":887},[32180,32185,32189,32194,32198,32202,32206],{"type":21,"tag":2314,"props":32181,"children":32182},{"style":2321},[32183],{"type":26,"value":32184},"    qml.RX(theta[",{"type":21,"tag":2314,"props":32186,"children":32187},{"style":2339},[32188],{"type":26,"value":5122},{"type":21,"tag":2314,"props":32190,"children":32191},{"style":2321},[32192],{"type":26,"value":32193},"], ",{"type":21,"tag":2314,"props":32195,"children":32196},{"style":3222},[32197],{"type":26,"value":14202},{"type":21,"tag":2314,"props":32199,"children":32200},{"style":3157},[32201],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32203,"children":32204},{"style":2339},[32205],{"type":26,"value":5122},{"type":21,"tag":2314,"props":32207,"children":32208},{"style":2321},[32209],{"type":26,"value":3257},{"type":21,"tag":2314,"props":32211,"children":32212},{"class":2316,"line":1364},[32213,32218,32222,32226,32230,32234,32238],{"type":21,"tag":2314,"props":32214,"children":32215},{"style":2321},[32216],{"type":26,"value":32217},"    qml.RY(theta[",{"type":21,"tag":2314,"props":32219,"children":32220},{"style":2339},[32221],{"type":26,"value":3513},{"type":21,"tag":2314,"props":32223,"children":32224},{"style":2321},[32225],{"type":26,"value":32193},{"type":21,"tag":2314,"props":32227,"children":32228},{"style":3222},[32229],{"type":26,"value":14202},{"type":21,"tag":2314,"props":32231,"children":32232},{"style":3157},[32233],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32235,"children":32236},{"style":2339},[32237],{"type":26,"value":3513},{"type":21,"tag":2314,"props":32239,"children":32240},{"style":2321},[32241],{"type":26,"value":3257},{"type":21,"tag":2314,"props":32243,"children":32244},{"class":2316,"line":3403},[32245,32249,32253,32257,32261,32265,32269,32273],{"type":21,"tag":2314,"props":32246,"children":32247},{"style":2321},[32248],{"type":26,"value":21730},{"type":21,"tag":2314,"props":32250,"children":32251},{"style":3222},[32252],{"type":26,"value":14202},{"type":21,"tag":2314,"props":32254,"children":32255},{"style":3157},[32256],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32258,"children":32259},{"style":2321},[32260],{"type":26,"value":21743},{"type":21,"tag":2314,"props":32262,"children":32263},{"style":2339},[32264],{"type":26,"value":5122},{"type":21,"tag":2314,"props":32266,"children":32267},{"style":2321},[32268],{"type":26,"value":1309},{"type":21,"tag":2314,"props":32270,"children":32271},{"style":2339},[32272],{"type":26,"value":3513},{"type":21,"tag":2314,"props":32274,"children":32275},{"style":2321},[32276],{"type":26,"value":3518},{"type":21,"tag":2314,"props":32278,"children":32279},{"class":2316,"line":3413},[32280,32284,32288,32292],{"type":21,"tag":2314,"props":32281,"children":32282},{"style":3157},[32283],{"type":26,"value":4540},{"type":21,"tag":2314,"props":32285,"children":32286},{"style":2321},[32287],{"type":26,"value":14358},{"type":21,"tag":2314,"props":32289,"children":32290},{"style":2339},[32291],{"type":26,"value":5122},{"type":21,"tag":2314,"props":32293,"children":32294},{"style":2321},[32295],{"type":26,"value":12322},{"type":21,"tag":2314,"props":32297,"children":32298},{"class":2316,"line":436},[32299],{"type":21,"tag":2314,"props":32300,"children":32301},{"emptyLinePlaceholder":3181},[32302],{"type":26,"value":3184},{"type":21,"tag":2314,"props":32304,"children":32305},{"class":2316,"line":3473},[32306],{"type":21,"tag":2314,"props":32307,"children":32308},{"style":3407},[32309],{"type":26,"value":32310},"# Automatic gradient computation\n",{"type":21,"tag":2314,"props":32312,"children":32313},{"class":2316,"line":3521},[32314,32319,32323],{"type":21,"tag":2314,"props":32315,"children":32316},{"style":2321},[32317],{"type":26,"value":32318},"grad_fn ",{"type":21,"tag":2314,"props":32320,"children":32321},{"style":3157},[32322],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32324,"children":32325},{"style":2321},[32326],{"type":26,"value":32327}," qml.grad(circuit)\n",{"type":21,"tag":2314,"props":32329,"children":32330},{"class":2316,"line":3563},[32331,32336,32340,32345,32349,32353,32358],{"type":21,"tag":2314,"props":32332,"children":32333},{"style":2321},[32334],{"type":26,"value":32335},"theta ",{"type":21,"tag":2314,"props":32337,"children":32338},{"style":3157},[32339],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32341,"children":32342},{"style":2321},[32343],{"type":26,"value":32344}," np.array([",{"type":21,"tag":2314,"props":32346,"children":32347},{"style":2339},[32348],{"type":26,"value":2436},{"type":21,"tag":2314,"props":32350,"children":32351},{"style":2321},[32352],{"type":26,"value":1309},{"type":21,"tag":2314,"props":32354,"children":32355},{"style":2339},[32356],{"type":26,"value":32357},"1.2",{"type":21,"tag":2314,"props":32359,"children":32360},{"style":2321},[32361],{"type":26,"value":3518},{"type":21,"tag":2314,"props":32363,"children":32364},{"class":2316,"line":4585},[32365,32369,32374],{"type":21,"tag":2314,"props":32366,"children":32367},{"style":2339},[32368],{"type":26,"value":3272},{"type":21,"tag":2314,"props":32370,"children":32371},{"style":2321},[32372],{"type":26,"value":32373},"(grad_fn(theta))  ",{"type":21,"tag":2314,"props":32375,"children":32376},{"style":3407},[32377],{"type":26,"value":32378},"# exact gradient\n",{"type":21,"tag":22,"props":32380,"children":32381},{},[32382,32384,32390,32392,32397],{"type":26,"value":32383},"若需要不带梯度的更快模拟，可使用 ",{"type":21,"tag":2073,"props":32385,"children":32387},{"className":32386},[],[32388],{"type":26,"value":32389},"lightning.qubit",{"type":26,"value":32391},"（C++ 后端，比 ",{"type":21,"tag":2073,"props":32393,"children":32395},{"className":32394},[],[32396],{"type":26,"value":15371},{"type":26,"value":32398}," 快约 10 倍）：",{"type":21,"tag":2304,"props":32400,"children":32402},{"className":9697,"code":32401,"language":9699,"meta":7,"style":7},"pip install pennylane-lightning\n",[32403],{"type":21,"tag":2073,"props":32404,"children":32405},{"__ignoreMap":7},[32406],{"type":21,"tag":2314,"props":32407,"children":32408},{"class":2316,"line":2317},[32409,32413,32417],{"type":21,"tag":2314,"props":32410,"children":32411},{"style":4318},[32412],{"type":26,"value":11748},{"type":21,"tag":2314,"props":32414,"children":32415},{"style":2350},[32416],{"type":26,"value":11753},{"type":21,"tag":2314,"props":32418,"children":32419},{"style":2350},[32420],{"type":26,"value":32421}," pennylane-lightning\n",{"type":21,"tag":2304,"props":32423,"children":32425},{"className":3145,"code":32424,"language":3147,"meta":7,"style":7},"dev = qml.device(\"lightning.qubit\", wires=20)\n",[32426],{"type":21,"tag":2073,"props":32427,"children":32428},{"__ignoreMap":7},[32429],{"type":21,"tag":2314,"props":32430,"children":32431},{"class":2316,"line":2317},[32432,32436,32440,32444,32449,32453,32457,32461,32466],{"type":21,"tag":2314,"props":32433,"children":32434},{"style":2321},[32435],{"type":26,"value":14179},{"type":21,"tag":2314,"props":32437,"children":32438},{"style":3157},[32439],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32441,"children":32442},{"style":2321},[32443],{"type":26,"value":14188},{"type":21,"tag":2314,"props":32445,"children":32446},{"style":2350},[32447],{"type":26,"value":32448},"\"lightning.qubit\"",{"type":21,"tag":2314,"props":32450,"children":32451},{"style":2321},[32452],{"type":26,"value":1309},{"type":21,"tag":2314,"props":32454,"children":32455},{"style":3222},[32456],{"type":26,"value":14202},{"type":21,"tag":2314,"props":32458,"children":32459},{"style":3157},[32460],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32462,"children":32463},{"style":2339},[32464],{"type":26,"value":32465},"20",{"type":21,"tag":2314,"props":32467,"children":32468},{"style":2321},[32469],{"type":26,"value":3257},{"type":21,"tag":22,"props":32471,"children":32472},{},[32473,32478],{"type":21,"tag":136,"props":32474,"children":32475},{},[32476],{"type":26,"value":32477},"何时使用 PennyLane：",{"type":26,"value":32479}," 变分算法（VQE、QAOA）、量子机器学习，以及任何需要电路梯度的工作流。",{"type":21,"tag":29,"props":32481,"children":32483},{"id":32482},"nvidia-cuda-q当速度至关重要时",[32484],{"type":26,"value":32485},"NVIDIA CUDA-Q：当速度至关重要时",{"type":21,"tag":22,"props":32487,"children":32488},{},[32489,32493],{"type":21,"tag":46,"props":32490,"children":32491},{"href":20571},[32492],{"type":26,"value":18171},{"type":26,"value":32494}," 提供 GPU 加速的模拟，对于大型电路，其速度可比 CPU 模拟器快 100 到 10,000 倍。如果你有任何一块 NVIDIA GPU，那么对于 25 个以上量子比特的电路，这就是正确的选择：",{"type":21,"tag":2304,"props":32496,"children":32498},{"className":3145,"code":32497,"language":3147,"meta":7,"style":7},"import cudaq\n\n@cudaq.kernel\ndef large_circuit(n: int):\n    qvec = cudaq.qvector(n)\n    h(qvec[0])\n    for i in range(n - 1):\n        cx(qvec[i], qvec[i + 1])\n    mz(qvec)\n\n# Run on GPU (specify 'nvidia' target)\ncudaq.set_target('nvidia')\ncounts = cudaq.sample(large_circuit, 30, shots_count=10000)\nprint(counts)\n",[32499],{"type":21,"tag":2073,"props":32500,"children":32501},{"__ignoreMap":7},[32502,32513,32520,32527,32552,32568,32583,32618,32638,32646,32653,32661,32678,32720],{"type":21,"tag":2314,"props":32503,"children":32504},{"class":2316,"line":2317},[32505,32509],{"type":21,"tag":2314,"props":32506,"children":32507},{"style":3157},[32508],{"type":26,"value":3170},{"type":21,"tag":2314,"props":32510,"children":32511},{"style":2321},[32512],{"type":26,"value":21843},{"type":21,"tag":2314,"props":32514,"children":32515},{"class":2316,"line":106},[32516],{"type":21,"tag":2314,"props":32517,"children":32518},{"emptyLinePlaceholder":3181},[32519],{"type":26,"value":3184},{"type":21,"tag":2314,"props":32521,"children":32522},{"class":2316,"line":2335},[32523],{"type":21,"tag":2314,"props":32524,"children":32525},{"style":4318},[32526],{"type":26,"value":21851},{"type":21,"tag":2314,"props":32528,"children":32529},{"class":2316,"line":2397},[32530,32534,32539,32544,32548],{"type":21,"tag":2314,"props":32531,"children":32532},{"style":3157},[32533],{"type":26,"value":4315},{"type":21,"tag":2314,"props":32535,"children":32536},{"style":4318},[32537],{"type":26,"value":32538}," large_circuit",{"type":21,"tag":2314,"props":32540,"children":32541},{"style":2321},[32542],{"type":26,"value":32543},"(n: ",{"type":21,"tag":2314,"props":32545,"children":32546},{"style":2339},[32547],{"type":26,"value":4977},{"type":21,"tag":2314,"props":32549,"children":32550},{"style":2321},[32551],{"type":26,"value":4368},{"type":21,"tag":2314,"props":32553,"children":32554},{"class":2316,"line":2421},[32555,32559,32563],{"type":21,"tag":2314,"props":32556,"children":32557},{"style":2321},[32558],{"type":26,"value":21874},{"type":21,"tag":2314,"props":32560,"children":32561},{"style":3157},[32562],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32564,"children":32565},{"style":2321},[32566],{"type":26,"value":32567}," cudaq.qvector(n)\n",{"type":21,"tag":2314,"props":32569,"children":32570},{"class":2316,"line":16},[32571,32575,32579],{"type":21,"tag":2314,"props":32572,"children":32573},{"style":2321},[32574],{"type":26,"value":21899},{"type":21,"tag":2314,"props":32576,"children":32577},{"style":2339},[32578],{"type":26,"value":5122},{"type":21,"tag":2314,"props":32580,"children":32581},{"style":2321},[32582],{"type":26,"value":3518},{"type":21,"tag":2314,"props":32584,"children":32585},{"class":2316,"line":127},[32586,32590,32594,32598,32602,32606,32610,32614],{"type":21,"tag":2314,"props":32587,"children":32588},{"style":3157},[32589],{"type":26,"value":4694},{"type":21,"tag":2314,"props":32591,"children":32592},{"style":2321},[32593],{"type":26,"value":4699},{"type":21,"tag":2314,"props":32595,"children":32596},{"style":3157},[32597],{"type":26,"value":3460},{"type":21,"tag":2314,"props":32599,"children":32600},{"style":2339},[32601],{"type":26,"value":3465},{"type":21,"tag":2314,"props":32603,"children":32604},{"style":2321},[32605],{"type":26,"value":7623},{"type":21,"tag":2314,"props":32607,"children":32608},{"style":3157},[32609],{"type":26,"value":4802},{"type":21,"tag":2314,"props":32611,"children":32612},{"style":2339},[32613],{"type":26,"value":6053},{"type":21,"tag":2314,"props":32615,"children":32616},{"style":2321},[32617],{"type":26,"value":4368},{"type":21,"tag":2314,"props":32619,"children":32620},{"class":2316,"line":887},[32621,32626,32630,32634],{"type":21,"tag":2314,"props":32622,"children":32623},{"style":2321},[32624],{"type":26,"value":32625},"        cx(qvec[i], qvec[i ",{"type":21,"tag":2314,"props":32627,"children":32628},{"style":3157},[32629],{"type":26,"value":6482},{"type":21,"tag":2314,"props":32631,"children":32632},{"style":2339},[32633],{"type":26,"value":6053},{"type":21,"tag":2314,"props":32635,"children":32636},{"style":2321},[32637],{"type":26,"value":3518},{"type":21,"tag":2314,"props":32639,"children":32640},{"class":2316,"line":1364},[32641],{"type":21,"tag":2314,"props":32642,"children":32643},{"style":2321},[32644],{"type":26,"value":32645},"    mz(qvec)\n",{"type":21,"tag":2314,"props":32647,"children":32648},{"class":2316,"line":3403},[32649],{"type":21,"tag":2314,"props":32650,"children":32651},{"emptyLinePlaceholder":3181},[32652],{"type":26,"value":3184},{"type":21,"tag":2314,"props":32654,"children":32655},{"class":2316,"line":3413},[32656],{"type":21,"tag":2314,"props":32657,"children":32658},{"style":3407},[32659],{"type":26,"value":32660},"# Run on GPU (specify 'nvidia' target)\n",{"type":21,"tag":2314,"props":32662,"children":32663},{"class":2316,"line":436},[32664,32669,32674],{"type":21,"tag":2314,"props":32665,"children":32666},{"style":2321},[32667],{"type":26,"value":32668},"cudaq.set_target(",{"type":21,"tag":2314,"props":32670,"children":32671},{"style":2350},[32672],{"type":26,"value":32673},"'nvidia'",{"type":21,"tag":2314,"props":32675,"children":32676},{"style":2321},[32677],{"type":26,"value":3257},{"type":21,"tag":2314,"props":32679,"children":32680},{"class":2316,"line":3473},[32681,32685,32689,32694,32699,32703,32707,32711,32716],{"type":21,"tag":2314,"props":32682,"children":32683},{"style":2321},[32684],{"type":26,"value":8411},{"type":21,"tag":2314,"props":32686,"children":32687},{"style":3157},[32688],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32690,"children":32691},{"style":2321},[32692],{"type":26,"value":32693}," cudaq.sample(large_circuit, ",{"type":21,"tag":2314,"props":32695,"children":32696},{"style":2339},[32697],{"type":26,"value":32698},"30",{"type":21,"tag":2314,"props":32700,"children":32701},{"style":2321},[32702],{"type":26,"value":1309},{"type":21,"tag":2314,"props":32704,"children":32705},{"style":3222},[32706],{"type":26,"value":21948},{"type":21,"tag":2314,"props":32708,"children":32709},{"style":3157},[32710],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32712,"children":32713},{"style":2339},[32714],{"type":26,"value":32715},"10000",{"type":21,"tag":2314,"props":32717,"children":32718},{"style":2321},[32719],{"type":26,"value":3257},{"type":21,"tag":2314,"props":32721,"children":32722},{"class":2316,"line":3521},[32723,32727],{"type":21,"tag":2314,"props":32724,"children":32725},{"style":2339},[32726],{"type":26,"value":3272},{"type":21,"tag":2314,"props":32728,"children":32729},{"style":2321},[32730],{"type":26,"value":32731},"(counts)\n",{"type":21,"tag":22,"props":32733,"children":32734},{},[32735,32740],{"type":21,"tag":136,"props":32736,"children":32737},{},[32738],{"type":26,"value":32739},"性能基准测试",{"type":26,"value":32741},"（GHZ 电路，28 个量子比特，1000 shots）：",{"type":21,"tag":3080,"props":32743,"children":32744},{},[32745,32750,32755],{"type":21,"tag":3084,"props":32746,"children":32747},{},[32748],{"type":26,"value":32749},"Qiskit Aer CPU：约 45 秒",{"type":21,"tag":3084,"props":32751,"children":32752},{},[32753],{"type":26,"value":32754},"PennyLane lightning.qubit：约 30 秒",{"type":21,"tag":3084,"props":32756,"children":32757},{},[32758],{"type":26,"value":32759},"CUDA-Q（A100 GPU）：约 0.8 秒",{"type":21,"tag":22,"props":32761,"children":32762},{},[32763,32768],{"type":21,"tag":136,"props":32764,"children":32765},{},[32766],{"type":26,"value":32767},"何时使用 CUDA-Q：",{"type":26,"value":32769}," 任何 25 个以上量子比特的电路、性能关键的模拟、多 GPU 工作负载。",{"type":21,"tag":29,"props":32771,"children":32773},{"id":32772},"cirq噪声建模与-nisq-研究",[32774],{"type":26,"value":32775},"Cirq：噪声建模与 NISQ 研究",{"type":21,"tag":22,"props":32777,"children":32778},{},[32779,32783],{"type":21,"tag":46,"props":32780,"children":32781},{"href":8787},[32782],{"type":26,"value":20802},{"type":26,"value":32784}," 包含三种模拟器：",{"type":21,"tag":2304,"props":32786,"children":32788},{"className":3145,"code":32787,"language":3147,"meta":7,"style":7},"import cirq\n\n# Exact statevector simulation\nsim = cirq.Simulator()\n\n# Density matrix with noise\nnoise_model = cirq.ConstantQubitNoiseModel(\n    cirq.depolarize(p=0.01)\n)\nnoisy_sim = cirq.DensityMatrixSimulator(noise=noise_model)\n\n# Clifford circuits only (but exponentially faster for stabilizer states)\nclifford_sim = cirq.CliffordSimulator()\n",[32789],{"type":21,"tag":2073,"props":32790,"children":32791},{"__ignoreMap":7},[32792,32804,32811,32819,32835,32842,32850,32867,32892,32899,32929,32936,32944],{"type":21,"tag":2314,"props":32793,"children":32794},{"class":2316,"line":2317},[32795,32799],{"type":21,"tag":2314,"props":32796,"children":32797},{"style":3157},[32798],{"type":26,"value":3170},{"type":21,"tag":2314,"props":32800,"children":32801},{"style":2321},[32802],{"type":26,"value":32803}," cirq\n",{"type":21,"tag":2314,"props":32805,"children":32806},{"class":2316,"line":106},[32807],{"type":21,"tag":2314,"props":32808,"children":32809},{"emptyLinePlaceholder":3181},[32810],{"type":26,"value":3184},{"type":21,"tag":2314,"props":32812,"children":32813},{"class":2316,"line":2335},[32814],{"type":21,"tag":2314,"props":32815,"children":32816},{"style":3407},[32817],{"type":26,"value":32818},"# Exact statevector simulation\n",{"type":21,"tag":2314,"props":32820,"children":32821},{"class":2316,"line":2397},[32822,32826,32830],{"type":21,"tag":2314,"props":32823,"children":32824},{"style":2321},[32825],{"type":26,"value":8378},{"type":21,"tag":2314,"props":32827,"children":32828},{"style":3157},[32829],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32831,"children":32832},{"style":2321},[32833],{"type":26,"value":32834}," cirq.Simulator()\n",{"type":21,"tag":2314,"props":32836,"children":32837},{"class":2316,"line":2421},[32838],{"type":21,"tag":2314,"props":32839,"children":32840},{"emptyLinePlaceholder":3181},[32841],{"type":26,"value":3184},{"type":21,"tag":2314,"props":32843,"children":32844},{"class":2316,"line":16},[32845],{"type":21,"tag":2314,"props":32846,"children":32847},{"style":3407},[32848],{"type":26,"value":32849},"# Density matrix with noise\n",{"type":21,"tag":2314,"props":32851,"children":32852},{"class":2316,"line":127},[32853,32858,32862],{"type":21,"tag":2314,"props":32854,"children":32855},{"style":2321},[32856],{"type":26,"value":32857},"noise_model ",{"type":21,"tag":2314,"props":32859,"children":32860},{"style":3157},[32861],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32863,"children":32864},{"style":2321},[32865],{"type":26,"value":32866}," cirq.ConstantQubitNoiseModel(\n",{"type":21,"tag":2314,"props":32868,"children":32869},{"class":2316,"line":887},[32870,32875,32879,32883,32888],{"type":21,"tag":2314,"props":32871,"children":32872},{"style":2321},[32873],{"type":26,"value":32874},"    cirq.depolarize(",{"type":21,"tag":2314,"props":32876,"children":32877},{"style":3222},[32878],{"type":26,"value":22},{"type":21,"tag":2314,"props":32880,"children":32881},{"style":3157},[32882],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32884,"children":32885},{"style":2339},[32886],{"type":26,"value":32887},"0.01",{"type":21,"tag":2314,"props":32889,"children":32890},{"style":2321},[32891],{"type":26,"value":3257},{"type":21,"tag":2314,"props":32893,"children":32894},{"class":2316,"line":1364},[32895],{"type":21,"tag":2314,"props":32896,"children":32897},{"style":2321},[32898],{"type":26,"value":3257},{"type":21,"tag":2314,"props":32900,"children":32901},{"class":2316,"line":3403},[32902,32907,32911,32916,32920,32924],{"type":21,"tag":2314,"props":32903,"children":32904},{"style":2321},[32905],{"type":26,"value":32906},"noisy_sim ",{"type":21,"tag":2314,"props":32908,"children":32909},{"style":3157},[32910],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32912,"children":32913},{"style":2321},[32914],{"type":26,"value":32915}," cirq.DensityMatrixSimulator(",{"type":21,"tag":2314,"props":32917,"children":32918},{"style":3222},[32919],{"type":26,"value":14593},{"type":21,"tag":2314,"props":32921,"children":32922},{"style":3157},[32923],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32925,"children":32926},{"style":2321},[32927],{"type":26,"value":32928},"noise_model)\n",{"type":21,"tag":2314,"props":32930,"children":32931},{"class":2316,"line":3413},[32932],{"type":21,"tag":2314,"props":32933,"children":32934},{"emptyLinePlaceholder":3181},[32935],{"type":26,"value":3184},{"type":21,"tag":2314,"props":32937,"children":32938},{"class":2316,"line":436},[32939],{"type":21,"tag":2314,"props":32940,"children":32941},{"style":3407},[32942],{"type":26,"value":32943},"# Clifford circuits only (but exponentially faster for stabilizer states)\n",{"type":21,"tag":2314,"props":32945,"children":32946},{"class":2316,"line":3473},[32947,32952,32956],{"type":21,"tag":2314,"props":32948,"children":32949},{"style":2321},[32950],{"type":26,"value":32951},"clifford_sim ",{"type":21,"tag":2314,"props":32953,"children":32954},{"style":3157},[32955],{"type":26,"value":3197},{"type":21,"tag":2314,"props":32957,"children":32958},{"style":2321},[32959],{"type":26,"value":32960}," cirq.CliffordSimulator()\n",{"type":21,"tag":22,"props":32962,"children":32963},{},[32964,32969],{"type":21,"tag":136,"props":32965,"children":32966},{},[32967],{"type":26,"value":32968},"何时使用 Cirq：",{"type":26,"value":32970}," NISQ 噪声建模、稳定子（stabilizer）电路研究、Google AI Quantum 工作流。",{"type":21,"tag":29,"props":32972,"children":32974},{"id":32973},"amazon-braket-localsimulator隔离性与可移植性",[32975],{"type":26,"value":32976},"Amazon Braket LocalSimulator：隔离性与可移植性",{"type":21,"tag":22,"props":32978,"children":32979},{},[32980,32986],{"type":21,"tag":46,"props":32981,"children":32983},{"href":32982},"\u002Fsdks\u002Fbraket",[32984],{"type":26,"value":32985},"Braket SDK",{"type":26,"value":32987}," 包含一个免费的本地模拟器，它精确地镜像云端 API：",{"type":21,"tag":2304,"props":32989,"children":32991},{"className":3145,"code":32990,"language":3147,"meta":7,"style":7},"from braket.devices import LocalSimulator\nfrom braket.circuits import Circuit\n\ndevice = LocalSimulator()\n\ncircuit = Circuit()\ncircuit.h(0)\ncircuit.cnot(0, 1)\ncircuit.probability()\n\ntask = device.run(circuit, shots=1000)\nresult = task.result()\nprint(result.measurement_counts)\n",[32992],{"type":21,"tag":2073,"props":32993,"children":32994},{"__ignoreMap":7},[32995,33016,33037,33044,33061,33068,33085,33101,33125,33133,33140,33173,33189],{"type":21,"tag":2314,"props":32996,"children":32997},{"class":2316,"line":2317},[32998,33002,33007,33011],{"type":21,"tag":2314,"props":32999,"children":33000},{"style":3157},[33001],{"type":26,"value":3160},{"type":21,"tag":2314,"props":33003,"children":33004},{"style":2321},[33005],{"type":26,"value":33006}," braket.devices ",{"type":21,"tag":2314,"props":33008,"children":33009},{"style":3157},[33010],{"type":26,"value":3170},{"type":21,"tag":2314,"props":33012,"children":33013},{"style":2321},[33014],{"type":26,"value":33015}," LocalSimulator\n",{"type":21,"tag":2314,"props":33017,"children":33018},{"class":2316,"line":106},[33019,33023,33028,33032],{"type":21,"tag":2314,"props":33020,"children":33021},{"style":3157},[33022],{"type":26,"value":3160},{"type":21,"tag":2314,"props":33024,"children":33025},{"style":2321},[33026],{"type":26,"value":33027}," braket.circuits ",{"type":21,"tag":2314,"props":33029,"children":33030},{"style":3157},[33031],{"type":26,"value":3170},{"type":21,"tag":2314,"props":33033,"children":33034},{"style":2321},[33035],{"type":26,"value":33036}," Circuit\n",{"type":21,"tag":2314,"props":33038,"children":33039},{"class":2316,"line":2335},[33040],{"type":21,"tag":2314,"props":33041,"children":33042},{"emptyLinePlaceholder":3181},[33043],{"type":26,"value":3184},{"type":21,"tag":2314,"props":33045,"children":33046},{"class":2316,"line":2397},[33047,33052,33056],{"type":21,"tag":2314,"props":33048,"children":33049},{"style":2321},[33050],{"type":26,"value":33051},"device ",{"type":21,"tag":2314,"props":33053,"children":33054},{"style":3157},[33055],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33057,"children":33058},{"style":2321},[33059],{"type":26,"value":33060}," LocalSimulator()\n",{"type":21,"tag":2314,"props":33062,"children":33063},{"class":2316,"line":2421},[33064],{"type":21,"tag":2314,"props":33065,"children":33066},{"emptyLinePlaceholder":3181},[33067],{"type":26,"value":3184},{"type":21,"tag":2314,"props":33069,"children":33070},{"class":2316,"line":16},[33071,33076,33080],{"type":21,"tag":2314,"props":33072,"children":33073},{"style":2321},[33074],{"type":26,"value":33075},"circuit ",{"type":21,"tag":2314,"props":33077,"children":33078},{"style":3157},[33079],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33081,"children":33082},{"style":2321},[33083],{"type":26,"value":33084}," Circuit()\n",{"type":21,"tag":2314,"props":33086,"children":33087},{"class":2316,"line":127},[33088,33093,33097],{"type":21,"tag":2314,"props":33089,"children":33090},{"style":2321},[33091],{"type":26,"value":33092},"circuit.h(",{"type":21,"tag":2314,"props":33094,"children":33095},{"style":2339},[33096],{"type":26,"value":5122},{"type":21,"tag":2314,"props":33098,"children":33099},{"style":2321},[33100],{"type":26,"value":3257},{"type":21,"tag":2314,"props":33102,"children":33103},{"class":2316,"line":887},[33104,33109,33113,33117,33121],{"type":21,"tag":2314,"props":33105,"children":33106},{"style":2321},[33107],{"type":26,"value":33108},"circuit.cnot(",{"type":21,"tag":2314,"props":33110,"children":33111},{"style":2339},[33112],{"type":26,"value":5122},{"type":21,"tag":2314,"props":33114,"children":33115},{"style":2321},[33116],{"type":26,"value":1309},{"type":21,"tag":2314,"props":33118,"children":33119},{"style":2339},[33120],{"type":26,"value":3513},{"type":21,"tag":2314,"props":33122,"children":33123},{"style":2321},[33124],{"type":26,"value":3257},{"type":21,"tag":2314,"props":33126,"children":33127},{"class":2316,"line":1364},[33128],{"type":21,"tag":2314,"props":33129,"children":33130},{"style":2321},[33131],{"type":26,"value":33132},"circuit.probability()\n",{"type":21,"tag":2314,"props":33134,"children":33135},{"class":2316,"line":3403},[33136],{"type":21,"tag":2314,"props":33137,"children":33138},{"emptyLinePlaceholder":3181},[33139],{"type":26,"value":3184},{"type":21,"tag":2314,"props":33141,"children":33142},{"class":2316,"line":3413},[33143,33148,33152,33157,33161,33165,33169],{"type":21,"tag":2314,"props":33144,"children":33145},{"style":2321},[33146],{"type":26,"value":33147},"task ",{"type":21,"tag":2314,"props":33149,"children":33150},{"style":3157},[33151],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33153,"children":33154},{"style":2321},[33155],{"type":26,"value":33156}," device.run(circuit, ",{"type":21,"tag":2314,"props":33158,"children":33159},{"style":3222},[33160],{"type":26,"value":4077},{"type":21,"tag":2314,"props":33162,"children":33163},{"style":3157},[33164],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33166,"children":33167},{"style":2339},[33168],{"type":26,"value":20419},{"type":21,"tag":2314,"props":33170,"children":33171},{"style":2321},[33172],{"type":26,"value":3257},{"type":21,"tag":2314,"props":33174,"children":33175},{"class":2316,"line":436},[33176,33180,33184],{"type":21,"tag":2314,"props":33177,"children":33178},{"style":2321},[33179],{"type":26,"value":19287},{"type":21,"tag":2314,"props":33181,"children":33182},{"style":3157},[33183],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33185,"children":33186},{"style":2321},[33187],{"type":26,"value":33188}," task.result()\n",{"type":21,"tag":2314,"props":33190,"children":33191},{"class":2316,"line":3473},[33192,33196],{"type":21,"tag":2314,"props":33193,"children":33194},{"style":2339},[33195],{"type":26,"value":3272},{"type":21,"tag":2314,"props":33197,"children":33198},{"style":2321},[33199],{"type":26,"value":33200},"(result.measurement_counts)\n",{"type":21,"tag":22,"props":33202,"children":33203},{},[33204,33209],{"type":21,"tag":136,"props":33205,"children":33206},{},[33207],{"type":26,"value":33208},"何时使用 Braket 本地模拟器：",{"type":26,"value":33210}," 你正在为 AWS 部署做开发，并希望本地开发\u002F测试环境能与云端 API 保持一致。",{"type":21,"tag":29,"props":33212,"children":33214},{"id":33213},"hlquantum-捷径",[33215],{"type":26,"value":33216},"HLQuantum 捷径",{"type":21,"tag":22,"props":33218,"children":33219},{},[33220,33222,33226],{"type":26,"value":33221},"如果你需要在多个模拟器上运行同一个电路以进行基准测试或对比，",{"type":21,"tag":46,"props":33223,"children":33224},{"href":18964},[33225],{"type":26,"value":18967},{"type":26,"value":33227}," 让这件事变得轻而易举：",{"type":21,"tag":2304,"props":33229,"children":33231},{"className":3145,"code":33230,"language":3147,"meta":7,"style":7},"import hlquantum as hlq\nimport time\n\nqc = hlq.Circuit(28)\nqc.h(0)\nfor i in range(27):\n    qc.cx(i, i + 1)\nqc.measure_all()\n\nfor backend in [\"qiskit\", \"pennylane\", \"cudaq\"]:\n    t0 = time.time()\n    result = hlq.run(qc, shots=1000, backend=backend)\n    print(f\"{backend}: {time.time() - t0:.2f}s\")\n",[33232],{"type":21,"tag":2073,"props":33233,"children":33234},{"__ignoreMap":7},[33235,33254,33266,33273,33297,33312,33344,33364,33371,33378,33424,33441,33485],{"type":21,"tag":2314,"props":33236,"children":33237},{"class":2316,"line":2317},[33238,33242,33246,33250],{"type":21,"tag":2314,"props":33239,"children":33240},{"style":3157},[33241],{"type":26,"value":3170},{"type":21,"tag":2314,"props":33243,"children":33244},{"style":2321},[33245],{"type":26,"value":19255},{"type":21,"tag":2314,"props":33247,"children":33248},{"style":3157},[33249],{"type":26,"value":4232},{"type":21,"tag":2314,"props":33251,"children":33252},{"style":2321},[33253],{"type":26,"value":19264},{"type":21,"tag":2314,"props":33255,"children":33256},{"class":2316,"line":106},[33257,33261],{"type":21,"tag":2314,"props":33258,"children":33259},{"style":3157},[33260],{"type":26,"value":3170},{"type":21,"tag":2314,"props":33262,"children":33263},{"style":2321},[33264],{"type":26,"value":33265}," time\n",{"type":21,"tag":2314,"props":33267,"children":33268},{"class":2316,"line":2335},[33269],{"type":21,"tag":2314,"props":33270,"children":33271},{"emptyLinePlaceholder":3181},[33272],{"type":26,"value":3184},{"type":21,"tag":2314,"props":33274,"children":33275},{"class":2316,"line":2397},[33276,33280,33284,33288,33293],{"type":21,"tag":2314,"props":33277,"children":33278},{"style":2321},[33279],{"type":26,"value":7336},{"type":21,"tag":2314,"props":33281,"children":33282},{"style":3157},[33283],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33285,"children":33286},{"style":2321},[33287],{"type":26,"value":21313},{"type":21,"tag":2314,"props":33289,"children":33290},{"style":2339},[33291],{"type":26,"value":33292},"28",{"type":21,"tag":2314,"props":33294,"children":33295},{"style":2321},[33296],{"type":26,"value":3257},{"type":21,"tag":2314,"props":33298,"children":33299},{"class":2316,"line":2421},[33300,33304,33308],{"type":21,"tag":2314,"props":33301,"children":33302},{"style":2321},[33303],{"type":26,"value":7352},{"type":21,"tag":2314,"props":33305,"children":33306},{"style":2339},[33307],{"type":26,"value":5122},{"type":21,"tag":2314,"props":33309,"children":33310},{"style":2321},[33311],{"type":26,"value":3257},{"type":21,"tag":2314,"props":33313,"children":33314},{"class":2316,"line":16},[33315,33319,33323,33327,33331,33335,33340],{"type":21,"tag":2314,"props":33316,"children":33317},{"style":3157},[33318],{"type":26,"value":3450},{"type":21,"tag":2314,"props":33320,"children":33321},{"style":2321},[33322],{"type":26,"value":4699},{"type":21,"tag":2314,"props":33324,"children":33325},{"style":3157},[33326],{"type":26,"value":3460},{"type":21,"tag":2314,"props":33328,"children":33329},{"style":2339},[33330],{"type":26,"value":3465},{"type":21,"tag":2314,"props":33332,"children":33333},{"style":2321},[33334],{"type":26,"value":3277},{"type":21,"tag":2314,"props":33336,"children":33337},{"style":2339},[33338],{"type":26,"value":33339},"27",{"type":21,"tag":2314,"props":33341,"children":33342},{"style":2321},[33343],{"type":26,"value":4368},{"type":21,"tag":2314,"props":33345,"children":33346},{"class":2316,"line":127},[33347,33352,33356,33360],{"type":21,"tag":2314,"props":33348,"children":33349},{"style":2321},[33350],{"type":26,"value":33351},"    qc.cx(i, i ",{"type":21,"tag":2314,"props":33353,"children":33354},{"style":3157},[33355],{"type":26,"value":6482},{"type":21,"tag":2314,"props":33357,"children":33358},{"style":2339},[33359],{"type":26,"value":6053},{"type":21,"tag":2314,"props":33361,"children":33362},{"style":2321},[33363],{"type":26,"value":3257},{"type":21,"tag":2314,"props":33365,"children":33366},{"class":2316,"line":887},[33367],{"type":21,"tag":2314,"props":33368,"children":33369},{"style":2321},[33370],{"type":26,"value":13043},{"type":21,"tag":2314,"props":33372,"children":33373},{"class":2316,"line":1364},[33374],{"type":21,"tag":2314,"props":33375,"children":33376},{"emptyLinePlaceholder":3181},[33377],{"type":26,"value":3184},{"type":21,"tag":2314,"props":33379,"children":33380},{"class":2316,"line":3403},[33381,33385,33390,33394,33398,33402,33406,33411,33415,33420],{"type":21,"tag":2314,"props":33382,"children":33383},{"style":3157},[33384],{"type":26,"value":3450},{"type":21,"tag":2314,"props":33386,"children":33387},{"style":2321},[33388],{"type":26,"value":33389}," backend ",{"type":21,"tag":2314,"props":33391,"children":33392},{"style":3157},[33393],{"type":26,"value":3460},{"type":21,"tag":2314,"props":33395,"children":33396},{"style":2321},[33397],{"type":26,"value":6615},{"type":21,"tag":2314,"props":33399,"children":33400},{"style":2350},[33401],{"type":26,"value":28723},{"type":21,"tag":2314,"props":33403,"children":33404},{"style":2321},[33405],{"type":26,"value":1309},{"type":21,"tag":2314,"props":33407,"children":33408},{"style":2350},[33409],{"type":26,"value":33410},"\"pennylane\"",{"type":21,"tag":2314,"props":33412,"children":33413},{"style":2321},[33414],{"type":26,"value":1309},{"type":21,"tag":2314,"props":33416,"children":33417},{"style":2350},[33418],{"type":26,"value":33419},"\"cudaq\"",{"type":21,"tag":2314,"props":33421,"children":33422},{"style":2321},[33423],{"type":26,"value":17540},{"type":21,"tag":2314,"props":33425,"children":33426},{"class":2316,"line":3413},[33427,33432,33436],{"type":21,"tag":2314,"props":33428,"children":33429},{"style":2321},[33430],{"type":26,"value":33431},"    t0 ",{"type":21,"tag":2314,"props":33433,"children":33434},{"style":3157},[33435],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33437,"children":33438},{"style":2321},[33439],{"type":26,"value":33440}," time.time()\n",{"type":21,"tag":2314,"props":33442,"children":33443},{"class":2316,"line":436},[33444,33449,33453,33457,33461,33465,33469,33473,33477,33481],{"type":21,"tag":2314,"props":33445,"children":33446},{"style":2321},[33447],{"type":26,"value":33448},"    result ",{"type":21,"tag":2314,"props":33450,"children":33451},{"style":3157},[33452],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33454,"children":33455},{"style":2321},[33456],{"type":26,"value":21377},{"type":21,"tag":2314,"props":33458,"children":33459},{"style":3222},[33460],{"type":26,"value":4077},{"type":21,"tag":2314,"props":33462,"children":33463},{"style":3157},[33464],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33466,"children":33467},{"style":2339},[33468],{"type":26,"value":20419},{"type":21,"tag":2314,"props":33470,"children":33471},{"style":2321},[33472],{"type":26,"value":1309},{"type":21,"tag":2314,"props":33474,"children":33475},{"style":3222},[33476],{"type":26,"value":18425},{"type":21,"tag":2314,"props":33478,"children":33479},{"style":3157},[33480],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33482,"children":33483},{"style":2321},[33484],{"type":26,"value":28242},{"type":21,"tag":2314,"props":33486,"children":33487},{"class":2316,"line":3473},[33488,33492,33496,33500,33504,33508,33512,33516,33520,33524,33529,33533,33538,33543,33547,33552],{"type":21,"tag":2314,"props":33489,"children":33490},{"style":2339},[33491],{"type":26,"value":17179},{"type":21,"tag":2314,"props":33493,"children":33494},{"style":2321},[33495],{"type":26,"value":3277},{"type":21,"tag":2314,"props":33497,"children":33498},{"style":3157},[33499],{"type":26,"value":3282},{"type":21,"tag":2314,"props":33501,"children":33502},{"style":2350},[33503],{"type":26,"value":3307},{"type":21,"tag":2314,"props":33505,"children":33506},{"style":2339},[33507],{"type":26,"value":3292},{"type":21,"tag":2314,"props":33509,"children":33510},{"style":2321},[33511],{"type":26,"value":18425},{"type":21,"tag":2314,"props":33513,"children":33514},{"style":2339},[33515],{"type":26,"value":3302},{"type":21,"tag":2314,"props":33517,"children":33518},{"style":2350},[33519],{"type":26,"value":2408},{"type":21,"tag":2314,"props":33521,"children":33522},{"style":2339},[33523],{"type":26,"value":3292},{"type":21,"tag":2314,"props":33525,"children":33526},{"style":2321},[33527],{"type":26,"value":33528},"time.time() ",{"type":21,"tag":2314,"props":33530,"children":33531},{"style":3157},[33532],{"type":26,"value":4802},{"type":21,"tag":2314,"props":33534,"children":33535},{"style":2321},[33536],{"type":26,"value":33537}," t0",{"type":21,"tag":2314,"props":33539,"children":33540},{"style":3157},[33541],{"type":26,"value":33542},":.2f",{"type":21,"tag":2314,"props":33544,"children":33545},{"style":2339},[33546],{"type":26,"value":3302},{"type":21,"tag":2314,"props":33548,"children":33549},{"style":2350},[33550],{"type":26,"value":33551},"s\"",{"type":21,"tag":2314,"props":33553,"children":33554},{"style":2321},[33555],{"type":26,"value":3257},{"type":21,"tag":22,"props":33557,"children":33558},{},[33559],{"type":26,"value":33560},"一个电路，三个后端，结果可直接对比。",{"type":21,"tag":2688,"props":33562,"children":33563},{},[33564],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":33566},[33567,33568,33569,33570,33571,33572,33573],{"id":31596,"depth":106,"text":31596},{"id":31784,"depth":106,"text":31787},{"id":32032,"depth":106,"text":32035},{"id":32482,"depth":106,"text":32485},{"id":32772,"depth":106,"text":32775},{"id":32973,"depth":106,"text":32976},{"id":33213,"depth":106,"text":33216},"content:zh:blog:quantum-simulators-compared.md","zh\u002Fblog\u002Fquantum-simulators-compared.md","zh\u002Fblog\u002Fquantum-simulators-compared",{"_path":33578,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":33579,"description":33580,"date":33581,"author":11,"tags":33582,"readingTime":1364,"body":33583,"_type":111,"_id":35671,"_source":113,"_file":35672,"_stem":35673,"_extension":116},"\u002Fzh\u002Fblog\u002Fvqe-pennylane-practical-guide","使用 PennyLane 构建 VQE：实用指南","使用 PennyLane 逐步实现变分量子本征求解器——从哈密顿量设置到经典优化循环。","2026-01-28",[282,13739,7102,13738],{"type":18,"children":33584,"toc":35662},[33585,33590,33596,33601,33624,33629,33634,33639,33666,33671,34002,34007,34012,34342,34348,34353,34828,34833,34841,34846,34851,34856,35140,35146,35151,35499,35504,35509,35519,35529,35547,35640,35658],{"type":21,"tag":22,"props":33586,"children":33587},{},[33588],{"type":26,"value":33589},"变分量子本征求解器（VQE）是最重要的近期量子算法之一。它可以求出分子或材料的基态能量——这是一项对经典计算机而言呈指数级困难、但在 NISQ 设备上却可行的计算。本指南将带你完成一个完整的 PennyLane VQE 实现。",{"type":21,"tag":29,"props":33591,"children":33593},{"id":33592},"vqe-的作用",[33594],{"type":26,"value":33595},"VQE 的作用",{"type":21,"tag":22,"props":33597,"children":33598},{},[33599],{"type":26,"value":33600},"VQE 用于求出哈密顿量 H（通常表示分子的能量）的最小本征值。其工作方式如下：",{"type":21,"tag":6961,"props":33602,"children":33603},{},[33604,33609,33614,33619],{"type":21,"tag":3084,"props":33605,"children":33606},{},[33607],{"type":26,"value":33608},"使用量子电路制备参数化试探态 |ψ(θ)⟩",{"type":21,"tag":3084,"props":33610,"children":33611},{},[33612],{"type":26,"value":33613},"在 QPU 上测量期望值 ⟨ψ(θ)|H|ψ(θ)⟩",{"type":21,"tag":3084,"props":33615,"children":33616},{},[33617],{"type":26,"value":33618},"使用经典优化器更新 θ 以最小化能量",{"type":21,"tag":3084,"props":33620,"children":33621},{},[33622],{"type":26,"value":33623},"重复上述步骤直至收敛",{"type":21,"tag":22,"props":33625,"children":33626},{},[33627],{"type":26,"value":33628},"变分原理保证对于任意态都有 ⟨ψ(θ)|H|ψ(θ)⟩ ≥ E₀——因此最小化这个量便给出了真实基态能量 E₀ 的一个上界。",{"type":21,"tag":29,"props":33630,"children":33632},{"id":33631},"环境设置",[33633],{"type":26,"value":33631},{"type":21,"tag":22,"props":33635,"children":33636},{},[33637],{"type":26,"value":33638},"安装 PennyLane 及其化学插件：",{"type":21,"tag":2304,"props":33640,"children":33642},{"code":33641,"language":9699,"meta":7,"className":9697,"style":7},"pip install pennylane pennylane-qchem\n",[33643],{"type":21,"tag":2073,"props":33644,"children":33645},{"__ignoreMap":7},[33646],{"type":21,"tag":2314,"props":33647,"children":33648},{"class":2316,"line":2317},[33649,33653,33657,33661],{"type":21,"tag":2314,"props":33650,"children":33651},{"style":4318},[33652],{"type":26,"value":11748},{"type":21,"tag":2314,"props":33654,"children":33655},{"style":2350},[33656],{"type":26,"value":11753},{"type":21,"tag":2314,"props":33658,"children":33659},{"style":2350},[33660],{"type":26,"value":20558},{"type":21,"tag":2314,"props":33662,"children":33663},{"style":2350},[33664],{"type":26,"value":33665}," pennylane-qchem\n",{"type":21,"tag":22,"props":33667,"children":33668},{},[33669],{"type":26,"value":33670},"对于氢分子（H₂）——这个经典的 VQE 基准——我们需要两个电子和四个自旋轨道（4 个量子比特）：",{"type":21,"tag":2304,"props":33672,"children":33674},{"code":33673,"language":3147,"meta":7,"className":3145,"style":7},"import pennylane as qml\nfrom pennylane import numpy as np\nimport pennylane.qchem as qchem\n\n# H2 at equilibrium bond length (Angstrom)\nsymbols = [\"H\", \"H\"]\ncoordinates = np.array([[0.0, 0.0, -0.6614], [0.0, 0.0, 0.6614]])\n\n# Build the qubit Hamiltonian\nH, qubits = qchem.molecular_hamiltonian(\n    symbols,\n    coordinates,\n    basis=\"sto-3g\"\n)\nprint(f\"Hamiltonian: {len(H.ops)} terms, {qubits} qubits\")\n# Hamiltonian: 15 terms, 4 qubits\n",[33675],{"type":21,"tag":2073,"props":33676,"children":33677},{"__ignoreMap":7},[33678,33697,33724,33745,33752,33760,33793,33864,33871,33879,33896,33904,33912,33928,33935,33994],{"type":21,"tag":2314,"props":33679,"children":33680},{"class":2316,"line":2317},[33681,33685,33689,33693],{"type":21,"tag":2314,"props":33682,"children":33683},{"style":3157},[33684],{"type":26,"value":3170},{"type":21,"tag":2314,"props":33686,"children":33687},{"style":2321},[33688],{"type":26,"value":14046},{"type":21,"tag":2314,"props":33690,"children":33691},{"style":3157},[33692],{"type":26,"value":4232},{"type":21,"tag":2314,"props":33694,"children":33695},{"style":2321},[33696],{"type":26,"value":14055},{"type":21,"tag":2314,"props":33698,"children":33699},{"class":2316,"line":106},[33700,33704,33708,33712,33716,33720],{"type":21,"tag":2314,"props":33701,"children":33702},{"style":3157},[33703],{"type":26,"value":3160},{"type":21,"tag":2314,"props":33705,"children":33706},{"style":2321},[33707],{"type":26,"value":14046},{"type":21,"tag":2314,"props":33709,"children":33710},{"style":3157},[33711],{"type":26,"value":3170},{"type":21,"tag":2314,"props":33713,"children":33714},{"style":2321},[33715],{"type":26,"value":4227},{"type":21,"tag":2314,"props":33717,"children":33718},{"style":3157},[33719],{"type":26,"value":4232},{"type":21,"tag":2314,"props":33721,"children":33722},{"style":2321},[33723],{"type":26,"value":4237},{"type":21,"tag":2314,"props":33725,"children":33726},{"class":2316,"line":2335},[33727,33731,33736,33740],{"type":21,"tag":2314,"props":33728,"children":33729},{"style":3157},[33730],{"type":26,"value":3170},{"type":21,"tag":2314,"props":33732,"children":33733},{"style":2321},[33734],{"type":26,"value":33735}," pennylane.qchem ",{"type":21,"tag":2314,"props":33737,"children":33738},{"style":3157},[33739],{"type":26,"value":4232},{"type":21,"tag":2314,"props":33741,"children":33742},{"style":2321},[33743],{"type":26,"value":33744}," qchem\n",{"type":21,"tag":2314,"props":33746,"children":33747},{"class":2316,"line":2397},[33748],{"type":21,"tag":2314,"props":33749,"children":33750},{"emptyLinePlaceholder":3181},[33751],{"type":26,"value":3184},{"type":21,"tag":2314,"props":33753,"children":33754},{"class":2316,"line":2421},[33755],{"type":21,"tag":2314,"props":33756,"children":33757},{"style":3407},[33758],{"type":26,"value":33759},"# H2 at equilibrium bond length (Angstrom)\n",{"type":21,"tag":2314,"props":33761,"children":33762},{"class":2316,"line":16},[33763,33768,33772,33776,33781,33785,33789],{"type":21,"tag":2314,"props":33764,"children":33765},{"style":2321},[33766],{"type":26,"value":33767},"symbols ",{"type":21,"tag":2314,"props":33769,"children":33770},{"style":3157},[33771],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33773,"children":33774},{"style":2321},[33775],{"type":26,"value":6615},{"type":21,"tag":2314,"props":33777,"children":33778},{"style":2350},[33779],{"type":26,"value":33780},"\"H\"",{"type":21,"tag":2314,"props":33782,"children":33783},{"style":2321},[33784],{"type":26,"value":1309},{"type":21,"tag":2314,"props":33786,"children":33787},{"style":2350},[33788],{"type":26,"value":33780},{"type":21,"tag":2314,"props":33790,"children":33791},{"style":2321},[33792],{"type":26,"value":6641},{"type":21,"tag":2314,"props":33794,"children":33795},{"class":2316,"line":127},[33796,33801,33805,33810,33814,33818,33822,33826,33830,33835,33839,33843,33847,33851,33855,33859],{"type":21,"tag":2314,"props":33797,"children":33798},{"style":2321},[33799],{"type":26,"value":33800},"coordinates ",{"type":21,"tag":2314,"props":33802,"children":33803},{"style":3157},[33804],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33806,"children":33807},{"style":2321},[33808],{"type":26,"value":33809}," np.array([[",{"type":21,"tag":2314,"props":33811,"children":33812},{"style":2339},[33813],{"type":26,"value":14870},{"type":21,"tag":2314,"props":33815,"children":33816},{"style":2321},[33817],{"type":26,"value":1309},{"type":21,"tag":2314,"props":33819,"children":33820},{"style":2339},[33821],{"type":26,"value":14870},{"type":21,"tag":2314,"props":33823,"children":33824},{"style":2321},[33825],{"type":26,"value":1309},{"type":21,"tag":2314,"props":33827,"children":33828},{"style":3157},[33829],{"type":26,"value":4802},{"type":21,"tag":2314,"props":33831,"children":33832},{"style":2339},[33833],{"type":26,"value":33834},"0.6614",{"type":21,"tag":2314,"props":33836,"children":33837},{"style":2321},[33838],{"type":26,"value":5177},{"type":21,"tag":2314,"props":33840,"children":33841},{"style":2339},[33842],{"type":26,"value":14870},{"type":21,"tag":2314,"props":33844,"children":33845},{"style":2321},[33846],{"type":26,"value":1309},{"type":21,"tag":2314,"props":33848,"children":33849},{"style":2339},[33850],{"type":26,"value":14870},{"type":21,"tag":2314,"props":33852,"children":33853},{"style":2321},[33854],{"type":26,"value":1309},{"type":21,"tag":2314,"props":33856,"children":33857},{"style":2339},[33858],{"type":26,"value":33834},{"type":21,"tag":2314,"props":33860,"children":33861},{"style":2321},[33862],{"type":26,"value":33863},"]])\n",{"type":21,"tag":2314,"props":33865,"children":33866},{"class":2316,"line":887},[33867],{"type":21,"tag":2314,"props":33868,"children":33869},{"emptyLinePlaceholder":3181},[33870],{"type":26,"value":3184},{"type":21,"tag":2314,"props":33872,"children":33873},{"class":2316,"line":1364},[33874],{"type":21,"tag":2314,"props":33875,"children":33876},{"style":3407},[33877],{"type":26,"value":33878},"# Build the qubit Hamiltonian\n",{"type":21,"tag":2314,"props":33880,"children":33881},{"class":2316,"line":3403},[33882,33887,33891],{"type":21,"tag":2314,"props":33883,"children":33884},{"style":2321},[33885],{"type":26,"value":33886},"H, qubits ",{"type":21,"tag":2314,"props":33888,"children":33889},{"style":3157},[33890],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33892,"children":33893},{"style":2321},[33894],{"type":26,"value":33895}," qchem.molecular_hamiltonian(\n",{"type":21,"tag":2314,"props":33897,"children":33898},{"class":2316,"line":3413},[33899],{"type":21,"tag":2314,"props":33900,"children":33901},{"style":2321},[33902],{"type":26,"value":33903},"    symbols,\n",{"type":21,"tag":2314,"props":33905,"children":33906},{"class":2316,"line":436},[33907],{"type":21,"tag":2314,"props":33908,"children":33909},{"style":2321},[33910],{"type":26,"value":33911},"    coordinates,\n",{"type":21,"tag":2314,"props":33913,"children":33914},{"class":2316,"line":3473},[33915,33919,33923],{"type":21,"tag":2314,"props":33916,"children":33917},{"style":3222},[33918],{"type":26,"value":22800},{"type":21,"tag":2314,"props":33920,"children":33921},{"style":3157},[33922],{"type":26,"value":3197},{"type":21,"tag":2314,"props":33924,"children":33925},{"style":2350},[33926],{"type":26,"value":33927},"\"sto-3g\"\n",{"type":21,"tag":2314,"props":33929,"children":33930},{"class":2316,"line":3521},[33931],{"type":21,"tag":2314,"props":33932,"children":33933},{"style":2321},[33934],{"type":26,"value":3257},{"type":21,"tag":2314,"props":33936,"children":33937},{"class":2316,"line":3563},[33938,33942,33946,33950,33955,33959,33964,33968,33973,33977,33981,33985,33990],{"type":21,"tag":2314,"props":33939,"children":33940},{"style":2339},[33941],{"type":26,"value":3272},{"type":21,"tag":2314,"props":33943,"children":33944},{"style":2321},[33945],{"type":26,"value":3277},{"type":21,"tag":2314,"props":33947,"children":33948},{"style":3157},[33949],{"type":26,"value":3282},{"type":21,"tag":2314,"props":33951,"children":33952},{"style":2350},[33953],{"type":26,"value":33954},"\"Hamiltonian: ",{"type":21,"tag":2314,"props":33956,"children":33957},{"style":2339},[33958],{"type":26,"value":24919},{"type":21,"tag":2314,"props":33960,"children":33961},{"style":2321},[33962],{"type":26,"value":33963},"(H.ops)",{"type":21,"tag":2314,"props":33965,"children":33966},{"style":2339},[33967],{"type":26,"value":3302},{"type":21,"tag":2314,"props":33969,"children":33970},{"style":2350},[33971],{"type":26,"value":33972}," terms, ",{"type":21,"tag":2314,"props":33974,"children":33975},{"style":2339},[33976],{"type":26,"value":3292},{"type":21,"tag":2314,"props":33978,"children":33979},{"style":2321},[33980],{"type":26,"value":1197},{"type":21,"tag":2314,"props":33982,"children":33983},{"style":2339},[33984],{"type":26,"value":3302},{"type":21,"tag":2314,"props":33986,"children":33987},{"style":2350},[33988],{"type":26,"value":33989}," qubits\"",{"type":21,"tag":2314,"props":33991,"children":33992},{"style":2321},[33993],{"type":26,"value":3257},{"type":21,"tag":2314,"props":33995,"children":33996},{"class":2316,"line":4585},[33997],{"type":21,"tag":2314,"props":33998,"children":33999},{"style":3407},[34000],{"type":26,"value":34001},"# Hamiltonian: 15 terms, 4 qubits\n",{"type":21,"tag":29,"props":34003,"children":34005},{"id":34004},"定义拟设",[34006],{"type":26,"value":34004},{"type":21,"tag":22,"props":34008,"children":34009},{},[34010],{"type":26,"value":34011},"**拟设（ansatz）**是用于制备试探态的参数化电路。对于化学问题，UCCSD（酉耦合簇单激发与双激发，Unitary Coupled-Cluster Singles and Doubles）拟设是标准选择：",{"type":21,"tag":2304,"props":34013,"children":34015},{"code":34014,"language":3147,"meta":7,"className":3145,"style":7},"# Get UCCSD circuit parameters\nelectrons = 2\nsingles, doubles = qchem.excitations(electrons, qubits)\ns_wires, d_wires = qchem.excitations_to_wires(singles, doubles, wires=range(qubits))\n\n# Initial Hartree-Fock state (reference state)\nhf_state = qchem.hf_state(electrons, qubits)\n\ndev = qml.device(\"default.qubit\", wires=qubits)\n\n@qml.qnode(dev)\ndef circuit(weights, wires, s_wires=[], d_wires=[], hf_state=hf_state):\n    # Prepare HF reference state\n    qml.BasisState(hf_state, wires=wires)\n\n    # Apply UCCSD excitations\n    qml.UCCSD(weights, wires, s_wires=s_wires, d_wires=d_wires, init_state=hf_state)\n\n    return qml.expval(H)\n",[34016],{"type":21,"tag":2073,"props":34017,"children":34018},{"__ignoreMap":7},[34019,34027,34043,34060,34094,34101,34109,34126,34133,34169,34176,34187,34230,34238,34259,34266,34274,34324,34331],{"type":21,"tag":2314,"props":34020,"children":34021},{"class":2316,"line":2317},[34022],{"type":21,"tag":2314,"props":34023,"children":34024},{"style":3407},[34025],{"type":26,"value":34026},"# Get UCCSD circuit parameters\n",{"type":21,"tag":2314,"props":34028,"children":34029},{"class":2316,"line":106},[34030,34035,34039],{"type":21,"tag":2314,"props":34031,"children":34032},{"style":2321},[34033],{"type":26,"value":34034},"electrons ",{"type":21,"tag":2314,"props":34036,"children":34037},{"style":3157},[34038],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34040,"children":34041},{"style":2339},[34042],{"type":26,"value":5048},{"type":21,"tag":2314,"props":34044,"children":34045},{"class":2316,"line":2335},[34046,34051,34055],{"type":21,"tag":2314,"props":34047,"children":34048},{"style":2321},[34049],{"type":26,"value":34050},"singles, doubles ",{"type":21,"tag":2314,"props":34052,"children":34053},{"style":3157},[34054],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34056,"children":34057},{"style":2321},[34058],{"type":26,"value":34059}," qchem.excitations(electrons, qubits)\n",{"type":21,"tag":2314,"props":34061,"children":34062},{"class":2316,"line":2397},[34063,34068,34072,34077,34081,34085,34089],{"type":21,"tag":2314,"props":34064,"children":34065},{"style":2321},[34066],{"type":26,"value":34067},"s_wires, d_wires ",{"type":21,"tag":2314,"props":34069,"children":34070},{"style":3157},[34071],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34073,"children":34074},{"style":2321},[34075],{"type":26,"value":34076}," qchem.excitations_to_wires(singles, doubles, ",{"type":21,"tag":2314,"props":34078,"children":34079},{"style":3222},[34080],{"type":26,"value":14202},{"type":21,"tag":2314,"props":34082,"children":34083},{"style":3157},[34084],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34086,"children":34087},{"style":2339},[34088],{"type":26,"value":4896},{"type":21,"tag":2314,"props":34090,"children":34091},{"style":2321},[34092],{"type":26,"value":34093},"(qubits))\n",{"type":21,"tag":2314,"props":34095,"children":34096},{"class":2316,"line":2421},[34097],{"type":21,"tag":2314,"props":34098,"children":34099},{"emptyLinePlaceholder":3181},[34100],{"type":26,"value":3184},{"type":21,"tag":2314,"props":34102,"children":34103},{"class":2316,"line":16},[34104],{"type":21,"tag":2314,"props":34105,"children":34106},{"style":3407},[34107],{"type":26,"value":34108},"# Initial Hartree-Fock state (reference state)\n",{"type":21,"tag":2314,"props":34110,"children":34111},{"class":2316,"line":127},[34112,34117,34121],{"type":21,"tag":2314,"props":34113,"children":34114},{"style":2321},[34115],{"type":26,"value":34116},"hf_state ",{"type":21,"tag":2314,"props":34118,"children":34119},{"style":3157},[34120],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34122,"children":34123},{"style":2321},[34124],{"type":26,"value":34125}," qchem.hf_state(electrons, qubits)\n",{"type":21,"tag":2314,"props":34127,"children":34128},{"class":2316,"line":887},[34129],{"type":21,"tag":2314,"props":34130,"children":34131},{"emptyLinePlaceholder":3181},[34132],{"type":26,"value":3184},{"type":21,"tag":2314,"props":34134,"children":34135},{"class":2316,"line":1364},[34136,34140,34144,34148,34152,34156,34160,34164],{"type":21,"tag":2314,"props":34137,"children":34138},{"style":2321},[34139],{"type":26,"value":14179},{"type":21,"tag":2314,"props":34141,"children":34142},{"style":3157},[34143],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34145,"children":34146},{"style":2321},[34147],{"type":26,"value":14188},{"type":21,"tag":2314,"props":34149,"children":34150},{"style":2350},[34151],{"type":26,"value":14193},{"type":21,"tag":2314,"props":34153,"children":34154},{"style":2321},[34155],{"type":26,"value":1309},{"type":21,"tag":2314,"props":34157,"children":34158},{"style":3222},[34159],{"type":26,"value":14202},{"type":21,"tag":2314,"props":34161,"children":34162},{"style":3157},[34163],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34165,"children":34166},{"style":2321},[34167],{"type":26,"value":34168},"qubits)\n",{"type":21,"tag":2314,"props":34170,"children":34171},{"class":2316,"line":3403},[34172],{"type":21,"tag":2314,"props":34173,"children":34174},{"emptyLinePlaceholder":3181},[34175],{"type":26,"value":3184},{"type":21,"tag":2314,"props":34177,"children":34178},{"class":2316,"line":3413},[34179,34183],{"type":21,"tag":2314,"props":34180,"children":34181},{"style":4318},[34182],{"type":26,"value":14226},{"type":21,"tag":2314,"props":34184,"children":34185},{"style":2321},[34186],{"type":26,"value":14231},{"type":21,"tag":2314,"props":34188,"children":34189},{"class":2316,"line":436},[34190,34194,34198,34203,34207,34212,34216,34221,34225],{"type":21,"tag":2314,"props":34191,"children":34192},{"style":3157},[34193],{"type":26,"value":4315},{"type":21,"tag":2314,"props":34195,"children":34196},{"style":4318},[34197],{"type":26,"value":14243},{"type":21,"tag":2314,"props":34199,"children":34200},{"style":2321},[34201],{"type":26,"value":34202},"(weights, wires, s_wires",{"type":21,"tag":2314,"props":34204,"children":34205},{"style":3157},[34206],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34208,"children":34209},{"style":2321},[34210],{"type":26,"value":34211},"[], d_wires",{"type":21,"tag":2314,"props":34213,"children":34214},{"style":3157},[34215],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34217,"children":34218},{"style":2321},[34219],{"type":26,"value":34220},"[], hf_state",{"type":21,"tag":2314,"props":34222,"children":34223},{"style":3157},[34224],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34226,"children":34227},{"style":2321},[34228],{"type":26,"value":34229},"hf_state):\n",{"type":21,"tag":2314,"props":34231,"children":34232},{"class":2316,"line":3473},[34233],{"type":21,"tag":2314,"props":34234,"children":34235},{"style":3407},[34236],{"type":26,"value":34237},"    # Prepare HF reference state\n",{"type":21,"tag":2314,"props":34239,"children":34240},{"class":2316,"line":3521},[34241,34246,34250,34254],{"type":21,"tag":2314,"props":34242,"children":34243},{"style":2321},[34244],{"type":26,"value":34245},"    qml.BasisState(hf_state, ",{"type":21,"tag":2314,"props":34247,"children":34248},{"style":3222},[34249],{"type":26,"value":14202},{"type":21,"tag":2314,"props":34251,"children":34252},{"style":3157},[34253],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34255,"children":34256},{"style":2321},[34257],{"type":26,"value":34258},"wires)\n",{"type":21,"tag":2314,"props":34260,"children":34261},{"class":2316,"line":3563},[34262],{"type":21,"tag":2314,"props":34263,"children":34264},{"emptyLinePlaceholder":3181},[34265],{"type":26,"value":3184},{"type":21,"tag":2314,"props":34267,"children":34268},{"class":2316,"line":4585},[34269],{"type":21,"tag":2314,"props":34270,"children":34271},{"style":3407},[34272],{"type":26,"value":34273},"    # Apply UCCSD excitations\n",{"type":21,"tag":2314,"props":34275,"children":34276},{"class":2316,"line":4604},[34277,34282,34287,34291,34296,34301,34305,34310,34315,34319],{"type":21,"tag":2314,"props":34278,"children":34279},{"style":2321},[34280],{"type":26,"value":34281},"    qml.UCCSD(weights, wires, ",{"type":21,"tag":2314,"props":34283,"children":34284},{"style":3222},[34285],{"type":26,"value":34286},"s_wires",{"type":21,"tag":2314,"props":34288,"children":34289},{"style":3157},[34290],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34292,"children":34293},{"style":2321},[34294],{"type":26,"value":34295},"s_wires, ",{"type":21,"tag":2314,"props":34297,"children":34298},{"style":3222},[34299],{"type":26,"value":34300},"d_wires",{"type":21,"tag":2314,"props":34302,"children":34303},{"style":3157},[34304],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34306,"children":34307},{"style":2321},[34308],{"type":26,"value":34309},"d_wires, ",{"type":21,"tag":2314,"props":34311,"children":34312},{"style":3222},[34313],{"type":26,"value":34314},"init_state",{"type":21,"tag":2314,"props":34316,"children":34317},{"style":3157},[34318],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34320,"children":34321},{"style":2321},[34322],{"type":26,"value":34323},"hf_state)\n",{"type":21,"tag":2314,"props":34325,"children":34326},{"class":2316,"line":4612},[34327],{"type":21,"tag":2314,"props":34328,"children":34329},{"emptyLinePlaceholder":3181},[34330],{"type":26,"value":3184},{"type":21,"tag":2314,"props":34332,"children":34333},{"class":2316,"line":4643},[34334,34338],{"type":21,"tag":2314,"props":34335,"children":34336},{"style":3157},[34337],{"type":26,"value":4540},{"type":21,"tag":2314,"props":34339,"children":34340},{"style":2321},[34341],{"type":26,"value":25124},{"type":21,"tag":29,"props":34343,"children":34345},{"id":34344},"运行-vqe-优化",[34346],{"type":26,"value":34347},"运行 VQE 优化",{"type":21,"tag":22,"props":34349,"children":34350},{},[34351],{"type":26,"value":34352},"借助 PennyLane 的自动微分功能，我们可以直接使用基于梯度的优化器：",{"type":21,"tag":2304,"props":34354,"children":34356},{"code":34355,"language":3147,"meta":7,"className":3145,"style":7},"# Initial parameters (all zeros = Hartree-Fock state)\ninit_params = np.zeros(len(singles) + len(doubles), requires_grad=True)\n\n# Adam optimizer (works well for VQE)\nopt = qml.AdamOptimizer(stepsize=0.4)\n\n# Optimization loop\nenergy_history = []\nparams = init_params.copy()\n\nfor step in range(200):\n    params, energy = opt.step_and_cost(\n        lambda p: circuit(p, range(qubits), s_wires=s_wires, d_wires=d_wires),\n        params\n    )\n    energy_history.append(energy)\n\n    if step % 20 == 0:\n        print(f\"Step {step:3d}: E = {energy:.6f} Ha\")\n\nprint(f\"\\nVQE ground state energy: {energy:.6f} Ha\")\nprint(f\"Reference (exact): -1.136189 Ha\")\n",[34357],{"type":21,"tag":2073,"props":34358,"children":34359},{"__ignoreMap":7},[34360,34368,34422,34429,34437,34469,34476,34484,34501,34516,34523,34554,34570,34617,34625,34632,34640,34647,34679,34745,34752,34804],{"type":21,"tag":2314,"props":34361,"children":34362},{"class":2316,"line":2317},[34363],{"type":21,"tag":2314,"props":34364,"children":34365},{"style":3407},[34366],{"type":26,"value":34367},"# Initial parameters (all zeros = Hartree-Fock state)\n",{"type":21,"tag":2314,"props":34369,"children":34370},{"class":2316,"line":106},[34371,34375,34379,34383,34387,34392,34396,34401,34406,34410,34414,34418],{"type":21,"tag":2314,"props":34372,"children":34373},{"style":2321},[34374],{"type":26,"value":29926},{"type":21,"tag":2314,"props":34376,"children":34377},{"style":3157},[34378],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34380,"children":34381},{"style":2321},[34382],{"type":26,"value":12641},{"type":21,"tag":2314,"props":34384,"children":34385},{"style":2339},[34386],{"type":26,"value":15018},{"type":21,"tag":2314,"props":34388,"children":34389},{"style":2321},[34390],{"type":26,"value":34391},"(singles) ",{"type":21,"tag":2314,"props":34393,"children":34394},{"style":3157},[34395],{"type":26,"value":6482},{"type":21,"tag":2314,"props":34397,"children":34398},{"style":2339},[34399],{"type":26,"value":34400}," len",{"type":21,"tag":2314,"props":34402,"children":34403},{"style":2321},[34404],{"type":26,"value":34405},"(doubles), ",{"type":21,"tag":2314,"props":34407,"children":34408},{"style":3222},[34409],{"type":26,"value":14836},{"type":21,"tag":2314,"props":34411,"children":34412},{"style":3157},[34413],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34415,"children":34416},{"style":2339},[34417],{"type":26,"value":3234},{"type":21,"tag":2314,"props":34419,"children":34420},{"style":2321},[34421],{"type":26,"value":3257},{"type":21,"tag":2314,"props":34423,"children":34424},{"class":2316,"line":2335},[34425],{"type":21,"tag":2314,"props":34426,"children":34427},{"emptyLinePlaceholder":3181},[34428],{"type":26,"value":3184},{"type":21,"tag":2314,"props":34430,"children":34431},{"class":2316,"line":2397},[34432],{"type":21,"tag":2314,"props":34433,"children":34434},{"style":3407},[34435],{"type":26,"value":34436},"# Adam optimizer (works well for VQE)\n",{"type":21,"tag":2314,"props":34438,"children":34439},{"class":2316,"line":2421},[34440,34444,34448,34452,34456,34460,34465],{"type":21,"tag":2314,"props":34441,"children":34442},{"style":2321},[34443],{"type":26,"value":14905},{"type":21,"tag":2314,"props":34445,"children":34446},{"style":3157},[34447],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34449,"children":34450},{"style":2321},[34451],{"type":26,"value":14914},{"type":21,"tag":2314,"props":34453,"children":34454},{"style":3222},[34455],{"type":26,"value":14919},{"type":21,"tag":2314,"props":34457,"children":34458},{"style":3157},[34459],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34461,"children":34462},{"style":2339},[34463],{"type":26,"value":34464},"0.4",{"type":21,"tag":2314,"props":34466,"children":34467},{"style":2321},[34468],{"type":26,"value":3257},{"type":21,"tag":2314,"props":34470,"children":34471},{"class":2316,"line":16},[34472],{"type":21,"tag":2314,"props":34473,"children":34474},{"emptyLinePlaceholder":3181},[34475],{"type":26,"value":3184},{"type":21,"tag":2314,"props":34477,"children":34478},{"class":2316,"line":127},[34479],{"type":21,"tag":2314,"props":34480,"children":34481},{"style":3407},[34482],{"type":26,"value":34483},"# Optimization loop\n",{"type":21,"tag":2314,"props":34485,"children":34486},{"class":2316,"line":887},[34487,34492,34496],{"type":21,"tag":2314,"props":34488,"children":34489},{"style":2321},[34490],{"type":26,"value":34491},"energy_history ",{"type":21,"tag":2314,"props":34493,"children":34494},{"style":3157},[34495],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34497,"children":34498},{"style":2321},[34499],{"type":26,"value":34500}," []\n",{"type":21,"tag":2314,"props":34502,"children":34503},{"class":2316,"line":1364},[34504,34508,34512],{"type":21,"tag":2314,"props":34505,"children":34506},{"style":2321},[34507],{"type":26,"value":25187},{"type":21,"tag":2314,"props":34509,"children":34510},{"style":3157},[34511],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34513,"children":34514},{"style":2321},[34515],{"type":26,"value":25857},{"type":21,"tag":2314,"props":34517,"children":34518},{"class":2316,"line":3403},[34519],{"type":21,"tag":2314,"props":34520,"children":34521},{"emptyLinePlaceholder":3181},[34522],{"type":26,"value":3184},{"type":21,"tag":2314,"props":34524,"children":34525},{"class":2316,"line":3413},[34526,34530,34534,34538,34542,34546,34550],{"type":21,"tag":2314,"props":34527,"children":34528},{"style":3157},[34529],{"type":26,"value":3450},{"type":21,"tag":2314,"props":34531,"children":34532},{"style":2321},[34533],{"type":26,"value":14967},{"type":21,"tag":2314,"props":34535,"children":34536},{"style":3157},[34537],{"type":26,"value":3460},{"type":21,"tag":2314,"props":34539,"children":34540},{"style":2339},[34541],{"type":26,"value":3465},{"type":21,"tag":2314,"props":34543,"children":34544},{"style":2321},[34545],{"type":26,"value":3277},{"type":21,"tag":2314,"props":34547,"children":34548},{"style":2339},[34549],{"type":26,"value":14584},{"type":21,"tag":2314,"props":34551,"children":34552},{"style":2321},[34553],{"type":26,"value":4368},{"type":21,"tag":2314,"props":34555,"children":34556},{"class":2316,"line":436},[34557,34561,34565],{"type":21,"tag":2314,"props":34558,"children":34559},{"style":2321},[34560],{"type":26,"value":25926},{"type":21,"tag":2314,"props":34562,"children":34563},{"style":3157},[34564],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34566,"children":34567},{"style":2321},[34568],{"type":26,"value":34569}," opt.step_and_cost(\n",{"type":21,"tag":2314,"props":34571,"children":34572},{"class":2316,"line":3473},[34573,34578,34583,34587,34592,34596,34600,34604,34608,34612],{"type":21,"tag":2314,"props":34574,"children":34575},{"style":3157},[34576],{"type":26,"value":34577},"        lambda",{"type":21,"tag":2314,"props":34579,"children":34580},{"style":2321},[34581],{"type":26,"value":34582}," p: circuit(p, ",{"type":21,"tag":2314,"props":34584,"children":34585},{"style":2339},[34586],{"type":26,"value":4896},{"type":21,"tag":2314,"props":34588,"children":34589},{"style":2321},[34590],{"type":26,"value":34591},"(qubits), ",{"type":21,"tag":2314,"props":34593,"children":34594},{"style":3222},[34595],{"type":26,"value":34286},{"type":21,"tag":2314,"props":34597,"children":34598},{"style":3157},[34599],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34601,"children":34602},{"style":2321},[34603],{"type":26,"value":34295},{"type":21,"tag":2314,"props":34605,"children":34606},{"style":3222},[34607],{"type":26,"value":34300},{"type":21,"tag":2314,"props":34609,"children":34610},{"style":3157},[34611],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34613,"children":34614},{"style":2321},[34615],{"type":26,"value":34616},"d_wires),\n",{"type":21,"tag":2314,"props":34618,"children":34619},{"class":2316,"line":3521},[34620],{"type":21,"tag":2314,"props":34621,"children":34622},{"style":2321},[34623],{"type":26,"value":34624},"        params\n",{"type":21,"tag":2314,"props":34626,"children":34627},{"class":2316,"line":3563},[34628],{"type":21,"tag":2314,"props":34629,"children":34630},{"style":2321},[34631],{"type":26,"value":4532},{"type":21,"tag":2314,"props":34633,"children":34634},{"class":2316,"line":4585},[34635],{"type":21,"tag":2314,"props":34636,"children":34637},{"style":2321},[34638],{"type":26,"value":34639},"    energy_history.append(energy)\n",{"type":21,"tag":2314,"props":34641,"children":34642},{"class":2316,"line":4604},[34643],{"type":21,"tag":2314,"props":34644,"children":34645},{"emptyLinePlaceholder":3181},[34646],{"type":26,"value":3184},{"type":21,"tag":2314,"props":34648,"children":34649},{"class":2316,"line":4612},[34650,34654,34658,34662,34667,34671,34675],{"type":21,"tag":2314,"props":34651,"children":34652},{"style":3157},[34653],{"type":26,"value":11900},{"type":21,"tag":2314,"props":34655,"children":34656},{"style":2321},[34657],{"type":26,"value":14967},{"type":21,"tag":2314,"props":34659,"children":34660},{"style":3157},[34661],{"type":26,"value":6333},{"type":21,"tag":2314,"props":34663,"children":34664},{"style":2339},[34665],{"type":26,"value":34666}," 20",{"type":21,"tag":2314,"props":34668,"children":34669},{"style":3157},[34670],{"type":26,"value":15093},{"type":21,"tag":2314,"props":34672,"children":34673},{"style":2339},[34674],{"type":26,"value":11914},{"type":21,"tag":2314,"props":34676,"children":34677},{"style":2321},[34678],{"type":26,"value":4873},{"type":21,"tag":2314,"props":34680,"children":34681},{"class":2316,"line":4643},[34682,34686,34690,34694,34698,34702,34706,34711,34715,34720,34724,34728,34733,34737,34741],{"type":21,"tag":2314,"props":34683,"children":34684},{"style":2339},[34685],{"type":26,"value":12846},{"type":21,"tag":2314,"props":34687,"children":34688},{"style":2321},[34689],{"type":26,"value":3277},{"type":21,"tag":2314,"props":34691,"children":34692},{"style":3157},[34693],{"type":26,"value":3282},{"type":21,"tag":2314,"props":34695,"children":34696},{"style":2350},[34697],{"type":26,"value":15184},{"type":21,"tag":2314,"props":34699,"children":34700},{"style":2339},[34701],{"type":26,"value":3292},{"type":21,"tag":2314,"props":34703,"children":34704},{"style":2321},[34705],{"type":26,"value":15193},{"type":21,"tag":2314,"props":34707,"children":34708},{"style":3157},[34709],{"type":26,"value":34710},":3d",{"type":21,"tag":2314,"props":34712,"children":34713},{"style":2339},[34714],{"type":26,"value":3302},{"type":21,"tag":2314,"props":34716,"children":34717},{"style":2350},[34718],{"type":26,"value":34719},": E = ",{"type":21,"tag":2314,"props":34721,"children":34722},{"style":2339},[34723],{"type":26,"value":3292},{"type":21,"tag":2314,"props":34725,"children":34726},{"style":2321},[34727],{"type":26,"value":26830},{"type":21,"tag":2314,"props":34729,"children":34730},{"style":3157},[34731],{"type":26,"value":34732},":.6f",{"type":21,"tag":2314,"props":34734,"children":34735},{"style":2339},[34736],{"type":26,"value":3302},{"type":21,"tag":2314,"props":34738,"children":34739},{"style":2350},[34740],{"type":26,"value":19391},{"type":21,"tag":2314,"props":34742,"children":34743},{"style":2321},[34744],{"type":26,"value":3257},{"type":21,"tag":2314,"props":34746,"children":34747},{"class":2316,"line":4688},[34748],{"type":21,"tag":2314,"props":34749,"children":34750},{"emptyLinePlaceholder":3181},[34751],{"type":26,"value":3184},{"type":21,"tag":2314,"props":34753,"children":34754},{"class":2316,"line":4727},[34755,34759,34763,34767,34771,34775,34780,34784,34788,34792,34796,34800],{"type":21,"tag":2314,"props":34756,"children":34757},{"style":2339},[34758],{"type":26,"value":3272},{"type":21,"tag":2314,"props":34760,"children":34761},{"style":2321},[34762],{"type":26,"value":3277},{"type":21,"tag":2314,"props":34764,"children":34765},{"style":3157},[34766],{"type":26,"value":3282},{"type":21,"tag":2314,"props":34768,"children":34769},{"style":2350},[34770],{"type":26,"value":3307},{"type":21,"tag":2314,"props":34772,"children":34773},{"style":2339},[34774],{"type":26,"value":15321},{"type":21,"tag":2314,"props":34776,"children":34777},{"style":2350},[34778],{"type":26,"value":34779},"VQE ground state energy: ",{"type":21,"tag":2314,"props":34781,"children":34782},{"style":2339},[34783],{"type":26,"value":3292},{"type":21,"tag":2314,"props":34785,"children":34786},{"style":2321},[34787],{"type":26,"value":26830},{"type":21,"tag":2314,"props":34789,"children":34790},{"style":3157},[34791],{"type":26,"value":34732},{"type":21,"tag":2314,"props":34793,"children":34794},{"style":2339},[34795],{"type":26,"value":3302},{"type":21,"tag":2314,"props":34797,"children":34798},{"style":2350},[34799],{"type":26,"value":19391},{"type":21,"tag":2314,"props":34801,"children":34802},{"style":2321},[34803],{"type":26,"value":3257},{"type":21,"tag":2314,"props":34805,"children":34806},{"class":2316,"line":4745},[34807,34811,34815,34819,34824],{"type":21,"tag":2314,"props":34808,"children":34809},{"style":2339},[34810],{"type":26,"value":3272},{"type":21,"tag":2314,"props":34812,"children":34813},{"style":2321},[34814],{"type":26,"value":3277},{"type":21,"tag":2314,"props":34816,"children":34817},{"style":3157},[34818],{"type":26,"value":3282},{"type":21,"tag":2314,"props":34820,"children":34821},{"style":2350},[34822],{"type":26,"value":34823},"\"Reference (exact): -1.136189 Ha\"",{"type":21,"tag":2314,"props":34825,"children":34826},{"style":2321},[34827],{"type":26,"value":3257},{"type":21,"tag":22,"props":34829,"children":34830},{},[34831],{"type":26,"value":34832},"典型输出：",{"type":21,"tag":2304,"props":34834,"children":34836},{"code":34835},"Step   0: E = -1.117498 Ha\nStep  20: E = -1.133254 Ha\nStep  40: E = -1.135901 Ha\nStep  60: E = -1.136140 Ha\n...\nVQE ground state energy: -1.136174 Ha\nReference (exact): -1.136189 Ha\n",[34837],{"type":21,"tag":2073,"props":34838,"children":34839},{"__ignoreMap":7},[34840],{"type":26,"value":34835},{"type":21,"tag":22,"props":34842,"children":34843},{},[34844],{"type":26,"value":34845},"VQE 达到了与精确能量相差约 0.015 mHa 的水平——这对 H₂ 而言即为化学精度。",{"type":21,"tag":29,"props":34847,"children":34849},{"id":34848},"使用无梯度优化器",[34850],{"type":26,"value":34848},{"type":21,"tag":22,"props":34852,"children":34853},{},[34854],{"type":26,"value":34855},"对于有噪声的硬件，由于硬件梯度带有噪声，像 COBYLA 或 SPSA 这样的无梯度优化器往往表现更好：",{"type":21,"tag":2304,"props":34857,"children":34859},{"code":34858,"language":3147,"meta":7,"className":3145,"style":7},"from scipy.optimize import minimize\n\n# Objective function (no gradient needed)\ndef objective(params):\n    return float(circuit(params, range(qubits), s_wires=s_wires, d_wires=d_wires))\n\nresult = minimize(\n    objective,\n    x0=init_params,\n    method=\"COBYLA\",\n    options={\"maxiter\": 500, \"rhobeg\": 0.1}\n)\n\nprint(f\"COBYLA energy: {result.fun:.6f} Ha\")\n",[34860],{"type":21,"tag":2073,"props":34861,"children":34862},{"__ignoreMap":7},[34863,34882,34889,34897,34913,34962,34969,34985,34993,35010,35031,35082,35089,35096],{"type":21,"tag":2314,"props":34864,"children":34865},{"class":2316,"line":2317},[34866,34870,34874,34878],{"type":21,"tag":2314,"props":34867,"children":34868},{"style":3157},[34869],{"type":26,"value":3160},{"type":21,"tag":2314,"props":34871,"children":34872},{"style":2321},[34873],{"type":26,"value":29039},{"type":21,"tag":2314,"props":34875,"children":34876},{"style":3157},[34877],{"type":26,"value":3170},{"type":21,"tag":2314,"props":34879,"children":34880},{"style":2321},[34881],{"type":26,"value":29048},{"type":21,"tag":2314,"props":34883,"children":34884},{"class":2316,"line":106},[34885],{"type":21,"tag":2314,"props":34886,"children":34887},{"emptyLinePlaceholder":3181},[34888],{"type":26,"value":3184},{"type":21,"tag":2314,"props":34890,"children":34891},{"class":2316,"line":2335},[34892],{"type":21,"tag":2314,"props":34893,"children":34894},{"style":3407},[34895],{"type":26,"value":34896},"# Objective function (no gradient needed)\n",{"type":21,"tag":2314,"props":34898,"children":34899},{"class":2316,"line":2397},[34900,34904,34909],{"type":21,"tag":2314,"props":34901,"children":34902},{"style":3157},[34903],{"type":26,"value":4315},{"type":21,"tag":2314,"props":34905,"children":34906},{"style":4318},[34907],{"type":26,"value":34908}," objective",{"type":21,"tag":2314,"props":34910,"children":34911},{"style":2321},[34912],{"type":26,"value":25096},{"type":21,"tag":2314,"props":34914,"children":34915},{"class":2316,"line":2421},[34916,34920,34924,34929,34933,34937,34941,34945,34949,34953,34957],{"type":21,"tag":2314,"props":34917,"children":34918},{"style":3157},[34919],{"type":26,"value":4540},{"type":21,"tag":2314,"props":34921,"children":34922},{"style":2339},[34923],{"type":26,"value":25874},{"type":21,"tag":2314,"props":34925,"children":34926},{"style":2321},[34927],{"type":26,"value":34928},"(circuit(params, ",{"type":21,"tag":2314,"props":34930,"children":34931},{"style":2339},[34932],{"type":26,"value":4896},{"type":21,"tag":2314,"props":34934,"children":34935},{"style":2321},[34936],{"type":26,"value":34591},{"type":21,"tag":2314,"props":34938,"children":34939},{"style":3222},[34940],{"type":26,"value":34286},{"type":21,"tag":2314,"props":34942,"children":34943},{"style":3157},[34944],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34946,"children":34947},{"style":2321},[34948],{"type":26,"value":34295},{"type":21,"tag":2314,"props":34950,"children":34951},{"style":3222},[34952],{"type":26,"value":34300},{"type":21,"tag":2314,"props":34954,"children":34955},{"style":3157},[34956],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34958,"children":34959},{"style":2321},[34960],{"type":26,"value":34961},"d_wires))\n",{"type":21,"tag":2314,"props":34963,"children":34964},{"class":2316,"line":16},[34965],{"type":21,"tag":2314,"props":34966,"children":34967},{"emptyLinePlaceholder":3181},[34968],{"type":26,"value":3184},{"type":21,"tag":2314,"props":34970,"children":34971},{"class":2316,"line":127},[34972,34976,34980],{"type":21,"tag":2314,"props":34973,"children":34974},{"style":2321},[34975],{"type":26,"value":19287},{"type":21,"tag":2314,"props":34977,"children":34978},{"style":3157},[34979],{"type":26,"value":3197},{"type":21,"tag":2314,"props":34981,"children":34982},{"style":2321},[34983],{"type":26,"value":34984}," minimize(\n",{"type":21,"tag":2314,"props":34986,"children":34987},{"class":2316,"line":887},[34988],{"type":21,"tag":2314,"props":34989,"children":34990},{"style":2321},[34991],{"type":26,"value":34992},"    objective,\n",{"type":21,"tag":2314,"props":34994,"children":34995},{"class":2316,"line":1364},[34996,35001,35005],{"type":21,"tag":2314,"props":34997,"children":34998},{"style":3222},[34999],{"type":26,"value":35000},"    x0",{"type":21,"tag":2314,"props":35002,"children":35003},{"style":3157},[35004],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35006,"children":35007},{"style":2321},[35008],{"type":26,"value":35009},"init_params,\n",{"type":21,"tag":2314,"props":35011,"children":35012},{"class":2316,"line":3403},[35013,35018,35022,35027],{"type":21,"tag":2314,"props":35014,"children":35015},{"style":3222},[35016],{"type":26,"value":35017},"    method",{"type":21,"tag":2314,"props":35019,"children":35020},{"style":3157},[35021],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35023,"children":35024},{"style":2350},[35025],{"type":26,"value":35026},"\"COBYLA\"",{"type":21,"tag":2314,"props":35028,"children":35029},{"style":2321},[35030],{"type":26,"value":2418},{"type":21,"tag":2314,"props":35032,"children":35033},{"class":2316,"line":3413},[35034,35039,35043,35047,35052,35056,35061,35065,35070,35074,35078],{"type":21,"tag":2314,"props":35035,"children":35036},{"style":3222},[35037],{"type":26,"value":35038},"    options",{"type":21,"tag":2314,"props":35040,"children":35041},{"style":3157},[35042],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35044,"children":35045},{"style":2321},[35046],{"type":26,"value":3292},{"type":21,"tag":2314,"props":35048,"children":35049},{"style":2350},[35050],{"type":26,"value":35051},"\"maxiter\"",{"type":21,"tag":2314,"props":35053,"children":35054},{"style":2321},[35055],{"type":26,"value":2408},{"type":21,"tag":2314,"props":35057,"children":35058},{"style":2339},[35059],{"type":26,"value":35060},"500",{"type":21,"tag":2314,"props":35062,"children":35063},{"style":2321},[35064],{"type":26,"value":1309},{"type":21,"tag":2314,"props":35066,"children":35067},{"style":2350},[35068],{"type":26,"value":35069},"\"rhobeg\"",{"type":21,"tag":2314,"props":35071,"children":35072},{"style":2321},[35073],{"type":26,"value":2408},{"type":21,"tag":2314,"props":35075,"children":35076},{"style":2339},[35077],{"type":26,"value":14826},{"type":21,"tag":2314,"props":35079,"children":35080},{"style":2321},[35081],{"type":26,"value":2506},{"type":21,"tag":2314,"props":35083,"children":35084},{"class":2316,"line":436},[35085],{"type":21,"tag":2314,"props":35086,"children":35087},{"style":2321},[35088],{"type":26,"value":3257},{"type":21,"tag":2314,"props":35090,"children":35091},{"class":2316,"line":3473},[35092],{"type":21,"tag":2314,"props":35093,"children":35094},{"emptyLinePlaceholder":3181},[35095],{"type":26,"value":3184},{"type":21,"tag":2314,"props":35097,"children":35098},{"class":2316,"line":3521},[35099,35103,35107,35111,35116,35120,35124,35128,35132,35136],{"type":21,"tag":2314,"props":35100,"children":35101},{"style":2339},[35102],{"type":26,"value":3272},{"type":21,"tag":2314,"props":35104,"children":35105},{"style":2321},[35106],{"type":26,"value":3277},{"type":21,"tag":2314,"props":35108,"children":35109},{"style":3157},[35110],{"type":26,"value":3282},{"type":21,"tag":2314,"props":35112,"children":35113},{"style":2350},[35114],{"type":26,"value":35115},"\"COBYLA energy: ",{"type":21,"tag":2314,"props":35117,"children":35118},{"style":2339},[35119],{"type":26,"value":3292},{"type":21,"tag":2314,"props":35121,"children":35122},{"style":2321},[35123],{"type":26,"value":30104},{"type":21,"tag":2314,"props":35125,"children":35126},{"style":3157},[35127],{"type":26,"value":34732},{"type":21,"tag":2314,"props":35129,"children":35130},{"style":2339},[35131],{"type":26,"value":3302},{"type":21,"tag":2314,"props":35133,"children":35134},{"style":2350},[35135],{"type":26,"value":19391},{"type":21,"tag":2314,"props":35137,"children":35138},{"style":2321},[35139],{"type":26,"value":3257},{"type":21,"tag":29,"props":35141,"children":35143},{"id":35142},"使用-hlquantum-运行-vqe",[35144],{"type":26,"value":35145},"使用 HLQuantum 运行 VQE",{"type":21,"tag":22,"props":35147,"children":35148},{},[35149],{"type":26,"value":35150},"HLQuantum 内置了一个可跨所有后端运行的 VQE 实现：",{"type":21,"tag":2304,"props":35152,"children":35154},{"code":35153,"language":3147,"meta":7,"className":3145,"style":7},"import hlquantum as hlq\n\n# Define the Hamiltonian in HLQuantum's format\nH = hlq.hamiltonians.h2_molecule(bond_length=1.32)\n\n# Run VQE on any backend\nresult = hlq.algorithms.vqe(\n    hamiltonian=H,\n    ansatz=\"uccsd\",\n    optimizer=\"adam\",\n    max_iterations=200,\n    backend=\"pennylane\",   # or \"qiskit\", \"cudaq\"\n)\n\nprint(f\"Ground state energy: {result.energy:.6f} Ha\")\nprint(f\"Optimal parameters: {result.params}\")\nprint(f\"Converged in {result.iterations} iterations\")\n",[35155],{"type":21,"tag":2073,"props":35156,"children":35157},{"__ignoreMap":7},[35158,35177,35184,35192,35226,35233,35241,35256,35273,35294,35314,35334,35359,35366,35373,35416,35457],{"type":21,"tag":2314,"props":35159,"children":35160},{"class":2316,"line":2317},[35161,35165,35169,35173],{"type":21,"tag":2314,"props":35162,"children":35163},{"style":3157},[35164],{"type":26,"value":3170},{"type":21,"tag":2314,"props":35166,"children":35167},{"style":2321},[35168],{"type":26,"value":19255},{"type":21,"tag":2314,"props":35170,"children":35171},{"style":3157},[35172],{"type":26,"value":4232},{"type":21,"tag":2314,"props":35174,"children":35175},{"style":2321},[35176],{"type":26,"value":19264},{"type":21,"tag":2314,"props":35178,"children":35179},{"class":2316,"line":106},[35180],{"type":21,"tag":2314,"props":35181,"children":35182},{"emptyLinePlaceholder":3181},[35183],{"type":26,"value":3184},{"type":21,"tag":2314,"props":35185,"children":35186},{"class":2316,"line":2335},[35187],{"type":21,"tag":2314,"props":35188,"children":35189},{"style":3407},[35190],{"type":26,"value":35191},"# Define the Hamiltonian in HLQuantum's format\n",{"type":21,"tag":2314,"props":35193,"children":35194},{"class":2316,"line":2397},[35195,35199,35203,35208,35213,35217,35222],{"type":21,"tag":2314,"props":35196,"children":35197},{"style":2321},[35198],{"type":26,"value":24835},{"type":21,"tag":2314,"props":35200,"children":35201},{"style":3157},[35202],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35204,"children":35205},{"style":2321},[35206],{"type":26,"value":35207}," hlq.hamiltonians.h2_molecule(",{"type":21,"tag":2314,"props":35209,"children":35210},{"style":3222},[35211],{"type":26,"value":35212},"bond_length",{"type":21,"tag":2314,"props":35214,"children":35215},{"style":3157},[35216],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35218,"children":35219},{"style":2339},[35220],{"type":26,"value":35221},"1.32",{"type":21,"tag":2314,"props":35223,"children":35224},{"style":2321},[35225],{"type":26,"value":3257},{"type":21,"tag":2314,"props":35227,"children":35228},{"class":2316,"line":2421},[35229],{"type":21,"tag":2314,"props":35230,"children":35231},{"emptyLinePlaceholder":3181},[35232],{"type":26,"value":3184},{"type":21,"tag":2314,"props":35234,"children":35235},{"class":2316,"line":16},[35236],{"type":21,"tag":2314,"props":35237,"children":35238},{"style":3407},[35239],{"type":26,"value":35240},"# Run VQE on any backend\n",{"type":21,"tag":2314,"props":35242,"children":35243},{"class":2316,"line":127},[35244,35248,35252],{"type":21,"tag":2314,"props":35245,"children":35246},{"style":2321},[35247],{"type":26,"value":19287},{"type":21,"tag":2314,"props":35249,"children":35250},{"style":3157},[35251],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35253,"children":35254},{"style":2321},[35255],{"type":26,"value":22772},{"type":21,"tag":2314,"props":35257,"children":35258},{"class":2316,"line":887},[35259,35264,35268],{"type":21,"tag":2314,"props":35260,"children":35261},{"style":3222},[35262],{"type":26,"value":35263},"    hamiltonian",{"type":21,"tag":2314,"props":35265,"children":35266},{"style":3157},[35267],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35269,"children":35270},{"style":2321},[35271],{"type":26,"value":35272},"H,\n",{"type":21,"tag":2314,"props":35274,"children":35275},{"class":2316,"line":1364},[35276,35281,35285,35290],{"type":21,"tag":2314,"props":35277,"children":35278},{"style":3222},[35279],{"type":26,"value":35280},"    ansatz",{"type":21,"tag":2314,"props":35282,"children":35283},{"style":3157},[35284],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35286,"children":35287},{"style":2350},[35288],{"type":26,"value":35289},"\"uccsd\"",{"type":21,"tag":2314,"props":35291,"children":35292},{"style":2321},[35293],{"type":26,"value":2418},{"type":21,"tag":2314,"props":35295,"children":35296},{"class":2316,"line":3403},[35297,35301,35305,35310],{"type":21,"tag":2314,"props":35298,"children":35299},{"style":3222},[35300],{"type":26,"value":22840},{"type":21,"tag":2314,"props":35302,"children":35303},{"style":3157},[35304],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35306,"children":35307},{"style":2350},[35308],{"type":26,"value":35309},"\"adam\"",{"type":21,"tag":2314,"props":35311,"children":35312},{"style":2321},[35313],{"type":26,"value":2418},{"type":21,"tag":2314,"props":35315,"children":35316},{"class":2316,"line":3413},[35317,35322,35326,35330],{"type":21,"tag":2314,"props":35318,"children":35319},{"style":3222},[35320],{"type":26,"value":35321},"    max_iterations",{"type":21,"tag":2314,"props":35323,"children":35324},{"style":3157},[35325],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35327,"children":35328},{"style":2339},[35329],{"type":26,"value":14584},{"type":21,"tag":2314,"props":35331,"children":35332},{"style":2321},[35333],{"type":26,"value":2418},{"type":21,"tag":2314,"props":35335,"children":35336},{"class":2316,"line":436},[35337,35341,35345,35349,35354],{"type":21,"tag":2314,"props":35338,"children":35339},{"style":3222},[35340],{"type":26,"value":22820},{"type":21,"tag":2314,"props":35342,"children":35343},{"style":3157},[35344],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35346,"children":35347},{"style":2350},[35348],{"type":26,"value":33410},{"type":21,"tag":2314,"props":35350,"children":35351},{"style":2321},[35352],{"type":26,"value":35353},",   ",{"type":21,"tag":2314,"props":35355,"children":35356},{"style":3407},[35357],{"type":26,"value":35358},"# or \"qiskit\", \"cudaq\"\n",{"type":21,"tag":2314,"props":35360,"children":35361},{"class":2316,"line":3473},[35362],{"type":21,"tag":2314,"props":35363,"children":35364},{"style":2321},[35365],{"type":26,"value":3257},{"type":21,"tag":2314,"props":35367,"children":35368},{"class":2316,"line":3521},[35369],{"type":21,"tag":2314,"props":35370,"children":35371},{"emptyLinePlaceholder":3181},[35372],{"type":26,"value":3184},{"type":21,"tag":2314,"props":35374,"children":35375},{"class":2316,"line":3563},[35376,35380,35384,35388,35392,35396,35400,35404,35408,35412],{"type":21,"tag":2314,"props":35377,"children":35378},{"style":2339},[35379],{"type":26,"value":3272},{"type":21,"tag":2314,"props":35381,"children":35382},{"style":2321},[35383],{"type":26,"value":3277},{"type":21,"tag":2314,"props":35385,"children":35386},{"style":3157},[35387],{"type":26,"value":3282},{"type":21,"tag":2314,"props":35389,"children":35390},{"style":2350},[35391],{"type":26,"value":26821},{"type":21,"tag":2314,"props":35393,"children":35394},{"style":2339},[35395],{"type":26,"value":3292},{"type":21,"tag":2314,"props":35397,"children":35398},{"style":2321},[35399],{"type":26,"value":19378},{"type":21,"tag":2314,"props":35401,"children":35402},{"style":3157},[35403],{"type":26,"value":34732},{"type":21,"tag":2314,"props":35405,"children":35406},{"style":2339},[35407],{"type":26,"value":3302},{"type":21,"tag":2314,"props":35409,"children":35410},{"style":2350},[35411],{"type":26,"value":19391},{"type":21,"tag":2314,"props":35413,"children":35414},{"style":2321},[35415],{"type":26,"value":3257},{"type":21,"tag":2314,"props":35417,"children":35418},{"class":2316,"line":4585},[35419,35423,35427,35431,35436,35440,35445,35449,35453],{"type":21,"tag":2314,"props":35420,"children":35421},{"style":2339},[35422],{"type":26,"value":3272},{"type":21,"tag":2314,"props":35424,"children":35425},{"style":2321},[35426],{"type":26,"value":3277},{"type":21,"tag":2314,"props":35428,"children":35429},{"style":3157},[35430],{"type":26,"value":3282},{"type":21,"tag":2314,"props":35432,"children":35433},{"style":2350},[35434],{"type":26,"value":35435},"\"Optimal parameters: ",{"type":21,"tag":2314,"props":35437,"children":35438},{"style":2339},[35439],{"type":26,"value":3292},{"type":21,"tag":2314,"props":35441,"children":35442},{"style":2321},[35443],{"type":26,"value":35444},"result.params",{"type":21,"tag":2314,"props":35446,"children":35447},{"style":2339},[35448],{"type":26,"value":3302},{"type":21,"tag":2314,"props":35450,"children":35451},{"style":2350},[35452],{"type":26,"value":3307},{"type":21,"tag":2314,"props":35454,"children":35455},{"style":2321},[35456],{"type":26,"value":3257},{"type":21,"tag":2314,"props":35458,"children":35459},{"class":2316,"line":4604},[35460,35464,35468,35472,35477,35481,35486,35490,35495],{"type":21,"tag":2314,"props":35461,"children":35462},{"style":2339},[35463],{"type":26,"value":3272},{"type":21,"tag":2314,"props":35465,"children":35466},{"style":2321},[35467],{"type":26,"value":3277},{"type":21,"tag":2314,"props":35469,"children":35470},{"style":3157},[35471],{"type":26,"value":3282},{"type":21,"tag":2314,"props":35473,"children":35474},{"style":2350},[35475],{"type":26,"value":35476},"\"Converged in ",{"type":21,"tag":2314,"props":35478,"children":35479},{"style":2339},[35480],{"type":26,"value":3292},{"type":21,"tag":2314,"props":35482,"children":35483},{"style":2321},[35484],{"type":26,"value":35485},"result.iterations",{"type":21,"tag":2314,"props":35487,"children":35488},{"style":2339},[35489],{"type":26,"value":3302},{"type":21,"tag":2314,"props":35491,"children":35492},{"style":2350},[35493],{"type":26,"value":35494}," iterations\"",{"type":21,"tag":2314,"props":35496,"children":35497},{"style":2321},[35498],{"type":26,"value":3257},{"type":21,"tag":29,"props":35500,"children":35502},{"id":35501},"真实硬件使用技巧",[35503],{"type":26,"value":35501},{"type":21,"tag":22,"props":35505,"children":35506},{},[35507],{"type":26,"value":35508},"在真实 QPU（IBM Quantum、IonQ）上运行 VQE 时，还需考虑以下几点：",{"type":21,"tag":22,"props":35510,"children":35511},{},[35512,35517],{"type":21,"tag":136,"props":35513,"children":35514},{},[35515],{"type":26,"value":35516},"每步使用较少的采样次数（shots）。",{"type":26,"value":35518}," 每个优化步骤 1000 次采样通常足以进行梯度估计。不要在每一步都使用 10,000 次采样——那会浪费 QPU 时间。",{"type":21,"tag":22,"props":35520,"children":35521},{},[35522,35527],{"type":21,"tag":136,"props":35523,"children":35524},{},[35525],{"type":26,"value":35526},"从浅层电路开始。",{"type":26,"value":35528}," CNOT 门越少 = 噪声越小。对于硬件，可以考虑使用硬件高效拟设电路，而非 UCCSD。",{"type":21,"tag":22,"props":35530,"children":35531},{},[35532,35537,35539,35545],{"type":21,"tag":136,"props":35533,"children":35534},{},[35535],{"type":26,"value":35536},"启用误差缓解。",{"type":26,"value":35538}," HLQuantum 的 ",{"type":21,"tag":2073,"props":35540,"children":35542},{"className":35541},[],[35543],{"type":26,"value":35544},"error_mitigation=\"zne\"",{"type":26,"value":35546}," 会应用零噪声外推（Zero Noise Extrapolation），这可以显著改善有噪声硬件上的结果：",{"type":21,"tag":2304,"props":35548,"children":35550},{"code":35549,"language":3147,"meta":7,"className":3145,"style":7},"result = hlq.run(vqe_circuit, backend=\"qiskit\", device=\"ibm_sherbrooke\",\n                 error_mitigation=\"zne\", shots=2048)\n",[35551],{"type":21,"tag":2073,"props":35552,"children":35553},{"__ignoreMap":7},[35554,35602],{"type":21,"tag":2314,"props":35555,"children":35556},{"class":2316,"line":2317},[35557,35561,35565,35570,35574,35578,35582,35586,35590,35594,35598],{"type":21,"tag":2314,"props":35558,"children":35559},{"style":2321},[35560],{"type":26,"value":19287},{"type":21,"tag":2314,"props":35562,"children":35563},{"style":3157},[35564],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35566,"children":35567},{"style":2321},[35568],{"type":26,"value":35569}," hlq.run(vqe_circuit, ",{"type":21,"tag":2314,"props":35571,"children":35572},{"style":3222},[35573],{"type":26,"value":18425},{"type":21,"tag":2314,"props":35575,"children":35576},{"style":3157},[35577],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35579,"children":35580},{"style":2350},[35581],{"type":26,"value":28723},{"type":21,"tag":2314,"props":35583,"children":35584},{"style":2321},[35585],{"type":26,"value":1309},{"type":21,"tag":2314,"props":35587,"children":35588},{"style":3222},[35589],{"type":26,"value":22243},{"type":21,"tag":2314,"props":35591,"children":35592},{"style":3157},[35593],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35595,"children":35596},{"style":2350},[35597],{"type":26,"value":28744},{"type":21,"tag":2314,"props":35599,"children":35600},{"style":2321},[35601],{"type":26,"value":2418},{"type":21,"tag":2314,"props":35603,"children":35604},{"class":2316,"line":106},[35605,35610,35614,35619,35623,35627,35631,35636],{"type":21,"tag":2314,"props":35606,"children":35607},{"style":3222},[35608],{"type":26,"value":35609},"                 error_mitigation",{"type":21,"tag":2314,"props":35611,"children":35612},{"style":3157},[35613],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35615,"children":35616},{"style":2350},[35617],{"type":26,"value":35618},"\"zne\"",{"type":21,"tag":2314,"props":35620,"children":35621},{"style":2321},[35622],{"type":26,"value":1309},{"type":21,"tag":2314,"props":35624,"children":35625},{"style":3222},[35626],{"type":26,"value":4077},{"type":21,"tag":2314,"props":35628,"children":35629},{"style":3157},[35630],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35632,"children":35633},{"style":2339},[35634],{"type":26,"value":35635},"2048",{"type":21,"tag":2314,"props":35637,"children":35638},{"style":2321},[35639],{"type":26,"value":3257},{"type":21,"tag":22,"props":35641,"children":35642},{},[35643,35645,35650,35652,35657],{"type":26,"value":35644},"有关量子化学模拟的更多细节，请查看完整的 ",{"type":21,"tag":46,"props":35646,"children":35647},{"href":14023},[35648],{"type":26,"value":35649},"PennyLane guide",{"type":26,"value":35651}," 以及 ",{"type":21,"tag":46,"props":35653,"children":35654},{"href":18964},[35655],{"type":26,"value":35656},"HLQuantum algorithms reference",{"type":26,"value":18641},{"type":21,"tag":2688,"props":35659,"children":35660},{},[35661],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":35663},[35664,35665,35666,35667,35668,35669,35670],{"id":33592,"depth":106,"text":33595},{"id":33631,"depth":106,"text":33631},{"id":34004,"depth":106,"text":34004},{"id":34344,"depth":106,"text":34347},{"id":34848,"depth":106,"text":34848},{"id":35142,"depth":106,"text":35145},{"id":35501,"depth":106,"text":35501},"content:zh:blog:vqe-pennylane-practical-guide.md","zh\u002Fblog\u002Fvqe-pennylane-practical-guide.md","zh\u002Fblog\u002Fvqe-pennylane-practical-guide",{"_path":35675,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":35676,"description":35677,"date":35678,"author":11,"tags":35679,"readingTime":16,"body":35680,"_type":111,"_id":36122,"_source":113,"_file":36123,"_stem":36124,"_extension":116},"\u002Fzh\u002Fblog\u002Funderstanding-quantum-error-correction","无需数学也能理解量子纠错","量子计算机为何会出错、纠错如何工作，以及这对容错量子计算的未来意味着什么。","2026-01-15",[125,15,2258],{"type":18,"children":35681,"toc":36113},[35682,35687,35692,35697,35716,35721,35726,35759,35764,35770,35782,35801,35809,35821,35827,35832,35840,35845,35850,35856,35861,35879,35884,35889,35895,35900,35933,35938,36052,36057,36062,36072,36082,36092,36109],{"type":21,"tag":22,"props":35683,"children":35684},{},[35685],{"type":26,"value":35686},"量子计算机会出错——而且错得很多。一个典型的超导量子比特门的错误率为 0.1–1%。运行一个包含 1000 个门的电路，你几乎必然会得到错误的答案。这并不是当前硬件的漏洞；而是一个根本性的挑战。量子纠错（QEC）就是解决方案——理解它是理解量子计算走向何方的关键。",{"type":21,"tag":29,"props":35688,"children":35690},{"id":35689},"为什么量子错误与众不同",[35691],{"type":26,"value":35689},{"type":21,"tag":22,"props":35693,"children":35694},{},[35695],{"type":26,"value":35696},"经典计算机也会出错，但这些错误很容易处理：把比特复制三份，然后进行多数表决。如果其中一份翻转了，另外两份会以多数将其否决。",{"type":21,"tag":22,"props":35698,"children":35699},{},[35700,35702,35714],{"type":26,"value":35701},"量子比特无法被复制——",{"type":21,"tag":136,"props":35703,"children":35704},{},[35705,35707,35712],{"type":26,"value":35706},"不可克隆定理（no-cloning theorem）",{"type":21,"tag":136,"props":35708,"children":35709},{},[35710],{"type":26,"value":35711},"禁止了这一点。你无法通过测量量子比特来检查错误，因为那样会使其叠加态坍缩。而且量子错误不仅仅是比特翻转：还有",{"type":26,"value":35713},"相位错误（phase errors）",{"type":26,"value":35715},"（|0⟩ 与 |1⟩ 之间的相对相位发生偏移），以及两者的组合。",{"type":21,"tag":29,"props":35717,"children":35719},{"id":35718},"量子错误的三种类型",[35720],{"type":26,"value":35718},{"type":21,"tag":22,"props":35722,"children":35723},{},[35724],{"type":26,"value":35725},"每一个量子错误都可以分解为三个泡利算符（Pauli operators）的组合：",{"type":21,"tag":3080,"props":35727,"children":35728},{},[35729,35739,35749],{"type":21,"tag":3084,"props":35730,"children":35731},{},[35732,35737],{"type":21,"tag":136,"props":35733,"children":35734},{},[35735],{"type":26,"value":35736},"X 错误（比特翻转）：",{"type":26,"value":35738}," |0⟩ → |1⟩ 且 |1⟩ → |0⟩。类似于经典的比特翻转。",{"type":21,"tag":3084,"props":35740,"children":35741},{},[35742,35747],{"type":21,"tag":136,"props":35743,"children":35744},{},[35745],{"type":26,"value":35746},"Z 错误（相位翻转）：",{"type":26,"value":35748}," |0⟩ → |0⟩，|1⟩ → −|1⟩。没有经典对应物——影响的是相位。",{"type":21,"tag":3084,"props":35750,"children":35751},{},[35752,35757],{"type":21,"tag":136,"props":35753,"children":35754},{},[35755],{"type":26,"value":35756},"Y 错误：",{"type":26,"value":35758}," 同时发生的 X 和 Z 组合错误。",{"type":21,"tag":22,"props":35760,"children":35761},{},[35762],{"type":26,"value":35763},"一个量子比特上的任何错误都可以表示为 X、Y、Z（以及恒等算符）的线性组合。这意味着如果我们能够独立地纠正 X 和 Z 错误，我们就能纠正任何错误——这是 QEC 的一个关键洞见。",{"type":21,"tag":29,"props":35765,"children":35767},{"id":35766},"核心思想不复制的冗余",[35768],{"type":26,"value":35769},"核心思想：不复制的冗余",{"type":21,"tag":22,"props":35771,"children":35772},{},[35773,35775,35780],{"type":26,"value":35774},"QEC 将一个**逻辑量子比特（logical qubit）",{"type":21,"tag":136,"props":35776,"children":35777},{},[35778],{"type":26,"value":35779},"编码到许多",{"type":26,"value":35781},"物理量子比特（physical qubits）**之上。这一思路类似于经典的重复码，但为量子力学做了适配。",{"type":21,"tag":22,"props":35783,"children":35784},{},[35785,35787,35792,35794,35799],{"type":26,"value":35786},"最简单的例子是",{"type":21,"tag":136,"props":35788,"children":35789},{},[35790],{"type":26,"value":35791},"三量子比特比特翻转码（3-qubit bit-flip code）",{"type":26,"value":35793},"：将 |0⟩ 编码为 |000⟩，将 |1⟩ 编码为 |111⟩。如果一个量子比特翻转了，你可以通过测量量子比特对之间的",{"type":21,"tag":362,"props":35795,"children":35796},{},[35797],{"type":26,"value":35798},"奇偶性（parity）",{"type":26,"value":35800},"（而不测量它们的实际值）来检测并纠正它：",{"type":21,"tag":2304,"props":35802,"children":35804},{"code":35803},"Logical |0⟩ = |000⟩\nLogical |1⟩ = |111⟩\n\nIf qubit 1 flips: |100⟩ or |011⟩\nParity check: measure (q0 ⊕ q1) and (q1 ⊕ q2)\n  → 10 → qubit 0 flipped → apply X to correct\n",[35805],{"type":21,"tag":2073,"props":35806,"children":35807},{"__ignoreMap":7},[35808],{"type":26,"value":35803},{"type":21,"tag":22,"props":35810,"children":35811},{},[35812,35814,35819],{"type":26,"value":35813},"奇偶性测量使用",{"type":21,"tag":136,"props":35815,"children":35816},{},[35817],{"type":26,"value":35818},"辅助量子比特（ancilla qubits）",{"type":26,"value":35820},"——它们是吸收错误信息而不干扰数据量子比特的辅助比特。这就是奇妙之处：你可以在不使编码态坍缩的情况下检测错误。",{"type":21,"tag":29,"props":35822,"children":35824},{"id":35823},"表面码当今领先的方法",[35825],{"type":26,"value":35826},"表面码：当今领先的方法",{"type":21,"tag":22,"props":35828,"children":35829},{},[35830],{"type":26,"value":35831},"**表面码（surface code）**是最有希望用于近期硬件的 QEC 码。它将一个逻辑量子比特编码在如下排列的二维物理量子比特网格中：",{"type":21,"tag":2304,"props":35833,"children":35835},{"code":35834},"● — ● — ● — ●\n|   |   |   |\n● — ● — ● — ●\n|   |   |   |\n● — ● — ● — ●\n|   |   |   |\n● — ● — ● — ●\n",[35836],{"type":21,"tag":2073,"props":35837,"children":35838},{"__ignoreMap":7},[35839],{"type":26,"value":35834},{"type":21,"tag":22,"props":35841,"children":35842},{},[35843],{"type":26,"value":35844},"数据量子比特（●）承载量子信息。它们之间的辅助量子比特持续测量奇偶性。一个 7×7 的网格（49 个物理量子比特）可以将 1 个逻辑量子比特编码为错误率约为 ~p² 的状态——如果物理门错误率为 1%，逻辑错误率会降到 ~0.01%。",{"type":21,"tag":22,"props":35846,"children":35847},{},[35848],{"type":26,"value":35849},"表面码的阈值约为 ~1%：如果硬件门错误低于此值，增加更多物理量子比特就能让逻辑错误率任意地小。IBM 最好的系统正在接近这一阈值。",{"type":21,"tag":29,"props":35851,"children":35853},{"id":35852},"你需要多少个物理量子比特",[35854],{"type":26,"value":35855},"你需要多少个物理量子比特？",{"type":21,"tag":22,"props":35857,"children":35858},{},[35859],{"type":26,"value":35860},"要无误差地运行 Shor 算法以破解 RSA-2048，估算表明：",{"type":21,"tag":3080,"props":35862,"children":35863},{},[35864,35869,35874],{"type":21,"tag":3084,"props":35865,"children":35866},{},[35867],{"type":26,"value":35868},"约 2000 万个物理量子比特",{"type":21,"tag":3084,"props":35870,"children":35871},{},[35872],{"type":26,"value":35873},"每个逻辑量子比特需要约 1000–10,000 个物理量子比特",{"type":21,"tag":3084,"props":35875,"children":35876},{},[35877],{"type":26,"value":35878},"门错误率必须低于 0.1%",{"type":21,"tag":22,"props":35880,"children":35881},{},[35882],{"type":26,"value":35883},"当前硬件：约 1000 个量子比特，约 0.1–1% 的门错误。差距是真实存在的——我们距离能够破解 RSA 的容错量子计算机大约还有 10–15 年。",{"type":21,"tag":22,"props":35885,"children":35886},{},[35887],{"type":26,"value":35888},"对于化学或优化领域的近期量子优势而言，要求要低得多：约 100 个逻辑量子比特或许就足以处理经典方法难以企及的分子。",{"type":21,"tag":29,"props":35890,"children":35892},{"id":35891},"这对当今的-nisq-设备意味着什么",[35893],{"type":26,"value":35894},"这对当今的 NISQ 设备意味着什么",{"type":21,"tag":22,"props":35896,"children":35897},{},[35898],{"type":26,"value":35899},"当前的 NISQ 设备没有 QEC。每个门都会增加噪声。相反，采用的方法是：",{"type":21,"tag":6961,"props":35901,"children":35902},{},[35903,35913,35923],{"type":21,"tag":3084,"props":35904,"children":35905},{},[35906,35911],{"type":21,"tag":136,"props":35907,"children":35908},{},[35909],{"type":26,"value":35910},"保持电路浅层化",{"type":26,"value":35912},"——更少的门 = 更少的累积噪声",{"type":21,"tag":3084,"props":35914,"children":35915},{},[35916,35921],{"type":21,"tag":136,"props":35917,"children":35918},{},[35919],{"type":26,"value":35920},"使用错误缓解（error mitigation）",{"type":26,"value":35922},"（而非纠错）——诸如零噪声外推（Zero Noise Extrapolation，ZNE）之类的后处理技术，它们在不使用额外量子比特的情况下从统计上减小错误的影响",{"type":21,"tag":3084,"props":35924,"children":35925},{},[35926,35931],{"type":21,"tag":136,"props":35927,"children":35928},{},[35929],{"type":26,"value":35930},"设计抗噪声算法",{"type":26,"value":35932},"——VQE、QAOA 以及其他变分方法被设计为对中等程度的噪声具有鲁棒性",{"type":21,"tag":22,"props":35934,"children":35935},{},[35936],{"type":26,"value":35937},"HLQuantum 内置了可应用于任何电路的错误缓解：",{"type":21,"tag":2304,"props":35939,"children":35941},{"code":35940,"language":3147,"meta":7,"className":3145,"style":7},"result = hlq.run(\n    qc,\n    backend=\"qiskit\",\n    device=\"ibm_sherbrooke\",\n    error_mitigation=\"zne\",  # Zero Noise Extrapolation\n    shots=8192\n)\n",[35942],{"type":21,"tag":2073,"props":35943,"children":35944},{"__ignoreMap":7},[35945,35960,35967,35986,36005,36029,36045],{"type":21,"tag":2314,"props":35946,"children":35947},{"class":2316,"line":2317},[35948,35952,35956],{"type":21,"tag":2314,"props":35949,"children":35950},{"style":2321},[35951],{"type":26,"value":19287},{"type":21,"tag":2314,"props":35953,"children":35954},{"style":3157},[35955],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35957,"children":35958},{"style":2321},[35959],{"type":26,"value":28699},{"type":21,"tag":2314,"props":35961,"children":35962},{"class":2316,"line":106},[35963],{"type":21,"tag":2314,"props":35964,"children":35965},{"style":2321},[35966],{"type":26,"value":28707},{"type":21,"tag":2314,"props":35968,"children":35969},{"class":2316,"line":2335},[35970,35974,35978,35982],{"type":21,"tag":2314,"props":35971,"children":35972},{"style":3222},[35973],{"type":26,"value":22820},{"type":21,"tag":2314,"props":35975,"children":35976},{"style":3157},[35977],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35979,"children":35980},{"style":2350},[35981],{"type":26,"value":28723},{"type":21,"tag":2314,"props":35983,"children":35984},{"style":2321},[35985],{"type":26,"value":2418},{"type":21,"tag":2314,"props":35987,"children":35988},{"class":2316,"line":2397},[35989,35993,35997,36001],{"type":21,"tag":2314,"props":35990,"children":35991},{"style":3222},[35992],{"type":26,"value":28735},{"type":21,"tag":2314,"props":35994,"children":35995},{"style":3157},[35996],{"type":26,"value":3197},{"type":21,"tag":2314,"props":35998,"children":35999},{"style":2350},[36000],{"type":26,"value":28744},{"type":21,"tag":2314,"props":36002,"children":36003},{"style":2321},[36004],{"type":26,"value":2418},{"type":21,"tag":2314,"props":36006,"children":36007},{"class":2316,"line":2421},[36008,36012,36016,36020,36024],{"type":21,"tag":2314,"props":36009,"children":36010},{"style":3222},[36011],{"type":26,"value":28782},{"type":21,"tag":2314,"props":36013,"children":36014},{"style":3157},[36015],{"type":26,"value":3197},{"type":21,"tag":2314,"props":36017,"children":36018},{"style":2350},[36019],{"type":26,"value":35618},{"type":21,"tag":2314,"props":36021,"children":36022},{"style":2321},[36023],{"type":26,"value":28749},{"type":21,"tag":2314,"props":36025,"children":36026},{"style":3407},[36027],{"type":26,"value":36028},"# Zero Noise Extrapolation\n",{"type":21,"tag":2314,"props":36030,"children":36031},{"class":2316,"line":16},[36032,36036,36040],{"type":21,"tag":2314,"props":36033,"children":36034},{"style":3222},[36035],{"type":26,"value":28762},{"type":21,"tag":2314,"props":36037,"children":36038},{"style":3157},[36039],{"type":26,"value":3197},{"type":21,"tag":2314,"props":36041,"children":36042},{"style":2339},[36043],{"type":26,"value":36044},"8192\n",{"type":21,"tag":2314,"props":36046,"children":36047},{"class":2316,"line":127},[36048],{"type":21,"tag":2314,"props":36049,"children":36050},{"style":2321},[36051],{"type":26,"value":3257},{"type":21,"tag":22,"props":36053,"children":36054},{},[36055],{"type":26,"value":36056},"ZNE 有意在多个层级上放大噪声，然后外推回零噪声极限。它不是 QEC——而是一种统计技巧——但对于短电路它的效果出奇地好。",{"type":21,"tag":29,"props":36058,"children":36060},{"id":36059},"值得关注的近期里程碑",[36061],{"type":26,"value":36059},{"type":21,"tag":22,"props":36063,"children":36064},{},[36065,36070],{"type":21,"tag":136,"props":36066,"children":36067},{},[36068],{"type":26,"value":36069},"规模化的纠错演示",{"type":26,"value":36071},"——IBM、Google 和 Microsoft 正在竞相演示表面码逻辑量子比特优于物理量子比特（错误率低于阈值）。Google 在 2024 年底声称实现了低于阈值的演示。",{"type":21,"tag":22,"props":36073,"children":36074},{},[36075,36080],{"type":21,"tag":136,"props":36076,"children":36077},{},[36078],{"type":26,"value":36079},"魔法态蒸馏（Magic state distillation）",{"type":26,"value":36081},"——非 Clifford 门（如 T 门）在容错架构中需要特殊的蒸馏协议。这在量子比特开销上目前极其昂贵。",{"type":21,"tag":22,"props":36083,"children":36084},{},[36085,36090],{"type":21,"tag":136,"props":36086,"children":36087},{},[36088],{"type":26,"value":36089},"逻辑门速度",{"type":26,"value":36091},"——表面码中的逻辑门比物理门慢得多。加快它们的速度是 2026–2030 年一项关键的硬件挑战。",{"type":21,"tag":22,"props":36093,"children":36094},{},[36095,36097,36102,36103,36108],{"type":26,"value":36096},"要更深入地了解纠错如何与特定 SDK 交互，请参阅",{"type":21,"tag":46,"props":36098,"children":36099},{"href":48},[36100],{"type":26,"value":36101},"量子纠错术语条目",{"type":26,"value":685},{"type":21,"tag":46,"props":36104,"children":36105},{"href":371},[36106],{"type":26,"value":36107},"NISQ 时代指南",{"type":26,"value":18641},{"type":21,"tag":2688,"props":36110,"children":36111},{},[36112],{"type":26,"value":2692},{"title":7,"searchDepth":106,"depth":106,"links":36114},[36115,36116,36117,36118,36119,36120,36121],{"id":35689,"depth":106,"text":35689},{"id":35718,"depth":106,"text":35718},{"id":35766,"depth":106,"text":35769},{"id":35823,"depth":106,"text":35826},{"id":35852,"depth":106,"text":35855},{"id":35891,"depth":106,"text":35894},{"id":36059,"depth":106,"text":36059},"content:zh:blog:understanding-quantum-error-correction.md","zh\u002Fblog\u002Funderstanding-quantum-error-correction.md","zh\u002Fblog\u002Funderstanding-quantum-error-correction"]