cirq.fidelity

cirq.fidelity(state1: numpy.ndarray, state2: numpy.ndarray) → float[source]

Fidelity of two quantum states.

The fidelity of two density matrices ρ and σ is defined as

trace(sqrt(sqrt(ρ) σ sqrt(ρ)))^2.

The given states can be state vectors or density matrices.

Parameters
  • state1 – The first state.

  • state2 – The second state.