sdrges.c
Go to the documentation of this file.
00001 /* sdrges.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_n1 = -1;
00020 static real c_b26 = 0.f;
00021 static integer c__2 = 2;
00022 static real c_b32 = 1.f;
00023 static integer c__3 = 3;
00024 static integer c__4 = 4;
00025 static integer c__0 = 0;
00026 
00027 /* Subroutine */ int sdrges_(integer *nsizes, integer *nn, integer *ntypes, 
00028         logical *dotype, integer *iseed, real *thresh, integer *nounit, real *
00029         a, integer *lda, real *b, real *s, real *t, real *q, integer *ldq, 
00030         real *z__, real *alphar, real *alphai, real *beta, real *work, 
00031         integer *lwork, real *result, logical *bwork, integer *info)
00032 {
00033     /* Initialized data */
00034 
00035     static integer kclass[26] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,
00036             2,2,2,3 };
00037     static integer kbmagn[26] = { 1,1,1,1,1,1,1,1,3,2,3,2,2,3,1,1,1,1,1,1,1,3,
00038             2,3,2,1 };
00039     static integer ktrian[26] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,
00040             1,1,1,1 };
00041     static integer iasign[26] = { 0,0,0,0,0,0,2,0,2,2,0,0,2,2,2,0,2,0,0,0,2,2,
00042             2,2,2,0 };
00043     static integer ibsign[26] = { 0,0,0,0,0,0,0,2,0,0,2,2,0,0,2,0,2,0,0,0,0,0,
00044             0,0,0,0 };
00045     static integer kz1[6] = { 0,1,2,1,3,3 };
00046     static integer kz2[6] = { 0,0,1,2,1,1 };
00047     static integer kadd[6] = { 0,0,0,0,3,2 };
00048     static integer katype[26] = { 0,1,0,1,2,3,4,1,4,4,1,1,4,4,4,2,4,5,8,7,9,4,
00049             4,4,4,0 };
00050     static integer kbtype[26] = { 0,0,1,1,2,-3,1,4,1,1,4,4,1,1,-4,2,-4,8,8,8,
00051             8,8,8,8,8,0 };
00052     static integer kazero[26] = { 1,1,1,1,1,1,2,1,2,2,1,1,2,2,3,1,3,5,5,5,5,3,
00053             3,3,3,1 };
00054     static integer kbzero[26] = { 1,1,1,1,1,1,1,2,1,1,2,2,1,1,4,1,4,6,6,6,6,4,
00055             4,4,4,1 };
00056     static integer kamagn[26] = { 1,1,1,1,1,1,1,1,2,3,2,3,2,3,1,1,1,1,1,1,1,2,
00057             3,3,2,1 };
00058 
00059     /* Format strings */
00060     static char fmt_9999[] = "(\002 SDRGES: \002,a,\002 returned INFO=\002,i"
00061             "6,\002.\002,/9x,\002N=\002,i6,\002, JTYPE=\002,i6,\002, ISEED="
00062             "(\002,4(i4,\002,\002),i5,\002)\002)";
00063     static char fmt_9998[] = "(\002 SDRGES: SGET53 returned INFO=\002,i1,"
00064             "\002 for eigenvalue \002,i6,\002.\002,/9x,\002N=\002,i6,\002, JT"
00065             "YPE=\002,i6,\002, ISEED=(\002,4(i4,\002,\002),i5,\002)\002)";
00066     static char fmt_9997[] = "(\002 SDRGES: S not in Schur form at eigenvalu"
00067             "e \002,i6,\002.\002,/9x,\002N=\002,i6,\002, JTYPE=\002,i6,\002, "
00068             "ISEED=(\002,3(i5,\002,\002),i5,\002)\002)";
00069     static char fmt_9996[] = "(/1x,a3,\002 -- Real Generalized Schur form dr"
00070             "iver\002)";
00071     static char fmt_9995[] = "(\002 Matrix types (see SDRGES for details):"
00072             " \002)";
00073     static char fmt_9994[] = "(\002 Special Matrices:\002,23x,\002(J'=transp"
00074             "osed Jordan block)\002,/\002   1=(0,0)  2=(I,0)  3=(0,I)  4=(I,I"
00075             ")  5=(J',J')  \002,\0026=(diag(J',I), diag(I,J'))\002,/\002 Diag"
00076             "onal Matrices:  ( \002,\002D=diag(0,1,2,...) )\002,/\002   7=(D,"
00077             "I)   9=(large*D, small*I\002,\002)  11=(large*I, small*D)  13=(l"
00078             "arge*D, large*I)\002,/\002   8=(I,D)  10=(small*D, large*I)  12="
00079             "(small*I, large*D) \002,\002 14=(small*D, small*I)\002,/\002  15"
00080             "=(D, reversed D)\002)";
00081     static char fmt_9993[] = "(\002 Matrices Rotated by Random \002,a,\002 M"
00082             "atrices U, V:\002,/\002  16=Transposed Jordan Blocks            "
00083             " 19=geometric \002,\002alpha, beta=0,1\002,/\002  17=arithm. alp"
00084             "ha&beta             \002,\002      20=arithmetic alpha, beta=0,"
00085             "1\002,/\002  18=clustered \002,\002alpha, beta=0,1            21"
00086             "=random alpha, beta=0,1\002,/\002 Large & Small Matrices:\002,"
00087             "/\002  22=(large, small)   \002,\00223=(small,large)    24=(smal"
00088             "l,small)    25=(large,large)\002,/\002  26=random O(1) matrices"
00089             ".\002)";
00090     static char fmt_9992[] = "(/\002 Tests performed:  (S is Schur, T is tri"
00091             "angular, \002,\002Q and Z are \002,a,\002,\002,/19x,\002l and r "
00092             "are the appropriate left and right\002,/19x,\002eigenvectors, re"
00093             "sp., a is alpha, b is beta, and\002,/19x,a,\002 means \002,a,"
00094             "\002.)\002,/\002 Without ordering: \002,/\002  1 = | A - Q S "
00095             "Z\002,a,\002 | / ( |A| n ulp )      2 = | B - Q T Z\002,a,\002 |"
00096             " / ( |B| n ulp )\002,/\002  3 = | I - QQ\002,a,\002 | / ( n ulp "
00097             ")             4 = | I - ZZ\002,a,\002 | / ( n ulp )\002,/\002  5"
00098             " = A is in Schur form S\002,/\002  6 = difference between (alpha"
00099             ",beta)\002,\002 and diagonals of (S,T)\002,/\002 With ordering:"
00100             " \002,/\002  7 = | (A,B) - Q (S,T) Z\002,a,\002 | / ( |(A,B)| n "
00101             "ulp )  \002,/\002  8 = | I - QQ\002,a,\002 | / ( n ulp )        "
00102             "    9 = | I - ZZ\002,a,\002 | / ( n ulp )\002,/\002 10 = A is in"
00103             " Schur form S\002,/\002 11 = difference between (alpha,beta) and"
00104             " diagonals\002,\002 of (S,T)\002,/\002 12 = SDIM is the correct "
00105             "number of \002,\002selected eigenvalues\002,/)";
00106     static char fmt_9991[] = "(\002 Matrix order=\002,i5,\002, type=\002,i2"
00107             ",\002, seed=\002,4(i4,\002,\002),\002 result \002,i2,\002 is\002"
00108             ",0p,f8.2)";
00109     static char fmt_9990[] = "(\002 Matrix order=\002,i5,\002, type=\002,i2"
00110             ",\002, seed=\002,4(i4,\002,\002),\002 result \002,i2,\002 is\002"
00111             ",1p,e10.3)";
00112 
00113     /* System generated locals */
00114     integer a_dim1, a_offset, b_dim1, b_offset, q_dim1, q_offset, s_dim1, 
00115             s_offset, t_dim1, t_offset, z_dim1, z_offset, i__1, i__2, i__3, 
00116             i__4;
00117     real r__1, r__2, r__3, r__4, r__5, r__6, r__7, r__8, r__9, r__10;
00118 
00119     /* Builtin functions */
00120     double r_sign(real *, real *);
00121     integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
00122 
00123     /* Local variables */
00124     integer i__, j, n, i1, n1, jc, nb, in, jr;
00125     real ulp;
00126     integer iadd, sdim, ierr, nmax, rsub;
00127     char sort[1];
00128     real temp1, temp2;
00129     logical badnn;
00130     integer iinfo;
00131     real rmagn[4];
00132     extern /* Subroutine */ int sget51_(integer *, integer *, real *, integer 
00133             *, real *, integer *, real *, integer *, real *, integer *, real *
00134 , real *), sgges_(char *, char *, char *, L_fp, integer *, real *, 
00135              integer *, real *, integer *, integer *, real *, real *, real *, 
00136             real *, integer *, real *, integer *, real *, integer *, logical *
00137 , integer *), sget53_(real *, integer *, 
00138             real *, integer *, real *, real *, real *, real *, integer *), 
00139             sget54_(integer *, real *, integer *, real *, integer *, real *, 
00140             integer *, real *, integer *, real *, integer *, real *, integer *
00141 , real *, real *);
00142     integer nmats, jsize, nerrs, jtype, ntest, isort;
00143     extern /* Subroutine */ int slatm4_(integer *, integer *, integer *, 
00144             integer *, integer *, real *, real *, real *, integer *, integer *
00145 , real *, integer *);
00146     logical ilabad;
00147     extern /* Subroutine */ int sorm2r_(char *, char *, integer *, integer *, 
00148             integer *, real *, integer *, real *, real *, integer *, real *, 
00149             integer *), slabad_(real *, real *);
00150     extern doublereal slamch_(char *);
00151     real safmin;
00152     integer ioldsd[4];
00153     real safmax;
00154     integer knteig;
00155     extern integer ilaenv_(integer *, char *, char *, integer *, integer *, 
00156             integer *, integer *);
00157     extern doublereal slarnd_(integer *, integer *);
00158     extern /* Subroutine */ int alasvm_(char *, integer *, integer *, integer 
00159             *, integer *), slarfg_(integer *, real *, real *, integer 
00160             *, real *), xerbla_(char *, integer *);
00161     extern logical slctes_(real *, real *, real *);
00162     extern /* Subroutine */ int slacpy_(char *, integer *, integer *, real *, 
00163             integer *, real *, integer *), slaset_(char *, integer *, 
00164             integer *, real *, real *, real *, integer *);
00165     integer minwrk, maxwrk;
00166     real ulpinv;
00167     integer mtypes, ntestt;
00168 
00169     /* Fortran I/O blocks */
00170     static cilist io___40 = { 0, 0, 0, fmt_9999, 0 };
00171     static cilist io___46 = { 0, 0, 0, fmt_9999, 0 };
00172     static cilist io___52 = { 0, 0, 0, fmt_9998, 0 };
00173     static cilist io___53 = { 0, 0, 0, fmt_9997, 0 };
00174     static cilist io___55 = { 0, 0, 0, fmt_9996, 0 };
00175     static cilist io___56 = { 0, 0, 0, fmt_9995, 0 };
00176     static cilist io___57 = { 0, 0, 0, fmt_9994, 0 };
00177     static cilist io___58 = { 0, 0, 0, fmt_9993, 0 };
00178     static cilist io___59 = { 0, 0, 0, fmt_9992, 0 };
00179     static cilist io___60 = { 0, 0, 0, fmt_9991, 0 };
00180     static cilist io___61 = { 0, 0, 0, fmt_9990, 0 };
00181 
00182 
00183 
00184 /*  -- LAPACK test routine (version 3.1) -- */
00185 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00186 /*     November 2006 */
00187 
00188 /*     .. Scalar Arguments .. */
00189 /*     .. */
00190 /*     .. Array Arguments .. */
00191 /*     .. */
00192 
00193 /*  Purpose */
00194 /*  ======= */
00195 
00196 /*  SDRGES checks the nonsymmetric generalized eigenvalue (Schur form) */
00197 /*  problem driver SGGES. */
00198 
00199 /*  SGGES factors A and B as Q S Z'  and Q T Z' , where ' means */
00200 /*  transpose, T is upper triangular, S is in generalized Schur form */
00201 /*  (block upper triangular, with 1x1 and 2x2 blocks on the diagonal, */
00202 /*  the 2x2 blocks corresponding to complex conjugate pairs of */
00203 /*  generalized eigenvalues), and Q and Z are orthogonal. It also */
00204 /*  computes the generalized eigenvalues (alpha(j),beta(j)), j=1,...,n, */
00205 /*  Thus, w(j) = alpha(j)/beta(j) is a root of the characteristic */
00206 /*  equation */
00207 /*                  det( A - w(j) B ) = 0 */
00208 /*  Optionally it also reorder the eigenvalues so that a selected */
00209 /*  cluster of eigenvalues appears in the leading diagonal block of the */
00210 /*  Schur forms. */
00211 
00212 /*  When SDRGES is called, a number of matrix "sizes" ("N's") and a */
00213 /*  number of matrix "TYPES" are specified.  For each size ("N") */
00214 /*  and each TYPE of matrix, a pair of matrices (A, B) will be generated */
00215 /*  and used for testing. For each matrix pair, the following 13 tests */
00216 /*  will be performed and compared with the threshhold THRESH except */
00217 /*  the tests (5), (11) and (13). */
00218 
00219 
00220 /*  (1)   | A - Q S Z' | / ( |A| n ulp ) (no sorting of eigenvalues) */
00221 
00222 
00223 /*  (2)   | B - Q T Z' | / ( |B| n ulp ) (no sorting of eigenvalues) */
00224 
00225 
00226 /*  (3)   | I - QQ' | / ( n ulp ) (no sorting of eigenvalues) */
00227 
00228 
00229 /*  (4)   | I - ZZ' | / ( n ulp ) (no sorting of eigenvalues) */
00230 
00231 /*  (5)   if A is in Schur form (i.e. quasi-triangular form) */
00232 /*        (no sorting of eigenvalues) */
00233 
00234 /*  (6)   if eigenvalues = diagonal blocks of the Schur form (S, T), */
00235 /*        i.e., test the maximum over j of D(j)  where: */
00236 
00237 /*        if alpha(j) is real: */
00238 /*                      |alpha(j) - S(j,j)|        |beta(j) - T(j,j)| */
00239 /*            D(j) = ------------------------ + ----------------------- */
00240 /*                   max(|alpha(j)|,|S(j,j)|)   max(|beta(j)|,|T(j,j)|) */
00241 
00242 /*        if alpha(j) is complex: */
00243 /*                                  | det( s S - w T ) | */
00244 /*            D(j) = --------------------------------------------------- */
00245 /*                   ulp max( s norm(S), |w| norm(T) )*norm( s S - w T ) */
00246 
00247 /*        and S and T are here the 2 x 2 diagonal blocks of S and T */
00248 /*        corresponding to the j-th and j+1-th eigenvalues. */
00249 /*        (no sorting of eigenvalues) */
00250 
00251 /*  (7)   | (A,B) - Q (S,T) Z' | / ( | (A,B) | n ulp ) */
00252 /*             (with sorting of eigenvalues). */
00253 
00254 /*  (8)   | I - QQ' | / ( n ulp ) (with sorting of eigenvalues). */
00255 
00256 /*  (9)   | I - ZZ' | / ( n ulp ) (with sorting of eigenvalues). */
00257 
00258 /*  (10)  if A is in Schur form (i.e. quasi-triangular form) */
00259 /*        (with sorting of eigenvalues). */
00260 
00261 /*  (11)  if eigenvalues = diagonal blocks of the Schur form (S, T), */
00262 /*        i.e. test the maximum over j of D(j)  where: */
00263 
00264 /*        if alpha(j) is real: */
00265 /*                      |alpha(j) - S(j,j)|        |beta(j) - T(j,j)| */
00266 /*            D(j) = ------------------------ + ----------------------- */
00267 /*                   max(|alpha(j)|,|S(j,j)|)   max(|beta(j)|,|T(j,j)|) */
00268 
00269 /*        if alpha(j) is complex: */
00270 /*                                  | det( s S - w T ) | */
00271 /*            D(j) = --------------------------------------------------- */
00272 /*                   ulp max( s norm(S), |w| norm(T) )*norm( s S - w T ) */
00273 
00274 /*        and S and T are here the 2 x 2 diagonal blocks of S and T */
00275 /*        corresponding to the j-th and j+1-th eigenvalues. */
00276 /*        (with sorting of eigenvalues). */
00277 
00278 /*  (12)  if sorting worked and SDIM is the number of eigenvalues */
00279 /*        which were SELECTed. */
00280 
00281 /*  Test Matrices */
00282 /*  ============= */
00283 
00284 /*  The sizes of the test matrices are specified by an array */
00285 /*  NN(1:NSIZES); the value of each element NN(j) specifies one size. */
00286 /*  The "types" are specified by a logical array DOTYPE( 1:NTYPES ); if */
00287 /*  DOTYPE(j) is .TRUE., then matrix type "j" will be generated. */
00288 /*  Currently, the list of possible types is: */
00289 
00290 /*  (1)  ( 0, 0 )         (a pair of zero matrices) */
00291 
00292 /*  (2)  ( I, 0 )         (an identity and a zero matrix) */
00293 
00294 /*  (3)  ( 0, I )         (an identity and a zero matrix) */
00295 
00296 /*  (4)  ( I, I )         (a pair of identity matrices) */
00297 
00298 /*          t   t */
00299 /*  (5)  ( J , J  )       (a pair of transposed Jordan blocks) */
00300 
00301 /*                                      t                ( I   0  ) */
00302 /*  (6)  ( X, Y )         where  X = ( J   0  )  and Y = (      t ) */
00303 /*                                   ( 0   I  )          ( 0   J  ) */
00304 /*                        and I is a k x k identity and J a (k+1)x(k+1) */
00305 /*                        Jordan block; k=(N-1)/2 */
00306 
00307 /*  (7)  ( D, I )         where D is diag( 0, 1,..., N-1 ) (a diagonal */
00308 /*                        matrix with those diagonal entries.) */
00309 /*  (8)  ( I, D ) */
00310 
00311 /*  (9)  ( big*D, small*I ) where "big" is near overflow and small=1/big */
00312 
00313 /*  (10) ( small*D, big*I ) */
00314 
00315 /*  (11) ( big*I, small*D ) */
00316 
00317 /*  (12) ( small*I, big*D ) */
00318 
00319 /*  (13) ( big*D, big*I ) */
00320 
00321 /*  (14) ( small*D, small*I ) */
00322 
00323 /*  (15) ( D1, D2 )        where D1 is diag( 0, 0, 1, ..., N-3, 0 ) and */
00324 /*                         D2 is diag( 0, N-3, N-4,..., 1, 0, 0 ) */
00325 /*            t   t */
00326 /*  (16) Q ( J , J ) Z     where Q and Z are random orthogonal matrices. */
00327 
00328 /*  (17) Q ( T1, T2 ) Z    where T1 and T2 are upper triangular matrices */
00329 /*                         with random O(1) entries above the diagonal */
00330 /*                         and diagonal entries diag(T1) = */
00331 /*                         ( 0, 0, 1, ..., N-3, 0 ) and diag(T2) = */
00332 /*                         ( 0, N-3, N-4,..., 1, 0, 0 ) */
00333 
00334 /*  (18) Q ( T1, T2 ) Z    diag(T1) = ( 0, 0, 1, 1, s, ..., s, 0 ) */
00335 /*                         diag(T2) = ( 0, 1, 0, 1,..., 1, 0 ) */
00336 /*                         s = machine precision. */
00337 
00338 /*  (19) Q ( T1, T2 ) Z    diag(T1)=( 0,0,1,1, 1-d, ..., 1-(N-5)*d=s, 0 ) */
00339 /*                         diag(T2) = ( 0, 1, 0, 1, ..., 1, 0 ) */
00340 
00341 /*                                                         N-5 */
00342 /*  (20) Q ( T1, T2 ) Z    diag(T1)=( 0, 0, 1, 1, a, ..., a   =s, 0 ) */
00343 /*                         diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 ) */
00344 
00345 /*  (21) Q ( T1, T2 ) Z    diag(T1)=( 0, 0, 1, r1, r2, ..., r(N-4), 0 ) */
00346 /*                         diag(T2) = ( 0, 1, 0, 1, ..., 1, 0, 0 ) */
00347 /*                         where r1,..., r(N-4) are random. */
00348 
00349 /*  (22) Q ( big*T1, small*T2 ) Z    diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) */
00350 /*                                   diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00351 
00352 /*  (23) Q ( small*T1, big*T2 ) Z    diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) */
00353 /*                                   diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00354 
00355 /*  (24) Q ( small*T1, small*T2 ) Z  diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) */
00356 /*                                   diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00357 
00358 /*  (25) Q ( big*T1, big*T2 ) Z      diag(T1) = ( 0, 0, 1, ..., N-3, 0 ) */
00359 /*                                   diag(T2) = ( 0, 1, ..., 1, 0, 0 ) */
00360 
00361 /*  (26) Q ( T1, T2 ) Z     where T1 and T2 are random upper-triangular */
00362 /*                          matrices. */
00363 
00364 
00365 /*  Arguments */
00366 /*  ========= */
00367 
00368 /*  NSIZES  (input) INTEGER */
00369 /*          The number of sizes of matrices to use.  If it is zero, */
00370 /*          SDRGES does nothing.  NSIZES >= 0. */
00371 
00372 /*  NN      (input) INTEGER array, dimension (NSIZES) */
00373 /*          An array containing the sizes to be used for the matrices. */
00374 /*          Zero values will be skipped.  NN >= 0. */
00375 
00376 /*  NTYPES  (input) INTEGER */
00377 /*          The number of elements in DOTYPE.   If it is zero, SDRGES */
00378 /*          does nothing.  It must be at least zero.  If it is MAXTYP+1 */
00379 /*          and NSIZES is 1, then an additional type, MAXTYP+1 is */
00380 /*          defined, which is to use whatever matrix is in A on input. */
00381 /*          This is only useful if DOTYPE(1:MAXTYP) is .FALSE. and */
00382 /*          DOTYPE(MAXTYP+1) is .TRUE. . */
00383 
00384 /*  DOTYPE  (input) LOGICAL array, dimension (NTYPES) */
00385 /*          If DOTYPE(j) is .TRUE., then for each size in NN a */
00386 /*          matrix of that size and of type j will be generated. */
00387 /*          If NTYPES is smaller than the maximum number of types */
00388 /*          defined (PARAMETER MAXTYP), then types NTYPES+1 through */
00389 /*          MAXTYP will not be generated. If NTYPES is larger */
00390 /*          than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES) */
00391 /*          will be ignored. */
00392 
00393 /*  ISEED   (input/output) INTEGER array, dimension (4) */
00394 /*          On entry ISEED specifies the seed of the random number */
00395 /*          generator. The array elements should be between 0 and 4095; */
00396 /*          if not they will be reduced mod 4096. Also, ISEED(4) must */
00397 /*          be odd.  The random number generator uses a linear */
00398 /*          congruential sequence limited to small integers, and so */
00399 /*          should produce machine independent random numbers. The */
00400 /*          values of ISEED are changed on exit, and can be used in the */
00401 /*          next call to SDRGES to continue the same random number */
00402 /*          sequence. */
00403 
00404 /*  THRESH  (input) REAL */
00405 /*          A test will count as "failed" if the "error", computed as */
00406 /*          described above, exceeds THRESH.  Note that the error is */
00407 /*          scaled to be O(1), so THRESH should be a reasonably small */
00408 /*          multiple of 1, e.g., 10 or 100.  In particular, it should */
00409 /*          not depend on the precision (single vs. double) or the size */
00410 /*          of the matrix.  THRESH >= 0. */
00411 
00412 /*  NOUNIT  (input) INTEGER */
00413 /*          The FORTRAN unit number for printing out error messages */
00414 /*          (e.g., if a routine returns IINFO not equal to 0.) */
00415 
00416 /*  A       (input/workspace) REAL array, */
00417 /*                                       dimension(LDA, max(NN)) */
00418 /*          Used to hold the original A matrix.  Used as input only */
00419 /*          if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and */
00420 /*          DOTYPE(MAXTYP+1)=.TRUE. */
00421 
00422 /*  LDA     (input) INTEGER */
00423 /*          The leading dimension of A, B, S, and T. */
00424 /*          It must be at least 1 and at least max( NN ). */
00425 
00426 /*  B       (input/workspace) REAL array, */
00427 /*                                       dimension(LDA, max(NN)) */
00428 /*          Used to hold the original B matrix.  Used as input only */
00429 /*          if NTYPES=MAXTYP+1, DOTYPE(1:MAXTYP)=.FALSE., and */
00430 /*          DOTYPE(MAXTYP+1)=.TRUE. */
00431 
00432 /*  S       (workspace) REAL array, dimension (LDA, max(NN)) */
00433 /*          The Schur form matrix computed from A by SGGES.  On exit, S */
00434 /*          contains the Schur form matrix corresponding to the matrix */
00435 /*          in A. */
00436 
00437 /*  T       (workspace) REAL array, dimension (LDA, max(NN)) */
00438 /*          The upper triangular matrix computed from B by SGGES. */
00439 
00440 /*  Q       (workspace) REAL array, dimension (LDQ, max(NN)) */
00441 /*          The (left) orthogonal matrix computed by SGGES. */
00442 
00443 /*  LDQ     (input) INTEGER */
00444 /*          The leading dimension of Q and Z. It must */
00445 /*          be at least 1 and at least max( NN ). */
00446 
00447 /*  Z       (workspace) REAL array, dimension( LDQ, max(NN) ) */
00448 /*          The (right) orthogonal matrix computed by SGGES. */
00449 
00450 /*  ALPHAR  (workspace) REAL array, dimension (max(NN)) */
00451 /*  ALPHAI  (workspace) REAL array, dimension (max(NN)) */
00452 /*  BETA    (workspace) REAL array, dimension (max(NN)) */
00453 /*          The generalized eigenvalues of (A,B) computed by SGGES. */
00454 /*          ( ALPHAR(k)+ALPHAI(k)*i ) / BETA(k) is the k-th */
00455 /*          generalized eigenvalue of A and B. */
00456 
00457 /*  WORK    (workspace) REAL array, dimension (LWORK) */
00458 
00459 /*  LWORK   (input) INTEGER */
00460 /*          The dimension of the array WORK. */
00461 /*          LWORK >= MAX( 10*(N+1), 3*N*N ), where N is the largest */
00462 /*          matrix dimension. */
00463 
00464 /*  RESULT  (output) REAL array, dimension (15) */
00465 /*          The values computed by the tests described above. */
00466 /*          The values are currently limited to 1/ulp, to avoid overflow. */
00467 
00468 /*  BWORK   (workspace) LOGICAL array, dimension (N) */
00469 
00470 /*  INFO    (output) INTEGER */
00471 /*          = 0:  successful exit */
00472 /*          < 0:  if INFO = -i, the i-th argument had an illegal value. */
00473 /*          > 0:  A routine returned an error code.  INFO is the */
00474 /*                absolute value of the INFO value returned. */
00475 
00476 /*  ===================================================================== */
00477 
00478 /*     .. Parameters .. */
00479 /*     .. */
00480 /*     .. Local Scalars .. */
00481 /*     .. */
00482 /*     .. Local Arrays .. */
00483 /*     .. */
00484 /*     .. External Functions .. */
00485 /*     .. */
00486 /*     .. External Subroutines .. */
00487 /*     .. */
00488 /*     .. Intrinsic Functions .. */
00489 /*     .. */
00490 /*     .. Data statements .. */
00491     /* Parameter adjustments */
00492     --nn;
00493     --dotype;
00494     --iseed;
00495     t_dim1 = *lda;
00496     t_offset = 1 + t_dim1;
00497     t -= t_offset;
00498     s_dim1 = *lda;
00499     s_offset = 1 + s_dim1;
00500     s -= s_offset;
00501     b_dim1 = *lda;
00502     b_offset = 1 + b_dim1;
00503     b -= b_offset;
00504     a_dim1 = *lda;
00505     a_offset = 1 + a_dim1;
00506     a -= a_offset;
00507     z_dim1 = *ldq;
00508     z_offset = 1 + z_dim1;
00509     z__ -= z_offset;
00510     q_dim1 = *ldq;
00511     q_offset = 1 + q_dim1;
00512     q -= q_offset;
00513     --alphar;
00514     --alphai;
00515     --beta;
00516     --work;
00517     --result;
00518     --bwork;
00519 
00520     /* Function Body */
00521 /*     .. */
00522 /*     .. Executable Statements .. */
00523 
00524 /*     Check for errors */
00525 
00526     *info = 0;
00527 
00528     badnn = FALSE_;
00529     nmax = 1;
00530     i__1 = *nsizes;
00531     for (j = 1; j <= i__1; ++j) {
00532 /* Computing MAX */
00533         i__2 = nmax, i__3 = nn[j];
00534         nmax = max(i__2,i__3);
00535         if (nn[j] < 0) {
00536             badnn = TRUE_;
00537         }
00538 /* L10: */
00539     }
00540 
00541     if (*nsizes < 0) {
00542         *info = -1;
00543     } else if (badnn) {
00544         *info = -2;
00545     } else if (*ntypes < 0) {
00546         *info = -3;
00547     } else if (*thresh < 0.f) {
00548         *info = -6;
00549     } else if (*lda <= 1 || *lda < nmax) {
00550         *info = -9;
00551     } else if (*ldq <= 1 || *ldq < nmax) {
00552         *info = -14;
00553     }
00554 
00555 /*     Compute workspace */
00556 /*      (Note: Comments in the code beginning "Workspace:" describe the */
00557 /*       minimal amount of workspace needed at that point in the code, */
00558 /*       as well as the preferred amount for good performance. */
00559 /*       NB refers to the optimal block size for the immediately */
00560 /*       following subroutine, as returned by ILAENV. */
00561 
00562     minwrk = 1;
00563     if (*info == 0 && *lwork >= 1) {
00564 /* Computing MAX */
00565         i__1 = (nmax + 1) * 10, i__2 = nmax * 3 * nmax;
00566         minwrk = max(i__1,i__2);
00567 /* Computing MAX */
00568         i__1 = 1, i__2 = ilaenv_(&c__1, "SGEQRF", " ", &nmax, &nmax, &c_n1, &
00569                 c_n1), i__1 = max(i__1,i__2), i__2 = 
00570                 ilaenv_(&c__1, "SORMQR", "LT", &nmax, &nmax, &nmax, &c_n1), i__1 = max(i__1,i__2), i__2 = ilaenv_(&
00571                 c__1, "SORGQR", " ", &nmax, &nmax, &nmax, &c_n1);
00572         nb = max(i__1,i__2);
00573 /* Computing MAX */
00574         i__1 = (nmax + 1) * 10, i__2 = (nmax << 1) + nmax * nb, i__1 = max(
00575                 i__1,i__2), i__2 = nmax * 3 * nmax;
00576         maxwrk = max(i__1,i__2);
00577         work[1] = (real) maxwrk;
00578     }
00579 
00580     if (*lwork < minwrk) {
00581         *info = -20;
00582     }
00583 
00584     if (*info != 0) {
00585         i__1 = -(*info);
00586         xerbla_("SDRGES", &i__1);
00587         return 0;
00588     }
00589 
00590 /*     Quick return if possible */
00591 
00592     if (*nsizes == 0 || *ntypes == 0) {
00593         return 0;
00594     }
00595 
00596     safmin = slamch_("Safe minimum");
00597     ulp = slamch_("Epsilon") * slamch_("Base");
00598     safmin /= ulp;
00599     safmax = 1.f / safmin;
00600     slabad_(&safmin, &safmax);
00601     ulpinv = 1.f / ulp;
00602 
00603 /*     The values RMAGN(2:3) depend on N, see below. */
00604 
00605     rmagn[0] = 0.f;
00606     rmagn[1] = 1.f;
00607 
00608 /*     Loop over matrix sizes */
00609 
00610     ntestt = 0;
00611     nerrs = 0;
00612     nmats = 0;
00613 
00614     i__1 = *nsizes;
00615     for (jsize = 1; jsize <= i__1; ++jsize) {
00616         n = nn[jsize];
00617         n1 = max(1,n);
00618         rmagn[2] = safmax * ulp / (real) n1;
00619         rmagn[3] = safmin * ulpinv * (real) n1;
00620 
00621         if (*nsizes != 1) {
00622             mtypes = min(26,*ntypes);
00623         } else {
00624             mtypes = min(27,*ntypes);
00625         }
00626 
00627 /*        Loop over matrix types */
00628 
00629         i__2 = mtypes;
00630         for (jtype = 1; jtype <= i__2; ++jtype) {
00631             if (! dotype[jtype]) {
00632                 goto L180;
00633             }
00634             ++nmats;
00635             ntest = 0;
00636 
00637 /*           Save ISEED in case of an error. */
00638 
00639             for (j = 1; j <= 4; ++j) {
00640                 ioldsd[j - 1] = iseed[j];
00641 /* L20: */
00642             }
00643 
00644 /*           Initialize RESULT */
00645 
00646             for (j = 1; j <= 13; ++j) {
00647                 result[j] = 0.f;
00648 /* L30: */
00649             }
00650 
00651 /*           Generate test matrices A and B */
00652 
00653 /*           Description of control parameters: */
00654 
00655 /*           KCLASS: =1 means w/o rotation, =2 means w/ rotation, */
00656 /*                   =3 means random. */
00657 /*           KATYPE: the "type" to be passed to SLATM4 for computing A. */
00658 /*           KAZERO: the pattern of zeros on the diagonal for A: */
00659 /*                   =1: ( xxx ), =2: (0, xxx ) =3: ( 0, 0, xxx, 0 ), */
00660 /*                   =4: ( 0, xxx, 0, 0 ), =5: ( 0, 0, 1, xxx, 0 ), */
00661 /*                   =6: ( 0, 1, 0, xxx, 0 ).  (xxx means a string of */
00662 /*                   non-zero entries.) */
00663 /*           KAMAGN: the magnitude of the matrix: =0: zero, =1: O(1), */
00664 /*                   =2: large, =3: small. */
00665 /*           IASIGN: 1 if the diagonal elements of A are to be */
00666 /*                   multiplied by a random magnitude 1 number, =2 if */
00667 /*                   randomly chosen diagonal blocks are to be rotated */
00668 /*                   to form 2x2 blocks. */
00669 /*           KBTYPE, KBZERO, KBMAGN, IBSIGN: the same, but for B. */
00670 /*           KTRIAN: =0: don't fill in the upper triangle, =1: do. */
00671 /*           KZ1, KZ2, KADD: used to implement KAZERO and KBZERO. */
00672 /*           RMAGN: used to implement KAMAGN and KBMAGN. */
00673 
00674             if (mtypes > 26) {
00675                 goto L110;
00676             }
00677             iinfo = 0;
00678             if (kclass[jtype - 1] < 3) {
00679 
00680 /*              Generate A (w/o rotation) */
00681 
00682                 if ((i__3 = katype[jtype - 1], abs(i__3)) == 3) {
00683                     in = ((n - 1) / 2 << 1) + 1;
00684                     if (in != n) {
00685                         slaset_("Full", &n, &n, &c_b26, &c_b26, &a[a_offset], 
00686                                 lda);
00687                     }
00688                 } else {
00689                     in = n;
00690                 }
00691                 slatm4_(&katype[jtype - 1], &in, &kz1[kazero[jtype - 1] - 1], 
00692                         &kz2[kazero[jtype - 1] - 1], &iasign[jtype - 1], &
00693                         rmagn[kamagn[jtype - 1]], &ulp, &rmagn[ktrian[jtype - 
00694                         1] * kamagn[jtype - 1]], &c__2, &iseed[1], &a[
00695                         a_offset], lda);
00696                 iadd = kadd[kazero[jtype - 1] - 1];
00697                 if (iadd > 0 && iadd <= n) {
00698                     a[iadd + iadd * a_dim1] = 1.f;
00699                 }
00700 
00701 /*              Generate B (w/o rotation) */
00702 
00703                 if ((i__3 = kbtype[jtype - 1], abs(i__3)) == 3) {
00704                     in = ((n - 1) / 2 << 1) + 1;
00705                     if (in != n) {
00706                         slaset_("Full", &n, &n, &c_b26, &c_b26, &b[b_offset], 
00707                                 lda);
00708                     }
00709                 } else {
00710                     in = n;
00711                 }
00712                 slatm4_(&kbtype[jtype - 1], &in, &kz1[kbzero[jtype - 1] - 1], 
00713                         &kz2[kbzero[jtype - 1] - 1], &ibsign[jtype - 1], &
00714                         rmagn[kbmagn[jtype - 1]], &c_b32, &rmagn[ktrian[jtype 
00715                         - 1] * kbmagn[jtype - 1]], &c__2, &iseed[1], &b[
00716                         b_offset], lda);
00717                 iadd = kadd[kbzero[jtype - 1] - 1];
00718                 if (iadd != 0 && iadd <= n) {
00719                     b[iadd + iadd * b_dim1] = 1.f;
00720                 }
00721 
00722                 if (kclass[jtype - 1] == 2 && n > 0) {
00723 
00724 /*                 Include rotations */
00725 
00726 /*                 Generate Q, Z as Householder transformations times */
00727 /*                 a diagonal matrix. */
00728 
00729                     i__3 = n - 1;
00730                     for (jc = 1; jc <= i__3; ++jc) {
00731                         i__4 = n;
00732                         for (jr = jc; jr <= i__4; ++jr) {
00733                             q[jr + jc * q_dim1] = slarnd_(&c__3, &iseed[1]);
00734                             z__[jr + jc * z_dim1] = slarnd_(&c__3, &iseed[1]);
00735 /* L40: */
00736                         }
00737                         i__4 = n + 1 - jc;
00738                         slarfg_(&i__4, &q[jc + jc * q_dim1], &q[jc + 1 + jc * 
00739                                 q_dim1], &c__1, &work[jc]);
00740                         work[(n << 1) + jc] = r_sign(&c_b32, &q[jc + jc * 
00741                                 q_dim1]);
00742                         q[jc + jc * q_dim1] = 1.f;
00743                         i__4 = n + 1 - jc;
00744                         slarfg_(&i__4, &z__[jc + jc * z_dim1], &z__[jc + 1 + 
00745                                 jc * z_dim1], &c__1, &work[n + jc]);
00746                         work[n * 3 + jc] = r_sign(&c_b32, &z__[jc + jc * 
00747                                 z_dim1]);
00748                         z__[jc + jc * z_dim1] = 1.f;
00749 /* L50: */
00750                     }
00751                     q[n + n * q_dim1] = 1.f;
00752                     work[n] = 0.f;
00753                     r__1 = slarnd_(&c__2, &iseed[1]);
00754                     work[n * 3] = r_sign(&c_b32, &r__1);
00755                     z__[n + n * z_dim1] = 1.f;
00756                     work[n * 2] = 0.f;
00757                     r__1 = slarnd_(&c__2, &iseed[1]);
00758                     work[n * 4] = r_sign(&c_b32, &r__1);
00759 
00760 /*                 Apply the diagonal matrices */
00761 
00762                     i__3 = n;
00763                     for (jc = 1; jc <= i__3; ++jc) {
00764                         i__4 = n;
00765                         for (jr = 1; jr <= i__4; ++jr) {
00766                             a[jr + jc * a_dim1] = work[(n << 1) + jr] * work[
00767                                     n * 3 + jc] * a[jr + jc * a_dim1];
00768                             b[jr + jc * b_dim1] = work[(n << 1) + jr] * work[
00769                                     n * 3 + jc] * b[jr + jc * b_dim1];
00770 /* L60: */
00771                         }
00772 /* L70: */
00773                     }
00774                     i__3 = n - 1;
00775                     sorm2r_("L", "N", &n, &n, &i__3, &q[q_offset], ldq, &work[
00776                             1], &a[a_offset], lda, &work[(n << 1) + 1], &
00777                             iinfo);
00778                     if (iinfo != 0) {
00779                         goto L100;
00780                     }
00781                     i__3 = n - 1;
00782                     sorm2r_("R", "T", &n, &n, &i__3, &z__[z_offset], ldq, &
00783                             work[n + 1], &a[a_offset], lda, &work[(n << 1) + 
00784                             1], &iinfo);
00785                     if (iinfo != 0) {
00786                         goto L100;
00787                     }
00788                     i__3 = n - 1;
00789                     sorm2r_("L", "N", &n, &n, &i__3, &q[q_offset], ldq, &work[
00790                             1], &b[b_offset], lda, &work[(n << 1) + 1], &
00791                             iinfo);
00792                     if (iinfo != 0) {
00793                         goto L100;
00794                     }
00795                     i__3 = n - 1;
00796                     sorm2r_("R", "T", &n, &n, &i__3, &z__[z_offset], ldq, &
00797                             work[n + 1], &b[b_offset], lda, &work[(n << 1) + 
00798                             1], &iinfo);
00799                     if (iinfo != 0) {
00800                         goto L100;
00801                     }
00802                 }
00803             } else {
00804 
00805 /*              Random matrices */
00806 
00807                 i__3 = n;
00808                 for (jc = 1; jc <= i__3; ++jc) {
00809                     i__4 = n;
00810                     for (jr = 1; jr <= i__4; ++jr) {
00811                         a[jr + jc * a_dim1] = rmagn[kamagn[jtype - 1]] * 
00812                                 slarnd_(&c__2, &iseed[1]);
00813                         b[jr + jc * b_dim1] = rmagn[kbmagn[jtype - 1]] * 
00814                                 slarnd_(&c__2, &iseed[1]);
00815 /* L80: */
00816                     }
00817 /* L90: */
00818                 }
00819             }
00820 
00821 L100:
00822 
00823             if (iinfo != 0) {
00824                 io___40.ciunit = *nounit;
00825                 s_wsfe(&io___40);
00826                 do_fio(&c__1, "Generator", (ftnlen)9);
00827                 do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00828                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00829                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00830                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer));
00831                 e_wsfe();
00832                 *info = abs(iinfo);
00833                 return 0;
00834             }
00835 
00836 L110:
00837 
00838             for (i__ = 1; i__ <= 13; ++i__) {
00839                 result[i__] = -1.f;
00840 /* L120: */
00841             }
00842 
00843 /*           Test with and without sorting of eigenvalues */
00844 
00845             for (isort = 0; isort <= 1; ++isort) {
00846                 if (isort == 0) {
00847                     *(unsigned char *)sort = 'N';
00848                     rsub = 0;
00849                 } else {
00850                     *(unsigned char *)sort = 'S';
00851                     rsub = 5;
00852                 }
00853 
00854 /*              Call SGGES to compute H, T, Q, Z, alpha, and beta. */
00855 
00856                 slacpy_("Full", &n, &n, &a[a_offset], lda, &s[s_offset], lda);
00857                 slacpy_("Full", &n, &n, &b[b_offset], lda, &t[t_offset], lda);
00858                 ntest = rsub + 1 + isort;
00859                 result[rsub + 1 + isort] = ulpinv;
00860                 sgges_("V", "V", sort, (L_fp)slctes_, &n, &s[s_offset], lda, &
00861                         t[t_offset], lda, &sdim, &alphar[1], &alphai[1], &
00862                         beta[1], &q[q_offset], ldq, &z__[z_offset], ldq, &
00863                         work[1], lwork, &bwork[1], &iinfo);
00864                 if (iinfo != 0 && iinfo != n + 2) {
00865                     result[rsub + 1 + isort] = ulpinv;
00866                     io___46.ciunit = *nounit;
00867                     s_wsfe(&io___46);
00868                     do_fio(&c__1, "SGGES", (ftnlen)5);
00869                     do_fio(&c__1, (char *)&iinfo, (ftnlen)sizeof(integer));
00870                     do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00871                     do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer));
00872                     do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(integer))
00873                             ;
00874                     e_wsfe();
00875                     *info = abs(iinfo);
00876                     goto L160;
00877                 }
00878 
00879                 ntest = rsub + 4;
00880 
00881 /*              Do tests 1--4 (or tests 7--9 when reordering ) */
00882 
00883                 if (isort == 0) {
00884                     sget51_(&c__1, &n, &a[a_offset], lda, &s[s_offset], lda, &
00885                             q[q_offset], ldq, &z__[z_offset], ldq, &work[1], &
00886                             result[1]);
00887                     sget51_(&c__1, &n, &b[b_offset], lda, &t[t_offset], lda, &
00888                             q[q_offset], ldq, &z__[z_offset], ldq, &work[1], &
00889                             result[2]);
00890                 } else {
00891                     sget54_(&n, &a[a_offset], lda, &b[b_offset], lda, &s[
00892                             s_offset], lda, &t[t_offset], lda, &q[q_offset], 
00893                             ldq, &z__[z_offset], ldq, &work[1], &result[7]);
00894                 }
00895                 sget51_(&c__3, &n, &a[a_offset], lda, &t[t_offset], lda, &q[
00896                         q_offset], ldq, &q[q_offset], ldq, &work[1], &result[
00897                         rsub + 3]);
00898                 sget51_(&c__3, &n, &b[b_offset], lda, &t[t_offset], lda, &z__[
00899                         z_offset], ldq, &z__[z_offset], ldq, &work[1], &
00900                         result[rsub + 4]);
00901 
00902 /*              Do test 5 and 6 (or Tests 10 and 11 when reordering): */
00903 /*              check Schur form of A and compare eigenvalues with */
00904 /*              diagonals. */
00905 
00906                 ntest = rsub + 6;
00907                 temp1 = 0.f;
00908 
00909                 i__3 = n;
00910                 for (j = 1; j <= i__3; ++j) {
00911                     ilabad = FALSE_;
00912                     if (alphai[j] == 0.f) {
00913 /* Computing MAX */
00914                         r__7 = safmin, r__8 = (r__2 = alphar[j], dabs(r__2)), 
00915                                 r__7 = max(r__7,r__8), r__8 = (r__3 = s[j + j 
00916                                 * s_dim1], dabs(r__3));
00917 /* Computing MAX */
00918                         r__9 = safmin, r__10 = (r__5 = beta[j], dabs(r__5)), 
00919                                 r__9 = max(r__9,r__10), r__10 = (r__6 = t[j + 
00920                                 j * t_dim1], dabs(r__6));
00921                         temp2 = ((r__1 = alphar[j] - s[j + j * s_dim1], dabs(
00922                                 r__1)) / dmax(r__7,r__8) + (r__4 = beta[j] - 
00923                                 t[j + j * t_dim1], dabs(r__4)) / dmax(r__9,
00924                                 r__10)) / ulp;
00925 
00926                         if (j < n) {
00927                             if (s[j + 1 + j * s_dim1] != 0.f) {
00928                                 ilabad = TRUE_;
00929                                 result[rsub + 5] = ulpinv;
00930                             }
00931                         }
00932                         if (j > 1) {
00933                             if (s[j + (j - 1) * s_dim1] != 0.f) {
00934                                 ilabad = TRUE_;
00935                                 result[rsub + 5] = ulpinv;
00936                             }
00937                         }
00938 
00939                     } else {
00940                         if (alphai[j] > 0.f) {
00941                             i1 = j;
00942                         } else {
00943                             i1 = j - 1;
00944                         }
00945                         if (i1 <= 0 || i1 >= n) {
00946                             ilabad = TRUE_;
00947                         } else if (i1 < n - 1) {
00948                             if (s[i1 + 2 + (i1 + 1) * s_dim1] != 0.f) {
00949                                 ilabad = TRUE_;
00950                                 result[rsub + 5] = ulpinv;
00951                             }
00952                         } else if (i1 > 1) {
00953                             if (s[i1 + (i1 - 1) * s_dim1] != 0.f) {
00954                                 ilabad = TRUE_;
00955                                 result[rsub + 5] = ulpinv;
00956                             }
00957                         }
00958                         if (! ilabad) {
00959                             sget53_(&s[i1 + i1 * s_dim1], lda, &t[i1 + i1 * 
00960                                     t_dim1], lda, &beta[j], &alphar[j], &
00961                                     alphai[j], &temp2, &ierr);
00962                             if (ierr >= 3) {
00963                                 io___52.ciunit = *nounit;
00964                                 s_wsfe(&io___52);
00965                                 do_fio(&c__1, (char *)&ierr, (ftnlen)sizeof(
00966                                         integer));
00967                                 do_fio(&c__1, (char *)&j, (ftnlen)sizeof(
00968                                         integer));
00969                                 do_fio(&c__1, (char *)&n, (ftnlen)sizeof(
00970                                         integer));
00971                                 do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(
00972                                         integer));
00973                                 do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)
00974                                         sizeof(integer));
00975                                 e_wsfe();
00976                                 *info = abs(ierr);
00977                             }
00978                         } else {
00979                             temp2 = ulpinv;
00980                         }
00981 
00982                     }
00983                     temp1 = dmax(temp1,temp2);
00984                     if (ilabad) {
00985                         io___53.ciunit = *nounit;
00986                         s_wsfe(&io___53);
00987                         do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
00988                         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
00989                         do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
00990                                 ;
00991                         do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
00992                                 integer));
00993                         e_wsfe();
00994                     }
00995 /* L130: */
00996                 }
00997                 result[rsub + 6] = temp1;
00998 
00999                 if (isort >= 1) {
01000 
01001 /*                 Do test 12 */
01002 
01003                     ntest = 12;
01004                     result[12] = 0.f;
01005                     knteig = 0;
01006                     i__3 = n;
01007                     for (i__ = 1; i__ <= i__3; ++i__) {
01008                         r__1 = -alphai[i__];
01009                         if (slctes_(&alphar[i__], &alphai[i__], &beta[i__]) ||
01010                                  slctes_(&alphar[i__], &r__1, &beta[i__])) {
01011                             ++knteig;
01012                         }
01013                         if (i__ < n) {
01014                             r__1 = -alphai[i__ + 1];
01015                             r__2 = -alphai[i__];
01016                             if ((slctes_(&alphar[i__ + 1], &alphai[i__ + 1], &
01017                                     beta[i__ + 1]) || slctes_(&alphar[i__ + 1]
01018 , &r__1, &beta[i__ + 1])) && ! (slctes_(&
01019                                     alphar[i__], &alphai[i__], &beta[i__]) || 
01020                                     slctes_(&alphar[i__], &r__2, &beta[i__])) 
01021                                     && iinfo != n + 2) {
01022                                 result[12] = ulpinv;
01023                             }
01024                         }
01025 /* L140: */
01026                     }
01027                     if (sdim != knteig) {
01028                         result[12] = ulpinv;
01029                     }
01030                 }
01031 
01032 /* L150: */
01033             }
01034 
01035 /*           End of Loop -- Check for RESULT(j) > THRESH */
01036 
01037 L160:
01038 
01039             ntestt += ntest;
01040 
01041 /*           Print out tests which fail. */
01042 
01043             i__3 = ntest;
01044             for (jr = 1; jr <= i__3; ++jr) {
01045                 if (result[jr] >= *thresh) {
01046 
01047 /*                 If this is the first test to fail, */
01048 /*                 print a header to the data file. */
01049 
01050                     if (nerrs == 0) {
01051                         io___55.ciunit = *nounit;
01052                         s_wsfe(&io___55);
01053                         do_fio(&c__1, "SGS", (ftnlen)3);
01054                         e_wsfe();
01055 
01056 /*                    Matrix types */
01057 
01058                         io___56.ciunit = *nounit;
01059                         s_wsfe(&io___56);
01060                         e_wsfe();
01061                         io___57.ciunit = *nounit;
01062                         s_wsfe(&io___57);
01063                         e_wsfe();
01064                         io___58.ciunit = *nounit;
01065                         s_wsfe(&io___58);
01066                         do_fio(&c__1, "Orthogonal", (ftnlen)10);
01067                         e_wsfe();
01068 
01069 /*                    Tests performed */
01070 
01071                         io___59.ciunit = *nounit;
01072                         s_wsfe(&io___59);
01073                         do_fio(&c__1, "orthogonal", (ftnlen)10);
01074                         do_fio(&c__1, "'", (ftnlen)1);
01075                         do_fio(&c__1, "transpose", (ftnlen)9);
01076                         for (j = 1; j <= 8; ++j) {
01077                             do_fio(&c__1, "'", (ftnlen)1);
01078                         }
01079                         e_wsfe();
01080 
01081                     }
01082                     ++nerrs;
01083                     if (result[jr] < 1e4f) {
01084                         io___60.ciunit = *nounit;
01085                         s_wsfe(&io___60);
01086                         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01087                         do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01088                                 ;
01089                         do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01090                                 integer));
01091                         do_fio(&c__1, (char *)&jr, (ftnlen)sizeof(integer));
01092                         do_fio(&c__1, (char *)&result[jr], (ftnlen)sizeof(
01093                                 real));
01094                         e_wsfe();
01095                     } else {
01096                         io___61.ciunit = *nounit;
01097                         s_wsfe(&io___61);
01098                         do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
01099                         do_fio(&c__1, (char *)&jtype, (ftnlen)sizeof(integer))
01100                                 ;
01101                         do_fio(&c__4, (char *)&ioldsd[0], (ftnlen)sizeof(
01102                                 integer));
01103                         do_fio(&c__1, (char *)&jr, (ftnlen)sizeof(integer));
01104                         do_fio(&c__1, (char *)&result[jr], (ftnlen)sizeof(
01105                                 real));
01106                         e_wsfe();
01107                     }
01108                 }
01109 /* L170: */
01110             }
01111 
01112 L180:
01113             ;
01114         }
01115 /* L190: */
01116     }
01117 
01118 /*     Summary */
01119 
01120     alasvm_("SGS", nounit, &nerrs, &ntestt, &c__0);
01121 
01122     work[1] = (real) maxwrk;
01123 
01124     return 0;
01125 
01126 
01127 
01128 
01129 
01130 
01131 
01132 
01133 /*     End of SDRGES */
01134 
01135 } /* sdrges_ */


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