-
Notifications
You must be signed in to change notification settings - Fork 349
Replacing existing spin_ops with the general operators #2710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4830bb4
b834f98
36097ff
94da283
3854090
61a9228
48a7ec8
f6e3630
322b8dd
fd7d1a2
a0c84af
604ffa7
21265e4
db7e756
3f87949
735f595
00036ba
b23343a
f2aa283
dda0eb8
e55849f
6afc0e1
b2692aa
f672373
ba301f2
9b15ccd
aafa774
81da29b
1614d8c
2a10655
9ff0f6f
e8860a0
124e624
3b79e84
6252869
1805556
a9cd155
c64f3a6
a6f2983
295770b
db54169
8415b17
83cd7dd
e141fd1
0bd41e2
0eea3dc
14f287a
d085084
b694a9b
631e8bb
66a1715
8fda12f
e830898
33dc4a3
5d3eb33
b5096d4
dbb16b4
975602b
ca899a3
4a2a5b7
18ca6b0
1819d4b
518ae29
a7c2f6e
6d00558
b1e21c6
438c0b5
8397d8a
b7e056d
67fdd36
974347d
08e682d
0114a74
81cbd9c
5d1d3c2
9c25c3b
828eab8
4ad9903
fd1d58d
237610d
1d0ea43
d088e0a
0668526
a762ef3
17a996c
38467f6
8da1cf7
f29b0f2
97256b8
c9aa9ba
ef586bb
beb3d4d
875cff0
6ae3e85
093ecf6
a264782
04d3515
4a2ace4
6d6baad
ce43284
23aed9b
76459e8
e897a2c
a45953f
cc25522
7dfe497
0f7c461
a412093
ba6a125
f599372
02fe66d
cac0163
d91ee6b
42d402f
0f7d82a
c9a234c
f48e4fa
a1043de
37fe1c7
34b5907
e5efc63
4a0814b
d733901
d0e0f5a
53ab777
c5c8ac7
55fc99d
e0cfd88
3c3e9f8
c1a97d7
9fb800a
e7bc5d5
c3f338b
c8a763d
4bc60bd
4913c3d
eae81cf
c822959
8763301
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| nvidia-mgpu-repo: cuda-quantum/cuquantum-mgpu.git | ||
| nvidia-mgpu-commit: ddfaacf2ffd7dc1a9a4333e06474b213887d437c | ||
| nvidia-mgpu-repo: cuda-quantum/cuquantum-mgpu.git | ||
| nvidia-mgpu-commit: 966ff7b2f775128fa3339e19672892d8ff1a4e74 |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -191,14 +191,14 @@ | |
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 17, | ||
| "execution_count": null, | ||
| "id": "heisenberg-code", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "def create_hamiltonian_heisenberg(n_spins: int, Jx: float, Jy: float, Jz: float, h_x: list[float], h_y: list[float], h_z: list[float]):\n", | ||
| " \"\"\"Create the Hamiltonian operator\"\"\"\n", | ||
| " ham = cudaq.SpinOperator(num_qubits=n_spins)\n", | ||
| " ham = 0\n", | ||
| "\n", | ||
| " # Add two-qubit interaction terms for Heisenberg Hamiltonian\n", | ||
| " for i in range(0, n_spins - 1):\n", | ||
|
|
@@ -221,14 +221,14 @@ | |
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 18, | ||
| "execution_count": null, | ||
| "id": "tfim-code", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "def create_hamiltonian_tfim(n_spins: int, h_field: float):\n", | ||
| " \"\"\"Create the Hamiltonian operator\"\"\"\n", | ||
| " ham = cudaq.SpinOperator(num_qubits=n_spins)\n", | ||
| " ham = 0\n", | ||
| " \n", | ||
| " # Add single-qubit terms\n", | ||
| " for i in range(0, n_spins):\n", | ||
|
|
@@ -253,19 +253,24 @@ | |
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 19, | ||
| "execution_count": null, | ||
| "id": "extract-code", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "def extractCoefficients(hamiltonian: cudaq.SpinOperator):\n", | ||
| " result = []\n", | ||
| " hamiltonian.for_each_term(lambda term: result.append(term.get_coefficient()))\n", | ||
| " for term in hamiltonian:\n", | ||
| " result.append(term.get_coefficient())\n", | ||
| " return result\n", | ||
| "\n", | ||
| "def extractWords(hamiltonian: cudaq.SpinOperator):\n", | ||
| " # Our kernel uses these words to apply exp_pauli to the entire state.\n", | ||
| " # we hence ensure that each pauli word covers the entire space.\n", | ||
| " n_spins = hamiltonian.get_qubit_count()\n", | ||
| " result = []\n", | ||
| " hamiltonian.for_each_term(lambda term: result.append(term.to_string(False)))\n", | ||
| " for term in hamiltonian:\n", | ||
| " result.append(term.get_pauli_word(n_spins))\n", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. General question about the Python notebooks and docs changes - right now most people that look at them are using the latest official release - are the changes in this PR will also work with 0.10? If not then I suggest to stage these changes until we have the next official release.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me double check, but I think these changes should work with 0.10.0; I largely had this PR ready prior to the 0.10.0 release, so everything that is not mitigation for deprecation should already be in 0.10.0. It was just too risky and too tight to pull it in in a way that is as nice as possible with regards to existing code. |
||
| " return result" | ||
| ] | ||
| }, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.