A quantum universe simulator with a C-engine
Project description
Qbit — Quantum Universe Simulator
s/o Gemini....
Setup
Note: This project uses Python 3.13.
Create and run a virtual environment
python3 -m venv venv # Create
source venv/bin/activate # Activate
pip install -r requirements.txt # Dependencies
Tests
python3 tests/gates.py # Run gate test
python3 tests/melinda.py # Run 2nd test suite
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
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 Distribution
qbituni-0.0.1.tar.gz
(6.6 kB
view details)
Built Distribution
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 qbituni-0.0.1.tar.gz.
File metadata
- Download URL: qbituni-0.0.1.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c543ea8946c858f5c413b9bad252a8beb955e0a9c1cba7d1f1cb50aa61b94b6
|
|
| MD5 |
71a136195cfe2c138de6da7e0dab6f63
|
|
| BLAKE2b-256 |
1f1646006d2521784ce3afbdaa5bc38761d0a1dba6f049c23d42151232e4e861
|
File details
Details for the file qbituni-0.0.1-cp313-cp313-macosx_10_13_universal2.whl.
File metadata
- Download URL: qbituni-0.0.1-cp313-cp313-macosx_10_13_universal2.whl
- Upload date:
- Size: 11.8 kB
- Tags: CPython 3.13, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2067e60a2e328dee963e689e9ea641cdbca3ea55e1865bf6b0538aede224156a
|
|
| MD5 |
40329b01e2a9cdd48517b64ed986be80
|
|
| BLAKE2b-256 |
1529c382bf2b318fb0f1ae8bb7f743be2a5d6ff6ec06e0114057476304e8bda8
|