From 14ed3d94a99a135fee9c72f5ba579cf89d6f7ff7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 15 Jan 2013 16:14:15 +0100
Subject: [PATCH] Ensure that running check without stoch_simul still sets
 oo_.dr.eigval

This is documented in the reference manual, but was not working.
The change consists in having check.m returning oo_ as 1st output argument, and
having the preprocessor generating the corresponding code.
---
 matlab/check.m                 | 6 ++++--
 matlab/smm_objective.m         | 4 ++--
 preprocessor/ComputingTasks.cc | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/matlab/check.m b/matlab/check.m
index 2ff30e0af..f6a785aa4 100644
--- a/matlab/check.m
+++ b/matlab/check.m
@@ -1,4 +1,4 @@
-function [result,info] = check(M, options, oo)
+function [oo,result,info] = check(M, options, oo)
 % Checks determinacy conditions by computing the generalized eigenvalues.
 
 %@info:
@@ -21,6 +21,8 @@ function [result,info] = check(M, options, oo)
 %! @strong{Outputs}
 %! @sp 1
 %! @table @ @var
+%! @item oo
+%! Matlab's structure gathering the results (initialized by dynare).
 %! @item result
 %! Integer scalar equal to one (BK conditions are satisfied) or zero (otherwise).
 %! @item info
@@ -38,7 +40,7 @@ function [result,info] = check(M, options, oo)
 %! @end deftypefn
 %@eod:
 
-% Copyright (C) 2001-2012 Dynare Team
+% Copyright (C) 2001-2013 Dynare Team
 %
 % This file is part of Dynare.
 %
diff --git a/matlab/smm_objective.m b/matlab/smm_objective.m
index 806746369..24adb3c63 100644
--- a/matlab/smm_objective.m
+++ b/matlab/smm_objective.m
@@ -15,7 +15,7 @@ function [r,flag] = smm_objective(xparams,sample_moments,weighting_matrix,option
 % SPECIAL REQUIREMENTS
 %  The user has to provide a file where the moment conditions are defined.
 
-% Copyright (C) 2010-2012 Dynare Team
+% Copyright (C) 2010-2013 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -75,7 +75,7 @@ save('estimated_parameters.mat','xparams');
 
 % Check for local determinacy of the deterministic steady state.
 noprint = options_.noprint; options_.noprint = 1;
-[local_determinacy_and_stability,info] = check(M_,options_,oo_); options_.noprint = noprint;
+[oo_,local_determinacy_and_stability,info] = check(M_,options_,oo_); options_.noprint = noprint;
 if ~local_determinacy_and_stability
     r = priorObjectiveValue * (1+info(2));
     flag = 0;
diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc
index cc7553325..4dbdc4ef7 100644
--- a/preprocessor/ComputingTasks.cc
+++ b/preprocessor/ComputingTasks.cc
@@ -59,7 +59,7 @@ void
 CheckStatement::writeOutput(ostream &output, const string &basename) const
 {
   options_list.writeOutput(output);
-  output << "check(M_,options_,oo_);\n";
+  output << "oo_ = check(M_,options_,oo_);" << endl;
 }
 
 void
-- 
GitLab