rssoft  0.0.0
Reed-Solomon codes library with soft decision decoding
rssoft::MultiplicityMatrix Class Reference

Multiplicity matrix corresponding to a reliability matrix. It is implemented as a map representing a sparse matrix where elements are indexed by their (row, column) numbers pair. Once constructed it is normally only used to be traversed column first during the Interpolation algorithm. The ordering of indexes reflects the column first order. More...

#include <MultiplicityMatrix.h>

List of all members.

Classes

class  traversing_iterator

Public Member Functions

 MultiplicityMatrix (const ReliabilityMatrix &relmat, unsigned int multiplicity, bool soft_decision=true)
 MultiplicityMatrix (const ReliabilityMatrix &relmat, float lambda)
 ~MultiplicityMatrix ()
unsigned int cost () const
unsigned int get_nb_symbols_log2 () const
unsigned int get_nb_symbols () const
unsigned int get_message_length () const
unsigned int operator() (unsigned int i_row, unsigned int i_col) const

Protected Types

typedef std::map< std::pair
< unsigned int, unsigned int >
, unsigned int,
MultiplicityMatrix_SparseOrdering >
::const_iterator 
const_iterator
typedef std::map< std::pair
< unsigned int, unsigned int >
, unsigned int,
MultiplicityMatrix_SparseOrdering >
::iterator 
iterator

Protected Member Functions

iterator operator() (unsigned int i_row, unsigned int i_col)

Protected Attributes

unsigned int _nb_symbols_log2
 log2 of the number of symbols in the alphabet
unsigned int _nb_symbols
 number of symbols in the alphabet
unsigned int _message_length
 message or block length
unsigned int _cost
 Multiplicity matrix cost.

Friends

std::ostream & operator<< (std::ostream &os, const MultiplicityMatrix &matrix)

Detailed Description

Multiplicity matrix corresponding to a reliability matrix. It is implemented as a map representing a sparse matrix where elements are indexed by their (row, column) numbers pair. Once constructed it is normally only used to be traversed column first during the Interpolation algorithm. The ordering of indexes reflects the column first order.


Member Typedef Documentation

typedef std::map<std::pair<unsigned int, unsigned int>, unsigned int, MultiplicityMatrix_SparseOrdering>::const_iterator rssoft::MultiplicityMatrix::const_iterator [protected]

Multiplicity matrix const iterator. The multiplicity matrix is a map of multiplicities (unsigned int) indexed by (row, column) pair Thus if it is an iterator of MultiplicityMatrix::const_iterator type:

  • it->first.first is the row index or symbol in the alphabet
  • it->first.second is the column index or symbol index in the message and point of evaluation in GFq
  • it->second is the multiplicity value
typedef std::map<std::pair<unsigned int, unsigned int>, unsigned int, MultiplicityMatrix_SparseOrdering>::iterator rssoft::MultiplicityMatrix::iterator [protected]

Multiplicity matrix iterator. The multiplicity matrix is a map of multiplicities (unsigned int) indexed by (row, column) pair Thus if it is an iterator of MultiplicityMatrix::const_iterator type:

  • it->first.first is the row index or symbol in the alphabet
  • it->first.second is the column index or symbol index in the message and point of evaluation in GFq
  • it->second is the multiplicity value

Constructor & Destructor Documentation

rssoft::MultiplicityMatrix::MultiplicityMatrix ( const ReliabilityMatrix relmat,
unsigned int  multiplicity,
bool  soft_decision = true 
)

Constructs a new multiplicity matrix. Uses long construction algorithm for soft decision.

Parameters:
relmatReliability matrix to build the multiplicity matrix from
multiplicityFor soft decision: target global multiplicity of interpolation points. For hard decision: multiplicity at each point
soft_decisionTrue to build the matrix for soft decision decoding (default) else to build the matrix for hard decision list decoding with specified multiplicity at each point
                                                                                                                     :
    _nb_symbols_log2(relmat.get_nb_symbols_log2()),
    _nb_symbols(relmat.get_nb_symbols()),
    _message_length(relmat.get_message_length()),
    _cost(0)
{
    if (soft_decision)
    {
        ReliabilityMatrix w_relmat(relmat);
        unsigned int star_row, star_col;
        
        for (unsigned int s = multiplicity; s > 0; s--)
        {
            float p_star = w_relmat.find_max(star_row, star_col);
            iterator m_it = (*this)(star_row, star_col);
            
            if (m_it == end())
            {
                w_relmat(star_row, star_col) = p_star / 2;
                insert(std::make_pair(std::make_pair(star_row, star_col), 1));
                _cost += 1;
            }
            else
            {
                w_relmat(star_row, star_col) = p_star / (m_it->second+2);
                m_it->second += 1;
                _cost += m_it->second;
            }
        }
    }
    else // build for hard decision
    {
        for (unsigned int ic = 0; ic < _message_length; ic++)
        {
            float max_p = 0.0;
            unsigned int max_ir = 0;
            
            for (unsigned int ir = 0; ir < _nb_symbols; ir++)
            {
                if (relmat(ir, ic) > max_p)
                {
                    max_p = relmat(ir, ic);
                    max_ir = ir;
                }
            }
            
            insert(std::make_pair(std::make_pair(max_ir, ic), multiplicity));
        }
    }
}

