use short-circuit ops (|| and &&) as opposed to (| and &) to avoid warnings in Octave (and save time)

time-shift
Houtan Bastani 2011-02-10 15:54:23 +01:00
parent 6f46019bfa
commit 43479f6ef3
36 changed files with 139 additions and 137 deletions

View File

@ -34,7 +34,7 @@ left = 1:qcols;
right = qcols+1:qcols+neq;
zerorows = find( sum(abs( hs(:,right)' ))==0 );
while( any(zerorows) & iq <= qrows )
while( any(zerorows) && iq <= qrows )
nz = length(zerorows);
q(iq+1:iq+nz,:) = hs(zerorows,left);
hs(zerorows,:) = SPShiftright(hs(zerorows,:),neq);

View File

@ -35,7 +35,7 @@ right = qcols+1:qcols+neq;
[Q,R,E] = qr( h(:,right) );
zerorows = find( abs(diag(R)) <= condn );
while( any(zerorows) & iq <= qrows )
while( any(zerorows) && iq <= qrows )
h=sparse(h);
Q=sparse(Q);
h = Q'*h;

View File

@ -14,7 +14,7 @@ function CutSample(M_, options_, estim_params_)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2005-2009 Dynare Team
% Copyright (C) 2005-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -60,7 +60,7 @@ if (TotalNumberOfMhFiles-1)-(FirstMhFile+1)+1 > 0
record.MhDraws(end,3) ];
elseif TotalNumberOfMhFiles == 1
record.KeepedDraws.Distribution = [];
elseif TotalNumberOfMhFiles == 2 & FirstMhFile > 1
elseif TotalNumberOfMhFiles == 2 && FirstMhFile > 1
record.KeepedDraws.Distribution = [MAX_nruns-FirstLine+1 ; record.MhDraws(end,3)];
end
save([DirectoryName '/' M_.fname '_mh_history.mat'],'record');

View File

@ -47,14 +47,14 @@ nobs = size(options_.varobs,1);
%------------------------------------------------------------------------------
% 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;

View File

@ -59,7 +59,7 @@ mXX = evalin('base', 'mXX');
fval = [];
cost_flag = 1;
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;
@ -67,7 +67,7 @@ if options_.mode_compute ~= 1 & any(xparam1 < bayestopt_.lb)
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;

View File

@ -42,7 +42,7 @@ function [ny, nx, posterior, prior, forecast_data] = bvar_toolbox(nlags)
% - bvar_prior_{tau,decay,lambda,mu,omega,flat,train}
% Copyright (C) 2003-2007 Christopher Sims
% Copyright (C) 2007-2009 Dynare Team
% Copyright (C) 2007-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -87,7 +87,7 @@ end
idx = options_.first_obs+options_.presample-train-nlags:options_.first_obs+options_.nobs-1;
% Prepare dataset
if options_.loglinear & ~options_.logdata
if options_.loglinear && ~options_.logdata
dataset = log(dataset);
end
if options_.prefilter
@ -106,7 +106,7 @@ mu = options_.bvar_prior_mu;
flat = options_.bvar_prior_flat;
ny = size(dataset, 2);
if options_.prefilter | options_.noconstant
if options_.prefilter || options_.noconstant
nx = 0;
else
nx = 1;
@ -204,7 +204,7 @@ else
breaks = [];
lbreak = 0;
end
if ~isempty(vprior) & vprior.w>0
if ~isempty(vprior) && vprior.w>0
ydum2 = zeros(lags+1,nv,nv);
xdum2 = zeros(lags+1,nx,nv);
ydum2(end,:,:) = diag(vprior.sig);
@ -286,7 +286,7 @@ y = ydata(smpl,:);
% Everything now set up with input data for y=Xb+e
% Add persistence dummies
if lambda ~= 0 | mu > 0
if lambda ~= 0 || mu > 0
ybar = mean(ydata(1:lags,:),1);
if ~nox
xbar = mean(xdata(1:lags,:),1);

View File

@ -11,7 +11,7 @@ function [result,info] = check
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2001-2010 Dynare Team
% Copyright (C) 2001-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -33,7 +33,7 @@ global M_ options_ oo_
temp_options = options_;
tempex = oo_.exo_simul;
if ~options_.initval_file & M_.exo_nbr > 1
if ~options_.initval_file && M_.exo_nbr > 1
oo_.exo_simul = ones(M_.maximum_lead+M_.maximum_lag+1,1)*oo_.exo_steady_state';
end
@ -47,7 +47,7 @@ end
oo_.dr = dr;
if info(1) ~= 0 & info(1) ~= 3 & info(1) ~= 4
if info(1) ~= 0 && info(1) ~= 3 && info(1) ~= 4
print_info(info, options_.noprint);
end
@ -76,7 +76,7 @@ if options_.noprint == 0
disp(sprintf('\nThere are %d eigenvalue(s) larger than 1 in modulus ', n_explod));
disp(sprintf('for %d forward-looking variable(s)',nyf));
disp(' ')
if dr.rank == nyf & nyf == n_explod
if dr.rank == nyf && nyf == n_explod
disp('The rank condition is verified.')
else
disp('The rank conditions ISN''T verified!')

View File

@ -1,6 +1,6 @@
function check_model()
% Copyright (C) 2005-2009 Dynare Team
% Copyright (C) 2005-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -29,7 +29,7 @@ if xlen > 1
' current period. Use additional endogenous variables']) ;
end
if (M_.exo_det_nbr > 0) & (M_.maximum_lag > 1 | M_.maximum_lead > 1)
if (M_.exo_det_nbr > 0) && (M_.maximum_lag > 1 || M_.maximum_lead > 1)
error(['Exogenous deterministic variables are currently only allowed in' ...
' models with leads and lags on only one period'])
end

View File

