[][src]Struct believer::generators::best_code_finder::BestCodeFinderUsingErasure

pub struct BestCodeFinderUsingErasure<'a, G: CodeGenerator> { /* fields omitted */ }

An interface to find the best code generated by some code generator among a given number of code.

Example

use believer::BestCodeFinderUsingErasure;
use believer::RegularLDPCCodeGenerator;
 
let generator = RegularLDPCCodeGenerator::new(3, 4, 2, 4);
let code_finder = BestCodeFinderUsingErasure::from_code_generator(&generator)
    .with_erasure_prob(0.5)
    .among_n_codes(10);
let (code, result) = code_finder.find_best_code_simulating_n_iterations(1000);

Methods

impl<'a, G: CodeGenerator> BestCodeFinderUsingErasure<'a, G>[src]

pub fn from_code_generator(code_generator: &'a G) -> Self[src]

Creates a new BestCodeFinderUsingErasure from a given code_generator.

Example

use believer::BestCodeFinderUsingErasure;
use believer::RegularLDPCCodeGenerator;
 
let generator = RegularLDPCCodeGenerator::new(3, 4, 2, 4);
let code_finder = BestCodeFinderUsingErasure::from_code_generator(&generator);

pub fn among_n_codes(self, n_codes: usize) -> Self[src]

Set the number of codes to try for self.

If not specified, default to 0.

Example

use believer::BestCodeFinderUsingErasure;
use believer::RegularLDPCCodeGenerator;
 
let generator = RegularLDPCCodeGenerator::new(3, 4, 2, 4);
let code_finder = BestCodeFinderUsingErasure
    ::from_code_generator(&generator)
    .among_n_codes(10);

pub fn with_erasure_prob(self, prob: f64) -> Self[src]

Set the erasure prob to use when simulating code performance.

If not specified, default to 0.5.

Example

use believer::BestCodeFinderUsingErasure;
use believer::RegularLDPCCodeGenerator;
 
let generator = RegularLDPCCodeGenerator::new(3, 4, 2, 4);
let code_finder = BestCodeFinderUsingErasure
    ::from_code_generator(&generator)
    .with_erasure_prob(0.2);

pub fn find_best_code_simulating_n_iterations_with_rng<R: Rng>(
    &self,
    n_iterations: usize,
    rng: &mut R
) -> (Option<ParityCheckMatrix>, SimulationResult)
[src]

Returns the best code and its performance obtained using the given random number generator rng.

To evaluate the performance of each code, n_iterations random error decoding are done.

It returns a pair of values. The first value is some code if at least one of the rate bellow 1.0. If no code obtained better failure rate, none is return. The second element is the associated performance.

Example

use believer::BestCodeFinderUsingErasure;
use believer::RegularLDPCCodeGenerator;
use rand::thread_rng;
 
let generator = RegularLDPCCodeGenerator::new(3, 4, 2, 4);
let code_finder = BestCodeFinderUsingErasure::from_code_generator(&generator)
    .with_erasure_prob(0.5)
    .among_n_codes(10);
let (code, result) = code_finder
    .find_best_code_simulating_n_iterations_with_rng(1000, &mut thread_rng());

pub fn find_best_code_simulating_n_iterations(
    &self,
    n_iterations: usize
) -> (Option<ParityCheckMatrix>, SimulationResult)
[src]

Returns the best code and its performance obtained using the thread rng.

To evaluate the performance of each code, n_iterations random error decoding are done.

It returns a pair of values. The first value is some code if at least one of the rate bellow 1.0. If not code obtained better failure rate, none is return. The second element is the associated performance.

Example

use believer::BestCodeFinderUsingErasure;
use believer::RegularLDPCCodeGenerator;
 
let generator = RegularLDPCCodeGenerator::new(3, 4, 2, 4);
let code_finder = BestCodeFinderUsingErasure::from_code_generator(&generator)
    .with_erasure_prob(0.5)
    .among_n_codes(10);
let (code, result) = code_finder
    .find_best_code_simulating_n_iterations(1000);

pub fn find_best_code_simulating_n_events_with_rng<R: Rng>(
    &self,
    n_events: usize,
    rng: &mut R
) -> (Option<ParityCheckMatrix>, SimulationResult)
[src]

Returns the best code and its performance obtained using the given random number generator rng.

To evaluate the performance of each code, the code is simulated until n_events success and n_events failures.

It returns a pair of values. The first value is some code if at least one of the rate bellow 1.0. If no code obtained better failure rate, none is return. The second element is the associated performance.

Example

use believer::BestCodeFinderUsingErasure;
use believer::RegularLDPCCodeGenerator;
use rand::thread_rng;
 
let generator = RegularLDPCCodeGenerator::new(3, 4, 2, 4);
let code_finder = BestCodeFinderUsingErasure::from_code_generator(&generator)
    .with_erasure_prob(0.5)
    .among_n_codes(10);
let (code, result) = code_finder
    .find_best_code_simulating_n_events_with_rng(25, &mut thread_rng());

pub fn find_best_code_simulating_n_events(
    &self,
    n_events: usize
) -> (Option<ParityCheckMatrix>, SimulationResult)
[src]

Returns the best code and its performance obtained using the thread rng.

To evaluate the performance of each code, the code is simulated until n_events success and n_events failures.

It returns a pair of values. The first value is some code if at least one of the rate bellow 1.0. If no code obtained better failure rate, none is return. The second element is the associated performance.

Example

use believer::BestCodeFinderUsingErasure;
use believer::RegularLDPCCodeGenerator;
 
let generator = RegularLDPCCodeGenerator::new(3, 4, 2, 4);
let code_finder = BestCodeFinderUsingErasure::from_code_generator(&generator)
    .with_erasure_prob(0.5)
    .among_n_codes(10);
let (code, result) = code_finder
    .find_best_code_simulating_n_events(25);

Auto Trait Implementations

impl<'a, G> Send for BestCodeFinderUsingErasure<'a, G>

impl<'a, G> Sync for BestCodeFinderUsingErasure<'a, G>

impl<'a, G> Unpin for BestCodeFinderUsingErasure<'a, G>

impl<'a, G> UnwindSafe for BestCodeFinderUsingErasure<'a, G> where
    G: RefUnwindSafe

impl<'a, G> RefUnwindSafe for BestCodeFinderUsingErasure<'a, G> where
    G: RefUnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,