Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK. Go to the latest version.

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.