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

LRE failure for chunking #2608

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions mitiq/lre/tests/test_lre.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,18 @@ def execute(circuit, noise_level=0.025):

def test_lre_executor_with_chunking():
"""Verify the executor works as expected for chunking a large circuit into
a smaller circuit."""
a smaller circuit. Note that this does not verify whether the chunked
circuit gets better results compared to a non-chunked circuit."""
# define a larger circuit
test_cirq = benchmarks.generate_rb_circuits(n_qubits=1, num_cliffords=12)[
0
]
lre_exp_val = execute_with_lre(
lre_exp_val_chunking = execute_with_lre(
test_cirq, execute, degree=2, fold_multiplier=2, num_chunks=14
)
assert abs(lre_exp_val - ideal_val) <= abs(noisy_val - ideal_val)
# verify we get an expectation value
assert(lre_exp_val_chunking) > 0

Copy link
Collaborator Author

@purva-thakre purva-thakre Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@natestemen I cannot think of a better test here. Which is why I decided to check the function does provided a non-zero expectation value.

test_layerwise_folding already has a test comparing the number of noise-scaled layers for a chunked and a non-chunked circuit.



@pytest.mark.parametrize("input_method", [(fold_global), (fold_all)])
Expand Down
Loading