【代码贡献】新增 VQE 变分量子本征求解器算法模块#23
Open
jsjjl wants to merge 11 commits into
Open
Conversation
Co-authored-by: traeagent <traeagent@users.noreply.github.com>
- 修复 amp_operator 中 in_operator 被重复调用的 bug(dagger 和正向电路现在共享同一实例) - 提取 _ensure_list 辅助函数,消除 cir 与 amp_operator 中重复的 qubit 列表处理逻辑 - 移除 mark_data_reflection 中无意义的 BARRIER 操作,简化电路 - 修复 GroverAdaptiveSearch 中冗余的三元表达式和 minimum_indexes 去重逻辑 - 为 cir 方法添加 iternum 负值校验 - 新增 Grover.search() 便捷方法,一键完成电路构建、执行和结果返回 - 修正 Grover __init__.py 模块文档字符串 - 新增 test/Grover/Test_Grover.py 测试文件,覆盖 24 个测试用例
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.
变更概述
本次 PR 为 pyqpanda-algorithm 项目新增完整的 VQE(Variational Quantum Eigensolver,变分量子本征求解器)算法模块。
新增文件
pyqpanda_alg/VQE/__init__.py— VQE 子包初始化,导出 VQE 类和 hardware_efficient_circuit 函数pyqpanda_alg/VQE/vqe.py— VQE 核心算法类,支持 PauliOperator/Hamiltonian 输入、自定义 ansatz、scipy 优化器pyqpanda_alg/VQE/ansatz.py— 硬件高效参数化量子电路(ansatz),使用 RY/RZ 旋转门和 CNOT 纠缠门example/VQE/example_vqe.py— VQE 使用示例test/VQE/Test_VQE.py— 单元测试修改文件
pyqpanda_alg/__init__.py— 启用 VQE 模块的包级导入功能说明