-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmrqcof.f
32 lines (32 loc) · 850 Bytes
/
mrqcof.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
SUBROUTINE MRQCOF(X,Y,SIG,NDATA,A,MA,LISTA,MFIT,ALPHA,BETA,NALP,
*CHISQ,FUNCS)
PARAMETER (MMAX=20)
DIMENSION X(NDATA),Y(NDATA),SIG(NDATA),ALPHA(NALP,NALP),BETA(MA),
* DYDA(MMAX),LISTA(MFIT),A(MA)
DO 12 J=1,MFIT
DO 11 K=1,J
ALPHA(J,K)=0.
11 CONTINUE
BETA(J)=0.
12 CONTINUE
CHISQ=0.
DO 15 I=1,NDATA
CALL FUNCS(X(I),A,YMOD,DYDA,MA)
SIG2I=1./(SIG(I)*SIG(I))
DY=Y(I)-YMOD
DO 14 J=1,MFIT
WT=DYDA(LISTA(J))*SIG2I
DO 13 K=1,J
ALPHA(J,K)=ALPHA(J,K)+WT*DYDA(LISTA(K))
13 CONTINUE
BETA(J)=BETA(J)+DY*WT
14 CONTINUE
CHISQ=CHISQ+DY*DY*SIG2I
15 CONTINUE
DO 17 J=2,MFIT
DO 16 K=1,J-1
ALPHA(K,J)=ALPHA(J,K)
16 CONTINUE
17 CONTINUE
RETURN
END