purity

Function purity 

Source
pub fn purity(state: &QuantumState) -> Result<f64, QuantumInfoError>
Expand description

Calculate the purity of a quantum state.

Purity = Tr[ρ²] For pure states: Purity = 1 For maximally mixed states: Purity = 1/d

§Arguments

  • state - Quantum state (state vector or density matrix)

§Returns

The purity ∈ [1/d, 1]