From 7d95539413435b7e0b6a9ed69addb6dc4de2c6a5 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Mon, 2 Oct 2017 11:13:15 +0200 Subject: [PATCH] preprocessor: add missing fill! statements to static/dynamic functions --- preprocessor/DynamicModel.cc | 2 ++ preprocessor/StaticModel.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/preprocessor/DynamicModel.cc b/preprocessor/DynamicModel.cc index b2b5c8f67..8d92a5642 100644 --- a/preprocessor/DynamicModel.cc +++ b/preprocessor/DynamicModel.cc @@ -2508,6 +2508,7 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia DynamicOutput << "#=" << endl << comments.str() << "=#" << endl << " @assert size(g2) == (" << nrows << ", " << hessianColsNbr << ")" << endl + << " fill!(g2, 0.0)" << endl << " dynamic!(y, x, params, steady_state, it_, residual, g1)" << endl; if (second_derivatives.size()) DynamicOutput << model_local_vars_output.str() @@ -2531,6 +2532,7 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia DynamicOutput << "#=" << endl << comments.str() << "=#" << endl << " @assert size(g3) == (" << nrows << ", " << ncols << ")" << endl + << " fill!(g3, 0.0)" << endl << " dynamic!(y, x, params, steady_state, it_, residual, g1, g2)" << endl; if (third_derivatives.size()) DynamicOutput << model_local_vars_output.str() diff --git a/preprocessor/StaticModel.cc b/preprocessor/StaticModel.cc index 8d6ba2449..ea6ed05e1 100644 --- a/preprocessor/StaticModel.cc +++ b/preprocessor/StaticModel.cc @@ -1555,6 +1555,7 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c StaticOutput << "#=" << endl << comments.str() << "=#" << endl << " @assert size(g2) == (" << equations.size() << ", " << g2ncols << ")" << endl + << " fill!(g2, 0.0)" << endl << " static!(y, x, params, residual, g1)" << endl; if (second_derivatives.size()) StaticOutput << model_local_vars_output.str() @@ -1578,6 +1579,7 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c StaticOutput << "#=" << endl << comments.str() << "=#" << endl << " @assert size(g3) == (" << nrows << ", " << ncols << ")" << endl + << " fill!(g3, 0.0)" << endl << " static!(y, x, params, residual, g1, g2)" << endl; if (third_derivatives.size()) StaticOutput << model_local_vars_output.str()