Remove duplicate branches in if/then/else statements

Detected by MATLAB Code Analyzer app.
covariance-quadratic-approximation
Sébastien Villemot 2023-12-15 15:29:25 +01:00
parent a0bafbcb95
commit 79959aa587
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
6 changed files with 18 additions and 45 deletions

View File

@ -194,13 +194,10 @@ while notsteady && t<=last
end
end
if badly_conditioned_F
if ~all(abs(F(:))<kalman_tol)
% Use univariate filter (will remove observations with zero variance prediction error)
return
else
% Pathological case, discard draw.
return
end
% if ~all(abs(F(:))<kalman_tol), then use univariate filter (will remove
% observations with zero variance prediction error), otherwise this is a
% pathological case and the draw is discarded
return
else
F_singular = false;
if rescale_prediction_error_covariance

View File

@ -87,13 +87,9 @@ while rank(Z*Pinf*Z',diffuse_kalman_tol) && (t<=last)
else %rank of F_{\infty,t} is 0
Fstar = Z*Pstar*Z' + H; % (5.7) in DK (2012)
if rcond(Fstar) < kalman_tol %F_{*} is singular
if ~all(abs(Fstar(:))<kalman_tol)
% The univariate diffuse kalman filter should be used.
return
else %rank 0
%pathological case, discard draw
return
end
% if ~all(abs(Fstar(:))<kalman_tol), then use univariate diffuse filter,
% otherwise this is a pathological case and the draw is discarded
return
else
iFstar = inv(Fstar);
dFstar = det(Fstar);

View File

@ -151,13 +151,9 @@ while notsteady && t<=last
v = Y(:,t)-a(Z);
end
if rcond(F) < kalman_tol
if ~all(abs(F(:))<kalman_tol)
% The univariate diffuse kalman filter should be used.
return
else
%pathological case, discard draw
return
end
% if ~all(abs(F(:))<kalman_tol), then use univariate diffuse filter, otherwise
% this is a pathological case and the draw is discarded
return
else
F_singular = 0;
dF = det(F);

View File

@ -191,13 +191,9 @@ while notsteady && t<=last
end
end
if badly_conditioned_F && (~occbin_.status || (occbin_.status && t<first_period_occbin_update))
if ~all(abs(F(:))<kalman_tol)
% Use univariate filter.
return
else
% Pathological case, discard draw
return
end
% if ~all(abs(F(:))<kalman_tol), then use univariate filter, otherwise this is a
% pathological case and the draw is discarded
return
else
F_singular = false;
end

View File

@ -105,13 +105,9 @@ while rank(Pinf,diffuse_kalman_tol) && (t<=last)
else %rank of F_{\infty,t} is 0
Fstar = ZZ*Pstar*ZZ' + H(d_index,d_index); % (5.7) in DK (2012)
if rcond(Fstar) < kalman_tol %F_{*} is singular
if ~all(abs(Fstar(:))<kalman_tol)
% The univariate diffuse kalman filter should be used.
return
else %rank 0
%pathological case, discard draw
return
end
% if ~all(abs(Fstar(:))<kalman_tol), then use univariate diffuse filter,
% otherwise this is a pathological case and the draw is discarded
return
else
iFstar = inv(Fstar);
dFstar = det(Fstar);

View File

@ -710,11 +710,7 @@ if parallel_recover ==0
pcerdone(j) = prtfrc;
idCPU(j) = njob;
if isoctave || options_.console_mode
if (~ispc || strcmpi('unix',Parallel(indPC).OperatingSystem))
statusString = [statusString, int2str(j), ' %3.f%% done! '];
else
statusString = [statusString, int2str(j), ' %3.f%% done! '];
end
statusString = [statusString, int2str(j), ' %3.f%% done! '];
else
status_String{j} = waitbarString;
status_Title{j} = waitbarTitle;
@ -722,11 +718,7 @@ if parallel_recover ==0
catch % ME
% To define!
if isoctave || options_.console_mode
if (~ispc || strcmpi('unix',Parallel(indPC).OperatingSystem))
statusString = [statusString, int2str(j), ' %3.f%% done! '];
else
statusString = [statusString, int2str(j), ' %3.f%% done! '];
end
statusString = [statusString, int2str(j), ' %3.f%% done! '];
end
end
end