Skip to main content

Prior

Enum Prior 

Source
#[non_exhaustive]
pub enum Prior { Discrete { points: Vec<C64>, probs: Vec<f64>, }, BernoulliGaussian { rho: f64, }, }
Expand description

The prior of every entry of $x$.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Discrete

Points of an alphabet and their probabilities.

Fields

§points: Vec<C64>

The points.

§probs: Vec<f64>

Their probabilities (summing to 1).

§

BernoulliGaussian

$(1 - \rho)\, \delta(x) + \rho\, \mathcal{N}(0, 1/\rho)$: sparse, of unit variance (Ma & Ping, eq. 43).

Fields

§rho: f64

The probability $\rho$ of a non-zero entry.

Implementations§

Source§

impl Prior

Source

pub fn uniform(c: &Constellation) -> Prior

Equally likely points of a constellation.

Source

pub fn with_probs(c: &Constellation, px: Option<&[f64]>) -> Result<Prior>

The points of a constellation with the probabilities px (normalised; uniform if None).

§Errors

Those of Constellation::priors.

Source

pub fn bernoulli_gaussian(rho: f64) -> Result<Prior>

The Bernoulli-Gaussian prior of sparsity rho.

§Errors

comnum_core::Error::Config unless $0 < \rho \le 1$.

Source

pub fn mean(&self) -> C64

$\mathbb{E}[X]$.

Source

pub fn variance(&self) -> f64

$\mathrm{Var}[X] = \mathbb{E}|X - \mathbb{E}X|^{2}$.

Source

pub fn denoise(&self, r: C64, tau: f64, domain: Domain) -> (C64, f64)

The posterior mean $F(r, \tau)$ and variance $G(r, \tau)$ of $x$ from $r = x + n$, $n$ of variance $\tau$ in domain (see the module).

Source

pub fn mse(&self, noise_var: f64, gamma2: f64, domain: Domain) -> (f64, f64)

The MSE function $\Psi(\sigma^{2}, \gamma^{2})$ and the variance function $\Phi(\sigma^{2}, \gamma^{2})$ of the denoiser applied with the variance $\gamma^{2}$ to $S + \sigma Z$ (see the module), by Gauss–Hermite quadrature.

Trait Implementations§

Source§

impl Clone for Prior

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 Prior

Source§

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

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

impl PartialEq for Prior

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 Prior

Auto Trait Implementations§

§

impl Freeze for Prior

§

impl RefUnwindSafe for Prior

§

impl Send for Prior

§

impl Sync for Prior

§

impl Unpin for Prior

§

impl UnsafeUnpin for Prior

§

impl UnwindSafe for Prior

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.