Lab 1
The purpose of this lab is to become familiar with QCL, an interpreted language that supports mixed quantum/classical computation.
First, some useful information:
QCL can be obtained online from: http://tph.tuwien.ac.at/~oemer/qcl.html,
but a precompiled version can be obtained locally from here
.
I suggest that you edit files outside of QCL, rather than using the command line interface that QCL provides.
Finally, although you should not need to for this assignment (you may for the next), you can increase the number of simulated qubits that QCL supports by using the -b command line option.
For instance, to simulate 64 qubits:
Note that you cannot simulate a large number of qubits.
Simulating a quantum system is an O(2^n) problem!
qureg x[2]; // declares 2 qubits x[0] and x[1]int i; // declares a classical integerreal r; // declares a classical floating point number
measure x, i; // measures qubit states and places the result in i
dump x; // dump qubit probabilities
reset; // resets all qubits in the system back to zero.
Mix(source1); // H gate
CNot(target, source1 & source2); // Toffoli gate.
The procedure should teleport a qubit (source) into
the destination qubit. It will use the scratch qubit as part of the
teleportation process. After writing this procedure, test it by running
it on a few arbitrary source qubit states (you can make some interesting
qubit states for testing, by using the Rot(pi/y, source) function. Choose
y to be some real number). Use the "dump" QCL command to demonstrate that
the source qubit state is successfully teleported into the destination
qubit. Print these tests out and hand in the source to teleport and
the screen dumps to show that it works.
Problem 2) Super-dense coding
Write a QCL procedure EPR(qubit q1, qubit q2) that creates an EPR state on qubits q1 and q2.