Skip to main content

QRAM-Simulator Banner

QRAM-Simulator

arXiv:QRAM arXiv:SparQ License GitHub CI Documentation

QRAM 电路模拟核心(C++ 基座仓):Qutrit/Qubit 两种 QRAM 架构、噪声模型、QRAM 论文实验与 pybind11 Python 绑定

仓库分工

本仓库是 C++ 基座:QRAM 电路核心 + 论文实验 + pybind11 薄绑定(qram-simulator PyPI 包);SparQ 框架(稀疏态模拟器、算法库、pysparq 富绑定、算法类实验)位于 SparQSim 仓库:

仓库 内容 PyPI 包
QRAM-Simulator(本仓库) C++ QRAM 电路核心(Common + QRAM)+ QRAM 论文实验 + pybind11 薄绑定 qram-simulator
SparQSim SparQ 框架(稀疏态模拟器、算法库、pysparq 富绑定、算法类实验) pysparq

依赖方向:SparQSim → QRAM-Simulator。SparQSim 以 git submodule (相对 URL ../QRAM-Simulator.git)方式引用本仓库并编译 C++ 核心;两个仓库各自 独立 tag/发版,SparQSim 发版前将 submodule pin 到本仓库的对应 tag。

核心能力

  • QRAM 电路模拟:Qutrit-based(qram_circuit_qutrit.h)与 Qubit-based (qram_circuit_qubit.h)两种实现
  • 噪声模型:退极化(Depolarizing)与振幅阻尼(Damping),含概率参数范围校验
  • 架构剪枝:qubit 架构 normal(剪枝)模式与 full(不剪枝)模式逐版本对拍
  • 公共组件:稀疏/稠密矩阵、随机引擎、错误处理、state manipulator 等

C++ 快速开始

构建

git clone https://github.com/IAI-USTC-Quantum/QRAM-Simulator.git
cd QRAM-Simulator
mkdir build && cd build

# 配置(CPU 版本;GPU/CUDA 后端当前暂缓,CMake 会构建 CPU-only 版本)
cmake .. -DCMAKE_BUILD_TYPE=Release

make -j$(nproc)

构建开关(均可通过 -D...=ON/OFF 控制):

开关 默认 说明
QRAM_BUILD_TESTS ON 构建 C++ 测试(test/)
QRAM_BUILD_EXPERIMENTS ON 构建 QRAM 实验程序(Experiments/)

核心用法

#include "qram_circuit_qubit.h"

using namespace qram_simulator;
using namespace qram_qubit;

// 1. 构造 QRAM 电路(addr_size=4, data_size=2)
QRAMCircuit qram(4, 2);
qram.set_memory_random();                     // 随机数据树

// 2. 注入噪声(可选;概率范围校验,Damping 要求 gamma < 1)
qram.set_noise_models({
    { OperationType::Depolarizing, 1e-3 },
    { OperationType::Damping, 1e-4 }
});

// 3. 运行(normal=架构剪枝 / full=不剪枝基准)
qram.set_input_uniform(100);
qram.run_normal();

// 4. 采样保真度
double fidelity = qram.sample_and_get_fidelity();

Python 快速开始

pip install qram-simulator

绑定层(bindings/python/,pybind11)导出核心工作类:QRAMCircuitQubit / QRAMCircuitQutrit(两套架构电路)、QRAMFullAmp(全振幅桥接)、TimeStep (时序与噪声调度)、OperationType 与全局随机种子控制,供外部库直接驱动 完整的"构造 → 设噪声 → 运行 → 保真度"工作流:

from qram_simulator import QRAMCircuitQubit, OperationType, set_seed

set_seed(42)
qram = QRAMCircuitQubit(4, 2)
qram.set_memory_random()
qram.set_noise_models({OperationType.Depolarizing: 1e-3,
                       OperationType.Damping: 1e-4})
qram.set_input_uniform(100)
qram.run_normal()
print(qram.sample_and_get_fidelity())

本地开发:pip install -v .(CMake ≥ 3.18 + C++17 + OpenMP), 测试:pytest bindings/python/test。

作为 CMake 子项目消费(SparQSim 的方式)

