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


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