qiskit.quantum_info.purity¶
-
purity
(state, validate=True)[source]¶ Calculate the purity of a quantum state.
The purity of a density matrix \(\rho\) is
\[\text{Purity}(\rho) = Tr[\rho^2]\]- Paramètres
state (Statevector or DensityMatrix) – a quantum state.
validate (bool) – check if input state is valid [Default: True]
- Renvoie
the purity \(Tr[\rho^2]\).
- Type renvoyé
float
- Lève
QiskitError – if the input isn’t a valid quantum state.