Commit e097f7c8 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Change options_.lik_init to default value if the fixed point of the Riccati...

Change options_.lik_init to default value if the fixed point of the Riccati equation cannot be found.
parent f2450932
......@@ -193,15 +193,22 @@ elseif options_.lik_init == 3 % Diffuse Kalman filter
[Z,ST,R1,QT,Pstar,Pinf] = schur_statespace_transformation(mf,T,R,Q,options_.qz_criterium);
elseif options_.lik_init==4
% Start from the solution of the Riccati equation.
[err, Pstar] = kalman_steady_state(transpose(T),R*Q*transpose(R),transpose(build_selection_matrix(mf,np,length(mf))),H);
mexErrCheck('kalman_steady_state',err);
Pinf = [];
if kalman_algo~=2
if kalman_algo ~= 2
kalman_algo = 1;
end
if isequal(H,0)
[err,Pstar] = kalman_steady_state(transpose(T),R*Q*transpose(R),transpose(build_selection_matrix(mf,np,length(mf))));
else
[err,Pstar] = kalman_steady_state(transpose(T),R*Q*transpose(R),transpose(build_selection_matrix(mf,np,length(mf))),H);
end
if err
disp(['I am not able to solve the Riccati equation so I switch to lik_init=1!']);
options_.lik_init = 1;
Pstar = lyapunov_symm(T,R*Q*R',options_.qz_criterium,options_.lyapunov_complex_threshold);
end
Pinf = [];
end
if kalman_algo == 2
end
kalman_tol = options_.kalman_tol;
riccati_tol = options_.riccati_tol;
mf = bayestopt_.mf1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment