pub struct QraCode {Show 24 fields
pub K: usize,
pub N: usize,
pub m: u32,
pub M: usize,
pub a: usize,
pub NC: usize,
pub V: usize,
pub C: usize,
pub NMSG: usize,
pub MAXVDEG: usize,
pub MAXCDEG: usize,
pub code_type: QraCodeType,
pub R: f32,
pub name: &'static str,
pub acc_input_idx: &'static [i32],
pub acc_input_wlog: &'static [i32],
pub gflog: &'static [i32],
pub gfexp: &'static [i32],
pub msgw: &'static [i32],
pub vdeg: &'static [i32],
pub cdeg: &'static [i32],
pub v2cmidx: &'static [i32],
pub c2vmidx: &'static [i32],
pub gfpmat: &'static [i32],
}Expand description
Static description of a single QRA code: parameters + the precomputed tables consumed by the encoder and BP decoder.
Fields§
§K: usizeNumber of information symbols.
N: usizeCodeword length in symbols.
m: u32Bits per symbol (M = 2^m).
M: usizeSymbol alphabet cardinality.
a: usizeCode grouping factor (1 for Q65).
NC: usizeNumber of check symbols (N − K).
V: usizeNumber of variables in the code graph (= N).
C: usizeNumber of factor nodes (= N + NC + 1).
NMSG: usizeNumber of edges / messages in the bipartite graph.
MAXVDEG: usizeMaximum variable-node degree in the graph.
MAXCDEG: usizeMaximum factor-node (check) degree in the graph.
code_type: QraCodeTypeCode type (Normal / CRC / CRC-punctured).
R: f32Code rate K / N.
name: &'static strHuman-readable code name (e.g. "qra15_65_64_irr_e23").
acc_input_idx: &'static [i32]acc_input_idx[k] — index into x[] of the systematic input
symbol entering the accumulator at check k. Length
NC * a + 1 (the +1 entry is the terminator check used in
debug builds; it is harmless to have it present).
acc_input_wlog: &'static [i32]acc_input_wlog[k] — log-α weight (in GF(M)*) applied to that
input before XOR-accumulation.
gflog: &'static [i32]GF(M) discrete log: gflog[x] = log_α(x) for x != 0.
gfexp: &'static [i32]GF(M) discrete exp: gfexp[i] = α^i for 0 ≤ i < M − 1.
msgw: &'static [i32]msgw[i] — log-α weight attached to message edge i.
vdeg: &'static [i32]vdeg[v] — degree of variable node v.
cdeg: &'static [i32]cdeg[c] — degree of factor node c.
v2cmidx: &'static [i32]v2cmidx[v * MAXVDEG + k] — message index for the k-th edge
leaving variable v. Length V * MAXVDEG.
c2vmidx: &'static [i32]c2vmidx[c * MAXCDEG + k] — message index for the k-th edge
leaving check c. Length C * MAXCDEG.
gfpmat: &'static [i32]gfpmat[w * M + k] — multiplication-by-α^w permutation
table over GF(M). Length (M − 1) * M.
Implementations§
Source§impl QraCode
impl QraCode
Sourcepub fn encode(&self, x: &[i32], y: &mut [i32])
pub fn encode(&self, x: &[i32], y: &mut [i32])
Systematic encode: copy x (K info symbols over GF(M)) into the
first K positions of y, then compute NC parity symbols by
running the QRA accumulator chain across acc_input_idx / acc_input_wlog.
x.len() must equal self.K; y.len() must equal self.N.
All symbol values must be in 0 .. self.M.
Sourcepub fn mfsk_bessel_metric(
&self,
pix: &mut [f32],
rsq: &[f32],
n_symbols: usize,
es_no_metric: f32,
) -> f32
pub fn mfsk_bessel_metric( &self, pix: &mut [f32], rsq: &[f32], n_symbols: usize, es_no_metric: f32, ) -> f32
Convert per-tone squared amplitudes into per-symbol intrinsic probability distributions, assuming non-coherent M-FSK reception in AWGN.
n_symbols is the number of observed channel symbols — this
matches the C reference’s qra_mfskbesselmetric(..., N, ...)
call shape, where N is passed in rather than read off the
code, because Q65 punctures 2 symbols off the codeword and so
observes N - 2 = 63 symbols, not the underlying code’s
N = 65. Both pix and rsq must have length M * n_symbols,
laid out row-major: symbol-k data sits in
[M * k .. M * (k+1)].
Returns the estimated noise standard deviation σ̂.
The metric is calibrated for Es/No = es_no_metric (linear,
not dB). Q65 uses ~2.8 dB linearised, scaled by m * R.
Sourcepub fn extrinsic(
&self,
pex: &mut [f32],
pix: &[f32],
maxiter: u32,
scratch: &mut DecoderScratch,
) -> ExtrinsicResult
pub fn extrinsic( &self, pex: &mut [f32], pix: &[f32], maxiter: u32, scratch: &mut DecoderScratch, ) -> ExtrinsicResult
Iterative non-binary BP: given per-symbol intrinsic probability
distributions pix (length M·V), iterate until each
variable’s outgoing extrinsic distribution is concentrated on
one value or maxiter is exhausted.
On return, pex (length M·V) holds the extrinsic
distributions — pass them together with pix to
Self::map_decode for the final hard decision.
scratch must come from DecoderScratch::for_code applied
to the same code instance.
Sourcepub fn map_decode(&self, pex: &mut [f32], pix: &[f32], xdec: &mut [i32])
pub fn map_decode(&self, pex: &mut [f32], pix: &[f32], xdec: &mut [i32])
MAP hard decision on the K information symbols.
Multiplies extrinsic × intrinsic for each variable, then
argmax. Destroys pex in place. xdec.len() must equal
self.K.
Auto Trait Implementations§
impl Freeze for QraCode
impl RefUnwindSafe for QraCode
impl Send for QraCode
impl Sync for QraCode
impl Unpin for QraCode
impl UnsafeUnpin for QraCode
impl UnwindSafe for QraCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more