Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 1.63 KB

File metadata and controls

38 lines (26 loc) · 1.63 KB
page_type languages products description urlFragment
sample
qsharp
qdk
This sample demonstrates the use of measurement operations to measure one or more qubits.
measuring-qubits

Measuring Qubits

This sample demonstrates:

  • The use of measurement operations to measure one or more qubits, getting classical data back that can be used in classical logic.
  • How to use assertions to build tests for expected behaviour of operations that involve measurements.
  • Resetting previously allocated qubits.

In Q#, the most basic measurement operation is the M operation, which measures a single qubit in the computational basis (sometimes also called the 𝑍-basis). In this sample, we show how M can be used to sample random numbers, and to measure registers of qubits.

Prerequisites

Running the Sample

To run the sample, use the dotnet run command from your terminal.

Manifest

Further resources