@ -20,7 +20,7 @@ function [fhat,xhat,fcount,retcode] = csminit(fcn,x0,f0,g0,badg,H0,varargin)
% http://sims.princeton.edu/yftp/optimize/mfiles/csminit.m
% Copyright (C) 1993-2007 Christopher Sims
% Copyright (C) 2008-2009 Dynare Team
% Copyright (C) 2008-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -59,7 +59,7 @@ fhat=f0;
g = g0;
gnorm = norm(g);
%
if (gnorm < 1.e-12) & ~badg % put ~badg 8/4/94
if (gnorm < 1.e-12) && ~badg % put ~badg 8/4/94
retcode =1;
dxnorm=0;
% gradient convergence
@ -138,14 +138,14 @@ else
fcount=fcount+1;
shrinkSignal = (~badg & (f0-f < max([-THETA*dfhat*lambda 0]))) | (badg & (f0-f) < 0) ;
growSignal = ~badg & ( (lambda > 0) & (f0-f > -(1-THETA)*dfhat*lambda) );
if shrinkSignal & ( (lambda>lambdaPeak) | (lambda<0) )
if (lambda>0) & ((~shrink) | (lambda/factor <= lambdaPeak))
if shrinkSignal && ( (lambda>lambdaPeak) || (lambda<0) )
if (lambda>0) && ((~shrink) || (lambda/factor <= lambdaPeak))
shrink=1;
factor=factor^.6;
while lambda/factor <= lambdaPeak
factor=factor^.6;
end
%if (abs(lambda)*(factor-1)*dxnorm < MINDX) | (abs(lambda)*(factor-1) < MINLAMB)
%if (abs(lambda)*(factor-1)*dxnorm < MINDX) || (abs(lambda)*(factor-1) < MINLAMB)
if abs(factor-1)<MINDFAC
if abs(lambda)<4
retcode=2;
@ -155,12 +155,12 @@ else
done=1;
end
end
if (lambda<lambdaMax) & (lambda>lambdaPeak)
if (lambda<lambdaMax) && (lambda>lambdaPeak)
lambdaMax=lambda;
end
lambda=lambda/factor;
if abs(lambda) < MINLAMB
if (lambda > 0) & (f0 <= fhat)
if (lambda > 0) && (f0 <= fhat)
% try going against gradient, which may be inaccurate
lambda = -lambda*factor^6
else
@ -172,11 +172,11 @@ else
done = 1;
end
end
elseif (growSignal & lambda>0) | (shrinkSignal & ((lambda <= lambdaPeak) & (lambda>0)))
elseif (growSignal && lambda>0) || (shrinkSignal && ((lambda <= lambdaPeak) && (lambda>0)))
if shrink
shrink=0;
factor = factor^.6;
%if ( abs(lambda)*(factor-1)*dxnorm< MINDX ) | ( abs(lambda)*(factor-1)< MINLAMB)
%if ( abs(lambda)*(factor-1)*dxnorm< MINDX ) || ( abs(lambda)*(factor-1)< MINLAMB)
if abs(factor-1)<MINDFAC
if abs(lambda)<4
retcode=4;
@ -186,7 +186,7 @@ else
done=1;
end
end
if ( f<fPeak ) & (lambda>0)
if ( f<fPeak ) && (lambda>0)
fPeak=f;
lambdaPeak=lambda;
if lambdaMax<=lambdaPeak

View File

@ -23,7 +23,7 @@ function [fh,xh,gh,H,itct,fcount,retcodeh] = csminwel1(fcn,x0,H0,grad,crit,nit,m
% http://sims.princeton.edu/yftp/optimize/mfiles/csminwel.m
% Copyright (C) 1993-2007 Christopher Sims
% Copyright (C) 2006-2010 Dynare Team
% Copyright (C) 2006-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -105,7 +105,7 @@ while ~done
% itct=itct+1;
fcount = fcount+fc;
% erased on 8/4/94
% if (retcode == 1) | (abs(f1-f) < crit)
% if (retcode == 1) || (abs(f1-f) < crit)
% done=1;
% end
% if itct > nit
@ -113,7 +113,7 @@ while ~done
% retcode = -retcode;
% end
if retcode1 ~= 1
if retcode1==2 | retcode1==4
if retcode1==2 || retcode1==4
wall1=1; badg1=1;
else
if NumGrad
@ -134,7 +134,7 @@ while ~done
%ARGLIST
%save g1 g1 x1 f1 P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13;
end
if wall1 % & (~done) by Jinill
if wall1 % && (~done) by Jinill
% Bad gradient or back and forth on step length. Possibly at
% cliff edge. Try perturbing search direction.
%
@ -147,7 +147,7 @@ while ~done
% P5,P6,P7,P8,P9,P10,P11,P12,P13);
fcount = fcount+fc; % put by Jinill
if f2 < f
if retcode2==2 | retcode2==4
if retcode2==2 || retcode2==4
wall2=1; badg2=1;
else
if NumGrad
@ -182,7 +182,7 @@ while ~done
% P4,P5,P6,P7,P8,...
% P9,P10,P11,P12,P13);
fcount = fcount+fc; % put by Jinill
if retcode3==2 | retcode3==4
if retcode3==2 || retcode3==4
wall3=1; badg3=1;
else
if NumGrad
@ -218,13 +218,13 @@ while ~done
f2=f;f3=f;f1=f;retcode2=retcode1;retcode3=retcode1;
end
%how to pick gh and xh
if f3 < f - crit & badg3==0 & f3 < f2 & f3 < f1
if f3 < f - crit && badg3==0 && f3 < f2 && f3 < f1
ih=3;
fh=f3;xh=x3;gh=g3;badgh=badg3;retcodeh=retcode3;
elseif f2 < f - crit & badg2==0 & f2 < f1
elseif f2 < f - crit && badg2==0 && f2 < f1
ih=2;
fh=f2;xh=x2;gh=g2;badgh=badg2;retcodeh=retcode2;
elseif f1 < f - crit & badg1==0
elseif f1 < f - crit && badg1==0
ih=1;
fh=f1;xh=x1;gh=g1;badgh=badg1;retcodeh=retcode1;
else
@ -271,7 +271,7 @@ while ~done
%gh
%badgh
stuck = (abs(fh-f) < crit);
if (~badg)&(~badgh)&(~stuck)
if (~badg) && (~badgh) && (~stuck)
H = bfgsi(H,gh-g,xh-x);
end
if Verbose
@ -293,7 +293,7 @@ while ~done
disp('smallest step still improving too slow, reversed gradient')
elseif rc == 5
disp('largest step still improving too fast')
elseif (rc == 4) | (rc==2)
elseif (rc == 4) || (rc==2)
disp('back and forth on step length never finished')
elseif rc == 3
disp('smallest step still improving too slow')

