87 INTEGER,
PARAMETER :: maxFitPar=250
88 INTEGER,
PARAMETER :: maxFitSymMatSize=(maxFitPar*maxFitPar+maxFitPar)/2
89 INTEGER,
PARAMETER :: maxBandWidth=10
90 INTEGER,
PARAMETER :: maxBorderSize=10
91 INTEGER,
PARAMETER :: maxTrackPar=maxBorderSize+5
92 INTEGER,
PARAMETER :: maxTrackSymMatSize=(maxTrackPar*maxTrackPar+maxTrackPar)/2
93 INTEGER,
PARAMETER :: maxPoints=1000
94 INTEGER,
PARAMETER :: sizeDataBuffer=10*maxPoints
98 INTEGER :: offsetDimension
103 INTEGER :: numOffsets
105 INTEGER :: lastOffset
106 INTEGER :: lastScatterer
110 INTEGER :: numAddLocPar
111 INTEGER :: extSeedPoint
112 INTEGER :: firstActiveCoord
113 INTEGER :: lastDownWeightMethod
114 DOUBLE PRECISION,
DIMENSION(maxFitPar) :: vecb
115 DOUBLE PRECISION,
DIMENSION(maxFitSymMatSize) :: matA
116 DOUBLE PRECISION,
DIMENSION(maxTrackSymMatSize) :: extSeedMat
117 DOUBLE PRECISION,
DIMENSION(maxTrackPar*maxTrackPar) :: jacTrackToFit
124 DOUBLE PRECISION,
DIMENSION(5,5) :: jacPointToPoint
125 DOUBLE PRECISION,
DIMENSION(2,2) :: prevJ
126 DOUBLE PRECISION,
DIMENSION(2,2) :: prevS
127 DOUBLE PRECISION,
DIMENSION(2) :: prevd
128 DOUBLE PRECISION,
DIMENSION(2,2) :: nextJ
129 DOUBLE PRECISION,
DIMENSION(2,2) :: nextS
130 DOUBLE PRECISION,
DIMENSION(2) :: nextd
131 DOUBLE PRECISION,
DIMENSION(2,2) :: matProj
132 INTEGER,
DIMENSION(2) :: indLocal
133 INTEGER,
DIMENSION(2) :: indGlobal
134 REAL,
DIMENSION(2) :: measValue
135 REAL,
DIMENSION(2) :: measPrec
136 REAL,
DIMENSION(2) :: scatValue
137 REAL,
DIMENSION(2) :: scatPrec
141 INTEGER :: numDataBlocks
142 INTEGER :: integDataSize
143 INTEGER :: maxDataSize
144 INTEGER,
DIMENSION(sizeDataBuffer) :: intData
146 REAL,
DIMENSION(sizeDataBuffer) :: floatData
148 INTEGER :: maxUsedFitPar = 0
149 INTEGER :: lastNumFitPar = 0
150 INTEGER :: lastBorderSize = 0
151 INTEGER :: lastBandWidth = 0
166 SUBROUTINE gblfit(cdw,mrank,np,ndf,chi2,wls)
176 CHARACTER (LEN=*),
INTENT(IN) :: cdw
177 INTEGER,
INTENT(OUT) :: mrank
178 INTEGER,
INTENT(OUT) :: np
179 INTEGER,
INTENT(OUT) :: ndf
180 REAL,
INTENT(OUT) :: chi2
181 REAL,
INTENT(OUT) :: wls
192 IF (trajlevel < 3) return
196 mrank=numcurv+2*offsetdimension
199 IF (printlevel > 1) print *,
' GBLFIT: NPAR, NBND, NBDR ', numfitpar, bandsize, numcurv+numaddlocpar
201 CALL
sqmibb(mata,vecb,numfitpar,numcurv+numaddlocpar,bandsize,inv,nrank)
202 IF (nrank /= numfitpar)
THEN
203 IF (printlevel > 1) print *,
' GBLFIT: rank deficit ', nrank, numfitpar
213 IF (iter <= lcdw) idwm=(index(
'TtHhCc',cdw(iter:iter))+1)/2
215 CALL
gblch2(idwm,chi2,swgt)
216 ndf=numdatablocks-numfitpar
221 wls=float(numdatablocks)-swgt
237 ijsym(i,j)=min(i,j)+(max(i,j)*max(i,j)-max(i,j))/2
239 IF (trajlevel == 1) CALL
gblcjc
240 IF (trajlevel /= 2) return
241 IF (numoffsets < 2) return
243 numaddlocpar=min(numaddlocpar,maxbordersize-numcurv)
244 numfitpar=numoffsets*offsetdimension+numcurv+numaddlocpar
245 IF (numfitpar > maxfitpar) return
265 DOUBLE PRECISION :: ajaci(5,5)
266 DOUBLE PRECISION :: ajacn(5,5)
267 DOUBLE PRECISION :: ajact(5,5)
274 DO ipoint=2,numpoints
276 ajacn=points(ipoint)%jacPointToPoint
281 forall(i=1:5,j=1:5) ajact(i,j)=sum(ajacn(i,:)*ajaci(:,j))
287 points(ipoint)%prevJ=ajact(4:5,4:5)
288 points(ipoint)%prevS=ajact(4:5,2:3)
289 points(ipoint)%prevd=ajact(4:5,1)
291 IF (points(ipoint)%offset > 0)
THEN
293 points(lastpoint)%nextJ=ajaci(4:5,4:5)
294 points(lastpoint)%nextS=ajaci(4:5,2:3)
295 points(lastpoint)%nextd=ajaci(4:5,1)
306 DO ipoint=numpoints-1,1,-1
308 IF (points(ipoint)%offset > 0)
THEN
313 ajacn=points(ipoint+1)%jacPointToPoint
318 forall(i=1:5,j=1:5) ajact(i,j)=sum(ajaci(i,:)*ajacn(:,j))
323 points(ipoint)%nextJ=ajaci(4:5,4:5)
324 points(ipoint)%nextS=ajaci(4:5,2:3)
325 points(ipoint)%nextd=ajaci(4:5,1)
342 INTEGER,
INTENT(IN) :: lprnt
343 INTEGER,
OPTIONAL,
INTENT(IN) :: icoord
350 IF (present(icoord))
THEN
354 IF (icoord > 1) firstactivecoord=1
369 maxdatasize=sizedatabuffer
372 IF (ifirst == 1)
THEN
374 IF (printlevel > 0) print *,
' GBL $Rev: 67 $'
389 DOUBLE PRECISION,
INTENT(IN) :: ajac(5,5)
390 INTEGER,
INTENT(OUT) :: ipoint
393 IF (numpoints >= maxpoints)
THEN
394 IF (printlevel > 0) print *,
' GBLADP: too many points, ignoring new point '
397 numpoints=numpoints+1
398 points(numpoints)%offset=0
399 points(numpoints)%indMeas=0
400 points(numpoints)%indScat=0
401 points(numpoints)%indKink=0
402 points(numpoints)%indLocal=0
403 points(numpoints)%indGlobal=0
406 points(numpoints)%jacPointToPoint=ajac
408 points(numpoints)%prevJ=0.0d0
409 points(numpoints)%prevS=0.0d0
410 points(numpoints)%prevd=0.0d0
411 points(numpoints)%nextJ=0.0d0
412 points(numpoints)%nextS=0.0d0
413 points(numpoints)%nextd=0.0d0
415 IF (lastoffset > 0)
THEN
416 IF (points(lastoffset)%indScat <= 0.AND.numoffsets > 1)
THEN
417 numoffsets=numoffsets-1
418 points(lastoffset)%offset=-points(lastoffset)%offset
421 numoffsets=numoffsets+1
422 points(numpoints)%offset=numoffsets
424 IF (numoffsets > 2.AND.lastscatterer > 0)
THEN
426 points(lastscatterer)%indKink=numkinks
445 DOUBLE PRECISION,
INTENT(IN) :: proj(2,2)
446 REAL,
INTENT(IN) :: res(2)
447 REAL,
INTENT(IN) :: prec(2)
449 IF (numpoints <= 0)
THEN
450 IF (printlevel > 0) print *,
' GBLADM: no point defined'
453 IF (nummeas+numscat >= maxpoints)
THEN
454 IF (printlevel > 0) print *, &
455 ' GBLADM: too many measurement+scatterers ', nummeas+numscat
458 IF (points(numpoints)%indMeas <= 0)
THEN
460 points(numpoints)%indMeas=1
461 points(numpoints)%matProj=proj
462 points(numpoints)%measValue=res
463 points(numpoints)%measPrec=prec
465 IF (printlevel > 0) print *, &
466 ' GBLADM: measurement already defined for point ', numpoints
484 INTEGER,
INTENT(IN) :: nder
485 REAL,
INTENT(IN) :: der(2,nder)
486 INTEGER,
INTENT(OUT) :: iret
489 IF (numpoints <= 0)
THEN
490 IF (printlevel > 0) print *,
' GBLADL: no point defined'
496 IF (points(numpoints)%indLocal(im) == 0)
THEN
498 IF (integdatasize > maxdatasize-nder) return
501 IF (der(im,k) /= 0.0)
THEN
502 numaddlocpar=max(numaddlocpar,k)
503 intdata(maxdatasize)=k
504 floatdata(maxdatasize)=der(im,k)
505 maxdatasize=maxdatasize-1
509 points(numpoints)%indLocal(im)=maxdatasize
510 intdata(maxdatasize)=mdat0-maxdatasize
511 floatdata(maxdatasize)=0.0
512 maxdatasize=maxdatasize-1
513 iret=iret+mdat0-maxdatasize
516 IF (printlevel > 0) print *, &
517 ' GBLADL: local derivatives already defined for point ', numpoints
538 INTEGER,
INTENT(IN) :: nder
539 INTEGER,
INTENT(IN) :: lder(nder)
540 REAL,
INTENT(IN) :: der(2,nder)
541 INTEGER,
INTENT(OUT) :: iret
544 IF (numpoints <= 0)
THEN
545 IF (printlevel > 0) print *,
' GBLADG: no point defined'
551 IF (points(numpoints)%indGlobal(im) == 0)
THEN
553 IF (integdatasize > maxdatasize-nder) return
556 IF (der(im,k) /= 0.0)
THEN
557 intdata(maxdatasize)=lder(k)
558 floatdata(maxdatasize)=der(im,k)
559 maxdatasize=maxdatasize-1
563 points(numpoints)%indGlobal(im)=maxdatasize
564 intdata(maxdatasize)=mdat0-maxdatasize
565 floatdata(maxdatasize)=0.0
566 maxdatasize=maxdatasize-1
567 iret=iret+mdat0-maxdatasize
570 IF (printlevel > 0) print *, &
571 ' GBLADG: global derivatives already defined for point ', numpoints
591 REAL,
INTENT(IN) :: res(2)
592 REAL,
INTENT(IN) :: prec(2)
594 IF (numpoints <= 0)
THEN
595 IF (printlevel > 0) print *,
' GBLADS: no point defined'
598 IF (nummeas+numscat >= maxpoints)
THEN
599 IF (printlevel > 0) print *, &
600 ' GBLADS: too many measurement+scatterers ', nummeas+numscat
603 IF (prec(1) <= 0.0.OR.prec(2) <= 0.0)
THEN
604 IF (printlevel > 0) print *,
' GBLADS: invalid scattering precision ', prec
608 IF (points(numpoints)%indScat <= 0)
THEN
609 jscat=maxpoints-numscat
611 points(numpoints)%indScat=1
612 lastscatterer=numpoints
613 points(numpoints)%scatValue=res
614 points(numpoints)%scatPrec=prec
616 IF (printlevel > 0) print *,
' GBLADM: scatterer already defined for point ', numpoints
628 IF (numpoints <= 0)
THEN
629 print *,
' GBLDMP no trajectory defined '
634 print *,
' GBLDMP trajectory definition '
635 print *,
'-------------------------------------'
636 print *,
' number of points ', numpoints
637 print *,
' number of offsets ', numoffsets
638 print *,
' number of scatterers ', numscat
639 print *,
' number of measurements ', nummeas
640 print *,
' number of kinks ', numkinks
641 IF (numaddlocpar > 0) print *,
' number of local par. ', numaddlocpar
645 print *,
' Point ', i
646 IF (points(i)%offset > 0) print *,
' Offset ', points(i)%offset
647 IF (points(i)%indScat > 0) print *,
' Scatterer ', points(i)%indScat
648 IF (points(i)%indMeas > 0)
THEN
649 IF (points(i)%offset > 0)
THEN
650 print *,
' Measurement using offset ',points(i)%offset
652 print *,
' Measurement using offsets ', &
653 -points(i)%offset-1,
' ,',-points(i)%offset
656 IF (points(i)%indKink > 0) print *,
' Kink ', points(i)%indKink, &
657 ' using offsets ',points(i)%offset-1,
'..',points(i)%offset+1
658 IF (points(i)%indMeas <= 0.AND.points(i)%indScat <= 0)
THEN
659 IF (points(i)%offset > 0)
THEN
660 print *,
' Prediction ',
' using offset ',points(i)%offset
663 print *,
' Prediction ', &
664 ' using offsets ',-points(i)%offset-1,
' ,',-points(i)%offset
702 DOUBLE PRECISION :: tc2l(2,2)
703 DOUBLE PRECISION :: wp(2,2)
704 DOUBLE PRECISION :: wn(2,2)
705 DOUBLE PRECISION :: wjp(2,2)
706 DOUBLE PRECISION :: wjn(2,2)
707 DOUBLE PRECISION :: dwp(2)
708 DOUBLE PRECISION :: dwn(2)
709 DOUBLE PRECISION :: wjs(2,2)
710 DOUBLE PRECISION :: wji(2,2)
711 DOUBLE PRECISION :: pn(2,2)
712 DOUBLE PRECISION :: wpp(2,2)
713 DOUBLE PRECISION :: wpn(2,2)
714 DOUBLE PRECISION :: dws(2)
715 DOUBLE PRECISION :: dps(2)
716 DOUBLE PRECISION :: det
717 DOUBLE PRECISION :: diag(maxtrackpar)
718 DOUBLE PRECISION :: eigen(maxtrackpar*maxtrackpar)
719 DOUBLE PRECISION :: work(maxtrackpar)
720 DOUBLE PRECISION :: seed(maxtrackpar*maxtrackpar)
721 INTEGER :: iwork(maxtrackpar)
725 lastdownweightmethod=0
732 joff=points(jpnt)%offset
733 ipar0=offsetdimension*(joff-1)+numcurv+numaddlocpar
735 IF (points(jpnt)%indKink > 0)
THEN
736 jscat=points(jpnt)%indScat
738 CALL
gblder(jpnt,-1,wp,wjp,dwp)
739 CALL
gblder(jpnt, 2,wn,wjn,dwn)
743 DO m=1,offsetdimension
744 kdat=maxdatasize-(numcurv+3*offsetdimension)
745 IF (integdatasize+3 > kdat) return
749 numdatablocks=numdatablocks +1
750 intdata(integdatasize+1)=3
751 intdata(integdatasize+2)=jpnt
752 intdata(integdatasize+3)=-m
753 floatdata(integdatasize+1)=points(jpnt)%scatValue(m)
754 floatdata(integdatasize+2)=points(jpnt)%scatPrec(m)
755 floatdata(integdatasize+3)=1.0
756 integdatasize=integdatasize+3
759 floatdata(kdat+1)= -sngl(dws(m))
761 DO l=1,offsetdimension
763 intdata(idx)= ipar0+l-offsetdimension
764 floatdata(idx)= sngl( wp(m,l+l0))
765 idx=idx+offsetdimension
766 intdata(idx)= ipar0+l
767 floatdata(idx)= sngl(-wjs(m,l+l0))
768 idx=idx+offsetdimension
769 intdata(idx)= ipar0+l+offsetdimension
770 floatdata(idx)= sngl( wn(m,l+l0))
772 kdat=kdat+3*offsetdimension
775 IF (floatdata(k) /= 0.0)
THEN
776 integdatasize=integdatasize+1
777 intdata(integdatasize)=intdata(k)
778 floatdata(integdatasize)=floatdata(k)
779 ipmn=min(ipmn,intdata(integdatasize))
782 intdata(ldat0+1)=integdatasize-ldat0
787 jmeas=points(jpnt)%indMeas
789 tc2l=points(jpnt)%matProj
790 ipar0=offsetdimension*(joff-1)+numcurv+numaddlocpar
792 ipar0=offsetdimension*(-joff-2)+numcurv+numaddlocpar
793 CALL
gblder(jpnt,-1,wp,wjp,dwp)
794 CALL
gblder(jpnt, 2,wn,wjn,dwn)
797 det=wjs(1,1)*wjs(2,2)-wjs(1,2)*wjs(2,1)
798 wji(1,1)= wjs(2,2)/det;wji(1,2)=-wjs(1,2)/det
799 wji(2,1)=-wjs(2,1)/det;wji(2,2)= wjs(1,1)/det
800 forall(i=1:2,j=1:2) pn(i,j)=sum(tc2l(i,:)*wji(:,j))
801 forall(i=1:2,j=1:2) wpp(i,j)=sum(pn(i,:)*wp(:,j))
802 forall(i=1:2,j=1:2) wpn(i,j)=sum(pn(i,:)*wn(:,j))
803 forall(i=1:2) dps(i)=sum(dws(:)*pn(i,:))
808 IF (points(jpnt)%measPrec(m) <= 0.0) cycle
809 kdat=maxdatasize-(numcurv+2*offsetdimension)
810 IF (integdatasize+3 > kdat) return
814 numdatablocks=numdatablocks+1
815 intdata(integdatasize+1)=3
816 intdata(integdatasize+2)=jpnt
817 intdata(integdatasize+3)=m
818 floatdata(integdatasize+1)=points(jpnt)%measValue(m)
819 floatdata(integdatasize+2)=points(jpnt)%measPrec(m)
820 floatdata(integdatasize+3)=1.0
821 integdatasize=integdatasize+3
824 DO l=1,offsetdimension
825 intdata(kdat+1)= ipar0+l
826 floatdata(kdat+1)= sngl(tc2l(m,l+l0))
832 floatdata(kdat+1)= -sngl(dps(m))
834 DO l=1,offsetdimension
836 intdata(idx)= ipar0+l
837 floatdata(idx)= sngl(wpp(m,l+l0))
838 idx=idx+offsetdimension
839 intdata(idx)= ipar0+l+offsetdimension
840 floatdata(idx)= sngl(wpn(m,l+l0))
842 kdat=kdat+2*offsetdimension
845 IF (floatdata(k) /= 0.0)
THEN
846 integdatasize=integdatasize+1
847 intdata(integdatasize)=intdata(k)
848 floatdata(integdatasize)=floatdata(k)
849 ipmn=min(ipmn,intdata(integdatasize))
852 intdata(ldat0+1)=integdatasize-ldat0
854 ilcl=points(jpnt)%indLocal(m)
857 IF (integdatasize+nlcl > maxdatasize) cycle
859 IF (intdata(ilcl+k) <= numaddlocpar)
THEN
860 integdatasize=integdatasize+1
861 intdata(integdatasize)=intdata(ilcl+k)+numcurv
862 floatdata(integdatasize)=floatdata(ilcl+k)
863 ipmn=min(ipmn,intdata(integdatasize))
866 intdata(ldat0+1)=integdatasize-ldat0
873 IF (extseedpoint /= 0)
THEN
874 IF (extseedmat(1) > 0.0d0) ipmn=1
876 nb=numcurv+numaddlocpar
877 npsd=nb+2*offsetdimension
880 CALL
gbljac(extseedpoint,1,ioff1)
881 CALL
devrot(nplc,diag,eigen,extseedmat,work,iwork)
882 forall(i=1:nplc,j=1:npsd) seed((j-1)*nplc+i)=sum(eigen((i-1)*nplc+1:i*nplc) &
883 *jactracktofit((j-1)*nplc+1:j*nplc))
884 ip0=(ioff1-1)*offsetdimension
887 IF (diag(i) > 0.0)
THEN
888 IF (integdatasize+3+npsd > maxdatasize) return
890 numdatablocks=numdatablocks+1
891 intdata(integdatasize+1)=3
892 intdata(integdatasize+2)=extseedpoint
893 intdata(integdatasize+3)=i
894 floatdata(integdatasize+1)=0.0
895 floatdata(integdatasize+2)=sngl(diag(i))
896 floatdata(integdatasize+3)=1.0
897 integdatasize=integdatasize+3
899 IF (seed((j-1)*nplc+i) /= 0.0)
THEN
900 integdatasize=integdatasize+1
902 intdata(integdatasize)=j+ip0
904 intdata(integdatasize)=j
906 floatdata(integdatasize)=sngl(seed((j-1)*nplc+i))
909 intdata(ldat0+1)=integdatasize-ldat0
915 IF (ipmn > numcurv)
THEN
920 numfitpar=numfitpar-ipoff
923 ltem=intdata(integdatasize+1)
924 forall(j=integdatasize+4:integdatasize+ltem) intdata(j)=intdata(j)-ipoff
925 integdatasize=integdatasize+ltem
944 INTEGER,
INTENT(IN OUT) :: ipoint
945 INTEGER,
INTENT(IN) :: idir
946 DOUBLE PRECISION,
INTENT(OUT) :: w(2,2)
947 DOUBLE PRECISION,
INTENT(OUT) :: wj(2,2)
948 DOUBLE PRECISION,
INTENT(OUT) :: dw(2)
950 DOUBLE PRECISION :: jm(2,2)
951 DOUBLE PRECISION :: sm(2,2)
952 DOUBLE PRECISION :: dv(2)
953 DOUBLE PRECISION :: det
959 jm=points(ipoint)%prevJ
960 sm=-points(ipoint)%prevS
961 dv=points(ipoint)%prevd
963 jm=points(ipoint)%nextJ
964 sm=points(ipoint)%nextS
965 dv=points(ipoint)%nextd
968 det=sm(1,1)*sm(2,2)-sm(1,2)*sm(2,1)
969 w(1,1)= sm(2,2)/det;w(1,2)=-sm(1,2)/det
970 w(2,1)=-sm(2,1)/det;w(2,2)= sm(1,1)/det
971 forall(i=1:2,j=1:2) wj(i,j)=sum(w(i,:)*jm(:,j))
972 forall(i=1:2) dw(i)=sum(dv(:)*w(i,:))
994 DOUBLE PRECISION :: dval
995 DOUBLE PRECISION :: dwgh
998 ijsym(i,j)=(i*i-i)/2+j
1000 vecb(1:numfitpar)=0.0d0
1002 IF (numfitpar > maxusedfitpar)
THEN
1003 mpar2=(maxusedfitpar*maxusedfitpar+maxusedfitpar)/2
1004 mata(mpar2+1:npar2)=0.0d0
1005 maxusedfitpar=numfitpar
1008 IF (lastnumfitpar > 0)
THEN
1009 DO i=1,lastnumfitpar
1011 forall(j=1:min(lastbordersize,i)) mata(ij0+j)=0.0d0
1012 forall(j=1:max(i-lastbandwidth,1):i) mata(ij0+j)=0.0d0
1017 nbdr=numcurv+numaddlocpar
1018 DO i=1,numdatablocks
1019 ltem=intdata(integdatasize+1)
1020 dval=dble(floatdata(integdatasize+1))
1021 dwgh=dble(floatdata(integdatasize+3)*floatdata(integdatasize+2))
1022 DO j=integdatasize+4,integdatasize+ltem
1024 vecb(ij)=vecb(ij)+dble(floatdata(j))*dval*dwgh
1025 DO k=integdatasize+4,j
1028 mata(jk)=mata(jk)+dble(floatdata(j))*dble(floatdata(k))*dwgh
1029 IF (ik > nbdr) bandsize=max(bandsize,ij-ik)
1032 integdatasize=integdatasize+ltem
1035 lastnumfitpar=numfitpar
1037 lastbandwidth=bandsize
1059 INTEGER,
INTENT(IN) :: idwm
1060 REAL,
INTENT(OUT) :: chi2
1061 REAL,
INTENT(OUT) :: swgt
1063 dimension dwint(0:3)
1064 DATA dwint / 1.0, 0.8737, 0.9326, 0.8228 /
1070 DO i=1,numdatablocks
1071 ltem=intdata(integdatasize+1)
1072 val=floatdata(integdatasize+1)
1073 wgh=floatdata(integdatasize+3)
1075 DO j=integdatasize+4,integdatasize+ltem
1076 brl=brl+sngl(vecb(intdata(j))*floatdata(j))
1078 sres=abs(brl-val)*sqrt(floatdata(integdatasize+2))
1079 chi2=chi2+sres*sres*wgh
1083 IF(sres < 4.6851)
THEN
1084 wgh=(1.0-0.045558*sres*sres)**2
1088 ELSE IF (idwm == 2)
THEN
1089 IF (sres < 1.345)
THEN
1094 ELSE IF (idwm == 3)
THEN
1095 wgh=1.0/(1.0+(sres/2.3849)**2)
1097 floatdata(integdatasize+3)=wgh
1098 integdatasize=integdatasize+ltem
1101 chi2=chi2/dwint(lastdownweightmethod)
1102 lastdownweightmethod=idwm
1123 INTEGER,
INTENT(OUT) :: iret
1125 dimension derlc(maxfitpar)
1129 IF (trajlevel < 3) return
1132 DO i=1,numdatablocks
1133 ltem=intdata(integdatasize+1)
1134 ipnt=intdata(integdatasize+2)
1135 im =intdata(integdatasize+3)
1137 derlc(1:numfitpar)=0.0
1138 forall(j=integdatasize+4:integdatasize+ltem) derlc(intdata(j))=floatdata(j)
1141 IF (im > 0) igbl=points(ipnt)%indGlobal(im)
1142 IF (igbl > 0) ngbl=intdata(igbl)
1143 sig=1.0/sqrt(floatdata(integdatasize+2))
1145 CALL
mille(numfitpar,derlc,ngbl,floatdata(igbl+1),intdata(igbl+1), &
1146 floatdata(integdatasize+1),sig)
1148 integdatasize=integdatasize+ltem
1183 INTEGER,
INTENT(IN) :: ipoint
1184 INTEGER,
INTENT(IN) :: itrans
1185 INTEGER,
INTENT(OUT) :: ioff1
1187 DOUBLE PRECISION :: w(2,2)
1188 DOUBLE PRECISION :: wj(2,2)
1189 DOUBLE PRECISION :: dw(2)
1190 DOUBLE PRECISION :: wp(2,2)
1191 DOUBLE PRECISION :: wjp(2,2)
1192 DOUBLE PRECISION :: wn(2,2)
1193 DOUBLE PRECISION :: wjn(2,2)
1194 DOUBLE PRECISION :: dwp(2)
1195 DOUBLE PRECISION :: dwn(2)
1196 DOUBLE PRECISION :: wjs(2,2)
1197 DOUBLE PRECISION :: wji(2,2)
1198 DOUBLE PRECISION :: wip(2,2)
1199 DOUBLE PRECISION :: win(2,2)
1200 DOUBLE PRECISION :: dip(2)
1201 DOUBLE PRECISION :: din(2)
1202 DOUBLE PRECISION :: wpp(2,2)
1203 DOUBLE PRECISION :: wpn(2,2)
1204 DOUBLE PRECISION :: dpp(2)
1205 DOUBLE PRECISION :: dpn(2)
1206 DOUBLE PRECISION :: det
1207 DOUBLE PRECISION :: sgn
1209 indx(i,j)=((i-1)*np+j)*(1-itrans)+((j-1)*mp+i)*itrans
1211 np=numcurv+numaddlocpar+2*offsetdimension
1215 joff=points(jpnt)%offset
1217 jactracktofit(1:mp*np)=0.0d0
1222 IF (ipoint > 0)
THEN
1224 IF (joff == numoffsets) idir=-1
1227 IF (joff == 1) idir=2
1229 koff=joff+2*iabs(idir)-3
1230 CALL
gblder(jpnt,idir,w,wj,dw)
1235 ip1=numcurv+numaddlocpar
1236 ip2=numcurv+numaddlocpar+offsetdimension
1241 ip2=numcurv+numaddlocpar
1242 ip1=numcurv+numaddlocpar+offsetdimension
1246 DO l=1,offsetdimension
1247 jactracktofit(indx(2 ,ip1+l))=-sgn*wj(1,l+l0)
1248 jactracktofit(indx(3 ,ip1+l))=-sgn*wj(2,l+l0)
1249 jactracktofit(indx(2 ,ip2+l))= sgn*w(1,l+l0)
1250 jactracktofit(indx(3 ,ip2+l))= sgn*w(2,l+l0)
1251 jactracktofit(indx(3+l,ip1+l))= 1.0d0
1253 IF (numcurv > 0)
THEN
1254 jactracktofit(indx(2,1)) = -sgn*dw(1)
1255 jactracktofit(indx(3,1)) = -sgn*dw(2)
1260 CALL
gblder(jpnt,-1,wp,wjp,dwp)
1261 CALL
gblder(jpnt, 2,wn,wjn,dwn)
1264 ip1=numcurv+numaddlocpar
1265 ip2=numcurv+numaddlocpar+offsetdimension
1268 det=wjs(1,1)*wjs(2,2)-wjs(1,2)*wjs(2,1)
1269 wji(1,1)= wjs(2,2)/det;wji(1,2)=-wjs(1,2)/det
1270 wji(2,1)=-wjs(2,1)/det;wji(2,2)= wjs(1,1)/det
1272 forall(i=1:2,j=1:2) wip(i,j)=sum(wji(i,:)*wp(:,j))
1273 forall(i=1:2,j=1:2) win(i,j)=sum(wji(i,:)*wn(:,j))
1274 forall(i=1:2) dip(i)=sum(wji(i,:)*dwp(:))
1275 forall(i=1:2) din(i)=sum(wji(i,:)*dwn(:))
1277 forall(i=1:2,j=1:2) wpp(i,j)=sum(wjn(i,:)*wip(:,j))
1278 forall(i=1:2,j=1:2) wpn(i,j)=sum(wjp(i,:)*win(:,j))
1279 forall(i=1:2) dpp(i)=sum(wjn(i,:)*dip(:))
1280 forall(i=1:2) dpn(i)=sum(wjp(i,:)*din(:))
1282 DO l=1,offsetdimension
1284 jactracktofit(indx(4,ip1+l))= wip(1,l+l0)
1285 jactracktofit(indx(5,ip1+l))= wip(2,l+l0)
1287 jactracktofit(indx(4,ip2+l))= win(1,l+l0)
1288 jactracktofit(indx(5,ip2+l))= win(2,l+l0)
1290 jactracktofit(indx(2,ip1+l))=-wpp(1,l+l0)
1291 jactracktofit(indx(3,ip1+l))=-wpp(2,l+l0)
1293 jactracktofit(indx(2,ip2+l))= wpn(1,l+l0)
1294 jactracktofit(indx(3,ip2+l))= wpn(2,l+l0)
1296 IF (numcurv > 0)
THEN
1298 jactracktofit(indx(4,1)) =-dip(1)-din(1)
1299 jactracktofit(indx(5,1)) =-dip(2)-din(2)
1301 jactracktofit(indx(2,1)) = dpp(1)-dpn(1)
1302 jactracktofit(indx(3,1)) = dpp(2)-dpn(2)
1307 IF (numcurv > 0)
THEN
1308 jactracktofit(indx(1,1))=1.0d0
1311 DO k=1, numaddlocpar
1312 jactracktofit(indx(k+5,numcurv+k))= 1.0d0
1344 INTEGER,
INTENT(IN OUT) :: ipoint
1345 DOUBLE PRECISION,
INTENT(OUT) :: dpar(*)
1346 DOUBLE PRECISION,
INTENT(OUT) :: dcov(*)
1348 DOUBLE PRECISION :: caux(maxtracksymmatsize)
1349 DOUBLE PRECISION :: baux(maxtrackpar)
1351 nb=numcurv+numaddlocpar
1353 np=nb+2*offsetdimension
1358 IF (jpnt < 1.OR.jpnt > numpoints)
THEN
1359 IF (printlevel > 0) print *,
' GBLRES invalid point ', ipoint
1365 IF (trajlevel < 4) return
1367 CALL
gbljac(ipoint,0,ioff1)
1369 baux(1:nb)=vecb(1:nb)
1370 caux(1:nb2)=mata(1:nb2)
1371 ip0=(ioff1-1)*offsetdimension
1388 CALL
dbgax(jactracktofit,baux,dpar,mp,np)
1389 CALL
dbavat(caux,jactracktofit,dcov,np,mp)
1410 INTEGER,
INTENT(IN) :: ipoint
1411 DOUBLE PRECISION,
INTENT(IN) :: dprc(*)
1415 IF (jpnt < 1.OR.jpnt > numpoints)
THEN
1416 IF (printlevel > 0) print *,
' GBLADX invalid point ', ipoint
1420 IF (trajlevel >= 3) return
1425 extseedmat(1:mp2)=dprc(1:mp2)
1438 DOUBLE PRECISION,
INTENT(IN) :: a(5,5)
1439 DOUBLE PRECISION,
INTENT(OUT) :: b(5,5)
1440 DOUBLE PRECISION :: a33(3,3)
1441 DOUBLE PRECISION :: a23(2,3)
1442 DOUBLE PRECISION :: a22(2,2)
1443 DOUBLE PRECISION :: det
1446 a33(1,1) = a(2,2)*a(3,3)-a(2,3)*a(3,2)
1447 a33(2,1) = a(2,3)*a(3,1)-a(2,1)*a(3,3)
1448 a33(3,1) = a(2,1)*a(3,2)-a(2,2)*a(3,1)
1449 a33(1,2) = a(1,3)*a(3,2)-a(1,2)*a(3,3)
1450 a33(2,2) = a(1,1)*a(3,3)-a(1,3)*a(3,1)
1451 a33(3,2) = a(1,2)*a(3,1)-a(1,1)*a(3,2)
1452 a33(1,3) = a(1,2)*a(2,3)-a(1,3)*a(2,2)
1453 a33(2,3) = a(1,3)*a(2,1)-a(1,1)*a(2,3)
1454 a33(3,3) = a(1,1)*a(2,2)-a(1,2)*a(2,1)
1455 det=a(1,1)*a33(1,1)+a(1,2)*a33(2,1)+a(1,3)*a33(3,1)
1457 a23(1,1) = (a(4,1)*a33(1,1)+a(4,2)*a33(2,1)+a(4,3)*a33(3,1))/det
1458 a23(1,2) = (a(4,1)*a33(1,2)+a(4,2)*a33(2,2)+a(4,3)*a33(3,2))/det
1459 a23(1,3) = (a(4,1)*a33(1,3)+a(4,2)*a33(2,3)+a(4,3)*a33(3,3))/det
1460 a23(2,1) = (a(5,1)*a33(1,1)+a(5,2)*a33(2,1)+a(5,3)*a33(3,1))/det
1461 a23(2,2) = (a(5,1)*a33(1,2)+a(5,2)*a33(2,2)+a(5,3)*a33(3,2))/det
1462 a23(2,3) = (a(5,1)*a33(1,3)+a(5,2)*a33(2,3)+a(5,3)*a33(3,3))/det
1464 a22(1,1) = a(4,4)-a23(1,1)*a(1,4)-a23(1,2)*a(2,4)-a23(1,3)*a(3,4)
1465 a22(1,2) = a(4,5)-a23(1,1)*a(1,5)-a23(1,2)*a(2,5)-a23(1,3)*a(3,5)
1466 a22(2,1) = a(5,4)-a23(2,1)*a(1,4)-a23(2,2)*a(2,4)-a23(2,3)*a(3,4)
1467 a22(2,2) = a(5,5)-a23(2,1)*a(1,5)-a23(2,2)*a(2,5)-a23(2,3)*a(3,5)
1469 det = a22(1,1)*a22(2,2)-a22(1,2)*a22(2,1)
1470 b(4,4) = a22(2,2)/det
1471 b(4,5) =-a22(1,2)/det
1472 b(5,4) =-a22(2,1)/det
1473 b(5,5) = a22(1,1)/det
1475 b(4,1) = -b(4,4)*a23(1,1)-b(4,5)*a23(2,1)
1476 b(4,2) = -b(4,4)*a23(1,2)-b(4,5)*a23(2,2)
1477 b(4,3) = -b(4,4)*a23(1,3)-b(4,5)*a23(2,3)
1478 b(5,1) = -b(5,4)*a23(1,1)-b(5,5)*a23(2,1)
1479 b(5,2) = -b(5,4)*a23(1,2)-b(5,5)*a23(2,2)
1480 b(5,3) = -b(5,4)*a23(1,3)-b(5,5)*a23(2,3)