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

Short import for TrotterQRTE #67

Merged
merged 3 commits into from
Aug 23, 2023
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

This file was deleted.

20 changes: 6 additions & 14 deletions qiskit_algorithms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
These elements are frequently used in a variety of applications, such as variational optimization,
time evolution and quantum machine learning.

The quantum algorithms here all use
`Primitives <https://qiskit.org/documentation/apidoc/primitives.html>`__
The quantum algorithms here all use
`Primitives <https://qiskit.org/documentation/apidoc/primitives.html>`__
to execute quantum circuits. This can be an
``Estimator``, which computes expectation values, or a ``Sampler`` which computes
probability distributions. Refer to the specific algorithm for more information in this regard.
Expand All @@ -44,7 +44,7 @@
The algorithms now presented are grouped by logical function, such
as minimum eigensolvers, amplitude amplifiers, time evolvers etc. Within each group, the
algorithms conform to an interface that allows them to be used interchangeably
by different applications. E.g. a Qiskit Nature application may take a minimum
by different applications. E.g. a Qiskit Nature application may take a minimum
eigensolver to solve a ground state problem, and require it to
conform to the :class:`.MinimumEigensolver` interface. Any algorithm that conforms to
the interface, for example :class:`.VQE`, can be used by this application.
Expand Down Expand Up @@ -200,6 +200,7 @@
PVQDResult
SciPyImaginaryEvolver
SciPyRealEvolver
TrotterQRTE
VarQITE
VarQRTE

Expand All @@ -214,17 +215,6 @@
time_evolvers.variational


Trotterization-based Quantum Real Time Evolution
++++++++++++++++++++++++++++++++++++++++++++++++
Trotterization-based quantum time evolution algorithms -
:class:`~.time_evolvers.trotterization.TrotterQRTE`.

.. autosummary::
:toctree:

time_evolvers.trotterization


Miscellaneous
=============
Various classes used by qiskit-algorithms that are part of and exposed
Expand Down Expand Up @@ -296,6 +286,7 @@
PVQDResult,
SciPyImaginaryEvolver,
SciPyRealEvolver,
TrotterQRTE,
VarQITE,
VarQRTE,
VarQTE,
Expand Down Expand Up @@ -363,6 +354,7 @@
"PVQDResult",
"SciPyRealEvolver",
"SciPyImaginaryEvolver",
"TrotterQRTE",
"IterativePhaseEstimation",
"AlgorithmError",
"estimate_observables",
Expand Down
21 changes: 2 additions & 19 deletions qiskit_algorithms/time_evolvers/trotterization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,8 @@
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
"""
Time Evolvers, Trotterization (:mod:`qiskit_algorithms.time_evolvers.variational`)
==================================================================================
""" The Time Evolvers, Trotterization package"""

This package contains Trotterization-based Quantum Real Time Evolution algorithm.
It is compliant with the new Quantum Time Evolution Framework and makes use of
:class:`qiskit.synthesis.evolution.ProductFormula` and
:class:`~qiskit.circuit.library.PauliEvolutionGate` implementations.

Trotterization-based Quantum Real Time Evolution
------------------------------------------------

.. autosummary::
:toctree: ../stubs/
:nosignatures:

TrotterQRTE
"""

from qiskit_algorithms.time_evolvers.trotterization.trotter_qrte import TrotterQRTE
from .trotter_qrte import TrotterQRTE

__all__ = ["TrotterQRTE"]
20 changes: 11 additions & 9 deletions qiskit_algorithms/time_evolvers/trotterization/trotter_qrte.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@

class TrotterQRTE(RealTimeEvolver):
"""Quantum Real Time Evolution using Trotterization.
Type of Trotterization is defined by a ``ProductFormula`` provided.

The type of Trotterization is defined by the :class:`~qiskit.synthesis.ProductFormula`
provided to the algorithm.

Examples:

.. code-block:: python

from qiskit.quantum_info import Pauli, SparsePauliOp
from qiskit import QuantumCircuit
from qiskit_algorithms import TimeEvolutionProblem
from qiskit_algorithms.time_evolvers import TrotterQRTE
from qiskit_algorithms import TrotterQRTE, TimeEvolutionProblem
from qiskit.primitives import Estimator

operator = SparsePauliOp([Pauli("X"), Pauli("Z")])
Expand All @@ -60,11 +61,12 @@ def __init__(
) -> None:
"""
Args:
product_formula: A Lie-Trotter-Suzuki product formula. If ``None`` provided, the
Lie-Trotter first order product formula with a single repetition is used. ``reps``
should be 1 to obtain a number of time-steps equal to ``num_timesteps`` and an
evaluation of :attr:`.TimeEvolutionProblem.aux_operators` at every time-step. If ``reps``
is larger than 1, the true number of time-steps will be ``num_timesteps * reps``.
product_formula: A Lie-Trotter-Suzuki product formula. If ``None`` provided (default),
the :class:`~qiskit.synthesis.LieTrotter` first order product formula with a single
repetition is used. ``reps`` should be 1 to obtain a number of time-steps equal to
``num_timesteps`` and an evaluation of :attr:`.TimeEvolutionProblem.aux_operators`
at every time-step. If ``reps`` is larger than 1, the true number of time-steps will
be ``num_timesteps * reps``.
num_timesteps: The number of time-steps the full evolution time is divided into
(repetitions of ``product_formula``)
estimator: An estimator primitive used for calculating expectation values of
Expand All @@ -85,7 +87,7 @@ def product_formula(self, product_formula: ProductFormula | None):
"""Sets a product formula. If ``None`` provided, sets the Lie-Trotter first order product
formula with a single repetition."""
if product_formula is None:
product_formula = LieTrotter()
product_formula = LieTrotter(reps=1)
self._product_formula = product_formula

@property
Expand Down
2 changes: 1 addition & 1 deletion test/time_evolvers/test_trotter_qrte.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from qiskit.primitives import Estimator
from qiskit.synthesis import SuzukiTrotter, QDrift

from qiskit_algorithms.time_evolvers import TimeEvolutionProblem, TrotterQRTE
from qiskit_algorithms import TimeEvolutionProblem, TrotterQRTE
from qiskit_algorithms.utils import algorithm_globals


Expand Down