/* -*- 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,
*
* 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
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 (
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)
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()) );
}
void siso_algorithm(int I, int S, int O,
const std::vector<int> &NS,
const std::vector<int> &OS,
- const std::vector<int> &PS,
- const std::vector<int> &PI,
+ 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,
- std::vector<float> &alpha,
- std::vector<float> &beta)
+ 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));
+ std::vector<float> beta(S*(K+1));
if(S0<0) { // initial state not specified
norm=INF;
for(int j=0;j<S;j++) {
minm=INF;
- for(int i=0;i<I;i++) {
- int i0 = j*I+i;
- mm=alpha[k*S+PS[i0]]+priori[k*I+PI[i0]]+prioro[k*O+OS[PS[i0]*I+PI[i0]]];
+ for(unsigned int i=0;i<PS[j].size();i++) {
+ //int i0 = j*I+i;
+ mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]];
minm=(*p2mymin)(minm,mm);
}
alpha[(k+1)*S+j]=minm;
d_POSTI,d_POSTO,
p2min,
&(in1[n*d_K*d_FSM.I()]),&(in2[n*d_K*d_FSM.O()]),
- &(out[n*d_K*multiple]),
- d_alpha,d_beta);
+ &(out[n*d_K*multiple])//,
+ //d_alpha,d_beta
+ );
}
}