Added arrays providing the number of temp terms in Julia modules...

... For static and dynamic models.
issue#70
Stéphane Adjemian(Charybdis) 2018-03-28 17:50:58 +02:00
parent ec215e2a44
commit bce9b66312
2 changed files with 16 additions and 2 deletions

View File

@ -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}, "

View File

@ -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