00001 SUBROUTINE CTRMM(SIDE,UPLO,TRANSA,DIAG,M,N,ALPHA,A,LDA,B,LDB)
00002
00003 COMPLEX ALPHA
00004 INTEGER LDA,LDB,M,N
00005 CHARACTER DIAG,SIDE,TRANSA,UPLO
00006
00007
00008 COMPLEX A(LDA,*),B(LDB,*)
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 LOGICAL LSAME
00132 EXTERNAL LSAME
00133
00134
00135 EXTERNAL XERBLA
00136
00137
00138 INTRINSIC CONJG,MAX
00139
00140
00141 COMPLEX TEMP
00142 INTEGER I,INFO,J,K,NROWA
00143 LOGICAL LSIDE,NOCONJ,NOUNIT,UPPER
00144
00145
00146 COMPLEX ONE
00147 PARAMETER (ONE= (1.0E+0,0.0E+0))
00148 COMPLEX ZERO
00149 PARAMETER (ZERO= (0.0E+0,0.0E+0))
00150
00151
00152
00153
00154 LSIDE = LSAME(SIDE,'L')
00155 IF (LSIDE) THEN
00156 NROWA = M
00157 ELSE
00158 NROWA = N
00159 END IF
00160 NOCONJ = LSAME(TRANSA,'T')
00161 NOUNIT = LSAME(DIAG,'N')
00162 UPPER = LSAME(UPLO,'U')
00163
00164 INFO = 0
00165 IF ((.NOT.LSIDE) .AND. (.NOT.LSAME(SIDE,'R'))) THEN
00166 INFO = 1
00167 ELSE IF ((.NOT.UPPER) .AND. (.NOT.LSAME(UPLO,'L'))) THEN
00168 INFO = 2
00169 ELSE IF ((.NOT.LSAME(TRANSA,'N')) .AND.
00170 + (.NOT.LSAME(TRANSA,'T')) .AND.
00171 + (.NOT.LSAME(TRANSA,'C'))) THEN
00172 INFO = 3
00173 ELSE IF ((.NOT.LSAME(DIAG,'U')) .AND. (.NOT.LSAME(DIAG,'N'))) THEN
00174 INFO = 4
00175 ELSE IF (M.LT.0) THEN
00176 INFO = 5
00177 ELSE IF (N.LT.0) THEN
00178 INFO = 6
00179 ELSE IF (LDA.LT.MAX(1,NROWA)) THEN
00180 INFO = 9
00181 ELSE IF (LDB.LT.MAX(1,M)) THEN
00182 INFO = 11
00183 END IF
00184 IF (INFO.NE.0) THEN
00185 CALL XERBLA('CTRMM ',INFO)
00186 RETURN
00187 END IF
00188
00189
00190
00191 IF (M.EQ.0 .OR. N.EQ.0) RETURN
00192
00193
00194
00195 IF (ALPHA.EQ.ZERO) THEN
00196 DO 20 J = 1,N
00197 DO 10 I = 1,M
00198 B(I,J) = ZERO
00199 10 CONTINUE
00200 20 CONTINUE
00201 RETURN
00202 END IF
00203
00204
00205
00206 IF (LSIDE) THEN
00207 IF (LSAME(TRANSA,'N')) THEN
00208
00209
00210
00211 IF (UPPER) THEN
00212 DO 50 J = 1,N
00213 DO 40 K = 1,M
00214 IF (B(K,J).NE.ZERO) THEN
00215 TEMP = ALPHA*B(K,J)
00216 DO 30 I = 1,K - 1
00217 B(I,J) = B(I,J) + TEMP*A(I,K)
00218 30 CONTINUE
00219 IF (NOUNIT) TEMP = TEMP*A(K,K)
00220 B(K,J) = TEMP
00221 END IF
00222 40 CONTINUE
00223 50 CONTINUE
00224 ELSE
00225 DO 80 J = 1,N
00226 DO 70 K = M,1,-1
00227 IF (B(K,J).NE.ZERO) THEN
00228 TEMP = ALPHA*B(K,J)
00229 B(K,J) = TEMP
00230 IF (NOUNIT) B(K,J) = B(K,J)*A(K,K)
00231 DO 60 I = K + 1,M
00232 B(I,J) = B(I,J) + TEMP*A(I,K)
00233 60 CONTINUE
00234 END IF
00235 70 CONTINUE
00236 80 CONTINUE
00237 END IF
00238 ELSE
00239
00240
00241
00242 IF (UPPER) THEN
00243 DO 120 J = 1,N
00244 DO 110 I = M,1,-1
00245 TEMP = B(I,J)
00246 IF (NOCONJ) THEN
00247 IF (NOUNIT) TEMP = TEMP*A(I,I)
00248 DO 90 K = 1,I - 1
00249 TEMP = TEMP + A(K,I)*B(K,J)
00250 90 CONTINUE
00251 ELSE
00252 IF (NOUNIT) TEMP = TEMP*CONJG(A(I,I))
00253 DO 100 K = 1,I - 1
00254 TEMP = TEMP + CONJG(A(K,I))*B(K,J)
00255 100 CONTINUE
00256 END IF
00257 B(I,J) = ALPHA*TEMP
00258 110 CONTINUE
00259 120 CONTINUE
00260 ELSE
00261 DO 160 J = 1,N
00262 DO 150 I = 1,M
00263 TEMP = B(I,J)
00264 IF (NOCONJ) THEN
00265 IF (NOUNIT) TEMP = TEMP*A(I,I)
00266 DO 130 K = I + 1,M
00267 TEMP = TEMP + A(K,I)*B(K,J)
00268 130 CONTINUE
00269 ELSE
00270 IF (NOUNIT) TEMP = TEMP*CONJG(A(I,I))
00271 DO 140 K = I + 1,M
00272 TEMP = TEMP + CONJG(A(K,I))*B(K,J)
00273 140 CONTINUE
00274 END IF
00275 B(I,J) = ALPHA*TEMP
00276 150 CONTINUE
00277 160 CONTINUE
00278 END IF
00279 END IF
00280 ELSE
00281 IF (LSAME(TRANSA,'N')) THEN
00282
00283
00284
00285 IF (UPPER) THEN
00286 DO 200 J = N,1,-1
00287 TEMP = ALPHA
00288 IF (NOUNIT) TEMP = TEMP*A(J,J)
00289 DO 170 I = 1,M
00290 B(I,J) = TEMP*B(I,J)
00291 170 CONTINUE
00292 DO 190 K = 1,J - 1
00293 IF (A(K,J).NE.ZERO) THEN
00294 TEMP = ALPHA*A(K,J)
00295 DO 180 I = 1,M
00296 B(I,J) = B(I,J) + TEMP*B(I,K)
00297 180 CONTINUE
00298 END IF
00299 190 CONTINUE
00300 200 CONTINUE
00301 ELSE
00302 DO 240 J = 1,N
00303 TEMP = ALPHA
00304 IF (NOUNIT) TEMP = TEMP*A(J,J)
00305 DO 210 I = 1,M
00306 B(I,J) = TEMP*B(I,J)
00307 210 CONTINUE
00308 DO 230 K = J + 1,N
00309 IF (A(K,J).NE.ZERO) THEN
00310 TEMP = ALPHA*A(K,J)
00311 DO 220 I = 1,M
00312 B(I,J) = B(I,J) + TEMP*B(I,K)
00313 220 CONTINUE
00314 END IF
00315 230 CONTINUE
00316 240 CONTINUE
00317 END IF
00318 ELSE
00319
00320
00321
00322 IF (UPPER) THEN
00323 DO 280 K = 1,N
00324 DO 260 J = 1,K - 1
00325 IF (A(J,K).NE.ZERO) THEN
00326 IF (NOCONJ) THEN
00327 TEMP = ALPHA*A(J,K)
00328 ELSE
00329 TEMP = ALPHA*CONJG(A(J,K))
00330 END IF
00331 DO 250 I = 1,M
00332 B(I,J) = B(I,J) + TEMP*B(I,K)
00333 250 CONTINUE
00334 END IF
00335 260 CONTINUE
00336 TEMP = ALPHA
00337 IF (NOUNIT) THEN
00338 IF (NOCONJ) THEN
00339 TEMP = TEMP*A(K,K)
00340 ELSE
00341 TEMP = TEMP*CONJG(A(K,K))
00342 END IF
00343 END IF
00344 IF (TEMP.NE.ONE) THEN
00345 DO 270 I = 1,M
00346 B(I,K) = TEMP*B(I,K)
00347 270 CONTINUE
00348 END IF
00349 280 CONTINUE
00350 ELSE
00351 DO 320 K = N,1,-1
00352 DO 300 J = K + 1,N
00353 IF (A(J,K).NE.ZERO) THEN
00354 IF (NOCONJ) THEN
00355 TEMP = ALPHA*A(J,K)
00356 ELSE
00357 TEMP = ALPHA*CONJG(A(J,K))
00358 END IF
00359 DO 290 I = 1,M
00360 B(I,J) = B(I,J) + TEMP*B(I,K)
00361 290 CONTINUE
00362 END IF
00363 300 CONTINUE
00364 TEMP = ALPHA
00365 IF (NOUNIT) THEN
00366 IF (NOCONJ) THEN
00367 TEMP = TEMP*A(K,K)
00368 ELSE
00369 TEMP = TEMP*CONJG(A(K,K))
00370 END IF
00371 END IF
00372 IF (TEMP.NE.ONE) THEN
00373 DO 310 I = 1,M
00374 B(I,K) = TEMP*B(I,K)
00375 310 CONTINUE
00376 END IF
00377 320 CONTINUE
00378 END IF
00379 END IF
00380 END IF
00381
00382 RETURN
00383
00384
00385
00386 END