X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=gr-trellis%2Fsrc%2Flib%2Ftrellis_siso_f.cc;h=c8fa8231dc6bfd5574cba31d0417a8b31c4bfc78;hb=eb7316ea486ab774c24cba1142a785080559e579;hp=df364fc659d1ef0086eac624ed01cc3438bad80b;hpb=d5c192f9e3cde58589845b7b51057afc45d3bc79;p=debian%2Fgnuradio diff --git a/gr-trellis/src/lib/trellis_siso_f.cc b/gr-trellis/src/lib/trellis_siso_f.cc index df364fc6..c8fa8231 100644 --- a/gr-trellis/src/lib/trellis_siso_f.cc +++ b/gr-trellis/src/lib/trellis_siso_f.cc @@ -1,12 +1,12 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * 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 2, or (at your option) + * 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, @@ -16,8 +16,8 @@ * * 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., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H @@ -42,7 +42,7 @@ trellis_make_siso_f ( bool POSTO, trellis_siso_type_t SISO_TYPE) { - return trellis_siso_f_sptr (new trellis_siso_f (FSM,K,S0,SK,POSTI,POSTO,SISO_TYPE)); + return gnuradio::get_initial_sptr(new trellis_siso_f (FSM,K,S0,SK,POSTI,POSTO,SISO_TYPE)); } trellis_siso_f::trellis_siso_f ( @@ -62,9 +62,9 @@ trellis_siso_f::trellis_siso_f ( d_SK (SK), d_POSTI (POSTI), d_POSTO (POSTO), - d_SISO_TYPE (SISO_TYPE), - d_alpha(FSM.S()*(K+1)), - d_beta(FSM.S()*(K+1)) + d_SISO_TYPE (SISO_TYPE)//, + //d_alpha(FSM.S()*(K+1)), + //d_beta(FSM.S()*(K+1)) { int multiple; if (d_POSTI && d_POSTO) @@ -77,10 +77,16 @@ trellis_siso_f::trellis_siso_f ( throw std::runtime_error ("Not both POSTI and POSTO can be false."); //printf("constructor: Multiple = %d\n",multiple); set_output_multiple (d_K*multiple); - //what is the meaning of relative rate for this? - // it was suggested to use the one furthest from 1.0 - // let's do it. - set_relative_rate ( multiple / ((double) d_FSM.I()) ); + //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 + // 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()) ); } @@ -123,17 +129,20 @@ inline float min_star(float a, float b) void siso_algorithm(int I, int S, int O, const std::vector &NS, const std::vector &OS, - const std::vector &PS, - const std::vector &PI, + const std::vector< std::vector > &PS, + const std::vector< std::vector > &PI, int K, int S0,int SK, bool POSTI, bool POSTO, float (*p2mymin)(float,float), - const float *priori, const float *prioro, float *post, - std::vector &alpha, - std::vector &beta) + const float *priori, const float *prioro, float *post//, + //std::vector &alpha, + //std::vector &beta + ) { float norm,mm,minm; + std::vector alpha(S*(K+1)); + std::vector beta(S*(K+1)); if(S0<0) { // initial state not specified @@ -148,9 +157,9 @@ void siso_algorithm(int I, int S, int O, norm=INF; for(int j=0;j