Skip to main content

Receiver

Struct Receiver 

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

A detector applied channel use after channel use (see the module).

Implementations§

Source§

impl Receiver

Source

pub fn new(kind: DetectorKind, c: Constellation, llr: bool) -> Result<Receiver>

The receiver of the detector kind for the alphabet c, with bit LLRs if llr.

§Errors

Error::Config when LLRs are asked from a detector without soft output, or for a detector that cannot be built (DetectorKind::detector).

Source

pub fn constellation(&self) -> &Constellation

The alphabet of every stream.

Source

pub fn layers( &self, h: &ArrayView2<'_, C64>, y: &[C64], noise_var: f64, out: &mut SoftOutput, ) -> Result<()>

Detect the layers of one channel use $y = H x + w$ and append them to out.

§Errors

The errors of the detector.

Source

pub fn detect_uses<I, H, Y>( &self, uses: I, alamouti: bool, noise_var: f64, channel: H, received: Y, out: &mut SoftOutput, ) -> Result<()>
where I: IntoIterator<Item = usize>, H: FnMut(usize) -> Result<CMat>, Y: FnMut(usize) -> Vec<C64>,

Detect the channel uses uses in turn and append them to out: use i has the channel channel(i) ($n_{r} \times n_{t}$) and the received vector received(i) ($n_{r}$); with alamouti, the pairs of consecutive uses carry the blocks of Alamouti’s code, detected with the channel of the first use of the pair (Receiver::decode_alamouti), otherwise every use carries one vector of layers (Receiver::layers).

§Errors

The errors of channel and of the detector; Error::Shape for an odd number of uses with Alamouti’s code.

§Examples
use comnum_mimo::receiver::{DetectorKind, Receiver, SoftOutput};
use comnum_mapping::constellation::Constellation;
use comnum_math::{C64, linalg::identity};
let c = Constellation::qam(4)?.normalized();
let rx = Receiver::new(DetectorKind::Zf, c.clone(), false)?;
let x: Vec<Vec<C64>> = (0..3).map(|i| vec![c.points()[i], c.points()[3 - i]]).collect();
let mut out = SoftOutput::default();
rx.detect_uses(0..3, false, 1e-3, |_| Ok(identity(2)), |i| x[i].clone(), &mut out)?;
assert!(out.symbols.iter().zip(x.concat()).all(|(a, b)| (a - b).norm() < 1e-12));
Source

pub fn decode_alamouti( &self, h: &ArrayView2<'_, C64>, y: &ArrayView2<'_, C64>, noise_var: f64, out: &mut SoftOutput, ) -> Result<()>

Decode one block of Alamouti’s code (the two channel uses are the columns of y, $n_{r} \times 2$) and append its two symbols to out.

§Errors

The errors of Ostbc::decode.

Trait Implementations§

Source§

impl Debug for Receiver

Source§

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

Formats the value using the given formatter. Read more

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> 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, 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.