LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
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.
Date
June 2016

Definition at line 417 of file cchkbd.f.

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

Here is the call graph for this function:

Here is the caller graph for this function: