1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//! Compile-time parameters for the WSJT-family LDPC codes.
//!
//! Both [`crate::fec::Ldpc174_91`] (FT8 / FT4) and
//! [`crate::fec::Ldpc240_101`] (FST4) share an identical
//! belief-propagation + ordered-statistics decoding algorithm — only
//! the parity-check matrix shape and CRC width differ. This module
//! abstracts those shape-only differences behind a sealed
//! [`LdpcParams`] trait so both codes target a single generic
//! implementation living in [`super::bp`] and [`super::osd`].
//!
//! ## Closed-set property
//!
//! The trait is **sealed** by design: in practice the WSJT LDPC
//! generator matrices are hand-crafted for very short blocklengths,
//! and adding a third matrix is a research project rather than a
//! refactor. Sealing the trait keeps the closed-set property
//! visible at compile time — external crates that try to add a new
//! params type fail to link, signalling the impossibility correctly.
//!
//! Adding a fourth WSJT-family LDPC code (e.g. a new FST4 sub-mode
//! with a different generator matrix) means: define a new
//! `XxxParams` ZST, implement `sealed::Sealed` and [`LdpcParams`]
//! for it inside this crate, supply the table data, and add a
//! `pub type Xxx = LdpcCodec<XxxParams>` alias in [`super`].
use tables;
/// Sealed implementation of [`LdpcParams`].
///
/// External crates cannot satisfy this bound, so they cannot
/// implement [`LdpcParams`] either. This is the compile-time
/// expression of "the WSJT LDPC generator matrices are a closed
/// set".
/// Compile-time parameters describing one specific WSJT-family LDPC
/// code. Implementors are zero-sized types ([`Ldpc174_91Params`],
/// [`Ldpc240_101Params`]) that ferry constants and table accessors
/// to the generic BP / OSD / encode bodies.
///
/// All accessors are written so the optimiser inlines them down to
/// a direct array index — one extra layer of indirection that
/// disappears at codegen.
// ────────────────────────────────────────────────────────────────────
// LDPC(174, 91) — FT8 / FT4 / FT2
// ────────────────────────────────────────────────────────────────────
/// Parameters for the WSJT LDPC(174, 91) code (FT8 / FT4 / FT2).
/// Tables come from [`super::tables`] and the `GEN_PARITY` constant
/// in [`super::osd`].
;
// ────────────────────────────────────────────────────────────────────
// LDPC(240, 101) — FST4 / FST4W
// ────────────────────────────────────────────────────────────────────
/// Parameters for the WSJT LDPC(240, 101) code (FST4 / FST4W).
/// Tables come from [`crate::fec::ldpc240_101::tables`].
;