LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ cchkbd()

subroutine cchkbd ( integer  NSIZES,
integer, dimension( * )  MVAL,
integer, dimension( * )  NVAL,
integer  NTYPES,
logical, dimension( * )  DOTYPE,
integer  NRHS,
integer, dimension( 4 )  ISEED,
real  THRESH,
complex, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  BD,
real, dimension( * )  BE,
real, dimension( * )  S1,
real, dimension( * )  S2,
complex, dimension( ldx, * )  X,
integer  LDX,
complex, dimension( ldx, * )  Y,
complex, dimension( ldx, * )  Z,
complex, dimension( ldq, * )  Q,
integer  LDQ,
complex, dimension( ldpt, * )  PT,
integer  LDPT,
complex, dimension( ldpt, * )  U,
complex, dimension( ldpt, * )  VT,
complex, dimension( * )  WORK,
integer  LWORK,
real, dimension( * )  RWORK,
integer  NOUT,
integer  INFO 
)

CCHKBD

Purpose:
 CCHKBD checks the singular value decomposition (SVD) routines.

 CGEBRD reduces a complex general m by n matrix A to real upper or
 lower bidiagonal form by an orthogonal transformation: Q' * A * P = B
 (or A = Q * B * P').  The matrix B is upper bidiagonal if m >= n
 and lower bidiagonal if m < n.

 CUNGBR generates the orthogonal matrices Q and P' from CGEBRD.
 Note that Q and P are not necessarily square.

 CBDSQR computes the singular value decomposition of the bidiagonal
 matrix B as B = U S V'.  It is called three times to compute
    1)  B = U S1 V', where S1 is the diagonal matrix of singular
        values and the columns of the matrices U and V are the left
        and right singular vectors, respectively, of B.
    2)  Same as 1), but the singular values are stored in S2 and the
        singular vectors are not computed.
    3)  A = (UQ) S (P'V'), the SVD of the original matrix A.
 In addition, CBDSQR has an option to apply the left orthogonal matrix
 U to a matrix X, useful in least squares applications.

 For each pair of matrix dimensions (M,N) and each selected matrix
 type, an M by N matrix A and an M by NRHS matrix X are generated.
 The problem dimensions are as follows
    A:          M x N
    Q:          M x min(M,N) (but M x M if NRHS > 0)
    P:          min(M,N) x N
    B:          min(M,N) x min(M,N)
    U, V:       min(M,N) x min(M,N)
    S1, S2      diagonal, order min(M,N)
    X:          M x NRHS

 For each generated matrix, 14 tests are performed:

 Test CGEBRD and CUNGBR

 (1)   | A - Q B PT | / ( |A| max(M,N) ulp ), PT = P'

 (2)   | I - Q' Q | / ( M ulp )

 (3)   | I - PT PT' | / ( N ulp )

 Test CBDSQR on bidiagonal matrix B

 (4)   | B - U S1 VT | / ( |B| min(M,N) ulp ), VT = V'

 (5)   | Y - U Z | / ( |Y| max(min(M,N),k) ulp ), where Y = Q' X
                                                  and   Z = U' Y.
 (6)   | I - U' U | / ( min(M,N) ulp )

 (7)   | I - VT VT' | / ( min(M,N) ulp )

 (8)   S1 contains min(M,N) nonnegative values in decreasing order.
       (Return 0 if true, 1/ULP if false.)

 (9)   0 if the true singular values of B are within THRESH of
       those in S1.  2*THRESH if they are not.  (Tested using
       SSVDCH)

 (10)  | S1 - S2 | / ( |S1| ulp ), where S2 is computed without
                                   computing U and V.

 Test CBDSQR on matrix A

 (11)  | A - (QU) S (VT PT) | / ( |A| max(M,N) ulp )

 (12)  | X - (QU) Z | / ( |X| max(M,k) ulp )

 (13)  | I - (QU)'(QU) | / ( M ulp )

 (14)  | I - (VT PT) (PT'VT') | / ( N ulp )

 The possible matrix types are

 (1)  The zero matrix.
 (2)  The identity matrix.

 (3)  A diagonal matrix with evenly spaced entries
      1, ..., ULP  and random signs.
      (ULP = (first number larger than 1) - 1 )
 (4)  A diagonal matrix with geometrically spaced entries
      1, ..., ULP  and random signs.
 (5)  A diagonal matrix with "clustered" entries 1, ULP, ..., ULP
      and random signs.

 (6)  Same as (3), but multiplied by SQRT( overflow threshold )
 (7)  Same as (3), but multiplied by SQRT( underflow threshold )

 (8)  A matrix of the form  U D V, where U and V are orthogonal and
      D has evenly spaced entries 1, ..., ULP with random signs
      on the diagonal.

 (9)  A matrix of the form  U D V, where U and V are orthogonal and
      D has geometrically spaced entries 1, ..., ULP with random
      signs on the diagonal.

 (10) A matrix of the form  U D V, where U and V are orthogonal and
      D has "clustered" entries 1, ULP,..., ULP with random
      signs on the diagonal.

 (11) Same as (8), but multiplied by SQRT( overflow threshold )
 (12) Same as (8), but multiplied by SQRT( underflow threshold )

 (13) Rectangular matrix with random entries chosen from (-1,1).
 (14) Same as (13), but multiplied by SQRT( overflow threshold )
 (15) Same as (13), but multiplied by SQRT( underflow threshold )

 Special case:
 (16) A bidiagonal matrix with random entries chosen from a
      logarithmic distribution on [ulp^2,ulp^(-2)]  (I.e., each
      entry is  e^x, where x is chosen uniformly on
      [ 2 log(ulp), -2 log(ulp) ] .)  For *this* type:
      (a) CGEBRD is not called to reduce it to bidiagonal form.
      (b) the bidiagonal is  min(M,N) x min(M,N); if M<N, the
          matrix will be lower bidiagonal, otherwise upper.
      (c) only tests 5--8 and 14 are performed.

 A subset of the full set of matrix types may be selected through
 the logical array DOTYPE.
