Skip to content

Commit 9775995

Browse files
StrilancCirqBot
authored andcommitted
Use latex in noise documentation (#1556)
- Replace images in docs/noise.md - Fix docstrings omitting the $$ to activate latex parsing Fixes #1552
1 parent 70d1173 commit 9775995

File tree

9 files changed

+160
-61
lines changed

9 files changed

+160
-61
lines changed

cirq/ops/common_channels.py

Lines changed: 140 additions & 51 deletions
Large diffs are not rendered by default.

cirq/protocols/channel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def _channel_(self) -> Union[Sequence[np.ndarray], NotImplementedType]:
4646
These matrices are the terms in the operator sum representation of
4747
a quantum channel. If the returned matrices are {A_0,A_1,..., A_{r-1}},
4848
then this describes the channel:
49-
\rho -> \sum_{k=0}^{r-1} A_0 \rho A_0^\dagger
49+
\rho \rightarrow \sum_{k=0}^{r-1} A_0 \rho A_0^\dagger
5050
These matrices are required to satisfy the trace preserving condition
5151
\sum_{k=0}^{r-1} A_i^\dagger A_i = I
5252
where I is the identity matrix. The matrices A_i are sometimes called
@@ -93,7 +93,7 @@ def channel(val: Any,
9393
These matrices are the terms in the operator sum representation of
9494
a quantum channel. If the returned matrices are {A_0,A_1,..., A_{r-1}},
9595
then this describes the channel:
96-
\rho -> \sum_{k=0}^{r-1} A_0 \rho A_0^\dagger
96+
\rho \rightarrow \sum_{k=0}^{r-1} A_0 \rho A_0^\dagger
9797
These matrices are required to satisfy the trace preserving condition
9898
\sum_{k=0}^{r-1} A_i^\dagger A_i = I
9999
where I is the identity matrix. The matrices A_i are sometimes called

cirq/protocols/measurement_key.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class SupportsMeasurementKey(Protocol):
3333
Note: Measurements, in contrast to general quantum channels, are
3434
distinguished by the recording of the quantum operation that occurred.
3535
That is a general quantum channel may enact the evolution
36-
\rho -> \sum_k A_k \rho A_k^\dagger
36+
\rho \rightarrow \sum_k A_k \rho A_k^\dagger
3737
where as a measurement enacts the evolution
38-
\rho -> A_k \rho A_k^\dagger
38+
\rho \rightarrow A_k \rho A_k^\dagger
3939
conditional on the measurement outcome being k.
4040
"""
4141

docs/noise.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ noise (these evolutions are also known as quantum operations, quantum
66
dynamical maps, or superoperators). This formalism models evolution of the
77
density matrix via
88

9-
![Operator sum representation: $\rho \rightarrow \sum_k A_k \rho A_k^\dagger$](resources/OperatorSumDef.gif)
9+
$$\rho \rightarrow \sum_k A_k \rho A_k^\dagger$$
1010

1111
Where A<sub>k</sub> are *Krauss* operators. These operators are not
1212
necessarily unitary and must satisfy
1313
the trace preserving property
1414

15-
![Operator sum normalization: $\sum_k A_k^\dagger A_k = I$](resources/OperatorSumNormDef.gif)
15+
$$\sum_k A_k^\dagger A_k = I$$
1616

1717
As a noisy channel, Krauss operators are not unique. For more details of these
1818
operators see [John Preskill's notes](http://www.theory.caltech.edu/people/preskill/ph219/chap3_15.pdf).
@@ -58,7 +58,7 @@ channel.
5858
Some channels can be interpreted as probabilistically selecting between
5959
different unitary evolutions.
6060

61-
![Mixture channel: $\rho \rightarrow \sum_k p_k U_k \rho U_k^\dagger {\rm ~where~} \sum_k p_k =1 {\rm ~and~ U_k U_k^\dagger= I}$](resources/MixtureChannelDef.gif)
61+
$$\rho \rightarrow \sum_k p_k U_k \rho U_k^\dagger {\rm ~where~} \sum_k p_k =1 {\rm ~and~ U_k U_k^\dagger= I}$$
6262

6363
In this case, it is possible to perform
6464
Monte Carlo simulations of these gates using a wave function based simulator
@@ -88,7 +88,9 @@ wave function simulator can be used.
8888

8989
This channel implements the evolution
9090

91-
![Asymmetric depolarizing channel: $\rho \rightarrow (1-p_x-p_y-p_z) \rho + p_x X \rho X + p_y Y \rho Y + p_z Z \rho Z$](resources/AsymmetricDepolarizingChannelDef.gif)
91+
$$
92+
\rho \rightarrow (1-p_x-p_y-p_z) \rho + p_x X \rho X + p_y Y \rho Y + p_z Z \rho Z
93+
$$
9294

9395
Here p<sub>x</sub> is the probability that the X Pauli gate is applied and
9496
no other gate is applied, and similarly for p<sub>y</sub> and p<sub>z</sub>.
@@ -101,7 +103,7 @@ such that each Pauli gate occurs with probability `p/3`.
101103
To construct channels, useful helpers are provided `cirq.asymmetric_depolarize`
102104
and `cirq.depolarize`.
103105

104-
Another common case is when only a Pauli X (bit flip) can occur, or
106+
Another common case is when only a Pauli X (bit flip) can occur, or()
105107
when only a Pauli Y (phase flip) can occur. These correspond to
106108
`BitFlipChannel` and `PhaseFlipChannel` with helpers `cirq.bit_flip` and
107109
`cirq.phase_flip`.
@@ -115,7 +117,15 @@ dissipation of energy to a surrounding environment. Cirq has implementations
115117
of both of these channels. The generalized amplitude damping channel
116118
corresponds to
117119

118-
![Generalized amplitude damping channel: $\rho \rightarrow \sum_{k=0}^3 M_k \rho M_k \\ M_0 = \sqrt{p} \begin{bmatrix} 1 & 0 \\ 0 & \sqrt{1 - \gamma} \end{bmatrix} \\ M_1 = \sqrt{p} \begin{bmatrix} 0 & \sqrt{\gamma} \\ 0 & 0 \end{bmatrix} \\ M_2 = \sqrt{1-p} \begin{bmatrix} \sqrt{1-\gamma} & 0 \\ 0 & 1 \\ \end{bmatrix} \\ M_3 = \sqrt{1-p} \begin{bmatrix} 0 & 0 \\ \sqrt{\gamma} & 0 \end{bmatrix}$](resources/GeneralizedAmplitudeDampingChannelDef.gif)
120+
$$
121+
\begin{aligned}
122+
\rho \rightarrow& \sum_{k=0}^3 M_k \rho M_k \newline
123+
M_0 =& \sqrt{p} \begin{bmatrix} 1 & 0 \cr 0 & \sqrt{1 - \gamma} \end{bmatrix} \newline
124+
M_1 =& \sqrt{p} \begin{bmatrix} 0 & \sqrt{\gamma} \cr 0 & 0 \end{bmatrix} \newline
125+
M_2 =& \sqrt{1-p} \begin{bmatrix} \sqrt{1-\gamma} & 0 \cr 0 & 1 \\ \end{bmatrix} \newline
126+
M_3 =& \sqrt{1-p} \begin{bmatrix} 0 & 0 \cr \sqrt{\gamma} & 0 \end{bmatrix}
127+
\end{aligned}
128+
$$
119129

120130
Where &#947; is the probability of the interaction being dissipative and
121131
`p` is the probability that the qubit and environment exchange energy. The
-1.33 KB
Binary file not shown.
-3.49 KB
Binary file not shown.
-1.59 KB
Binary file not shown.

docs/resources/OperatorSumDef.gif

-644 Bytes
Binary file not shown.
-552 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)