QCGPU is a high performance, hardware accelerated quantum computer simulator written with Python and OpenCL.

  • Simulation of arbitrary quantum circuits
  • Optional simulation of decoherence
  • Optimized for maximally entangled states
  • Runs cross platform, on GPUs, CPUs and other OpenCL devices
  • Example implementations of Grover, Deutsch-Jozsa, Bernstein-Vazirani and Shors algorithm
  • Implements Hadamard, Pauli and phase gates, with support for arbitrary gates
  • Support for arbitrary controlled gates
###########################################
# Bernstein-Vazirani Algorithm
###########################################

import qcgpu

a = 101 # The hidden integer, bitstring is 1100101

register = qcgpu.State(16) # Create a new quantum register

register.apply_all(qcgpu.gate.h()) # Apply a hadamard gate to each qubit

# Apply the inner products oracle
for i in range(16):
    if a & (1 << i) != 0:
        register.z(i)

register.apply_all(qcgpu.gate.h()) # Apply a hadamard gate to each qubit

register.measure(samples=1000) # Measure the register (sample 1000 times)