-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvements to
autogenerate-bloqs-notebooks-v2.py
(#796)
* Improvements to autogenerate-bloqs-notebooks-v2.py * Revert swap_network.ipynb * Revert changes to jupyter_autogen_v2.py
- Loading branch information
1 parent
370ccc4
commit 0db37a9
Showing
7 changed files
with
161 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "269cd713", | ||
"metadata": { | ||
"cq.autogen": "title_cell" | ||
}, | ||
"source": [ | ||
"# Hadamard" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a181241c", | ||
"metadata": { | ||
"cq.autogen": "top_imports" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from qualtran import Bloq, CompositeBloq, BloqBuilder, Signature, Register\n", | ||
"from qualtran.drawing import show_bloq, show_call_graph, show_counts_sigma\n", | ||
"from typing import *\n", | ||
"import numpy as np\n", | ||
"import sympy\n", | ||
"import cirq" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "51e3fa62", | ||
"metadata": { | ||
"cq.autogen": "Hadamard.bloq_doc.md" | ||
}, | ||
"source": [ | ||
"## `Hadamard`\n", | ||
"The Hadamard gate\n", | ||
"\n", | ||
"This converts between the X and Z basis.\n", | ||
"\n", | ||
"$$\\begin{aligned}\n", | ||
"H |0\\rangle = |+\\rangle \\\\\n", | ||
"H |-\\rangle = |1\\rangle\n", | ||
"\\end{aligned}$$\n", | ||
"\n", | ||
"#### Registers\n", | ||
" - `q`: The qubit\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d05cfd73", | ||
"metadata": { | ||
"cq.autogen": "Hadamard.bloq_doc.py" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from qualtran.bloqs.basic_gates import Hadamard" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "35b53a72", | ||
"metadata": { | ||
"cq.autogen": "Hadamard.example_instances.md" | ||
}, | ||
"source": [ | ||
"### Example Instances" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "39ebe976", | ||
"metadata": { | ||
"cq.autogen": "Hadamard.hadamard" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"hadamard = Hadamard()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "f19223de", | ||
"metadata": { | ||
"cq.autogen": "Hadamard.graphical_signature.md" | ||
}, | ||
"source": [ | ||
"#### Graphical Signature" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "92b60b87", | ||
"metadata": { | ||
"cq.autogen": "Hadamard.graphical_signature.py" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from qualtran.drawing import show_bloqs\n", | ||
"show_bloqs([hadamard],\n", | ||
" ['`hadamard`'])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "6dc303ab", | ||
"metadata": { | ||
"cq.autogen": "Hadamard.call_graph.md" | ||
}, | ||
"source": [ | ||
"### Call Graph" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "19f5aeb1", | ||
"metadata": { | ||
"cq.autogen": "Hadamard.call_graph.py" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"hadamard_g, hadamard_sigma = hadamard.call_graph()\n", | ||
"show_call_graph(hadamard_g)\n", | ||
"show_counts_sigma(hadamard_sigma)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters