Skip to main content

ResourceGrid

Struct ResourceGrid 

Source
pub struct ResourceGrid {
    pub n_subcarriers: usize,
    pub n_symbols: usize,
    pub pattern: PilotPattern,
    pub seed: u64,
}
Expand description

A grid of n_subcarriers × n_symbols resource elements with pilots.

Fields§

§n_subcarriers: usize

Subcarriers $K$ (the active subcarriers of the OFDM modulator).

§n_symbols: usize

OFDM symbols $L$ per grid.

§pattern: PilotPattern

The pilot pattern.

§seed: u64

Seed of the pilot symbols.

Implementations§

Source§

impl ResourceGrid

Source

pub fn check(&self) -> Result<()>

Validate the grid.

§Errors

Error::Config for an empty grid, a pilot period or spacing of zero, or a pilot table of another size than the grid.

§Examples
use comnum_waveform::ofdm::grid::{PilotPattern, ResourceGrid};
let g = ResourceGrid { n_subcarriers: 12, n_symbols: 7, pattern: PilotPattern::Comb { spacing: 0 }, seed: 1 };
assert!(g.check().is_err() && g.map(&[]).is_err());
Source

pub fn from_table(table: PilotTable) -> ResourceGrid

The grid of a pilot table, of its size.

Source

pub fn is_pilot(&self, k: usize, l: usize) -> bool

Whether RE $(k, l)$ carries a pilot (a spacing of zero, which ResourceGrid::check refuses, is read as one).

Source

pub fn port_pilots(&self, l: usize, port: usize, n_ports: usize) -> Vec<usize>

The pilot subcarriers of symbol l that belong to port port out of n_ports: the pilots of a symbol are dealt to the ports in turn (frequency-division orthogonal pilots; the other ports are silent there).

Source

pub fn map_port( &self, data: &[C64], port: usize, n_ports: usize, ) -> Result<Vec<C64>>

The grid of port port out of n_ports: ResourceGrid::map with the pilots of the other ports set to zero.

§Errors

As ResourceGrid::map.

Source

pub fn pilot(&self, k: usize, l: usize) -> C64

The pilot symbol of RE $(k, l)$: the value of the table of an explicit pattern, unit-energy QPSK drawn from the seed otherwise.

Source

pub fn pilot_positions(&self) -> Vec<(usize, usize)>

The pilot REs $(k, l)$, symbol after symbol.

Source

pub fn data_indices(&self) -> Vec<usize>

The indices $l K + k$ of the data REs, symbol after symbol: the order in which ResourceGrid::map places the data and ResourceGrid::extract takes them.

§Examples
use comnum_waveform::ofdm::grid::{PilotPattern, ResourceGrid};
let g = ResourceGrid { n_subcarriers: 4, n_symbols: 2, pattern: PilotPattern::Comb { spacing: 2 }, seed: 0 };
assert_eq!(g.data_indices(), vec![1, 3, 5, 7]);
Source

pub fn pilot_symbols(&self) -> Vec<usize>

The symbols that carry at least one pilot.

Source

pub fn n_data(&self) -> usize

Number of data REs per grid (counted, nothing allocated).

Source

pub fn map(&self, data: &[C64]) -> Result<Vec<C64>>

Place data (exactly ResourceGrid::n_data symbols) and the pilots: the grid, symbol after symbol.

§Errors

The errors of ResourceGrid::check; Error::Shape for another number of data symbols.

Source

pub fn extract<T: Copy>(&self, grid: &[T]) -> Result<Vec<T>>

The data REs of a grid, in the order of ResourceGrid::map.

§Errors

Error::Shape unless grid holds the $K L$ REs of the grid.

Trait Implementations§

Source§

impl Clone for ResourceGrid

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 ResourceGrid

Source§

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

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

impl PartialEq for ResourceGrid

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 ResourceGrid

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.