Skip to content

Commit 3fe756f

Browse files
committed
final update
1 parent c2239e8 commit 3fe756f

7 files changed

Lines changed: 5544 additions & 3533 deletions

File tree

doc/pub/week10/ipynb/week10.ipynb

Lines changed: 2179 additions & 3424 deletions
Large diffs are not rendered by default.

doc/src/week10/programs/.ipynb_checkpoints/lipkinvqe_qpe-checkpoint.ipynb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# VQE for Lipkin Model: Complete Working Implementation\n",
7+
"# VQE and QPE for Lipkin Model\n",
88
"\n",
9-
"This notebook implements **Variational Quantum Eigensolver (VQE)** for the Lipkin model using:\n",
9+
"We conclude by implementing the **Variational Quantum Eigensolver (VQE)** for the Lipkin model as well as the **Quantum Phase Estimation Algorithm (QPE)** using:\n",
1010
"- **3 qubits** to encode 5D quasi-spin space (j=2)\n",
1111
"- **Pauli decomposition** of the Hamiltonian\n",
1212
"- **Computational basis measurements** with proper basis rotations\n",
1313
"- **4-layer hardware-efficient ansatz** (24 parameters)\n",
1414
"\n",
1515
"\n",
16-
"- **Note well that this notebook does not have a VQE implementation with shots**"
16+
"- **Note well that this notebook does not have a VQE implementation with shots. Figures and analysis at the end was added using Claude Code**"
1717
]
1818
},
1919
{
2020
"cell_type": "markdown",
2121
"metadata": {},
2222
"source": [
23-
"## 1. Imports and Setup"
23+
"## Imports and Setup"
2424
]
2525
},
2626
{
@@ -53,7 +53,7 @@
5353
"cell_type": "markdown",
5454
"metadata": {},
5555
"source": [
56-
"## 2. Pauli Matrices and 3-Qubit Operators"
56+
"## Pauli Matrices and 3-Qubit Operators"
5757
]
5858
},
5959
{
@@ -97,7 +97,7 @@
9797
"cell_type": "markdown",
9898
"metadata": {},
9999
"source": [
100-
"## 3. Quantum Gates\n",
100+
"## Quantum Gates\n",
101101
"\n",
102102
"**Critical:** For Y measurements, we use **H·S†** rotation.\n",
103103
"\n",
@@ -156,7 +156,7 @@
156156
"cell_type": "markdown",
157157
"metadata": {},
158158
"source": [
159-
"## 4. State Encoding: j=2 Quasi-Spin to 3 Qubits\n",
159+
"## State Encoding: j=2 Quasi-Spin to 3 Qubits\n",
160160
"\n",
161161
"| Quasi-spin | Qubit State | Binary |\n",
162162
"|------------|-------------|--------|\n",
@@ -207,7 +207,7 @@
207207
"cell_type": "markdown",
208208
"metadata": {},
209209
"source": [
210-
"## 5. Lipkin Hamiltonian Construction\n",
210+
"## Lipkin Hamiltonian Construction\n",
211211
"\n",
212212
"$$H = \\frac{\\varepsilon}{2}\\left(J_z - \\frac{N}{2}\\right) + \\frac{V}{2}(J_+^2 + J_-^2) + \\frac{W}{2}J_z^2$$\n",
213213
"\n",
@@ -280,7 +280,7 @@
280280
"cell_type": "markdown",
281281
"metadata": {},
282282
"source": [
283-
"## 6. Exact Diagonalization"
283+
"## Exact Diagonalization"
284284
]
285285
},
286286
{
@@ -342,7 +342,7 @@
342342
"cell_type": "markdown",
343343
"metadata": {},
344344
"source": [
345-
"## 7. Pauli Decomposition"
345+
"## Pauli Decomposition"
346346
]
347347
},
348348
{
@@ -398,7 +398,7 @@
398398
"cell_type": "markdown",
399399
"metadata": {},
400400
"source": [
401-
"## 8. Computational Basis Measurements\n",
401+
"## Computational Basis Measurements\n",
402402
"\n",
403403
"**CRITICAL FIX:** Use H·S† for Y measurements!\n",
404404
"\n",
@@ -499,7 +499,7 @@
499499
"cell_type": "markdown",
500500
"metadata": {},
501501
"source": [
502-
"## 9. Hardware-Efficient Ansatz (4 Layers)\n",
502+
"## Hardware-Efficient Ansatz (4 Layers)\n",
503503
"\n",
504504
"Circuit structure per layer:\n",
505505
"- Ry rotations on all 3 qubits\n",
@@ -577,9 +577,9 @@
577577
"cell_type": "markdown",
578578
"metadata": {},
579579
"source": [
580-
"## 10. VQE with Exact Evaluation\n",
580+
"## VQE with Exact Evaluation\n",
581581
"\n",
582-
"Now we test VQE without shot noise to verify everything works. Note that we do not implement the VQE with shots"
582+
"Now we test VQE without shot noise to verify everything works. Note that we do not implement the VQE with shots."
583583
]
584584
},
585585
{
@@ -694,7 +694,7 @@
694694
"cell_type": "markdown",
695695
"metadata": {},
696696
"source": [
697-
"## 11. QPE Parameters and Phase Encoding"
697+
"## QPE Parameters and Phase Encoding"
698698
]
699699
},
700700
{
@@ -767,7 +767,7 @@
767767
"cell_type": "markdown",
768768
"metadata": {},
769769
"source": [
770-
"## 12. Quantum Fourier Transform and Controlled-$U^{2^k}$"
770+
"## Quantum Fourier Transform and Controlled-$U^{2^k}$"
771771
]
772772
},
773773
{
@@ -890,7 +890,7 @@
890890
"cell_type": "markdown",
891891
"metadata": {},
892892
"source": [
893-
"## 13. Full QPE Circuit"
893+
"## Full QPE Circuit"
894894
]
895895
},
896896
{
@@ -981,7 +981,7 @@
981981
"cell_type": "markdown",
982982
"metadata": {},
983983
"source": [
984-
"## 14. Run QPE — Three Trial States"
984+
"## Run QPE — Three Trial States"
985985
]
986986
},
987987
{
@@ -1100,7 +1100,7 @@
11001100
"cell_type": "markdown",
11011101
"metadata": {},
11021102
"source": [
1103-
"## 15. QPE Results — Visualisation"
1103+
"## QPE Results — Visualisation"
11041104
]
11051105
},
11061106
{
@@ -1197,7 +1197,7 @@
11971197
"cell_type": "markdown",
11981198
"metadata": {},
11991199
"source": [
1200-
"## 16. Quantum Fourier Transform — Detailed Verification"
1200+
"## Quantum Fourier Transform — Detailed Verification"
12011201
]
12021202
},
12031203
{

doc/src/week10/programs/.ipynb_checkpoints/qft_qpe_notebook-checkpoint.ipynb

Lines changed: 942 additions & 68 deletions
Large diffs are not rendered by default.

doc/src/week10/programs/.ipynb_checkpoints/week10-checkpoint.ipynb

Lines changed: 2380 additions & 0 deletions
Large diffs are not rendered by default.

doc/src/week10/programs/lipkinvqe_qpe.ipynb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# VQE for Lipkin Model: Complete Working Implementation\n",
7+
"# VQE and QPE for Lipkin Model\n",
88
"\n",
9-
"This notebook implements **Variational Quantum Eigensolver (VQE)** for the Lipkin model using:\n",
9+
"We conclude by implementing the **Variational Quantum Eigensolver (VQE)** for the Lipkin model as well as the **Quantum Phase Estimation Algorithm (QPE)** using:\n",
1010
"- **3 qubits** to encode 5D quasi-spin space (j=2)\n",
1111
"- **Pauli decomposition** of the Hamiltonian\n",
1212
"- **Computational basis measurements** with proper basis rotations\n",
1313
"- **4-layer hardware-efficient ansatz** (24 parameters)\n",
1414
"\n",
1515
"\n",
16-
"- **Note well that this notebook does not have a VQE implementation with shots**"
16+
"- **Note well that this notebook does not have a VQE implementation with shots. Figures and analysis at the end was added using Claude Code**"
1717
]
1818
},
1919
{
2020
"cell_type": "markdown",
2121
"metadata": {},
2222
"source": [
23-
"## 1. Imports and Setup"
23+
"## Imports and Setup"
2424
]
2525
},
2626
{
@@ -53,7 +53,7 @@
5353
"cell_type": "markdown",
5454
"metadata": {},
5555
"source": [
56-
"## 2. Pauli Matrices and 3-Qubit Operators"
56+
"## Pauli Matrices and 3-Qubit Operators"
5757
]
5858
},
5959
{
@@ -97,7 +97,7 @@
9797
"cell_type": "markdown",
9898
"metadata": {},
9999
"source": [
100-
"## 3. Quantum Gates\n",
100+
"## Quantum Gates\n",
101101
"\n",
102102
"**Critical:** For Y measurements, we use **H·S†** rotation.\n",
103103
"\n",
@@ -156,7 +156,7 @@
156156
"cell_type": "markdown",
157157
"metadata": {},
158158
"source": [
159-
"## 4. State Encoding: j=2 Quasi-Spin to 3 Qubits\n",
159+
"## State Encoding: j=2 Quasi-Spin to 3 Qubits\n",
160160
"\n",
161161
"| Quasi-spin | Qubit State | Binary |\n",
162162
"|------------|-------------|--------|\n",
@@ -207,7 +207,7 @@
207207
"cell_type": "markdown",
208208
"metadata": {},
209209
"source": [
210-
"## 5. Lipkin Hamiltonian Construction\n",
210+
"## Lipkin Hamiltonian Construction\n",
211211
"\n",
212212
"$$H = \\frac{\\varepsilon}{2}\\left(J_z - \\frac{N}{2}\\right) + \\frac{V}{2}(J_+^2 + J_-^2) + \\frac{W}{2}J_z^2$$\n",
213213
"\n",
@@ -280,7 +280,7 @@
280280
"cell_type": "markdown",
281281
"metadata": {},
282282
"source": [
283-
"## 6. Exact Diagonalization"
283+
"## Exact Diagonalization"
284284
]
285285
},
286286
{
@@ -342,7 +342,7 @@
342342
"cell_type": "markdown",
343343
"metadata": {},
344344
"source": [
345-
"## 7. Pauli Decomposition"
345+
"## Pauli Decomposition"
346346
]
347347
},
348348
{
@@ -398,7 +398,7 @@
398398
"cell_type": "markdown",
399399
"metadata": {},
400400
"source": [
401-
"## 8. Computational Basis Measurements\n",
401+
"## Computational Basis Measurements\n",
402402
"\n",
403403
"**CRITICAL FIX:** Use H·S† for Y measurements!\n",
404404
"\n",
@@ -499,7 +499,7 @@
499499
"cell_type": "markdown",
500500
"metadata": {},
501501
"source": [
502-
"## 9. Hardware-Efficient Ansatz (4 Layers)\n",
502+
"## Hardware-Efficient Ansatz (4 Layers)\n",
503503
"\n",
504504
"Circuit structure per layer:\n",
505505
"- Ry rotations on all 3 qubits\n",
@@ -577,9 +577,9 @@
577577
"cell_type": "markdown",
578578
"metadata": {},
579579
"source": [
580-
"## 10. VQE with Exact Evaluation\n",
580+
"## VQE with Exact Evaluation\n",
581581
"\n",
582-
"Now we test VQE without shot noise to verify everything works. Note that we do not implement the VQE with shots"
582+
"Now we test VQE without shot noise to verify everything works. Note that we do not implement the VQE with shots."
583583
]
584584
},
585585
{
@@ -694,7 +694,7 @@
694694
"cell_type": "markdown",
695695
"metadata": {},
696696
"source": [
697-
"## 11. QPE Parameters and Phase Encoding"
697+
"## QPE Parameters and Phase Encoding"
698698
]
699699
},
700700
{
@@ -767,7 +767,7 @@
767767
"cell_type": "markdown",
768768
"metadata": {},
769769
"source": [
770-
"## 12. Quantum Fourier Transform and Controlled-$U^{2^k}$"
770+
"## Quantum Fourier Transform and Controlled-$U^{2^k}$"
771771
]
772772
},
773773
{
@@ -890,7 +890,7 @@
890890
"cell_type": "markdown",
891891
"metadata": {},
892892
"source": [
893-
"## 13. Full QPE Circuit"
893+
"## Full QPE Circuit"
894894
]
895895
},
896896
{
@@ -981,7 +981,7 @@
981981
"cell_type": "markdown",
982982
"metadata": {},
983983
"source": [
984-
"## 14. Run QPE — Three Trial States"
984+
"## Run QPE — Three Trial States"
985985
]
986986
},
987987
{
@@ -1100,7 +1100,7 @@
11001100
"cell_type": "markdown",
11011101
"metadata": {},
11021102
"source": [
1103-
"## 15. QPE Results — Visualisation"
1103+
"## QPE Results — Visualisation"
11041104
]
11051105
},
11061106
{
@@ -1197,7 +1197,7 @@
11971197
"cell_type": "markdown",
11981198
"metadata": {},
11991199
"source": [
1200-
"## 16. Quantum Fourier Transform — Detailed Verification"
1200+
"## Quantum Fourier Transform — Detailed Verification"
12011201
]
12021202
},
12031203
{

doc/src/week10/programs/qft_qpe_notebook.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
"| 6 | Pauli Decomposition of 4×4 Matrices |\n",
2121
"| 7 | Quantum Phase Estimation Algorithm |\n",
2222
"| 8 | QPE Example: Eigenvalues of a 4×4 Hamiltonian |\n",
23-
"| 9 | Summary & Key Formulae |\n"
23+
"| 9 | Summary & Key Formulae |\n",
24+
"\n",
25+
"At the end of this notebook, you will also find a detailed comparison between the VQE and the QPE for the Lipkin model of project 1.\n"
2426
]
2527
},
2628
{
161 KB
Loading

0 commit comments

Comments
 (0)