{"id":42677361,"url":"https://github.com/originq/pyqpanda-algorithm","last_synced_at":"2026-02-02T15:02:10.055Z","repository":{"id":335052114,"uuid":"1143066600","full_name":"OriginQ/pyqpanda-algorithm","owner":"OriginQ","description":"pyqpanda-algorithm 是由Origin Quantum开发的量子算法软件包，适配QPanda3框架，支持在金融、机器学习、组合优化、科学计算等领域广泛应用。现对算法包内13种关键算法开源，帮助用户快速提升开发效率。","archived":false,"fork":false,"pushed_at":"2026-01-30T01:52:58.000Z","size":2919,"stargazers_count":2,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-01T21:33:32.990Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://qcloud.originqc.com.cn/zh/programming/pyqpanda-algorithm","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OriginQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-27T06:19:20.000Z","updated_at":"2026-02-01T08:33:23.000Z","dependencies_parsed_at":"2026-01-31T13:00:39.599Z","dependency_job_id":null,"html_url":"https://github.com/OriginQ/pyqpanda-algorithm","commit_stats":null,"previous_names":["originq/pyqpanda-algorithm"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/OriginQ/pyqpanda-algorithm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OriginQ%2Fpyqpanda-algorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OriginQ%2Fpyqpanda-algorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OriginQ%2Fpyqpanda-algorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OriginQ%2Fpyqpanda-algorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OriginQ","download_url":"https://codeload.github.com/OriginQ/pyqpanda-algorithm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OriginQ%2Fpyqpanda-algorithm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29013701,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T14:58:54.169Z","status":"ssl_error","status_checked_at":"2026-02-02T14:58:51.285Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-29T11:44:35.341Z","updated_at":"2026-02-02T15:02:10.034Z","avatar_url":"https://github.com/OriginQ.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Origin Quantum is pleased to support the open source community by making pyqpanda-algorithm available.   \u003cbr/\u003e\r\nCopyright (c) 2026 Origin Quantum. All rights reserved. \u003cbr/\u003e\r\nThis source code is licensed under the Apache License Version 2.0 \u003cbr/\u003e\r\n\r\n\u003ch1 align=\"center\" style=\"text-align:center;\"\u003e\r\n  pyqpanda-algorithm 算法软件包\r\n\u003c/h1\u003e\r\n\r\n\u003cp align=\"center\"\u003e QPanda3框架 高开发效率 高可靠和稳定性 高性能 \u003cbr /\u003e集合了在量子算法中常用的基本量子算法和函数\u003c/p\u003e\r\n\r\n\r\n\r\n\r\n\r\n## 介绍\r\n\r\npyqpanda-algorithm 是由本源量子（Origin Quantum）开发的量子算法软件包，旨在为量子计算开发者提供一套标准化、模块化、高性能的基础算法库。该库集成了多种在金融、机器学习、组合优化、科学计算等领域广泛应用的量子算法，帮助用户快速实现从理论到代码的转化，提升开发效率并确保算法在不同量子平台上的可移植性。\r\n\r\n软件包官网： [https://qcloud.originqc.com.cn/zh/programming/pyqpanda-algorithm]\r\n\r\n------\r\n\r\n## **核心特点**\r\n\r\n1. **模块化与高复用性**\r\n   所有算法以独立模块形式组织，便于开发者按需调用。例如，`QAOA`、`Grover`、`QSVM` 等算法均可独立导入与使用，支持在不同项目中重复利用。\r\n2. **高性能实现**\r\n   域名特定算法经过算法优化与工程加速，结合 QPanda3 的底层优化（如 OriginBIS 指令集、硬件感知编译），显著提升在模拟器与真实量子硬件上的执行效率。\r\n3.  **跨平台兼容性**\r\n   与 QPanda3 框架深度集成，支持在 CPU 模拟器、量子云服务（如本源悟空）及真实量子处理器上运行，实现“一次编写，多端部署”。\r\n4. **完善的文档与示例**\r\n   提供详尽的 API 文档、使用示例与注释代码，降低学习门槛，特别适合初学者与研究者快速上手机器学习与组合优化任务。\r\n5. **生态整合性强**\r\n   与本源量子的其他工具链（如 VQNet、本源悟空、本源量禹）无缝对接，支持从算法设计到实际运行的完整工作流。\r\n\r\n------\r\n\r\n## 软件包种类\r\n\r\n### 1. **优化与搜索算法包**\r\n\r\n适用于组合优化、大规模搜索问题，在路径规划、资源调度、投资组合优化等领域有广泛应用。\r\n\r\n- **QUBO（无约束二进制优化）**  \r\n  将组合优化问题转化为二次无约束二元优化问题，是量子退火和变分量子算法的通用建模形式。\r\n\r\n- **QAOA（量子近似优化算法）**  \r\n  混合量子-经典变分算法，通过优化参数化量子线路（Ansatz）来近似求解 QUBO 问题，适用于最大割、最大满足等问题。\r\n\r\n- **Grover 搜索算法**  \r\n  在无结构数据库中实现目标项的二次加速搜索。通过振幅放大技术，将搜索复杂度从 $O(N)$ 降低至 $O(\\sqrt{N})$。\r\n\r\n### 2. **机器学习与数据挖掘算法**\r\n\r\n将量子计算能力引入经典机器学习流程，提升分类、聚类、回归等任务的效率与精度。\r\n\r\n- **QSVM（量子支持向量机）**  \r\n  基于量子核函数的分类模型，可在高维空间中实现更优的分类边界。\r\n\r\n- **QSVR（量子支持向量回归）**  \r\n  用于拟合连续变量的回归模型，适用于时间序列预测等任务。\r\n\r\n- **QKMeans（量子 K-均值聚类）**  \r\n  利用量子加速实现大规模数据聚类，适用于高维数据聚类场景。\r\n\r\n- **QPCA（量子主成分分析）**  \r\n  通过量子线路提取数据主成分，实现降维加速。\r\n\r\n- **QMRMR（量子最小冗余最大相关）**  \r\n  实现高效特征选择，减少冗余特征影响。\r\n\r\n- **QARM（量子关联规则挖掘）**  \r\n  快速挖掘频繁项集与关联规则，适用于市场篮子分析等任务。\r\n\r\n### 3. **科学计算与数值求解算法**\r\n\r\n用于求解物理建模、工程仿真中的本征值、线性方程组、矩阵分解等关键问题。\r\n\r\n- **QSVD（量子变分奇异值分解）**  \r\n  在变分框架下提取矩阵的奇异值与奇异向量，用于降维与推荐系统。\r\n\r\n### 4. **通用工具与基础组件**\r\n\r\n提供量子振幅估计算法、比较器、稀疏编码等底层工具。\r\n\r\n- **QAE（量子振幅估计算法）**  \r\n  精确估算目标态的振幅或测量概率，具备二次加速优势，常用于金融衍生品定价、风险评估等。\r\n\r\n- **Comparator（量子比较器）**  \r\n  实现数值大小比较或阈值判定，支持构建量子决策逻辑。\r\n\r\n- **SparseAmp（稀疏幅度编码）**  \r\n  高效将稀疏向量编码为量子态，减少量子资源消耗，适用于数据预处理。\r\n\r\n------\r\n\r\n## 安装\r\n\r\npyqpanda_alg是基于pyqpanda3的算法扩展模块。它的安装和使用需要依赖pyqpanda3。pyqpanda3的接口用法请参考[pyqpanda3](https://qcloud.originqc.com.cn/document/qpanda-3/cn/index.html)。\r\n\r\n如果已经安装了python环境和pip工具，在终端或控制台中输入如下命令：`pip install pyqpanda_alg`\r\n\r\n#### 注意：\r\n\r\n如果你在linux下遇到权限问题，你需要添加sudo（superuser do）。\r\n\r\n------\r\n\r\n## 环境配置\r\n\r\npyqpanda_alg采用Python作为主要语言，对系统的环境要求如下：\r\n\r\n### \t\tWindows\r\n\r\n| software                                                     | version            |\r\n| ------------------------------------------------------------ | ------------------ |\r\n| [Microsoft Visual C++ Redistributable x64](https://aka.ms/vs/17/release/vc_redist.x64.exe) | 2019               |\r\n| Python                                                       | \u003e= 3.11 \u0026\u0026 \u003c= 3.13 |\r\n\r\n### \t\tLinux\r\n\r\n| software | version            |\r\n| -------- | ------------------ |\r\n| GCC      | \u003e= 7.5             |\r\n| Python   | \u003e= 3.11 \u0026\u0026 \u003c= 3.13 |\r\n\r\n------\r\n\r\n## 开源许可\r\n\r\n使用 [Apache License 2.0](https://gitee.com/OriginQ/alg/blob/master/LICENSE)，对 公司、团队、个人 等 商用、非商用 都自由免费且非常友好，请放心使用和登记。\r\n\r\n\r\n------\r\n\r\n## 致谢\r\n\r\n感谢所有贡献者、测试者与社区支持者。特别鸣谢本源量子研究院在算法设计与性能优化方面的技术支持。\r\n\r\n------\r\n\r\n## **联系方式**\r\n\r\n- **官方邮箱**：[qcloud@originqc.com](mailto:qcloud@originqc.com)\r\n\r\n- **售前咨询链接**：https://contact.originqc.com.cn/\r\n\r\n- **官方微信**：搜索“本源量子云社区”，关注开源项目动态\r\n\u003cp align=\"center\"\u003e\r\n  \u003cimg src=\"my-folder/服务号.png\" alt=\"本源量子云社区服务号\" width=\"50%\"\u003e\r\n\u003c/p\u003e\r\n\r\n- **官方小助手**：可扫描下方二维码，添加官方小助手，获取更多支持\r\n\u003cp align=\"center\"\u003e\r\n  \u003cimg src=\"my-folder/本源量子云小助手.jpg\" alt=\"本源量子官方小助手\" width=\"30%\"\u003e\r\n\u003c/p\u003e\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foriginq%2Fpyqpanda-algorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foriginq%2Fpyqpanda-algorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foriginq%2Fpyqpanda-algorithm/lists"}