From 32f66d2d357e90a8335ff11de41f0fc9602ac5fb Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Fri, 24 Jul 2015 12:33:28 +0200 Subject: [PATCH] write more output to modfilename.jl --- julia/DynareModel.jl | 20 ++++++++++++++++---- preprocessor/ModFile.cc | 25 ++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/julia/DynareModel.jl b/julia/DynareModel.jl index 6c45d6776..8bb735bfe 100644 --- a/julia/DynareModel.jl +++ b/julia/DynareModel.jl @@ -56,9 +56,18 @@ immutable AuxVars orig_expr::UTF8String end +immutable DetShocks + exo_det::Int + exo_id::Int + multiplicative::Bool + periods::Array{Int,1} + value::Float64 +end + type Model fname::ASCIIString dname::ASCIIString + dynare_version::ASCIIString endo::Array{Endo,1} exo::Array{Exo,1} exo_det::Array{ExoDet,1} @@ -70,6 +79,7 @@ type Model orig_eq_nbr::Int eq_nbr::Int ramsey_eq_nbr::Int + det_shocks::Array{DetShocks,1} nstatic::Int nfwrd::Int npred::Int @@ -99,6 +109,7 @@ end function model() return Model("", # fname "", # dname + "", # dynare_version Array(Endo,0), # endo Array(Exo,0), # exo Array(ExoDet,0), # exo_det @@ -110,6 +121,7 @@ function model() 0, # orig_eq_nbr 0, # eq_nbr 0, # ramsey_eq_nbr + Array(DetShocks,0), # det_shocks 0, # nstatic 0, # nfwrd 0, # npred @@ -128,10 +140,10 @@ function model() false, # static_and_dynamic_models_differ Array(ASCIIString,0), # equations_tags Array(Int64,1), # exo_names_orig_ord - Array(Float64, 0, 0), # sigma_e (Covariance matrix of the structural innovations) - Array(Float64, 0, 0), # correlation_matrix (Correlation matrix of the structural innovations) - Array(Float64, 0, 0), # h (Covariance matrix of the measurement errors) - Array(Float64, 0, 0), # correlation_matrix_me (Covariance matrixof the measurement errors) + Array(Float64, 0, 0), # sigma_e (Cov matrix of the structural innovations) + Array(Float64, 0, 0), # correlation_matrix (Corr matrix of the structural innovations) + Array(Float64, 0, 0), # h (Cov matrix of the measurement errors) + Array(Float64, 0, 0), # correlation_matrix_me (Cov matrix of the measurement errors) true, # sigma_e_is_diagonal Array(Float64, 0) # params ) diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc index 9dcd406d8..fb2ab8860 100644 --- a/preprocessor/ModFile.cc +++ b/preprocessor/ModFile.cc @@ -1086,8 +1086,31 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output) << "export dynamicmodel!, staticmodel!, steadystate!" << endl << "export model__" << endl << "model__ = model()" << endl - << "model__.fname = \"" << basename << "\"" << endl; + << "model__.fname = \"" << basename << "\"" << endl + << "model__.dynare_version = \"" << PACKAGE_VERSION << "\"" << endl + << "model__.sigma_e = zeros(Float64, " << symbol_table.exo_nbr() << ", " + << symbol_table.exo_nbr() << ")" << endl + << "model__.sigma_e_is_diagonal = 1;" << endl + << "model__.correlation_matrix = ones(Float64, " << symbol_table.exo_nbr() << ", " + << symbol_table.exo_nbr() << ")" << endl + << "model__.orig_eq_nbr = " << orig_eqn_nbr << endl + << "model__.eq_nbr = " << dynamic_model.equation_number() << endl + << "model__.ramsey_eq_nbr = " << ramsey_eqn_nbr << endl; + + + if (mod_file_struct.calibrated_measurement_errors) + jlOutputFile << "model__.h = zeros(Float64," + << symbol_table.observedVariablesNbr() << ", " + << symbol_table.observedVariablesNbr() << ");" << endl + << "model__.correlation_matrix_me = ones(Float64, " + << symbol_table.observedVariablesNbr() << ", " + << symbol_table.observedVariablesNbr() << ");" << endl; + else + jlOutputFile << "model__.h = zeros(Float64, 1, 1)" << endl + << "model__.correlation_matrix_me = ones(Float64, 1, 1)" << endl; + + cout << "Processing outputs ..." << endl; symbol_table.writeJuliaOutput(jlOutputFile); jlOutputFile << "end" << endl;