Here is the call graph for this function:

rssoft::MultiplicityMatrix::MultiplicityMatrix ( const ReliabilityMatrix relmat,
float  lambda 
)

Constructs a new multiplicity matrix. Uses short construction algorithm.

Parameters:
relmatReliability matrix to build the multiplicity matrix from
lambdaMultiplicative constant
                                                                                    :
    _nb_symbols_log2(relmat.get_nb_symbols_log2()),
    _nb_symbols(relmat.get_nb_symbols()),
    _message_length(relmat.get_message_length()),
    _cost(0)
 {
    for (unsigned int ic = 0; ic < _message_length; ic++)
    {
        for (unsigned int ir = 0; ir < _nb_symbols; ir++)
        {
            float p = floor(relmat(ir, ic) * lambda);
            
            if (p > 0.0)
            {
                unsigned int p_int = (unsigned int)(p);
                
                if (p_int > 0)
                {
                    insert(std::make_pair(std::make_pair(ir, ic), p_int));
                }
                
                _cost += p_int * (p_int + 1);
            }
        }
    }
    
    _cost /= 2;
 }

Member Function Documentation

unsigned int rssoft::MultiplicityMatrix::cost ( ) const [inline]

Get multiplicity matrix cost

Returns:
Multiplicity matrix cost
    {
        return _cost;
    }
unsigned int rssoft::MultiplicityMatrix::get_message_length ( ) const [inline]

Get the number of message symbols (i.e. columns)

        {
                return _message_length;
        }
unsigned int rssoft::MultiplicityMatrix::get_nb_symbols ( ) const [inline]

Get the number of symbols (i.e. rows)

        {
                return _nb_symbols;
        }
unsigned int rssoft::MultiplicityMatrix::get_nb_symbols_log2 ( ) const [inline]

Get the log2 of the number of symbols (i.e. rows)

        {
                return _nb_symbols_log2;
        }
unsigned int rssoft::MultiplicityMatrix::operator() ( unsigned int  i_row,
unsigned int  i_col 
) const

Operator to get value at row i column j.

{
    MultiplicityMatrix::const_iterator elt_it = this->find(std::make_pair(iX,iY));

    if (elt_it == end())
    {
        return 0;
    }
    else
    {
        return elt_it->second;
    }
}
iterator rssoft::MultiplicityMatrix::operator() ( unsigned int  i_row,
unsigned int  i_col 
) [inline, protected]

Operator to get iterator at row i column j. Read-write version.

    {
        return find(std::make_pair(i_row, i_col));
    }

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const MultiplicityMatrix matrix 
) [friend]

Prints a multiplicity matrix to an output stream

{
        unsigned int nb_rows = matrix.get_nb_symbols();
        unsigned int nb_cols = matrix.get_message_length();

        for (unsigned int ir=0; ir<nb_rows; ir++)
        {
                for (unsigned int ic=0; ic<nb_cols; ic++)
                {
                        if (ic > 0)
                        {
                                os << " ";
                        }
            
            MultiplicityMatrix::const_iterator elt_it = matrix.find(std::make_pair(ir,ic));
            
            if (elt_it == matrix.end())
            {
                os << std::setw(3) << 0;
            }
            else
            {
                os << std::setw(3) << elt_it->second;
            }
                }

                os << std::endl;
        }
    
    return os;
}

Member Data Documentation

unsigned int rssoft::MultiplicityMatrix::_cost [protected]

Multiplicity matrix cost.

message or block length

unsigned int rssoft::MultiplicityMatrix::_nb_symbols [protected]

number of symbols in the alphabet

log2 of the number of symbols in the alphabet


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines