From d7083e4e2f2af7a1ec110ecce73959db915adca6 Mon Sep 17 00:00:00 2001 From: woodsp-ibm Date: Fri, 4 Aug 2023 17:05:42 -0400 Subject: [PATCH 01/13] Documentation fixes and changes --- .../qiskit_algorithms.AlgorithmError.rst | 6 + docs/apidocs/qiskit_algorithms.gradients.rst | 24 +++ docs/apidocs/qiskit_algorithms.optimizers.rst | 24 +++ .../{algorithms.rst => qiskit_algorithms.rst} | 0 .../qiskit_algorithms.state_fidelities.rst | 24 +++ ...lgorithms.time_evolvers.trotterization.rst | 24 +++ ...t_algorithms.time_evolvers.variational.rst | 24 +++ docs/index.rst | 2 +- qiskit_algorithms/__init__.py | 197 +++++++++++------- qiskit_algorithms/eigensolvers/__init__.py | 29 +-- qiskit_algorithms/gradients/__init__.py | 23 +- .../minimum_eigensolvers/__init__.py | 31 +-- qiskit_algorithms/optimizers/__init__.py | 36 ++-- .../state_fidelities/__init__.py | 16 +- .../time_evolvers/trotterization/__init__.py | 6 +- .../time_evolvers/variational/__init__.py | 6 +- 16 files changed, 298 insertions(+), 174 deletions(-) create mode 100644 docs/apidocs/qiskit_algorithms.AlgorithmError.rst create mode 100644 docs/apidocs/qiskit_algorithms.gradients.rst create mode 100644 docs/apidocs/qiskit_algorithms.optimizers.rst rename docs/apidocs/{algorithms.rst => qiskit_algorithms.rst} (100%) create mode 100644 docs/apidocs/qiskit_algorithms.state_fidelities.rst create mode 100644 docs/apidocs/qiskit_algorithms.time_evolvers.trotterization.rst create mode 100644 docs/apidocs/qiskit_algorithms.time_evolvers.variational.rst diff --git a/docs/apidocs/qiskit_algorithms.AlgorithmError.rst b/docs/apidocs/qiskit_algorithms.AlgorithmError.rst new file mode 100644 index 00000000..9c213025 --- /dev/null +++ b/docs/apidocs/qiskit_algorithms.AlgorithmError.rst @@ -0,0 +1,6 @@ +AlgorithmError +============== + +.. currentmodule:: qiskit_algorithms + +.. autoexception:: AlgorithmError diff --git a/docs/apidocs/qiskit_algorithms.gradients.rst b/docs/apidocs/qiskit_algorithms.gradients.rst new file mode 100644 index 00000000..ccdb7bcd --- /dev/null +++ b/docs/apidocs/qiskit_algorithms.gradients.rst @@ -0,0 +1,24 @@ +.. _qiskit_algorithms-gradients: + +.. automodule:: qiskit_algorithms.gradients + :no-members: + :no-inherited-members: + :no-special-members: + + + + + + + + + + + + + + + + + + diff --git a/docs/apidocs/qiskit_algorithms.optimizers.rst b/docs/apidocs/qiskit_algorithms.optimizers.rst new file mode 100644 index 00000000..80de5465 --- /dev/null +++ b/docs/apidocs/qiskit_algorithms.optimizers.rst @@ -0,0 +1,24 @@ +.. _qiskit_algorithms-optimizers: + +.. automodule:: qiskit_algorithms.optimizers + :no-members: + :no-inherited-members: + :no-special-members: + + + + + + + + + + + + + + + + + + diff --git a/docs/apidocs/algorithms.rst b/docs/apidocs/qiskit_algorithms.rst similarity index 100% rename from docs/apidocs/algorithms.rst rename to docs/apidocs/qiskit_algorithms.rst diff --git a/docs/apidocs/qiskit_algorithms.state_fidelities.rst b/docs/apidocs/qiskit_algorithms.state_fidelities.rst new file mode 100644 index 00000000..4dffac42 --- /dev/null +++ b/docs/apidocs/qiskit_algorithms.state_fidelities.rst @@ -0,0 +1,24 @@ +.. _qiskit_algorithms-state_fidelities: + +.. automodule:: qiskit_algorithms.state_fidelities + :no-members: + :no-inherited-members: + :no-special-members: + + + + + + + + + + + + + + + + + + diff --git a/docs/apidocs/qiskit_algorithms.time_evolvers.trotterization.rst b/docs/apidocs/qiskit_algorithms.time_evolvers.trotterization.rst new file mode 100644 index 00000000..d8221e41 --- /dev/null +++ b/docs/apidocs/qiskit_algorithms.time_evolvers.trotterization.rst @@ -0,0 +1,24 @@ +.. _qiskit_algorithms-time_evolvers-trotterization: + +.. automodule:: qiskit_algorithms.time_evolvers.trotterization + :no-members: + :no-inherited-members: + :no-special-members: + + + + + + + + + + + + + + + + + + diff --git a/docs/apidocs/qiskit_algorithms.time_evolvers.variational.rst b/docs/apidocs/qiskit_algorithms.time_evolvers.variational.rst new file mode 100644 index 00000000..4c0187d0 --- /dev/null +++ b/docs/apidocs/qiskit_algorithms.time_evolvers.variational.rst @@ -0,0 +1,24 @@ +.. _qiskit_algorithms-time_evolvers-variational: + +.. automodule:: qiskit_algorithms.time_evolvers.variational + :no-members: + :no-inherited-members: + :no-special-members: + + + + + + + + + + + + + + + + + + diff --git a/docs/index.rst b/docs/index.rst index aad34a14..6f6a5902 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -24,7 +24,7 @@ Next Steps Overview Getting Started - API References + API References Tutorials Release Notes GitHub diff --git a/qiskit_algorithms/__init__.py b/qiskit_algorithms/__init__.py index f0326ba8..fd518ac9 100644 --- a/qiskit_algorithms/__init__.py +++ b/qiskit_algorithms/__init__.py @@ -11,29 +11,43 @@ # that they have been altered from the originals. """ -===================================== -Algorithms (:mod:`qiskit_algorithms`) -===================================== -It contains a collection of quantum algorithms, for use with quantum computers, to -carry out research and investigate how to solve problems in different domains on -near-term quantum devices with short depth circuits. - -Algorithms configuration includes the use of :mod:`~qiskit_algorithms.optimizers` which -were designed to be swappable sub-parts of an algorithm. Any component and may be exchanged for -a different implementation of the same component type in order to potentially alter the behavior -and outcome of the algorithm. +============================================ +Qiskit Algorithms (:mod:`qiskit_algorithms`) +============================================ +Qiskit Algorithms is a library of quantum algorithms for quantum computing with +`Qiskit `_. +The algorithms can be used to carry out research and investigate how to solve +problems in different domains on simulators and near-term real quantum devices +using short depth circuits. + +Now there are some classical algorithms here, for example the :class:`.NumPyMinimumEigensolver` +which take the same input but solve the problem classically. This has utility in the near-term, +where problems are still tractable classically, to validate and/or act as a reference. +There are also classical :mod:`.optimizers` for use with variational algorithms such as :class:`.VQE`. + +While :mod:`.optimizers` were been mentioned, algorithms may also use :mod:`.gradients` and +:mod:`.state_fidelities`. Plus any of these may be used directly if you have need of such function. + +The quantum algorithms here all use ``Primitives`` to execute quantum circuits. This can be an +``Estimator``, which computes expectation values, or a ``Sampler`` which computes +probability distributions. .. currentmodule:: qiskit_algorithms Algorithms ========== -It contains a variety of quantum algorithms and these have been grouped by logical function such -as minimum eigensolvers and amplitude amplifiers. These algorithms are based on the Qiskit Primitives. - +The algorithms are now presented and are grouped by logical function such +as minimum eigensolvers, amplitude amplifiers, time evolvers etc. Within each group the +algorithms comform to an interface defined there which allows them to be used interchangeably +in an application that specifies use of an algorithm type by that interface. E.g. Qiskit Nature +application may take a Minimum Eigensolver to solve a ground state problem and require it to conform to +the :class:`.MinimumEigensolver` interface. As long as it does, e.g. :class:`.VQE` then the application +can make use of it. Amplitude Amplifiers -------------------- +Algorithms based on amplitude amplification. .. autosummary:: :toctree: ../stubs/ @@ -47,6 +61,7 @@ Amplitude Estimators -------------------- +Algorithms based on amplitude estimation. .. autosummary:: :toctree: ../stubs/ @@ -67,105 +82,78 @@ Eigensolvers ------------ - Algorithms to find eigenvalues of an operator. For chemistry these can be used to find excited states of a molecule, and ``qiskit-nature`` has some algorithms that leverage chemistry specific knowledge to do this in that application domain. -These algorithms are based on the Qiskit Primitives. - -.. autosummary:: - :toctree: ../stubs/ - - eigensolvers - -Time Evolvers -------------- - -Algorithms to evolve quantum states in time. Both real and imaginary time evolution is possible -with algorithms that support them. For machine learning, Quantum Imaginary Time Evolution might be -used to train Quantum Boltzmann Machine Neural Networks for example. -These algorithms are based on the Qiskit Primitives. .. autosummary:: :toctree: ../stubs/ :nosignatures: - RealTimeEvolver - ImaginaryTimeEvolver - TimeEvolutionResult - TimeEvolutionProblem - PVQD - PVQDResult - SciPyImaginaryEvolver - SciPyRealEvolver - VarQITE - VarQRTE - -Variational Quantum Time Evolution -++++++++++++++++++++++++++++++++++ - -Classes used by variational quantum time evolution algorithms - :class:`.VarQITE` and -:class:`.VarQRTE`. - -.. autosummary:: - :toctree: ../stubs/ - - time_evolvers.variational - - -Trotterization-based Quantum Real Time Evolution -++++++++++++++++++++++++++++++++++++++++++++++++ - -Package for primitives-enabled Trotterization-based quantum time evolution -algorithm - :class:`~.time_evolvers.TrotterQRTE`. - -.. autosummary:: - :toctree: ../stubs/ - - time_evolvers.trotterization + Eigensolver + EigensolverResult + NumPyEigensolver + NumPyEigensolverResult + VQD + VQDResult Gradients ---------- - -Algorithms to calculate the gradient of a quantum circuit. These algorithms are based -on the Qiskit Primitives. +Algorithms to calculate the gradient of a quantum circuit. .. autosummary:: - :toctree: ../stubs/ + :toctree: gradients Minimum Eigensolvers --------------------- +Algorithms to find the minimum eigenvalue of an operator. + +Those algorithms taking an ``Estimator`` primitive that can solve for a general hamiltonian. + +.. autosummary:: + :toctree: ../stubs/ + :nosignatures: + + MinimumEigensolver + MinimumEigensolverResult + NumPyMinimumEigensolver + NumPyMinimumEigensolverResult + VQE + VQEResult + AdaptVQE + AdaptVQEResult -Algorithms that can find the minimum eigenvalue of an operator. These algorithms are -based on the Qiskit Primitives. +Those algorithms taking an ``Sampler`` primitive that can solve for a diagonal hamiltonian such +as Ising Hamiltonian of an optimization problem. .. autosummary:: :toctree: ../stubs/ + :nosignatures: - minimum_eigensolvers + SamplingMinimumEigensolver + SamplingMinimumEigensolverResult + SamplingVQE + SamplingVQEResult + QAOA Optimizers ---------- - -Classical optimizers for use by quantum variational algorithms. These algorithms -are based on the Qiskit Primitives. +Classical optimizers designed for use by quantum variational algorithms. .. autosummary:: - :toctree: ../stubs/ + :toctree: optimizers Phase Estimators ---------------- - -Algorithms that estimate the phases of eigenstates of a unitary. These algorithms -are based on the Qiskit Primitives. +Algorithms that estimate the phases of eigenstates of a unitary. .. autosummary:: :toctree: ../stubs/ @@ -181,21 +169,69 @@ State Fidelities ---------------- +Algorithms that compute the fidelity of pairs of quantum states. -Algorithms that compute the fidelity of pairs of quantum states. These algorithms -are based on the Qiskit Primitives. +.. autosummary:: + :toctree: + + state_fidelities + + +Time Evolvers +------------- +Algorithms to evolve quantum states in time. Both real and imaginary time evolution is possible +with algorithms that support them. For machine learning, Quantum Imaginary Time Evolution might be +used to train Quantum Boltzmann Machine Neural Networks for example. .. autosummary:: :toctree: ../stubs/ + :nosignatures: + + RealTimeEvolver + ImaginaryTimeEvolver + TimeEvolutionResult + TimeEvolutionProblem + PVQD + PVQDResult + SciPyImaginaryEvolver + SciPyRealEvolver + VarQITE + VarQRTE + +Variational Quantum Time Evolution +++++++++++++++++++++++++++++++++++ +Classes used by variational quantum time evolution algorithms - +:class:`.VarQITE` and :class:`.VarQRTE`. + +.. autosummary:: + :toctree: + + time_evolvers.variational - state_fidelities + +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 +by the public API. Exceptions ---------- .. autosummary:: - :toctree: ../stubs/ + :toctree: + :nosignatures: AlgorithmError @@ -207,6 +243,7 @@ .. autosummary:: :toctree: ../stubs/ + :nosignatures: AlgorithmJob diff --git a/qiskit_algorithms/eigensolvers/__init__.py b/qiskit_algorithms/eigensolvers/__init__.py index 584374e0..b3d454b7 100644 --- a/qiskit_algorithms/eigensolvers/__init__.py +++ b/qiskit_algorithms/eigensolvers/__init__.py @@ -10,34 +10,7 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -""" -===================================================================== -Eigensolvers Package (:mod:`qiskit_algorithms.eigensolvers`) -===================================================================== - -.. currentmodule:: qiskit_algorithms.eigensolvers - -Eigensolvers -================ - -.. autosummary:: - :toctree: ../stubs/ - - Eigensolver - NumPyEigensolver - VQD - -Results -======= - - .. autosummary:: - :toctree: ../stubs/ - - EigensolverResult - NumPyEigensolverResult - VQDResult - -""" +"""The Eigensolvers package""" from .numpy_eigensolver import NumPyEigensolver, NumPyEigensolverResult from .eigensolver import Eigensolver, EigensolverResult diff --git a/qiskit_algorithms/gradients/__init__.py b/qiskit_algorithms/gradients/__init__.py index e2936543..415da7dd 100644 --- a/qiskit_algorithms/gradients/__init__.py +++ b/qiskit_algorithms/gradients/__init__.py @@ -11,17 +11,18 @@ # that they have been altered from the originals. """ -============================================== Gradients (:mod:`qiskit_algorithms.gradients`) ============================================== +Algorithms to calculate the gradient of a quantum circuit. .. currentmodule:: qiskit_algorithms.gradients Base Classes -============ +------------ .. autosummary:: :toctree: ../stubs/ + :nosignatures: BaseEstimatorGradient BaseQGT @@ -31,56 +32,62 @@ QGTResult Finite Differences -================== +------------------ .. autosummary:: :toctree: ../stubs/ + :nosignatures: FiniteDiffEstimatorGradient FiniteDiffSamplerGradient Linear Combination of Unitaries -=============================== +------------------------------- .. autosummary:: :toctree: ../stubs/ + :nosignatures: LinCombEstimatorGradient LinCombSamplerGradient LinCombQGT Parameter Shift Rules -===================== +--------------------- .. autosummary:: :toctree: ../stubs/ + :nosignatures: ParamShiftEstimatorGradient ParamShiftSamplerGradient Quantum Fisher Information -========================== +-------------------------- .. autosummary:: :toctree: ../stubs/ + :nosignatures: QFIResult QFI Classical Methods -================= +----------------- .. autosummary:: :toctree: ../stubs/ + :nosignatures: ReverseEstimatorGradient ReverseQGT Simultaneous Perturbation Stochastic Approximation -================================================== +-------------------------------------------------- .. autosummary:: :toctree: ../stubs/ + :nosignatures: SPSAEstimatorGradient SPSASamplerGradient diff --git a/qiskit_algorithms/minimum_eigensolvers/__init__.py b/qiskit_algorithms/minimum_eigensolvers/__init__.py index d312f590..c86ed780 100644 --- a/qiskit_algorithms/minimum_eigensolvers/__init__.py +++ b/qiskit_algorithms/minimum_eigensolvers/__init__.py @@ -10,36 +10,7 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -""" -============================================================================ -Minimum Eigensolvers Package (:mod:`qiskit_algorithms.minimum_eigensolvers`) -============================================================================ - -.. currentmodule:: qiskit_algorithms.minimum_eigensolvers - -Minimum Eigensolvers -==================== -.. autosummary:: - :toctree: ../stubs/ - - MinimumEigensolver - NumPyMinimumEigensolver - VQE - AdaptVQE - SamplingMinimumEigensolver - SamplingVQE - QAOA - -.. autosummary:: - :toctree: ../stubs/ - - MinimumEigensolverResult - NumPyMinimumEigensolverResult - VQEResult - AdaptVQEResult - SamplingMinimumEigensolverResult - SamplingVQEResult -""" +"""The Minimum Eigensolvers package.""" from .adapt_vqe import AdaptVQE, AdaptVQEResult from .minimum_eigensolver import MinimumEigensolver, MinimumEigensolverResult diff --git a/qiskit_algorithms/optimizers/__init__.py b/qiskit_algorithms/optimizers/__init__.py index 942de206..03c30314 100644 --- a/qiskit_algorithms/optimizers/__init__.py +++ b/qiskit_algorithms/optimizers/__init__.py @@ -12,9 +12,11 @@ """ Optimizers (:mod:`qiskit_algorithms.optimizers`) -===================================================== -It contains a variety of classical optimizers for use by quantum variational algorithms, -such as :class:`~qiskit_algorithms.VQE`. +================================================ +Classical Optimizers. + +This package contains a variety of classical optimizers and were designed for use by +qiskit_algorithm's quantum variational algorithms, such as :class:`~qiskit_algorithms.VQE`. Logically, these optimizers can be divided into two categories: `Local Optimizers`_ @@ -27,8 +29,8 @@ .. currentmodule:: qiskit_algorithms.optimizers -Optimizer Base Class -==================== +Optimizer Base Classes +---------------------- .. autosummary:: :toctree: ../stubs/ @@ -38,8 +40,8 @@ Optimizer Minimizer -Steppable Optimizer Base Class -============================== +Steppable Optimization +---------------------- .. autosummary:: :toctree: ../stubs/ @@ -56,9 +58,8 @@ OptimizerState - Local Optimizers -================ +---------------- .. autosummary:: :toctree: ../stubs/ @@ -84,11 +85,11 @@ UMDA Qiskit also provides the following optimizers, which are built-out using the optimizers from -the `scikit-quant` package. The `scikit-quant` package is not installed by default but must be -explicitly installed, if desired, by the user - the optimizers therein are provided under various -licenses so it has been made an optional install for the end user to choose whether to do so or -not. To install the `scikit-quant` dependent package you can use -`pip install scikit-quant`. +`scikit-quant `_. The ``scikit-quant`` package +is not installed by default but must be explicitly installed, if desired, by the user. The +optimizers therein are provided under various licenses hence it has been made an optional install +so a user's choice to do so is their own. +To install the ``scikit-quant`` dependent package you can use ``pip install scikit-quant``. .. autosummary:: :toctree: ../stubs/ @@ -99,9 +100,10 @@ SNOBFIT Global Optimizers -================= -The global optimizers here all use NLopt for their core function and can only be -used if their dependent NLopt package is manually installed. +----------------- +The global optimizers here all use `NLOpt `_ for their +core function and can only be used if the optional dependent ``NLOpt`` package is installed. +To install the ``NLOpt`` dependent package you can use ``pip install nlopt``. .. autosummary:: :toctree: ../stubs/ diff --git a/qiskit_algorithms/state_fidelities/__init__.py b/qiskit_algorithms/state_fidelities/__init__.py index 9354ce30..47e89f31 100644 --- a/qiskit_algorithms/state_fidelities/__init__.py +++ b/qiskit_algorithms/state_fidelities/__init__.py @@ -10,26 +10,28 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. """ -===================================================================== -State Fidelity Interfaces (:mod:`qiskit_algorithms.state_fidelities`) -===================================================================== +State Fidelities (:mod:`qiskit_algorithms.state_fidelities`) +============================================================ +Algorithms that compute the fidelity of pairs of quantum states. .. currentmodule:: qiskit_algorithms.state_fidelities State Fidelities -================ +---------------- .. autosummary:: :toctree: ../stubs/ + :nosignatures: BaseStateFidelity ComputeUncompute Results -======= +------- - .. autosummary:: - :toctree: ../stubs/ +.. autosummary:: + :toctree: ../stubs/ + :nosignatures: StateFidelityResult diff --git a/qiskit_algorithms/time_evolvers/trotterization/__init__.py b/qiskit_algorithms/time_evolvers/trotterization/__init__.py index 07ec3ba2..c8b969ec 100644 --- a/qiskit_algorithms/time_evolvers/trotterization/__init__.py +++ b/qiskit_algorithms/time_evolvers/trotterization/__init__.py @@ -9,7 +9,11 @@ # 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. -"""This package contains Trotterization-based Quantum Real Time Evolution algorithm. +""" +Time Evolvers, Trotterization (:mod:`qiskit_algorithms.time_evolvers.variational`) +================================================================================== + +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. diff --git a/qiskit_algorithms/time_evolvers/variational/__init__.py b/qiskit_algorithms/time_evolvers/variational/__init__.py index 0210fb92..c0a63e1a 100644 --- a/qiskit_algorithms/time_evolvers/variational/__init__.py +++ b/qiskit_algorithms/time_evolvers/variational/__init__.py @@ -10,8 +10,8 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. """ -Variational Quantum Time Evolutions (:mod:`qiskit_algorithms.time_evolvers.variational`) -======================================================================================== +Time Evolvers, Variational (:mod:`qiskit_algorithms.time_evolvers.variational`) +=============================================================================== Algorithms for performing Variational Quantum Time Evolution of quantum states, which can be tailored to near-term devices. @@ -68,6 +68,7 @@ .. autosummary:: :toctree: ../stubs/ + :nosignatures: :template: autosummary/class_no_inherited_members.rst VariationalPrinciple @@ -84,6 +85,7 @@ .. autosummary:: :toctree: ../stubs/ + :nosignatures: :template: autosummary/class_no_inherited_members.rst ForwardEulerSolver From e1d6e91e91883913ae2d867041b73d8bf87b0808 Mon Sep 17 00:00:00 2001 From: woodsp-ibm Date: Fri, 4 Aug 2023 17:09:14 -0400 Subject: [PATCH 02/13] Remove excess blank lines --- docs/apidocs/qiskit_algorithms.gradients.rst | 18 ------------------ docs/apidocs/qiskit_algorithms.optimizers.rst | 18 ------------------ .../qiskit_algorithms.state_fidelities.rst | 18 ------------------ ...algorithms.time_evolvers.trotterization.rst | 18 ------------------ ...it_algorithms.time_evolvers.variational.rst | 18 ------------------ 5 files changed, 90 deletions(-) diff --git a/docs/apidocs/qiskit_algorithms.gradients.rst b/docs/apidocs/qiskit_algorithms.gradients.rst index ccdb7bcd..96987f24 100644 --- a/docs/apidocs/qiskit_algorithms.gradients.rst +++ b/docs/apidocs/qiskit_algorithms.gradients.rst @@ -4,21 +4,3 @@ :no-members: :no-inherited-members: :no-special-members: - - - - - - - - - - - - - - - - - - diff --git a/docs/apidocs/qiskit_algorithms.optimizers.rst b/docs/apidocs/qiskit_algorithms.optimizers.rst index 80de5465..cf07f4da 100644 --- a/docs/apidocs/qiskit_algorithms.optimizers.rst +++ b/docs/apidocs/qiskit_algorithms.optimizers.rst @@ -4,21 +4,3 @@ :no-members: :no-inherited-members: :no-special-members: - - - - - - - - - - - - - - - - - - diff --git a/docs/apidocs/qiskit_algorithms.state_fidelities.rst b/docs/apidocs/qiskit_algorithms.state_fidelities.rst index 4dffac42..bd2f8c48 100644 --- a/docs/apidocs/qiskit_algorithms.state_fidelities.rst +++ b/docs/apidocs/qiskit_algorithms.state_fidelities.rst @@ -4,21 +4,3 @@ :no-members: :no-inherited-members: :no-special-members: - - - - - - - - - - - - - - - - - - diff --git a/docs/apidocs/qiskit_algorithms.time_evolvers.trotterization.rst b/docs/apidocs/qiskit_algorithms.time_evolvers.trotterization.rst index d8221e41..50d8625b 100644 --- a/docs/apidocs/qiskit_algorithms.time_evolvers.trotterization.rst +++ b/docs/apidocs/qiskit_algorithms.time_evolvers.trotterization.rst @@ -4,21 +4,3 @@ :no-members: :no-inherited-members: :no-special-members: - - - - - - - - - - - - - - - - - - diff --git a/docs/apidocs/qiskit_algorithms.time_evolvers.variational.rst b/docs/apidocs/qiskit_algorithms.time_evolvers.variational.rst index 4c0187d0..12bf5a83 100644 --- a/docs/apidocs/qiskit_algorithms.time_evolvers.variational.rst +++ b/docs/apidocs/qiskit_algorithms.time_evolvers.variational.rst @@ -4,21 +4,3 @@ :no-members: :no-inherited-members: :no-special-members: - - - - - - - - - - - - - - - - - - From 2c17b59300c915b804412a15fee61cf527256009 Mon Sep 17 00:00:00 2001 From: woodsp-ibm Date: Mon, 7 Aug 2023 16:49:46 -0400 Subject: [PATCH 03/13] Tweak/fix text --- qiskit_algorithms/__init__.py | 28 +++++++++---------- .../minimum_eigensolvers/sampling_vqe.py | 2 +- qiskit_algorithms/minimum_eigensolvers/vqe.py | 4 +-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/qiskit_algorithms/__init__.py b/qiskit_algorithms/__init__.py index fd518ac9..ef1fe271 100644 --- a/qiskit_algorithms/__init__.py +++ b/qiskit_algorithms/__init__.py @@ -16,34 +16,34 @@ ============================================ Qiskit Algorithms is a library of quantum algorithms for quantum computing with `Qiskit `_. -The algorithms can be used to carry out research and investigate how to solve +These algorithms can be used to carry out research and investigate how to solve problems in different domains on simulators and near-term real quantum devices using short depth circuits. -Now there are some classical algorithms here, for example the :class:`.NumPyMinimumEigensolver` +Now there are some classical algorithms here, for example the :class:`.NumPyMinimumEigensolver`, which take the same input but solve the problem classically. This has utility in the near-term, where problems are still tractable classically, to validate and/or act as a reference. There are also classical :mod:`.optimizers` for use with variational algorithms such as :class:`.VQE`. While :mod:`.optimizers` were been mentioned, algorithms may also use :mod:`.gradients` and -:mod:`.state_fidelities`. Plus any of these may be used directly if you have need of such function. +:mod:`.state_fidelities`. Any of these may also be used directly if you have need of such function. The quantum algorithms here all use ``Primitives`` to execute quantum circuits. This can be an ``Estimator``, which computes expectation values, or a ``Sampler`` which computes -probability distributions. +probability distributions. Refer to the specific algorithm for more information in this regard. .. currentmodule:: qiskit_algorithms Algorithms ========== -The algorithms are now presented and are grouped by logical function such +The algorithms are now presented and are grouped by logical function, such as minimum eigensolvers, amplitude amplifiers, time evolvers etc. Within each group the -algorithms comform to an interface defined there which allows them to be used interchangeably -in an application that specifies use of an algorithm type by that interface. E.g. Qiskit Nature -application may take a Minimum Eigensolver to solve a ground state problem and require it to conform to -the :class:`.MinimumEigensolver` interface. As long as it does, e.g. :class:`.VQE` then the application -can make use of it. +algorithms comform to an interface defined there, which allows them to be used interchangeably +in an application that specifies use of an algorithm type by that interface. 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. As long as it does, for example :class:`.VQE` is one such +algorithm conforming to that interface, then the application can work with it. Amplitude Amplifiers -------------------- @@ -99,7 +99,7 @@ Gradients ----------- +--------- Algorithms to calculate the gradient of a quantum circuit. .. autosummary:: @@ -109,10 +109,10 @@ Minimum Eigensolvers ---------------------- +-------------------- Algorithms to find the minimum eigenvalue of an operator. -Those algorithms taking an ``Estimator`` primitive that can solve for a general hamiltonian. +The set of these algorithms, taking an ``Estimator`` primitive, that can solve for a general hamiltonian. .. autosummary:: :toctree: ../stubs/ @@ -127,7 +127,7 @@ AdaptVQE AdaptVQEResult -Those algorithms taking an ``Sampler`` primitive that can solve for a diagonal hamiltonian such +The set of these algorithms, taking an ``Sampler`` primitive, that can solve for a diagonal hamiltonian such as Ising Hamiltonian of an optimization problem. .. autosummary:: diff --git a/qiskit_algorithms/minimum_eigensolvers/sampling_vqe.py b/qiskit_algorithms/minimum_eigensolvers/sampling_vqe.py index d809ffa4..37ba5b71 100644 --- a/qiskit_algorithms/minimum_eigensolvers/sampling_vqe.py +++ b/qiskit_algorithms/minimum_eigensolvers/sampling_vqe.py @@ -348,7 +348,7 @@ def _build_sampling_vqe_result( class SamplingVQEResult(VariationalResult, SamplingMinimumEigensolverResult): - """VQE Result.""" + """The SamplingVQE Result.""" def __init__(self) -> None: super().__init__() diff --git a/qiskit_algorithms/minimum_eigensolvers/vqe.py b/qiskit_algorithms/minimum_eigensolvers/vqe.py index bab3a284..4d7af6eb 100644 --- a/qiskit_algorithms/minimum_eigensolvers/vqe.py +++ b/qiskit_algorithms/minimum_eigensolvers/vqe.py @@ -42,7 +42,7 @@ class VQE(VariationalAlgorithm, MinimumEigensolver): - r"""The variational quantum eigensolver (VQE) algorithm. + r"""The Variational Quantum Eigensolver (VQE) algorithm. VQE is a hybrid quantum-classical algorithm that uses a variational technique to find the minimum eigenvalue of a given Hamiltonian operator :math:`H`. @@ -340,7 +340,7 @@ def _build_vqe_result( class VQEResult(VariationalResult, MinimumEigensolverResult): - """Variational quantum eigensolver result.""" + """The Variational Quantum Eigensolver (VQE) result.""" def __init__(self) -> None: super().__init__() From aad527afc5d8f6be53e40a21361e625d4b0b1006 Mon Sep 17 00:00:00 2001 From: woodsp-ibm Date: Mon, 7 Aug 2023 17:10:09 -0400 Subject: [PATCH 04/13] Fix line too long --- qiskit_algorithms/__init__.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/qiskit_algorithms/__init__.py b/qiskit_algorithms/__init__.py index ef1fe271..2b2a9319 100644 --- a/qiskit_algorithms/__init__.py +++ b/qiskit_algorithms/__init__.py @@ -41,9 +41,10 @@ as minimum eigensolvers, amplitude amplifiers, time evolvers etc. Within each group the algorithms comform to an interface defined there, which allows them to be used interchangeably in an application that specifies use of an algorithm type by that interface. 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. As long as it does, for example :class:`.VQE` is one such -algorithm conforming to that interface, then the application can work with it. +application may take a minimum eigensolver, to solve a ground state problem, and require it to +conform to the :class:`.MinimumEigensolver` interface. As long as it does, for example +:class:`.VQE` is one such algorithm conforming to that interface, then the application + can work with it. Amplitude Amplifiers -------------------- @@ -112,7 +113,8 @@ -------------------- Algorithms to find the minimum eigenvalue of an operator. -The set of these algorithms, taking an ``Estimator`` primitive, that can solve for a general hamiltonian. +The set of these algorithms, taking an ``Estimator`` primitive, that can +solve for a general hamiltonian. .. autosummary:: :toctree: ../stubs/ @@ -127,8 +129,8 @@ AdaptVQE AdaptVQEResult -The set of these algorithms, taking an ``Sampler`` primitive, that can solve for a diagonal hamiltonian such -as Ising Hamiltonian of an optimization problem. +The set of these algorithms, taking an ``Sampler`` primitive, that can +solve for a diagonal hamiltonian such as an Ising Hamiltonian of an optimization problem. .. autosummary:: :toctree: ../stubs/ From 892e93b0c3031f8f3fe0ee86d531d40a9bb30097 Mon Sep 17 00:00:00 2001 From: woodsp-ibm Date: Tue, 8 Aug 2023 09:08:19 -0400 Subject: [PATCH 05/13] Fix indent space --- qiskit_algorithms/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_algorithms/__init__.py b/qiskit_algorithms/__init__.py index 2b2a9319..a8c88154 100644 --- a/qiskit_algorithms/__init__.py +++ b/qiskit_algorithms/__init__.py @@ -44,7 +44,7 @@ application may take a minimum eigensolver, to solve a ground state problem, and require it to conform to the :class:`.MinimumEigensolver` interface. As long as it does, for example :class:`.VQE` is one such algorithm conforming to that interface, then the application - can work with it. +can work with it. Amplitude Amplifiers -------------------- From e57ed111f28e774ef4423eee49dca19b2fa3bbb4 Mon Sep 17 00:00:00 2001 From: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com> Date: Tue, 15 Aug 2023 11:42:43 -0400 Subject: [PATCH 06/13] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> --- qiskit_algorithms/__init__.py | 29 ++++++++++++------------ qiskit_algorithms/optimizers/__init__.py | 3 +-- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/qiskit_algorithms/__init__.py b/qiskit_algorithms/__init__.py index a8c88154..99f8ff2b 100644 --- a/qiskit_algorithms/__init__.py +++ b/qiskit_algorithms/__init__.py @@ -20,12 +20,12 @@ problems in different domains on simulators and near-term real quantum devices using short depth circuits. -Now there are some classical algorithms here, for example the :class:`.NumPyMinimumEigensolver`, -which take the same input but solve the problem classically. This has utility in the near-term, +The library includes some algorithms, for example the :class:`.NumPyMinimumEigensolver`, which take +the same input as their quantum counterpart but solve the problem classically. This has utility in the near-term, where problems are still tractable classically, to validate and/or act as a reference. There are also classical :mod:`.optimizers` for use with variational algorithms such as :class:`.VQE`. -While :mod:`.optimizers` were been mentioned, algorithms may also use :mod:`.gradients` and +Other common subroutines used by this module's algorithms are :mod:`.gradients` and :mod:`.state_fidelities`. Any of these may also be used directly if you have need of such function. The quantum algorithms here all use ``Primitives`` to execute quantum circuits. This can be an @@ -37,14 +37,13 @@ Algorithms ========== -The algorithms are now presented and are grouped by logical function, such -as minimum eigensolvers, amplitude amplifiers, time evolvers etc. Within each group the -algorithms comform to an interface defined there, which allows them to be used interchangeably -in an application that specifies use of an algorithm type by that interface. 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. As long as it does, for example -:class:`.VQE` is one such algorithm conforming to that interface, then the application -can work with it. +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 +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. Amplitude Amplifiers -------------------- @@ -113,8 +112,8 @@ -------------------- Algorithms to find the minimum eigenvalue of an operator. -The set of these algorithms, taking an ``Estimator`` primitive, that can -solve for a general hamiltonian. +This set of these algorithms take an ``Estimator`` primitive and can +solve for a general Hamiltonian. .. autosummary:: :toctree: ../stubs/ @@ -129,8 +128,8 @@ AdaptVQE AdaptVQEResult -The set of these algorithms, taking an ``Sampler`` primitive, that can -solve for a diagonal hamiltonian such as an Ising Hamiltonian of an optimization problem. +This set of algorithms take a ``Sampler`` primitive and can only +solve for a diagonal Hamiltonian, such as an Ising Hamiltonian of an optimization problem. .. autosummary:: :toctree: ../stubs/ diff --git a/qiskit_algorithms/optimizers/__init__.py b/qiskit_algorithms/optimizers/__init__.py index 03c30314..c196c85b 100644 --- a/qiskit_algorithms/optimizers/__init__.py +++ b/qiskit_algorithms/optimizers/__init__.py @@ -87,8 +87,7 @@ Qiskit also provides the following optimizers, which are built-out using the optimizers from `scikit-quant `_. The ``scikit-quant`` package is not installed by default but must be explicitly installed, if desired, by the user. The -optimizers therein are provided under various licenses hence it has been made an optional install -so a user's choice to do so is their own. +optimizers therein are provided under various licenses, hence it has been made an optional install. To install the ``scikit-quant`` dependent package you can use ``pip install scikit-quant``. .. autosummary:: From e7a5f56fd7cd013de4ccc76bea1c4adb43e42a70 Mon Sep 17 00:00:00 2001 From: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com> Date: Tue, 15 Aug 2023 11:53:59 -0400 Subject: [PATCH 07/13] Update qiskit_algorithms/__init__.py --- qiskit_algorithms/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qiskit_algorithms/__init__.py b/qiskit_algorithms/__init__.py index adce55b4..be6acd5d 100644 --- a/qiskit_algorithms/__init__.py +++ b/qiskit_algorithms/__init__.py @@ -21,8 +21,8 @@ using short depth circuits. The library includes some algorithms, for example the :class:`.NumPyMinimumEigensolver`, which take -the same input as their quantum counterpart but solve the problem classically. This has utility in the near-term, -where problems are still tractable classically, to validate and/or act as a reference. +the same input as their quantum counterpart but solve the problem classically. This has utility +in the near-term, where problems are still tractable classically, to validate and/or act as a reference. There are also classical :mod:`.optimizers` for use with variational algorithms such as :class:`.VQE`. Other common subroutines used by this module's algorithms are :mod:`.gradients` and From ce1a9c810af2e1ccc3c92e8a6bdf85e19204adfa Mon Sep 17 00:00:00 2001 From: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com> Date: Tue, 15 Aug 2023 12:20:13 -0400 Subject: [PATCH 08/13] Update qiskit_algorithms/__init__.py Change text to trigger CLA check --- qiskit_algorithms/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qiskit_algorithms/__init__.py b/qiskit_algorithms/__init__.py index be6acd5d..4df197c5 100644 --- a/qiskit_algorithms/__init__.py +++ b/qiskit_algorithms/__init__.py @@ -21,8 +21,8 @@ using short depth circuits. The library includes some algorithms, for example the :class:`.NumPyMinimumEigensolver`, which take -the same input as their quantum counterpart but solve the problem classically. This has utility -in the near-term, where problems are still tractable classically, to validate and/or act as a reference. +the same input as their quantum counterpart but solve the problem classically. This has utility in +the near-term, where problems are still tractable classically, to validate and/or act as a reference. There are also classical :mod:`.optimizers` for use with variational algorithms such as :class:`.VQE`. Other common subroutines used by this module's algorithms are :mod:`.gradients` and From 57795cc988935fcc7753fe114066c0f2fd2cc73a Mon Sep 17 00:00:00 2001 From: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com> Date: Wed, 16 Aug 2023 08:29:47 -0400 Subject: [PATCH 09/13] Update qiskit_algorithms/__init__.py Co-authored-by: Julien Gacon --- qiskit_algorithms/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_algorithms/__init__.py b/qiskit_algorithms/__init__.py index 4df197c5..d2099dfe 100644 --- a/qiskit_algorithms/__init__.py +++ b/qiskit_algorithms/__init__.py @@ -18,7 +18,7 @@ `Qiskit `_. These algorithms can be used to carry out research and investigate how to solve problems in different domains on simulators and near-term real quantum devices -using short depth circuits. +using shallow circuits. The library includes some algorithms, for example the :class:`.NumPyMinimumEigensolver`, which take the same input as their quantum counterpart but solve the problem classically. This has utility in From 37013d5c85b027cd2150bd04e080ebed578b4e5d Mon Sep 17 00:00:00 2001 From: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com> Date: Wed, 16 Aug 2023 08:30:05 -0400 Subject: [PATCH 10/13] Update qiskit_algorithms/__init__.py Co-authored-by: Julien Gacon --- qiskit_algorithms/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qiskit_algorithms/__init__.py b/qiskit_algorithms/__init__.py index d2099dfe..93fc45da 100644 --- a/qiskit_algorithms/__init__.py +++ b/qiskit_algorithms/__init__.py @@ -25,8 +25,7 @@ the near-term, where problems are still tractable classically, to validate and/or act as a reference. There are also classical :mod:`.optimizers` for use with variational algorithms such as :class:`.VQE`. -Other common subroutines used by this module's algorithms are :mod:`.gradients` and -:mod:`.state_fidelities`. Any of these may also be used directly if you have need of such function. +This package also provides common building blocks for algorithms, such quantum circuit gradients (:mod:`.gradients`) and fidelities of quantum states (:mod:`.state_fidelities`). These elements are frequently used in a variety of applications, such as variational optimization, time evolution or QML. The quantum algorithms here all use ``Primitives`` to execute quantum circuits. This can be an ``Estimator``, which computes expectation values, or a ``Sampler`` which computes From 01955d80d8625876f10dbadd94d900971acc19ce Mon Sep 17 00:00:00 2001 From: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com> Date: Wed, 16 Aug 2023 08:35:05 -0400 Subject: [PATCH 11/13] Update qiskit_algorithms/__init__.py Co-authored-by: Julien Gacon --- qiskit_algorithms/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qiskit_algorithms/__init__.py b/qiskit_algorithms/__init__.py index 93fc45da..2d30b881 100644 --- a/qiskit_algorithms/__init__.py +++ b/qiskit_algorithms/__init__.py @@ -27,7 +27,9 @@ This package also provides common building blocks for algorithms, such quantum circuit gradients (:mod:`.gradients`) and fidelities of quantum states (:mod:`.state_fidelities`). These elements are frequently used in a variety of applications, such as variational optimization, time evolution or QML. -The quantum algorithms here all use ``Primitives`` to execute quantum circuits. This can be an +The quantum algorithms here all use +`Primitives `__ +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. From 73a51aea6987b354ee3107c8ca100201707c5fa2 Mon Sep 17 00:00:00 2001 From: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com> Date: Wed, 16 Aug 2023 08:35:20 -0400 Subject: [PATCH 12/13] Update qiskit_algorithms/__init__.py Co-authored-by: Julien Gacon --- qiskit_algorithms/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_algorithms/__init__.py b/qiskit_algorithms/__init__.py index 2d30b881..3a63f6de 100644 --- a/qiskit_algorithms/__init__.py +++ b/qiskit_algorithms/__init__.py @@ -41,7 +41,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. From 6ab34fbf6b5f1aa8d75d6aba1d6f01771d86d194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elena=20Pe=C3=B1a=20Tapia?= <57907331+ElePT@users.noreply.github.com> Date: Wed, 16 Aug 2023 15:32:07 +0200 Subject: [PATCH 13/13] Update qiskit_algorithms/__init__.py Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com> --- qiskit_algorithms/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qiskit_algorithms/__init__.py b/qiskit_algorithms/__init__.py index 3a63f6de..4ccd4525 100644 --- a/qiskit_algorithms/__init__.py +++ b/qiskit_algorithms/__init__.py @@ -25,7 +25,10 @@ the near-term, where problems are still tractable classically, to validate and/or act as a reference. There are also classical :mod:`.optimizers` for use with variational algorithms such as :class:`.VQE`. -This package also provides common building blocks for algorithms, such quantum circuit gradients (:mod:`.gradients`) and fidelities of quantum states (:mod:`.state_fidelities`). These elements are frequently used in a variety of applications, such as variational optimization, time evolution or QML. +This package also provides common building blocks for algorithms, such quantum circuit +gradients (:mod:`.gradients`) and fidelities of quantum states (:mod:`.state_fidelities`). +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 `__