Merge branch 'nomodule' into 'master'
Julia: remove module for derivatives w.r.t. parameters See merge request Dynare/preprocessor!70master
commit
6ecb602536
|
@ -959,44 +959,28 @@ DynamicModel::writeParamsDerivativesFile(const string &basename) const
|
|||
<< "end" << endl;
|
||||
}
|
||||
else
|
||||
paramsDerivsFile << "module " << basename << "DynamicParamsDerivs" << endl
|
||||
<< "#" << endl
|
||||
<< "# NB: this file was automatically generated by Dynare" << endl
|
||||
paramsDerivsFile << "# NB: this file was automatically generated by Dynare" << endl
|
||||
<< "# from " << basename << ".mod" << endl
|
||||
<< "#" << endl
|
||||
<< "export params_derivs" << endl << endl
|
||||
<< "function params_derivs(y, x, paramssteady_state, it_, "
|
||||
<< "function dynamic_params_derivs(y, x, paramssteady_state, it_,"
|
||||
<< "ss_param_deriv, ss_param_2nd_deriv)" << endl
|
||||
<< "@inbounds begin" << endl
|
||||
<< tt_output.str()
|
||||
<< "end" << endl
|
||||
<< "rp = zeros(" << equations.size() << ", "
|
||||
<< symbol_table.param_nbr() << ");" << endl
|
||||
<< "@inbounds begin" << endl
|
||||
<< rp_output.str()
|
||||
<< "end" << endl
|
||||
<< "gp = zeros(" << equations.size() << ", " << getJacobianColsNbr(false) << ", " << symbol_table.param_nbr() << ");" << endl
|
||||
<< "@inbounds begin" << endl
|
||||
<< gp_output.str()
|
||||
<< "end" << endl
|
||||
<< "rpp = zeros(" << params_derivatives.at({ 0, 2 }).size() << ",4);" << endl
|
||||
<< "@inbounds begin" << endl
|
||||
<< rpp_output.str()
|
||||
<< "end" << endl
|
||||
<< "gpp = zeros(" << params_derivatives.at({ 1, 2 }).size() << ",5);" << endl
|
||||
<< "@inbounds begin" << endl
|
||||
<< gpp_output.str()
|
||||
<< "end" << endl
|
||||
<< "hp = zeros(" << params_derivatives.at({ 2, 1 }).size() << ",5);" << endl
|
||||
<< "@inbounds begin" << endl
|
||||
<< hp_output.str()
|
||||
<< "end" << endl
|
||||
<< "g3p = zeros(" << params_derivatives.at({ 3, 1 }).size() << ",6);" << endl
|
||||
<< "@inbounds begin" << endl
|
||||
<< g3p_output.str()
|
||||
<< "end" << endl
|
||||
<< "(rp, gp, rpp, gpp, hp, g3p)" << endl
|
||||
<< "end" << endl
|
||||
<< "return (rp, gp, rpp, gpp, hp, g3p)" << endl
|
||||
<< "end" << endl;
|
||||
|
||||
paramsDerivsFile.close();
|
||||
|
|
|
@ -221,12 +221,9 @@ SteadyStateModel::writeSteadyStateFile(const string &basename, bool julia) const
|
|||
<< "% Steady state generated by Dynare preprocessor" << endl
|
||||
<< " info = 0;" << endl;
|
||||
else
|
||||
output << "module " << basename << "SteadyState2" << endl
|
||||
<< "#" << endl
|
||||
<< "# NB: this file was automatically generated by Dynare" << endl
|
||||
output << "# NB: this file was automatically generated by Dynare" << endl
|
||||
<< "# from " << basename << ".mod" << endl
|
||||
<< "#" << endl
|
||||
<< "export steady_state!" << endl << endl
|
||||
<< "function steady_state!(ys_::Vector{<: Real}, exo_::Vector{<: Real}, "
|
||||
<< "params::Vector{<: Real})" << endl
|
||||
<< "@inbounds begin" << endl;
|
||||
|
@ -257,7 +254,7 @@ SteadyStateModel::writeSteadyStateFile(const string &basename, bool julia) const
|
|||
|
||||
output << "end" << endl;
|
||||
if (julia)
|
||||
output << "end" << endl << "end" << endl;
|
||||
output << "end" << endl;
|
||||
|
||||
if (julia)
|
||||
writeToFileIfModified(output, filesystem::path{basename} / "model" / "julia" / "SteadyState2.jl");
|
||||
|
|
|
@ -294,40 +294,26 @@ StaticModel::writeParamsDerivativesFile(const string &basename) const
|
|||
<< "end" << endl;
|
||||
}
|
||||
else
|
||||
paramsDerivsFile << "module " << basename << "StaticParamsDerivs" << endl
|
||||
<< "#" << endl
|
||||
<< "# NB: this file was automatically generated by Dynare" << endl
|
||||
paramsDerivsFile << "# NB: this file was automatically generated by Dynare" << endl
|
||||
<< "# from " << basename << ".mod" << endl
|
||||
<< "#" << endl
|
||||
<< "export params_derivs" << endl << endl
|
||||
<< "function params_derivs(y, x, params)" << endl
|
||||
<< "function static_params_derivs(y, x, params)" << endl
|
||||
<< "@inbounds begin" << endl
|
||||
<< tt_output.str()
|
||||
<< "end" << endl
|
||||
<< "rp = zeros(" << equations.size() << ", "
|
||||
<< symbol_table.param_nbr() << ");" << endl
|
||||
<< "@inbounds begin" << endl
|
||||
<< rp_output.str()
|
||||
<< "end" << endl
|
||||
<< "gp = zeros(" << equations.size() << ", " << symbol_table.endo_nbr() << ", "
|
||||
<< symbol_table.param_nbr() << ");" << endl
|
||||
<< "@inbounds begin" << endl
|
||||
<< gp_output.str()
|
||||
<< "end" << endl
|
||||
<< "rpp = zeros(" << params_derivatives.at({ 0, 2 }).size() << ",4);" << endl
|
||||
<< "@inbounds begin" << endl
|
||||
<< rpp_output.str()
|
||||
<< "end" << endl
|
||||
<< "gpp = zeros(" << params_derivatives.at({ 1, 2 }).size() << ",5);" << endl
|
||||
<< "@inbounds begin" << endl
|
||||
<< gpp_output.str()
|
||||
<< "end" << endl
|
||||
<< "hp = zeros(" << params_derivatives.at({ 2, 1 }).size() << ",5);" << endl
|
||||
<< "@inbounds begin" << endl
|
||||
<< hp_output.str()
|
||||
<< "end" << endl
|
||||
<< "(rp, gp, rpp, gpp, hp)" << endl
|
||||
<< "end" << endl
|
||||
<< "return (rp, gp, rpp, gpp, hp)" << endl
|
||||
<< "end" << endl;
|
||||
|
||||
paramsDerivsFile.close();
|
||||
|
|
Loading…
Reference in New Issue