Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
purva-thakre committed Sep 27, 2024
1 parent ce46c58 commit 4561acb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
6 changes: 4 additions & 2 deletions mitiq/lre/lre.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ def mitigate_executor(
input_circuit: Circuit to be scaled.
executor: Executes a circuit and returns a `QuantumResult`
degree: Degree of the multivariate polynomial.
fold_multiplier: Scaling gap required by unitary folding.
fold_multiplier Scaling gap value required for unitary folding which
is used to generate the scale factor vectors.
folding_method: Unitary folding method. Default is
:func:`fold_gates_at_random`.
num_chunks: Number of desired approximately equal chunks. When the
Expand Down Expand Up @@ -143,7 +144,8 @@ def lre_decorator(
input_circuit: Circuit to be scaled.
executor: Executes a circuit and returns a `QuantumResult`
degree: Degree of the multivariate polynomial.
fold_multiplier: Scaling gap required by unitary folding.
fold_multiplier Scaling gap value required for unitary folding which
is used to generate the scale factor vectors.
folding_method: Unitary folding method. Default is
:func:`fold_gates_at_random`.
num_chunks: Number of desired approximately equal chunks. When the
Expand Down
14 changes: 5 additions & 9 deletions mitiq/lre/tests/test_lre.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
)[0]


# default execute function for all unit tests
def execute(circuit, noise_level=0.025):
"""Default executor for all unit tests."""
noisy_circuit = circuit.with_noise(depolarize(p=noise_level))
Expand Down Expand Up @@ -45,10 +46,7 @@ def test_lre_exp_value(input_degree, input_fold_multiplier):
"input_degree, input_fold_multiplier", [(2, 2), (2, 3), (3, 4)]
)
def test_lre_exp_value_decorator(input_degree, input_fold_multiplier):
"""Verify LRE executors work as expected."""

# move to a separate test
# verify the mitigated decorator work as expected
"""Verify LRE mitigated executor work as expected."""
mitigated_executor = mitigate_executor(
execute, degree=2, fold_multiplier=2
)
Expand All @@ -63,8 +61,7 @@ def test_lre_decorator():

@lre_decorator(degree=2, fold_multiplier=2)
def execute(circuit, noise_level=0.025):
mitiq_circuit = circuit
noisy_circuit = mitiq_circuit.with_noise(depolarize(p=noise_level))
noisy_circuit = circuit.with_noise(depolarize(p=noise_level))
rho = (
DensityMatrixSimulator()
.simulate(noisy_circuit)
Expand All @@ -82,8 +79,7 @@ def test_lre_decorator_raised_error():

@lre_decorator()
def execute(circuit, noise_level=0.025):
mitiq_circuit = circuit
noisy_circuit = mitiq_circuit.with_noise(depolarize(p=noise_level))
noisy_circuit = circuit.with_noise(depolarize(p=noise_level))
rho = (
DensityMatrixSimulator()
.simulate(noisy_circuit)
Expand Down Expand Up @@ -115,7 +111,7 @@ def test_lre_executor_with_chunking():
@pytest.mark.xfail
def test_lre_executor_with_chunking_failures(test_input):
"""Verify chunking fails when a large number of layers are chunked into a
smaller number of circuit layers."""
smaller number of circuit chunks."""
# define a larger circuit
test_cirq = benchmarks.generate_rb_circuits(n_qubits=1, num_cliffords=15)[
0
Expand Down

0 comments on commit 4561acb

Please sign in to comment.