Skip to content

Commit

Permalink
add more bloq examples
Browse files Browse the repository at this point in the history
  • Loading branch information
anurudhp committed Mar 22, 2024
1 parent db1a412 commit 0d08279
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
28 changes: 26 additions & 2 deletions qualtran/bloqs/basic_gates/su2_rotation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,30 @@
"su2_rotation_gate = SU2RotationGate(np.pi / 4, np.pi / 2, np.pi / 2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7233599d",
"metadata": {
"cq.autogen": "SU2RotationGate.hadamard"
},
"outputs": [],
"source": [
"hadamard = SU2RotationGate(np.pi / 4, 0, 0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9f659e0d",
"metadata": {
"cq.autogen": "SU2RotationGate.t_gate"
},
"outputs": [],
"source": [
"t_gate = SU2RotationGate(0, 3 * np.pi / 4, 0)"
]
},
{
"cell_type": "markdown",
"id": "9a2820b5",
Expand All @@ -106,8 +130,8 @@
"outputs": [],
"source": [
"from qualtran.drawing import show_bloqs\n",
"show_bloqs([su2_rotation_gate],\n",
" ['`su2_rotation_gate`'])"
"show_bloqs([su2_rotation_gate, hadamard, t_gate],\n",
" ['`su2_rotation_gate`', '`hadamard`', '`t_gate`'])"
]
},
{
Expand Down
14 changes: 13 additions & 1 deletion qualtran/bloqs/basic_gates/su2_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,20 @@ def _su2_rotation_gate() -> SU2RotationGate:
return su2_rotation_gate


@bloq_example
def _hadamard() -> SU2RotationGate:
hadamard = SU2RotationGate(np.pi / 4, 0, 0)
return hadamard


@bloq_example
def _t_gate() -> SU2RotationGate:
t_gate = SU2RotationGate(0, 3 * np.pi / 4, 0)
return t_gate


_SU2_ROTATION_GATE_DOC = BloqDocSpec(
bloq_cls=SU2RotationGate,
import_line='from qualtran.bloqs.basic_gates import SU2RotationGate',
examples=[_su2_rotation_gate],
examples=[_su2_rotation_gate, _hadamard, _t_gate],
)

0 comments on commit 0d08279

Please sign in to comment.