From f26551509c4a497ee842b08a12797a7b7601db0b Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Wed, 29 Jul 2015 14:52:15 +0200 Subject: [PATCH] preprocessor: simplify writing of NNZDerivatives --- preprocessor/DynamicModel.cc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/preprocessor/DynamicModel.cc b/preprocessor/DynamicModel.cc index b6f7e3e7cd..70b1617659 100644 --- a/preprocessor/DynamicModel.cc +++ b/preprocessor/DynamicModel.cc @@ -2862,20 +2862,17 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de // Write number of non-zero derivatives // Use -1 if the derivatives have not been computed - output << "M_.NNZDerivatives = zeros(3, 1);" << endl - << "M_.NNZDerivatives(1) = " << NNZDerivatives[0] << ";" << endl; + output << "M_.NNZDerivatives = [" << NNZDerivatives[0] << "; "; if (order > 1) - { - output << "M_.NNZDerivatives(2) = " << NNZDerivatives[1] << ";" << endl; - if (order > 2) - output << "M_.NNZDerivatives(3) = " << NNZDerivatives[2] << ";" << endl; - else - output << "M_.NNZDerivatives(3) = -1;" << endl; - } + output << NNZDerivatives[1] << "; "; else - output << "M_.NNZDerivatives(2) = -1;" << endl - << "M_.NNZDerivatives(3) = -1;" << endl; + output << "-1; "; + if (order > 2) + output << NNZDerivatives[2]; + else + output << "-1"; + output << "];" << endl; } map<pair<int, pair<int, int > >, expr_t> -- GitLab