From b765f8dad041253c75824faa03d8fe0faee8dca1 Mon Sep 17 00:00:00 2001 From: Dor Harpaz Date: Thu, 6 Mar 2025 14:56:12 +0200 Subject: [PATCH 1/4] Add test: classiq_overview_tutorial --- .../test_classiq_overview_tutorial.py | 22 ++++++++++++++ .../classiq_overview_tutorial.ipynb | 30 +++++++++---------- 2 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 tests/notebooks/workshops/test_classiq_overview_tutorial.py diff --git a/tests/notebooks/workshops/test_classiq_overview_tutorial.py b/tests/notebooks/workshops/test_classiq_overview_tutorial.py new file mode 100644 index 00000000..29d658a2 --- /dev/null +++ b/tests/notebooks/workshops/test_classiq_overview_tutorial.py @@ -0,0 +1,22 @@ +from tests.utils_for_testbook import ( + validate_quantum_program_size, + validate_quantum_model, + wrap_testbook, +) +from testbook.client import TestbookNotebookClient + + +@wrap_testbook("classiq_overview_tutorial", timeout_seconds=500) +def test_notebook(tb: TestbookNotebookClient) -> None: + # test models + validate_quantum_model(tb.ref("qmod")) + + # test quantum programs + validate_quantum_program_size( + tb.ref("qprog"), + expected_width=20, # actual width: 16 + expected_depth=300, # actual depth: 225 + ) + + # test notebook content + pass # Todo diff --git a/tutorials/Classiq_tutorial/classiq_overview_tutorial.ipynb b/tutorials/Classiq_tutorial/classiq_overview_tutorial.ipynb index ed67ed17..c438472d 100644 --- a/tutorials/Classiq_tutorial/classiq_overview_tutorial.ipynb +++ b/tutorials/Classiq_tutorial/classiq_overview_tutorial.ipynb @@ -19,7 +19,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -50,15 +50,15 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "@qfunc\n", "def main(x: Output[QNum], y: Output[QNum]) -> None:\n", - " allocate(3,x)\n", + " allocate(3, x)\n", " hadamard_transform(x)\n", - " y |= x**2 + 1\n" + " y |= x**2 + 1" ] }, { @@ -97,7 +97,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -114,7 +114,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -130,14 +130,14 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Opening: https://platform.classiq.io/circuit/2sdF7ey6Azju9VOkicpb93WuI8Y?version=0.67.0\n" + "Opening: https://platform.classiq.io/circuit/2twY58AvicdOjhZ4UZaGkP1POTb?version=0.70.0\n" ] } ], @@ -179,7 +179,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -210,14 +210,14 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "[{'x': 6, 'y': 37}: 280, {'x': 1, 'y': 2}: 278, {'x': 0, 'y': 1}: 272, {'x': 7, 'y': 50}: 253, {'x': 3, 'y': 10}: 252, {'x': 5, 'y': 26}: 244, {'x': 4, 'y': 17}: 239, {'x': 2, 'y': 5}: 230]\n" + "[{'x': 0, 'y': 1}: 295, {'x': 1, 'y': 2}: 262, {'x': 6, 'y': 37}: 259, {'x': 5, 'y': 26}: 257, {'x': 7, 'y': 50}: 251, {'x': 4, 'y': 17}: 247, {'x': 2, 'y': 5}: 243, {'x': 3, 'y': 10}: 234]\n" ] } ], @@ -237,7 +237,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -304,7 +304,7 @@ ], "metadata": { "kernelspec": { - "display_name": "external-user-venv-PaJZMdG0-py3.11", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -318,9 +318,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.6" + "version": "3.11.7" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } From 2a1297f1d858291f1cd1c7e96b84c714206843a6 Mon Sep 17 00:00:00 2001 From: Dor Harpaz Date: Thu, 6 Mar 2025 14:58:54 +0200 Subject: [PATCH 2/4] Add tests: Qmod_tutorial_part1 Qmod_tutorial_part2 --- .../workshops/test_Qmod_tutorial_part1.py | 25 +++++++++++ .../workshops/test_Qmod_tutorial_part2.py | 25 +++++++++++ .../Qmod_tutorial_part1.ipynb | 43 ++++++++++++------- .../Qmod_tutorial_part2.ipynb | 36 ++++++++-------- 4 files changed, 95 insertions(+), 34 deletions(-) create mode 100644 tests/notebooks/workshops/test_Qmod_tutorial_part1.py create mode 100644 tests/notebooks/workshops/test_Qmod_tutorial_part2.py diff --git a/tests/notebooks/workshops/test_Qmod_tutorial_part1.py b/tests/notebooks/workshops/test_Qmod_tutorial_part1.py new file mode 100644 index 00000000..6db87ef4 --- /dev/null +++ b/tests/notebooks/workshops/test_Qmod_tutorial_part1.py @@ -0,0 +1,25 @@ +from tests.utils_for_testbook import ( + validate_quantum_program_size, + validate_quantum_model, + wrap_testbook, +) +from testbook.client import TestbookNotebookClient + + +@wrap_testbook("Qmod_tutorial_part1", timeout_seconds=500) +def test_notebook(tb: TestbookNotebookClient) -> None: + # todo: Has many overwrites of `qmod` and `qprog` + # as well as many missing places of "put your code" + + # test models + validate_quantum_model(tb.ref("qmod")) + + # test quantum programs + validate_quantum_program_size( + tb.ref("qprog"), + expected_width=7, # actual width: 5 + expected_depth=100, # actual depth: 64 + ) + + # test notebook content + pass # Todo diff --git a/tests/notebooks/workshops/test_Qmod_tutorial_part2.py b/tests/notebooks/workshops/test_Qmod_tutorial_part2.py new file mode 100644 index 00000000..28fbd9bb --- /dev/null +++ b/tests/notebooks/workshops/test_Qmod_tutorial_part2.py @@ -0,0 +1,25 @@ +from tests.utils_for_testbook import ( + validate_quantum_program_size, + validate_quantum_model, + wrap_testbook, +) +from testbook.client import TestbookNotebookClient + + +@wrap_testbook("Qmod_tutorial_part2", timeout_seconds=500) +def test_notebook(tb: TestbookNotebookClient) -> None: + # todo: Has many overwrites of `qmod` and `qprog` + # as well as many missing places of "put your code" + + # test models + validate_quantum_model(tb.ref("qmod")) + + # test quantum programs + validate_quantum_program_size( + tb.ref("qprog"), + expected_width=5, # actual width: 3 + expected_depth=40, # actual depth: 22 + ) + + # test notebook content + pass # Todo diff --git a/tutorials/Classiq_tutorial/Qmod_tutorial_part1.ipynb b/tutorials/Classiq_tutorial/Qmod_tutorial_part1.ipynb index c022b470..c4ed9a6d 100644 --- a/tutorials/Classiq_tutorial/Qmod_tutorial_part1.ipynb +++ b/tutorials/Classiq_tutorial/Qmod_tutorial_part1.ipynb @@ -19,23 +19,26 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from classiq import *\n", "\n", + "\n", "@qfunc\n", "def foo(q: QBit) -> None:\n", " X(q)\n", " H(q)\n", "\n", + "\n", "@qfunc\n", "def main(q: Output[QBit]) -> None:\n", " allocate(q)\n", " foo(q)\n", "\n", - "qmod = create_model(main)" + "\n", + "qmod = create_model(main)" ] }, { @@ -57,16 +60,16 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[{'q': 1}: 1032, {'q': 0}: 1016]" + "[{'q': 0}: 1057, {'q': 1}: 991]" ] }, - "execution_count": 12, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -119,16 +122,16 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[{'q': 1}: 1066, {'q': 0}: 982]" + "[{'q': 1}: 1065, {'q': 0}: 983]" ] }, - "execution_count": 4, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -140,7 +143,7 @@ "...\n", "\n", "# execute the model to see that we get similar results\n", - "qmod = create_model(main)\n", + "qmod = create_model(main)\n", "qprog = synthesize(qmod)\n", "job = execute(qprog)\n", "job.get_sample_result().parsed_counts" @@ -186,7 +189,7 @@ "...\n", "\n", "# execute and inspect the results\n", - "qmod = create_model(main)\n", + "qmod = create_model(main)\n", "qprog = synthesize(qmod)\n", "job = execute(qprog)\n", "job.get_sample_result().parsed_counts" @@ -258,7 +261,9 @@ "outputs": [], "source": [ "from typing import List\n", + "\n", "import numpy as np\n", + "\n", "from classiq import *\n", "\n", "rng = np.random.default_rng(seed=0)\n", @@ -419,19 +424,22 @@ "source": [ "from classiq import *\n", "\n", + "\n", "# rewrite the model, initializing q inside foo\n", "@qfunc\n", "def foo(q: Output[QBit]) -> None:\n", - " allocate(1,q)\n", + " allocate(1, q)\n", " X(q)\n", " H(q)\n", "\n", + "\n", "@qfunc\n", "def main(q: Output[QBit]) -> None:\n", " foo(q)\n", "\n", + "\n", "# execute the model to see that we get similar results\n", - "qmod = create_model(main)\n", + "qmod = create_model(main)\n", "qprog = synthesize(qmod)\n", "job = execute(qprog)\n", "job.get_sample_result().parsed_counts" @@ -475,8 +483,9 @@ " allocate(2, qarr)\n", " bell(qarr)\n", "\n", + "\n", "# execute and inspect the results\n", - "qmod = create_model(main)\n", + "qmod = create_model(main)\n", "qprog = synthesize(qmod)\n", "job = execute(qprog)\n", "job.get_sample_result().parsed_counts" @@ -528,7 +537,9 @@ "outputs": [], "source": [ "from typing import List\n", + "\n", "import numpy as np\n", + "\n", "from classiq import *\n", "\n", "rng = np.random.default_rng(seed=0)\n", @@ -666,7 +677,7 @@ ], "metadata": { "kernelspec": { - "display_name": "external-user-venv-PaJZMdG0-py3.11", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -680,9 +691,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.6" + "version": "3.11.7" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/tutorials/Classiq_tutorial/Qmod_tutorial_part2.ipynb b/tutorials/Classiq_tutorial/Qmod_tutorial_part2.ipynb index 17048eb1..886313a7 100644 --- a/tutorials/Classiq_tutorial/Qmod_tutorial_part2.ipynb +++ b/tutorials/Classiq_tutorial/Qmod_tutorial_part2.ipynb @@ -83,7 +83,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:38:29.067853Z", @@ -134,7 +134,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:38:35.979170Z", @@ -164,7 +164,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:38:39.116182Z", @@ -215,7 +215,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:38:49.235798Z", @@ -257,7 +257,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:38:54.717424Z", @@ -289,7 +289,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:38:59.101064Z", @@ -335,7 +335,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:39:02.550042Z", @@ -373,7 +373,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 9, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:39:07.035217Z", @@ -426,7 +426,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 10, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:39:07.114464Z", @@ -477,7 +477,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 11, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:39:07.126045Z", @@ -522,7 +522,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 12, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:39:07.167263Z", @@ -557,7 +557,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 13, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:39:10.853181Z", @@ -595,7 +595,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 14, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:39:17.883614Z", @@ -632,7 +632,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 15, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:39:26.245095Z", @@ -684,7 +684,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 16, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:39:26.331226Z", @@ -696,7 +696,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Opening: https://nightly.platform.classiq.io/circuit/6fec16d5-72a1-49bf-ab24-3287255c3391?version=0.64.0.dev0\n" + "Opening: https://platform.classiq.io/circuit/2twaDvhLGYuci5llUPMMF2zad9j?version=0.70.0\n" ] } ], @@ -736,7 +736,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 17, "metadata": { "ExecuteTime": { "end_time": "2024-10-07T13:39:36.928795Z", @@ -789,7 +789,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.4" + "version": "3.11.7" }, "vscode": { "interpreter": { From a652ab43a5c8c52650f618de006402ec352dca3a Mon Sep 17 00:00:00 2001 From: Dor Harpaz Date: Thu, 6 Mar 2025 14:59:40 +0200 Subject: [PATCH 3/4] Add test: synthesis_tutorial --- .../workshops/test_synthesis_tutorial.py | 24 ++++++++++++++++++ .../Classiq_tutorial/synthesis_tutorial.ipynb | 25 ++++++++++--------- 2 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 tests/notebooks/workshops/test_synthesis_tutorial.py diff --git a/tests/notebooks/workshops/test_synthesis_tutorial.py b/tests/notebooks/workshops/test_synthesis_tutorial.py new file mode 100644 index 00000000..c977554c --- /dev/null +++ b/tests/notebooks/workshops/test_synthesis_tutorial.py @@ -0,0 +1,24 @@ +from tests.utils_for_testbook import ( + validate_quantum_program_size, + validate_quantum_model, + wrap_testbook, +) +from testbook.client import TestbookNotebookClient + + +@wrap_testbook("synthesis_tutorial", timeout_seconds=500) +def test_notebook(tb: TestbookNotebookClient) -> None: + # test quantum programs + validate_quantum_program_size( + tb.ref("qprog_opt_depth"), + expected_width=20, # actual width: 16 + expected_depth=250, # actual depth: 171 + ) + validate_quantum_program_size( + tb.ref("qprog_opt_width"), + expected_width=20, # actual width: 9 + expected_depth=250, # actual depth: 199 + ) + + # test notebook content + pass # Todo diff --git a/tutorials/Classiq_tutorial/synthesis_tutorial.ipynb b/tutorials/Classiq_tutorial/synthesis_tutorial.ipynb index 837715ef..afed4f01 100644 --- a/tutorials/Classiq_tutorial/synthesis_tutorial.ipynb +++ b/tutorials/Classiq_tutorial/synthesis_tutorial.ipynb @@ -15,7 +15,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2025-02-19T09:57:25.784056Z", @@ -26,6 +26,7 @@ "source": [ "from classiq import *\n", "\n", + "\n", "@qfunc\n", "def main(x: Output[QNum[3]], y: Output[QNum]) -> None:\n", " allocate(x)\n", @@ -42,7 +43,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2025-02-19T09:57:33.595260Z", @@ -53,7 +54,7 @@ "source": [ "qprog_opt_depth = synthesize(\n", " model=main,\n", - " constraints=Constraints(optimization_parameter=OptimizationParameter.DEPTH) \n", + " constraints=Constraints(optimization_parameter=OptimizationParameter.DEPTH),\n", ")" ] }, @@ -66,7 +67,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2025-02-19T09:57:35.150980Z", @@ -78,7 +79,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Opening: https://platform.classiq.io/circuit/2tFsFhhCaOu0oxISGTKjXSkbSty?version=0.68.0\n" + "Opening: https://platform.classiq.io/circuit/2twaSBItXmQT3lgsNKPOCSzYedO?version=0.70.0\n" ] } ], @@ -113,7 +114,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2025-02-19T09:57:38.617264Z", @@ -124,7 +125,7 @@ "source": [ "qprog_opt_width = synthesize(\n", " model=main,\n", - " constraints=Constraints(optimization_parameter=OptimizationParameter.WIDTH) \n", + " constraints=Constraints(optimization_parameter=OptimizationParameter.WIDTH),\n", ")" ] }, @@ -137,7 +138,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2025-02-19T09:57:39.812986Z", @@ -149,7 +150,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Opening: https://platform.classiq.io/circuit/2tFsGKc7EHcx0fX3oXREB18FTjd?version=0.68.0\n" + "Opening: https://platform.classiq.io/circuit/2twaSjGvvXFX7TCHomoiGKVTHPt?version=0.70.0\n" ] } ], @@ -179,7 +180,7 @@ ], "metadata": { "kernelspec": { - "display_name": "external-user-venv-PaJZMdG0-py3.11", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -193,9 +194,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.6" + "version": "3.11.7" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } From 8b07b784bd067dac05f4220e65038356c2e15955 Mon Sep 17 00:00:00 2001 From: Dor Harpaz Date: Thu, 6 Mar 2025 15:25:19 +0200 Subject: [PATCH 4/4] Fix notebooks & fix cwd --- tests/test_notebooks.py | 3 +- .../Qmod_tutorial_part1.ipynb | 24 ++++++------- .../Qmod_tutorial_part2.ipynb | 36 +++++++++---------- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/tests/test_notebooks.py b/tests/test_notebooks.py index 74aeee83..f1771885 100644 --- a/tests/test_notebooks.py +++ b/tests/test_notebooks.py @@ -3,7 +3,7 @@ from contextlib import contextmanager from testbook import testbook # type: ignore[import] -from utils_for_tests import iterate_notebooks +from utils_for_tests import iterate_notebooks, ROOT_DIRECTORY TIMEOUT: int = 60 * 10 # 10 minutes LOGGER = logging.getLogger(__name__) @@ -22,6 +22,7 @@ def test_notebooks() -> None: @contextmanager def cwd(path): oldpwd = os.getcwd() + os.chdir(ROOT_DIRECTORY) os.chdir(path) try: yield diff --git a/tutorials/Classiq_tutorial/Qmod_tutorial_part1.ipynb b/tutorials/Classiq_tutorial/Qmod_tutorial_part1.ipynb index c4ed9a6d..213e6e65 100644 --- a/tutorials/Classiq_tutorial/Qmod_tutorial_part1.ipynb +++ b/tutorials/Classiq_tutorial/Qmod_tutorial_part1.ipynb @@ -233,8 +233,8 @@ "...\n", "\n", "# synthesize the model and show the result\n", - "model = create_model(main)\n", - "qprog = synthesize(model)\n", + "qmod = create_model(main)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] }, @@ -518,8 +518,8 @@ " my_hadamard_transform(q)\n", "\n", "\n", - "model = create_model(main)\n", - "qprog = synthesize(model)\n", + "qmod = create_model(main)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] }, @@ -555,8 +555,8 @@ " power(3, lambda: unitary(unitary_matrix, q))\n", "\n", "\n", - "model = create_model(main)\n", - "qprog = synthesize(model)\n", + "qmod = create_model(main)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] }, @@ -600,8 +600,8 @@ " my_hadamard_transform(q)\n", "\n", "\n", - "model = create_model(main)\n", - "qprog = synthesize(model)\n", + "qmod = create_model(main)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] }, @@ -641,8 +641,8 @@ " my_controlled_ry(control_bit, target)\n", "\n", "\n", - "model = create_model(main)\n", - "qprog = synthesize(model)\n", + "qmod = create_model(main)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] }, @@ -669,8 +669,8 @@ " control(x == 9, lambda: X(target))\n", "\n", "\n", - "model = create_model(main)\n", - "qprog = synthesize(model)\n", + "qmod = create_model(main)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] } diff --git a/tutorials/Classiq_tutorial/Qmod_tutorial_part2.ipynb b/tutorials/Classiq_tutorial/Qmod_tutorial_part2.ipynb index 886313a7..8dc10064 100644 --- a/tutorials/Classiq_tutorial/Qmod_tutorial_part2.ipynb +++ b/tutorials/Classiq_tutorial/Qmod_tutorial_part2.ipynb @@ -397,8 +397,8 @@ " bind([lsb, msb], res)\n", "\n", "\n", - "model = create_model(main)\n", - "qprog = synthesize(model)\n", + "qmod = create_model(main)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] }, @@ -508,8 +508,8 @@ " )\n", "\n", "\n", - "model = create_model(main)\n", - "qprog = synthesize(model)\n", + "qmod = create_model(main)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] }, @@ -550,8 +550,8 @@ " # res |= x * y - z\n", "\n", "\n", - "model = create_model(main)\n", - "qprog = synthesize(model)\n", + "qmod = create_model(main)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] }, @@ -581,8 +581,8 @@ " res |= x + y\n", "\n", "\n", - "model = create_model(main)\n", - "qprog = synthesize(model)\n", + "qmod = create_model(main)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] }, @@ -625,8 +625,8 @@ " )\n", "\n", "\n", - "model = create_model(main)\n", - "qprog = synthesize(model)\n", + "qmod = create_model(main)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] }, @@ -667,11 +667,11 @@ " res |= xyz + w\n", "\n", "\n", - "model = create_model(main)\n", - "model = set_constraints(\n", - " model, Constraints(optimization_parameter=OptimizationParameter.WIDTH)\n", + "qmod = create_model(main)\n", + "qmod = set_constraints(\n", + " qmod, Constraints(optimization_parameter=OptimizationParameter.WIDTH)\n", ")\n", - "qprog = synthesize(model)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] }, @@ -722,8 +722,8 @@ " )\n", "\n", "\n", - "model = create_model(main)\n", - "qprog = synthesize(model)\n", + "qmod = create_model(main)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] }, @@ -767,8 +767,8 @@ " bind([lsb, msb], res)\n", "\n", "\n", - "model = create_model(main)\n", - "qprog = synthesize(model)\n", + "qmod = create_model(main)\n", + "qprog = synthesize(qmod)\n", "show(qprog)" ] }