Commit 1b0d63ab authored by Houtan Bastani's avatar Houtan Bastani

add types to dynamic, static, and steady_state function calls

parent cbe10274
......@@ -2334,15 +2334,22 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
}
else
{
DynamicOutput << "function dynamic!(y, x, params, steady_state, it_, residual)" << endl
DynamicOutput << "function dynamic!(y::Vector{Float64}, x::Matrix{Float64}, "
<< "params::Vector{Float64}," << endl
<< " steady_state::Vector{Float64}, it_::Int, "
<< "residual::Vector{Float64})" << endl
<< "#" << endl
<< "# Model equations" << endl
<< "#" << endl
<< "residual = zeros(" << nrows << ", 1);" << endl
<< "residual = zeros(" << nrows << ");" << endl
<< model_output.str()
<< model_eq_output.str()
<< "end" << endl << endl
<< "function dynamic!(y, x, params, steady_state, it_, residual, g1)" << endl
<< "function dynamic!(y::Vector{Float64}, x::Matrix{Float64}, "
<< "params::Vector{Float64}," << endl
<< " steady_state::Vector{Float64}, it_::Int, "
<< "residual::Vector{Float64}," << endl
<< " g1::Matrix{Float64})" << endl
<< " dynamic!(y, x, params, steady_state, it_, residual)" << endl
<< model_output.str()
<< " g1 = zeros(" << nrows << ", " << dynJacobianColsNbr << ");" << endl
......@@ -2351,7 +2358,11 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
<< " #" << endl
<< jacobian_output.str()
<< "end" << endl << endl
<< "function dynamic!(y, x, params, steady_state, it_, residual, g1, g2)" << endl
<< "function dynamic!(y::Vector{Float64}, x::Matrix{Float64}, "
<< "params::Vector{Float64}," << endl
<< " steady_state::Vector{Float64}, it_::Int, "
<< "residual::Vector{Float64}," << endl
<< " g1::Matrix{Float64}, g2::Matrix{Float64})" << endl
<< " dynamic!(y, x, params, steady_state, it_, residual, g1)" << endl
<< " #" << endl
<< " # Hessian matrix" << endl
......@@ -2366,7 +2377,11 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
// Initialize g3 matrix
DynamicOutput << "end" << endl << endl
<< "function dynamic!(y, x, params, steady_state, it_, residual, g1, g2, g3)" << endl
<< "function dynamic!(y::Vector{Float64}, x::Matrix{Float64}, "
<< "params::Vector{Float64}," << endl
<< " steady_state::Vector{Float64}, it_::Int, "
<< "residual::Vector{Float64}," << endl
<< " g1::Matrix{Float64}, g2::Matrix{Float64}, g3::Matrix{Float64})" << endl
<< " dynamic!(y, x, params, steady_state, it_, residual, g1, g2)" << endl
<< " #" << endl
<< " # Third order derivatives" << endl
......
......@@ -1406,8 +1406,10 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
}
else
{
StaticOutput << "function static!(y, x, params, residual)" << endl
<< "residual = zeros( " << equations.size() << ", 1)" << endl
StaticOutput << "function static!(y::Vector{Float64}, x::Matrix{Float64}, "
<< "params::Vector{Float64}," << endl
<< " residual::Vector{Float64})" << endl
<< "residual = zeros(" << equations.size() << ")" << endl
<< "#" << endl
<< "# Model equations" << endl
<< "#" << endl
......@@ -1417,7 +1419,9 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
<< " residual = real(residual)+imag(residual).^2;" << endl
<< "end" << endl
<< "end" << endl << endl
<< "function static!(y, x, params, residual, g1)" << endl
<< "function static!(y::Vector{Float64}, x::Matrix{Float64}, "
<< "params::Vector{Float64}," << endl
<< " residual::Vector{Float64}, g1::Matrix{Float64})" << endl
<< " static!(y, x, params, residual)" << endl
<< model_output.str()
<< " g1 = zeros(" << equations.size() << ", " << symbol_table.endo_nbr() << ");" << endl
......@@ -1429,7 +1433,10 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
<< " g1 = real(g1)+2*imag(g1);" << endl
<< " end" << endl
<< "end" << endl << endl
<< "function static!(y, x, params, residual, g1, g2)" << endl
<< "function static!(y::Vector{Float64}, x::Matrix{Float64}, "
<< "params::Vector{Float64}," << endl
<< " residual::Vector{Float64}, g1::Matrix{Float64}, "
<< "g2::Matrix{Float64})" << endl
<< " static!(y, x, params, residual, g1)" << endl
<< " #" << endl
<< " # Hessian matrix" << endl
......@@ -1446,7 +1453,11 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
// Initialize g3 matrix
StaticOutput << "end" << endl << endl
<< "function static!(y, x, params, residual, g1, g2, g3)" << endl
<< "function static!(y::Vector{Float64}, x::Matrix{Float64}, "
<< "params::Vector{Float64}," << endl
<< " residual::Vector{Float64}, g1::Matrix{Float64}, "
<< "g2::Matrix{Float64}," << endl
<< " g3::Matrix{Float64})" << endl
<< " static!(y, x, params, residual, g1, g2)" << endl
<< " #" << endl
<< " # Third order derivatives" << endl
......
......@@ -129,7 +129,8 @@ SteadyStateModel::writeSteadyStateFile(const string &basename, bool ramsey_model
else
output << "module " << basename << "SteadyState2" << endl << endl
<< "export steady_state!" << endl << endl
<< "function steady_state!(ys_, exo_, params)" << endl;
<< "function steady_state!(ys_::Vector{Float64}, exo_::Vector{Float64}, "
<< "params::Vector{Float64})" << endl;
for (size_t i = 0; i < def_table.size(); i++)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment