![]() |
rssoft
0.0.0
Reed-Solomon codes library with soft decision decoding
|
#include <FinalEvaluation.h>

Public Member Functions | |
| FinalEvaluation (const gf::GFq &_gf, unsigned int _k, const EvaluationValues &_evaluation_values) | |
| ~FinalEvaluation () | |
| void | run (const std::vector< gf::GFq_Polynomial > &polynomials, const ReliabilityMatrix &relmat) |
| const std::vector < gf::GFq_Symbol > & | get_best_codeword () const |
| const std::vector < ProbabilityCodeword > & | get_codewords () const |
| const std::vector < gf::GFq_Symbol > & | get_best_message () const |
| const std::vector < ProbabilityCodeword > & | get_messages () const |
| void | print_codewords (std::ostream &os, const std::vector< ProbabilityCodeword > &words) const |
Protected Attributes | |
| const gf::GFq & | gf |
| Galois Field in use. | |
| unsigned int | k |
| k as in RS(n,k) | |
| const EvaluationValues & | evaluation_values |
| Evaluation X,Y values used for coding. | |
| std::map< gf::GFq_Element, unsigned int > | symbol_index |
| Symbol index in reliability matrix row order. | |
| std::vector< ProbabilityCodeword > | codewords |
| The codewords (overriden at each run) | |
| std::vector< ProbabilityCodeword > | messages |
| The encoded messages (overriden at each run) | |
| rssoft::FinalEvaluation::FinalEvaluation | ( | const gf::GFq & | _gf, |
| unsigned int | _k, | ||
| const EvaluationValues & | _evaluation_values | ||
| ) |
Constructor
| _gf | Galois Field in use |
| _k | k as in RS(n,k) |
| _evaluation_values | Evaluation X,Y values used for coding |
:
gf(_gf),
k(_k),
evaluation_values(_evaluation_values)
{
std::vector<gf::GFq_Element>::const_iterator s_it = evaluation_values.get_symbols().begin();
unsigned int i_s = 0;
for (; s_it != evaluation_values.get_symbols().end(); ++s_it, i_s++)
{
symbol_index.insert(std::make_pair(*s_it, i_s));
}
}

Destructor. Nothing special
{}
| const std::vector<gf::GFq_Symbol>& rssoft::FinalEvaluation::get_best_codeword | ( | ) | const [inline] |
Get the best probability scoring codeword
{
return codewords.begin()->get_codeword();
}
| const std::vector<gf::GFq_Symbol>& rssoft::FinalEvaluation::get_best_message | ( | ) | const [inline] |
Get the best probability scoring message
{
return messages.begin()->get_codeword();
}
| const std::vector<ProbabilityCodeword>& rssoft::FinalEvaluation::get_codewords | ( | ) | const [inline] |
Get all codewords with their probability score
{
return codewords;
}
| const std::vector<ProbabilityCodeword>& rssoft::FinalEvaluation::get_messages | ( | ) | const [inline] |
Get all messages with their probability score
{
return messages;
}
| void rssoft::FinalEvaluation::print_codewords | ( | std::ostream & | os, |
| const std::vector< ProbabilityCodeword > & | words | ||
| ) | const |
Print a codeword or message word to an output stream
{
std::vector<ProbabilityCodeword>::const_iterator w_it = words.begin();
unsigned int i_w = 0;
for (; w_it != words.end(); ++w_it, i_w++)
{
std::streamsize prec = os.precision();
os << "#" << i_w << ": (" << std::setprecision(3) << w_it->get_probability_score() << " dB/symbol) ";
os.precision(prec);
w_it->print_codeword(os);
os << std::endl;
}
}
| void rssoft::FinalEvaluation::run | ( | const std::vector< gf::GFq_Polynomial > & | polynomials, |
| const ReliabilityMatrix & | relmat | ||
| ) |
Runs one evaluation for the given polynomials
{
if (polynomials.size() == 0)
{
throw RSSoft_Exception("Cannot evaluate empty list of polynomials");
}
else if (relmat.get_nb_symbols() != gf.size()+1)
{
throw RSSoft_Exception("Reliability matrix number of rows is incompatible with GF size");
}
else if (relmat.get_message_length()!= evaluation_values.get_evaluation_points().size())
{
throw RSSoft_Exception("Reliability matrix number of columns is incompatible with the number of evaluation points");
}
else
{
std::vector<gf::GFq_Polynomial>::const_iterator poly_it = polynomials.begin();
static const ProbabilityCodeword tmp_pc;
for (; poly_it != polynomials.end(); ++poly_it)
{
codewords.push_back(tmp_pc);
messages.push_back(tmp_pc);
float proba_score = 0.0; // We will use log scale in dB/symbol
unsigned int proba_count = 0; // number of individual symbol probabilities considered
std::vector<gf::GFq_Element>::const_iterator evalpt_it = evaluation_values.get_evaluation_points().begin();
unsigned int i_pt = 0;
for (; evalpt_it != evaluation_values.get_evaluation_points().end(); ++evalpt_it, i_pt++)
{
gf::GFq_Element eval = (*poly_it)(*evalpt_it); // Evaluate polynomial at current point
codewords.back().get_codeword().push_back(eval.poly()); // Store the corresponding symbol in the codeword
unsigned int& i_s = symbol_index.at(eval); // Retrieve symbol index in reliability matrix row order
float p_ij = relmat(i_s, i_pt);
if (p_ij != 0.0) // symbol was not erased
{
proba_score += 10.0 * log10(p_ij); // Accumulate probability (dB)
proba_count++;
}
}
// Probability score in dB is divided by the number of evaluation points used. This is an attempt to get a common metric among codes of different lengths
codewords.back().get_probability_score() = proba_score/proba_count; // Store the probability score in the probability score weighted codeword
messages.back().get_probability_score() = proba_score/proba_count; // Store the message with probability score.
poly_it->get_poly_symbols(messages.back().get_codeword(), k); // Message is polynomial's coefficients
}
}
// Sort codewords and messages vectors according to decreasing codewords probability score
std::sort(codewords.begin(), codewords.end(), std::greater<ProbabilityCodeword>());
std::sort(messages.begin(), messages.end(), std::greater<ProbabilityCodeword>());
}

std::vector<ProbabilityCodeword> rssoft::FinalEvaluation::codewords [protected] |
The codewords (overriden at each run)
const EvaluationValues& rssoft::FinalEvaluation::evaluation_values [protected] |
Evaluation X,Y values used for coding.
const gf::GFq& rssoft::FinalEvaluation::gf [protected] |
Galois Field in use.
unsigned int rssoft::FinalEvaluation::k [protected] |
k as in RS(n,k)
std::vector<ProbabilityCodeword> rssoft::FinalEvaluation::messages [protected] |
The encoded messages (overriden at each run)
std::map<gf::GFq_Element, unsigned int> rssoft::FinalEvaluation::symbol_index [protected] |
Symbol index in reliability matrix row order.