UnifiedQuantum - A unified, non-commercial quantum computing aggregation framework.
Project description
UnifiedQuantum
UnifiedQuantum — A unified, non-commercial quantum computing aggregation framework.
UnifiedQuantum is a lightweight Python framework that provides a unified interface for quantum circuit construction, simulation, and cloud execution across multiple quantum computing platforms. It aggregates backends including OriginQ, Quafu, and IBM Quantum under one consistent API.
核心工作流
UnifiedQuantum 围绕一个简洁的工作流设计:任意方式构建线路 → uniqc CLI 统一执行。
1. 安装
pip install unified-quantum
2. 构建线路(支持原生 API 或任意第三方工具)
from uniqc.circuit_builder import Circuit
c = Circuit()
c.h(0)
c.cnot(0, 1)
c.measure(0, 1)
# 输出 OriginIR 格式,可供 CLI 使用
open('circuit.ir', 'w').write(c.originir)
你也可以使用 Qiskit、Cirq 等工具构建线路,只需最终输出 OriginIR 或 OpenQASM 2.0 格式。
3. CLI 统一执行
# 本地模拟
uniqc simulate circuit.ir --shots 1000
# 提交到云端
uniqc submit circuit.ir --platform originq --shots 1000
# 查询任务结果
uniqc result <task_id>
设计理念
UnifiedQuantum 是一个非商业性的开源项目,四条基本立场贯穿整个设计:
- 聚合:把分散的量子云平台(OriginQ、Quafu、IBM Quantum 等)收拢到同一套接口下。
- 统一:从线路构建、模拟执行到任务管理,对外呈现一致的 API 与 CLI,不让用户为每家平台单独学一套。
- 透明:线路如何组装、如何被翻译、如何提交到后端,全部显式可见,没有隐藏的 magic。
- 轻量:纯 Python 实现(C++ 加速模拟器为可选项),依赖少、安装快、易于嵌入现有项目。
抽象上,UnifiedQuantum 的三个核心对象覆盖了完整的量子程序生命周期:
- Circuit — 量子线路构建器,原生支持 OriginIR / OpenQASM 2.0 双格式输出。
- Backend — 本地模拟器或真实量子硬件的统一句柄。
- Result — 测量结果以原生 Python 结构返回(
dict/list/ndarray),便于后处理。
Features
- 多平台提交:一个
submit_task(或uniqc submit)即可将同一份 OriginIR 发往 OriginQ、Quafu、IBM Quantum,或本地 dummy 模拟器。 - 本地模拟:自带 OriginIR Simulator、QASM Simulator,支持 statevector / density matrix 两种后端,以及带噪声的变体。
- 算法组件:内置 HEA、UCCSD、QAOA 等常用 ansatz,可直接用于 VQE / QAOA 研究。
- PyTorch 集成:提供
QuantumLayer、参数偏移梯度、批处理执行,便于构建混合量子—经典模型。 - 可互操作:线路既可用原生 API 构建,也可来自 Qiskit、Cirq 等第三方工具,只要最终产出 OriginIR 或 OpenQASM 2.0。
- 同步 / 异步并存:
submit_task立即返回task_id;wait_for_result或--wait可阻塞至完成。 - 易扩展:门集、错误模型、平台适配器都按接口组织,添加新后端只需实现一个 adapter。
Installation
Supported Platforms
- Windows / Linux / macOS
Requirements
- Python 3.10 – 3.13
pip(推荐)
pip install unified-quantum
uv tool(作为独立 CLI 工具安装)
如果只想在命令行用 uniqc 而不污染全局环境:
# 安装
uv tool install unified-quantum
# 带可选依赖
uv tool install "unified-quantum[simulation]"
# 升级 / 卸载
uv tool upgrade unified-quantum
uv tool uninstall unified-quantum
uv tool 会为 uniqc 创建一个独立的虚拟环境并把可执行文件链接到 ~/.local/bin/uniqc。
Build from Source
纯 Python(无 C++ 依赖):
git clone https://github.com/IAI-USTC-Quantum/UnifiedQuantum.git
cd UnifiedQuantum
pip install . --no-cpp
开发模式:
pip install -e .
含 C++ 模拟器(需 CMake):
git clone --recurse-submodules https://github.com/IAI-USTC-Quantum/UnifiedQuantum.git
cd UnifiedQuantum
pip install .
Optional Dependencies
核心依赖(包括 scipy)在默认安装中已包含。以下为可选功能依赖:
| 功能 | 安装命令 |
|---|---|
| OriginQ 云平台 | pip install unified-quantum[originq] |
| Quafu 执行后端 | pip install unified-quantum[quafu] |
| Qiskit 执行后端 | pip install unified-quantum[qiskit] |
| 高级模拟 (QuTiP) | pip install unified-quantum[simulation] |
| 可视化 | pip install unified-quantum[visualization] |
| PyTorch 集成 | pip install unified-quantum[pytorch] |
| 安装所有可选依赖 | pip install unified-quantum[all] |
CLI Quick Reference
# 查看帮助
uniqc --help
# 本地模拟
uniqc simulate circuit.ir --shots 1000
# 提交到云端(支持 originq / quafu / ibm / dummy)
uniqc submit circuit.ir --platform originq --shots 1000
# 查询任务结果
uniqc result <task_id>
# 配置云平台 Token
uniqc config init
uniqc config set originq.token YOUR_TOKEN
# 也可以用 python -m 调用(等价于 uniqc)
python -m uniqc simulate circuit.ir
Examples
📁 examples/ — Runnable demonstrations
Getting Started
| Example | Description |
|---|---|
| Circuit Remapping | Build a circuit and remap qubits for real hardware |
| Dummy Server | Submit tasks to the local dummy simulator |
| Result Post-Processing | Convert and analyze results |
Algorithms
| Example | Description |
|---|---|
| Grover Search | Unstructured search with quadratic speedup |
| Quantum Phase Estimation | Eigenvalue phase estimation |
Documentation
Status
🚧 Actively developing. API may change.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unified_quantum-0.0.4-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: unified_quantum-0.0.4-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 517.4 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33fb0b4c14233fc6af2067aa0e24d433f3b924bea9974ae96cf3e4e6b23ec0ad
|
|
| MD5 |
8e055425b0a0ab6514ce616ef4acd662
|
|
| BLAKE2b-256 |
a22ecd5495363b8c24c1d663e0060c28046820c15e9d37b089fc54547eb47390
|
File details
Details for the file unified_quantum-0.0.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: unified_quantum-0.0.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 595.4 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcd1faf0308134d202681bb7a09e39140d642785aa3928e17ab736488431af66
|
|
| MD5 |
467d54e6b04fb0faf4147776157bab9b
|
|
| BLAKE2b-256 |
19e93d55668acdb31a80a066a3e1a9061b850e84cdc2ff07ed00bcbc20854a45
|
File details
Details for the file unified_quantum-0.0.4-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: unified_quantum-0.0.4-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 606.3 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca537a7eac54419f45292e5c4bd1aedbe1d535ee8cc4b8a0adac60eb3741a734
|
|
| MD5 |
660be8faf22a543a31690618d2cba5c5
|
|
| BLAKE2b-256 |
c923bcec61d1f9d193db78c93fd218faa0062af0c9da38cb4e668619b6305386
|
File details
Details for the file unified_quantum-0.0.4-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: unified_quantum-0.0.4-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 517.4 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a2bca8e5e2e0506c6bfec429eb4bbc960cb1dede17f8a3e8c59faeb0f9aa1df
|
|
| MD5 |
984f3d672983122c24592e68eacfeac8
|
|
| BLAKE2b-256 |
dd19015ce74c3af80b19a151c6ad5dcb02cede86148cbd46212a72f936e6489a
|
File details
Details for the file unified_quantum-0.0.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: unified_quantum-0.0.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 595.4 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c96b83c725f2bcee5a35777d066f8297774fe36f97c3ec38b8b36be564f9fd1
|
|
| MD5 |
38e202ba9d917f8b92e3dfee98f10c57
|
|
| BLAKE2b-256 |
26ea0724a5baa0b186ee5a3aaf22c38922e35b19a8a4cd00acc9aa60cd683ae8
|
File details
Details for the file unified_quantum-0.0.4-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: unified_quantum-0.0.4-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 606.3 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a54e1f1f94035ab2410d378bc5658d5b26a442a6c30f9c291e284530126f25b
|
|
| MD5 |
c50e78aed7d66eef3efa411742485ad7
|
|
| BLAKE2b-256 |
aa5b2333a604ef91dc52901545c7257c621ce2dba4843d1517721866e6df91e0
|
File details
Details for the file unified_quantum-0.0.4-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: unified_quantum-0.0.4-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 517.4 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f434644daad6bf29c978a32c9610124b959dfbc1e91e1539b03fdfcad259954
|
|
| MD5 |
4b7bc62e625e189ffcf57ae06c62cad4
|
|
| BLAKE2b-256 |
e7d6d52ec1504337f77fbd08cedda0c2d53d75391d370ee806debad3301db4bf
|
File details
Details for the file unified_quantum-0.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: unified_quantum-0.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 595.4 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef28a20875f864e6db01eef4bb82aba530d79da9e51d6ef6a1461b1887aa7acd
|
|
| MD5 |
e472a5bdbb3a7b1c5cff8a0338a2dcb0
|
|
| BLAKE2b-256 |
34247f4801819173e03c0df735f004583f11e2c3540f088651475f9ca90ff7c7
|
File details
Details for the file unified_quantum-0.0.4-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: unified_quantum-0.0.4-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 606.3 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d2dab7222079d6e74c0483bcc5164c860134f8ad33cda2dfbe096f7ae59bcf8
|
|
| MD5 |
ad6c907b41f43fc5979e02fa2d042d2a
|
|
| BLAKE2b-256 |
d081ad5773ccad7bcab3ba3737120ac0e2b9043eaa0e6cbcc2c11fc23aa77dfb
|
File details
Details for the file unified_quantum-0.0.4-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: unified_quantum-0.0.4-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 517.4 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c63efb4822764854866b9560d39cc44ab3152a66b2f65e2c2b78a0473cdbe429
|
|
| MD5 |
b17ab12df42e793777b6a9c4eee94faf
|
|
| BLAKE2b-256 |
056c37f8759fedaf4442bb2ca2fd56ee34417ec2c3f7787018cecf8fed8c8285
|
File details
Details for the file unified_quantum-0.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: unified_quantum-0.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 595.4 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b65fd1f00258da0d717348034a98431e8af7ccc87d0db66b75b8353d022d7f24
|
|
| MD5 |
d894bc13d3807e60f346bdc86ffe70fa
|
|
| BLAKE2b-256 |
27820f3de0a51c6679dd90319a92713a00b6135d99b97d7a7d23c597c6a2f324
|
File details
Details for the file unified_quantum-0.0.4-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: unified_quantum-0.0.4-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 606.3 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2af9a542f6cadea570d73beea72a64eb6afc626fa91c9288b8952890a783db4
|
|
| MD5 |
4c57fe6153137bf27357d827c1c24551
|
|
| BLAKE2b-256 |
e3bc83031d14a3f413087b2065aa8832bd8dacd848860bc07da3f30a37e39d26
|