Skip to main content

Constellation

Struct Constellation 

Source
pub struct Constellation { /* private fields */ }
Expand description

A symbol constellation with a bit labelling.

Implementations§

Source§

impl Constellation

Source

pub fn bpsk() -> Constellation

Binary phase-shift keying: bit 0 → +1, bit 1 → −1.

Source

pub fn qpsk() -> Constellation

Quadrature PSK with Gray labelling (the same constellation as 4-QAM).

Source

pub fn psk(m: usize) -> Result<Constellation, ErrorsJSL>

m-ary PSK (m a power of two, at least 2) on the unit circle with Gray labelling: symbol k sits at angle 2πk/m.

Source

pub fn qam(m: usize) -> Result<Constellation, ErrorsJSL>

Square m-QAM (m = 4, 16, 64, 256 or 1024) with independent Gray-coded PAM on the I and Q axes: the first half of the bits label I, the second half label Q.

Source

pub fn size(&self) -> usize

Number of symbols.

Source

pub fn bits_per_symbol(&self) -> usize

Source

pub fn points(&self) -> &[Complex<f64>]

The symbols, indexed by bit label.

Source

pub fn average_power(&self) -> f64

Mean symbol energy (1 by construction).

Source

pub fn min_distance(&self) -> f64

Smallest distance between two distinct symbols.

Source

pub fn symbol(&self, label: usize) -> Option<Complex<f64>>

The symbol for a bit label.

Source

pub fn map_bits(&self, bits: &[u8]) -> Result<Vec<Complex<f64>>, ErrorsJSL>

Maps bits (each 0 or 1, MSB first within a symbol) to symbols; the bit count must be a multiple of bits_per_symbol.

Source

pub fn nearest(&self, sample: Complex<f64>) -> usize

The label of the symbol nearest to sample.

Source

pub fn slice(&self, sample: Complex<f64>) -> Complex<f64>

The symbol nearest to sample (a slicer).

Source

pub fn demap_hard(&self, samples: &[Complex<f64>]) -> Vec<u8> ⓘ

Hard-decision demapping to bits (MSB first).

Source

pub fn demap_soft( &self, samples: &[Complex<f64>], noise_variance: f64, ) -> Result<Vec<f64>, ErrorsJSL>

Soft demapping: the max-log LLR ln P(bit=0)/P(bit=1) of every bit, for complex noise of total variance noise_variance per sample (E|n|²).

Trait Implementations§

Source§

impl Clone for Constellation

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Constellation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Constellation

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Constellation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.