oseiskar / simdkalman

Python Kalman filters vectorized as Single Instruction, Multiple Data
https://simdkalman.readthedocs.io/
MIT License
176 stars 36 forks source link

Bug in KalmanFilter.compute #7

Closed maxclaey closed 4 years ago

maxclaey commented 4 years ago

I think there is a bug in KalmanFilter.compute, more specifically on line 522 of kalmanfilter.py. I noticed that when I tried to perform KalmanFilter.em in a scenario where observations consist of more than 1 variable, the code crashes due to broadcasting errors.

On line 522, result.filtered.gains is initialized as follows: result.filtered.gains = np.empty((n_vars, n_measurements, n_states, n_states)) while I think it should be: result.filtered.gains = np.empty((n_vars, n_measurements, n_states, n_obs))

Would it be possible to have a look, and hotfix if needed? Many thanks in advance!

oseiskar commented 4 years ago

You're absolutely right. Thanks for reporting! Now fixed in v. 1.0.1

maxclaey commented 4 years ago

Perfect, thanks for the quick resolution!