Skip to content

Commit 0426c7e

Browse files
committed
Update the tutorials to latest Qiskit ecosystem and IBM hardware
1 parent 6aeca2b commit 0426c7e

8 files changed

+263
-246
lines changed

requirements.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ pylatexenc>=2.10
44
pandas>=2.2.2
55
scipy
66
tqdm
7+
sympy
78
treelib>=1.7.0
8-
qiskit>=1.3.0
9-
qiskit-aer>=0.14.2
10-
qiskit-ibm-runtime>=0.33.2
11-
qiskit-experiments>=0.10.0
9+
qiskit>=2.1.2
10+
qiskit-aer>=0.17.1
11+
qiskit-ibm-runtime>=0.41.1
12+
qiskit-experiments>=0.12.0
1213
mthree==3.0.0

setup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
'scipy',
2727
'dill',
2828
'tqdm',
29+
'sympy',
2930
'treelib>=1.7.0',
30-
'qiskit>=1.3.0',
31-
'qiskit-aer>=0.14.2',
32-
'qiskit-ibm-runtime>=0.33.2',
33-
'qiskit-experiments>=0.10.0',
31+
'qiskit>=2.1.2',
32+
'qiskit-aer>=0.17.1',
33+
'qiskit-ibm-runtime>=0.41.1',
34+
'qiskit-experiments>=0.12.0',
3435
'mthree==3.0.0',
3536
],
3637
extras_require={

test.ipynb

Whitespace-only changes.

tutorials/01_full_quantum_state_tomography.ipynb

Lines changed: 122 additions & 121 deletions
Large diffs are not rendered by default.

tutorials/02a_hadamard_random_forest _simulation.ipynb

Lines changed: 44 additions & 46 deletions
Large diffs are not rendered by default.

tutorials/03a_estimate_entanglement.ipynb

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
},
3030
{
3131
"cell_type": "code",
32-
"execution_count": 3,
32+
"execution_count": 1,
3333
"id": "bb7d11b2-68ee-4d44-82e0-d33c35046604",
3434
"metadata": {},
3535
"outputs": [
3636
{
3737
"name": "stdout",
3838
"output_type": "stream",
3939
"text": [
40-
"Logarithmic Negativity (exact) = 4.4847971053408774e-15\n"
40+
"Logarithmic Negativity (exact) = 4.164454454959387e-15\n"
4141
]
4242
}
4343
],
@@ -67,7 +67,7 @@
6767
},
6868
{
6969
"cell_type": "code",
70-
"execution_count": 4,
70+
"execution_count": 2,
7171
"id": "eec8ffe0-b606-490c-9bc9-f4a51401ec06",
7272
"metadata": {},
7373
"outputs": [
@@ -103,7 +103,7 @@
103103
},
104104
{
105105
"cell_type": "code",
106-
"execution_count": 8,
106+
"execution_count": 3,
107107
"id": "b9558a22-4bd0-4c87-b776-193cd0a18a14",
108108
"metadata": {},
109109
"outputs": [],
@@ -116,7 +116,7 @@
116116
},
117117
{
118118
"cell_type": "code",
119-
"execution_count": 10,
119+
"execution_count": 4,
120120
"id": "4e2e900f-d996-4fb5-b259-32fba56e1974",
121121
"metadata": {},
122122
"outputs": [],
@@ -130,7 +130,7 @@
130130
},
131131
{
132132
"cell_type": "code",
133-
"execution_count": 19,
133+
"execution_count": 5,
134134
"id": "e8059915-ea72-48ee-b51b-5f2a4e84b651",
135135
"metadata": {},
136136
"outputs": [
@@ -140,22 +140,22 @@
140140
"text": [
141141
"=================================== Simulate 2-qubit =========================================\n",
142142
"Logarithmic Negativity (exact) = 0.4607085373250065\n",
143-
"Logarithmic Negativity (HRF) = 0.5037943745848781\n",
143+
"Logarithmic Negativity (HRF) = 0.5023735774657798\n",
144144
"=================================== Simulate 4-qubit =========================================\n",
145145
"Logarithmic Negativity (exact) = 0.844756958281152\n",
146-
"Logarithmic Negativity (HRF) = 0.8540890214338566\n",
146+
"Logarithmic Negativity (HRF) = 0.8590883068910752\n",
147147
"=================================== Simulate 6-qubit =========================================\n",
148148
"Logarithmic Negativity (exact) = 1.6779210392164574\n",
149-
"Logarithmic Negativity (HRF) = 1.6878049433906073\n",
149+
"Logarithmic Negativity (HRF) = 1.7173906754959771\n",
150150
"=================================== Simulate 8-qubit =========================================\n",
151151
"Logarithmic Negativity (exact) = 2.297051063765075\n",
152-
"Logarithmic Negativity (HRF) = 2.370611767843103\n"
152+
"Logarithmic Negativity (HRF) = 2.3877043577478925\n"
153153
]
154154
}
155155
],
156156
"source": [
157157
"import math\n",
158-
"from qiskit.circuit.library import RealAmplitudes\n",
158+
"from qiskit.circuit.library import real_amplitudes\n",
159159
"from qiskit.quantum_info import Statevector, state_fidelity, DensityMatrix\n",
160160
"import hadamard_random_forest as hrf\n",
161161
"\n",
@@ -168,7 +168,7 @@
168168
"\n",
169169
"for num_qubits in range(2, 9, 2):\n",
170170
" print(f\"=================================== Simulate {num_qubits}-qubit =========================================\")\n",
171-
" ansatz = RealAmplitudes(num_qubits, entanglement='pairwise', reps=num_layers, insert_barriers=True, skip_final_rotation_layer=True)\n",
171+
" ansatz = real_amplitudes(num_qubits, entanglement='pairwise', reps=num_layers, insert_barriers=True, skip_final_rotation_layer=True)\n",
172172
" params = loaded_param['parameter'][(num_qubits, num_layers)][0] \n",
173173
" list_circuits = hrf.get_circuits(num_qubits, ansatz)\n",
174174
"\n",
@@ -212,16 +212,17 @@
212212
},
213213
{
214214
"cell_type": "code",
215-
"execution_count": 7,
215+
"execution_count": 1,
216216
"id": "b56946c6-13a3-483c-b985-52f670ea28a4",
217217
"metadata": {},
218218
"outputs": [
219219
{
220220
"name": "stdout",
221221
"output_type": "stream",
222222
"text": [
223-
"Qiskit: 2.0.0\n",
224-
"Qiskit Aer: 0.17.0\n",
223+
"Qiskit: 2.1.2\n",
224+
"Qiskit Aer: 0.17.1\n",
225+
"Qiskit IBM Runtime: 0.41.1\n",
225226
"Mthree error mitigation: 3.0.0\n"
226227
]
227228
}
@@ -249,7 +250,7 @@
249250
],
250251
"metadata": {
251252
"kernelspec": {
252-
"display_name": "Python 3 (ipykernel)",
253+
"display_name": "qenv (3.9.13)",
253254
"language": "python",
254255
"name": "python3"
255256
},
@@ -263,7 +264,7 @@
263264
"name": "python",
264265
"nbconvert_exporter": "python",
265266
"pygments_lexer": "ipython3",
266-
"version": "3.10.14"
267+
"version": "3.11.13"
267268
}
268269
},
269270
"nbformat": 4,

tutorials/03b_estimate_magic.ipynb

Lines changed: 35 additions & 27 deletions
Large diffs are not rendered by default.

tutorials/03c_estimate_state_overlap.ipynb

Lines changed: 34 additions & 27 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)