diff options
Diffstat (limited to 'gr-trellis/src/lib/trellis_siso_f.cc')
-rw-r--r-- | gr-trellis/src/lib/trellis_siso_f.cc | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/gr-trellis/src/lib/trellis_siso_f.cc b/gr-trellis/src/lib/trellis_siso_f.cc index d478c13a3..ffebf1928 100644 --- a/gr-trellis/src/lib/trellis_siso_f.cc +++ b/gr-trellis/src/lib/trellis_siso_f.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2004,2010 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, @@ -29,10 +29,10 @@ #include <stdexcept> #include <assert.h> #include <iostream> - + static const float INF = 1.0e9; -trellis_siso_f_sptr +trellis_siso_f_sptr trellis_make_siso_f ( const fsm &FSM, int K, @@ -55,7 +55,7 @@ trellis_siso_f::trellis_siso_f ( trellis_siso_type_t SISO_TYPE) : gr_block ("siso_f", gr_make_io_signature (1, -1, sizeof (float)), - gr_make_io_signature (1, -1, sizeof (float))), + gr_make_io_signature (1, -1, sizeof (float))), d_FSM (FSM), d_K (K), d_S0 (S0), @@ -67,7 +67,7 @@ trellis_siso_f::trellis_siso_f ( //d_beta(FSM.S()*(K+1)) { int multiple; - if (d_POSTI && d_POSTO) + if (d_POSTI && d_POSTO) multiple = d_FSM.I()+d_FSM.O(); else if(d_POSTI) multiple = d_FSM.I(); @@ -79,14 +79,14 @@ trellis_siso_f::trellis_siso_f ( set_output_multiple (d_K*multiple); //what is the meaning of relative rate for a block with 2 inputs? //set_relative_rate ( multiple / ((double) d_FSM.I()) ); - // it turns out that the above gives problems in the scheduler, so + // it turns out that the above gives problems in the scheduler, so // let's try (assumption O>I) //set_relative_rate ( multiple / ((double) d_FSM.O()) ); // I am tempted to automate like this if(d_FSM.I() <= d_FSM.O()) set_relative_rate ( multiple / ((double) d_FSM.O()) ); else - set_relative_rate ( multiple / ((double) d_FSM.I()) ); + set_relative_rate ( multiple / ((double) d_FSM.I()) ); } @@ -102,7 +102,7 @@ trellis_siso_f::forecast (int noutput_items, gr_vector_int &ninput_items_require multiple = d_FSM.O(); else throw std::runtime_error ("Not both POSTI and POSTO can be false."); - //printf("forecast: Multiple = %d\n",multiple); + //printf("forecast: Multiple = %d\n",multiple); assert (noutput_items % (d_K*multiple) == 0); int input_required1 = d_FSM.I() * (noutput_items/multiple) ; int input_required2 = d_FSM.O() * (noutput_items/multiple) ; @@ -131,7 +131,7 @@ inline float min_star(float a, float b) return (a <= b ? a : b)-log(1+exp(a <= b ? a-b : b-a)); } -void siso_algorithm(int I, int S, int O, +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, @@ -143,7 +143,7 @@ void siso_algorithm(int I, int S, int O, const float *priori, const float *prioro, float *post//, //std::vector<float> &alpha, //std::vector<float> &beta - ) + ) { float norm,mm,minm; std::vector<float> alpha(S*(K+1)); @@ -170,7 +170,7 @@ void siso_algorithm(int I, int S, int O, alpha[(k+1)*S+j]=minm; if(minm<norm) norm=minm; } - for(int j=0;j<S;j++) + for(int j=0;j<S;j++) alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode } @@ -184,7 +184,7 @@ void siso_algorithm(int I, int S, int O, for(int k=K-1;k>=0;k--) { // backward recursion norm=INF; - for(int j=0;j<S;j++) { + for(int j=0;j<S;j++) { minm=INF; for(int i=0;i<I;i++) { int i0 = j*I+i; @@ -233,8 +233,8 @@ if (POSTI && POSTO) for(int n=0;n<O;n++) post[k*(I+O)+I+n]-=norm; // normalize metrics } -} -else if(POSTI) +} +else if(POSTI) { for(int k=0;k<K;k++) { // input combining norm=INF; @@ -288,7 +288,7 @@ trellis_siso_f::general_work (int noutput_items, { assert (input_items.size() == 2*output_items.size()); int nstreams = output_items.size(); - //printf("general_work:Streams: %d\n",nstreams); + //printf("general_work:Streams: %d\n",nstreams); int multiple; if (d_POSTI && d_POSTO) multiple = d_FSM.I()+d_FSM.O(); @@ -301,11 +301,11 @@ trellis_siso_f::general_work (int noutput_items, assert (noutput_items % (d_K*multiple) == 0); int nblocks = noutput_items / (d_K*multiple); - //printf("general_work:Blocks: %d\n",nblocks); + //printf("general_work:Blocks: %d\n",nblocks); //for(int i=0;i<ninput_items.size();i++) //printf("general_work:Input items available: %d\n",ninput_items[i]); - float (*p2min)(float, float) = NULL; + float (*p2min)(float, float) = NULL; if(d_SISO_TYPE == TRELLIS_MIN_SUM) p2min = &min; else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT) |