Objective function for optim.
[f,g,ind]=diffcode_CDcost(x,ind,fun,varargin)
real vector or matrix
integer parameter (see optim)
Scilab function with calling sequence F=fun(x,varargin) varargin may be use to pass parameters p1,...pn
objective value at point x
gradient value at point x
This function can be used as an optim external to minimize problem where gradient is too complicated to program. only a the function fun which computes the criterion is required
This function should be used as follow:
[f,xopt,gopt]=optim(list(diffcode_CDcost,fun,p1,...pn),x0,...)