qiskit.quantum_info.purity¶
-
purity
(state, validate=True)[ソース]¶ Calculate the purity of a quantum state.
The purity of a density matrix \(\rho\) is
\[\text{Purity}(\rho) = Tr[\rho^2]\]- パラメータ
state (Statevector or DensityMatrix) – a quantum state.
validate (bool) – check if input state is valid [Default: True]
- 戻り値
the purity \(Tr[\rho^2]\).
- 戻り値の型
float
- 例外
QiskitError – if the input isn’t a valid quantum state.