Assignments: These assignments are optional, but highly encouraged. They will not be checked.

- (20 points)
In HW1, we had a solution to the "imply" in a 4 Qbit embedding
that we tested in the spreadsheet. Notice that if the resulting
embedding does not match the bipartite graph we need, you can
embed q1+q3 and q2+q4 to get a symmetric solution, which is a
match for the graph we want. Let's now transform this into
Quantum machine instructions (QMI).
But first, let's run some QMI code:

cd qOp cd examples cd dw bash A-execute-qmi.bash

Copy the file A-execute-qmi.bash to imply4-qmi.bash, then create the same embedding as in the spreadsheet for the "imply equation".

Hints:- Check out embedding
(slide 16), which shows the Qbit numbering in the Chimera graph. The
coupler (strength) indexing counts down top-to-bottom, i.e., you get
the following connections:
- Q0000 -- C0000 -- Q0004
- Q0000 -- C0001 -- Q0005
- Q0000 -- C0002 -- Q0006
- Q0000 -- C0003 -- Q0007
- Q0001 -- C0004 -- Q0004
- Q0001 -- C0005 -- Q0005
- Q0001 -- C0006 -- Q0006
- Q0001 -- C0007 -- Q0007
- etc.

Turn in file imply4.bash (dw program) and imply4a.pdf (spreadsheet snapshot)

- Check out embedding
(slide 16), which shows the Qbit numbering in the Chimera graph. The
coupler (strength) indexing counts down top-to-bottom, i.e., you get
the following connections:
- (10 points)
Let's try one more embedding exercise, again for the "imply"
circuit from of slide 8 in
a 4-Qbit subset in the spreadsheet, but this time by embedded q1
into 3 Qbits.

Hints:- Set the a-weights for q1 and q2 and the strength for b12. Notice that you already have a solution, but that's not the point. We want to learn how to embed multiple Qbits at once.
- To facilitate a 3-way embedding, multiply all weights and strengths by 3.
- Split q1 into q1+q3+q4, adjust the a-weights (divide by number of resulting Qbits).
- Connect your split Qbits with the "equal" circuit (but use -4 so that it supersedes the strength of the imply coupler) and adjust the a-weights accordingly (subtract from them the [sum of new adjacent strengths] divided by number of new couplings).
- At this point, you should be done. However, if you wanted to create an imply coupling between q2 and the other 3 Qbits (3 links), then you would create these links at the same strength given by the original single-coupling divided by the number of target links: -3/3=-1. Try this out.

Turn in file imply4b.pdf

- (20 points)
Let's repeat this embedding for the "imply" from
slide 8 for a 5-Qbit
subset with q1 replicated in another 3 Qbits such that it can be
embedded into D-Wave's bipartite graph. Since you cannot do this in
the spreadsheet, try it on paper. Then program it in QMI.

Hints:- Please q2 in the middle, then create a "ring" of the other Qbits around it (in north, south, east, west location).
- Follow the steps from the previous exercise to (a) multiply weights/strengths, (b) split weights, (c) add equalities with weight/strength adjustments, (d) split the original (imply) strengths across the east/west connection.
- Code it up in dw as in the 1st exercise.

Turn in file imply5.bash (dw program) and imply5.pdf (graph showing Qbits+couplings with weights+strengths on paper)

- (10 points)
Let's create the 1-bit full adder from
slide 41 on
Quirk with inputs c0, a0, b0
and outputs s0 and c1.

Hints:- Watch the tutorial.
- Create the adder circuit by just dropping down X gates (marked as "cross", right below the Y gate) and adding one or two control probes (solid dot) for C-Not and Hadamard gates, respectively.
- Put a Sample box on the inputs (left).
- Test your circuit by verifying that inputs/outputs are correct. You can change inputs by putting one or more X gates on Qbit input lines (very left, left of the sample box), and then watch the output.
- Label inputs and outputs. You can do this by creating a labeled gate for each symbol, i.e., click: make gate, from matrix "{{1,0},{0,1}}" circuit symbol "c0", create. Place it on the c0 input line, etc. for a0/b0/s0/c1.
- Export your solution as a URL (copy clipboard) in the file added.txt.

Turn in file adder.txt

- (20 points)
Combine two adders to create a 2-bit adder in Quirk with inputs c0, a0, a1,
b0, b1 and outputs s0, s1, and c2. Make sure to label inputs/outputs.
Turn in file doubleadder.txt

- (5 points) Create a Toffoli gate in Quirk from basic gates by
modifying
this
solution. Start with the given circuit but
substitute gates as follows:
- T is Z^1/4 (can also be creates by matrix {{1,0},{0,i}})
- T-dagger is Z^-1/4 (or {{1,0},{0,-i}})
- S is Z^1/2 (or {{1,0},{0,e^(i*pi/4)}})
- add a Sample on the inputs
- try out all input combinations to verify output

Turn in file toffoli.txt

- (15 points) Create a Toffoli gate in Quirk from basic gates by
modifying
this
solution. We now try
construct Toffoli variation. Start with the given circuit but
substitute gates as follows:
- T is Z^1/8
- T-dagger is Z^-1/8
- S is Z
- add a Sample on the inputs
- try to add one more gate, X^1/2, in the right place with the right wiring
- try out all input combinations to verify output

Turn in file toffoli2.txt

- (0 points) Learn about superdense coding and then check out the predefined Superdense circuit in Quirk (click menu button). Have a look at how it works in action. Fun stuff to first grasp and then watch. Nothing to turn in, no points :-)