zdrgvx.c
Go to the documentation of this file.
00001 /* zdrgvx.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 /* Table of constant values */
00017 
00018 static integer c__1 = 1;
00019 static integer c__0 = 0;
00020 static doublecomplex c_b11 = {1.,0.};
00021 static integer c__5 = 5;
00022 static logical c_true = TRUE_;
00023 static logical c_false = FALSE_;
00024 static integer c__3 = 3;
00025 static integer c__7 = 7;
00026 
00027 /* Subroutine */ int zdrgvx_(integer *nsize, doublereal *thresh, integer *nin, 
00028          integer *nout, doublecomplex *a, integer *lda, doublecomplex *b, 
00029         doublecomplex *ai, doublecomplex *bi, doublecomplex *alpha, 
00030         doublecomplex *beta, doublecomplex *vl, doublecomplex *vr, integer *
00031         ilo, integer *ihi, doublereal *lscale, doublereal *rscale, doublereal 
00032         *s, doublereal *dtru, doublereal *dif, doublereal *diftru, 
00033         doublecomplex *work, integer *lwork, doublereal *rwork, integer *
00034         iwork, integer *liwork, doublereal *result, logical *bwork, integer *
00035         info)
00036 {
00037     /* Format strings */
00038     static char fmt_9999[] = "(\002 ZDRGVX: \002,a,\002 returned INFO=\002,i"
00039             "6,\002.\002,/9x,\002N=\002,i6,\002, JTYPE=\002,i6,\002)\002)";
00040     static char fmt_9998[] = "(\002 ZDRGVX: \002,a,\002 Eigenvectors from"
00041             " \002,a,\002 incorrectly \002,\002normalized.\002,/\002 Bits of "
00042             "error=\002,0p,g10.3,\002,\002,9x,\002N=\002,i6,\002, JTYPE=\002,"
00043             "i6,\002, IWA=\002,i5,\002, IWB=\002,i5,\002, IWX=\002,i5,\002, I"
00044             "WY=\002,i5)";
00045     static char fmt_9997[] = "(/1x,a3,\002 -- Complex Expert Eigenvalue/vect"
00046             "or\002,\002 problem driver\002)";
00047     static char fmt_9995[] = "(\002 Matrix types: \002,/)";
00048     static char fmt_9994[] = "(\002 TYPE 1: Da is diagonal, Db is identity,"
00049             " \002,/\002     A = Y^(-H) Da X^(-1), B = Y^(-H) Db X^(-1) \002,/"
00050             "\002     YH and X are left and right eigenvectors. \002,/)";
00051     static char fmt_9993[] = "(\002 TYPE 2: Da is quasi-diagonal, Db is iden"
00052             "tity, \002,/\002     A = Y^(-H) Da X^(-1), B = Y^(-H) Db X^(-1)"
00053             " \002,/\002     YH and X are left and right eigenvectors. \002,/)"
00054             ;
00055     static char fmt_9992[] = "(/\002 Tests performed:  \002,/4x,\002 a is al"
00056             "pha, b is beta, l is a left eigenvector, \002,/4x,\002 r is a ri"
00057             "ght eigenvector and \002,a,\002 means \002,a,\002.\002,/\002 1 ="
00058             " max | ( b A - a B )\002,a,\002 l | / const.\002,/\002 2 = max |"
00059             " ( b A - a B ) r | / const.\002,/\002 3 = max ( Sest/Stru, Stru/"
00060             "Sest ) \002,\002 over all eigenvalues\002,/\002 4 = max( DIFest/"
00061             "DIFtru, DIFtru/DIFest ) \002,\002 over the 1st and 5th eigenvect"
00062             "ors\002,/)";
00063     static char fmt_9991[] = "(\002 Type=\002,i2,\002,\002,\002 IWA=\002,i2"
00064             ",\002, IWB=\002,i2,\002, IWX=\002,i2,\002, IWY=\002,i2,\002, res"
00065             "ult \002,i2,\002 is\002,0p,f8.2)";
00066     static char fmt_9990[] = "(\002 Type=\002,i2,\002,\002,\002 IWA=\002,i2"
00067             ",\002, IWB=\002,i2,\002, IWX=\002,i2,\002, IWY=\002,i2,\002, res"
00068             "ult \002,i2,\002 is\002,1p,d10.3)";
00069     static char fmt_9987[] = "(\002 ZDRGVX: \002,a,\002 returned INFO=\002,i"
00070             "6,\002.\002,/9x,\002N=\002,i6,\002, Input example #\002,i2,\002"
00071             ")\002)";
00072     static char fmt_9986[] = "(\002 ZDRGVX: \002,a,\002 Eigenvectors from"
00073             " \002,a,\002 incorrectly \002,\002normalized.\002,/\002 Bits of "
00074             "error=\002,0p,g10.3,\002,\002,9x,\002N=\002,i6,\002, Input Examp"
00075             "le #\002,i2,\002)\002)";
00076     static char fmt_9996[] = "(\002Input Example\002)";
00077     static char fmt_9989[] = "(\002 Input example #\002,i2,\002, matrix orde"
00078             "r=\002,i4,\002,\002,\002 result \002,i2,\002 is\002,0p,f8.2)";
00079     static char fmt_9988[] = "(\002 Input example #\002,i2,\002, matrix orde"
00080             "r=\002,i4,\002,\002,\002 result \002,i2,\002 is\002,1p,d10.3)";
00081 
00082     /* System generated locals */
00083     integer a_dim1, a_offset, ai_dim1, ai_offset, b_dim1, b_offset, bi_dim1, 
00084             bi_offset, vl_dim1, vl_offset, vr_dim1, vr_offset, i__1, i__2;
00085     doublereal d__1, d__2, d__3, d__4;
00086     doublecomplex z__1;
00087 
00088     /* Builtin functions */
00089     double sqrt(doublereal);
00090     void z_div(doublecomplex *, doublecomplex *, doublecomplex *);
00091     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void),
00092              s_rsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
00093             e_rsle(void);
00094 
00095     /* Local variables */
00096     integer i__, j, n, iwa, iwb;
00097     doublereal ulp;
00098     integer iwx, iwy, nmax, linfo;
00099     doublereal anorm, bnorm;
00100     extern /* Subroutine */ int zget52_(logical *, integer *, doublecomplex *, 
00101              integer *, doublecomplex *, integer *, doublecomplex *, integer *
00102 , doublecomplex *, doublecomplex *, doublecomplex *, doublereal *, 
00103              doublereal *);
00104     integer nerrs;
00105     doublereal ratio1, ratio2, thrsh2;
00106     extern /* Subroutine */ int zlatm6_(integer *, integer *, doublecomplex *, 
00107              integer *, doublecomplex *, doublecomplex *, integer *, 
00108             doublecomplex *, integer *, doublecomplex *, doublecomplex *, 
00109             doublecomplex *, doublecomplex *, doublereal *, doublereal *);
00110     extern doublereal dlamch_(char *);
00111     extern /* Subroutine */ int xerbla_(char *, integer *);
00112     doublereal abnorm;
00113     extern integer ilaenv_(integer *, char *, char *, integer *, integer *, 
00114             integer *, integer *);
00115     extern doublereal zlange_(char *, integer *, integer *, doublecomplex *, 
00116             integer *, doublereal *);
00117     extern /* Subroutine */ int alasvm_(char *, integer *, integer *, integer 
00118             *, integer *);
00119     doublecomplex weight[5];
00120     extern /* Subroutine */ int zlacpy_(char *, integer *, integer *, 
00121             doublecomplex *, integer *, doublecomplex *, integer *);
00122     integer minwrk, maxwrk, iptype;
00123     extern /* Subroutine */ int zggevx_(char *, char *, char *, char *, 
00124             integer *, doublecomplex *, integer *, doublecomplex *, integer *, 
00125              doublecomplex *, doublecomplex *, doublecomplex *, integer *, 
00126             doublecomplex *, integer *, integer *, integer *, doublereal *, 
00127             doublereal *, doublereal *, doublereal *, doublereal *, 
00128             doublereal *, doublecomplex *, integer *, doublereal *, integer *, 
00129              logical *, integer *);
00130     doublereal ulpinv;
00131     integer nptknt, ntestt;
00132 
00133     /* Fortran I/O blocks */
00134     static cilist io___20 = { 0, 0, 0, fmt_9999, 0 };
00135     static cilist io___22 = { 0, 0, 0, fmt_9998, 0 };
00136     static cilist io___23 = { 0, 0, 0, fmt_9998, 0 };
00137     static cilist io___28 = { 0, 0, 0, fmt_9997, 0 };
00138     static cilist io___29 = { 0, 0, 0, fmt_9995, 0 };
00139     static cilist io___30 = { 0, 0, 0, fmt_9994, 0 };
00140     static cilist io___31 = { 0, 0, 0, fmt_9993, 0 };
00141     static cilist io___32 = { 0, 0, 0, fmt_9992, 0 };
00142     static cilist io___33 = { 0, 0, 0, fmt_9991, 0 };
00143     static cilist io___34 = { 0, 0, 0, fmt_9990, 0 };
00144     static cilist io___35 = { 0, 0, 1, 0, 0 };
00145     static cilist io___36 = { 0, 0, 0, 0, 0 };
00146     static cilist io___37 = { 0, 0, 0, 0, 0 };
00147     static cilist io___38 = { 0, 0, 0, 0, 0 };
00148     static cilist io___39 = { 0, 0, 0, 0, 0 };
00149     static cilist io___40 = { 0, 0, 0, fmt_9987, 0 };
00150     static cilist io___41 = { 0, 0, 0, fmt_9986, 0 };
00151     static cilist io___42 = { 0, 0, 0, fmt_9986, 0 };
00152     static cilist io___43 = { 0, 0, 0, fmt_9997, 0 };
00153     static cilist io___44 = { 0, 0, 0, fmt_9996, 0 };
00154     static cilist io___45 = { 0, 0, 0, fmt_9992, 0 };
00155     static cilist io___46 = { 0, 0, 0, fmt_9989, 0 };
00156     static cilist io___47 = { 0, 0, 0, fmt_9988, 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 /*  ZDRGVX checks the nonsymmetric generalized eigenvalue problem */
00173 /*  expert driver ZGGEVX. */
00174 
00175 /*  ZGGEVX computes the generalized eigenvalues, (optionally) the left */
00176 /*  and/or right eigenvectors, (optionally) computes a balancing */
00177 /*  transformation to improve the conditioning, and (optionally) */
00178 /*  reciprocal condition numbers for the eigenvalues and eigenvectors. */
00179 
00180 /*  When ZDRGVX is called with NSIZE > 0, two types of test matrix pairs */
00181 /*  are generated by the subroutine DLATM6 and test the driver ZGGEVX. */
00182 /*  The test matrices have the known exact condition numbers for */
00183 /*  eigenvalues. For the condition numbers of the eigenvectors */
00184 /*  corresponding the first and last eigenvalues are also know */
00185 /*  ``exactly'' (see ZLATM6). */
00186 /*  For each matrix pair, the following tests will be performed and */
00187 /*  compared with the threshhold THRESH. */
00188 
00189 /*  (1) max over all left eigenvalue/-vector pairs (beta/alpha,l) of */
00190 
00191 /*     | l**H * (beta A - alpha B) | / ( ulp max( |beta A|, |alpha B| ) ) */
00192 
00193 /*      where l**H is the conjugate tranpose of l. */
00194 
00195 /*  (2) max over all right eigenvalue/-vector pairs (beta/alpha,r) of */
00196 
00197 /*        | (beta A - alpha B) r | / ( ulp max( |beta A|, |alpha B| ) ) */
00198 
00199 /*  (3) The condition number S(i) of eigenvalues computed by ZGGEVX */
00200 /*      differs less than a factor THRESH from the exact S(i) (see */
00201 /*      ZLATM6). */
00202 
00203 /*  (4) DIF(i) computed by ZTGSNA differs less than a factor 10*THRESH */
00204 /*      from the exact value (for the 1st and 5th vectors only). */
00205 
00206 /*  Test Matrices */
00207 /*  ============= */
00208 
00209 /*  Two kinds of test matrix pairs */
00210 /*           (A, B) = inverse(YH) * (Da, Db) * inverse(X) */
00211 /*  are used in the tests: */
00212 
00213 /*  1: Da = 1+a   0    0    0    0    Db = 1   0   0   0   0 */
00214 /*           0   2+a   0    0    0         0   1   0   0   0 */
00215 /*           0    0   3+a   0    0         0   0   1   0   0 */
00216 /*           0    0    0   4+a   0         0   0   0   1   0 */
00217 /*           0    0    0    0   5+a ,      0   0   0   0   1 , and */
00218 
00219 /*  2: Da =  1   -1    0    0    0    Db = 1   0   0   0   0 */
00220 /*           1    1    0    0    0         0   1   0   0   0 */
00221 /*           0    0    1    0    0         0   0   1   0   0 */
00222 /*           0    0    0   1+a  1+b        0   0   0   1   0 */
00223 /*           0    0    0  -1-b  1+a ,      0   0   0   0   1 . */
00224 
00225 /*  In both cases the same inverse(YH) and inverse(X) are used to compute */
00226 /*  (A, B), giving the exact eigenvectors to (A,B) as (YH, X): */
00227 
00228 /*  YH:  =  1    0   -y    y   -y    X =  1   0  -x  -x   x */
00229 /*          0    1   -y    y   -y         0   1   x  -x  -x */
00230 /*          0    0    1    0    0         0   0   1   0   0 */
00231 /*          0    0    0    1    0         0   0   0   1   0 */
00232 /*          0    0    0    0    1,        0   0   0   0   1 , where */
00233 
00234 /*  a, b, x and y will have all values independently of each other from */
00235 /*  { sqrt(sqrt(ULP)),  0.1,  1,  10,  1/sqrt(sqrt(ULP)) }. */
00236 
00237 /*  Arguments */
00238 /*  ========= */
00239 
00240 /*  NSIZE   (input) INTEGER */
00241 /*          The number of sizes of matrices to use.  NSIZE must be at */
00242 /*          least zero. If it is zero, no randomly generated matrices */
00243 /*          are tested, but any test matrices read from NIN will be */
00244 /*          tested.  If it is not zero, then N = 5. */
00245 
00246 /*  THRESH  (input) DOUBLE PRECISION */
00247 /*          A test will count as "failed" if the "error", computed as */
00248 /*          described above, exceeds THRESH.  Note that the error */
00249 /*          is scaled to be O(1), so THRESH should be a reasonably */
00250 /*          small multiple of 1, e.g., 10 or 100.  In particular, */
00251 /*          it should not depend on the precision (single vs. double) */
00252 /*          or the size of the matrix.  It must be at least zero. */
00253 
00254 /*  NIN     (input) INTEGER */
00255 /*          The FORTRAN unit number for reading in the data file of */
00256 /*          problems to solve. */
00257 
00258 /*  NOUT    (input) INTEGER */
00259 /*          The FORTRAN unit number for printing out error messages */
00260 /*          (e.g., if a routine returns IINFO not equal to 0.) */
00261 
00262 /*  A       (workspace) COMPLEX*16 array, dimension (LDA, NSIZE) */
00263 /*          Used to hold the matrix whose eigenvalues are to be */
00264 /*          computed.  On exit, A contains the last matrix actually used. */
00265 
00266 /*  LDA     (input) INTEGER */
00267 /*          The leading dimension of A, B, AI, BI, Ao, and Bo. */
00268 /*          It must be at least 1 and at least NSIZE. */
00269 
00270 /*  B       (workspace) COMPLEX*16 array, dimension (LDA, NSIZE) */
00271 /*          Used to hold the matrix whose eigenvalues are to be */
00272 /*          computed.  On exit, B contains the last matrix actually used. */
00273 
00274 /*  AI      (workspace) COMPLEX*16 array, dimension (LDA, NSIZE) */
00275 /*          Copy of A, modified by ZGGEVX. */
00276 
00277 /*  BI      (workspace) COMPLEX*16 array, dimension (LDA, NSIZE) */
00278 /*          Copy of B, modified by ZGGEVX. */
00279 
00280 /*  ALPHA   (workspace) COMPLEX*16 array, dimension (NSIZE) */
00281 /*  BETA    (workspace) COMPLEX*16 array, dimension (NSIZE) */
00282 /*          On exit, ALPHA/BETA are the eigenvalues. */
00283 
00284 /*  VL      (workspace) COMPLEX*16 array, dimension (LDA, NSIZE) */
00285 /*          VL holds the left eigenvectors computed by ZGGEVX. */
00286 
00287 /*  VR      (workspace) COMPLEX*16 array, dimension (LDA, NSIZE) */
00288 /*          VR holds the right eigenvectors computed by ZGGEVX. */
00289 
00290 /*  ILO     (output/workspace) INTEGER */
00291 
00292 /*  IHI     (output/workspace) INTEGER */
00293 
00294 /*  LSCALE  (output/workspace) DOUBLE PRECISION array, dimension (N) */
00295 
00296 /*  RSCALE  (output/workspace) DOUBLE PRECISION array, dimension (N) */
00297 
00298 /*  S       (output/workspace) DOUBLE PRECISION array, dimension (N) */
00299 
00300 /*  DTRU    (output/workspace) DOUBLE PRECISION array, dimension (N) */
00301 
00302 /*  DIF     (output/workspace) DOUBLE PRECISION array, dimension (N) */
00303 
00304 /*  DIFTRU  (output/workspace) DOUBLE PRECISION array, dimension (N) */
00305 
00306 /*  WORK    (workspace) COMPLEX*16 array, dimension (LWORK) */
00307 
00308 /*  LWORK   (input) INTEGER */
00309 /*          Leading dimension of WORK.  LWORK >= 2*N*N + 2*N */
00310 
00311 /*  RWORK   (workspace) DOUBLE PRECISION array, dimension (6*N) */
00312 
00313 /*  IWORK   (workspace) INTEGER array, dimension (LIWORK) */
00314 
00315 /*  LIWORK  (input) INTEGER */
00316 /*          Leading dimension of IWORK.  LIWORK >= N+2. */
00317 
00318 /*  RESULT  (output/workspace) DOUBLE PRECISION array, dimension (4) */
00319 
00320 /*  BWORK   (workspace) LOGICAL array, dimension (N) */
00321 
00322 /*  INFO    (output) INTEGER */
00323 /*          = 0:  successful exit */
00324 /*          < 0:  if INFO = -i, the i-th argument had an illegal value. */
00325 /*          > 0:  A routine returned an error code. */
00326 
00327 /*  ===================================================================== */
00328 
00329 /*     .. Parameters .. */
00330 /*     .. */
00331 /*     .. Local Scalars .. */
00332 /*     .. */
00333 /*     .. Local Arrays .. */
00334 /*     .. */
00335 /*     .. External Functions .. */
00336 /*     .. */
00337 /*     .. External Subroutines .. */
00338 /*     .. */
00339 /*     .. Intrinsic Functions .. */
00340 /*     .. */
00341 /*     .. Executable Statements .. */
00342 
00343 /*     Check for errors */
00344 
00345     /* Parameter adjustments */
00346     vr_dim1 = *lda;
00347     vr_offset = 1 + vr_dim1;
00348     vr -= vr_offset;
00349     vl_dim1 = *lda;
00350     vl_offset = 1 + vl_dim1;
00351     vl -= vl_offset;
00352     bi_dim1 = *lda;
00353     bi_offset = 1 + bi_dim1;
00354     bi -= bi_offset;
00355     ai_dim1 = *lda;
00356     ai_offset = 1 + ai_dim1;
00357     ai -= ai_offset;
00358     b_dim1 = *lda;
00359     b_offset = 1 + b_dim1;
00360     b -= b_offset;
00361     a_dim1 = *lda;
00362     a_offset = 1 + a_dim1;
00363     a -= a_offset;
00364     --alpha;
00365     --beta;
00366     --lscale;
00367     --rscale;
00368     --s;
00369     --dtru;
00370     --dif;
00371     --diftru;
00372     --work;
00373     --rwork;
00374     --iwork;
00375     --result;
00376     --bwork;
00377 
00378     /* Function Body */
00379     *info = 0;
00380 
00381     nmax = 5;
00382 
00383     if (*nsize < 0) {
00384         *info = -1;
00385     } else if (*thresh < 0.) {
00386         *info = -2;
00387     } else if (*nin <= 0) {
00388         *info = -3;
00389     } else if (*nout <= 0) {
00390         *info = -4;
00391     } else if (*lda < 1 || *lda < nmax) {
00392         *info = -6;
00393     } else if (*liwork < nmax + 2) {
00394         *info = -26;
00395     }
00396 
00397 /*     Compute workspace */
00398 /*      (Note: Comments in the code beginning "Workspace:" describe the */
00399 /*       minimal amount of workspace needed at that point in the code, */
00400 /*       as well as the preferred amount for good performance. */
00401 /*       NB refers to the optimal block size for the immediately */
00402 /*       following subroutine, as returned by ILAENV.) */
00403 
00404     minwrk = 1;
00405     if (*info == 0 && *lwork >= 1) {
00406         minwrk = (nmax << 1) * (nmax + 1);
00407         maxwrk = nmax * (ilaenv_(&c__1, "ZGEQRF", " ", &nmax, &c__1, &nmax, &
00408                 c__0) + 1);
00409 /* Computing MAX */
00410         i__1 = maxwrk, i__2 = (nmax << 1) * (nmax + 1);
00411         maxwrk = max(i__1,i__2);
00412         work[1].r = (doublereal) maxwrk, work[1].i = 0.;
00413     }
00414 
00415     if (*lwork < minwrk) {
00416         *info = -23;
00417     }
00418 
00419     if (*info != 0) {
00420         i__1 = -(*info);
00421         xerbla_("ZDRGVX", &i__1);
00422         return 0;
00423     }
00424 
00425     n = 5;
00426     ulp = dlamch_("P");
00427     ulpinv = 1. / ulp;
00428     thrsh2 = *thresh * 10.;
00429     nerrs = 0;
00430     nptknt = 0;
00431     ntestt = 0;
00432 
00433     if (*nsize == 0) {
00434         goto L90;
00435     }
00436 
00437 /*     Parameters used for generating test matrices. */
00438 
00439     d__1 = sqrt(sqrt(ulp));
00440     z__1.r = d__1, z__1.i = 0.;
00441     weight[0].r = z__1.r, weight[0].i = z__1.i;
00442     weight[1].r = .1, weight[1].i = 0.;
00443     weight[2].r = 1., weight[2].i = 0.;
00444     z_div(&z__1, &c_b11, &weight[1]);
00445     weight[3].r = z__1.r, weight[3].i = z__1.i;
00446     z_div(&z__1, &c_b11, weight);
00447     weight[4].r = z__1.r, weight[4].i = z__1.i;
00448 
00449     for (iptype = 1; iptype <= 2; ++iptype) {
00450         for (iwa = 1; iwa <= 5; ++iwa) {
00451             for (iwb = 1; iwb <= 5; ++iwb) {
00452                 for (iwx = 1; iwx <= 5; ++iwx) {
00453                     for (iwy = 1; iwy <= 5; ++iwy) {
00454 
00455 /*                    generated a pair of test matrix */
00456 
00457                         zlatm6_(&iptype, &c__5, &a[a_offset], lda, &b[
00458                                 b_offset], &vr[vr_offset], lda, &vl[vl_offset]
00459 , lda, &weight[iwa - 1], &weight[iwb - 1], &
00460                                 weight[iwx - 1], &weight[iwy - 1], &dtru[1], &
00461                                 diftru[1]);
00462 
00463 /*                    Compute eigenvalues/eigenvectors of (A, B). */
00464 /*                    Compute eigenvalue/eigenvector condition numbers */
00465 /*                    using computed eigenvectors. */
00466 
00467                         zlacpy_("F", &n, &n, &a[a_offset], lda, &ai[ai_offset]
00468 , lda);
00469                         zlacpy_("F", &n, &n, &b[b_offset], lda, &bi[bi_offset]
00470 , lda);
00471 
00472                         zggevx_("N", "V", "V", "B", &n, &ai[ai_offset], lda, &
00473                                 bi[bi_offset], lda, &alpha[1], &beta[1], &vl[
00474                                 vl_offset], lda, &vr[vr_offset], lda, ilo, 
00475                                 ihi, &lscale[1], &rscale[1], &anorm, &bnorm, &
00476                                 s[1], &dif[1], &work[1], lwork, &rwork[1], &
00477                                 iwork[1], &bwork[1], &linfo);
00478                         if (linfo != 0) {
00479                             io___20.ciunit = *nout;
00480                             s_wsfe(&io___20);
00481                             do_fio(&c__1, "ZGGEVX", (ftnlen)6);
00482                             do_fio(&c__1, (char *)&linfo, (ftnlen)sizeof(
00483                                     integer));
00484                             do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00485                                     ;
00486                             do_fio(&c__1, (char *)&iptype, (ftnlen)sizeof(
00487                                     integer));
00488                             do_fio(&c__1, (char *)&iwa, (ftnlen)sizeof(
00489                                     integer));
00490                             do_fio(&c__1, (char *)&iwb, (ftnlen)sizeof(
00491                                     integer));
00492                             do_fio(&c__1, (char *)&iwx, (ftnlen)sizeof(
00493                                     integer));
00494                             do_fio(&c__1, (char *)&iwy, (ftnlen)sizeof(
00495                                     integer));
00496                             e_wsfe();
00497                             goto L30;
00498                         }
00499 
00500 /*                    Compute the norm(A, B) */
00501 
00502                         zlacpy_("Full", &n, &n, &ai[ai_offset], lda, &work[1], 
00503                                  &n);
00504                         zlacpy_("Full", &n, &n, &bi[bi_offset], lda, &work[n *
00505                                  n + 1], &n);
00506                         i__1 = n << 1;
00507                         abnorm = zlange_("Fro", &n, &i__1, &work[1], &n, &
00508                                 rwork[1]);
00509 
00510 /*                    Tests (1) and (2) */
00511 
00512                         result[1] = 0.;
00513                         zget52_(&c_true, &n, &a[a_offset], lda, &b[b_offset], 
00514                                 lda, &vl[vl_offset], lda, &alpha[1], &beta[1], 
00515                                  &work[1], &rwork[1], &result[1]);
00516                         if (result[2] > *thresh) {
00517                             io___22.ciunit = *nout;
00518                             s_wsfe(&io___22);
00519                             do_fio(&c__1, "Left", (ftnlen)4);
00520                             do_fio(&c__1, "ZGGEVX", (ftnlen)6);
00521                             do_fio(&c__1, (char *)&result[2], (ftnlen)sizeof(
00522                                     doublereal));
00523                             do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00524                                     ;
00525                             do_fio(&c__1, (char *)&iptype, (ftnlen)sizeof(
00526                                     integer));
00527                             do_fio(&c__1, (char *)&iwa, (ftnlen)sizeof(
00528                                     integer));
00529                             do_fio(&c__1, (char *)&iwb, (ftnlen)sizeof(
00530                                     integer));
00531                             do_fio(&c__1, (char *)&iwx, (ftnlen)sizeof(
00532                                     integer));
00533                             do_fio(&c__1, (char *)&iwy, (ftnlen)sizeof(
00534                                     integer));
00535                             e_wsfe();
00536                         }
00537 
00538                         result[2] = 0.;
00539                         zget52_(&c_false, &n, &a[a_offset], lda, &b[b_offset], 
00540                                  lda, &vr[vr_offset], lda, &alpha[1], &beta[1]
00541 , &work[1], &rwork[1], &result[2]);
00542                         if (result[3] > *thresh) {
00543                             io___23.ciunit = *nout;
00544                             s_wsfe(&io___23);
00545                             do_fio(&c__1, "Right", (ftnlen)5);
00546                             do_fio(&c__1, "ZGGEVX", (ftnlen)6);
00547                             do_fio(&c__1, (char *)&result[3], (ftnlen)sizeof(
00548                                     doublereal));
00549                             do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
00550                                     ;
00551                             do_fio(&c__1, (char *)&iptype, (ftnlen)sizeof(
00552                                     integer));
00553                             do_fio(&c__1, (char *)&iwa, (ftnlen)sizeof(
00554                                     integer));
00555                             do_fio(&c__1, (char *)&iwb, (ftnlen)sizeof(
00556                                     integer));
00557                             do_fio(&c__1, (char *)&iwx, (ftnlen)sizeof(
00558                                     integer));
00559                             do_fio(&c__1, (char *)&iwy, (ftnlen)sizeof(
00560                                     integer));
00561                             e_wsfe();
00562                         }
00563 
00564 /*                    Test (3) */
00565 
00566                         result[3] = 0.;
00567                         i__1 = n;
00568                         for (i__ = 1; i__ <= i__1; ++i__) {
00569                             if (s[i__] == 0.) {
00570                                 if (dtru[i__] > abnorm * ulp) {
00571                                     result[3] = ulpinv;
00572                                 }
00573                             } else if (dtru[i__] == 0.) {
00574                                 if (s[i__] > abnorm * ulp) {
00575                                     result[3] = ulpinv;
00576                                 }
00577                             } else {
00578 /* Computing MAX */
00579                                 d__3 = (d__1 = dtru[i__] / s[i__], abs(d__1)),
00580                                          d__4 = (d__2 = s[i__] / dtru[i__], 
00581                                         abs(d__2));
00582                                 rwork[i__] = max(d__3,d__4);
00583 /* Computing MAX */
00584                                 d__1 = result[3], d__2 = rwork[i__];
00585                                 result[3] = max(d__1,d__2);
00586                             }
00587 /* L10: */
00588                         }
00589 
00590 /*                    Test (4) */
00591 
00592                         result[4] = 0.;
00593                         if (dif[1] == 0.) {
00594                             if (diftru[1] > abnorm * ulp) {
00595                                 result[4] = ulpinv;
00596                             }
00597                         } else if (diftru[1] == 0.) {
00598                             if (dif[1] > abnorm * ulp) {
00599                                 result[4] = ulpinv;
00600                             }
00601                         } else if (dif[5] == 0.) {
00602                             if (diftru[5] > abnorm * ulp) {
00603                                 result[4] = ulpinv;
00604                             }
00605                         } else if (diftru[5] == 0.) {
00606                             if (dif[5] > abnorm * ulp) {
00607                                 result[4] = ulpinv;
00608                             }
00609                         } else {
00610 /* Computing MAX */
00611                             d__3 = (d__1 = diftru[1] / dif[1], abs(d__1)), 
00612                                     d__4 = (d__2 = dif[1] / diftru[1], abs(
00613                                     d__2));
00614                             ratio1 = max(d__3,d__4);
00615 /* Computing MAX */
00616                             d__3 = (d__1 = diftru[5] / dif[5], abs(d__1)), 
00617                                     d__4 = (d__2 = dif[5] / diftru[5], abs(
00618                                     d__2));
00619                             ratio2 = max(d__3,d__4);
00620                             result[4] = max(ratio1,ratio2);
00621                         }
00622 
00623                         ntestt += 4;
00624 
00625 /*                    Print out tests which fail. */
00626 
00627                         for (j = 1; j <= 4; ++j) {
00628                             if (result[j] >= thrsh2 && j >= 4 || result[j] >= 
00629                                     *thresh && j <= 3) {
00630 
00631 /*                       If this is the first test to fail, */
00632 /*                       print a header to the data file. */
00633 
00634                                 if (nerrs == 0) {
00635                                     io___28.ciunit = *nout;
00636                                     s_wsfe(&io___28);
00637                                     do_fio(&c__1, "ZXV", (ftnlen)3);
00638                                     e_wsfe();
00639 
00640 /*                          Print out messages for built-in examples */
00641 
00642 /*                          Matrix types */
00643 
00644                                     io___29.ciunit = *nout;
00645                                     s_wsfe(&io___29);
00646                                     e_wsfe();
00647                                     io___30.ciunit = *nout;
00648                                     s_wsfe(&io___30);
00649                                     e_wsfe();
00650                                     io___31.ciunit = *nout;
00651                                     s_wsfe(&io___31);
00652                                     e_wsfe();
00653 
00654 /*                          Tests performed */
00655 
00656                                     io___32.ciunit = *nout;
00657                                     s_wsfe(&io___32);
00658                                     do_fio(&c__1, "'", (ftnlen)1);
00659                                     do_fio(&c__1, "transpose", (ftnlen)9);
00660                                     do_fio(&c__1, "'", (ftnlen)1);
00661                                     e_wsfe();
00662 
00663                                 }
00664                                 ++nerrs;
00665                                 if (result[j] < 1e4) {
00666                                     io___33.ciunit = *nout;
00667                                     s_wsfe(&io___33);
00668                                     do_fio(&c__1, (char *)&iptype, (ftnlen)
00669                                             sizeof(integer));
00670                                     do_fio(&c__1, (char *)&iwa, (ftnlen)
00671                                             sizeof(integer));
00672                                     do_fio(&c__1, (char *)&iwb, (ftnlen)
00673                                             sizeof(integer));
00674                                     do_fio(&c__1, (char *)&iwx, (ftnlen)
00675                                             sizeof(integer));
00676                                     do_fio(&c__1, (char *)&iwy, (ftnlen)
00677                                             sizeof(integer));
00678                                     do_fio(&c__1, (char *)&j, (ftnlen)sizeof(
00679                                             integer));
00680                                     do_fio(&c__1, (char *)&result[j], (ftnlen)
00681                                             sizeof(doublereal));
00682                                     e_wsfe();
00683                                 } else {
00684                                     io___34.ciunit = *nout;
00685                                     s_wsfe(&io___34);
00686                                     do_fio(&c__1, (char *)&iptype, (ftnlen)
00687                                             sizeof(integer));
00688                                     do_fio(&c__1, (char *)&iwa, (ftnlen)
00689                                             sizeof(integer));
00690                                     do_fio(&c__1, (char *)&iwb, (ftnlen)
00691                                             sizeof(integer));
00692                                     do_fio(&c__1, (char *)&iwx, (ftnlen)
00693                                             sizeof(integer));
00694                                     do_fio(&c__1, (char *)&iwy, (ftnlen)
00695                                             sizeof(integer));
00696                                     do_fio(&c__1, (char *)&j, (ftnlen)sizeof(
00697                                             integer));
00698                                     do_fio(&c__1, (char *)&result[j], (ftnlen)
00699                                             sizeof(doublereal));
00700                                     e_wsfe();
00701                                 }
00702                             }
00703 /* L20: */
00704                         }
00705 
00706 L30:
00707 
00708 /* L40: */
00709                         ;
00710                     }
00711 /* L50: */
00712                 }
00713 /* L60: */
00714             }
00715 /* L70: */
00716         }
00717 /* L80: */
00718     }
00719 
00720     goto L150;
00721 
00722 L90:
00723 
00724 /*     Read in data from file to check accuracy of condition estimation */
00725 /*     Read input data until N=0 */
00726 
00727     io___35.ciunit = *nin;
00728     i__1 = s_rsle(&io___35);
00729     if (i__1 != 0) {
00730         goto L150;
00731     }
00732     i__1 = do_lio(&c__3, &c__1, (char *)&n, (ftnlen)sizeof(integer));
00733     if (i__1 != 0) {
00734         goto L150;
00735     }
00736     i__1 = e_rsle();
00737     if (i__1 != 0) {
00738         goto L150;
00739     }
00740     if (n == 0) {
00741         goto L150;
00742     }
00743     i__1 = n;
00744     for (i__ = 1; i__ <= i__1; ++i__) {
00745         io___36.ciunit = *nin;
00746         s_rsle(&io___36);
00747         i__2 = n;
00748         for (j = 1; j <= i__2; ++j) {
00749             do_lio(&c__7, &c__1, (char *)&a[i__ + j * a_dim1], (ftnlen)sizeof(
00750                     doublecomplex));
00751         }
00752         e_rsle();
00753 /* L100: */
00754     }
00755     i__1 = n;
00756     for (i__ = 1; i__ <= i__1; ++i__) {
00757         io___37.ciunit = *nin;
00758         s_rsle(&io___37);
00759         i__2 = n;
00760         for (j = 1; j <= i__2; ++j) {
00761             do_lio(&c__7, &c__1, (char *)&b[i__ + j * b_dim1], (ftnlen)sizeof(
00762                     doublecomplex));
00763         }
00764         e_rsle();
00765 /* L110: */
00766     }
00767     io___38.ciunit = *nin;
00768     s_rsle(&io___38);
00769     i__1 = n;
00770     for (i__ = 1; i__ <= i__1; ++i__) {
00771         do_lio(&c__5, &c__1, (char *)&dtru[i__], (ftnlen)sizeof(doublereal));
00772     }
00773     e_rsle();
00774     io___39.ciunit = *nin;
00775     s_rsle(&io___39);
00776     i__1 = n;
00777     for (i__ = 1; i__ <= i__1; ++i__) {
00778         do_lio(&c__5, &c__1, (char *)&diftru[i__], (ftnlen)sizeof(doublereal))
00779                 ;
00780     }
00781     e_rsle();
00782 
00783     ++nptknt;
00784 
00785 /*     Compute eigenvalues/eigenvectors of (A, B). */
00786 /*     Compute eigenvalue/eigenvector condition numbers */
00787 /*     using computed eigenvectors. */
00788 
00789     zlacpy_("F", &n, &n, &a[a_offset], lda, &ai[ai_offset], lda);
00790     zlacpy_("F", &n, &n, &b[b_offset], lda, &bi[bi_offset], lda);
00791 
00792     zggevx_("N", "V", "V", "B", &n, &ai[ai_offset], lda, &bi[bi_offset], lda, 
00793             &alpha[1], &beta[1], &vl[vl_offset], lda, &vr[vr_offset], lda, 
00794             ilo, ihi, &lscale[1], &rscale[1], &anorm, &bnorm, &s[1], &dif[1], 
00795             &work[1], lwork, &rwork[1], &iwork[1], &bwork[1], &linfo);
00796 
00797     if (linfo != 0) {
00798         io___40.ciunit = *nout;
00799         s_wsfe(&io___40);
00800         do_fio(&c__1, "ZGGEVX", (ftnlen)6);
00801         do_fio(&c__1, (char *)&linfo, (ftnlen)sizeof(integer));
00802         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00803         do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
00804         e_wsfe();
00805         goto L140;
00806     }
00807 
00808 /*     Compute the norm(A, B) */
00809 
00810     zlacpy_("Full", &n, &n, &ai[ai_offset], lda, &work[1], &n);
00811     zlacpy_("Full", &n, &n, &bi[bi_offset], lda, &work[n * n + 1], &n);
00812     i__1 = n << 1;
00813     abnorm = zlange_("Fro", &n, &i__1, &work[1], &n, &rwork[1]);
00814 
00815 /*     Tests (1) and (2) */
00816 
00817     result[1] = 0.;
00818     zget52_(&c_true, &n, &a[a_offset], lda, &b[b_offset], lda, &vl[vl_offset], 
00819              lda, &alpha[1], &beta[1], &work[1], &rwork[1], &result[1]);
00820     if (result[2] > *thresh) {
00821         io___41.ciunit = *nout;
00822         s_wsfe(&io___41);
00823         do_fio(&c__1, "Left", (ftnlen)4);
00824         do_fio(&c__1, "ZGGEVX", (ftnlen)6);
00825         do_fio(&c__1, (char *)&result[2], (ftnlen)sizeof(doublereal));
00826         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00827         do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
00828         e_wsfe();
00829     }
00830 
00831     result[2] = 0.;
00832     zget52_(&c_false, &n, &a[a_offset], lda, &b[b_offset], lda, &vr[vr_offset]
00833 , lda, &alpha[1], &beta[1], &work[1], &rwork[1], &result[2]);
00834     if (result[3] > *thresh) {
00835         io___42.ciunit = *nout;
00836         s_wsfe(&io___42);
00837         do_fio(&c__1, "Right", (ftnlen)5);
00838         do_fio(&c__1, "ZGGEVX", (ftnlen)6);
00839         do_fio(&c__1, (char *)&result[3], (ftnlen)sizeof(doublereal));
00840         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00841         do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
00842         e_wsfe();
00843     }
00844 
00845 /*     Test (3) */
00846 
00847     result[3] = 0.;
00848     i__1 = n;
00849     for (i__ = 1; i__ <= i__1; ++i__) {
00850         if (s[i__] == 0.) {
00851             if (dtru[i__] > abnorm * ulp) {
00852                 result[3] = ulpinv;
00853             }
00854         } else if (dtru[i__] == 0.) {
00855             if (s[i__] > abnorm * ulp) {
00856                 result[3] = ulpinv;
00857             }
00858         } else {
00859 /* Computing MAX */
00860             d__3 = (d__1 = dtru[i__] / s[i__], abs(d__1)), d__4 = (d__2 = s[
00861                     i__] / dtru[i__], abs(d__2));
00862             rwork[i__] = max(d__3,d__4);
00863 /* Computing MAX */
00864             d__1 = result[3], d__2 = rwork[i__];
00865             result[3] = max(d__1,d__2);
00866         }
00867 /* L120: */
00868     }
00869 
00870 /*     Test (4) */
00871 
00872     result[4] = 0.;
00873     if (dif[1] == 0.) {
00874         if (diftru[1] > abnorm * ulp) {
00875             result[4] = ulpinv;
00876         }
00877     } else if (diftru[1] == 0.) {
00878         if (dif[1] > abnorm * ulp) {
00879             result[4] = ulpinv;
00880         }
00881     } else if (dif[5] == 0.) {
00882         if (diftru[5] > abnorm * ulp) {
00883             result[4] = ulpinv;
00884         }
00885     } else if (diftru[5] == 0.) {
00886         if (dif[5] > abnorm * ulp) {
00887             result[4] = ulpinv;
00888         }
00889     } else {
00890 /* Computing MAX */
00891         d__3 = (d__1 = diftru[1] / dif[1], abs(d__1)), d__4 = (d__2 = dif[1] /
00892                  diftru[1], abs(d__2));
00893         ratio1 = max(d__3,d__4);
00894 /* Computing MAX */
00895         d__3 = (d__1 = diftru[5] / dif[5], abs(d__1)), d__4 = (d__2 = dif[5] /
00896                  diftru[5], abs(d__2));
00897         ratio2 = max(d__3,d__4);
00898         result[4] = max(ratio1,ratio2);
00899     }
00900 
00901     ntestt += 4;
00902 
00903 /*     Print out tests which fail. */
00904 
00905     for (j = 1; j <= 4; ++j) {
00906         if (result[j] >= thrsh2) {
00907 
00908 /*           If this is the first test to fail, */
00909 /*           print a header to the data file. */
00910 
00911             if (nerrs == 0) {
00912                 io___43.ciunit = *nout;
00913                 s_wsfe(&io___43);
00914                 do_fio(&c__1, "ZXV", (ftnlen)3);
00915                 e_wsfe();
00916 
00917 /*              Print out messages for built-in examples */
00918 
00919 /*              Matrix types */
00920 
00921                 io___44.ciunit = *nout;
00922                 s_wsfe(&io___44);
00923                 e_wsfe();
00924 
00925 /*              Tests performed */
00926 
00927                 io___45.ciunit = *nout;
00928                 s_wsfe(&io___45);
00929                 do_fio(&c__1, "'", (ftnlen)1);
00930                 do_fio(&c__1, "transpose", (ftnlen)9);
00931                 do_fio(&c__1, "'", (ftnlen)1);
00932                 e_wsfe();
00933 
00934             }
00935             ++nerrs;
00936             if (result[j] < 1e4) {
00937                 io___46.ciunit = *nout;
00938                 s_wsfe(&io___46);
00939                 do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
00940                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00941                 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
00942                 do_fio(&c__1, (char *)&result[j], (ftnlen)sizeof(doublereal));
00943                 e_wsfe();
00944             } else {
00945                 io___47.ciunit = *nout;
00946                 s_wsfe(&io___47);
00947                 do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
00948                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00949                 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
00950                 do_fio(&c__1, (char *)&result[j], (ftnlen)sizeof(doublereal));
00951                 e_wsfe();
00952             }
00953         }
00954 /* L130: */
00955     }
00956 
00957 L140:
00958 
00959     goto L90;
00960 L150:
00961 
00962 /*     Summary */
00963 
00964     alasvm_("ZXV", nout, &nerrs, &ntestt, &c__0);
00965 
00966     work[1].r = (doublereal) maxwrk, work[1].i = 0.;
00967 
00968     return 0;
00969 
00970 
00971 
00972 
00973 
00974 
00975 
00976 
00977 
00978 
00979 
00980 
00981 
00982 
00983 
00984 /*     End of ZDRGVX */
00985 
00986 } /* zdrgvx_ */


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