Skip to content

Instantly share code, notes, and snippets.

@brianlechthaler
Created December 27, 2020 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianlechthaler/da84a8ed0e6fc9d369685cf7f14132a3 to your computer and use it in GitHub Desktop.
Save brianlechthaler/da84a8ed0e6fc9d369685cf7f14132a3 to your computer and use it in GitHub Desktop.
Simple Superpositioning Example (QASM2)
OPENQASM 2.0;
include "qelib1.inc";
# Initialize 1 quantum register (1 qubit)
qreg q[1];
# Initialize 1 classic register (1 bit)
creg c[1];
#Place a Hadamard gate at the beginning of the first qubit
h q[0];
# Take a measurement on the first qubit after applying the Hadamard gate, save result to the first classical bit
measure q[0] -> c[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment