You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

zlatm6.c 22 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. #include <math.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <stdio.h>
  5. #include <complex.h>
  6. #ifdef complex
  7. #undef complex
  8. #endif
  9. #ifdef I
  10. #undef I
  11. #endif
  12. #if defined(_WIN64)
  13. typedef long long BLASLONG;
  14. typedef unsigned long long BLASULONG;
  15. #else
  16. typedef long BLASLONG;
  17. typedef unsigned long BLASULONG;
  18. #endif
  19. #ifdef LAPACK_ILP64
  20. typedef BLASLONG blasint;
  21. #if defined(_WIN64)
  22. #define blasabs(x) llabs(x)
  23. #else
  24. #define blasabs(x) labs(x)
  25. #endif
  26. #else
  27. typedef int blasint;
  28. #define blasabs(x) abs(x)
  29. #endif
  30. typedef blasint integer;
  31. typedef unsigned int uinteger;
  32. typedef char *address;
  33. typedef short int shortint;
  34. typedef float real;
  35. typedef double doublereal;
  36. typedef struct { real r, i; } complex;
  37. typedef struct { doublereal r, i; } doublecomplex;
  38. #ifdef _MSC_VER
  39. static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
  40. static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
  41. static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
  42. static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
  43. #else
  44. static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
  45. static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
  46. static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
  47. static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
  48. #endif
  49. #define pCf(z) (*_pCf(z))
  50. #define pCd(z) (*_pCd(z))
  51. typedef char integer1;
  52. #define TRUE_ (1)
  53. #define FALSE_ (0)
  54. /* Extern is for use with -E */
  55. #ifndef Extern
  56. #define Extern extern
  57. #endif
  58. /* I/O stuff */
  59. typedef int flag;
  60. typedef int ftnlen;
  61. typedef int ftnint;
  62. /*external read, write*/
  63. typedef struct
  64. { flag cierr;
  65. ftnint ciunit;
  66. flag ciend;
  67. char *cifmt;
  68. ftnint cirec;
  69. } cilist;
  70. /*internal read, write*/
  71. typedef struct
  72. { flag icierr;
  73. char *iciunit;
  74. flag iciend;
  75. char *icifmt;
  76. ftnint icirlen;
  77. ftnint icirnum;
  78. } icilist;
  79. /*open*/
  80. typedef struct
  81. { flag oerr;
  82. ftnint ounit;
  83. char *ofnm;
  84. ftnlen ofnmlen;
  85. char *osta;
  86. char *oacc;
  87. char *ofm;
  88. ftnint orl;
  89. char *oblnk;
  90. } olist;
  91. /*close*/
  92. typedef struct
  93. { flag cerr;
  94. ftnint cunit;
  95. char *csta;
  96. } cllist;
  97. /*rewind, backspace, endfile*/
  98. typedef struct
  99. { flag aerr;
  100. ftnint aunit;
  101. } alist;
  102. /* inquire */
  103. typedef struct
  104. { flag inerr;
  105. ftnint inunit;
  106. char *infile;
  107. ftnlen infilen;
  108. ftnint *inex; /*parameters in standard's order*/
  109. ftnint *inopen;
  110. ftnint *innum;
  111. ftnint *innamed;
  112. char *inname;
  113. ftnlen innamlen;
  114. char *inacc;
  115. ftnlen inacclen;
  116. char *inseq;
  117. ftnlen inseqlen;
  118. char *indir;
  119. ftnlen indirlen;
  120. char *infmt;
  121. ftnlen infmtlen;
  122. char *inform;
  123. ftnint informlen;
  124. char *inunf;
  125. ftnlen inunflen;
  126. ftnint *inrecl;
  127. ftnint *innrec;
  128. char *inblank;
  129. ftnlen inblanklen;
  130. } inlist;
  131. #define VOID void
  132. union Multitype { /* for multiple entry points */
  133. integer1 g;
  134. shortint h;
  135. integer i;
  136. /* longint j; */
  137. real r;
  138. doublereal d;
  139. complex c;
  140. doublecomplex z;
  141. };
  142. typedef union Multitype Multitype;
  143. struct Vardesc { /* for Namelist */
  144. char *name;
  145. char *addr;
  146. ftnlen *dims;
  147. int type;
  148. };
  149. typedef struct Vardesc Vardesc;
  150. struct Namelist {
  151. char *name;
  152. Vardesc **vars;
  153. int nvars;
  154. };
  155. typedef struct Namelist Namelist;
  156. #define abs(x) ((x) >= 0 ? (x) : -(x))
  157. #define dabs(x) (fabs(x))
  158. #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
  159. #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
  160. #define dmin(a,b) (f2cmin(a,b))
  161. #define dmax(a,b) (f2cmax(a,b))
  162. #define bit_test(a,b) ((a) >> (b) & 1)
  163. #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
  164. #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
  165. #define abort_() { sig_die("Fortran abort routine called", 1); }
  166. #define c_abs(z) (cabsf(Cf(z)))
  167. #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
  168. #ifdef _MSC_VER
  169. #define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
  170. #define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/Cd(b)._Val[1]);}
  171. #else
  172. #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
  173. #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
  174. #endif
  175. #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
  176. #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
  177. #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
  178. //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
  179. #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
  180. #define d_abs(x) (fabs(*(x)))
  181. #define d_acos(x) (acos(*(x)))
  182. #define d_asin(x) (asin(*(x)))
  183. #define d_atan(x) (atan(*(x)))
  184. #define d_atn2(x, y) (atan2(*(x),*(y)))
  185. #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
  186. #define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
  187. #define d_cos(x) (cos(*(x)))
  188. #define d_cosh(x) (cosh(*(x)))
  189. #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
  190. #define d_exp(x) (exp(*(x)))
  191. #define d_imag(z) (cimag(Cd(z)))
  192. #define r_imag(z) (cimagf(Cf(z)))
  193. #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  194. #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  195. #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  196. #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  197. #define d_log(x) (log(*(x)))
  198. #define d_mod(x, y) (fmod(*(x), *(y)))
  199. #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
  200. #define d_nint(x) u_nint(*(x))
  201. #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
  202. #define d_sign(a,b) u_sign(*(a),*(b))
  203. #define r_sign(a,b) u_sign(*(a),*(b))
  204. #define d_sin(x) (sin(*(x)))
  205. #define d_sinh(x) (sinh(*(x)))
  206. #define d_sqrt(x) (sqrt(*(x)))
  207. #define d_tan(x) (tan(*(x)))
  208. #define d_tanh(x) (tanh(*(x)))
  209. #define i_abs(x) abs(*(x))
  210. #define i_dnnt(x) ((integer)u_nint(*(x)))
  211. #define i_len(s, n) (n)
  212. #define i_nint(x) ((integer)u_nint(*(x)))
  213. #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
  214. #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
  215. #define pow_si(B,E) spow_ui(*(B),*(E))
  216. #define pow_ri(B,E) spow_ui(*(B),*(E))
  217. #define pow_di(B,E) dpow_ui(*(B),*(E))
  218. #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
  219. #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
  220. #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
  221. #define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; }
  222. #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
  223. #define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; }
  224. #define sig_die(s, kill) { exit(1); }
  225. #define s_stop(s, n) {exit(0);}
  226. #define z_abs(z) (cabs(Cd(z)))
  227. #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
  228. #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
  229. #define myexit_() break;
  230. #define mycycle_() continue;
  231. #define myceiling_(w) {ceil(w)}
  232. #define myhuge_(w) {HUGE_VAL}
  233. //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
  234. #define mymaxloc_(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
  235. /* procedure parameter types for -A and -C++ */
  236. /* Table of constant values */
  237. static integer c__1 = 1;
  238. static integer c__4 = 4;
  239. static integer c__8 = 8;
  240. static integer c__24 = 24;
  241. /* > \brief \b ZLATM6 */
  242. /* =========== DOCUMENTATION =========== */
  243. /* Online html documentation available at */
  244. /* http://www.netlib.org/lapack/explore-html/ */
  245. /* Definition: */
  246. /* =========== */
  247. /* SUBROUTINE ZLATM6( TYPE, N, A, LDA, B, X, LDX, Y, LDY, ALPHA, */
  248. /* BETA, WX, WY, S, DIF ) */
  249. /* INTEGER LDA, LDX, LDY, N, TYPE */
  250. /* COMPLEX*16 ALPHA, BETA, WX, WY */
  251. /* DOUBLE PRECISION DIF( * ), S( * ) */
  252. /* COMPLEX*16 A( LDA, * ), B( LDA, * ), X( LDX, * ), */
  253. /* $ Y( LDY, * ) */
  254. /* > \par Purpose: */
  255. /* ============= */
  256. /* > */
  257. /* > \verbatim */
  258. /* > */
  259. /* > ZLATM6 generates test matrices for the generalized eigenvalue */
  260. /* > problem, their corresponding right and left eigenvector matrices, */
  261. /* > and also reciprocal condition numbers for all eigenvalues and */
  262. /* > the reciprocal condition numbers of eigenvectors corresponding to */
  263. /* > the 1th and 5th eigenvalues. */
  264. /* > */
  265. /* > Test Matrices */
  266. /* > ============= */
  267. /* > */
  268. /* > Two kinds of test matrix pairs */
  269. /* > (A, B) = inverse(YH) * (Da, Db) * inverse(X) */
  270. /* > are used in the tests: */
  271. /* > */
  272. /* > Type 1: */
  273. /* > Da = 1+a 0 0 0 0 Db = 1 0 0 0 0 */
  274. /* > 0 2+a 0 0 0 0 1 0 0 0 */
  275. /* > 0 0 3+a 0 0 0 0 1 0 0 */
  276. /* > 0 0 0 4+a 0 0 0 0 1 0 */
  277. /* > 0 0 0 0 5+a , 0 0 0 0 1 */
  278. /* > and Type 2: */
  279. /* > Da = 1+i 0 0 0 0 Db = 1 0 0 0 0 */
  280. /* > 0 1-i 0 0 0 0 1 0 0 0 */
  281. /* > 0 0 1 0 0 0 0 1 0 0 */
  282. /* > 0 0 0 (1+a)+(1+b)i 0 0 0 0 1 0 */
  283. /* > 0 0 0 0 (1+a)-(1+b)i, 0 0 0 0 1 . */
  284. /* > */
  285. /* > In both cases the same inverse(YH) and inverse(X) are used to compute */
  286. /* > (A, B), giving the exact eigenvectors to (A,B) as (YH, X): */
  287. /* > */
  288. /* > YH: = 1 0 -y y -y X = 1 0 -x -x x */
  289. /* > 0 1 -y y -y 0 1 x -x -x */
  290. /* > 0 0 1 0 0 0 0 1 0 0 */
  291. /* > 0 0 0 1 0 0 0 0 1 0 */
  292. /* > 0 0 0 0 1, 0 0 0 0 1 , where */
  293. /* > */
  294. /* > a, b, x and y will have all values independently of each other. */
  295. /* > \endverbatim */
  296. /* Arguments: */
  297. /* ========== */
  298. /* > \param[in] TYPE */
  299. /* > \verbatim */
  300. /* > TYPE is INTEGER */
  301. /* > Specifies the problem type (see further details). */
  302. /* > \endverbatim */
  303. /* > */
  304. /* > \param[in] N */
  305. /* > \verbatim */
  306. /* > N is INTEGER */
  307. /* > Size of the matrices A and B. */
  308. /* > \endverbatim */
  309. /* > */
  310. /* > \param[out] A */
  311. /* > \verbatim */
  312. /* > A is COMPLEX*16 array, dimension (LDA, N). */
  313. /* > On exit A N-by-N is initialized according to TYPE. */
  314. /* > \endverbatim */
  315. /* > */
  316. /* > \param[in] LDA */
  317. /* > \verbatim */
  318. /* > LDA is INTEGER */
  319. /* > The leading dimension of A and of B. */
  320. /* > \endverbatim */
  321. /* > */
  322. /* > \param[out] B */
  323. /* > \verbatim */
  324. /* > B is COMPLEX*16 array, dimension (LDA, N). */
  325. /* > On exit B N-by-N is initialized according to TYPE. */
  326. /* > \endverbatim */
  327. /* > */
  328. /* > \param[out] X */
  329. /* > \verbatim */
  330. /* > X is COMPLEX*16 array, dimension (LDX, N). */
  331. /* > On exit X is the N-by-N matrix of right eigenvectors. */
  332. /* > \endverbatim */
  333. /* > */
  334. /* > \param[in] LDX */
  335. /* > \verbatim */
  336. /* > LDX is INTEGER */
  337. /* > The leading dimension of X. */
  338. /* > \endverbatim */
  339. /* > */
  340. /* > \param[out] Y */
  341. /* > \verbatim */
  342. /* > Y is COMPLEX*16 array, dimension (LDY, N). */
  343. /* > On exit Y is the N-by-N matrix of left eigenvectors. */
  344. /* > \endverbatim */
  345. /* > */
  346. /* > \param[in] LDY */
  347. /* > \verbatim */
  348. /* > LDY is INTEGER */
  349. /* > The leading dimension of Y. */
  350. /* > \endverbatim */
  351. /* > */
  352. /* > \param[in] ALPHA */
  353. /* > \verbatim */
  354. /* > ALPHA is COMPLEX*16 */
  355. /* > \endverbatim */
  356. /* > */
  357. /* > \param[in] BETA */
  358. /* > \verbatim */
  359. /* > BETA is COMPLEX*16 */
  360. /* > \verbatim */
  361. /* > Weighting constants for matrix A. */
  362. /* > \endverbatim */
  363. /* > */
  364. /* > \param[in] WX */
  365. /* > \verbatim */
  366. /* > WX is COMPLEX*16 */
  367. /* > Constant for right eigenvector matrix. */
  368. /* > \endverbatim */
  369. /* > */
  370. /* > \param[in] WY */
  371. /* > \verbatim */
  372. /* > WY is COMPLEX*16 */
  373. /* > Constant for left eigenvector matrix. */
  374. /* > \endverbatim */
  375. /* > */
  376. /* > \param[out] S */
  377. /* > \verbatim */
  378. /* > S is DOUBLE PRECISION array, dimension (N) */
  379. /* > S(i) is the reciprocal condition number for eigenvalue i. */
  380. /* > \endverbatim */
  381. /* > */
  382. /* > \param[out] DIF */
  383. /* > \verbatim */
  384. /* > DIF is DOUBLE PRECISION array, dimension (N) */
  385. /* > DIF(i) is the reciprocal condition number for eigenvector i. */
  386. /* > \endverbatim */
  387. /* Authors: */
  388. /* ======== */
  389. /* > \author Univ. of Tennessee */
  390. /* > \author Univ. of California Berkeley */
  391. /* > \author Univ. of Colorado Denver */
  392. /* > \author NAG Ltd. */
  393. /* > \date December 2016 */
  394. /* > \ingroup complex16_matgen */
  395. /* ===================================================================== */
  396. /* Subroutine */ void zlatm6_(integer *type__, integer *n, doublecomplex *a,
  397. integer *lda, doublecomplex *b, doublecomplex *x, integer *ldx,
  398. doublecomplex *y, integer *ldy, doublecomplex *alpha, doublecomplex *
  399. beta, doublecomplex *wx, doublecomplex *wy, doublereal *s, doublereal
  400. *dif)
  401. {
  402. /* System generated locals */
  403. integer a_dim1, a_offset, b_dim1, b_offset, x_dim1, x_offset, y_dim1,
  404. y_offset, i__1, i__2, i__3;
  405. doublereal d__1, d__2;
  406. doublecomplex z__1, z__2, z__3, z__4;
  407. /* Local variables */
  408. integer info;
  409. doublecomplex work[26];
  410. integer i__, j;
  411. doublecomplex z__[64] /* was [8][8] */;
  412. doublereal rwork[50];
  413. extern /* Subroutine */ void zlakf2_(integer *, integer *, doublecomplex *,
  414. integer *, doublecomplex *, doublecomplex *, doublecomplex *,
  415. doublecomplex *, integer *), zgesvd_(char *, char *, integer *,
  416. integer *, doublecomplex *, integer *, doublereal *,
  417. doublecomplex *, integer *, doublecomplex *, integer *,
  418. doublecomplex *, integer *, doublereal *, integer *), zlacpy_(char *, integer *, integer *, doublecomplex *,
  419. integer *, doublecomplex *, integer *);
  420. /* -- LAPACK computational routine (version 3.7.0) -- */
  421. /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
  422. /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
  423. /* December 2016 */
  424. /* ===================================================================== */
  425. /* Generate test problem ... */
  426. /* (Da, Db) ... */
  427. /* Parameter adjustments */
  428. b_dim1 = *lda;
  429. b_offset = 1 + b_dim1 * 1;
  430. b -= b_offset;
  431. a_dim1 = *lda;
  432. a_offset = 1 + a_dim1 * 1;
  433. a -= a_offset;
  434. x_dim1 = *ldx;
  435. x_offset = 1 + x_dim1 * 1;
  436. x -= x_offset;
  437. y_dim1 = *ldy;
  438. y_offset = 1 + y_dim1 * 1;
  439. y -= y_offset;
  440. --s;
  441. --dif;
  442. /* Function Body */
  443. i__1 = *n;
  444. for (i__ = 1; i__ <= i__1; ++i__) {
  445. i__2 = *n;
  446. for (j = 1; j <= i__2; ++j) {
  447. if (i__ == j) {
  448. i__3 = i__ + i__ * a_dim1;
  449. z__2.r = (doublereal) i__, z__2.i = 0.;
  450. z__1.r = z__2.r + alpha->r, z__1.i = z__2.i + alpha->i;
  451. a[i__3].r = z__1.r, a[i__3].i = z__1.i;
  452. i__3 = i__ + i__ * b_dim1;
  453. b[i__3].r = 1., b[i__3].i = 0.;
  454. } else {
  455. i__3 = i__ + j * a_dim1;
  456. a[i__3].r = 0., a[i__3].i = 0.;
  457. i__3 = i__ + j * b_dim1;
  458. b[i__3].r = 0., b[i__3].i = 0.;
  459. }
  460. /* L10: */
  461. }
  462. /* L20: */
  463. }
  464. if (*type__ == 2) {
  465. i__1 = a_dim1 + 1;
  466. a[i__1].r = 1., a[i__1].i = 1.;
  467. i__1 = (a_dim1 << 1) + 2;
  468. d_cnjg(&z__1, &a[a_dim1 + 1]);
  469. a[i__1].r = z__1.r, a[i__1].i = z__1.i;
  470. i__1 = a_dim1 * 3 + 3;
  471. a[i__1].r = 1., a[i__1].i = 0.;
  472. i__1 = (a_dim1 << 2) + 4;
  473. z__2.r = alpha->r + 1., z__2.i = alpha->i + 0.;
  474. d__1 = z__2.r;
  475. z__3.r = beta->r + 1., z__3.i = beta->i + 0.;
  476. d__2 = z__3.r;
  477. z__1.r = d__1, z__1.i = d__2;
  478. a[i__1].r = z__1.r, a[i__1].i = z__1.i;
  479. i__1 = a_dim1 * 5 + 5;
  480. d_cnjg(&z__1, &a[(a_dim1 << 2) + 4]);
  481. a[i__1].r = z__1.r, a[i__1].i = z__1.i;
  482. }
  483. /* Form X and Y */
  484. zlacpy_("F", n, n, &b[b_offset], lda, &y[y_offset], ldy);
  485. i__1 = y_dim1 + 3;
  486. d_cnjg(&z__2, wy);
  487. z__1.r = -z__2.r, z__1.i = -z__2.i;
  488. y[i__1].r = z__1.r, y[i__1].i = z__1.i;
  489. i__1 = y_dim1 + 4;
  490. d_cnjg(&z__1, wy);
  491. y[i__1].r = z__1.r, y[i__1].i = z__1.i;
  492. i__1 = y_dim1 + 5;
  493. d_cnjg(&z__2, wy);
  494. z__1.r = -z__2.r, z__1.i = -z__2.i;
  495. y[i__1].r = z__1.r, y[i__1].i = z__1.i;
  496. i__1 = (y_dim1 << 1) + 3;
  497. d_cnjg(&z__2, wy);
  498. z__1.r = -z__2.r, z__1.i = -z__2.i;
  499. y[i__1].r = z__1.r, y[i__1].i = z__1.i;
  500. i__1 = (y_dim1 << 1) + 4;
  501. d_cnjg(&z__1, wy);
  502. y[i__1].r = z__1.r, y[i__1].i = z__1.i;
  503. i__1 = (y_dim1 << 1) + 5;
  504. d_cnjg(&z__2, wy);
  505. z__1.r = -z__2.r, z__1.i = -z__2.i;
  506. y[i__1].r = z__1.r, y[i__1].i = z__1.i;
  507. zlacpy_("F", n, n, &b[b_offset], lda, &x[x_offset], ldx);
  508. i__1 = x_dim1 * 3 + 1;
  509. z__1.r = -wx->r, z__1.i = -wx->i;
  510. x[i__1].r = z__1.r, x[i__1].i = z__1.i;
  511. i__1 = (x_dim1 << 2) + 1;
  512. z__1.r = -wx->r, z__1.i = -wx->i;
  513. x[i__1].r = z__1.r, x[i__1].i = z__1.i;
  514. i__1 = x_dim1 * 5 + 1;
  515. x[i__1].r = wx->r, x[i__1].i = wx->i;
  516. i__1 = x_dim1 * 3 + 2;
  517. x[i__1].r = wx->r, x[i__1].i = wx->i;
  518. i__1 = (x_dim1 << 2) + 2;
  519. z__1.r = -wx->r, z__1.i = -wx->i;
  520. x[i__1].r = z__1.r, x[i__1].i = z__1.i;
  521. i__1 = x_dim1 * 5 + 2;
  522. z__1.r = -wx->r, z__1.i = -wx->i;
  523. x[i__1].r = z__1.r, x[i__1].i = z__1.i;
  524. /* Form (A, B) */
  525. i__1 = b_dim1 * 3 + 1;
  526. z__1.r = wx->r + wy->r, z__1.i = wx->i + wy->i;
  527. b[i__1].r = z__1.r, b[i__1].i = z__1.i;
  528. i__1 = b_dim1 * 3 + 2;
  529. z__2.r = -wx->r, z__2.i = -wx->i;
  530. z__1.r = z__2.r + wy->r, z__1.i = z__2.i + wy->i;
  531. b[i__1].r = z__1.r, b[i__1].i = z__1.i;
  532. i__1 = (b_dim1 << 2) + 1;
  533. z__1.r = wx->r - wy->r, z__1.i = wx->i - wy->i;
  534. b[i__1].r = z__1.r, b[i__1].i = z__1.i;
  535. i__1 = (b_dim1 << 2) + 2;
  536. z__1.r = wx->r - wy->r, z__1.i = wx->i - wy->i;
  537. b[i__1].r = z__1.r, b[i__1].i = z__1.i;
  538. i__1 = b_dim1 * 5 + 1;
  539. z__2.r = -wx->r, z__2.i = -wx->i;
  540. z__1.r = z__2.r + wy->r, z__1.i = z__2.i + wy->i;
  541. b[i__1].r = z__1.r, b[i__1].i = z__1.i;
  542. i__1 = b_dim1 * 5 + 2;
  543. z__1.r = wx->r + wy->r, z__1.i = wx->i + wy->i;
  544. b[i__1].r = z__1.r, b[i__1].i = z__1.i;
  545. i__1 = a_dim1 * 3 + 1;
  546. i__2 = a_dim1 + 1;
  547. z__2.r = wx->r * a[i__2].r - wx->i * a[i__2].i, z__2.i = wx->r * a[i__2]
  548. .i + wx->i * a[i__2].r;
  549. i__3 = a_dim1 * 3 + 3;
  550. z__3.r = wy->r * a[i__3].r - wy->i * a[i__3].i, z__3.i = wy->r * a[i__3]
  551. .i + wy->i * a[i__3].r;
  552. z__1.r = z__2.r + z__3.r, z__1.i = z__2.i + z__3.i;
  553. a[i__1].r = z__1.r, a[i__1].i = z__1.i;
  554. i__1 = a_dim1 * 3 + 2;
  555. z__3.r = -wx->r, z__3.i = -wx->i;
  556. i__2 = (a_dim1 << 1) + 2;
  557. z__2.r = z__3.r * a[i__2].r - z__3.i * a[i__2].i, z__2.i = z__3.r * a[
  558. i__2].i + z__3.i * a[i__2].r;
  559. i__3 = a_dim1 * 3 + 3;
  560. z__4.r = wy->r * a[i__3].r - wy->i * a[i__3].i, z__4.i = wy->r * a[i__3]
  561. .i + wy->i * a[i__3].r;
  562. z__1.r = z__2.r + z__4.r, z__1.i = z__2.i + z__4.i;
  563. a[i__1].r = z__1.r, a[i__1].i = z__1.i;
  564. i__1 = (a_dim1 << 2) + 1;
  565. i__2 = a_dim1 + 1;
  566. z__2.r = wx->r * a[i__2].r - wx->i * a[i__2].i, z__2.i = wx->r * a[i__2]
  567. .i + wx->i * a[i__2].r;
  568. i__3 = (a_dim1 << 2) + 4;
  569. z__3.r = wy->r * a[i__3].r - wy->i * a[i__3].i, z__3.i = wy->r * a[i__3]
  570. .i + wy->i * a[i__3].r;
  571. z__1.r = z__2.r - z__3.r, z__1.i = z__2.i - z__3.i;
  572. a[i__1].r = z__1.r, a[i__1].i = z__1.i;
  573. i__1 = (a_dim1 << 2) + 2;
  574. i__2 = (a_dim1 << 1) + 2;
  575. z__2.r = wx->r * a[i__2].r - wx->i * a[i__2].i, z__2.i = wx->r * a[i__2]
  576. .i + wx->i * a[i__2].r;
  577. i__3 = (a_dim1 << 2) + 4;
  578. z__3.r = wy->r * a[i__3].r - wy->i * a[i__3].i, z__3.i = wy->r * a[i__3]
  579. .i + wy->i * a[i__3].r;
  580. z__1.r = z__2.r - z__3.r, z__1.i = z__2.i - z__3.i;
  581. a[i__1].r = z__1.r, a[i__1].i = z__1.i;
  582. i__1 = a_dim1 * 5 + 1;
  583. z__3.r = -wx->r, z__3.i = -wx->i;
  584. i__2 = a_dim1 + 1;
  585. z__2.r = z__3.r * a[i__2].r - z__3.i * a[i__2].i, z__2.i = z__3.r * a[
  586. i__2].i + z__3.i * a[i__2].r;
  587. i__3 = a_dim1 * 5 + 5;
  588. z__4.r = wy->r * a[i__3].r - wy->i * a[i__3].i, z__4.i = wy->r * a[i__3]
  589. .i + wy->i * a[i__3].r;
  590. z__1.r = z__2.r + z__4.r, z__1.i = z__2.i + z__4.i;
  591. a[i__1].r = z__1.r, a[i__1].i = z__1.i;
  592. i__1 = a_dim1 * 5 + 2;
  593. i__2 = (a_dim1 << 1) + 2;
  594. z__2.r = wx->r * a[i__2].r - wx->i * a[i__2].i, z__2.i = wx->r * a[i__2]
  595. .i + wx->i * a[i__2].r;
  596. i__3 = a_dim1 * 5 + 5;
  597. z__3.r = wy->r * a[i__3].r - wy->i * a[i__3].i, z__3.i = wy->r * a[i__3]
  598. .i + wy->i * a[i__3].r;
  599. z__1.r = z__2.r + z__3.r, z__1.i = z__2.i + z__3.i;
  600. a[i__1].r = z__1.r, a[i__1].i = z__1.i;
  601. /* Compute condition numbers */
  602. s[1] = 1. / sqrt((z_abs(wy) * 3. * z_abs(wy) + 1.) / (z_abs(&a[a_dim1 + 1]
  603. ) * z_abs(&a[a_dim1 + 1]) + 1.));
  604. s[2] = 1. / sqrt((z_abs(wy) * 3. * z_abs(wy) + 1.) / (z_abs(&a[(a_dim1 <<
  605. 1) + 2]) * z_abs(&a[(a_dim1 << 1) + 2]) + 1.));
  606. s[3] = 1. / sqrt((z_abs(wx) * 2. * z_abs(wx) + 1.) / (z_abs(&a[a_dim1 * 3
  607. + 3]) * z_abs(&a[a_dim1 * 3 + 3]) + 1.));
  608. s[4] = 1. / sqrt((z_abs(wx) * 2. * z_abs(wx) + 1.) / (z_abs(&a[(a_dim1 <<
  609. 2) + 4]) * z_abs(&a[(a_dim1 << 2) + 4]) + 1.));
  610. s[5] = 1. / sqrt((z_abs(wx) * 2. * z_abs(wx) + 1.) / (z_abs(&a[a_dim1 * 5
  611. + 5]) * z_abs(&a[a_dim1 * 5 + 5]) + 1.));
  612. zlakf2_(&c__1, &c__4, &a[a_offset], lda, &a[(a_dim1 << 1) + 2], &b[
  613. b_offset], &b[(b_dim1 << 1) + 2], z__, &c__8);
  614. zgesvd_("N", "N", &c__8, &c__8, z__, &c__8, rwork, work, &c__1, &work[1],
  615. &c__1, &work[2], &c__24, &rwork[8], &info);
  616. dif[1] = rwork[7];
  617. zlakf2_(&c__4, &c__1, &a[a_offset], lda, &a[a_dim1 * 5 + 5], &b[b_offset],
  618. &b[b_dim1 * 5 + 5], z__, &c__8);
  619. zgesvd_("N", "N", &c__8, &c__8, z__, &c__8, rwork, work, &c__1, &work[1],
  620. &c__1, &work[2], &c__24, &rwork[8], &info);
  621. dif[5] = rwork[7];
  622. return;
  623. /* End of ZLATM6 */
  624. } /* zlatm6_ */