Skip to content

Commit eb270bb

Browse files
authored
ionq ms gate params and pyqasm demos (#45)
* update readme, ionq ms gate params, and pyqasm demos * Update README.md
1 parent e739a7a commit eb270bb

File tree

5 files changed

+454
-87
lines changed

5 files changed

+454
-87
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This repository features tutorials and examples for the following:
1111

1212
- [**qBraid-SDK**](https://docs.qbraid.com/sdk/): Learn how to interact with quantum devices using the qBraid Runtime framework.
1313
- [**qBraid-QIR**](https://docs.qbraid.com/qir/): Explore qBraid's Quantum Intermediate Representation (QIR) interface using familiar frameworks like OpenQASM 3 and Cirq.
14+
- [**PyQASM**](https://docs.qbraid.com/pyqasm/): Discover new ways to integrate with OpenQASM, featuring methods for program validation, compilation, inlining, and unrolling.
1415
- [**qBraid-CLI**](https://docs.qbraid.com/cli/): Understand how to manage quantum jobs and resources using qBraid's Command Line Interface.
1516
- [**qBraid-Lab**](https://docs.qbraid.com/lab/) Integration:
1617
- [**Quantum Jobs**](https://docs.qbraid.com/lab/user-guide/quantum-jobs): Learn how to submit and manage quantum jobs in qBraid Lab.

pyqasm/deutsch_josza_unroll.ipynb

+54-11
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,29 @@
1919
},
2020
{
2121
"cell_type": "code",
22-
"execution_count": null,
22+
"execution_count": 1,
2323
"metadata": {},
24-
"outputs": [],
24+
"outputs": [
25+
{
26+
"data": {
27+
"text/plain": [
28+
"'0.1.0'"
29+
]
30+
},
31+
"execution_count": 1,
32+
"metadata": {},
33+
"output_type": "execute_result"
34+
}
35+
],
2536
"source": [
26-
"import pyqasm \n",
37+
"import pyqasm\n",
38+
"\n",
2739
"pyqasm.__version__"
2840
]
2941
},
3042
{
3143
"cell_type": "code",
32-
"execution_count": null,
44+
"execution_count": 2,
3345
"metadata": {},
3446
"outputs": [],
3547
"source": [
@@ -45,11 +57,10 @@
4557
},
4658
{
4759
"cell_type": "code",
48-
"execution_count": null,
60+
"execution_count": 3,
4961
"metadata": {},
5062
"outputs": [],
5163
"source": [
52-
"\n",
5364
"qasm = \"\"\"\n",
5465
"// A program containing the Deutsch-Josza algorithm in OpenQASM 3\n",
5566
"OPENQASM 3;\n",
@@ -106,19 +117,51 @@
106117
},
107118
{
108119
"cell_type": "code",
109-
"execution_count": null,
120+
"execution_count": 4,
110121
"metadata": {},
111122
"outputs": [],
112123
"source": [
113124
"program = loads(qasm)\n",
125+
"\n",
114126
"program.unroll()"
115127
]
116128
},
117129
{
118130
"cell_type": "code",
119-
"execution_count": null,
131+
"execution_count": 5,
120132
"metadata": {},
121-
"outputs": [],
133+
"outputs": [
134+
{
135+
"name": "stdout",
136+
"output_type": "stream",
137+
"text": [
138+
"OPENQASM 3.0;\n",
139+
"include \"stdgates.inc\";\n",
140+
"qubit[4] q;\n",
141+
"qubit[1] ancilla;\n",
142+
"x ancilla[0];\n",
143+
"h q[0];\n",
144+
"h q[1];\n",
145+
"h q[2];\n",
146+
"h q[3];\n",
147+
"h ancilla[0];\n",
148+
"cx q[0], ancilla[0];\n",
149+
"cx q[1], ancilla[0];\n",
150+
"cx q[2], ancilla[0];\n",
151+
"cx q[3], ancilla[0];\n",
152+
"h q[0];\n",
153+
"h q[1];\n",
154+
"h q[2];\n",
155+
"h q[3];\n",
156+
"bit[4] result;\n",
157+
"result[0] = measure q[0];\n",
158+
"result[1] = measure q[1];\n",
159+
"result[2] = measure q[2];\n",
160+
"result[3] = measure q[3];\n",
161+
"\n"
162+
]
163+
}
164+
],
122165
"source": [
123166
"print(dumps(program))"
124167
]
@@ -133,7 +176,7 @@
133176
],
134177
"metadata": {
135178
"kernelspec": {
136-
"display_name": "Python 3",
179+
"display_name": "sdk311",
137180
"language": "python",
138181
"name": "python3"
139182
},
@@ -147,7 +190,7 @@
147190
"name": "python",
148191
"nbconvert_exporter": "python",
149192
"pygments_lexer": "ipython3",
150-
"version": "3.11.6"
193+
"version": "3.11.9"
151194
}
152195
},
153196
"nbformat": 4,

0 commit comments

Comments
 (0)