# submodule: git submodule add ../QRAM-Simulator.git extern/qram-simulator
set(QRAM_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(QRAM_BUILD_EXPERIMENTS OFF CACHE BOOL "" FORCE)
add_subdirectory(extern/qram-simulator)   # 提供 SparQ_QRAMSimulator / SparQ_Common 目标与平铺头文件布局

运行实验

# QRAM 保真度实验(V2)
./build/bin/Experiment_QRAM_FidelityV2 ...

Python 侧(pysparq 全功能绑定与 qram_simulator 薄绑定)见 SparQSim 仓库。

论文与引用

本仓库由两篇论文分别驱动:

Paper 1: QRAM-Simulator — arXiv:2503.13832

Efficient Simulation of Quantum Random Access Memory

  • QRAM 电路模拟:Qutrit-based 与 Qubit-based 两种 QRAM 实现(C++ API),支持退极化和振幅阻尼噪声模型
  • 稀疏态优化:仅存储非零振幅,可实现 64+ 量子比特的结构化算法模拟
  • 错误过滤:针对含噪 QRAM 的错误过滤方案

对应代码:QRAM/、Experiments/QRAM/(错误过滤实验在 SparQSim 仓库)

Paper 2: SparQ — arXiv:2503.15118

SparQ: A Sparse Quantum Circuit Simulator with Register-Level Abstraction

将 Register Level Programming 拓展为通用稀疏态量子模拟器(QFT、Grover、哈密顿量 模拟、QDA、QCNN 等算法与扩展算法库)。

对应代码:SparQ/、SparQ_Algorithm/ 与算法类实验已迁至 SparQSim 仓库。

BibTeX

@article{sun2025sparqsim,
  title={SparQSim: Simulating Scalable Quantum Algorithms via Sparse Quantum State Representations},
  author={Sun, Tai-Ping and Chen, Zhao-Yun and Wang, Yun-Jie and Xue, Cheng and Liu, Huan-Yu and Zhuang, Xi-Ning and Xu, Xiao-Fan and Wu, Yu-Chun and Guo, Guo-Ping},
  journal={arXiv preprint arXiv:2503.15118},
  year={2025}
}

@article{wang2025refined,
  title={Refined Criteria for QRAM Error Suppression via Efficient Large-Scale QRAM Simulator},
  author={Wang, Yun-Jie and Sun, Tai-Ping and Zhuang, Xi-Ning and Xu, Xiao-Fan and Liu, Huan-Yu and Xue, Cheng and Wu, Yu-Chun and Chen, Zhao-Yun and Guo, Guo-Ping},
  journal={arXiv preprint arXiv:2503.13832},
  year={2025}
}

复现论文结果

详细的实验复现指南见 docs/paper/ 目录:

项目结构

QRAM-Simulator/
├── QRAM/               # QRAM 电路实现(Qutrit/Qubit-based)
├── Common/             # 公共组件(矩阵、随机引擎、state manipulator 等)
├── bindings/python/    # pybind11 薄绑定(qram-simulator PyPI 包)
├── Experiments/        # QRAM 论文实验(QRAMFidelityV2、QubitPaper、ChannelCorrespondence 等)
├── test/               # C++ 测试(Common/QRAM 归属部分)
├── ThirdParty/         # vendored 依赖(Eigen、fmt、googletest、argparse)
└── docs/               # Sphinx 文档(breathe 吸入 Doxygen C++ API + autoapi Python API)

发版流程

  1. 在 Gitea(开发主仓)合并变更到 main;
  2. 同步到 GitHub 上游 IAI-USTC-Quantum/QRAM-Simulator;
  3. 更新 CHANGELOG.md,打 tag(vX.Y.Z,注意历史上已有 v0.1.x,新系列从 v0.2.0 起);
  4. push tag 或创建 GitHub Release → pypi-publish.yml 自动构建 cp310–cp313 的 manylinux / win_amd64 wheel 与 sdist,经 PyPI trusted publishing 发布 qram-simulator 包;pysparq 仍由 SparQSim 仓库发布。

About Us

本项目由 IAI-USTC Quantum 开发。

IAI-USTC Quantum 是合肥综合性国家科学中心人工智能研究院(Institute of Artificial Intelligence, Hefei Comprehensive National Science Center)量子人工智能团队。

主要开发者:Agony5757 (chenzhaoyun@iai.ustc.edu.cn)、RichardSun、Itachixc、YunJ1e、cilysad、TMYTiMidlY

相关项目

许可证

Apache-2.0 License

Release files for qram-simulator 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qram-simulator 0.2.1
File Size Uploaded
qram_simulator-0.2.1.tar.gz 4.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for qram-simulator 0.2.1
File
qram_simulator-0.2.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
qram_simulator-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
qram_simulator-0.2.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
qram_simulator-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
qram_simulator-0.2.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
qram_simulator-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
qram_simulator-0.2.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
qram_simulator-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details

Total release size: 9.4 MB

Release files / qram_simulator-0.2.1.tar.gz

Download URL qram_simulator-0.2.1.tar.gz
Size 4.1 MB
Tags Source
SHA-256 checksum
How to use checksums
29355da3db73e14a58dee95f4f239e9f48b57eebee8b58860f5fc6aa392f990b
BLAKE2b-256 checksum
How to use checksums
6ea1a9fd6669a8cc3f7877cd6494e896548bc40debbd8699bb9f56c3b5ff1d80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / qram_simulator-0.2.1-cp313-cp313-win_amd64.whl

Download URL qram_simulator-0.2.1-cp313-cp313-win_amd64.whl
Size 843.7 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
5e02136222f221177ceb83b58761adb8a94629230d72d9a5787d307f4591b338
BLAKE2b-256 checksum
How to use checksums
eaedccae23da1fb0260fe12923265362ffbb7f6808527cad75f39f0d1a80ea13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / qram_simulator-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL qram_simulator-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 475.3 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
090fe85c5c5254c2d2893930708766939f2dc7098670be85394f3bc7de5059c7
BLAKE2b-256 checksum
How to use checksums
fe7a9d498980845d62c4ce0ac5fd0b648a117c0c879ab5b916d207e636baab6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / qram_simulator-0.2.1-cp312-cp312-win_amd64.whl

Download URL qram_simulator-0.2.1-cp312-cp312-win_amd64.whl
Size 843.5 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
8e0415aac91cba963845f2eeea6bf107b53e53ec8c0483dd886ea5f59a82aa8b
BLAKE2b-256 checksum
How to use checksums
03dba0eace04fad3b4276dadad6de60c11e2ececa18dde6a24890a8c6b0ec729
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / qram_simulator-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL qram_simulator-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 475.2 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c359e356b6f0e40cdb897992ba207219b3dfc5c6cc9acaf0206f2daccde70d3b
BLAKE2b-256 checksum
How to use checksums
7252581e11e39f5dabb2e706e50ed73c60554d6343b83ab84c5ca51b879e9683
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / qram_simulator-0.2.1-cp311-cp311-win_amd64.whl

Download URL qram_simulator-0.2.1-cp311-cp311-win_amd64.whl
Size 842.7 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
445eb6da94dd9c0186ca7c99cd64af24453f0bfc2194050c329fa848a18d801a
BLAKE2b-256 checksum
How to use checksums
b0c3fe2f37f287f19abc09e84523f27896691b6febe7aca4c4410483249e367a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / qram_simulator-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL qram_simulator-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 475.5 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
7620ba23bcc9362d01f44f6bd7ff90c749366dfe32e300c80ab6b06fa8c8f1f8
BLAKE2b-256 checksum
How to use checksums
bef4cc63937f70525d5153f1fe8a34e6ad4ae3ec17d47f3bf13e30d292bce147
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / qram_simulator-0.2.1-cp310-cp310-win_amd64.whl

Download URL qram_simulator-0.2.1-cp310-cp310-win_amd64.whl
Size 841.4 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
22db6fc20c3e08b9d2d7b9ee10bef6ede0632f31c14514e413da45df884282dc
BLAKE2b-256 checksum
How to use checksums
ca747aaef0e7854d7416eb21a2b4eb61f62ecb8fcdfd6bb54074be1f024c2196
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / qram_simulator-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL qram_simulator-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 474.2 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
14cb67fb994cba1e031a8080e929e37306ee0f03e87dd81c4a3d3c89fcfb2d7c
BLAKE2b-256 checksum
How to use checksums
192c7f57cbbabe33c56f88c2f184b123657c7e7b509edd9046d79b7486c943a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

9 release files

0.2.0

9 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page