rssoft  0.0.0
Reed-Solomon codes library with soft decision decoding
/shared/development/google_code/rssoft/library/lib/RR_Factorization.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 RSSoft. A Reed-Solomon 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  Roth-Ruckenstein factorization class for soft decision decoding
00021  Optimized recursive strategy
00022 
00023  */
00024 #ifndef __RR_FACTORIZATION_H__
00025 #define __RR_FACTORIZATION_H__
00026 
00027 #include "GFq_Polynomial.h"
00028 #include "GFq_Element.h"
00029 #include <vector>
00030 #include <set>
00031 
00032 namespace rssoft
00033 {
00034 
00035 namespace gf
00036 {
00037 class GFq;
00038 class GFq_BivariatePolynomial;
00039 }
00040 
00044 class RR_Node
00045 {
00046 public:
00054         RR_Node(RR_Node *_parent,
00055                         const gf::GFq_BivariatePolynomial& _Q,
00056             const gf::GFq_Element& _coeff,
00057                         unsigned int _id);
00058 
00062         unsigned int get_id() const
00063         {
00064                 return id;
00065         }
00066 
00070         int get_degree() const
00071         {
00072                 return degree;
00073         }
00074 
00078         const gf::GFq_BivariatePolynomial& getQ() const
00079         {
00080                 return Q;
00081         }
00082 
00086         const gf::GFq_Element& get_coeff() const
00087         {
00088                 return coeff;
00089         }
00090 
00094         void add_ry(const gf::GFq_Element& root_y)
00095         {
00096                 ry_set.insert(root_y);
00097         }
00098 
00102         bool is_in_ry_set(const gf::GFq_Element& root_y) const
00103         {
00104                 std::set<gf::GFq_Element>::const_iterator e_it = ry_set.find(root_y);
00105                 return e_it != ry_set.end();
00106         }
00107 
00108 protected:
00109         RR_Node *parent; 
00110         const gf::GFq_BivariatePolynomial& Q; 
00111     const gf::GFq_Element& coeff; // !< Coefficient on the arc towards this node
00112         unsigned int id; 
00113         int degree; 
00114         std::set<gf::GFq_Element> ry_set; 
00115 
00116 };
00117 
00121 class RR_Factorization
00122 {
00123 public:
00129         RR_Factorization(const gf::GFq& _gf, unsigned int _k);
00130 
00134         ~RR_Factorization();
00135 
00139         void init();
00140     
00144     void set_verbosity(unsigned int _verbosity)
00145     {
00146         verbosity = _verbosity;
00147     }
00148 
00154         std::vector<gf::GFq_Polynomial>& run(const gf::GFq_BivariatePolynomial& polynomial);
00155 
00156 protected:
00162         gf::GFq_Polynomial node_run(RR_Node& rr_node);
00163 
00164         const gf::GFq& gf; 
00165         unsigned int k;    
00166     unsigned int verbosity; 
00167     
00168         unsigned int t;    
00169         std::vector<gf::GFq_Polynomial> F; 
00170 };
00171 
00172 } // namespace rssoft
00173 
00174 #endif // __RR_FACTORIZATION_H__
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines