Homework 3


Important: Make one submission per group. Write Names and Unity IDs on every submission file of all group members. Name the submission files correctly as asked for.

  1. (20 points) Use the Dwave Ocean tools to (A) try their factorization example under a simulator and then (B) on the Dwave 2000Q system.

    Turn in the files interface-sim.py, demo-sim.py, output-sim.txt, interface-hw.py, demo-hw.py, output-hw.txt

  2. (20 points) Slide 35 indicates how to build a more complex gate from a sequence of simpler ones, i.e., how to build a CNOT from 2 Hadamards and a CPHASE, also depicted in slide 37. Use Quirk to create such a 3-gate 2-Qubit CNOT solution. Notice that CPHASE is a Pauli gate, you have to figure out which one. Also add a regular CNOT gate using 2 more Qubits. And add a sample display to all four Qubits. Then test your solution: The upper 2-Qubit circuit should behave the same as the lower 2-Qubit one for all four input combinations.

    Turn in file cphase.txt (export as URL)

  3. (20 points) You already created the 1-bit full adder from slide 41 on Quirk. The CCNOT gates are Toffoli gates, i.e., you can now create the adder in Qiskit.
    Hints:

    Turn in file adder.py

  4. (20 points)

  5. (20 points)

    Consider an n-qubit input state. Use qiskit to create a circuit that changes the phase by pi for all values in which the high-order n/2 qubits are equal to the low-order n/2 qubits. In other words, consider a 6-bit value x[5:0]. The circuit should be true if and only if x[5:3] is the same as x[2:0].

    Submit equal_phase.py, and equal_phase.txt: evidence that your circuit actually works for a 6-bit value. Note that a simple measurement in the computational basis will not show the phase shift.