Objective function evaluation. Call and collect the required outputs from an objective function.
This function is used by fminnewton.m to request the correct amount of arguments from an objective function. For example: a simplex method will only ever require the objective function value; the Newton-Raphson method does not require a Hessian matrix during a line-search; a backtracking line-search does not require a gradient evaluation. This function ensures that the only objective function calculations performed are those required.
x - objective at this iterate (waveform) obj_fun_handle - function handle to the objective function (e.g. @obj_fun_name). data - data structure inherited from fminnewton.m
max_min - value of +1 or -1 depending on whether a maximum or a minimum is sought
data - modified data structure with diagnostics from the objective. fx - objective function value at x. grad - gradient of the objective function at x. required for gradient based optimisation in fminnewton.m. hess - Hessian of the objective function at x. required for Newton-Raphson optimisation in fminnewton.m.
This function also allows the objective function value to be returned as a vector, where the first element is the objective value to display (i.e. the true fidelity from GRAPE), and further elements are penalties to the objective function included in the optimisation. Must set optim.npen > 0 in the options for fminnewton.m
Version 1.9, authors: David Goodwin