M operation

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Intrinsic

Package: Microsoft.Quantum.Type2.Core

Performs a measurement of a single qubit in the Pauli $Z$ basis.

operation M (qubit : Qubit) : Result

Description

The output result is given by the distribution \begin{align} \Pr(\texttt{Zero} | \ket{\psi}) = \braket{\psi | 0} \braket{0 | \psi}. \end{align}

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:

Measure([PauliZ], [qubit]);