Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem In CheckMatrix #1

Open
DiegoRuiz-Git opened this issue Nov 6, 2024 · 2 comments
Open

Problem In CheckMatrix #1

DiegoRuiz-Git opened this issue Nov 6, 2024 · 2 comments

Comments

@DiegoRuiz-Git
Copy link

Hi @oscarhiggott,

First thank you for putting this useful library on github! I think I found a bug, here is a minimal working example:

I have a dem that looks like this

stim.DetectorErrorModel('''
    error(0.01) D0
    error(0.001) D0 L0
''')

If D0 is triggered, we would expect the decoder to always choose error(0.01) D0 and to not predict that L0 was triggered. However, when running the code, the observable is always predicted as True.
I dug a bit into the source code, and I think the reason for this is that in decoder._matrices.check_matrix, the two error mechanism are merged, with a prior probability which is the sum of the two. And in it the same in decoder._matrices.observables_matrix.

Thank you

@DiegoRuiz-Git DiegoRuiz-Git changed the title Bug In CheckMatrix Problem In CheckMatrix Nov 6, 2024
@oscarhiggott
Copy link
Owner

Thanks for flagging this. Of course this issue will only arise for a code/circuit with distance at most 2 by definition, but it would still be good to handle it correctly.

I could imagine two similarly valid approaches:

  1. Both (or in general all) indistinguishable errors could still be merged, but the most probable logical observable assignment is chosen (instead of the arbitrary choice made currently).

  2. Errors are only merged if they flip the same set of detectors and observables (instead of only merging errors with the same detectors, ignoring the observables, as currently done).

I would like to have both as options, and am leaning towards having (2) as the default (with an option like merge_all_indistinguishable_errors to choose (1)).

@DiegoRuiz-Git
Copy link
Author

Thanks for the reply! As stim already merges errors if they flip the same detectors and observables in the dem, why is there a need to remerge the errors? (at least to implement solution 2.)
But maybe I'm missing some cases I don't work with usually

@DiegoRuiz-Git DiegoRuiz-Git closed this as not planned Won't fix, can't repro, duplicate, stale Nov 9, 2024
@DiegoRuiz-Git DiegoRuiz-Git reopened this Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants