% bfgsmin: bfgs or limited memory bfgs minimization of function % % Usage: [x, obj_value, convergence, iters] = bfgsmin(f, args, control) % % The function must be of the form % [value, return_2,..., return_m] = f(arg_1, arg_2,..., arg_n) % By default, minimization is w.r.t. arg_1, but it can be done % w.r.t. any argument that is a vector. Numeric derivatives are % used unless analytic derivatives are supplied. See bfgsmin_example.m % for methods. % % Arguments: % * f: name of function to minimize (string) % * args: a cell array that holds all arguments of the function % The argument with respect to which minimization is done % MUST be a vector % * control: an optional cell array of 1-8 elements. If a cell % array shorter than 8 elements is provided, the trailing elements % are provided with default values. % * elem 1: maximum iterations (positive integer, or -1 or Inf for unlimited (default)) % * elem 2: verbosity % 0 = no screen output (default) % 1 = only final results % 2 = summary every iteration % 3 = detailed information % * elem 3: convergence criterion % 1 = strict (function, gradient and param change) (default) % 0 = weak - only function convergence required % * elem 4: arg in f_args with respect to which minimization is done (default is first) % * elem 5: (optional) Memory limit for lbfgs. If it's a positive integer % then lbfgs will be use. Otherwise ordinary bfgs is used % * elem 6: function change tolerance, default 1e-12 % * elem 7: parameter change tolerance, default 1e-6 % * elem 8: gradient tolerance, default 1e-5 % % Returns: % * x: the minimizer % * obj_value: the value of f at x % * convergence: 1 if normal conv, other values if not % * iters: number of iterations performed % % Example: see bfgsmin_example.m