Skip to content

Commit 5ff51bb

Browse files
DmitryVasilevskyDmitry Vasilevskysezna
authored
Updated doc comments on measurement operations (#2080)
Moved important remarks into summary as only summary is visible in most cases. Removed description when it was a simple rewording of the summary. For example, MeasureInteger resets its arguments, but it was not clear from the name or summary. --------- Co-authored-by: Dmitry Vasilevsky <[email protected]> Co-authored-by: Alex Hansen <[email protected]>
1 parent 5f42849 commit 5ff51bb

File tree

1 file changed

+13
-34
lines changed

1 file changed

+13
-34
lines changed

library/std/src/Std/Measurement.qs

+13-34
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ operation MeasureAllZ(register : Qubit[]) : Result {
3030
}
3131

3232
/// # Summary
33-
/// Measures each qubit in a given array in the standard basis.
33+
/// Measures each qubit in a given array in the Pauli Z basis.
3434
///
3535
/// # Description
3636
/// Measures each qubit in a register in the `Z` basis
@@ -65,8 +65,8 @@ operation MeasureEachZ(register : Qubit[]) : Result[] {
6565
}
6666

6767
/// # Summary
68-
/// Measures each qubit in a given array in the Z basis
69-
/// and resets them to a fixed initial state.
68+
/// Measures each qubit in a given array in the Pauli Z basis
69+
/// and resets them to |0⟩ state.
7070
///
7171
/// # Input
7272
/// ## targets
@@ -86,14 +86,8 @@ operation MResetEachZ(register : Qubit[]) : Result[] {
8686
}
8787

8888
/// # Summary
89-
/// Measures a single qubit in the X basis,
90-
/// and resets it to a fixed initial state
91-
/// following the measurement.
92-
///
93-
/// # Description
94-
/// Performs a single-qubit measurement in the X-basis,
95-
/// and ensures that the qubit is returned to |0⟩
96-
/// following the measurement.
89+
/// Performs a single-qubit measurement in the Pauli X basis,
90+
/// and resets `target` to the |0⟩ state after the measurement.
9791
///
9892
/// # Input
9993
/// ## target
@@ -109,14 +103,8 @@ operation MResetX(target : Qubit) : Result {
109103
}
110104

111105
/// # Summary
112-
/// Measures a single qubit in the Y basis,
113-
/// and resets it to a fixed initial state
114-
/// following the measurement.
115-
///
116-
/// # Description
117-
/// Performs a single-qubit measurement in the Y-basis,
118-
/// and ensures that the qubit is returned to |0⟩
119-
/// following the measurement.
106+
/// Performs a single-qubit measurement in the Pauli Y basis,
107+
/// and resets `target` to the |0⟩ state after the measurement.
120108
///
121109
/// # Input
122110
/// ## target
@@ -134,14 +122,8 @@ operation MResetY(target : Qubit) : Result {
134122
}
135123

136124
/// # Summary
137-
/// Measures a single qubit in the Z basis,
138-
/// and resets it to a fixed initial state
139-
/// following the measurement.
140-
///
141-
/// # Description
142-
/// Performs a single-qubit measurement in the Z-basis,
143-
/// and ensures that the qubit is returned to |0⟩
144-
/// following the measurement.
125+
/// Performs a single-qubit measurement in the Pauli Z basis,
126+
/// and resets `target` to the |0⟩ state after the measurement.
145127
///
146128
/// # Input
147129
/// ## target
@@ -154,20 +136,17 @@ operation MResetZ(target : Qubit) : Result {
154136
}
155137

156138
/// # Summary
157-
/// Measures the content of a quantum register and converts
158-
/// it to an integer. The measurement is performed with respect
159-
/// to the standard computational basis, i.e., the eigenbasis of `PauliZ`.
139+
/// Measures the content of a quantum register and converts it to an integer.
140+
/// The measurement is performed with respect to the standard computational basis,
141+
/// i.e., the eigenbasis of `PauliZ`. Input register is reset to the |00...0⟩ state,
142+
/// which is suitable for releasing the register back to a target machine.
160143
///
161144
/// # Input
162145
/// ## target
163146
/// A quantum register in the little-endian encoding.
164147
///
165148
/// # Output
166149
/// An unsigned integer that contains the measured value of `target`.
167-
///
168-
/// # Remarks
169-
/// This operation resets its input register to the |00...0> state,
170-
/// suitable for releasing back to a target machine.
171150
operation MeasureInteger(target : Qubit[]) : Int {
172151
let nBits = Length(target);
173152
Fact(nBits < 64, $"`Length(target)` must be less than 64, but was {nBits}.");

0 commit comments

Comments
 (0)