From eab1e94bd987e4cd4d6036bd27d670444a531ec3 Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Sun, 19 Nov 2023 22:51:42 -0800 Subject: [PATCH] Fix various documentation typos Fixes https://github.com/quantumlib/Stim/issues/630 Fixes https://github.com/quantumlib/Stim/issues/635 Fixes https://github.com/quantumlib/Stim/issues/636 --- doc/gates.md | 4 ++-- doc/python_api_reference_vDev.md | 14 +++++++++----- doc/stim.pyi | 14 +++++++++----- glue/python/src/stim/__init__.pyi | 14 +++++++++----- src/stim/circuit/gate_data_collapsing.cc | 4 ++-- src/stim/stabilizers/conversions.cc | 4 ++-- src/stim/stabilizers/tableau.pybind.cc | 7 +++---- 7 files changed, 36 insertions(+), 25 deletions(-) diff --git a/doc/gates.md b/doc/gates.md index a8106f157..05b314b59 100644 --- a/doc/gates.md +++ b/doc/gates.md @@ -2748,7 +2748,7 @@ Examples: # Reset qubit 5 into the |+> state. RX 5 - # Result multiple qubits into the |+> state. + # Reset multiple qubits into the |+> state. RX 2 3 5 Stabilizer Generators: @@ -2780,7 +2780,7 @@ Examples: # Reset qubit 5 into the |i> state. RY 5 - # Result multiple qubits into the |i> state. + # Reset multiple qubits into the |i> state. RY 2 3 5 Stabilizer Generators: diff --git a/doc/python_api_reference_vDev.md b/doc/python_api_reference_vDev.md index 6cf06b5c3..1791d4f5c 100644 --- a/doc/python_api_reference_vDev.md +++ b/doc/python_api_reference_vDev.md @@ -9315,8 +9315,13 @@ def from_named_gate( def from_numpy( self, *, - bit_packed: bool = False, -) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: + x2x: np.ndarray, + x2z: np.ndarray, + z2x: np.ndarray, + z2z: np.ndarray, + x_signs: Optional[np.ndarray] = None, + z_signs: Optional[np.ndarray] = None, +) -> stim.Tableau: """Creates a tableau from numpy arrays x2x, x2z, z2x, z2z, x_signs, and z_signs. The x2x, x2z, z2x, z2z arrays are the four quadrants of the table defined in @@ -9368,7 +9373,7 @@ def from_numpy( ... x2z=np.array([[0, 0], [0, 0]], dtype=np.bool_), ... z2z=np.array([[1, 0], [1, 1]], dtype=np.bool_), ... ) - >>> print(repr(tableau)) + >>> tableau stim.Tableau.from_conjugated_generators( xs=[ stim.PauliString("+XX"), @@ -9382,7 +9387,7 @@ def from_numpy( >>> tableau == stim.Tableau.from_named_gate("CNOT") True - >>> tableau = stim.Tableau.from_numpy( + >>> stim.Tableau.from_numpy( ... x2x=np.array([[9], [5], [7], [6]], dtype=np.uint8), ... x2z=np.array([[13], [13], [0], [3]], dtype=np.uint8), ... z2x=np.array([[8], [5], [9], [15]], dtype=np.uint8), @@ -9390,7 +9395,6 @@ def from_numpy( ... x_signs=np.array([7], dtype=np.uint8), ... z_signs=np.array([9], dtype=np.uint8), ... ) - >>> print(repr(tableau)) stim.Tableau.from_conjugated_generators( xs=[ stim.PauliString("-Y_ZY"), diff --git a/doc/stim.pyi b/doc/stim.pyi index c6c90d962..adcdecd69 100644 --- a/doc/stim.pyi +++ b/doc/stim.pyi @@ -7156,8 +7156,13 @@ class Tableau: def from_numpy( self, *, - bit_packed: bool = False, - ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: + x2x: np.ndarray, + x2z: np.ndarray, + z2x: np.ndarray, + z2z: np.ndarray, + x_signs: Optional[np.ndarray] = None, + z_signs: Optional[np.ndarray] = None, + ) -> stim.Tableau: """Creates a tableau from numpy arrays x2x, x2z, z2x, z2z, x_signs, and z_signs. The x2x, x2z, z2x, z2z arrays are the four quadrants of the table defined in @@ -7209,7 +7214,7 @@ class Tableau: ... x2z=np.array([[0, 0], [0, 0]], dtype=np.bool_), ... z2z=np.array([[1, 0], [1, 1]], dtype=np.bool_), ... ) - >>> print(repr(tableau)) + >>> tableau stim.Tableau.from_conjugated_generators( xs=[ stim.PauliString("+XX"), @@ -7223,7 +7228,7 @@ class Tableau: >>> tableau == stim.Tableau.from_named_gate("CNOT") True - >>> tableau = stim.Tableau.from_numpy( + >>> stim.Tableau.from_numpy( ... x2x=np.array([[9], [5], [7], [6]], dtype=np.uint8), ... x2z=np.array([[13], [13], [0], [3]], dtype=np.uint8), ... z2x=np.array([[8], [5], [9], [15]], dtype=np.uint8), @@ -7231,7 +7236,6 @@ class Tableau: ... x_signs=np.array([7], dtype=np.uint8), ... z_signs=np.array([9], dtype=np.uint8), ... ) - >>> print(repr(tableau)) stim.Tableau.from_conjugated_generators( xs=[ stim.PauliString("-Y_ZY"), diff --git a/glue/python/src/stim/__init__.pyi b/glue/python/src/stim/__init__.pyi index c6c90d962..adcdecd69 100644 --- a/glue/python/src/stim/__init__.pyi +++ b/glue/python/src/stim/__init__.pyi @@ -7156,8 +7156,13 @@ class Tableau: def from_numpy( self, *, - bit_packed: bool = False, - ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: + x2x: np.ndarray, + x2z: np.ndarray, + z2x: np.ndarray, + z2z: np.ndarray, + x_signs: Optional[np.ndarray] = None, + z_signs: Optional[np.ndarray] = None, + ) -> stim.Tableau: """Creates a tableau from numpy arrays x2x, x2z, z2x, z2z, x_signs, and z_signs. The x2x, x2z, z2x, z2z arrays are the four quadrants of the table defined in @@ -7209,7 +7214,7 @@ class Tableau: ... x2z=np.array([[0, 0], [0, 0]], dtype=np.bool_), ... z2z=np.array([[1, 0], [1, 1]], dtype=np.bool_), ... ) - >>> print(repr(tableau)) + >>> tableau stim.Tableau.from_conjugated_generators( xs=[ stim.PauliString("+XX"), @@ -7223,7 +7228,7 @@ class Tableau: >>> tableau == stim.Tableau.from_named_gate("CNOT") True - >>> tableau = stim.Tableau.from_numpy( + >>> stim.Tableau.from_numpy( ... x2x=np.array([[9], [5], [7], [6]], dtype=np.uint8), ... x2z=np.array([[13], [13], [0], [3]], dtype=np.uint8), ... z2x=np.array([[8], [5], [9], [15]], dtype=np.uint8), @@ -7231,7 +7236,6 @@ class Tableau: ... x_signs=np.array([7], dtype=np.uint8), ... z_signs=np.array([9], dtype=np.uint8), ... ) - >>> print(repr(tableau)) stim.Tableau.from_conjugated_generators( xs=[ stim.PauliString("-Y_ZY"), diff --git a/src/stim/circuit/gate_data_collapsing.cc b/src/stim/circuit/gate_data_collapsing.cc index 9eb273a41..2dc2172da 100644 --- a/src/stim/circuit/gate_data_collapsing.cc +++ b/src/stim/circuit/gate_data_collapsing.cc @@ -373,7 +373,7 @@ Parens Arguments: # Reset qubit 5 into the |+> state. RX 5 - # Result multiple qubits into the |+> state. + # Reset multiple qubits into the |+> state. RX 2 3 5 )MARKDOWN", .unitary_data = {}, @@ -410,7 +410,7 @@ Parens Arguments: # Reset qubit 5 into the |i> state. RY 5 - # Result multiple qubits into the |i> state. + # Reset multiple qubits into the |i> state. RY 2 3 5 )MARKDOWN", .unitary_data = {}, diff --git a/src/stim/stabilizers/conversions.cc b/src/stim/stabilizers/conversions.cc index 42f1eb139..cb83c0b41 100644 --- a/src/stim/stabilizers/conversions.cc +++ b/src/stim/stabilizers/conversions.cc @@ -110,14 +110,14 @@ bool stim::try_disjoint_to_independent_xyz_errors_approx( double stim::depolarize1_probability_to_independent_per_channel_probability(double p) { if (p > 0.75) { - throw std::invalid_argument("disjoint_to_independent_depolarize1 with p>0.75; p=" + std::to_string(p)); + throw std::invalid_argument("depolarize1_probability_to_independent_per_channel_probability with p>0.75; p=" + std::to_string(p)); } return 0.5 - 0.5 * sqrt(1 - (4 * p) / 3); } double stim::depolarize2_probability_to_independent_per_channel_probability(double p) { if (p > 0.9375) { - throw std::invalid_argument("disjoint_to_independent_depolarize1 with p>15.0/16.0; p=" + std::to_string(p)); + throw std::invalid_argument("depolarize2_probability_to_independent_per_channel_probability with p>15.0/16.0; p=" + std::to_string(p)); } return 0.5 - 0.5 * pow(1 - (16 * p) / 15, 0.125); } diff --git a/src/stim/stabilizers/tableau.pybind.cc b/src/stim/stabilizers/tableau.pybind.cc index 7c946203e..b251566a6 100644 --- a/src/stim/stabilizers/tableau.pybind.cc +++ b/src/stim/stabilizers/tableau.pybind.cc @@ -536,7 +536,7 @@ void stim_pybind::pybind_tableau_methods(pybind11::module &m, pybind11::class_ Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: + @signature def from_numpy(self, *, x2x: np.ndarray, x2z: np.ndarray, z2x: np.ndarray, z2z: np.ndarray, x_signs: Optional[np.ndarray] = None, z_signs: Optional[np.ndarray] = None) -> stim.Tableau: Creates a tableau from numpy arrays x2x, x2z, z2x, z2z, x_signs, and z_signs. @@ -589,7 +589,7 @@ void stim_pybind::pybind_tableau_methods(pybind11::module &m, pybind11::class_>> print(repr(tableau)) + >>> tableau stim.Tableau.from_conjugated_generators( xs=[ stim.PauliString("+XX"), @@ -603,7 +603,7 @@ void stim_pybind::pybind_tableau_methods(pybind11::module &m, pybind11::class_>> tableau == stim.Tableau.from_named_gate("CNOT") True - >>> tableau = stim.Tableau.from_numpy( + >>> stim.Tableau.from_numpy( ... x2x=np.array([[9], [5], [7], [6]], dtype=np.uint8), ... x2z=np.array([[13], [13], [0], [3]], dtype=np.uint8), ... z2x=np.array([[8], [5], [9], [15]], dtype=np.uint8), @@ -611,7 +611,6 @@ void stim_pybind::pybind_tableau_methods(pybind11::module &m, pybind11::class_>> print(repr(tableau)) stim.Tableau.from_conjugated_generators( xs=[ stim.PauliString("-Y_ZY"),