Skip to content

Instantly share code, notes, and snippets.

@nelimee
Created June 24, 2018 10:41
Show Gist options
  • Save nelimee/5f34e369105bd3cd46eec98893f3914f to your computer and use it in GitHub Desktop.
Save nelimee/5f34e369105bd3cd46eec98893f3914f to your computer and use it in GitHub Desktop.
// Quantum circuit to illustrate issue #1
// of https://github.com/nelimeee/qasm2error
OPENQASM 2.0;
include "qelib1.inc";
// A quantum gate that applies 10 times non-simplifiable
// gates to the given qubit
gate g10 q {
y q;
barrier q;
x q;
barrier q;
z q;
barrier q;
h q;
barrier q;
y q;
barrier q;
z q;
barrier q;
h q;
barrier q;
x q;
barrier q;
tdg q;
barrier q;
s q;
barrier q;
}
// A quantum gate that applies 100 times the H gate
// to the given qubit
gate g100 q {
g10 q;
g10 q;
g10 q;
g10 q;
g10 q;
g10 q;
g10 q;
g10 q;
g10 q;
g10 q;
}
// A quantum gate that applies 1000 times the H gate
// to the given qubit
gate g1000 q {
g100 q;
g100 q;
g100 q;
g100 q;
g100 q;
g100 q;
g100 q;
g100 q;
g100 q;
g100 q;
}
qreg q[2];
// Repeat single qubit operation to increase error
g1000 q[0];
// Perform a SWAP.
swap q[0], q[1];
// Errors here should be:
// 1. Very high for q[1]
// 2. Low for q[0]: only the errors on SWAP should affect
// q[0].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment