From 25ecba92f478e1ee4cd3cd36822f417e7aab4c5a Mon Sep 17 00:00:00 2001 From: Tanuj Khattar Date: Mon, 9 Jan 2023 05:11:58 +0530 Subject: [PATCH] Fix bug in documentation of phase_flip and bit_flip methods (#5977) --- cirq-core/cirq/ops/common_channels.py | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/cirq-core/cirq/ops/common_channels.py b/cirq-core/cirq/ops/common_channels.py index 08767d86258..5d78d183f77 100644 --- a/cirq-core/cirq/ops/common_channels.py +++ b/cirq-core/cirq/ops/common_channels.py @@ -1010,15 +1010,15 @@ def _phase_flip(p: float) -> PhaseFlipChannel: $$ \begin{aligned} - M_0 =& \sqrt{p} \begin{bmatrix} + M_0 =& \sqrt{1 - p} \begin{bmatrix} 1 & 0 \\ 0 & 1 - \end{bmatrix} + \end{bmatrix} \\ - M_1 =& \sqrt{1-p} \begin{bmatrix} + M_1 =& \sqrt{p} \begin{bmatrix} 1 & 0 \\ 0 & -1 - \end{bmatrix} + \end{bmatrix} \end{aligned} $$ @@ -1046,15 +1046,15 @@ def phase_flip(p: Optional[float] = None) -> Union[common_gates.ZPowGate, PhaseF $$ \begin{aligned} - M_0 =& \sqrt{p} \begin{bmatrix} + M_0 =& \sqrt{1 - p} \begin{bmatrix} 1 & 0 \\ 0 & 1 - \end{bmatrix} + \end{bmatrix} \\ - M_1 =& \sqrt{1-p} \begin{bmatrix} + M_1 =& \sqrt{p} \begin{bmatrix} 1 & 0 \\ 0 & -1 - \end{bmatrix} + \end{bmatrix} \end{aligned} $$ @@ -1162,14 +1162,14 @@ def _bit_flip(p: float) -> BitFlipChannel: $$ \begin{aligned} - M_0 =& \sqrt{p} \begin{bmatrix} + M_0 =& \sqrt{1-p} \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \\ - M_1 =& \sqrt{1-p} \begin{bmatrix} + M_1 =& \sqrt{p} \begin{bmatrix} 0 & 1 \\ - 1 & -0 + 1 & 0 \end{bmatrix} \end{aligned} $$ @@ -1198,14 +1198,14 @@ def bit_flip(p: Optional[float] = None) -> Union[common_gates.XPowGate, BitFlipC $$ \begin{aligned} - M_0 =& \sqrt{p} \begin{bmatrix} + M_0 =& \sqrt{1-p} \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \\ - M_1 =& \sqrt{1-p} \begin{bmatrix} + M_1 =& \sqrt{p} \begin{bmatrix} 0 & 1 \\ - 1 & -0 + 1 & 0 \end{bmatrix} \end{aligned} $$