Skip to content

Commit

Permalink
Use Aer's SamplerV2 instead of SamplerV1
Browse files Browse the repository at this point in the history
Addresses part of #506
  • Loading branch information
garrison committed Jul 17, 2024
1 parent f36020e commit 0a16d16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions test/cutting/test_cutting_roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
)
from qiskit.quantum_info import PauliList, random_unitary
from qiskit.primitives import Estimator
from qiskit_aer.primitives import Sampler
from qiskit_aer.primitives import Sampler, SamplerV2

from circuit_knitting.utils.simulation import ExactSampler
from circuit_knitting.cutting import (
Expand Down Expand Up @@ -172,7 +172,8 @@ def test_cutting_exact_reconstruction(example_circuit):


@pytest.mark.parametrize(
"sampler,is_exact_sampler", [(Sampler(), False), (ExactSampler(), True)]
"sampler,is_exact_sampler",
[(Sampler(), False), (SamplerV2(), False), (ExactSampler(), True)],
)
def test_sampler_with_identity_subobservable(sampler, is_exact_sampler):
"""This test ensures that the sampler works for a subcircuit with no observable measurements.
Expand Down
6 changes: 3 additions & 3 deletions test/cutting/test_cutting_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit.providers.fake_provider import GenericBackendV2
from qiskit_ibm_runtime import SamplerV2
from qiskit_aer.primitives import Sampler
from qiskit_aer.primitives import SamplerV2 as AerSamplerV2
from qiskit_aer import AerSimulator

from circuit_knitting.cutting.qpd.instructions import SingleQubitQPDGate
Expand Down Expand Up @@ -89,8 +89,8 @@ def test_exotic_labels(label1, label2):
assert subexperiments.keys() == subcircuits.keys()

samplers = {
label1: Sampler(run_options={"shots": 10}),
label2: Sampler(run_options={"shots": 10}),
label1: AerSamplerV2(run_options={"shots": 10}),
label2: AerSamplerV2(run_options={"shots": 10}),
}
results = {
label: sampler.run(subexperiments[label]).result()
Expand Down

0 comments on commit 0a16d16

Please sign in to comment.