perm filename NLLSFT.F4[NET,GUE] blob sn#041468 filedate 1973-05-10 generic text, type T, neo UTF8
      implicit double precision (a-h,o-z)
      dimension x(100),y(100),sigmay(100),a(10),sigmaa(10),deltaa(10),
     c yfit(100)
1     type 100
      accept 101,npts
      if (npts) 999,999,2
2     type 102
      accept 103,nterms
      type 104
      accept 105,mode
      do 10 i=1,npts
10    read (21,107) x(i),y(i),sigmay(i)
      type 108
      do 20 i=1,nterms
      accept 109,a(i)
20    deltaa(i)=.1*a(i)
      flamda=1.e-3
      csave=0.
      chisqr=0.
14    type 110
      accept 109,error
      if (error) 1,1,15
15    call curfit(x,y,sigmay,npts,nterms,mode,a,deltaa,sigmaa,flamda,
     c yfit,chisqr)
      type 200,chisqr
      do 30 i=1,nterms
30    type 201,i,a(i)
      if (dabs((csave-chisqr)/chisqr).le.error) goto 300
      csave=chisqr
      goto 15
300   do 310 i=1,nterms
310   type 201,i,sigmaa(i)
      type 203
      goto 14
999   stop
100   format(' number of points='$)
101   format(i)
102   format(' nterms='$)
103   format(i)
104   format(' mode='$)
105   format(i)
107   format(3d)
108   format('0input initial parameters:'/)
109   format(d)
110   format(' error='$)
200   format(' chisqr=',1pd20.8)
201   format(1x,i,1pd20.8)
203   format('1')
      end