Skip to content

Documentation for correction return type of decode() method is misleading/incomplete #174

@RickRichmond

Description

@RickRichmond

Currently correction return value from decode() is documented as follows:

Returns: ### correctionnumpy.ndarray or list[int]

A 1D numpy array of ints giving the minimum-weight correction operator as a binary vector. The number of elements in correction is one greater than the largest fault ID. The ith element of correction is 1 if the minimum-weight perfect matching (MWPM) found by PyMatching contains an odd number of edges that have i as one of the fault_ids, and is 0 otherwise. If each edge in the matching graph is assigned a unique integer in its fault_ids attribute, then the locations of nonzero entries in correction correspond to the edges in the MWPM. However, fault_ids can instead be used, for example, to store IDs of the physical or logical frame changes that occur when an edge flips (see the documentation for Matching.add_edge for more information).

However, if a Matching decoder is constructed using from_detector_error_model() or from_check_matrix(), where a faults_matrix (e.g. L) is passed to the latter method, then the shape of correction will be (1,) (for a single logical observable, e.g. as is common in surface codes).

Recommend a clarification on this in the doc string please.

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