- Translate the following OpenQASM program into a quantum score:
OPENQASM 2.0;
include "qelib1.inc";
qreg q[5];
creg c[5];
x q[4];
h q[3];
h q[4];
cx q[3],q[4];
h q[3];
h q[4];
cx q[3],q[4];
measure q[3] -> c[3];
measure q[4] -> c[4];
- Translate the following quantum score to an OpenQASM program:
- Challenge problem: run the following OpenQASM program on IBM QX twice in the simulator, once with the third q[2] qubit initialized to |"1">, as in the following example code, and once with the third qubit initialized to |"0"> (hint: remove the x q[2]; line to do this). Make sure to set the parameters of the simulator, or of the experiment, to do as many shots as possible to get as close to the theoretical result as possible. What does the program return? What is its purpose? Refer to the following OpenQASM code:
include "qelib1.inc";
qreg q[5];
creg c[5];
x q[2];
h q[1];
sdg q[1];
cx q[2],q[1];
h q[1];
t q[1];
cx q[2],q[1];
t q[1];
h q[1];
s q[1];
x q[1];
s q[2];
measure q[1] -> c[1];
In each of the two runs, write out a program with no more than one gate, which would produce the equivalent output. Think about the similarities to the CNOT gate in terms of controlled behavior.
- Implement the XYZS†T†HHTSZY X |"0"〉 circuit in OpenQASM.
- Translate the following circuit to OpenQASM:
- Draw the quantum score that corresponds to the following OpenQASM program:
include "qelib1.inc";
qreg q[5];
creg c[5];
x q[0];
x q[1];
id q[2];
h q[2];
cx q[1],q[2];
tdg q[2];
cx q[0],q[2];
t q[2];
cx q[1],q[2];
tdg q[2];
cx q[0],q[2];
t q[1];
t q[2];
h q[2];
cx q[1],q[2];
h q[1];
h q[2];
cx q[1],q[2];
h q[1];
h q[2];
cx q[1],q[2];
cx q[0],q[2];
t q[0];
tdg q[2];
cx q[0],q[2];
measure q[0] -> c[0];
measure q[1] -> c[1];
measure q[2] -> c[2];