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