Skip to content

Commit

Permalink
evolution tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
WanderingMike committed Dec 12, 2023
2 parents 70ba393 + eea1e76 commit 00001fe
Show file tree
Hide file tree
Showing 42 changed files with 3,813 additions and 2,116 deletions.
24 changes: 24 additions & 0 deletions doc/source/api-reference/qibo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,23 @@ Iterative Quantum Amplitude Estimation (IQAE)
:member-order: bysource


Double Bracket Iteration algorithm for Diagonalization
""""""""""""""""""""""""""""""""""""""""""""""""""""""

The Double Bracket Flow (DBF) has been presented `here <https://arxiv.org/abs/2206.11772>`_
as a novel strategy for preparing eigenstates of a quantum system. We implement in
Qibo a discretized version of the algorithm, which executes sequential Double
Bracket Iterations.

.. autoclass:: qibo.models.dbi.double_bracket.DoubleBracketGeneratorType
:members:
:member-order: bysource

.. autoclass:: qibo.models.dbi.double_bracket.DoubleBracketIteration
:members:
:member-order: bysource


.. _timeevolution:

Time evolution
Expand Down Expand Up @@ -548,6 +565,13 @@ Controlled-NOT (CNOT)
:members:
:member-order: bysource

Controlled-Y (CY)
"""""""""""""""""""""

.. autoclass:: qibo.gates.CY
:members:
:member-order: bysource

Controlled-phase (CZ)
"""""""""""""""""""""

Expand Down
11 changes: 5 additions & 6 deletions doc/source/code-examples/advancedexamples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2011,10 +2011,9 @@ Multiple transpilation steps can be implemented using the :class:`qibo.transpile
from qibo import gates
from qibo.models import Circuit
from qibo.transpiler.pipeline import Passes, assert_transpiling
from qibo.transpiler.abstract import NativeType
from qibo.transpiler.optimizer import Preprocessing
from qibo.transpiler.router import ShortestPaths
from qibo.transpiler.unroller import NativeGates
from qibo.transpiler.unroller import Unroller, NativeGates
from qibo.transpiler.placer import Random

# Define connectivity as nx.Graph
Expand All @@ -2040,10 +2039,10 @@ Multiple transpilation steps can be implemented using the :class:`qibo.transpile
# Routing step
custom_passes.append(ShortestPaths(connectivity=star_connectivity()))
# Gate decomposition step
custom_passes.append(NativeGates(two_qubit_natives=NativeType.iSWAP))
custom_passes.append(Unroller(native_gates=NativeGates.default()))

# Define the general pipeline
custom_pipeline = Passes(custom_passes, connectivity=star_connectivity(), native_gates=NativeType.iSWAP)
custom_pipeline = Passes(custom_passes, connectivity=star_connectivity(), native_gates=NativeGates.default())