Parameters
[in]NSIZES
          NSIZES is INTEGER
          The number of values of M and N contained in the vectors
          MVAL and NVAL.  The matrix sizes are used in pairs (M,N).
[in]MVAL
          MVAL is INTEGER array, dimension (NM)
          The values of the matrix row dimension M.
[in]NVAL
          NVAL is INTEGER array, dimension (NM)
          The values of the matrix column dimension N.
[in]NTYPES
          NTYPES is INTEGER
          The number of elements in DOTYPE.   If it is zero, CCHKBD
          does nothing.  It must be at least zero.  If it is MAXTYP+1
          and NSIZES is 1, then an additional type, MAXTYP+1 is
          defined, which is to use whatever matrices are in A and B.
          This is only useful if DOTYPE(1:MAXTYP) is .FALSE. and
          DOTYPE(MAXTYP+1) is .TRUE. .
[in]DOTYPE
          DOTYPE is LOGICAL array, dimension (NTYPES)
          If DOTYPE(j) is .TRUE., then for each size (m,n), a matrix
          of type j will be generated.  If NTYPES is smaller than the
          maximum number of types defined (PARAMETER MAXTYP), then
          types NTYPES+1 through MAXTYP will not be generated.  If
          NTYPES is larger than MAXTYP, DOTYPE(MAXTYP+1) through
          DOTYPE(NTYPES) will be ignored.
[in]NRHS
          NRHS is INTEGER
          The number of columns in the "right-hand side" matrices X, Y,
          and Z, used in testing CBDSQR.  If NRHS = 0, then the
          operations on the right-hand side will not be tested.
          NRHS must be at least 0.
[in,out]ISEED
          ISEED is INTEGER array, dimension (4)
          On entry ISEED specifies the seed of the random number
          generator. The array elements should be between 0 and 4095;
          if not they will be reduced mod 4096.  Also, ISEED(4) must
          be odd.  The values of ISEED are changed on exit, and can be
          used in the next call to CCHKBD to continue the same random
          number sequence.
[in]THRESH
          THRESH is REAL
          The threshold value for the test ratios.  A result is
          included in the output file if RESULT >= THRESH.  To have
          every test ratio printed, use THRESH = 0.  Note that the
          expected value of the test ratios is O(1), so THRESH should
          be a reasonably small multiple of 1, e.g., 10 or 100.
[out]A
          A is COMPLEX array, dimension (LDA,NMAX)
          where NMAX is the maximum value of N in NVAL.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,MMAX),
          where MMAX is the maximum value of M in MVAL.
[out]BD
          BD is REAL array, dimension
                      (max(min(MVAL(j),NVAL(j))))
[out]BE
          BE is REAL array, dimension
                      (max(min(MVAL(j),NVAL(j))))
[out]S1
          S1 is REAL array, dimension
                      (max(min(MVAL(j),NVAL(j))))
[out]S2
          S2 is REAL array, dimension
                      (max(min(MVAL(j),NVAL(j))))
[out]X
          X is COMPLEX array, dimension (LDX,NRHS)
[in]LDX
          LDX is INTEGER
          The leading dimension of the arrays X, Y, and Z.
          LDX >= max(1,MMAX).
[out]Y
          Y is COMPLEX array, dimension (LDX,NRHS)
[out]Z
          Z is COMPLEX array, dimension (LDX,NRHS)
[out]Q
          Q is COMPLEX array, dimension (LDQ,MMAX)
[in]LDQ
          LDQ is INTEGER
          The leading dimension of the array Q.  LDQ >= max(1,MMAX).
