# Modelling correlated measurement errors in Stim

Is there a way to model correlated measurement errors in Stim? I see we can implement correlated Pauli errors, but couldn't find anything for correlated measurement errors.

• Why don't you just apply a correlated error just before the measurement gate to simulate the measurement error? Commented May 20, 2023 at 5:42
• Thanks for the suggestion! I am doing that currently, but I am not sure if that is the best way to model correlated measurements. Paulis are unitary, and measurement is a non-unitary operation, so I don't know if that would be an accurate reflection of the true result. I am trying to model things as closely as possible. Commented May 20, 2023 at 6:41

Currently, the only way to have a correlated measurement error is to insert CORRELATED_ERROR on the qubits just before measuring. If you are always reset-ing the qubits after measuring them, this is correct.

If you use non-demolition measurements, it's not correct. You'd need to fake the error in terms of ancilla qubits. For example, replace the measurements by CNOTs onto ancilla qubits, then apply the correlated error to the ancilla qubits, then measure them. This will work, but it's always kinda crummy as a solution because it makes it hard to tell which operations are actually intended by the circuit and which are fake operations used to implement noise.

Here is an example with demolition measurement. The circuit before adding noise:

CX 0 1 2 3
TICK
CX 4 3 2 1
TICK
MR 1 3
TICK


and after:

CX 0 1 2 3
TICK
CX 4 3 2 1
TICK
CORRELATED_ERROR(0.001) X1 X3
MR 1 3
TICK


Here is an example with non-demolition measurement. The circuit before adding noise:

CX 0 1 2 3
TICK
CX 4 3 2 1
TICK
M 1 3
TICK


and after:

CX 0 1 2 3
TICK
CX 4 3 2 1
TICK

# measurement with correlated noise
# 101 and 103 are ancilla qubits currently in the |0> state
CX 1 101 3 103
CORRELATED_ERROR(0.001) X101 X103
MR 101 103
TICK