corrected bug for decompostion (nargout > 7) in missing_DiffuseKalmanSmoother3.m
parent
4ec9652f9e
commit
f4b7840739
|
@ -296,19 +296,25 @@ if nargout > 7
|
||||||
decomp = zeros(nk,mm,rr,smpl+nk);
|
decomp = zeros(nk,mm,rr,smpl+nk);
|
||||||
ZRQinv = inv(Z*QQ*Z');
|
ZRQinv = inv(Z*QQ*Z');
|
||||||
for t = max(d,1):smpl
|
for t = max(d,1):smpl
|
||||||
ri_d = Z'*iF(:,:,t)*v(:,t);
|
ri_d = zeros(mm,1);
|
||||||
|
di = flipud(data_index{t})';
|
||||||
|
for i = di
|
||||||
|
if Fi(i,t) > crit
|
||||||
|
ri_d = Z(i,:)'/Fi(i,t)*v(i,t)+ri_d-Ki(:,i,t)'*ri_d/Fi(i,t)*Z(i,:)';
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
% calculate eta_tm1t
|
% calculate eta_tm1t
|
||||||
eta_tm1t = QRt*ri_d;
|
eta_tm1t = QRt*ri_d;
|
||||||
% calculate decomposition
|
% calculate decomposition
|
||||||
Ttok = eye(mm,mm);
|
Ttok = eye(mm,mm);
|
||||||
|
AAA = P1(:,:,t)*Z'*ZRQinv*Z*R;
|
||||||
for h = 1:nk
|
for h = 1:nk
|
||||||
|
BBB = Ttok*AAA;
|
||||||
for j=1:rr
|
for j=1:rr
|
||||||
eta=zeros(rr,1);
|
decomp(h,:,j,t+h) = eta_tm1t(j)*BBB(:,j);
|
||||||
eta(j) = eta_tm1t(j);
|
|
||||||
decomp(h,:,j,t+h) = T^(h-1)*P(:,:,t)*Z'*ZRQinv*Z*R*eta;
|
|
||||||
end
|
end
|
||||||
|
Ttok = T*Ttok;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue