42 function sshift( data,spct,ldspct,nsi,npt,nft,ideriv,srange,
43 # ctol,noneg,tmpdat,tmpclc,wspec,work,sfac )
48 double precision sshift
50 integer iarr,ideriv,ldspct,nsi,npt,nft,noneg
51 double precision spct(ldspct,nsi),data(npt),tmpdat(2*nft),
52 # tmpclc(2*nft),wspec(ldspct,nsi),work(2*nft),
53 # sfac(nsi),srange,ctol,err
55 integer i,info,irng,isi,ixmx,ixw1,ixw2,ixw3,j,jtmp,k,mneg,
58 double precision a,approx,asum,b,c,c1m,d1m,dummy,ovmax,
59 # scl,shift,smax,smin,temp,xfrac
67 double precision fmomnt
69 external fmomnt,lgrint
78 smax = dabs( srange*npt )
79 d1m=dabs( fmomnt(
data,npt,ideriv ) )
82 c1m=c1m+dabs( fmomnt( spct(1,i),npt,ideriv ) )
85 approx = d1m-c1m/dble(nsi)
86 if (approx.gt.smax .or. approx.lt.-smax) approx=zero
87 mnrng = max0( int(approx-smax)+nft/2, 1 )
88 mxrng = min0( int(approx+smax)+nft/2, npt )
110 tmpclc(j)=spct(j,isi)
116 call correl( tmpdat,tmpclc,nft,wspec(1,isi),work )
127 asum=asum+spct(i,j)*spct(i,k)
130 if (k.ne.j) amat(k,j)=asum
140 call qrfac(nsi,nsi,amat,
mxsite,.true.,jpvt,nsi,rdiag,
141 # work(ixw1),work(ixw2) )
158 if (dabs(amat(i,i)) .le. ctol*dabs(amat(1,1)) )
go to 21
175 21
do irng=mnrng,mxrng
183 tmpdat(j)=wspec(irng,j)
192 # .false.,work(ixw1) )
200 scl=tmpscl( jpvt(j) )
202 tmpclc(irng)=tmpclc(irng)+scl*wspec(irng,j)
214 if (tmpclc(irng).gt.ovmax)
then
230 iarr=max(ixmx-2,mnrng)
231 iarr=min(iarr,mxrng-4)
232 xfrac=lgrint(tmpclc(iarr),err)
234 shift=dble(ixmx-(nft/2)-1)+xfrac
241 if (ixmx.gt.mnrng.and. ixmx.lt.mxrng)
then
244 b = 0.5d0*(wspec(ixmx+1,j)-wspec(ixmx-1,j))
245 c = 0.5d0*(wspec(ixmx+1,j)+wspec(ixmx-1,j))-a
246 tmpdat(j)= a + b*xfrac + c*xfrac*xfrac
251 tmpdat(j)=wspec(ixmx,j)
261 call rsolve( nsi,k,amat,
mxsite,work,work(ixw1),tmpscl,.false.,
272 if (noneg.ne.0.and.k.gt.1)
then
276 if (tmpscl(i).lt.smin)
then
285 #
mxsite,1,work(ixw2),work(ixw3),2)
305 if (i.gt.k) sfac(i)=zero
312 if (jpvt(i).le.0)
then
316 50
if (k.eq.i)
goto 70
subroutine qrfac(m, n, a, lda, pivot, ipvt, lipvt, rdiag, acnorm, wa)
subroutine dchex(r, ldr, p, k, l, z, ldz, nz, c, s, job)
double precision function sshift(data, spct, ldspct, nsi, npt, nft, ideriv, srange, ctol, noneg, tmpdat, tmpclc, wspec, work, sfac)
subroutine correl(data, spctr, npt, ans, fft)
integer, parameter mxsite
subroutine qtbvec(m, n, q, ldq, qraux, b, qtb)
subroutine rsolve(m, n, q, ldq, qraux, qtb, x, rcalc, rsd)