Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

qiskit.quantum_info.purity

purity(state, validate=True)

GitHub(opens in a new tab)

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.