00001 SUBROUTINE CDRVLS( DOTYPE, NM, MVAL, NN, NVAL, NNS, NSVAL, NNB,
00002 $ NBVAL, NXVAL, THRESH, TSTERR, A, COPYA, B,
00003 $ COPYB, C, S, COPYS, WORK, RWORK, IWORK,
00004 $ NOUT )
00005
00006
00007
00008
00009
00010
00011 LOGICAL TSTERR
00012 INTEGER NM, NN, NNB, NNS, NOUT
00013 REAL THRESH
00014
00015
00016 LOGICAL DOTYPE( * )
00017 INTEGER IWORK( * ), MVAL( * ), NBVAL( * ), NSVAL( * ),
00018 $ NVAL( * ), NXVAL( * )
00019 REAL COPYS( * ), RWORK( * ), S( * )
00020 COMPLEX A( * ), B( * ), C( * ), COPYA( * ), COPYB( * ),
00021 $ WORK( * )
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 INTEGER NTESTS
00121 PARAMETER ( NTESTS = 18 )
00122 INTEGER SMLSIZ
00123 PARAMETER ( SMLSIZ = 25 )
00124 REAL ONE, ZERO
00125 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
00126 COMPLEX CONE, CZERO
00127 PARAMETER ( CONE = ( 1.0E+0, 0.0E+0 ),
00128 $ CZERO = ( 0.0E+0, 0.0E+0 ) )
00129
00130
00131 CHARACTER TRANS
00132 CHARACTER*3 PATH
00133 INTEGER CRANK, I, IM, IN, INB, INFO, INS, IRANK,
00134 $ ISCALE, ITRAN, ITYPE, J, K, LDA, LDB, LDWORK,
00135 $ LWLSY, LWORK, M, MNMIN, N, NB, NCOLS, NERRS,
00136 $ NFAIL, NRHS, NROWS, NRUN, RANK
00137 REAL EPS, NORMA, NORMB, RCOND
00138
00139
00140 INTEGER ISEED( 4 ), ISEEDY( 4 )
00141 REAL RESULT( NTESTS )
00142
00143
00144 REAL CQRT12, CQRT14, CQRT17, SASUM, SLAMCH
00145 EXTERNAL CQRT12, CQRT14, CQRT17, SASUM, SLAMCH
00146
00147
00148 EXTERNAL ALAERH, ALAHD, ALASVM, CERRLS, CGELS, CGELSD,
00149 $ CGELSS, CGELSX, CGELSY, CGEMM, CLACPY, CLARNV,
00150 $ CQRT13, CQRT15, CQRT16, CSSCAL, SAXPY,
00151 $ XLAENV
00152
00153
00154 INTRINSIC MAX, MIN, REAL, SQRT
00155
00156
00157 LOGICAL LERR, OK
00158 CHARACTER*32 SRNAMT
00159 INTEGER INFOT, IOUNIT
00160
00161
00162 COMMON / INFOC / INFOT, IOUNIT, OK, LERR
00163 COMMON / SRNAMC / SRNAMT
00164
00165
00166 DATA ISEEDY / 1988, 1989, 1990, 1991 /
00167
00168
00169
00170
00171
00172 PATH( 1: 1 ) = 'Complex precision'
00173 PATH( 2: 3 ) = 'LS'
00174 NRUN = 0
00175 NFAIL = 0
00176 NERRS = 0
00177 DO 10 I = 1, 4
00178 ISEED( I ) = ISEEDY( I )
00179 10 CONTINUE
00180 EPS = SLAMCH( 'Epsilon' )
00181
00182
00183
00184 RCOND = SQRT( EPS ) - ( SQRT( EPS )-EPS ) / 2
00185
00186
00187
00188 CALL XLAENV( 9, SMLSIZ )
00189 IF( TSTERR )
00190 $ CALL CERRLS( PATH, NOUT )
00191
00192
00193
00194 IF( ( NM.EQ.0 .OR. NN.EQ.0 ) .AND. THRESH.EQ.ZERO )
00195 $ CALL ALAHD( NOUT, PATH )
00196 INFOT = 0
00197
00198 DO 140 IM = 1, NM
00199 M = MVAL( IM )
00200 LDA = MAX( 1, M )
00201
00202 DO 130 IN = 1, NN
00203 N = NVAL( IN )
00204 MNMIN = MIN( M, N )
00205 LDB = MAX( 1, M, N )
00206
00207 DO 120 INS = 1, NNS
00208 NRHS = NSVAL( INS )
00209 LWORK = MAX( 1, ( M+NRHS )*( N+2 ), ( N+NRHS )*( M+2 ),
00210 $ M*N+4*MNMIN+MAX( M, N ), 2*N+M )
00211
00212 DO 110 IRANK = 1, 2
00213 DO 100 ISCALE = 1, 3
00214 ITYPE = ( IRANK-1 )*3 + ISCALE
00215 IF( .NOT.DOTYPE( ITYPE ) )
00216 $ GO TO 100
00217
00218 IF( IRANK.EQ.1 ) THEN
00219
00220
00221
00222
00223
00224 CALL CQRT13( ISCALE, M, N, COPYA, LDA, NORMA,
00225 $ ISEED )
00226 DO 40 INB = 1, NNB
00227 NB = NBVAL( INB )
00228 CALL XLAENV( 1, NB )
00229 CALL XLAENV( 3, NXVAL( INB ) )
00230
00231 DO 30 ITRAN = 1, 2
00232 IF( ITRAN.EQ.1 ) THEN
00233 TRANS = 'N'
00234 NROWS = M
00235 NCOLS = N
00236 ELSE
00237 TRANS = 'C'
00238 NROWS = N
00239 NCOLS = M
00240 END IF
00241 LDWORK = MAX( 1, NCOLS )
00242
00243
00244
00245 IF( NCOLS.GT.0 ) THEN
00246 CALL CLARNV( 2, ISEED, NCOLS*NRHS,
00247 $ WORK )
00248 CALL CSSCAL( NCOLS*NRHS,
00249 $ ONE / REAL( NCOLS ), WORK,
00250 $ 1 )
00251 END IF
00252 CALL CGEMM( TRANS, 'No transpose', NROWS,
00253 $ NRHS, NCOLS, CONE, COPYA, LDA,
00254 $ WORK, LDWORK, CZERO, B, LDB )
00255 CALL CLACPY( 'Full', NROWS, NRHS, B, LDB,
00256 $ COPYB, LDB )
00257
00258
00259
00260 IF( M.GT.0 .AND. N.GT.0 ) THEN
00261 CALL CLACPY( 'Full', M, N, COPYA, LDA,
00262 $ A, LDA )
00263 CALL CLACPY( 'Full', NROWS, NRHS,
00264 $ COPYB, LDB, B, LDB )
00265 END IF
00266 SRNAMT = 'CGELS '
00267 CALL CGELS( TRANS, M, N, NRHS, A, LDA, B,
00268 $ LDB, WORK, LWORK, INFO )
00269
00270 IF( INFO.NE.0 )
00271 $ CALL ALAERH( PATH, 'CGELS ', INFO, 0,
00272 $ TRANS, M, N, NRHS, -1, NB,
00273 $ ITYPE, NFAIL, NERRS,
00274 $ NOUT )
00275
00276
00277
00278 LDWORK = MAX( 1, NROWS )
00279 IF( NROWS.GT.0 .AND. NRHS.GT.0 )
00280 $ CALL CLACPY( 'Full', NROWS, NRHS,
00281 $ COPYB, LDB, C, LDB )
00282 CALL CQRT16( TRANS, M, N, NRHS, COPYA,
00283 $ LDA, B, LDB, C, LDB, RWORK,
00284 $ RESULT( 1 ) )
00285
00286 IF( ( ITRAN.EQ.1 .AND. M.GE.N ) .OR.
00287 $ ( ITRAN.EQ.2 .AND. M.LT.N ) ) THEN
00288
00289
00290
00291 RESULT( 2 ) = CQRT17( TRANS, 1, M, N,
00292 $ NRHS, COPYA, LDA, B, LDB,
00293 $ COPYB, LDB, C, WORK,
00294 $ LWORK )
00295 ELSE
00296
00297
00298
00299 RESULT( 2 ) = CQRT14( TRANS, M, N,
00300 $ NRHS, COPYA, LDA, B, LDB,
00301 $ WORK, LWORK )
00302 END IF
00303
00304
00305
00306
00307 DO 20 K = 1, 2
00308 IF( RESULT( K ).GE.THRESH ) THEN
00309 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
00310 $ CALL ALAHD( NOUT, PATH )
00311 WRITE( NOUT, FMT = 9999 )TRANS, M,
00312 $ N, NRHS, NB, ITYPE, K,
00313 $ RESULT( K )
00314 NFAIL = NFAIL + 1
00315 END IF
00316 20 CONTINUE
00317 NRUN = NRUN + 2
00318 30 CONTINUE
00319 40 CONTINUE
00320 END IF
00321
00322
00323
00324
00325 CALL CQRT15( ISCALE, IRANK, M, N, NRHS, COPYA, LDA,
00326 $ COPYB, LDB, COPYS, RANK, NORMA, NORMB,
00327 $ ISEED, WORK, LWORK )
00328
00329
00330
00331 DO 50 J = 1, N
00332 IWORK( J ) = 0
00333 50 CONTINUE
00334 LDWORK = MAX( 1, M )
00335
00336
00337
00338
00339
00340
00341
00342 CALL CLACPY( 'Full', M, N, COPYA, LDA, A, LDA )
00343 CALL CLACPY( 'Full', M, NRHS, COPYB, LDB, B, LDB )
00344
00345 SRNAMT = 'CGELSX'
00346 CALL CGELSX( M, N, NRHS, A, LDA, B, LDB, IWORK,
00347 $ RCOND, CRANK, WORK, RWORK, INFO )
00348
00349 IF( INFO.NE.0 )
00350 $ CALL ALAERH( PATH, 'CGELSX', INFO, 0, ' ', M, N,
00351 $ NRHS, -1, NB, ITYPE, NFAIL, NERRS,
00352 $ NOUT )
00353
00354
00355
00356
00357
00358
00359 RESULT( 3 ) = CQRT12( CRANK, CRANK, A, LDA, COPYS,
00360 $ WORK, LWORK, RWORK )
00361
00362
00363
00364
00365 CALL CLACPY( 'Full', M, NRHS, COPYB, LDB, WORK,
00366 $ LDWORK )
00367 CALL CQRT16( 'No transpose', M, N, NRHS, COPYA,
00368 $ LDA, B, LDB, WORK, LDWORK, RWORK,
00369 $ RESULT( 4 ) )
00370
00371
00372
00373
00374 RESULT( 5 ) = ZERO
00375 IF( M.GT.CRANK )
00376 $ RESULT( 5 ) = CQRT17( 'No transpose', 1, M, N,
00377 $ NRHS, COPYA, LDA, B, LDB, COPYB,
00378 $ LDB, C, WORK, LWORK )
00379
00380
00381
00382
00383 RESULT( 6 ) = ZERO
00384
00385 IF( N.GT.CRANK )
00386 $ RESULT( 6 ) = CQRT14( 'No transpose', M, N,
00387 $ NRHS, COPYA, LDA, B, LDB, WORK,
00388 $ LWORK )
00389
00390
00391
00392
00393 DO 60 K = 3, 6
00394 IF( RESULT( K ).GE.THRESH ) THEN
00395 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
00396 $ CALL ALAHD( NOUT, PATH )
00397 WRITE( NOUT, FMT = 9998 )M, N, NRHS, 0,
00398 $ ITYPE, K, RESULT( K )
00399 NFAIL = NFAIL + 1
00400 END IF
00401 60 CONTINUE
00402 NRUN = NRUN + 4
00403
00404
00405
00406 DO 90 INB = 1, NNB
00407 NB = NBVAL( INB )
00408 CALL XLAENV( 1, NB )
00409 CALL XLAENV( 3, NXVAL( INB ) )
00410
00411
00412
00413
00414
00415
00416
00417
00418 CALL CLACPY( 'Full', M, N, COPYA, LDA, A, LDA )
00419 CALL CLACPY( 'Full', M, NRHS, COPYB, LDB, B,
00420 $ LDB )
00421
00422
00423
00424 DO 70 J = 1, N
00425 IWORK( J ) = 0
00426 70 CONTINUE
00427
00428
00429
00430 LWLSY = MNMIN + MAX( 2*MNMIN, NB*( N+1 ),
00431 $ MNMIN+NB*NRHS )
00432 LWLSY = MAX( 1, LWLSY )
00433
00434 SRNAMT = 'CGELSY'
00435 CALL CGELSY( M, N, NRHS, A, LDA, B, LDB, IWORK,
00436 $ RCOND, CRANK, WORK, LWLSY, RWORK,
00437 $ INFO )
00438 IF( INFO.NE.0 )
00439 $ CALL ALAERH( PATH, 'CGELSY', INFO, 0, ' ', M,
00440 $ N, NRHS, -1, NB, ITYPE, NFAIL,
00441 $ NERRS, NOUT )
00442
00443
00444
00445
00446
00447
00448 RESULT( 7 ) = CQRT12( CRANK, CRANK, A, LDA,
00449 $ COPYS, WORK, LWORK, RWORK )
00450
00451
00452
00453
00454 CALL CLACPY( 'Full', M, NRHS, COPYB, LDB, WORK,
00455 $ LDWORK )
00456 CALL CQRT16( 'No transpose', M, N, NRHS, COPYA,
00457 $ LDA, B, LDB, WORK, LDWORK, RWORK,
00458 $ RESULT( 8 ) )
00459
00460
00461
00462
00463 RESULT( 9 ) = ZERO
00464 IF( M.GT.CRANK )
00465 $ RESULT( 9 ) = CQRT17( 'No transpose', 1, M,
00466 $ N, NRHS, COPYA, LDA, B, LDB,
00467 $ COPYB, LDB, C, WORK, LWORK )
00468
00469
00470
00471
00472 RESULT( 10 ) = ZERO
00473
00474 IF( N.GT.CRANK )
00475 $ RESULT( 10 ) = CQRT14( 'No transpose', M, N,
00476 $ NRHS, COPYA, LDA, B, LDB,
00477 $ WORK, LWORK )
00478
00479
00480
00481
00482
00483
00484
00485 CALL CLACPY( 'Full', M, N, COPYA, LDA, A, LDA )
00486 CALL CLACPY( 'Full', M, NRHS, COPYB, LDB, B,
00487 $ LDB )
00488 SRNAMT = 'CGELSS'
00489 CALL CGELSS( M, N, NRHS, A, LDA, B, LDB, S,
00490 $ RCOND, CRANK, WORK, LWORK, RWORK,
00491 $ INFO )
00492
00493 IF( INFO.NE.0 )
00494 $ CALL ALAERH( PATH, 'CGELSS', INFO, 0, ' ', M,
00495 $ N, NRHS, -1, NB, ITYPE, NFAIL,
00496 $ NERRS, NOUT )
00497
00498
00499
00500
00501
00502
00503 IF( RANK.GT.0 ) THEN
00504 CALL SAXPY( MNMIN, -ONE, COPYS, 1, S, 1 )
00505 RESULT( 11 ) = SASUM( MNMIN, S, 1 ) /
00506 $ SASUM( MNMIN, COPYS, 1 ) /
00507 $ ( EPS*REAL( MNMIN ) )
00508 ELSE
00509 RESULT( 11 ) = ZERO
00510 END IF
00511
00512
00513
00514 CALL CLACPY( 'Full', M, NRHS, COPYB, LDB, WORK,
00515 $ LDWORK )
00516 CALL CQRT16( 'No transpose', M, N, NRHS, COPYA,
00517 $ LDA, B, LDB, WORK, LDWORK, RWORK,
00518 $ RESULT( 12 ) )
00519
00520
00521
00522 RESULT( 13 ) = ZERO
00523 IF( M.GT.CRANK )
00524 $ RESULT( 13 ) = CQRT17( 'No transpose', 1, M,
00525 $ N, NRHS, COPYA, LDA, B, LDB,
00526 $ COPYB, LDB, C, WORK, LWORK )
00527
00528
00529
00530 RESULT( 14 ) = ZERO
00531 IF( N.GT.CRANK )
00532 $ RESULT( 14 ) = CQRT14( 'No transpose', M, N,
00533 $ NRHS, COPYA, LDA, B, LDB,
00534 $ WORK, LWORK )
00535
00536
00537
00538
00539
00540
00541
00542 CALL XLAENV( 9, 25 )
00543
00544 CALL CLACPY( 'Full', M, N, COPYA, LDA, A, LDA )
00545 CALL CLACPY( 'Full', M, NRHS, COPYB, LDB, B,
00546 $ LDB )
00547
00548 SRNAMT = 'CGELSD'
00549 CALL CGELSD( M, N, NRHS, A, LDA, B, LDB, S,
00550 $ RCOND, CRANK, WORK, LWORK, RWORK,
00551 $ IWORK, INFO )
00552 IF( INFO.NE.0 )
00553 $ CALL ALAERH( PATH, 'CGELSD', INFO, 0, ' ', M,
00554 $ N, NRHS, -1, NB, ITYPE, NFAIL,
00555 $ NERRS, NOUT )
00556
00557
00558
00559 IF( RANK.GT.0 ) THEN
00560 CALL SAXPY( MNMIN, -ONE, COPYS, 1, S, 1 )
00561 RESULT( 15 ) = SASUM( MNMIN, S, 1 ) /
00562 $ SASUM( MNMIN, COPYS, 1 ) /
00563 $ ( EPS*REAL( MNMIN ) )
00564 ELSE
00565 RESULT( 15 ) = ZERO
00566 END IF
00567
00568
00569
00570 CALL CLACPY( 'Full', M, NRHS, COPYB, LDB, WORK,
00571 $ LDWORK )
00572 CALL CQRT16( 'No transpose', M, N, NRHS, COPYA,
00573 $ LDA, B, LDB, WORK, LDWORK, RWORK,
00574 $ RESULT( 16 ) )
00575
00576
00577
00578 RESULT( 17 ) = ZERO
00579 IF( M.GT.CRANK )
00580 $ RESULT( 17 ) = CQRT17( 'No transpose', 1, M,
00581 $ N, NRHS, COPYA, LDA, B, LDB,
00582 $ COPYB, LDB, C, WORK, LWORK )
00583
00584
00585
00586 RESULT( 18 ) = ZERO
00587 IF( N.GT.CRANK )
00588 $ RESULT( 18 ) = CQRT14( 'No transpose', M, N,
00589 $ NRHS, COPYA, LDA, B, LDB,
00590 $ WORK, LWORK )
00591
00592
00593
00594
00595 DO 80 K = 7, NTESTS
00596 IF( RESULT( K ).GE.THRESH ) THEN
00597 IF( NFAIL.EQ.0 .AND. NERRS.EQ.0 )
00598 $ CALL ALAHD( NOUT, PATH )
00599 WRITE( NOUT, FMT = 9998 )M, N, NRHS, NB,
00600 $ ITYPE, K, RESULT( K )
00601 NFAIL = NFAIL + 1
00602 END IF
00603 80 CONTINUE
00604 NRUN = NRUN + 12
00605
00606 90 CONTINUE
00607 100 CONTINUE
00608 110 CONTINUE
00609 120 CONTINUE
00610 130 CONTINUE
00611 140 CONTINUE
00612
00613
00614
00615 CALL ALASVM( PATH, NOUT, NFAIL, NRUN, NERRS )
00616
00617 9999 FORMAT( ' TRANS=''', A1, ''', M=', I5, ', N=', I5, ', NRHS=', I4,
00618 $ ', NB=', I4, ', type', I2, ', test(', I2, ')=', G12.5 )
00619 9998 FORMAT( ' M=', I5, ', N=', I5, ', NRHS=', I4, ', NB=', I4,
00620 $ ', type', I2, ', test(', I2, ')=', G12.5 )
00621 RETURN
00622
00623
00624
00625 END