Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
1d0a2c4
Merge pull request #37 from cq-lib/develop
jianjian01 Sep 3, 2026
84ac489
Merge pull request #47 from cq-lib/develop
jianjian01 Sep 28, 2026
d26de48
Merge pull request #50 from cq-lib/develop
jianjian01 Sep 28, 2026
75b7a47
fix(core): remove unsupported crates.io category
jianjian01 Sep 28, 2026
c02851c
fix(em): rebuild virtual distillation as a Hadamard-test circuit
jianjian01 Sep 29, 2026
875ded1
fix(device): reject zero-qubit device factory construction
jianjian01 Sep 29, 2026
2083940
docs(tianyan): fix wait/wait_raw parameter names to timeout and poll_…
jianjian01 Sep 29, 2026
f1c2491
fix(cqlib): remove unsupported crates.io category
jianjian01 Sep 29, 2026
a21ee76
chore(release): bump versions to 0.1.0-beta.2 / 2.0.0-beta2
jianjian01 Sep 29, 2026
2be7214
Merge pull request #51 from jianjian01/release/2.0
jianjian01 Sep 29, 2026
0e43bb4
docs(whitepaper): add cqlib whitepaper pdf for release 2.0
jianjian01 Sep 30, 2026
8288e80
Merge pull request #52 from jianjian01/release/2.0
jianjian01 Sep 30, 2026
06d3c00
docs(whitepaper): track PDF via Git LFS and link it in READMEs
jianjian01 Sep 30, 2026
281adc3
Merge pull request #53 from jianjian01/release/2.0
jianjian01 Sep 30, 2026
d8449fa
feat(core): add payload accessors to Instruction and ValueInstruction
jianjian01 Sep 30, 2026
459da0a
feat(binding-python): expose instruction payload accessors and Classi…
jianjian01 Sep 30, 2026
9e7cee2
docs: document instruction payload accessors and ClassicalDataOp
jianjian01 Sep 30, 2026
72cedd3
chore(release): bump versions to 0.1.0-beta.3 / 2.0.0-beta3
jianjian01 Sep 30, 2026
6c2b8c7
Merge pull request #54 from jianjian01/release/2.0
jianjian01 Sep 30, 2026
30f7e9d
fix(qis): correct simulation edge cases and numerical errors
jianjian01 Oct 8, 2026
3ce2049
feat(binding-python): support Hamiltonian copy protocols
jianjian01 Oct 8, 2026
694607a
docs: clarify CQLib conventions and algorithm references
jianjian01 Oct 8, 2026
f08479f
test(qis): make formation entropy regressions portable
jianjian01 Oct 8, 2026
3955e6d
Merge pull request #55 from jianjian01/release/2.0
jianjian01 Oct 8, 2026
75a8830
chore: bump release versions to beta4
jianjian01 Oct 8, 2026
aeb6ca8
Merge branch 'release/2.0' of github.com:cq-lib/cqlib into release/2.0
jianjian01 Oct 8, 2026
759a7bb
Merge pull request #56 from jianjian01/release/2.0
jianjian01 Oct 8, 2026
73a8047
feat(core): add fermionic algebra and Jordan-Wigner mapping
jianjian01 Oct 10, 2026
a8b867a
fix(core): preserve parameter coefficients and numeric phases
jianjian01 Oct 12, 2026
164525e
feat(core): add validated fermionic excitation generators
jianjian01 Oct 12, 2026
0edf872
feat(core): add checked sparse Pauli operator algebra
jianjian01 Oct 12, 2026
1a31d4e
refactor(core): move regression tests into owning modules
jianjian01 Oct 12, 2026
8e4cb79
feat(python): expose fermionic and checked Pauli algebra
jianjian01 Oct 12, 2026
fa40c8d
Merge pull request #57 from jianjian01/feat/fermion-jordan-wigner
jianjian01 Oct 13, 2026
ec1b9d6
feat(c): expose fermionic and checked Pauli algebra
jianjian01 Oct 13, 2026
82c643b
Merge pull request #58 from jianjian01/feat/fermion-jordan-wigner
jianjian01 Oct 13, 2026
3d0c968
chore(python)!: require Python 3.11 and support 3.15
jianjian01 Oct 13, 2026
0ee412b
chore(release): bump versions to beta5
jianjian01 Oct 13, 2026
74d7b2b
Merge pull request #59 from jianjian01/release/2.0
jianjian01 Oct 13, 2026
93b15fe
fix(circuit): preserve CircuitGate qubit storage order
jianjian01 Oct 16, 2026
8870d33
fix(python): preserve NumPy complex Hamiltonian coefficients
jianjian01 Oct 16, 2026
b0116c5
fix(core): substitute parameters simultaneously and inside polynomials
jianjian01 Oct 16, 2026
12e36b5
fix(circuit): accumulate sub-circuit global phase in decompose
jianjian01 Oct 16, 2026
cda0a18
fix(qis): make GPhase matrices and simulation consistent
jianjian01 Oct 17, 2026
458e51a
fix(qasm3): preserve global phase in nested gate definitions
jianjian01 Oct 17, 2026
015572b
fix(qis): reject duplicate density matrix targets before mutation
jianjian01 Oct 17, 2026
6be1c8c
test(bindings): cover duplicate density matrix targets in Python and C
jianjian01 Oct 17, 2026
3717b4d
fix(circuit): bind CircuitGate matrix parameters and normalize qubit …
jianjian01 Oct 17, 2026
930c492
fix(circuit): preserve circuit-backed unitary port order
jianjian01 Oct 17, 2026
916651d
fix(compile): bind definition arguments by gate signature
jianjian01 Oct 17, 2026
8f3cb1c
fix(circuit): normalize circuit-backed unitary instruction matrices
jianjian01 Oct 17, 2026
26d2c18
fix(qis): resolve readout noise IDs from storage positions
jianjian01 Oct 18, 2026
8d093e5
fix(circuit): avoid double-counting inherent controls in symbolic MCG…
jianjian01 Oct 18, 2026
14d68c8
fix(visualization): align Pauli-vector labels with PauliString
jianjian01 Oct 18, 2026
db7fcc4
chore(release): prepare beta6 versions and compatibility notes
jianjian01 Oct 18, 2026
6067823
Merge pull request #68 from jianjian01/release/2.0
jianjian01 Oct 18, 2026
6bf3d9c
fix(compile): canonicalize KAK Weyl boundary representatives
jianjian01 Oct 18, 2026
3f436fe
Merge branch 'release/2.0' of github.com:cq-lib/cqlib into release/2.0
jianjian01 Oct 18, 2026
492a981
Merge pull request #69 from jianjian01/release/2.0
jianjian01 Oct 19, 2026
599d720
fix(qis): correct stabilizer Y2P and Y2M conjugation signs
jianjian01 Oct 20, 2026
4964837
fix(qasm3): reject unsupported end statements in all scopes
jianjian01 Oct 20, 2026
cb1faef
fix(qasm2): serialize half-rotation gates with valid syntax
jianjian01 Oct 20, 2026
98d168c
fix(circuit): enforce injective and atomic composition
jianjian01 Oct 20, 2026
904bc05
fix(compile): complete universal single-qubit native lowering paths
jianjian01 Oct 29, 2026
7078472
fix(circuit): remap classical handles during parameter binding
jianjian01 Oct 29, 2026
99fee77
fix(circuit): restore qubits and phase on control-flow rollback
jianjian01 Oct 29, 2026
3a94a40
fix(circuit): stage only new parameters during composition
jianjian01 Oct 29, 2026
4447475
Merge pull request #72 from jianjian01/release/2.0
jianjian01 Oct 29, 2026
c99c02c
fix(qasm2): preserve qubit order and define exported gates
jianjian01 Oct 29, 2026
55fb8f2
Merge pull request #73 from jianjian01/release/2.0
jianjian01 Oct 29, 2026
644bfd9
chore(release): bump versions to beta 7
jianjian01 Oct 29, 2026
46ec087
Merge pull request #74 from jianjian01/release/2.0
jianjian01 Oct 29, 2026
f289992
feat(decompose): add multi-qubit Block-ZXZ unitary synthesis
jianjian01 Nov 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pdf filter=lfs diff=lfs merge=lfs -text
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.11'
- name: Install Rust
run: rustup toolchain install "$RUSTUP_TOOLCHAIN" --profile minimal --component rustfmt --component clippy --no-self-update
- name: Rust formatting
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.11'
- name: Install Rust
run: rustup toolchain install "$RUSTUP_TOOLCHAIN" --profile minimal --no-self-update
- uses: Swatinem/rust-cache@v2
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/wheels-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- uses: actions/setup-python@v6
if: runner.os != 'Linux'
with:
python-version: '3.10'
python-version: '3.11'
- name: Set up native build tools
if: runner.os != 'Linux'
run: |
Expand All @@ -66,50 +66,50 @@ jobs:
-e PLATFORM -e RUSTUP_TOOLCHAIN -e CARGO_PROFILE_DEV_DEBUG \
-e CARGO_PROFILE_TEST_DEBUG -e CARGO_INCREMENTAL -e CARGO_BUILD_JOBS \
"$IMAGE" bash -euo pipefail -c '
export PATH="/opt/python/cp310-cp310/bin:$HOME/.cargo/bin:$PATH"
export PATH="/opt/python/cp311-cp311/bin:$HOME/.cargo/bin:$PATH"
export CARGO_TARGET_DIR=/tmp/cqlib-manylinux-target
curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs -o /tmp/rustup.sh
sh /tmp/rustup.sh -y --profile minimal --default-toolchain "$RUSTUP_TOOLCHAIN"
python -m pip install maturin==1.14.1 packaging==25.0 tomli==2.2.1 cmake==3.31.6
cargo test --locked -p cqlib-core -p binding-c -p cqlib
python tools/ci.py release --platform "$PLATFORM"
for version in 311 312 313 314; do
for version in 312 313 314 315; do
/opt/python/cp$version-cp$version/bin/python -m pip install packaging==25.0
/opt/python/cp$version-cp$version/bin/python tools/ci.py wheel-test
done
'
- uses: actions/setup-python@v6
if: runner.os != 'Linux'
with:
python-version: '3.11'
- name: Test the same wheel on Python 3.11
python-version: '3.12'
- name: Test the same wheel on Python 3.12
if: runner.os != 'Linux'
run: |
python -m pip install packaging==25.0
python tools/ci.py wheel-test
- uses: actions/setup-python@v6
if: runner.os != 'Linux'
with:
python-version: '3.12'
- name: Test the same wheel on Python 3.12
python-version: '3.13'
- name: Test the same wheel on Python 3.13
if: runner.os != 'Linux'
run: |
python -m pip install packaging==25.0
python tools/ci.py wheel-test
- uses: actions/setup-python@v6
if: runner.os != 'Linux'
with:
python-version: '3.13'
- name: Test the same wheel on Python 3.13
python-version: '3.14'
- name: Test the same wheel on Python 3.14
if: runner.os != 'Linux'
run: |
python -m pip install packaging==25.0
python tools/ci.py wheel-test
- uses: actions/setup-python@v6
if: runner.os != 'Linux'
with:
python-version: '3.14'
- name: Test the same wheel on Python 3.14
python-version: '3.15'
- name: Test the same wheel on Python 3.15
if: runner.os != 'Linux'
run: |
python -m pip install packaging==25.0
Expand All @@ -131,7 +131,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.11'
- name: Install build tools
run: |
rustup toolchain install "$RUSTUP_TOOLCHAIN" --profile minimal --no-self-update
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.11'
- run: python -m pip install packaging==25.0 tomli==2.2.1
- name: Check tag and component versions
env:
Expand Down
4 changes: 4 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[default]
# Unicode decimal-number category in regular expressions.
extend-ignore-re = ['\\p\{Nd\}']

