Fix analytic_derivation with newrat
Because analytic_derivation=1
by default, the Hessian is not computed in dsge_likelihood
. H0
being empty results in a crash
Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To operate on each element of the matrix individually, use TIMES (.*) for elementwise multiplication.
Error in csminit1 (line 77) dx = -H0*g; ^ Error in newrat (line 154) [fval,x0] = csminit1(func0,xparam1,penalty,fval0(icount),gg,0,H,Verbose,varargin{:});
in the second iteration. The reason is that line 303
[~,~,gg,hh]=penalty_objective_function(xparam1,func0,penalty,varargin{:});
does not account for hh
not being set (in contrast to previous checks like if isempty(hh)
). The testsuite misses this due to only doing one iteration.