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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:20