pub trait DecoderArithmetic: Debug + Send {
type Llr: Debug + Copy + Default + Send;
type CheckMessage: Debug + Copy + Default + Send;
type VarMessage: Debug + Copy + Default + Send;
type VarLlr: Debug + Copy + Default + Send;
// Required methods
fn input_llr_quantize(&self, llr: f64) -> Self::Llr;
fn llr_hard_decision(&self, llr: Self::Llr) -> bool;
fn llr_to_var_message(&self, llr: Self::Llr) -> Self::VarMessage;
fn llr_to_var_llr(&self, llr: Self::Llr) -> Self::VarLlr;
fn var_llr_to_llr(&self, var_llr: Self::VarLlr) -> Self::Llr;
fn send_check_messages<F>(
&mut self,
var_messages: &[Message<Self::VarMessage>],
send: F,
)
where F: FnMut(SentMessage<Self::CheckMessage>);
fn send_var_messages<F>(
&mut self,
input_llr: Self::Llr,
check_messages: &[Message<Self::CheckMessage>],
send: F,
) -> Self::Llr
where F: FnMut(SentMessage<Self::VarMessage>);
fn update_check_messages_and_vars(
&mut self,
check_messages: &mut [SentMessage<Self::CheckMessage>],
vars: &mut [Self::VarLlr],
);
}
Expand description
LDPC decoder arithmetic.
This trait models generic arithmetic rules for a belief propagation LDPC decoder. The trait defines the data types to use for LLRs and messages, and how to compute the check node and variable node messages.
The LDPC decoders are generic over objects implementing this trait.
The methods in this trait depend on &self
or &mut self
so that the
decoder arithmetic object can have an internal state implement lookup
tables, caching, etc.
Required Associated Types§
Sourcetype CheckMessage: Debug + Copy + Default + Send
type CheckMessage: Debug + Copy + Default + Send
Check node message.
Defines the type used to represent check node messages.
Required Methods§
Sourcefn input_llr_quantize(&self, llr: f64) -> Self::Llr
fn input_llr_quantize(&self, llr: f64) -> Self::Llr
Quantization function for input LLRs.
Defines how the channel LLRs (the input to the decoder) are quantized
and represented internally as a Self::Llr
.
Sourcefn llr_hard_decision(&self, llr: Self::Llr) -> bool
fn llr_hard_decision(&self, llr: Self::Llr) -> bool
Hard decision on LLRs.
Returns the hard decision bit corresponding to an LLR.
Sourcefn llr_to_var_message(&self, llr: Self::Llr) -> Self::VarMessage
fn llr_to_var_message(&self, llr: Self::Llr) -> Self::VarMessage
Transform LLR to variable message.
Defines how to transform an LLR into a variable message. This is used in the first iteration of the belief propagation algorithm, where the variable messages are simply the channel LLRs.
Sourcefn llr_to_var_llr(&self, llr: Self::Llr) -> Self::VarLlr
fn llr_to_var_llr(&self, llr: Self::Llr) -> Self::VarLlr
Transform LLR to variable LLR.
Defines how to transform an LLR into a variable node LLR.
Sourcefn var_llr_to_llr(&self, var_llr: Self::VarLlr) -> Self::Llr
fn var_llr_to_llr(&self, var_llr: Self::VarLlr) -> Self::Llr
Transform variable LLR to LLR.
Defines how to transform a variable LLR into an LLR.
Sourcefn send_check_messages<F>(
&mut self,
var_messages: &[Message<Self::VarMessage>],
send: F,
)
fn send_check_messages<F>( &mut self, var_messages: &[Message<Self::VarMessage>], send: F, )
Send check messages from a check node.
This function is called with the list of variable messages arriving to a check node, and closure that must be called to send each check message outgoing from that check node.
This function should compute the values of the check node messages and
call the send
closure for each of the variable nodes connected to the
check node being processed.
Sourcefn send_var_messages<F>(
&mut self,
input_llr: Self::Llr,
check_messages: &[Message<Self::CheckMessage>],
send: F,
) -> Self::Llr
fn send_var_messages<F>( &mut self, input_llr: Self::Llr, check_messages: &[Message<Self::CheckMessage>], send: F, ) -> Self::Llr
Send variable messages from a variable node.
This function is called with the channel LLR corresponding to a variable node, a list of check messages arriving to that variable node, and closure that must be called to send each variable message outgoing from that variable node.
This function should compute the values of the variable node messages and
call the send
closure for each of the check nodes connected to the
variable node being processed.
Additionally, the function returns the new LLR for this variable node.
Sourcefn update_check_messages_and_vars(
&mut self,
check_messages: &mut [SentMessage<Self::CheckMessage>],
vars: &mut [Self::VarLlr],
)
fn update_check_messages_and_vars( &mut self, check_messages: &mut [SentMessage<Self::CheckMessage>], vars: &mut [Self::VarLlr], )
Update check messages and variable values for a check node.
This function is used in the horizontal layered decoder. It is called with the messages sent by a check node and the list of LLRs of all the variables. The function computes and updates the new check messages and the new variable LLRs (for the variables directly connected to this check messages).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.