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

Change exponent asterisks in doc string to carats #5716

Merged
merged 9 commits into from
Jul 11, 2022
34 changes: 17 additions & 17 deletions cirq-core/cirq/ops/common_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@
class AsymmetricDepolarizingChannel(raw_types.Gate):
r"""A channel that depolarizes asymmetrically along different directions.

This channel applies one of 4**n disjoint possibilities: nothing (the
identity channel) or one of the 4**n - 1 pauli gates.
This channel applies one of $4^n$ disjoint possibilities: nothing (the
identity channel) or one of the $4^n - 1$ pauli gates.

This channel evolves a density matrix via

$$
\sum_i p_i Pi \rho Pi
$$

where i varies from 0 to 4**n-1 and Pi represents n-qubit Pauli operator
where i varies from 0 to $4^n-1$ and Pi represents n-qubit Pauli operator
(including identity). The input $\rho$ is the density matrix before the
depolarization.

Expand Down Expand Up @@ -211,16 +211,16 @@ def asymmetric_depolarize(
) -> AsymmetricDepolarizingChannel:
r"""Returns an `AsymmetricDepolarizingChannel` with the given parameters.

This channel applies one of 4**n disjoint possibilities: nothing (the
identity channel) or one of the 4**n - 1 pauli gates.
This channel applies one of $4^n$ disjoint possibilities: nothing (the
identity channel) or one of the $4^n - 1$ pauli gates.

This channel evolves a density matrix via

$$
\sum_i p_i Pi \rho Pi
$$

where i varies from 0 to 4**n-1 and Pi represents n-qubit Pauli operator
where i varies from 0 to $4^n-1$ and Pi represents n-qubit Pauli operator
(including identity). The input $\rho$ is the density matrix before the
depolarization.

Expand Down Expand Up @@ -250,18 +250,18 @@ def asymmetric_depolarize(
class DepolarizingChannel(raw_types.Gate):
r"""A channel that depolarizes one or several qubits.

This channel applies one of 4**n disjoint possibilities: nothing (the
identity channel) or one of the 4**n - 1 pauli gates. The disjoint
This channel applies one of $4^n$ disjoint possibilities: nothing (the
identity channel) or one of the $4^n - 1$ pauli gates. The disjoint
probabilities of the non-identity Pauli gates are all the same,
p / (4**n - 1), and the identity is done with probability 1 - p. The
$p / (4^n - 1)$, and the identity is done with probability $1 - p$. The
supplied probability must be a valid probability or else this
constructor will raise a ValueError.


This channel evolves a density matrix via

$$
\rho \rightarrow (1 - p) \rho + p / (4**n - 1) \sum _i P_i \rho P_i
\rho \rightarrow (1 - p) \rho + p / (4^n - 1) \sum _i P_i \rho P_i
$$

where $P_i$ are the $4^n - 1$ Pauli gates (excluding the identity).
Expand All @@ -273,7 +273,7 @@ def __init__(self, p: float, n_qubits: int = 1) -> None:
Args:
p: The probability that one of the Pauli gates is applied. Each of
the Pauli gates is applied independently with probability
p / (4**n - 1).
$p / (4^n - 1)$.
n_qubits: the number of qubits.

Raises:
Expand Down Expand Up @@ -333,7 +333,7 @@ def p(self) -> float:
"""The probability that one of the Pauli gates is applied.

Each of the Pauli gates is applied independently with probability
p / (4**n_qubits - 1).
$p / (4^n_qubits - 1)$.
"""
return self._p

Expand All @@ -354,25 +354,25 @@ def _approx_eq_(self, other: Any, atol: float) -> bool:
def depolarize(p: float, n_qubits: int = 1) -> DepolarizingChannel:
r"""Returns a DepolarizingChannel with given probability of error.

This channel applies one of 4**n disjoint possibilities: nothing (the
identity channel) or one of the 4**n - 1 pauli gates. The disjoint
This channel applies one of $4^n$ disjoint possibilities: nothing (the
identity channel) or one of the $4^n - 1$ pauli gates. The disjoint
probabilities of the non-identity Pauli gates are all the same,
p / (4**n - 1), and the identity is done with probability 1 - p. The
$p / (4^n - 1)$, and the identity is done with probability 1 - p. The
supplied probability must be a valid probability or else this constructor
will raise a ValueError.

This channel evolves a density matrix via

$$
\rho \rightarrow (1 - p) \rho + p / (4**n - 1) \sum _i P_i \rho P_i
\rho \rightarrow (1 - p) \rho + p / (4^n - 1) \sum _i P_i \rho P_i
$$

where $P_i$ are the $4^n - 1$ Pauli gates (excluding the identity).

Args:
p: The probability that one of the Pauli gates is applied. Each of
the Pauli gates is applied independently with probability
p / (4**n - 1).
$p / (4^n - 1)$.
n_qubits: The number of qubits.

Raises:
Expand Down