Skip to content

Commit

Permalink
Use BaseSamplerV1 with explicit version (#653) (#654)
Browse files Browse the repository at this point in the history
This change is motivated by the following warning:

> DeprecationWarning: The class ``qiskit.primitives.base.base_sampler.BaseSampler``
> is deprecated as of qiskit 1.2. It will be removed no earlier
> than 3 months after the release date. The `BaseSampler` class is
> a type alias for the `BaseSamplerV1` interface that has been
> deprecated in favor of explicitly versioned interface classes.
> It is recommended to migrate all implementations to use
> `BaseSamplerV2`. However, for implementations incompatible with
> `BaseSamplerV2`, `BaseSampler` can be replaced with the explicitly
> versioned `BaseSamplerV1` class.

Related to #551 and #506.

(cherry picked from commit a9bfc91)

Co-authored-by: Jim Garrison <garrison@ibm.com>
  • Loading branch information
mergify[bot] and garrison authored Aug 2, 2024
1 parent 6aff8fa commit f0f7897
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions circuit_knitting/utils/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import numpy as np
from qiskit.circuit import QuantumCircuit
from qiskit.quantum_info import Statevector, Operator
from qiskit.primitives.base import BaseSampler, SamplerResult
from qiskit.primitives.base import BaseSamplerV1, SamplerResult
from qiskit.primitives.primitive_job import PrimitiveJob
from qiskit.result import QuasiDistribution

Expand Down Expand Up @@ -128,7 +128,7 @@ def simulate_statevector_outcomes(qc: QuantumCircuit, /) -> dict[int, float]:
return {outcome: sum(prob for prob, _ in svs) for outcome, svs in current.items()}


class ExactSampler(BaseSampler):
class ExactSampler(BaseSamplerV1):
"""Sampler which returns exact probabilities for each possible outcome.
This sampler supports:
Expand Down

0 comments on commit f0f7897

Please sign in to comment.