5 SUBROUTINE ZERM(A
,MI
,MJ
,NA
) ! Set the elements of general matrix to zero
14 SUBROUTINE ZERV(D
,M
) ! set elements of a vector to zero
23 SUBROUTINE MULMV(A
,D
,E
,MI
,MJ
,NA
)
25 DIMENSION A(NA
,*),D(*),E(*)
28 CALL MADVS(A(1,J
),D(J
),E
,MI
)
33 SUBROUTINE MADVS(D
,S
,E
,M
)
42 subroutine LINMM(a
,b
,m
,mm
,na
,nb
)
43 DIMENSION A(NA
,*),B(NB
,*),ipiv(m
)
44 CALL LDUM(A
,IPIV
,D
,M
,NA
)
45 CALL UDLMM(A
,B
,IPIV
,M
,MM
,NA
,NB
)
49 !------------------------------------------------------------------------------
50 ! R.J.Purser, NCEP, Washington D.C. 1996
52 ! perform l-d-u decomposition of square matrix a in place with
55 ! --> a square matrix to be factorized
56 ! <-- ipiv array encoding the pivoting sequence
57 ! <-- d indicator for possible sign change of determinant
58 ! --> m degree of (active part of) a
59 ! --> na first fortran dimension of a
62 ! S is an array, internal to this routine, containing the
63 ! scaling factors of each row used for pivoting decisions. It is given a
64 ! fortran dimension of NN=500 in the parameter statement below.
65 ! If the order of the linear system exceeds NN, increase NN.
66 !------------------------------------------------------------------------------
67 SUBROUTINE LDUM(A
,IPIV
,D
,M
,NA
)
69 DIMENSION A(NA
,*),IPIV(*),S(NN
)
70 ! IF(M.GT.NN)STOP'MATRIX TOO LARGE FOR LDUM'
79 PRINT'('' ROW '',I3,'' OF MATRIX IN LUFM VANISHES'')',I
97 ! swap rows, recording changed sign of determinant
111 PRINT'('' FAILURE IN LDUM:''/'' MATRIX SINGULAR, RANK='',i3)',JM
119 A(I
,K
)=A(I
,K
)-AIJ
*A(J
,K
)
126 !------------------------------------------------------------------------------
127 ! R.J.Purser, National Meteorological Center, Washington D.C. 1993
129 ! use l-u factors in a to back-substitute for mm rhs in b, using ipiv to
130 ! define the pivoting permutation used in the l-u decomposition.
132 ! --> A L-D-U factorization of linear system matrux
133 ! <-> B right-hand-sides on entry, corresponding matrix of solution
135 ! --> IPIV array encoding the pivoting sequence
136 ! --> M degree of (active part of) B and A
137 ! --> MM number of right-hand-side vectors (active columns of B)
138 ! --> NA first fortran dimension of A
139 ! --> NB first fortran dimension of B
140 !------------------------------------------------------------------------------
141 SUBROUTINE UDLMM(A
,B
,IPIV
,M
,MM
,NA
,NB
)
142 DIMENSION A(NA
,*),B(NB
,*),IPIV(*)
143 DO K
=1,MM
!loop over columns of B
148 CALL DSBVR(B(1,K
),A(I
,1),S
,I
-1,NA
)
154 CALL DSBVR(B(I
+1,K
),A(I
,I
+1),B(I
,K
),M
-I
,NA
)
161 subroutine DSBVR(D
,A
,S
,M
,NA
)
162 DIMENSION D(M
),A(NA
,*)
170 end module da_mat_cv3