Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated doc comments on measurement operations #2080

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 13 additions & 34 deletions library/std/src/Std/Measurement.qs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 `target` to the |0⟩ state after the measurement.
///
/// # Input
/// ## target
Expand All @@ -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 `target` to the |0⟩ state after the measurement.
///
/// # Input
/// ## target
Expand All @@ -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 `target` to the |0⟩ state after the measurement.
///
/// # Input
/// ## target
Expand All @@ -154,20 +136,17 @@ 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 the |00...0⟩ state,
/// which is suitable for releasing the register back to a target machine.
///
/// # Input
/// ## target
/// A quantum register in the little-endian encoding.
///
/// # 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}.");
Expand Down
Loading