Skip to content

Commit

Permalink
fixup notebook text
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 committed Jul 10, 2024
1 parent 17ff505 commit 6340ef1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
38 changes: 19 additions & 19 deletions tket2-py/examples/1-Getting-Started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "0c2a523d",
"metadata": {},
"outputs": [],
Expand All @@ -65,7 +65,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"id": "2896f51f",
"metadata": {},
"outputs": [],
Expand All @@ -91,13 +91,13 @@
"\n",
"### Using the commands-based builder\n",
"\n",
"The simplest way is to use the commands-based builder interface `CircuitBuild`.\n",
"It supports constructing pure circuits by listing a series of commands applied to specific qubits."
"The simplest way is to use the commands-based builder interface `CircBuild`.\n",
"It supports constructing circuits by listing a series of commands applied to specific qubits."
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "71f02038",
"metadata": {},
"outputs": [
Expand All @@ -122,10 +122,10 @@
"```"
],
"text/plain": [
"<Tk2Circuit at 0x111e94840>"
"<Tk2Circuit at 0x13c307d00>"
]
},
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -148,13 +148,13 @@
"source": [
"### Using the Dataflow Builder\n",
"\n",
"The Dataflow Builder is more flexible than `CircBuild`. It lets you connect arbitrary inputs and outputs to each operation.\n",
"`CircBuild` can also be used to build arbitrary dataflow graphs. It lets you connect arbitrary inputs and outputs to each operation.\n",
"This way, you can define circuits that read the same boolean multiple times, or allocate qubits dynamically."
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"id": "3e3c2ed0-892b-42d7-b5e8-1bc81970635b",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -188,10 +188,10 @@
"```"
],
"text/plain": [
"<Tk2Circuit at 0x10368e020>"
"<Tk2Circuit at 0x13af07bc0>"
]
},
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -207,7 +207,7 @@
"# We can get the wire for the single input qubit.\n",
"[q0] = builder.inputs()\n",
"\n",
"# And allocate a new qubit\n",
"# And allocate a new qubit, indexing the `Node` output gets the outgoing \"Wire\".\n",
"q1 = builder.add(QAlloc())[0]\n",
"\n",
"# Each operation returns the new wires it creates.\n",
Expand Down Expand Up @@ -241,7 +241,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 6,
"id": "0ffe2aed",
"metadata": {},
"outputs": [
Expand All @@ -262,7 +262,7 @@
"Requirement already satisfied: typing-extensions~=4.2 in /Users/seyon/ng/tket2proto/.venv/lib/python3.11/site-packages (from pytket) (4.12.2)\n",
"Requirement already satisfied: qwasm~=1.0 in /Users/seyon/ng/tket2proto/.venv/lib/python3.11/site-packages (from pytket) (1.0.1)\n",
"Requirement already satisfied: MarkupSafe>=2.0 in /Users/seyon/ng/tket2proto/.venv/lib/python3.11/site-packages (from jinja2~=3.0->pytket) (2.1.5)\n",
"Requirement already satisfied: setuptools in /Users/seyon/ng/tket2proto/.venv/lib/python3.11/site-packages (from qwasm~=1.0->pytket) (70.2.0)\n",
"Requirement already satisfied: setuptools in /Users/seyon/ng/tket2proto/.venv/lib/python3.11/site-packages (from qwasm~=1.0->pytket) (70.3.0)\n",
"Requirement already satisfied: mpmath<1.4,>=1.1.0 in /Users/seyon/ng/tket2proto/.venv/lib/python3.11/site-packages (from sympy~=1.6->pytket) (1.3.0)\n",
"\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.1.2\u001b[0m\n",
Expand All @@ -280,7 +280,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 7,
"id": "f47e0f2d",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -309,7 +309,7 @@
"\n",
"\n",
"\n",
" &lt;div id=&#34;circuit-display-vue-container-b74d63f9-7262-4b5b-af94-f157a996ee6a&#34; class=&#34;pytket-circuit-display-container&#34;&gt;\n",
" &lt;div id=&#34;circuit-display-vue-container-82bb2fe8-b3bd-4877-b794-00b36aacf879&#34; class=&#34;pytket-circuit-display-container&#34;&gt;\n",
" &lt;div style=&#34;display: none&#34;&gt;\n",
" &lt;div id=&#34;circuit-json-to-display&#34;&gt;{&#34;bits&#34;: [], &#34;commands&#34;: [{&#34;args&#34;: [[&#34;q&#34;, [0]]], &#34;op&#34;: {&#34;type&#34;: &#34;H&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [0]], [&#34;q&#34;, [1]]], &#34;op&#34;: {&#34;type&#34;: &#34;CX&#34;}}], &#34;created_qubits&#34;: [], &#34;discarded_qubits&#34;: [], &#34;implicit_permutation&#34;: [[[&#34;q&#34;, [0]], [&#34;q&#34;, [0]]], [[&#34;q&#34;, [1]], [&#34;q&#34;, [1]]]], &#34;phase&#34;: &#34;0.0&#34;, &#34;qubits&#34;: [[&#34;q&#34;, [0]], [&#34;q&#34;, [1]]]}&lt;/div&gt;\n",
" &lt;/div&gt;\n",
Expand All @@ -319,7 +319,7 @@
" &gt;&lt;/circuit-display-container&gt;\n",
" &lt;/div&gt;\n",
" &lt;script type=&#34;application/javascript&#34;&gt;\n",
" const circuitRendererUid = &#34;b74d63f9-7262-4b5b-af94-f157a996ee6a&#34;;\n",
" const circuitRendererUid = &#34;82bb2fe8-b3bd-4877-b794-00b36aacf879&#34;;\n",
" const displayOptions = JSON.parse(&#39;{}&#39;);\n",
"\n",
" // Script to initialise the circuit renderer app\n",
Expand Down Expand Up @@ -383,10 +383,10 @@
"```"
],
"text/plain": [
"<Tk2Circuit at 0x1160209f0>"
"<Tk2Circuit at 0x13c30f4e0>"
]
},
"execution_count": 9,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
26 changes: 13 additions & 13 deletions tket2-py/examples/2-Rewriting-Circuits.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -21,7 +21,7 @@
"from tket2.circuit import Tk2Circuit\n",
"from tket2.circuit.build import H, from_coms, CX, PauliX, PauliY, PauliZ, id_circ\n",
"from tket2.pattern import Rule, RuleMatcher\n",
"\n",
" \n",
"from pytket import Circuit as Tk1Circuit\n",
"from pytket.circuit.display import render_circuit_jupyter\n",
"\n",
Expand Down Expand Up @@ -51,7 +51,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -91,7 +91,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -126,7 +126,7 @@
"\n",
"\n",
"\n",
" &lt;div id=&#34;circuit-display-vue-container-dfde7757-c0a7-43ba-8879-7031c84a10b6&#34; class=&#34;pytket-circuit-display-container&#34;&gt;\n",
" &lt;div id=&#34;circuit-display-vue-container-0197cd96-d6e5-43b1-9bab-ab2e7418f357&#34; class=&#34;pytket-circuit-display-container&#34;&gt;\n",
" &lt;div style=&#34;display: none&#34;&gt;\n",
" &lt;div id=&#34;circuit-json-to-display&#34;&gt;{&#34;bits&#34;: [], &#34;commands&#34;: [{&#34;args&#34;: [[&#34;q&#34;, [1]], [&#34;q&#34;, [2]]], &#34;op&#34;: {&#34;type&#34;: &#34;CX&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [2]]], &#34;op&#34;: {&#34;params&#34;: [&#34;0.25&#34;], &#34;type&#34;: &#34;Rz&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [1]], [&#34;q&#34;, [2]]], &#34;op&#34;: {&#34;type&#34;: &#34;CX&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [0]], [&#34;q&#34;, [1]]], &#34;op&#34;: {&#34;type&#34;: &#34;CX&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [1]]], &#34;op&#34;: {&#34;params&#34;: [&#34;0.5&#34;], &#34;type&#34;: &#34;Rz&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [0]], [&#34;q&#34;, [1]]], &#34;op&#34;: {&#34;type&#34;: &#34;CX&#34;}}], &#34;created_qubits&#34;: [], &#34;discarded_qubits&#34;: [], &#34;implicit_permutation&#34;: [[[&#34;q&#34;, [0]], [&#34;q&#34;, [0]]], [[&#34;q&#34;, [1]], [&#34;q&#34;, [1]]], [[&#34;q&#34;, [2]], [&#34;q&#34;, [2]]]], &#34;phase&#34;: &#34;0.0&#34;, &#34;qubits&#34;: [[&#34;q&#34;, [0]], [&#34;q&#34;, [1]], [&#34;q&#34;, [2]]]}&lt;/div&gt;\n",
" &lt;/div&gt;\n",
Expand All @@ -136,7 +136,7 @@
" &gt;&lt;/circuit-display-container&gt;\n",
" &lt;/div&gt;\n",
" &lt;script type=&#34;application/javascript&#34;&gt;\n",
" const circuitRendererUid = &#34;dfde7757-c0a7-43ba-8879-7031c84a10b6&#34;;\n",
" const circuitRendererUid = &#34;0197cd96-d6e5-43b1-9bab-ab2e7418f357&#34;;\n",
" const displayOptions = JSON.parse(&#39;{}&#39;);\n",
"\n",
" // Script to initialise the circuit renderer app\n",
Expand Down Expand Up @@ -211,7 +211,7 @@
"\n",
"\n",
"\n",
" &lt;div id=&#34;circuit-display-vue-container-119adc8d-a900-4a1d-9b31-d35826719d7a&#34; class=&#34;pytket-circuit-display-container&#34;&gt;\n",
" &lt;div id=&#34;circuit-display-vue-container-218e3858-bc07-490d-9e85-504575ba4d33&#34; class=&#34;pytket-circuit-display-container&#34;&gt;\n",
" &lt;div style=&#34;display: none&#34;&gt;\n",
" &lt;div id=&#34;circuit-json-to-display&#34;&gt;{&#34;bits&#34;: [], &#34;commands&#34;: [{&#34;args&#34;: [[&#34;q&#34;, [1]], [&#34;q&#34;, [2]]], &#34;op&#34;: {&#34;params&#34;: [&#34;0.25&#34;], &#34;type&#34;: &#34;ZZPhase&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [0]], [&#34;q&#34;, [1]]], &#34;op&#34;: {&#34;params&#34;: [&#34;0.5&#34;], &#34;type&#34;: &#34;ZZPhase&#34;}}], &#34;created_qubits&#34;: [], &#34;discarded_qubits&#34;: [], &#34;implicit_permutation&#34;: [[[&#34;q&#34;, [0]], [&#34;q&#34;, [0]]], [[&#34;q&#34;, [1]], [&#34;q&#34;, [1]]], [[&#34;q&#34;, [2]], [&#34;q&#34;, [2]]]], &#34;phase&#34;: &#34;0.0&#34;, &#34;qubits&#34;: [[&#34;q&#34;, [0]], [&#34;q&#34;, [1]], [&#34;q&#34;, [2]]]}&lt;/div&gt;\n",
" &lt;/div&gt;\n",
Expand All @@ -221,7 +221,7 @@
" &gt;&lt;/circuit-display-container&gt;\n",
" &lt;/div&gt;\n",
" &lt;script type=&#34;application/javascript&#34;&gt;\n",
" const circuitRendererUid = &#34;119adc8d-a900-4a1d-9b31-d35826719d7a&#34;;\n",
" const circuitRendererUid = &#34;218e3858-bc07-490d-9e85-504575ba4d33&#34;;\n",
" const displayOptions = JSON.parse(&#39;{}&#39;);\n",
"\n",
" // Script to initialise the circuit renderer app\n",
Expand Down Expand Up @@ -289,7 +289,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -324,7 +324,7 @@
"\n",
"\n",
"\n",
" &lt;div id=&#34;circuit-display-vue-container-c344a50d-756e-41ee-b0be-462426c9f10e&#34; class=&#34;pytket-circuit-display-container&#34;&gt;\n",
" &lt;div id=&#34;circuit-display-vue-container-2c68e63a-7b61-4310-ad7c-6c082f581fe8&#34; class=&#34;pytket-circuit-display-container&#34;&gt;\n",
" &lt;div style=&#34;display: none&#34;&gt;\n",
" &lt;div id=&#34;circuit-json-to-display&#34;&gt;{&#34;bits&#34;: [], &#34;commands&#34;: [{&#34;args&#34;: [[&#34;q&#34;, [0]]], &#34;op&#34;: {&#34;params&#34;: [&#34;3.5&#34;], &#34;type&#34;: &#34;Rx&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [1]], [&#34;q&#34;, [2]]], &#34;op&#34;: {&#34;params&#34;: [&#34;0.25&#34;], &#34;type&#34;: &#34;ZZPhase&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [0]]], &#34;op&#34;: {&#34;params&#34;: [&#34;1.5&#34;], &#34;type&#34;: &#34;Rz&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [1]]], &#34;op&#34;: {&#34;params&#34;: [&#34;0.5&#34;], &#34;type&#34;: &#34;Rz&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [1]], [&#34;q&#34;, [0]]], &#34;op&#34;: {&#34;type&#34;: &#34;CX&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [0]]], &#34;op&#34;: {&#34;params&#34;: [&#34;0.5&#34;], &#34;type&#34;: &#34;Rz&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [0]]], &#34;op&#34;: {&#34;params&#34;: [&#34;0.5&#34;], &#34;type&#34;: &#34;Rx&#34;}}, {&#34;args&#34;: [[&#34;q&#34;, [0]]], &#34;op&#34;: {&#34;params&#34;: [&#34;0.5&#34;], &#34;type&#34;: &#34;Rz&#34;}}], &#34;created_qubits&#34;: [], &#34;discarded_qubits&#34;: [], &#34;implicit_permutation&#34;: [[[&#34;q&#34;, [0]], [&#34;q&#34;, [0]]], [[&#34;q&#34;, [1]], [&#34;q&#34;, [1]]], [[&#34;q&#34;, [2]], [&#34;q&#34;, [2]]]], &#34;phase&#34;: &#34;0.0&#34;, &#34;qubits&#34;: [[&#34;q&#34;, [0]], [&#34;q&#34;, [1]], [&#34;q&#34;, [2]]]}&lt;/div&gt;\n",
" &lt;/div&gt;\n",
Expand All @@ -334,7 +334,7 @@
" &gt;&lt;/circuit-display-container&gt;\n",
" &lt;/div&gt;\n",
" &lt;script type=&#34;application/javascript&#34;&gt;\n",
" const circuitRendererUid = &#34;c344a50d-756e-41ee-b0be-462426c9f10e&#34;;\n",
" const circuitRendererUid = &#34;2c68e63a-7b61-4310-ad7c-6c082f581fe8&#34;;\n",
" const displayOptions = JSON.parse(&#39;{}&#39;);\n",
"\n",
" // Script to initialise the circuit renderer app\n",
Expand Down Expand Up @@ -861,7 +861,7 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -879,5 +879,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}

0 comments on commit 6340ef1

Please sign in to comment.