Skip to content

SinterCompiledDecoder_BP.decode_shots_bit_packed: missing count= in np.unpackbits causes wrong corrections #34

@RefaatIsmail

Description

@RefaatIsmail

SinterCompiledDecoder_BP.decode_shots_bit_packed: missing count= in np.unpackbits causes wrong corrections

In relay_bp/stim/sinter/decoders.py, line 46:

syndromes = np.unpackbits(
    bit_packed_detection_event_data, bitorder="little", axis=1
).astype(np.uint8)

When num_detectors % 8 != 0, np.unpackbits pads to the nearest byte boundary, producing extra zero columns that participate in BP message passing and silently produce wrong corrections (inflated logical error rate, no exception raised).

Fix

num_detectors = self.check_matrices.check_matrix.shape[0]
syndromes = np.unpackbits(
    bit_packed_detection_event_data, bitorder="little", axis=1, count=num_detectors
).astype(np.uint8)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions