Tried this simple example where initializing two qubits in $|0\rangle$ state, performing biased bit flip erasure on qubit 1 using HERALDED_PAULI_CHANNEL_1 while measuring qubit 0:

import stim
    import numpy as np
    circuit = stim.Circuit()
    circuit.append_operation("R", (0, 1))
    p = 0.2
    circuit.append_operation("HERALDED_PAULI_CHANNEL_1", 1, (p, p, 0, 0))
    N = 1000
    result = circuit.compile_sampler().sample(shots = N)
    one_num = np.sum([int(True == j[-1]) for j in result])
    print('%s/%s' %(one_num, N))

I get around 200/1000 measurement error on the qubit 0 as if the error is on qubit 0. What is wrong here? Thank you.


1 Answer 1


Update: This is fixed in stim~=1.12.1 and in stim~=1.13.dev1701377008. The only stable version affected was 1.12.0, since HERALDED_PAULI_CHANNEL_1 was released in 1.12.

😱 This is a bug. Good catch. I've written a fix and am merging it: https://github.com/quantumlib/Stim/pull/676. Also added some tests that verify it's fixed. I also checked HERALDED_ERASE, which historically was added at the same time but didn't have the same bug.

enter image description here

Within two hours you should be able to pip install stim~=1.13.dev and get a version with the bug fixed. I'll also backport the fix to 1.12 and release a version 1.12.1. That should be done before the end of the day.


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.