View File

@ -22,7 +22,7 @@ function [x,rc] = csolve(FUN,x,gradfun,crit,itmax,varargin)
% http://sims.princeton.edu/yftp/optimize/mfiles/csolve.m
% Copyright (C) 1993-2007 Christopher Sims
% Copyright (C) 2007 Dynare Team
% Copyright (C) 2007-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -66,7 +66,7 @@ af00=af0;
itct=0;
while ~done
% disp([af00-af0 crit*max(1,af0)])
if itct>3 & af00-af0<crit*max(1,af0) & rem(itct,2)==1
if itct>3 && af00-af0<crit*max(1,af0) && rem(itct,2)==1
randomize=1;
else
if ~analyticg
@ -117,14 +117,14 @@ while ~done
lambdamin=lambda;
xmin=x+dx;
end
if ((lambda >0) & (af0-af < alpha*lambda*af0)) | ((lambda<0) & (af0-af < 0) )
if ((lambda >0) && (af0-af < alpha*lambda*af0)) || ((lambda<0) && (af0-af < 0) )
if ~shrink
factor=factor^.6;
shrink=1;
end
if abs(lambda*(1-factor))*dxSize > .1*delta;
lambda = factor*lambda;
elseif (lambda > 0) & (factor==.6) %i.e., we've only been shrinking
elseif (lambda > 0) && (factor==.6) %i.e., we've only been shrinking
lambda=-.3;
else %
subDone=1;
@ -138,7 +138,7 @@ while ~done
rc=3;
end
end
elseif (lambda >0) & (af-af0 > (1-alpha)*lambda*af0)
elseif (lambda >0) && (af-af0 > (1-alpha)*lambda*af0)
if shrink
factor=factor^.6;
shrink=0;

View File

@ -113,7 +113,7 @@ end
k = [1:length(dens)];
if pshape(indx) ~= 5
[junk,k1] = max(dens);
if k1 == 1 | k1 == length(dens)
if k1 == 1 || k1 == length(dens)
k = find(dens < 10);
end
end

View File

@ -213,7 +213,7 @@ k = 1:size(J,2);
for i=1:n
if sum(abs(J(:,i))) < 1e-8
if m(i) < n1 | m(i) > n2
if m(i) < n1 || m(i) > n2
k(i) = 0;
m(i) = 0;
end

View File

@ -11,7 +11,7 @@ function dynare_estimation(var_list,varargin)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2010 Dynare Team
% Copyright (C) 2003-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -62,13 +62,13 @@ else
dynare_estimation_1(var_list,varargin{:});
end
if nnobs > 1 & horizon > 0
if nnobs > 1 && horizon > 0
mh_replic = options_.mh_replic;
rawdata = read_variables(options_.datafile,options_.varobs,[],options_.xls_sheet,options_.xls_range);
gend = options_.nobs;
rawdata = rawdata(options_.first_obs:options_.first_obs+gend-1,:);
% Take the log of the variables if needed
if options_.loglinear & ~options_.logdata % and if the data are not in logs, then...
if options_.loglinear && ~options_.logdata % and if the data are not in logs, then...
rawdata = log(rawdata);
end

View File

