A sci-fi, interactive quantum circuit simulator for Macs — Apple Silicon, Intel Mac, and portable Python hosts, not just M1. Build tiny circuits, watch probability amplitudes interfere, run Bell/GHZ/Grover/QFT demos, and see the classical memory wall that real quantum hardware is meant to overcome.
Repository name remains
m1-quantum-labbecause the project started on a 2021 M1 iMac, but the code now supports broader Mac hardware detection and portable Python/NumPy execution.
- Sci-fi interactive UI in
web/index.html. - Live animated Bloch/amplitude-field visualization.
- Clickable presets: Bell, GHZ, Grover, QFT.
- Gate controls: add H layer, X flip, Z phase, CNOT entanglement.
- Live probability-collapse chart and telemetry terminal.
- Mac compatibility panel for Apple Silicon Mac, Intel Mac, and portable Python hosts.
- Python hardware classification no longer assumes every machine is an M1 iMac.
A Mac is not a physical quantum computer. It has no controllable qubits. But it can run a faithful classical state-vector simulation of ideal quantum circuits, which is the closest useful software analogue available locally.
Quantum Mac Lab turns that into a practical local project:
- Mac-friendly Python + NumPy implementation.
- Dense
complex64state-vector engine for educational quantum circuits. - Bell, GHZ, Grover search, QFT, and random-circuit demos.
- Hardware-aware qubit capacity estimates for different RAM sizes.
- Interactive web dashboard with quantum-themed graphics.
- Tests covering core quantum and hardware behavior.
git clone https://github.com/rtmalikian/m1-quantum-lab.git
cd m1-quantum-lab
python3 -m http.server 8766Then open:
http://127.0.0.1:8766/web/index.html
No build system is required. The UI is a self-contained HTML/CSS/JavaScript artifact.
python3 -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'Run demos:
m1-quantum-lab bell --shots 16
m1-quantum-lab ghz --qubits 5
m1-quantum-lab grover --qubits 4
m1-quantum-lab qft --qubits 3
m1-quantum-lab hardwareRun tests:
pytestThe simulator stores the complete quantum state as a vector of complex amplitudes:
n qubits -> 2^n amplitudes
Single-qubit gates update amplitude pairs. Controlled gates use bit masks to swap or phase selected amplitudes. Measurement probabilities are abs(amplitude)^2.
from m1_quantum_lab import QuantumState
qs = QuantumState(2)
qs.h(1).cnot(control=1, target=0)
print(qs.probabilities())
# {'00': 0.4999999701976776, '01': 0.0, '10': 0.0, '11': 0.4999999701976776}The simulator now classifies machines instead of assuming M1 only:
| Host | Support path |
|---|---|
| Apple Silicon Mac | Fastest default path with native ARM64 NumPy wheels |
| Intel Mac | Supported classical simulator path using CPU vector math |
| Portable Python host | Works where Python/NumPy install; performance depends on local BLAS |
The default engine uses complex64 amplitudes: 8 bytes per amplitude. Memory is the bottleneck:
| Qubits | Amplitudes | State memory |
|---|---|---|
| 20 | 1,048,576 | 8 MB |
| 24 | 16,777,216 | 128 MB |
| 28 | 268,435,456 | 2 GB |
| 30 | 1,073,741,824 | 8 GB |
| 31 | 2,147,483,648 | 16 GB before overhead |
Quantum Mac Lab demo: grover (4 qubits, 16 amplitudes)
Simulated in 0.13 ms using dense NumPy state-vector math.
|1000> 96.132% ██████████████████████████████████████
|1111> 0.258%
|1110> 0.258%
|1101> 0.258%
✅ It is a local quantum circuit simulator. ✅ It is useful for learning superposition, interference, entanglement, Grover search, and QFT. ✅ It now includes an interactive sci-fi web dashboard. ✅ It works beyond M1 assumptions: Apple Silicon, Intel Mac, and generic Python paths.
❌ It is not a real quantum processing unit. ❌ It does not produce quantum speedups. ❌ It cannot escape the exponential memory wall of classical simulation.
- Optional Metal/MPS backend via PyTorch or MLX.
- Tensor-network backend for low-entanglement circuits.
- Stabilizer backend for Clifford circuits.
- Browser-based drag/drop circuit editing.
- Optional cloud quantum provider comparison.
Quantum simulator for Mac, Apple Silicon quantum simulator, Intel Mac quantum simulator, M1 quantum computing, Python quantum circuit simulator, Grover search simulator, Bell state simulator, QFT simulator, state-vector quantum simulator, interactive quantum computing UI.
MIT
