Skip to content

Commit

Permalink
noncon graph as maximal graph problem!
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisRalli committed Feb 24, 2023
1 parent 96fb5a9 commit 3d48b3b
Show file tree
Hide file tree
Showing 7 changed files with 1,527 additions and 283 deletions.
6 changes: 3 additions & 3 deletions notebooks/1. Basic Usage/1.1 PauliwordOp usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a1dc01d0749c4e1cb4dded12dfbc4f86",
"model_id": "dccecb676dc64415ae2222f156069202",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -524,7 +524,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'scipy.sparse.csr.csr_matrix'>\n",
"<class 'scipy.sparse._csr.csr_matrix'>\n",
"[[5.+0.j 0.+0.j 0.+0.j 1.+0.j]\n",
" [0.+0.j 1.+0.j 1.+0.j 0.+0.j]\n",
" [0.+0.j 1.+0.j 1.+0.j 0.+0.j]\n",
Expand Down Expand Up @@ -708,7 +708,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.9.16"
}
},
"nbformat": 4,
Expand Down
286 changes: 135 additions & 151 deletions notebooks/1. Basic Usage/1.2 QuantumState usage.ipynb

Large diffs are not rendered by default.

172 changes: 86 additions & 86 deletions notebooks/1. Basic Usage/1.3 importing_hamiltonian_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,107 +57,107 @@
{
"data": {
"text/plain": [
"['C_STO-3G_TRIPLET_JW.json',\n",
" 'H2_6-31G_SINGLET_JW.json',\n",
" 'HCl_STO-3G_SINGLET_BK.json',\n",
" 'HeH+_6-311G_SINGLET_BK.json',\n",
" 'BeH2_STO-3G_SINGLET_JW.json',\n",
" 'NH4+_STO-3G_SINGLET_BK.json',\n",
" 'SiH4_STO-3G_SINGLET_JW.json',\n",
" 'LiOH_STO-3G_SINGLET_JW.json',\n",
" 'H2O_STO-3G_SINGLET_BK.json',\n",
" 'LiOH_STO-3G_SINGLET_BK.json',\n",
" 'OH-_STO-3G_SINGLET_BK.json',\n",
" 'Be_STO-3G_SINGLET_JW.json',\n",
" 'O2_STO-3G_TRIPLET_JW.json',\n",
" 'BeH+_STO-3G_SINGLET_BK.json',\n",
" 'H3+_3-21G_SINGLET_BK.json',\n",
" 'H3+_3-21G_SINGLET_JW.json',\n",
" 'H3+_STO-3G_SINGLET_JW.json',\n",
" 'HCN_STO-3G_SINGLET_JW.json',\n",
" 'H4_STO-3G_SINGLET_BK.json',\n",
" 'NH2-_STO-3G_SINGLET_BK.json',\n",
" 'LiH_STO-3G_SINGLET_JW.json',\n",
" 'CH2_STO-3G_TRIPLET_JW.json',\n",
" 'H6_STO-3G_SINGLET_JW.json',\n",
" 'H2O_STO-3G_SINGLET_JW.json',\n",
"['MgH2_STO-3G_SINGLET_BK.json',\n",
" 'Mg_STO-3G_SINGLET_JW.json',\n",
" 'HOOH_STO-3G_SINGLET_JW.json',\n",
" 'OH-_STO-3G_SINGLET_JW.json',\n",
" 'NaH_STO-3G_SINGLET_JW.json',\n",
" 'HCN_STO-3G_SINGLET_BK.json',\n",
" 'N2_STO-3G_SINGLET_BK.json',\n",
" 'B_STO-3G_DOUBLET_JW.json',\n",
" 'CH+_STO-3G_SINGLET_BK.json',\n",
" 'H2S_STO-3G_SINGLET_JW.json',\n",
" 'NH_STO-3G_SINGLET_JW.json',\n",
" 'LiOH_STO-3G_SINGLET_BK.json',\n",
" 'BH_STO-3G_SINGLET_BK.json',\n",
" 'HCl_STO-3G_SINGLET_JW.json',\n",
" 'CH2_STO-3G_TRIPLET_BK.json',\n",
" 'NaCl_STO-3G_SINGLET_BK.json',\n",
" 'F2_STO-3G_SINGLET_JW.json',\n",
" 'Be_STO-3G_SINGLET_BK.json',\n",
" 'LiH_3-21G_SINGLET_BK.json',\n",
" 'HeH+_6-311G_SINGLET_JW.json',\n",
" 'O2_STO-3G_TRIPLET_BK.json',\n",
" 'H2_6-31G_SINGLET_BK.json',\n",
" 'CH3OH_STO-3G_SINGLET_BK.json',\n",
" 'NH2-_STO-3G_SINGLET_BK.json',\n",
" 'H2_3-21G_SINGLET_BK.json',\n",
" 'BeH+_STO-3G_SINGLET_JW.json',\n",
" 'Li_STO-3G_DOUBLET_BK.json',\n",
" 'H6_STO-3G_SINGLET_BK.json',\n",
" 'NH_STO-3G_SINGLET_JW.json',\n",
" 'H2_6-31G_SINGLET_JW.json',\n",
" 'CH3OH_STO-3G_SINGLET_JW.json',\n",
" 'HF_3-21G_SINGLET_BK.json',\n",
" 'HeH+_3-21G_SINGLET_JW.json',\n",
" 'LiH_STO-3G_SINGLET_BK.json',\n",
" 'NaCl_STO-3G_SINGLET_BK.json',\n",
" 'N_STO-3G_QUARTET_BK.json',\n",
" 'B+_STO-3G_SINGLET_JW.json',\n",
" 'Li_STO-3G_DOUBLET_JW.json',\n",
" 'NaH_STO-3G_SINGLET_JW.json',\n",
" 'MgH2_STO-3G_SINGLET_BK.json',\n",
" 'NH_STO-3G_SINGLET_BK.json',\n",
" 'NH2-_STO-3G_SINGLET_JW.json',\n",
" 'H4_STO-3G_SINGLET_JW.json',\n",
" 'Mg_STO-3G_SINGLET_BK.json',\n",
" 'CH3OH_STO-3G_SINGLET_BK.json',\n",
" 'CO2_STO-3G_SINGLET_JW.json',\n",
" 'CH4_STO-3G_SINGLET_JW.json',\n",
" 'O2_STO-3G_TRIPLET_JW.json',\n",
" 'BeH+_STO-3G_SINGLET_BK.json',\n",
" 'H2_3-21G_SINGLET_JW.json',\n",
" 'Be_STO-3G_SINGLET_JW.json',\n",
" 'F2_STO-3G_SINGLET_BK.json',\n",
" 'HeH+_6-311G_SINGLET_BK.json',\n",
" 'LiH_3-21G_SINGLET_JW.json',\n",
" 'HCl_STO-3G_SINGLET_BK.json',\n",
" 'NaCl_STO-3G_SINGLET_JW.json',\n",
" 'H3+_STO-3G_SINGLET_BK.json',\n",
" 'NH3_STO-3G_SINGLET_JW.json',\n",
" 'OH-_STO-3G_SINGLET_JW.json',\n",
" 'H3O+_STO-3G_SINGLET_JW.json',\n",
" 'CH2_STO-3G_TRIPLET_JW.json',\n",
" 'NH_STO-3G_SINGLET_BK.json',\n",
" 'H2S_STO-3G_SINGLET_BK.json',\n",
" 'BH_STO-3G_SINGLET_JW.json',\n",
" 'HF_STO-3G_SINGLET_BK.json',\n",
" 'LiOH_STO-3G_SINGLET_JW.json',\n",
" 'HCN_STO-3G_SINGLET_JW.json',\n",
" 'CH+_STO-3G_SINGLET_JW.json',\n",
" 'N2_STO-3G_SINGLET_JW.json',\n",
" 'B_STO-3G_DOUBLET_BK.json',\n",
" 'OH-_STO-3G_SINGLET_BK.json',\n",
" 'NaH_STO-3G_SINGLET_BK.json',\n",
" 'O2_STO-3G_TRIPLET_BK.json',\n",
" 'CO2_STO-3G_SINGLET_BK.json',\n",
" 'HeH+_6-311G_SINGLET_JW.json',\n",
" 'N2_STO-3G_SINGLET_BK.json',\n",
" 'NeH+_STO-3G_SINGLET_BK.json',\n",
" 'C_STO-3G_TRIPLET_BK.json',\n",
" 'H2_6-311G_SINGLET_BK.json',\n",
" 'B_STO-3G_DOUBLET_JW.json',\n",
" 'BeH2_STO-3G_SINGLET_BK.json',\n",
" 'B+_STO-3G_SINGLET_BK.json',\n",
" 'HeH+_3-21G_SINGLET_BK.json',\n",
" 'HCN_STO-3G_SINGLET_BK.json',\n",
" 'N_STO-3G_QUARTET_JW.json',\n",
" 'HF_STO-3G_SINGLET_JW.json',\n",
" 'HOOH_STO-3G_SINGLET_BK.json',\n",
" 'CH+_STO-3G_SINGLET_JW.json',\n",
" 'CH4_STO-3G_SINGLET_BK.json',\n",
" 'H2S_STO-3G_SINGLET_BK.json',\n",
" 'Mg_STO-3G_SINGLET_BK.json',\n",
" 'MgH2_STO-3G_SINGLET_JW.json',\n",
" 'H3O+_STO-3G_SINGLET_BK.json',\n",
" 'CO_STO-3G_SINGLET_BK.json',\n",
" 'HeH+_3-21G_SINGLET_BK.json',\n",
" 'HF_3-21G_SINGLET_BK.json',\n",
" 'H3+_STO-3G_SINGLET_JW.json',\n",
" 'BeH2_STO-3G_SINGLET_JW.json',\n",
" 'CO2_STO-3G_SINGLET_JW.json',\n",
" 'H4_STO-3G_SINGLET_BK.json',\n",
" 'H3+_3-21G_SINGLET_BK.json',\n",
" 'HF_STO-3G_SINGLET_BK.json',\n",
" 'LiH_STO-3G_SINGLET_JW.json',\n",
" 'CH4_STO-3G_SINGLET_JW.json',\n",
" 'BH2+_STO-3G_SINGLET_JW.json',\n",
" 'Mg_STO-3G_SINGLET_JW.json',\n",
" 'B_STO-3G_DOUBLET_BK.json',\n",
" 'NH4+_STO-3G_SINGLET_JW.json',\n",
" 'H2_6-311G_SINGLET_JW.json',\n",
" 'F2_STO-3G_SINGLET_JW.json',\n",
" 'HF_3-21G_SINGLET_JW.json',\n",
" 'C_STO-3G_TRIPLET_JW.json',\n",
" 'H6_STO-3G_SINGLET_JW.json',\n",
" 'H2O_STO-3G_SINGLET_BK.json',\n",
" 'N_STO-3G_QUARTET_JW.json',\n",
" 'NH4+_STO-3G_SINGLET_BK.json',\n",
" 'NeH+_STO-3G_SINGLET_JW.json',\n",
" 'H3O+_STO-3G_SINGLET_BK.json',\n",
" 'O_STO-3G_TRIPLET_JW.json',\n",
" 'BH_STO-3G_SINGLET_BK.json',\n",
" 'H2_3-21G_SINGLET_JW.json',\n",
" 'HOOH_STO-3G_SINGLET_JW.json',\n",
" 'B+_STO-3G_SINGLET_JW.json',\n",
" 'Li_STO-3G_DOUBLET_BK.json',\n",
" 'H2_6-311G_SINGLET_BK.json',\n",
" 'SiH4_STO-3G_SINGLET_JW.json',\n",
" 'NH3_STO-3G_SINGLET_BK.json',\n",
" 'N2_STO-3G_SINGLET_JW.json',\n",
" 'LiH_3-21G_SINGLET_BK.json',\n",
" 'H2S_STO-3G_SINGLET_JW.json',\n",
" 'CO_STO-3G_SINGLET_BK.json',\n",
" 'Be_STO-3G_SINGLET_BK.json',\n",
" 'H2_3-21G_SINGLET_BK.json',\n",
" 'H2_6-31G_SINGLET_BK.json',\n",
" 'H2_6-311G_SINGLET_JW.json',\n",
" 'NH3_STO-3G_SINGLET_JW.json',\n",
" 'SiH4_STO-3G_SINGLET_BK.json',\n",
" 'NH4+_STO-3G_SINGLET_JW.json',\n",
" 'NeH+_STO-3G_SINGLET_BK.json',\n",
" 'B+_STO-3G_SINGLET_BK.json',\n",
" 'O_STO-3G_TRIPLET_JW.json',\n",
" 'Li_STO-3G_DOUBLET_JW.json',\n",
" 'H2O_STO-3G_SINGLET_JW.json',\n",
" 'N_STO-3G_QUARTET_BK.json',\n",
" 'BH2+_STO-3G_SINGLET_BK.json',\n",
" 'F2_STO-3G_SINGLET_BK.json',\n",
" 'CH4_STO-3G_SINGLET_BK.json',\n",
" 'H6_STO-3G_SINGLET_BK.json',\n",
" 'C_STO-3G_TRIPLET_BK.json',\n",
" 'H3+_3-21G_SINGLET_JW.json',\n",
" 'LiH_STO-3G_SINGLET_BK.json',\n",
" 'HF_STO-3G_SINGLET_JW.json',\n",
" 'H3+_STO-3G_SINGLET_BK.json',\n",
" 'H4_STO-3G_SINGLET_JW.json',\n",
" 'CO2_STO-3G_SINGLET_BK.json',\n",
" 'BeH2_STO-3G_SINGLET_BK.json',\n",
" 'CO_STO-3G_SINGLET_JW.json',\n",
" 'HCl_STO-3G_SINGLET_JW.json',\n",
" 'LiH_3-21G_SINGLET_JW.json']"
" 'H3O+_STO-3G_SINGLET_JW.json',\n",
" 'HeH+_3-21G_SINGLET_JW.json',\n",
" 'HF_3-21G_SINGLET_JW.json']"
]
},
"execution_count": 3,
Expand Down Expand Up @@ -661,7 +661,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.9.16"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@
"text": [
"The heisenberg Hamiltonian is\n",
"\n",
"-0.480+0.000j IIYY +\n",
"-0.480+0.000j IYYI +\n",
"-0.480+0.000j YYII +\n",
"-0.179+0.000j IIZZ +\n",
"-0.179+0.000j IZZI +\n",
"-0.179+0.000j ZZII +\n",
"-0.115+0.000j IIXX +\n",
"-0.115+0.000j IXXI +\n",
"-0.115+0.000j XXII\n",
"-0.398+0.000j IIXX +\n",
"-0.398+0.000j IXXI +\n",
"-0.398+0.000j XXII +\n",
"-0.355+0.000j IIZZ +\n",
"-0.355+0.000j IZZI +\n",
"-0.355+0.000j ZZII +\n",
"-0.037+0.000j IIYY +\n",
"-0.037+0.000j IYYI +\n",
"-0.037+0.000j YYII\n",
"\n",
"with ground state energy -1.4609414542131196 and corresponding eigenvector\n",
"with ground state energy -1.6208187405454877 and corresponding eigenvector\n",
"\n",
"-0.419+0.000j |0000> +\n",
" 0.376+0.000j |0011> +\n",
" 0.296+0.000j |0101> +\n",
" 0.308+0.000j |0110> +\n",
" 0.308+0.000j |1001> +\n",
" 0.296+0.000j |1010> +\n",
" 0.376+0.000j |1100> +\n",
"-0.419+0.000j |1111>\n"
" 0.575-0.000j |0000> +\n",
" 0.366+0.000j |0011> +\n",
" 0.109+0.000j |0101> +\n",
" 0.153+0.000j |0110> +\n",
" 0.153+0.000j |1001> +\n",
" 0.109+0.000j |1010> +\n",
" 0.366+0.000j |1100> +\n",
" 0.575+0.000j |1111>\n"
]
}
],
Expand Down Expand Up @@ -155,26 +155,26 @@
"text": [
"We rotate the Hamiltonian accordingly:\n",
"\n",
"-0.179+0.000j IIZZ +\n",
"-0.115+0.000j IIXX +\n",
"-0.480+0.000j IIYY +\n",
" 0.179-0.000j IXZI +\n",
" 0.115-0.000j IXXX +\n",
" 0.179-0.000j XIZZ +\n",
" 0.480-0.000j XIZX +\n",
" 0.115-0.000j XXIX +\n",
"-0.480+0.000j XXYY\n",
"-0.355+0.000j IIZZ +\n",
"-0.398+0.000j IIXX +\n",
"-0.037+0.000j IIYY +\n",
" 0.355-0.000j IXZI +\n",
" 0.398-0.000j IXXX +\n",
" 0.355-0.000j XIZZ +\n",
" 0.037-0.000j XIZX +\n",
" 0.398-0.000j XXIX +\n",
"-0.037+0.000j XXYY\n",
"\n",
"and observe that qubit positions [1 0] consist only of Pauli I, X operators.\n",
"\n",
"These may therefore be removed to yield a 2-qubit reduced Hamiltonian:\n",
"\n",
"-0.179+0.000j ZI +\n",
"-0.358+0.000j ZZ +\n",
" 0.115+0.000j IX +\n",
"-0.480+0.000j ZX +\n",
"-0.230+0.000j XX +\n",
"-0.961+0.000j YY\n"
"-0.355+0.000j ZI +\n",
"-0.710+0.000j ZZ +\n",
" 0.398+0.000j IX +\n",
"-0.037+0.000j ZX +\n",
"-0.797+0.000j XX +\n",
"-0.074+0.000j YY\n"
]
}
],
Expand Down Expand Up @@ -206,16 +206,16 @@
"name": "stdout",
"output_type": "stream",
"text": [
"The ground state energy of the Hamiltonian is -1.4609414542131196\n",
"and for the 2-qubit tapered Hamiltonian it is -1.460941454213121;\n",
"the energy error is 1.3322676295501878e-15.\n",
"The ground state energy of the Hamiltonian is -1.6208187405454877\n",
"and for the 2-qubit tapered Hamiltonian it is -1.6208187405454877;\n",
"the energy error is 0.0.\n",
"\n",
"The tapered ground state is:\n",
"\n",
"-0.593+0.000j |00> +\n",
"-0.436+0.000j |01> +\n",
"-0.418+0.000j |10> +\n",
" 0.532+0.000j |11>\n"
" 0.813-0.000j |00> +\n",
"-0.217+0.000j |01> +\n",
"-0.154+0.000j |10> +\n",
" 0.517+0.000j |11>\n"
]
}
],
Expand Down Expand Up @@ -262,7 +262,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.9.16"
},
"vscode": {
"interpreter": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.9.16"
},
"vscode": {
"interpreter": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.9.16"
},
"vscode": {
"interpreter": {
Expand Down
Loading

0 comments on commit 3d48b3b

Please sign in to comment.