ccsoft  0.0.0
Convolutional codes library with soft decision decoding
/shared/development/google_code/rssoft/libccsoft/lib/CC_ReliabilityMatrix.h
Go to the documentation of this file.
00001 /*
00002  Copyright 2013 Edouard Griffiths <f4exb at free dot fr>
00003 
00004  This file is part of CCSoft. A Convolutional Codes Soft Decoding library
00005 
00006  This program is free software; you can redistribute it and/or modify
00007  it under the terms of the GNU General Public License as published by
00008  the Free Software Foundation; either version 2 of the License, or
00009  (at your option) any later version.
00010 
00011  This program is distributed in the hope that it will be useful,
00012  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  GNU General Public License for more details.
00015 
00016  You should have received a copy of the GNU General Public License
00017  along with this program; if not, write to the Free Software
00018  Foundation, Inc., 51 Franklin Street, Boston, MA  02110-1301  USA
00019 
00020  Reliability Matrix class. 
00021  Analog data is entered first then the normalization method is called to get the actual reliability data (probabilities).
00022 
00023  */
00024 
00025 #ifndef __CC_RELIABILITY_MATRIX_H__
00026 #define __CC_RELIABILITY_MATRIX_H__
00027 
00028 #include <iostream>
00029 
00030 namespace ccsoft
00031 {
00032 
00036 class CC_ReliabilityMatrix
00037 {
00038 public:
00044     CC_ReliabilityMatrix(unsigned int nb_symbols_log2, unsigned int message_length);
00045     
00049     CC_ReliabilityMatrix(const CC_ReliabilityMatrix& relmat);
00050 
00054     ~CC_ReliabilityMatrix();
00055 
00060     void enter_symbol_data(float *symbol_data);
00061 
00067     void enter_symbol_data(unsigned int message_symbol_index, float *symbol_data);
00068     
00072     void enter_erasure();
00073 
00077     void enter_erasure(unsigned int message_symbol_index);
00078 
00082     void normalize();
00083 
00087     void reset_message_symbol_count()
00088     {
00089         _message_symbol_count = 0;
00090     }
00091 
00095     unsigned int get_nb_symbols_log2() const
00096     {
00097         return _nb_symbols_log2;
00098     }
00099 
00103     unsigned int get_nb_symbols() const
00104     {
00105         return _nb_symbols;
00106     }
00107 
00111     unsigned int get_message_length() const
00112     {
00113         return _message_length;
00114     }
00115 
00119     float& operator()(unsigned int i_row, unsigned int i_col)
00120     {
00121         return _matrix[_nb_symbols*i_col + i_row];
00122     }
00123     
00127     const float& operator()(unsigned int i_row, unsigned int i_col) const
00128     {
00129         return _matrix[_nb_symbols*i_col + i_row];
00130     }
00131     
00135     const float *get_raw_matrix() const
00136     {
00137         return _matrix;
00138     }
00139     
00143     float *get_raw_matrix() 
00144     {
00145         return _matrix;
00146     }
00147     
00151     float find_max(unsigned int& i_row, unsigned int& i_col) const;
00152 
00159     float find_max_in_col(unsigned int& i_row, unsigned int i_col, float prev_max = 1.0) const;
00160 
00164     friend std::ostream& operator <<(std::ostream& os, const CC_ReliabilityMatrix& matrix);
00165     
00166 
00167 protected:
00168     unsigned int _nb_symbols_log2;
00169     unsigned int _nb_symbols;
00170     unsigned int _message_length;
00171     unsigned int _message_symbol_count; 
00172     float *_matrix; 
00173 };
00174 
00175 
00176 }
00177 
00178 #endif // __CC_RELIABILITY_MATRIX_H__
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines