diff --git a/DynamicModel.cc b/DynamicModel.cc index c56f15ec..ba3140ad 100644 --- a/DynamicModel.cc +++ b/DynamicModel.cc @@ -2393,15 +2393,15 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia << endl << "## Input" << endl << " 1 y: Array{Float64, num_dynamic_vars, 1} Vector of endogenous variables in the order stored" << endl - << " in model.lead_lag_incidence; see the manual" << endl - << " 2 x: Array{Float64, nperiods, length(model.exo)} Matrix of exogenous variables (in declaration order)" << endl + << " in model_.lead_lag_incidence; see the manual" << endl + << " 2 x: Array{Float64, nperiods, length(model_.exo)} Matrix of exogenous variables (in declaration order)" << endl << " for all simulation periods" << endl - << " 3 params: Array{Float64, length(model.param), 1} Vector of parameter values in declaration order" << endl + << " 3 params: Array{Float64, length(model_.param), 1} Vector of parameter values in declaration order" << endl << " 4 steady_state:" << endl << " 5 it_: Int Time period for exogenous variables for which to evaluate the model" << endl << endl << "## Output" << endl - << " 6 residual: Array(Float64, model.eq_nbr, 1) Vector of residuals of the dynamic model equations in" << endl + << " 6 residual: Array(Float64, model_.eq_nbr, 1) Vector of residuals of the dynamic model equations in" << endl << " order of declaration of the equations." << endl; DynamicOutput << "function dynamic!(y::Vector{Float64}, x::Matrix{Float64}, " @@ -2424,9 +2424,9 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia << "residual::Vector{Float64}," << endl << " g1::Matrix{Float64})" << endl; - comments << " 7 g1: Array(Float64, model.eq_nbr, num_dynamic_vars) Jacobian matrix of the dynamic model equations;" << endl + comments << " 7 g1: Array(Float64, model_.eq_nbr, num_dynamic_vars) Jacobian matrix of the dynamic model equations;" << endl << " rows: equations in order of declaration" << endl - << " columns: variables in order stored in M_.lead_lag_incidence" << endl; + << " columns: variables in order stored in model_.lead_lag_incidence" << endl; DynamicOutput << "#=" << endl << comments.str() << "=#" << endl << " @assert size(g1) == (" << nrows << ", " << dynJacobianColsNbr << ")" << endl @@ -2444,9 +2444,9 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia << "residual::Vector{Float64}," << endl << " g1::Matrix{Float64}, g2::Matrix{Float64})" << endl; - comments << " 8 g2: spzeros(model.eq_nbr, (num_dynamic_vars)^2) Hessian matrix of the dynamic model equations;" << endl + comments << " 8 g2: spzeros(model_.eq_nbr, (num_dynamic_vars)^2) Hessian matrix of the dynamic model equations;" << endl << " rows: equations in order of declaration" << endl - << " columns: variables in order stored in M_.lead_lag_incidence" << endl; + << " columns: variables in order stored in model_.lead_lag_incidence" << endl; DynamicOutput << "#=" << endl << comments.str() << "=#" << endl << " @assert size(g2) == (" << nrows << ", " << hessianColsNbr << ")" << endl @@ -2467,9 +2467,9 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia << "residual::Vector{Float64}," << endl << " g1::Matrix{Float64}, g2::Matrix{Float64}, g3::Matrix{Float64})" << endl; - comments << " 9 g3: spzeros(model.eq_nbr, (num_dynamic_vars)^3) Third order derivative matrix of the dynamic model equations;" << endl + comments << " 9 g3: spzeros(model_.eq_nbr, (num_dynamic_vars)^3) Third order derivative matrix of the dynamic model equations;" << endl << " rows: equations in order of declaration" << endl - << " columns: variables in order stored in M_.lead_lag_incidence" << endl; + << " columns: variables in order stored in model_.lead_lag_incidence" << endl; DynamicOutput << "#=" << endl << comments.str() << "=#" << endl << " @assert size(g3) == (" << nrows << ", " << ncols << ")" << endl @@ -2500,8 +2500,8 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de string outstruct; if (julia) { - modstruct = "model."; - outstruct = "output."; + modstruct = "model_."; + outstruct = "oo_."; } else { diff --git a/ModFile.cc b/ModFile.cc index ce7318c9..290b9f71 100644 --- a/ModFile.cc +++ b/ModFile.cc @@ -1117,43 +1117,43 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output) << "if isfile(\"" << basename << "SteadyState2.jl" "\")" << endl << " using " << basename << "SteadyState2" << endl << "end" << endl << endl - << "export model" << endl; + << "export model_, options_, oo_" << endl; // Write Output jlOutputFile << endl - << "output = dynare_output()" << endl - << "output.dynare_version = \"" << PACKAGE_VERSION << "\"" << endl; + << "oo_ = dynare_output()" << endl + << "oo_.dynare_version = \"" << PACKAGE_VERSION << "\"" << endl; // Write Options jlOutputFile << endl - << "options = dynare_options()" << endl - << "options.dynare_version = \"" << PACKAGE_VERSION << "\"" << endl; + << "options_ = dynare_options()" << endl + << "options_.dynare_version = \"" << PACKAGE_VERSION << "\"" << endl; if (linear == 1) - jlOutputFile << "options.linear = true" << endl; + jlOutputFile << "options_.linear = true" << endl; // Write Model jlOutputFile << endl - << "model = dynare_model()" << endl - << "model.fname = \"" << basename << "\"" << endl - << "model.dynare_version = \"" << PACKAGE_VERSION << "\"" << endl - << "model.sigma_e = zeros(Float64, " << symbol_table.exo_nbr() << ", " + << "model_ = dynare_model()" << 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.correlation_matrix = ones(Float64, " << symbol_table.exo_nbr() << ", " + << "model_.correlation_matrix = ones(Float64, " << symbol_table.exo_nbr() << ", " << symbol_table.exo_nbr() << ")" << endl - << "model.orig_eq_nbr = " << mod_file_struct.orig_eq_nbr << endl - << "model.eq_nbr = " << dynamic_model.equation_number() << endl - << "model.ramsey_eq_nbr = " << mod_file_struct.ramsey_eq_nbr << endl; + << "model_.orig_eq_nbr = " << mod_file_struct.orig_eq_nbr << endl + << "model_.eq_nbr = " << dynamic_model.equation_number() << endl + << "model_.ramsey_eq_nbr = " << mod_file_struct.ramsey_eq_nbr << endl; if (mod_file_struct.calibrated_measurement_errors) - jlOutputFile << "model.h = zeros(Float64," + jlOutputFile << "model_.h = zeros(Float64," << symbol_table.observedVariablesNbr() << ", " << symbol_table.observedVariablesNbr() << ");" << endl - << "model.correlation_matrix_me = ones(Float64, " + << "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; + 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); @@ -1174,22 +1174,22 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output) } steady_state_model.writeSteadyStateFile(basename, mod_file_struct.ramsey_model_present, true); - jlOutputFile << "model.static = " << basename << "Static.static!" << endl - << "model.dynamic = " << basename << "Dynamic.dynamic!" << endl + jlOutputFile << "model_.static = " << basename << "Static.static!" << endl + << "model_.dynamic = " << basename << "Dynamic.dynamic!" << endl << "if isfile(\"" << basename << "SteadyState.jl" "\")" << endl - << " model.user_written_analytical_steady_state = true" << endl + << " model_.user_written_analytical_steady_state = true" << endl << "end" << endl << "if isfile(\"" << basename << "SteadyState2.jl" "\")" << endl - << " model.analytical_steady_state = true" << endl - << " model.steady_state = " << basename << "SteadyState2.steady_state!" << endl + << " model_.analytical_steady_state = true" << endl + << " model_.steady_state = " << basename << "SteadyState2.steady_state!" << endl << "end" << endl << "if isfile(\"" << basename << "StaticParamsDerivs.jl" "\")" << endl << " using " << basename << "StaticParamsDerivs" << endl - << " model.static_params_derivs = " << basename << "StaticParamsDerivs.params_derivs" << endl + << " model_.static_params_derivs = " << basename << "StaticParamsDerivs.params_derivs" << endl << "end" << endl << "if isfile(\"" << basename << "DynamicParamsDerivs.jl" "\")" << endl << " using " << basename << "DynamicParamsDerivs" << endl - << " model.dynamic_params_derivs = " << basename << "DynamicParamsDerivs.params_derivs" << endl + << " model_.dynamic_params_derivs = " << basename << "DynamicParamsDerivs.params_derivs" << endl << "end" << endl << "end" << endl; jlOutputFile.close(); diff --git a/SymbolTable.cc b/SymbolTable.cc index 0a15fc07..420120f1 100644 --- a/SymbolTable.cc +++ b/SymbolTable.cc @@ -813,7 +813,7 @@ SymbolTable::writeJuliaOutput(ostream &output) const throw (NotYetFrozenExceptio throw NotYetFrozenException(); output << "# Endogenous Variables" << endl - << "model.endo = [" << endl; + << "model_.endo = [" << endl; if (endo_nbr() > 0) for (int id = 0; id < endo_nbr(); id++) output << " DynareModel.Endo(\"" @@ -823,7 +823,7 @@ SymbolTable::writeJuliaOutput(ostream &output) const throw (NotYetFrozenExceptio output << " ]" << endl; output << "# Exogenous Variables" << endl - << "model.exo = [" << endl; + << "model_.exo = [" << endl; if (exo_nbr() > 0) for (int id = 0; id < exo_nbr(); id++) output << " DynareModel.Exo(\"" @@ -835,7 +835,7 @@ SymbolTable::writeJuliaOutput(ostream &output) const throw (NotYetFrozenExceptio if (exo_det_nbr() > 0) { output << "# Exogenous Deterministic Variables" << endl - << "model.exo_det = [" << endl; + << "model_.exo_det = [" << endl; if (exo_det_nbr() > 0) for (int id = 0; id < exo_det_nbr(); id++) output << " DynareModel.ExoDet(\"" @@ -846,7 +846,7 @@ SymbolTable::writeJuliaOutput(ostream &output) const throw (NotYetFrozenExceptio } output << "# Parameters" << endl - << "model.param = [" << endl; + << "model_.param = [" << endl; if (param_nbr() > 0) for (int id = 0; id < param_nbr(); id++) output << " DynareModel.Param(\"" @@ -855,12 +855,12 @@ SymbolTable::writeJuliaOutput(ostream &output) const throw (NotYetFrozenExceptio << getLongName(param_ids[id]) << "\")" << endl; output << " ]" << endl; - output << "model.orig_endo_nbr = " << orig_endo_nbr() << endl; + output << "model_.orig_endo_nbr = " << orig_endo_nbr() << endl; if (aux_vars.size() > 0) { output << "# Auxiliary Variables" << endl - << "model.aux_vars = [" << endl; + << "model_.aux_vars = [" << endl; for (int i = 0; i < (int) aux_vars.size(); i++) { output << " DynareModel.AuxVars(" @@ -899,7 +899,7 @@ SymbolTable::writeJuliaOutput(ostream &output) const throw (NotYetFrozenExceptio if (predeterminedNbr() > 0) { output << "# Predetermined Variables" << endl - << "model.pred_vars = [ " << endl; + << "model_.pred_vars = [ " << endl; for (set::const_iterator it = predetermined_variables.begin(); it != predetermined_variables.end(); it++) output << " DynareModel.PredVars(" @@ -910,7 +910,7 @@ SymbolTable::writeJuliaOutput(ostream &output) const throw (NotYetFrozenExceptio if (observedVariablesNbr() > 0) { output << "# Observed Variables" << endl - << "options.obs_vars = [" << endl; + << "options_.obs_vars = [" << endl; for (vector::const_iterator it = varobs.begin(); it != varobs.end(); it++) output << " DynareModel.ObsVars("