Skip to content

Commit

Permalink
Revert "Implemented general Quantum Time Evolution Framework interfac…
Browse files Browse the repository at this point in the history
…es. (Qiskit/qiskit#7669)" (Qiskit/qiskit#7845)

* Revert "Implemented general Quantum Time Evolution Framework interfaces. (Qiskit/qiskit#7669)"

This reverts commit 6566c43.

* Fix dangling import

After Qiskit/qiskit#7669 the custom ListOrDict type it added was used in Qiskit/qiskit#7758. This
was missed in the straight revert of Qiskit/qiskit#7669 which was causing an import
error. This commit fixes this oversight by updating the the import in
aux_ops_evaluator to use the ListOrDict type where it lives with Qiskit/qiskit#7669
reverted (this is why we should try to keep each PR to a single logical
change and avoid unrelated refactors in a PR).

Co-authored-by: Matthew Treinish <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 31, 2022
1 parent e21151d commit 2a7ffe9
Show file tree
Hide file tree
Showing 20 changed files with 15 additions and 409 deletions.
23 changes: 0 additions & 23 deletions qiskit_algorithms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,6 @@
NumPyEigensolver
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:
RealEvolver
ImaginaryEvolver
EvolutionResult
EvolutionProblem
Factorizers
-----------
Expand Down Expand Up @@ -204,9 +188,6 @@
"""

from .algorithm_result import AlgorithmResult
from .evolvers import EvolutionResult, EvolutionProblem
from .evolvers.real.real_evolver import RealEvolver
from .evolvers.imaginary.imaginary_evolver import ImaginaryEvolver
from .variational_algorithm import VariationalAlgorithm, VariationalResult
from .amplitude_amplifiers import Grover, GroverResult, AmplificationProblem, AmplitudeAmplifier
from .amplitude_estimators import (
Expand Down Expand Up @@ -264,10 +245,6 @@
"MaximumLikelihoodAmplitudeEstimationResult",
"EstimationProblem",
"NumPyEigensolver",
"RealEvolver",
"ImaginaryEvolver",
"EvolutionResult",
"EvolutionProblem",
"LinearSolverResult",
"Eigensolver",
"EigensolverResult",
Expand Down
2 changes: 1 addition & 1 deletion qiskit_algorithms/aux_ops_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import numpy as np

from qiskit import QuantumCircuit
from qiskit.algorithms.minimum_eigen_solvers.minimum_eigen_solver import ListOrDict
from qiskit.algorithms.eigen_solvers.eigen_solver import ListOrDict
from qiskit.opflow import (
CircuitSampler,
ListOp,
Expand Down
8 changes: 5 additions & 3 deletions qiskit_algorithms/eigen_solvers/eigen_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
"""The Eigensolver interface"""

from abc import ABC, abstractmethod
from typing import Optional, List, Tuple
from typing import Dict, Optional, List, Union, Tuple, TypeVar

import numpy as np

from qiskit.opflow import OperatorBase
from ..algorithm_result import AlgorithmResult
from ..list_or_dict import ListOrDict

# Introduced new type to maintain readability.
_T = TypeVar("_T") # Pylint does not allow single character class names.
ListOrDict = Union[List[Optional[_T]], Dict[str, _T]]


class Eigensolver(ABC):
Expand Down
3 changes: 1 addition & 2 deletions qiskit_algorithms/eigen_solvers/numpy_eigen_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
from qiskit.opflow import I, ListOp, OperatorBase, StateFn
from qiskit.utils.validation import validate_min
from ..exceptions import AlgorithmError
from .eigen_solver import Eigensolver, EigensolverResult
from ..list_or_dict import ListOrDict
from .eigen_solver import Eigensolver, EigensolverResult, ListOrDict

logger = logging.getLogger(__name__)

Expand Down
21 changes: 0 additions & 21 deletions qiskit_algorithms/evolvers/__init__.py

This file was deleted.

58 changes: 0 additions & 58 deletions qiskit_algorithms/evolvers/evolution_problem.py

This file was deleted.

40 changes: 0 additions & 40 deletions qiskit_algorithms/evolvers/evolution_result.py

This file was deleted.

36 changes: 0 additions & 36 deletions qiskit_algorithms/evolvers/evolver.py

This file was deleted.

11 changes: 0 additions & 11 deletions qiskit_algorithms/evolvers/imaginary/__init__.py

This file was deleted.

21 changes: 0 additions & 21 deletions qiskit_algorithms/evolvers/imaginary/imaginary_evolver.py

This file was deleted.

11 changes: 0 additions & 11 deletions qiskit_algorithms/evolvers/real/__init__.py

This file was deleted.

21 changes: 0 additions & 21 deletions qiskit_algorithms/evolvers/real/real_evolver.py

This file was deleted.

18 changes: 0 additions & 18 deletions qiskit_algorithms/list_or_dict.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
"""The Minimum Eigensolver interface"""

from abc import ABC, abstractmethod
from typing import Optional, Tuple
from typing import Dict, Optional, List, Union, Tuple, TypeVar

import numpy as np

from qiskit.opflow import OperatorBase
from ..algorithm_result import AlgorithmResult
from ..list_or_dict import ListOrDict

# Introduced new type to maintain readability.
_T = TypeVar("_T") # Pylint does not allow single character class names.
ListOrDict = Union[List[Optional[_T]], Dict[str, _T]]


class MinimumEigensolver(ABC):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

from qiskit.opflow import OperatorBase
from ..eigen_solvers.numpy_eigen_solver import NumPyEigensolver
from .minimum_eigen_solver import MinimumEigensolver, MinimumEigensolverResult
from ..list_or_dict import ListOrDict
from .minimum_eigen_solver import MinimumEigensolver, MinimumEigensolverResult, ListOrDict

logger = logging.getLogger(__name__)

Expand Down
3 changes: 1 addition & 2 deletions qiskit_algorithms/minimum_eigen_solvers/vqe.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@
from qiskit.utils.validation import validate_min
from qiskit.utils.backend_utils import is_aer_provider
from qiskit.utils import QuantumInstance, algorithm_globals
from ..list_or_dict import ListOrDict
from ..optimizers import Optimizer, SLSQP, OptimizerResult
from ..variational_algorithm import VariationalAlgorithm, VariationalResult
from .minimum_eigen_solver import MinimumEigensolver, MinimumEigensolverResult
from .minimum_eigen_solver import MinimumEigensolver, MinimumEigensolverResult, ListOrDict
from ..exceptions import AlgorithmError
from ..aux_ops_evaluator import eval_observables

Expand Down
11 changes: 0 additions & 11 deletions test/evolvers/__init__.py

This file was deleted.

Loading

0 comments on commit 2a7ffe9

Please sign in to comment.