pygsti.tools.fidelity

pygsti.tools.fidelity(A, B)
Returns the quantum state fidelity between density

matrices A and B given by :

F = Tr( sqrt{ sqrt(A) * B * sqrt(A) } )^2

To compute process fidelity, pass this function the Choi matrices of the two processes, or just call the process_fidelity function with the gate matrices.

Parameters:
  • A (numpy array) – First density matrix.
  • B (numpy array) – Second density matrix.
Returns:

The resulting fidelity.

Return type:

float