【代码贡献】新增多量子比特 SWAP Test 状态重叠估计算法 - #78
Open
tokenjunkielabs wants to merge 1 commit into
Open
tokenjunkielabs wants to merge 1 commit into
tokenjunkielabs wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
本提交为 #13 的代码贡献类参赛条目,新增可复用的多量子比特 SWAP Test,用于估计两个量子态的重叠/相似度。
主要内容
QOverlap.SwapTest,使用 1 个 ancilla + 两个等宽状态寄存器执行标准受控 SWAP 测试。SwapTestResult:返回 overlap²、overlap、ancilla P(0)、dominant bitstring 与 shots。overlap_squared_from_zero_probability独立后处理 API,并对采样/硬件噪声导致的非物理小负值做 [0,1] 截断。QOverlap暴露到pyqpanda_alg包。该实现直接遵循 SWAP Test 关系
P(0)=(1+|<psi|phi>|²)/2,不绑定特定状态制备方式,可作为量子核、态验证、变分算法结果比较等上层模块的基础组件。未运行额外测试/验证矩阵;本提交直接提交实现、文档与回归源文件。
相关:#13