Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

mapalgorithm.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           mapalgorithm.h  -  description
00003                              -------------------
00004     begin                : Die Aug 5 2003
00005     copyright            : (C) 2003 by Tobias Niemitz
00006     email                : tobias.niemitz@tu-harburg.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef MAPALGORITHM_H
00019 #define MAPALGORITHM_H
00020 
00021 
00022 #include "trellissoftout.h"
00023 
00024 
00025 namespace simthlib {
00026 
00054 class LogMapAlgorithmAbstract : public TrellisSoftoutAlgorithm
00055 {
00056   
00057   public:
00058 
00059         LogMapAlgorithmAbstract(std::auto_ptr<Trellis> usedTrellis);
00060         
00061         virtual ~LogMapAlgorithmAbstract();
00062 
00063         virtual void softout4Output(const simth::LlvSeq &metr, simth::LlrSeq *softout, const simth::LlrSeq *apri);
00064 
00065         virtual void softout4Input(const simth::LlvSeq &metr, simth::LlrSeq* softout, const simth::LlrSeq* apri);
00066 
00067         virtual void decode(const simth::LlvSeq &metr, simth::BitSeq* decodedData, const simth::LlrSeq* apri);
00068 
00069  
00070   protected:
00071 
00073         double sigma();
00074 
00077         void forwardrecursion(const simth::LlvSeq &channelMetr, const simth::LlrSeq* apri=NULL);
00078 
00081         std::vector<double> backwardrecursion(const int endState =0);
00082 
00084         void initialize_alpha( );
00085 
00087         void initialize_beta( );
00088 
00089         /* Initializes the last ms probabilities of the vector beta. The endState (default 0) as a
00090         secure event, the other as an impossible event. */
00091         //virtual std::vector<double> initialize_beta( );
00092 
00095         void set_gammas(simth::LlvSeq& metr, simth::LlrSeq* apri);
00096 
00099         virtual void set_alpha(const int index) = 0;
00100 
00101 
00104         virtual double set_beta(const int index) = 0;
00105 
00106 
00107     //the following is old and has to be replaced by new versions (ph 21.03.2003):
00108 
00111         virtual void calculate_llr(simth::LlrSeq *softout) = 0;
00112 
00113 
00116         virtual double calculate_gamma(double metricValue,int index,const simth::LlrSeq* apri) = 0;
00117 
00118 
00122         virtual double calculate_beta(const std::vector<double> *beta, const std::vector<double> *gamma,
00123                                     const int t, const int l, const int ms) = 0;
00124 
00125 
00126 
00127 
00128  protected:
00129 
00130     // alpha is a two-dimensional (ms,tau)-matrix
00131         simth::Array2d<double> alpha;           
00132         simth::Array2d<double> beta;
00133         simth::Array2d<double> gamma;
00134 
00135 
00136   private:
00137 
00138         void invariante() const;
00139 
00140 
00141 
00142        // sigma is the mean noise value
00143         double sigma_;
00144 
00145 };
00146 
00147 inline double LogMapAlgorithmAbstract::sigma()
00148 {
00149   return sigma_;
00150 }
00151 
00152 inline void LogMapAlgorithmAbstract::invariante() const
00153 {
00154   if(DEBUG){
00155   }
00156 }
00157 
00158 
00169 class MaxLogMap : public LogMapAlgorithmAbstract
00170 {
00171   private:
00172 
00173         void invariante() const;
00174 
00175   protected:
00176 
00179         virtual void set_alpha(const int index) = 0;
00180 
00181 
00182     //        double calculate_alpha(const std::vector<double> *alpha, const std::vector<double> *gamma,
00183         //                            const int t, const int l, const int ms);
00184 
00185 //double calculate_beta(const std::vector<double> *beta, const std::vector<double> *gamma,
00186 //                                    const int t, const int l, const int ms);
00187 
00188 //      double calculate_gamma(const int t, const int l1, const int l2, const double aprillr,
00189 //                                        double dist);
00190 
00191 //        void calculate_llr(simth::LlrSeq &softout, const std::vector<double> *alpha,
00192 //                                        const std::vector<double> *beta, const std::vector<double> *gamma,
00193 //                                        const int ms, const int tau);
00194 
00195   public:
00196 
00197         MaxLogMap(std::auto_ptr<Trellis> usedTrellis);
00198 
00199         virtual ~MaxLogMap();
00200 
00201 //        virtual void reducedSoftout4Output(const simth::LlvSeq &metr, simth::LlrSeq* softout, const simth::LlrSeq* apri,
00202 //                                      int startState, int endState);
00203 
00204 };
00205 
00206 inline void MaxLogMap::invariante() const
00207 {
00208   if(DEBUG){
00209   }
00210 }
00211 
00212 
00219 class MaxLogMapReduced : public MaxLogMap
00220 {
00221   private:
00222 
00223         void invariante() const;
00224         
00225   public:
00226 
00227     MaxLogMapReduced(std::auto_ptr<Trellis> usedTrellis);
00228 
00229     virtual ~MaxLogMapReduced();
00230 
00231     void reducedSoftout4Output(const simth::LlvSeq &metr, simth::LlrSeq* softout, const simth::LlrSeq* apri,
00232                                       int startState, int endState);
00233 
00234 };
00235 
00236 inline void MaxLogMapReduced::invariante() const
00237 {
00238   if(DEBUG){
00239   }
00240 }
00241 
00242 
00256 /* class LogMap : public LogMapAlgorithmAbstract */
00257 /* { */
00258 /*   private: */
00259 
00260 /*         void invariante() const; */
00261 
00262 /*   protected: */
00263 
00264 /*         double calculate_alpha(const std::vector<double> *alpha, const std::vector<double> *gamma, */
00265 /*                                     const int t, const int l, const int ms); */
00266 
00267 /*         double calculate_beta(const std::vector<double> *beta, const std::vector<double> *gamma, */
00268 /*                                     const int t, const int l, const int ms); */
00269 
00270 /*         double calculate_gamma(const int t, const int l1, const int l2, const double aprillr, */
00271 /*                                         double dist); */
00272 
00273 /*         void calculate_llr(simth::LlrSeq &softout, const std::vector<double> *alpha, */
00274 /*                                         const std::vector<double> *beta, const std::vector<double> *gamma, */
00275 /*                                         const int ms, const int tau); */
00276 
00277 /*   public: */
00278 
00279 /*         LogMap(std::auto_ptr<Trellis> usedTrellis); */
00280 
00281 /*         virtual ~LogMap(); */
00282 
00283 /*         virtual void reducedSoftout4Output(const simth::LlvSeq &metr, simth::LlrSeq* softout, const simth::LlrSeq* apri, */
00284 /*                                       int startState, int endState); */
00285 /* }; */
00286 
00287 /* inline void LogMap::invariante() const */
00288 /* { */
00289 /*   if(DEBUG){ */
00290 /*   } */
00291 /* } */
00292 
00293 /* class LogMapReduced : public LogMap */
00294 /* { */
00295 /*   private: */
00296 
00297 /*         void invariante() const; */
00298 
00299 /*   public: */
00300 
00301 /*     LogMapReduced(std::auto_ptr<Trellis> usedTrellis); */
00302 
00303 /*     virtual ~LogMapReduced(); */
00304 
00305 /*     void reducedSoftout4Output(const simth::LlvSeq &metr, simth::LlrSeq* softout, const simth::LlrSeq* apri, */
00306 /*                                       int startState, int endState); */
00307 
00308 /* }; */
00309 
00310 /* inline void LogMapReduced::invariante() const */
00311 /* { */
00312 /*   if(DEBUG){ */
00313 /*   } */
00314 /* } */
00315 /* } */
00316 
00317 }
00318 
00319 #endif

Generated on Tue Aug 9 14:35:11 2005 for simtheticlib by  doxygen 1.4.1