measurement_ops.measure

Determine probability of obtaining measurement outcome.

Functions

measure(measurement, state)

Determine probability of obtaining a measurement outcome applied to state.

Module Contents

measurement_ops.measure.measure(measurement, state)

Determine probability of obtaining a measurement outcome applied to state.

A measurement is defined by a function

\[\mu : \Sigma \rightarrow \text{Pos}(\mathcal{X}),\]

for some choice of alphabet \(\Sigma\) and a complex Euclidean space \(\mathcal{X}\) that satisfies

\[\sum_{a \in \Sigma} \mu(a) = \mathbb{I}_{\mathcal{X}}.\]

Further information can be found here [1].

Examples

Consider the following state:

\[u = \frac{1}{\sqrt{3}} e_0 + \sqrt{\frac{2}{3}} e_1\]

where we define \(u u^* = \rho \in \text{D}(\mathcal{X})\).

Define measurement operators

\[P_0 = e_0 e_0^* \quad \text{and} \quad P_1 = e_1 e_1^*.\]
>>> from toqito.states import basis
>>> from toqito.measurement_ops import measure
>>> import numpy as np
>>> e_0, e_1 = basis(2, 0), basis(2, 1)
>>>
>>> u = 1/np.sqrt(3) * e_0 + np.sqrt(2/3) * e_1
>>> rho = u @ u.conj().T
>>>
>>> proj_0 = e_0 @ e_0.conj().T
>>> proj_1 = e_1 @ e_1.conj().T

Then the probability of obtaining outcome \(0\) is given by

\[\langle P_0, \rho \rangle = \frac{1}{3}.\]
>>> measure(proj_0, rho)
0.3333333333333334

Similarly, the probability of obtaining outcome \(1\) is given by

\[\langle P_1, \rho \rangle = \frac{2}{3}.\]
>>> measure(proj_1, rho)
0.6666666666666666

References

[1]

Wikipedia. Measurement in quantum mechanics. URL: https://en.wikipedia.org/wiki/Measurement_in_quantum_mechanics.

Parameters:
  • measurement (numpy.ndarray) – The measurement to apply.

  • state (numpy.ndarray) – The state to apply the measurement to.

Returns:

Returns the probability of obtaining a given outcome after applying the variable measurement to the variable state.

Return type:

float