Skip to main content

A quantum universe simulator with a C-engine

Project description

qbitUni — Quantum Universe Simulator

s/o Gemini....

Installation

git clone https://github.com/imesh/qbit-universe.git

Setup

Note: This project uses Python 3.13.

Create and run a virtual environment

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Tests

python3 tests/gates.py
python3 tests/melinda.py

Running your first simulation

from qbitUni import QbitUni

# ⚡ Initialize a 2-qubit Universe
# This allocates the state vector in C memory
univ = QbitUni(2)

# ⊹ Apply a Hadamard gate to Qubit 0
# This puts Qubit 0 into a 50/50 superposition of |0> and |1>
univ.h(0)

# 🎛️ Apply a CNOT (Controlled-NOT) gate
# Control: Qubit 0, Target: Qubit 1
# This 'links' the two qubits together (Entanglement)
univ.cnot(0, 1)

# 🧮 Peek at the Math
# Check the probability of the universe being in state |00> or |11>
print(f"Prob of |00>: {univ.get_prob(0):.2f}")
print(f"Prob of |11>: {univ.get_prob(3):.2f}")

# 🌊 Collapse the Wavefunction
# Measuring will force the universe into a single classical state
result = univ.measure()
print(f"Final Measurement: {result:02b}")

Project details


Download files

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

Source Distribution

qbituni-0.0.3.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

qbituni-0.0.3-cp313-cp313-macosx_10_13_universal2.whl (13.4 kB view details)

Uploaded CPython 3.13macOS 10.13+ universal2 (ARM64, x86-64)

File details

Details for the file qbituni-0.0.3.tar.gz.

File metadata

  • Download URL: qbituni-0.0.3.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for qbituni-0.0.3.tar.gz
Algorithm Hash digest
SHA256 ebb7467a3904adf9db59219624866cda45608b24ce63be3af70cd434f6874592
MD5 c309f1eb6f4d20ae6aa3d90dc29f53bb
BLAKE2b-256 9ef922606ec875545a3699df18c916d50689e97abcd08b155805a03d73763914

See more details on using hashes here.

File details

Details for the file qbituni-0.0.3-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for qbituni-0.0.3-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 7a04994e453077ff72e9cbfecc7c36523ad4b2c2dc2ccc5c56773c96e5c0a43a
MD5 9730c598e008dca264dbcc564bf26be5
BLAKE2b-256 fac9a73873758cf72ad64399559fef5d9dee4126e09da9a7de09ad5afb661d9e

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