leakage_from_process_matrix

leakage_from_process_matrix(matrix)

Return the leakage from the qubit subspace.

Leakage is defined as the probability that a quantum operation results in the system leaving the qubit subspace. For an ideal process matrix, the trace of the process matrix should equal 1, indicating no leakage.

Parameters:

matrix (ndarray | Array) – The process matrix representing the quantum operation.

Return type:

float | ndarray | Array

Returns:

The leakage from the qubit subspace.

Raises:

SimphonyError – If the process matrix is not square.

Notes

The leakage \(L\) is calculated as:

\[L = 1 - \text{Tr}(\chi),\]

where \(\chi\) is the process matrix.