Skip to content

hal.codes.radial_codes

RadialCode

RadialCode(
    s,
    *,
    r=None,
    A=None,
    B=None,
    abdiff=False,
    checkdiff=False,
    field=None,
    max_attempts=1000,
    max_row_attempts=1000
)

Bases: CSSCode

Radial (QC-LDPC) CSS code constructed via the lifted product.

Optional arguments A_proto / B_proto let you reuse or test custom base-matrices; if they are omitted they are generated randomly subject to the same constraints as in the original script.

_generate_protograph classmethod

_generate_protograph(
    r, s, stringent, *, max_attempts, max_row_attempts
)

Direct transcription of the algorithm in the original script:

– pick the first row at random; – keep sampling rows until all three checkers pass (difference / rank / 4–cycle); – back-off after 1000 row attempts or 1000 global attempts, exactly like the original.

write_pcm_mtx

write_pcm_mtx(which, outfile)

Dump code.hx or code.hz (which = "X" | "Z") in MatrixMarket coordinate format, including the protographs in comments.