program lbfgsvarma implicit none c c ---------------------------------------------------------------------- c Program: lbfgsvarma c c Author: Tamara Gibson (Kolda), Fall 1995. c Copyright (c) 1996. c University of Maryland at College Park. c All rights reserved. c c Interface program to CUTE for lbfgsvar.F. c c ---------------------------------------------------------------------- c integer input parameter (input = 55) integer iout parameter (iout = 6) integer NMAX parameter (NMAX = 10000) integer N,M,i,nargs integer fevals,iter,retcode real time,dum,timset,timsol,timtot double precision x(NMAX),w1(NMAX),w2(NMAX) double precision f,g(NMAX),gnorm character*64 prbdat character*10 xnames(NMAX), pname real cputim integer iargc double precision MAX c c Read number of input arguments c nargs = iargc() c c Build data input file name for unix or vms systems. c prbdat = 'OUTSDIF.d' c c Open the relevant file. c OPEN (INPUT,FILE=PRBDAT,FORM='FORMATTED',STATUS='OLD') REWIND INPUT c c Set up SIF data. c TIME = CPUTIM( DUM ) CALL USETUP( INPUT, IOUT, N, X, W1, W2, NMAX ) c c Obtain Variable Names c call unames(N,pname,xnames) c c Evaluate the function and gradient c call UFN(N,x,f) call UGR(N,x,g) c c Take timings c timset = cputim(dum) - time time = cputim(dum) c c Call the Optimizer c call opt(N,x,f,g,fevals,iter,M,retcode) c c Report Output c gnorm = 0.0 do i = 1,N gnorm = max(gnorm,abs(g(i))) enddo timsol = cputim(dum) - time timtot = timset + timsol if (nargs .eq. 0) then if (retcode .ne. 0) then write(6,*) 'WARNING: Return code signals problem.' endif write(iout,2000) pname,M,retcode,iter,fevals,f,gnorm write(iout,2040) timset,timsol,timtot else write(iout,3000) pname, M, retcode, iter, fevals, f, . gnorm, timsol endif 2000 format(/,' Problem: ', A10, * /,' Value of M = ',I12 * /,' Exit Condition = ',I12, * /,' Iterations = ',I12, * /,' Function Evals = ',I12, * /,' Final F = ',1P,D12.4, * /,' Final norm of G = ',1P,D12.4) 2040 format(/,' Set up Time = ',0P,F12.2, * /,' Solve Time = ',0P,F12.2, * /,' Total Time = ',0P,F12.2,' seconds') 3000 format(A10,' ',I3,' ',I4,' ',I6,' ',I6,' ',D12.4,' ', * D12.4,' ',F7.2) c c End Program c end subroutine FEVAL(N,x,f) implicit none integer N double precision x(N),f call UFN(N,x,f) end subroutine GEVAL(N,x,g) implicit none integer N double precision x(N),g(N) call UGR(N,x,g) end