File indexing completed on 2018-03-02 18:36:18 UTC
view on githubraw file Latest commit f50e6c17 on 2003-11-19 19:07:02 UTC
4cee17c1be Patr*0001
0002 subroutine lsupdxx(
0003 & nn, ifail, lphprint
0004 & , jmin, jmax, nupdate
0005 & , ff, fmin, fold, gnorm0, dotdg
0006 & , gg, dd, xx, xdiff
0007 & , tmin, tmax, tact, epsx
0008 & )
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
f50e6c1777 Patr*0030 #include "blas1.h"
4cee17c1be Patr*0031
0032 implicit none
0033
0034
0035
0036
0037 integer nn, jmin, jmax, nupdate, ifail
0038 double precision ff, fmin, fold, gnorm0, dotdg
0039 double precision gg(nn), dd(nn), xx(nn), xdiff(nn)
0040 double precision tmin, tmax, tact, epsx
0041 logical lphprint
0042
0043
0044
0045
0046 integer i
0047 double precision fdiff, preco
0048
ae287463fd Patr*0049 double precision DDOT
0050 external DDOT
4cee17c1be Patr*0051
0052
0053
0054
0055
0056
0057
0058
0059 if ( ( jmax .eq. 0 ) .or. (nupdate .eq. 0 ) ) then
0060
0061 if (jmax .eq. 0) then
0062 fold = fmin
0063 if (lphprint)
0064 & print *, 'pathei-lsopt: using fold = fmin = ', fmin
0065 end if
0066 fdiff = fold - ff
0067 if (jmax .eq. 0) fdiff = ABS(fdiff)
0068
0069 preco = 2. * fdiff / (gnorm0*gnorm0)
0070 do i = 1, nn
0071 dd(i) = -gg(i)*preco
0072 end do
0073
0074 if (lphprint)
0075 & print *, 'pathei-lsopt: first estimate of dd via ',
0076 & 'fold - ff'
0077
0078
0079
0080
0081
0082
0083 else
0084
0085 do i = 1, nn
0086 dd(i) = -gg(i)
0087 end do
0088
0089 if (jmax .gt. 0) then
0090 call hessupd( nn, nupdate, dd, jmin, jmax, xdiff,
0091 & lphprint )
0092 else
0093 if (lphprint)
0094 & print *, 'pathei-lsopt: no hessupd for first optim.'
0095 end if
0096
0097 endif
0098
0099
0100
0101
ae287463fd Patr*0102 dotdg = DDOT( nn, dd, 1, gg, 1 )
4cee17c1be Patr*0103 if (dotdg .ge. 0.0) then
0104 ifail = 4
0105 goto 999
0106 end if
0107
0108
0109
0110
0111
0112 tmin = 0.
0113 do i = 1, nn
0114 tmin = max( tmin, abs(dd(i)) )
0115 end do
0116 tmin = epsx/tmin
0117
0118
0119
0120
0121
0122
0123 tact = 1.0
0124 tmax = 1.0e+10
0125 if (tact.le.tmin) then
0126 tact = tmin
0127 if (tact.gt.tmax) then
0128 tmin = tmax
0129 endif
0130 endif
0131
0132 if (tact .gt. tmax) then
0133 tact = tmax
0134 ifail = 7
0135 endif
0136
0137
0138
0139
0140 do i = 1, nn
0141 xdiff(i) = xx(i) + tact*dd(i)
0142 end do
0143
0144
0145
0146
0147
0148 999 continue
0149
0150 return
0151
0152 end