Skip to content

Commit bee5e7f

Browse files
Remove deprecated methods in qiskit.algorithms (Qiskit#7257)
* rm deprecated algo methods * add reno * fix tests, remove from varalgo * intial point was said to be abstract in varalgo! * attempt to fix sphinx #1 of ? Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent ccc371f commit bee5e7f

File tree

5 files changed

+28
-448
lines changed

5 files changed

+28
-448
lines changed

qiskit/algorithms/minimum_eigen_solvers/vqe.py

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
from qiskit.opflow.gradients import GradientBase
3939
from qiskit.utils.validation import validate_min
4040
from qiskit.utils.backend_utils import is_aer_provider
41-
from qiskit.utils.deprecation import deprecate_function
4241
from qiskit.utils import QuantumInstance, algorithm_globals
4342
from ..optimizers import Optimizer, SLSQP
4443
from ..variational_algorithm import VariationalAlgorithm, VariationalResult
@@ -648,51 +647,6 @@ def energy_evaluation(parameters):
648647

649648
return energy_evaluation
650649

651-
@deprecate_function(
652-
"""
653-
The VQE.get_optimal_cost method is deprecated as of Qiskit Terra 0.18.0
654-
and will be removed no sooner than 3 months after the releasedate.
655-
This information is part of the returned result object and can be
656-
queried as VQEResult.eigenvalue."""
657-
)
658-
def get_optimal_cost(self) -> float:
659-
"""Get the minimal cost or energy found by the VQE."""
660-
if self._ret.optimal_point is None:
661-
raise AlgorithmError(
662-
"Cannot return optimal cost before running the algorithm to find optimal params."
663-
)
664-
return self._ret.optimal_value
665-
666-
@deprecate_function(
667-
"""
668-
The VQE.get_optimal_circuit method is deprecated as of Qiskit Terra
669-
0.18.0 and will be removed no sooner than 3 months after the releasedate.
670-
This information is part of the returned result object and can be
671-
queried as VQEResult.ansatz.bind_parameters(VQEResult.optimal_point)."""
672-
)
673-
def get_optimal_circuit(self) -> QuantumCircuit:
674-
"""Get the circuit with the optimal parameters."""
675-
if self._ret.optimal_point is None:
676-
raise AlgorithmError(
677-
"Cannot find optimal circuit before running the algorithm to find optimal params."
678-
)
679-
return self.ansatz.assign_parameters(self._ret.optimal_parameters)
680-
681-
@deprecate_function(
682-
"""
683-
The VQE.get_optimal_vector method is deprecated as of Qiskit Terra 0.18.0
684-
and will be removed no sooner than 3 months after the releasedate.
685-
This information is part of the returned result object and can be
686-
queried as VQEResult.eigenvector."""
687-
)
688-
def get_optimal_vector(self) -> Union[List[float], Dict[str, int]]:
689-
"""Get the simulation outcome of the optimal circuit."""
690-
if self._ret.optimal_parameters is None:
691-
raise AlgorithmError(
692-
"Cannot find optimal circuit before running the algorithm to find optimal vector."
693-
)
694-
return self._get_eigenstate(self._ret.optimal_parameters)
695-
696650
def _get_eigenstate(self, optimal_parameters) -> Union[List[float], Dict[str, int]]:
697651
"""Get the simulation outcome of the ansatz, provided with parameters."""
698652
optimal_circuit = self.ansatz.bind_parameters(optimal_parameters)
@@ -704,20 +658,6 @@ def _get_eigenstate(self, optimal_parameters) -> Union[List[float], Dict[str, in
704658

705659
return state
706660

707-
@property
708-
@deprecate_function(
709-
"""
710-
The VQE.optimal_params property is deprecated as of Qiskit Terra 0.18.0
711-
and will be removed no sooner than 3 months after the releasedate.
712-
This information is part of the returned result object and can be
713-
queried as VQEResult.optimal_point."""
714-
)
715-
def optimal_params(self) -> np.ndarray:
716-
"""The optimal parameters for the ansatz."""
717-
if self._ret.optimal_point is None:
718-
raise AlgorithmError("Cannot find optimal params before running the algorithm.")
719-
return self._ret.optimal_point
720-
721661

722662
class VQEResult(VariationalResult, MinimumEigensolverResult):
723663
"""VQE Result."""

qiskit/algorithms/phase_estimators/hamiltonian_phase_estimation_result.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515

1616
from typing import Dict, Union, cast
17-
from qiskit.utils.deprecation import deprecate_function
1817
from qiskit.algorithms.algorithm_result import AlgorithmResult
1918
from .phase_estimation_result import PhaseEstimationResult
2019
from .phase_estimation_scale import PhaseEstimationScale
@@ -84,20 +83,6 @@ def filter_phases(
8483
else:
8584
return cast(Dict, phases)
8685

87-
@property
88-
@deprecate_function(
89-
"""The 'HamiltonianPhaseEstimationResult.most_likely_phase' attribute
90-
is deprecated as of 0.18.0 and will be removed no earlier than 3 months
91-
after the release date. It has been renamed as the 'phase' attribute."""
92-
)
93-
def most_likely_phase(self) -> float:
94-
"""DEPRECATED - The most likely phase of the unitary corresponding to the Hamiltonian.
95-
96-
Returns:
97-
The most likely phase.
98-
"""
99-
return self.phase
100-
10186
@property
10287
def phase(self) -> float:
10388
"""The most likely phase of the unitary corresponding to the Hamiltonian.

0 commit comments

Comments
 (0)