00001 SUBROUTINE SLARHS( 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 REAL 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 REAL ONE, ZERO
00134 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
00135
00136
00137 LOGICAL BAND, GEN, NOTRAN, QRS, SYM, TRAN, TRI
00138 CHARACTER C1, DIAG
00139 CHARACTER*2 C2
00140 INTEGER J, MB, NX
00141
00142
00143 LOGICAL LSAME, LSAMEN
00144 EXTERNAL LSAME, LSAMEN
00145
00146
00147 EXTERNAL SGBMV, SGEMM, SLACPY, SLARNV, SSBMV, SSPMV,
00148 $ SSYMM, STBMV, STPMV, STRMM, XERBLA
00149
00150
00151 INTRINSIC MAX
00152
00153
00154
00155
00156
00157 INFO = 0
00158 C1 = PATH( 1: 1 )
00159 C2 = PATH( 2: 3 )
00160 TRAN = LSAME( TRANS, 'T' ) .OR. LSAME( TRANS, 'C' )
00161 NOTRAN = .NOT.TRAN
00162 GEN = LSAME( PATH( 2: 2 ), 'G' )
00163 QRS = LSAME( PATH( 2: 2 ), 'Q' ) .OR. LSAME( PATH( 3: 3 ), 'Q' )
00164 SYM = LSAME( PATH( 2: 2 ), 'P' ) .OR. LSAME( PATH( 2: 2 ), 'S' )
00165 TRI = LSAME( PATH( 2: 2 ), 'T' )
00166 BAND = LSAME( PATH( 3: 3 ), 'B' )
00167 IF( .NOT.LSAME( C1, 'Single precision' ) ) THEN
00168 INFO = -1
00169 ELSE IF( .NOT.( LSAME( XTYPE, 'N' ) .OR. LSAME( XTYPE, 'C' ) ) )
00170 $ THEN
00171 INFO = -2
00172 ELSE IF( ( SYM .OR. TRI ) .AND. .NOT.
00173 $ ( LSAME( UPLO, 'U' ) .OR. LSAME( UPLO, 'L' ) ) ) THEN
00174 INFO = -3
00175 ELSE IF( ( GEN .OR. QRS ) .AND. .NOT.
00176 $ ( TRAN .OR. LSAME( TRANS, 'N' ) ) ) THEN
00177 INFO = -4
00178 ELSE IF( M.LT.0 ) THEN
00179 INFO = -5
00180 ELSE IF( N.LT.0 ) THEN
00181 INFO = -6
00182 ELSE IF( BAND .AND. KL.LT.0 ) THEN
00183 INFO = -7
00184 ELSE IF( BAND .AND. KU.LT.0 ) THEN
00185 INFO = -8
00186 ELSE IF( NRHS.LT.0 ) THEN
00187 INFO = -9
00188 ELSE IF( ( .NOT.BAND .AND. LDA.LT.MAX( 1, M ) ) .OR.
00189 $ ( BAND .AND. ( SYM .OR. TRI ) .AND. LDA.LT.KL+1 ) .OR.
00190 $ ( BAND .AND. GEN .AND. LDA.LT.KL+KU+1 ) ) THEN
00191 INFO = -11
00192 ELSE IF( ( NOTRAN .AND. LDX.LT.MAX( 1, N ) ) .OR.
00193 $ ( TRAN .AND. LDX.LT.MAX( 1, M ) ) ) THEN
00194 INFO = -13
00195 ELSE IF( ( NOTRAN .AND. LDB.LT.MAX( 1, M ) ) .OR.
00196 $ ( TRAN .AND. LDB.LT.MAX( 1, N ) ) ) THEN
00197 INFO = -15
00198 END IF
00199 IF( INFO.NE.0 ) THEN
00200 CALL XERBLA( 'SLARHS', -INFO )
00201 RETURN
00202 END IF
00203
00204
00205
00206 IF( TRAN ) THEN
00207 NX = M
00208 MB = N
00209 ELSE
00210 NX = N
00211 MB = M
00212 END IF
00213 IF( .NOT.LSAME( XTYPE, 'C' ) ) THEN
00214 DO 10 J = 1, NRHS
00215 CALL SLARNV( 2, ISEED, N, X( 1, J ) )
00216 10 CONTINUE
00217 END IF
00218
00219
00220
00221
00222 IF( LSAMEN( 2, C2, 'GE' ) .OR. LSAMEN( 2, C2, 'QR' ) .OR.
00223 $ LSAMEN( 2, C2, 'LQ' ) .OR. LSAMEN( 2, C2, 'QL' ) .OR.
00224 $ LSAMEN( 2, C2, 'RQ' ) ) THEN
00225
00226
00227
00228 CALL SGEMM( TRANS, 'N', MB, NRHS, NX, ONE, A, LDA, X, LDX,
00229 $ ZERO, B, LDB )
00230
00231 ELSE IF( LSAMEN( 2, C2, 'PO' ) .OR. LSAMEN( 2, C2, 'SY' ) ) THEN
00232
00233
00234
00235 CALL SSYMM( 'Left', UPLO, N, NRHS, ONE, A, LDA, X, LDX, ZERO,
00236 $ B, LDB )
00237
00238 ELSE IF( LSAMEN( 2, C2, 'GB' ) ) THEN
00239
00240
00241
00242 DO 20 J = 1, NRHS
00243 CALL SGBMV( TRANS, MB, NX, KL, KU, ONE, A, LDA, X( 1, J ),
00244 $ 1, ZERO, B( 1, J ), 1 )
00245 20 CONTINUE
00246
00247 ELSE IF( LSAMEN( 2, C2, 'PB' ) ) THEN
00248
00249
00250
00251 DO 30 J = 1, NRHS
00252 CALL SSBMV( UPLO, N, KL, ONE, A, LDA, X( 1, J ), 1, ZERO,
00253 $ B( 1, J ), 1 )
00254 30 CONTINUE
00255
00256 ELSE IF( LSAMEN( 2, C2, 'PP' ) .OR. LSAMEN( 2, C2, 'SP' ) ) THEN
00257
00258
00259
00260 DO 40 J = 1, NRHS
00261 CALL SSPMV( UPLO, N, ONE, A, X( 1, J ), 1, ZERO, B( 1, J ),
00262 $ 1 )
00263 40 CONTINUE
00264
00265 ELSE IF( LSAMEN( 2, C2, 'TR' ) ) THEN
00266
00267
00268
00269
00270
00271 CALL SLACPY( 'Full', N, NRHS, X, LDX, B, LDB )
00272 IF( KU.EQ.2 ) THEN
00273 DIAG = 'U'
00274 ELSE
00275 DIAG = 'N'
00276 END IF
00277 CALL STRMM( 'Left', UPLO, TRANS, DIAG, N, NRHS, ONE, A, LDA, B,
00278 $ LDB )
00279
00280 ELSE IF( LSAMEN( 2, C2, 'TP' ) ) THEN
00281
00282
00283
00284 CALL SLACPY( 'Full', N, NRHS, X, LDX, B, LDB )
00285 IF( KU.EQ.2 ) THEN
00286 DIAG = 'U'
00287 ELSE
00288 DIAG = 'N'
00289 END IF
00290 DO 50 J = 1, NRHS
00291 CALL STPMV( UPLO, TRANS, DIAG, N, A, B( 1, J ), 1 )
00292 50 CONTINUE
00293
00294 ELSE IF( LSAMEN( 2, C2, 'TB' ) ) THEN
00295
00296
00297
00298 CALL SLACPY( 'Full', N, NRHS, X, LDX, B, LDB )
00299 IF( KU.EQ.2 ) THEN
00300 DIAG = 'U'
00301 ELSE
00302 DIAG = 'N'
00303 END IF
00304 DO 60 J = 1, NRHS
00305 CALL STBMV( UPLO, TRANS, DIAG, N, KL, A, LDA, B( 1, J ), 1 )
00306 60 CONTINUE
00307
00308 ELSE
00309
00310
00311
00312 INFO = -1
00313 CALL XERBLA( 'SLARHS', -INFO )
00314 END IF
00315
00316 RETURN
00317
00318
00319
00320 END