FDHES
Approximates the Hessian using forward differences and function values.
Required Arguments
FCN — User-supplied subroutine to evaluate the function to be minimized. The usage is
CALL FCN (N, X, F), where
N – Length of X. (Input)
X – The point at which the function is evaluated. (Input)
X should not be changed by FCN.
F – The computed function value at the point X. (Output)
FCN must be declared EXTERNAL in the calling program.
XC — Vector of length N containing the point at which the Hessian is to be approximated. (Input)
FC — Function value at XC. (Input)
HN by N matrix containing the finite difference approximation to the Hessian in the lower triangle. (Output)
Optional Arguments
N — Dimension of the problem. (Input)
Default: N = SIZE (XC,1).
XSCALE — Vector of length N containing the diagonal scaling matrix for the variables. (Input)
In the absence of other information, set all entries to 1.0.
Default: XSCALE = 1.0.
EPSFCN — Estimate of the relative noise in the function. (Input)
EPSFCN must be less than or equal to 0.1. In the absence of other information, set EPSFCN to 0.0.
Default: EPSFCN = 0.0.
LDH — Row dimension of H exactly as specified in the dimension statement of the calling program. (Input)
Default: LDH = SIZE (H,1).
FORTRAN 90 Interface
Generic: CALL FDHES (FCN, XC, FC, H [])
Specific: The specific interface names are S_FDHES and D_FDHES.
FORTRAN 77 Interface
Single: CALL FDHES (FCN, N, XC, XSCALE, FC, EPSFCN, H, LDH)
Double: The double precision name is DFDHES.
Description
The routine FDHES uses the following finite-difference formula to estimate the Hessian matrix of function f at x:
Where
ɛ is the machine epsilon or user-supplied estimate of the relative noise, si and sj are the scaling factors of the i‑th and j-th variables, and ei and ej are the i-th and j-th unit vectors, respectively. For more details, see Dennis and Schnabel (1983).
Since the finite-difference method has truncation error, cancellation error, and rounding error, users should be aware of possible poor performance. When possible, high precision arithmetic is recommended.
Comments
1. Workspace may be explicitly provided, if desired, by use of F2HES/DF2HES. The reference is:
CALL F2HES (FCN, N, XC, XSCALE, FC, EPSFCN, H, LDH, WK1, WK2)
The additional arguments are as follows:
WK1 — Real work vector of length N.
WK2 — Real work vector of length N.
2. This is Description A5.6.2 from Dennis and Schnabel, 1983; page 321.
Example
The Hessian is estimated for the following function at (1,1)
 
USE FDHES_INT
USE UMACH_INT
 
IMPLICIT NONE
! Declaration of variables
INTEGER N, LDHES, NOUT
PARAMETER (N=2, LDHES=2)
REAL XC(N), FVALUE, HES(LDHES,N), EPSFCN
EXTERNAL FCN
! Initialization
DATA XC/1.0E0,-1.0E0/
! Set function noise
EPSFCN = 0.001
! Evaluate the function at
! current point
CALL FCN (N, XC, FVALUE)
! Get Hessian forward difference
! approximation
CALL FDHES (FCN, XC, FVALUE, HES, EPSFCN=EPSFCN)
!
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) ((HES(I,J),J=1,I),I=1,N)
99999 FORMAT (’ The lower triangle of the Hessian is’, /,&
5X,F10.2,/,5X,2F10.2,/)
!
END
!
SUBROUTINE FCN (N, X, F)
! SPECIFICATIONS FOR ARGUMENTS
INTEGER N
REAL X(N), F
!
F = X(1)*(X(1) - X(2)) - 2.0E0
!
RETURN
END
Output
 
The lower triangle of the Hessian is
2.00
-1.00 0.00
Published date: 03/19/2020
Last modified date: 03/19/2020