Wrapper for user Hessian function for optimization tools

Description

Provides a wrapper around user analytic Hessian function for nonlinear optimization to try to control for inadmissible arguments to user that function, as well as provide for maximization.

Usage

1
uhess(par, fnuser)

Arguments

par

A vector of parameters to the user-supplied function fn

fnuser

A user-supplied function object that has three sub-functions fn, gr, and hess. fn generates the scalar numerical value of the objective function, gr its vector valued gradient (or is NULL) and hess a numerical matrix for the Hessian (or is NULL).

Details

Note that a FIXED name environment opx12env is used to carry the user's fn, gr and hess and the counters.

Value

uhess returns a matrix numeric value, but if the inputs to the function are inadmissible, all elements are set to the R constant .Machine$double.xmax and the computation of fn fails. The returned value has an attribute inadmissible which is returned TRUE in this case, but otherwise is FALSE.

Examples

1
cat("uhess: try an inadmissible set of parameters to a user function\n")