189 SUBROUTINE zdrvls( DOTYPE, NM, MVAL, NN, NVAL, NNS, NSVAL, NNB,
190 $ NBVAL, NXVAL, THRESH, TSTERR, A, COPYA, B,
191 $ COPYB, C, S, COPYS, NOUT )
199 INTEGER NM, NN, NNB, NNS, NOUT
200 DOUBLE PRECISION THRESH
204 INTEGER MVAL( * ), NBVAL( * ), NSVAL( * ),
205 $ nval( * ), nxval( * )
206 DOUBLE PRECISION COPYS( * ), S( * )
207 COMPLEX*16 A( * ), B( * ), C( * ), COPYA( * ), COPYB( * )
214 PARAMETER ( NTESTS = 18 )
216 parameter( smlsiz = 25 )
217 DOUBLE PRECISION ONE, ZERO
218 parameter( one = 1.0d+0, zero = 0.0d+0 )
219 COMPLEX*16 CONE, CZERO
220 parameter( cone = ( 1.0d+0, 0.0d+0 ),
221 $ czero = ( 0.0d+0, 0.0d+0 ) )
226 INTEGER CRANK, I, IM, IMB, IN, INB, INFO, INS, IRANK,
227 $ iscale, itran, itype, j, k, lda, ldb, ldwork,
228 $ lwlsy, lwork, m, mnmin, n, nb, ncols, nerrs,
229 $ nfail, nrhs, nrows, nrun, rank, mb,
230 $ mmax, nmax, nsmax, liwork, lrwork,
231 $ lwork_zgels, lwork_zgelst, lwork_zgetsls,
232 $ lwork_zgelss, lwork_zgelsy, lwork_zgelsd,
233 $ lrwork_zgelsy, lrwork_zgelss, lrwork_zgelsd
234 DOUBLE PRECISION EPS, NORMA, NORMB, RCOND
237 INTEGER ISEED( 4 ), ISEEDY( 4 ), IWQ( 1 )
238 DOUBLE PRECISION RESULT( NTESTS ), RWQ( 1 )
242 COMPLEX*16,
ALLOCATABLE :: WORK (:)
243 DOUBLE PRECISION,
ALLOCATABLE :: RWORK (:), WORK2 (:)
244 INTEGER,
ALLOCATABLE :: IWORK (:)
247 DOUBLE PRECISION DASUM, DLAMCH, ZQRT12, ZQRT14, ZQRT17
248 EXTERNAL DASUM, DLAMCH, ZQRT12, ZQRT14, ZQRT17
257 INTRINSIC dble, max, min, int, sqrt
262 INTEGER INFOT, IOUNIT
265 COMMON / infoc / infot, iounit, ok, lerr
266 COMMON / srnamc / srnamt
269 DATA iseedy / 1988, 1989, 1990, 1991 /
275 path( 1: 1 ) =
'Zomplex precision'
281 iseed( i ) = iseedy( i )
283 eps = dlamch(
'Epsilon' )
287 rcond = sqrt( eps ) - ( sqrt( eps )-eps ) / 2
293 $
CALL zerrls( path, nout )
297 IF( ( nm.EQ.0 .OR. nn.EQ.0 ) .AND. thresh.EQ.zero )
298 $
CALL alahd( nout, path )
307 IF ( mval( i ).GT.mmax )
THEN
312 IF ( nval( i ).GT.nmax )
THEN
317 IF ( nsval( i ).GT.nsmax )
THEN
324 mnmin = max( min( m, n ), 1 )
329 lwork = max( 1, ( m+n )*nrhs,
330 $ ( n+nrhs )*( m+2 ), ( m+nrhs )*( n+2 ),
331 $ max( m+mnmin, nrhs*mnmin,2*n+m ),
332 $ max( m*n+4*mnmin+max(m,n), m*n+2*mnmin+4*n ) )
345 mnmin = max(min( m, n ),1)
351 itype = ( irank-1 )*3 + iscale
352 IF( dotype( itype ) )
THEN
353 IF( irank.EQ.1 )
THEN
355 IF( itran.EQ.1 )
THEN
362 CALL zgels( trans, m, n, nrhs, a, lda,
363 $ b, ldb, wq, -1, info )
364 lwork_zgels = int( wq( 1 ) )
366 CALL zgelst( trans, m, n, nrhs, a, lda,
367 $ b, ldb, wq, -1, info )
368 lwork_zgelst = int( wq( 1 ) )
370 CALL zgetsls( trans, m, n, nrhs, a, lda,
371 $ b, ldb, wq, -1, info )
372 lwork_zgetsls = int( wq( 1 ) )
376 CALL zgelsy( m, n, nrhs, a, lda, b, ldb, iwq,
377 $ rcond, crank, wq, -1, rwq, info )
378 lwork_zgelsy = int( wq( 1 ) )
381 CALL zgelss( m, n, nrhs, a, lda, b, ldb, s,
382 $ rcond, crank, wq, -1 , rwq,
384 lwork_zgelss = int( wq( 1 ) )
385 lrwork_zgelss = 5*mnmin
387 CALL zgelsd( m, n, nrhs, a, lda, b, ldb, s,
388 $ rcond, crank, wq, -1, rwq, iwq,
390 lwork_zgelsd = int( wq( 1 ) )
391 lrwork_zgelsd = int( rwq( 1 ) )
393 liwork = max( liwork, n, iwq( 1 ) )
395 lrwork = max( lrwork, lrwork_zgelsy,
396 $ lrwork_zgelss, lrwork_zgelsd )
398 lwork = max( lwork, lwork_zgels, lwork_zgelst,
399 $ lwork_zgetsls, lwork_zgelsy,
400 $ lwork_zgelss, lwork_zgelsd )
410 ALLOCATE( work( lwork ) )
411 ALLOCATE( work2( 2 * lwork ) )
412 ALLOCATE( iwork( liwork ) )
413 ALLOCATE( rwork( lrwork ) )
421 mnmin = max(min( m, n ),1)
430 itype = ( irank-1 )*3 + iscale
431 IF( .NOT.dotype( itype ) )
436 IF( irank.EQ.1 )
THEN
440 CALL zqrt13( iscale, m, n, copya, lda, norma,
448 CALL xlaenv( 3, nxval( inb ) )
453 IF( itran.EQ.1 )
THEN
462 ldwork = max( 1, ncols )
466 IF( ncols.GT.0 )
THEN
467 CALL zlarnv( 2, iseed, ncols*nrhs,
470 $ one / dble( ncols ), work,
473 CALL zgemm( trans,
'No transpose', nrows,
474 $ nrhs, ncols, cone, copya, lda,
475 $ work, ldwork, czero, b, ldb )
476 CALL zlacpy(
'Full', nrows, nrhs, b, ldb,
481 IF( m.GT.0 .AND. n.GT.0 )
THEN
482 CALL zlacpy(
'Full', m, n, copya, lda,
484 CALL zlacpy(
'Full', nrows, nrhs,
485 $ copyb, ldb, b, ldb )
488 CALL zgels( trans, m, n, nrhs, a, lda, b,
489 $ ldb, work, lwork, info )
492 $
CALL alaerh( path,
'ZGELS ', info, 0,
493 $ trans, m, n, nrhs, -1, nb,
494 $ itype, nfail, nerrs,
502 IF( nrows.GT.0 .AND. nrhs.GT.0 )
503 $
CALL zlacpy(
'Full', nrows, nrhs,
504 $ copyb, ldb, c, ldb )
505 CALL zqrt16( trans, m, n, nrhs, copya,
506 $ lda, b, ldb, c, ldb, rwork,
512 IF( ( itran.EQ.1 .AND. m.GE.n ) .OR.
513 $ ( itran.EQ.2 .AND. m.LT.n ) )
THEN
517 result( 2 ) = zqrt17( trans, 1, m, n,
518 $ nrhs, copya, lda, b, ldb,
519 $ copyb, ldb, c, work,
525 result( 2 ) = zqrt14( trans, m, n,
526 $ nrhs, copya, lda, b, ldb,
534 IF( result( k ).GE.thresh )
THEN
535 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
536 $
CALL alahd( nout, path )
537 WRITE( nout, fmt = 9999 )trans, m,
538 $ n, nrhs, nb, itype, k,
553 IF( irank.EQ.1 )
THEN
557 CALL zqrt13( iscale, m, n, copya, lda, norma,
565 CALL xlaenv( 3, nxval( inb ) )
570 IF( itran.EQ.1 )
THEN
579 ldwork = max( 1, ncols )
583 IF( ncols.GT.0 )
THEN
584 CALL zlarnv( 2, iseed, ncols*nrhs,
587 $ one / dble( ncols ), work,
590 CALL zgemm( trans,
'No transpose', nrows,
591 $ nrhs, ncols, cone, copya, lda,
592 $ work, ldwork, czero, b, ldb )
593 CALL zlacpy(
'Full', nrows, nrhs, b, ldb,
598 IF( m.GT.0 .AND. n.GT.0 )
THEN
599 CALL zlacpy(
'Full', m, n, copya, lda,
601 CALL zlacpy(
'Full', nrows, nrhs,
602 $ copyb, ldb, b, ldb )
605 CALL zgelst( trans, m, n, nrhs, a, lda, b,
606 $ ldb, work, lwork, info )
609 $
CALL alaerh( path,
'ZGELST', info, 0,
610 $ trans, m, n, nrhs, -1, nb,
611 $ itype, nfail, nerrs,
619 IF( nrows.GT.0 .AND. nrhs.GT.0 )
620 $
CALL zlacpy(
'Full', nrows, nrhs,
621 $ copyb, ldb, c, ldb )
622 CALL zqrt16( trans, m, n, nrhs, copya,
623 $ lda, b, ldb, c, ldb, rwork,
629 IF( ( itran.EQ.1 .AND. m.GE.n ) .OR.
630 $ ( itran.EQ.2 .AND. m.LT.n ) )
THEN
634 result( 4 ) = zqrt17( trans, 1, m, n,
635 $ nrhs, copya, lda, b, ldb,
636 $ copyb, ldb, c, work,
642 result( 4 ) = zqrt14( trans, m, n,
643 $ nrhs, copya, lda, b, ldb,
651 IF( result( k ).GE.thresh )
THEN
652 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
653 $
CALL alahd( nout, path )
654 WRITE( nout, fmt = 9999 )trans, m,
655 $ n, nrhs, nb, itype, k,
670 IF( irank.EQ.1 )
THEN
674 CALL zqrt13( iscale, m, n, copya, lda, norma,
693 IF( itran.EQ.1 )
THEN
702 ldwork = max( 1, ncols )
706 IF( ncols.GT.0 )
THEN
707 CALL zlarnv( 2, iseed, ncols*nrhs,
709 CALL zscal( ncols*nrhs,
710 $ cone / dble( ncols ),
713 CALL zgemm( trans,
'No transpose',
714 $ nrows, nrhs, ncols, cone,
715 $ copya, lda, work, ldwork,
717 CALL zlacpy(
'Full', nrows, nrhs,
718 $ b, ldb, copyb, ldb )
722 IF( m.GT.0 .AND. n.GT.0 )
THEN
723 CALL zlacpy(
'Full', m, n,
724 $ copya, lda, a, lda )
725 CALL zlacpy(
'Full', nrows, nrhs,
726 $ copyb, ldb, b, ldb )
729 CALL zgetsls( trans, m, n, nrhs, a,
730 $ lda, b, ldb, work, lwork,
733 $
CALL alaerh( path,
'ZGETSLS ', info,
734 $ 0, trans, m, n, nrhs,
735 $ -1, nb, itype, nfail,
743 IF( nrows.GT.0 .AND. nrhs.GT.0 )
744 $
CALL zlacpy(
'Full', nrows, nrhs,
745 $ copyb, ldb, c, ldb )
746 CALL zqrt16( trans, m, n, nrhs,
747 $ copya, lda, b, ldb,
754 IF( ( itran.EQ.1 .AND. m.GE.n ) .OR.
755 $ ( itran.EQ.2 .AND. m.LT.n ) )
THEN
761 result( 6 ) = zqrt17( trans, 1, m,
762 $ n, nrhs, copya, lda,
763 $ b, ldb, copyb, ldb,
769 result( 6 ) = zqrt14( trans, m, n,
770 $ nrhs, copya, lda, b,
778 IF( result( k ).GE.thresh )
THEN
779 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
780 $
CALL alahd( nout, path )
781 WRITE( nout, fmt = 9997 )trans,
782 $ m, n, nrhs, mb, nb, itype, k,
799 CALL zqrt15( iscale, irank, m, n, nrhs, copya, lda,
800 $ copyb, ldb, copys, rank, norma, normb,
801 $ iseed, work, lwork )
812 CALL xlaenv( 3, nxval( inb ) )
821 CALL zlacpy(
'Full', m, n, copya, lda, a, lda )
822 CALL zlacpy(
'Full', m, nrhs, copyb, ldb, b,
832 CALL zgelsy( m, n, nrhs, a, lda, b, ldb, iwork,
833 $ rcond, crank, work, lwlsy, rwork,
836 $
CALL alaerh( path,
'ZGELSY', info, 0,
' ', m,
837 $ n, nrhs, -1, nb, itype, nfail,
845 result( 7 ) = zqrt12( crank, crank, a, lda,
846 $ copys, work, lwork, rwork )
851 CALL zlacpy(
'Full', m, nrhs, copyb, ldb, work,
853 CALL zqrt16(
'No transpose', m, n, nrhs, copya,
854 $ lda, b, ldb, work, ldwork, rwork,
862 $ result( 9 ) = zqrt17(
'No transpose', 1, m,
863 $ n, nrhs, copya, lda, b, ldb,
864 $ copyb, ldb, c, work, lwork )
872 $ result( 10 ) = zqrt14(
'No transpose', m, n,
873 $ nrhs, copya, lda, b, ldb,
882 CALL zlacpy(
'Full', m, n, copya, lda, a, lda )
883 CALL zlacpy(
'Full', m, nrhs, copyb, ldb, b,
886 CALL zgelss( m, n, nrhs, a, lda, b, ldb, s,
887 $ rcond, crank, work, lwork, rwork,
891 $
CALL alaerh( path,
'ZGELSS', info, 0,
' ', m,
892 $ n, nrhs, -1, nb, itype, nfail,
901 CALL daxpy( mnmin, -one, copys, 1, s, 1 )
902 result( 11 ) = dasum( mnmin, s, 1 ) /
903 $ dasum( mnmin, copys, 1 ) /
904 $ ( eps*dble( mnmin ) )
911 CALL zlacpy(
'Full', m, nrhs, copyb, ldb, work,
913 CALL zqrt16(
'No transpose', m, n, nrhs, copya,
914 $ lda, b, ldb, work, ldwork, rwork,
921 $ result( 13 ) = zqrt17(
'No transpose', 1, m,
922 $ n, nrhs, copya, lda, b, ldb,
923 $ copyb, ldb, c, work, lwork )
929 $ result( 14 ) = zqrt14(
'No transpose', m, n,
930 $ nrhs, copya, lda, b, ldb,
941 CALL zlacpy(
'Full', m, n, copya, lda, a, lda )
942 CALL zlacpy(
'Full', m, nrhs, copyb, ldb, b,
946 CALL zgelsd( m, n, nrhs, a, lda, b, ldb, s,
947 $ rcond, crank, work, lwork, rwork,
950 $
CALL alaerh( path,
'ZGELSD', info, 0,
' ', m,
951 $ n, nrhs, -1, nb, itype, nfail,
957 CALL daxpy( mnmin, -one, copys, 1, s, 1 )
958 result( 15 ) = dasum( mnmin, s, 1 ) /
959 $ dasum( mnmin, copys, 1 ) /
960 $ ( eps*dble( mnmin ) )
967 CALL zlacpy(
'Full', m, nrhs, copyb, ldb, work,
969 CALL zqrt16(
'No transpose', m, n, nrhs, copya,
970 $ lda, b, ldb, work, ldwork, rwork,
977 $ result( 17 ) = zqrt17(
'No transpose', 1, m,
978 $ n, nrhs, copya, lda, b, ldb,
979 $ copyb, ldb, c, work, lwork )
985 $ result( 18 ) = zqrt14(
'No transpose', m, n,
986 $ nrhs, copya, lda, b, ldb,
993 IF( result( k ).GE.thresh )
THEN
994 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
995 $
CALL alahd( nout, path )
996 WRITE( nout, fmt = 9998 )m, n, nrhs, nb,
997 $ itype, k, result( k )
1012 CALL alasvm( path, nout, nfail, nrun, nerrs )
1014 9999
FORMAT(
' TRANS=''', a1,
''', M=', i5,
', N=', i5,
', NRHS=', i4,
1015 $
', NB=', i4,
', type', i2,
', test(', i2,
')=', g12.5 )
1016 9998
FORMAT(
' M=', i5,
', N=', i5,
', NRHS=', i4,
', NB=', i4,
1017 $
', type', i2,
', test(', i2,
')=', g12.5 )
1018 9997
FORMAT(
' TRANS=''', a1,
' M=', i5,
', N=', i5,
', NRHS=', i4,
1019 $
', MB=', i4,
', NB=', i4,
', type', i2,
1020 $
', test(', i2,
')=', g12.5 )
subroutine alasvm(type, nout, nfail, nrun, nerrs)
ALASVM
subroutine xlaenv(ispec, nvalue)
XLAENV
subroutine alaerh(path, subnam, info, infoe, opts, m, n, kl, ku, n5, imat, nfail, nerrs, nout)
ALAERH
subroutine alahd(iounit, path)
ALAHD
subroutine daxpy(n, da, dx, incx, dy, incy)
DAXPY
subroutine zgels(trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info)
ZGELS solves overdetermined or underdetermined systems for GE matrices
subroutine zgelsd(m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, rwork, iwork, info)
ZGELSD computes the minimum-norm solution to a linear least squares problem for GE matrices
subroutine zgelss(m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, rwork, info)
ZGELSS solves overdetermined or underdetermined systems for GE matrices
subroutine zgelst(trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info)
ZGELST solves overdetermined or underdetermined systems for GE matrices using QR or LQ factorization ...
subroutine zgelsy(m, n, nrhs, a, lda, b, ldb, jpvt, rcond, rank, work, lwork, rwork, info)
ZGELSY solves overdetermined or underdetermined systems for GE matrices
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
subroutine zgetsls(trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info)
ZGETSLS
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine zlarnv(idist, iseed, n, x)
ZLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine zdscal(n, da, zx, incx)
ZDSCAL
subroutine zscal(n, za, zx, incx)
ZSCAL
subroutine zdrvls(dotype, nm, mval, nn, nval, nns, nsval, nnb, nbval, nxval, thresh, tsterr, a, copya, b, copyb, c, s, copys, nout)
ZDRVLS
subroutine zerrls(path, nunit)
ZERRLS
subroutine zqrt13(scale, m, n, a, lda, norma, iseed)
ZQRT13
subroutine zqrt15(scale, rksel, m, n, nrhs, a, lda, b, ldb, s, rank, norma, normb, iseed, work, lwork)
ZQRT15
subroutine zqrt16(trans, m, n, nrhs, a, lda, x, ldx, b, ldb, rwork, resid)
ZQRT16