From 57ae7d7fd983bea2bbf041c7331cf28e9080c119 Mon Sep 17 00:00:00 2001
From: Michel Juillard <michel.juillard@mjui.fr>
Date: Wed, 7 May 2014 21:25:10 +0200
Subject: [PATCH] adding solve_algo=9: using trust_region algorithm on the
 entire model

---
 doc/dynare.texi       | 6 +++++-
 matlab/dynare_solve.m | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/doc/dynare.texi b/doc/dynare.texi
index 5f18125f31..7ddd04dd06 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -2758,7 +2758,8 @@ using the same solver as value @code{1}
 Use Chris Sims' solver
 
 @item 4
-Trust-region solver with autoscaling.
+Splits the model into recursive blocks and solves each block in turn
+using a trust-region solver with autoscaling.
 
 @item 5
 Newton algorithm with a sparse Gaussian elimination (SPE) (requires
@@ -2777,6 +2778,9 @@ each iteration (requires @code{bytecode} and/or @code{block} option,
 Newton algorithm with a Stabilized Bi-Conjugate Gradient (BICGSTAB)
 solver at each iteration (requires @code{bytecode} and/or @code{block}
 option, @pxref{Model declaration})
+
+@item 9
+Trust-region algorithm on the entire model.
 @end table
 
 @noindent
diff --git a/matlab/dynare_solve.m b/matlab/dynare_solve.m
index 744d174e2c..f98980d972 100644
--- a/matlab/dynare_solve.m
+++ b/matlab/dynare_solve.m
@@ -109,7 +109,11 @@ if options_.solve_algo == 0
         info = 1;
     end
 elseif options_.solve_algo == 1
-    [x,info]=solve1(func,x,1:nn,1:nn,jacobian_flag,options_.gstep, ...
+        [x,info]=solve1(func,x,1:nn,1:nn,jacobian_flag,options_.gstep, ...
+                    tolf,options_.solve_tolx, ...
+                    options_.steady.maxit,options_.debug,varargin{:});
+elseif options_.solve_algo == 5
+        [x,info]=trust_region(func,x,1:nn,1:nn,jacobian_flag,options_.gstep, ...
                     tolf,options_.solve_tolx, ...
                     options_.steady.maxit,options_.debug,varargin{:});
 elseif options_.solve_algo == 2 || options_.solve_algo == 4
-- 
GitLab