QuBlox (v2.0)
What is this?
QuBlox is an open-source quantum computing simulator built for Roblox using Luau.
It provides state vector simulation, quantum gates, measurements, and even custom gates
Where can I download it?
You can download QuBlox at the github releases page: Releases · coolguy65161/QuBlox
API Documentation
The API documentation can be found here: Documentation
Example
This example creates a 5 qubit GHZ state.
More examples can be found in the /examples folder on the github repo: Repository
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local QuBlox = require(ReplicatedStorage.QuBlox)
local Circuit = QuBlox.Circuit(5, 5)
Circuit:h(1)
Circuit:cnot(1, 2)
Circuit:cnot(2, 3)
Circuit:cnot(3, 4)
Circuit:cnot(4, 5)
local results = Circuit:results(100000)
print(results)
Expected output:
00000 ≈ 50%
11111 ≈ 50%
Benchmarks
Old benchmarks (v1):
Example:
- 7-qubit GHZ state
- 500,000 measurements
- ~3.5 seconds
Example:
- 5-qubit GHZ state
- 1,000 measurements
- ~27.8 milliseconds
New benchmarks (v2.0):
Example:
- 7-qubit GHZ state
- 500,000 measurements
- ~747 milliseconds
Example:
- 5-qubit GHZ state
- 1,000 measurements
- ~1.1 milliseconds
Check changelog for newer information
Additional Information
QuBlox uses big endian display ordering.
Quantum noise simulation has not been implemented.
Not all gates have been fully tested.
Latest Release: QuBlox (v2.0) - Run Quantum Circuits Inside Roblox - #6 by coolguy65161
All minor versions will only be edited into this post, and all major versions will be a new reply in the forum. You can see those here:
Changelog
v1.1 - rest of minor versions will be edited in
QuBlox (v2.0) - Run Quantum Circuits Inside Roblox - #5 by coolguy65161
v2.0-preview1
Release QuBlox v2.0-preview1 · coolguy65161/QuBlox
Changes
-
Direct state updates for single qubit gates
-
Removed QuBlox:GetTensorMatrix()
-
Renamed QuBlox:GetTensorOperations() to QuBlox:GetSingleOperations()
-
Added QuBlox:UpdateSingularState()
Additional information
Multi-qubit gates do not work in this version
v2.0-preview2
Release QuBlox v2.0-preview2 · coolguy65161/QuBlox
Changes
-
Removed QuBlox:GetMultiOperations()
-
Removed QuBlox:GetSingleOperations()
-
Removed findMultiGates()
-
Removed findSingleGates()
-
Removed removeDuplicateGates()
-
Removed QuBlox:GetCircuitMatrix
-
Removed QuBlox:GetTensorMatrix
-
Removed QuBlox:GetMultiMatrix
-
Added QuBlox:applyMultiQubit()
-
Added getIndex()
-
Added a general support algorithm for direct amplitude modification
-
Refactored QuBlox:UpdateStateVector()
Benchmarks:
7 qubit GHZ state
- 500k shots
- ~0.89s
New bottleneck:
State modification, updating the state vector now takes 1.3ms for the
7 qubit GHZ state. Results comes up with 0.89s of time.
Additional information
Can now support 15+ qubits