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

Add dbi notebooks to documentation #1337

Merged
merged 23 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b867fec
doc: Add notebooks to sphinx
andrea-pasquale May 29, 2024
a82406d
Merge branch 'dbi_cost_functions' into dbi_cost_doc
andrea-pasquale May 29, 2024
4c88e60
fix: Fix energy fluctuations
andrea-pasquale May 29, 2024
7022262
tests: Code improvements and tests
andrea-pasquale May 29, 2024
30cbe29
feat: Tests passing on GPU
andrea-pasquale May 29, 2024
492202a
cleanup: Remove unused features
andrea-pasquale May 30, 2024
5e45c38
Merge branch 'dbi_cost_functions' into dbi_cost_doc
andrea-pasquale May 30, 2024
2547b21
feat: Add symblic link to doc
andrea-pasquale May 30, 2024
8beac7c
Merge branch 'dbi_cost_functions' into dbi_cost_doc
andrea-pasquale May 30, 2024
4d18650
feat: Update notebooks
andrea-pasquale May 30, 2024
0fbafa6
Merge branch 'dbi_cost_functions' into dbi_cost_doc
andrea-pasquale May 30, 2024
dfbad7f
doc: Update notebooks
andrea-pasquale May 30, 2024
01c99e8
fix: Fixing documentation
andrea-pasquale May 31, 2024
8c9c610
Update README.md
marekgluza May 31, 2024
5f24028
feat: Disable progressbar for hyperopt
andrea-pasquale May 31, 2024
392f939
fix: Fix README link
andrea-pasquale May 31, 2024
6dfa80a
more about the D operators
marekgluza May 31, 2024
90fbc03
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 31, 2024
5671d03
fix: Attempt to fix CI
andrea-pasquale May 31, 2024
410dcd0
test: execute and clean all dbi notebooks
MatteoRobbiati May 31, 2024
6130d09
fix: rm old dbi notebook from doc
MatteoRobbiati May 31, 2024
c4bfc1e
chore: Add ipykernel as doc dep
andrea-pasquale Jun 1, 2024
b5a4202
chore: Clean notebook
andrea-pasquale Jun 1, 2024
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
14 changes: 13 additions & 1 deletion doc/source/code-examples/applications-by-algorithm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,16 @@ Diagonalization Algorithms
.. toctree::
:maxdepth: 1

tutorials/dbi/dbi.ipynb
tutorials/dbi/README.md

.. tutorials/dbi/dbi_tutorial_basic_intro.ipynb

tutorials/dbi/dbi_scheduling.ipynb
tutorials/dbi/dbi_cost_functions_and_d_gradients_tutorial.ipynb
tutorials/dbi/dbi_gradient_descent_strategies.ipynb
tutorials/dbi/dbi_group_commutator_tests.ipynb

.. tutorials/dbi/dbi_gdbi_strategies_compare.ipynb

tutorials/dbi/dbi_strategy_Ising_model.ipynb
tutorials/dbi/dbi_strategy_Pauli-Z.ipynb
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the list of notebooks currently imported in the documentation.
Feel free to re-organize them if some of them are not needed

1 change: 0 additions & 1 deletion doc/source/code-examples/applications-by-topic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ Quantum Physics
tutorials/bell-variational/README.md
tutorials/falqon/README.md
tutorials/grover/README.md
tutorials/dbi/dbi.ipynb

Quantum Machine Learning
^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
1 change: 0 additions & 1 deletion doc/source/code-examples/tutorials/dbi/dbi.ipynb

This file was deleted.

3 changes: 3 additions & 0 deletions examples/dbi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Double Bracket Iterations

General documentation for DBI + links to notebooks
267 changes: 237 additions & 30 deletions examples/dbi/dbi_scheduling.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/dbi/dbi_strategies_compare.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"outputs": [],
"source": [
"# backend\n",
"set_backend(\"qibojit\", platform=\"numba\")\n",
"set_backend(\"numpy\", )\n",
"# initialize dbi object\n",
"nqubits = 5\n",
"h0 = random_hermitian(2**nqubits, seed=2)\n",
Expand Down Expand Up @@ -133,7 +133,7 @@
"outputs": [],
"source": [
"# initialize DBI class for the Pauli-Z strategy\n",
"set_backend(\"pytorch\", platform=\"numba\")\n",
"set_backend(\"numpy\")\n",
"dbi_pauli = DoubleBracketIteration(Hamiltonian(nqubits=nqubits, matrix=h0), mode=DoubleBracketGeneratorType.single_commutator, scheduling=scheduling, cost=cost)"
]
},
Expand Down Expand Up @@ -251,7 +251,7 @@
"outputs": [],
"source": [
"# backend\n",
"set_backend(\"qibojit\", platform=\"numba\")\n",
"set_backend(\"numpy\")\n",
"# initialize dbi object\n",
"# hamiltonian parameters\n",
"# define the hamiltonian\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/dbi/dbi_strategy_Ising_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"outputs": [],
"source": [
"# backend\n",
"set_backend(\"qibojit\", platform=\"numba\")\n",
"set_backend(\"numpy\")\n",
"# initialize dbi object\n",
"nqubits = 5\n",
"h0 = random_hermitian(2**nqubits, seed=2)\n",
Expand Down Expand Up @@ -222,7 +222,7 @@
"outputs": [],
"source": [
"# backend\n",
"set_backend(\"qibojit\", platform=\"numba\")\n",
"set_backend(\"numpy\")\n",
"# initialize dbi object\n",
"dbi_TFIM = DoubleBracketIteration(deepcopy(H_TFIM), scheduling=scheduling, mode=mode)"
]
Expand Down
6 changes: 3 additions & 3 deletions examples/dbi/dbi_strategy_Pauli-Z.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"source": [
"# set the qibo backend (we suggest qibojit if N >= 20)\n",
"# alternatives: tensorflow (not optimized), numpy (when CPU not supported by jit)\n",
"set_backend(\"qibojit\", \"numba\")\n",
"set_backend(\"numpy\")\n",
"\n",
"# hamiltonian parameters\n",
"nqubits = 5\n",
Expand Down Expand Up @@ -246,7 +246,7 @@
"source": [
"# set the qibo backend (we suggest qibojit if N >= 20)\n",
"# alternatives: tensorflow (not optimized), numpy (when CPU not supported by jit)\n",
"set_backend(\"qibojit\", \"numba\")\n",
"set_backend(\"numpy\")\n",
"\n",
"\n",
"# initialize class|\n",
Expand Down Expand Up @@ -439,7 +439,7 @@
" dbi_mixed_can(step=step)\n",
" off_diagonal_norm_history_mixed_can.append(dbi_mixed_can.off_diagonal_norm)\n",
" steps_mixed_can.append(step)\n",
" \n",
"\n",
"print(\"After 2 steps, off diagonal norm:\", dbi_mixed_can.off_diagonal_norm)\n",
"print(\"By comparison, the Pauli-Z:\", off_diagonal_norm_history[2])"
]
Expand Down
4 changes: 2 additions & 2 deletions examples/dbi/dbi_tutorial_basic_intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"outputs": [],
"source": [
"# set the qibo backend (we suggest qibojit if N >= 20)\n",
"set_backend(\"qibojit\", \"numba\")\n",
"set_backend(\"numpy\")\n",
"\n",
"# hamiltonian parameters\n",
"nqubits = 5\n",
Expand Down Expand Up @@ -554,7 +554,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down
Loading