Julia: no longer write the main dynamic/static files in legacy representation

master
Sébastien Villemot 2022-11-02 15:48:47 +01:00
parent 6aca84bfbb
commit 00fd9dadb6
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
4 changed files with 4 additions and 437 deletions

View File

@ -722,219 +722,6 @@ DynamicModel::writeDynamicMFile(const string &basename) const
writeDynamicMCompatFile(basename);
}
void
DynamicModel::writeDynamicJuliaFile(const string &basename) const
{
auto [d_output, tt_output] = writeModelFileHelper<ExprNodeOutputType::juliaDynamicModel>();
stringstream output;
output << "module " << basename << "Dynamic" << endl
<< "#" << endl
<< "# NB: this file was automatically generated by Dynare" << endl
<< "# from " << basename << ".mod" << endl
<< "#" << endl
<< "using StatsFuns" << endl << endl
<< "export dynamic!, dynamicResid!, dynamicG1!, dynamicG2!, dynamicG3!" << endl << endl
<< "#=" << endl
<< "# The comments below apply to all functions contained in this module #" << endl
<< " NB: The arguments contained on the first line of the function" << endl
<< " definition are those that are modified in place" << endl << endl
<< "## Exported Functions ##" << endl
<< " dynamic! : Wrapper function; computes residuals, Jacobian, Hessian," << endl
<< " and third derivatives depending on the arguments provided" << endl
<< " dynamicResid! : Computes the dynamic model residuals" << endl
<< " dynamicG1! : Computes the dynamic model Jacobian" << endl
<< " dynamicG2! : Computes the dynamic model Hessian" << endl
<< " dynamicG3! : Computes the dynamic model third derivatives" << endl << endl
<< "## Local Functions ##" << endl
<< " dynamicResidTT! : Computes the dynamic model temporary terms for the residuals" << endl
<< " dynamicG1TT! : Computes the dynamic model temporary terms for the Jacobian" << endl
<< " dynamicG2TT! : Computes the dynamic model temporary terms for the Hessian" << endl
<< " dynamicG3TT! : Computes the dynamic model temporary terms for the third derivatives" << endl << endl
<< "## Function Arguments ##" << endl
<< " T : Vector{<: Real}(num_temp_terms), temporary terms" << endl
<< " y : Vector{<: Real}(num_dynamic_vars), endogenous variables in the order stored model_.lead_lag_incidence; see the manual" << endl
<< " x : Matrix{<: Real}(nperiods,model_.exo_nbr), exogenous variables (in declaration order) for all simulation periods" << endl
<< " params : Vector{<: Real}(model_.param_nbr), parameter values in declaration order" << endl
<< " steady_state : Vector{<: Real}(model_endo_nbr)" << endl
<< " it_ : Int, time period for exogenous variables for which to evaluate the model" << endl
<< " residual : Vector{<: Real}(model_.eq_nbr), residuals of the dynamic model equations in order of declaration of the equations." << endl
<< " g1 : Matrix{<: Real}(model_.eq_nbr, num_dynamic_vars), Jacobian matrix of the dynamic model equations" << endl
<< " The rows and columns respectively correspond to equations in order of declaration and variables in order" << endl
<< " stored in model_.lead_lag_incidence" << endl
<< " g2 : spzeros(model_.eq_nbr, (num_dynamic_vars)^2) Hessian matrix of the dynamic model equations" << endl
<< " The rows and columns respectively correspond to equations in order of declaration and variables in order" << endl
<< " stored in model_.lead_lag_incidence" << endl
<< " g3 : spzeros(model_.eq_nbr, (num_dynamic_vars)^3) Third order derivative matrix of the dynamic model equations;" << endl
<< " The rows and columns respectively correspond to equations in order of declaration and variables in order" << endl
<< " stored in model_.lead_lag_incidence" << endl << endl
<< "## Remarks ##" << endl
<< " [1] `num_dynamic_vars` is the number of non zero entries in the lead lag incidence matrix, `model_.lead_lag_incidence.`" << endl
<< " [2] The size of `T`, ie the value of `num_temp_terms`, depends on the version of the dynamic model called. The number of temporary variables" << endl
<< " used for the different returned objects (residuals, jacobian, hessian or third order derivatives) is given by the elements in `tmp_nbr`" << endl
<< " exported vector. The first element is the number of temporaries used for the computation of the residuals, the second element is the" << endl
<< " number of temporaries used for the evaluation of the jacobian matrix, etc. If one calls the version of the dynamic model computing the" << endl
<< " residuals, the jacobian and hessian matrices, then `T` must have at least `sum(tmp_nbr[1:3])` elements." << endl
<< "=#" << endl << endl;
// dynamicResidTT!
output << "function dynamicResidTT!(T::Vector{<: Real}," << endl
<< " y::Vector{<: Real}, x::Matrix{<: Real}, "
<< "params::Vector{<: Real}, steady_state::Vector{<: Real}, it_::Int)" << endl
<< "@inbounds begin" << endl
<< tt_output[0].str()
<< "end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// dynamic!
output << "function dynamicResid!(T::Vector{<: Real}, residual::AbstractVector{<: Real}," << endl
<< " y::Vector{<: Real}, x::Matrix{<: Real}, "
<< "params::Vector{<: Real}, steady_state::Vector{<: Real}, it_::Int, T_flag::Bool)" << endl
<< " @assert length(T) >= " << temporary_terms_derivatives[0].size() << endl
<< " @assert length(residual) == " << equations.size() << endl
<< " @assert length(y)+size(x, 2) == " << getJacobianColsNbr(false) << endl
<< " @assert length(params) == " << symbol_table.param_nbr() << endl
<< " if T_flag" << endl
<< " dynamicResidTT!(T, y, x, params, steady_state, it_)" << endl
<< " end" << endl
<< "@inbounds begin" << endl
<< d_output[0].str()
<< "end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// dynamicG1TT!
output << "function dynamicG1TT!(T::Vector{<: Real}," << endl
<< " y::Vector{<: Real}, x::Matrix{<: Real}, "
<< "params::Vector{<: Real}, steady_state::Vector{<: Real}, it_::Int)" << endl
<< " dynamicResidTT!(T, y, x, params, steady_state, it_)" << endl
<< "@inbounds begin" << endl
<< tt_output[1].str()
<< "end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// dynamicG1!
output << "function dynamicG1!(T::Vector{<: Real}, g1::Matrix{<: Real}," << endl
<< " y::Vector{<: Real}, x::Matrix{<: Real}, "
<< "params::Vector{<: Real}, steady_state::Vector{<: Real}, it_::Int, T_flag::Bool)" << endl
<< " @assert length(T) >= "
<< temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size() << endl
<< " @assert size(g1) == (" << equations.size() << ", " << getJacobianColsNbr(false) << ")" << endl
<< " @assert length(y)+size(x, 2) == " << getJacobianColsNbr(false) << endl
<< " @assert length(params) == " << symbol_table.param_nbr() << endl
<< " if T_flag" << endl
<< " dynamicG1TT!(T, y, x, params, steady_state, it_)" << endl
<< " end" << endl
<< " fill!(g1, 0.0)" << endl
<< "@inbounds begin" << endl
<< d_output[1].str()
<< "end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// dynamicG2TT!
output << "function dynamicG2TT!(T::Vector{<: Real}," << endl
<< " y::Vector{<: Real}, x::Matrix{<: Real}, "
<< "params::Vector{<: Real}, steady_state::Vector{<: Real}, it_::Int)" << endl
<< " dynamicG1TT!(T, y, x, params, steady_state, it_)" << endl
<< "@inbounds begin" << endl
<< tt_output[2].str()
<< "end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// dynamicG2!
int hessianColsNbr {getJacobianColsNbr(false) * getJacobianColsNbr(false)};
output << "function dynamicG2!(T::Vector{<: Real}, g2::Matrix{<: Real}," << endl
<< " y::Vector{<: Real}, x::Matrix{<: Real}, "
<< "params::Vector{<: Real}, steady_state::Vector{<: Real}, it_::Int, T_flag::Bool)" << endl
<< " @assert length(T) >= " << temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size() + temporary_terms_derivatives[2].size() << endl
<< " @assert size(g2) == (" << equations.size() << ", " << hessianColsNbr << ")" << endl
<< " @assert length(y)+size(x, 2) == " << getJacobianColsNbr(false) << endl
<< " @assert length(params) == " << symbol_table.param_nbr() << endl
<< " if T_flag" << endl
<< " dynamicG2TT!(T, y, x, params, steady_state, it_)" << endl
<< " end" << endl
<< " fill!(g2, 0.0)" << endl
<< "@inbounds begin" << endl
<< d_output[2].str()
<< "end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// dynamicG3TT!
output << "function dynamicG3TT!(T::Vector{<: Real}," << endl
<< " y::Vector{<: Real}, x::Matrix{<: Real}, "
<< "params::Vector{<: Real}, steady_state::Vector{<: Real}, it_::Int)" << endl
<< " dynamicG2TT!(T, y, x, params, steady_state, it_)" << endl
<< "@inbounds begin" << endl
<< tt_output[3].str()
<< "end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// dynamicG3!
int ncols {hessianColsNbr * getJacobianColsNbr(false)};
output << "function dynamicG3!(T::Vector{<: Real}, g3::Matrix{<: Real}," << endl
<< " y::Vector{<: Real}, x::Matrix{<: Real}, "
<< "params::Vector{<: Real}, steady_state::Vector{<: Real}, it_::Int, T_flag::Bool)" << endl
<< " @assert length(T) >= "
<< temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size() + temporary_terms_derivatives[2].size() + temporary_terms_derivatives[3].size() << endl
<< " @assert size(g3) == (" << equations.size() << ", " << ncols << ")" << endl
<< " @assert length(y)+size(x, 2) == " << getJacobianColsNbr(false) << endl
<< " @assert length(params) == " << symbol_table.param_nbr() << endl
<< " if T_flag" << endl
<< " dynamicG3TT!(T, y, x, params, steady_state, it_)" << endl
<< " end" << endl
<< " fill!(g3, 0.0)" << endl
<< "@inbounds begin" << endl
<< d_output[3].str()
<< "end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// dynamic!
output << "function dynamic!(T::Vector{<: Real}, residual::AbstractVector{<: Real}," << endl
<< " y::Vector{<: Real}, x::Matrix{<: Real}, "
<< "params::Vector{<: Real}, steady_state::Vector{<: Real}, it_::Int)" << endl
<< " dynamicResid!(T, residual, y, x, params, steady_state, it_, true)" << endl
<< " return nothing" << endl
<< "end" << endl
<< endl
<< "function dynamic!(T::Vector{<: Real}, residual::AbstractVector{<: Real}, g1::Matrix{<: Real}," << endl
<< " y::Vector{<: Real}, x::Matrix{<: Real}, "
<< "params::Vector{<: Real}, steady_state::Vector{<: Real}, it_::Int)" << endl
<< " dynamicG1!(T, g1, y, x, params, steady_state, it_, true)" << endl
<< " dynamicResid!(T, residual, y, x, params, steady_state, it_, false)" << endl
<< " return nothing" << endl
<< "end" << endl
<< endl
<< "function dynamic!(T::Vector{<: Real}, residual::AbstractVector{<: Real}, g1::Matrix{<: Real}, g2::Matrix{<: Real}," << endl
<< " y::Vector{<: Real}, x::Matrix{<: Real}, "
<< "params::Vector{<: Real}, steady_state::Vector{<: Real}, it_::Int)" << endl
<< " dynamicG2!(T, g2, y, x, params, steady_state, it_, true)" << endl
<< " dynamicG1!(T, g1, y, x, params, steady_state, it_, false)" << endl
<< " dynamicResid!(T, residual, y, x, params, steady_state, it_, false)" << endl
<< " return nothing" << endl
<< "end" << endl
<< endl
<< "function dynamic!(T::Vector{<: Real}, residual::AbstractVector{<: Real}, g1::Matrix{<: Real}, g2::Matrix{<: Real}, g3::Matrix{<: Real}," << endl
<< " y::Vector{<: Real}, x::Matrix{<: Real}, "
<< "params::Vector{<: Real}, steady_state::Vector{<: Real}, it_::Int)" << endl
<< " dynamicG3!(T, g3, y, x, params, steady_state, it_, true)" << endl
<< " dynamicG2!(T, g2, y, x, params, steady_state, it_, false)" << endl
<< " dynamicG1!(T, g1, y, x, params, steady_state, it_, false)" << endl
<< " dynamicResid!(T, residual, y, x, params, steady_state, it_, false)" << endl
<< " return nothing" << endl
<< "end" << endl
<< "end" << endl;
writeToFileIfModified(output, basename + "Dynamic.jl");
}
string
DynamicModel::reform(const string &name1) const
{
@ -3503,10 +3290,9 @@ DynamicModel::writeDynamicFile(const string &basename, bool block, bool use_dll,
if (use_dll)
writeModelCFile<true>(basename, mexext, matlabroot, dynareroot);
else if (julia)
writeDynamicJuliaFile(basename);
else
else if (!julia) // M-files
writeDynamicMFile(basename);
// The legacy representation is no longer produced for Julia
}
// Sparse representation

View File

@ -120,8 +120,6 @@ private:
//! Writes dynamic model file (Matlab version)
void writeDynamicMFile(const string &basename) const;
//! Writes dynamic model file (Julia version, legacy representation)
void writeDynamicJuliaFile(const string &basename) const;
//! Writes the main dynamic function of block decomposed model (MATLAB version)
void writeDynamicBlockMFile(const string &basename) const;
/* Writes the main dynamic functions of block decomposed model (C version),

View File

@ -610,219 +610,6 @@ StaticModel::writeStaticMCompatFile(const string &basename) const
output.close();
}
void
StaticModel::writeStaticJuliaFile(const string &basename) const
{
auto [d_output, tt_output] = writeModelFileHelper<ExprNodeOutputType::juliaStaticModel>();
stringstream output;
output << "module " << basename << "Static" << endl
<< "#" << endl
<< "# NB: this file was automatically generated by Dynare" << endl
<< "# from " << basename << ".mod" << endl
<< "#" << endl
<< "using StatsFuns" << endl << endl
<< "export static!, staticResid!, staticG1!, staticG2!, staticG3!" << endl << endl
<< "#=" << endl
<< "# The comments below apply to all functions contained in this module #" << endl
<< " NB: The arguments contained on the first line of the function" << endl
<< " definition are those that are modified in place" << endl << endl
<< "## Exported Functions ##" << endl
<< " static! : Wrapper function; computes residuals, Jacobian, Hessian," << endl
<< " and third order derivatives matroces depending on the arguments provided" << endl
<< " staticResid! : Computes the static model residuals" << endl
<< " staticG1! : Computes the static model Jacobian" << endl
<< " staticG2! : Computes the static model Hessian" << endl
<< " staticG3! : Computes the static model third derivatives" << endl << endl
<< "## Local Functions ##" << endl
<< " staticResidTT! : Computes the static model temporary terms for the residuals" << endl
<< " staticG1TT! : Computes the static model temporary terms for the Jacobian" << endl
<< " staticG2TT! : Computes the static model temporary terms for the Hessian" << endl
<< " staticG3TT! : Computes the static model temporary terms for the third derivatives" << endl << endl
<< "## Function Arguments ##" << endl
<< " T : Vector{<: Real}(num_temp_terms) temporary terms" << endl
<< " y : Vector{<: Real}(model_.endo_nbr) endogenous variables in declaration order" << endl
<< " x : Vector{<: Real}(model_.exo_nbr) exogenous variables in declaration order" << endl
<< " params : Vector{<: Real}(model_.param) parameter values in declaration order" << endl
<< " residual : Vector{<: Real}(model_.eq_nbr) residuals of the static model equations" << endl
<< " in order of declaration of the equations. Dynare may prepend auxiliary equations," << endl
<< " see model.aux_vars" << endl
<< " g1 : Matrix{<: Real}(model.eq_nbr,model_.endo_nbr) Jacobian matrix of the static model equations" << endl
<< " The columns and rows respectively correspond to the variables in declaration order and the" << endl
<< " equations in order of declaration" << endl
<< " g2 : spzeros(model.eq_nbr, model_.endo^2) Hessian matrix of the static model equations" << endl
<< " The columns and rows respectively correspond to the variables in declaration order and the" << endl
<< " equations in order of declaration" << endl
<< " g3 : spzeros(model.eq_nbr, model_.endo^3) Third order derivatives matrix of the static model equations" << endl
<< " The columns and rows respectively correspond to the variables in declaration order and the" << endl
<< " equations in order of declaration" << endl << endl
<< "## Remarks ##" << endl
<< " [1] The size of `T`, ie the value of `num_temp_terms`, depends on the version of the static model called. The number of temporary variables" << endl
<< " used for the different returned objects (residuals, jacobian, hessian or third order derivatives) is given by the elements in `tmp_nbr`" << endl
<< " exported vector. The first element is the number of temporaries used for the computation of the residuals, the second element is the" << endl
<< " number of temporaries used for the evaluation of the jacobian matrix, etc. If one calls the version of the static model computing the" << endl
<< " residuals, and the jacobian and hessian matrices, then `T` must have at least `sum(tmp_nbr[1:3])` elements." << endl
<< "=#" << endl << endl;
// staticResidTT!
output << "function staticResidTT!(T::Vector{<: Real}," << endl
<< " y::Vector{<: Real}, x::Vector{<: Real}, params::Vector{<: Real})" << endl
<< " @assert length(T) >= " << temporary_terms_derivatives[0].size() << endl
<< " @inbounds begin" << endl
<< tt_output[0].str()
<< " end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// static!
output << "function staticResid!(T::Vector{<: Real}, residual::Vector{<: Real}," << endl
<< " y::Vector{<: Real}, x::Vector{<: Real}, params::Vector{<: Real}, T0_flag::Bool)" << endl
<< " @assert length(y) == " << symbol_table.endo_nbr() << endl
<< " @assert length(x) == " << symbol_table.exo_nbr() << endl
<< " @assert length(params) == " << symbol_table.param_nbr() << endl
<< " @assert length(residual) == " << equations.size() << endl
<< " if T0_flag" << endl
<< " staticResidTT!(T, y, x, params)" << endl
<< " end" << endl
<< " @inbounds begin" << endl
<< d_output[0].str()
<< " end" << endl
<< " if ~isreal(residual)" << endl
<< " residual = real(residual)+imag(residual).^2;" << endl
<< " end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// staticG1TT!
output << "function staticG1TT!(T::Vector{<: Real}," << endl
<< " y::Vector{<: Real}, x::Vector{<: Real}, params::Vector{<: Real}, T0_flag::Bool)" << endl
<< " if T0_flag" << endl
<< " staticResidTT!(T, y, x, params)" << endl
<< " end" << endl
<< " @inbounds begin" << endl
<< tt_output[1].str()
<< " end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// staticG1!
output << "function staticG1!(T::Vector{<: Real}, g1::Matrix{<: Real}," << endl
<< " y::Vector{<: Real}, x::Vector{<: Real}, params::Vector{<: Real}, T1_flag::Bool, T0_flag::Bool)" << endl
<< " @assert length(T) >= "
<< temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size() << endl
<< " @assert size(g1) == (" << equations.size() << ", " << symbol_table.endo_nbr() << ")" << endl
<< " @assert length(y) == " << symbol_table.endo_nbr() << endl
<< " @assert length(x) == " << symbol_table.exo_nbr() << endl
<< " @assert length(params) == " << symbol_table.param_nbr() << endl
<< " if T1_flag" << endl
<< " staticG1TT!(T, y, x, params, T0_flag)" << endl
<< " end" << endl
<< " fill!(g1, 0.0)" << endl
<< " @inbounds begin" << endl
<< d_output[1].str()
<< " end" << endl
<< " if ~isreal(g1)" << endl
<< " g1 = real(g1)+2*imag(g1);" << endl
<< " end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// staticG2TT!
output << "function staticG2TT!(T::Vector{<: Real}," << endl
<< " y::Vector{<: Real}, x::Vector{<: Real}, params::Vector{<: Real}, T1_flag::Bool, T0_flag::Bool)" << endl
<< " if T1_flag" << endl
<< " staticG1TT!(T, y, x, params, TO_flag)" << endl
<< " end" << endl
<< " @inbounds begin" << endl
<< tt_output[2].str()
<< " end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// staticG2!
int hessianColsNbr{symbol_table.endo_nbr() * symbol_table.endo_nbr()};
output << "function staticG2!(T::Vector{<: Real}, g2::Matrix{<: Real}," << endl
<< " y::Vector{<: Real}, x::Vector{<: Real}, params::Vector{<: Real}, T2_flag::Bool, T1_flag::Bool, T0_flag::Bool)" << endl
<< " @assert length(T) >= "
<< temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size() + temporary_terms_derivatives[2].size() << endl
<< " @assert size(g2) == (" << equations.size() << ", " << hessianColsNbr << ")" << endl
<< " @assert length(y) == " << symbol_table.endo_nbr() << endl
<< " @assert length(x) == " << symbol_table.exo_nbr() << endl
<< " @assert length(params) == " << symbol_table.param_nbr() << endl
<< " if T2_flag" << endl
<< " staticG2TT!(T, y, x, params, T1_flag, T0_flag)" << endl
<< " end" << endl
<< " fill!(g2, 0.0)" << endl
<< " @inbounds begin" << endl
<< d_output[2].str()
<< " end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// staticG3TT!
output << "function staticG3TT!(T::Vector{<: Real}," << endl
<< " y::Vector{<: Real}, x::Vector{<: Real}, params::Vector{<: Real}, T2_flag::Bool, T1_flag::Bool, T0_flag::Bool)" << endl
<< " if T2_flag" << endl
<< " staticG2TT!(T, y, x, params, T1_flag, T0_flag)" << endl
<< " end" << endl
<< " @inbounds begin" << endl
<< tt_output[3].str()
<< " end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// staticG3!
int ncols{hessianColsNbr * symbol_table.endo_nbr()};
output << "function staticG3!(T::Vector{<: Real}, g3::Matrix{<: Real}," << endl
<< " y::Vector{<: Real}, x::Vector{<: Real}, params::Vector{<: Real}, T3_flag::Bool, T2_flag::Bool, T1_flag::Bool, T0_flag::Bool)" << endl
<< " @assert length(T) >= "
<< temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size() + temporary_terms_derivatives[2].size() + temporary_terms_derivatives[3].size() << endl
<< " @assert size(g3) == (" << equations.size() << ", " << ncols << ")" << endl
<< " @assert length(y) == " << symbol_table.endo_nbr() << endl
<< " @assert length(x) == " << symbol_table.exo_nbr() << endl
<< " @assert length(params) == " << symbol_table.param_nbr() << endl
<< " if T3_flag" << endl
<< " staticG3TT!(T, y, x, params, T2_flag, T1_flag, T0_flag)" << endl
<< " end" << endl
<< " fill!(g3, 0.0)" << endl
<< " @inbounds begin" << endl
<< d_output[3].str()
<< " end" << endl
<< " return nothing" << endl
<< "end" << endl << endl;
// static!
output << "function static!(T::Vector{<: Real}, residual::Vector{<: Real}," << endl
<< " y::Vector{<: Real}, x::Vector{<: Real}, params::Vector{<: Real})" << endl
<< " staticResid!(T, residual, y, x, params, true)" << endl
<< " return nothing" << endl
<< "end" << endl
<< endl
<< "function static!(T::Vector{<: Real}, residual::Vector{<: Real}, g1::Matrix{<: Real}," << endl
<< " y::Vector{<: Real}, x::Vector{<: Real}, params::Vector{<: Real})" << endl
<< " staticG1!(T, g1, y, x, params, true, true)" << endl
<< " staticResid!(T, residual, y, x, params, false)" << endl
<< " return nothing" << endl
<< "end" << endl
<< endl
<< "function static!(T::Vector{<: Real}, g1::Matrix{<: Real}," << endl
<< " y::Vector{<: Real}, x::Vector{<: Real}, params::Vector{<: Real})" << endl
<< " staticG1!(T, g1, y, x, params, true, false)" << endl
<< " return nothing" << endl
<< "end" << endl
<< endl
<< "function static!(T::Vector{<: Real}, residual::Vector{<: Real}, g1::Matrix{<: Real}, g2::Matrix{<: Real}," << endl
<< " y::Vector{<: Real}, x::Vector{<: Real}, params::Vector{<: Real})" << endl
<< " staticG2!(T, g2, y, x, params, true, true, true)" << endl
<< " staticG1!(T, g1, y, x, params, false, false)" << endl
<< " staticResid!(T, residual, y, x, params, false)" << endl
<< " return nothing" << endl
<< "end" << endl
<< "end" << endl;
writeToFileIfModified(output, basename + "Static.jl");
}
void
StaticModel::writeStaticFile(const string &basename, bool block, bool use_dll, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot, bool julia) const
{
@ -871,10 +658,9 @@ StaticModel::writeStaticFile(const string &basename, bool block, bool use_dll, c
if (use_dll)
writeModelCFile<false>(basename, mexext, matlabroot, dynareroot);
else if (julia)
writeStaticJuliaFile(basename);
else // M-files
else if (!julia) // M-files
writeStaticMFile(basename);
// The legacy representation is no longer produced for Julia
}
// Sparse representation

View File

@ -37,9 +37,6 @@ private:
//! Writes static model file (standard Matlab version)
void writeStaticMFile(const string &basename) const;
//! Writes static model file (Julia version, legacy representation)
void writeStaticJuliaFile(const string &basename) const;
//! Writes the main static function of block decomposed model (MATLAB version)
void writeStaticBlockMFile(const string &basename) const;