Skip to content

Commit 545d2dd

Browse files
authored
Change exponent asterisks in doc string to carats (#5716)
- The double asterisks "**" are interpreted as markdown for bold text. - Change these to exponents within latex blocks in common_channels.
1 parent e6e62c0 commit 545d2dd

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

cirq-core/cirq/ops/common_channels.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@
3131
class AsymmetricDepolarizingChannel(raw_types.Gate):
3232
r"""A channel that depolarizes asymmetrically along different directions.
3333
34-
This channel applies one of 4**n disjoint possibilities: nothing (the
35-
identity channel) or one of the 4**n - 1 pauli gates.
34+
This channel applies one of $4^n$ disjoint possibilities: nothing (the
35+
identity channel) or one of the $4^n - 1$ pauli gates.
3636
3737
This channel evolves a density matrix via
3838
3939
$$
4040
\sum_i p_i Pi \rho Pi
4141
$$
4242
43-
where i varies from 0 to 4**n-1 and Pi represents n-qubit Pauli operator
43+
where i varies from 0 to $4^n-1$ and Pi represents n-qubit Pauli operator
4444
(including identity). The input $\rho$ is the density matrix before the
4545
depolarization.
4646
@@ -211,16 +211,16 @@ def asymmetric_depolarize(
211211
) -> AsymmetricDepolarizingChannel:
212212
r"""Returns an `AsymmetricDepolarizingChannel` with the given parameters.
213213
214-
This channel applies one of 4**n disjoint possibilities: nothing (the
215-
identity channel) or one of the 4**n - 1 pauli gates.
214+
This channel applies one of $4^n$ disjoint possibilities: nothing (the
215+
identity channel) or one of the $4^n - 1$ pauli gates.
216216
217217
This channel evolves a density matrix via
218218
219219
$$
220220
\sum_i p_i Pi \rho Pi
221221
$$
222222
223-
where i varies from 0 to 4**n-1 and Pi represents n-qubit Pauli operator
223+
where i varies from 0 to $4^n-1$ and Pi represents n-qubit Pauli operator
224224
(including identity). The input $\rho$ is the density matrix before the
225225
depolarization.
226226
@@ -250,18 +250,18 @@ def asymmetric_depolarize(
250250
class DepolarizingChannel(raw_types.Gate):
251251
r"""A channel that depolarizes one or several qubits.
252252
253-
This channel applies one of 4**n disjoint possibilities: nothing (the
254-
identity channel) or one of the 4**n - 1 pauli gates. The disjoint
253+
This channel applies one of $4^n$ disjoint possibilities: nothing (the
254+
identity channel) or one of the $4^n - 1$ pauli gates. The disjoint
255255
probabilities of the non-identity Pauli gates are all the same,
256-
p / (4**n - 1), and the identity is done with probability 1 - p. The
256+
$p / (4^n - 1)$, and the identity is done with probability $1 - p$. The
257257
supplied probability must be a valid probability or else this
258258
constructor will raise a ValueError.
259259
260260
261261
This channel evolves a density matrix via
262262
263263
$$
264-
\rho \rightarrow (1 - p) \rho + p / (4**n - 1) \sum _i P_i \rho P_i
264+
\rho \rightarrow (1 - p) \rho + p / (4^n - 1) \sum _i P_i \rho P_i
265265
$$
266266
267267
where $P_i$ are the $4^n - 1$ Pauli gates (excluding the identity).
@@ -273,7 +273,7 @@ def __init__(self, p: float, n_qubits: int = 1) -> None:
273273
Args:
274274
p: The probability that one of the Pauli gates is applied. Each of
275275
the Pauli gates is applied independently with probability
276-
p / (4**n - 1).
276+
$p / (4^n - 1)$.
277277
n_qubits: the number of qubits.
278278
279279
Raises:
@@ -333,7 +333,7 @@ def p(self) -> float:
333333
"""The probability that one of the Pauli gates is applied.
334334
335335
Each of the Pauli gates is applied independently with probability
336-
p / (4**n_qubits - 1).
336+
$p / (4^n_qubits - 1)$.
337337
"""
338338
return self._p
339339

@@ -354,25 +354,25 @@ def _approx_eq_(self, other: Any, atol: float) -> bool:
354354
def depolarize(p: float, n_qubits: int = 1) -> DepolarizingChannel:
355355
r"""Returns a DepolarizingChannel with given probability of error.
356356
357-
This channel applies one of 4**n disjoint possibilities: nothing (the
358-
identity channel) or one of the 4**n - 1 pauli gates. The disjoint
357+
This channel applies one of $4^n$ disjoint possibilities: nothing (the
358+
identity channel) or one of the $4^n - 1$ pauli gates. The disjoint
359359
probabilities of the non-identity Pauli gates are all the same,
360-
p / (4**n - 1), and the identity is done with probability 1 - p. The
360+
$p / (4^n - 1)$, and the identity is done with probability 1 - p. The
361361
supplied probability must be a valid probability or else this constructor
362362
will raise a ValueError.
363363
364364
This channel evolves a density matrix via
365365
366366
$$
367-
\rho \rightarrow (1 - p) \rho + p / (4**n - 1) \sum _i P_i \rho P_i
367+
\rho \rightarrow (1 - p) \rho + p / (4^n - 1) \sum _i P_i \rho P_i
368368
$$
369369
370370
where $P_i$ are the $4^n - 1$ Pauli gates (excluding the identity).
371371
372372
Args:
373373
p: The probability that one of the Pauli gates is applied. Each of
374374
the Pauli gates is applied independently with probability
375-
p / (4**n - 1).
375+
$p / (4^n - 1)$.
376376
n_qubits: The number of qubits.
377377
378378
Raises:

0 commit comments

Comments
 (0)