Measure 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 joint measurement of one or more qubits in the specified Pauli bases.

operation Measure (bases : Pauli[], qubits : Qubit[]) : Result

Description

The output result is given by the distribution: \begin{align} \Pr(\texttt{Zero} | \ket{\psi}) = \frac12 \braket{ \psi \mid| \left( \boldone + P_0 \otimes P_1 \otimes \cdots \otimes P_{N-1} \right) \mid| \psi }, \end{align} where $P_i$ is the $i$th element of bases, and where $N = \texttt{Length}(\texttt{bases})$. That is, measurement returns a Result $d$ such that the eigenvalue of the observed measurement effect is $(-1)^d$.

Input

bases : Pauli[]

Array of single-qubit Pauli values indicating the tensor product factors on each qubit.

qubits : Qubit[]

Register of qubits to be measured.

Output : Result

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

Remarks

If the basis array and qubit array are different lengths, then the operation will fail.