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

Correcting run-on sentences in API-doc #2589

Merged
merged 9 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
88 changes: 53 additions & 35 deletions mitiq/cdr/cdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,31 @@ def execute_with_cdr(
noisy and data and parameters returning a float. See
``cdr.linear_fit_function`` for an example.
num_fit_parameters: The number of parameters the fit_function takes.
scale_noise: scale_noise: Function for scaling the noise of a quantum
circuit.
scale_noise: Function for scaling the noise of a quantum circuit.
scale_factors: Factors by which to scale the noise.

- When 1.0 is the only scale factor, the method is known as CDR.

- Note: When scale factors larger than 1.0 are provided, the method
is known as "variable-noise CDR."
is known as "variable-noise CDR."

kwargs: Available keyword arguments are:
purva-thakre marked this conversation as resolved.
Show resolved Hide resolved

- method_select (string): Specifies the method used to select the
purva-thakre marked this conversation as resolved.
Show resolved Hide resolved
non-Clifford gates to replace when constructing the
near-Clifford training circuits. Can be 'uniform' or
'gaussian'.
- method_replace (string): Specifies the method used to replace
the selected non-Clifford gates with a Clifford when
constructing the near-Clifford training circuits. Can be
'uniform', 'gaussian', or 'closest'.
non-Clifford gates to replace when constructing the near-Clifford
training circuits. Can be 'uniform' or 'gaussian'.

- method_replace (string): Specifies the method used to replace the
purva-thakre marked this conversation as resolved.
Show resolved Hide resolved
selected non-Clifford gates with a Clifford when constructing the
near-Clifford training circuits. Can be 'uniform', 'gaussian', or
'closest'.

- sigma_select (float): Width of the Gaussian distribution used for
purva-thakre marked this conversation as resolved.
Show resolved Hide resolved
``method_select='gaussian'``.
``method_select='gaussian'``.

- sigma_replace (float): Width of the Gaussian distribution used
purva-thakre marked this conversation as resolved.
Show resolved Hide resolved
for ``method_replace='gaussian'``.
for ``method_replace='gaussian'``.

- random_state (int): Seed for sampling.
purva-thakre marked this conversation as resolved.
Show resolved Hide resolved
"""
# Handle keyword arguments for generating training circuits.
Expand Down Expand Up @@ -198,25 +204,31 @@ def mitigate_executor(
noisy and data and parameters returning a float. See
``cdr.linear_fit_function`` for an example.
num_fit_parameters: The number of parameters the fit_function takes.
scale_noise: scale_noise: Function for scaling the noise of a quantum
circuit.
scale_noise: Function for scaling the noise of a quantum circuit.
scale_factors: Factors by which to scale the noise.

- When 1.0 is the only scale factor, the method is known as CDR.

- Note: When scale factors larger than 1.0 are provided, the method
is known as "variable-noise CDR."
is known as "variable-noise CDR."

kwargs: Available keyword arguments are:
purva-thakre marked this conversation as resolved.
Show resolved Hide resolved

- method_select (string): Specifies the method used to select the
non-Clifford gates to replace when constructing the
near-Clifford training circuits. Can be 'uniform' or
'gaussian'.
non-Clifford gates to replace when constructing the near-Clifford
training circuits. Can be 'uniform' or 'gaussian'.

- method_replace (string): Specifies the method used to replace
the selected non-Clifford gates with a Clifford when
constructing the near-Clifford training circuits. Can be
'uniform', 'gaussian', or 'closest'.
the selected non-Clifford gates with a Clifford when constructing
the near-Clifford training circuits. Can be 'uniform', 'gaussian'
, or 'closest'.

- sigma_select (float): Width of the Gaussian distribution used for
``method_select='gaussian'``.
``method_select='gaussian'``.

- sigma_replace (float): Width of the Gaussian distribution used
for ``method_replace='gaussian'``.
for ``method_replace='gaussian'``.

- random_state (int): Seed for sampling."""
executor_obj = Executor(executor)
if not executor_obj.can_batch:
Expand Down Expand Up @@ -305,25 +317,31 @@ def cdr_decorator(
noisy and data and parameters returning a float. See
``cdr.linear_fit_function`` for an example.
num_fit_parameters: The number of parameters the fit_function takes.
scale_noise: scale_noise: Function for scaling the noise of a quantum
circuit.
scale_noise: Function for scaling the noise of a quantum circuit.
scale_factors: Factors by which to scale the noise.

- When 1.0 is the only scale factor, the method is known as CDR.

- Note: When scale factors larger than 1.0 are provided, the method
is known as "variable-noise CDR."
is known as "variable-noise CDR."

kwargs: Available keyword arguments are:
purva-thakre marked this conversation as resolved.
Show resolved Hide resolved

- method_select (string): Specifies the method used to select the
non-Clifford gates to replace when constructing the
near-Clifford training circuits. Can be 'uniform' or
'gaussian'.
- method_replace (string): Specifies the method used to replace
the selected non-Clifford gates with a Clifford when
constructing the near-Clifford training circuits. Can be
'uniform', 'gaussian', or 'closest'.
non-Clifford gates to replace when constructing the near-Clifford
training circuits. Can be 'uniform' or 'gaussian'.

- method_replace (string): Specifies the method used to replace the
selected non-Clifford gates with a Clifford when constructing the
near-Clifford training circuits. Can be 'uniform', 'gaussian', or
'closest'.

- sigma_select (float): Width of the Gaussian distribution used for
``method_select='gaussian'``.
``method_select='gaussian'``.

- sigma_replace (float): Width of the Gaussian distribution used
for ``method_replace='gaussian'``.
for ``method_replace='gaussian'``.

- random_state (int): Seed for sampling.
"""

Expand Down
16 changes: 10 additions & 6 deletions mitiq/cdr/clifford_training_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ def generate_training_circuits(
'closest'.
random_state: Seed for sampling.
kwargs: Available keyword arguments are:
purva-thakre marked this conversation as resolved.
Show resolved Hide resolved

- sigma_select (float): Width of the Gaussian distribution used for
``method_select='gaussian'``.
``method_select='gaussian'``.

- sigma_replace (float): Width of the Gaussian distribution used
for ``method_replace='gaussian'``.
for ``method_replace='gaussian'``.
"""
if random_state is None or isinstance(random_state, int):
random_state = np.random.RandomState(random_state)
Expand Down Expand Up @@ -115,10 +117,12 @@ def _map_to_near_clifford(
'closest'.
random_state: Seed for sampling.
kwargs: Additional options for selection / replacement methods.
purva-thakre marked this conversation as resolved.
Show resolved Hide resolved
sigma_select (float): Width of the Gaussian distribution used for
``method_select='gaussian'``.
sigma_replace (float): Width of the Gaussian distribution used for
``method_replace='gaussian'``.

- sigma_select (float): Width of the Gaussian distribution used for
``method_select='gaussian'``.

- sigma_replace (float): Width of the Gaussian distribution used
for ``method_replace='gaussian'``.
"""
sigma_select: float = kwargs.get("sigma_select", 0.5)
sigma_replace: float = kwargs.get("sigma_replace", 0.5)
Expand Down
Loading