From 6818443d3532fc71a8c2d2167d509e557441b070 Mon Sep 17 00:00:00 2001 From: Pedro Rivero Date: Mon, 5 Feb 2024 18:39:39 -0500 Subject: [PATCH] fix(zne_estrategy): update default amplifier to multi-qubit (#62) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Summary Update default amplifier in `ZNEStrategy` to act on all multi-qubit gates (i.e. `MultiQubitAmplifier`) instead of just two-qubit gates (i.e. `TwoQubitAmplifier`). ### Details and comments Builds towards solving #58 --- test/test_zne_strategy.py | 6 +++--- zne/zne_strategy.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_zne_strategy.py b/test/test_zne_strategy.py index 94cb90d..85080eb 100644 --- a/test/test_zne_strategy.py +++ b/test/test_zne_strategy.py @@ -22,7 +22,7 @@ from zne.extrapolation import Extrapolator, LinearExtrapolator from zne.noise_amplification import NoiseAmplifier -from zne.noise_amplification.folding_amplifier import TwoQubitAmplifier +from zne.noise_amplification.folding_amplifier import MultiQubitAmplifier from zne.zne_strategy import ZNEStrategy from . import NO_ITERS_NONE, NO_NONE @@ -68,7 +68,7 @@ class TestInit: def test_defaults(self): """Test default configuration.""" - assert ZNEStrategy().noise_amplifier == TwoQubitAmplifier() + assert ZNEStrategy().noise_amplifier == MultiQubitAmplifier() assert ZNEStrategy().noise_factors == (1,) assert ZNEStrategy().extrapolator == LinearExtrapolator() @@ -277,7 +277,7 @@ class TestNoiseAmplifier: def test_default(self): zne_strategy = ZNEStrategy() zne_strategy.noise_amplifier = None - assert zne_strategy.noise_amplifier == TwoQubitAmplifier() + assert zne_strategy.noise_amplifier == MultiQubitAmplifier() @mark.parametrize( "noise_amplifier", diff --git a/zne/zne_strategy.py b/zne/zne_strategy.py index 6ad5c62..d7cda88 100644 --- a/zne/zne_strategy.py +++ b/zne/zne_strategy.py @@ -24,7 +24,7 @@ from qiskit.primitives import EstimatorResult from .extrapolation import Extrapolator, LinearExtrapolator -from .noise_amplification import NoiseAmplifier, TwoQubitAmplifier +from .noise_amplification import MultiQubitAmplifier, NoiseAmplifier from .types import EstimatorResultData, Metadata # noqa: F401 from .utils.grouping import from_common_key, group_elements_gen, merge_dicts from .utils.typing import isreal, normalize_array @@ -120,7 +120,7 @@ def noise_factors(self, noise_factors: Sequence[float]) -> tuple[float, ...]: return noise_factors - @quality(default=TwoQubitAmplifier()) + @quality(default=MultiQubitAmplifier()) def noise_amplifier(self, noise_amplifier: NoiseAmplifier) -> NoiseAmplifier: """Noise amplifier strategy for ZNE.