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.

slaebz.c 34 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120
  1. /* f2c.h -- Standard Fortran to C header file */
  2. /** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed."
  3. - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */
  4. #ifndef F2C_INCLUDE
  5. #define F2C_INCLUDE
  6. #include <math.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <stdio.h>
  10. #include <complex.h>
  11. #ifdef complex
  12. #undef complex
  13. #endif
  14. #ifdef I
  15. #undef I
  16. #endif
  17. #if defined(_WIN64)
  18. typedef long long BLASLONG;
  19. typedef unsigned long long BLASULONG;
  20. #else
  21. typedef long BLASLONG;
  22. typedef unsigned long BLASULONG;
  23. #endif
  24. #ifdef LAPACK_ILP64
  25. typedef BLASLONG blasint;
  26. #if defined(_WIN64)
  27. #define blasabs(x) llabs(x)
  28. #else
  29. #define blasabs(x) labs(x)
  30. #endif
  31. #else
  32. typedef int blasint;
  33. #define blasabs(x) abs(x)
  34. #endif
  35. typedef blasint integer;
  36. typedef unsigned int uinteger;
  37. typedef char *address;
  38. typedef short int shortint;
  39. typedef float real;
  40. typedef double doublereal;
  41. typedef struct { real r, i; } complex;
  42. typedef struct { doublereal r, i; } doublecomplex;
  43. static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
  44. static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
  45. static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
  46. static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
  47. #define pCf(z) (*_pCf(z))
  48. #define pCd(z) (*_pCd(z))
  49. typedef int logical;
  50. typedef short int shortlogical;
  51. typedef char logical1;
  52. typedef char integer1;
  53. #define TRUE_ (1)
  54. #define FALSE_ (0)
  55. /* Extern is for use with -E */
  56. #ifndef Extern
  57. #define Extern extern
  58. #endif
  59. /* I/O stuff */
  60. typedef int flag;
  61. typedef int ftnlen;
  62. typedef int ftnint;
  63. /*external read, write*/
  64. typedef struct
  65. { flag cierr;
  66. ftnint ciunit;
  67. flag ciend;
  68. char *cifmt;
  69. ftnint cirec;
  70. } cilist;
  71. /*internal read, write*/
  72. typedef struct
  73. { flag icierr;
  74. char *iciunit;
  75. flag iciend;
  76. char *icifmt;
  77. ftnint icirlen;
  78. ftnint icirnum;
  79. } icilist;
  80. /*open*/
  81. typedef struct
  82. { flag oerr;
  83. ftnint ounit;
  84. char *ofnm;
  85. ftnlen ofnmlen;
  86. char *osta;
  87. char *oacc;
  88. char *ofm;
  89. ftnint orl;
  90. char *oblnk;
  91. } olist;
  92. /*close*/
  93. typedef struct
  94. { flag cerr;
  95. ftnint cunit;
  96. char *csta;
  97. } cllist;
  98. /*rewind, backspace, endfile*/
  99. typedef struct
  100. { flag aerr;
  101. ftnint aunit;
  102. } alist;
  103. /* inquire */
  104. typedef struct
  105. { flag inerr;
  106. ftnint inunit;
  107. char *infile;
  108. ftnlen infilen;
  109. ftnint *inex; /*parameters in standard's order*/
  110. ftnint *inopen;
  111. ftnint *innum;
  112. ftnint *innamed;
  113. char *inname;
  114. ftnlen innamlen;
  115. char *inacc;
  116. ftnlen inacclen;
  117. char *inseq;
  118. ftnlen inseqlen;
  119. char *indir;
  120. ftnlen indirlen;
  121. char *infmt;
  122. ftnlen infmtlen;
  123. char *inform;
  124. ftnint informlen;
  125. char *inunf;
  126. ftnlen inunflen;
  127. ftnint *inrecl;
  128. ftnint *innrec;
  129. char *inblank;
  130. ftnlen inblanklen;
  131. } inlist;
  132. #define VOID void
  133. union Multitype { /* for multiple entry points */
  134. integer1 g;
  135. shortint h;
  136. integer i;
  137. /* longint j; */
  138. real r;
  139. doublereal d;
  140. complex c;
  141. doublecomplex z;
  142. };
  143. typedef union Multitype Multitype;
  144. struct Vardesc { /* for Namelist */
  145. char *name;
  146. char *addr;
  147. ftnlen *dims;
  148. int type;
  149. };
  150. typedef struct Vardesc Vardesc;
  151. struct Namelist {
  152. char *name;
  153. Vardesc **vars;
  154. int nvars;
  155. };
  156. typedef struct Namelist Namelist;
  157. #define abs(x) ((x) >= 0 ? (x) : -(x))
  158. #define dabs(x) (fabs(x))
  159. #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
  160. #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
  161. #define dmin(a,b) (f2cmin(a,b))
  162. #define dmax(a,b) (f2cmax(a,b))
  163. #define bit_test(a,b) ((a) >> (b) & 1)
  164. #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
  165. #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
  166. #define abort_() { sig_die("Fortran abort routine called", 1); }
  167. #define c_abs(z) (cabsf(Cf(z)))
  168. #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
  169. #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
  170. #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
  171. #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
  172. #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
  173. #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
  174. //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
  175. #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
  176. #define d_abs(x) (fabs(*(x)))
  177. #define d_acos(x) (acos(*(x)))
  178. #define d_asin(x) (asin(*(x)))
  179. #define d_atan(x) (atan(*(x)))
  180. #define d_atn2(x, y) (atan2(*(x),*(y)))
  181. #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
  182. #define r_cnjg(R, Z) { pCf(R) = conj(Cf(Z)); }
  183. #define d_cos(x) (cos(*(x)))
  184. #define d_cosh(x) (cosh(*(x)))
  185. #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
  186. #define d_exp(x) (exp(*(x)))
  187. #define d_imag(z) (cimag(Cd(z)))
  188. #define r_imag(z) (cimag(Cf(z)))
  189. #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  190. #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  191. #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  192. #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  193. #define d_log(x) (log(*(x)))
  194. #define d_mod(x, y) (fmod(*(x), *(y)))
  195. #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
  196. #define d_nint(x) u_nint(*(x))
  197. #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
  198. #define d_sign(a,b) u_sign(*(a),*(b))
  199. #define r_sign(a,b) u_sign(*(a),*(b))
  200. #define d_sin(x) (sin(*(x)))
  201. #define d_sinh(x) (sinh(*(x)))
  202. #define d_sqrt(x) (sqrt(*(x)))
  203. #define d_tan(x) (tan(*(x)))
  204. #define d_tanh(x) (tanh(*(x)))
  205. #define i_abs(x) abs(*(x))
  206. #define i_dnnt(x) ((integer)u_nint(*(x)))
  207. #define i_len(s, n) (n)
  208. #define i_nint(x) ((integer)u_nint(*(x)))
  209. #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
  210. #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
  211. #define pow_si(B,E) spow_ui(*(B),*(E))
  212. #define pow_ri(B,E) spow_ui(*(B),*(E))
  213. #define pow_di(B,E) dpow_ui(*(B),*(E))
  214. #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
  215. #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
  216. #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
  217. #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++ = ' '; }
  218. #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
  219. #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]; }
  220. #define sig_die(s, kill) { exit(1); }
  221. #define s_stop(s, n) {exit(0);}
  222. static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
  223. #define z_abs(z) (cabs(Cd(z)))
  224. #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
  225. #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
  226. #define myexit_() break;
  227. #define mycycle() continue;
  228. #define myceiling(w) {ceil(w)}
  229. #define myhuge(w) {HUGE_VAL}
  230. //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
  231. #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
  232. /* procedure parameter types for -A and -C++ */
  233. #define F2C_proc_par_types 1
  234. #ifdef __cplusplus
  235. typedef logical (*L_fp)(...);
  236. #else
  237. typedef logical (*L_fp)();
  238. #endif
  239. static float spow_ui(float x, integer n) {
  240. float pow=1.0; unsigned long int u;
  241. if(n != 0) {
  242. if(n < 0) n = -n, x = 1/x;
  243. for(u = n; ; ) {
  244. if(u & 01) pow *= x;
  245. if(u >>= 1) x *= x;
  246. else break;
  247. }
  248. }
  249. return pow;
  250. }
  251. static double dpow_ui(double x, integer n) {
  252. double pow=1.0; unsigned long int u;
  253. if(n != 0) {
  254. if(n < 0) n = -n, x = 1/x;
  255. for(u = n; ; ) {
  256. if(u & 01) pow *= x;
  257. if(u >>= 1) x *= x;
  258. else break;
  259. }
  260. }
  261. return pow;
  262. }
  263. static _Complex float cpow_ui(_Complex float x, integer n) {
  264. _Complex float pow=1.0; unsigned long int u;
  265. if(n != 0) {
  266. if(n < 0) n = -n, x = 1/x;
  267. for(u = n; ; ) {
  268. if(u & 01) pow *= x;
  269. if(u >>= 1) x *= x;
  270. else break;
  271. }
  272. }
  273. return pow;
  274. }
  275. static _Complex double zpow_ui(_Complex double x, integer n) {
  276. _Complex double pow=1.0; unsigned long int u;
  277. if(n != 0) {
  278. if(n < 0) n = -n, x = 1/x;
  279. for(u = n; ; ) {
  280. if(u & 01) pow *= x;
  281. if(u >>= 1) x *= x;
  282. else break;
  283. }
  284. }
  285. return pow;
  286. }
  287. static integer pow_ii(integer x, integer n) {
  288. integer pow; unsigned long int u;
  289. if (n <= 0) {
  290. if (n == 0 || x == 1) pow = 1;
  291. else if (x != -1) pow = x == 0 ? 1/x : 0;
  292. else n = -n;
  293. }
  294. if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
  295. u = n;
  296. for(pow = 1; ; ) {
  297. if(u & 01) pow *= x;
  298. if(u >>= 1) x *= x;
  299. else break;
  300. }
  301. }
  302. return pow;
  303. }
  304. static integer dmaxloc_(double *w, integer s, integer e, integer *n)
  305. {
  306. double m; integer i, mi;
  307. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  308. if (w[i-1]>m) mi=i ,m=w[i-1];
  309. return mi-s+1;
  310. }
  311. static integer smaxloc_(float *w, integer s, integer e, integer *n)
  312. {
  313. float m; integer i, mi;
  314. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  315. if (w[i-1]>m) mi=i ,m=w[i-1];
  316. return mi-s+1;
  317. }
  318. static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  319. integer n = *n_, incx = *incx_, incy = *incy_, i;
  320. _Complex float zdotc = 0.0;
  321. if (incx == 1 && incy == 1) {
  322. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  323. zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
  324. }
  325. } else {
  326. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  327. zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
  328. }
  329. }
  330. pCf(z) = zdotc;
  331. }
  332. static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  333. integer n = *n_, incx = *incx_, incy = *incy_, i;
  334. _Complex double zdotc = 0.0;
  335. if (incx == 1 && incy == 1) {
  336. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  337. zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
  338. }
  339. } else {
  340. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  341. zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
  342. }
  343. }
  344. pCd(z) = zdotc;
  345. }
  346. static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  347. integer n = *n_, incx = *incx_, incy = *incy_, i;
  348. _Complex float zdotc = 0.0;
  349. if (incx == 1 && incy == 1) {
  350. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  351. zdotc += Cf(&x[i]) * Cf(&y[i]);
  352. }
  353. } else {
  354. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  355. zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
  356. }
  357. }
  358. pCf(z) = zdotc;
  359. }
  360. static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  361. integer n = *n_, incx = *incx_, incy = *incy_, i;
  362. _Complex double zdotc = 0.0;
  363. if (incx == 1 && incy == 1) {
  364. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  365. zdotc += Cd(&x[i]) * Cd(&y[i]);
  366. }
  367. } else {
  368. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  369. zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
  370. }
  371. }
  372. pCd(z) = zdotc;
  373. }
  374. #endif
  375. /* -- translated by f2c (version 20000121).
  376. You must link the resulting object file with the libraries:
  377. -lf2c -lm (in that order)
  378. */
  379. /* > \brief \b SLAEBZ computes the number of eigenvalues of a real symmetric tridiagonal matrix which are less
  380. than or equal to a given value, and performs other tasks required by the routine sstebz. */
  381. /* =========== DOCUMENTATION =========== */
  382. /* Online html documentation available at */
  383. /* http://www.netlib.org/lapack/explore-html/ */
  384. /* > \htmlonly */
  385. /* > Download SLAEBZ + dependencies */
  386. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slaebz.
  387. f"> */
  388. /* > [TGZ]</a> */
  389. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slaebz.
  390. f"> */
  391. /* > [ZIP]</a> */
  392. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slaebz.
  393. f"> */
  394. /* > [TXT]</a> */
  395. /* > \endhtmlonly */
  396. /* Definition: */
  397. /* =========== */
  398. /* SUBROUTINE SLAEBZ( IJOB, NITMAX, N, MMAX, MINP, NBMIN, ABSTOL, */
  399. /* RELTOL, PIVMIN, D, E, E2, NVAL, AB, C, MOUT, */
  400. /* NAB, WORK, IWORK, INFO ) */
  401. /* INTEGER IJOB, INFO, MINP, MMAX, MOUT, N, NBMIN, NITMAX */
  402. /* REAL ABSTOL, PIVMIN, RELTOL */
  403. /* INTEGER IWORK( * ), NAB( MMAX, * ), NVAL( * ) */
  404. /* REAL AB( MMAX, * ), C( * ), D( * ), E( * ), E2( * ), */
  405. /* $ WORK( * ) */
  406. /* > \par Purpose: */
  407. /* ============= */
  408. /* > */
  409. /* > \verbatim */
  410. /* > */
  411. /* > SLAEBZ contains the iteration loops which compute and use the */
  412. /* > function N(w), which is the count of eigenvalues of a symmetric */
  413. /* > tridiagonal matrix T less than or equal to its argument w. It */
  414. /* > performs a choice of two types of loops: */
  415. /* > */
  416. /* > IJOB=1, followed by */
  417. /* > IJOB=2: It takes as input a list of intervals and returns a list of */
  418. /* > sufficiently small intervals whose union contains the same */
  419. /* > eigenvalues as the union of the original intervals. */
  420. /* > The input intervals are (AB(j,1),AB(j,2)], j=1,...,MINP. */
  421. /* > The output interval (AB(j,1),AB(j,2)] will contain */
  422. /* > eigenvalues NAB(j,1)+1,...,NAB(j,2), where 1 <= j <= MOUT. */
  423. /* > */
  424. /* > IJOB=3: It performs a binary search in each input interval */
  425. /* > (AB(j,1),AB(j,2)] for a point w(j) such that */
  426. /* > N(w(j))=NVAL(j), and uses C(j) as the starting point of */
  427. /* > the search. If such a w(j) is found, then on output */
  428. /* > AB(j,1)=AB(j,2)=w. If no such w(j) is found, then on output */
  429. /* > (AB(j,1),AB(j,2)] will be a small interval containing the */
  430. /* > point where N(w) jumps through NVAL(j), unless that point */
  431. /* > lies outside the initial interval. */
  432. /* > */
  433. /* > Note that the intervals are in all cases half-open intervals, */
  434. /* > i.e., of the form (a,b] , which includes b but not a . */
  435. /* > */
  436. /* > To avoid underflow, the matrix should be scaled so that its largest */
  437. /* > element is no greater than overflow**(1/2) * underflow**(1/4) */
  438. /* > in absolute value. To assure the most accurate computation */
  439. /* > of small eigenvalues, the matrix should be scaled to be */
  440. /* > not much smaller than that, either. */
  441. /* > */
  442. /* > See W. Kahan "Accurate Eigenvalues of a Symmetric Tridiagonal */
  443. /* > Matrix", Report CS41, Computer Science Dept., Stanford */
  444. /* > University, July 21, 1966 */
  445. /* > */
  446. /* > Note: the arguments are, in general, *not* checked for unreasonable */
  447. /* > values. */
  448. /* > \endverbatim */
  449. /* Arguments: */
  450. /* ========== */
  451. /* > \param[in] IJOB */
  452. /* > \verbatim */
  453. /* > IJOB is INTEGER */
  454. /* > Specifies what is to be done: */
  455. /* > = 1: Compute NAB for the initial intervals. */
  456. /* > = 2: Perform bisection iteration to find eigenvalues of T. */
  457. /* > = 3: Perform bisection iteration to invert N(w), i.e., */
  458. /* > to find a point which has a specified number of */
  459. /* > eigenvalues of T to its left. */
  460. /* > Other values will cause SLAEBZ to return with INFO=-1. */
  461. /* > \endverbatim */
  462. /* > */
  463. /* > \param[in] NITMAX */
  464. /* > \verbatim */
  465. /* > NITMAX is INTEGER */
  466. /* > The maximum number of "levels" of bisection to be */
  467. /* > performed, i.e., an interval of width W will not be made */
  468. /* > smaller than 2^(-NITMAX) * W. If not all intervals */
  469. /* > have converged after NITMAX iterations, then INFO is set */
  470. /* > to the number of non-converged intervals. */
  471. /* > \endverbatim */
  472. /* > */
  473. /* > \param[in] N */
  474. /* > \verbatim */
  475. /* > N is INTEGER */
  476. /* > The dimension n of the tridiagonal matrix T. It must be at */
  477. /* > least 1. */
  478. /* > \endverbatim */
  479. /* > */
  480. /* > \param[in] MMAX */
  481. /* > \verbatim */
  482. /* > MMAX is INTEGER */
  483. /* > The maximum number of intervals. If more than MMAX intervals */
  484. /* > are generated, then SLAEBZ will quit with INFO=MMAX+1. */
  485. /* > \endverbatim */
  486. /* > */
  487. /* > \param[in] MINP */
  488. /* > \verbatim */
  489. /* > MINP is INTEGER */
  490. /* > The initial number of intervals. It may not be greater than */
  491. /* > MMAX. */
  492. /* > \endverbatim */
  493. /* > */
  494. /* > \param[in] NBMIN */
  495. /* > \verbatim */
  496. /* > NBMIN is INTEGER */
  497. /* > The smallest number of intervals that should be processed */
  498. /* > using a vector loop. If zero, then only the scalar loop */
  499. /* > will be used. */
  500. /* > \endverbatim */
  501. /* > */
  502. /* > \param[in] ABSTOL */
  503. /* > \verbatim */
  504. /* > ABSTOL is REAL */
  505. /* > The minimum (absolute) width of an interval. When an */
  506. /* > interval is narrower than ABSTOL, or than RELTOL times the */
  507. /* > larger (in magnitude) endpoint, then it is considered to be */
  508. /* > sufficiently small, i.e., converged. This must be at least */
  509. /* > zero. */
  510. /* > \endverbatim */
  511. /* > */
  512. /* > \param[in] RELTOL */
  513. /* > \verbatim */
  514. /* > RELTOL is REAL */
  515. /* > The minimum relative width of an interval. When an interval */
  516. /* > is narrower than ABSTOL, or than RELTOL times the larger (in */
  517. /* > magnitude) endpoint, then it is considered to be */
  518. /* > sufficiently small, i.e., converged. Note: this should */
  519. /* > always be at least radix*machine epsilon. */
  520. /* > \endverbatim */
  521. /* > */
  522. /* > \param[in] PIVMIN */
  523. /* > \verbatim */
  524. /* > PIVMIN is REAL */
  525. /* > The minimum absolute value of a "pivot" in the Sturm */
  526. /* > sequence loop. */
  527. /* > This must be at least f2cmax |e(j)**2|*safe_min and at */
  528. /* > least safe_min, where safe_min is at least */
  529. /* > the smallest number that can divide one without overflow. */
  530. /* > \endverbatim */
  531. /* > */
  532. /* > \param[in] D */
  533. /* > \verbatim */
  534. /* > D is REAL array, dimension (N) */
  535. /* > The diagonal elements of the tridiagonal matrix T. */
  536. /* > \endverbatim */
  537. /* > */
  538. /* > \param[in] E */
  539. /* > \verbatim */
  540. /* > E is REAL array, dimension (N) */
  541. /* > The offdiagonal elements of the tridiagonal matrix T in */
  542. /* > positions 1 through N-1. E(N) is arbitrary. */
  543. /* > \endverbatim */
  544. /* > */
  545. /* > \param[in] E2 */
  546. /* > \verbatim */
  547. /* > E2 is REAL array, dimension (N) */
  548. /* > The squares of the offdiagonal elements of the tridiagonal */
  549. /* > matrix T. E2(N) is ignored. */
  550. /* > \endverbatim */
  551. /* > */
  552. /* > \param[in,out] NVAL */
  553. /* > \verbatim */
  554. /* > NVAL is INTEGER array, dimension (MINP) */
  555. /* > If IJOB=1 or 2, not referenced. */
  556. /* > If IJOB=3, the desired values of N(w). The elements of NVAL */
  557. /* > will be reordered to correspond with the intervals in AB. */
  558. /* > Thus, NVAL(j) on output will not, in general be the same as */
  559. /* > NVAL(j) on input, but it will correspond with the interval */
  560. /* > (AB(j,1),AB(j,2)] on output. */
  561. /* > \endverbatim */
  562. /* > */
  563. /* > \param[in,out] AB */
  564. /* > \verbatim */
  565. /* > AB is REAL array, dimension (MMAX,2) */
  566. /* > The endpoints of the intervals. AB(j,1) is a(j), the left */
  567. /* > endpoint of the j-th interval, and AB(j,2) is b(j), the */
  568. /* > right endpoint of the j-th interval. The input intervals */
  569. /* > will, in general, be modified, split, and reordered by the */
  570. /* > calculation. */
  571. /* > \endverbatim */
  572. /* > */
  573. /* > \param[in,out] C */
  574. /* > \verbatim */
  575. /* > C is REAL array, dimension (MMAX) */
  576. /* > If IJOB=1, ignored. */
  577. /* > If IJOB=2, workspace. */
  578. /* > If IJOB=3, then on input C(j) should be initialized to the */
  579. /* > first search point in the binary search. */
  580. /* > \endverbatim */
  581. /* > */
  582. /* > \param[out] MOUT */
  583. /* > \verbatim */
  584. /* > MOUT is INTEGER */
  585. /* > If IJOB=1, the number of eigenvalues in the intervals. */
  586. /* > If IJOB=2 or 3, the number of intervals output. */
  587. /* > If IJOB=3, MOUT will equal MINP. */
  588. /* > \endverbatim */
  589. /* > */
  590. /* > \param[in,out] NAB */
  591. /* > \verbatim */
  592. /* > NAB is INTEGER array, dimension (MMAX,2) */
  593. /* > If IJOB=1, then on output NAB(i,j) will be set to N(AB(i,j)). */
  594. /* > If IJOB=2, then on input, NAB(i,j) should be set. It must */
  595. /* > satisfy the condition: */
  596. /* > N(AB(i,1)) <= NAB(i,1) <= NAB(i,2) <= N(AB(i,2)), */
  597. /* > which means that in interval i only eigenvalues */
  598. /* > NAB(i,1)+1,...,NAB(i,2) will be considered. Usually, */
  599. /* > NAB(i,j)=N(AB(i,j)), from a previous call to SLAEBZ with */
  600. /* > IJOB=1. */
  601. /* > On output, NAB(i,j) will contain */
  602. /* > f2cmax(na(k),f2cmin(nb(k),N(AB(i,j)))), where k is the index of */
  603. /* > the input interval that the output interval */
  604. /* > (AB(j,1),AB(j,2)] came from, and na(k) and nb(k) are the */
  605. /* > the input values of NAB(k,1) and NAB(k,2). */
  606. /* > If IJOB=3, then on output, NAB(i,j) contains N(AB(i,j)), */
  607. /* > unless N(w) > NVAL(i) for all search points w , in which */
  608. /* > case NAB(i,1) will not be modified, i.e., the output */
  609. /* > value will be the same as the input value (modulo */
  610. /* > reorderings -- see NVAL and AB), or unless N(w) < NVAL(i) */
  611. /* > for all search points w , in which case NAB(i,2) will */
  612. /* > not be modified. Normally, NAB should be set to some */
  613. /* > distinctive value(s) before SLAEBZ is called. */
  614. /* > \endverbatim */
  615. /* > */
  616. /* > \param[out] WORK */
  617. /* > \verbatim */
  618. /* > WORK is REAL array, dimension (MMAX) */
  619. /* > Workspace. */
  620. /* > \endverbatim */
  621. /* > */
  622. /* > \param[out] IWORK */
  623. /* > \verbatim */
  624. /* > IWORK is INTEGER array, dimension (MMAX) */
  625. /* > Workspace. */
  626. /* > \endverbatim */
  627. /* > */
  628. /* > \param[out] INFO */
  629. /* > \verbatim */
  630. /* > INFO is INTEGER */
  631. /* > = 0: All intervals converged. */
  632. /* > = 1--MMAX: The last INFO intervals did not converge. */
  633. /* > = MMAX+1: More than MMAX intervals were generated. */
  634. /* > \endverbatim */
  635. /* Authors: */
  636. /* ======== */
  637. /* > \author Univ. of Tennessee */
  638. /* > \author Univ. of California Berkeley */
  639. /* > \author Univ. of Colorado Denver */
  640. /* > \author NAG Ltd. */
  641. /* > \date December 2016 */
  642. /* > \ingroup OTHERauxiliary */
  643. /* > \par Further Details: */
  644. /* ===================== */
  645. /* > */
  646. /* > \verbatim */
  647. /* > */
  648. /* > This routine is intended to be called only by other LAPACK */
  649. /* > routines, thus the interface is less user-friendly. It is intended */
  650. /* > for two purposes: */
  651. /* > */
  652. /* > (a) finding eigenvalues. In this case, SLAEBZ should have one or */
  653. /* > more initial intervals set up in AB, and SLAEBZ should be called */
  654. /* > with IJOB=1. This sets up NAB, and also counts the eigenvalues. */
  655. /* > Intervals with no eigenvalues would usually be thrown out at */
  656. /* > this point. Also, if not all the eigenvalues in an interval i */
  657. /* > are desired, NAB(i,1) can be increased or NAB(i,2) decreased. */
  658. /* > For example, set NAB(i,1)=NAB(i,2)-1 to get the largest */
  659. /* > eigenvalue. SLAEBZ is then called with IJOB=2 and MMAX */
  660. /* > no smaller than the value of MOUT returned by the call with */
  661. /* > IJOB=1. After this (IJOB=2) call, eigenvalues NAB(i,1)+1 */
  662. /* > through NAB(i,2) are approximately AB(i,1) (or AB(i,2)) to the */
  663. /* > tolerance specified by ABSTOL and RELTOL. */
  664. /* > */
  665. /* > (b) finding an interval (a',b'] containing eigenvalues w(f),...,w(l). */
  666. /* > In this case, start with a Gershgorin interval (a,b). Set up */
  667. /* > AB to contain 2 search intervals, both initially (a,b). One */
  668. /* > NVAL element should contain f-1 and the other should contain l */
  669. /* > , while C should contain a and b, resp. NAB(i,1) should be -1 */
  670. /* > and NAB(i,2) should be N+1, to flag an error if the desired */
  671. /* > interval does not lie in (a,b). SLAEBZ is then called with */
  672. /* > IJOB=3. On exit, if w(f-1) < w(f), then one of the intervals -- */
  673. /* > j -- will have AB(j,1)=AB(j,2) and NAB(j,1)=NAB(j,2)=f-1, while */
  674. /* > if, to the specified tolerance, w(f-k)=...=w(f+r), k > 0 and r */
  675. /* > >= 0, then the interval will have N(AB(j,1))=NAB(j,1)=f-k and */
  676. /* > N(AB(j,2))=NAB(j,2)=f+r. The cases w(l) < w(l+1) and */
  677. /* > w(l-r)=...=w(l+k) are handled similarly. */
  678. /* > \endverbatim */
  679. /* > */
  680. /* ===================================================================== */
  681. /* Subroutine */ int slaebz_(integer *ijob, integer *nitmax, integer *n,
  682. integer *mmax, integer *minp, integer *nbmin, real *abstol, real *
  683. reltol, real *pivmin, real *d__, real *e, real *e2, integer *nval,
  684. real *ab, real *c__, integer *mout, integer *nab, real *work, integer
  685. *iwork, integer *info)
  686. {
  687. /* System generated locals */
  688. integer nab_dim1, nab_offset, ab_dim1, ab_offset, i__1, i__2, i__3, i__4,
  689. i__5, i__6;
  690. real r__1, r__2, r__3, r__4;
  691. /* Local variables */
  692. integer itmp1, itmp2, j, kfnew, klnew, kf, ji, kl, jp, jit;
  693. real tmp1, tmp2;
  694. /* -- LAPACK auxiliary routine (version 3.7.0) -- */
  695. /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
  696. /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
  697. /* December 2016 */
  698. /* ===================================================================== */
  699. /* Check for Errors */
  700. /* Parameter adjustments */
  701. nab_dim1 = *mmax;
  702. nab_offset = 1 + nab_dim1 * 1;
  703. nab -= nab_offset;
  704. ab_dim1 = *mmax;
  705. ab_offset = 1 + ab_dim1 * 1;
  706. ab -= ab_offset;
  707. --d__;
  708. --e;
  709. --e2;
  710. --nval;
  711. --c__;
  712. --work;
  713. --iwork;
  714. /* Function Body */
  715. *info = 0;
  716. if (*ijob < 1 || *ijob > 3) {
  717. *info = -1;
  718. return 0;
  719. }
  720. /* Initialize NAB */
  721. if (*ijob == 1) {
  722. /* Compute the number of eigenvalues in the initial intervals. */
  723. *mout = 0;
  724. i__1 = *minp;
  725. for (ji = 1; ji <= i__1; ++ji) {
  726. for (jp = 1; jp <= 2; ++jp) {
  727. tmp1 = d__[1] - ab[ji + jp * ab_dim1];
  728. if (abs(tmp1) < *pivmin) {
  729. tmp1 = -(*pivmin);
  730. }
  731. nab[ji + jp * nab_dim1] = 0;
  732. if (tmp1 <= 0.f) {
  733. nab[ji + jp * nab_dim1] = 1;
  734. }
  735. i__2 = *n;
  736. for (j = 2; j <= i__2; ++j) {
  737. tmp1 = d__[j] - e2[j - 1] / tmp1 - ab[ji + jp * ab_dim1];
  738. if (abs(tmp1) < *pivmin) {
  739. tmp1 = -(*pivmin);
  740. }
  741. if (tmp1 <= 0.f) {
  742. ++nab[ji + jp * nab_dim1];
  743. }
  744. /* L10: */
  745. }
  746. /* L20: */
  747. }
  748. *mout = *mout + nab[ji + (nab_dim1 << 1)] - nab[ji + nab_dim1];
  749. /* L30: */
  750. }
  751. return 0;
  752. }
  753. /* Initialize for loop */
  754. /* KF and KL have the following meaning: */
  755. /* Intervals 1,...,KF-1 have converged. */
  756. /* Intervals KF,...,KL still need to be refined. */
  757. kf = 1;
  758. kl = *minp;
  759. /* If IJOB=2, initialize C. */
  760. /* If IJOB=3, use the user-supplied starting point. */
  761. if (*ijob == 2) {
  762. i__1 = *minp;
  763. for (ji = 1; ji <= i__1; ++ji) {
  764. c__[ji] = (ab[ji + ab_dim1] + ab[ji + (ab_dim1 << 1)]) * .5f;
  765. /* L40: */
  766. }
  767. }
  768. /* Iteration loop */
  769. i__1 = *nitmax;
  770. for (jit = 1; jit <= i__1; ++jit) {
  771. /* Loop over intervals */
  772. if (kl - kf + 1 >= *nbmin && *nbmin > 0) {
  773. /* Begin of Parallel Version of the loop */
  774. i__2 = kl;
  775. for (ji = kf; ji <= i__2; ++ji) {
  776. /* Compute N(c), the number of eigenvalues less than c */
  777. work[ji] = d__[1] - c__[ji];
  778. iwork[ji] = 0;
  779. if (work[ji] <= *pivmin) {
  780. iwork[ji] = 1;
  781. /* Computing MIN */
  782. r__1 = work[ji], r__2 = -(*pivmin);
  783. work[ji] = f2cmin(r__1,r__2);
  784. }
  785. i__3 = *n;
  786. for (j = 2; j <= i__3; ++j) {
  787. work[ji] = d__[j] - e2[j - 1] / work[ji] - c__[ji];
  788. if (work[ji] <= *pivmin) {
  789. ++iwork[ji];
  790. /* Computing MIN */
  791. r__1 = work[ji], r__2 = -(*pivmin);
  792. work[ji] = f2cmin(r__1,r__2);
  793. }
  794. /* L50: */
  795. }
  796. /* L60: */
  797. }
  798. if (*ijob <= 2) {
  799. /* IJOB=2: Choose all intervals containing eigenvalues. */
  800. klnew = kl;
  801. i__2 = kl;
  802. for (ji = kf; ji <= i__2; ++ji) {
  803. /* Insure that N(w) is monotone */
  804. /* Computing MIN */
  805. /* Computing MAX */
  806. i__5 = nab[ji + nab_dim1], i__6 = iwork[ji];
  807. i__3 = nab[ji + (nab_dim1 << 1)], i__4 = f2cmax(i__5,i__6);
  808. iwork[ji] = f2cmin(i__3,i__4);
  809. /* Update the Queue -- add intervals if both halves */
  810. /* contain eigenvalues. */
  811. if (iwork[ji] == nab[ji + (nab_dim1 << 1)]) {
  812. /* No eigenvalue in the upper interval: */
  813. /* just use the lower interval. */
  814. ab[ji + (ab_dim1 << 1)] = c__[ji];
  815. } else if (iwork[ji] == nab[ji + nab_dim1]) {
  816. /* No eigenvalue in the lower interval: */
  817. /* just use the upper interval. */
  818. ab[ji + ab_dim1] = c__[ji];
  819. } else {
  820. ++klnew;
  821. if (klnew <= *mmax) {
  822. /* Eigenvalue in both intervals -- add upper to */
  823. /* queue. */
  824. ab[klnew + (ab_dim1 << 1)] = ab[ji + (ab_dim1 <<
  825. 1)];
  826. nab[klnew + (nab_dim1 << 1)] = nab[ji + (nab_dim1
  827. << 1)];
  828. ab[klnew + ab_dim1] = c__[ji];
  829. nab[klnew + nab_dim1] = iwork[ji];
  830. ab[ji + (ab_dim1 << 1)] = c__[ji];
  831. nab[ji + (nab_dim1 << 1)] = iwork[ji];
  832. } else {
  833. *info = *mmax + 1;
  834. }
  835. }
  836. /* L70: */
  837. }
  838. if (*info != 0) {
  839. return 0;
  840. }
  841. kl = klnew;
  842. } else {
  843. /* IJOB=3: Binary search. Keep only the interval containing */
  844. /* w s.t. N(w) = NVAL */
  845. i__2 = kl;
  846. for (ji = kf; ji <= i__2; ++ji) {
  847. if (iwork[ji] <= nval[ji]) {
  848. ab[ji + ab_dim1] = c__[ji];
  849. nab[ji + nab_dim1] = iwork[ji];
  850. }
  851. if (iwork[ji] >= nval[ji]) {
  852. ab[ji + (ab_dim1 << 1)] = c__[ji];
  853. nab[ji + (nab_dim1 << 1)] = iwork[ji];
  854. }
  855. /* L80: */
  856. }
  857. }
  858. } else {
  859. /* End of Parallel Version of the loop */
  860. /* Begin of Serial Version of the loop */
  861. klnew = kl;
  862. i__2 = kl;
  863. for (ji = kf; ji <= i__2; ++ji) {
  864. /* Compute N(w), the number of eigenvalues less than w */
  865. tmp1 = c__[ji];
  866. tmp2 = d__[1] - tmp1;
  867. itmp1 = 0;
  868. if (tmp2 <= *pivmin) {
  869. itmp1 = 1;
  870. /* Computing MIN */
  871. r__1 = tmp2, r__2 = -(*pivmin);
  872. tmp2 = f2cmin(r__1,r__2);
  873. }
  874. i__3 = *n;
  875. for (j = 2; j <= i__3; ++j) {
  876. tmp2 = d__[j] - e2[j - 1] / tmp2 - tmp1;
  877. if (tmp2 <= *pivmin) {
  878. ++itmp1;
  879. /* Computing MIN */
  880. r__1 = tmp2, r__2 = -(*pivmin);
  881. tmp2 = f2cmin(r__1,r__2);
  882. }
  883. /* L90: */
  884. }
  885. if (*ijob <= 2) {
  886. /* IJOB=2: Choose all intervals containing eigenvalues. */
  887. /* Insure that N(w) is monotone */
  888. /* Computing MIN */
  889. /* Computing MAX */
  890. i__5 = nab[ji + nab_dim1];
  891. i__3 = nab[ji + (nab_dim1 << 1)], i__4 = f2cmax(i__5,itmp1);
  892. itmp1 = f2cmin(i__3,i__4);
  893. /* Update the Queue -- add intervals if both halves */
  894. /* contain eigenvalues. */
  895. if (itmp1 == nab[ji + (nab_dim1 << 1)]) {
  896. /* No eigenvalue in the upper interval: */
  897. /* just use the lower interval. */
  898. ab[ji + (ab_dim1 << 1)] = tmp1;
  899. } else if (itmp1 == nab[ji + nab_dim1]) {
  900. /* No eigenvalue in the lower interval: */
  901. /* just use the upper interval. */
  902. ab[ji + ab_dim1] = tmp1;
  903. } else if (klnew < *mmax) {
  904. /* Eigenvalue in both intervals -- add upper to queue. */
  905. ++klnew;
  906. ab[klnew + (ab_dim1 << 1)] = ab[ji + (ab_dim1 << 1)];
  907. nab[klnew + (nab_dim1 << 1)] = nab[ji + (nab_dim1 <<
  908. 1)];
  909. ab[klnew + ab_dim1] = tmp1;
  910. nab[klnew + nab_dim1] = itmp1;
  911. ab[ji + (ab_dim1 << 1)] = tmp1;
  912. nab[ji + (nab_dim1 << 1)] = itmp1;
  913. } else {
  914. *info = *mmax + 1;
  915. return 0;
  916. }
  917. } else {
  918. /* IJOB=3: Binary search. Keep only the interval */
  919. /* containing w s.t. N(w) = NVAL */
  920. if (itmp1 <= nval[ji]) {
  921. ab[ji + ab_dim1] = tmp1;
  922. nab[ji + nab_dim1] = itmp1;
  923. }
  924. if (itmp1 >= nval[ji]) {
  925. ab[ji + (ab_dim1 << 1)] = tmp1;
  926. nab[ji + (nab_dim1 << 1)] = itmp1;
  927. }
  928. }
  929. /* L100: */
  930. }
  931. kl = klnew;
  932. }
  933. /* Check for convergence */
  934. kfnew = kf;
  935. i__2 = kl;
  936. for (ji = kf; ji <= i__2; ++ji) {
  937. tmp1 = (r__1 = ab[ji + (ab_dim1 << 1)] - ab[ji + ab_dim1], abs(
  938. r__1));
  939. /* Computing MAX */
  940. r__3 = (r__1 = ab[ji + (ab_dim1 << 1)], abs(r__1)), r__4 = (r__2 =
  941. ab[ji + ab_dim1], abs(r__2));
  942. tmp2 = f2cmax(r__3,r__4);
  943. /* Computing MAX */
  944. r__1 = f2cmax(*abstol,*pivmin), r__2 = *reltol * tmp2;
  945. if (tmp1 < f2cmax(r__1,r__2) || nab[ji + nab_dim1] >= nab[ji + (
  946. nab_dim1 << 1)]) {
  947. /* Converged -- Swap with position KFNEW, */
  948. /* then increment KFNEW */
  949. if (ji > kfnew) {
  950. tmp1 = ab[ji + ab_dim1];
  951. tmp2 = ab[ji + (ab_dim1 << 1)];
  952. itmp1 = nab[ji + nab_dim1];
  953. itmp2 = nab[ji + (nab_dim1 << 1)];
  954. ab[ji + ab_dim1] = ab[kfnew + ab_dim1];
  955. ab[ji + (ab_dim1 << 1)] = ab[kfnew + (ab_dim1 << 1)];
  956. nab[ji + nab_dim1] = nab[kfnew + nab_dim1];
  957. nab[ji + (nab_dim1 << 1)] = nab[kfnew + (nab_dim1 << 1)];
  958. ab[kfnew + ab_dim1] = tmp1;
  959. ab[kfnew + (ab_dim1 << 1)] = tmp2;
  960. nab[kfnew + nab_dim1] = itmp1;
  961. nab[kfnew + (nab_dim1 << 1)] = itmp2;
  962. if (*ijob == 3) {
  963. itmp1 = nval[ji];
  964. nval[ji] = nval[kfnew];
  965. nval[kfnew] = itmp1;
  966. }
  967. }
  968. ++kfnew;
  969. }
  970. /* L110: */
  971. }
  972. kf = kfnew;
  973. /* Choose Midpoints */
  974. i__2 = kl;
  975. for (ji = kf; ji <= i__2; ++ji) {
  976. c__[ji] = (ab[ji + ab_dim1] + ab[ji + (ab_dim1 << 1)]) * .5f;
  977. /* L120: */
  978. }
  979. /* If no more intervals to refine, quit. */
  980. if (kf > kl) {
  981. goto L140;
  982. }
  983. /* L130: */
  984. }
  985. /* Converged */
  986. L140:
  987. /* Computing MAX */
  988. i__1 = kl + 1 - kf;
  989. *info = f2cmax(i__1,0);
  990. *mout = kl;
  991. return 0;
  992. /* End of SLAEBZ */
  993. } /* slaebz_ */