[default.extend-words]
ket = "ket"
bra = "bra"
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ docs/ 文档相关文件
本项目当前要求:

- Rust 1.89+
- Python 3.10+
- Python 3.11+
- C 11+ 工具链,用于 C 绑定相关开发

建议使用 `rustup` 管理 Rust 工具链,并使用 Python 虚拟环境隔离开发依赖。
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Keep common changes scoped to the relevant module when possible, and avoid combi
The project currently requires:

- Rust 1.89+
- Python 3.10+
- Python 3.11+
- A C 11+ toolchain for C binding development

We recommend using `rustup` for Rust toolchains and a Python virtual environment for Python dependencies.
Expand Down
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members = [
resolver = "2"

[workspace.package]
version = "0.1.0-beta.1"
version = "0.1.0-beta.7"
edition = "2024"
rust-version = "1.89"
license = "Apache-2.0"
Expand Down
10 changes: 6 additions & 4 deletions README.CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE.txt)
[![Rust](https://img.shields.io/badge/rust-1.89%2B-orange.svg)](https://www.rust-lang.org)
[![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org)
[![Python](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org)
[![C](https://img.shields.io/badge/c-11%2B-lightgrey.svg)](https://en.cppreference.com/w/c/11)

[English](README.md)
Expand All @@ -16,14 +16,16 @@
## 概述

Cqlib 是一个高性能量子计算 SDK,为量子程序的构建、优化与执行提供统一基础。核心采用 Rust 实现,兼顾极致性能与内存安全,并原生支持
Python 3.10+ 和 C 11+ 语言接口。
Python 3.11+ 和 C 11+ 语言接口。

Cqlib 从底层设计兼顾科研与生产需求,覆盖量子计算全流程:从线路构建与参数化,到多层 IR 变换、基于规则的编译优化
Pass,再到搭载噪声模型的真实设备模拟,并内置零噪声外推(ZNE)和虚拟蒸馏(Virtual
Distillation)等误差缓解技术。其模块化设计支持独立使用各组件或组合为完整流水线,适用于量子算法原型开发、教学以及集成到更大规模软件栈中。

了解更多请访问 **[qc.zdxlz.com/cqlib](https://qc.zdxlz.com/cqlib)**。

**[阅读白皮书](docs/whitepaper/Cqlib.pdf)** —— 一份文档讲清 Cqlib 的设计理念、系统架构与技术细节。

## 核心特性

- **量子线路构建** — 直观的 API 用于构建、组合和参数化量子线路
Expand Down Expand Up @@ -136,12 +138,12 @@ int main(void) {
| 语言 | 最低版本 | 绑定技术 |
|--------|------|-------------------|
| Rust | 1.89 | 原生 |
| Python | 3.10 | PyO3 (abi3-py310) |
| Python | 3.11 | PyO3 (abi3-py311) |
| C | 11 | cbindgen |

## 从源码构建

**前置条件:** Rust 1.89+,Python 3.10+(用于 Python 绑定)
**前置条件:** Rust 1.89+,Python 3.11+(用于 Python 绑定)

```bash
git clone https://gitee.com/cq-lib/cqlib.git
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE.txt)
[![Rust](https://img.shields.io/badge/rust-1.89%2B-orange.svg)](https://www.rust-lang.org)
[![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org)
[![Python](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org)
[![C](https://img.shields.io/badge/c-11%2B-lightgrey.svg)](https://en.cppreference.com/w/c/11)

[中文文档](README.CN.md)
Expand All @@ -17,7 +17,7 @@

Cqlib is a high-performance quantum computing SDK that provides a unified foundation for building, optimizing, and
executing quantum programs. Its core is written in Rust for maximum safety and speed, with first-class language bindings
for Python 3.10+ and C 11+.
for Python 3.11+ and C 11+.

Designed from the ground up for both research and production use, Cqlib covers the full quantum computing workflow: from
circuit construction and parameterization, through multi-level IR transformations, rule-based compilation and
Expand All @@ -28,6 +28,8 @@ education, and integration into larger software stacks.

Learn more at **[qc.zdxlz.com/cqlib](https://qc.zdxlz.com/cqlib)**.

**[Read the Whitepaper](docs/whitepaper/Cqlib.pdf)** — Cqlib's design philosophy, architecture, and technical details in one document.

## Features

- **Circuit Construction** — Intuitive APIs to build, compose, and parameterize quantum circuits
Expand Down Expand Up @@ -140,12 +142,12 @@ int main(void) {
| Language | Minimum Version | Binding Technology |
|----------|-----------------|--------------------|
| Rust | 1.89 | Native |
| Python | 3.10 | PyO3 (abi3-py310) |
| Python | 3.11 | PyO3 (abi3-py311) |
| C | 11 | cbindgen |

## Building from Source

**Prerequisites:** Rust 1.89+, Python 3.10+ (for Python bindings)
**Prerequisites:** Rust 1.89+, Python 3.11+ (for Python bindings)

```bash
git clone https://gitee.com/cq-lib/cqlib.git
Expand Down
3 changes: 2 additions & 1 deletion crates/binding-c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ license.workspace = true
crate-type = ["rlib", "staticlib", "cdylib"]

[dependencies]
cqlib-core = { path = "../cqlib-core", version = "0.1.0-beta.1" }
cqlib-core = { path = "../cqlib-core", version = "0.1.0-beta.7" }
libc = "0.2"
bitvec.workspace = true
ndarray.workspace = true
num-complex.workspace = true
rustworkx-core.workspace = true
Expand Down
13 changes: 12 additions & 1 deletion crates/binding-c/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,15 @@ gcc -I crates/binding-c/include \
-o test_circuit

./test_circuit # prints "binding-c circuit tests passed"
```
```

## Checked sparse algebra

The new `fermionic_op_*`, `jordan_wigner_*`, and checked `hamiltonian_*` functions
expose fermionic products, excitation generators and sparse Pauli arithmetic.
They return an error code and deliver independent objects through output pointers;
errors leave outputs unchanged. Inputs are borrowed and coefficients are never
approximately pruned unless requested. See [Fermionic algebra](../../docs/api/en/c/3_qis/10_fermion.md)
and [Hamiltonian](../../docs/api/en/c/3_qis/7_hamiltonian.md).

The staged SDK consumer tests include `test_qis_algebra.c` for both static and shared linking.
3 changes: 2 additions & 1 deletion crates/binding-c/src/circuit/parameter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,8 @@ pub extern "C" fn param_replace(
box_param(unsafe { (*a).inner.replace(symbol, replacement) })
}

/// Substitute several symbols in one call and simplify the result.
/// Simultaneously substitute symbols and simplify the result. Replacement
/// expressions are not substituted again; the original parameter is unchanged.
/// `names` and `values` are parallel arrays of length `len`. Returns a new
/// parameter, or NULL on NULL input, non-UTF-8 names or NULL elements.
#[unsafe(no_mangle)]
Expand Down
4 changes: 3 additions & 1 deletion crates/binding-c/src/circuit/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ pub extern "C" fn circuit_to_matrix(
}

/// Compose another circuit into this one. `qubits_map` maps `other`'s qubits
/// to this circuit's qubits. NULL map uses identity mapping (merge by ID).
/// in insertion order to distinct qubits already in this circuit.
/// NULL or zero-length map uses identity mapping (merge by ID).
/// Errors leave this circuit unchanged.
#[unsafe(no_mangle)]
pub extern "C" fn circuit_compose(
ptr: *mut CCircuit,
Expand Down
Loading
Loading