params
Integer parameter IDs for error bits, error-basis bits and output bits.
ParamKind module-attribute
ParamKind = Literal['e', 'f', 'm']
Error bit, error-basis bit or output bit.
ParamLayout dataclass
ParamLayout(num_errors: int)
Integer IDs for Tsim's parameters, fixed by the number of error bits.
Error bit j has ID j, so error IDs are error indices. Above them, error-basis and output bits are interleaved: basis bit j has ID num_errors + 2j and output bit i has ID num_errors + 2i + 1. An ID therefore means the same thing at every pipeline stage, whatever the numbers of basis and output bits; names exist only for drawing.
basis
basis(j: int) -> int
Return the ID of error-basis bit j.
Source code in src/tsim/core/params.py
30 31 32 | |
basis_index
basis_index(param: int) -> int
Return j for the error-basis bit whose ID is param.
Source code in src/tsim/core/params.py
45 46 47 48 49 50 | |
error
error(j: int) -> int
Return the ID of error bit j.
Source code in src/tsim/core/params.py
26 27 28 | |
kind
kind(param: int) -> tuple[ParamKind, int]
Return the kind of the bit with ID param and its index.
Source code in src/tsim/core/params.py
38 39 40 41 42 43 | |
name
name(param: int) -> str
Return the display name e{j}, f{j} or m{i} of param.
Source code in src/tsim/core/params.py
52 53 54 55 | |
names
names(params: Iterable[int]) -> dict[int, str]
Return the display names of params, by ID.
Source code in src/tsim/core/params.py
57 58 59 | |
output
output(i: int) -> int
Return the ID of output bit i.
Source code in src/tsim/core/params.py
34 35 36 | |