zchkbd.c
Go to the documentation of this file.
00001 /* zchkbd.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Common Block Declarations */
00017 
00018 struct {
00019     integer infot, nunit;
00020     logical ok, lerr;
00021 } infoc_;
00022 
00023 #define infoc_1 infoc_
00024 
00025 struct {
00026     char srnamt[32];
00027 } srnamc_;
00028 
00029 #define srnamc_1 srnamc_
00030 
00031 /* Table of constant values */
00032 
00033 static doublecomplex c_b1 = {0.,0.};
00034 static doublecomplex c_b2 = {1.,0.};
00035 static integer c__0 = 0;
00036 static integer c__6 = 6;
00037 static doublereal c_b37 = 1.;
00038 static integer c__1 = 1;
00039 static doublereal c_b47 = 0.;
00040 static integer c__2 = 2;
00041 static integer c__4 = 4;
00042 
00043 /* Subroutine */ int zchkbd_(integer *nsizes, integer *mval, integer *nval, 
00044         integer *ntypes, logical *dotype, integer *nrhs, integer *iseed, 
00045         doublereal *thresh, doublecomplex *a, integer *lda, doublereal *bd, 
00046         doublereal *be, doublereal *s1, doublereal *s2, doublecomplex *x, 
00047         integer *ldx, doublecomplex *y, doublecomplex *z__, doublecomplex *q, 
00048         integer *ldq, doublecomplex *pt, integer *ldpt, doublecomplex *u, 
00049         doublecomplex *vt, doublecomplex *work, integer *lwork, doublereal *
00050         rwork, integer *nout, integer *info)
00051 {
00052     /* Initialized data */
00053 
00054     static integer ktype[16] = { 1,2,4,4,4,4,4,6,6,6,6,6,9,9,9,10 };
00055     static integer kmagn[16] = { 1,1,1,1,1,2,3,1,1,1,2,3,1,2,3,0 };
00056     static integer kmode[16] = { 0,0,4,3,1,4,4,4,3,1,4,4,0,0,0,0 };
00057 
00058     /* Format strings */
00059     static char fmt_9998[] = "(\002 ZCHKBD: \002,a,\002 returned INFO=\002,i"
00060             "6,\002.\002,/9x,\002M=\002,i6,\002, N=\002,i6,\002, JTYPE=\002,i"
00061             "6,\002, ISEED=(\002,3(i5,\002,\002),i5,\002)\002)";
00062     static char fmt_9999[] = "(\002 M=\002,i5,\002, N=\002,i5,\002, type "
00063             "\002,i2,\002, seed=\002,4(i4,\002,\002),\002 test(\002,i2,\002)"
00064             "=\002,g11.4)";
00065 
00066     /* System generated locals */
00067     integer a_dim1, a_offset, pt_dim1, pt_offset, q_dim1, q_offset, u_dim1, 
00068             u_offset, vt_dim1, vt_offset, x_dim1, x_offset, y_dim1, y_offset, 
00069             z_dim1, z_offset, i__1, i__2, i__3, i__4, i__5, i__6, i__7;
00070     doublereal d__1, d__2, d__3, d__4, d__5, d__6, d__7;
00071 
00072     /* Builtin functions */
00073     /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
00074     double log(doublereal), sqrt(doublereal), exp(doublereal);
00075     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00076 
00077     /* Local variables */
00078     integer i__, j, m, n, mq;
00079     doublereal ulp, cond;
00080     integer jcol;
00081     char path[3];
00082     integer mmax, nmax;
00083     doublereal unfl, ovfl;
00084     char uplo[1];
00085     doublereal temp1, temp2;
00086     logical badmm, badnn;
00087     integer nfail, imode;
00088     doublereal dumma[1];
00089     integer iinfo;
00090     extern /* Subroutine */ int zbdt01_(integer *, integer *, integer *, 
00091             doublecomplex *, integer *, doublecomplex *, integer *, 
00092             doublereal *, doublereal *, doublecomplex *, integer *, 
00093             doublecomplex *, doublereal *, doublereal *), zbdt02_(integer *, 
00094             integer *, doublecomplex *, integer *, doublecomplex *, integer *, 
00095              doublecomplex *, integer *, doublecomplex *, doublereal *, 
00096             doublereal *), zbdt03_(char *, integer *, integer *, doublereal *, 
00097              doublereal *, doublecomplex *, integer *, doublereal *, 
00098             doublecomplex *, integer *, doublecomplex *, doublereal *)
00099             ;
00100     doublereal anorm;
00101     integer mnmin;
00102     extern /* Subroutine */ int dcopy_(integer *, doublereal *, integer *, 
00103             doublereal *, integer *);
00104     integer mnmax;
00105     extern /* Subroutine */ int zgemm_(char *, char *, integer *, integer *, 
00106             integer *, doublecomplex *, doublecomplex *, integer *, 
00107             doublecomplex *, integer *, doublecomplex *, doublecomplex *, 
00108             integer *);
00109     integer jsize, itype, jtype, iwork[1], ntest;
00110     extern /* Subroutine */ int dlahd2_(integer *, char *), zunt01_(
00111             char *, integer *, integer *, doublecomplex *, integer *, 
00112             doublecomplex *, integer *, doublereal *, doublereal *);
00113     integer log2ui;
00114     extern /* Subroutine */ int dlabad_(doublereal *, doublereal *);
00115     logical bidiag;
00116     extern doublereal dlamch_(char *), dlarnd_(integer *, integer *);
00117     extern /* Subroutine */ int dsvdch_(integer *, doublereal *, doublereal *, 
00118              doublereal *, doublereal *, integer *), xerbla_(char *, integer *
00119 );
00120     integer ioldsd[4];
00121     extern /* Subroutine */ int zgebrd_(integer *, integer *, doublecomplex *, 
00122              integer *, doublereal *, doublereal *, doublecomplex *, 
00123             doublecomplex *, doublecomplex *, integer *, integer *), alasum_(
00124             char *, integer *, integer *, integer *, integer *);
00125     doublereal amninv;
00126     extern /* Subroutine */ int zlacpy_(char *, integer *, integer *, 
00127             doublecomplex *, integer *, doublecomplex *, integer *), 
00128             zlaset_(char *, integer *, integer *, doublecomplex *, 
00129             doublecomplex *, doublecomplex *, integer *), zbdsqr_(
00130             char *, integer *, integer *, integer *, integer *, doublereal *, 
00131             doublereal *, doublecomplex *, integer *, doublecomplex *, 
00132             integer *, doublecomplex *, integer *, doublereal *, integer *);
00133     integer minwrk;
00134     extern /* Subroutine */ int zungbr_(char *, integer *, integer *, integer 
00135             *, doublecomplex *, integer *, doublecomplex *, doublecomplex *, 
00136             integer *, integer *), zlatmr_(integer *, integer *, char 
00137             *, integer *, char *, doublecomplex *, integer *, doublereal *, 
00138             doublecomplex *, char *, char *, doublecomplex *, integer *, 
00139             doublereal *, doublecomplex *, integer *, doublereal *, char *, 
00140             integer *, integer *, integer *, doublereal *, doublereal *, char 
00141             *, doublecomplex *, integer *, integer *, integer *);
00142     doublereal rtunfl, rtovfl, ulpinv, result[14];
00143     extern /* Subroutine */ int zlatms_(integer *, integer *, char *, integer 
00144             *, char *, doublereal *, integer *, doublereal *, doublereal *, 
00145             integer *, integer *, char *, doublecomplex *, integer *, 
00146             doublecomplex *, integer *);
00147     integer mtypes;
00148 
00149     /* Fortran I/O blocks */
00150     static cilist io___40 = { 0, 0, 0, fmt_9998, 0 };
00151     static cilist io___41 = { 0, 0, 0, fmt_9998, 0 };
00152     static cilist io___43 = { 0, 0, 0, fmt_9998, 0 };
00153     static cilist io___44 = { 0, 0, 0, fmt_9998, 0 };
00154     static cilist io___45 = { 0, 0, 0, fmt_9998, 0 };
00155     static cilist io___46 = { 0, 0, 0, fmt_9998, 0 };
00156     static cilist io___50 = { 0, 0, 0, fmt_9999, 0 };
00157 
00158 
00159 
00160 /*  -- LAPACK test routine (version 3.1) -- */
00161 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00162 /*     November 2006 */
00163 
00164 /*     .. Scalar Arguments .. */
00165 /*     .. */
00166 /*     .. Array Arguments .. */
00167 /*     .. */
00168 
00169 /*  Purpose */
00170 /*  ======= */
00171 
00172 /*  ZCHKBD checks the singular value decomposition (SVD) routines. */
00173 
00174 /*  ZGEBRD reduces a complex general m by n matrix A to real upper or */
00175 /*  lower bidiagonal form by an orthogonal transformation: Q' * A * P = B */
00176 /*  (or A = Q * B * P').  The matrix B is upper bidiagonal if m >= n */
00177 /*  and lower bidiagonal if m < n. */
00178 
00179 /*  ZUNGBR generates the orthogonal matrices Q and P' from ZGEBRD. */
00180 /*  Note that Q and P are not necessarily square. */
00181 
00182 /*  ZBDSQR computes the singular value decomposition of the bidiagonal */
00183 /*  matrix B as B = U S V'.  It is called three times to compute */
00184 /*     1)  B = U S1 V', where S1 is the diagonal matrix of singular */
00185 /*         values and the columns of the matrices U and V are the left */
00186 /*         and right singular vectors, respectively, of B. */
00187 /*     2)  Same as 1), but the singular values are stored in S2 and the */
00188 /*         singular vectors are not computed. */
00189 /*     3)  A = (UQ) S (P'V'), the SVD of the original matrix A. */
00190 /*  In addition, ZBDSQR has an option to apply the left orthogonal matrix */
00191 /*  U to a matrix X, useful in least squares applications. */
00192 
00193 /*  For each pair of matrix dimensions (M,N) and each selected matrix */
00194 /*  type, an M by N matrix A and an M by NRHS matrix X are generated. */
00195 /*  The problem dimensions are as follows */
00196 /*     A:          M x N */
00197 /*     Q:          M x min(M,N) (but M x M if NRHS > 0) */
00198 /*     P:          min(M,N) x N */
00199 /*     B:          min(M,N) x min(M,N) */
00200 /*     U, V:       min(M,N) x min(M,N) */
00201 /*     S1, S2      diagonal, order min(M,N) */
00202 /*     X:          M x NRHS */
00203 
00204 /*  For each generated matrix, 14 tests are performed: */
00205 
00206 /*  Test ZGEBRD and ZUNGBR */
00207 
00208 /*  (1)   | A - Q B PT | / ( |A| max(M,N) ulp ), PT = P' */
00209 
00210 /*  (2)   | I - Q' Q | / ( M ulp ) */
00211 
00212 /*  (3)   | I - PT PT' | / ( N ulp ) */
00213 
00214 /*  Test ZBDSQR on bidiagonal matrix B */
00215 
00216 /*  (4)   | B - U S1 VT | / ( |B| min(M,N) ulp ), VT = V' */
00217 
00218 /*  (5)   | Y - U Z | / ( |Y| max(min(M,N),k) ulp ), where Y = Q' X */
00219 /*                                                   and   Z = U' Y. */
00220 /*  (6)   | I - U' U | / ( min(M,N) ulp ) */
00221 
00222 /*  (7)   | I - VT VT' | / ( min(M,N) ulp ) */
00223 
00224 /*  (8)   S1 contains min(M,N) nonnegative values in decreasing order. */
00225 /*        (Return 0 if true, 1/ULP if false.) */
00226 
00227 /*  (9)   0 if the true singular values of B are within THRESH of */
00228 /*        those in S1.  2*THRESH if they are not.  (Tested using */
00229 /*        DSVDCH) */
00230 
00231 /*  (10)  | S1 - S2 | / ( |S1| ulp ), where S2 is computed without */
00232 /*                                    computing U and V. */
00233 
00234 /*  Test ZBDSQR on matrix A */
00235 
00236 /*  (11)  | A - (QU) S (VT PT) | / ( |A| max(M,N) ulp ) */
00237 
00238 /*  (12)  | X - (QU) Z | / ( |X| max(M,k) ulp ) */
00239 
00240 /*  (13)  | I - (QU)'(QU) | / ( M ulp ) */
00241 
00242 /*  (14)  | I - (VT PT) (PT'VT') | / ( N ulp ) */
00243 
00244 /*  The possible matrix types are */
00245 
00246 /*  (1)  The zero matrix. */
00247 /*  (2)  The identity matrix. */
00248 
00249 /*  (3)  A diagonal matrix with evenly spaced entries */
00250 /*       1, ..., ULP  and random signs. */
00251 /*       (ULP = (first number larger than 1) - 1 ) */
00252 /*  (4)  A diagonal matrix with geometrically spaced entries */
00253 /*       1, ..., ULP  and random signs. */
00254 /*  (5)  A diagonal matrix with "clustered" entries 1, ULP, ..., ULP */
00255 /*       and random signs. */
00256 
00257 /*  (6)  Same as (3), but multiplied by SQRT( overflow threshold ) */
00258 /*  (7)  Same as (3), but multiplied by SQRT( underflow threshold ) */
00259 
00260 /*  (8)  A matrix of the form  U D V, where U and V are orthogonal and */
00261 /*       D has evenly spaced entries 1, ..., ULP with random signs */
00262 /*       on the diagonal. */
00263 
00264 /*  (9)  A matrix of the form  U D V, where U and V are orthogonal and */
00265 /*       D has geometrically spaced entries 1, ..., ULP with random */
00266 /*       signs on the diagonal. */
00267 
00268 /*  (10) A matrix of the form  U D V, where U and V are orthogonal and */
00269 /*       D has "clustered" entries 1, ULP,..., ULP with random */
00270 /*       signs on the diagonal. */
00271 
00272 /*  (11) Same as (8), but multiplied by SQRT( overflow threshold ) */
00273 /*  (12) Same as (8), but multiplied by SQRT( underflow threshold ) */
00274 
00275 /*  (13) Rectangular matrix with random entries chosen from (-1,1). */
00276 /*  (14) Same as (13), but multiplied by SQRT( overflow threshold ) */
00277 /*  (15) Same as (13), but multiplied by SQRT( underflow threshold ) */
00278 
00279 /*  Special case: */
00280 /*  (16) A bidiagonal matrix with random entries chosen from a */
00281 /*       logarithmic distribution on [ulp^2,ulp^(-2)]  (I.e., each */
00282 /*       entry is  e^x, where x is chosen uniformly on */
00283 /*       [ 2 log(ulp), -2 log(ulp) ] .)  For *this* type: */
00284 /*       (a) ZGEBRD is not called to reduce it to bidiagonal form. */
00285 /*       (b) the bidiagonal is  min(M,N) x min(M,N); if M<N, the */
00286 /*           matrix will be lower bidiagonal, otherwise upper. */
00287 /*       (c) only tests 5--8 and 14 are performed. */
00288 
00289 /*  A subset of the full set of matrix types may be selected through */
00290 /*  the logical array DOTYPE. */
00291 
00292 /*  Arguments */
00293 /*  ========== */
00294 
00295 /*  NSIZES  (input) INTEGER */
00296 /*          The number of values of M and N contained in the vectors */
00297 /*          MVAL and NVAL.  The matrix sizes are used in pairs (M,N). */
00298 
00299 /*  MVAL    (input) INTEGER array, dimension (NM) */
00300 /*          The values of the matrix row dimension M. */
00301 
00302 /*  NVAL    (input) INTEGER array, dimension (NM) */
00303 /*          The values of the matrix column dimension N. */
00304 
00305 /*  NTYPES  (input) INTEGER */
00306 /*          The number of elements in DOTYPE.   If it is zero, ZCHKBD */
00307 /*          does nothing.  It must be at least zero.  If it is MAXTYP+1 */
00308 /*          and NSIZES is 1, then an additional type, MAXTYP+1 is */
00309 /*          defined, which is to use whatever matrices are in A and B. */
00310 /*          This is only useful if DOTYPE(1:MAXTYP) is .FALSE. and */
00311 /*          DOTYPE(MAXTYP+1) is .TRUE. . */
00312 
00313 /*  DOTYPE  (input) LOGICAL array, dimension (NTYPES) */
00314 /*          If DOTYPE(j) is .TRUE., then for each size (m,n), a matrix */
00315 /*          of type j will be generated.  If NTYPES is smaller than the */
00316 /*          maximum number of types defined (PARAMETER MAXTYP), then */
00317 /*          types NTYPES+1 through MAXTYP will not be generated.  If */
00318 /*          NTYPES is larger than MAXTYP, DOTYPE(MAXTYP+1) through */
00319 /*          DOTYPE(NTYPES) will be ignored. */
00320 
00321 /*  NRHS    (input) INTEGER */
00322 /*          The number of columns in the "right-hand side" matrices X, Y, */
00323 /*          and Z, used in testing ZBDSQR.  If NRHS = 0, then the */
00324 /*          operations on the right-hand side will not be tested. */
00325 /*          NRHS must be at least 0. */
00326 
00327 /*  ISEED   (input/output) INTEGER array, dimension (4) */
00328 /*          On entry ISEED specifies the seed of the random number */
00329 /*          generator. The array elements should be between 0 and 4095; */
00330 /*          if not they will be reduced mod 4096.  Also, ISEED(4) must */
00331 /*          be odd.  The values of ISEED are changed on exit, and can be */
00332 /*          used in the next call to ZCHKBD to continue the same random */
00333 /*          number sequence. */
00334 
00335 /*  THRESH  (input) DOUBLE PRECISION */
00336 /*          The threshold value for the test ratios.  A result is */
00337 /*          included in the output file if RESULT >= THRESH.  To have */
00338 /*          every test ratio printed, use THRESH = 0.  Note that the */
00339 /*          expected value of the test ratios is O(1), so THRESH should */
00340 /*          be a reasonably small multiple of 1, e.g., 10 or 100. */
00341 
00342 /*  A       (workspace) COMPLEX*16 array, dimension (LDA,NMAX) */
00343 /*          where NMAX is the maximum value of N in NVAL. */
00344 
00345 /*  LDA     (input) INTEGER */
00346 /*          The leading dimension of the array A.  LDA >= max(1,MMAX), */
00347 /*          where MMAX is the maximum value of M in MVAL. */
00348 
00349 /*  BD      (workspace) DOUBLE PRECISION array, dimension */
00350 /*                      (max(min(MVAL(j),NVAL(j)))) */
00351 
00352 /*  BE      (workspace) DOUBLE PRECISION array, dimension */
00353 /*                      (max(min(MVAL(j),NVAL(j)))) */
00354 
00355 /*  S1      (workspace) DOUBLE PRECISION array, dimension */
00356 /*                      (max(min(MVAL(j),NVAL(j)))) */
00357 
00358 /*  S2      (workspace) DOUBLE PRECISION array, dimension */
00359 /*                      (max(min(MVAL(j),NVAL(j)))) */
00360 
00361 /*  X       (workspace) COMPLEX*16 array, dimension (LDX,NRHS) */
00362 
00363 /*  LDX     (input) INTEGER */
00364 /*          The leading dimension of the arrays X, Y, and Z. */
00365 /*          LDX >= max(1,MMAX). */
00366 
00367 /*  Y       (workspace) COMPLEX*16 array, dimension (LDX,NRHS) */
00368 
00369 /*  Z       (workspace) COMPLEX*16 array, dimension (LDX,NRHS) */
00370 
00371 /*  Q       (workspace) COMPLEX*16 array, dimension (LDQ,MMAX) */
00372 
00373 /*  LDQ     (input) INTEGER */
00374 /*          The leading dimension of the array Q.  LDQ >= max(1,MMAX). */
00375 
00376 /*  PT      (workspace) COMPLEX*16 array, dimension (LDPT,NMAX) */
00377 
00378 /*  LDPT    (input) INTEGER */
00379 /*          The leading dimension of the arrays PT, U, and V. */
00380 /*          LDPT >= max(1, max(min(MVAL(j),NVAL(j)))). */
00381 
00382 /*  U       (workspace) COMPLEX*16 array, dimension */
00383 /*                      (LDPT,max(min(MVAL(j),NVAL(j)))) */
00384 
00385 /*  V       (workspace) COMPLEX*16 array, dimension */
00386 /*                      (LDPT,max(min(MVAL(j),NVAL(j)))) */
00387 
00388 /*  WORK    (workspace) COMPLEX*16 array, dimension (LWORK) */
00389 
00390 /*  LWORK   (input) INTEGER */
00391 /*          The number of entries in WORK.  This must be at least */
00392 /*          3(M+N) and  M(M + max(M,N,k) + 1) + N*min(M,N)  for all */
00393 /*          pairs  (M,N)=(MM(j),NN(j)) */
00394 
00395 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension */
00396 /*                      (5*max(min(M,N))) */
00397 
00398 /*  NOUT    (input) INTEGER */
00399 /*          The FORTRAN unit number for printing out error messages */
00400 /*          (e.g., if a routine returns IINFO not equal to 0.) */
00401 
00402 /*  INFO    (output) INTEGER */
00403 /*          If 0, then everything ran OK. */
00404 /*           -1: NSIZES < 0 */
00405 /*           -2: Some MM(j) < 0 */
00406 /*           -3: Some NN(j) < 0 */
00407 /*           -4: NTYPES < 0 */
00408 /*           -6: NRHS  < 0 */
00409 /*           -8: THRESH < 0 */
00410 /*          -11: LDA < 1 or LDA < MMAX, where MMAX is max( MM(j) ). */
00411 /*          -17: LDB < 1 or LDB < MMAX. */
00412 /*          -21: LDQ < 1 or LDQ < MMAX. */
00413 /*          -23: LDP < 1 or LDP < MNMAX. */
00414 /*          -27: LWORK too small. */
00415 /*          If  ZLATMR, CLATMS, ZGEBRD, ZUNGBR, or ZBDSQR, */
00416 /*              returns an error code, the */
00417 /*              absolute value of it is returned. */
00418 
00419 /* ----------------------------------------------------------------------- */
00420 
00421 /*     Some Local Variables and Parameters: */
00422 /*     ---- ----- --------- --- ---------- */
00423 
00424 /*     ZERO, ONE       Real 0 and 1. */
00425 /*     MAXTYP          The number of types defined. */
00426 /*     NTEST           The number of tests performed, or which can */
00427 /*                     be performed so far, for the current matrix. */
00428 /*     MMAX            Largest value in NN. */
00429 /*     NMAX            Largest value in NN. */
00430 /*     MNMIN           min(MM(j), NN(j)) (the dimension of the bidiagonal */
00431 /*                     matrix.) */
00432 /*     MNMAX           The maximum value of MNMIN for j=1,...,NSIZES. */
00433 /*     NFAIL           The number of tests which have exceeded THRESH */
00434 /*     COND, IMODE     Values to be passed to the matrix generators. */
00435 /*     ANORM           Norm of A; passed to matrix generators. */
00436 
00437 /*     OVFL, UNFL      Overflow and underflow thresholds. */
00438 /*     RTOVFL, RTUNFL  Square roots of the previous 2 values. */
00439 /*     ULP, ULPINV     Finest relative precision and its inverse. */
00440 
00441 /*             The following four arrays decode JTYPE: */
00442 /*     KTYPE(j)        The general type (1-10) for type "j". */
00443 /*     KMODE(j)        The MODE value to be passed to the matrix */
00444 /*                     generator for type "j". */
00445 /*     KMAGN(j)        The order of magnitude ( O(1), */
00446 /*                     O(overflow^(1/2) ), O(underflow^(1/2) ) */
00447 
00448 /* ====================================================================== */
00449 
00450 /*     .. Parameters .. */
00451 /*     .. */
00452 /*     .. Local Scalars .. */
00453 /*     .. */
00454 /*     .. Local Arrays .. */
00455 /*     .. */
00456 /*     .. External Functions .. */
00457 /*     .. */
00458 /*     .. External Subroutines .. */
00459 /*     .. */
00460 /*     .. Intrinsic Functions .. */
00461 /*     .. */
00462 /*     .. Scalars in Common .. */
00463 /*     .. */
00464 /*     .. Common blocks .. */
00465 /*     .. */
00466 /*     .. Data statements .. */
00467     /* Parameter adjustments */
00468     --mval;
00469     --nval;
00470     --dotype;
00471     --iseed;
00472     a_dim1 = *lda;
00473     a_offset = 1 + a_dim1;
00474     a -= a_offset;
00475     --bd;
00476     --be;
00477     --s1;
00478     --s2;
00479     z_dim1 = *ldx;
00480     z_offset = 1 + z_dim1;
00481     z__ -= z_offset;
00482     y_dim1 = *ldx;
00483     y_offset = 1 + y_dim1;
00484     y -= y_offset;
00485     x_dim1 = *ldx;
00486     x_offset = 1 + x_dim1;
00487     x -= x_offset;
00488     q_dim1 = *ldq;
00489     q_offset = 1 + q_dim1;
00490     q -= q_offset;
00491     vt_dim1 = *ldpt;
00492     vt_offset = 1 + vt_dim1;
00493     vt -= vt_offset;
00494     u_dim1 = *ldpt;
00495     u_offset = 1 + u_dim1;
00496     u -= u_offset;
00497     pt_dim1 = *ldpt;
00498     pt_offset = 1 + pt_dim1;
00499     pt -= pt_offset;
00500     --work;
00501     --rwork;
00502 
00503     /* Function Body */
00504 /*     .. */
00505 /*     .. Executable Statements .. */
00506 
00507 /*     Check for errors */
00508 
00509     *info = 0;
00510 
00511     badmm = FALSE_;
00512     badnn = FALSE_;
00513     mmax = 1;
00514     nmax = 1;
00515     mnmax = 1;
00516     minwrk = 1;
00517     i__1 = *nsizes;
00518     for (j = 1; j <= i__1; ++j) {
00519 /* Computing MAX */
00520         i__2 = mmax, i__3 = mval[j];
00521         mmax = max(i__2,i__3);
00522         if (mval[j] < 0) {
00523             badmm = TRUE_;
00524         }
00525 /* Computing MAX */
00526         i__2 = nmax, i__3 = nval[j];
00527         nmax = max(i__2,i__3);
00528         if (nval[j] < 0) {
00529             badnn = TRUE_;
00530         }
00531 /* Computing MAX */
00532 /* Computing MIN */
00533         i__4 = mval[j], i__5 = nval[j];
00534         i__2 = mnmax, i__3 = min(i__4,i__5);
00535         mnmax = max(i__2,i__3);
00536 /* Computing MAX */
00537 /* Computing MAX */
00538         i__4 = mval[j], i__5 = nval[j], i__4 = max(i__4,i__5);
00539 /* Computing MIN */
00540         i__6 = nval[j], i__7 = mval[j];
00541         i__2 = minwrk, i__3 = (mval[j] + nval[j]) * 3, i__2 = max(i__2,i__3), 
00542                 i__3 = mval[j] * (mval[j] + max(i__4,*nrhs) + 1) + nval[j] * 
00543                 min(i__6,i__7);
00544         minwrk = max(i__2,i__3);
00545 /* L10: */
00546     }
00547 
00548 /*     Check for errors */
00549 
00550     if (*nsizes < 0) {
00551         *info = -1;
00552     } else if (badmm) {
00553         *info = -2;
00554     } else if (badnn) {
00555         *info = -3;
00556     } else if (*ntypes < 0) {
00557         *info = -4;
00558     } else if (*nrhs < 0) {
00559         *info = -6;
00560     } else if (*lda < mmax) {
00561         *info = -11;
00562     } else if (*ldx < mmax) {
00563         *info = -17;
00564     } else if (*ldq < mmax) {
00565         *info = -21;
00566     } else if (*ldpt < mnmax) {
00567         *info = -23;
00568     } else if (minwrk > *lwork) {
00569         *info = -27;
00570     }
00571 
00572     if (*info != 0) {
00573         i__1 = -(*info);
00574         xerbla_("ZCHKBD", &i__1);
00575         return 0;
00576     }
00577 
00578 /*     Initialize constants */
00579 
00580     s_copy(path, "Zomplex precision", (ftnlen)1, (ftnlen)17);
00581     s_copy(path + 1, "BD", (ftnlen)2, (ftnlen)2);
00582     nfail = 0;
00583     ntest = 0;
00584     unfl = dlamch_("Safe minimum");
00585     ovfl = dlamch_("Overflow");
00586     dlabad_(&unfl, &ovfl);
00587     ulp = dlamch_("Precision");
00588     ulpinv = 1. / ulp;
00589     log2ui = (integer) (log(ulpinv) / log(2.));
00590     rtunfl = sqrt(unfl);
00591     rtovfl = sqrt(ovfl);
00592     infoc_1.infot = 0;
00593 
00594 /*     Loop over sizes, types */
00595 
00596     i__1 = *nsizes;
00597     for (jsize = 1; jsize <= i__1; ++jsize) {
00598         m = mval[jsize];
00599         n = nval[jsize];
00600         mnmin = min(m,n);
00601 /* Computing MAX */
00602         i__2 = max(m,n);
00603         amninv = 1. / max(i__2,1);
00604 
00605         if (*nsizes != 1) {
00606             mtypes = min(16,*ntypes);
00607         } else {
00608             mtypes = min(17,*ntypes);
00609         }
00610 
00611         i__2 = mtypes;
00612         for (jtype = 1; jtype <= i__2; ++jtype) {
00613             if (! dotype[jtype]) {
00614                 goto L170;
00615             }
00616 
00617             for (j = 1; j <= 4; ++j) {
00618                 ioldsd[j - 1] = iseed[j];
00619 /* L20: */
00620             }
00621 
00622             for (j = 1; j <= 14; ++j) {
00623                 result[j - 1] = -1.;
00624 /* L30: */
00625             }
00626 
00627             *(unsigned char *)uplo = ' ';
00628 
00629 /*           Compute "A" */
00630 
00631 /*           Control parameters: */
00632 
00633 /*           KMAGN  KMODE        KTYPE */
00634 /*       =1  O(1)   clustered 1  zero */
00635 /*       =2  large  clustered 2  identity */
00636 /*       =3  small  exponential  (none) */
00637 /*       =4         arithmetic   diagonal, (w/ eigenvalues) */
00638 /*       =5         random       symmetric, w/ eigenvalues */
00639 /*       =6                      nonsymmetric, w/ singular values */
00640 /*       =7                      random diagonal */
00641 /*       =8                      random symmetric */
00642 /*       =9                      random nonsymmetric */
00643 /*       =10                     random bidiagonal (log. distrib.) */
00644 
00645             if (mtypes > 16) {
00646                 goto L100;
00647             }
00648 
00649             itype = ktype[jtype - 1];
00650             imode = kmode[jtype - 1];
00651 
00652 /*           Compute norm */
00653 
00654             switch (kmagn[jtype - 1]) {
00655                 case 1:  goto L40;
00656                 case 2:  goto L50;
00657                 case 3:  goto L60;
00658             }
00659 
00660 L40:
00661             anorm = 1.;
00662             goto L70;
00663 
00664 L50:
00665             anorm = rtovfl * ulp * amninv;
00666             goto L70;
00667 
00668 L60:
00669             anorm = rtunfl * max(m,n) * ulpinv;
00670             goto L70;
00671 
00672 L70:
00673 
00674             zlaset_("Full", lda, &n, &c_b1, &c_b1, &a[a_offset], lda);
00675             iinfo = 0;
00676             cond = ulpinv;
00677 
00678             bidiag = FALSE_;
00679             if (itype == 1) {
00680 
00681 /*              Zero matrix */
00682 
00683                 iinfo = 0;
00684 
00685             } else if (itype == 2) {
00686 
00687 /*              Identity */
00688 
00689                 i__3 = mnmin;
00690                 for (jcol = 1; jcol <= i__3; ++jcol) {
00691                     i__4 = jcol + jcol * a_dim1;
00692                     a[i__4].r = anorm, a[i__4].i = 0.;
00693 /* L80: */
00694                 }
00695 
00696             } else if (itype == 4) {
00697 
00698 /*              Diagonal Matrix, [Eigen]values Specified */
00699 
00700                 zlatms_(&mnmin, &mnmin, "S", &iseed[1], "N", &rwork[1], &
00701                         imode, &cond, &anorm, &c__0, &c__0, "N", &a[a_offset], 
00702                          lda, &work[1], &iinfo);
00703 
00704             } else if (itype == 5) {
00705 
00706 /*              Symmetric, eigenvalues specified */
00707 
00708                 zlatms_(&mnmin, &mnmin, "S", &iseed[1], "S", &rwork[1], &
00709                         imode, &cond, &anorm, &m, &n, "N", &a[a_offset], lda, 
00710                         &work[1], &iinfo);
00711 
00712             } else if (itype == 6) {
00713 
00714 /*              Nonsymmetric, singular values specified */
00715 
00716                 zlatms_(&m, &n, "S", &iseed[1], "N", &rwork[1], &imode, &cond, 
00717                          &anorm, &m, &n, "N", &a[a_offset], lda, &work[1], &
00718                         iinfo);
00719 
00720             } else if (itype == 7) {
00721 
00722 /*              Diagonal, random entries */
00723 
00724                 zlatmr_(&mnmin, &mnmin, "S", &iseed[1], "N", &work[1], &c__6, 
00725                         &c_b37, &c_b2, "T", "N", &work[mnmin + 1], &c__1, &
00726                         c_b37, &work[(mnmin << 1) + 1], &c__1, &c_b37, "N", 
00727                         iwork, &c__0, &c__0, &c_b47, &anorm, "NO", &a[
00728                         a_offset], lda, iwork, &iinfo);
00729 
00730             } else if (itype == 8) {
00731 
00732 /*              Symmetric, random entries */
00733 
00734                 zlatmr_(&mnmin, &mnmin, "S", &iseed[1], "S", &work[1], &c__6, 
00735                         &c_b37, &c_b2, "T", "N", &work[mnmin + 1], &c__1, &
00736                         c_b37, &work[m + mnmin + 1], &c__1, &c_b37, "N", 
00737                         iwork, &m, &n, &c_b47, &anorm, "NO", &a[a_offset], 
00738                         lda, iwork, &iinfo);
00739 
00740             } else if (itype == 9) {
00741 
00742 /*              Nonsymmetric, random entries */
00743 
00744                 zlatmr_(&m, &n, "S", &iseed[1], "N", &work[1], &c__6, &c_b37, 
00745                         &c_b2, "T", "N", &work[mnmin + 1], &c__1, &c_b37, &
00746                         work[m + mnmin + 1], &c__1, &c_b37, "N", iwork, &m, &
00747                         n, &c_b47, &anorm, "NO", &a[a_offset], lda, iwork, &
00748                         iinfo);
00749 
00750             } else if (itype == 10) {
00751 
00752 /*              Bidiagonal, random entries */
00753 
00754                 temp1 = log(ulp) * -2.;
00755                 i__3 = mnmin;
00756                 for (j = 1; j <= i__3; ++j) {
00757                     bd[j] = exp(temp1 * dlarnd_(&c__2, &iseed[1]));
00758                     if (j < mnmin) {
00759                         be[j] = exp(temp1 * dlarnd_(&c__2, &iseed[1]));
00760                     }
00761 /* L90: */
00762                 }
00763 
00764                 iinfo = 0;
00765                 bidiag = TRUE_;
00766                 if (m >= n) {
00767                     *(unsigned char *)uplo = 'U';
00768                 } else {
00769                     *(unsigned char *)uplo = 'L';
00770                 }
00771             } else {
00772                 iinfo = 1;
00773             }
00774 
00775             if (iinfo == 0) {
00776 
00777 /*              Generate Right-Hand Side */
00778 
00779                 if (bidiag) {
00780                     zlatmr_(&mnmin, nrhs, "S", &iseed[1], "N", &work[1], &
00781                             c__6, &c_b37, &c_b2, "T", "N", &work[mnmin + 1], &
00782                             c__1, &c_b37, &work[(mnmin << 1) + 1], &c__1, &
00783                             c_b37, "N", iwork, &mnmin, nrhs, &c_b47, &c_b37, 
00784                             "NO", &y[y_offset], ldx, iwork, &iinfo);
00785                 } else {
00786                     zlatmr_(&m, nrhs, "S", &iseed[1], "N", &work[1], &c__6, &
00787                             c_b37, &c_b2, "T", "N", &work[m + 1], &c__1, &
00788                             c_b37, &work[(m << 1) + 1], &c__1, &c_b37, "N", 
00789                             iwork, &m, nrhs, &c_b47, &c_b37, "NO", &x[
00790                             x_offset], ldx, iwork, &iinfo);
00791                 }
00792             }
00793 
00794 /*           Error Exit */
00795 
00796             if (iinfo != 0) {
00797                 io___40.ciunit = *nout;
00798                 s_wsfe(&io___40);
00799                 do_fio(&c__1, "Generator", (ftnlen)9);
00800                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00801                 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00802                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00803                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00804                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
00805                 e_wsfe();
00806                 *info = abs(iinfo);
00807                 return 0;
00808             }
00809 
00810 L100:
00811 
00812 /*           Call ZGEBRD and ZUNGBR to compute B, Q, and P, do tests. */
00813 
00814             if (! bidiag) {
00815 
00816 /*              Compute transformations to reduce A to bidiagonal form: */
00817 /*              B := Q' * A * P. */
00818 
00819                 zlacpy_(" ", &m, &n, &a[a_offset], lda, &q[q_offset], ldq);
00820                 i__3 = *lwork - (mnmin << 1);
00821                 zgebrd_(&m, &n, &q[q_offset], ldq, &bd[1], &be[1], &work[1], &
00822                         work[mnmin + 1], &work[(mnmin << 1) + 1], &i__3, &
00823                         iinfo);
00824 
00825 /*              Check error code from ZGEBRD. */
00826 
00827                 if (iinfo != 0) {
00828                     io___41.ciunit = *nout;
00829                     s_wsfe(&io___41);
00830                     do_fio(&c__1, "ZGEBRD", (ftnlen)6);
00831                     do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00832                     do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00833                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00834                     do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00835                     do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00836                             ;
00837                     e_wsfe();
00838                     *info = abs(iinfo);
00839                     return 0;
00840                 }
00841 
00842                 zlacpy_(" ", &m, &n, &q[q_offset], ldq, &pt[pt_offset], ldpt);
00843                 if (m >= n) {
00844                     *(unsigned char *)uplo = 'U';
00845                 } else {
00846                     *(unsigned char *)uplo = 'L';
00847                 }
00848 
00849 /*              Generate Q */
00850 
00851                 mq = m;
00852                 if (*nrhs <= 0) {
00853                     mq = mnmin;
00854                 }
00855                 i__3 = *lwork - (mnmin << 1);
00856                 zungbr_("Q", &m, &mq, &n, &q[q_offset], ldq, &work[1], &work[(
00857                         mnmin << 1) + 1], &i__3, &iinfo);
00858 
00859 /*              Check error code from ZUNGBR. */
00860 
00861                 if (iinfo != 0) {
00862                     io___43.ciunit = *nout;
00863                     s_wsfe(&io___43);
00864                     do_fio(&c__1, "ZUNGBR(Q)", (ftnlen)9);
00865                     do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00866                     do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00867                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00868                     do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00869                     do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00870                             ;
00871                     e_wsfe();
00872                     *info = abs(iinfo);
00873                     return 0;
00874                 }
00875 
00876 /*              Generate P' */
00877 
00878                 i__3 = *lwork - (mnmin << 1);
00879                 zungbr_("P", &mnmin, &n, &m, &pt[pt_offset], ldpt, &work[
00880                         mnmin + 1], &work[(mnmin << 1) + 1], &i__3, &iinfo);
00881 
00882 /*              Check error code from ZUNGBR. */
00883 
00884                 if (iinfo != 0) {
00885                     io___44.ciunit = *nout;
00886                     s_wsfe(&io___44);
00887                     do_fio(&c__1, "ZUNGBR(P)", (ftnlen)9);
00888                     do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00889                     do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00890                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00891                     do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00892                     do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00893                             ;
00894                     e_wsfe();
00895                     *info = abs(iinfo);
00896                     return 0;
00897                 }
00898 
00899 /*              Apply Q' to an M by NRHS matrix X:  Y := Q' * X. */
00900 
00901                 zgemm_("Conjugate transpose", "No transpose", &m, nrhs, &m, &
00902                         c_b2, &q[q_offset], ldq, &x[x_offset], ldx, &c_b1, &y[
00903                         y_offset], ldx);
00904 
00905 /*              Test 1:  Check the decomposition A := Q * B * PT */
00906 /*                   2:  Check the orthogonality of Q */
00907 /*                   3:  Check the orthogonality of PT */
00908 
00909                 zbdt01_(&m, &n, &c__1, &a[a_offset], lda, &q[q_offset], ldq, &
00910                         bd[1], &be[1], &pt[pt_offset], ldpt, &work[1], &rwork[
00911                         1], result);
00912                 zunt01_("Columns", &m, &mq, &q[q_offset], ldq, &work[1], 
00913                         lwork, &rwork[1], &result[1]);
00914                 zunt01_("Rows", &mnmin, &n, &pt[pt_offset], ldpt, &work[1], 
00915                         lwork, &rwork[1], &result[2]);
00916             }
00917 
00918 /*           Use ZBDSQR to form the SVD of the bidiagonal matrix B: */
00919 /*           B := U * S1 * VT, and compute Z = U' * Y. */
00920 
00921             dcopy_(&mnmin, &bd[1], &c__1, &s1[1], &c__1);
00922             if (mnmin > 0) {
00923                 i__3 = mnmin - 1;
00924                 dcopy_(&i__3, &be[1], &c__1, &rwork[1], &c__1);
00925             }
00926             zlacpy_(" ", &m, nrhs, &y[y_offset], ldx, &z__[z_offset], ldx);
00927             zlaset_("Full", &mnmin, &mnmin, &c_b1, &c_b2, &u[u_offset], ldpt);
00928             zlaset_("Full", &mnmin, &mnmin, &c_b1, &c_b2, &vt[vt_offset], 
00929                     ldpt);
00930 
00931             zbdsqr_(uplo, &mnmin, &mnmin, &mnmin, nrhs, &s1[1], &rwork[1], &
00932                     vt[vt_offset], ldpt, &u[u_offset], ldpt, &z__[z_offset], 
00933                     ldx, &rwork[mnmin + 1], &iinfo);
00934 
00935 /*           Check error code from ZBDSQR. */
00936 
00937             if (iinfo != 0) {
00938                 io___45.ciunit = *nout;
00939                 s_wsfe(&io___45);
00940                 do_fio(&c__1, "ZBDSQR(vects)", (ftnlen)13);
00941                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00942                 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00943                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00944                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00945                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
00946                 e_wsfe();
00947                 *info = abs(iinfo);
00948                 if (iinfo < 0) {
00949                     return 0;
00950                 } else {
00951                     result[3] = ulpinv;
00952                     goto L150;
00953                 }
00954             }
00955 
00956 /*           Use ZBDSQR to compute only the singular values of the */
00957 /*           bidiagonal matrix B;  U, VT, and Z should not be modified. */
00958 
00959             dcopy_(&mnmin, &bd[1], &c__1, &s2[1], &c__1);
00960             if (mnmin > 0) {
00961                 i__3 = mnmin - 1;
00962                 dcopy_(&i__3, &be[1], &c__1, &rwork[1], &c__1);
00963             }
00964 
00965             zbdsqr_(uplo, &mnmin, &c__0, &c__0, &c__0, &s2[1], &rwork[1], &vt[
00966                     vt_offset], ldpt, &u[u_offset], ldpt, &z__[z_offset], ldx, 
00967                      &rwork[mnmin + 1], &iinfo);
00968 
00969 /*           Check error code from ZBDSQR. */
00970 
00971             if (iinfo != 0) {
00972                 io___46.ciunit = *nout;
00973                 s_wsfe(&io___46);
00974                 do_fio(&c__1, "ZBDSQR(values)", (ftnlen)14);
00975                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00976                 do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
00977                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00978                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00979                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
00980                 e_wsfe();
00981                 *info = abs(iinfo);
00982                 if (iinfo < 0) {
00983                     return 0;
00984                 } else {
00985                     result[8] = ulpinv;
00986                     goto L150;
00987                 }
00988             }
00989 
00990 /*           Test 4:  Check the decomposition B := U * S1 * VT */
00991 /*                5:  Check the computation Z := U' * Y */
00992 /*                6:  Check the orthogonality of U */
00993 /*                7:  Check the orthogonality of VT */
00994 
00995             zbdt03_(uplo, &mnmin, &c__1, &bd[1], &be[1], &u[u_offset], ldpt, &
00996                     s1[1], &vt[vt_offset], ldpt, &work[1], &result[3]);
00997             zbdt02_(&mnmin, nrhs, &y[y_offset], ldx, &z__[z_offset], ldx, &u[
00998                     u_offset], ldpt, &work[1], &rwork[1], &result[4]);
00999             zunt01_("Columns", &mnmin, &mnmin, &u[u_offset], ldpt, &work[1], 
01000                     lwork, &rwork[1], &result[5]);
01001             zunt01_("Rows", &mnmin, &mnmin, &vt[vt_offset], ldpt, &work[1], 
01002                     lwork, &rwork[1], &result[6]);
01003 
01004 /*           Test 8:  Check that the singular values are sorted in */
01005 /*                    non-increasing order and are non-negative */
01006 
01007             result[7] = 0.;
01008             i__3 = mnmin - 1;
01009             for (i__ = 1; i__ <= i__3; ++i__) {
01010                 if (s1[i__] < s1[i__ + 1]) {
01011                     result[7] = ulpinv;
01012                 }
01013                 if (s1[i__] < 0.) {
01014                     result[7] = ulpinv;
01015                 }
01016 /* L110: */
01017             }
01018             if (mnmin >= 1) {
01019                 if (s1[mnmin] < 0.) {
01020                     result[7] = ulpinv;
01021                 }
01022             }
01023 
01024 /*           Test 9:  Compare ZBDSQR with and without singular vectors */
01025 
01026             temp2 = 0.;
01027 
01028             i__3 = mnmin;
01029             for (j = 1; j <= i__3; ++j) {
01030 /* Computing MAX */
01031 /* Computing MAX */
01032                 d__6 = (d__1 = s1[j], abs(d__1)), d__7 = (d__2 = s2[j], abs(
01033                         d__2));
01034                 d__4 = sqrt(unfl) * max(s1[1],1.), d__5 = ulp * max(d__6,d__7)
01035                         ;
01036                 temp1 = (d__3 = s1[j] - s2[j], abs(d__3)) / max(d__4,d__5);
01037                 temp2 = max(temp1,temp2);
01038 /* L120: */
01039             }
01040 
01041             result[8] = temp2;
01042 
01043 /*           Test 10:  Sturm sequence test of singular values */
01044 /*                     Go up by factors of two until it succeeds */
01045 
01046             temp1 = *thresh * (.5 - ulp);
01047 
01048             i__3 = log2ui;
01049             for (j = 0; j <= i__3; ++j) {
01050                 dsvdch_(&mnmin, &bd[1], &be[1], &s1[1], &temp1, &iinfo);
01051                 if (iinfo == 0) {
01052                     goto L140;
01053                 }
01054                 temp1 *= 2.;
01055 /* L130: */
01056             }
01057 
01058 L140:
01059             result[9] = temp1;
01060 
01061 /*           Use ZBDSQR to form the decomposition A := (QU) S (VT PT) */
01062 /*           from the bidiagonal form A := Q B PT. */
01063 
01064             if (! bidiag) {
01065                 dcopy_(&mnmin, &bd[1], &c__1, &s2[1], &c__1);
01066                 if (mnmin > 0) {
01067                     i__3 = mnmin - 1;
01068                     dcopy_(&i__3, &be[1], &c__1, &rwork[1], &c__1);
01069                 }
01070 
01071                 zbdsqr_(uplo, &mnmin, &n, &m, nrhs, &s2[1], &rwork[1], &pt[
01072                         pt_offset], ldpt, &q[q_offset], ldq, &y[y_offset], 
01073                         ldx, &rwork[mnmin + 1], &iinfo);
01074 
01075 /*              Test 11:  Check the decomposition A := Q*U * S2 * VT*PT */
01076 /*                   12:  Check the computation Z := U' * Q' * X */
01077 /*                   13:  Check the orthogonality of Q*U */
01078 /*                   14:  Check the orthogonality of VT*PT */
01079 
01080                 zbdt01_(&m, &n, &c__0, &a[a_offset], lda, &q[q_offset], ldq, &
01081                         s2[1], dumma, &pt[pt_offset], ldpt, &work[1], &rwork[
01082                         1], &result[10]);
01083                 zbdt02_(&m, nrhs, &x[x_offset], ldx, &y[y_offset], ldx, &q[
01084                         q_offset], ldq, &work[1], &rwork[1], &result[11]);
01085                 zunt01_("Columns", &m, &mq, &q[q_offset], ldq, &work[1], 
01086                         lwork, &rwork[1], &result[12]);
01087                 zunt01_("Rows", &mnmin, &n, &pt[pt_offset], ldpt, &work[1], 
01088                         lwork, &rwork[1], &result[13]);
01089             }
01090 
01091 /*           End of Loop -- Check for RESULT(j) > THRESH */
01092 
01093 L150:
01094             for (j = 1; j <= 14; ++j) {
01095                 if (result[j - 1] >= *thresh) {
01096                     if (nfail == 0) {
01097                         dlahd2_(nout, path);
01098                     }
01099                     io___50.ciunit = *nout;
01100                     s_wsfe(&io___50);
01101                     do_fio(&c__1, (char *)&m, (ftnlen)sizeof(integer));
01102                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01103                     do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
01104                     do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
01105                             ;
01106                     do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
01107                     do_fio(&c__1, (char *)&result[j - 1], (ftnlen)sizeof(
01108                             doublereal));
01109                     e_wsfe();
01110                     ++nfail;
01111                 }
01112 /* L160: */
01113             }
01114             if (! bidiag) {
01115                 ntest += 14;
01116             } else {
01117                 ntest += 5;
01118             }
01119 
01120 L170:
01121             ;
01122         }
01123 /* L180: */
01124     }
01125 
01126 /*     Summary */
01127 
01128     alasum_(path, nout, &nfail, &ntest, &c__0);
01129 
01130     return 0;
01131 
01132 /*     End of ZCHKBD */
01133 
01134 
01135 } /* zchkbd_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:17