Skip to content

Commit

Permalink
israel and tamuz comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Dror Segman authored and Dror Segman committed Feb 23, 2025
1 parent 7b6fa14 commit 2e1d1e9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
1 change: 0 additions & 1 deletion tutorials/Classiq_tutorial/classiq_overview_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"outputs": [],
"source": [
"@qfunc\n",
"\n",
"def main(x: Output[QNum], y: Output[QNum]) -> None:\n",
" allocate(3,x)\n",
" hadamard_transform(x)\n",
Expand Down
40 changes: 23 additions & 17 deletions tutorials/Classiq_tutorial/synthesis_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-19T09:57:25.784056Z",
"start_time": "2025-02-19T09:57:25.755663Z"
}
},
"outputs": [],
"source": [
"from classiq import *\n",
"\n",
Expand All @@ -28,48 +30,48 @@
" allocate(x)\n",
" hadamard_transform(x)\n",
" y |= x**2 + 1"
],
"outputs": [],
"execution_count": 3
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": "First, let's synthesize to optimize on circuit depth, i.e. to minimize the longest chain of gates in the circuit and hence the overall execution time (and required coherence time)."
"source": [
"First, let's synthesize to optimize on circuit depth, i.e. to minimize the longest path formed by gates in the circuit (and hence affects the required coherence time)."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-19T09:57:33.595260Z",
"start_time": "2025-02-19T09:57:25.795982Z"
}
},
"outputs": [],
"source": [
"qprog_opt_depth = synthesize(\n",
" model=main,\n",
" constraints=Constraints(optimization_parameter=OptimizationParameter.DEPTH) \n",
")"
],
"outputs": [],
"execution_count": 4
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": "We can inspect the resulting circuit using Classiq's web visualization:\n"
"source": [
"We can inspect the resulting circuit using Classiq's web visualization:\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-19T09:57:35.150980Z",
"start_time": "2025-02-19T09:57:33.606889Z"
}
},
"source": [
"show(qprog_opt_depth)"
],
"outputs": [
{
"name": "stdout",
Expand All @@ -79,7 +81,9 @@
]
}
],
"execution_count": 5
"source": [
"show(qprog_opt_depth)"
]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -108,20 +112,20 @@
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-19T09:57:38.617264Z",
"start_time": "2025-02-19T09:57:35.204530Z"
}
},
"outputs": [],
"source": [
"qprog_opt_width = synthesize(\n",
" model=main,\n",
" constraints=Constraints(optimization_parameter=OptimizationParameter.WIDTH) \n",
")"
],
"outputs": [],
"execution_count": 6
]
},
{
"cell_type": "markdown",
Expand All @@ -132,13 +136,13 @@
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"ExecuteTime": {
"end_time": "2025-02-19T09:57:39.812986Z",
"start_time": "2025-02-19T09:57:38.625126Z"
}
},
"source": "show(qprog_opt_width)",
"outputs": [
{
"name": "stdout",
Expand All @@ -148,7 +152,9 @@
]
}
],
"execution_count": 7
"source": [
"show(qprog_opt_width)"
]
},
{
"cell_type": "markdown",
Expand Down

0 comments on commit 2e1d1e9

Please sign in to comment.