From eacd87490a22ef9d8c0ac1d633bf8982d633ce52 Mon Sep 17 00:00:00 2001
From: sebastien <sebastien@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Thu, 9 Apr 2009 10:09:31 +0000
Subject: [PATCH] 4.0: merged r2572 changeset from trunk (fixed bug with
 USE_DLL and order 2)

git-svn-id: https://www.dynare.org/svn/dynare/branches/4.0@2573 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 preprocessor/ModelTree.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/preprocessor/ModelTree.cc b/preprocessor/ModelTree.cc
index 21df8f0f2e..78b2d33edc 100644
--- a/preprocessor/ModelTree.cc
+++ b/preprocessor/ModelTree.cc
@@ -1754,8 +1754,10 @@ ModelTree::writeDynamicCFile(const string &dynamic_basename) const
                     << "  g2 = NULL;" << endl
                     << " if (nlhs >= 3)" << endl
                     << "  {" << endl
-                    << "     /* Set the output pointer to the output matrix g2. */" << endl
-                    << "     plhs[2] = mxCreateDoubleMatrix(" << equations.size() << ", " << variable_table.getDynJacobianColsNbr(computeJacobianExo)*variable_table.getDynJacobianColsNbr(computeJacobianExo) << ", mxREAL);" << endl
+                    << "     /* Set the output pointer to the output matrix g2. */" << endl;
+  int g2_ncols = variable_table.getDynJacobianColsNbr(computeJacobianExo)*variable_table.getDynJacobianColsNbr(computeJacobianExo);
+  mDynamicModelFile << "     plhs[2] = mxCreateSparse(" << equations.size() << ", " << g2_ncols << ", "
+                    << 5*g2_ncols << ", mxREAL);" << endl
                     << "     /* Create a C pointer to a copy of the output matrix g1. */" << endl
                     << "     g2 = mxGetPr(plhs[2]);" << endl
                     << "  }" << endl
-- 
GitLab