From 46993a03da43bfec6ffd9a0566d0b4f25b6a0fb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 26 Oct 2018 11:16:31 +0200
Subject: [PATCH] Fix bug introduced in bfd93f4ac0ff1e with correlations in
 estim_params

For correlations, there is one extra columns (since there are two symbol
indices). MATLAB automatically adds the missing column, while Octave is
stricter when verifying dimensions.

By the way, add a missing comma.

(manually cherry-picked from 1c33af4844557f9a5ce95a1ab6f3e293006c0811)
---
 preprocessor/ComputingTasks.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc
index 993021591..8f098f085 100644
--- a/preprocessor/ComputingTasks.cc
+++ b/preprocessor/ComputingTasks.cc
@@ -813,8 +813,8 @@ EstimatedParamsStatement::writeOutput(ostream &output, const string &basename, b
 {
   output << "estim_params_.var_exo = zeros(0, 10);" << endl
          << "estim_params_.var_endo = zeros(0, 10);" << endl
-         << "estim_params_.corrx = zeros(0, 10);" << endl
-         << "estim_params_.corrn = zeros(0, 10);" << endl
+         << "estim_params_.corrx = zeros(0, 11);" << endl
+         << "estim_params_.corrn = zeros(0, 11);" << endl
          << "estim_params_.param_vals = zeros(0, 10);" << endl;
 
   for (vector<EstimationParams>::const_iterator it = estim_params_list.begin(); it != estim_params_list.end(); it++)
@@ -840,7 +840,7 @@ EstimatedParamsStatement::writeOutput(ostream &output, const string &basename, b
             output << "estim_params_.corrx = [estim_params_.corrx; ";
           else if (symb_type == eEndogenous)
             output << "estim_params_.corrn = [estim_params_.corrn; ";
-          output << symb_id << " " << symbol_table.getTypeSpecificID(it->name2)+1;
+          output << symb_id << ", " << symbol_table.getTypeSpecificID(it->name2)+1;
           break;
         }
       output << ", ";
-- 
GitLab