1
$\begingroup$

In Stim, I want to simulate correlated errors having the following behavior:

R 0 1
H 0
ERROR_1(p) 0
CX 0 1
ERROR_2(conditioned on ERROR_1) 1
...

The ERROR_1 and ERROR_2 compose a correlated error. ERROR_1 happens with probability p and ERROR_2 will happen if and only if ERROR_1 happens.

The current CORRELATED_ERROR in stim seems not support this type of error. How can I achieve this or did I miss anything?

$\endgroup$

1 Answer 1

2
$\begingroup$

Stim doesn't have good facilities for time-correlated errors. For your case you can use an ancilla qubit as a hacky error storage bit:

R 0 1
H 0

# Start fancy error
R 999  # clear ancilla qubit
X_ERROR(p) 999  # store error on ancilla qubit
CX 999 0  # spread error from ancilla qubit to targets
CY 999 1  # spread error from ancilla qubit to targets
CZ 999 2  # spread error from ancilla qubit to targets

CX 0 1

# Continue fancy error
CX 999 1  # spread error from ancilla qubit to more targets
CY 999 2  # spread error from ancilla qubit to more targets
CZ 999 3  # spread error from ancilla qubit to more targets

The main annoyance is that code working with the circuit often needs to understand that the CNOT gates touching the ancilla qubits aren't intended as physical gates a machine would do but rather just implementation details of the noise model.

For more complex cases you can implement your error model in python and run it alongside a stim.FlipSimulator, injecting the errors as the simulation runs. This still requires all errors to be probabilistic Pauli flips, but since they're generated by python you can relate them in essentially any way you want.

For even more complex cases you can run alongside a stim.TableauSimulator, but resorting to that is a major 1000x performance reduction in sample rate.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.