From bce9b66312f3afe6054a301d32aff469cd4e8b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=28Charybdis=29?= Date: Wed, 28 Mar 2018 17:50:58 +0200 Subject: [PATCH] Added arrays providing the number of temp terms in Julia modules... ... For static and dynamic models. --- src/DynamicModel.cc | 9 ++++++++- src/StaticModel.cc | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc index 5a6fb32c..99858c75 100644 --- a/src/DynamicModel.cc +++ b/src/DynamicModel.cc @@ -2641,7 +2641,7 @@ DynamicModel::writeDynamicModel(const string &dynamic_basename, ostream &Dynamic << "# from " << dynamic_basename << ".mod" << endl << "#" << endl << "using Utils" << endl << endl - << "export dynamic!, dynamicResid!, dynamicG1!, dynamicG2!, dynamicG3!" << endl << endl + << "export tmp_nbr, 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 @@ -2680,6 +2680,13 @@ DynamicModel::writeDynamicModel(const string &dynamic_basename, ostream &Dynamic << " columns: variables in order stored in model_.lead_lag_incidence" << endl << "=#" << endl << endl; + // Write the number of temporary terms + output << "tmp_nbr = zeros(Int,4)" << endl + << "tmp_nbr[1] = " << temporary_terms_res_idxs.size() << "# Number of temporary terms for the residuals" << endl + << "tmp_nbr[2] = " << temporary_terms_g1_idxs.size() << "# Number of temporary terms for g1 (jacobian)" << endl + << "tmp_nbr[3] = " << temporary_terms_g2_idxs.size() << "# Number of temporary terms for g2 (hessian)" << endl + << "tmp_nbr[4] = " << temporary_terms_g3_idxs.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}, " diff --git a/src/StaticModel.cc b/src/StaticModel.cc index bd67ebd2..68c513ae 100644 --- a/src/StaticModel.cc +++ b/src/StaticModel.cc @@ -1659,7 +1659,7 @@ StaticModel::writeStaticModel(const string &basename, << "# from " << basename << ".mod" << endl << "#" << endl << "using Utils" << endl << endl - << "export static!, staticResid!, staticG1!, staticG2!, staticG3!" << endl << endl + << "export tmp_nbr, 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 @@ -1695,6 +1695,13 @@ StaticModel::writeStaticModel(const string &basename, << " rows: equations in order of declaration" << endl << "=#" << endl << endl; + // Write the number of temporary terms + output << "tmp_nbr = zeros(Int,4)" << endl + << "tmp_nbr[1] = " << temporary_terms_res_idxs.size() << "# Number of temporary terms for the residuals" << endl + << "tmp_nbr[2] = " << temporary_terms_g1_idxs.size() << "# Number of temporary terms for g1 (jacobian)" << endl + << "tmp_nbr[3] = " << temporary_terms_g2_idxs.size() << "# Number of temporary terms for g2 (hessian)" << endl + << "tmp_nbr[4] = " << temporary_terms_g3_idxs.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