Merge branch 'master' of https://github.com/DynareTeam/dynare
commit
9aee761879
|
@ -3600,6 +3600,12 @@ default value, mandatory option.
|
|||
The number of periods used to compute the approximate solution
|
||||
at every iteration of the algorithm. Default: @code{200}.
|
||||
|
||||
@item order = @var{INTEGER}
|
||||
... Default: @code{0}.
|
||||
|
||||
@item hybrid
|
||||
...
|
||||
|
||||
@end table
|
||||
|
||||
@end deffn
|
||||
|
|
|
@ -105,6 +105,8 @@ switch nargin
|
|||
end
|
||||
else
|
||||
switch a
|
||||
case 'Y'
|
||||
date.freq = 1;
|
||||
case 'Q'
|
||||
date.freq = 4;
|
||||
case 'M'
|
||||
|
@ -112,8 +114,9 @@ switch nargin
|
|||
case 'W'
|
||||
date.freq = 52;
|
||||
otherwise
|
||||
% Yearly data are assumed.
|
||||
date.freq = 1;
|
||||
error(['dynDate:: With one string argument of length one, ' ...
|
||||
'you must provide one of weekly (''W''), monthly (''M''), ' ...
|
||||
'quaterly (''Q'') or yearly (''Y'').']);
|
||||
end
|
||||
end
|
||||
elseif isa(a,'dynDate') % If input argument is a dynDate object then do a copy.
|
||||
|
|
|
@ -301,7 +301,7 @@ for i = 1:Size;
|
|||
if maximum_lead > 0 && n_fwrd > 0
|
||||
data(i).eigval = - jacob(1 , n_pred + n - n_fwrd + 1 : n_pred + n) / jacob(1 , n_pred + n + 1 : n_pred + n + n_fwrd) ;
|
||||
data(i).rank = sum(abs(data(i).eigval) > 0);
|
||||
full_rank = (abs(jacob(1,n_pred+n+1: n_pred_n+n_fwrd)) > 1e-9);
|
||||
full_rank = (abs(jacob(1,n_pred+n+1: n_pred+n+n_fwrd)) > 1e-9);
|
||||
else
|
||||
data(i).eigval = [];
|
||||
data(i).rank = 0;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
function oo = evaluate_smoother(parameters)
|
||||
function oo = evaluate_smoother(parameters,var_list)
|
||||
% Evaluate the smoother at parameters.
|
||||
%
|
||||
% INPUTS
|
||||
% o parameters a string ('posterior mode','posterior mean','posterior median','prior mode','prior mean') or a vector of values for
|
||||
% the (estimated) parameters of the model.
|
||||
% o var_list subset of endogenous variables
|
||||
%
|
||||
%
|
||||
% OUTPUTS
|
||||
|
@ -24,7 +25,7 @@ function oo = evaluate_smoother(parameters)
|
|||
% [1] This function use persistent variables for the dataset and the description of the missing observations. Consequently, if this function
|
||||
% is called more than once (by changing the value of parameters) the sample *must not* change.
|
||||
|
||||
% Copyright (C) 2010-2012 Dynare Team
|
||||
% Copyright (C) 2010-2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -41,10 +42,17 @@ function oo = evaluate_smoother(parameters)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
global options_ M_ bayestopt_ oo_
|
||||
global options_ M_ bayestopt_ oo_ estim_params_ % estim_params_ may be emty
|
||||
|
||||
persistent dataset_
|
||||
|
||||
|
||||
if isempty(dataset_) || isempty(bayestopt_)
|
||||
options = options_;
|
||||
options.smoother = 1; % this is necessary because of a check in dynare_estimation_init()
|
||||
[dataset_,xparam1, M_, options_, oo_, estim_params_,bayestopt_] = dynare_estimation_init(var_list, M_.fname, [], M_, options, oo_, estim_params_, bayestopt_);
|
||||
end
|
||||
|
||||
if nargin==0
|
||||
parameters = 'posterior_mode';
|
||||
end
|
||||
|
@ -78,49 +86,6 @@ if ischar(parameters)
|
|||
end
|
||||
end
|
||||
|
||||
if isempty(dataset_)
|
||||
% Load and transform data.
|
||||
transformation = [];
|
||||
if options_.loglinear && ~options_.logdata
|
||||
transformation = @log;
|
||||
end
|
||||
xls.sheet = options_.xls_sheet;
|
||||
xls.range = options_.xls_range;
|
||||
|
||||
if ~isfield(options_,'nobs')
|
||||
options_.nobs = [];
|
||||
end
|
||||
|
||||
dataset_ = initialize_dataset(options_.datafile,options_.varobs,options_.first_obs,options_.nobs,transformation,options_.prefilter,xls);
|
||||
options_.nobs = dataset_.info.ntobs;
|
||||
|
||||
% Determine if a constant is needed.
|
||||
if options_.steadystate_flag% if the *_steadystate.m file is provided.
|
||||
[ys,params,info] = evaluate_steady_state(oo_.steady_state,M_,options_,oo_,1);
|
||||
if size(ys,1) < M_.endo_nbr
|
||||
if length(M_.aux_vars) > 0
|
||||
ys = add_auxiliary_variables_to_steadystate(ys,M_.aux_vars,...
|
||||
M_.fname,...
|
||||
zeros(M_.exo_nbr,1),...
|
||||
oo_.exo_det_steady_state,...
|
||||
M_.params,...
|
||||
options_.bytecode);
|
||||
else
|
||||
error([M_.fname '_steadystate.m doesn''t match the model']);
|
||||
end
|
||||
end
|
||||
oo_.steady_state = ys;
|
||||
else% if the steady state file is not provided.
|
||||
[dd,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
|
||||
oo_.steady_state = dd.ys; clear('dd');
|
||||
end
|
||||
if all(abs(oo_.steady_state(bayestopt_.mfys))<1e-9)
|
||||
options_.noconstant = 1;
|
||||
else
|
||||
options_.noconstant = 0;
|
||||
end
|
||||
end
|
||||
|
||||
pshape_original = bayestopt_.pshape;
|
||||
bayestopt_.pshape = Inf(size(bayestopt_.pshape));
|
||||
clear('priordens')
|
||||
|
|
|
@ -72,7 +72,16 @@ function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadysta
|
|||
fh_static = str2func([M.fname '_static']);
|
||||
[fvec,jacob] = fh_static(ys_init,exo_ss, ...
|
||||
params);
|
||||
if max(abs(fvec)) > 1e-12
|
||||
|
||||
ii = find(~isfinite(fvec));
|
||||
if ~isempty(ii)
|
||||
ys=fvec;
|
||||
check=1;
|
||||
disp(['STEADY: numerical initial values or parameters incompatible with the following' ...
|
||||
' equations'])
|
||||
disp(ii')
|
||||
disp('Check whether your model in truly linear')
|
||||
elseif isempty(ii) && max(abs(fvec)) > 1e-12
|
||||
ys = ys_init-jacob\fvec;
|
||||
else
|
||||
ys = ys_init;
|
||||
|
@ -94,6 +103,9 @@ function [ys,params,info] = evaluate_steady_state(ys_init,M,options,oo,steadysta
|
|||
resid = evaluate_static_model(ys_init,exo_ss,params,M,options);
|
||||
end
|
||||
info(2) = resid'*resid ;
|
||||
if isnan(info(2))
|
||||
info(1)=22;
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ function oo_ = shock_decomposition(M_,oo_,options_,varlist)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2009-2011 Dynare Team
|
||||
% Copyright (C) 2009-2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -57,7 +57,7 @@ if isempty(parameter_set)
|
|||
end
|
||||
end
|
||||
|
||||
oo = evaluate_smoother(parameter_set);
|
||||
oo = evaluate_smoother(parameter_set,varlist);
|
||||
|
||||
% reduced form
|
||||
dr = oo.dr;
|
||||
|
|
|
@ -68,6 +68,11 @@ g3 = [];
|
|||
Blck_size=size(y_index,2);
|
||||
correcting_factor=0.01;
|
||||
ilu_setup.droptol=1e-10;
|
||||
ilu_setup.type = 'ilutp';
|
||||
%ilu_setup.milu = 'col';
|
||||
ilu_setup.milu = 'off';
|
||||
ilu_setup.thresh = 1;
|
||||
ilu_setup.udiag = 0;
|
||||
max_resa=1e100;
|
||||
Jacobian_Size=Blck_size*(y_kmin+y_kmax_l +periods);
|
||||
g1=spalloc( Blck_size*periods, Jacobian_Size, nze*periods);
|
||||
|
@ -244,7 +249,10 @@ while ~(cvg==1 || iter>maxit_),
|
|||
elseif(stack_solve_algo==3),
|
||||
flag1=1;
|
||||
while(flag1>0)
|
||||
if (preconditioner == 3)
|
||||
if preconditioner == 2
|
||||
[L1, U1]=ilu(g1a,ilu_setup);
|
||||
[za,flag1] = bicgstab(g1a,b,1e-7,Blck_size*periods,L1,U1);
|
||||
elseif (preconditioner == 3)
|
||||
Size = Blck_size;
|
||||
gss0 = g1a(Size + 1: 2*Size,1: Size) + g1a(Size + 1: 2*Size,Size+1: 2*Size) + g1a(Size + 1: 2*Size,2*Size+1: 3*Size);
|
||||
[L1, U1]=lu(gss0);
|
||||
|
|
|
@ -183,12 +183,12 @@ dynSparseMatrix::dynSparseMatrix()
|
|||
}
|
||||
|
||||
dynSparseMatrix::dynSparseMatrix(const int y_size_arg, const int y_kmin_arg, const int y_kmax_arg, const bool print_it_arg, const bool steady_state_arg, const int periods_arg,
|
||||
const int minimal_solving_periods_arg
|
||||
const int minimal_solving_periods_arg, const double slowc_arg
|
||||
#ifdef CUDA
|
||||
, const int CUDA_device_arg, cublasHandle_t cublas_handle_arg, cusparseHandle_t cusparse_handle_arg, cusparseMatDescr_t descr_arg
|
||||
#endif
|
||||
):
|
||||
Evaluate(y_size_arg, y_kmin_arg, y_kmax_arg, print_it_arg, steady_state_arg, periods_arg, minimal_solving_periods_arg)
|
||||
Evaluate(y_size_arg, y_kmin_arg, y_kmax_arg, print_it_arg, steady_state_arg, periods_arg, minimal_solving_periods_arg, slowc_arg)
|
||||
{
|
||||
pivotva = NULL;
|
||||
g_save_op = NULL;
|
||||
|
@ -3197,6 +3197,15 @@ dynSparseMatrix::End_Solver()
|
|||
End_Matlab_LU_UMFPack();
|
||||
}
|
||||
|
||||
void
|
||||
dynSparseMatrix::Print_UMFPack(SuiteSparse_long *Ap, SuiteSparse_long *Ai, double *Ax, int n)
|
||||
{
|
||||
int k = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
for (int j = Ap[i]; j < Ap[i+1]; j++)
|
||||
mexPrintf("(%d, %d) %f\n", Ai[j]+1, i+1, Ax[k++]);
|
||||
}
|
||||
|
||||
void
|
||||
dynSparseMatrix::Solve_LU_UMFPack(SuiteSparse_long *Ap, SuiteSparse_long *Ai, double *Ax, double *b, int n, int Size, double slowc_l, bool is_two_boundaries, int it_)
|
||||
{
|
||||
|
@ -3702,15 +3711,18 @@ dynSparseMatrix::Solve_CUDA_BiCGStab(int *Ap, int *Ai, double *Ax, int *Ap_tild,
|
|||
mxSetFieldByNumber(Setup, 0, droptol, mxCreateDoubleScalar(lu_inc_tol));
|
||||
mxSetFieldByNumber(Setup, 0, milu, mxCreateString("off"));
|
||||
mxSetFieldByNumber(Setup, 0, udiag, mxCreateDoubleScalar(0));
|
||||
mxSetFieldByNumber(Setup, 0, thresh, mxCreateDoubleScalar(0));
|
||||
mxSetFieldByNumber(Setup, 0, thresh, mxCreateDoubleScalar(1));
|
||||
//mxSetFieldByNumber(Setup, 0, thresh, mxCreateDoubleScalar(1));
|
||||
mxArray *lhs0[2];
|
||||
mxArray *rhs0[2];
|
||||
rhs0[0] = A_m;
|
||||
rhs0[1] = Setup;
|
||||
mexCallMATLAB(2, lhs0, 2, rhs0, "ilu");
|
||||
L1 = lhs0[0];
|
||||
U1 = lhs0[1];
|
||||
ostringstream tmp;
|
||||
if (mexCallMATLAB(2, lhs0, 2, rhs0, "ilu"))
|
||||
{
|
||||
tmp << " In BiCGStab, the incomplet LU decomposition (ilu) ahs failed.\n";
|
||||
throw FatalExceptionHandling(tmp.str());
|
||||
}
|
||||
mxDestroyArray(Setup);
|
||||
|
||||
|
||||
|
@ -4221,7 +4233,6 @@ dynSparseMatrix::Solve_CUDA_BiCGStab(int *Ap, int *Ai, double *Ax, int *Ap_tild,
|
|||
if (preconditioner == 3)
|
||||
{
|
||||
double *p_tild;
|
||||
mexPrintf("n=%d\n",n);
|
||||
|
||||
cudaChk(cudaMemcpy(tmp_vect_host, p, n*sizeof(double), cudaMemcpyDeviceToHost), " in Solve_Cuda_BiCGStab, cudaMemcpy tmp_vect_host = p has failed\n");
|
||||
/*mexPrintf("p\n");
|
||||
|
@ -4716,22 +4727,24 @@ dynSparseMatrix::Solve_Matlab_BiCGStab(mxArray *A_m, mxArray *b_m, int Size, dou
|
|||
mwSize dims[1] = {(mwSize)1 };
|
||||
mxArray *Setup = mxCreateStructArray(1, dims, 5, field_names);
|
||||
mxSetFieldByNumber(Setup, 0, type, mxCreateString("ilutp"));
|
||||
//mxSetFieldByNumber(Setup, 0, type, mxCreateString("nofill"));
|
||||
mxSetFieldByNumber(Setup, 0, droptol, mxCreateDoubleScalar(lu_inc_tol));
|
||||
mxSetFieldByNumber(Setup, 0, milu, mxCreateString("off"));
|
||||
mxSetFieldByNumber(Setup, 0, udiag, mxCreateDoubleScalar(0));
|
||||
mxSetFieldByNumber(Setup, 0, thresh, mxCreateDoubleScalar(0));
|
||||
//mxSetFieldByNumber(Setup, 0, thresh, mxCreateDoubleScalar(1));
|
||||
mxSetFieldByNumber(Setup, 0, thresh, mxCreateDoubleScalar(1));
|
||||
mxArray *lhs0[2];
|
||||
mxArray *rhs0[2];
|
||||
rhs0[0] = A_m;
|
||||
rhs0[1] = Setup;
|
||||
mexCallMATLAB(2, lhs0, 2, rhs0, "ilu");
|
||||
if (mexCallMATLAB(2, lhs0, 2, rhs0, "ilu"))
|
||||
{
|
||||
ostringstream tmp;
|
||||
tmp << " In BiCGStab, the incomplet LU decomposition (ilu) ahs failed.\n";
|
||||
throw FatalExceptionHandling(tmp.str());
|
||||
}
|
||||
L1 = lhs0[0];
|
||||
U1 = lhs0[1];
|
||||
mxDestroyArray(Setup);
|
||||
}
|
||||
|
||||
double flags = 2;
|
||||
mxArray *z;
|
||||
if (steady_state) /*Octave BicStab algorihtm involves a 0 division in case of a preconditionner equal to the LU decomposition of A matrix*/
|
||||
|
@ -6068,6 +6081,7 @@ dynSparseMatrix::Simulate_One_Boundary(int block_num, int y_size, int y_kmin, in
|
|||
mxArray *b_m = NULL, *A_m = NULL, *x0_m = NULL;
|
||||
SuiteSparse_long *Ap = NULL, *Ai = NULL;
|
||||
double *Ax = NULL, *b = NULL;
|
||||
int preconditioner = 1;
|
||||
|
||||
|
||||
try_at_iteration = 0;
|
||||
|
@ -6138,10 +6152,12 @@ dynSparseMatrix::Simulate_One_Boundary(int block_num, int y_size, int y_kmin, in
|
|||
mexPrintf("MODEL STEADY STATE: Sparse LU\n");
|
||||
break;
|
||||
case 7:
|
||||
mexPrintf("MODEL STEADY STATE: (method=GMRES)\n");
|
||||
mexPrintf(preconditioner_print_out("MODEL STEADY STATE: (method=GMRES)\n", preconditioner, true).c_str());
|
||||
//mexPrintf("MODEL STEADY STATE: (method=GMRES)\n");
|
||||
break;
|
||||
case 8:
|
||||
mexPrintf("MODEL STEADY STATE: (method=BiCGStab)\n");
|
||||
mexPrintf(preconditioner_print_out("MODEL STEADY STATE: (method=BiCGStab)\n", preconditioner, true).c_str());
|
||||
//mexPrintf("MODEL STEADY STATE: (method=BiCGStab)\n");
|
||||
break;
|
||||
default:
|
||||
mexPrintf("MODEL STEADY STATE: (method=Unknown - %d - )\n", stack_solve_algo);
|
||||
|
@ -6224,7 +6240,7 @@ dynSparseMatrix::Simulate_One_Boundary(int block_num, int y_size, int y_kmin, in
|
|||
else if ((solve_algo == 7 && steady_state) || (stack_solve_algo == 2 && !steady_state))
|
||||
Solve_Matlab_GMRES(A_m, b_m, size, slowc, block_num, false, it_, x0_m);
|
||||
else if ((solve_algo == 8 && steady_state) || (stack_solve_algo == 3 && !steady_state))
|
||||
Solve_Matlab_BiCGStab(A_m, b_m, size, slowc, block_num, false, it_, x0_m, 1);
|
||||
Solve_Matlab_BiCGStab(A_m, b_m, size, slowc, block_num, false, it_, x0_m, preconditioner);
|
||||
else if ((solve_algo == 6 && steady_state) || ((stack_solve_algo == 0 || stack_solve_algo == 1 || stack_solve_algo == 4) && !steady_state))
|
||||
Solve_LU_UMFPack(Ap, Ai, Ax, b, size, size, slowc, true, 0);
|
||||
}
|
||||
|
@ -6339,20 +6355,26 @@ dynSparseMatrix::Simulate_Newton_One_Boundary(const bool forward)
|
|||
}
|
||||
|
||||
string
|
||||
dynSparseMatrix::preconditioner_print_out(string s, int preconditioner)
|
||||
dynSparseMatrix::preconditioner_print_out(string s, int preconditioner, bool ss)
|
||||
{
|
||||
int n = s.length();
|
||||
string tmp = ", preconditioner=";
|
||||
switch(preconditioner)
|
||||
{
|
||||
case 0:
|
||||
tmp.append("Jacobi on dynamic jacobian");
|
||||
if (ss)
|
||||
tmp.append("Jacobi on static jacobian");
|
||||
else
|
||||
tmp.append("Jacobi on dynamic jacobian");
|
||||
break;
|
||||
case 1:
|
||||
tmp.append("incomplet lu0 on dynamic jacobian");
|
||||
if (ss)
|
||||
tmp.append("incomplet lutp on static jacobian");
|
||||
else
|
||||
tmp.append("incomplet lu0 on dynamic jacobian");
|
||||
break;
|
||||
case 2:
|
||||
tmp.append("incomplet lut on dynamic jacobian");
|
||||
tmp.append("incomplet lutp on dynamic jacobian");
|
||||
break;
|
||||
case 3:
|
||||
tmp.append("lu on static jacobian");
|
||||
|
@ -6526,10 +6548,10 @@ dynSparseMatrix::Simulate_Newton_Two_Boundaries(int blck, int y_size, int y_kmin
|
|||
mexPrintf("MODEL SIMULATION: (method=Relaxation)\n");
|
||||
break;
|
||||
case 2:
|
||||
mexPrintf(preconditioner_print_out("MODEL SIMULATION: (method=GMRES)\n", preconditioner).c_str());
|
||||
mexPrintf(preconditioner_print_out("MODEL SIMULATION: (method=GMRES)\n", preconditioner, false).c_str());
|
||||
break;
|
||||
case 3:
|
||||
mexPrintf(preconditioner_print_out("MODEL SIMULATION: (method=BiCGStab)\n", preconditioner).c_str());
|
||||
mexPrintf(preconditioner_print_out("MODEL SIMULATION: (method=BiCGStab)\n", preconditioner, false).c_str());
|
||||
break;
|
||||
case 4:
|
||||
mexPrintf("MODEL SIMULATION: (method=Sparse LU & optimal path length)\n");
|
||||
|
@ -6538,7 +6560,7 @@ dynSparseMatrix::Simulate_Newton_Two_Boundaries(int blck, int y_size, int y_kmin
|
|||
mexPrintf("MODEL SIMULATION: (method=ByteCode own solver)\n");
|
||||
break;
|
||||
case 7:
|
||||
mexPrintf(preconditioner_print_out("MODEL SIMULATION: (method=GPU BiCGStab)\n", preconditioner).c_str());
|
||||
mexPrintf(preconditioner_print_out("MODEL SIMULATION: (method=GPU BiCGStab)\n", preconditioner, false).c_str());
|
||||
break;
|
||||
default:
|
||||
mexPrintf("MODEL SIMULATION: (method=Unknown - %d - )\n", stack_solve_algo);
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
typedef int64_t SuiteSparse_long;
|
||||
#endif
|
||||
dynSparseMatrix();
|
||||
dynSparseMatrix(const int y_size_arg, const int y_kmin_arg, const int y_kmax_arg, const bool print_it_arg, const bool steady_state_arg, const int periods_arg, const int minimal_solving_periods_arg
|
||||
dynSparseMatrix(const int y_size_arg, const int y_kmin_arg, const int y_kmax_arg, const bool print_it_arg, const bool steady_state_arg, const int periods_arg, const int minimal_solving_periods_arg, const double slowc_arg
|
||||
#ifdef CUDA
|
||||
,const int CUDA_device_arg, cublasHandle_t cublas_handle_arg, cusparseHandle_t cusparse_handle_arg, cusparseMatDescr_t descr_arg
|
||||
#endif
|
||||
|
@ -141,6 +141,7 @@ private:
|
|||
bool Solve_ByteCode_Sparse_GaussianElimination(int Size, int blck, int it_);
|
||||
void Solve_Matlab_Relaxation(mxArray *A_m, mxArray *b_m, unsigned int Size, double slowc_l, bool is_two_boundaries, int it_);
|
||||
void Solve_Matlab_LU_UMFPack(mxArray *A_m, mxArray *b_m, int Size, double slowc_l, bool is_two_boundaries, int it_);
|
||||
void Print_UMFPack(SuiteSparse_long *Ap, SuiteSparse_long *Ai, double *Ax, int n);
|
||||
void Solve_LU_UMFPack(mxArray *A_m, mxArray *b_m, int Size, double slowc_l, bool is_two_boundaries, int it_);
|
||||
void Solve_LU_UMFPack(SuiteSparse_long *Ap, SuiteSparse_long *Ai, double *Ax, double *b, int n, int Size, double slowc_l, bool is_two_boundaries, int it_);
|
||||
void End_Matlab_LU_UMFPack();
|
||||
|
@ -157,7 +158,7 @@ private:
|
|||
bool Simulate_One_Boundary(int blck, int y_size, int y_kmin, int y_kmax, int Size, bool cvg);
|
||||
bool solve_linear(const int block_num, const int y_size, const int y_kmin, const int y_kmax, const int size, const int iter);
|
||||
void solve_non_linear(const int block_num, const int y_size, const int y_kmin, const int y_kmax, const int size);
|
||||
string preconditioner_print_out(string s, int preconditioner);
|
||||
string preconditioner_print_out(string s, int preconditioner, bool ss);
|
||||
bool compare(int *save_op, int *save_opa, int *save_opaa, int beg_t, int periods, long int nop4, int Size
|
||||
#ifdef PROFILER
|
||||
, long int *ndiv, long int *nsub
|
||||
|
@ -237,7 +238,7 @@ protected:
|
|||
int u_count_alloc, u_count_alloc_save;
|
||||
vector<double *> jac;
|
||||
double *jcb;
|
||||
double slowc, slowc_save, prev_slowc_save, markowitz_c;
|
||||
double slowc_save, prev_slowc_save, markowitz_c;
|
||||
int y_decal;
|
||||
int *index_equa;
|
||||
int u_count, tbreak_g;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
TOP_DIR=/Users/Houtan/Documents/DYNARE/PACKAGES
|
||||
|
@ -7,8 +6,9 @@ TOP_DYN_DIR=$TOP_DIR/dynare
|
|||
|
||||
VERSION=4.3
|
||||
INSTALLDIRNAME=dynare-$VERSION-osx
|
||||
mkdir $INSTALLDIRNAME
|
||||
INSTALLDIR=$TOP_DIR/$INSTALLDIRNAME
|
||||
mkdir $INSTALLDIRNAME
|
||||
|
||||
|
||||
########################
|
||||
# UPDATE DYNARE SOURCE #
|
||||
|
@ -22,9 +22,9 @@ autoreconf -si
|
|||
########################
|
||||
# create directories
|
||||
mkdir "$INSTALLDIR/scripts"
|
||||
mkdir "$INSTALLDIR/dynare++"
|
||||
mkdir -p "$INSTALLDIR/doc/dynare++"
|
||||
mkdir "$INSTALLDIR/doc/dynare.html"
|
||||
mkdir "$INSTALLDIR/dynare++"
|
||||
mkdir -p "$INSTALLDIR/contrib/ms-sbvar/TZcode"
|
||||
mkdir -p "$INSTALLDIR/mex/octave"
|
||||
mkdir -p "$INSTALLDIR/mex/matlab/osx64"
|
||||
|
@ -47,8 +47,13 @@ cp -r $TOP_DYN_DIR/examples $INSTALLDIR
|
|||
##########################################################
|
||||
# FIRST BUILD 32 BIT EVERYTHING, 32 BIT MATLAB < 7.5 MEX #
|
||||
##########################################################
|
||||
./configure FFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch i386' CPPFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch i386' LDFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch i386' --with-matlab=/Applications/MATLAB/R2007a MATLAB_VERSION=7.4 --with-gsl=/usr/local32 --with-slicot=/usr/local32 --with-matio=/usr/local32
|
||||
./configure FFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch i386' CPPFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch i386' LDFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch i386' --with-matlab=/Applications/MATLAB_OLD/R2007a MATLAB_VERSION=7.4 --with-slicot=/usr/local32 --disable-octave --with-matio=/usr/localStatic --with-gsl=/usr/localStatic
|
||||
cd $TOP_DYN_DIR/doc
|
||||
texi2dvi --pdf --batch --build-dir=dynare.t2p dynare.texi
|
||||
|
||||
cd $TOP_DYN_DIR
|
||||
make pdf
|
||||
make html
|
||||
|
||||
cd $TOP_DYN_DIR/preprocessor
|
||||
make
|
||||
|
@ -74,6 +79,7 @@ cp $TOP_DYN_DIR/preprocessor/dynare_m $INSTALLDIR/mat
|
|||
cp $TOP_DYN_DIR/mex/build/matlab/block_kalman_filter/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.4
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/bytecode/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.4
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/dynare_simul_/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.4
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/estimation/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.4
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/gensylv/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.4
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/k_order_perturbation/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.4
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/kalman_steady_state/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.4
|
||||
|
@ -112,13 +118,14 @@ cp $TOP_DYN_DIR/dynare++/kord/kord.pdf
|
|||
##############################################
|
||||
make clean
|
||||
cd $TOP_DYN_DIR/mex/build/matlab
|
||||
./configure FFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch i386' CPPFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch i386' LDFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch i386' --with-matlab=/Applications/MATLAB/MATLAB_R2009b_32bit/MATLAB_R2009b.app MATLAB_VERSION=7.9 MEXEXT='mexmaci' --with-gsl=/usr/local32 --with-slicot=/usr/local32 --with-matio=/usr/local32
|
||||
./configure FFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch i386' CPPFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch i386' LDFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch i386' --with-matlab=/Applications/MATLAB_OLD/MATLAB_R2009b_32bit/MATLAB_R2009b.app MATLAB_VERSION=7.9 MEXEXT='mexmaci' --with-slicot=/usr/local32 --with-matio=/usr/localStatic --with-gsl=/usr/localStatic
|
||||
make
|
||||
|
||||
# Matlab
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/block_kalman_filter/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.5-7.11
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/bytecode/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.5-7.11
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/dynare_simul_/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.5-7.11
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/estimation/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.5-7.11
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/gensylv/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.5-7.11
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/k_order_perturbation/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.5-7.11
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/kalman_steady_state/*.mexmaci $INSTALLDIR/mex/matlab/osx32-7.5-7.11
|
||||
|
@ -134,13 +141,14 @@ cp $TOP_DYN_DIR/mex/build/matlab/sobol/*.mexmaci
|
|||
#####################################
|
||||
make clean
|
||||
cd $TOP_DYN_DIR/mex/build/matlab
|
||||
./configure --with-matlab=/Applications/MATLAB/MATLAB_R2009b.app MATLAB_VERSION=7.9
|
||||
./configure --with-matlab=/Applications/MATLAB_OLD/MATLAB_R2009b.app MATLAB_VERSION=7.9 MEXEXT=mexmaci64 --with-matio=/usr/localStatic --with-gsl=/usr/localStatic
|
||||
make
|
||||
|
||||
# Matlab
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/block_kalman_filter/*.mexmaci64 $INSTALLDIR/mex/matlab/osx64
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/bytecode/*.mexmaci64 $INSTALLDIR/mex/matlab/osx64
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/dynare_simul_/*.mexmaci64 $INSTALLDIR/mex/matlab/osx64
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/estimation/*.mexmaci64 $INSTALLDIR/mex/matlab/osx64
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/gensylv/*.mexmaci64 $INSTALLDIR/mex/matlab/osx64
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/k_order_perturbation/*.mexmaci64 $INSTALLDIR/mex/matlab/osx64
|
||||
cp $TOP_DYN_DIR/mex/build/matlab/kalman_steady_state/*.mexmaci64 $INSTALLDIR/mex/matlab/osx64
|
||||
|
@ -155,17 +163,19 @@ cp $TOP_DYN_DIR/mex/build/matlab/sobol/*.mexmaci64
|
|||
#####################################
|
||||
make clean
|
||||
cd $TOP_DYN_DIR/mex/build/octave
|
||||
./configure
|
||||
./configure CC="gcc" CXX="g++" --with-matio=/usr/localStatic --with-gsl=/usr/localStatic
|
||||
make
|
||||
|
||||
# Octave
|
||||
cp $TOP_DYN_DIR/mex/build/octave/block_kalman_filter/*.mex $INSTALLDIR/mex/octave
|
||||
cp $TOP_DYN_DIR/mex/build/octave/bytecode/*.mex $INSTALLDIR/mex/octave
|
||||
cp $TOP_DYN_DIR/mex/build/octave/dynare_simul_/*.mex $INSTALLDIR/mex/octave
|
||||
cp $TOP_DYN_DIR/mex/build/octave/estimation/*.mex $INSTALLDIR/mex/octave
|
||||
cp $TOP_DYN_DIR/mex/build/octave/gensylv/*.mex $INSTALLDIR/mex/octave
|
||||
cp $TOP_DYN_DIR/mex/build/octave/k_order_perturbation/*.mex $INSTALLDIR/mex/octave
|
||||
cp $TOP_DYN_DIR/mex/build/octave/kalman_steady_state/*.mex $INSTALLDIR/mex/octave
|
||||
cp $TOP_DYN_DIR/mex/build/octave/kronecker/*.mex $INSTALLDIR/mex/octave
|
||||
cp $TOP_DYN_DIR/mex/build/octave/linsolve/*.oct $INSTALLDIR/mex/octave
|
||||
cp $TOP_DYN_DIR/mex/build/octave/local_state_space_iterations/*.mex $INSTALLDIR/mex/octave
|
||||
cp $TOP_DYN_DIR/mex/build/octave/mjdgges/*.mex $INSTALLDIR/mex/octave
|
||||
cp $TOP_DYN_DIR/mex/build/octave/ms_sbvar/*.mex $INSTALLDIR/mex/octave
|
||||
|
@ -186,5 +196,3 @@ find . -name *.DS_Store -type f -exec rm {} \;
|
|||
chmod -R g+w $INSTALLDIR
|
||||
|
||||
echo DONE
|
||||
# NEED TO BUILD DYNARE.HTML DOCUMENTION ON DEBIAN
|
||||
# AND INCLUDE IN DISTRIBUTION BY HAND
|
||||
|
|
|
@ -358,6 +358,11 @@ EstimationStatement::writeOutput(ostream &output, const string &basename) const
|
|||
else if (atoi(it->second.c_str()) == 2)
|
||||
output << "options_.particle.status = 1;" << endl;
|
||||
|
||||
// Do not check for the steady state in diffuse filter mode (#400)
|
||||
it = options_list.num_options.find("diffuse_filter");
|
||||
if (it != options_list.num_options.end() && it->second == "1")
|
||||
output << "options_.steadystate.nocheck = 1;" << endl;
|
||||
|
||||
symbol_list.writeOutput("var_list_", output);
|
||||
output << "dynare_estimation(var_list_);\n";
|
||||
}
|
||||
|
@ -2435,9 +2440,10 @@ ExtendedPathStatement::writeOutput(ostream &output, const string &basename) cons
|
|||
{
|
||||
// Beware: options do not have the same name in the interface and in the M code...
|
||||
|
||||
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("solver_periods");
|
||||
if (it != options_list.num_options.end())
|
||||
output << "options_.ep.periods = " << it->second << ";" << endl;
|
||||
for (OptionsList::num_options_t::const_iterator it = options_list.num_options.begin();
|
||||
it != options_list.num_options.end(); ++it)
|
||||
if (it->first != string("periods"))
|
||||
output << "options_." << it->first << " = " << it->second << ";" << endl;
|
||||
|
||||
output << "oo_.endo_simul = [ oo_.steady_state, extended_path([], " << options_list.num_options.find("periods")->second
|
||||
<< ") ];" << endl
|
||||
|
|
|
@ -103,7 +103,7 @@ class ParsingDriver;
|
|||
%token DEFAULT FIXED_POINT
|
||||
%token FORECAST K_ORDER_SOLVER INSTRUMENTS PRIOR SHIFT MEAN STDEV VARIANCE MODE INTERVAL SHAPE DOMAINN
|
||||
%token GAMMA_PDF GRAPH GRAPH_FORMAT CONDITIONAL_VARIANCE_DECOMPOSITION NOCHECK STD
|
||||
%token HISTVAL HOMOTOPY_SETUP HOMOTOPY_MODE HOMOTOPY_STEPS HOMOTOPY_FORCE_CONTINUE HP_FILTER HP_NGRID
|
||||
%token HISTVAL HOMOTOPY_SETUP HOMOTOPY_MODE HOMOTOPY_STEPS HOMOTOPY_FORCE_CONTINUE HP_FILTER HP_NGRID HYBRID
|
||||
%token IDENTIFICATION INF_CONSTANT INITVAL INITVAL_FILE BOUNDS JSCALE INIT
|
||||
%token <string_val> INT_NUMBER
|
||||
%token <string_val> DATE_NUMBER
|
||||
|
@ -2229,6 +2229,8 @@ extended_path_options_list : extended_path_option COMMA extended_path_options_li
|
|||
|
||||
extended_path_option : o_periods
|
||||
| o_solver_periods
|
||||
| o_extended_path_order
|
||||
| o_hybrid
|
||||
;
|
||||
|
||||
model_diagnostics : MODEL_DIAGNOSTICS ';'
|
||||
|
@ -2262,7 +2264,9 @@ o_irf_shocks : IRF_SHOCKS EQUAL '(' symbol_list ')' { driver.option_symbol_list(
|
|||
o_hp_filter : HP_FILTER EQUAL non_negative_number { driver.option_num("hp_filter", $3); };
|
||||
o_hp_ngrid : HP_NGRID EQUAL INT_NUMBER { driver.option_num("hp_ngrid", $3); };
|
||||
o_periods : PERIODS EQUAL INT_NUMBER { driver.option_num("periods", $3); };
|
||||
o_solver_periods : SOLVER_PERIODS EQUAL INT_NUMBER { driver.option_num("solver_periods", $3); };
|
||||
o_solver_periods : SOLVER_PERIODS EQUAL INT_NUMBER { driver.option_num("ep.periods", $3); };
|
||||
o_extended_path_order : ORDER EQUAL INT_NUMBER { driver.option_num("ep.stochastic.order", $3); };
|
||||
o_hybrid : HYBRID { driver.option_num("ep.stochastic.hybrid_order", "2"); };
|
||||
o_maxit : MAXIT EQUAL INT_NUMBER { driver.option_num("maxit_", $3); };
|
||||
o_solve_maxit : SOLVE_MAXIT EQUAL INT_NUMBER { driver.option_num("solve_maxit", $3); };
|
||||
o_cutoff : CUTOFF EQUAL non_negative_number { driver.cutoff($3); };
|
||||
|
|
|
@ -159,6 +159,7 @@ string eofbuff;
|
|||
/* End of a Dynare statement */
|
||||
<INITIAL>calib_smoother { BEGIN DYNARE_STATEMENT; return token::CALIB_SMOOTHER; }
|
||||
<INITIAL>model_diagnostics {BEGIN DYNARE_STATEMENT; return token::MODEL_DIAGNOSTICS;}
|
||||
<INITIAL>extended_path {BEGIN DYNARE_STATEMENT; return token::EXTENDED_PATH;}
|
||||
|
||||
<DYNARE_STATEMENT>; {
|
||||
if (!sigma_e)
|
||||
|
@ -185,7 +186,6 @@ string eofbuff;
|
|||
<INITIAL>homotopy_setup {BEGIN DYNARE_BLOCK; return token::HOMOTOPY_SETUP;}
|
||||
<INITIAL>conditional_forecast_paths {BEGIN DYNARE_BLOCK; return token::CONDITIONAL_FORECAST_PATHS;}
|
||||
<INITIAL>svar_identification {BEGIN DYNARE_BLOCK; return token::SVAR_IDENTIFICATION;}
|
||||
<INITIAL>extended_path {BEGIN DYNARE_BLOCK; return token::EXTENDED_PATH;}
|
||||
|
||||
/* For the semicolon after an "end" keyword */
|
||||
<INITIAL>; {return Dynare::parser::token_type (yytext[0]);}
|
||||
|
@ -310,6 +310,7 @@ string eofbuff;
|
|||
<DYNARE_STATEMENT>cycle_reduction {return token::CYCLE_REDUCTION;}
|
||||
<DYNARE_STATEMENT>logarithmic_reduction {return token::LOGARITHMIC_REDUCTION;}
|
||||
<DYNARE_STATEMENT>use_univariate_filters_if_singularity_is_detected {return token::USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED;}
|
||||
<DYNARE_STATEMENT>hybrid {return token::HYBRID;}
|
||||
<DYNARE_STATEMENT>default {return token::DEFAULT;}
|
||||
<DYNARE_STATEMENT>alpha {
|
||||
yylval->string_val = new string(yytext);
|
||||
|
|
Loading…
Reference in New Issue