Merge branch 'master' of ssh://kirikou.dynare.org/srv/d_kirikou/git/dynare

time-shift
Johannes Pfeifer 2012-08-05 13:02:51 +02:00
commit cf2e477e58
10 changed files with 76 additions and 54 deletions

View File

@ -1,4 +1,4 @@
dnl Copyright (C) 2009-2011 Dynare Team
dnl Copyright (C) 2009-2012 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
@ -62,7 +62,7 @@ case ${MATLAB_ARCH} in
ax_mexopts_ok="yes"
;;
maci | maci64)
SDKROOT='/Developer/SDKs/MacOSX10.6.sdk'
SDKROOT='/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk'
MACOSX_DEPLOYMENT_TARGET='10.6'
if test "${MATLAB_ARCH}" = "maci"; then
ARCHS='i386'

View File

@ -35,7 +35,9 @@ function [fval,grad,hess,exit_flag,info,PHI,SIGMAu,iXX,prior] = DsgeVarLikelihoo
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% Declaration of the persistent variables.
persistent penalty dsge_prior_weight_idx
persistent dsge_prior_weight_idx
penalty = BayesInfo.penalty;
grad=[];
hess=[];
@ -46,16 +48,6 @@ SIGMAu = [];
iXX = [];
prior = [];
% Initialization of the penalty
if ~nargin || isempty(penalty)
penalty = 1e8;
if ~nargin, return, end
end
if nargin==1
penalty = xparam1;
return
end
% Initialization of of the index for parameter dsge_prior_weight in Model.params.
if isempty(dsge_prior_weight_idx)
dsge_prior_weight_idx = strmatch('dsge_prior_weight',Model.param_names);

View File

@ -644,11 +644,11 @@ else % flgresume
end
% initialize random number generator
if ischar(opts.Seed)
randn('state', eval(opts.Seed)); % random number generator state
else
randn('state', opts.Seed);
end
% $$$ if ischar(opts.Seed)
% $$$ randn('state', eval(opts.Seed)); % random number generator state
% $$$ else
% $$$ randn('state', opts.Seed);
% $$$ end
%qqq
% load(opts.SaveFilename, 'startseed');
% randn('state', startseed);

View File

