From a4556896db75cca168b7925876a5d67d2909e979 Mon Sep 17 00:00:00 2001
From: MichelJuillard <michel.juillard@mjui.fr>
Date: Tue, 12 Jul 2022 11:15:51 +0200
Subject: [PATCH] Julia functions Float64 -> <: Real

---
 src/DataTree.cc           |  4 +-
 src/DynamicModel.cc       | 86 +++++++++++++++++++--------------------
 src/ModelEquationBlock.cc |  4 +-
 src/StaticModel.cc        | 60 +++++++++++++--------------
 4 files changed, 77 insertions(+), 77 deletions(-)

diff --git a/src/DataTree.cc b/src/DataTree.cc
index 363a1647..d96c965b 100644
--- a/src/DataTree.cc
+++ b/src/DataTree.cc
@@ -916,9 +916,9 @@ void
 DataTree::writePowerDerivJulia(ostream &output) const
 {
   if (isBinaryOpUsed(BinaryOpcode::powerDeriv))
-    output << "nearbyint(x::Float64) = (abs((x)-floor(x)) < abs((x)-ceil(x)) ? floor(x) : ceil(x))" << endl
+    output << "nearbyint(x::<: Real) = (abs((x)-floor(x)) < abs((x)-ceil(x)) ? floor(x) : ceil(x))" << endl
 	   << endl
-	   << "function get_power_deriv(x::Float64, p::Float64, k::Int64)" << endl
+	   << "function get_power_deriv(x::<: Real, p::<: Real, k::Int64)" << endl
 	   << "    if (abs(x) < 1e-12 && p > 0 && k > p && abs(p-nearbyint(p)) < 1e-12 )" << endl
 	   << "        return 0.0" << endl
 	   << "    else" << endl
diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 9e444e3a..98636796 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -1364,14 +1364,14 @@ DynamicModel::writeDynamicJuliaFile(const string &basename) const
          << "  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{Float64}(num_temp_terms), temporary terms" << endl
-         << "  y            : Vector{Float64}(num_dynamic_vars), endogenous variables in the order stored model_.lead_lag_incidence; see the manual" << endl
-         << "  x            : Matrix{Float64}(nperiods,model_.exo_nbr), exogenous variables (in declaration order) for all simulation periods" << endl
-         << "  params       : Vector{Float64}(model_.param_nbr), parameter values in declaration order" << endl
-         << "  steady_state : Vector{Float64}(model_endo_nbr)" << 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{Float64}(model_.eq_nbr), residuals of the dynamic model equations in order of declaration of the equations." << endl
-         << "  g1           : Matrix{Float64}(model_.eq_nbr, num_dynamic_vars), Jacobian matrix of the dynamic model equations" << 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
@@ -1397,17 +1397,17 @@ DynamicModel::writeDynamicJuliaFile(const string &basename) const
          << "tmp_nbr[4] = " << temporary_terms_derivatives[3].size() << "# Number of temporary terms for g3 (third order derivates)" << endl << endl;
 
   // dynamicResidTT!
-  output << "function dynamicResidTT!(T::Vector{Float64}," << endl
-         << "                         y::Vector{Float64}, x::Matrix{Float64}, "
-         << "params::Vector{Float64}, steady_state::Vector{Float64}, it_::Int)" << endl
+  output << "function dynamicResidTT!(T::Vector{<: Real}," << endl
+         << "                         y::Vector{<: Real}, x::Matrix{<: Real}, "
+         << "params::Vector{<: Real}, steady_state::Vector{<: Real}, it_::Int)" << endl
          << tt_output[0].str()
          << "    return nothing" << endl
          << "end" << endl << endl;
 
   // dynamic!
-  output << "function dynamicResid!(T::Vector{Float64}, residual::AbstractVector{Float64}," << endl
-         << "                       y::Vector{Float64}, x::Matrix{Float64}, "
-         << "params::Vector{Float64}, steady_state::Vector{Float64}, it_::Int, T_flag::Bool)" << endl
+  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_mlv.size() + temporary_terms_derivatives[0].size() << endl
          << "    @assert length(residual) == " << equations.size() << endl
          << "    @assert length(y)+size(x, 2) == " << getJacobianColsNbr() << endl
@@ -1420,18 +1420,18 @@ DynamicModel::writeDynamicJuliaFile(const string &basename) const
          << "end" << endl << endl;
 
   // dynamicG1TT!
-  output << "function dynamicG1TT!(T::Vector{Float64}," << endl
-         << "                      y::Vector{Float64}, x::Matrix{Float64}, "
-         << "params::Vector{Float64}, steady_state::Vector{Float64}, it_::Int)" << endl
+  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
          << tt_output[1].str()
          << "    return nothing" << endl
          << "end" << endl << endl;
 
   // dynamicG1!
-  output << "function dynamicG1!(T::Vector{Float64}, g1::Matrix{Float64}," << endl
-         << "                    y::Vector{Float64}, x::Matrix{Float64}, "
-         << "params::Vector{Float64}, steady_state::Vector{Float64}, it_::Int, T_flag::Bool)" << endl
+  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_mlv.size() + temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size() << endl
          << "    @assert size(g1) == (" << equations.size() << ", " << getJacobianColsNbr() << ")" << endl
@@ -1446,9 +1446,9 @@ DynamicModel::writeDynamicJuliaFile(const string &basename) const
          << "end" << endl << endl;
 
   // dynamicG2TT!
-  output << "function dynamicG2TT!(T::Vector{Float64}," << endl
-         << "                      y::Vector{Float64}, x::Matrix{Float64}, "
-         << "params::Vector{Float64}, steady_state::Vector{Float64}, it_::Int)" << endl
+  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
          << tt_output[2].str()
          << "    return nothing" << endl
@@ -1456,9 +1456,9 @@ DynamicModel::writeDynamicJuliaFile(const string &basename) const
 
   // dynamicG2!
   int hessianColsNbr{getJacobianColsNbr() * getJacobianColsNbr()};
-  output << "function dynamicG2!(T::Vector{Float64}, g2::Matrix{Float64}," << endl
-         << "                    y::Vector{Float64}, x::Matrix{Float64}, "
-         << "params::Vector{Float64}, steady_state::Vector{Float64}, it_::Int, T_flag::Bool)" << endl
+  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_mlv.size() + 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() << endl
@@ -1472,9 +1472,9 @@ DynamicModel::writeDynamicJuliaFile(const string &basename) const
          << "end" << endl << endl;
 
   // dynamicG3TT!
-  output << "function dynamicG3TT!(T::Vector{Float64}," << endl
-         << "                      y::Vector{Float64}, x::Matrix{Float64}, "
-         << "params::Vector{Float64}, steady_state::Vector{Float64}, it_::Int)" << endl
+  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
          << tt_output[3].str()
          << "    return nothing" << endl
@@ -1482,9 +1482,9 @@ DynamicModel::writeDynamicJuliaFile(const string &basename) const
 
   // dynamicG3!
   int ncols{hessianColsNbr * getJacobianColsNbr()};
-  output << "function dynamicG3!(T::Vector{Float64}, g3::Matrix{Float64}," << endl
-         << "                    y::Vector{Float64}, x::Matrix{Float64}, "
-         << "params::Vector{Float64}, steady_state::Vector{Float64}, it_::Int, T_flag::Bool)" << endl
+  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_mlv.size() + 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
@@ -1499,33 +1499,33 @@ DynamicModel::writeDynamicJuliaFile(const string &basename) const
          << "end" << endl << endl;
 
   // dynamic!
-  output << "function dynamic!(T::Vector{Float64}, residual::AbstractVector{Float64}," << endl
-         << "                  y::Vector{Float64}, x::Matrix{Float64}, "
-         << "params::Vector{Float64}, steady_state::Vector{Float64}, it_::Int)" << endl
+  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{Float64}, residual::AbstractVector{Float64}, g1::Matrix{Float64}," << endl
-         << "                  y::Vector{Float64}, x::Matrix{Float64}, "
-         << "params::Vector{Float64}, steady_state::Vector{Float64}, it_::Int)" << 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{Float64}, residual::AbstractVector{Float64}, g1::Matrix{Float64}, g2::Matrix{Float64}," << endl
-         << "                  y::Vector{Float64}, x::Matrix{Float64}, "
-         << "params::Vector{Float64}, steady_state::Vector{Float64}, it_::Int)" << 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{Float64}, residual::AbstractVector{Float64}, g1::Matrix{Float64}, g2::Matrix{Float64}, g3::Matrix{Float64}," << endl
-         << "                  y::Vector{Float64}, x::Matrix{Float64}, "
-         << "params::Vector{Float64}, steady_state::Vector{Float64}, it_::Int)" << 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
diff --git a/src/ModelEquationBlock.cc b/src/ModelEquationBlock.cc
index 02290549..cd47e872 100644
--- a/src/ModelEquationBlock.cc
+++ b/src/ModelEquationBlock.cc
@@ -196,8 +196,8 @@ SteadyStateModel::writeSteadyStateFile(const string &basename, bool julia) const
            << "#     from " << basename << ".mod" << endl
            << "#" << endl
            << "export steady_state!" << endl << endl
-           << "function steady_state!(ys_::Vector{Float64}, exo_::Vector{Float64}, "
-           << "params::Vector{Float64})" << endl;
+           << "function steady_state!(ys_::Vector{<: Real}, exo_::Vector{<: Real}, "
+           << "params::Vector{<: Real})" << endl;
 
   for (const auto & [symb_ids, value] : def_table)
     {
diff --git a/src/StaticModel.cc b/src/StaticModel.cc
index 5777967f..b33eae8e 100644
--- a/src/StaticModel.cc
+++ b/src/StaticModel.cc
@@ -1308,14 +1308,14 @@ StaticModel::writeStaticJuliaFile(const string &basename) const
          << "  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{Float64}(num_temp_terms) temporary terms" << endl
-         << "  y        : Vector{Float64}(model_.endo_nbr) endogenous variables in declaration order" << endl
-         << "  x        : Vector{Float64}(model_.exo_nbr) exogenous variables in declaration order" << endl
-         << "  params   : Vector{Float64}(model_.param) parameter values in declaration order" << endl
-         << "  residual : Vector{Float64}(model_.eq_nbr) residuals of the static model equations" << 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{Float64}(model.eq_nbr,model_.endo_nbr) Jacobian matrix of the static model equations" << 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
@@ -1340,16 +1340,16 @@ StaticModel::writeStaticJuliaFile(const string &basename) const
          << "tmp_nbr[4] = " << temporary_terms_derivatives[3].size() << "# Number of temporary terms for g3 (third order derivates)" << endl << endl;
 
   // staticResidTT!
-  output << "function staticResidTT!(T::Vector{Float64}," << endl
-         << "                        y::Vector{Float64}, x::Vector{Float64}, params::Vector{Float64})" << endl
+  output << "function staticResidTT!(T::Vector{<: Real}," << endl
+         << "                        y::Vector{<: Real}, x::Vector{<: Real}, params::Vector{<: Real})" << endl
          << "    @assert length(T) >= " << temporary_terms_mlv.size() + temporary_terms_derivatives[0].size()  << endl
          << tt_output[0].str()
          << "    return nothing" << endl
          << "end" << endl << endl;
 
   // static!
-  output << "function staticResid!(T::Vector{Float64}, residual::Vector{Float64}," << endl
-         << "                      y::Vector{Float64}, x::Vector{Float64}, params::Vector{Float64}, T0_flag::Bool)" << endl
+  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
@@ -1365,8 +1365,8 @@ StaticModel::writeStaticJuliaFile(const string &basename) const
          << "end" << endl << endl;
 
   // staticG1TT!
-  output << "function staticG1TT!(T::Vector{Float64}," << endl
-         << "                     y::Vector{Float64}, x::Vector{Float64}, params::Vector{Float64}, T0_flag::Bool)" << endl
+  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
@@ -1375,8 +1375,8 @@ StaticModel::writeStaticJuliaFile(const string &basename) const
          << "end" << endl << endl;
 
   // staticG1!
-  output << "function staticG1!(T::Vector{Float64}, g1::Matrix{Float64}," << endl
-         << "                   y::Vector{Float64}, x::Vector{Float64}, params::Vector{Float64}, T1_flag::Bool, T0_flag::Bool)" << endl
+  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_mlv.size() + temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size() << endl
          << "    @assert size(g1) == (" << equations.size() << ", " << symbol_table.endo_nbr() << ")" << endl
@@ -1395,8 +1395,8 @@ StaticModel::writeStaticJuliaFile(const string &basename) const
          << "end" << endl << endl;
 
   // staticG2TT!
-  output << "function staticG2TT!(T::Vector{Float64}," << endl
-         << "                     y::Vector{Float64}, x::Vector{Float64}, params::Vector{Float64}, T1_flag::Bool, T0_flag::Bool)" << endl
+  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
@@ -1406,8 +1406,8 @@ StaticModel::writeStaticJuliaFile(const string &basename) const
 
   // staticG2!
   int hessianColsNbr{symbol_table.endo_nbr() * symbol_table.endo_nbr()};
-  output << "function staticG2!(T::Vector{Float64}, g2::Matrix{Float64}," << endl
-         << "                   y::Vector{Float64}, x::Vector{Float64}, params::Vector{Float64}, T2_flag::Bool, T1_flag::Bool, T0_flag::Bool)" << endl
+  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_mlv.size() + temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size() + temporary_terms_derivatives[2].size() << endl
          << "    @assert size(g2) == (" << equations.size() << ", " << hessianColsNbr << ")" << endl
@@ -1423,8 +1423,8 @@ StaticModel::writeStaticJuliaFile(const string &basename) const
          << "end" << endl << endl;
 
   // staticG3TT!
-  output << "function staticG3TT!(T::Vector{Float64}," << endl
-         << "                     y::Vector{Float64}, x::Vector{Float64}, params::Vector{Float64}, T2_flag::Bool, T1_flag::Bool, T0_flag::Bool)" << endl
+  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
@@ -1434,8 +1434,8 @@ StaticModel::writeStaticJuliaFile(const string &basename) const
 
   // staticG3!
   int ncols{hessianColsNbr * symbol_table.endo_nbr()};
-  output << "function staticG3!(T::Vector{Float64}, g3::Matrix{Float64}," << endl
-         << "                   y::Vector{Float64}, x::Vector{Float64}, params::Vector{Float64}, T3_flag::Bool, T2_flag::Bool, T1_flag::Bool, T0_flag::Bool)" << endl
+  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_mlv.size() + 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
@@ -1451,27 +1451,27 @@ StaticModel::writeStaticJuliaFile(const string &basename) const
          << "end" << endl << endl;
 
   // static!
-  output << "function static!(T::Vector{Float64}, residual::Vector{Float64}," << endl
-         << "                  y::Vector{Float64}, x::Vector{Float64}, params::Vector{Float64})" << endl
+  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{Float64}, residual::Vector{Float64}, g1::Matrix{Float64}," << endl
-         << "                 y::Vector{Float64}, x::Vector{Float64}, params::Vector{Float64})" << 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{Float64}, g1::Matrix{Float64}," << endl
-         << "                 y::Vector{Float64}, x::Vector{Float64}, params::Vector{Float64})" << 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{Float64}, residual::Vector{Float64}, g1::Matrix{Float64}, g2::Matrix{Float64}," << endl
-         << "                 y::Vector{Float64}, x::Vector{Float64}, params::Vector{Float64})" << 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
-- 
GitLab