|
4 | 4 | "cell_type": "markdown",
|
5 | 5 | "metadata": {},
|
6 | 6 | "source": [
|
7 |
| - "# Ground state energy estimation of a spin (qubit) Hamiltonian\n", |
| 7 | + "# Minimum eigenvalue estimation of a spin (qubit) Hamiltonian\n", |
8 | 8 | "\n",
|
9 |
| - "In this tutorial we implement a [Qiskit pattern](https://docs.quantum.ibm.com/guides/intro-to-patterns) showing how to post-process quantum samples to compute an approximation to the ground state of a ``22``-site XX-Z spin-1/2 chain and two-point correlators. We will follow a sample-based quantum diagonalization approach[[1]](https://arxiv.org/abs/2405.05068).\n", |
| 9 | + "In this tutorial we implement a [Qiskit pattern](https://docs.quantum.ibm.com/guides/intro-to-patterns) showing how to post-process quantum samples to approximate the minimum eigenvalue and spin-spin correlators for a ``22``-site XX-Z spin-1/2 chain. We will follow a sample-based quantum diagonalization approach [[1]](https://arxiv.org/abs/2405.05068).\n", |
10 | 10 | "\n",
|
11 | 11 | "While a Qiskit pattern typically involves 4 steps, the aim of this tutorial is to focus on the post-processing of the samples obtained from a quantum circuit whose support coincides with that of the ground state. Consequently, we generate a synthetic set of bitstrings to define the subspace and do not design an ansatz nor sample from a quantum circuit in this tutorial.\n",
|
12 | 12 | "\n",
|
|
20 | 20 | " - N/A: Will generate synthetic quantum samples\n",
|
21 | 21 | "4. **Step 4: Post-process results**\n",
|
22 | 22 | " - Project the Hamiltonian onto the subspace spanned by the samples\n",
|
23 |
| - " - Diagonalize the Hamiltonian in the subspace to approximate the ground state" |
| 23 | + " - Diagonalize the Hamiltonian in the subspace to approximate the ground state\n", |
| 24 | + " - Calculate spin-spin correlators for each site, $l$" |
24 | 25 | ]
|
25 | 26 | },
|
26 | 27 | {
|
|
39 | 40 | "of many-body Hamiltonians can be written as the linear combination of polynomially-many \n",
|
40 | 41 | "Pauli strings, including interacting-electron Hamiltonians, spin Hamiltonians, etc.\n",
|
41 | 42 | "\n",
|
42 |
| - "In particular, we consider the ground state properties of the antiferromagnetic XX-Z spin-1/2 chain\n", |
| 43 | + "In particular, we consider the properties of the antiferromagnetic XX-Z spin-1/2 chain\n", |
43 | 44 | "with $L = 22$ sites:\n",
|
44 | 45 | "$$\n",
|
45 | 46 | "H = \\sum_{\\langle i, j \\rangle} J_{xy}\\left( \\sigma^x_i\\sigma^x_j + \\sigma^y_i\\sigma^y_j \\right) + \\sigma^z_i\\sigma^z_j.\n",
|
|
231 | 232 | "from qiskit_addon_sqd.qubit import solve_qubit\n",
|
232 | 233 | "\n",
|
233 | 234 | "scipy_kwargs = {\"k\": 4, \"which\": \"SA\"}\n",
|
234 |
| - "energies, eigenstates = solve_qubit(bitstring_matrix, hamiltonian, verbose=True, **scipy_kwargs)\n", |
| 235 | + "eigenvals, eigenstates = solve_qubit(bitstring_matrix, hamiltonian, verbose=True, **scipy_kwargs)\n", |
235 | 236 | "\n",
|
236 |
| - "ground_state = eigenstates[:, 0]" |
| 237 | + "min_eval = eigenstates[:, 0]" |
237 | 238 | ]
|
238 | 239 | },
|
239 | 240 | {
|
|
250 | 251 | }
|
251 | 252 | ],
|
252 | 253 | "source": [
|
253 |
| - "print(energies)" |
| 254 | + "print(eigenvals)" |
254 | 255 | ]
|
255 | 256 | },
|
256 | 257 | {
|
|
296 | 297 | " pstr[i] = \"X\"\n",
|
297 | 298 | " pauli_op = SparsePauliOp(\"\".join(pstr))\n",
|
298 | 299 | " sparse_op = project_operator_to_subspace(bitstring_matrix, pauli_op)\n",
|
299 |
| - " s_x[i] += np.real(np.conjugate(ground_state).T @ sparse_op @ ground_state)\n", |
| 300 | + " s_x[i] += np.real(np.conjugate(min_eval).T @ sparse_op @ min_eval)\n", |
300 | 301 | "\n",
|
301 | 302 | " # Sigma_y\n",
|
302 | 303 | " pstr = [\"I\" for i in range(num_spins)]\n",
|
303 | 304 | " pstr[i] = \"Y\"\n",
|
304 | 305 | " pauli_op = SparsePauliOp(\"\".join(pstr))\n",
|
305 | 306 | " sparse_op = project_operator_to_subspace(bitstring_matrix, pauli_op)\n",
|
306 |
| - " s_y[i] += np.real(np.conjugate(ground_state).T @ sparse_op @ ground_state)\n", |
| 307 | + " s_y[i] += np.real(np.conjugate(min_eval).T @ sparse_op @ min_eval)\n", |
307 | 308 | "\n",
|
308 | 309 | " # Sigma_z\n",
|
309 | 310 | " pstr = [\"I\" for i in range(num_spins)]\n",
|
310 | 311 | " pstr[i] = \"Z\"\n",
|
311 | 312 | " pauli_op = SparsePauliOp(\"\".join(pstr))\n",
|
312 | 313 | " sparse_op = project_operator_to_subspace(bitstring_matrix, pauli_op)\n",
|
313 |
| - " s_z[i] += np.real(np.conjugate(ground_state).T @ sparse_op @ ground_state)" |
| 314 | + " s_z[i] += np.real(np.conjugate(min_eval).T @ sparse_op @ min_eval)" |
314 | 315 | ]
|
315 | 316 | },
|
316 | 317 | {
|
|
377 | 378 | " pauli_op = SparsePauliOp(\"\".join(pstr))\n",
|
378 | 379 | " sparse_op = project_operator_to_subspace(bitstring_matrix, pauli_op)\n",
|
379 | 380 | " c_x[distance - 1] += (\n",
|
380 |
| - " np.real(np.conjugate(ground_state).T @ sparse_op @ ground_state) - s_x[i] * s_x[j_wrap]\n", |
| 381 | + " np.real(np.conjugate(min_eval).T @ sparse_op @ min_eval) - s_x[i] * s_x[j_wrap]\n", |
381 | 382 | " )\n",
|
382 | 383 | "\n",
|
383 | 384 | " # Sigma_y Sigma_y\n",
|
|
387 | 388 | " pauli_op = SparsePauliOp(\"\".join(pstr))\n",
|
388 | 389 | " sparse_op = project_operator_to_subspace(bitstring_matrix, pauli_op)\n",
|
389 | 390 | " c_y[distance - 1] += (\n",
|
390 |
| - " np.real(np.conjugate(ground_state).T @ sparse_op @ ground_state) - s_y[i] * s_y[j_wrap]\n", |
| 391 | + " np.real(np.conjugate(min_eval).T @ sparse_op @ min_eval) - s_y[i] * s_y[j_wrap]\n", |
391 | 392 | " )\n",
|
392 | 393 | "\n",
|
393 | 394 | " # Sigma_z Sigma_z\n",
|
|
397 | 398 | " pauli_op = SparsePauliOp(\"\".join(pstr))\n",
|
398 | 399 | " sparse_op = project_operator_to_subspace(bitstring_matrix, pauli_op)\n",
|
399 | 400 | " c_z[distance - 1] += (\n",
|
400 |
| - " np.real(np.conjugate(ground_state).T @ sparse_op @ ground_state) - s_z[i] * s_z[j_wrap]\n", |
| 401 | + " np.real(np.conjugate(min_eval).T @ sparse_op @ min_eval) - s_z[i] * s_z[j_wrap]\n", |
401 | 402 | " )\n",
|
402 | 403 | "\n",
|
403 | 404 | " distance_counts[distance - 1] += 1\n",
|
|
0 commit comments