1 subroutine minsumsl(nvar,x,minval)
2 implicit real*8 (a-h,o-z)
4 parameter (maxvar=maxene+3*nnbase)
5 parameter (liv=60,lv=(77+maxvar*(maxvar+17)/2))
6 *********************************************************************
7 * OPTIMIZE sets up SUMSL or DFP and provides a simple interface for *
8 * the calling subprogram. *
9 * when d(i)=1.0, then v(35) is the length of the initial step, *
10 * calculated in the usual pythagorean way. *
11 * absolute convergence occurs when the function is within v(31) of *
12 * zero. unless you know the minimum value in advance, abs convg *
13 * is probably not useful. *
14 * relative convergence is when the model predicts that the function *
15 * will decrease by less than v(32)*abs(fun). *
16 *********************************************************************
18 real*8 minval,x(nvar),d(maxvar),v(1:lv)
19 external funclik,grad,fdum
21 double precision rdum(1)
22 double precision urparm(maxT)
23 double precision g(maxvar)
24 call deflt(2,iv,liv,lv,v)
25 * 12 means fresh start, dont call deflt
27 * max num of fun calls
30 * max num of iterations
37 * 1 means to print out result
39 * 1 means to print out summary stats
41 * 1 means to print initial x and d
43 * min val for v(radfac) default is 0.1
45 * max val for v(radfac) default is 4.0
48 * check false conv if (act fnctn decrease) .lt. v(26)*(exp decrease)
49 * the sumsl default is 0.1
51 * false conv if (act fnctn decrease) .lt. v(34)
52 * the sumsl default is 100*machep
54 * absolute convergence
57 * relative convergence
60 * controls initial step size
62 * large vals of d correspond to small components of step
68 call funclik(nvar,x,nf,f,idum,urparm,fdum)
69 write (2,'(a,1pe17.10)') 'Initial function value:',f
70 call grad(nvar,x,nf,g,idum,urparm,fdum)
71 write (2,*) "Initial gradient"
73 write (2,'(i5,e15.5)') i,g(i)
75 c minimize the log-likelihood function
77 call sumsl(nvar,d,x,funclik,grad,iv,liv,lv,v,idum,urparm,fdum)
80 write (2,'(a,i4)') 'SUMSL return code:',iv(1)
81 write (2,'(a,1pe17.10)') 'Final function value:',minval
82 c print *,"exiting minsumsl"
85 c---------------------------------------------------------------------