[−][src]Trait believer::channel::BinaryChannel
A trait that represent a binary transmission channel. It takes an GF2
element
and (randomly) map it to an other GF2
element. It has an intrinsic likelyhood
for each output.
Example
// Create a bsc with error prob of 0.2. let bsc = channel::BinarySymmetricChannel::new(0.2); // Sample the channel by always sending 0. let received = bsc.sample_uniform(GF2::B0, 1000); let number_of_one = received.iter() .filter(|&x| x == &GF2::B1) .collect::<Vec<_>>() .len(); println!("{}", number_of_one); // Should be around 200.
Required methods
fn intrinsic_likelyhood(&self, output: GF2) -> f64
For a given output
, compute log(p(output|input = 1) / p(output|input = 0)).
Example
let bsc = channel::BinarySymmetricChannel::new(0.2); assert_eq!(bsc.intrinsic_likelyhood(GF2::B0), -2.0); assert_eq!(bsc.intrinsic_likelyhood(GF2::B1), 2.0);
fn send(&self, input: GF2) -> GF2
For a given input
, returns an output
according to some
probability distribution depending on the channel.
Provided methods
fn message_likelyhood(&self, output: &[GF2]) -> Vec<f64>
fn sample(&self, inputs: &[GF2]) -> Vec<GF2>
Returns a Vec
of outputs as long as the inputs
where each
output is sample using the send
method.
fn sample_uniform(&self, input: GF2, n_inputs: usize) -> Vec<GF2>
Returns a Vec
of outputs where the input
is send n_inputs
times.