189 SUBROUTINE sdrvls( 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
204 INTEGER MVAL( * ), NBVAL( * ), NSVAL( * ),
205 $ nval( * ), nxval( * )
206 REAL A( * ), B( * ), C( * ), COPYA( * ), COPYB( * ),
214 PARAMETER ( NTESTS = 18 )
216 parameter( smlsiz = 25 )
218 parameter( one = 1.0e0, two = 2.0e0, zero = 0.0e0 )
223 INTEGER CRANK, I, IM, IMB, IN, INB, INFO, INS, IRANK,
224 $ iscale, itran, itype, j, k, lda, ldb, ldwork,
225 $ lwlsy, lwork, m, mnmin, n, nb, ncols, nerrs,
226 $ nfail, nrhs, nrows, nrun, rank, mb,
227 $ mmax, nmax, nsmax, liwork,
228 $ lwork_sgels, lwork_sgelst, lwork_sgetsls,
229 $ lwork_sgelss, lwork_sgelsy, lwork_sgelsd
230 REAL EPS, NORMA, NORMB, RCOND
233 INTEGER ISEED( 4 ), ISEEDY( 4 ), IWQ( 1 )
234 REAL RESULT( NTESTS ), WQ( 1 )
237 REAL,
ALLOCATABLE :: WORK (:)
238 INTEGER,
ALLOCATABLE :: IWORK (:)
241 REAL SASUM, SLAMCH, SQRT12, SQRT14, SQRT17
242 EXTERNAL SASUM, SLAMCH, SQRT12, SQRT14, SQRT17
251 INTRINSIC int, max, min, real, sqrt
256 INTEGER INFOT, IOUNIT
259 COMMON / infoc / infot, iounit, ok, lerr
260 COMMON / srnamc / srnamt
263 DATA iseedy / 1988, 1989, 1990, 1991 /
269 path( 1: 1 ) =
'SINGLE PRECISION'
275 iseed( i ) = iseedy( i )
277 eps = slamch(
'Epsilon' )
281 rcond = sqrt( eps ) - ( sqrt( eps )-eps ) / 2
288 $
CALL serrls( path, nout )
292 IF( ( nm.EQ.0 .OR. nn.EQ.0 ) .AND. thresh.EQ.zero )
293 $
CALL alahd( nout, path )
304 IF ( mval( i ).GT.mmax )
THEN
309 IF ( nval( i ).GT.nmax )
THEN
314 IF ( nsval( i ).GT.nsmax )
THEN
321 mnmin = max( min( m, n ), 1 )
326 lwork = max( 1, ( m+n )*nrhs,
327 $ ( n+nrhs )*( m+2 ), ( m+nrhs )*( n+2 ),
328 $ max( m+mnmin, nrhs*mnmin,2*n+m ),
329 $ max( m*n+4*mnmin+max(m,n), m*n+2*mnmin+4*n ) )
341 mnmin = max(min( m, n ),1)
347 itype = ( irank-1 )*3 + iscale
348 IF( dotype( itype ) )
THEN
349 IF( irank.EQ.1 )
THEN
351 IF( itran.EQ.1 )
THEN
358 CALL sgels( trans, m, n, nrhs, a, lda,
359 $ b, ldb, wq( 1 ), -1, info )
360 lwork_sgels = int( wq( 1 ) )
362 CALL sgelst( trans, m, n, nrhs, a, lda,
363 $ b, ldb, wq, -1, info )
364 lwork_sgelst = int( wq( 1 ) )
366 CALL sgetsls( trans, m, n, nrhs, a, lda,
367 $ b, ldb, wq( 1 ), -1, info )
368 lwork_sgetsls = int( wq( 1 ) )
372 CALL sgelsy( m, n, nrhs, a, lda, b, ldb, iwq,
373 $ rcond, crank, wq, -1, info )
374 lwork_sgelsy = int( wq( 1 ) )
376 CALL sgelss( m, n, nrhs, a, lda, b, ldb, s,
377 $ rcond, crank, wq, -1 , info )
378 lwork_sgelss = int( wq( 1 ) )
380 CALL sgelsd( m, n, nrhs, a, lda, b, ldb, s,
381 $ rcond, crank, wq, -1, iwq, info )
382 lwork_sgelsd = int( wq( 1 ) )
384 liwork = max( liwork, n, iwq( 1 ) )
386 lwork = max( lwork, lwork_sgels, lwork_sgelst,
387 $ lwork_sgetsls, lwork_sgelsy,
388 $ lwork_sgelss, lwork_sgelsd )
398 ALLOCATE( work( lwork ) )
399 ALLOCATE( iwork( liwork ) )
407 mnmin = max(min( m, n ),1)
416 itype = ( irank-1 )*3 + iscale
417 IF( .NOT.dotype( itype ) )
422 IF( irank.EQ.1 )
THEN
426 CALL sqrt13( iscale, m, n, copya, lda, norma,
434 CALL xlaenv( 3, nxval( inb ) )
439 IF( itran.EQ.1 )
THEN
448 ldwork = max( 1, ncols )
452 IF( ncols.GT.0 )
THEN
453 CALL slarnv( 2, iseed, ncols*nrhs,
455 CALL sscal( ncols*nrhs,
456 $ one / real( ncols ), work,
459 CALL sgemm( trans,
'No transpose', nrows,
460 $ nrhs, ncols, one, copya, lda,
461 $ work, ldwork, zero, b, ldb )
462 CALL slacpy(
'Full', nrows, nrhs, b, ldb,
467 IF( m.GT.0 .AND. n.GT.0 )
THEN
468 CALL slacpy(
'Full', m, n, copya, lda,
470 CALL slacpy(
'Full', nrows, nrhs,
471 $ copyb, ldb, b, ldb )
474 CALL sgels( trans, m, n, nrhs, a, lda, b,
475 $ ldb, work, lwork, info )
477 $
CALL alaerh( path,
'SGELS ', info, 0,
478 $ trans, m, n, nrhs, -1, nb,
479 $ itype, nfail, nerrs,
487 IF( nrows.GT.0 .AND. nrhs.GT.0 )
488 $
CALL slacpy(
'Full', nrows, nrhs,
489 $ copyb, ldb, c, ldb )
490 CALL sqrt16( trans, m, n, nrhs, copya,
491 $ lda, b, ldb, c, ldb, work,
497 IF( ( itran.EQ.1 .AND. m.GE.n ) .OR.
498 $ ( itran.EQ.2 .AND. m.LT.n ) )
THEN
504 result( 2 ) = sqrt17( trans, 1, m, n,
505 $ nrhs, copya, lda, b, ldb,
506 $ copyb, ldb, c, work,
512 result( 2 ) = sqrt14( trans, m, n,
513 $ nrhs, copya, lda, b, ldb,
521 IF( result( k ).GE.thresh )
THEN
522 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
523 $
CALL alahd( nout, path )
524 WRITE( nout, fmt = 9999 )trans, m,
525 $ n, nrhs, nb, itype, k,
540 IF( irank.EQ.1 )
THEN
544 CALL sqrt13( iscale, m, n, copya, lda, norma,
556 IF( itran.EQ.1 )
THEN
565 ldwork = max( 1, ncols )
569 IF( ncols.GT.0 )
THEN
570 CALL slarnv( 2, iseed, ncols*nrhs,
572 CALL sscal( ncols*nrhs,
573 $ one / real( ncols ), work,
576 CALL sgemm( trans,
'No transpose', nrows,
577 $ nrhs, ncols, one, copya, lda,
578 $ work, ldwork, zero, b, ldb )
579 CALL slacpy(
'Full', nrows, nrhs, b, ldb,
584 IF( m.GT.0 .AND. n.GT.0 )
THEN
585 CALL slacpy(
'Full', m, n, copya, lda,
587 CALL slacpy(
'Full', nrows, nrhs,
588 $ copyb, ldb, b, ldb )
591 CALL sgelst( trans, m, n, nrhs, a, lda, b,
592 $ ldb, work, lwork, info )
594 $
CALL alaerh( path,
'SGELST', info, 0,
595 $ trans, m, n, nrhs, -1, nb,
596 $ itype, nfail, nerrs,
604 IF( nrows.GT.0 .AND. nrhs.GT.0 )
605 $
CALL slacpy(
'Full', nrows, nrhs,
606 $ copyb, ldb, c, ldb )
607 CALL sqrt16( trans, m, n, nrhs, copya,
608 $ lda, b, ldb, c, ldb, work,
614 IF( ( itran.EQ.1 .AND. m.GE.n ) .OR.
615 $ ( itran.EQ.2 .AND. m.LT.n ) )
THEN
621 result( 4 ) = sqrt17( trans, 1, m, n,
622 $ nrhs, copya, lda, b, ldb,
623 $ copyb, ldb, c, work,
629 result( 4 ) = sqrt14( trans, m, n,
630 $ nrhs, copya, lda, b, ldb,
638 IF( result( k ).GE.thresh )
THEN
639 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
640 $
CALL alahd( nout, path )
641 WRITE( nout, fmt = 9999 ) trans, m,
642 $ n, nrhs, nb, itype, k,
657 IF( irank.EQ.1 )
THEN
661 CALL sqrt13( iscale, m, n, copya, lda, norma,
680 IF( itran.EQ.1 )
THEN
689 ldwork = max( 1, ncols )
693 IF( ncols.GT.0 )
THEN
694 CALL slarnv( 2, iseed, ncols*nrhs,
696 CALL sscal( ncols*nrhs,
697 $ one / real( ncols ),
700 CALL sgemm( trans,
'No transpose',
701 $ nrows, nrhs, ncols, one,
702 $ copya, lda, work, ldwork,
704 CALL slacpy(
'Full', nrows, nrhs,
705 $ b, ldb, copyb, ldb )
709 IF( m.GT.0 .AND. n.GT.0 )
THEN
710 CALL slacpy(
'Full', m, n,
711 $ copya, lda, a, lda )
712 CALL slacpy(
'Full', nrows, nrhs,
713 $ copyb, ldb, b, ldb )
716 CALL sgetsls( trans, m, n, nrhs,
717 $ a, lda, b, ldb, work, lwork,
720 $
CALL alaerh( path,
'SGETSLS', info,
721 $ 0, trans, m, n, nrhs,
722 $ -1, nb, itype, nfail,
730 IF( nrows.GT.0 .AND. nrhs.GT.0 )
731 $
CALL slacpy(
'Full', nrows, nrhs,
732 $ copyb, ldb, c, ldb )
733 CALL sqrt16( trans, m, n, nrhs,
734 $ copya, lda, b, ldb,
741 IF( ( itran.EQ.1 .AND. m.GE.n ) .OR.
742 $ ( itran.EQ.2 .AND. m.LT.n ) )
THEN
748 result( 6 ) = sqrt17( trans, 1, m,
749 $ n, nrhs, copya, lda,
750 $ b, ldb, copyb, ldb,
756 result( 6 ) = sqrt14( trans, m, n,
758 $ b, ldb, work, lwork )
765 IF( result( k ).GE.thresh )
THEN
766 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
767 $
CALL alahd( nout, path )
768 WRITE( nout, fmt = 9997 ) trans,
769 $ m, n, nrhs, mb, nb, itype,
786 CALL sqrt15( iscale, irank, m, n, nrhs, copya, lda,
787 $ copyb, ldb, copys, rank, norma, normb,
788 $ iseed, work, lwork )
799 CALL xlaenv( 3, nxval( inb ) )
814 CALL slacpy(
'Full', m, n, copya, lda, a, lda )
815 CALL slacpy(
'Full', m, nrhs, copyb, ldb, b,
819 CALL sgelsy( m, n, nrhs, a, lda, b, ldb, iwork,
820 $ rcond, crank, work, lwlsy, info )
822 $
CALL alaerh( path,
'SGELSY', info, 0,
' ', m,
823 $ n, nrhs, -1, nb, itype, nfail,
829 result( 7 ) = sqrt12( crank, crank, a, lda,
830 $ copys, work, lwork )
835 CALL slacpy(
'Full', m, nrhs, copyb, ldb, work,
837 CALL sqrt16(
'No transpose', m, n, nrhs, copya,
838 $ lda, b, ldb, work, ldwork,
839 $ work( m*nrhs+1 ), result( 8 ) )
846 $ result( 9 ) = sqrt17(
'No transpose', 1, m,
847 $ n, nrhs, copya, lda, b, ldb,
848 $ copyb, ldb, c, work, lwork )
856 $ result( 10 ) = sqrt14(
'No transpose', m, n,
857 $ nrhs, copya, lda, b, ldb,
866 CALL slacpy(
'Full', m, n, copya, lda, a, lda )
867 CALL slacpy(
'Full', m, nrhs, copyb, ldb, b,
870 CALL sgelss( m, n, nrhs, a, lda, b, ldb, s,
871 $ rcond, crank, work, lwork, info )
873 $
CALL alaerh( path,
'SGELSS', info, 0,
' ', m,
874 $ n, nrhs, -1, nb, itype, nfail,
883 CALL saxpy( mnmin, -one, copys, 1, s, 1 )
884 result( 11 ) = sasum( mnmin, s, 1 ) /
885 $ sasum( mnmin, copys, 1 ) /
886 $ ( eps*real( mnmin ) )
893 CALL slacpy(
'Full', m, nrhs, copyb, ldb, work,
895 CALL sqrt16(
'No transpose', m, n, nrhs, copya,
896 $ lda, b, ldb, work, ldwork,
897 $ work( m*nrhs+1 ), result( 12 ) )
903 $ result( 13 ) = sqrt17(
'No transpose', 1, m,
904 $ n, nrhs, copya, lda, b, ldb,
905 $ copyb, ldb, c, work, lwork )
911 $ result( 14 ) = sqrt14(
'No transpose', m, n,
912 $ nrhs, copya, lda, b, ldb,
927 CALL slacpy(
'Full', m, n, copya, lda, a, lda )
928 CALL slacpy(
'Full', m, nrhs, copyb, ldb, b,
932 CALL sgelsd( m, n, nrhs, a, lda, b, ldb, s,
933 $ rcond, crank, work, lwork, iwork,
936 $
CALL alaerh( path,
'SGELSD', info, 0,
' ', m,
937 $ n, nrhs, -1, nb, itype, nfail,
943 CALL saxpy( mnmin, -one, copys, 1, s, 1 )
944 result( 15 ) = sasum( mnmin, s, 1 ) /
945 $ sasum( mnmin, copys, 1 ) /
946 $ ( eps*real( mnmin ) )
953 CALL slacpy(
'Full', m, nrhs, copyb, ldb, work,
955 CALL sqrt16(
'No transpose', m, n, nrhs, copya,
956 $ lda, b, ldb, work, ldwork,
957 $ work( m*nrhs+1 ), result( 16 ) )
963 $ result( 17 ) = sqrt17(
'No transpose', 1, m,
964 $ n, nrhs, copya, lda, b, ldb,
965 $ copyb, ldb, c, work, lwork )
971 $ result( 18 ) = sqrt14(
'No transpose', m, n,
972 $ nrhs, copya, lda, b, ldb,
979 IF( result( k ).GE.thresh )
THEN
980 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
981 $
CALL alahd( nout, path )
982 WRITE( nout, fmt = 9998 )m, n, nrhs, nb,
983 $ itype, k, result( k )
998 CALL alasvm( path, nout, nfail, nrun, nerrs )
1000 9999
FORMAT(
' TRANS=''', a1,
''', M=', i5,
', N=', i5,
', NRHS=', i4,
1001 $
', NB=', i4,
', type', i2,
', test(', i2,
')=', g12.5 )
1002 9998
FORMAT(
' M=', i5,
', N=', i5,
', NRHS=', i4,
', NB=', i4,
1003 $
', type', i2,
', test(', i2,
')=', g12.5 )
1004 9997
FORMAT(
' TRANS=''', a1,
' M=', i5,
', N=', i5,
', NRHS=', i4,
1005 $
', MB=', i4,
', NB=', i4,
', type', i2,
1006 $
', 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 saxpy(n, sa, sx, incx, sy, incy)
SAXPY
subroutine sgels(trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info)
SGELS solves overdetermined or underdetermined systems for GE matrices
subroutine sgelsd(m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, iwork, info)
SGELSD computes the minimum-norm solution to a linear least squares problem for GE matrices
subroutine sgelss(m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, info)
SGELSS solves overdetermined or underdetermined systems for GE matrices
subroutine sgelst(trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info)
SGELST solves overdetermined or underdetermined systems for GE matrices using QR or LQ factorization ...
subroutine sgelsy(m, n, nrhs, a, lda, b, ldb, jpvt, rcond, rank, work, lwork, info)
SGELSY solves overdetermined or underdetermined systems for GE matrices
subroutine sgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
SGEMM
subroutine sgetsls(trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info)
SGETSLS
subroutine slacpy(uplo, m, n, a, lda, b, ldb)
SLACPY copies all or part of one two-dimensional array to another.
subroutine slarnv(idist, iseed, n, x)
SLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine sdrvls(dotype, nm, mval, nn, nval, nns, nsval, nnb, nbval, nxval, thresh, tsterr, a, copya, b, copyb, c, s, copys, nout)
SDRVLS
subroutine serrls(path, nunit)
SERRLS
subroutine sqrt13(scale, m, n, a, lda, norma, iseed)
SQRT13
subroutine sqrt15(scale, rksel, m, n, nrhs, a, lda, b, ldb, s, rank, norma, normb, iseed, work, lwork)
SQRT15
subroutine sqrt16(trans, m, n, nrhs, a, lda, x, ldx, b, ldb, rwork, resid)
SQRT16