Week 1 Exercise and Homework
Exercises:
-
Follow the Design - The Qmod Language tutorial:
-
Write within the IDE with the native syntax a quantum algorithm that coherently calculates \( y = 2x + 4z + 2 \) where \( x \) and \( z \) are quantum numbers represented with 5 qubits each, initialized in a superposition of all possible values.
-
Follow the Design - Quantum Variables and Functions tutorial:
-
Create another quantum function
flip_lsb
that flips the least significant bit. -
Follow the Optimize - The Synthesis Engine tutorial:
-
Modify the constraints such that you optimize the circuit for minimal circuit depth using a maximum of 25 qubits. What are the circuit depth and width you receive? Are they different from the given example?
-
Open the example from the Analyze - Classiq Visualization Tool tutorial in the IDE:
-
Export it as a LaTeX file, and view it in a LaTeX Editor (it is recommended to use Overleaf - a free, easy-to-use online LaTeX editor).
-
Follow the Execute tutorial:
-
First, adapt the code such that the quantum number \( x \) is allocated with 8 qubits. Then, execute the algorithm with 5096 shots and post-process the results from your Python SDK. Plot a graph of all the measured values of \( x \) and \( y \) with the corresponding axes (make sure you receive the graph of \( y = x^2 + 1 \)).
Advanced Exercises:
-
Synthesize 3 different implementations of an MCX (multi-control-X) with 5 control qubits and 1 target qubit:
-
Use the control quantum operation for implementing an MCX, following this tutorial that can be opened in the IDE. One implementation should be optimized for minimized depth, the other for minimized width, and the third somewhere in between (choose yourself what is the maximal width/depth you apply).
-
Export the 3 implementations as LaTeX files on the hierarchy level that demonstrates the differences between the implementations.
-
Aggregate the implementations in 1 file, export it as a PDF, and explain the key differences. (It is recommended to use Overleaf - a free, easy-to-use online LaTeX editor).
-
Synthesize 2 different implementations of an MCX with 20 control qubits and 1 target qubit:
-
Compare the circuit width and circuit depth required for each implementation.