Skip to content

Commit

Permalink
make private function public
Browse files Browse the repository at this point in the history
  • Loading branch information
purva-thakre committed Oct 22, 2024
1 parent ecfa7dc commit 57bd891
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions mitiq/lre/inference/multivariate_richardson.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from numpy.typing import NDArray

from mitiq.lre.multivariate_scaling.layerwise_folding import (
_get_scale_factor_vectors,
get_scale_factor_vectors,
)


Expand Down Expand Up @@ -93,7 +93,7 @@ def sample_matrix(
if fold_multiplier < 1:
raise ValueError("Fold multiplier must be greater than or equal to 1.")

scale_factor_vectors = _get_scale_factor_vectors(
scale_factor_vectors = get_scale_factor_vectors(
input_circuit, degree, fold_multiplier, num_chunks
)
num_layers = len(scale_factor_vectors[0])
Expand Down Expand Up @@ -156,7 +156,7 @@ def multivariate_richardson_coefficients(
input_circuit, degree, fold_multiplier, num_chunks
)
num_layers = len(
_get_scale_factor_vectors(
get_scale_factor_vectors(
input_circuit, degree, fold_multiplier, num_chunks
)
)
Expand Down
4 changes: 2 additions & 2 deletions mitiq/lre/multivariate_scaling/layerwise_folding.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _get_chunks(
]


def _get_scale_factor_vectors(
def get_scale_factor_vectors(
input_circuit: Circuit,
degree: int,
fold_multiplier: int,
Expand Down Expand Up @@ -188,7 +188,7 @@ def multivariate_layer_scaling(
circuit_copy = deepcopy(input_circuit)
terminal_measurements = _pop_measurements(circuit_copy)

scaling_pattern = _get_scale_factor_vectors(
scaling_pattern = get_scale_factor_vectors(
circuit_copy, degree, fold_multiplier, num_chunks
)

Expand Down
12 changes: 6 additions & 6 deletions mitiq/lre/tests/test_layerwise_folding.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from mitiq.lre.multivariate_scaling.layerwise_folding import (
_get_chunks,
_get_num_layers_without_measurements,
_get_scale_factor_vectors,
get_scale_factor_vectors,
multivariate_layer_scaling,
)

Expand Down Expand Up @@ -215,11 +215,11 @@ def test_layers_with_chunking():
),
],
)
def test_get_scale_factor_vectors_no_chunking(
def testget_scale_factor_vectors_no_chunking(
test_input, degree, test_fold_multiplier, expected_scale_factor_vectors
):
"""Verifies vectors of scale factors are calculated accurately."""
calculated_scale_factor_vectors = _get_scale_factor_vectors(
calculated_scale_factor_vectors = get_scale_factor_vectors(
test_input, degree, test_fold_multiplier
)

Expand All @@ -234,11 +234,11 @@ def test_get_scale_factor_vectors_no_chunking(
(test_circuit1, 2, 3, 2, 6),
],
)
def test_get_scale_factor_vectors_with_chunking(
def testget_scale_factor_vectors_with_chunking(
test_input, degree, test_fold_multiplier, test_chunks, expected_size
):
"""Verifies vectors of scale factors are calculated accurately."""
calculated_scale_factor_vectors = _get_scale_factor_vectors(
calculated_scale_factor_vectors = get_scale_factor_vectors(
test_input, degree, test_fold_multiplier, test_chunks
)

Expand Down Expand Up @@ -270,7 +270,7 @@ def test_invalid_num_chunks(test_input, num_chunks, error_msg):
"""Ensures that the number of intended chunks in the input circuit raises
an error for an invalid value."""
with pytest.raises(ValueError, match=error_msg):
_get_scale_factor_vectors(test_input, 2, 2, num_chunks)
get_scale_factor_vectors(test_input, 2, 2, num_chunks)


@pytest.mark.parametrize(
Expand Down

0 comments on commit 57bd891

Please sign in to comment.