Skip to content

Fix infinite loop in mr_hessian

@rattoma mr_hessian contains the loop

            while (fx-f0)==0
                hess_info.h1(i)= hess_info.h1(i)*2;
                xh1(i)=x(i)+hess_info.h1(i);
                [fx,exit_flag,ffx]=penalty_objective_function(xh1,func,penalty,varargin{:});
                ic=1;
            end

That loop does not have a proper termination criterion. I have a mod-file where hess_info.h1(i) becomes 0 so that it is always true that fx=f0. So either we condition on ic also being smaller than a particlar number, or we need to check that hess_info.h1(i)*2 is not 0.