solve1: initialize fjac only if it needs to be computed numerically.

time-shift
Michel Juillard 2014-05-11 14:44:06 +02:00
parent e8ac5da9ea
commit 72950de0a0
1 changed files with 3 additions and 1 deletions

View File

@ -41,7 +41,6 @@ function [x,check] = solve1(func,x,j1,j2,jacobian_flag,gstep,tolf,tolx,maxit,deb
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
nn = length(j1);
fjac = zeros(nn,nn) ;
g = zeros(nn,1) ;
tolmin = tolx ;
@ -71,6 +70,9 @@ end
stpmax = stpmx*max([sqrt(x'*x);nn]) ;
first_time = 1;
if ~jacobian_flag
fjac = zeros(nn,nn) ;
end
for its = 1:maxit
if jacobian_flag
[fvec,fjac] = feval(func,x,varargin{:});