Commit 8a0dabd0 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

use || and && as opposed to | and & where appropriate

parent 0aa9424c
......@@ -27,7 +27,7 @@ function [alphahat,etahat,atilde, aK] = DiffuseKalmanSmoother1(T,R,Q,Pinf1,Pstar
% Models", S.J. Koopman and J. Durbin (2003, in Journal of Time Series
% Analysis, vol. 24(1), pp. 85-98).
% Copyright (C) 2004-2010 Dynare Team
% Copyright (C) 2004-2011 Dynare Team
%
% This file is part of Dynare.
%
......@@ -86,7 +86,7 @@ for i=1:pp;
end
t = 0;
while rank(Pinf(:,:,t+1),crit1) & t<smpl
while rank(Pinf(:,:,t+1),crit1) && t<smpl
t = t+1;
v(:,t) = Y(:,t) - a(mf,t) - trend(:,t);
if rcond(Pinf(mf,mf,t)) < crit
......@@ -116,7 +116,7 @@ Kstar = Kstar(:,:,1:d);
Pstar = Pstar(:,:,1:d);
Pinf = Pinf(:,:,1:d);
notsteady = 1;
while notsteady & t<smpl
while notsteady && t<smpl
t = t+1;
v(:,t) = Y(:,t) - a(mf,t) - trend(:,t);
P(:,:,t)=tril(P(:,:,t))+transpose(tril(P(:,:,t),-1));
......
......@@ -148,7 +148,7 @@ Kstar = Kstar(:,:,1:d);
Pstar = Pstar(:,:,1:d);
Pinf = Pinf(:,:,1:d);
notsteady = 1;
while notsteady & t<smpl
while notsteady && t<smpl
t = t+1;
v(:,t) = Y(:,t) - Z*a(:,t);
P(:,:,t)=tril(P(:,:,t))+transpose(tril(P(:,:,t),-1));
......
......@@ -100,7 +100,7 @@ end
t = 0;
icc=0;
newRank = rank(Pinf(:,:,1),crit1);
while newRank & t < smpl
while newRank && t < smpl
t = t+1;
a(:,t) = a1(:,t);
Pstar(:,:,t)=tril(Pstar(:,:,t))+transpose(tril(Pstar(:,:,t),-1));
......@@ -112,7 +112,7 @@ while newRank & t < smpl
Fstar(i,t) = Pstar(mf(i),mf(i),t);
Finf(i,t) = Pinf(mf(i),mf(i),t);
Kstar(:,i,t) = Pstar(:,mf(i),t);
if Finf(i,t) > crit & newRank, % original MJ: if Finf(i,t) > crit
if Finf(i,t) > crit && newRank, % original MJ: if Finf(i,t) > crit
icc=icc+1;
Kinf(:,i,t) = Pinf(:,mf(i),t);
Linf(:,:,i,t) = eye(mm) - Kinf(:,i,t)*Z(i,:)/Finf(i,t);
......@@ -129,7 +129,7 @@ while newRank & t < smpl
elseif Fstar(i,t) > crit
%% Note that : (1) rank(Pinf)=0 implies that Finf = 0, (2) outside this loop (when for some i and t the condition
%% rank(Pinf)=0 is satisfied we have P = Pstar and F = Fstar and (3) Finf = 0 does not imply that
%% rank(Pinf)=0. [stphane,11-03-2004].
%% rank(Pinf)=0. [stphane,11-03-2004].
Li(:,:,i,t) = eye(mm)-Kstar(:,i,t)*Z(i,:)/Fstar(i,t); % we need to store Li for DKF smoother
a(:,t) = a(:,t) + Kstar(:,i,t)*v(i,t)/Fstar(i,t);
Pstar(:,:,t) = Pstar(:,:,t) - Kstar(:,i,t)*transpose(Kstar(:,i,t))/Fstar(i,t);
......@@ -170,7 +170,7 @@ Pinf = Pinf(:,:,1:d);
Pstar1 = Pstar1(:,:,1:d);
Pinf1 = Pinf1(:,:,1:d);
notsteady = 1;
while notsteady & t<smpl
while notsteady && t<smpl
t = t+1;
a(:,t) = a1(:,t);
P(:,:,t)=tril(P(:,:,t))+transpose(tril(P(:,:,t),-1));
......@@ -250,7 +250,7 @@ if d
r1 = zeros(mm,d);
for t = d:-1:1
for i=pp:-1:1
if Finf(i,t) > crit & ~(t==d & i>options_.diffuse_d), % use of options_.diffuse_d to be sure of DKF termination
if Finf(i,t) > crit && ~(t==d && i>options_.diffuse_d), % use of options_.diffuse_d to be sure of DKF termination
%r1(:,t) = transpose(Z)*v(:,t)/Finf(i,t) + ... BUG HERE in transpose(Z)
r1(:,t) = Z(i,:)'*v(i,t)/Finf(i,t) + ...
L0(:,:,i,t)'*r0(:,t) + Linf(:,:,i,t)'*r1(:,t);
......
......@@ -34,7 +34,7 @@ function [alphahat,etahat,a,P,aK,PK,d,decomp] = DiffuseKalmanSmoother3_Z(T,Z,R,Q
% Models", S.J. Koopman and J. Durbin (2003, in Journal of Time Series
% Analysis, vol. 24(1), pp. 85-98).
% Copyright (C) 2004-2010 Dynare Team
% Copyright (C) 2004-2011 Dynare Team
%
% This file is part of Dynare.
%
......@@ -109,7 +109,7 @@ r = zeros(mm,smpl);
t = 0;
icc=0;
newRank = rank(Pinf(:,:,1),crit1);
while newRank & t < smpl
while newRank && t < smpl
t = t+1;
a(:,t) = a1(:,t);
Pstar(:,:,t)=tril(Pstar(:,:,t))+tril(Pstar(:,:,t),-1)';
......@@ -122,7 +122,7 @@ while newRank & t < smpl
Fstar(i,t) = Zi*Pstar(:,:,t)*Zi';
Finf(i,t) = Zi*Pinf(:,:,t)*Zi';
Kstar(:,i,t) = Pstar(:,:,t)*Zi';
if Finf(i,t) > crit & newRank
if Finf(i,t) > crit && newRank
icc=icc+1;
Kinf(:,i,t) = Pinf(:,:,t)*Zi';
% Linf(:,:,i,t) = eye(mm) - Kinf(:,i,t)*Z(i,:)/Finf(i,t);
......@@ -139,7 +139,7 @@ while newRank & t < smpl
P0=Pinf(:,:,t);
if ~isempty(options_.diffuse_d),
newRank = (icc<options_.diffuse_d);
if newRank & (any(diag(Z*P0*Z')>crit)==0 & rank(P0,crit1)==0);
if newRank && (any(diag(Z*P0*Z')>crit)==0 && rank(P0,crit1)==0);
disp('WARNING!! Change in OPTIONS_.DIFFUSE_D in univariate DKF')
options_.diffuse_d = icc;
newRank=0;
......@@ -187,7 +187,7 @@ Pinf = Pinf(:,:,1:d);
Pstar1 = Pstar1(:,:,1:d);
Pinf1 = Pinf1(:,:,1:d);
notsteady = 1;
while notsteady & t<smpl
while notsteady && t<smpl
t = t+1;
a(:,t) = a1(:,t);
P(:,:,t)=tril(P(:,:,t))+tril(P(:,:,t),-1)';
......@@ -267,7 +267,7 @@ if d
r1 = zeros(mm,d);
for t = d:-1:1
for i=pp:-1:1
% if Finf(i,t) > crit & ~(t==d & i>options_.diffuse_d), % use of options_.diffuse_d to be sure of DKF termination
% if Finf(i,t) > crit && ~(t==d && i>options_.diffuse_d), % use of options_.diffuse_d to be sure of DKF termination
if Finf(i,t) > crit
r1(:,t) = Z(i,:)'*v(i,t)/Finf(i,t) + ...
(Kinf(:,i,t)'*Fstar(i,t)/Finf(i,t)-Kstar(:,i,t)')*r0(:,t)/Finf(i,t)*Z(i,:)' + ...
......
......@@ -28,7 +28,7 @@ function [alphahat,epsilonhat,etahat,atilde, aK] = DiffuseKalmanSmootherH1(T,R,Q
% Models", S.J. Koopman and J. Durbin (2003, in Journal of Time Series
% Analysis, vol. 24(1), pp. 85-98).
% Copyright (C) 2004-2010 Dynare Team
% Copyright (C) 2004-2011 Dynare Team
%
% This file is part of Dynare.
%
......@@ -87,7 +87,7 @@ for i=1:pp;
end
t = 0;
while rank(Pinf(:,:,t+1),crit1) & t<smpl
while rank(Pinf(:,:,t+1),crit1) && t<smpl
t = t+1;
v(:,t) = Y(:,t) - a(mf,t) - trend(:,t);
if rcond(Pinf(mf,mf,t)) < crit
......@@ -117,7 +117,7 @@ Kstar = Kstar(:,:,1:d);
Pstar = Pstar(:,:,1:d);
Pinf = Pinf(:,:,1:d);
notsteady = 1;
while notsteady & t<smpl
while notsteady && t<smpl
t = t+1;
v(:,t) = Y(:,t) - a(mf,t) - trend(:,t);
P(:,:,t)=tril(P(:,:,t))+transpose(tril(P(:,:,t),-1));
......
......@@ -94,7 +94,7 @@ epsilonhat = zeros(size(Y));
r = zeros(mm,smpl+1);
t = 0;
while rank(Pinf(:,:,t+1),crit1) & t<smpl
while rank(Pinf(:,:,t+1),crit1) && t<smpl
t = t+1;
v(:,t)= Y(:,t) - Z*a(:,t);
Finf = Z*Pinf(:,:,t)*Z';
......@@ -149,7 +149,7 @@ Kstar = Kstar(:,:,1:d);
Pstar = Pstar(:,:,1:d);
Pinf = Pinf(:,:,1:d);
notsteady = 1;
while notsteady & t<smpl
while notsteady && t<smpl
t = t+1;
v(:,t) = Y(:,t) - Z*a(:,t);
P(:,:,t)=tril(P(:,:,t))+transpose(tril(P(:,:,t),-1));
......
......@@ -105,7 +105,7 @@ end
t = 0;
icc=0;
newRank = rank(Pinf(:,:,1),crit1);
while newRank & t < smpl
while newRank && t < smpl
t = t+1;
a(:,t) = a1(:,t);
Pstar(:,:,t)=tril(Pstar(:,:,t))+transpose(tril(Pstar(:,:,t),-1));
......@@ -117,7 +117,7 @@ while newRank & t < smpl
Fstar(i,t) = Pstar(mf(i),mf(i),t) + H(i,i);
Finf(i,t) = Pinf(mf(i),mf(i),t);
Kstar(:,i,t) = Pstar(:,mf(i),t);
if Finf(i,t) > crit & newRank, % original MJ: if Finf(i,t) > crit
if Finf(i,t) > crit && newRank, % original MJ: if Finf(i,t) > crit
icc=icc+1;
Kinf(:,i,t) = Pinf(:,mf(i),t);
Linf(:,:,i,t) = eye(mm) - Kinf(:,i,t)*Z(i,:)/Finf(i,t);
......@@ -136,8 +136,8 @@ while newRank & t < smpl
% if newRank==0, options_.diffuse_d = i; end,
if ~isempty(options_.diffuse_d),
newRank = (icc<options_.diffuse_d);
%if newRank & any(diag(P0(mf,mf))>crit)==0;
if newRank & (any(diag(P0(mf,mf))>crit)==0 & rank(P0,crit1)==0);
%if newRank && any(diag(P0(mf,mf))>crit)==0;
if newRank && (any(diag(P0(mf,mf))>crit)==0 && rank(P0,crit1)==0);
disp('WARNING!! Change in OPTIONS_.DIFFUSE_D in univariate DKF')
options_.diffuse_d = icc;
newRank=0;
......@@ -190,7 +190,7 @@ Pinf = Pinf(:,:,1:d);
Pstar1 = Pstar1(:,:,1:d);
Pinf1 = Pinf1(:,:,1:d);
notsteady = 1;
while notsteady & t<smpl
while notsteady && t<smpl
t = t+1;
a(:,t) = a1(:,t);
P(:,:,t)=tril(P(:,:,t))+transpose(tril(P(:,:,t),-1));
......@@ -260,7 +260,7 @@ if d
r1 = zeros(mm,d);
for t = d:-1:1
for i=pp:-1:1
if Finf(i,t) > crit & ~(t==d & i>options_.diffuse_d), % use of options_.diffuse_d to be sure of DKF termination
if Finf(i,t) > crit && ~(t==d && i>options_.diffuse_d), % use of options_.diffuse_d to be sure of DKF termination
r1(:,t) = Z(i,:)'*v(i,t)/Finf(i,t) + ...
L0(:,:,i,t)'*r0(:,t) + Linf(:,:,i,t)'*r1(:,t);
r0(:,t) = Linf(:,:,i,t)'*r0(:,t);
......
......@@ -35,7 +35,7 @@ function [alphahat,epsilonhat,etahat,a,P,aK,PK,d,decomp] = DiffuseKalmanSmoother
% Models", S.J. Koopman and J. Durbin (2003, in Journal of Time Series
% Analysis, vol. 24(1), pp. 85-98).
% Copyright (C) 2004-2010 Dynare Team
% Copyright (C) 2004-2011 Dynare Team
%
% This file is part of Dynare.
%
......@@ -110,7 +110,7 @@ r = zeros(mm,smpl);
t = 0;
icc=0;
newRank = rank(Pinf(:,:,1),crit1);
while newRank & t < smpl
while newRank && t < smpl
t = t+1;
a(:,t) = a1(:,t);
Pstar(:,:,t)=tril(Pstar(:,:,t))+tril(Pstar(:,:,t),-1)';
......@@ -123,7 +123,7 @@ while newRank & t < smpl
Fstar(i,t) = Zi*Pstar(:,:,t)*Zi' +H(i,i);
Finf(i,t) = Zi*Pinf(:,:,t)*Zi';
Kstar(:,i,t) = Pstar(:,:,t)*Zi';
if Finf(i,t) > crit & newRank
if Finf(i,t) > crit && newRank
icc=icc+1;
Kinf(:,i,t) = Pinf(:,:,t)*Zi';
Linf(:,:,i,t) = eye(mm) - Kinf(:,i,t)*Z(i,:)/Finf(i,t);
......@@ -140,7 +140,7 @@ while newRank & t < smpl
P0=Pinf(:,:,t);
if ~isempty(options_.diffuse_d),
newRank = (icc<options_.diffuse_d);
if newRank & (any(diag(Z*P0*Z')>crit)==0 & rank(P0,crit1)==0);
if newRank && (any(diag(Z*P0*Z')>crit)==0 && rank(P0,crit1)==0);
disp('WARNING!! Change in OPTIONS_.DIFFUSE_D in univariate DKF')
options_.diffuse_d = icc;
newRank=0;
......@@ -155,7 +155,7 @@ while newRank & t < smpl
elseif Fstar(i,t) > crit
%% Note that : (1) rank(Pinf)=0 implies that Finf = 0, (2) outside this loop (when for some i and t the condition
%% rank(Pinf)=0 is satisfied we have P = Pstar and F = Fstar and (3) Finf = 0 does not imply that
%% rank(Pinf)=0. [stphane,11-03-2004].
%% rank(Pinf)=0. [stphane,11-03-2004].
Li(:,:,i,t) = eye(mm)-Kstar(:,i,t)*Z(i,:)/Fstar(i,t); % we need to store Li for DKF smoother
a(:,t) = a(:,t) + Kstar(:,i,t)*v(i,t)/Fstar(i,t);
Pstar(:,:,t) = Pstar(:,:,t) - Kstar(:,i,t)*Kstar(:,i,t)'/Fstar(i,t);
......@@ -188,7 +188,7 @@ Pinf = Pinf(:,:,1:d);
Pstar1 = Pstar1(:,:,1:d);
Pinf1 = Pinf1(:,:,1:d);
notsteady = 1;
while notsteady & t<smpl
while notsteady && t<smpl
t = t+1;
a(:,t) = a1(:,t);
P(:,:,t)=tril(P(:,:,t))+tril(P(:,:,t),-1)';
......@@ -271,7 +271,7 @@ if d
r1 = zeros(mm,d);
for t = d:-1:2
for i=pp:-1:1
% if Finf(i,t) > crit & ~(t==d & i>options_.diffuse_d), % use of options_.diffuse_d to be sure of DKF termination
% if Finf(i,t) > crit && ~(t==d && i>options_.diffuse_d), % use of options_.diffuse_d to be sure of DKF termination
if Finf(i,t) > crit
r1(:,t) = Z(i,:)'*v(i,t)/Finf(i,t) + ...
L0(:,:,i,t)'*r0(:,t) + Linf(:,:,i,t)'*r1(:,t);
......
......@@ -29,7 +29,7 @@ function [alphahat,epsilonhat,etahat,a,aK] = DiffuseKalmanSmootherH3corr(T,R,Q,H
% Models", S.J. Koopman and J. Durbin (2000, in Journal of Time Series
% Analysis, vol. 21(3), pp. 281-296).
% Copyright (C) 2004-2010 Dynare Team
% Copyright (C) 2004-2011 Dynare Team
%
% This file is part of Dynare.
%
......@@ -94,7 +94,7 @@ end
%% [1] Kalman filter...
t = 0;
newRank = rank(Pinf(:,:,1),crit);
while newRank & t < smpl
while newRank && t < smpl
t = t+1;
a(:,t) = a1(:,t);
Pstar1(:,:,t) = Pstar(:,:,t);
......@@ -143,7 +143,7 @@ Pinf = Pinf(:,:,1:d);
Pstar1 = Pstar1(:,:,1:d);
Pinf1 = Pinf1(:,:,1:d);
notsteady = 1;
while notsteady & t<smpl
while notsteady && t<smpl
t = t+1;
a(:,t) = a1(:,t);
P(:,:,t)=tril(P(:,:,t))+transpose(tril(P(:,:,t),-1));
......@@ -234,4 +234,4 @@ if d
end
end
end
alphahat = alphahat(1:mm,:);
\ No newline at end of file
alphahat = alphahat(1:mm,:);
......@@ -48,14 +48,14 @@ llik=NaN;
%------------------------------------------------------------------------------
% 1. Get the structural parameters & define penalties
%------------------------------------------------------------------------------
if options_.mode_compute ~= 1 & any(xparam1 < bayestopt_.lb)
if options_.mode_compute ~= 1 && any(xparam1 < bayestopt_.lb)
k = find(xparam1 < bayestopt_.lb);
fval = bayestopt_.penalty+sum((bayestopt_.lb(k)-xparam1(k)).^2);
cost_flag = 0;
info = 41;
return;
end
if options_.mode_compute ~= 1 & any(xparam1 > bayestopt_.ub)
if options_.mode_compute ~= 1 && any(xparam1 > bayestopt_.ub)
k = find(xparam1 > bayestopt_.ub);
fval = bayestopt_.penalty+sum((xparam1(k)-bayestopt_.ub(k)).^2);
cost_flag = 0;
......
......@@ -15,7 +15,7 @@ function oo_ = GetPosteriorParametersStatistics(estim_params_, M_, options_, bay
% SPECIAL REQUIREMENTS
% None.
% Copyright (C) 2006-2010 Dynare Team
% Copyright (C) 2006-2011 Dynare Team
%
% This file is part of Dynare.
%
......@@ -32,7 +32,7 @@ function oo_ = GetPosteriorParametersStatistics(estim_params_, M_, options_, bay
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
%if ~options_.mh_replic & options_.load_mh_file
%if ~options_.mh_replic && options_.load_mh_file
% load([M_.fname '_results.mat'],'oo_');
%end
......
......@@ -16,7 +16,7 @@ function oo_ = PlotPosteriorDistributions(estim_params_, M_, options_, bayestopt
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2005-2010 Dynare Team
% Copyright (C) 2005-2011 Dynare Team
%
% This file is part of Dynare.
%
......@@ -155,7 +155,7 @@ for i=1:npar
title(nam,'Interpreter','none');
hold off;
drawnow
if subplotnum == MaxNumberOfPlotPerFigure | i == npar;
if subplotnum == MaxNumberOfPlotPerFigure || i == npar;
eval(['print -depsc2 ' OutputDirectoryName '/' M_.fname '_PriorsAndPosteriors' int2str(figunumber) '.eps']);
if ~exist('OCTAVE_VERSION')
eval(['print -dpdf ' OutputDirectoryName '/' M_.fname '_PriorsAndPosteriors' int2str(figunumber)]);
......
......@@ -16,7 +16,7 @@ function PosteriorFilterSmootherAndForecast(Y,gend, type,data_index)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2005-2010 Dynare Team
% Copyright (C) 2005-2011 Dynare Team
%
% This file is part of Dynare.
%
......@@ -200,49 +200,49 @@ for b=1:B
irun6 = irun6 + 1;
irun7 = irun7 + 1;
if irun1 > MAX_nsmoo | b == B
if irun1 > MAX_nsmoo || b == B
stock = stock_smooth(:,:,1:irun1-1);
ifil1 = ifil1 + 1;
save([DirectoryName '/' M_.fname '_smooth' int2str(ifil1) '.mat'],'stock');
irun1 = 1;
end
if nvx & (irun2 > MAX_ninno | b == B)
if nvx && (irun2 > MAX_ninno || b == B)
stock = stock_innov(:,:,1:irun2-1);
ifil2 = ifil2 + 1;
save([DirectoryName '/' M_.fname '_inno' int2str(ifil2) '.mat'],'stock');
irun2 = 1;
end
if nvn & (irun3 > MAX_error | b == B)
if nvn && (irun3 > MAX_error || b == B)
stock = stock_error(:,:,1:irun3-1);
ifil3 = ifil3 + 1;
save([DirectoryName '/' M_.fname '_error' int2str(ifil3) '.mat'],'stock');
irun3 = 1;
end
if naK & (irun4 > MAX_naK | b == B)
if naK && (irun4 > MAX_naK || b == B)
stock = stock_filter(:,:,:,1:irun4-1);
ifil4 = ifil4 + 1;
save([DirectoryName '/' M_.fname '_filter' int2str(ifil4) '.mat'],'stock');
irun4 = 1;
end
if irun5 > MAX_nruns | b == B
if irun5 > MAX_nruns || b == B
stock = stock_param(1:irun5-1,:);
ifil5 = ifil5 + 1;
save([DirectoryName '/' M_.fname '_param' int2str(ifil5) '.mat'],'stock','stock_logpo','stock_ys');
irun5 = 1;
end
if horizon & (irun6 > MAX_nforc1 | b == B)
if horizon && (irun6 > MAX_nforc1 || b == B)
stock = stock_forcst_mean(:,:,1:irun6-1);
ifil6 = ifil6 + 1;
save([DirectoryName '/' M_.fname '_forc_mean' int2str(ifil6) '.mat'],'stock');
irun6 = 1;
end
if horizon & (irun7 > MAX_nforc2 | b == B)
if horizon && (irun7 > MAX_nforc2 || b == B)
stock = stock_forcst_total(:,:,1:irun7-1);
ifil7 = ifil7 + 1;
save([DirectoryName '/' M_.fname '_forc_total' int2str(ifil7) '.mat'],'stock');
......
......@@ -36,7 +36,7 @@ function PosteriorIRF(type)
global options_ estim_params_ oo_ M_ bayestopt_
% Set the number of periods
if isempty(options_.irf) | ~options_.irf
if isempty(options_.irf) || ~options_.irf
options_.irf = 40;
end
% Set varlist if necessary
......
......@@ -232,13 +232,13 @@ while fpar<npar
stock_irf_dsgevar = zeros(options_.irf,nvobs,M_.exo_nbr,MAX_nirfs_dsgevar);
end
end
if irun == MAX_nirfs_dsge | irun == npar | fpar == npar
if irun == MAX_nirfs_dsge || irun == npar || fpar == npar
if fpar == npar
stock_irf_dsge = stock_irf_dsge(:,:,:,1:irun);
if MAX_nirfs_dsgevar & (fpar == npar | IRUN == npar)
if MAX_nirfs_dsgevar && (fpar == npar || IRUN == npar)
stock_irf_bvardsge = stock_irf_bvardsge(:,:,:,1:IRUN);
instr = [MhDirectoryName '/' M_.fname '_irf_bvardsge' ...
int2str(NumberOfIRFfiles_dsgevar) '.mat stock_irf_bvardsge;'];,
int2str(NumberOfIRFfiles_dsgevar) '.mat stock_irf_bvardsge;'];
eval(['save ' instr]);
NumberOfIRFfiles_dsgevar = NumberOfIRFfiles_dsgevar+1;
if RemoteFlag==1,
......@@ -254,7 +254,7 @@ while fpar<npar
NumberOfIRFfiles_dsge = NumberOfIRFfiles_dsge+1;
irun = 0;
end
if irun2 == MAX_nruns | fpar == npar
if irun2 == MAX_nruns || fpar == npar
if fpar == npar
stock_param = stock_param(1:irun2,:);
end
......
......@@ -93,15 +93,15 @@ for i=fpar:npar,
if max(abs(MeanIRF(:,j,i))) > 10^(-6)
subplotnum = subplotnum+1;
if options_.nograph
if subplotnum == 1 & options_.relative_irf
if subplotnum == 1 && options_.relative_irf
hh = figure('Name',['Relative response to orthogonalized shock to ' tit(i,:)],'Visible','off');
elseif subplotnum == 1 & ~options_.relative_irf
elseif subplotnum == 1 && ~options_.relative_irf
hh = figure('Name',['Orthogonalized shock to ' tit(i,:)],'Visible','off');
end
else
if subplotnum == 1 & options_.relative_irf
if subplotnum == 1 && options_.relative_irf
hh = figure('Name',['Relative response to orthogonalized shock to ' tit(i,:)]);
elseif subplotnum == 1 & ~options_.relative_irf
elseif subplotnum == 1 && ~options_.relative_irf
hh = figure('Name',['Orthogonalized shock to ' tit(i,:)]);
end
end
......@@ -143,7 +143,7 @@ for i=fpar:npar,
title(name,'Interpreter','none')
end
if subplotnum == MaxNumberOfPlotPerFigure | (j == nvar & subplotnum> 0)
if subplotnum == MaxNumberOfPlotPerFigure || (j == nvar && subplotnum> 0)
figunumber = figunumber+1;
set(hh,'visible','on')
eval(['print -depsc2 ' DirectoryName '/' M_.fname '_Bayesian_IRF_' deblank(tit(i,:)) '_' int2str(figunumber) '.eps']);
......
function [x,status]=bicgstab_(func,b,x,tole,kmax,varargin)
% Copyright (C) 2007-2009 Dynare Team
% Copyright (C) 2007-2011 Dynare Team
%
% This file is part of Dynare.
%
......@@ -30,7 +30,7 @@ k = 0;
rho_1 = rh_0'*r;
tolr = tole*norm(b);
while norm(r) > tolr & k < kmax
while norm(r) > tolr && k < kmax
k = k+1;
beta = (rho_1/rho_0)*(alpha/w);
p = r+beta*(p-w*v);
......
......@@ -15,7 +15,7 @@ function d1 = bksupk(ny,fid,jcf,icc1)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2010 Dynare Team
% Copyright (C) 2003-2011 Dynare Team
%
% This file is part of Dynare.
%
......@@ -48,7 +48,7 @@ ir = ir-ny ;
i = 2 ;
while i <= M_.maximum_lead | i <= options_.periods
while i <= M_.maximum_lead || i <= options_.periods
irf1 = selif(irf,irf<=options_.periods*ny) ;
ofs = (((options_.periods-i)*ny+1)-1)*jcf*8 ;
......
function dcompare(s1)
% Copyright (C) 2001-2009 Dynare Team
% Copyright (C) 2001-2011 Dynare Team
%
% This file is part of Dynare.
%
......@@ -29,7 +29,7 @@ end
if options_.smpl(3) > 0
if options_.smpl(3) == 2
if options_.smpl(1)<0 | options_.smpl(2)>size(x,2)-lag1(2)
if options_.smpl(1)<0 || options_.smpl(2)>size(x,2)-lag1(2)
error ('Wrong sample.') ;
end
i = [options_.smpl(1)+lag1(1):options_.smpl(2)+lag1(1)]' ;
......
......@@ -19,7 +19,7 @@ function disp_identification(pdraws, idemodel, idemoments, name, advanced)
global options_
if nargin<5 | isempty(advanced),
if nargin<5 || isempty(advanced),
advanced=0;
end
......@@ -192,7 +192,7 @@ if ~any(idemoments.ino) && ~any(any(idemoments.ind==0))
disp(' ')
end
if ~ options_.noprint & advanced,
if ~ options_.noprint && advanced,
disp('Press KEY to continue with identification analysis')
pause;
dyntable('Multi collinearity in the model:',char('param','min','mean','max'), ...
......@@ -204,7 +204,7 @@ if ~ options_.noprint & advanced,
end
% if advanced & (~options_.noprint),
% if advanced && (~options_.noprint),
% for j=1:length(kokP),
% dyntable([name{kokP(j)},' pairwise correlations in the model'],char(' ','min','mean','max'), ...
% char(name{jpM{j}}),[pminM{j}' pmeanM{j}' pmaxM{j}'],10,10,3);
......