Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.quantum_info.purity

purity(state, validate=True)

GitHub

Calculate the purity of a quantum state.

The purity of a density matrix ρ\rho is

Purity(ρ)=Tr[ρ2]\text{Purity}(\rho) = Tr[\rho^2]

Parameters

  • state (Statevector orDensityMatrix) – a quantum state.
  • validate (bool) – check if input state is valid [Default: True]

Returns

the purity Tr[ρ2]Tr[\rho^2].

Return type

float

Raises

QiskitError – if the input isn’t a valid quantum state.

Was this page helpful?
Report a bug or request content on GitHub.