[out]PT
          PT is COMPLEX array, dimension (LDPT,NMAX)
[in]LDPT
          LDPT is INTEGER
          The leading dimension of the arrays PT, U, and V.
          LDPT >= max(1, max(min(MVAL(j),NVAL(j)))).
[out]U
          U is COMPLEX array, dimension
                      (LDPT,max(min(MVAL(j),NVAL(j))))
[out]VT
          VT is COMPLEX array, dimension
                      (LDPT,max(min(MVAL(j),NVAL(j))))
[out]WORK
          WORK is COMPLEX array, dimension (LWORK)
[in]LWORK
          LWORK is INTEGER
          The number of entries in WORK.  This must be at least
          3(M+N) and  M(M + max(M,N,k) + 1) + N*min(M,N)  for all
          pairs  (M,N)=(MM(j),NN(j))
[out]RWORK
          RWORK is REAL array, dimension
                      (5*max(min(M,N)))
[in]NOUT
          NOUT is INTEGER
          The FORTRAN unit number for printing out error messages
          (e.g., if a routine returns IINFO not equal to 0.)
[out]INFO
          INFO is INTEGER
          If 0, then everything ran OK.
           -1: NSIZES < 0
           -2: Some MM(j) < 0
           -3: Some NN(j) < 0
           -4: NTYPES < 0
           -6: NRHS  < 0
           -8: THRESH < 0
          -11: LDA < 1 or LDA < MMAX, where MMAX is max( MM(j) ).
          -17: LDB < 1 or LDB < MMAX.
          -21: LDQ < 1 or LDQ < MMAX.
          -23: LDP < 1 or LDP < MNMAX.
          -27: LWORK too small.
          If  CLATMR, CLATMS, CGEBRD, CUNGBR, or CBDSQR,
              returns an error code, the
              absolute value of it is returned.

