57 INTEGER(mpi),
PARAMETER ::
msfd=20
89SUBROUTINE ptline(n,x,f,g,s,step, info)
93 INTEGER(mpi),
INTENT(IN) :: n
94 REAL(mpd),
INTENT(IN OUT) :: x(n)
95 REAL(mpd),
INTENT(IN OUT) :: f
96 REAL(mpd),
INTENT(IN OUT) :: g(n)
97 REAL(mpd),
INTENT(IN OUT) :: s(n)
98 REAL(mpd),
INTENT(OUT) :: step
99 INTEGER(mpi),
INTENT(OUT) :: info
124 IF(dginit >= 0.0_mpd)
GO TO 100
143 IF(dg < sfd(3,im))
THEN
148 IF(dg <= 0.0_mpd)
THEN
149 IF(dg >= sfd(3,idgl)) idgl=nsfd
151 IF(dg >= 0.0_mpd)
THEN
152 IF(idgr == 0) idgr=nsfd
153 IF(dg <= sfd(3,idgr)) idgr=nsfd
165 sfd(4,nsfd)=(sfd(1,i1)*fp2-sfd(1,i2)*fp1)/(fp2-fp1)
168 IF(nsfd >= minf.AND.abs(dg) <= abs(dginit)*gtol)
THEN
174 IF(sfd(3,idgr)+sfd(3,idgl) < 0.0_mpd) idgm=idgr
178 IF(nsfd >= maxf)
GO TO 102
179 alpha=min(sfd(4,nsfd),stmx)-tot
180 IF(abs(alpha) < 1.0e-3_mpd.AND.sfd(4,nsfd) > stmx)
GO TO 103
181 IF(abs(alpha) < 1.0e-3_mpd)
GO TO 104
203 IF(abs(sfd(3,i)) < abs(sfd(3,im))) im=i
205 alpha=sfd(1,im)-sfd(1,nsfd)
206 IF(im == nsfd)
RETURN
232SUBROUTINE ptldef(gtole,stmax,minfe,maxfe)
236 INTEGER(mpi),
INTENT(IN) :: minfe
237 INTEGER(mpi),
INTENT(IN) :: maxfe
238 REAL(mps),
INTENT(IN) :: gtole
239 REAL(mps),
INTENT(IN) :: stmax
241 gtol=max(1.0e-4,min(gtole,0.9e0))
242 IF(gtole == 0.0)
gtol=0.9_mpd
247 IF(maxfe == 0)
maxf=5
262 INTEGER(mpi),
INTENT(OUT) :: nf
263 INTEGER(mpi),
INTENT(OUT) :: m
264 REAL(mps),
DIMENSION(3),
INTENT(OUT) :: slopes
265 REAL(mps),
DIMENSION(3),
INTENT(OUT) :: steps
279 IF(abs(
sfd(3,i)) < abs(
sfd(3,m))) m=i
281 slopes(1)=real(
sfd(3,1))
283 slopes(3)=real(
sfd(3,m))
284 steps(1) =real(
sfd(1,1))
286 steps(3) =real(
sfd(1,m))
302 INTEGER(mpi),
INTENT(IN) :: lunp
304 CHARACTER (LEN=2) :: tlr
310 WRITE(lun,*)
'PTLINE: line-search method based on slopes', &
311 ' with sufficient slope-decrease'
312 WRITE(lun,*)
'PTLDEF: slope ratio limit=',
gtol
313 WRITE(lun,*)
'PTLDEF: maximum step =',
stmx
314 WRITE(lun,*)
'PTLDEF:',
minf,
' <= nr of calls <=',
maxf
318 IF(abs(
sfd(3,i)) < abs(
sfd(3,im))) im=i
323 IF(i ==
idgl) tlr(1:1)=
'L'
324 IF(i ==
idgr) tlr(2:2)=
'R'
326 WRITE(lun,102) i-1,
sfd(1,i),tlr,(
sfd(j,i),j=2,4)
328 ratio=real(abs(
sfd(3,i)/
sfd(3,1)))
329 WRITE(lun,103) i-1,
sfd(1,i),tlr,(
sfd(j,i),j=2,4),ratio
333 IF(
lsinfo == 0)
WRITE(lun,*) &
334 'PTLINE: INFO=0 input error (e.g. gradient not negative)'
335 IF(
lsinfo == 1)
WRITE(lun,*)
'PTLINE: INFO=1 convergence reached'
336 IF(
lsinfo == 2)
WRITE(lun,*)
'PTLINE: INFO=2 too many function calls'
337 IF(
lsinfo == 3)
WRITE(lun,*)
'PTLINE: INFO=3 maximum step reached'
338 IF(
lsinfo == 4)
WRITE(lun,*)
'PTLINE: INFO=4 step too small (< 0.001)'
341101
FORMAT(
' i x F(x) F''(X)', &
343102
FORMAT(i3,f12.6,1x,a2,g15.6,g14.6,f12.6,
' ratio')
344103
FORMAT(i3,f12.6,1x,a2,g15.6,g14.6,f12.6,f10.3)
subroutine ptlopt(nf, m, slopes, steps)
Get details.
subroutine ptline(n, x, f, g, s, step, info)
Perform linesearch.
subroutine ptldef(gtole, stmax, minfe, maxfe)
Initialize line search.
subroutine ptlprt(lunp)
Print line search data.
real(mpd) gtol
slope ratio
integer(mpi) nsfd
number of function calls
integer(mpi) idgm
index of minimal slope
real(mpd), dimension(4, msfd) sfd
abscissa; function value; slope; predicted zero
integer(mpi) lsinfo
(status) information
integer(mpi) idgr
index of smallest positive slope
integer(mpi) idgl
index of smallest negative slope
integer(mpi), parameter msfd
real(mpd) stmx
maximum slope ratio
integer, parameter mpd
double precision