Skip to content

Commit d1fb0f5

Browse files
author
Alexandre Marquet
committed
Deduce length of sequence from observation array in PyViterbi.
1 parent c3f8377 commit d1fb0f5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

PyTurbo.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ cdef class PyViterbi:
4646
def __dealloc__(self):
4747
del self.cpp_viterbi
4848

49-
def viterbi_algorithm(self, K, S0, SK, float[::1] _in):
49+
def viterbi_algorithm(self, S0, SK, float[::1] _in):
50+
cdef int K = _in.shape[0]/self.O
5051
cdef unsigned char[::1] _out = numpy.zeros(K, dtype=numpy.uint8)
5152

5253
self.cpp_viterbi.viterbi_algorithm(K, S0, SK, &_in[0], &_out[0])

examples/75_cc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def branch_metrics(bits_rcvd):
6767
bm[O*i:O*(i+1)] = branch_metrics([r[2*i], r[2*i+1]])
6868

6969
#decode message
70-
m_hat = dec.viterbi_algorithm(K_m, -1, -1, bm);
70+
m_hat = dec.viterbi_algorithm(-1, -1, bm);
7171

7272
print(numpy.array(m, dtype=numpy.int))
7373
print('...')

0 commit comments

Comments
 (0)