fix comments in generated files
parent
8715878971
commit
59122a1e73
|
@ -1575,7 +1575,11 @@ DynamicModel::writeDynamicJuliaFile(const string &basename) const
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
output << "module " << basename << "Dynamic" << endl << endl
|
output << "module " << basename << "Dynamic" << endl
|
||||||
|
<< "#" << endl
|
||||||
|
<< "# NB: this file was automatically generated by Dynare" << endl
|
||||||
|
<< "# from " << basename << ".mod" << endl
|
||||||
|
<< "#" << endl
|
||||||
<< "using Utils" << endl << endl
|
<< "using Utils" << endl << endl
|
||||||
<< "export dynamic!" << endl << endl;
|
<< "export dynamic!" << endl << endl;
|
||||||
writeDynamicModel(output, false, true);
|
writeDynamicModel(output, false, true);
|
||||||
|
@ -2365,16 +2369,29 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ostringstream comments;
|
||||||
|
comments << "## Function Arguments" << endl
|
||||||
|
<< 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
|
||||||
|
<< " for all simulation periods" << 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
|
||||||
|
<< " order of declaration of the equations." << endl;
|
||||||
|
|
||||||
DynamicOutput << "function dynamic!(y::Vector{Float64}, x::Matrix{Float64}, "
|
DynamicOutput << "function dynamic!(y::Vector{Float64}, x::Matrix{Float64}, "
|
||||||
<< "params::Vector{Float64}," << endl
|
<< "params::Vector{Float64}," << endl
|
||||||
<< " steady_state::Vector{Float64}, it_::Int, "
|
<< " steady_state::Vector{Float64}, it_::Int, "
|
||||||
<< "residual::Vector{Float64})" << endl
|
<< "residual::Vector{Float64})" << endl
|
||||||
<< "#" << endl
|
<< "#=" << endl << comments.str() << "=#" << endl
|
||||||
<< "# Function argument sizes:" << endl
|
|
||||||
<< "# residual: Array(Float64, model.eq_nbr, 1)" << endl
|
|
||||||
<< "#" << endl
|
|
||||||
<< "@assert size(residual) == " << nrows << endl
|
<< "@assert size(residual) == " << nrows << endl
|
||||||
<< "fill!(residual, 0.0)" << endl << endl
|
<< "fill!(residual, 0.0)" << endl
|
||||||
<< "#" << endl
|
<< "#" << endl
|
||||||
<< "# Model equations" << endl
|
<< "# Model equations" << endl
|
||||||
<< "#" << endl
|
<< "#" << endl
|
||||||
|
@ -2385,14 +2402,15 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
|
||||||
<< "params::Vector{Float64}," << endl
|
<< "params::Vector{Float64}," << endl
|
||||||
<< " steady_state::Vector{Float64}, it_::Int, "
|
<< " steady_state::Vector{Float64}, it_::Int, "
|
||||||
<< "residual::Vector{Float64}," << endl
|
<< "residual::Vector{Float64}," << endl
|
||||||
<< " g1::Matrix{Float64})" << endl
|
<< " g1::Matrix{Float64})" << endl;
|
||||||
<< " #" << endl
|
|
||||||
<< " # Function argument sizes:" << endl
|
comments << " 7 g1: Array(Float64, model.eq_nbr, num_dynamic_vars) Jacobian matrix of the dynamic model equations;" << endl
|
||||||
<< " # residual: Array(Float64, model.eq_nbr, 1)" << endl
|
<< " rows: equations in order of declaration" << endl
|
||||||
<< " # g1: Array(Float64, model.eq_nbr, num_dynamic_endo_(+exo?)_vars)" << endl
|
<< " columns: variables in order stored in M_.lead_lag_incidence" << endl;
|
||||||
<< " #" << endl
|
|
||||||
|
DynamicOutput << "#=" << endl << comments.str() << "=#" << endl
|
||||||
<< " @assert size(g1) == (" << nrows << ", " << dynJacobianColsNbr << ")" << endl
|
<< " @assert size(g1) == (" << nrows << ", " << dynJacobianColsNbr << ")" << endl
|
||||||
<< " fill!(g1, 0.0)" << endl << endl
|
<< " fill!(g1, 0.0)" << endl
|
||||||
<< " dynamic!(y, x, params, steady_state, it_, residual)" << endl
|
<< " dynamic!(y, x, params, steady_state, it_, residual)" << endl
|
||||||
<< model_output.str()
|
<< model_output.str()
|
||||||
<< " #" << endl
|
<< " #" << endl
|
||||||
|
@ -2404,13 +2422,13 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
|
||||||
<< "params::Vector{Float64}," << endl
|
<< "params::Vector{Float64}," << endl
|
||||||
<< " steady_state::Vector{Float64}, it_::Int, "
|
<< " steady_state::Vector{Float64}, it_::Int, "
|
||||||
<< "residual::Vector{Float64}," << endl
|
<< "residual::Vector{Float64}," << endl
|
||||||
<< " g1::Matrix{Float64}, g2::Matrix{Float64})" << endl
|
<< " g1::Matrix{Float64}, g2::Matrix{Float64})" << endl;
|
||||||
<< " #" << endl
|
|
||||||
<< " # Function argument sizes:" << endl
|
comments << " 8 g2: spzeros(model.eq_nbr, (num_dynamic_vars)^2) Hessian matrix of the dynamic model equations;" << endl
|
||||||
<< " # residual: Array(Float64, model.eq_nbr, 1)" << endl
|
<< " rows: equations in order of declaration" << endl
|
||||||
<< " # g1: Array(Float64, model.eq_nbr, num_dynamic_endo_(+exo?)_vars)" << endl
|
<< " columns: variables in order stored in M_.lead_lag_incidence" << endl;
|
||||||
<< " # g2: spzeros(model.eq_nbr, (num_dynamic_endo_(+exo?)_vars)^2)" << endl
|
|
||||||
<< " #" << endl << endl
|
DynamicOutput << "#=" << endl << comments.str() << "=#" << endl
|
||||||
<< " @assert size(g2) == (" << nrows << ", " << hessianColsNbr << ")" << endl
|
<< " @assert size(g2) == (" << nrows << ", " << hessianColsNbr << ")" << endl
|
||||||
<< " dynamic!(y, x, params, steady_state, it_, residual, g1)" << endl;
|
<< " dynamic!(y, x, params, steady_state, it_, residual, g1)" << endl;
|
||||||
if (second_derivatives.size())
|
if (second_derivatives.size())
|
||||||
|
@ -2427,14 +2445,13 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
|
||||||
<< "params::Vector{Float64}," << endl
|
<< "params::Vector{Float64}," << endl
|
||||||
<< " steady_state::Vector{Float64}, it_::Int, "
|
<< " steady_state::Vector{Float64}, it_::Int, "
|
||||||
<< "residual::Vector{Float64}," << endl
|
<< "residual::Vector{Float64}," << endl
|
||||||
<< " g1::Matrix{Float64}, g2::Matrix{Float64}, g3::Matrix{Float64})" << endl
|
<< " g1::Matrix{Float64}, g2::Matrix{Float64}, g3::Matrix{Float64})" << endl;
|
||||||
<< " #" << endl
|
|
||||||
<< " # Function argument sizes:" << endl
|
comments << " 9 g3: spzeros(model.eq_nbr, (num_dynamic_vars)^3) Third order derivative matrix of the dynamic model equations;" << endl
|
||||||
<< " # residual: Array(Float64, model.eq_nbr, 1)" << endl
|
<< " rows: equations in order of declaration" << endl
|
||||||
<< " # g1: Array(Float64, model.eq_nbr, num_dynamic_endo_(+exo?)_vars)" << endl
|
<< " columns: variables in order stored in M_.lead_lag_incidence" << endl;
|
||||||
<< " # g2: spzeros(model.eq_nbr, (num_dynamic_endo_(+exo?)_vars)^2)" << endl
|
|
||||||
<< " # g3: spzeros(model.eq_nbr, (num_dynamic_endo_(+exo?)_vars)^3)" << endl
|
DynamicOutput << "#=" << endl << comments.str() << "=#" << endl
|
||||||
<< " #" << endl << endl
|
|
||||||
<< " @assert size(g3) == (" << nrows << ", " << ncols << ")" << endl
|
<< " @assert size(g3) == (" << nrows << ", " << ncols << ")" << endl
|
||||||
<< " dynamic!(y, x, params, steady_state, it_, residual, g1, g2)" << endl;
|
<< " dynamic!(y, x, params, steady_state, it_, residual, g1, g2)" << endl;
|
||||||
if (third_derivatives.size())
|
if (third_derivatives.size())
|
||||||
|
@ -3934,7 +3951,11 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
|
||||||
<< "% Warning : this file is generated automatically by Dynare" << endl
|
<< "% Warning : this file is generated automatically by Dynare" << endl
|
||||||
<< "% from model file (.mod)" << endl << endl;
|
<< "% from model file (.mod)" << endl << endl;
|
||||||
else
|
else
|
||||||
paramsDerivsFile << "module " << basename << "DynamicParamsDerivs" << endl << endl
|
paramsDerivsFile << "module " << basename << "DynamicParamsDerivs" << endl
|
||||||
|
<< "#" << endl
|
||||||
|
<< "# NB: this file was automatically generated by Dynare" << endl
|
||||||
|
<< "# from " << basename << ".mod" << endl
|
||||||
|
<< "#" << endl
|
||||||
<< "export params_derivs" << endl << endl
|
<< "export params_derivs" << endl << endl
|
||||||
<< "function params_derivs(y, x, paramssteady_state, it_, "
|
<< "function params_derivs(y, x, paramssteady_state, it_, "
|
||||||
<< "ss_param_deriv, ss_param_2nd_deriv)" << endl;
|
<< "ss_param_deriv, ss_param_2nd_deriv)" << endl;
|
||||||
|
|
|
@ -1077,10 +1077,10 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output)
|
||||||
}
|
}
|
||||||
|
|
||||||
jlOutputFile << "module " << basename << endl
|
jlOutputFile << "module " << basename << endl
|
||||||
<< "##" << endl
|
<< "#" << endl
|
||||||
<< " # Note : this file was automatically generated by Dynare" << endl
|
<< "# NB: this file was automatically generated by Dynare" << endl
|
||||||
<< " # from " << basename << ".mod" << endl
|
<< "# from " << basename << ".mod" << endl
|
||||||
<< "##" << endl
|
<< "#" << endl
|
||||||
<< "using DynareModel" << endl
|
<< "using DynareModel" << endl
|
||||||
<< "using DynareOptions" << endl
|
<< "using DynareOptions" << endl
|
||||||
<< "using DynareOutput" << endl
|
<< "using DynareOutput" << endl
|
||||||
|
|
|
@ -1436,15 +1436,25 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ostringstream comments;
|
||||||
|
comments << "## Function Arguments" << endl
|
||||||
|
<< endl
|
||||||
|
<< "## Input" << endl
|
||||||
|
<< " 1 y: Array{Float64, length(model.endo), 1} Vector of endogenous variables in declaration order" << endl
|
||||||
|
<< " 2 x: Array{Float64, length(model.exo), 1} Vector of exogenous variables in declaration order" << endl
|
||||||
|
<< " 3 params: Array{Float64, length(model.param), 1} Vector of parameter values in declaration order" << endl
|
||||||
|
<< endl
|
||||||
|
<< "## Output" << endl
|
||||||
|
<< " 4 residual: Array(Float64, model.eq_nbr, 1) Vector of residuals of the static model equations" << endl
|
||||||
|
<< " in order of declaration of the equations." << endl
|
||||||
|
<< " Dynare may prepend auxiliary equations, see model.aux_vars" << endl;
|
||||||
|
|
||||||
StaticOutput << "function static!(y::Vector{Float64}, x::Vector{Float64}, "
|
StaticOutput << "function static!(y::Vector{Float64}, x::Vector{Float64}, "
|
||||||
<< "params::Vector{Float64}," << endl
|
<< "params::Vector{Float64}," << endl
|
||||||
<< " residual::Vector{Float64})" << endl
|
<< " residual::Vector{Float64})" << endl
|
||||||
<< "#" << endl
|
<< "#=" << endl << comments.str() << "=#" << endl
|
||||||
<< "# Function argument sizes:" << endl
|
|
||||||
<< "# residual: Array(Float64, model.eq_nbr, 1)" << endl
|
|
||||||
<< "#" << endl
|
|
||||||
<< "@assert size(residual) == " << equations.size() << endl
|
<< "@assert size(residual) == " << equations.size() << endl
|
||||||
<< "fill!(residual, 0.0)" << endl << endl
|
<< "fill!(residual, 0.0)" << endl
|
||||||
<< "#" << endl
|
<< "#" << endl
|
||||||
<< "# Model equations" << endl
|
<< "# Model equations" << endl
|
||||||
<< "#" << endl
|
<< "#" << endl
|
||||||
|
@ -1456,15 +1466,16 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
|
||||||
<< "end" << endl << endl
|
<< "end" << endl << endl
|
||||||
<< "function static!(y::Vector{Float64}, x::Vector{Float64}, "
|
<< "function static!(y::Vector{Float64}, x::Vector{Float64}, "
|
||||||
<< "params::Vector{Float64}," << endl
|
<< "params::Vector{Float64}," << endl
|
||||||
<< " residual::Vector{Float64}, g1::Matrix{Float64})" << endl
|
<< " residual::Vector{Float64}, g1::Matrix{Float64})" << endl;
|
||||||
<< " #" << endl
|
|
||||||
<< " # Function argument sizes:" << endl
|
comments << " 5 g1: Array(Float64, model.eq_nbr, length(model.endo)) Jacobian matrix of the static model equations;" << endl
|
||||||
<< " # residual: Array(Float64, model.eq_nbr, 1)" << endl
|
<< " columns: variables in declaration order" << endl
|
||||||
<< " # g1: Array(Float64, model.eq_nbr, length(model.endo))" << endl
|
<< " rows: equations in order of declaration" << endl;
|
||||||
<< " #" << endl
|
|
||||||
|
StaticOutput << "#=" << endl << comments.str() << "=#" << endl
|
||||||
<< " @assert size(g1) == (" << equations.size() << ", " << symbol_table.endo_nbr()
|
<< " @assert size(g1) == (" << equations.size() << ", " << symbol_table.endo_nbr()
|
||||||
<< ")" << endl
|
<< ")" << endl
|
||||||
<< " fill!(g1, 0.0)" << endl << endl
|
<< " fill!(g1, 0.0)" << endl
|
||||||
<< " static!(y, x, params, residual)" << endl
|
<< " static!(y, x, params, residual)" << endl
|
||||||
<< model_output.str()
|
<< model_output.str()
|
||||||
<< " #" << endl
|
<< " #" << endl
|
||||||
|
@ -1478,13 +1489,13 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
|
||||||
<< "function static!(y::Vector{Float64}, x::Vector{Float64}, "
|
<< "function static!(y::Vector{Float64}, x::Vector{Float64}, "
|
||||||
<< "params::Vector{Float64}," << endl
|
<< "params::Vector{Float64}," << endl
|
||||||
<< " residual::Vector{Float64}, g1::Matrix{Float64}, "
|
<< " residual::Vector{Float64}, g1::Matrix{Float64}, "
|
||||||
<< "g2::Matrix{Float64})" << endl
|
<< "g2::Matrix{Float64})" << endl;
|
||||||
<< " #" << endl
|
|
||||||
<< " # Function argument sizes:" << endl
|
comments << " 6 g2: spzeros(model.eq_nbr, length(model.endo)^2) Hessian matrix of the static model equations;" << endl
|
||||||
<< " # residual: Array(Float64, model.eq_nbr, 1)" << endl
|
<< " columns: variables in declaration order" << endl
|
||||||
<< " # g1: Array(Float64, model.eq_nbr, length(model.endo))" << endl
|
<< " rows: equations in order of declaration" << endl;
|
||||||
<< " # g2: spzeros(model.eq_nbr, length(model.endo)^2)" << endl
|
|
||||||
<< " #" << endl << endl
|
StaticOutput << "#=" << endl << comments.str() << "=#" << endl
|
||||||
<< " @assert size(g2) == (" << equations.size() << ", " << g2ncols << ")" << endl
|
<< " @assert size(g2) == (" << equations.size() << ", " << g2ncols << ")" << endl
|
||||||
<< " static!(y, x, params, residual, g1)" << endl;
|
<< " static!(y, x, params, residual, g1)" << endl;
|
||||||
if (second_derivatives.size())
|
if (second_derivatives.size())
|
||||||
|
@ -1501,14 +1512,13 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
|
||||||
<< "params::Vector{Float64}," << endl
|
<< "params::Vector{Float64}," << endl
|
||||||
<< " residual::Vector{Float64}, g1::Matrix{Float64}, "
|
<< " residual::Vector{Float64}, g1::Matrix{Float64}, "
|
||||||
<< "g2::Matrix{Float64}," << endl
|
<< "g2::Matrix{Float64}," << endl
|
||||||
<< " g3::Matrix{Float64})" << endl
|
<< " g3::Matrix{Float64})" << endl;
|
||||||
<< " #" << endl
|
|
||||||
<< " # Function argument sizes:" << endl
|
comments << " 7 g3: spzeros(model.eq_nbr, length(model.endo)^3) Third derivatives matrix of the static model equations;" << endl
|
||||||
<< " # residual: Array(Float64, model.eq_nbr, 1)" << endl
|
<< " columns: variables in declaration order" << endl
|
||||||
<< " # g1: Array(Float64, model.eq_nbr, length(model.endo))" << endl
|
<< " rows: equations in order of declaration" << endl;
|
||||||
<< " # g2: spzeros(model.eq_nbr, length(model.endo)^2)" << endl
|
|
||||||
<< " # g3: spzeros(model.eq_nbr, length(model.endo)^3)" << endl
|
StaticOutput << "#=" << endl << comments.str() << "=#" << endl
|
||||||
<< " #" << endl << endl
|
|
||||||
<< " @assert size(g3) == (" << nrows << ", " << ncols << ")" << endl
|
<< " @assert size(g3) == (" << nrows << ", " << ncols << ")" << endl
|
||||||
<< " static!(y, x, params, residual, g1, g2)" << endl;
|
<< " static!(y, x, params, residual, g1, g2)" << endl;
|
||||||
if (third_derivatives.size())
|
if (third_derivatives.size())
|
||||||
|
@ -1644,7 +1654,11 @@ StaticModel::writeStaticJuliaFile(const string &basename) const
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
output << "module " << basename << "Static" << endl << endl
|
output << "module " << basename << "Static" << endl
|
||||||
|
<< "#" << endl
|
||||||
|
<< "# NB: this file was automatically generated by Dynare" << endl
|
||||||
|
<< "# from " << basename << ".mod" << endl
|
||||||
|
<< "#" << endl
|
||||||
<< "using Utils" << endl << endl
|
<< "using Utils" << endl << endl
|
||||||
<< "export static!" << endl << endl;
|
<< "export static!" << endl << endl;
|
||||||
writeStaticModel(output, false, true);
|
writeStaticModel(output, false, true);
|
||||||
|
@ -2108,7 +2122,11 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
|
||||||
<< "% Warning : this file is generated automatically by Dynare" << endl
|
<< "% Warning : this file is generated automatically by Dynare" << endl
|
||||||
<< "% from model file (.mod)" << endl << endl;
|
<< "% from model file (.mod)" << endl << endl;
|
||||||
else
|
else
|
||||||
paramsDerivsFile << "module " << basename << "StaticParamsDerivs" << endl << endl
|
paramsDerivsFile << "module " << basename << "StaticParamsDerivs" << endl
|
||||||
|
<< "#" << endl
|
||||||
|
<< "# NB: this file was automatically generated by Dynare" << endl
|
||||||
|
<< "# from " << basename << ".mod" << endl
|
||||||
|
<< "#" << endl
|
||||||
<< "export params_derivs" << endl << endl
|
<< "export params_derivs" << endl << endl
|
||||||
<< "function params_derivs(y, x, params)" << endl;
|
<< "function params_derivs(y, x, params)" << endl;
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,11 @@ SteadyStateModel::writeSteadyStateFile(const string &basename, bool ramsey_model
|
||||||
<< "% Steady state generated by Dynare preprocessor" << endl
|
<< "% Steady state generated by Dynare preprocessor" << endl
|
||||||
<< " info = 0;" << endl;
|
<< " info = 0;" << endl;
|
||||||
else
|
else
|
||||||
output << "module " << basename << "SteadyState2" << endl << endl
|
output << "module " << basename << "SteadyState2" << endl
|
||||||
|
<< "#" << endl
|
||||||
|
<< "# NB: this file was automatically generated by Dynare" << endl
|
||||||
|
<< "# from " << basename << ".mod" << endl
|
||||||
|
<< "#" << endl
|
||||||
<< "export steady_state!" << endl << endl
|
<< "export steady_state!" << endl << endl
|
||||||
<< "function steady_state!(ys_::Vector{Float64}, exo_::Vector{Float64}, "
|
<< "function steady_state!(ys_::Vector{Float64}, exo_::Vector{Float64}, "
|
||||||
<< "params::Vector{Float64})" << endl;
|
<< "params::Vector{Float64})" << endl;
|
||||||
|
|
Loading…
Reference in New Issue