@ -77,10 +77,10 @@ if options_.prefilter == 1
end
%% Set options related to filtered variables.
if options_.filtered_vars ~= 0 & isempty(options_.filter_step_ahead),
if options_.filtered_vars ~= 0 && isempty(options_.filter_step_ahead),
options_.filter_step_ahead = 1;
end
if options_.filtered_vars ~= 0 & options_.filter_step_ahead == 0,
if options_.filtered_vars ~= 0 && options_.filter_step_ahead == 0,
options_.filter_step_ahead = 1;
end
if options_.filter_step_ahead ~= 0
@ -120,7 +120,7 @@ if ~isempty(estim_params_)
end
% Test if initial values of the estimated parameters are all between
% the prior lower and upper bounds.
if any(xparam1 < bounds(:,1)) | any(xparam1 > bounds(:,2))
if any(xparam1 < bounds(:,1)) || any(xparam1 > bounds(:,2))
find(xparam1 < bounds(:,1))
find(xparam1 > bounds(:,2))
error('Initial parameter values are outside parameter bounds')
@ -684,7 +684,7 @@ if ~options_.mh_posterior_mode_estimation
end
end
if options_.mode_check == 1 & ~options_.mh_posterior_mode_estimation
if options_.mode_check == 1 && ~options_.mh_posterior_mode_estimation
mode_check(xparam1,0,hh,gend,data,lb,ub,data_index,number_of_observations,no_more_missing_observations);
end
@ -703,7 +703,7 @@ else
end
if any(bayestopt_.pshape > 0) & ~options_.mh_posterior_mode_estimation
if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
disp(' ')
disp('RESULTS FROM POSTERIOR MAXIMIZATION')
tstath = zeros(nx,1);
@ -815,7 +815,7 @@ if any(bayestopt_.pshape > 0) & ~options_.mh_posterior_mode_estimation
disp(' ')
disp(sprintf('Log data density [Laplace approximation] is %f.',md_Laplace))
disp(' ')
elseif ~any(bayestopt_.pshape > 0) & options_.mh_posterior_mode_estimation
elseif ~any(bayestopt_.pshape > 0) && options_.mh_posterior_mode_estimation
disp(' ')
disp('RESULTS FROM MAXIMUM LIKELIHOOD')
tstath = zeros(nx,1);
@ -900,7 +900,7 @@ end
OutputDirectoryName = CheckPath('Output');
if any(bayestopt_.pshape > 0) & options_.TeX %% Bayesian estimation (posterior mode) Latex output
if any(bayestopt_.pshape > 0) && options_.TeX %% Bayesian estimation (posterior mode) Latex output
if np
filename = [OutputDirectoryName '/' M_.fname '_Posterior_Mode_1.TeX'];
fidTeX = fopen(filename,'w');
@ -1083,21 +1083,21 @@ if np > 0
save([M_.fname '_params.mat'],'pindx');
end
if (any(bayestopt_.pshape >0 ) & options_.mh_replic) | ...
(any(bayestopt_.pshape >0 ) & options_.load_mh_file) %% not ML estimation
if (any(bayestopt_.pshape >0 ) && options_.mh_replic) || ...
(any(bayestopt_.pshape >0 ) && options_.load_mh_file) %% not ML estimation
bounds = prior_bounds(bayestopt_);
bounds(:,1)=max(bounds(:,1),lb);
bounds(:,2)=min(bounds(:,2),ub);
bayestopt_.lb = bounds(:,1);
bayestopt_.ub = bounds(:,2);
if any(xparam1 < bounds(:,1)) | any(xparam1 > bounds(:,2))
if any(xparam1 < bounds(:,1)) || any(xparam1 > bounds(:,2))
find(xparam1 < bounds(:,1))
find(xparam1 > bounds(:,2))
error('Mode values are outside prior bounds. Reduce prior_trunc.')
end
% runs MCMC
if options_.mh_replic
if options_.load_mh_file & options_.use_mh_covariance_matrix
if options_.load_mh_file && options_.use_mh_covariance_matrix
invhess = compute_mh_covariance_matrix;
end
if options_.dsge_var
@ -1111,7 +1111,7 @@ if (any(bayestopt_.pshape >0 ) & options_.mh_replic) | ...
CutSample(M_, options_, estim_params_);
return
else
if ~options_.nodiagnostic & options_.mh_replic > 1000 & options_.mh_nblck > 1
if ~options_.nodiagnostic && options_.mh_replic > 1000 && options_.mh_nblck > 1
McMCDiagnostics(options_, estim_params_, M_);
end
%% Here i discard first half of the draws:
@ -1131,7 +1131,7 @@ if (any(bayestopt_.pshape >0 ) & options_.mh_replic) | ...
if options_.moments_varendo
oo_ = compute_moments_varendo('posterior',options_,M_,oo_,var_list_);
end
if options_.smoother | ~isempty(options_.filter_step_ahead) | options_.forecast
if options_.smoother || ~isempty(options_.filter_step_ahead) || options_.forecast
prior_posterior_statistics('posterior',data,gend,data_index,missing_value);
end
xparam = get_posterior_parameters('mean');
@ -1139,9 +1139,9 @@ if (any(bayestopt_.pshape >0 ) & options_.mh_replic) | ...
end
end
if (~((any(bayestopt_.pshape > 0) & options_.mh_replic) | (any(bayestopt_.pshape ...
> 0) & options_.load_mh_file)) ...
| ~options_.smoother ) & M_.endo_nbr^2*gend < 1e7 & options_.partial_information == 0 % to be fixed
if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.pshape ...
> 0) && options_.load_mh_file)) ...
|| ~options_.smoother ) && M_.endo_nbr^2*gend < 1e7 && options_.partial_information == 0 % to be fixed
%% ML estimation, or posterior mode without metropolis-hastings or metropolis without bayesian smooth variable
[atT,innov,measurement_error,updated_variables,ys,trend_coeff,aK,T,R,P,PK,decomp] = DsgeSmoother(xparam1,gend,data,data_index,missing_value);
oo_.Smoother.SteadyState = ys;
@ -1713,7 +1713,7 @@ if (~((any(bayestopt_.pshape > 0) & options_.mh_replic) | (any(bayestopt_.pshape
end
end
if options_.forecast > 0 & options_.mh_replic == 0 & ~options_.load_mh_file
if options_.forecast > 0 && options_.mh_replic == 0 && ~options_.load_mh_file
forecast(var_list_,'smoother');
end

View File

@ -75,7 +75,7 @@ if options_.steadystate_flag
% Check if the steady state obtained from the _steadystate file is a
% steady state.
check1 = 0;
if isfield(options_,'unit_root_vars') & options_.diffuse_filter == 0
if isfield(options_,'unit_root_vars') && options_.diffuse_filter == 0
if isempty(options_.unit_root_vars)
if ~options_.bytecode
check1 = max(abs(feval([M_.fname '_static'],...
@ -101,7 +101,7 @@ if info(1) > 0
print_info(info, options_.noprint)
end
if any(abs(oo_.steady_state(bayestopt_.mfys))>1e-9) & (options_.prefilter==1)
if any(abs(oo_.steady_state(bayestopt_.mfys))>1e-9) && (options_.prefilter==1)
disp(['You are trying to estimate a model with a non zero steady state for the observed endogenous'])
disp(['variables using demeaned data!'])
error('You should change something in your mod file...')

View File

@ -25,7 +25,7 @@ function [LIK, lik] = kalman_filter(T,R,Q,H,P,Y,start,mf,kalman_tol,riccati_tol)
% NOTES
% The vector "lik" is used to evaluate the jacobian of the likelihood.
% Copyright (C) 2004-2010 Dynare Team
% Copyright (C) 2004-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -55,7 +55,7 @@ oldK = Inf;
notsteady = 1; % Steady state flag.
F_singular = 1;
while notsteady & t<smpl
while notsteady && t<smpl
t = t+1;
v = Y(:,t)-a(mf);
F = P(mf,mf) + H;

View File

@ -12,7 +12,7 @@ function make_ex_
% SPECIAL REQUIREMENTS
%
% Copyright (C) 1996-2009 Dynare Team
% Copyright (C) 1996-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -36,7 +36,7 @@ options_ = set_default_option(options_,'periods',0);
if isempty(oo_.exo_steady_state)
oo_.exo_steady_state = zeros(M_.exo_nbr,1);
end
if M_.exo_det_nbr > 1 & isempty(oo_.exo_det_steady_state)
if M_.exo_det_nbr > 1 && isempty(oo_.exo_det_steady_state)
oo_.exo_det_steady_state = zeros(M_.exo_det_nbr,1);
end
if isempty(oo_.exo_simul)

View File

@ -15,7 +15,7 @@ function [marginal,oo_] = marginal_density(M_, options_, estim_params_, oo_)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2005-2009 Dynare Team
% Copyright (C) 2005-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -94,7 +94,7 @@ while check_coverage
marginal(linee,:) = [p, lpost_mode-log(tmp/((TotalNumberOfMhDraws-TODROP)*nblck))];
warning(warning_old_state);
end
if abs((marginal(9,2)-marginal(1,2))/marginal(9,2)) > 0.01 | isinf(marginal(1,2))
if abs((marginal(9,2)-marginal(1,2))/marginal(9,2)) > 0.01 || isinf(marginal(1,2))
if increase == 1
disp('MH: The support of the weighting density function is not large enough...')
disp('MH: I increase the variance of this distribution.')

View File

@ -16,7 +16,7 @@ function [ ix2, ilogpo2, ModelName, MhDirectoryName, fblck, fline, npar, nblck,
% SPECIAL REQUIREMENTS
% None.
% Copyright (C) 2006-2010 Dynare Team
% Copyright (C) 2006-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -51,7 +51,7 @@ npar = length(xparam1);
MAX_nruns = ceil(options_.MaxNumberOfBytes/(npar+2)/8);
d = chol(vv);
if ~options_.load_mh_file & ~options_.mh_recover
if ~options_.load_mh_file && ~options_.mh_recover
%% Here we start a new metropolis-hastings, previous draws are not
%% considered.
if nblck > 1
@ -90,9 +90,9 @@ if ~options_.load_mh_file & ~options_.mh_recover
validate = 0;
init_iter = 0;
trial = 1;
while validate == 0 & trial <= 10
while validate == 0 && trial <= 10
candidate = rand_multivariate_normal( transpose(xparam1), d * options_.mh_init_scale, npar);
if all(candidate(:) > mh_bounds(:,1)) & all(candidate(:) < mh_bounds(:,2))
if all(candidate(:) > mh_bounds(:,1)) && all(candidate(:) < mh_bounds(:,2))
ix2(j,:) = candidate;
ilogpo2(j) = - feval(TargetFun,ix2(j,:)',varargin{:});
if ilogpo2(j) <= - bayestopt_.penalty+1e-6
@ -108,7 +108,7 @@ if ~options_.load_mh_file & ~options_.mh_recover
end
end
init_iter = init_iter + 1;
if init_iter > 100 & validate == 0
if init_iter > 100 && validate == 0
disp(['MH: I couldn''t get a valid initial value in 100 trials.'])
disp(['MH: You should Reduce mh_init_scale...'])
disp(sprintf('MH: Parameter mh_init_scale is equal to %f.',options_.mh_init_scale))
@ -116,7 +116,7 @@ if ~options_.load_mh_file & ~options_.mh_recover
trial = trial+1;
end
end
if trial > 10 & ~validate
if trial > 10 && ~validate
disp(['MH: I''m unable to find a starting value for block ' int2str(j)])
return
end
@ -127,7 +127,7 @@ if ~options_.load_mh_file & ~options_.mh_recover
else% Case 2: one chain (we start from the posterior mode)
fprintf(fidlog,[' Initial values of the parameters:\n']);
candidate = transpose(xparam1);
if all(candidate' > mh_bounds(:,1)) & all(candidate' < mh_bounds(:,2))
if all(candidate' > mh_bounds(:,1)) && all(candidate' < mh_bounds(:,2))
ix2 = candidate;
ilogpo2 = - feval(TargetFun,ix2',varargin{:});
disp('MH: Initialization at the posterior mode.')
@ -197,7 +197,7 @@ if ~options_.load_mh_file & ~options_.mh_recover
end,
fprintf(fidlog,' \n');
fclose(fidlog);
elseif options_.load_mh_file & ~options_.mh_recover
elseif options_.load_mh_file && ~options_.mh_recover
%% Here we consider previous mh files (previous mh did not crash).
disp('MH: I''m loading past metropolis-hastings simulations...')
file = dir([ MhDirectoryName '/' ModelName '_mh_history.mat' ]);

View File

@ -24,7 +24,7 @@ function optimal_bandwidth = mh_optimal_bandwidth(data,number_of_draws,bandwidth
% [1] M. Skold and G.O. Roberts [2003], "Density estimation for the Metropolis-Hastings algorithm".
% [2] Silverman [1986], "Density estimation for statistics and data analysis".
% Copyright (C) 2004-2009 Dynare Team
% Copyright (C) 2004-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -91,7 +91,7 @@ end
%% Get the Skold and Roberts' correction.
if bandwidth==0 | bandwidth==-1
if bandwidth==0 || bandwidth==-1
correction = correction_for_repeated_draws(data,number_of_draws);
else
correction = 0;
@ -103,9 +103,9 @@ if bandwidth == 0; % Rule of thumb bandwidth parameter (Silverman [1986].
h = 2*sigma*(sqrt(pi)*mu02/(12*(mu21^2)*number_of_draws))^(1/5);
h = h*correction^(1/5);
elseif bandwidth == -1; % Sheather and Jones [1991] plug-in estimation of the optimal bandwidth parameter.
if strcmp(kernel_function,'uniform') | ...
strcmp(kernel_function,'triangle') | ...
strcmp(kernel_function,'epanechnikov') | ...
if strcmp(kernel_function,'uniform') || ...
strcmp(kernel_function,'triangle') || ...
strcmp(kernel_function,'epanechnikov') || ...
strcmp(kernel_function,'quartic')
error(['I can''t compute the optimal bandwidth with this kernel...' ...
'Try the gaussian, triweight or cosinus kernels.']);
@ -126,9 +126,9 @@ elseif bandwidth == -1; % Sheather and Jones [1991] plug-in estimation of the op
h = (correction*mu02/(number_of_draws*Ihat2*mu21^2))^(1/5); % equation (22) in Skold and Roberts [2003].
elseif bandwidth == -2; % Bump killing... I compute local bandwith parameters in order to remove
% spurious bumps introduced by long rejecting periods.
if strcmp(kernel_function,'uniform') | ...
strcmp(kernel_function,'triangle') | ...
strcmp(kernel_function,'epanechnikov') | ...
if strcmp(kernel_function,'uniform') || ...
strcmp(kernel_function,'triangle') || ...
strcmp(kernel_function,'epanechnikov') || ...
strcmp(kernel_function,'quartic')
error(['I can''t compute the optimal bandwidth with this kernel...' ...
'Try the gaussian, triweight or cosinus kernels.']);
@ -136,7 +136,7 @@ elseif bandwidth == -2; % Bump killing... I compute local bandwith parameter
T = zeros(n,1);
for i=1:n
j = i;
while j<= n & (data(j,1)-data(i,1))<2*eps;
while j<= n && (data(j,1)-data(i,1))<2*eps;
j = j+1;
end
T(i) = (j-i);

View File

@ -97,7 +97,7 @@ epsilonhat = zeros(rr,smpl);
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;
di = data_index{t};
if isempty(di)
@ -160,7 +160,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;
P(:,:,t)=tril(P(:,:,t))+transpose(tril(P(:,:,t),-1));
di = data_index{t};

View File

@ -113,7 +113,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);
Pstar1(:,:,t) = Pstar(:,:,t);
@ -125,7 +125,7 @@ while newRank & t < smpl
Fstar(i,t) = Zi*Pstar(:,:,t)*Zi' +H(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';
Kinf_Finf = Kinf(:,i,t)/Finf(i,t);
@ -172,7 +172,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);
P1(:,:,t) = P(:,:,t);
@ -254,7 +254,7 @@ if d
for t = d:-1:1
di = flipud(data_index{t})';
for i = di
% 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,:)' + ...

View File

@ -62,7 +62,7 @@ else
% testing if ys isn't a steady state or if we aren't computing Ramsey policy
fh = str2func([M_.fname '_static']);
if max(abs(feval(fh,oo_.steady_state,[oo_.exo_steady_state; oo_.exo_det_steady_state], M_.params))) ...
> options_.dynatol & options_.ramsey_policy == 0
> options_.dynatol && options_.ramsey_policy == 0
if options_.linear == 0
% nonlinear models
[dr.ys,check1] = dynare_solve(fh,dr.ys,options_.jacobian_flag,...

View File

@ -125,7 +125,7 @@ if ~isreal(dr.ys)
end
dr.fbias = zeros(M_.endo_nbr,1);
if( (options_.partial_information ==1) | (options_.ACES_solver==1))%&& (check_flag == 0)
if( (options_.partial_information ==1) || (options_.ACES_solver==1))%&& (check_flag == 0)
[dr,info,M_,options_,oo_] = dr1_PI(dr,check_flag,M_,options_,oo_);
else
[dr,info,M_,options_,oo_] = dr1(dr,check_flag,M_,options_,oo_);

View File

@ -90,7 +90,7 @@ try
end
warning('on','MATLAB:singularMatrix');
warning('on','MATLAB:nearlySingularMatrix');
if (isinf(UAVinv) | isnan(UAVinv))
if (isinf(UAVinv) || isnan(UAVinv))
if(options_.useACES==1)
disp('ERROR! saving PI_gensys_data_dump');
save PI_gensys_data_dump
@ -232,14 +232,14 @@ for i=1:nn
% bug detected by Vasco Curdia and Daria Finocchiaro, 2/25/2004 A root of
% exactly 1.01 and no root between 1 and 1.02, led to div being stuck at 1.01
% and the 1.01 root being misclassified as stable. Changing < to <= below fixes this.
if 1+realsmall<divhat & divhat<=div
if 1+realsmall<divhat && divhat<=div
div=.5*(1+divhat);
end
end
end
% ----------------------------------------
nunstab=nunstab+(abs(b(i,i))>div*abs(a(i,i)));
if abs(a(i,i))<realsmall & abs(b(i,i))<realsmall
if abs(a(i,i))<realsmall && abs(b(i,i))<realsmall
zxz=1;
end
end
@ -257,7 +257,7 @@ if zxz
nmat=[]; %;gev=[]
return
end
if (FL_RANK ~= nunstab & options_.ACES_solver~=1)
if (FL_RANK ~= nunstab && options_.ACES_solver~=1)
disp(['Number of unstable variables ' num2str(nunstab)]);
disp( ['does not match number of expectational equations ' num2str(FL_RANK)]);
nmat=[];% gev=[];

View File

@ -78,7 +78,7 @@ if (options_.order > 1)
end
% expanding system for Optimal Linear Regulator
if options_.ramsey_policy & options_.ACES_solver == 0
if options_.ramsey_policy && options_.ACES_solver == 0
if isfield(M_,'orig_model')
orig_model = M_.orig_model;
M_.endo_nbr = orig_model.endo_nbr;
@ -194,7 +194,7 @@ end % end if useAIM and...
%end
if isfield(lq_instruments,'names')
num_inst=size(lq_instruments.names,1);
if ~isfield(lq_instruments,'inst_var_indices') & num_inst>0
if ~isfield(lq_instruments,'inst_var_indices') && num_inst>0
for i=1:num_inst
i_tmp = strmatch(deblank(lq_instruments.names(i,:)),M_.endo_names,'exact');
if isempty(i_tmp)
@ -213,7 +213,7 @@ end % end if useAIM and...
i_var=[];
num_inst=0;
end
if size(i_var,2)>0 & size(i_var,2)==num_inst
if size(i_var,2)>0 && size(i_var,2)==num_inst
m_var=zeros(nendo,1);
for i=1:nendo
if isempty(find(i_var==i))
@ -262,7 +262,7 @@ end % end if useAIM and...
fnd = find(lead_lag(:,M_.maximum_lag+2));
AA0(:, fnd)= jacobia_(:,nonzeros(lead_lag(:,M_.maximum_lag+2))); %forwd jacobian
end
if npred>0 & M_.maximum_lag ==1
if npred>0 && M_.maximum_lag ==1
fnd = find(lead_lag(:,1));
AA2(:, fnd)= jacobia_(:,nonzeros(lead_lag(:,1))); %backward
end
@ -285,7 +285,7 @@ end % end if useAIM and...
lq_instruments.B0=[lq_instruments.ij0; eye(num_inst)];
AA0=[AA0, zeros(xlen,num_inst); zeros(num_inst,xlen+num_inst)];
end
if npred>0 & M_.maximum_lag ==1
if npred>0 && M_.maximum_lag ==1
AA_all(:,:)=0.0;
fnd = find(lead_lag(:,1));
AA_all(:, fnd)= jacobia_(:,nonzeros(lead_lag(:,1))); %backward
@ -353,7 +353,7 @@ end % end if useAIM and...
end
% reuse some of the bypassed code and tests that may be needed
if eu ~=[1; 1] & options_.ACES_solver==0
if eu ~=[1; 1] && options_.ACES_solver==0
info(1) = abs(eu(1)+eu(2));
info(2) = 1.0e+8;
% return

View File

@ -10,6 +10,7 @@ function [A,B,Q,Z] = qzdiv(stake,A,B,Q,Z)
% http://sims.princeton.edu/yftp/gensys/mfiles/qzdiv.m
% Copyright (C) 1993-2007 Christopher Sims
% Copyright (C) 2008-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -33,7 +34,7 @@ root(:,2) = root(:,2)./root(:,1);
for i = n:-1:1
m=0;
for j=i:-1:1
if (root(j,2) > stake | root(j,2) < -.1)
if (root(j,2) > stake || root(j,2) < -.1)
m=j;
break
end

View File

@ -14,6 +14,7 @@ function [A,B,Q,Z] = qzswitch(i,A,B,Q,Z)
% http://sims.princeton.edu/yftp/gensys/mfiles/qzswitch.m
% Copyright (C) 1993-2007 Christopher Sims
% Copyright (C) 2008-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -36,7 +37,7 @@ a = A(i,i); d = B(i,i); b = A(i,i+1); e = B(i,i+1);
c = A(i+1,i+1); f = B(i+1,i+1);
% A(i:i+1,i:i+1)=[a b; 0 c];
% B(i:i+1,i:i+1)=[d e; 0 f];
if (abs(c)<realsmall & abs(f)<realsmall)
if (abs(c)<realsmall && abs(f)<realsmall)
if abs(a)<realsmall
% l.r. coincident 0's with u.l. of A=0; do nothing
return
@ -47,7 +48,7 @@ if (abs(c)<realsmall & abs(f)<realsmall)
wz=[wz [wz(2)';-wz(1)'] ];
xy=eye(2);
end
elseif (abs(a)<realsmall & abs(d)<realsmall)
elseif (abs(a)<realsmall && abs(d)<realsmall)
if abs(c)<realsmall
% u.l. coincident zeros with l.r. of A=0; do nothing
return

View File

@ -122,7 +122,7 @@ else
if options_.steadystate_flag,
NamFileInput(length(NamFileInput)+1,:)={'',[ModelName '_steadystate.m']};
end
if (options_.load_mh_file~=0) & any(fline>1) ,
if (options_.load_mh_file~=0) && any(fline>1) ,
NamFileInput(length(NamFileInput)+1,:)={[M_.dname '/metropolis/'],[ModelName '_mh' int2str(NewFile(1)) '_blck*.mat']};
end
if exist([ModelName '_optimal_mh_scale_parameter.mat'])

View File

@ -136,7 +136,7 @@ for b = fblck:nblck,
jloop=jloop+1;
randn('state',record.Seeds(b).Normal);
rand('state',record.Seeds(b).Unifor);
if (options_.load_mh_file~=0) & (fline(b)>1) & OpenOldFile(b)
if (options_.load_mh_file~=0) && (fline(b)>1) && OpenOldFile(b)
load(['./' MhDirectoryName '/' ModelName '_mh' int2str(NewFile(b)) ...
'_blck' int2str(b) '.mat'])
x2 = [x2;zeros(InitSizeArray(b)-fline(b)+1,npar)];
@ -177,7 +177,7 @@ for b = fblck:nblck,
j = 1;
while j <= nruns(b)
par = feval(ProposalFun, ix2(b,:), proposal_covariance_Cholesky_decomposition, n);
if all( par(:) > mh_bounds(:,1) ) & all( par(:) < mh_bounds(:,2) )
if all( par(:) > mh_bounds(:,1) ) && all( par(:) < mh_bounds(:,2) )
try
logpost = - feval(TargetFun, par(:),varargin{:});
catch
@ -210,22 +210,22 @@ for b = fblck:nblck,
fprintf([s0,'%s'],newString);
end
end
if mod(j,50)==0 & whoiam
if mod(j,50)==0 && whoiam
% keyboard;
waitbarString = [ '(' int2str(b) '/' int2str(options_.mh_nblck) '), ' sprintf('accept. %3.f%%', 100 * isux/j)];
fMessageStatus((b-fblck)/(nblck-fblck+1)+prtfrc/(nblck-fblck+1),whoiam,waitbarString, '', options_.parallel(ThisMatlab));
end
else
if mod(j, 3)==0 & ~whoiam
if mod(j, 3)==0 && ~whoiam
waitbar(prtfrc,hh,[ '(' int2str(b) '/' int2str(options_.mh_nblck) ') ' sprintf('%f done, acceptation rate %f',prtfrc,isux/j)]);
elseif mod(j,50)==0 & whoiam,
elseif mod(j,50)==0 && whoiam,
% keyboard;
waitbarString = [ '(' int2str(b) '/' int2str(options_.mh_nblck) ') ' sprintf('%f done, acceptation rate %f',prtfrc,isux/j)];
fMessageStatus(prtfrc,whoiam,waitbarString, waitbarTitle, options_.parallel(ThisMatlab));
end
end
if (irun == InitSizeArray(b)) | (j == nruns(b)) % Now I save the simulations
if (irun == InitSizeArray(b)) || (j == nruns(b)) % Now I save the simulations
save([MhDirectoryName '/' ModelName '_mh' int2str(NewFile(b)) '_blck' int2str(b) '.mat'],'x2','logpo2');
fidlog = fopen([MhDirectoryName '/metropolis.log'],'a');
fprintf(fidlog,['\n']);
@ -238,7 +238,7 @@ for b = fblck:nblck,
fprintf(fidlog,[' params:' int2str(i) ': ' num2str(mean(x2(:,i))) '\n']);
end
fprintf(fidlog,[' log2po:' num2str(mean(logpo2)) '\n']);
fprintf(fidlog,[' Minimum value.........:\n']);;
fprintf(fidlog,[' Minimum value.........:\n']);
for i=1:length(x2(1,:))
fprintf(fidlog,[' params:' int2str(i) ': ' num2str(min(x2(:,i))) '\n']);
end

View File

@ -17,7 +17,7 @@ function dyn_data_01=read_variables(file_name_01,var_names_01,dyn_data_01,xls_sh
% all local variables have complicated names in order to avoid name
% conflicts with possible user variable names
% Copyright (C) 2005-2009 Dynare Team
% Copyright (C) 2005-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -50,7 +50,7 @@ if exist(file_name_01)
eval(dyn_instr_01);
for dyn_i_01=1:var_size_01
dyn_tmp_01 = eval(var_names_01(dyn_i_01,:));
if length(dyn_tmp_01) > dyn_size_01 & dyn_size_01 > 0
if length(dyn_tmp_01) > dyn_size_01 && dyn_size_01 > 0
cd(old_pwd)
error('data size is too large')
end
@ -61,7 +61,7 @@ elseif exist([file_name_01 '.mat'])
s = load(file_name_01);
for dyn_i_01=1:var_size_01
dyn_tmp_01 = s.(deblank(var_names_01(dyn_i_01,:)));
if length(dyn_tmp_01) > dyn_size_01 & dyn_size_01 > 0
if length(dyn_tmp_01) > dyn_size_01 && dyn_size_01 > 0
cd(old_pwd)
error('data size is too large')
end
@ -73,7 +73,7 @@ elseif exist([file_name_01 '.xls'])
for dyn_i_01=1:var_size_01
iv = strmatch(var_names_01(dyn_i_01,:),raw(1,:),'exact');
dyn_tmp_01 = [raw{2:end,iv}]';
if length(dyn_tmp_01) > dyn_size_01 & dyn_size_01 > 0
if length(dyn_tmp_01) > dyn_size_01 && dyn_size_01 > 0
cd(old_pwd)
error('data size is too large')
end

View File

@ -18,7 +18,7 @@ function set_shocks(flag,k,ivar,values)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2009 Dynare Team
% Copyright (C) 2003-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -40,9 +40,9 @@ global oo_ M_
k = k + M_.maximum_lag;
n1 = size(oo_.exo_simul,1);
n2 = size(oo_.exo_det_simul,1);
if k(end) > n1 & flag <= 1
if k(end) > n1 && flag <= 1
oo_.exo_simul = [oo_.exo_simul; repmat(oo_.exo_steady_state',k(end)-n1,1)];
elseif k(end) > n2 & flag > 1
elseif k(end) > n2 && flag > 1
oo_.exo_det_simul = [oo_.exo_det_simul; repmat(oo_.exo_det_steady_state',k(end)-n2,1)];
end

View File

@ -69,7 +69,7 @@ if ~ options_.initval_file
end
end
if isempty(options_.scalv) | options_.scalv == 0
if isempty(options_.scalv) || options_.scalv == 0
options_.scalv = oo_.steady_state ;
end

View File

@ -42,7 +42,7 @@ function y = solve_two_boundaries(fname, y, x, params, y_index, nze, periods, y_
% none.
%
% Copyright (C) 1996-2010 Dynare Team
% Copyright (C) 1996-2011 Dynare Team
%
% This file is part of Dynare.
%
@ -72,7 +72,7 @@ max_resa=1e100;
Jacobian_Size=Blck_size*(y_kmin+y_kmax_l +periods);
g1=spalloc( Blck_size*periods, Jacobian_Size, nze*periods);
reduced = 0;
while ~(cvg==1 | iter>maxit_),
while ~(cvg==1 || iter>maxit_),
[r, y, g1, g2, g3, b]=feval(fname, y, x, params, periods, 0, y_kmin, Blck_size);
% fjac = zeros(Blck_size, Blck_size*(y_kmin_l+1+y_kmax_l));
% disp(['Blck_size=' int2str(Blck_size) ' size(y_index)=' int2str(size(y_index,2))]);
@ -146,16 +146,16 @@ while ~(cvg==1 | iter>maxit_),
% else
% max_res=max(max(abs(r)));
% end;
if(~isreal(max_res) | isnan(max_res))
if(~isreal(max_res) || isnan(max_res))
cvg = 0;
elseif(is_linear & iter>0)
elseif(is_linear && iter>0)
cvg = 1;
else
cvg=(max_res<solve_tolf);
end;
if(~cvg)
if(iter>0)
if(~isreal(max_res) | isnan(max_res) | (max_resa<max_res && iter>1))
if(~isreal(max_res) || isnan(max_res) || (max_resa<max_res && iter>1))
if(~isreal(max_res))
disp(['Variable ' M_.endo_names(max_indx,:) ' (' int2str(max_indx) ') returns an undefined value']);
end;
@ -257,7 +257,7 @@ while ~(cvg==1 | iter>maxit_),
while(flag1>0)
[L1, U1]=luinc(g1a,luinc_tol);
[za,flag1] = gmres(g1a,b,Blck_size,1e-6,Blck_size*periods,L1,U1);
if (flag1>0 | reduced)
if (flag1>0 || reduced)
if(flag1==1)
disp(['Error in simul: No convergence inside GMRES after ' num2str(periods*10,'%6d') ' iterations, in block' num2str(Block_Size,'%3d')]);
elseif(flag1==2)
@ -278,7 +278,7 @@ while ~(cvg==1 | iter>maxit_),
while(flag1>0)
[L1, U1]=luinc(g1a,luinc_tol);
[za,flag1] = bicgstab(g1a,b,1e-7,Blck_size*periods,L1,U1);
if (flag1>0 | reduced)
if (flag1>0 || reduced)
if(flag1==1)
disp(['Error in simul: No convergence inside BICGSTAB after ' num2str(periods*10,'%6d') ' iterations, in block' num2str(Block_Size,'%3d')]);
elseif(flag1==2)

View File

@ -96,7 +96,7 @@ ipred = nstatic+(1:npred)';
% Compute stationary variables (before HP filtering),
% and compute 2nd order mean correction on stationary variables (in case of
% HP filtering, this mean correction is computed *before* filtering)
if options_.order == 2 | options_.hp_filter == 0
if options_.order == 2 || options_.hp_filter == 0
[vx, u] = lyapunov_symm(A,B*M_.Sigma_e*B',options_.qz_criterium,options_.lyapunov_complex_threshold);
iky = inv_order_var(ivar);
stationary_vars = (1:length(ivar))';