@ -130,22 +130,7 @@ function [fval,DLIK,Hess,exit_flag,ys,trend_coeff,info,Model,DynareOptions,Bayes
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT FR
% Declaration of the penalty as a persistent variable.
% Persistent variable 'penalty' is used to compute an endogenous penalty to
% the value 'fval' when various conditions are encountered. These conditions
% set also 'exit_flag' equal to 0 instead of 1. It is only when
% dsge_likelihood() is called by an optimizer called by
% dynare_estimation_1() that 'exit_flag' is ignored and penalized 'fval' is
% actually used.
% In that case, 'penalty' is properly initialized, at the very end of the
% present function, by a call to dsge_likelihood() made in
% initial_estimation_checks(). If a condition triggers exit_flag ==
% 0, initial_estimation_checks() triggers an error.
% In summary, an initial call to the present function, without triggering
% any condition, guarantees that 'penalty' is properly initialized when needed.
persistent penalty
penalty = BayesInfo.penalty;
% Initialization of the returned variables and others...
fval = [];
@ -568,16 +553,16 @@ if analytic_derivation,
if full_Hess
DTj = DT(:,:,j+offset);
DPj = dum;
for i=1:j,
DTi = DT(:,:,i+offset);
DPi = DP(:,:,i+offset);
D2Tij = D2T(:,:,i,j);
D2Omij = D2Om(:,:,i,j);
for i=1:j+offset,
DTi = DT(:,:,i);
DPi = DP(:,:,i);
D2Tij = D2T(:,:,i,j+offset);
D2Omij = D2Om(:,:,i,j+offset);
tmp = D2Tij*Pstar*T' + T*Pstar*D2Tij' + DTi*DPj*T' + DTj*DPi*T' + T*DPj*DTi' + T*DPi*DTj' + DTi*Pstar*DTj' + DTj*Pstar*DTi' + D2Omij;
dum = lyapunov_symm(T,tmp,DynareOptions.qz_criterium,DynareOptions.lyapunov_complex_threshold);
dum(abs(dum)<1.e-12) = 0;
D2P(:,:,i+offset,j+offset) = dum;
D2P(:,:,j+offset,i+offset) = dum;
D2P(:,:,i,j+offset) = dum;
D2P(:,:,j+offset,i) = dum;
end
end
end
@ -771,9 +756,6 @@ end
% Update DynareOptions.kalman_algo.
DynareOptions.kalman_algo = kalman_algo;
% Update the penalty.
penalty = fval;
if analytic_derivation==0 && nargout==2,
lik=lik(start:end,:);
DLIK=[-lnprior; lik(:)];

View File

@ -159,7 +159,7 @@ for i=1:n1
xx = x(:,m);
y(:,(i-1)*n1*n2+(j-1)*n2+k) = xx;
if j ~= i
y(:,(j-1)*n1*n2+(i-1)*n2+i) = xx;
y(:,(j-1)*n1*n2+(i-1)*n2+k) = xx;
end
end
end

View File

@ -0,0 +1,53 @@
% [err, g_0, g_1, g_2, g_3, derivs] = k_order_perturbation(dr,DynareModel,DynareOptions)
% computes a k_order_petrubation solution for k=1,2,3
%
% INPUTS
% dr: struct describing the reduced form solution of the model.
% DynareModel: struct jobs's parameters
% DynareOptions: struct job's options
%
% OUTPUTS
% err: double err code (currently unused)
% g_0: vector dynare++ output. Constant effect of future volatility (in
% dr.order_var order) on the decision rule
% (=ghs2/2). Contains zero when order of
% approximation is 1.
% g_1: matrix dynare++ output. First order Taylor coefficients
% of decision rule. When order of approximation
% is 3, the. Contains both the effect of
% state endogenous variable and shocks. The rows
% are in dr.order_var order. The columns are in
% dr.order_var order of state endogenous
% variables and shocks
% g_2: matrix dynare++ output. Second order Taylor coefficients of decision
% rule. Contains both the effect of state endogenous
% variable and shocks. The rows are in dr.order_var
% order. Each row corresponds to the vectorized
% version of the lower triangle of the Hessian
% matrix. The Taylor coefficient (1/2) is
% included. The columns of the Hessian matrix are in
% dr.order_var order of state endogenous variables
% and shocks
% g_3: matrix dynare++ output. Third order Taylor coefficients of decision
% rule. Contains both the effect of state endogenous
% variable and shocks. The rows are in dr.order_var
% order. Each row corresponds to the vectorized
% version of the 3rd order derivatives tensor where each
% combination of variables appears only once.
% The Taylor coefficient (1/6) is
% included. Inside the tensor, the variables are in
% dr.order_var order of state endogenous variables
% and shocks
% derivs struct contains the original derivatives of the
% decision function (ghx, ghu, ghxx, ghxu, ghuu,
% ghs2, ghxxx, ghxxu, ghxuu,ghuuu, ghxss, ghuss),
% keeping the effect of future volatility
% separate (in ghs2, ghxss and ghuss). The
% derivatives matrices contain full versions of
% the Hessian matrices and 3rd order
% tensor. Symmetric derivatives are repeated. The
% Taylor coefficients (1/2 and 1/6) aren't
% included.
% k_order_peturbation is a compiled MEX function. It's source code is in
% dynare/mex/sources/k_order_perturbation.cc and it uses code provided by
% dynare++

View File

@ -180,9 +180,6 @@ if ~options_.load_mh_file && ~options_.mh_recover
% separate initializaton for each chain
JSUM = 0;
for j=1:nblck,
JSUM = JSUM + sum(100*clock);
randn('state',JSUM);
rand('state',JSUM);
record.Seeds(j).Normal = randn('state');
record.Seeds(j).Unifor = rand('state');
end

View File

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
dnl Copyright (C) 2009-2011 Dynare Team
dnl Copyright (C) 2009-2012 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
@ -17,7 +17,7 @@ dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ([2.61])
AC_PREREQ([2.62])
AC_INIT([dynare], [4.4-unstable])
AC_CONFIG_SRCDIR([configure.ac])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

View File

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
dnl Copyright (C) 2009-2011 Dynare Team
dnl Copyright (C) 2009-2012 Dynare Team
dnl
dnl This file is part of Dynare.
dnl
@ -17,7 +17,7 @@ dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ([2.61])
AC_PREREQ([2.62])
AC_INIT([dynare], [4.4-unstable])
AC_CONFIG_SRCDIR([configure.ac])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

View File

@ -260,8 +260,6 @@ extern "C" {
// run stochastic steady
app.walkStochSteady();
app.get_rule_ders()->print();
/* Write derivative outputs into memory map */
map<string, ConstTwoDMatrix> mm;
app.getFoldDecisionRule().writeMMap(mm, string());