-----------------------------------------------------------------------

     Some Local Variables and Parameters:
     ---- ----- --------- --- ----------

     ZERO, ONE       Real 0 and 1.
     MAXTYP          The number of types defined.
     NTEST           The number of tests performed, or which can
                     be performed so far, for the current matrix.
     MMAX            Largest value in NN.
     NMAX            Largest value in NN.
     MNMIN           min(MM(j), NN(j)) (the dimension of the bidiagonal
                     matrix.)
     MNMAX           The maximum value of MNMIN for j=1,...,NSIZES.
     NFAIL           The number of tests which have exceeded THRESH
     COND, IMODE     Values to be passed to the matrix generators.
     ANORM           Norm of A; passed to matrix generators.

     OVFL, UNFL      Overflow and underflow thresholds.
     RTOVFL, RTUNFL  Square roots of the previous 2 values.
     ULP, ULPINV     Finest relative precision and its inverse.

             The following four arrays decode JTYPE:
     KTYPE(j)        The general type (1-10) for type "j".
     KMODE(j)        The MODE value to be passed to the matrix
                     generator for type "j".
     KMAGN(j)        The order of magnitude ( O(1),
                     O(overflow^(1/2) ), O(underflow^(1/2) )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 411 of file cchkbd.f.

415*
416* -- LAPACK test routine --
417* -- LAPACK is a software package provided by Univ. of Tennessee, --
418* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
419*
420* .. Scalar Arguments ..
421 INTEGER INFO, LDA, LDPT, LDQ, LDX, LWORK, NOUT, NRHS,
422 $ NSIZES, NTYPES
423 REAL THRESH
424* ..
425* .. Array Arguments ..
426 LOGICAL DOTYPE( * )
427 INTEGER ISEED( 4 ), MVAL( * ), NVAL( * )
428 REAL BD( * ), BE( * ), RWORK( * ), S1( * ), S2( * )
429 COMPLEX A( LDA, * ), PT( LDPT, * ), Q( LDQ, * ),
430 $ U( LDPT, * ), VT( LDPT, * ), WORK( * ),
431 $ X( LDX, * ), Y( LDX, * ), Z( LDX, * )
432* ..
433*
434* ======================================================================
435*
436* .. Parameters ..
437 REAL ZERO, ONE, TWO, HALF
438 parameter( zero = 0.0e0, one = 1.0e0, two = 2.0e0,
439 $ half = 0.5e0 )
440 COMPLEX CZERO, CONE
441 parameter( czero = ( 0.0e+0, 0.0e+0 ),
442 $ cone = ( 1.0e+0, 0.0e+0 ) )
443 INTEGER MAXTYP
444 parameter( maxtyp = 16 )
445* ..
446* .. Local Scalars ..
447 LOGICAL BADMM, BADNN, BIDIAG
448 CHARACTER UPLO
449 CHARACTER*3 PATH
450 INTEGER I, IINFO, IMODE, ITYPE, J, JCOL, JSIZE, JTYPE,
451 $ LOG2UI, M, MINWRK, MMAX, MNMAX, MNMIN, MQ,
452 $ MTYPES, N, NFAIL, NMAX, NTEST
453 REAL AMNINV, ANORM, COND, OVFL, RTOVFL, RTUNFL,
454 $ TEMP1, TEMP2, ULP, ULPINV, UNFL
455* ..
456* .. Local Arrays ..
457 INTEGER IOLDSD( 4 ), IWORK( 1 ), KMAGN( MAXTYP ),
458 $ KMODE( MAXTYP ), KTYPE( MAXTYP )
459 REAL DUMMA( 1 ), RESULT( 14 )
460* ..
461* .. External Functions ..
462 REAL SLAMCH, SLARND
463 EXTERNAL slamch, slarnd
464* ..
465* .. External Subroutines ..
466 EXTERNAL alasum, cbdsqr, cbdt01, cbdt02, cbdt03,
470* ..
471* .. Intrinsic Functions ..
472 INTRINSIC abs, exp, int, log, max, min, sqrt
473* ..
474* .. Scalars in Common ..
475 LOGICAL LERR, OK
476 CHARACTER*32 SRNAMT
477 INTEGER INFOT, NUNIT
478* ..
479* .. Common blocks ..
480 COMMON / infoc / infot, nunit, ok, lerr
481 COMMON / srnamc / srnamt
482* ..
483* .. Data statements ..
484 DATA ktype / 1, 2, 5*4, 5*6, 3*9, 10 /
485 DATA kmagn / 2*1, 3*1, 2, 3, 3*1, 2, 3, 1, 2, 3, 0 /
486 DATA kmode / 2*0, 4, 3, 1, 4, 4, 4, 3, 1, 4, 4, 0,
487 $ 0, 0, 0 /
488* ..
489* .. Executable Statements ..
490*
491* Check for errors
492*
493 info = 0
494*
495 badmm = .false.
496 badnn = .false.
497 mmax = 1
498 nmax = 1
499 mnmax = 1
500 minwrk = 1
501 DO 10 j = 1, nsizes
502 mmax = max( mmax, mval( j ) )
503 IF( mval( j ).LT.0 )
504 $ badmm = .true.
505 nmax = max( nmax, nval( j ) )
506 IF( nval( j ).LT.0 )
507 $ badnn = .true.
508 mnmax = max( mnmax, min( mval( j ), nval( j ) ) )
509 minwrk = max( minwrk, 3*( mval( j )+nval( j ) ),
510 $ mval( j )*( mval( j )+max( mval( j ), nval( j ),
511 $ nrhs )+1 )+nval( j )*min( nval( j ), mval( j ) ) )
512 10 CONTINUE
513*
514* Check for errors
515*
516 IF( nsizes.LT.0 ) THEN
517 info = -1
518 ELSE IF( badmm ) THEN
519 info = -2
520 ELSE IF( badnn ) THEN
521 info = -3
522 ELSE IF( ntypes.LT.0 ) THEN
523 info = -4
524 ELSE IF( nrhs.LT.0 ) THEN
525 info = -6
526 ELSE IF( lda.LT.mmax ) THEN
527 info = -11
528 ELSE IF( ldx.LT.mmax ) THEN
529 info = -17
530 ELSE IF( ldq.LT.mmax ) THEN
531 info = -21
532 ELSE IF( ldpt.LT.mnmax ) THEN
533 info = -23
534 ELSE IF( minwrk.GT.lwork ) THEN
535 info = -27
536 END IF
537*
538 IF( info.NE.0 ) THEN
539 CALL xerbla( 'CCHKBD', -info )
540 RETURN
541 END IF
542*
543* Initialize constants
544*
545 path( 1: 1 ) = 'Complex precision'
546 path( 2: 3 ) = 'BD'
547 nfail = 0
548 ntest = 0
549 unfl = slamch( 'Safe minimum' )
550 ovfl = slamch( 'Overflow' )
551 CALL slabad( unfl, ovfl )
552 ulp = slamch( 'Precision' )
553 ulpinv = one / ulp
554 log2ui = int( log( ulpinv ) / log( two ) )
555 rtunfl = sqrt( unfl )
556 rtovfl = sqrt( ovfl )
557 infot = 0
558*
559* Loop over sizes, types
560*
561 DO 180 jsize = 1, nsizes
562 m = mval( jsize )
563 n = nval( jsize )
564 mnmin = min( m, n )
565 amninv = one / max( m, n, 1 )
566*
567 IF( nsizes.NE.1 ) THEN
568 mtypes = min( maxtyp, ntypes )
569 ELSE
570 mtypes = min( maxtyp+1, ntypes )
571 END IF
572*
573 DO 170 jtype = 1, mtypes
574 IF( .NOT.dotype( jtype ) )
575 $ GO TO 170
576*
577 DO 20 j = 1, 4
578 ioldsd( j ) = iseed( j )
579 20 CONTINUE
580*
581 DO 30 j = 1, 14
582 result( j ) = -one
583 30 CONTINUE
584*
585 uplo = ' '
586*
587* Compute "A"
588*
589* Control parameters:
590*
591* KMAGN KMODE KTYPE
592* =1 O(1) clustered 1 zero
593* =2 large clustered 2 identity
594* =3 small exponential (none)
595* =4 arithmetic diagonal, (w/ eigenvalues)
596* =5 random symmetric, w/ eigenvalues
597* =6 nonsymmetric, w/ singular values
598* =7 random diagonal
599* =8 random symmetric
600* =9 random nonsymmetric
601* =10 random bidiagonal (log. distrib.)
602*
603 IF( mtypes.GT.maxtyp )
604 $ GO TO 100
605*
606 itype = ktype( jtype )
607 imode = kmode( jtype )
608*
609* Compute norm
610*
611 GO TO ( 40, 50, 60 )kmagn( jtype )
612*
613 40 CONTINUE
614 anorm = one
615 GO TO 70
616*
617 50 CONTINUE
618 anorm = ( rtovfl*ulp )*amninv
619 GO TO 70
620*
621 60 CONTINUE
622 anorm = rtunfl*max( m, n )*ulpinv
623 GO TO 70
624*
625 70 CONTINUE
626*
627 CALL claset( 'Full', lda, n, czero, czero, a, lda )
628 iinfo = 0
629 cond = ulpinv
630*
631 bidiag = .false.
632 IF( itype.EQ.1 ) THEN
633*
634* Zero matrix
635*
636 iinfo = 0
637*
638 ELSE IF( itype.EQ.2 ) THEN
639*
640* Identity
641*
642 DO 80 jcol = 1, mnmin
643 a( jcol, jcol ) = anorm
644 80 CONTINUE
645*
646 ELSE IF( itype.EQ.4 ) THEN
647*
648* Diagonal Matrix, [Eigen]values Specified
649*
650 CALL clatms( mnmin, mnmin, 'S', iseed, 'N', rwork, imode,
651 $ cond, anorm, 0, 0, 'N', a, lda, work,
652 $ iinfo )
653*
654 ELSE IF( itype.EQ.5 ) THEN
655*
656* Symmetric, eigenvalues specified
657*
658 CALL clatms( mnmin, mnmin, 'S', iseed, 'S', rwork, imode,
659 $ cond, anorm, m, n, 'N', a, lda, work,
660 $ iinfo )
661*
662 ELSE IF( itype.EQ.6 ) THEN
663*
664* Nonsymmetric, singular values specified
665*
666 CALL clatms( m, n, 'S', iseed, 'N', rwork, imode, cond,
667 $ anorm, m, n, 'N', a, lda, work, iinfo )
668*
669 ELSE IF( itype.EQ.7 ) THEN
670*
671* Diagonal, random entries
672*
673 CALL clatmr( mnmin, mnmin, 'S', iseed, 'N', work, 6, one,
674 $ cone, 'T', 'N', work( mnmin+1 ), 1, one,
675 $ work( 2*mnmin+1 ), 1, one, 'N', iwork, 0, 0,
676 $ zero, anorm, 'NO', a, lda, iwork, iinfo )
677*
678 ELSE IF( itype.EQ.8 ) THEN
679*
680* Symmetric, random entries
681*
682 CALL clatmr( mnmin, mnmin, 'S', iseed, 'S', work, 6, one,
683 $ cone, 'T', 'N', work( mnmin+1 ), 1, one,
684 $ work( m+mnmin+1 ), 1, one, 'N', iwork, m, n,
685 $ zero, anorm, 'NO', a, lda, iwork, iinfo )
686*
687 ELSE IF( itype.EQ.9 ) THEN
688*
689* Nonsymmetric, random entries
690*
691 CALL clatmr( m, n, 'S', iseed, 'N', work, 6, one, cone,
692 $ 'T', 'N', work( mnmin+1 ), 1, one,
693 $ work( m+mnmin+1 ), 1, one, 'N', iwork, m, n,
694 $ zero, anorm, 'NO', a, lda, iwork, iinfo )
695*
696 ELSE IF( itype.EQ.10 ) THEN
697*
698* Bidiagonal, random entries
699*
700 temp1 = -two*log( ulp )
701 DO 90 j = 1, mnmin
702 bd( j ) = exp( temp1*slarnd( 2, iseed ) )
703 IF( j.LT.mnmin )
704 $ be( j ) = exp( temp1*slarnd( 2, iseed ) )
705 90 CONTINUE
706*
707 iinfo = 0
708 bidiag = .true.
709 IF( m.GE.n ) THEN
710 uplo = 'U'
711 ELSE
712 uplo = 'L'
713 END IF
714 ELSE
715 iinfo = 1
716 END IF
717*
718 IF( iinfo.EQ.0 ) THEN
719*
720* Generate Right-Hand Side
721*
722 IF( bidiag ) THEN
723 CALL clatmr( mnmin, nrhs, 'S', iseed, 'N', work, 6,
724 $ one, cone, 'T', 'N', work( mnmin+1 ), 1,
725 $ one, work( 2*mnmin+1 ), 1, one, 'N',
726 $ iwork, mnmin, nrhs, zero, one, 'NO', y,
727 $ ldx, iwork, iinfo )
728 ELSE
729 CALL clatmr( m, nrhs, 'S', iseed, 'N', work, 6, one,
730 $ cone, 'T', 'N', work( m+1 ), 1, one,
731 $ work( 2*m+1 ), 1, one, 'N', iwork, m,
732 $ nrhs, zero, one, 'NO', x, ldx, iwork,
733 $ iinfo )
734 END IF
735 END IF
736*
737* Error Exit
738*
739 IF( iinfo.NE.0 ) THEN
740 WRITE( nout, fmt = 9998 )'Generator', iinfo, m, n,
741 $ jtype, ioldsd
742 info = abs( iinfo )
743 RETURN
744 END IF
745*
746 100 CONTINUE
747*
748* Call CGEBRD and CUNGBR to compute B, Q, and P, do tests.
749*
750 IF( .NOT.bidiag ) THEN
751*
752* Compute transformations to reduce A to bidiagonal form:
753* B := Q' * A * P.
754*
755 CALL clacpy( ' ', m, n, a, lda, q, ldq )
756 CALL cgebrd( m, n, q, ldq, bd, be, work, work( mnmin+1 ),
757 $ work( 2*mnmin+1 ), lwork-2*mnmin, iinfo )
758*
759* Check error code from CGEBRD.
760*
761 IF( iinfo.NE.0 ) THEN
762 WRITE( nout, fmt = 9998 )'CGEBRD', iinfo, m, n,
763 $ jtype, ioldsd
764 info = abs( iinfo )
765 RETURN
766 END IF
767*
768 CALL clacpy( ' ', m, n, q, ldq, pt, ldpt )
769 IF( m.GE.n ) THEN
770 uplo = 'U'
771 ELSE
772 uplo = 'L'
773 END IF
774*
775* Generate Q
776*
777 mq = m
778 IF( nrhs.LE.0 )
779 $ mq = mnmin
780 CALL cungbr( 'Q', m, mq, n, q, ldq, work,
781 $ work( 2*mnmin+1 ), lwork-2*mnmin, iinfo )
782*
783* Check error code from CUNGBR.
784*
785 IF( iinfo.NE.0 ) THEN
786 WRITE( nout, fmt = 9998 )'CUNGBR(Q)', iinfo, m, n,
787 $ jtype, ioldsd
788 info = abs( iinfo )
789 RETURN
790 END IF
791*
792* Generate P'
793*
794 CALL cungbr( 'P', mnmin, n, m, pt, ldpt, work( mnmin+1 ),
795 $ work( 2*mnmin+1 ), lwork-2*mnmin, iinfo )
796*
797* Check error code from CUNGBR.
798*
799 IF( iinfo.NE.0 ) THEN
800 WRITE( nout, fmt = 9998 )'CUNGBR(P)', iinfo, m, n,
801 $ jtype, ioldsd
802 info = abs( iinfo )
803 RETURN
804 END IF
805*
806* Apply Q' to an M by NRHS matrix X: Y := Q' * X.
807*
808 CALL cgemm( 'Conjugate transpose', 'No transpose', m,
809 $ nrhs, m, cone, q, ldq, x, ldx, czero, y,
810 $ ldx )
811*
812* Test 1: Check the decomposition A := Q * B * PT
813* 2: Check the orthogonality of Q
814* 3: Check the orthogonality of PT
815*
816 CALL cbdt01( m, n, 1, a, lda, q, ldq, bd, be, pt, ldpt,
817 $ work, rwork, result( 1 ) )
818 CALL cunt01( 'Columns', m, mq, q, ldq, work, lwork,
819 $ rwork, result( 2 ) )
820 CALL cunt01( 'Rows', mnmin, n, pt, ldpt, work, lwork,
821 $ rwork, result( 3 ) )
822 END IF
823*
824* Use CBDSQR to form the SVD of the bidiagonal matrix B:
825* B := U * S1 * VT, and compute Z = U' * Y.
826*
827 CALL scopy( mnmin, bd, 1, s1, 1 )
828 IF( mnmin.GT.0 )
829 $ CALL scopy( mnmin-1, be, 1, rwork, 1 )
830 CALL clacpy( ' ', m, nrhs, y, ldx, z, ldx )
831 CALL claset( 'Full', mnmin, mnmin, czero, cone, u, ldpt )
832 CALL claset( 'Full', mnmin, mnmin, czero, cone, vt, ldpt )
833*
834 CALL cbdsqr( uplo, mnmin, mnmin, mnmin, nrhs, s1, rwork, vt,
835 $ ldpt, u, ldpt, z, ldx, rwork( mnmin+1 ),
836 $ iinfo )
837*
838* Check error code from CBDSQR.
839*
840 IF( iinfo.NE.0 ) THEN
841 WRITE( nout, fmt = 9998 )'CBDSQR(vects)', iinfo, m, n,
842 $ jtype, ioldsd
843 info = abs( iinfo )
844 IF( iinfo.LT.0 ) THEN
845 RETURN
846 ELSE
847 result( 4 ) = ulpinv
848 GO TO 150
849 END IF
850 END IF
851*
852* Use CBDSQR to compute only the singular values of the
853* bidiagonal matrix B; U, VT, and Z should not be modified.
854*
855 CALL scopy( mnmin, bd, 1, s2, 1 )
856 IF( mnmin.GT.0 )
857 $ CALL scopy( mnmin-1, be, 1, rwork, 1 )
858*
859 CALL cbdsqr( uplo, mnmin, 0, 0, 0, s2, rwork, vt, ldpt, u,
860 $ ldpt, z, ldx, rwork( mnmin+1 ), iinfo )
861*
862* Check error code from CBDSQR.
863*
864 IF( iinfo.NE.0 ) THEN
865 WRITE( nout, fmt = 9998 )'CBDSQR(values)', iinfo, m, n,
866 $ jtype, ioldsd
867 info = abs( iinfo )
868 IF( iinfo.LT.0 ) THEN
869 RETURN
870 ELSE
871 result( 9 ) = ulpinv
872 GO TO 150
873 END IF
874 END IF
875*
876* Test 4: Check the decomposition B := U * S1 * VT
877* 5: Check the computation Z := U' * Y
878* 6: Check the orthogonality of U
879* 7: Check the orthogonality of VT
880*
881 CALL cbdt03( uplo, mnmin, 1, bd, be, u, ldpt, s1, vt, ldpt,
882 $ work, result( 4 ) )
883 CALL cbdt02( mnmin, nrhs, y, ldx, z, ldx, u, ldpt, work,
884 $ rwork, result( 5 ) )
885 CALL cunt01( 'Columns', mnmin, mnmin, u, ldpt, work, lwork,
886 $ rwork, result( 6 ) )
887 CALL cunt01( 'Rows', mnmin, mnmin, vt, ldpt, work, lwork,
888 $ rwork, result( 7 ) )
889*
890* Test 8: Check that the singular values are sorted in
891* non-increasing order and are non-negative
892*
893 result( 8 ) = zero
894 DO 110 i = 1, mnmin - 1
895 IF( s1( i ).LT.s1( i+1 ) )
896 $ result( 8 ) = ulpinv
897 IF( s1( i ).LT.zero )
898 $ result( 8 ) = ulpinv
899 110 CONTINUE
900 IF( mnmin.GE.1 ) THEN
901 IF( s1( mnmin ).LT.zero )
902 $ result( 8 ) = ulpinv
903 END IF
904*
905* Test 9: Compare CBDSQR with and without singular vectors
906*
907 temp2 = zero
908*
909 DO 120 j = 1, mnmin
910 temp1 = abs( s1( j )-s2( j ) ) /
911 $ max( sqrt( unfl )*max( s1( 1 ), one ),
912 $ ulp*max( abs( s1( j ) ), abs( s2( j ) ) ) )
913 temp2 = max( temp1, temp2 )
914 120 CONTINUE
915*
916 result( 9 ) = temp2
917*
918* Test 10: Sturm sequence test of singular values
919* Go up by factors of two until it succeeds
920*
921 temp1 = thresh*( half-ulp )
922*
923 DO 130 j = 0, log2ui
924 CALL ssvdch( mnmin, bd, be, s1, temp1, iinfo )
925 IF( iinfo.EQ.0 )
926 $ GO TO 140
927 temp1 = temp1*two
928 130 CONTINUE
929*
930 140 CONTINUE
931 result( 10 ) = temp1
932*
933* Use CBDSQR to form the decomposition A := (QU) S (VT PT)
934* from the bidiagonal form A := Q B PT.
935*
936 IF( .NOT.bidiag ) THEN
937 CALL scopy( mnmin, bd, 1, s2, 1 )
938 IF( mnmin.GT.0 )
939 $ CALL scopy( mnmin-1, be, 1, rwork, 1 )
940*
941 CALL cbdsqr( uplo, mnmin, n, m, nrhs, s2, rwork, pt,
942 $ ldpt, q, ldq, y, ldx, rwork( mnmin+1 ),
943 $ iinfo )
944*
945* Test 11: Check the decomposition A := Q*U * S2 * VT*PT
946* 12: Check the computation Z := U' * Q' * X
947* 13: Check the orthogonality of Q*U
948* 14: Check the orthogonality of VT*PT
949*
950 CALL cbdt01( m, n, 0, a, lda, q, ldq, s2, dumma, pt,
951 $ ldpt, work, rwork, result( 11 ) )
952 CALL cbdt02( m, nrhs, x, ldx, y, ldx, q, ldq, work,
953 $ rwork, result( 12 ) )
954 CALL cunt01( 'Columns', m, mq, q, ldq, work, lwork,
955 $ rwork, result( 13 ) )
956 CALL cunt01( 'Rows', mnmin, n, pt, ldpt, work, lwork,
957 $ rwork, result( 14 ) )
958 END IF
959*
960* End of Loop -- Check for RESULT(j) > THRESH
961*
962 150 CONTINUE
963 DO 160 j = 1, 14
964 IF( result( j ).GE.thresh ) THEN
965 IF( nfail.EQ.0 )
966 $ CALL slahd2( nout, path )
967 WRITE( nout, fmt = 9999 )m, n, jtype, ioldsd, j,
968 $ result( j )
969 nfail = nfail + 1
970 END IF
971 160 CONTINUE
972 IF( .NOT.bidiag ) THEN
973 ntest = ntest + 14
974 ELSE
975 ntest = ntest + 5
976 END IF
977*
978 170 CONTINUE
979 180 CONTINUE
980*
981* Summary
982*
983 CALL alasum( path, nout, nfail, ntest, 0 )
984*
985 RETURN
986*
987* End of CCHKBD
988*
989 9999 FORMAT( ' M=', i5, ', N=', i5, ', type ', i2, ', seed=',
990 $ 4( i4, ',' ), ' test(', i2, ')=', g11.4 )
991 9998 FORMAT( ' CCHKBD: ', a, ' returned INFO=', i6, '.', / 9x, 'M=',
992 $ i6, ', N=', i6, ', JTYPE=', i6, ', ISEED=(', 3( i5, ',' ),
993 $ i5, ')' )
994*
subroutine slabad(SMALL, LARGE)
SLABAD
Definition: slabad.f:74
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
subroutine alasum(TYPE, NOUT, NFAIL, NRUN, NERRS)
ALASUM
Definition: alasum.f:73
subroutine cgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CGEMM
Definition: cgemm.f:187
subroutine cbdt02(M, N, B, LDB, C, LDC, U, LDU, WORK, RWORK, RESID)
CBDT02
Definition: cbdt02.f:120
subroutine cbdt01(M, N, KD, A, LDA, Q, LDQ, D, E, PT, LDPT, WORK, RWORK, RESID)
CBDT01
Definition: cbdt01.f:147
subroutine cunt01(ROWCOL, M, N, U, LDU, WORK, LWORK, RWORK, RESID)
CUNT01
Definition: cunt01.f:126
subroutine cbdt03(UPLO, N, KD, D, E, U, LDU, S, VT, LDVT, WORK, RESID)
CBDT03
Definition: cbdt03.f:135
subroutine clatms(M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX, KL, KU, PACK, A, LDA, WORK, INFO)
CLATMS
Definition: clatms.f:332
subroutine clatmr(M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX, RSIGN, GRADE, DL, MODEL, CONDL, DR, MODER, CONDR, PIVTNG, IPIVOT, KL, KU, SPARSE, ANORM, PACK, A, LDA, IWORK, INFO)
CLATMR
Definition: clatmr.f:490
subroutine cungbr(VECT, M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
CUNGBR
Definition: cungbr.f:157
subroutine cgebrd(M, N, A, LDA, D, E, TAUQ, TAUP, WORK, LWORK, INFO)
CGEBRD
Definition: cgebrd.f:206
subroutine claset(UPLO, M, N, ALPHA, BETA, A, LDA)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition: claset.f:106
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:103
subroutine cbdsqr(UPLO, N, NCVT, NRU, NCC, D, E, VT, LDVT, U, LDU, C, LDC, RWORK, INFO)
CBDSQR
Definition: cbdsqr.f:222
real function slarnd(IDIST, ISEED)
SLARND
Definition: slarnd.f:73
subroutine scopy(N, SX, INCX, SY, INCY)
SCOPY
Definition: scopy.f:82
subroutine ssvdch(N, S, E, SVD, TOL, INFO)
SSVDCH
Definition: ssvdch.f:97
subroutine slahd2(IOUNIT, PATH)
SLAHD2
Definition: slahd2.f:65
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the call graph for this function:
Here is the caller graph for this function: