state_fidelity

Function state_fidelity 

Source
pub fn state_fidelity(
    state1: &QuantumState,
    state2: &QuantumState,
) -> Result<f64, QuantumInfoError>
Expand description

Compute the state fidelity between two quantum states.

For pure states |ψ⟩ and |φ⟩: F = |⟨ψ|φ⟩|² For mixed states ρ and σ: F = (Tr[√(√ρ σ √ρ)])²

§Arguments

  • state1 - First quantum state (state vector or density matrix)
  • state2 - Second quantum state (state vector or density matrix)

§Returns

The fidelity F ∈ [0, 1]