marginalize_confusion_matrix

forest.benchmarking.readout.marginalize_confusion_matrix(confusion_matrix: numpy.ndarray, all_qubits: Sequence[int], marginal_subset: Tuple[int, ...]) → numpy.ndarray

Marginalize a confusion matrix to get a confusion matrix on only the marginal_subset.

Taking a joint confusion matrix (see estimate_joint_confusion_in_set) on all_qubits and marginalizing out some qubits results in another joint confusion matrix on only the marginal_subset. Comparing this marginal confusion matrix to a direct estimate of the joint confusion matrix on only the marginal_subset provides information about correlations between the marginal subset and the remaining qubits in all_qubits. For example, if each qubit is independent, we expect that the joint matrix on all_qubits is a tensor product of the matrices for each individual qubit. In this case, any marginalized single qubit confusion matrix for a given qubit should be identical to the directly estimated single qubit confusion matrix for that same qubit (up to estimation error).

Parameters:
  • confusion_matrix – a confusion matrix for a group of qubits.
  • all_qubits – the sequence of qubit labels corresponding to the confusion matrix. Qubits should be listed such that the most significant bit labels the first qubit in the sequence.
  • marginal_subset – a subset of labels in all_qubits. The subset may be provided in any order, but the returned confusion matrix order will correspond to the order of subset elements as they appear in all_qubits
Returns:

a joint confusion matrix for the qubits in the marginal subset