comnum_core/lib.rs
1//! # comnum-core — the vocabulary every comnum crate speaks
2//!
3//! Typed containers, verb traits, unit newtypes, the random generator and the error
4//! type. It contains no algorithm: the blocks that implement these traits live in the
5//! crates above it (see `docs/ARCHITECTURE.md`).
6//!
7//! | Module | Content |
8//! |---|---|
9//! | [`channel`] | [`Path`], one path of a delay–Doppler channel realisation |
10//! | [`signal`] | [`Bits`], [`Llr`], [`Symbols`], [`Labels`], [`Signal`] (streams × elements), [`DualPol`] |
11//! | [`traits`] | [`Encode`], [`Decode`], [`Map`], [`Demap`] (with [`Demapping`] and [`Jacobian`]), [`Modulate`], [`Demodulate`], [`Precode`], [`Detect`], [`Propagate`], [`Impair`] |
12//! | [`units`] | [`Db`], [`EbN0`], [`EsN0`], [`Hertz`], [`Seconds`] |
13//! | [`rng`] | [`Rng`] (xoshiro256\*\*), [`SimRng`], [`stream`], [`batch_rng`] |
14//! | [`error`] | [`Error`], [`Result`], [`ensure`], [`ensure_shape`], [`expect_len`], [`same_len`] |
15//!
16//! # Conventions
17//!
18//! - Complex baseband samples are [`C64`] (`num_complex::Complex<f64>`).
19//! - Physical quantities are in SI units unless the name says otherwise (`_db`, `_dbm`,
20//! `_km`, `_ps_nm_km`, …).
21//! - There is no global or thread-local generator anywhere: every random block takes a
22//! `&mut SimRng`, so every simulation is reproducible from its seed.
23//!
24//! [`Path`]: channel::Path
25//! [`Bits`]: signal::Bits
26//! [`Llr`]: signal::Llr
27//! [`Symbols`]: signal::Symbols
28//! [`Labels`]: signal::Labels
29//! [`Signal`]: signal::Signal
30//! [`DualPol`]: signal::DualPol
31//! [`Encode`]: traits::Encode
32//! [`Decode`]: traits::Decode
33//! [`Map`]: traits::Map
34//! [`Demap`]: traits::Demap
35//! [`Demapping`]: traits::Demapping
36//! [`Jacobian`]: traits::Jacobian
37//! [`Modulate`]: traits::Modulate
38//! [`Demodulate`]: traits::Demodulate
39//! [`Precode`]: traits::Precode
40//! [`Detect`]: traits::Detect
41//! [`Propagate`]: traits::Propagate
42//! [`Impair`]: traits::Impair
43//! [`Db`]: units::Db
44//! [`EbN0`]: units::EbN0
45//! [`EsN0`]: units::EsN0
46//! [`Hertz`]: units::Hertz
47//! [`Seconds`]: units::Seconds
48//! [`Rng`]: rng::Rng
49//! [`SimRng`]: rng::SimRng
50//! [`stream`]: rng::stream
51//! [`batch_rng`]: rng::batch_rng
52
53pub mod channel;
54pub mod error;
55pub mod rng;
56pub mod signal;
57pub mod traits;
58pub mod units;
59
60pub use error::{Error, Result, ensure, ensure_shape, expect_len, same_len};
61
62/// Complex number with `f64` components (the type of every complex sample).
63pub type C64 = num_complex::Complex<f64>;
64
65/// The items used by most blocks.
66pub mod prelude {
67 pub use crate::C64;
68 pub use crate::error::{Error, Result};
69 pub use crate::rng::{Rng, SimRng, batch_rng, stream};
70 pub use crate::signal::{Bits, DualPol, Labels, Llr, Signal, Symbols};
71 pub use crate::traits::{
72 Decode, Demap, Demapping, Demodulate, Detect, Encode, Impair, Jacobian, Map, Modulate, Precode, Propagate,
73 };
74 pub use crate::units::{Db, EbN0, EsN0, Hertz, Seconds};
75}