cirq.measure_confusion_matrix

Prepares TensoredConfusionMatrices for the n qubits in the input.

The confusion matrix (CM) for two qubits is the following matrix:

⎡ Pr(00|00) Pr(01|00) Pr(10|00) Pr(11|00) ⎤
⎢ Pr(00|01) Pr(01|01) Pr(10|01) Pr(11|01) ⎥
⎢ Pr(00|10) Pr(01|10) Pr(10|10) Pr(11|10) ⎥
⎣ Pr(00|11) Pr(01|11) Pr(10|11) Pr(11|11) ⎦

where Pr(ij | pq) = Probability of observing “ij” given state “pq” was prepared.

sampler Sampler to collect the data from.
qubits Qubits for which the confusion matrix should be measured.
repetitions Number of times to sample each circuit for a confusion matrix row.