From 75b54dd88ea4837a2866ef60526839f67b3c67ed Mon Sep 17 00:00:00 2001 From: MichelJuillard Date: Tue, 3 Jan 2023 14:26:21 +0100 Subject: [PATCH] fixing bug diffuse filter --- src/kalman_filter.jl | 5 +++-- src/kalman_likelihood.jl | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kalman_filter.jl b/src/kalman_filter.jl index 55ec525..1018795 100644 --- a/src/kalman_filter.jl +++ b/src/kalman_filter.jl @@ -375,8 +375,8 @@ function diffuse_kalman_filter_init!(Y::AbstractArray{X}, # Finf = Z*Pinf*Z' get_F!(vFinf, vZPinf, vZsmall, vPinf) info = get_cholF!(vcholF, vFinf) - if info > 0 - if norm(vFinf) < tol || rcond(vFinf) < ws.kalman_tol + if info > 0 || rcond(vFinf) < ws.kalman_tol + if norm(vFinf) < tol get_updated_Finfnull2!(vatt, vPinftt, vPstartt, @@ -402,6 +402,7 @@ function diffuse_kalman_filter_init!(Y::AbstractArray{X}, cholHset = true end ws.lik[t] += ndata*l2pi + univariate_step(vatt, va1, vPinftt, vPinf1, vPstartt, vPstar1, Y, t, vc, vZsmall, vvH, vd, vT, ws.QQ, va, vPinf, vPstar, diffuse_kalman_tol, kalman_tol, ws, pattern) + t += 1 continue end else diff --git a/src/kalman_likelihood.jl b/src/kalman_likelihood.jl index 5c878d4..e92dcaa 100644 --- a/src/kalman_likelihood.jl +++ b/src/kalman_likelihood.jl @@ -611,7 +611,6 @@ function diffuse_kalman_likelihood_init!(Y::Matrix{U}, # iFv = inv(F)*v get_iFv!(ws.iFv, ws.cholF, ws.v) ws.lik[t] = ny*log(2*pi) + log(det_from_cholesky(ws.cholF)) + LinearAlgebra.dot(ws.v, ws.iFv) - continue else ws.lik[t] += univariate_step(Y, t, Z, H, T, QQ, a, Pinf, Pstar, diffuse_kalman_tol, kalman_tol, ws) end