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.1.5-cp312-cp312-win_amd64.whl (183.2 kB view details)

Uploaded CPython 3.12Windows x86-64

quancoms-0.1.5-cp312-cp312-macosx_11_0_arm64.whl (281.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

quancoms-0.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (385.4 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

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

Hashes for quancoms-0.1.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4bd8e1dacaa7b3ee4c8ef768428eba504f1ca05eb8e89f5faebf4d6adb377559
MD5 6d8b02b74eab58e4d6ff9e3c9595a3b6
BLAKE2b-256 ed2ab4004f5ac8831a00273400cfd1c5c3e71af424767235b2cfe44f7d9e1229

See more details on using hashes here.

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

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.1.5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for quancoms-0.1.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0899d026c0793a206f8dd9dbee544ba61b239cba32a388f9fa751028a42eb06c
MD5 405ff6c80c22be624774a570e90b90d5
BLAKE2b-256 c6b42bedbc63bab61b8e6350a33859d0b60e0ff4d75469c135eb2fe254188768

See more details on using hashes here.

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

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.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for quancoms-0.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 85aeb11aeda1c022e45531279d26bfaa839403af0db101e7171485c7896549b5
MD5 8b6db8cdbe978f580ddcbbbf8a2c50c2
BLAKE2b-256 e1c9b162735e8183e0cefe177bb5038447dd7220c77e85574e96f781ee7c2bfe

See more details on using hashes here.

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

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