Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions tutorials/workshops/QMOD_workshop/QMOD_Workshop_Part_2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -324,19 +324,7 @@
" \\end{cases}\n",
"$$\n",
"\n",
"Notes:\n",
"- You cannot use `x` directly as the control variable in a `control` operator because it also occurs in the nested scope. To determine if `x` is in the lower or upper half of the domain, duplicate the most significant bit (MSB) onto a separate variable called `label`.\n",
"- In Python, assignment operators cannot be used in lambda expressions, so the computation of the function needs to be factored out to a named Python function (but not necessarily a Qmod function).\n",
"\n",
"\n",
"<details>\n",
" <summary>Hint</summary>\n",
" dup_msb(x, label)<br>\n",
" control(label, ...) # 0.5 <= x < 1.0<br>\n",
" X(label)<br>\n",
" control(label, ...) # 0.0 <= x < 0.5<br>\n",
"</details>\n",
"\n"
"Note: in Python, assignment operators cannot be used in lambda expressions, so the computation of the function needs to be factored out to a named Python function.\n"
]
},
{
Expand Down Expand Up @@ -421,7 +409,7 @@
"\n",
"The second `bind` operation concatenates the variables back to the `res` output variable.\n",
"\n",
"For this exercise, fill in the missing code parts in the above snippet and use the `control` statement to manually generate the 3-qubit probability distribution: `[1/8, 1/8, 1/8, -sqrt(3)/16, 1/8 + sqrt(3)/16, 1/8, 1/8, 1/8, 1/8]`.\n",
"For this exercise, fill in the missing code parts in the above snippet and use the `control` statement to manually generate the 3-qubit probability distribution: `[1/8, 1/8, 1/8, 1/8 - sqrt(3)/16, 1/8 + sqrt(3)/16, 1/8, 1/8, 1/8, 1/8]`.\n",
"\n",
"The following sequence of operations generates it:\n",
"1. Perform the Hadamard transform on all three qubits.\n",
Expand Down Expand Up @@ -452,7 +440,7 @@
" 1 / 8,\n",
" 1 / 8,\n",
" 1 / 8,\n",
" -sqrt(3) / 16,\n",
" 1 / 8 - sqrt(3) / 16,\n",
" 1 / 8 + sqrt(3) / 16,\n",
" 1 / 8,\n",
" 1 / 8,\n",
Expand Down
Loading