# Call the transpiler pipeline on the circuit
transpiled_circ, final_layout = custom_pipeline(circuit)
Expand All @@ -2057,10 +2056,10 @@ Multiple transpilation steps can be implemented using the :class:`qibo.transpile
connectivity=star_connectivity(),
initial_layout=initial_layout,
final_layout=final_layout,
native_gates=NativeType.iSWAP
native_gates=NativeGates.default()
)

In this case circuits will first be transpiled to respect the 5-qubit star connectivity, with qubit 2 as the middle qubit. This will potentially add some SWAP gates.
Then all gates will be converted to native. The :class:`qibo.transpiler.unroller.NativeGates` transpiler used in this example assumes Z, RZ, GPI2 or U3 as
Then all gates will be converted to native. The :class:`qibo.transpiler.unroller.Unroller` transpiler used in this example assumes Z, RZ, GPI2 or U3 as
the single-qubit native gates, and supports CZ and iSWAP as two-qubit natives. In this case we restricted the two-qubit gate set to CZ only.
The final_layout contains the final logical-physical qubit mapping.
9 changes: 9 additions & 0 deletions doc/source/code-examples/applications-by-algorithm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,12 @@ Clustering
:maxdepth: 1

tutorials/qclustering/README.md


Diagonalization Algorithms
^^^^^^^^^^^^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 1

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

Quantum Machine Learning
^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
165 changes: 165 additions & 0 deletions doc/source/code-examples/applications.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,171 @@ Applications
In this section we present some examples of quantum circuits applied to specific
problems.

Applications by topic
---------------------

Complexity theory
^^^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 1

tutorials/grover3sat/README.md
tutorials/adiabatic3sat/README.md


Condensed Matter Physics
^^^^^^^^^^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 1

tutorials/aavqe/README.md


Cryptography
^^^^^^^^^^^^

.. toctree::
:maxdepth: 1

tutorials/hash-grover/README.md


Finance
^^^^^^^

.. toctree::
:maxdepth: 1

tutorials/unary/README.md


High-Energy Physics
^^^^^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 1

tutorials/qPDF/qPDF.ipynb
tutorials/anomaly_detection/README.md


Quantum Physics
^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 1

tutorials/qsvd/README.md
tutorials/3_tangle/README.md
tutorials/adiabatic/README.md
tutorials/shor/README.md
tutorials/bell-variational/README.md
tutorials/falqon/README.md
tutorials/grover/README.md
tutorials/dbi/dbi.ipynb


Quantum Machine Learning
^^^^^^^^^^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 1

tutorials/variational_classifier/README.md
tutorials/reuploading_classifier/README.md
tutorials/vqregressor/README.md
tutorials/autoencoder/README.md
tutorials/EF_QAE/README.md
tutorials/qfiae/qfiae_demo.ipynb
tutorials/qcnn_classifier/qcnn_demo.ipynb
tutorials/qclustering/README.md
tutorials/adiabatic_qml/adiabatic-qml.ipynb

Combinatorics
^^^^^^^^^^^^^

.. toctree::
:maxdepth: 1

tutorials/qap/README.md
tutorials/mvc/README.md


Applications by algorithm
-------------------------

Variational Quantum Circuits
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 1

tutorials/aavqe/README.md
tutorials/variational_classifier/README.md
tutorials/reuploading_classifier/README.md
tutorials/vqregressor/README.md
tutorials/autoencoder/README.md
tutorials/qsvd/README.md
tutorials/3_tangle/README.md
tutorials/EF_QAE/README.md
tutorials/unary/README.md
tutorials/bell-variational/README.md
tutorials/qPDF/qPDF.ipynb
tutorials/anomaly_detection/README.md
tutorials/qcnn_classifier/qcnn_demo.ipynb
tutorials/adiabatic_qml/adiabatic-qml.ipynb

Grover's Algorithm
^^^^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 1

tutorials/grover3sat/README.md
tutorials/hash-grover/README.md
tutorials/grover/README.md
tutorials/qfiae/qfiae_demo.ipynb


Shor's Factorization Algorithms
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 1

tutorials/shor/README.md


Adiabatic Evolution
^^^^^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 1

tutorials/adiabatic/README.md
tutorials/adiabatic3sat/README.md


Diagonalization
^^^^^^^^^^^^^^^

.. toctree::
:maxdepth: 1

tutorials/dbi/dbi.ipynb

FALQON
^^^^^^

.. toctree::
:maxdepth: 1

tutorials/falqon/README.md

Clustering
^^^^^^^^^^

.. toctree::
:maxdepth: 2
Expand Down
1 change: 1 addition & 0 deletions doc/source/code-examples/tutorials/dbi/dbi.ipynb
6 changes: 6 additions & 0 deletions doc/source/getting-started/backends.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ be controlled using the ``QIBO_LOG_LEVEL`` environment variable. This can be set
to 3 to hide info messages or 4 to hide both info and warning messages. The
default value is 1 allowing all messages to appear.

.. note::
The `qibojit` backend implements in-place updates. This
implies that the initial state is modified at runtime without performing any copies to save memory.
For algorithms that require access to the initial state after its modification, such as quantum machine learning applications,
it is suggested to perform a copy of the state explicitly if really needed by the algorithm.


.. _hardware-backends:

Expand Down
764 changes: 764 additions & 0 deletions examples/dbi/dbi.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 00001fe

Please sign in to comment.