Lab Exercises

Suggested reading:
An overview to quantum computing in this thesis by J. Allcock.

Exercise 1.

Write a "simulator" for a one-qubit quantum computation. In this exwercise, work in a basis where

      |0> = [1,0] and |1> = [0,1]
    
two represent a qubit. create functions to do unary NOT operations, and the Hadamard transform,
      H1 = [[1, 1]
            [1,-1]]
    
Also great a function to "measure" (and print out) the state of the qubit. Is it in state "0" or "1"? Note: you should be working with complex oefficients, but you will not need to for this exercise.

Exercise 2.

Extend the provious exercise to a two-qubit system. Work in a basis be such that
 {a|0,0> + b|0,1>  + c|1,0> + d|1,1>} = [a,b,c,d]
  
Focus on the 2-qubut Hadamard transform H2 = [[H1,H1],[H1,-H1]] and measuring the state of each qubit.

Exercise 3.

Code up the Deutsch algorithm and test it for all four constant+balanced bit manipulation functions,
  f1(0)=f1(1)=0; f2(0)=f2(1)=1  (constnnt)
  f3(0)=0, f3(1)=1; f4(0)=1, f4(1)=10 (balanced).