dlaebz.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. /* dlaebz.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. /* Subroutine */ int _starpu_dlaebz_(integer *ijob, integer *nitmax, integer *n,
  14. integer *mmax, integer *minp, integer *nbmin, doublereal *abstol,
  15. doublereal *reltol, doublereal *pivmin, doublereal *d__, doublereal *
  16. e, doublereal *e2, integer *nval, doublereal *ab, doublereal *c__,
  17. integer *mout, integer *nab, doublereal *work, integer *iwork,
  18. integer *info)
  19. {
  20. /* System generated locals */
  21. integer nab_dim1, nab_offset, ab_dim1, ab_offset, i__1, i__2, i__3, i__4,
  22. i__5, i__6;
  23. doublereal d__1, d__2, d__3, d__4;
  24. /* Local variables */
  25. integer j, kf, ji, kl, jp, jit;
  26. doublereal tmp1, tmp2;
  27. integer itmp1, itmp2, kfnew, klnew;
  28. /* -- LAPACK auxiliary routine (version 3.2) -- */
  29. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  30. /* November 2006 */
  31. /* .. Scalar Arguments .. */
  32. /* .. */
  33. /* .. Array Arguments .. */
  34. /* .. */
  35. /* Purpose */
  36. /* ======= */
  37. /* DLAEBZ contains the iteration loops which compute and use the */
  38. /* function N(w), which is the count of eigenvalues of a symmetric */
  39. /* tridiagonal matrix T less than or equal to its argument w. It */
  40. /* performs a choice of two types of loops: */
  41. /* IJOB=1, followed by */
  42. /* IJOB=2: It takes as input a list of intervals and returns a list of */
  43. /* sufficiently small intervals whose union contains the same */
  44. /* eigenvalues as the union of the original intervals. */
  45. /* The input intervals are (AB(j,1),AB(j,2)], j=1,...,MINP. */
  46. /* The output interval (AB(j,1),AB(j,2)] will contain */
  47. /* eigenvalues NAB(j,1)+1,...,NAB(j,2), where 1 <= j <= MOUT. */
  48. /* IJOB=3: It performs a binary search in each input interval */
  49. /* (AB(j,1),AB(j,2)] for a point w(j) such that */
  50. /* N(w(j))=NVAL(j), and uses C(j) as the starting point of */
  51. /* the search. If such a w(j) is found, then on output */
  52. /* AB(j,1)=AB(j,2)=w. If no such w(j) is found, then on output */
  53. /* (AB(j,1),AB(j,2)] will be a small interval containing the */
  54. /* point where N(w) jumps through NVAL(j), unless that point */
  55. /* lies outside the initial interval. */
  56. /* Note that the intervals are in all cases half-open intervals, */
  57. /* i.e., of the form (a,b] , which includes b but not a . */
  58. /* To avoid underflow, the matrix should be scaled so that its largest */
  59. /* element is no greater than overflow**(1/2) * underflow**(1/4) */
  60. /* in absolute value. To assure the most accurate computation */
  61. /* of small eigenvalues, the matrix should be scaled to be */
  62. /* not much smaller than that, either. */
  63. /* See W. Kahan "Accurate Eigenvalues of a Symmetric Tridiagonal */
  64. /* Matrix", Report CS41, Computer Science Dept., Stanford */
  65. /* University, July 21, 1966 */
  66. /* Note: the arguments are, in general, *not* checked for unreasonable */
  67. /* values. */
  68. /* Arguments */
  69. /* ========= */
  70. /* IJOB (input) INTEGER */
  71. /* Specifies what is to be done: */
  72. /* = 1: Compute NAB for the initial intervals. */
  73. /* = 2: Perform bisection iteration to find eigenvalues of T. */
  74. /* = 3: Perform bisection iteration to invert N(w), i.e., */
  75. /* to find a point which has a specified number of */
  76. /* eigenvalues of T to its left. */
  77. /* Other values will cause DLAEBZ to return with INFO=-1. */
  78. /* NITMAX (input) INTEGER */
  79. /* The maximum number of "levels" of bisection to be */
  80. /* performed, i.e., an interval of width W will not be made */
  81. /* smaller than 2^(-NITMAX) * W. If not all intervals */
  82. /* have converged after NITMAX iterations, then INFO is set */
  83. /* to the number of non-converged intervals. */
  84. /* N (input) INTEGER */
  85. /* The dimension n of the tridiagonal matrix T. It must be at */
  86. /* least 1. */
  87. /* MMAX (input) INTEGER */
  88. /* The maximum number of intervals. If more than MMAX intervals */
  89. /* are generated, then DLAEBZ will quit with INFO=MMAX+1. */
  90. /* MINP (input) INTEGER */
  91. /* The initial number of intervals. It may not be greater than */
  92. /* MMAX. */
  93. /* NBMIN (input) INTEGER */
  94. /* The smallest number of intervals that should be processed */
  95. /* using a vector loop. If zero, then only the scalar loop */
  96. /* will be used. */
  97. /* ABSTOL (input) DOUBLE PRECISION */
  98. /* The minimum (absolute) width of an interval. When an */
  99. /* interval is narrower than ABSTOL, or than RELTOL times the */
  100. /* larger (in magnitude) endpoint, then it is considered to be */
  101. /* sufficiently small, i.e., converged. This must be at least */
  102. /* zero. */
  103. /* RELTOL (input) DOUBLE PRECISION */
  104. /* The minimum relative width of an interval. When an interval */
  105. /* is narrower than ABSTOL, or than RELTOL times the larger (in */
  106. /* magnitude) endpoint, then it is considered to be */
  107. /* sufficiently small, i.e., converged. Note: this should */
  108. /* always be at least radix*machine epsilon. */
  109. /* PIVMIN (input) DOUBLE PRECISION */
  110. /* The minimum absolute value of a "pivot" in the Sturm */
  111. /* sequence loop. This *must* be at least max |e(j)**2| * */
  112. /* safe_min and at least safe_min, where safe_min is at least */
  113. /* the smallest number that can divide one without overflow. */
  114. /* D (input) DOUBLE PRECISION array, dimension (N) */
  115. /* The diagonal elements of the tridiagonal matrix T. */
  116. /* E (input) DOUBLE PRECISION array, dimension (N) */
  117. /* The offdiagonal elements of the tridiagonal matrix T in */
  118. /* positions 1 through N-1. E(N) is arbitrary. */
  119. /* E2 (input) DOUBLE PRECISION array, dimension (N) */
  120. /* The squares of the offdiagonal elements of the tridiagonal */
  121. /* matrix T. E2(N) is ignored. */
  122. /* NVAL (input/output) INTEGER array, dimension (MINP) */
  123. /* If IJOB=1 or 2, not referenced. */
  124. /* If IJOB=3, the desired values of N(w). The elements of NVAL */
  125. /* will be reordered to correspond with the intervals in AB. */
  126. /* Thus, NVAL(j) on output will not, in general be the same as */
  127. /* NVAL(j) on input, but it will correspond with the interval */
  128. /* (AB(j,1),AB(j,2)] on output. */
  129. /* AB (input/output) DOUBLE PRECISION array, dimension (MMAX,2) */
  130. /* The endpoints of the intervals. AB(j,1) is a(j), the left */
  131. /* endpoint of the j-th interval, and AB(j,2) is b(j), the */
  132. /* right endpoint of the j-th interval. The input intervals */
  133. /* will, in general, be modified, split, and reordered by the */
  134. /* calculation. */
  135. /* C (input/output) DOUBLE PRECISION array, dimension (MMAX) */
  136. /* If IJOB=1, ignored. */
  137. /* If IJOB=2, workspace. */
  138. /* If IJOB=3, then on input C(j) should be initialized to the */
  139. /* first search point in the binary search. */
  140. /* MOUT (output) INTEGER */
  141. /* If IJOB=1, the number of eigenvalues in the intervals. */
  142. /* If IJOB=2 or 3, the number of intervals output. */
  143. /* If IJOB=3, MOUT will equal MINP. */
  144. /* NAB (input/output) INTEGER array, dimension (MMAX,2) */
  145. /* If IJOB=1, then on output NAB(i,j) will be set to N(AB(i,j)). */
  146. /* If IJOB=2, then on input, NAB(i,j) should be set. It must */
  147. /* satisfy the condition: */
  148. /* N(AB(i,1)) <= NAB(i,1) <= NAB(i,2) <= N(AB(i,2)), */
  149. /* which means that in interval i only eigenvalues */
  150. /* NAB(i,1)+1,...,NAB(i,2) will be considered. Usually, */
  151. /* NAB(i,j)=N(AB(i,j)), from a previous call to DLAEBZ with */
  152. /* IJOB=1. */
  153. /* On output, NAB(i,j) will contain */
  154. /* max(na(k),min(nb(k),N(AB(i,j)))), where k is the index of */
  155. /* the input interval that the output interval */
  156. /* (AB(j,1),AB(j,2)] came from, and na(k) and nb(k) are the */
  157. /* the input values of NAB(k,1) and NAB(k,2). */
  158. /* If IJOB=3, then on output, NAB(i,j) contains N(AB(i,j)), */
  159. /* unless N(w) > NVAL(i) for all search points w , in which */
  160. /* case NAB(i,1) will not be modified, i.e., the output */
  161. /* value will be the same as the input value (modulo */
  162. /* reorderings -- see NVAL and AB), or unless N(w) < NVAL(i) */
  163. /* for all search points w , in which case NAB(i,2) will */
  164. /* not be modified. Normally, NAB should be set to some */
  165. /* distinctive value(s) before DLAEBZ is called. */
  166. /* WORK (workspace) DOUBLE PRECISION array, dimension (MMAX) */
  167. /* Workspace. */
  168. /* IWORK (workspace) INTEGER array, dimension (MMAX) */
  169. /* Workspace. */
  170. /* INFO (output) INTEGER */
  171. /* = 0: All intervals converged. */
  172. /* = 1--MMAX: The last INFO intervals did not converge. */
  173. /* = MMAX+1: More than MMAX intervals were generated. */
  174. /* Further Details */
  175. /* =============== */
  176. /* This routine is intended to be called only by other LAPACK */
  177. /* routines, thus the interface is less user-friendly. It is intended */
  178. /* for two purposes: */
  179. /* (a) finding eigenvalues. In this case, DLAEBZ should have one or */
  180. /* more initial intervals set up in AB, and DLAEBZ should be called */
  181. /* with IJOB=1. This sets up NAB, and also counts the eigenvalues. */
  182. /* Intervals with no eigenvalues would usually be thrown out at */
  183. /* this point. Also, if not all the eigenvalues in an interval i */
  184. /* are desired, NAB(i,1) can be increased or NAB(i,2) decreased. */
  185. /* For example, set NAB(i,1)=NAB(i,2)-1 to get the largest */
  186. /* eigenvalue. DLAEBZ is then called with IJOB=2 and MMAX */
  187. /* no smaller than the value of MOUT returned by the call with */
  188. /* IJOB=1. After this (IJOB=2) call, eigenvalues NAB(i,1)+1 */
  189. /* through NAB(i,2) are approximately AB(i,1) (or AB(i,2)) to the */
  190. /* tolerance specified by ABSTOL and RELTOL. */
  191. /* (b) finding an interval (a',b'] containing eigenvalues w(f),...,w(l). */
  192. /* In this case, start with a Gershgorin interval (a,b). Set up */
  193. /* AB to contain 2 search intervals, both initially (a,b). One */
  194. /* NVAL element should contain f-1 and the other should contain l */
  195. /* , while C should contain a and b, resp. NAB(i,1) should be -1 */
  196. /* and NAB(i,2) should be N+1, to flag an error if the desired */
  197. /* interval does not lie in (a,b). DLAEBZ is then called with */
  198. /* IJOB=3. On exit, if w(f-1) < w(f), then one of the intervals -- */
  199. /* j -- will have AB(j,1)=AB(j,2) and NAB(j,1)=NAB(j,2)=f-1, while */
  200. /* if, to the specified tolerance, w(f-k)=...=w(f+r), k > 0 and r */
  201. /* >= 0, then the interval will have N(AB(j,1))=NAB(j,1)=f-k and */
  202. /* N(AB(j,2))=NAB(j,2)=f+r. The cases w(l) < w(l+1) and */
  203. /* w(l-r)=...=w(l+k) are handled similarly. */
  204. /* ===================================================================== */
  205. /* .. Parameters .. */
  206. /* .. */
  207. /* .. Local Scalars .. */
  208. /* .. */
  209. /* .. Intrinsic Functions .. */
  210. /* .. */
  211. /* .. Executable Statements .. */
  212. /* Check for Errors */
  213. /* Parameter adjustments */
  214. nab_dim1 = *mmax;
  215. nab_offset = 1 + nab_dim1;
  216. nab -= nab_offset;
  217. ab_dim1 = *mmax;
  218. ab_offset = 1 + ab_dim1;
  219. ab -= ab_offset;
  220. --d__;
  221. --e;
  222. --e2;
  223. --nval;
  224. --c__;
  225. --work;
  226. --iwork;
  227. /* Function Body */
  228. *info = 0;
  229. if (*ijob < 1 || *ijob > 3) {
  230. *info = -1;
  231. return 0;
  232. }
  233. /* Initialize NAB */
  234. if (*ijob == 1) {
  235. /* Compute the number of eigenvalues in the initial intervals. */
  236. *mout = 0;
  237. /* DIR$ NOVECTOR */
  238. i__1 = *minp;
  239. for (ji = 1; ji <= i__1; ++ji) {
  240. for (jp = 1; jp <= 2; ++jp) {
  241. tmp1 = d__[1] - ab[ji + jp * ab_dim1];
  242. if (abs(tmp1) < *pivmin) {
  243. tmp1 = -(*pivmin);
  244. }
  245. nab[ji + jp * nab_dim1] = 0;
  246. if (tmp1 <= 0.) {
  247. nab[ji + jp * nab_dim1] = 1;
  248. }
  249. i__2 = *n;
  250. for (j = 2; j <= i__2; ++j) {
  251. tmp1 = d__[j] - e2[j - 1] / tmp1 - ab[ji + jp * ab_dim1];
  252. if (abs(tmp1) < *pivmin) {
  253. tmp1 = -(*pivmin);
  254. }
  255. if (tmp1 <= 0.) {
  256. ++nab[ji + jp * nab_dim1];
  257. }
  258. /* L10: */
  259. }
  260. /* L20: */
  261. }
  262. *mout = *mout + nab[ji + (nab_dim1 << 1)] - nab[ji + nab_dim1];
  263. /* L30: */
  264. }
  265. return 0;
  266. }
  267. /* Initialize for loop */
  268. /* KF and KL have the following meaning: */
  269. /* Intervals 1,...,KF-1 have converged. */
  270. /* Intervals KF,...,KL still need to be refined. */
  271. kf = 1;
  272. kl = *minp;
  273. /* If IJOB=2, initialize C. */
  274. /* If IJOB=3, use the user-supplied starting point. */
  275. if (*ijob == 2) {
  276. i__1 = *minp;
  277. for (ji = 1; ji <= i__1; ++ji) {
  278. c__[ji] = (ab[ji + ab_dim1] + ab[ji + (ab_dim1 << 1)]) * .5;
  279. /* L40: */
  280. }
  281. }
  282. /* Iteration loop */
  283. i__1 = *nitmax;
  284. for (jit = 1; jit <= i__1; ++jit) {
  285. /* Loop over intervals */
  286. if (kl - kf + 1 >= *nbmin && *nbmin > 0) {
  287. /* Begin of Parallel Version of the loop */
  288. i__2 = kl;
  289. for (ji = kf; ji <= i__2; ++ji) {
  290. /* Compute N(c), the number of eigenvalues less than c */
  291. work[ji] = d__[1] - c__[ji];
  292. iwork[ji] = 0;
  293. if (work[ji] <= *pivmin) {
  294. iwork[ji] = 1;
  295. /* Computing MIN */
  296. d__1 = work[ji], d__2 = -(*pivmin);
  297. work[ji] = min(d__1,d__2);
  298. }
  299. i__3 = *n;
  300. for (j = 2; j <= i__3; ++j) {
  301. work[ji] = d__[j] - e2[j - 1] / work[ji] - c__[ji];
  302. if (work[ji] <= *pivmin) {
  303. ++iwork[ji];
  304. /* Computing MIN */
  305. d__1 = work[ji], d__2 = -(*pivmin);
  306. work[ji] = min(d__1,d__2);
  307. }
  308. /* L50: */
  309. }
  310. /* L60: */
  311. }
  312. if (*ijob <= 2) {
  313. /* IJOB=2: Choose all intervals containing eigenvalues. */
  314. klnew = kl;
  315. i__2 = kl;
  316. for (ji = kf; ji <= i__2; ++ji) {
  317. /* Insure that N(w) is monotone */
  318. /* Computing MIN */
  319. /* Computing MAX */
  320. i__5 = nab[ji + nab_dim1], i__6 = iwork[ji];
  321. i__3 = nab[ji + (nab_dim1 << 1)], i__4 = max(i__5,i__6);
  322. iwork[ji] = min(i__3,i__4);
  323. /* Update the Queue -- add intervals if both halves */
  324. /* contain eigenvalues. */
  325. if (iwork[ji] == nab[ji + (nab_dim1 << 1)]) {
  326. /* No eigenvalue in the upper interval: */
  327. /* just use the lower interval. */
  328. ab[ji + (ab_dim1 << 1)] = c__[ji];
  329. } else if (iwork[ji] == nab[ji + nab_dim1]) {
  330. /* No eigenvalue in the lower interval: */
  331. /* just use the upper interval. */
  332. ab[ji + ab_dim1] = c__[ji];
  333. } else {
  334. ++klnew;
  335. if (klnew <= *mmax) {
  336. /* Eigenvalue in both intervals -- add upper to */
  337. /* queue. */
  338. ab[klnew + (ab_dim1 << 1)] = ab[ji + (ab_dim1 <<
  339. 1)];
  340. nab[klnew + (nab_dim1 << 1)] = nab[ji + (nab_dim1
  341. << 1)];
  342. ab[klnew + ab_dim1] = c__[ji];
  343. nab[klnew + nab_dim1] = iwork[ji];
  344. ab[ji + (ab_dim1 << 1)] = c__[ji];
  345. nab[ji + (nab_dim1 << 1)] = iwork[ji];
  346. } else {
  347. *info = *mmax + 1;
  348. }
  349. }
  350. /* L70: */
  351. }
  352. if (*info != 0) {
  353. return 0;
  354. }
  355. kl = klnew;
  356. } else {
  357. /* IJOB=3: Binary search. Keep only the interval containing */
  358. /* w s.t. N(w) = NVAL */
  359. i__2 = kl;
  360. for (ji = kf; ji <= i__2; ++ji) {
  361. if (iwork[ji] <= nval[ji]) {
  362. ab[ji + ab_dim1] = c__[ji];
  363. nab[ji + nab_dim1] = iwork[ji];
  364. }
  365. if (iwork[ji] >= nval[ji]) {
  366. ab[ji + (ab_dim1 << 1)] = c__[ji];
  367. nab[ji + (nab_dim1 << 1)] = iwork[ji];
  368. }
  369. /* L80: */
  370. }
  371. }
  372. } else {
  373. /* End of Parallel Version of the loop */
  374. /* Begin of Serial Version of the loop */
  375. klnew = kl;
  376. i__2 = kl;
  377. for (ji = kf; ji <= i__2; ++ji) {
  378. /* Compute N(w), the number of eigenvalues less than w */
  379. tmp1 = c__[ji];
  380. tmp2 = d__[1] - tmp1;
  381. itmp1 = 0;
  382. if (tmp2 <= *pivmin) {
  383. itmp1 = 1;
  384. /* Computing MIN */
  385. d__1 = tmp2, d__2 = -(*pivmin);
  386. tmp2 = min(d__1,d__2);
  387. }
  388. /* A series of compiler directives to defeat vectorization */
  389. /* for the next loop */
  390. /* $PL$ CMCHAR=' ' */
  391. /* DIR$ NEXTSCALAR */
  392. /* $DIR SCALAR */
  393. /* DIR$ NEXT SCALAR */
  394. /* VD$L NOVECTOR */
  395. /* DEC$ NOVECTOR */
  396. /* VD$ NOVECTOR */
  397. /* VDIR NOVECTOR */
  398. /* VOCL LOOP,SCALAR */
  399. /* IBM PREFER SCALAR */
  400. /* $PL$ CMCHAR='*' */
  401. i__3 = *n;
  402. for (j = 2; j <= i__3; ++j) {
  403. tmp2 = d__[j] - e2[j - 1] / tmp2 - tmp1;
  404. if (tmp2 <= *pivmin) {
  405. ++itmp1;
  406. /* Computing MIN */
  407. d__1 = tmp2, d__2 = -(*pivmin);
  408. tmp2 = min(d__1,d__2);
  409. }
  410. /* L90: */
  411. }
  412. if (*ijob <= 2) {
  413. /* IJOB=2: Choose all intervals containing eigenvalues. */
  414. /* Insure that N(w) is monotone */
  415. /* Computing MIN */
  416. /* Computing MAX */
  417. i__5 = nab[ji + nab_dim1];
  418. i__3 = nab[ji + (nab_dim1 << 1)], i__4 = max(i__5,itmp1);
  419. itmp1 = min(i__3,i__4);
  420. /* Update the Queue -- add intervals if both halves */
  421. /* contain eigenvalues. */
  422. if (itmp1 == nab[ji + (nab_dim1 << 1)]) {
  423. /* No eigenvalue in the upper interval: */
  424. /* just use the lower interval. */
  425. ab[ji + (ab_dim1 << 1)] = tmp1;
  426. } else if (itmp1 == nab[ji + nab_dim1]) {
  427. /* No eigenvalue in the lower interval: */
  428. /* just use the upper interval. */
  429. ab[ji + ab_dim1] = tmp1;
  430. } else if (klnew < *mmax) {
  431. /* Eigenvalue in both intervals -- add upper to queue. */
  432. ++klnew;
  433. ab[klnew + (ab_dim1 << 1)] = ab[ji + (ab_dim1 << 1)];
  434. nab[klnew + (nab_dim1 << 1)] = nab[ji + (nab_dim1 <<
  435. 1)];
  436. ab[klnew + ab_dim1] = tmp1;
  437. nab[klnew + nab_dim1] = itmp1;
  438. ab[ji + (ab_dim1 << 1)] = tmp1;
  439. nab[ji + (nab_dim1 << 1)] = itmp1;
  440. } else {
  441. *info = *mmax + 1;
  442. return 0;
  443. }
  444. } else {
  445. /* IJOB=3: Binary search. Keep only the interval */
  446. /* containing w s.t. N(w) = NVAL */
  447. if (itmp1 <= nval[ji]) {
  448. ab[ji + ab_dim1] = tmp1;
  449. nab[ji + nab_dim1] = itmp1;
  450. }
  451. if (itmp1 >= nval[ji]) {
  452. ab[ji + (ab_dim1 << 1)] = tmp1;
  453. nab[ji + (nab_dim1 << 1)] = itmp1;
  454. }
  455. }
  456. /* L100: */
  457. }
  458. kl = klnew;
  459. /* End of Serial Version of the loop */
  460. }
  461. /* Check for convergence */
  462. kfnew = kf;
  463. i__2 = kl;
  464. for (ji = kf; ji <= i__2; ++ji) {
  465. tmp1 = (d__1 = ab[ji + (ab_dim1 << 1)] - ab[ji + ab_dim1], abs(
  466. d__1));
  467. /* Computing MAX */
  468. d__3 = (d__1 = ab[ji + (ab_dim1 << 1)], abs(d__1)), d__4 = (d__2 =
  469. ab[ji + ab_dim1], abs(d__2));
  470. tmp2 = max(d__3,d__4);
  471. /* Computing MAX */
  472. d__1 = max(*abstol,*pivmin), d__2 = *reltol * tmp2;
  473. if (tmp1 < max(d__1,d__2) || nab[ji + nab_dim1] >= nab[ji + (
  474. nab_dim1 << 1)]) {
  475. /* Converged -- Swap with position KFNEW, */
  476. /* then increment KFNEW */
  477. if (ji > kfnew) {
  478. tmp1 = ab[ji + ab_dim1];
  479. tmp2 = ab[ji + (ab_dim1 << 1)];
  480. itmp1 = nab[ji + nab_dim1];
  481. itmp2 = nab[ji + (nab_dim1 << 1)];
  482. ab[ji + ab_dim1] = ab[kfnew + ab_dim1];
  483. ab[ji + (ab_dim1 << 1)] = ab[kfnew + (ab_dim1 << 1)];
  484. nab[ji + nab_dim1] = nab[kfnew + nab_dim1];
  485. nab[ji + (nab_dim1 << 1)] = nab[kfnew + (nab_dim1 << 1)];
  486. ab[kfnew + ab_dim1] = tmp1;
  487. ab[kfnew + (ab_dim1 << 1)] = tmp2;
  488. nab[kfnew + nab_dim1] = itmp1;
  489. nab[kfnew + (nab_dim1 << 1)] = itmp2;
  490. if (*ijob == 3) {
  491. itmp1 = nval[ji];
  492. nval[ji] = nval[kfnew];
  493. nval[kfnew] = itmp1;
  494. }
  495. }
  496. ++kfnew;
  497. }
  498. /* L110: */
  499. }
  500. kf = kfnew;
  501. /* Choose Midpoints */
  502. i__2 = kl;
  503. for (ji = kf; ji <= i__2; ++ji) {
  504. c__[ji] = (ab[ji + ab_dim1] + ab[ji + (ab_dim1 << 1)]) * .5;
  505. /* L120: */
  506. }
  507. /* If no more intervals to refine, quit. */
  508. if (kf > kl) {
  509. goto L140;
  510. }
  511. /* L130: */
  512. }
  513. /* Converged */
  514. L140:
  515. /* Computing MAX */
  516. i__1 = kl + 1 - kf;
  517. *info = max(i__1,0);
  518. *mout = kl;
  519. return 0;
  520. /* End of DLAEBZ */
  521. } /* _starpu_dlaebz_ */