Skip to content

Commit

Permalink
Projected Variational Quantum Dynamics (Qiskit/qiskit#8304)
Browse files Browse the repository at this point in the history
* pvqd dradt

* update as theta + difference

* black

* refactor test

* update to new time evo framework

* add gradients

* use gradient only if supported

* polishing!

- reno
- remove old pvqd file
- allow attributes to be None
- more tests

* fix algorithms import

* changes from code review

* add more tests for  different ops

* refactor PVQD to multiple files

* remove todo

* comments from review

* rm OrderedDict from unitary

no idea why this unused import existed, that should be caught before this PR?

* changes from code review

* remove function to attach intial states

* include comments from review

- support MatrixOp
- default for timestep
- update reno with refs
- test step and get_loss

* make only quantum instance and optimizer optional, and use num_timesteps

* fix docs

* add comment why Optimizer is optional

* use class attributes to document mutable attrs

* rm duplicate quantum_instance doc

* fix attributes docs

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
Cryoris and mergify[bot] authored Aug 4, 2022
1 parent e2d5972 commit adc48b5
Show file tree
Hide file tree
Showing 7 changed files with 921 additions and 2 deletions.
5 changes: 5 additions & 0 deletions qiskit_algorithms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
RealEvolver
ImaginaryEvolver
TrotterQRTE
PVQD
PVQDResult
EvolutionResult
EvolutionProblem
Expand Down Expand Up @@ -246,6 +248,7 @@
from .exceptions import AlgorithmError
from .aux_ops_evaluator import eval_observables
from .evolvers.trotterization import TrotterQRTE
from .evolvers.pvqd import PVQD, PVQDResult

__all__ = [
"AlgorithmResult",
Expand Down Expand Up @@ -292,6 +295,8 @@
"PhaseEstimationScale",
"PhaseEstimation",
"PhaseEstimationResult",
"PVQD",
"PVQDResult",
"IterativePhaseEstimation",
"AlgorithmError",
"eval_observables",
Expand Down
6 changes: 4 additions & 2 deletions qiskit_algorithms/evolvers/evolution_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(
self,
hamiltonian: OperatorBase,
time: float,
initial_state: Union[StateFn, QuantumCircuit],
initial_state: Optional[Union[StateFn, QuantumCircuit]] = None,
aux_operators: Optional[ListOrDict[OperatorBase]] = None,
truncation_threshold: float = 1e-12,
t_param: Optional[Parameter] = None,
Expand All @@ -41,7 +41,9 @@ def __init__(
Args:
hamiltonian: The Hamiltonian under which to evolve the system.
time: Total time of evolution.
initial_state: Quantum state to be evolved.
initial_state: The quantum state to be evolved for methods like Trotterization.
For variational time evolutions, where the evolution happens in an ansatz,
this argument is not required.
aux_operators: Optional list of auxiliary operators to be evaluated with the
evolved ``initial_state`` and their expectation values returned.
truncation_threshold: Defines a threshold under which values can be assumed to be 0.
Expand Down
18 changes: 18 additions & 0 deletions qiskit_algorithms/evolvers/pvqd/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# 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.

"""The projected Variational Quantum Dynamic (p-VQD) module."""

from .pvqd_result import PVQDResult
from .pvqd import PVQD

__all__ = ["PVQD", "PVQDResult"]
Loading

0 comments on commit adc48b5

Please sign in to comment.