function [xo,Ot,nS]=dfp(S,x0,ip,G,method,Lb,Ub,problem,tol,mxit)
//   Unconstrained optimization using DFP.
//
//   [xo,Ot,nS]=dfp(S,x0,ip,G,method,Lb,Ub,problem,tol,mxit)
//
//   S: objective function
//   x0: initial point
//   ip: (0) no plot (default), (>0) plot figure ip with pause, (<0) plot figure ip
//   G: gradient vector function
//   method: line-search method: (0) quadratic+cubic (default), (1) cubic
//   Lb, Ub: lower and upper bound vectors to plot (default = x0*(1+/-2))
//   problem: (-1): minimum (default), (1): maximum
//   tol: tolerance (default = 1e-4)
//   mxit: maximum number of iterations (default = 50*(1+4*~(ip>0)))
//   xo: optimal point
//   Ot: optimal value of S
//   nS: number of objective function evaluations

//   Copyright (c) 2001 by LASIM-DEQUI-UFRGS
//   $Revision: 1.0 $  $Date: 2001/07/12 19:50:25 $
//   Argimiro R. Secchi (arge@enq.ufrgs.br)

 if nargin < 2,
   error('dfp requires two input arguments');
 end
 if nargin < 3 || isempty(ip),
   ip=0;
 end
 if nargin < 4 || isempty(G),
   G=[];
 end
 if nargin < 5 || isempty(method),
   method=0;
 end
 if nargin < 6 || isempty(Lb),
   Lb=-x0-~x0;
 end
 if nargin < 7 || isempty(Ub),
   Ub=2*x0+~x0;
 end
 if nargin < 8 || isempty(problem),
   problem=-1;
 end
 if nargin < 9 || isempty(tol),
   tol=1e-4;
 end
 if nargin < 10 || isempty(mxit),
   mxit=50*(1+4*~(ip>0));
 end

exec varmetr.sci;
[xo,Ot,nS]=varmetr('dfp',S,x0,ip,G,method,Lb,Ub,problem,tol,mxit);
endfunction
