PageRenderTime 24ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/contrib/clapack-3.2.1-CMAKE/TESTING/EIG/ddrgvx.c

http://github.com/openmeeg/openmeeg
C | 969 lines | 607 code | 152 blank | 210 comment | 112 complexity | 846306b857c6ab00a9487360a6e1d7e6 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. /* ddrgvx.f -- translated by f2c (version 20061008).
  2. You must link the resulting object file with libf2c:
  3. on Microsoft Windows system, link with libf2c.lib;
  4. on Linux or Unix systems, link with .../path/to/libf2c.a -lm
  5. or, if you install libf2c.a in a standard place, with -lf2c -lm
  6. -- in that order, at the end of the command line, as in
  7. cc *.o -lf2c -lm
  8. Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
  9. http://www.netlib.org/f2c/libf2c.zip
  10. */
  11. #include "f2c.h"
  12. #include "blaswrap.h"
  13. /* Table of constant values */
  14. static integer c__1 = 1;
  15. static integer c__0 = 0;
  16. static integer c__5 = 5;
  17. static logical c_true = TRUE_;
  18. static logical c_false = FALSE_;
  19. static integer c__3 = 3;
  20. /* Subroutine */ int ddrgvx_(integer *nsize, doublereal *thresh, integer *nin,
  21. integer *nout, doublereal *a, integer *lda, doublereal *b,
  22. doublereal *ai, doublereal *bi, doublereal *alphar, doublereal *
  23. alphai, doublereal *beta, doublereal *vl, doublereal *vr, integer *
  24. ilo, integer *ihi, doublereal *lscale, doublereal *rscale, doublereal
  25. *s, doublereal *dtru, doublereal *dif, doublereal *diftru, doublereal
  26. *work, integer *lwork, integer *iwork, integer *liwork, doublereal *
  27. result, logical *bwork, integer *info)
  28. {
  29. /* Format strings */
  30. static char fmt_9999[] = "(\002 DDRGVX: \002,a,\002 returned INFO=\002,i"
  31. "6,\002.\002,/9x,\002N=\002,i6,\002, JTYPE=\002,i6,\002)\002)";
  32. static char fmt_9998[] = "(\002 DDRGVX: \002,a,\002 Eigenvectors from"
  33. " \002,a,\002 incorrectly \002,\002normalized.\002,/\002 Bits of "
  34. "error=\002,0p,g10.3,\002,\002,9x,\002N=\002,i6,\002, JTYPE=\002,"
  35. "i6,\002, IWA=\002,i5,\002, IWB=\002,i5,\002, IWX=\002,i5,\002, I"
  36. "WY=\002,i5)";
  37. static char fmt_9997[] = "(/1x,a3,\002 -- Real Expert Eigenvalue/vecto"
  38. "r\002,\002 problem driver\002)";
  39. static char fmt_9995[] = "(\002 Matrix types: \002,/)";
  40. static char fmt_9994[] = "(\002 TYPE 1: Da is diagonal, Db is identity,"
  41. " \002,/\002 A = Y^(-H) Da X^(-1), B = Y^(-H) Db X^(-1) \002,/"
  42. "\002 YH and X are left and right eigenvectors. \002,/)";
  43. static char fmt_9993[] = "(\002 TYPE 2: Da is quasi-diagonal, Db is iden"
  44. "tity, \002,/\002 A = Y^(-H) Da X^(-1), B = Y^(-H) Db X^(-1)"
  45. " \002,/\002 YH and X are left and right eigenvectors. \002,/)"
  46. ;
  47. static char fmt_9992[] = "(/\002 Tests performed: \002,/4x,\002 a is al"
  48. "pha, b is beta, l is a left eigenvector, \002,/4x,\002 r is a ri"
  49. "ght eigenvector and \002,a,\002 means \002,a,\002.\002,/\002 1 ="
  50. " max | ( b A - a B )\002,a,\002 l | / const.\002,/\002 2 = max |"
  51. " ( b A - a B ) r | / const.\002,/\002 3 = max ( Sest/Stru, Stru/"
  52. "Sest ) \002,\002 over all eigenvalues\002,/\002 4 = max( DIFest/"
  53. "DIFtru, DIFtru/DIFest ) \002,\002 over the 1st and 5th eigenvect"
  54. "ors\002,/)";
  55. static char fmt_9991[] = "(\002 Type=\002,i2,\002,\002,\002 IWA=\002,i2"
  56. ",\002, IWB=\002,i2,\002, IWX=\002,i2,\002, IWY=\002,i2,\002, res"
  57. "ult \002,i2,\002 is\002,0p,f8.2)";
  58. static char fmt_9990[] = "(\002 Type=\002,i2,\002,\002,\002 IWA=\002,i2"
  59. ",\002, IWB=\002,i2,\002, IWX=\002,i2,\002, IWY=\002,i2,\002, res"
  60. "ult \002,i2,\002 is\002,1p,d10.3)";
  61. static char fmt_9987[] = "(\002 DDRGVX: \002,a,\002 returned INFO=\002,i"
  62. "6,\002.\002,/9x,\002N=\002,i6,\002, Input example #\002,i2,\002"
  63. ")\002)";
  64. static char fmt_9986[] = "(\002 DDRGVX: \002,a,\002 Eigenvectors from"
  65. " \002,a,\002 incorrectly \002,\002normalized.\002,/\002 Bits of "
  66. "error=\002,0p,g10.3,\002,\002,9x,\002N=\002,i6,\002, Input Examp"
  67. "le #\002,i2,\002)\002)";
  68. static char fmt_9996[] = "(\002 Input Example\002)";
  69. static char fmt_9989[] = "(\002 Input example #\002,i2,\002, matrix orde"
  70. "r=\002,i4,\002,\002,\002 result \002,i2,\002 is\002,0p,f8.2)";
  71. static char fmt_9988[] = "(\002 Input example #\002,i2,\002, matrix orde"
  72. "r=\002,i4,\002,\002,\002 result \002,i2,\002 is\002,1p,d10.3)";
  73. /* System generated locals */
  74. integer a_dim1, a_offset, ai_dim1, ai_offset, b_dim1, b_offset, bi_dim1,
  75. bi_offset, vl_dim1, vl_offset, vr_dim1, vr_offset, i__1, i__2;
  76. doublereal d__1, d__2, d__3, d__4;
  77. /* Builtin functions */
  78. double sqrt(doublereal);
  79. integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void),
  80. s_rsle(cilist *), do_lio(integer *, integer *, char *, ftnlen),
  81. e_rsle(void);
  82. /* Local variables */
  83. integer i__, j, n, iwa, iwb;
  84. doublereal ulp;
  85. integer iwx, iwy, nmax;
  86. extern /* Subroutine */ int dget52_(logical *, integer *, doublereal *,
  87. integer *, doublereal *, integer *, doublereal *, integer *,
  88. doublereal *, doublereal *, doublereal *, doublereal *,
  89. doublereal *);
  90. integer linfo;
  91. doublereal anorm, bnorm;
  92. integer nerrs;
  93. extern /* Subroutine */ int dlatm6_(integer *, integer *, doublereal *,
  94. integer *, doublereal *, doublereal *, integer *, doublereal *,
  95. integer *, doublereal *, doublereal *, doublereal *, doublereal *,
  96. doublereal *, doublereal *);
  97. doublereal ratio1, ratio2, thrsh2;
  98. extern doublereal dlamch_(char *), dlange_(char *, integer *,
  99. integer *, doublereal *, integer *, doublereal *);
  100. extern /* Subroutine */ int dlacpy_(char *, integer *, integer *,
  101. doublereal *, integer *, doublereal *, integer *),
  102. xerbla_(char *, integer *);
  103. doublereal abnorm;
  104. extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
  105. integer *, integer *);
  106. extern /* Subroutine */ int alasvm_(char *, integer *, integer *, integer
  107. *, integer *), dggevx_(char *, char *, char *, char *,
  108. integer *, doublereal *, integer *, doublereal *, integer *,
  109. doublereal *, doublereal *, doublereal *, doublereal *, integer *,
  110. doublereal *, integer *, integer *, integer *, doublereal *,
  111. doublereal *, doublereal *, doublereal *, doublereal *,
  112. doublereal *, doublereal *, integer *, integer *, logical *,
  113. integer *);
  114. doublereal weight[5];
  115. integer minwrk, maxwrk, iptype;
  116. doublereal ulpinv;
  117. integer nptknt, ntestt;
  118. /* Fortran I/O blocks */
  119. static cilist io___20 = { 0, 0, 0, fmt_9999, 0 };
  120. static cilist io___22 = { 0, 0, 0, fmt_9998, 0 };
  121. static cilist io___23 = { 0, 0, 0, fmt_9998, 0 };
  122. static cilist io___28 = { 0, 0, 0, fmt_9997, 0 };
  123. static cilist io___29 = { 0, 0, 0, fmt_9995, 0 };
  124. static cilist io___30 = { 0, 0, 0, fmt_9994, 0 };
  125. static cilist io___31 = { 0, 0, 0, fmt_9993, 0 };
  126. static cilist io___32 = { 0, 0, 0, fmt_9992, 0 };
  127. static cilist io___33 = { 0, 0, 0, fmt_9991, 0 };
  128. static cilist io___34 = { 0, 0, 0, fmt_9990, 0 };
  129. static cilist io___35 = { 0, 0, 1, 0, 0 };
  130. static cilist io___36 = { 0, 0, 0, 0, 0 };
  131. static cilist io___37 = { 0, 0, 0, 0, 0 };
  132. static cilist io___38 = { 0, 0, 0, 0, 0 };
  133. static cilist io___39 = { 0, 0, 0, 0, 0 };
  134. static cilist io___40 = { 0, 0, 0, fmt_9987, 0 };
  135. static cilist io___41 = { 0, 0, 0, fmt_9986, 0 };
  136. static cilist io___42 = { 0, 0, 0, fmt_9986, 0 };
  137. static cilist io___43 = { 0, 0, 0, fmt_9997, 0 };
  138. static cilist io___44 = { 0, 0, 0, fmt_9996, 0 };
  139. static cilist io___45 = { 0, 0, 0, fmt_9992, 0 };
  140. static cilist io___46 = { 0, 0, 0, fmt_9989, 0 };
  141. static cilist io___47 = { 0, 0, 0, fmt_9988, 0 };
  142. /* -- LAPACK test routine (version 3.1) -- */
  143. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  144. /* November 2006 */
  145. /* .. Scalar Arguments .. */
  146. /* .. */
  147. /* .. Array Arguments .. */
  148. /* .. */
  149. /* Purpose */
  150. /* ======= */
  151. /* DDRGVX checks the nonsymmetric generalized eigenvalue problem */
  152. /* expert driver DGGEVX. */
  153. /* DGGEVX computes the generalized eigenvalues, (optionally) the left */
  154. /* and/or right eigenvectors, (optionally) computes a balancing */
  155. /* transformation to improve the conditioning, and (optionally) */
  156. /* reciprocal condition numbers for the eigenvalues and eigenvectors. */
  157. /* When DDRGVX is called with NSIZE > 0, two types of test matrix pairs */
  158. /* are generated by the subroutine DLATM6 and test the driver DGGEVX. */
  159. /* The test matrices have the known exact condition numbers for */
  160. /* eigenvalues. For the condition numbers of the eigenvectors */
  161. /* corresponding the first and last eigenvalues are also know */
  162. /* ``exactly'' (see DLATM6). */
  163. /* For each matrix pair, the following tests will be performed and */
  164. /* compared with the threshhold THRESH. */
  165. /* (1) max over all left eigenvalue/-vector pairs (beta/alpha,l) of */
  166. /* | l**H * (beta A - alpha B) | / ( ulp max( |beta A|, |alpha B| ) ) */
  167. /* where l**H is the conjugate tranpose of l. */
  168. /* (2) max over all right eigenvalue/-vector pairs (beta/alpha,r) of */
  169. /* | (beta A - alpha B) r | / ( ulp max( |beta A|, |alpha B| ) ) */
  170. /* (3) The condition number S(i) of eigenvalues computed by DGGEVX */
  171. /* differs less than a factor THRESH from the exact S(i) (see */
  172. /* DLATM6). */
  173. /* (4) DIF(i) computed by DTGSNA differs less than a factor 10*THRESH */
  174. /* from the exact value (for the 1st and 5th vectors only). */
  175. /* Test Matrices */
  176. /* ============= */
  177. /* Two kinds of test matrix pairs */
  178. /* (A, B) = inverse(YH) * (Da, Db) * inverse(X) */
  179. /* are used in the tests: */
  180. /* 1: Da = 1+a 0 0 0 0 Db = 1 0 0 0 0 */
  181. /* 0 2+a 0 0 0 0 1 0 0 0 */
  182. /* 0 0 3+a 0 0 0 0 1 0 0 */
  183. /* 0 0 0 4+a 0 0 0 0 1 0 */
  184. /* 0 0 0 0 5+a , 0 0 0 0 1 , and */
  185. /* 2: Da = 1 -1 0 0 0 Db = 1 0 0 0 0 */
  186. /* 1 1 0 0 0 0 1 0 0 0 */
  187. /* 0 0 1 0 0 0 0 1 0 0 */
  188. /* 0 0 0 1+a 1+b 0 0 0 1 0 */
  189. /* 0 0 0 -1-b 1+a , 0 0 0 0 1 . */
  190. /* In both cases the same inverse(YH) and inverse(X) are used to compute */
  191. /* (A, B), giving the exact eigenvectors to (A,B) as (YH, X): */
  192. /* YH: = 1 0 -y y -y X = 1 0 -x -x x */
  193. /* 0 1 -y y -y 0 1 x -x -x */
  194. /* 0 0 1 0 0 0 0 1 0 0 */
  195. /* 0 0 0 1 0 0 0 0 1 0 */
  196. /* 0 0 0 0 1, 0 0 0 0 1 , where */
  197. /* a, b, x and y will have all values independently of each other from */
  198. /* { sqrt(sqrt(ULP)), 0.1, 1, 10, 1/sqrt(sqrt(ULP)) }. */
  199. /* Arguments */
  200. /* ========= */
  201. /* NSIZE (input) INTEGER */
  202. /* The number of sizes of matrices to use. NSIZE must be at */
  203. /* least zero. If it is zero, no randomly generated matrices */
  204. /* are tested, but any test matrices read from NIN will be */
  205. /* tested. */
  206. /* THRESH (input) DOUBLE PRECISION */
  207. /* A test will count as "failed" if the "error", computed as */
  208. /* described above, exceeds THRESH. Note that the error */
  209. /* is scaled to be O(1), so THRESH should be a reasonably */
  210. /* small multiple of 1, e.g., 10 or 100. In particular, */
  211. /* it should not depend on the precision (single vs. double) */
  212. /* or the size of the matrix. It must be at least zero. */
  213. /* NIN (input) INTEGER */
  214. /* The FORTRAN unit number for reading in the data file of */
  215. /* problems to solve. */
  216. /* NOUT (input) INTEGER */
  217. /* The FORTRAN unit number for printing out error messages */
  218. /* (e.g., if a routine returns IINFO not equal to 0.) */
  219. /* A (workspace) DOUBLE PRECISION array, dimension (LDA, NSIZE) */
  220. /* Used to hold the matrix whose eigenvalues are to be */
  221. /* computed. On exit, A contains the last matrix actually used. */
  222. /* LDA (input) INTEGER */
  223. /* The leading dimension of A, B, AI, BI, Ao, and Bo. */
  224. /* It must be at least 1 and at least NSIZE. */
  225. /* B (workspace) DOUBLE PRECISION array, dimension (LDA, NSIZE) */
  226. /* Used to hold the matrix whose eigenvalues are to be */
  227. /* computed. On exit, B contains the last matrix actually used. */
  228. /* AI (workspace) DOUBLE PRECISION array, dimension (LDA, NSIZE) */
  229. /* Copy of A, modified by DGGEVX. */
  230. /* BI (workspace) DOUBLE PRECISION array, dimension (LDA, NSIZE) */
  231. /* Copy of B, modified by DGGEVX. */
  232. /* ALPHAR (workspace) DOUBLE PRECISION array, dimension (NSIZE) */
  233. /* ALPHAI (workspace) DOUBLE PRECISION array, dimension (NSIZE) */
  234. /* BETA (workspace) DOUBLE PRECISION array, dimension (NSIZE) */
  235. /* On exit, (ALPHAR + ALPHAI*i)/BETA are the eigenvalues. */
  236. /* VL (workspace) DOUBLE PRECISION array, dimension (LDA, NSIZE) */
  237. /* VL holds the left eigenvectors computed by DGGEVX. */
  238. /* VR (workspace) DOUBLE PRECISION array, dimension (LDA, NSIZE) */
  239. /* VR holds the right eigenvectors computed by DGGEVX. */
  240. /* ILO (output/workspace) INTEGER */
  241. /* IHI (output/workspace) INTEGER */
  242. /* LSCALE (output/workspace) DOUBLE PRECISION array, dimension (N) */
  243. /* RSCALE (output/workspace) DOUBLE PRECISION array, dimension (N) */
  244. /* S (output/workspace) DOUBLE PRECISION array, dimension (N) */
  245. /* DTRU (output/workspace) DOUBLE PRECISION array, dimension (N) */
  246. /* DIF (output/workspace) DOUBLE PRECISION array, dimension (N) */
  247. /* DIFTRU (output/workspace) DOUBLE PRECISION array, dimension (N) */
  248. /* WORK (workspace) DOUBLE PRECISION array, dimension (LWORK) */
  249. /* LWORK (input) INTEGER */
  250. /* Leading dimension of WORK. LWORK >= 2*N*N+12*N+16. */
  251. /* IWORK (workspace) INTEGER array, dimension (LIWORK) */
  252. /* LIWORK (input) INTEGER */
  253. /* Leading dimension of IWORK. Must be at least N+6. */
  254. /* RESULT (output/workspace) DOUBLE PRECISION array, dimension (4) */
  255. /* BWORK (workspace) LOGICAL array, dimension (N) */
  256. /* INFO (output) INTEGER */
  257. /* = 0: successful exit */
  258. /* < 0: if INFO = -i, the i-th argument had an illegal value. */
  259. /* > 0: A routine returned an error code. */
  260. /* ===================================================================== */
  261. /* .. Parameters .. */
  262. /* .. */
  263. /* .. Local Scalars .. */
  264. /* .. */
  265. /* .. Local Arrays .. */
  266. /* .. */
  267. /* .. External Functions .. */
  268. /* .. */
  269. /* .. External Subroutines .. */
  270. /* .. */
  271. /* .. Intrinsic Functions .. */
  272. /* .. */
  273. /* .. Executable Statements .. */
  274. /* Check for errors */
  275. /* Parameter adjustments */
  276. vr_dim1 = *lda;
  277. vr_offset = 1 + vr_dim1;
  278. vr -= vr_offset;
  279. vl_dim1 = *lda;
  280. vl_offset = 1 + vl_dim1;
  281. vl -= vl_offset;
  282. bi_dim1 = *lda;
  283. bi_offset = 1 + bi_dim1;
  284. bi -= bi_offset;
  285. ai_dim1 = *lda;
  286. ai_offset = 1 + ai_dim1;
  287. ai -= ai_offset;
  288. b_dim1 = *lda;
  289. b_offset = 1 + b_dim1;
  290. b -= b_offset;
  291. a_dim1 = *lda;
  292. a_offset = 1 + a_dim1;
  293. a -= a_offset;
  294. --alphar;
  295. --alphai;
  296. --beta;
  297. --lscale;
  298. --rscale;
  299. --s;
  300. --dtru;
  301. --dif;
  302. --diftru;
  303. --work;
  304. --iwork;
  305. --result;
  306. --bwork;
  307. /* Function Body */
  308. *info = 0;
  309. nmax = 5;
  310. if (*nsize < 0) {
  311. *info = -1;
  312. } else if (*thresh < 0.) {
  313. *info = -2;
  314. } else if (*nin <= 0) {
  315. *info = -3;
  316. } else if (*nout <= 0) {
  317. *info = -4;
  318. } else if (*lda < 1 || *lda < nmax) {
  319. *info = -6;
  320. } else if (*liwork < nmax + 6) {
  321. *info = -26;
  322. }
  323. /* Compute workspace */
  324. /* (Note: Comments in the code beginning "Workspace:" describe the */
  325. /* minimal amount of workspace needed at that point in the code, */
  326. /* as well as the preferred amount for good performance. */
  327. /* NB refers to the optimal block size for the immediately */
  328. /* following subroutine, as returned by ILAENV.) */
  329. minwrk = 1;
  330. if (*info == 0 && *lwork >= 1) {
  331. minwrk = (nmax << 1) * nmax + nmax * 12 + 16;
  332. maxwrk = nmax * 6 + nmax * ilaenv_(&c__1, "DGEQRF", " ", &nmax, &c__1,
  333. &nmax, &c__0);
  334. /* Computing MAX */
  335. i__1 = maxwrk, i__2 = (nmax << 1) * nmax + nmax * 12 + 16;
  336. maxwrk = max(i__1,i__2);
  337. work[1] = (doublereal) maxwrk;
  338. }
  339. if (*lwork < minwrk) {
  340. *info = -24;
  341. }
  342. if (*info != 0) {
  343. i__1 = -(*info);
  344. xerbla_("DDRGVX", &i__1);
  345. return 0;
  346. }
  347. n = 5;
  348. ulp = dlamch_("P");
  349. ulpinv = 1. / ulp;
  350. thrsh2 = *thresh * 10.;
  351. nerrs = 0;
  352. nptknt = 0;
  353. ntestt = 0;
  354. if (*nsize == 0) {
  355. goto L90;
  356. }
  357. /* Parameters used for generating test matrices. */
  358. weight[0] = sqrt(sqrt(ulp));
  359. weight[1] = .1;
  360. weight[2] = 1.;
  361. weight[3] = 1. / weight[1];
  362. weight[4] = 1. / weight[0];
  363. for (iptype = 1; iptype <= 2; ++iptype) {
  364. for (iwa = 1; iwa <= 5; ++iwa) {
  365. for (iwb = 1; iwb <= 5; ++iwb) {
  366. for (iwx = 1; iwx <= 5; ++iwx) {
  367. for (iwy = 1; iwy <= 5; ++iwy) {
  368. /* generated a test matrix pair */
  369. dlatm6_(&iptype, &c__5, &a[a_offset], lda, &b[
  370. b_offset], &vr[vr_offset], lda, &vl[vl_offset]
  371. , lda, &weight[iwa - 1], &weight[iwb - 1], &
  372. weight[iwx - 1], &weight[iwy - 1], &dtru[1], &
  373. diftru[1]);
  374. /* Compute eigenvalues/eigenvectors of (A, B). */
  375. /* Compute eigenvalue/eigenvector condition numbers */
  376. /* using computed eigenvectors. */
  377. dlacpy_("F", &n, &n, &a[a_offset], lda, &ai[ai_offset]
  378. , lda);
  379. dlacpy_("F", &n, &n, &b[b_offset], lda, &bi[bi_offset]
  380. , lda);
  381. dggevx_("N", "V", "V", "B", &n, &ai[ai_offset], lda, &
  382. bi[bi_offset], lda, &alphar[1], &alphai[1], &
  383. beta[1], &vl[vl_offset], lda, &vr[vr_offset],
  384. lda, ilo, ihi, &lscale[1], &rscale[1], &anorm,
  385. &bnorm, &s[1], &dif[1], &work[1], lwork, &
  386. iwork[1], &bwork[1], &linfo);
  387. if (linfo != 0) {
  388. result[1] = ulpinv;
  389. io___20.ciunit = *nout;
  390. s_wsfe(&io___20);
  391. do_fio(&c__1, "DGGEVX", (ftnlen)6);
  392. do_fio(&c__1, (char *)&linfo, (ftnlen)sizeof(
  393. integer));
  394. do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
  395. ;
  396. do_fio(&c__1, (char *)&iptype, (ftnlen)sizeof(
  397. integer));
  398. e_wsfe();
  399. goto L30;
  400. }
  401. /* Compute the norm(A, B) */
  402. dlacpy_("Full", &n, &n, &ai[ai_offset], lda, &work[1],
  403. &n);
  404. dlacpy_("Full", &n, &n, &bi[bi_offset], lda, &work[n *
  405. n + 1], &n);
  406. i__1 = n << 1;
  407. abnorm = dlange_("Fro", &n, &i__1, &work[1], &n, &
  408. work[1]);
  409. /* Tests (1) and (2) */
  410. result[1] = 0.;
  411. dget52_(&c_true, &n, &a[a_offset], lda, &b[b_offset],
  412. lda, &vl[vl_offset], lda, &alphar[1], &alphai[
  413. 1], &beta[1], &work[1], &result[1]);
  414. if (result[2] > *thresh) {
  415. io___22.ciunit = *nout;
  416. s_wsfe(&io___22);
  417. do_fio(&c__1, "Left", (ftnlen)4);
  418. do_fio(&c__1, "DGGEVX", (ftnlen)6);
  419. do_fio(&c__1, (char *)&result[2], (ftnlen)sizeof(
  420. doublereal));
  421. do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
  422. ;
  423. do_fio(&c__1, (char *)&iptype, (ftnlen)sizeof(
  424. integer));
  425. do_fio(&c__1, (char *)&iwa, (ftnlen)sizeof(
  426. integer));
  427. do_fio(&c__1, (char *)&iwb, (ftnlen)sizeof(
  428. integer));
  429. do_fio(&c__1, (char *)&iwx, (ftnlen)sizeof(
  430. integer));
  431. do_fio(&c__1, (char *)&iwy, (ftnlen)sizeof(
  432. integer));
  433. e_wsfe();
  434. }
  435. result[2] = 0.;
  436. dget52_(&c_false, &n, &a[a_offset], lda, &b[b_offset],
  437. lda, &vr[vr_offset], lda, &alphar[1], &
  438. alphai[1], &beta[1], &work[1], &result[2]);
  439. if (result[3] > *thresh) {
  440. io___23.ciunit = *nout;
  441. s_wsfe(&io___23);
  442. do_fio(&c__1, "Right", (ftnlen)5);
  443. do_fio(&c__1, "DGGEVX", (ftnlen)6);
  444. do_fio(&c__1, (char *)&result[3], (ftnlen)sizeof(
  445. doublereal));
  446. do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer))
  447. ;
  448. do_fio(&c__1, (char *)&iptype, (ftnlen)sizeof(
  449. integer));
  450. do_fio(&c__1, (char *)&iwa, (ftnlen)sizeof(
  451. integer));
  452. do_fio(&c__1, (char *)&iwb, (ftnlen)sizeof(
  453. integer));
  454. do_fio(&c__1, (char *)&iwx, (ftnlen)sizeof(
  455. integer));
  456. do_fio(&c__1, (char *)&iwy, (ftnlen)sizeof(
  457. integer));
  458. e_wsfe();
  459. }
  460. /* Test (3) */
  461. result[3] = 0.;
  462. i__1 = n;
  463. for (i__ = 1; i__ <= i__1; ++i__) {
  464. if (s[i__] == 0.) {
  465. if (dtru[i__] > abnorm * ulp) {
  466. result[3] = ulpinv;
  467. }
  468. } else if (dtru[i__] == 0.) {
  469. if (s[i__] > abnorm * ulp) {
  470. result[3] = ulpinv;
  471. }
  472. } else {
  473. /* Computing MAX */
  474. d__3 = (d__1 = dtru[i__] / s[i__], abs(d__1)),
  475. d__4 = (d__2 = s[i__] / dtru[i__],
  476. abs(d__2));
  477. work[i__] = max(d__3,d__4);
  478. /* Computing MAX */
  479. d__1 = result[3], d__2 = work[i__];
  480. result[3] = max(d__1,d__2);
  481. }
  482. /* L10: */
  483. }
  484. /* Test (4) */
  485. result[4] = 0.;
  486. if (dif[1] == 0.) {
  487. if (diftru[1] > abnorm * ulp) {
  488. result[4] = ulpinv;
  489. }
  490. } else if (diftru[1] == 0.) {
  491. if (dif[1] > abnorm * ulp) {
  492. result[4] = ulpinv;
  493. }
  494. } else if (dif[5] == 0.) {
  495. if (diftru[5] > abnorm * ulp) {
  496. result[4] = ulpinv;
  497. }
  498. } else if (diftru[5] == 0.) {
  499. if (dif[5] > abnorm * ulp) {
  500. result[4] = ulpinv;
  501. }
  502. } else {
  503. /* Computing MAX */
  504. d__3 = (d__1 = diftru[1] / dif[1], abs(d__1)),
  505. d__4 = (d__2 = dif[1] / diftru[1], abs(
  506. d__2));
  507. ratio1 = max(d__3,d__4);
  508. /* Computing MAX */
  509. d__3 = (d__1 = diftru[5] / dif[5], abs(d__1)),
  510. d__4 = (d__2 = dif[5] / diftru[5], abs(
  511. d__2));
  512. ratio2 = max(d__3,d__4);
  513. result[4] = max(ratio1,ratio2);
  514. }
  515. ntestt += 4;
  516. /* Print out tests which fail. */
  517. for (j = 1; j <= 4; ++j) {
  518. if (result[j] >= thrsh2 && j >= 4 || result[j] >=
  519. *thresh && j <= 3) {
  520. /* If this is the first test to fail, */
  521. /* print a header to the data file. */
  522. if (nerrs == 0) {
  523. io___28.ciunit = *nout;
  524. s_wsfe(&io___28);
  525. do_fio(&c__1, "DXV", (ftnlen)3);
  526. e_wsfe();
  527. /* Print out messages for built-in examples */
  528. /* Matrix types */
  529. io___29.ciunit = *nout;
  530. s_wsfe(&io___29);
  531. e_wsfe();
  532. io___30.ciunit = *nout;
  533. s_wsfe(&io___30);
  534. e_wsfe();
  535. io___31.ciunit = *nout;
  536. s_wsfe(&io___31);
  537. e_wsfe();
  538. /* Tests performed */
  539. io___32.ciunit = *nout;
  540. s_wsfe(&io___32);
  541. do_fio(&c__1, "'", (ftnlen)1);
  542. do_fio(&c__1, "transpose", (ftnlen)9);
  543. do_fio(&c__1, "'", (ftnlen)1);
  544. e_wsfe();
  545. }
  546. ++nerrs;
  547. if (result[j] < 1e4) {
  548. io___33.ciunit = *nout;
  549. s_wsfe(&io___33);
  550. do_fio(&c__1, (char *)&iptype, (ftnlen)
  551. sizeof(integer));
  552. do_fio(&c__1, (char *)&iwa, (ftnlen)
  553. sizeof(integer));
  554. do_fio(&c__1, (char *)&iwb, (ftnlen)
  555. sizeof(integer));
  556. do_fio(&c__1, (char *)&iwx, (ftnlen)
  557. sizeof(integer));
  558. do_fio(&c__1, (char *)&iwy, (ftnlen)
  559. sizeof(integer));
  560. do_fio(&c__1, (char *)&j, (ftnlen)sizeof(
  561. integer));
  562. do_fio(&c__1, (char *)&result[j], (ftnlen)
  563. sizeof(doublereal));
  564. e_wsfe();
  565. } else {
  566. io___34.ciunit = *nout;
  567. s_wsfe(&io___34);
  568. do_fio(&c__1, (char *)&iptype, (ftnlen)
  569. sizeof(integer));
  570. do_fio(&c__1, (char *)&iwa, (ftnlen)
  571. sizeof(integer));
  572. do_fio(&c__1, (char *)&iwb, (ftnlen)
  573. sizeof(integer));
  574. do_fio(&c__1, (char *)&iwx, (ftnlen)
  575. sizeof(integer));
  576. do_fio(&c__1, (char *)&iwy, (ftnlen)
  577. sizeof(integer));
  578. do_fio(&c__1, (char *)&j, (ftnlen)sizeof(
  579. integer));
  580. do_fio(&c__1, (char *)&result[j], (ftnlen)
  581. sizeof(doublereal));
  582. e_wsfe();
  583. }
  584. }
  585. /* L20: */
  586. }
  587. L30:
  588. /* L40: */
  589. ;
  590. }
  591. /* L50: */
  592. }
  593. /* L60: */
  594. }
  595. /* L70: */
  596. }
  597. /* L80: */
  598. }
  599. goto L150;
  600. L90:
  601. /* Read in data from file to check accuracy of condition estimation */
  602. /* Read input data until N=0 */
  603. io___35.ciunit = *nin;
  604. i__1 = s_rsle(&io___35);
  605. if (i__1 != 0) {
  606. goto L150;
  607. }
  608. i__1 = do_lio(&c__3, &c__1, (char *)&n, (ftnlen)sizeof(integer));
  609. if (i__1 != 0) {
  610. goto L150;
  611. }
  612. i__1 = e_rsle();
  613. if (i__1 != 0) {
  614. goto L150;
  615. }
  616. if (n == 0) {
  617. goto L150;
  618. }
  619. i__1 = n;
  620. for (i__ = 1; i__ <= i__1; ++i__) {
  621. io___36.ciunit = *nin;
  622. s_rsle(&io___36);
  623. i__2 = n;
  624. for (j = 1; j <= i__2; ++j) {
  625. do_lio(&c__5, &c__1, (char *)&a[i__ + j * a_dim1], (ftnlen)sizeof(
  626. doublereal));
  627. }
  628. e_rsle();
  629. /* L100: */
  630. }
  631. i__1 = n;
  632. for (i__ = 1; i__ <= i__1; ++i__) {
  633. io___37.ciunit = *nin;
  634. s_rsle(&io___37);
  635. i__2 = n;
  636. for (j = 1; j <= i__2; ++j) {
  637. do_lio(&c__5, &c__1, (char *)&b[i__ + j * b_dim1], (ftnlen)sizeof(
  638. doublereal));
  639. }
  640. e_rsle();
  641. /* L110: */
  642. }
  643. io___38.ciunit = *nin;
  644. s_rsle(&io___38);
  645. i__1 = n;
  646. for (i__ = 1; i__ <= i__1; ++i__) {
  647. do_lio(&c__5, &c__1, (char *)&dtru[i__], (ftnlen)sizeof(doublereal));
  648. }
  649. e_rsle();
  650. io___39.ciunit = *nin;
  651. s_rsle(&io___39);
  652. i__1 = n;
  653. for (i__ = 1; i__ <= i__1; ++i__) {
  654. do_lio(&c__5, &c__1, (char *)&diftru[i__], (ftnlen)sizeof(doublereal))
  655. ;
  656. }
  657. e_rsle();
  658. ++nptknt;
  659. /* Compute eigenvalues/eigenvectors of (A, B). */
  660. /* Compute eigenvalue/eigenvector condition numbers */
  661. /* using computed eigenvectors. */
  662. dlacpy_("F", &n, &n, &a[a_offset], lda, &ai[ai_offset], lda);
  663. dlacpy_("F", &n, &n, &b[b_offset], lda, &bi[bi_offset], lda);
  664. dggevx_("N", "V", "V", "B", &n, &ai[ai_offset], lda, &bi[bi_offset], lda,
  665. &alphar[1], &alphai[1], &beta[1], &vl[vl_offset], lda, &vr[
  666. vr_offset], lda, ilo, ihi, &lscale[1], &rscale[1], &anorm, &bnorm,
  667. &s[1], &dif[1], &work[1], lwork, &iwork[1], &bwork[1], &linfo);
  668. if (linfo != 0) {
  669. result[1] = ulpinv;
  670. io___40.ciunit = *nout;
  671. s_wsfe(&io___40);
  672. do_fio(&c__1, "DGGEVX", (ftnlen)6);
  673. do_fio(&c__1, (char *)&linfo, (ftnlen)sizeof(integer));
  674. do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
  675. do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
  676. e_wsfe();
  677. goto L140;
  678. }
  679. /* Compute the norm(A, B) */
  680. dlacpy_("Full", &n, &n, &ai[ai_offset], lda, &work[1], &n);
  681. dlacpy_("Full", &n, &n, &bi[bi_offset], lda, &work[n * n + 1], &n);
  682. i__1 = n << 1;
  683. abnorm = dlange_("Fro", &n, &i__1, &work[1], &n, &work[1]);
  684. /* Tests (1) and (2) */
  685. result[1] = 0.;
  686. dget52_(&c_true, &n, &a[a_offset], lda, &b[b_offset], lda, &vl[vl_offset],
  687. lda, &alphar[1], &alphai[1], &beta[1], &work[1], &result[1]);
  688. if (result[2] > *thresh) {
  689. io___41.ciunit = *nout;
  690. s_wsfe(&io___41);
  691. do_fio(&c__1, "Left", (ftnlen)4);
  692. do_fio(&c__1, "DGGEVX", (ftnlen)6);
  693. do_fio(&c__1, (char *)&result[2], (ftnlen)sizeof(doublereal));
  694. do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
  695. do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
  696. e_wsfe();
  697. }
  698. result[2] = 0.;
  699. dget52_(&c_false, &n, &a[a_offset], lda, &b[b_offset], lda, &vr[vr_offset]
  700. , lda, &alphar[1], &alphai[1], &beta[1], &work[1], &result[2]);
  701. if (result[3] > *thresh) {
  702. io___42.ciunit = *nout;
  703. s_wsfe(&io___42);
  704. do_fio(&c__1, "Right", (ftnlen)5);
  705. do_fio(&c__1, "DGGEVX", (ftnlen)6);
  706. do_fio(&c__1, (char *)&result[3], (ftnlen)sizeof(doublereal));
  707. do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
  708. do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
  709. e_wsfe();
  710. }
  711. /* Test (3) */
  712. result[3] = 0.;
  713. i__1 = n;
  714. for (i__ = 1; i__ <= i__1; ++i__) {
  715. if (s[i__] == 0.) {
  716. if (dtru[i__] > abnorm * ulp) {
  717. result[3] = ulpinv;
  718. }
  719. } else if (dtru[i__] == 0.) {
  720. if (s[i__] > abnorm * ulp) {
  721. result[3] = ulpinv;
  722. }
  723. } else {
  724. /* Computing MAX */
  725. d__3 = (d__1 = dtru[i__] / s[i__], abs(d__1)), d__4 = (d__2 = s[
  726. i__] / dtru[i__], abs(d__2));
  727. work[i__] = max(d__3,d__4);
  728. /* Computing MAX */
  729. d__1 = result[3], d__2 = work[i__];
  730. result[3] = max(d__1,d__2);
  731. }
  732. /* L120: */
  733. }
  734. /* Test (4) */
  735. result[4] = 0.;
  736. if (dif[1] == 0.) {
  737. if (diftru[1] > abnorm * ulp) {
  738. result[4] = ulpinv;
  739. }
  740. } else if (diftru[1] == 0.) {
  741. if (dif[1] > abnorm * ulp) {
  742. result[4] = ulpinv;
  743. }
  744. } else if (dif[5] == 0.) {
  745. if (diftru[5] > abnorm * ulp) {
  746. result[4] = ulpinv;
  747. }
  748. } else if (diftru[5] == 0.) {
  749. if (dif[5] > abnorm * ulp) {
  750. result[4] = ulpinv;
  751. }
  752. } else {
  753. /* Computing MAX */
  754. d__3 = (d__1 = diftru[1] / dif[1], abs(d__1)), d__4 = (d__2 = dif[1] /
  755. diftru[1], abs(d__2));
  756. ratio1 = max(d__3,d__4);
  757. /* Computing MAX */
  758. d__3 = (d__1 = diftru[5] / dif[5], abs(d__1)), d__4 = (d__2 = dif[5] /
  759. diftru[5], abs(d__2));
  760. ratio2 = max(d__3,d__4);
  761. result[4] = max(ratio1,ratio2);
  762. }
  763. ntestt += 4;
  764. /* Print out tests which fail. */
  765. for (j = 1; j <= 4; ++j) {
  766. if (result[j] >= thrsh2) {
  767. /* If this is the first test to fail, */
  768. /* print a header to the data file. */
  769. if (nerrs == 0) {
  770. io___43.ciunit = *nout;
  771. s_wsfe(&io___43);
  772. do_fio(&c__1, "DXV", (ftnlen)3);
  773. e_wsfe();
  774. /* Print out messages for built-in examples */
  775. /* Matrix types */
  776. io___44.ciunit = *nout;
  777. s_wsfe(&io___44);
  778. e_wsfe();
  779. /* Tests performed */
  780. io___45.ciunit = *nout;
  781. s_wsfe(&io___45);
  782. do_fio(&c__1, "'", (ftnlen)1);
  783. do_fio(&c__1, "transpose", (ftnlen)9);
  784. do_fio(&c__1, "'", (ftnlen)1);
  785. e_wsfe();
  786. }
  787. ++nerrs;
  788. if (result[j] < 1e4) {
  789. io___46.ciunit = *nout;
  790. s_wsfe(&io___46);
  791. do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
  792. do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
  793. do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
  794. do_fio(&c__1, (char *)&result[j], (ftnlen)sizeof(doublereal));
  795. e_wsfe();
  796. } else {
  797. io___47.ciunit = *nout;
  798. s_wsfe(&io___47);
  799. do_fio(&c__1, (char *)&nptknt, (ftnlen)sizeof(integer));
  800. do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
  801. do_fio(&c__1, (char *)&j, (ftnlen)sizeof(integer));
  802. do_fio(&c__1, (char *)&result[j], (ftnlen)sizeof(doublereal));
  803. e_wsfe();
  804. }
  805. }
  806. /* L130: */
  807. }
  808. L140:
  809. goto L90;
  810. L150:
  811. /* Summary */
  812. alasvm_("DXV", nout, &nerrs, &ntestt, &c__0);
  813. work[1] = (doublereal) maxwrk;
  814. return 0;
  815. /* End of DDRGVX */
  816. } /* ddrgvx_ */