File indexing completed on 2018-03-02 18:36:17 UTC
view on githubraw file Latest commit f50e6c17 on 2003-11-19 19:07:02 UTC
4cee17c1be Patr*0001
0002 subroutine lsline(
0003 & simul
0004 & , nn, ifail, lphprint
0005 & , ifunc, nfunc
0006 & , ff, dotdg
0007 & , tmin, tmax, tact, epsx
0008 & , dd, gg, xx, xdiff
0009 & )
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
f50e6c1777 Patr*0048 #include "blas1.h"
4cee17c1be Patr*0049
0050 implicit none
0051
0052
0053
0054
0055 integer nn, ifail, ifunc, nfunc
0056 double precision ff, dotdg, tmin, tmax, tact, epsx
0057 double precision xx(nn), dd(nn), gg(nn), xdiff(nn)
0058
0059 logical lphprint
0060
0061 external simul
0062
0063
0064
0065
0066
0067 double precision xpara1, xpara2
0068 parameter( xpara1 = 0.0001, xpara2=0.9 )
0069
0070 double precision factor
0071 parameter( factor = 0.2 )
0072
0073 double precision barmax
0074 parameter( barmax = 0.3 )
0075 double precision barmul
0076 parameter( barmul = 5.0 )
0077 double precision barmin
0078 parameter( barmin = 0.01 )
0079
0080 integer i, indic
0081
0082 double precision tg, fg, td, ta
0083 double precision fa, fpa, fp
0084 double precision fnew, fdiff
0085 double precision z, test, barr
0086 double precision left, right, told
0087
ae287463fd Patr*0088 external DDOT
0089 double precision DDOT
4cee17c1be Patr*0090
0091
0092
0093
0094
0095 if ( (nn.le.0)
0096 & .or. (dotdg.ge.0.0)
0097 & .or. (xpara1.le.0.0) .or. (xpara1.ge.0.5)
0098 & .or. (xpara2.le.xpara1) .or. (xpara2.ge.1.0) ) then
0099 ifail = 9
0100 go to 999
0101 endif
0102
0103
0104
0105
0106 indic = 0
0107
0108 barr = barmin
0109 fg = ff
0110 fa = ff
0111 fpa = dotdg
0112
0113 td = 0.0
0114 tg = 0.0
0115 ta = 0.0
0116
0117
0118
0119
0120
0121 do ifunc = 1, nfunc
0122
0123 if (lphprint)
0124 & print *, 'pathei-lsopt: ', ifunc, ' simul.'
0125
0126
0127
0128
0129 call simul( indic, nn, xdiff, fnew, gg )
0130
ae287463fd Patr*0131 fp = DDOT( nn, dd, 1, gg, 1 )
4cee17c1be Patr*0132 fdiff = fnew - ff
0133
0134
0135
0136
0137 if (fdiff .gt. tact*xpara1*dotdg) then
0138 td = tact
0139 ifail = 0
0140 go to 500
0141 endif
0142
0143
0144
0145
0146 if (fp .gt. xpara2*dotdg) then
0147 ifail = 0
0148 go to 320
0149 endif
0150
0151 if (ifail.eq.0) go to 350
0152
0153
0154
0155
0156
0157 320 continue
0158
0159 ff = fnew
0160 do i = 1, nn
0161 xx(i) = xdiff(i)
0162 end do
0163
0164 if (lphprint)
0165 & print *, 'pathei-lsopt: no inter-/extrapolation in lsline'
0166
0167 go to 999
0168
0169
0170
0171
0172
0173
0174 350 continue
0175
0176 tg = tact
0177 fg = fnew
0178 if (td .ne. 0.0) go to 500
0179
0180 told = tact
0181 left = (1.0+barmin)*tact
0182 right = 10.0*tact
0183 call cubic( tact, fnew, fp, ta, fa, fpa, left, right )
0184 ta = told
0185 if (tact.ge.tmax) then
0186 ifail = 7
0187 tact = tmax
0188 endif
0189
0190 if (lphprint)
0191 & print *, 'pathei-lsopt: extrapolation: ',
0192 & 'td, tg, tact, ifail = ', td, tg, tact, ifail
0193
0194 go to 900
0195
0196
0197
0198
0199
0200 500 continue
0201
0202 test = barr*(td-tg)
0203 left = tg+test
0204 right = td-test
0205 told = tact
0206 call cubic( tact, fnew, fp, ta, fa, fpa, left, right )
0207 ta = told
0208 if (tact.gt.left .and. tact.lt.right) then
0209 barr = dmax1( barmin, barr/barmul )
0210 else
0211 barr = dmin1( barmul*barr, barmax )
0212 endif
0213
0214 if (lphprint)
0215 & print *, 'pathei-lsopt: interpolation: ',
0216 & 'td, tg, tact, ifail = ', td, tg, tact, ifail
0217
0218
0219
0220
0221
0222
0223
0224 900 continue
0225
0226 fa = fnew
0227 fpa = fp
0228
0229
0230
0231
0232 if (td .eq. 0.0) go to 950
0233 if (td-tg .lt. tmin) go to 920
0234
0235
0236
0237
0238 do i = 1, nn
0239 z = xx(i) + tact*dd(i)
0240 if ((z.ne.xx(i)) .and. (z.ne.xdiff(i))) go to 950
0241 end do
0242
0243
0244
0245
0246 920 continue
0247 ifail = 8
0248
0249
0250
0251
0252
0253 if (tg .ne. 0.0) then
0254 ff = fg
0255 do i = 1, nn
0256 xx(i) = xx(i) + tg*dd(i)
0257 end do
0258 endif
0259
0260 go to 999
0261
0262
0263
0264
0265 950 continue
0266
0267 do i = 1, nn
0268 xdiff(i) = xx(i) + tact*dd(i)
0269 end do
0270
0271
0272
0273
0274 end do
0275
0276
0277
0278
0279 ifail = 6
0280 ff = fg
0281 do i = 1, nn
0282 xx(i) = xx(i) + tg*dd(i)
0283 end do
0284
0285
0286
0287
0288 999 continue
0289
0290 return
0291
0292 end