diff options
Diffstat (limited to 'gr-trellis/src/lib/trellis_viterbi_i.cc')
-rw-r--r-- | gr-trellis/src/lib/trellis_viterbi_i.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gr-trellis/src/lib/trellis_viterbi_i.cc b/gr-trellis/src/lib/trellis_viterbi_i.cc index b81df8f13..f5d61173b 100644 --- a/gr-trellis/src/lib/trellis_viterbi_i.cc +++ b/gr-trellis/src/lib/trellis_viterbi_i.cc @@ -77,8 +77,8 @@ trellis_viterbi_i::forecast (int noutput_items, gr_vector_int &ninput_items_requ void viterbi_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, const float *in, int *out)//, @@ -106,9 +106,9 @@ void viterbi_algorithm(int I, int S, int O, for(int j=0;j<S;j++) { // for each next state do ACS minm=INF; minmi=0; - for(int i=0;i<I;i++) { - int i0 = j*I+i; - if((mm=alpha[alphai*S+PS[i0]]+in[k*O+OS[PS[i0]*I+PI[i0]]])<minm) + for(int i=0;i<PS[j].size();i++) { + //int i0 = j*I+i; + if((mm=alpha[alphai*S+PS[j][i]]+in[k*O+OS[PS[j][i]*I+PI[j][i]]])<minm) minm=mm,minmi=i; } trace[k*S+j]=minmi; @@ -132,9 +132,9 @@ void viterbi_algorithm(int I, int S, int O, } for(int k=K-1;k>=0;k--) { // traceback - int i0=st*I+trace[k*S+st]; - out[k]= (int) PI[i0]; - st=PS[i0]; + int i0=trace[k*S+st]; + out[k]= (int) PI[st][i0]; + st=PS[st][i0]; } } |