From ee21ad44b8ce8f7ab3a0837f945afb254f79721d Mon Sep 17 00:00:00 2001 From: ratto Date: Fri, 12 Dec 2008 07:40:28 +0000 Subject: [PATCH] refined the search of x increments for gradients when the parameters are near to boundaries. git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@2307 ac1d8469-bf42-47a9-8791-bf33cf982152 --- matlab/mr_hessian.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/matlab/mr_hessian.m b/matlab/mr_hessian.m index 57bc4872c..cec3fb1c0 100644 --- a/matlab/mr_hessian.m +++ b/matlab/mr_hessian.m @@ -35,12 +35,16 @@ func = str2func(func); [f0, ff0]=feval(func,x,varargin{:}); n=size(x,1); h2=bayestopt_.ub-bayestopt_.lb; +hmax=bayestopt_.ub-x; +hmax=min(hmax,x-bayestopt_.lb); %h1=max(abs(x),gstep_*ones(n,1))*eps^(1/3); %h1=max(abs(x),sqrt(gstep_)*ones(n,1))*eps^(1/6); if isempty(h1), h1=max(abs(x),sqrt(gstep_)*ones(n,1))*eps^(1/4); end +h1 = min(h1,0.5.*hmax); + if htol0