Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

quancoms-0.0.1-cp312-cp312-win_amd64.whl (152.7 kB view details)

Uploaded CPython 3.12Windows x86-64

quancoms-0.0.1-cp312-cp312-macosx_11_0_arm64.whl (255.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

quancoms-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (352.4 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file quancoms-0.0.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: quancoms-0.0.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 152.7 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

Hashes for quancoms-0.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 81da881dfbfbd98ba8d27bda1ec4a6746a06ec0f5ca67d62a6f7b7645d8768fb
MD5 1fe236397008ac3f396d5c4b4e603b17
BLAKE2b-256 ca9b9a290a0f7b18900f6a7525396151a4729bdd2f54d1d41bec5d18716e42d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for quancoms-0.0.1-cp312-cp312-win_amd64.whl:

Publisher: release.yml on Low-Zi-Hong/quancoms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quancoms-0.0.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for quancoms-0.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a83833d109c536b7702b5ad2f84b8d98a726396b16db960e3e230cc003c652e6
MD5 41093ebe87a369efa1c9a5d4d8aa5c0a
BLAKE2b-256 4b9a2d0d123c876a5426180632bb34ebbdbcbeedb7e39709047cfb31a6d7ffd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for quancoms-0.0.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on Low-Zi-Hong/quancoms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quancoms-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for quancoms-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2c24ce2c70ba70fcd3b1fe3859d9a1ad88c60fe3c13f9ac5909e5af8fd992c5c
MD5 a5028e3393e90b917c5b871f0adf1f1b
BLAKE2b-256 1bfa4c089a960624bccd1c5dc68f4d6e16d3d0a7e833c4ae182ba76b25dae786

See more details on using hashes here.

Provenance

The following attestation bundles were made for quancoms-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on Low-Zi-Hong/quancoms

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page