Skip to content

Commit

Permalink
Change exponent asterisks in doc string to carats (quantumlib#5716)
Browse files Browse the repository at this point in the history
- The double asterisks "**" are interpreted as
    markdown for bold text.
- Change these to exponents within latex blocks in common_channels.
  • Loading branch information
dstrain115 authored and rht committed May 1, 2023
1 parent abdd392 commit a0b43e8
Showing 1 changed file with 17 additions and 17 deletions.
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

0 comments on commit a0b43e8

Please sign in to comment.