Switch to unified view

a b/combinedDeepLearningActiveContour/minFunc/autoHv.m
1
function [Hv] = autoHv(v,x,g,useComplex,funObj,varargin)
2
% Numerically compute Hessian-vector product H*v of funObj(x,varargin{:})
3
%  based on gradient values
4
5
if useComplex
6
    mu = 1e-150i;
7
else
8
    mu = 2*sqrt(1e-12)*(1+norm(x))/norm(v);
9
end
10
[f,finDif] = funObj(x + v*mu,varargin{:});
11
Hv = (finDif-g)/mu;