<< uncprb_gethesfcn Unconstrained Optimization Problems Toolbox uncprb_getinitf >>

Unconstrained Optimization Problems Toolbox >> Unconstrained Optimization Problems Toolbox > uncprb_gethesfd

uncprb_gethesfd

Compute the Hessian by finite differences.

Calling Sequence

Hfd = uncprb_gethesfd ( n , m , x , nprob )
Hfd = uncprb_gethesfd ( n , m , x , nprob , Hstep )
Hfd = uncprb_gethesfd ( n , m , x , nprob , Hstep , Horder )

Parameters

x:

a n x 1 matrix of doubles, the point where to compute f

Hstep :

the step to use for differences. If Hstep=[], uses the default step. The default step depends on the order and the machine precision %eps.

Horder :

the order to use for differences (1, 2 or 4). Default Horder=2. If Horder=[], uses the default order.

nprob:

the problem number

n:

the number of variables, i.e. the size of x

m:

the number of functions, i.e. the size of fvec

gfd:

a n x 1 matrix of doubles, the gradient, df(x)/dxj, j=1, ..., n

Description

Uses finite differences to compute the Hessian matrix. Does not exploit the structure to compute the difference.

Examples

// Get Hfd at x0 for Rosenbrock's test case
nprob = 1
[n,m,x0]=uncprb_getinitf(nprob)
Hfd = uncprb_gethesfd ( n , m , x0 , nprob )
// Compare with exact Hessian
H = uncprb_gethesfcn(n,m,x0,nprob)
norm(H-Hfd)/norm(H)
// Set the step
Hfd = uncprb_gethesfd ( n , m , x0 , nprob , 1.e-1 , [] )
// Set the step and the order
Hfd = uncprb_gethesfd ( n , m , x0 , nprob , 1.e-1 , 4 )
// Set the order (use default step)
Hfd = uncprb_gethesfd ( n , m , x0 , nprob , [] , 4 )
// Use default step and default order
Hfd = uncprb_gethesfd ( n , m , x0 , nprob , [] , [] )

Authors

<< uncprb_gethesfcn Unconstrained Optimization Problems Toolbox uncprb_getinitf >>