Checks results against NumPy
Each gate and random circuit is compared with a plain NumPy reference simulator, on the CPU and the GPU.
A qscommons project · version 1.1.1
A Rust core runs your circuits on every CPU core or any GPU, up to 30 qubits. On a GPU it runs 22 qubits in 77 ms, and its docs start at bra-ket notation.
import qsengine
qc = qsengine.QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
print(qc.run(shots=1000, seed=1))
# {'00': 513, '11': 487}
print(qc.probabilities())
# 0.5 for 00, 0.5 for 11
print(qc)
# q0: ──H──●──
# │
# q1: ─────X──
Build a circuit from gates in Python, then ask for counts or exact amplitudes. Every example in the documentation prints real output from qsengine 1.1.
import qsengine
qc = qsengine.QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
counts = qc.run(shots=1000, seed=1)
print(counts)
# {'00': 513, '11': 487}
print(qc.probabilities())
# 0.5 for 00, 0.5 for 11
print(qc)
# q0: ──H──●──
# │
# q1: ─────X──
# the same circuit, each backend
cpu = qc.run(backend="cpu")
gpu = qc.run(backend="gpu")
# three qubits: a GHZ state
ghz = qsengine.QuantumCircuit(3)
ghz.h(0)
ghz.cx(0, 1)
ghz.cx(1, 2)
print(ghz.statevector())
Each gate and random circuit is compared with a plain NumPy reference simulator, on the CPU and the GPU.
On any vendor's GPU through Vulkan, DirectX 12 or Metal, 5.6 times faster than Qiskit Aer on the same circuit.
With backend="auto", small circuits run in 64-bit on every CPU core and large ones move to the GPU.
One wheel per platform covers CPython 3.9 and newer, so there is nothing to compile and NumPy comes with it.
No. qsengine runs on any CPU and uses a GPU when one is present, through Vulkan, DirectX 12 or Metal.
Up to 30 qubits. Memory doubles with every qubit: 20 qubits take 16 MiB and 30 take 16 GiB.
CPython 3.9 and newer, with one wheel per platform.
Open an issue for a bug or an idea, or send a pull request. The contributing guide covers running the tests and updating the docs. Read the contributing guide