state_props.purity

Calcultes the purity of a quantum state.

Functions

purity(rho)

Compute the purity of a quantum state [1].

Module Contents

state_props.purity.purity(rho)

Compute the purity of a quantum state [1].

The negativity of a subsystem can be defined in terms of a density matrix \(\rho\): The purity of a quantum state \(\rho\) is defined as

\[\text{Tr}(\rho^2),\]

where \(\text{Tr}\) is the trace function.

Examples

Consider the following scaled state defined as the scaled identity matrix

\[\begin{split}\rho = \frac{1}{4} \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} \in \text{D}(\mathcal{X}).\end{split}\]

Calculating the purity of \(\rho\) yields \(\frac{1}{4}\). This can be observed using toqito as follows.

>>> from toqito.state_props import purity
>>> import numpy as np
>>> purity(np.identity(4) / 4)
np.float64(0.25)

Calculate the purity of the Werner state:

>>> from toqito.states import werner
>>> rho = werner(2, 1 / 4)
>>> np.around(purity(rho), decimals=4)
np.float64(0.2653)

References

[1] (1,2)

Wikipedia. Purity (quantum mechanics). URL: https://en.wikipedia.org/wiki/Purity_(quantum_mechanics).

Raises:

ValueError – If matrix is not density operator.

Parameters:

rho (numpy.ndarray) – A density matrix of a pure state vector.

Returns:

A value between 0 and 1 that corresponds to the purity of \(\rho\).

Return type:

float