Skip to content
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

Code cleanup + Bugfix #63

Merged
merged 5 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![pylint](https://img.shields.io/badge/PyLint-9.24-yellow?logo=python&logoColor=white)
![pylint](https://img.shields.io/badge/PyLint-9.15-yellow?logo=python&logoColor=white)

# Quantum Computing Application Specifications

Expand Down
8 changes: 4 additions & 4 deletions notebooks/ExoticPhasesExample.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@
"source": [
"energy_precision = 1e-3\n",
"evolution_time=100\n",
"numsteps=68"
"nsteps=68"
]
},
{
Expand All @@ -547,7 +547,7 @@
" outdir='trotter/triangular_heisenberg/',\n",
" hamiltonian_name='triangular_heisenberg',\n",
" write_circuits=True,\n",
" nsteps=numsteps\n",
" nsteps=nsteps\n",
")"
]
},
Expand All @@ -561,7 +561,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "qc-apps",
"display_name": "qca",
"language": "python",
"name": "python3"
},
Expand All @@ -575,7 +575,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.10"
"version": "3.12.0"
}
},
"nbformat": 4,
Expand Down
148 changes: 72 additions & 76 deletions notebooks/HighTemperatureSuperConductorExample.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,7 @@
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/gsgrattan/.conda/envs/qc-apps/lib/python3.11/site-packages/cotengra/hyperoptimizers/hyper.py:33: UserWarning: Couldn't import `kahypar` - skipping from default hyper optimizer and using basic `labels` method instead.\n",
" warnings.warn(\n"
]
}
],
"outputs": [],
"source": [
"import time\n",
"\n",
Expand Down Expand Up @@ -160,8 +151,8 @@
" category='scientific',\n",
" size=f'{n}x{n}',\n",
" task='Ground State Energy Estimation',\n",
"\n",
" evolution_time=t_one_band,\n",
" is_extrapolated=True,\n",
" trotter_order=trotter_order_one_band,\n",
" bits_precision=bits_precision_one_band,\n",
" nsteps=trotter_steps_one_band,\n",
Expand All @@ -188,18 +179,18 @@
"output_type": "stream",
"text": [
"Estimating one_band\n",
"Time to generate circuit for GSEE: 7.358298171311617e-05 seconds\n",
" Time to decompose high level HPowGate circuit: 0.0002579170395620167 seconds \n",
" Time to transform decomposed HPowGate circuit to Clifford+T: 0.00040374998934566975 seconds\n",
" Time to decompose high level IdentityGate circuit: 2.0458013750612736e-05 seconds \n",
" Time to transform decomposed IdentityGate circuit to Clifford+T: 9.665964171290398e-06 seconds\n",
" Time to decompose high level PhaseOffset circuit: 9.662494994699955e-05 seconds \n",
" Time to transform decomposed PhaseOffset circuit to Clifford+T: 0.0001105000264942646 seconds\n",
" Time to decompose high level Trotter_Unitary circuit: 0.0451331670046784 seconds \n",
" Time to transform decomposed Trotter_Unitary circuit to Clifford+T: 0.3732286249869503 seconds\n",
" Time to decompose high level MeasurementGate circuit: 0.0001948749995790422 seconds \n",
" Time to transform decomposed MeasurementGate circuit to Clifford+T: 3.7833990063518286e-05 seconds\n",
"Time to estimate one_band: 0.7837549999821931\n"
"Time to generate circuit for GSEE: 8.829217404127121e-05 seconds\n",
" Time to decompose high level HPowGate circuit: 0.0002071247436106205 seconds \n",
" Time to transform decomposed HPowGate circuit to Clifford+T: 0.0005226251669228077 seconds\n",
" Time to decompose high level IdentityGate circuit: 1.4707911759614944e-05 seconds \n",
" Time to transform decomposed IdentityGate circuit to Clifford+T: 4.082918167114258e-06 seconds\n",
" Time to decompose high level PhaseOffset circuit: 8.604209870100021e-05 seconds \n",
" Time to transform decomposed PhaseOffset circuit to Clifford+T: 0.00012337509542703629 seconds\n",
" Time to decompose high level Trotter_Unitary circuit: 0.08032337483018637 seconds \n",
" Time to transform decomposed Trotter_Unitary circuit to Clifford+T: 0.27045220835134387 seconds\n",
" Time to decompose high level MeasurementGate circuit: 0.000187666155397892 seconds \n",
" Time to transform decomposed MeasurementGate circuit to Clifford+T: 4.083290696144104e-05 seconds\n",
"Time to estimate one_band: 0.6402935408987105\n"
]
}
],
Expand All @@ -216,6 +207,7 @@
" phase_offset=one_band_phase_offset,\n",
" circuit_name='one_band',\n",
" metadata=one_band_metadata,\n",
" include_nested_resources=True,\n",
" write_circuits=True\n",
")\n",
"t1 = time.perf_counter()\n",
Expand Down Expand Up @@ -513,12 +505,11 @@
" category='scientific',\n",
" size=f'{6}x{7}',\n",
" task='Ground State Energy Estimation',\n",
"\n",
" evolution_time=t_current_limit,\n",
" is_extrapolated=True,\n",
" trotter_order=trotter_order_current_limit,\n",
" bits_precision=bits_precision_current_limit,\n",
" nsteps=trotter_steps_current_limit,\n",
"\n",
")\n",
"\n",
"metadata_ideal = GSEEMetaData(\n",
Expand All @@ -531,7 +522,6 @@
" trotter_order=trotter_order_ideal,\n",
" bits_precision=bits_precision_ideal,\n",
" nsteps=trotter_steps_ideal,\n",
"\n",
")"
]
},
Expand All @@ -545,31 +535,31 @@
"output_type": "stream",
"text": [
"Estimating Current Limit\n",
"Time to generate circuit for GSEE: 9.895797120407224e-05 seconds\n",
" Time to decompose high level HPowGate circuit: 0.0002941249986179173 seconds \n",
" Time to transform decomposed HPowGate circuit to Clifford+T: 0.0009380419505760074 seconds\n",
" Time to decompose high level IdentityGate circuit: 1.6625039279460907e-05 seconds \n",
" Time to transform decomposed IdentityGate circuit to Clifford+T: 4.499976057559252e-06 seconds\n",
" Time to decompose high level PhaseOffset circuit: 8.404103573411703e-05 seconds \n",
" Time to transform decomposed PhaseOffset circuit to Clifford+T: 0.00010008300887420774 seconds\n",
" Time to decompose high level Trotter_Unitary circuit: 0.25881625001784414 seconds \n",
" Time to transform decomposed Trotter_Unitary circuit to Clifford+T: 0.9029138330370188 seconds\n",
" Time to decompose high level MeasurementGate circuit: 0.001000499993097037 seconds \n",
" Time to transform decomposed MeasurementGate circuit to Clifford+T: 4.299997817724943e-05 seconds\n",
"Time to estimate Current Limit: 2.4191256249905564\n",
"Time to generate circuit for GSEE: 3.21660190820694e-05 seconds\n",
" Time to decompose high level HPowGate circuit: 0.00010754214599728584 seconds \n",
" Time to transform decomposed HPowGate circuit to Clifford+T: 0.00019329087808728218 seconds\n",
" Time to decompose high level IdentityGate circuit: 1.3499986380338669e-05 seconds \n",
" Time to transform decomposed IdentityGate circuit to Clifford+T: 3.708992153406143e-06 seconds\n",
" Time to decompose high level PhaseOffset circuit: 7.729092612862587e-05 seconds \n",
" Time to transform decomposed PhaseOffset circuit to Clifford+T: 8.945818990468979e-05 seconds\n",
" Time to decompose high level Trotter_Unitary circuit: 0.1907161669805646 seconds \n",
" Time to transform decomposed Trotter_Unitary circuit to Clifford+T: 0.922632624860853 seconds\n",
" Time to decompose high level MeasurementGate circuit: 0.0007120422087609768 seconds \n",
" Time to transform decomposed MeasurementGate circuit to Clifford+T: 4.1250139474868774e-05 seconds\n",
"Time to estimate Current Limit: 2.1353615829721093\n",
"Estimating Ideal\n",
"Time to generate circuit for GSEE: 3.4584023524075747e-05 seconds\n",
" Time to decompose high level HPowGate circuit: 6.941700121387839e-05 seconds \n",
" Time to transform decomposed HPowGate circuit to Clifford+T: 9.016698459163308e-05 seconds\n",
" Time to decompose high level IdentityGate circuit: 1.0707997716963291e-05 seconds \n",
" Time to transform decomposed IdentityGate circuit to Clifford+T: 3.5830307751893997e-06 seconds\n",
" Time to decompose high level PhaseOffset circuit: 7.508299313485622e-05 seconds \n",
" Time to transform decomposed PhaseOffset circuit to Clifford+T: 3.8833997678011656e-05 seconds\n",
" Time to decompose high level Trotter_Unitary circuit: 0.27210870798444375 seconds \n",
" Time to transform decomposed Trotter_Unitary circuit to Clifford+T: 0.6658007500227541 seconds\n",
" Time to decompose high level MeasurementGate circuit: 0.0008316660532727838 seconds \n",
" Time to transform decomposed MeasurementGate circuit to Clifford+T: 4.2208004742860794e-05 seconds\n",
"Time to estimate Ideal: 2.424980083014816\n"
"Time to generate circuit for GSEE: 2.8833281248807907e-05 seconds\n",
" Time to decompose high level HPowGate circuit: 6.658397614955902e-05 seconds \n",
" Time to transform decomposed HPowGate circuit to Clifford+T: 7.66250304877758e-05 seconds\n",
" Time to decompose high level IdentityGate circuit: 1.0250136256217957e-05 seconds \n",
" Time to transform decomposed IdentityGate circuit to Clifford+T: 2.9583461582660675e-06 seconds\n",
" Time to decompose high level PhaseOffset circuit: 6.0750171542167664e-05 seconds \n",
" Time to transform decomposed PhaseOffset circuit to Clifford+T: 3.5291071981191635e-05 seconds\n",
" Time to decompose high level Trotter_Unitary circuit: 0.2048220420256257 seconds \n",
" Time to transform decomposed Trotter_Unitary circuit to Clifford+T: 0.5036598341539502 seconds\n",
" Time to decompose high level MeasurementGate circuit: 0.0007734578102827072 seconds \n",
" Time to transform decomposed MeasurementGate circuit to Clifford+T: 4.216702654957771e-05 seconds\n",
"Time to estimate Ideal: 1.7194426669739187\n"
]
}
],
Expand All @@ -587,6 +577,7 @@
" phase_offset=phase_offset_current_limit,\n",
" circuit_name='two_band_current_limit',\n",
" metadata=metadata_current_limit,\n",
" include_nested_resources=True,\n",
" write_circuits=True\n",
")\n",
"t1 = time.perf_counter()\n",
Expand All @@ -604,6 +595,7 @@
" phase_offset=phase_offset_ideal,\n",
" circuit_name='two_band_ideal',\n",
" metadata=metadata_ideal,\n",
" include_nested_resources=True,\n",
" write_circuits=True\n",
")\n",
"t1 = time.perf_counter()\n",
Expand Down Expand Up @@ -1038,6 +1030,7 @@
" task='Ground State Energy Estimation',\n",
"\n",
" evolution_time=t_current_limit,\n",
" is_extrapolated=True,\n",
" trotter_order=trotter_order_current_limit,\n",
" bits_precision=bits_precision_current_limit,\n",
" nsteps=trotter_steps_current_limit,\n",
Expand Down Expand Up @@ -1066,31 +1059,31 @@
"output_type": "stream",
"text": [
"Estimating Current Limit\n",
"Time to generate circuit for GSEE: 0.00012049998622387648 seconds\n",
" Time to decompose high level HPowGate circuit: 0.00010195799404755235 seconds \n",
" Time to transform decomposed HPowGate circuit to Clifford+T: 0.00022904202342033386 seconds\n",
" Time to decompose high level IdentityGate circuit: 2.5374989490956068e-05 seconds \n",
" Time to transform decomposed IdentityGate circuit to Clifford+T: 5.208014044910669e-06 seconds\n",
" Time to decompose high level PhaseOffset circuit: 9.14589618332684e-05 seconds \n",
" Time to transform decomposed PhaseOffset circuit to Clifford+T: 0.00010649999603629112 seconds\n",
" Time to decompose high level Trotter_Unitary circuit: 0.6369308329885826 seconds \n",
" Time to transform decomposed Trotter_Unitary circuit to Clifford+T: 2.6309287089970894 seconds\n",
" Time to decompose high level MeasurementGate circuit: 0.0021917499834671617 seconds \n",
" Time to transform decomposed MeasurementGate circuit to Clifford+T: 4.954199539497495e-05 seconds\n",
"Time to estimate Current Limit: 6.172279916994739\n",
"Time to generate circuit for GSEE: 3.4874770790338516e-05 seconds\n",
" Time to decompose high level HPowGate circuit: 0.00011974992230534554 seconds \n",
" Time to transform decomposed HPowGate circuit to Clifford+T: 0.00022624991834163666 seconds\n",
" Time to decompose high level IdentityGate circuit: 1.5125144273042679e-05 seconds \n",
" Time to transform decomposed IdentityGate circuit to Clifford+T: 3.7918798625469208e-06 seconds\n",
" Time to decompose high level PhaseOffset circuit: 8.566631004214287e-05 seconds \n",
" Time to transform decomposed PhaseOffset circuit to Clifford+T: 0.00010370789095759392 seconds\n",
" Time to decompose high level Trotter_Unitary circuit: 0.6261392920278013 seconds \n",
" Time to transform decomposed Trotter_Unitary circuit to Clifford+T: 2.3303427919745445 seconds\n",
" Time to decompose high level MeasurementGate circuit: 0.002318750135600567 seconds \n",
" Time to transform decomposed MeasurementGate circuit to Clifford+T: 4.862481728196144e-05 seconds\n",
"Time to estimate Current Limit: 5.381249750033021\n",
"Estimating Ideal\n",
"Time to generate circuit for GSEE: 4.7291978262364864e-05 seconds\n",
" Time to decompose high level HPowGate circuit: 8.358299965038896e-05 seconds \n",
" Time to transform decomposed HPowGate circuit to Clifford+T: 0.0001830410328693688 seconds\n",
" Time to decompose high level IdentityGate circuit: 1.591700129210949e-05 seconds \n",
" Time to transform decomposed IdentityGate circuit to Clifford+T: 3.915978595614433e-06 seconds\n",
" Time to decompose high level PhaseOffset circuit: 7.058301707729697e-05 seconds \n",
" Time to transform decomposed PhaseOffset circuit to Clifford+T: 8.283299393951893e-05 seconds\n",
" Time to decompose high level Trotter_Unitary circuit: 0.5475135830347426 seconds \n",
" Time to transform decomposed Trotter_Unitary circuit to Clifford+T: 2.4883924159803428 seconds\n",
" Time to decompose high level MeasurementGate circuit: 0.002176332985982299 seconds \n",
" Time to transform decomposed MeasurementGate circuit to Clifford+T: 5.570799112319946e-05 seconds\n",
"Time to estimate Ideal: 6.056912083993666\n"
"Time to generate circuit for GSEE: 2.8333161026239395e-05 seconds\n",
" Time to decompose high level HPowGate circuit: 7.39172101020813e-05 seconds \n",
" Time to transform decomposed HPowGate circuit to Clifford+T: 0.00020616687834262848 seconds\n",
" Time to decompose high level IdentityGate circuit: 1.041637733578682e-05 seconds \n",
" Time to transform decomposed IdentityGate circuit to Clifford+T: 2.9997900128364563e-06 seconds\n",
" Time to decompose high level PhaseOffset circuit: 6.391620263457298e-05 seconds \n",
" Time to transform decomposed PhaseOffset circuit to Clifford+T: 7.108272984623909e-05 seconds\n",
" Time to decompose high level Trotter_Unitary circuit: 0.5104598328471184 seconds \n",
" Time to transform decomposed Trotter_Unitary circuit to Clifford+T: 2.089019749779254 seconds\n",
" Time to decompose high level MeasurementGate circuit: 0.002230667043477297 seconds \n",
" Time to transform decomposed MeasurementGate circuit to Clifford+T: 5.258386954665184e-05 seconds\n",
"Time to estimate Ideal: 5.026830167043954\n"
]
}
],
Expand All @@ -1108,8 +1101,10 @@
" phase_offset=phase_offset_current_limit,\n",
" circuit_name='three_band_current_limit',\n",
" metadata=metadata_current_limit,\n",
" include_nested_resources=True,\n",
" write_circuits=True\n",
")\n",
"\n",
"t1 = time.perf_counter()\n",
"print(f'Time to estimate Current Limit: {t1-t0}')\n",
"\n",
Expand All @@ -1125,6 +1120,7 @@
" phase_offset=phase_offset_ideal,\n",
" circuit_name='three_band_ideal',\n",
" metadata=metadata_ideal,\n",
" include_nested_resources=True,\n",
" write_circuits=True\n",
")\n",
"t1 = time.perf_counter()\n",
Expand All @@ -1150,7 +1146,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "qc-apps",
"display_name": "qiskit",
"language": "python",
"name": "python3"
},
Expand All @@ -1164,7 +1160,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.10"
"version": "3.12.0"
}
},
"nbformat": 4,
Expand Down
238 changes: 117 additions & 121 deletions notebooks/MagneticLattices.ipynb

Large diffs are not rendered by default.

Loading
Loading