Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky test in mitiq/zne/tests/test_zne.py #2442

Closed
purva-thakre opened this issue Jul 6, 2024 · 1 comment
Closed

Flaky test in mitiq/zne/tests/test_zne.py #2442

purva-thakre opened this issue Jul 6, 2024 · 1 comment
Labels
bug Something isn't working os: mac os: windows zne Zero-noise extrapolation.

Comments

@purva-thakre
Copy link
Collaborator

purva-thakre commented Jul 6, 2024

Noticed the failure here: https://github.com/unitaryfund/mitiq/actions/runs/9814019705/job/27101033866#step:6:4363

If I rerun the workflow, the test passes.

image

@pytest.mark.parametrize(
"executor", (sample_bitstrings, compute_density_matrix)
)
def test_with_observable_batched_factory(executor):
observable = Observable(PauliString(spec="Z"))
circuit = cirq.Circuit(cirq.H.on(cirq.LineQubit(0))) * 20
noisy_value = observable.expectation(circuit, sample_bitstrings)
zne_value = execute_with_zne(
circuit,
executor=functools.partial(
executor, noise_model_function=cirq.depolarize
),
observable=observable,
factory=PolyFactory(scale_factors=[1, 3, 5], order=2),
)
true_value = observable.expectation(
circuit, functools.partial(compute_density_matrix, noise_level=(0,))
)
assert abs(zne_value - true_value) <= abs(noisy_value - true_value)

def sample_bitstrings(

@cosenal
Copy link
Contributor

cosenal commented Aug 15, 2024

Closing as dupe of #1896.

@cosenal cosenal closed this as completed Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working os: mac os: windows zne Zero-noise extrapolation.
Projects
None yet
Development

No branches or pull requests

2 participants