Specifically, the new version of lgssm_posterior_sample now pads the diagonal of the covariance matrix before passing it to the MVN sampler. The amount of padding is controlled by an optional jitter parameter that is set to 0 by default. The code runs identically unless a user specifies a nonzero value for the jitter.
This PR modifies
lgssm_posterior_sample
to avoid NaNs caused by numerical instability, as described in issue https://github.com/probml/dynamax/issues/320.Specifically, the new version of
lgssm_posterior_sample
now pads the diagonal of the covariance matrix before passing it to the MVN sampler. The amount of padding is controlled by an optionaljitter
parameter that is set to 0 by default. The code runs identically unless a user specifies a nonzero value for the jitter.Note that this PR builds on top of https://github.com/probml/dynamax/pull/319 and should be merged second.