diff options
author | Achilleas Anastasopoulos <anastas@umich.edu> | 2011-02-18 20:35:23 -0500 |
---|---|---|
committer | Achilleas Anastasopoulos <anastas@umich.edu> | 2011-02-18 20:35:23 -0500 |
commit | ea76761275b68744f05550ddab612f551baad75a (patch) | |
tree | 961d7e546a48698c79417afedfeb0bc5a5a33cb9 /gr-trellis/src/lib/core_algorithms.h | |
parent | 2ed9e3bc58dacd41dff201d8365f7bd04fc56462 (diff) |
core algorithms such as viterbi/siso were refactored
and implemented using templates.
Minor renaming of some files
Diffstat (limited to 'gr-trellis/src/lib/core_algorithms.h')
-rw-r--r-- | gr-trellis/src/lib/core_algorithms.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/gr-trellis/src/lib/core_algorithms.h b/gr-trellis/src/lib/core_algorithms.h new file mode 100644 index 0000000000..77b27b7976 --- /dev/null +++ b/gr-trellis/src/lib/core_algorithms.h @@ -0,0 +1,91 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_CORE_ALGORITHMS_H +#define INCLUDED_CORE_ALGORITHMS_H + +#include <cmath> +#include <vector> +//#include <gr_complex.h> +#include "metric_type.h" + + +inline float min(float a, float b); +inline float min_star(float a, float b); + +template <class T> +void viterbi_algorithm(int I, int S, int O, + const std::vector<int> &NS, + const std::vector<int> &OS, + const std::vector< std::vector<int> > &PS, + const std::vector< std::vector<int> > &PI, + int K, + int S0,int SK, + const float *in, T *out +); + +template <class Ti, class To> +void viterbi_algorithm_combined(int I, int S, int O, + const std::vector<int> &NS, + const std::vector<int> &OS, + const std::vector< std::vector<int> > &PS, + const std::vector< std::vector<int> > &PI, + int K, + int S0,int SK, + int D, + const std::vector<Ti> &TABLE, + trellis_metric_type_t TYPE, + const Ti *in, To *out +); + + + +void siso_algorithm(int I, int S, int O, + const std::vector<int> &NS, + const std::vector<int> &OS, + const std::vector< std::vector<int> > &PS, + const std::vector< std::vector<int> > &PI, + int K, + int S0,int SK, + bool POSTI, bool POSTO, + float (*p2mymin)(float,float), + const float *priori, const float *prioro, float *post +); + + +void siso_algorithm_combined(int I, int S, int O, + const std::vector<int> &NS, + const std::vector<int> &OS, + const std::vector< std::vector<int> > &PS, + const std::vector< std::vector<int> > &PI, + int K, + int S0,int SK, + bool POSTI, bool POSTO, + float (*p2mymin)(float,float), + int D, + const std::vector<float> &TABLE, + trellis_metric_type_t TYPE, + const float *priori, const float *observations, float *post +); + + +#endif |