A quantom computer simulator.
Project description
quancoms
A high-performance, full-state vector quantum simulator written in Rust.
"Where bitwise magic meets quantum mechanics."
Features
- $O(2^{n-k})$ Optimization: Uses a specialized Bit-Insertion Technique to skip unnecessary state scans, making controlled gates ($CNOT$, $CCNOT$, $MCU$) significantly faster than naive implementations.
- Memory Safety: Built-in exponential RAM requirement pre-check. It knows your hardware limits before it even tries to allocate.
- Comprehensive Gate Set:
- Unary: $X, H, R_x, R_y, R_z$, and the universal $U$ gate.
- Controlled: $CNOT, CCNOT, CSWAP$.
- Universal: $MCU$ (Multi-Controlled Unitary) for any $k$-control configuration
- Flexible Observation: Supports full collapse, partial measurement, and "God-eye" non-destructive probability inspection.
Quick Start
Create a Bell State ($|00\rangle + |11\rangle$)
use quancoms::qubit::QuantumRegister;
fn main() -> Result<(), String> {
let mut reg = QuantumRegister::new(2)?;
reg.H(0)? // Superposition on qubit 0
.CNOT(0, 1)?; // Entangle qubit 0 and 1
let result = reg.observe()?;
println!("Measured state: {:?}", result);
Ok(())
}
Optimisation
Most simulators loop through all $2^n$ states for every gate. BIQ is different.For a gate with $k$ control qubits, we only iterate through $2^{n-(k+1)}$ subspaces. We use a "Triple Hole" (or N-Hole) injection strategy to reconstruct the target indices on the fly using bitwise XOR and shifts. Performance Gain:
| Gate | Naive Loop | BIQ (Bit-Injected) |
|---|---|---|
| X / H / U | $2^n$ | $2^{n-1}$ (2x Faster) |
| CNOT | $2^n$ | $2^{n-2}$ (4x Faster) |
| CCNOT / CSWAP | $2^n$ | $2^{n-3}$ (8x Faster) |
Hardware limit
Quantum simulation is memory-intensive. Each additional qubit doubles the RAM requirement. | Qubits | RAM Required | Note | | 20 | 16 MiB | Runs on a toaster| | 30 | 16 GiB | Standard PC limit | | 40 | 16 TiB | Data center required| | 100 | $\infty$ | Beyond the observable universe's storage| Note: BIQ will panic! safely if your available RAM cannot accommodate the requested state vector.
Testing
We take physics seriously. Our test suite (currently 12+ passed) includes:
- Bell State correlation tests.
- GHZ State ($|000\rangle + |111\rangle$) multi-measurement consistency.
- Unitary matrix reversibility.
cargo test
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 quancoms-0.1.5-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: quancoms-0.1.5-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 183.2 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bd8e1dacaa7b3ee4c8ef768428eba504f1ca05eb8e89f5faebf4d6adb377559
|
|
| MD5 |
6d8b02b74eab58e4d6ff9e3c9595a3b6
|
|
| BLAKE2b-256 |
ed2ab4004f5ac8831a00273400cfd1c5c3e71af424767235b2cfe44f7d9e1229
|
Provenance
The following attestation bundles were made for quancoms-0.1.5-cp312-cp312-win_amd64.whl:
Publisher:
release.yml on Low-Zi-Hong/quancoms
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quancoms-0.1.5-cp312-cp312-win_amd64.whl -
Subject digest:
4bd8e1dacaa7b3ee4c8ef768428eba504f1ca05eb8e89f5faebf4d6adb377559 - Sigstore transparency entry: 1192022893
- Sigstore integration time:
-
Permalink:
Low-Zi-Hong/quancoms@ae896c1e615fab1bbe7330e554545d0f78ddc05b -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/Low-Zi-Hong
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ae896c1e615fab1bbe7330e554545d0f78ddc05b -
Trigger Event:
push
-
Statement type:
File details
Details for the file quancoms-0.1.5-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: quancoms-0.1.5-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 281.9 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0899d026c0793a206f8dd9dbee544ba61b239cba32a388f9fa751028a42eb06c
|
|
| MD5 |
405ff6c80c22be624774a570e90b90d5
|
|
| BLAKE2b-256 |
c6b42bedbc63bab61b8e6350a33859d0b60e0ff4d75469c135eb2fe254188768
|
Provenance
The following attestation bundles were made for quancoms-0.1.5-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
release.yml on Low-Zi-Hong/quancoms
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quancoms-0.1.5-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
0899d026c0793a206f8dd9dbee544ba61b239cba32a388f9fa751028a42eb06c - Sigstore transparency entry: 1192022891
- Sigstore integration time:
-
Permalink:
Low-Zi-Hong/quancoms@ae896c1e615fab1bbe7330e554545d0f78ddc05b -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/Low-Zi-Hong
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ae896c1e615fab1bbe7330e554545d0f78ddc05b -
Trigger Event:
push
-
Statement type:
File details
Details for the file quancoms-0.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: quancoms-0.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 385.4 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85aeb11aeda1c022e45531279d26bfaa839403af0db101e7171485c7896549b5
|
|
| MD5 |
8b6db8cdbe978f580ddcbbbf8a2c50c2
|
|
| BLAKE2b-256 |
e1c9b162735e8183e0cefe177bb5038447dd7220c77e85574e96f781ee7c2bfe
|
Provenance
The following attestation bundles were made for quancoms-0.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on Low-Zi-Hong/quancoms
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quancoms-0.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
85aeb11aeda1c022e45531279d26bfaa839403af0db101e7171485c7896549b5 - Sigstore transparency entry: 1192022897
- Sigstore integration time:
-
Permalink:
Low-Zi-Hong/quancoms@ae896c1e615fab1bbe7330e554545d0f78ddc05b -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/Low-Zi-Hong
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ae896c1e615fab1bbe7330e554545d0f78ddc05b -
Trigger Event:
push
-
Statement type: