213 INTEGER nm, nn, nnb, nns, nout
214 DOUBLE PRECISION thresh
218 INTEGER iwork( * ), mval( * ), nbval( * ), nsval( * ),
219 $ nval( * ), nxval( * )
220 DOUBLE PRECISION a( * ), b( * ), c( * ), copya( * ), copyb( * ),
221 $ copys( * ), s( * ), work( * )
228 parameter ( ntests = 14 )
230 parameter ( smlsiz = 25 )
231 DOUBLE PRECISION one, two, zero
232 parameter ( one = 1.0d0, two = 2.0d0, zero = 0.0d0 )
237 INTEGER crank, i, im, in, inb, info, ins, irank,
238 $ iscale, itran, itype, j, k, lda, ldb, ldwork,
239 $ lwlsy, lwork, m, mnmin, n, nb, ncols, nerrs,
240 $ nfail, nlvl, nrhs, nrows, nrun, rank
241 DOUBLE PRECISION eps, norma, normb, rcond
244 INTEGER iseed( 4 ), iseedy( 4 )
245 DOUBLE PRECISION result( ntests )
258 INTRINSIC dble, int, log, max, min, sqrt
263 INTEGER infot, iounit
266 COMMON / infoc / infot, iounit, ok, lerr
267 COMMON / srnamc / srnamt
270 DATA iseedy / 1988, 1989, 1990, 1991 /
276 path( 1: 1 ) =
'Double precision'
282 iseed( i ) = iseedy( i )
288 rcond = sqrt( eps ) - ( sqrt( eps )-eps ) / 2
295 $
CALL derrls( path, nout )
299 IF( ( nm.EQ.0 .OR. nn.EQ.0 ) .AND. thresh.EQ.zero )
300 $
CALL alahd( nout, path )
316 nlvl = max( int( log( max( one, dble( mnmin ) ) /
317 $ dble( smlsiz+1 ) ) / log( two ) ) + 1, 0 )
318 lwork = max( 1, ( m+nrhs )*( n+2 ), ( n+nrhs )*( m+2 ),
319 $ m*n+4*mnmin+max( m, n ), 12*mnmin+2*mnmin*smlsiz+
320 $ 8*mnmin*nlvl+mnmin*nrhs+(smlsiz+1)**2 )
324 itype = ( irank-1 )*3 + iscale
325 IF( .NOT.dotype( itype ) )
328 IF( irank.EQ.1 )
THEN
334 CALL dqrt13( iscale, m, n, copya, lda, norma,
339 CALL xlaenv( 3, nxval( inb ) )
342 IF( itran.EQ.1 )
THEN
351 ldwork = max( 1, ncols )
355 IF( ncols.GT.0 )
THEN
356 CALL dlarnv( 2, iseed, ncols*nrhs,
358 CALL dscal( ncols*nrhs,
359 $ one / dble( ncols ), work,
362 CALL dgemm( trans,
'No transpose', nrows,
363 $ nrhs, ncols, one, copya, lda,
364 $ work, ldwork, zero, b, ldb )
365 CALL dlacpy(
'Full', nrows, nrhs, b, ldb,
370 IF( m.GT.0 .AND. n.GT.0 )
THEN
371 CALL dlacpy(
'Full', m, n, copya, lda,
373 CALL dlacpy(
'Full', nrows, nrhs,
374 $ copyb, ldb, b, ldb )
377 CALL dgels( trans, m, n, nrhs, a, lda, b,
378 $ ldb, work, lwork, info )
380 $
CALL alaerh( path,
'DGELS ', info, 0,
381 $ trans, m, n, nrhs, -1, nb,
382 $ itype, nfail, nerrs,
387 ldwork = max( 1, nrows )
388 IF( nrows.GT.0 .AND. nrhs.GT.0 )
389 $
CALL dlacpy(
'Full', nrows, nrhs,
390 $ copyb, ldb, c, ldb )
391 CALL dqrt16( trans, m, n, nrhs, copya,
392 $ lda, b, ldb, c, ldb, work,
395 IF( ( itran.EQ.1 .AND. m.GE.n ) .OR.
396 $ ( itran.EQ.2 .AND. m.LT.n ) )
THEN
400 result( 2 ) =
dqrt17( trans, 1, m, n,
401 $ nrhs, copya, lda, b, ldb,
402 $ copyb, ldb, c, work,
408 result( 2 ) =
dqrt14( trans, m, n,
409 $ nrhs, copya, lda, b, ldb,
417 IF( result( k ).GE.thresh )
THEN
418 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
419 $
CALL alahd( nout, path )
420 WRITE( nout, fmt = 9999 )trans, m,
421 $ n, nrhs, nb, itype, k,
434 CALL dqrt15( iscale, irank, m, n, nrhs, copya, lda,
435 $ copyb, ldb, copys, rank, norma, normb,
436 $ iseed, work, lwork )
447 CALL xlaenv( 3, nxval( inb ) )
464 lwlsy = max( 1, mnmin+2*n+nb*( n+1 ),
467 CALL dlacpy(
'Full', m, n, copya, lda, a, lda )
468 CALL dlacpy(
'Full', m, nrhs, copyb, ldb, b,
472 CALL dgelsy( m, n, nrhs, a, lda, b, ldb, iwork,
473 $ rcond, crank, work, lwlsy, info )
475 $
CALL alaerh( path,
'DGELSY', info, 0,
' ', m,
476 $ n, nrhs, -1, nb, itype, nfail,
482 result( 3 ) =
dqrt12( crank, crank, a, lda,
483 $ copys, work, lwork )
488 CALL dlacpy(
'Full', m, nrhs, copyb, ldb, work,
490 CALL dqrt16(
'No transpose', m, n, nrhs, copya,
491 $ lda, b, ldb, work, ldwork,
492 $ work( m*nrhs+1 ), result( 4 ) )
499 $ result( 5 ) =
dqrt17(
'No transpose', 1, m,
500 $ n, nrhs, copya, lda, b, ldb,
501 $ copyb, ldb, c, work, lwork )
509 $ result( 6 ) =
dqrt14(
'No transpose', m, n,
510 $ nrhs, copya, lda, b, ldb,
519 CALL dlacpy(
'Full', m, n, copya, lda, a, lda )
520 CALL dlacpy(
'Full', m, nrhs, copyb, ldb, b,
523 CALL dgelss( m, n, nrhs, a, lda, b, ldb, s,
524 $ rcond, crank, work, lwork, info )
526 $
CALL alaerh( path,
'DGELSS', info, 0,
' ', m,
527 $ n, nrhs, -1, nb, itype, nfail,
536 CALL daxpy( mnmin, -one, copys, 1, s, 1 )
537 result( 7 ) =
dasum( mnmin, s, 1 ) /
538 $
dasum( mnmin, copys, 1 ) /
539 $ ( eps*dble( mnmin ) )
546 CALL dlacpy(
'Full', m, nrhs, copyb, ldb, work,
548 CALL dqrt16(
'No transpose', m, n, nrhs, copya,
549 $ lda, b, ldb, work, ldwork,
550 $ work( m*nrhs+1 ), result( 8 ) )
556 $ result( 9 ) =
dqrt17(
'No transpose', 1, m,
557 $ n, nrhs, copya, lda, b, ldb,
558 $ copyb, ldb, c, work, lwork )
564 $ result( 10 ) =
dqrt14(
'No transpose', m, n,
565 $ nrhs, copya, lda, b, ldb,
580 CALL dlacpy(
'Full', m, n, copya, lda, a, lda )
581 CALL dlacpy(
'Full', m, nrhs, copyb, ldb, b,
585 CALL dgelsd( m, n, nrhs, a, lda, b, ldb, s,
586 $ rcond, crank, work, lwork, iwork,
589 $
CALL alaerh( path,
'DGELSD', info, 0,
' ', m,
590 $ n, nrhs, -1, nb, itype, nfail,
596 CALL daxpy( mnmin, -one, copys, 1, s, 1 )
597 result( 11 ) =
dasum( mnmin, s, 1 ) /
598 $
dasum( mnmin, copys, 1 ) /
599 $ ( eps*dble( mnmin ) )
606 CALL dlacpy(
'Full', m, nrhs, copyb, ldb, work,
608 CALL dqrt16(
'No transpose', m, n, nrhs, copya,
609 $ lda, b, ldb, work, ldwork,
610 $ work( m*nrhs+1 ), result( 12 ) )
616 $ result( 13 ) =
dqrt17(
'No transpose', 1, m,
617 $ n, nrhs, copya, lda, b, ldb,
618 $ copyb, ldb, c, work, lwork )
624 $ result( 14 ) =
dqrt14(
'No transpose', m, n,
625 $ nrhs, copya, lda, b, ldb,
632 IF( result( k ).GE.thresh )
THEN
633 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
634 $
CALL alahd( nout, path )
635 WRITE( nout, fmt = 9998 )m, n, nrhs, nb,
636 $ itype, k, result( k )
651 CALL alasvm( path, nout, nfail, nrun, nerrs )
653 9999
FORMAT(
' TRANS=''', a1,
''', M=', i5,
', N=', i5,
', NRHS=', i4,
654 $
', NB=', i4,
', type', i2,
', test(', i2,
')=', g12.5 )
655 9998
FORMAT(
' M=', i5,
', N=', i5,
', NRHS=', i4,
', NB=', i4,
656 $
', type', i2,
', test(', i2,
')=', g12.5 )
subroutine alasvm(TYPE, NOUT, NFAIL, NRUN, NERRS)
ALASVM
subroutine dlasrt(ID, N, D, INFO)
DLASRT sorts numbers in increasing or decreasing order.
subroutine alahd(IOUNIT, PATH)
ALAHD
subroutine alaerh(PATH, SUBNAM, INFO, INFOE, OPTS, M, N, KL, KU, N5, IMAT, NFAIL, NERRS, NOUT)
ALAERH
subroutine dqrt16(TRANS, M, N, NRHS, A, LDA, X, LDX, B, LDB, RWORK, RESID)
DQRT16
subroutine derrls(PATH, NUNIT)
DERRLS
double precision function dlamch(CMACH)
DLAMCH
double precision function dqrt12(M, N, A, LDA, S, WORK, LWORK)
DQRT12
subroutine dlacpy(UPLO, M, N, A, LDA, B, LDB)
DLACPY copies all or part of one two-dimensional array to another.
subroutine dgelsd(M, N, NRHS, A, LDA, B, LDB, S, RCOND, RANK, WORK, LWORK, IWORK, INFO)
DGELSD computes the minimum-norm solution to a linear least squares problem for GE matrices ...
subroutine daxpy(N, DA, DX, INCX, DY, INCY)
DAXPY
subroutine dgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
DGEMM
subroutine xlaenv(ISPEC, NVALUE)
XLAENV
subroutine dqrt15(SCALE, RKSEL, M, N, NRHS, A, LDA, B, LDB, S, RANK, NORMA, NORMB, ISEED, WORK, LWORK)
DQRT15
subroutine dgelss(M, N, NRHS, A, LDA, B, LDB, S, RCOND, RANK, WORK, LWORK, INFO)
DGELSS solves overdetermined or underdetermined systems for GE matrices
subroutine dgels(TRANS, M, N, NRHS, A, LDA, B, LDB, WORK, LWORK, INFO)
DGELS solves overdetermined or underdetermined systems for GE matrices
double precision function dqrt14(TRANS, M, N, NRHS, A, LDA, X, LDX, WORK, LWORK)
DQRT14
subroutine dscal(N, DA, DX, INCX)
DSCAL
double precision function dasum(N, DX, INCX)
DASUM
double precision function dqrt17(TRANS, IRESID, M, N, NRHS, A, LDA, X, LDX, B, LDB, C, WORK, LWORK)
DQRT17
subroutine dqrt13(SCALE, M, N, A, LDA, NORMA, ISEED)
DQRT13
subroutine dgelsy(M, N, NRHS, A, LDA, B, LDB, JPVT, RCOND, RANK, WORK, LWORK, INFO)
DGELSY solves overdetermined or underdetermined systems for GE matrices
subroutine dlarnv(IDIST, ISEED, N, X)
DLARNV returns a vector of random numbers from a uniform or normal distribution.