dtrevc.c 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229
  1. /* dtrevc.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 logical c_false = FALSE_;
  15. static integer c__1 = 1;
  16. static doublereal c_b22 = 1.;
  17. static doublereal c_b25 = 0.;
  18. static integer c__2 = 2;
  19. static logical c_true = TRUE_;
  20. /* Subroutine */ int _starpu_dtrevc_(char *side, char *howmny, logical *select,
  21. integer *n, doublereal *t, integer *ldt, doublereal *vl, integer *
  22. ldvl, doublereal *vr, integer *ldvr, integer *mm, integer *m,
  23. doublereal *work, integer *info)
  24. {
  25. /* System generated locals */
  26. integer t_dim1, t_offset, vl_dim1, vl_offset, vr_dim1, vr_offset, i__1,
  27. i__2, i__3;
  28. doublereal d__1, d__2, d__3, d__4;
  29. /* Builtin functions */
  30. double sqrt(doublereal);
  31. /* Local variables */
  32. integer i__, j, k;
  33. doublereal x[4] /* was [2][2] */;
  34. integer j1, j2, n2, ii, ki, ip, is;
  35. doublereal wi, wr, rec, ulp, beta, emax;
  36. logical pair;
  37. extern doublereal _starpu_ddot_(integer *, doublereal *, integer *, doublereal *,
  38. integer *);
  39. logical allv;
  40. integer ierr;
  41. doublereal unfl, ovfl, smin;
  42. logical over;
  43. doublereal vmax;
  44. integer jnxt;
  45. extern /* Subroutine */ int _starpu_dscal_(integer *, doublereal *, doublereal *,
  46. integer *);
  47. doublereal scale;
  48. extern logical _starpu_lsame_(char *, char *);
  49. extern /* Subroutine */ int _starpu_dgemv_(char *, integer *, integer *,
  50. doublereal *, doublereal *, integer *, doublereal *, integer *,
  51. doublereal *, doublereal *, integer *);
  52. doublereal remax;
  53. extern /* Subroutine */ int _starpu_dcopy_(integer *, doublereal *, integer *,
  54. doublereal *, integer *);
  55. logical leftv, bothv;
  56. extern /* Subroutine */ int _starpu_daxpy_(integer *, doublereal *, doublereal *,
  57. integer *, doublereal *, integer *);
  58. doublereal vcrit;
  59. logical somev;
  60. doublereal xnorm;
  61. extern /* Subroutine */ int _starpu_dlaln2_(logical *, integer *, integer *,
  62. doublereal *, doublereal *, doublereal *, integer *, doublereal *,
  63. doublereal *, doublereal *, integer *, doublereal *, doublereal *
  64. , doublereal *, integer *, doublereal *, doublereal *, integer *),
  65. _starpu_dlabad_(doublereal *, doublereal *);
  66. extern doublereal _starpu_dlamch_(char *);
  67. extern integer _starpu_idamax_(integer *, doublereal *, integer *);
  68. extern /* Subroutine */ int _starpu_xerbla_(char *, integer *);
  69. doublereal bignum;
  70. logical rightv;
  71. doublereal smlnum;
  72. /* -- LAPACK routine (version 3.2) -- */
  73. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  74. /* November 2006 */
  75. /* .. Scalar Arguments .. */
  76. /* .. */
  77. /* .. Array Arguments .. */
  78. /* .. */
  79. /* Purpose */
  80. /* ======= */
  81. /* DTREVC computes some or all of the right and/or left eigenvectors of */
  82. /* a real upper quasi-triangular matrix T. */
  83. /* Matrices of this type are produced by the Schur factorization of */
  84. /* a real general matrix: A = Q*T*Q**T, as computed by DHSEQR. */
  85. /* The right eigenvector x and the left eigenvector y of T corresponding */
  86. /* to an eigenvalue w are defined by: */
  87. /* T*x = w*x, (y**H)*T = w*(y**H) */
  88. /* where y**H denotes the conjugate transpose of y. */
  89. /* The eigenvalues are not input to this routine, but are read directly */
  90. /* from the diagonal blocks of T. */
  91. /* This routine returns the matrices X and/or Y of right and left */
  92. /* eigenvectors of T, or the products Q*X and/or Q*Y, where Q is an */
  93. /* input matrix. If Q is the orthogonal factor that reduces a matrix */
  94. /* A to Schur form T, then Q*X and Q*Y are the matrices of right and */
  95. /* left eigenvectors of A. */
  96. /* Arguments */
  97. /* ========= */
  98. /* SIDE (input) CHARACTER*1 */
  99. /* = 'R': compute right eigenvectors only; */
  100. /* = 'L': compute left eigenvectors only; */
  101. /* = 'B': compute both right and left eigenvectors. */
  102. /* HOWMNY (input) CHARACTER*1 */
  103. /* = 'A': compute all right and/or left eigenvectors; */
  104. /* = 'B': compute all right and/or left eigenvectors, */
  105. /* backtransformed by the matrices in VR and/or VL; */
  106. /* = 'S': compute selected right and/or left eigenvectors, */
  107. /* as indicated by the logical array SELECT. */
  108. /* SELECT (input/output) LOGICAL array, dimension (N) */
  109. /* If HOWMNY = 'S', SELECT specifies the eigenvectors to be */
  110. /* computed. */
  111. /* If w(j) is a real eigenvalue, the corresponding real */
  112. /* eigenvector is computed if SELECT(j) is .TRUE.. */
  113. /* If w(j) and w(j+1) are the real and imaginary parts of a */
  114. /* complex eigenvalue, the corresponding complex eigenvector is */
  115. /* computed if either SELECT(j) or SELECT(j+1) is .TRUE., and */
  116. /* on exit SELECT(j) is set to .TRUE. and SELECT(j+1) is set to */
  117. /* .FALSE.. */
  118. /* Not referenced if HOWMNY = 'A' or 'B'. */
  119. /* N (input) INTEGER */
  120. /* The order of the matrix T. N >= 0. */
  121. /* T (input) DOUBLE PRECISION array, dimension (LDT,N) */
  122. /* The upper quasi-triangular matrix T in Schur canonical form. */
  123. /* LDT (input) INTEGER */
  124. /* The leading dimension of the array T. LDT >= max(1,N). */
  125. /* VL (input/output) DOUBLE PRECISION array, dimension (LDVL,MM) */
  126. /* On entry, if SIDE = 'L' or 'B' and HOWMNY = 'B', VL must */
  127. /* contain an N-by-N matrix Q (usually the orthogonal matrix Q */
  128. /* of Schur vectors returned by DHSEQR). */
  129. /* On exit, if SIDE = 'L' or 'B', VL contains: */
  130. /* if HOWMNY = 'A', the matrix Y of left eigenvectors of T; */
  131. /* if HOWMNY = 'B', the matrix Q*Y; */
  132. /* if HOWMNY = 'S', the left eigenvectors of T specified by */
  133. /* SELECT, stored consecutively in the columns */
  134. /* of VL, in the same order as their */
  135. /* eigenvalues. */
  136. /* A complex eigenvector corresponding to a complex eigenvalue */
  137. /* is stored in two consecutive columns, the first holding the */
  138. /* real part, and the second the imaginary part. */
  139. /* Not referenced if SIDE = 'R'. */
  140. /* LDVL (input) INTEGER */
  141. /* The leading dimension of the array VL. LDVL >= 1, and if */
  142. /* SIDE = 'L' or 'B', LDVL >= N. */
  143. /* VR (input/output) DOUBLE PRECISION array, dimension (LDVR,MM) */
  144. /* On entry, if SIDE = 'R' or 'B' and HOWMNY = 'B', VR must */
  145. /* contain an N-by-N matrix Q (usually the orthogonal matrix Q */
  146. /* of Schur vectors returned by DHSEQR). */
  147. /* On exit, if SIDE = 'R' or 'B', VR contains: */
  148. /* if HOWMNY = 'A', the matrix X of right eigenvectors of T; */
  149. /* if HOWMNY = 'B', the matrix Q*X; */
  150. /* if HOWMNY = 'S', the right eigenvectors of T specified by */
  151. /* SELECT, stored consecutively in the columns */
  152. /* of VR, in the same order as their */
  153. /* eigenvalues. */
  154. /* A complex eigenvector corresponding to a complex eigenvalue */
  155. /* is stored in two consecutive columns, the first holding the */
  156. /* real part and the second the imaginary part. */
  157. /* Not referenced if SIDE = 'L'. */
  158. /* LDVR (input) INTEGER */
  159. /* The leading dimension of the array VR. LDVR >= 1, and if */
  160. /* SIDE = 'R' or 'B', LDVR >= N. */
  161. /* MM (input) INTEGER */
  162. /* The number of columns in the arrays VL and/or VR. MM >= M. */
  163. /* M (output) INTEGER */
  164. /* The number of columns in the arrays VL and/or VR actually */
  165. /* used to store the eigenvectors. */
  166. /* If HOWMNY = 'A' or 'B', M is set to N. */
  167. /* Each selected real eigenvector occupies one column and each */
  168. /* selected complex eigenvector occupies two columns. */
  169. /* WORK (workspace) DOUBLE PRECISION array, dimension (3*N) */
  170. /* INFO (output) INTEGER */
  171. /* = 0: successful exit */
  172. /* < 0: if INFO = -i, the i-th argument had an illegal value */
  173. /* Further Details */
  174. /* =============== */
  175. /* The algorithm used in this program is basically backward (forward) */
  176. /* substitution, with scaling to make the the code robust against */
  177. /* possible overflow. */
  178. /* Each eigenvector is normalized so that the element of largest */
  179. /* magnitude has magnitude 1; here the magnitude of a complex number */
  180. /* (x,y) is taken to be |x| + |y|. */
  181. /* ===================================================================== */
  182. /* .. Parameters .. */
  183. /* .. */
  184. /* .. Local Scalars .. */
  185. /* .. */
  186. /* .. External Functions .. */
  187. /* .. */
  188. /* .. External Subroutines .. */
  189. /* .. */
  190. /* .. Intrinsic Functions .. */
  191. /* .. */
  192. /* .. Local Arrays .. */
  193. /* .. */
  194. /* .. Executable Statements .. */
  195. /* Decode and test the input parameters */
  196. /* Parameter adjustments */
  197. --select;
  198. t_dim1 = *ldt;
  199. t_offset = 1 + t_dim1;
  200. t -= t_offset;
  201. vl_dim1 = *ldvl;
  202. vl_offset = 1 + vl_dim1;
  203. vl -= vl_offset;
  204. vr_dim1 = *ldvr;
  205. vr_offset = 1 + vr_dim1;
  206. vr -= vr_offset;
  207. --work;
  208. /* Function Body */
  209. bothv = _starpu_lsame_(side, "B");
  210. rightv = _starpu_lsame_(side, "R") || bothv;
  211. leftv = _starpu_lsame_(side, "L") || bothv;
  212. allv = _starpu_lsame_(howmny, "A");
  213. over = _starpu_lsame_(howmny, "B");
  214. somev = _starpu_lsame_(howmny, "S");
  215. *info = 0;
  216. if (! rightv && ! leftv) {
  217. *info = -1;
  218. } else if (! allv && ! over && ! somev) {
  219. *info = -2;
  220. } else if (*n < 0) {
  221. *info = -4;
  222. } else if (*ldt < max(1,*n)) {
  223. *info = -6;
  224. } else if (*ldvl < 1 || leftv && *ldvl < *n) {
  225. *info = -8;
  226. } else if (*ldvr < 1 || rightv && *ldvr < *n) {
  227. *info = -10;
  228. } else {
  229. /* Set M to the number of columns required to store the selected */
  230. /* eigenvectors, standardize the array SELECT if necessary, and */
  231. /* test MM. */
  232. if (somev) {
  233. *m = 0;
  234. pair = FALSE_;
  235. i__1 = *n;
  236. for (j = 1; j <= i__1; ++j) {
  237. if (pair) {
  238. pair = FALSE_;
  239. select[j] = FALSE_;
  240. } else {
  241. if (j < *n) {
  242. if (t[j + 1 + j * t_dim1] == 0.) {
  243. if (select[j]) {
  244. ++(*m);
  245. }
  246. } else {
  247. pair = TRUE_;
  248. if (select[j] || select[j + 1]) {
  249. select[j] = TRUE_;
  250. *m += 2;
  251. }
  252. }
  253. } else {
  254. if (select[*n]) {
  255. ++(*m);
  256. }
  257. }
  258. }
  259. /* L10: */
  260. }
  261. } else {
  262. *m = *n;
  263. }
  264. if (*mm < *m) {
  265. *info = -11;
  266. }
  267. }
  268. if (*info != 0) {
  269. i__1 = -(*info);
  270. _starpu_xerbla_("DTREVC", &i__1);
  271. return 0;
  272. }
  273. /* Quick return if possible. */
  274. if (*n == 0) {
  275. return 0;
  276. }
  277. /* Set the constants to control overflow. */
  278. unfl = _starpu_dlamch_("Safe minimum");
  279. ovfl = 1. / unfl;
  280. _starpu_dlabad_(&unfl, &ovfl);
  281. ulp = _starpu_dlamch_("Precision");
  282. smlnum = unfl * (*n / ulp);
  283. bignum = (1. - ulp) / smlnum;
  284. /* Compute 1-norm of each column of strictly upper triangular */
  285. /* part of T to control overflow in triangular solver. */
  286. work[1] = 0.;
  287. i__1 = *n;
  288. for (j = 2; j <= i__1; ++j) {
  289. work[j] = 0.;
  290. i__2 = j - 1;
  291. for (i__ = 1; i__ <= i__2; ++i__) {
  292. work[j] += (d__1 = t[i__ + j * t_dim1], abs(d__1));
  293. /* L20: */
  294. }
  295. /* L30: */
  296. }
  297. /* Index IP is used to specify the real or complex eigenvalue: */
  298. /* IP = 0, real eigenvalue, */
  299. /* 1, first of conjugate complex pair: (wr,wi) */
  300. /* -1, second of conjugate complex pair: (wr,wi) */
  301. n2 = *n << 1;
  302. if (rightv) {
  303. /* Compute right eigenvectors. */
  304. ip = 0;
  305. is = *m;
  306. for (ki = *n; ki >= 1; --ki) {
  307. if (ip == 1) {
  308. goto L130;
  309. }
  310. if (ki == 1) {
  311. goto L40;
  312. }
  313. if (t[ki + (ki - 1) * t_dim1] == 0.) {
  314. goto L40;
  315. }
  316. ip = -1;
  317. L40:
  318. if (somev) {
  319. if (ip == 0) {
  320. if (! select[ki]) {
  321. goto L130;
  322. }
  323. } else {
  324. if (! select[ki - 1]) {
  325. goto L130;
  326. }
  327. }
  328. }
  329. /* Compute the KI-th eigenvalue (WR,WI). */
  330. wr = t[ki + ki * t_dim1];
  331. wi = 0.;
  332. if (ip != 0) {
  333. wi = sqrt((d__1 = t[ki + (ki - 1) * t_dim1], abs(d__1))) *
  334. sqrt((d__2 = t[ki - 1 + ki * t_dim1], abs(d__2)));
  335. }
  336. /* Computing MAX */
  337. d__1 = ulp * (abs(wr) + abs(wi));
  338. smin = max(d__1,smlnum);
  339. if (ip == 0) {
  340. /* Real right eigenvector */
  341. work[ki + *n] = 1.;
  342. /* Form right-hand side */
  343. i__1 = ki - 1;
  344. for (k = 1; k <= i__1; ++k) {
  345. work[k + *n] = -t[k + ki * t_dim1];
  346. /* L50: */
  347. }
  348. /* Solve the upper quasi-triangular system: */
  349. /* (T(1:KI-1,1:KI-1) - WR)*X = SCALE*WORK. */
  350. jnxt = ki - 1;
  351. for (j = ki - 1; j >= 1; --j) {
  352. if (j > jnxt) {
  353. goto L60;
  354. }
  355. j1 = j;
  356. j2 = j;
  357. jnxt = j - 1;
  358. if (j > 1) {
  359. if (t[j + (j - 1) * t_dim1] != 0.) {
  360. j1 = j - 1;
  361. jnxt = j - 2;
  362. }
  363. }
  364. if (j1 == j2) {
  365. /* 1-by-1 diagonal block */
  366. _starpu_dlaln2_(&c_false, &c__1, &c__1, &smin, &c_b22, &t[j +
  367. j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
  368. n], n, &wr, &c_b25, x, &c__2, &scale, &xnorm,
  369. &ierr);
  370. /* Scale X(1,1) to avoid overflow when updating */
  371. /* the right-hand side. */
  372. if (xnorm > 1.) {
  373. if (work[j] > bignum / xnorm) {
  374. x[0] /= xnorm;
  375. scale /= xnorm;
  376. }
  377. }
  378. /* Scale if necessary */
  379. if (scale != 1.) {
  380. _starpu_dscal_(&ki, &scale, &work[*n + 1], &c__1);
  381. }
  382. work[j + *n] = x[0];
  383. /* Update right-hand side */
  384. i__1 = j - 1;
  385. d__1 = -x[0];
  386. _starpu_daxpy_(&i__1, &d__1, &t[j * t_dim1 + 1], &c__1, &work[
  387. *n + 1], &c__1);
  388. } else {
  389. /* 2-by-2 diagonal block */
  390. _starpu_dlaln2_(&c_false, &c__2, &c__1, &smin, &c_b22, &t[j -
  391. 1 + (j - 1) * t_dim1], ldt, &c_b22, &c_b22, &
  392. work[j - 1 + *n], n, &wr, &c_b25, x, &c__2, &
  393. scale, &xnorm, &ierr);
  394. /* Scale X(1,1) and X(2,1) to avoid overflow when */
  395. /* updating the right-hand side. */
  396. if (xnorm > 1.) {
  397. /* Computing MAX */
  398. d__1 = work[j - 1], d__2 = work[j];
  399. beta = max(d__1,d__2);
  400. if (beta > bignum / xnorm) {
  401. x[0] /= xnorm;
  402. x[1] /= xnorm;
  403. scale /= xnorm;
  404. }
  405. }
  406. /* Scale if necessary */
  407. if (scale != 1.) {
  408. _starpu_dscal_(&ki, &scale, &work[*n + 1], &c__1);
  409. }
  410. work[j - 1 + *n] = x[0];
  411. work[j + *n] = x[1];
  412. /* Update right-hand side */
  413. i__1 = j - 2;
  414. d__1 = -x[0];
  415. _starpu_daxpy_(&i__1, &d__1, &t[(j - 1) * t_dim1 + 1], &c__1,
  416. &work[*n + 1], &c__1);
  417. i__1 = j - 2;
  418. d__1 = -x[1];
  419. _starpu_daxpy_(&i__1, &d__1, &t[j * t_dim1 + 1], &c__1, &work[
  420. *n + 1], &c__1);
  421. }
  422. L60:
  423. ;
  424. }
  425. /* Copy the vector x or Q*x to VR and normalize. */
  426. if (! over) {
  427. _starpu_dcopy_(&ki, &work[*n + 1], &c__1, &vr[is * vr_dim1 + 1], &
  428. c__1);
  429. ii = _starpu_idamax_(&ki, &vr[is * vr_dim1 + 1], &c__1);
  430. remax = 1. / (d__1 = vr[ii + is * vr_dim1], abs(d__1));
  431. _starpu_dscal_(&ki, &remax, &vr[is * vr_dim1 + 1], &c__1);
  432. i__1 = *n;
  433. for (k = ki + 1; k <= i__1; ++k) {
  434. vr[k + is * vr_dim1] = 0.;
  435. /* L70: */
  436. }
  437. } else {
  438. if (ki > 1) {
  439. i__1 = ki - 1;
  440. _starpu_dgemv_("N", n, &i__1, &c_b22, &vr[vr_offset], ldvr, &
  441. work[*n + 1], &c__1, &work[ki + *n], &vr[ki *
  442. vr_dim1 + 1], &c__1);
  443. }
  444. ii = _starpu_idamax_(n, &vr[ki * vr_dim1 + 1], &c__1);
  445. remax = 1. / (d__1 = vr[ii + ki * vr_dim1], abs(d__1));
  446. _starpu_dscal_(n, &remax, &vr[ki * vr_dim1 + 1], &c__1);
  447. }
  448. } else {
  449. /* Complex right eigenvector. */
  450. /* Initial solve */
  451. /* [ (T(KI-1,KI-1) T(KI-1,KI) ) - (WR + I* WI)]*X = 0. */
  452. /* [ (T(KI,KI-1) T(KI,KI) ) ] */
  453. if ((d__1 = t[ki - 1 + ki * t_dim1], abs(d__1)) >= (d__2 = t[
  454. ki + (ki - 1) * t_dim1], abs(d__2))) {
  455. work[ki - 1 + *n] = 1.;
  456. work[ki + n2] = wi / t[ki - 1 + ki * t_dim1];
  457. } else {
  458. work[ki - 1 + *n] = -wi / t[ki + (ki - 1) * t_dim1];
  459. work[ki + n2] = 1.;
  460. }
  461. work[ki + *n] = 0.;
  462. work[ki - 1 + n2] = 0.;
  463. /* Form right-hand side */
  464. i__1 = ki - 2;
  465. for (k = 1; k <= i__1; ++k) {
  466. work[k + *n] = -work[ki - 1 + *n] * t[k + (ki - 1) *
  467. t_dim1];
  468. work[k + n2] = -work[ki + n2] * t[k + ki * t_dim1];
  469. /* L80: */
  470. }
  471. /* Solve upper quasi-triangular system: */
  472. /* (T(1:KI-2,1:KI-2) - (WR+i*WI))*X = SCALE*(WORK+i*WORK2) */
  473. jnxt = ki - 2;
  474. for (j = ki - 2; j >= 1; --j) {
  475. if (j > jnxt) {
  476. goto L90;
  477. }
  478. j1 = j;
  479. j2 = j;
  480. jnxt = j - 1;
  481. if (j > 1) {
  482. if (t[j + (j - 1) * t_dim1] != 0.) {
  483. j1 = j - 1;
  484. jnxt = j - 2;
  485. }
  486. }
  487. if (j1 == j2) {
  488. /* 1-by-1 diagonal block */
  489. _starpu_dlaln2_(&c_false, &c__1, &c__2, &smin, &c_b22, &t[j +
  490. j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
  491. n], n, &wr, &wi, x, &c__2, &scale, &xnorm, &
  492. ierr);
  493. /* Scale X(1,1) and X(1,2) to avoid overflow when */
  494. /* updating the right-hand side. */
  495. if (xnorm > 1.) {
  496. if (work[j] > bignum / xnorm) {
  497. x[0] /= xnorm;
  498. x[2] /= xnorm;
  499. scale /= xnorm;
  500. }
  501. }
  502. /* Scale if necessary */
  503. if (scale != 1.) {
  504. _starpu_dscal_(&ki, &scale, &work[*n + 1], &c__1);
  505. _starpu_dscal_(&ki, &scale, &work[n2 + 1], &c__1);
  506. }
  507. work[j + *n] = x[0];
  508. work[j + n2] = x[2];
  509. /* Update the right-hand side */
  510. i__1 = j - 1;
  511. d__1 = -x[0];
  512. _starpu_daxpy_(&i__1, &d__1, &t[j * t_dim1 + 1], &c__1, &work[
  513. *n + 1], &c__1);
  514. i__1 = j - 1;
  515. d__1 = -x[2];
  516. _starpu_daxpy_(&i__1, &d__1, &t[j * t_dim1 + 1], &c__1, &work[
  517. n2 + 1], &c__1);
  518. } else {
  519. /* 2-by-2 diagonal block */
  520. _starpu_dlaln2_(&c_false, &c__2, &c__2, &smin, &c_b22, &t[j -
  521. 1 + (j - 1) * t_dim1], ldt, &c_b22, &c_b22, &
  522. work[j - 1 + *n], n, &wr, &wi, x, &c__2, &
  523. scale, &xnorm, &ierr);
  524. /* Scale X to avoid overflow when updating */
  525. /* the right-hand side. */
  526. if (xnorm > 1.) {
  527. /* Computing MAX */
  528. d__1 = work[j - 1], d__2 = work[j];
  529. beta = max(d__1,d__2);
  530. if (beta > bignum / xnorm) {
  531. rec = 1. / xnorm;
  532. x[0] *= rec;
  533. x[2] *= rec;
  534. x[1] *= rec;
  535. x[3] *= rec;
  536. scale *= rec;
  537. }
  538. }
  539. /* Scale if necessary */
  540. if (scale != 1.) {
  541. _starpu_dscal_(&ki, &scale, &work[*n + 1], &c__1);
  542. _starpu_dscal_(&ki, &scale, &work[n2 + 1], &c__1);
  543. }
  544. work[j - 1 + *n] = x[0];
  545. work[j + *n] = x[1];
  546. work[j - 1 + n2] = x[2];
  547. work[j + n2] = x[3];
  548. /* Update the right-hand side */
  549. i__1 = j - 2;
  550. d__1 = -x[0];
  551. _starpu_daxpy_(&i__1, &d__1, &t[(j - 1) * t_dim1 + 1], &c__1,
  552. &work[*n + 1], &c__1);
  553. i__1 = j - 2;
  554. d__1 = -x[1];
  555. _starpu_daxpy_(&i__1, &d__1, &t[j * t_dim1 + 1], &c__1, &work[
  556. *n + 1], &c__1);
  557. i__1 = j - 2;
  558. d__1 = -x[2];
  559. _starpu_daxpy_(&i__1, &d__1, &t[(j - 1) * t_dim1 + 1], &c__1,
  560. &work[n2 + 1], &c__1);
  561. i__1 = j - 2;
  562. d__1 = -x[3];
  563. _starpu_daxpy_(&i__1, &d__1, &t[j * t_dim1 + 1], &c__1, &work[
  564. n2 + 1], &c__1);
  565. }
  566. L90:
  567. ;
  568. }
  569. /* Copy the vector x or Q*x to VR and normalize. */
  570. if (! over) {
  571. _starpu_dcopy_(&ki, &work[*n + 1], &c__1, &vr[(is - 1) * vr_dim1
  572. + 1], &c__1);
  573. _starpu_dcopy_(&ki, &work[n2 + 1], &c__1, &vr[is * vr_dim1 + 1], &
  574. c__1);
  575. emax = 0.;
  576. i__1 = ki;
  577. for (k = 1; k <= i__1; ++k) {
  578. /* Computing MAX */
  579. d__3 = emax, d__4 = (d__1 = vr[k + (is - 1) * vr_dim1]
  580. , abs(d__1)) + (d__2 = vr[k + is * vr_dim1],
  581. abs(d__2));
  582. emax = max(d__3,d__4);
  583. /* L100: */
  584. }
  585. remax = 1. / emax;
  586. _starpu_dscal_(&ki, &remax, &vr[(is - 1) * vr_dim1 + 1], &c__1);
  587. _starpu_dscal_(&ki, &remax, &vr[is * vr_dim1 + 1], &c__1);
  588. i__1 = *n;
  589. for (k = ki + 1; k <= i__1; ++k) {
  590. vr[k + (is - 1) * vr_dim1] = 0.;
  591. vr[k + is * vr_dim1] = 0.;
  592. /* L110: */
  593. }
  594. } else {
  595. if (ki > 2) {
  596. i__1 = ki - 2;
  597. _starpu_dgemv_("N", n, &i__1, &c_b22, &vr[vr_offset], ldvr, &
  598. work[*n + 1], &c__1, &work[ki - 1 + *n], &vr[(
  599. ki - 1) * vr_dim1 + 1], &c__1);
  600. i__1 = ki - 2;
  601. _starpu_dgemv_("N", n, &i__1, &c_b22, &vr[vr_offset], ldvr, &
  602. work[n2 + 1], &c__1, &work[ki + n2], &vr[ki *
  603. vr_dim1 + 1], &c__1);
  604. } else {
  605. _starpu_dscal_(n, &work[ki - 1 + *n], &vr[(ki - 1) * vr_dim1
  606. + 1], &c__1);
  607. _starpu_dscal_(n, &work[ki + n2], &vr[ki * vr_dim1 + 1], &
  608. c__1);
  609. }
  610. emax = 0.;
  611. i__1 = *n;
  612. for (k = 1; k <= i__1; ++k) {
  613. /* Computing MAX */
  614. d__3 = emax, d__4 = (d__1 = vr[k + (ki - 1) * vr_dim1]
  615. , abs(d__1)) + (d__2 = vr[k + ki * vr_dim1],
  616. abs(d__2));
  617. emax = max(d__3,d__4);
  618. /* L120: */
  619. }
  620. remax = 1. / emax;
  621. _starpu_dscal_(n, &remax, &vr[(ki - 1) * vr_dim1 + 1], &c__1);
  622. _starpu_dscal_(n, &remax, &vr[ki * vr_dim1 + 1], &c__1);
  623. }
  624. }
  625. --is;
  626. if (ip != 0) {
  627. --is;
  628. }
  629. L130:
  630. if (ip == 1) {
  631. ip = 0;
  632. }
  633. if (ip == -1) {
  634. ip = 1;
  635. }
  636. /* L140: */
  637. }
  638. }
  639. if (leftv) {
  640. /* Compute left eigenvectors. */
  641. ip = 0;
  642. is = 1;
  643. i__1 = *n;
  644. for (ki = 1; ki <= i__1; ++ki) {
  645. if (ip == -1) {
  646. goto L250;
  647. }
  648. if (ki == *n) {
  649. goto L150;
  650. }
  651. if (t[ki + 1 + ki * t_dim1] == 0.) {
  652. goto L150;
  653. }
  654. ip = 1;
  655. L150:
  656. if (somev) {
  657. if (! select[ki]) {
  658. goto L250;
  659. }
  660. }
  661. /* Compute the KI-th eigenvalue (WR,WI). */
  662. wr = t[ki + ki * t_dim1];
  663. wi = 0.;
  664. if (ip != 0) {
  665. wi = sqrt((d__1 = t[ki + (ki + 1) * t_dim1], abs(d__1))) *
  666. sqrt((d__2 = t[ki + 1 + ki * t_dim1], abs(d__2)));
  667. }
  668. /* Computing MAX */
  669. d__1 = ulp * (abs(wr) + abs(wi));
  670. smin = max(d__1,smlnum);
  671. if (ip == 0) {
  672. /* Real left eigenvector. */
  673. work[ki + *n] = 1.;
  674. /* Form right-hand side */
  675. i__2 = *n;
  676. for (k = ki + 1; k <= i__2; ++k) {
  677. work[k + *n] = -t[ki + k * t_dim1];
  678. /* L160: */
  679. }
  680. /* Solve the quasi-triangular system: */
  681. /* (T(KI+1:N,KI+1:N) - WR)'*X = SCALE*WORK */
  682. vmax = 1.;
  683. vcrit = bignum;
  684. jnxt = ki + 1;
  685. i__2 = *n;
  686. for (j = ki + 1; j <= i__2; ++j) {
  687. if (j < jnxt) {
  688. goto L170;
  689. }
  690. j1 = j;
  691. j2 = j;
  692. jnxt = j + 1;
  693. if (j < *n) {
  694. if (t[j + 1 + j * t_dim1] != 0.) {
  695. j2 = j + 1;
  696. jnxt = j + 2;
  697. }
  698. }
  699. if (j1 == j2) {
  700. /* 1-by-1 diagonal block */
  701. /* Scale if necessary to avoid overflow when forming */
  702. /* the right-hand side. */
  703. if (work[j] > vcrit) {
  704. rec = 1. / vmax;
  705. i__3 = *n - ki + 1;
  706. _starpu_dscal_(&i__3, &rec, &work[ki + *n], &c__1);
  707. vmax = 1.;
  708. vcrit = bignum;
  709. }
  710. i__3 = j - ki - 1;
  711. work[j + *n] -= _starpu_ddot_(&i__3, &t[ki + 1 + j * t_dim1],
  712. &c__1, &work[ki + 1 + *n], &c__1);
  713. /* Solve (T(J,J)-WR)'*X = WORK */
  714. _starpu_dlaln2_(&c_false, &c__1, &c__1, &smin, &c_b22, &t[j +
  715. j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
  716. n], n, &wr, &c_b25, x, &c__2, &scale, &xnorm,
  717. &ierr);
  718. /* Scale if necessary */
  719. if (scale != 1.) {
  720. i__3 = *n - ki + 1;
  721. _starpu_dscal_(&i__3, &scale, &work[ki + *n], &c__1);
  722. }
  723. work[j + *n] = x[0];
  724. /* Computing MAX */
  725. d__2 = (d__1 = work[j + *n], abs(d__1));
  726. vmax = max(d__2,vmax);
  727. vcrit = bignum / vmax;
  728. } else {
  729. /* 2-by-2 diagonal block */
  730. /* Scale if necessary to avoid overflow when forming */
  731. /* the right-hand side. */
  732. /* Computing MAX */
  733. d__1 = work[j], d__2 = work[j + 1];
  734. beta = max(d__1,d__2);
  735. if (beta > vcrit) {
  736. rec = 1. / vmax;
  737. i__3 = *n - ki + 1;
  738. _starpu_dscal_(&i__3, &rec, &work[ki + *n], &c__1);
  739. vmax = 1.;
  740. vcrit = bignum;
  741. }
  742. i__3 = j - ki - 1;
  743. work[j + *n] -= _starpu_ddot_(&i__3, &t[ki + 1 + j * t_dim1],
  744. &c__1, &work[ki + 1 + *n], &c__1);
  745. i__3 = j - ki - 1;
  746. work[j + 1 + *n] -= _starpu_ddot_(&i__3, &t[ki + 1 + (j + 1) *
  747. t_dim1], &c__1, &work[ki + 1 + *n], &c__1);
  748. /* Solve */
  749. /* [T(J,J)-WR T(J,J+1) ]'* X = SCALE*( WORK1 ) */
  750. /* [T(J+1,J) T(J+1,J+1)-WR] ( WORK2 ) */
  751. _starpu_dlaln2_(&c_true, &c__2, &c__1, &smin, &c_b22, &t[j +
  752. j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
  753. n], n, &wr, &c_b25, x, &c__2, &scale, &xnorm,
  754. &ierr);
  755. /* Scale if necessary */
  756. if (scale != 1.) {
  757. i__3 = *n - ki + 1;
  758. _starpu_dscal_(&i__3, &scale, &work[ki + *n], &c__1);
  759. }
  760. work[j + *n] = x[0];
  761. work[j + 1 + *n] = x[1];
  762. /* Computing MAX */
  763. d__3 = (d__1 = work[j + *n], abs(d__1)), d__4 = (d__2
  764. = work[j + 1 + *n], abs(d__2)), d__3 = max(
  765. d__3,d__4);
  766. vmax = max(d__3,vmax);
  767. vcrit = bignum / vmax;
  768. }
  769. L170:
  770. ;
  771. }
  772. /* Copy the vector x or Q*x to VL and normalize. */
  773. if (! over) {
  774. i__2 = *n - ki + 1;
  775. _starpu_dcopy_(&i__2, &work[ki + *n], &c__1, &vl[ki + is *
  776. vl_dim1], &c__1);
  777. i__2 = *n - ki + 1;
  778. ii = _starpu_idamax_(&i__2, &vl[ki + is * vl_dim1], &c__1) + ki -
  779. 1;
  780. remax = 1. / (d__1 = vl[ii + is * vl_dim1], abs(d__1));
  781. i__2 = *n - ki + 1;
  782. _starpu_dscal_(&i__2, &remax, &vl[ki + is * vl_dim1], &c__1);
  783. i__2 = ki - 1;
  784. for (k = 1; k <= i__2; ++k) {
  785. vl[k + is * vl_dim1] = 0.;
  786. /* L180: */
  787. }
  788. } else {
  789. if (ki < *n) {
  790. i__2 = *n - ki;
  791. _starpu_dgemv_("N", n, &i__2, &c_b22, &vl[(ki + 1) * vl_dim1
  792. + 1], ldvl, &work[ki + 1 + *n], &c__1, &work[
  793. ki + *n], &vl[ki * vl_dim1 + 1], &c__1);
  794. }
  795. ii = _starpu_idamax_(n, &vl[ki * vl_dim1 + 1], &c__1);
  796. remax = 1. / (d__1 = vl[ii + ki * vl_dim1], abs(d__1));
  797. _starpu_dscal_(n, &remax, &vl[ki * vl_dim1 + 1], &c__1);
  798. }
  799. } else {
  800. /* Complex left eigenvector. */
  801. /* Initial solve: */
  802. /* ((T(KI,KI) T(KI,KI+1) )' - (WR - I* WI))*X = 0. */
  803. /* ((T(KI+1,KI) T(KI+1,KI+1)) ) */
  804. if ((d__1 = t[ki + (ki + 1) * t_dim1], abs(d__1)) >= (d__2 =
  805. t[ki + 1 + ki * t_dim1], abs(d__2))) {
  806. work[ki + *n] = wi / t[ki + (ki + 1) * t_dim1];
  807. work[ki + 1 + n2] = 1.;
  808. } else {
  809. work[ki + *n] = 1.;
  810. work[ki + 1 + n2] = -wi / t[ki + 1 + ki * t_dim1];
  811. }
  812. work[ki + 1 + *n] = 0.;
  813. work[ki + n2] = 0.;
  814. /* Form right-hand side */
  815. i__2 = *n;
  816. for (k = ki + 2; k <= i__2; ++k) {
  817. work[k + *n] = -work[ki + *n] * t[ki + k * t_dim1];
  818. work[k + n2] = -work[ki + 1 + n2] * t[ki + 1 + k * t_dim1]
  819. ;
  820. /* L190: */
  821. }
  822. /* Solve complex quasi-triangular system: */
  823. /* ( T(KI+2,N:KI+2,N) - (WR-i*WI) )*X = WORK1+i*WORK2 */
  824. vmax = 1.;
  825. vcrit = bignum;
  826. jnxt = ki + 2;
  827. i__2 = *n;
  828. for (j = ki + 2; j <= i__2; ++j) {
  829. if (j < jnxt) {
  830. goto L200;
  831. }
  832. j1 = j;
  833. j2 = j;
  834. jnxt = j + 1;
  835. if (j < *n) {
  836. if (t[j + 1 + j * t_dim1] != 0.) {
  837. j2 = j + 1;
  838. jnxt = j + 2;
  839. }
  840. }
  841. if (j1 == j2) {
  842. /* 1-by-1 diagonal block */
  843. /* Scale if necessary to avoid overflow when */
  844. /* forming the right-hand side elements. */
  845. if (work[j] > vcrit) {
  846. rec = 1. / vmax;
  847. i__3 = *n - ki + 1;
  848. _starpu_dscal_(&i__3, &rec, &work[ki + *n], &c__1);
  849. i__3 = *n - ki + 1;
  850. _starpu_dscal_(&i__3, &rec, &work[ki + n2], &c__1);
  851. vmax = 1.;
  852. vcrit = bignum;
  853. }
  854. i__3 = j - ki - 2;
  855. work[j + *n] -= _starpu_ddot_(&i__3, &t[ki + 2 + j * t_dim1],
  856. &c__1, &work[ki + 2 + *n], &c__1);
  857. i__3 = j - ki - 2;
  858. work[j + n2] -= _starpu_ddot_(&i__3, &t[ki + 2 + j * t_dim1],
  859. &c__1, &work[ki + 2 + n2], &c__1);
  860. /* Solve (T(J,J)-(WR-i*WI))*(X11+i*X12)= WK+I*WK2 */
  861. d__1 = -wi;
  862. _starpu_dlaln2_(&c_false, &c__1, &c__2, &smin, &c_b22, &t[j +
  863. j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
  864. n], n, &wr, &d__1, x, &c__2, &scale, &xnorm, &
  865. ierr);
  866. /* Scale if necessary */
  867. if (scale != 1.) {
  868. i__3 = *n - ki + 1;
  869. _starpu_dscal_(&i__3, &scale, &work[ki + *n], &c__1);
  870. i__3 = *n - ki + 1;
  871. _starpu_dscal_(&i__3, &scale, &work[ki + n2], &c__1);
  872. }
  873. work[j + *n] = x[0];
  874. work[j + n2] = x[2];
  875. /* Computing MAX */
  876. d__3 = (d__1 = work[j + *n], abs(d__1)), d__4 = (d__2
  877. = work[j + n2], abs(d__2)), d__3 = max(d__3,
  878. d__4);
  879. vmax = max(d__3,vmax);
  880. vcrit = bignum / vmax;
  881. } else {
  882. /* 2-by-2 diagonal block */
  883. /* Scale if necessary to avoid overflow when forming */
  884. /* the right-hand side elements. */
  885. /* Computing MAX */
  886. d__1 = work[j], d__2 = work[j + 1];
  887. beta = max(d__1,d__2);
  888. if (beta > vcrit) {
  889. rec = 1. / vmax;
  890. i__3 = *n - ki + 1;
  891. _starpu_dscal_(&i__3, &rec, &work[ki + *n], &c__1);
  892. i__3 = *n - ki + 1;
  893. _starpu_dscal_(&i__3, &rec, &work[ki + n2], &c__1);
  894. vmax = 1.;
  895. vcrit = bignum;
  896. }
  897. i__3 = j - ki - 2;
  898. work[j + *n] -= _starpu_ddot_(&i__3, &t[ki + 2 + j * t_dim1],
  899. &c__1, &work[ki + 2 + *n], &c__1);
  900. i__3 = j - ki - 2;
  901. work[j + n2] -= _starpu_ddot_(&i__3, &t[ki + 2 + j * t_dim1],
  902. &c__1, &work[ki + 2 + n2], &c__1);
  903. i__3 = j - ki - 2;
  904. work[j + 1 + *n] -= _starpu_ddot_(&i__3, &t[ki + 2 + (j + 1) *
  905. t_dim1], &c__1, &work[ki + 2 + *n], &c__1);
  906. i__3 = j - ki - 2;
  907. work[j + 1 + n2] -= _starpu_ddot_(&i__3, &t[ki + 2 + (j + 1) *
  908. t_dim1], &c__1, &work[ki + 2 + n2], &c__1);
  909. /* Solve 2-by-2 complex linear equation */
  910. /* ([T(j,j) T(j,j+1) ]'-(wr-i*wi)*I)*X = SCALE*B */
  911. /* ([T(j+1,j) T(j+1,j+1)] ) */
  912. d__1 = -wi;
  913. _starpu_dlaln2_(&c_true, &c__2, &c__2, &smin, &c_b22, &t[j +
  914. j * t_dim1], ldt, &c_b22, &c_b22, &work[j + *
  915. n], n, &wr, &d__1, x, &c__2, &scale, &xnorm, &
  916. ierr);
  917. /* Scale if necessary */
  918. if (scale != 1.) {
  919. i__3 = *n - ki + 1;
  920. _starpu_dscal_(&i__3, &scale, &work[ki + *n], &c__1);
  921. i__3 = *n - ki + 1;
  922. _starpu_dscal_(&i__3, &scale, &work[ki + n2], &c__1);
  923. }
  924. work[j + *n] = x[0];
  925. work[j + n2] = x[2];
  926. work[j + 1 + *n] = x[1];
  927. work[j + 1 + n2] = x[3];
  928. /* Computing MAX */
  929. d__1 = abs(x[0]), d__2 = abs(x[2]), d__1 = max(d__1,
  930. d__2), d__2 = abs(x[1]), d__1 = max(d__1,d__2)
  931. , d__2 = abs(x[3]), d__1 = max(d__1,d__2);
  932. vmax = max(d__1,vmax);
  933. vcrit = bignum / vmax;
  934. }
  935. L200:
  936. ;
  937. }
  938. /* Copy the vector x or Q*x to VL and normalize. */
  939. if (! over) {
  940. i__2 = *n - ki + 1;
  941. _starpu_dcopy_(&i__2, &work[ki + *n], &c__1, &vl[ki + is *
  942. vl_dim1], &c__1);
  943. i__2 = *n - ki + 1;
  944. _starpu_dcopy_(&i__2, &work[ki + n2], &c__1, &vl[ki + (is + 1) *
  945. vl_dim1], &c__1);
  946. emax = 0.;
  947. i__2 = *n;
  948. for (k = ki; k <= i__2; ++k) {
  949. /* Computing MAX */
  950. d__3 = emax, d__4 = (d__1 = vl[k + is * vl_dim1], abs(
  951. d__1)) + (d__2 = vl[k + (is + 1) * vl_dim1],
  952. abs(d__2));
  953. emax = max(d__3,d__4);
  954. /* L220: */
  955. }
  956. remax = 1. / emax;
  957. i__2 = *n - ki + 1;
  958. _starpu_dscal_(&i__2, &remax, &vl[ki + is * vl_dim1], &c__1);
  959. i__2 = *n - ki + 1;
  960. _starpu_dscal_(&i__2, &remax, &vl[ki + (is + 1) * vl_dim1], &c__1)
  961. ;
  962. i__2 = ki - 1;
  963. for (k = 1; k <= i__2; ++k) {
  964. vl[k + is * vl_dim1] = 0.;
  965. vl[k + (is + 1) * vl_dim1] = 0.;
  966. /* L230: */
  967. }
  968. } else {
  969. if (ki < *n - 1) {
  970. i__2 = *n - ki - 1;
  971. _starpu_dgemv_("N", n, &i__2, &c_b22, &vl[(ki + 2) * vl_dim1
  972. + 1], ldvl, &work[ki + 2 + *n], &c__1, &work[
  973. ki + *n], &vl[ki * vl_dim1 + 1], &c__1);
  974. i__2 = *n - ki - 1;
  975. _starpu_dgemv_("N", n, &i__2, &c_b22, &vl[(ki + 2) * vl_dim1
  976. + 1], ldvl, &work[ki + 2 + n2], &c__1, &work[
  977. ki + 1 + n2], &vl[(ki + 1) * vl_dim1 + 1], &
  978. c__1);
  979. } else {
  980. _starpu_dscal_(n, &work[ki + *n], &vl[ki * vl_dim1 + 1], &
  981. c__1);
  982. _starpu_dscal_(n, &work[ki + 1 + n2], &vl[(ki + 1) * vl_dim1
  983. + 1], &c__1);
  984. }
  985. emax = 0.;
  986. i__2 = *n;
  987. for (k = 1; k <= i__2; ++k) {
  988. /* Computing MAX */
  989. d__3 = emax, d__4 = (d__1 = vl[k + ki * vl_dim1], abs(
  990. d__1)) + (d__2 = vl[k + (ki + 1) * vl_dim1],
  991. abs(d__2));
  992. emax = max(d__3,d__4);
  993. /* L240: */
  994. }
  995. remax = 1. / emax;
  996. _starpu_dscal_(n, &remax, &vl[ki * vl_dim1 + 1], &c__1);
  997. _starpu_dscal_(n, &remax, &vl[(ki + 1) * vl_dim1 + 1], &c__1);
  998. }
  999. }
  1000. ++is;
  1001. if (ip != 0) {
  1002. ++is;
  1003. }
  1004. L250:
  1005. if (ip == -1) {
  1006. ip = 0;
  1007. }
  1008. if (ip == 1) {
  1009. ip = -1;
  1010. }
  1011. /* L260: */
  1012. }
  1013. }
  1014. return 0;
  1015. /* End of DTREVC */
  1016. } /* _starpu_dtrevc_ */