Expand description
One verb trait per role in the chain.
Methods taking &self are pure; &mut self signals internal state (memory,
adaptation). Every trait has an _into method writing into a caller-owned buffer,
which it resizes and fills in place (never replaces), so that a loop passing the same
buffer allocates no output once its shape is stable; scratch buffers may still
allocate (docs/adr/0011-into-reuses-the-output.md). All but Precode and
Detect also have an allocating method that calls it. Randomness is always
explicit: a random block receives &mut SimRng.
The waveform traits are generic over the symbols they carry, Symbols by default:
a waveform of complex symbols (OFDM) implements Modulate, one that carries the
index of a symbol (chirp spread spectrum, continuous-phase modulation) implements
Modulate<Labels> (docs/adr/0012-index-symbol-waveforms.md). Demap takes the
a priori log-probabilities of the points and the Jacobian logarithm through
Demapping, uniform and exact by default.
| Trait | Role | Input → output |
|---|---|---|
Encode / Decode | channel coding | Bits → Bits, Llr → Bits |
Map / Demap | constellation mapping | Bits → Symbols → Llr |
Modulate / Demodulate | waveform | Symbols or Labels → Signal → Symbols or Labels |
Precode / Detect | MIMO | Symbols → Symbols |
Propagate | propagation medium | Signal → Signal |
Impair | component non-ideality | Signal → Signal |
§Examples
use comnum_core::prelude::*;
/// A noiseless gain, the smallest `Impair`.
struct Gain(f64);
impl Impair for Gain {
fn impair_into(&mut self, x: &Signal, _: &mut SimRng, out: &mut Signal) -> Result<()> {
out.resize(x.n_streams(), x.len(), x.sample_rate());
out.as_array_mut().assign(&(x.as_array() * self.0));
Ok(())
}
}
let x = Signal::from_stream(vec![C64::new(1.0, 0.0); 4], Hertz(1.0))?;
let y = Gain(2.0).impair(&x, &mut batch_rng(1, 0))?;
assert_eq!(y.stream(0)[3], C64::new(2.0, 0.0));Structs§
- Demapping
- The a priori information and the approximation of a soft demapper
(
Demap::demap_with_into). With the log-priors $\lambda_{x} = \ln P(x)$ of the points $x$ of the alphabet and the variance $\sigma^{2}$ of the complex noise, the LLR of a bit of the received symbol $y$ is
Enums§
- Jacobian
- The Jacobian logarithm of the log-MAP algorithms and of the soft demappers, exact or approximated by its maximum:
Traits§
- Decode
- Channel decoding of log-likelihood ratios into information bits.
- Demap
- Soft demapping of received symbols into log-likelihood ratios.
- Demodulate
- Demodulation of a waveform back to symbols: complex
Symbolsby default, or the decidedLabelsof a waveform that carries the index of a symbol (Demodulate<Labels>). - Detect
- Detection of transmitted symbols from received streams.
- Encode
- Channel encoding of information bits into codewords.
- Impair
- A component non-ideality (amplifier, oscillator, converter…).
- Map
- Mapping of bits onto constellation symbols.
- Modulate
- Modulation of symbols onto a waveform: complex
Symbolsby default, or theLabelsof a waveform that carries the index of a symbol (Modulate<Labels>). - Precode
- MIMO precoding of streams of symbols.
- Propagate
- Propagation through a medium. Randomness is always explicit.