ADSMAX Alternating directions method for direct search optimization. [x, fmax, nf] = ADSMAX(FUN, x0, STOPIT, SAVIT, P) attempts to maximize the function FUN, using the starting vector x0. The alternating directions direct search method is used. Output arguments: x = vector yielding largest function value found, fmax = function value at x, nf = number of function evaluations. The iteration is terminated when either - the relative increase in function value between successive iterations is <= STOPIT(1) (default 1e-3), - STOPIT(2) function evaluations have been performed (default inf, i.e., no limit), or - a function value equals or exceeds STOPIT(3) (default inf, i.e., no test on function values). Progress of the iteration is not shown if STOPIT(5) = 0 (default 1). If a non-empty fourth parameter string SAVIT is present, then `SAVE SAVIT x fmax nf' is executed after each inner iteration. By default, the search directions are the co-ordinate directions. The columns of a fifth parameter matrix P specify alternative search directions (P = EYE is the default). NB: x0 can be a matrix. In the output argument, in SAVIT saves, and in function calls, x has the same shape as x0. ADSMAX(fun, x0, STOPIT, SAVIT, P, P1, P2,...) allows additional arguments to be passed to fun, via feval(fun,x,P1,P2,...).