From 3536e6dedc942e62444593794067ae8c31ea9ca4 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilevsky Date: Fri, 27 Dec 2024 12:49:27 -0800 Subject: [PATCH 1/3] Updated doc comments on measurement operations --- library/std/src/Std/Measurement.qs | 47 +++++++++--------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/library/std/src/Std/Measurement.qs b/library/std/src/Std/Measurement.qs index 81bc287eaa..120efeaf9a 100644 --- a/library/std/src/Std/Measurement.qs +++ b/library/std/src/Std/Measurement.qs @@ -30,7 +30,7 @@ operation MeasureAllZ(register : Qubit[]) : Result { } /// # Summary -/// Measures each qubit in a given array in the standard basis. +/// Measures each qubit in a given array in the Pauli Z basis. /// /// # Description /// Measures each qubit in a register in the `Z` basis @@ -65,8 +65,8 @@ operation MeasureEachZ(register : Qubit[]) : Result[] { } /// # Summary -/// Measures each qubit in a given array in the Z basis -/// and resets them to a fixed initial state. +/// Measures each qubit in a given array in the Pauli Z basis +/// and resets them to |0⟩ state. /// /// # Input /// ## targets @@ -86,14 +86,8 @@ operation MResetEachZ(register : Qubit[]) : Result[] { } /// # Summary -/// Measures a single qubit in the X basis, -/// and resets it to a fixed initial state -/// following the measurement. -/// -/// # Description -/// Performs a single-qubit measurement in the X-basis, -/// and ensures that the qubit is returned to |0⟩ -/// following the measurement. +/// Performs a single-qubit measurement in the Pauli X basis, +/// and resets qubit to |0⟩ state after the measurement. /// /// # Input /// ## target @@ -109,14 +103,8 @@ operation MResetX(target : Qubit) : Result { } /// # Summary -/// Measures a single qubit in the Y basis, -/// and resets it to a fixed initial state -/// following the measurement. -/// -/// # Description -/// Performs a single-qubit measurement in the Y-basis, -/// and ensures that the qubit is returned to |0⟩ -/// following the measurement. +/// Performs a single-qubit measurement in the Pauli Y basis, +/// and resets qubit to |0⟩ state after the measurement. /// /// # Input /// ## target @@ -134,14 +122,8 @@ operation MResetY(target : Qubit) : Result { } /// # Summary -/// Measures a single qubit in the Z basis, -/// and resets it to a fixed initial state -/// following the measurement. -/// -/// # Description -/// Performs a single-qubit measurement in the Z-basis, -/// and ensures that the qubit is returned to |0⟩ -/// following the measurement. +/// Performs a single-qubit measurement in the Pauli Z basis, +/// and resets qubit to |0⟩ state after the measurement. /// /// # Input /// ## target @@ -154,9 +136,10 @@ operation MResetZ(target : Qubit) : Result { } /// # Summary -/// Measures the content of a quantum register and converts -/// it to an integer. The measurement is performed with respect -/// to the standard computational basis, i.e., the eigenbasis of `PauliZ`. +/// Measures the content of a quantum register and converts it to an integer. +/// The measurement is performed with respect to the standard computational basis, +/// i.e., the eigenbasis of `PauliZ`. Input register is reset to |00...0⟩ state +/// suitable for releasing back to a target machine. /// /// # Input /// ## target @@ -164,10 +147,6 @@ operation MResetZ(target : Qubit) : Result { /// /// # Output /// An unsigned integer that contains the measured value of `target`. -/// -/// # Remarks -/// This operation resets its input register to the |00...0> state, -/// suitable for releasing back to a target machine. operation MeasureInteger(target : Qubit[]) : Int { let nBits = Length(target); Fact(nBits < 64, $"`Length(target)` must be less than 64, but was {nBits}."); From 298e06c97d661253a08bfb47635b921802c02fca Mon Sep 17 00:00:00 2001 From: DmitryVasilevsky <60718360+DmitryVasilevsky@users.noreply.github.com> Date: Fri, 27 Dec 2024 13:20:19 -0800 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Alex Hansen --- library/std/src/Std/Measurement.qs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/std/src/Std/Measurement.qs b/library/std/src/Std/Measurement.qs index 120efeaf9a..d060d8c53a 100644 --- a/library/std/src/Std/Measurement.qs +++ b/library/std/src/Std/Measurement.qs @@ -87,7 +87,7 @@ operation MResetEachZ(register : Qubit[]) : Result[] { /// # Summary /// Performs a single-qubit measurement in the Pauli X basis, -/// and resets qubit to |0⟩ state after the measurement. +/// and resets `target` to the |0⟩ state after the measurement. /// /// # Input /// ## target @@ -104,7 +104,7 @@ operation MResetX(target : Qubit) : Result { /// # Summary /// Performs a single-qubit measurement in the Pauli Y basis, -/// and resets qubit to |0⟩ state after the measurement. +/// and resets `target` to the |0⟩ state after the measurement. /// /// # Input /// ## target @@ -123,7 +123,7 @@ operation MResetY(target : Qubit) : Result { /// # Summary /// Performs a single-qubit measurement in the Pauli Z basis, -/// and resets qubit to |0⟩ state after the measurement. +/// and resets `target` to the |0⟩ state after the measurement. /// /// # Input /// ## target From 12c3ebc84f6512ab4cd189347c43fded248b95f0 Mon Sep 17 00:00:00 2001 From: DmitryVasilevsky <60718360+DmitryVasilevsky@users.noreply.github.com> Date: Fri, 27 Dec 2024 13:41:27 -0800 Subject: [PATCH 3/3] Update library/std/src/Std/Measurement.qs Co-authored-by: Alex Hansen --- library/std/src/Std/Measurement.qs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/std/src/Std/Measurement.qs b/library/std/src/Std/Measurement.qs index d060d8c53a..4d814bb4bb 100644 --- a/library/std/src/Std/Measurement.qs +++ b/library/std/src/Std/Measurement.qs @@ -138,8 +138,8 @@ operation MResetZ(target : Qubit) : Result { /// # Summary /// Measures the content of a quantum register and converts it to an integer. /// The measurement is performed with respect to the standard computational basis, -/// i.e., the eigenbasis of `PauliZ`. Input register is reset to |00...0⟩ state -/// suitable for releasing back to a target machine. +/// i.e., the eigenbasis of `PauliZ`. Input register is reset to the |00...0⟩ state, +/// which is suitable for releasing the register back to a target machine. /// /// # Input /// ## target