Skip to content

Commit b1f4889

Browse files
Adam GitterAdamg-classiq
authored andcommitted
design quantum operations page updated
1 parent fdf231d commit b1f4889

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tutorials/documentation_materials/classiq_101/classiq_concepts/design/quantum_operations/quantum_operations.ipynb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@
3333
"cell_type": "markdown",
3434
"metadata": {},
3535
"source": [
36-
"The task is to prepare a quantum number `x` in a superposition of all possible integers between $0$ to $15$, i.e., $|x\\rangle = \\frac{1}{\\sqrt{16}}(|0\\rangle + |1\\rangle + \\dots + |15\\rangle)$. Then, prepare another quantum number `y` that is in the state $|17\\rangle$ only if $|x\\rangle$ is in the state $|15\\rangle$, otherwise the state of `y` should be $|0\\rangle$. Mathematically, the task is to prepare this state:\n",
37-
"$\\begin{equation}\n",
38-
"|x\\rangle|y\\rangle = \\frac{1}{\\sqrt{16}}(|0\\rangle|0\\rangle+|1\\rangle|0\\rangle+\\dots+|14\\rangle|0\\rangle+|15\\rangle|17\\rangle).\n",
39-
"\\end{equation}$\n",
36+
"The task is to prepare a quantum number `x` in a superposition of all possible integers between $0$ to $15$, i.e., $|x\\rangle = \\frac{1}{\\sqrt{16}}(|0\\rangle + |1\\rangle + \\dots + |15\\rangle)$. \n",
37+
"Then, prepare another quantum number `y` that is in the state $|17\\rangle$ only if $|x\\rangle$ is in the state $|15\\rangle$, otherwise the state of `y` should be $|0\\rangle$. Mathematically, the task is to prepare this state:\n",
38+
"$$\n",
39+
"|x\\rangle|y\\rangle = \\frac{1}{\\sqrt{16}}(|0\\rangle|0\\rangle+|1\\rangle|0\\rangle+\\dots+|14\\rangle|0\\rangle+|15\\rangle|17\\rangle)\n",
40+
"$$\n",
4041
"\n",
4142
"How to approach this task? You have already seen how to create a uniform superposition with the `hadamard_transform`. Now, conditioned on the value of $|x\\rangle$ being $|15\\rangle$, prepare the state of $|y\\rangle$ to be $|17\\rangle$ with the `inplace_xor` function."
4243
]
@@ -72,7 +73,7 @@
7273
"cell_type": "markdown",
7374
"metadata": {},
7475
"source": [
75-
"In the Python syntax, `control` is a Python function with two arguments. The `ctrl` argument is the condition for which the `stmt_block` operand is applied. The `stmt_block` argument is the specific operation/function to apply, given that the condition is satisfied. Passing a function as an argument for another function is done with the `lambda:` keyword, used to define inline functions. **So, anytime you pass a function as an argument in the Python SDK, use the prefix `lambda:`**. [read more](https://docs.classiq.io/latest/qmod-reference/language-reference/operators/?h=lambda).\n",
76+
"In the Python syntax, `control` is a Python function with two arguments. The `ctrl` argument is the condition for which the `stmt_block` operand is applied. The `stmt_block` argument is the specific operation/function to apply, given that the condition is satisfied. Passing a function as an argument for another function is done with the `lambda:` keyword, used to define inline functions. **So, anytime you pass a function as an argument in the Python SDK, use the prefix `lambda:`** ([read more](https://docs.classiq.io/latest/qmod-reference/language-reference/operators/?h=lambda)).\n",
7677
"\n",
7778
"In the native syntax, `control` is embedded in the Qmod language such that the condition is specified with the `()` parentheses, and the operand to apply is specified within the scope of the `control`, i.e., within the `{}` curly brackets.\n",
7879
"\n",
@@ -193,12 +194,12 @@
193194
"\n",
194195
"* In the Python SDK, write the quantum operations just like any other Python function. The arguments of the quantum operation that are functions by themselves must be passed with the `lambda:` keyword. In the above example, the `stmt_block` argument of the `control` function is a function by itself (`inplace_xor`), hence it is prefixed with `lambda:`.\n",
195196
"\n",
196-
"* Other quantum operations are `power` (raising a unitary to some power), `invert` (applying the inverse of a unitary), and `within_apply` (applying two unitaries $U$ and $V$ as $UVU^\\dagger$). See a detailed [description of the quantum operators](https://docs.classiq.io/latest/qmod-reference/language-reference/statements/power/).\n"
197+
"* Other quantum operations are `power` (raising a unitary to some power), `invert` (applying the inverse of a unitary), `within_apply` (applying two unitaries $U$ and $V$ as $UVU^\\dagger$) and `bind` (rewiring qubit(s) referenced by a source variable to a destination variable). For more information, see the detailed description of [each quantum operator](https://docs.classiq.io/latest/qmod-reference/language-reference/statements/power/).\n"
197198
]
198199
},
199200
{
200201
"cell_type": "code",
201-
"execution_count": 7,
202+
"execution_count": 12,
202203
"metadata": {},
203204
"outputs": [],
204205
"source": [

0 commit comments

Comments
 (0)