00001 SUBROUTINE CLARHS( PATH, XTYPE, UPLO, TRANS, M, N, KL, KU, NRHS,
00002 $ A, LDA, X, LDX, B, LDB, ISEED, INFO )
00003
00004
00005
00006
00007
00008
00009 CHARACTER TRANS, UPLO, XTYPE
00010 CHARACTER*3 PATH
00011 INTEGER INFO, KL, KU, LDA, LDB, LDX, M, N, NRHS
00012
00013
00014 INTEGER ISEED( 4 )
00015 COMPLEX A( LDA, * ), B( LDB, * ), X( LDX, * )
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
00132
00133
00134
00135
00136
00137
00138 COMPLEX ONE, ZERO
00139 PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ),
00140 $ ZERO = ( 0.0E+0, 0.0E+0 ) )
00141
00142
00143 LOGICAL BAND, GEN, NOTRAN, QRS, SYM, TRAN, TRI
00144 CHARACTER C1, DIAG
00145 CHARACTER*2 C2
00146 INTEGER J, MB, NX
00147
00148
00149 LOGICAL LSAME, LSAMEN
00150 EXTERNAL LSAME, LSAMEN
00151
00152
00153 EXTERNAL CGBMV, CGEMM, CHBMV, CHEMM, CHPMV, CLACPY,
00154 $ CLARNV, CSBMV, CSPMV, CSYMM, CTBMV, CTPMV,
00155 $ CTRMM, XERBLA
00156
00157
00158 INTRINSIC MAX
00159
00160
00161
00162
00163
00164 INFO = 0
00165 C1 = PATH( 1: 1 )
00166 C2 = PATH( 2: 3 )
00167 TRAN = LSAME( TRANS, 'T' ) .OR. LSAME( TRANS, 'C' )
00168 NOTRAN = .NOT.TRAN
00169 GEN = LSAME( PATH( 2: 2 ), 'G' )
00170 QRS = LSAME( PATH( 2: 2 ), 'Q' ) .OR. LSAME( PATH( 3: 3 ), 'Q' )
00171 SYM = LSAME( PATH( 2: 2 ), 'P' ) .OR.
00172 $ LSAME( PATH( 2: 2 ), 'S' ) .OR. LSAME( PATH( 2: 2 ), 'H' )
00173 TRI = LSAME( PATH( 2: 2 ), 'T' )
00174 BAND = LSAME( PATH( 3: 3 ), 'B' )
00175 IF( .NOT.LSAME( C1, 'Complex precision' ) ) THEN
00176 INFO = -1
00177 ELSE IF( .NOT.( LSAME( XTYPE, 'N' ) .OR. LSAME( XTYPE, 'C' ) ) )
00178 $ THEN
00179 INFO = -2
00180 ELSE IF( ( SYM .OR. TRI ) .AND. .NOT.
00181 $ ( LSAME( UPLO, 'U' ) .OR. LSAME( UPLO, 'L' ) ) ) THEN
00182 INFO = -3
00183 ELSE IF( ( GEN.OR.QRS ) .AND.
00184 $ .NOT.( TRAN .OR. LSAME( TRANS, 'N' ) ) ) THEN
00185 INFO = -4
00186 ELSE IF( M.LT.0 ) THEN
00187 INFO = -5
00188 ELSE IF( N.LT.0 ) THEN
00189 INFO = -6
00190 ELSE IF( BAND .AND. KL.LT.0 ) THEN
00191 INFO = -7
00192 ELSE IF( BAND .AND. KU.LT.0 ) THEN
00193 INFO = -8
00194 ELSE IF( NRHS.LT.0 ) THEN
00195 INFO = -9
00196 ELSE IF( ( .NOT.BAND .AND. LDA.LT.MAX( 1, M ) ) .OR.
00197 $ ( BAND .AND. ( SYM .OR. TRI ) .AND. LDA.LT.KL+1 ) .OR.
00198 $ ( BAND .AND. GEN .AND. LDA.LT.KL+KU+1 ) ) THEN
00199 INFO = -11
00200 ELSE IF( ( NOTRAN .AND. LDX.LT.MAX( 1, N ) ) .OR.
00201 $ ( TRAN .AND. LDX.LT.MAX( 1, M ) ) ) THEN
00202 INFO = -13
00203 ELSE IF( ( NOTRAN .AND. LDB.LT.MAX( 1, M ) ) .OR.
00204 $ ( TRAN .AND. LDB.LT.MAX( 1, N ) ) ) THEN
00205 INFO = -15
00206 END IF
00207 IF( INFO.NE.0 ) THEN
00208 CALL XERBLA( 'CLARHS', -INFO )
00209 RETURN
00210 END IF
00211
00212
00213
00214 IF( TRAN ) THEN
00215 NX = M
00216 MB = N
00217 ELSE
00218 NX = N
00219 MB = M
00220 END IF
00221 IF( .NOT.LSAME( XTYPE, 'C' ) ) THEN
00222 DO 10 J = 1, NRHS
00223 CALL CLARNV( 2, ISEED, N, X( 1, J ) )
00224 10 CONTINUE
00225 END IF
00226
00227
00228
00229
00230 IF( LSAMEN( 2, C2, 'GE' ) .OR. LSAMEN( 2, C2, 'QR' ) .OR.
00231 $ LSAMEN( 2, C2, 'LQ' ) .OR. LSAMEN( 2, C2, 'QL' ) .OR.
00232 $ LSAMEN( 2, C2, 'RQ' ) ) THEN
00233
00234
00235
00236 CALL CGEMM( TRANS, 'N', MB, NRHS, NX, ONE, A, LDA, X, LDX,
00237 $ ZERO, B, LDB )
00238
00239 ELSE IF( LSAMEN( 2, C2, 'PO' ) .OR. LSAMEN( 2, C2, 'HE' ) ) THEN
00240
00241
00242
00243 CALL CHEMM( 'Left', UPLO, N, NRHS, ONE, A, LDA, X, LDX, ZERO,
00244 $ B, LDB )
00245
00246 ELSE IF( LSAMEN( 2, C2, 'SY' ) ) THEN
00247
00248
00249
00250 CALL CSYMM( 'Left', UPLO, N, NRHS, ONE, A, LDA, X, LDX, ZERO,
00251 $ B, LDB )
00252
00253 ELSE IF( LSAMEN( 2, C2, 'GB' ) ) THEN
00254
00255
00256
00257 DO 20 J = 1, NRHS
00258 CALL CGBMV( TRANS, M, N, KL, KU, ONE, A, LDA, X( 1, J ), 1,
00259 $ ZERO, B( 1, J ), 1 )
00260 20 CONTINUE
00261
00262 ELSE IF( LSAMEN( 2, C2, 'PB' ) .OR. LSAMEN( 2, C2, 'HB' ) ) THEN
00263
00264
00265
00266 DO 30 J = 1, NRHS
00267 CALL CHBMV( UPLO, N, KL, ONE, A, LDA, X( 1, J ), 1, ZERO,
00268 $ B( 1, J ), 1 )
00269 30 CONTINUE
00270
00271 ELSE IF( LSAMEN( 2, C2, 'SB' ) ) THEN
00272
00273
00274
00275 DO 40 J = 1, NRHS
00276 CALL CSBMV( UPLO, N, KL, ONE, A, LDA, X( 1, J ), 1, ZERO,
00277 $ B( 1, J ), 1 )
00278 40 CONTINUE
00279
00280 ELSE IF( LSAMEN( 2, C2, 'PP' ) .OR. LSAMEN( 2, C2, 'HP' ) ) THEN
00281
00282
00283
00284 DO 50 J = 1, NRHS
00285 CALL CHPMV( UPLO, N, ONE, A, X( 1, J ), 1, ZERO, B( 1, J ),
00286 $ 1 )
00287 50 CONTINUE
00288
00289 ELSE IF( LSAMEN( 2, C2, 'SP' ) ) THEN
00290
00291
00292
00293 DO 60 J = 1, NRHS
00294 CALL CSPMV( UPLO, N, ONE, A, X( 1, J ), 1, ZERO, B( 1, J ),
00295 $ 1 )
00296 60 CONTINUE
00297
00298 ELSE IF( LSAMEN( 2, C2, 'TR' ) ) THEN
00299
00300
00301
00302
00303
00304 CALL CLACPY( 'Full', N, NRHS, X, LDX, B, LDB )
00305 IF( KU.EQ.2 ) THEN
00306 DIAG = 'U'
00307 ELSE
00308 DIAG = 'N'
00309 END IF
00310 CALL CTRMM( 'Left', UPLO, TRANS, DIAG, N, NRHS, ONE, A, LDA, B,
00311 $ LDB )
00312
00313 ELSE IF( LSAMEN( 2, C2, 'TP' ) ) THEN
00314
00315
00316
00317 CALL CLACPY( 'Full', N, NRHS, X, LDX, B, LDB )
00318 IF( KU.EQ.2 ) THEN
00319 DIAG = 'U'
00320 ELSE
00321 DIAG = 'N'
00322 END IF
00323 DO 70 J = 1, NRHS
00324 CALL CTPMV( UPLO, TRANS, DIAG, N, A, B( 1, J ), 1 )
00325 70 CONTINUE
00326
00327 ELSE IF( LSAMEN( 2, C2, 'TB' ) ) THEN
00328
00329
00330
00331 CALL CLACPY( 'Full', N, NRHS, X, LDX, B, LDB )
00332 IF( KU.EQ.2 ) THEN
00333 DIAG = 'U'
00334 ELSE
00335 DIAG = 'N'
00336 END IF
00337 DO 80 J = 1, NRHS
00338 CALL CTBMV( UPLO, TRANS, DIAG, N, KL, A, LDA, B( 1, J ), 1 )
00339 80 CONTINUE
00340
00341 ELSE
00342
00343
00344
00345 INFO = -1
00346 CALL XERBLA( 'CLARHS', -INFO )
00347 END IF
00348
00349 RETURN
00350
00351
00352
00353 END