# hessreg.m

From Spinach Documentation Wiki

The function returns well conditioned Hessian matrix.

## Syntax

[H,g,data]=hessreg(H,g,reg_param,data)

## Description

Returns well conditioned Hessian matrix and, if 'RFO' is used, also returns the scaled gradient. .

## Arguments

H - Hessian matrix to be regularised and conditioned. g - gradient vector to assist regularisation for the 'RFO' method. reg_param - structure of regularisation options and tolerances. data - (optional) data structure to modify regularisation diagnostics.

## Returns

H - Regularised and conditioned Hessian matrix g - gradient vector from 'RFO' method (may occasionally change from input g). data - (optional) data structure with regularisation diagnostics if data input was supplied.

## Default Options

Although these options would be automatically generated by optim_tols.m when used with fminnewton.m or fminkrotov.m, if the function is used separately from these functions - the following are its default options:

reg_param.method This defines the regularisation strategy. Options are a Cholesky factorisation ('CHOL'), or the eigendecomposition based Rational Function Optimisation ('RFO'), Trust Region regularisation ('TRM') and a reset to the identity ('reset'). (Default 'RFO'). reg_param.n_reg Maximumnumber of cholesky factorisation trials, or conditioning iterates allowed (Default 2500). reg_param.delta Used in 'TRM' and regularisation. Should be in the form 0<delta and is the constant multiplied by the identity in H=(H+delta*I), to shift eigenvalues. (Default 1) reg_param.alpha Used in 'RFO' and regularisation. Should be in the form 0<alpha and is the uniform scaling factor. (Default 1) reg_param.cond_method Either none, 'scaled' or 'iterative'. 'iterative' conditionsthe hessian iteratively, reducing the factor delta to reg_param.phi*alpha at every iterate (default 0.9), until the condition number is less than reg_param.max_cond. reg_param.phi Used in 'RFO' and regularisation as the factor to reduce scaling with 'iterative' conditioning. Should be 0<phi<1 for 'RFO' (Default 0.9). If used with 'TRM' and 'iterative' conditions, this factor increases the eigenvalue shift parameter at each iterate, in this case phi>1 (no Default for 'TRM'). reg_param.max_cond positive number being the maximum allowed condition number of the Hessian when reg_param.conditioning 'ioterative' or 'scaled' are used (Default 1e4).

## Notes

If data input exists, the data output gives diagnostic information such as hessian eigenvalues, condition number, and the number of conditioning iterates.

## See also

hessprep.m, fminnewton.m, fminkrotov.m

*Version 1.9, authors: David Goodwin*