M operation

Performs a measurement of a single qubit in the Pauli $Z$ basis. The output result is given by the distribution \begin{align} \Pr(\texttt{Zero} | \ket{\psi}) = \braket{\psi | 0} \braket{0 | \psi}. \end{align}

operation M (qubit : Qubit) : Result

Input

qubit
Qubit

Qubit to be measured.

Output

Result

Zero if the $+1$ eigenvalue is observed, and One if the $-1$ eigenvalue is observed.

Remarks

Equivalent to: qsharp Measure([PauliZ], [qubit]);