[][src]Struct believer::generators::increasing_range_code::IRCodeGenBuilder

pub struct IRCodeGenBuilder { /* fields omitted */ }

An interface to build IncreasingRangeCodeGenerator.

All parameters are optional except the number of bits and checks. It is possible to set the maximal degrees of both bits and checks, the initial range (the first half of the checks must fit in a box of length initial_range, the next quarter in a box of length 2 * initial_range and so on) and the minimal girth.

Example

// Build a code generator by setting all parameters.

let n_bits = 16;
let n_checks = 12;
let code_generator = IRCodeGenBuilder::new(n_bits, n_checks)
    .with_max_bit_degree(5)
    .with_max_check_degree(5)
    .with_initial_range(10)
    .with_minimal_girth(8)
    .build();

// Build a code generator by setting the size and the degrees. This is equivalent to an
// standard LDPC code with no locality contraints.

let bit_deg = 3;
let check_deg = 4;
let code_generator = IRCodeGenBuilder::new(n_bits, n_checks)
    .with_max_degrees(bit_deg, check_deg)
    .build();

// It is possible to reuse a builder.

let mut builder = IRCodeGenBuilder::new(n_bits, n_checks);
let generator_a = builder.build();

// Set the maximal degrees.
builder.with_max_degrees(bit_deg, check_deg);
let generator_b = builder.build();

// Set the other parameters. The maximal degrees are still the same.
builder.with_initial_range(10).with_minimal_girth(8);
let generator_c = builder.build();

// Change the maximal bit degree.
builder.with_max_bit_degree(5);
let generator_d = builder.build();

Methods

impl IRCodeGenBuilder[src]

pub fn build(&self) -> IncreasingRangeCodeGenerator[src]

Builds an IncreasingRangeCodeGenerator from the given parameters.

pub fn new(n_bits: usize, n_checks: usize) -> Self[src]

Creates an IRCodeGenBuilder that will build IncreasingRangeCodeGenerator over n_bits and n_checks.

pub fn with_max_bit_degree(&mut self, max_bit_degree: usize) -> &mut Self[src]

Fixes the max_bit_degree of the code generator.

If not fixed, there will be no restriction on the degree of the bits.

pub fn with_max_check_degree(&mut self, max_check_degree: usize) -> &mut Self[src]

Fixes the max_check_degree of the code generator.

If not fixed, there will be no restriction on the degree of the checks.

pub fn with_max_degrees(
    &mut self,
    max_bit_degree: usize,
    max_check_degree: usize
) -> &mut Self
[src]

Fixes the max_bit_degree and the max_check_degree of the code generator.

If not fixed, there will be no restriction on the degree of the bits and the checks.

pub fn with_initial_range(&mut self, initial_range: usize) -> &mut Self[src]

Fixes the initial_range of the code generator.

If not fixed, it will be set to the maximal check degree.

pub fn with_minimal_girth(&mut self, minimal_girth: usize) -> &mut Self[src]

Fixes the minimal_girth of the code generator.

If not fixed, there will be no restriction on the minimal girth.

Auto Trait Implementations

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