Skip to main content

A stabilizer decomposition based quantum circuit simulator implemented in Rust with Python bindings.

Project description

NECSTAR: NEar-Clifford STAbilizer decomposition simulator in Rust (Python Bindings)

A high-performance quantum circuit simulator designed for the strong simulation of near-Clifford circuits based on the stabilizer decomposition method.

NECSTAR is particularly effective for circuits dominated by Clifford gates but also containing a small number of non-Clifford gates. Currently, NECSTAR supports only T-gates as non-Clifford operations, but future versions may include additional non-Clifford gates.

Getting Started

You can install NECSTAR either via pip or by building from source.

Install via pip (Recommended)

pip install necstar

Note: Pre-built binaries are provided for major platforms. If a binary is not available for your system, the Rust toolchain is required to build from source.

Build from Source

Ensure you have the Rust toolchain installed. Then, clone the repository and build the Python package:

  1. Clone the repository:

    git clone git@github.com:mutekichi/necstar.git
    cd necstar
    
  2. (recommended) Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    
  3. Build and install the package:

    pip install -e .
    

    Since NECSTAR uses maturin as its build backend, pip will automatically handle the Rust compilation. This requires that you have the Rust toolchain installed on your system.

Example Usage

import necstar

# 1. Build a quantum circuit
qc = necstar.QuantumCircuit(2)
qc.apply_h(0)
qc.apply_cx(0, 1)
qc.apply_t(1) # Non-Clifford T-gate

# 2. Compile into a QuantumState (internally decomposes T-states)
state = necstar.QuantumState.from_circuit(qc)

# 3. Perform operations
shots = 1024
samples = state.sample(qargs=[0, 1], shots=shots)
print(f"Samples: {samples}")

pauli_z0 = necstar.PauliString.from_str("ZI")
exp_val = state.exp_value(pauli_z0)
print(f"Expectation value: {exp_val}")

# (Optional) Check the stabilizer rank
print(f"Stabilizer rank: {state.stabilizer_rank}")

Documentation

See the Documentation for more details and examples.

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.

necstar-0.1.1-cp311-cp311-win_amd64.whl (912.9 kB view details)

Uploaded CPython 3.11Windows x86-64

necstar-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

necstar-0.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

necstar-0.1.1-cp311-cp311-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

necstar-0.1.1-cp311-cp311-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file necstar-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: necstar-0.1.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 912.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for necstar-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b67ffc7d7933e913b9146e7685d196c453ce4ee04a4551f66032faaa0bf1f08c
MD5 c063c43f0e31fd1a94b4ee5fe751e095
BLAKE2b-256 61bf02dd05bcca2bce38cdd7d39cc8576939ef4a9cc801c25ebae08d1af98276

See more details on using hashes here.

File details

Details for the file necstar-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for necstar-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 edacfeb6470c232c277147e198a9d927df068b63fd09fc3cf45c49b250c4308a
MD5 59b1d1bfab34512244a8be3d1f8ffb83
BLAKE2b-256 9aff0cac954b568181222fbc98bc5ff7b20e40344e00f4eafc731d59825fb682

See more details on using hashes here.

File details

Details for the file necstar-0.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for necstar-0.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e65d4d70f156e548cb80d8e86d4318bd79e807254662892e2bd7d4ec8e70e9a5
MD5 3bb5eceb7b797279c6a0a00a276c582c
BLAKE2b-256 b17011a8db710962953b0a2dc87052757aee7d70dc6e41fd8a7577d738fd6f15

See more details on using hashes here.

File details

Details for the file necstar-0.1.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for necstar-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 981ae9301e17367b06109a580fd1d9c390478f86225837b2bea5e05951f22cbb
MD5 1e928becc06ff8b0ee40f7f2d484210d
BLAKE2b-256 3bdf3e6bfb6d0014719b62911cd08b98b9364cf3533cbfb1e00f8ea6cb1b7565

See more details on using hashes here.

File details

Details for the file necstar-0.1.1-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for necstar-0.1.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 57eb9f197b31f9d31db35e71022789753e3791cfab65660facd540be1800674d
MD5 b3d8f0742dd9b10128fff1e107be7c6f
BLAKE2b-256 1cb991b9431236e3b55f0492a92a12ed024acdda3e4d3f3a4f866857d6411261

See more details on using hashes here.

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