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.

slarrv.c 55 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610
  1. #include <math.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <stdio.h>
  5. #include <complex.h>
  6. #ifdef complex
  7. #undef complex
  8. #endif
  9. #ifdef I
  10. #undef I
  11. #endif
  12. #if defined(_WIN64)
  13. typedef long long BLASLONG;
  14. typedef unsigned long long BLASULONG;
  15. #else
  16. typedef long BLASLONG;
  17. typedef unsigned long BLASULONG;
  18. #endif
  19. #ifdef LAPACK_ILP64
  20. typedef BLASLONG blasint;
  21. #if defined(_WIN64)
  22. #define blasabs(x) llabs(x)
  23. #else
  24. #define blasabs(x) labs(x)
  25. #endif
  26. #else
  27. typedef int blasint;
  28. #define blasabs(x) abs(x)
  29. #endif
  30. typedef blasint integer;
  31. typedef unsigned int uinteger;
  32. typedef char *address;
  33. typedef short int shortint;
  34. typedef float real;
  35. typedef double doublereal;
  36. typedef struct { real r, i; } complex;
  37. typedef struct { doublereal r, i; } doublecomplex;
  38. #ifdef _MSC_VER
  39. static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
  40. static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
  41. static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
  42. static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
  43. #else
  44. static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
  45. static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
  46. static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
  47. static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
  48. #endif
  49. #define pCf(z) (*_pCf(z))
  50. #define pCd(z) (*_pCd(z))
  51. typedef blasint logical;
  52. typedef char logical1;
  53. typedef char integer1;
  54. #define TRUE_ (1)
  55. #define FALSE_ (0)
  56. /* Extern is for use with -E */
  57. #ifndef Extern
  58. #define Extern extern
  59. #endif
  60. /* I/O stuff */
  61. typedef int flag;
  62. typedef int ftnlen;
  63. typedef int ftnint;
  64. /*external read, write*/
  65. typedef struct
  66. { flag cierr;
  67. ftnint ciunit;
  68. flag ciend;
  69. char *cifmt;
  70. ftnint cirec;
  71. } cilist;
  72. /*internal read, write*/
  73. typedef struct
  74. { flag icierr;
  75. char *iciunit;
  76. flag iciend;
  77. char *icifmt;
  78. ftnint icirlen;
  79. ftnint icirnum;
  80. } icilist;
  81. /*open*/
  82. typedef struct
  83. { flag oerr;
  84. ftnint ounit;
  85. char *ofnm;
  86. ftnlen ofnmlen;
  87. char *osta;
  88. char *oacc;
  89. char *ofm;
  90. ftnint orl;
  91. char *oblnk;
  92. } olist;
  93. /*close*/
  94. typedef struct
  95. { flag cerr;
  96. ftnint cunit;
  97. char *csta;
  98. } cllist;
  99. /*rewind, backspace, endfile*/
  100. typedef struct
  101. { flag aerr;
  102. ftnint aunit;
  103. } alist;
  104. /* inquire */
  105. typedef struct
  106. { flag inerr;
  107. ftnint inunit;
  108. char *infile;
  109. ftnlen infilen;
  110. ftnint *inex; /*parameters in standard's order*/
  111. ftnint *inopen;
  112. ftnint *innum;
  113. ftnint *innamed;
  114. char *inname;
  115. ftnlen innamlen;
  116. char *inacc;
  117. ftnlen inacclen;
  118. char *inseq;
  119. ftnlen inseqlen;
  120. char *indir;
  121. ftnlen indirlen;
  122. char *infmt;
  123. ftnlen infmtlen;
  124. char *inform;
  125. ftnint informlen;
  126. char *inunf;
  127. ftnlen inunflen;
  128. ftnint *inrecl;
  129. ftnint *innrec;
  130. char *inblank;
  131. ftnlen inblanklen;
  132. } inlist;
  133. #define VOID void
  134. union Multitype { /* for multiple entry points */
  135. integer1 g;
  136. shortint h;
  137. integer i;
  138. /* longint j; */
  139. real r;
  140. doublereal d;
  141. complex c;
  142. doublecomplex z;
  143. };
  144. typedef union Multitype Multitype;
  145. struct Vardesc { /* for Namelist */
  146. char *name;
  147. char *addr;
  148. ftnlen *dims;
  149. int type;
  150. };
  151. typedef struct Vardesc Vardesc;
  152. struct Namelist {
  153. char *name;
  154. Vardesc **vars;
  155. int nvars;
  156. };
  157. typedef struct Namelist Namelist;
  158. #define abs(x) ((x) >= 0 ? (x) : -(x))
  159. #define dabs(x) (fabs(x))
  160. #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
  161. #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
  162. #define dmin(a,b) (f2cmin(a,b))
  163. #define dmax(a,b) (f2cmax(a,b))
  164. #define bit_test(a,b) ((a) >> (b) & 1)
  165. #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
  166. #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
  167. #define abort_() { sig_die("Fortran abort routine called", 1); }
  168. #define c_abs(z) (cabsf(Cf(z)))
  169. #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
  170. #ifdef _MSC_VER
  171. #define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
  172. #define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/df(b)._Val[1]);}
  173. #else
  174. #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
  175. #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
  176. #endif
  177. #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
  178. #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
  179. #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
  180. //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
  181. #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
  182. #define d_abs(x) (fabs(*(x)))
  183. #define d_acos(x) (acos(*(x)))
  184. #define d_asin(x) (asin(*(x)))
  185. #define d_atan(x) (atan(*(x)))
  186. #define d_atn2(x, y) (atan2(*(x),*(y)))
  187. #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
  188. #define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
  189. #define d_cos(x) (cos(*(x)))
  190. #define d_cosh(x) (cosh(*(x)))
  191. #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
  192. #define d_exp(x) (exp(*(x)))
  193. #define d_imag(z) (cimag(Cd(z)))
  194. #define r_imag(z) (cimagf(Cf(z)))
  195. #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  196. #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  197. #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  198. #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  199. #define d_log(x) (log(*(x)))
  200. #define d_mod(x, y) (fmod(*(x), *(y)))
  201. #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
  202. #define d_nint(x) u_nint(*(x))
  203. #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
  204. #define d_sign(a,b) u_sign(*(a),*(b))
  205. #define r_sign(a,b) u_sign(*(a),*(b))
  206. #define d_sin(x) (sin(*(x)))
  207. #define d_sinh(x) (sinh(*(x)))
  208. #define d_sqrt(x) (sqrt(*(x)))
  209. #define d_tan(x) (tan(*(x)))
  210. #define d_tanh(x) (tanh(*(x)))
  211. #define i_abs(x) abs(*(x))
  212. #define i_dnnt(x) ((integer)u_nint(*(x)))
  213. #define i_len(s, n) (n)
  214. #define i_nint(x) ((integer)u_nint(*(x)))
  215. #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
  216. #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
  217. #define pow_si(B,E) spow_ui(*(B),*(E))
  218. #define pow_ri(B,E) spow_ui(*(B),*(E))
  219. #define pow_di(B,E) dpow_ui(*(B),*(E))
  220. #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
  221. #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
  222. #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
  223. #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++ = ' '; }
  224. #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
  225. #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]; }
  226. #define sig_die(s, kill) { exit(1); }
  227. #define s_stop(s, n) {exit(0);}
  228. static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
  229. #define z_abs(z) (cabs(Cd(z)))
  230. #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
  231. #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
  232. #define myexit_() break;
  233. #define mycycle() continue;
  234. #define myceiling(w) {ceil(w)}
  235. #define myhuge(w) {HUGE_VAL}
  236. //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
  237. #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
  238. /* procedure parameter types for -A and -C++ */
  239. #ifdef __cplusplus
  240. typedef logical (*L_fp)(...);
  241. #else
  242. typedef logical (*L_fp)();
  243. #endif
  244. static float spow_ui(float x, integer n) {
  245. float pow=1.0; unsigned long int u;
  246. if(n != 0) {
  247. if(n < 0) n = -n, x = 1/x;
  248. for(u = n; ; ) {
  249. if(u & 01) pow *= x;
  250. if(u >>= 1) x *= x;
  251. else break;
  252. }
  253. }
  254. return pow;
  255. }
  256. static double dpow_ui(double x, integer n) {
  257. double pow=1.0; unsigned long int u;
  258. if(n != 0) {
  259. if(n < 0) n = -n, x = 1/x;
  260. for(u = n; ; ) {
  261. if(u & 01) pow *= x;
  262. if(u >>= 1) x *= x;
  263. else break;
  264. }
  265. }
  266. return pow;
  267. }
  268. #ifdef _MSC_VER
  269. static _Fcomplex cpow_ui(complex x, integer n) {
  270. complex pow={1.0,0.0}; unsigned long int u;
  271. if(n != 0) {
  272. if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
  273. for(u = n; ; ) {
  274. if(u & 01) pow.r *= x.r, pow.i *= x.i;
  275. if(u >>= 1) x.r *= x.r, x.i *= x.i;
  276. else break;
  277. }
  278. }
  279. _Fcomplex p={pow.r, pow.i};
  280. return p;
  281. }
  282. #else
  283. static _Complex float cpow_ui(_Complex float x, integer n) {
  284. _Complex float pow=1.0; unsigned long int u;
  285. if(n != 0) {
  286. if(n < 0) n = -n, x = 1/x;
  287. for(u = n; ; ) {
  288. if(u & 01) pow *= x;
  289. if(u >>= 1) x *= x;
  290. else break;
  291. }
  292. }
  293. return pow;
  294. }
  295. #endif
  296. #ifdef _MSC_VER
  297. static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
  298. _Dcomplex pow={1.0,0.0}; unsigned long int u;
  299. if(n != 0) {
  300. if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
  301. for(u = n; ; ) {
  302. if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1];
  303. if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1];
  304. else break;
  305. }
  306. }
  307. _Dcomplex p = {pow._Val[0], pow._Val[1]};
  308. return p;
  309. }
  310. #else
  311. static _Complex double zpow_ui(_Complex double x, integer n) {
  312. _Complex double pow=1.0; unsigned long int u;
  313. if(n != 0) {
  314. if(n < 0) n = -n, x = 1/x;
  315. for(u = n; ; ) {
  316. if(u & 01) pow *= x;
  317. if(u >>= 1) x *= x;
  318. else break;
  319. }
  320. }
  321. return pow;
  322. }
  323. #endif
  324. static integer pow_ii(integer x, integer n) {
  325. integer pow; unsigned long int u;
  326. if (n <= 0) {
  327. if (n == 0 || x == 1) pow = 1;
  328. else if (x != -1) pow = x == 0 ? 1/x : 0;
  329. else n = -n;
  330. }
  331. if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
  332. u = n;
  333. for(pow = 1; ; ) {
  334. if(u & 01) pow *= x;
  335. if(u >>= 1) x *= x;
  336. else break;
  337. }
  338. }
  339. return pow;
  340. }
  341. static integer dmaxloc_(double *w, integer s, integer e, integer *n)
  342. {
  343. double m; integer i, mi;
  344. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  345. if (w[i-1]>m) mi=i ,m=w[i-1];
  346. return mi-s+1;
  347. }
  348. static integer smaxloc_(float *w, integer s, integer e, integer *n)
  349. {
  350. float m; integer i, mi;
  351. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  352. if (w[i-1]>m) mi=i ,m=w[i-1];
  353. return mi-s+1;
  354. }
  355. static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  356. integer n = *n_, incx = *incx_, incy = *incy_, i;
  357. #ifdef _MSC_VER
  358. _Fcomplex zdotc = {0.0, 0.0};
  359. if (incx == 1 && incy == 1) {
  360. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  361. zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
  362. zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
  363. }
  364. } else {
  365. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  366. zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
  367. zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
  368. }
  369. }
  370. pCf(z) = zdotc;
  371. }
  372. #else
  373. _Complex float zdotc = 0.0;
  374. if (incx == 1 && incy == 1) {
  375. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  376. zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
  377. }
  378. } else {
  379. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  380. zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
  381. }
  382. }
  383. pCf(z) = zdotc;
  384. }
  385. #endif
  386. static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  387. integer n = *n_, incx = *incx_, incy = *incy_, i;
  388. #ifdef _MSC_VER
  389. _Dcomplex zdotc = {0.0, 0.0};
  390. if (incx == 1 && incy == 1) {
  391. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  392. zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
  393. zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
  394. }
  395. } else {
  396. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  397. zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
  398. zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
  399. }
  400. }
  401. pCd(z) = zdotc;
  402. }
  403. #else
  404. _Complex double zdotc = 0.0;
  405. if (incx == 1 && incy == 1) {
  406. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  407. zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
  408. }
  409. } else {
  410. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  411. zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
  412. }
  413. }
  414. pCd(z) = zdotc;
  415. }
  416. #endif
  417. static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  418. integer n = *n_, incx = *incx_, incy = *incy_, i;
  419. #ifdef _MSC_VER
  420. _Fcomplex zdotc = {0.0, 0.0};
  421. if (incx == 1 && incy == 1) {
  422. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  423. zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
  424. zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
  425. }
  426. } else {
  427. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  428. zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
  429. zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
  430. }
  431. }
  432. pCf(z) = zdotc;
  433. }
  434. #else
  435. _Complex float zdotc = 0.0;
  436. if (incx == 1 && incy == 1) {
  437. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  438. zdotc += Cf(&x[i]) * Cf(&y[i]);
  439. }
  440. } else {
  441. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  442. zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
  443. }
  444. }
  445. pCf(z) = zdotc;
  446. }
  447. #endif
  448. static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  449. integer n = *n_, incx = *incx_, incy = *incy_, i;
  450. #ifdef _MSC_VER
  451. _Dcomplex zdotc = {0.0, 0.0};
  452. if (incx == 1 && incy == 1) {
  453. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  454. zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
  455. zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
  456. }
  457. } else {
  458. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  459. zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
  460. zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
  461. }
  462. }
  463. pCd(z) = zdotc;
  464. }
  465. #else
  466. _Complex double zdotc = 0.0;
  467. if (incx == 1 && incy == 1) {
  468. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  469. zdotc += Cd(&x[i]) * Cd(&y[i]);
  470. }
  471. } else {
  472. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  473. zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
  474. }
  475. }
  476. pCd(z) = zdotc;
  477. }
  478. #endif
  479. /* -- translated by f2c (version 20000121).
  480. You must link the resulting object file with the libraries:
  481. -lf2c -lm (in that order)
  482. */
  483. /* Table of constant values */
  484. static real c_b5 = 0.f;
  485. static integer c__1 = 1;
  486. static integer c__2 = 2;
  487. /* > \brief \b SLARRV computes the eigenvectors of the tridiagonal matrix T = L D LT given L, D and the eigenv
  488. alues of L D LT. */
  489. /* =========== DOCUMENTATION =========== */
  490. /* Online html documentation available at */
  491. /* http://www.netlib.org/lapack/explore-html/ */
  492. /* > \htmlonly */
  493. /* > Download SLARRV + dependencies */
  494. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slarrv.
  495. f"> */
  496. /* > [TGZ]</a> */
  497. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slarrv.
  498. f"> */
  499. /* > [ZIP]</a> */
  500. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slarrv.
  501. f"> */
  502. /* > [TXT]</a> */
  503. /* > \endhtmlonly */
  504. /* Definition: */
  505. /* =========== */
  506. /* SUBROUTINE SLARRV( N, VL, VU, D, L, PIVMIN, */
  507. /* ISPLIT, M, DOL, DOU, MINRGP, */
  508. /* RTOL1, RTOL2, W, WERR, WGAP, */
  509. /* IBLOCK, INDEXW, GERS, Z, LDZ, ISUPPZ, */
  510. /* WORK, IWORK, INFO ) */
  511. /* INTEGER DOL, DOU, INFO, LDZ, M, N */
  512. /* REAL MINRGP, PIVMIN, RTOL1, RTOL2, VL, VU */
  513. /* INTEGER IBLOCK( * ), INDEXW( * ), ISPLIT( * ), */
  514. /* $ ISUPPZ( * ), IWORK( * ) */
  515. /* REAL D( * ), GERS( * ), L( * ), W( * ), WERR( * ), */
  516. /* $ WGAP( * ), WORK( * ) */
  517. /* REAL Z( LDZ, * ) */
  518. /* > \par Purpose: */
  519. /* ============= */
  520. /* > */
  521. /* > \verbatim */
  522. /* > */
  523. /* > SLARRV computes the eigenvectors of the tridiagonal matrix */
  524. /* > T = L D L**T given L, D and APPROXIMATIONS to the eigenvalues of L D L**T. */
  525. /* > The input eigenvalues should have been computed by SLARRE. */
  526. /* > \endverbatim */
  527. /* Arguments: */
  528. /* ========== */
  529. /* > \param[in] N */
  530. /* > \verbatim */
  531. /* > N is INTEGER */
  532. /* > The order of the matrix. N >= 0. */
  533. /* > \endverbatim */
  534. /* > */
  535. /* > \param[in] VL */
  536. /* > \verbatim */
  537. /* > VL is REAL */
  538. /* > Lower bound of the interval that contains the desired */
  539. /* > eigenvalues. VL < VU. Needed to compute gaps on the left or right */
  540. /* > end of the extremal eigenvalues in the desired RANGE. */
  541. /* > \endverbatim */
  542. /* > */
  543. /* > \param[in] VU */
  544. /* > \verbatim */
  545. /* > VU is REAL */
  546. /* > Upper bound of the interval that contains the desired */
  547. /* > eigenvalues. VL < VU. */
  548. /* > Note: VU is currently not used by this implementation of SLARRV, VU is */
  549. /* > passed to SLARRV because it could be used compute gaps on the right end */
  550. /* > of the extremal eigenvalues. However, with not much initial accuracy in */
  551. /* > LAMBDA and VU, the formula can lead to an overestimation of the right gap */
  552. /* > and thus to inadequately early RQI 'convergence'. This is currently */
  553. /* > prevented this by forcing a small right gap. And so it turns out that VU */
  554. /* > is currently not used by this implementation of SLARRV. */
  555. /* > \endverbatim */
  556. /* > */
  557. /* > \param[in,out] D */
  558. /* > \verbatim */
  559. /* > D is REAL array, dimension (N) */
  560. /* > On entry, the N diagonal elements of the diagonal matrix D. */
  561. /* > On exit, D may be overwritten. */
  562. /* > \endverbatim */
  563. /* > */
  564. /* > \param[in,out] L */
  565. /* > \verbatim */
  566. /* > L is REAL array, dimension (N) */
  567. /* > On entry, the (N-1) subdiagonal elements of the unit */
  568. /* > bidiagonal matrix L are in elements 1 to N-1 of L */
  569. /* > (if the matrix is not split.) At the end of each block */
  570. /* > is stored the corresponding shift as given by SLARRE. */
  571. /* > On exit, L is overwritten. */
  572. /* > \endverbatim */
  573. /* > */
  574. /* > \param[in] PIVMIN */
  575. /* > \verbatim */
  576. /* > PIVMIN is REAL */
  577. /* > The minimum pivot allowed in the Sturm sequence. */
  578. /* > \endverbatim */
  579. /* > */
  580. /* > \param[in] ISPLIT */
  581. /* > \verbatim */
  582. /* > ISPLIT is INTEGER array, dimension (N) */
  583. /* > The splitting points, at which T breaks up into blocks. */
  584. /* > The first block consists of rows/columns 1 to */
  585. /* > ISPLIT( 1 ), the second of rows/columns ISPLIT( 1 )+1 */
  586. /* > through ISPLIT( 2 ), etc. */
  587. /* > \endverbatim */
  588. /* > */
  589. /* > \param[in] M */
  590. /* > \verbatim */
  591. /* > M is INTEGER */
  592. /* > The total number of input eigenvalues. 0 <= M <= N. */
  593. /* > \endverbatim */
  594. /* > */
  595. /* > \param[in] DOL */
  596. /* > \verbatim */
  597. /* > DOL is INTEGER */
  598. /* > \endverbatim */
  599. /* > */
  600. /* > \param[in] DOU */
  601. /* > \verbatim */
  602. /* > DOU is INTEGER */
  603. /* > If the user wants to compute only selected eigenvectors from all */
  604. /* > the eigenvalues supplied, he can specify an index range DOL:DOU. */
  605. /* > Or else the setting DOL=1, DOU=M should be applied. */
  606. /* > Note that DOL and DOU refer to the order in which the eigenvalues */
  607. /* > are stored in W. */
  608. /* > If the user wants to compute only selected eigenpairs, then */
  609. /* > the columns DOL-1 to DOU+1 of the eigenvector space Z contain the */
  610. /* > computed eigenvectors. All other columns of Z are set to zero. */
  611. /* > \endverbatim */
  612. /* > */
  613. /* > \param[in] MINRGP */
  614. /* > \verbatim */
  615. /* > MINRGP is REAL */
  616. /* > \endverbatim */
  617. /* > */
  618. /* > \param[in] RTOL1 */
  619. /* > \verbatim */
  620. /* > RTOL1 is REAL */
  621. /* > \endverbatim */
  622. /* > */
  623. /* > \param[in] RTOL2 */
  624. /* > \verbatim */
  625. /* > RTOL2 is REAL */
  626. /* > Parameters for bisection. */
  627. /* > An interval [LEFT,RIGHT] has converged if */
  628. /* > RIGHT-LEFT < MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) ) */
  629. /* > \endverbatim */
  630. /* > */
  631. /* > \param[in,out] W */
  632. /* > \verbatim */
  633. /* > W is REAL array, dimension (N) */
  634. /* > The first M elements of W contain the APPROXIMATE eigenvalues for */
  635. /* > which eigenvectors are to be computed. The eigenvalues */
  636. /* > should be grouped by split-off block and ordered from */
  637. /* > smallest to largest within the block ( The output array */
  638. /* > W from SLARRE is expected here ). Furthermore, they are with */
  639. /* > respect to the shift of the corresponding root representation */
  640. /* > for their block. On exit, W holds the eigenvalues of the */
  641. /* > UNshifted matrix. */
  642. /* > \endverbatim */
  643. /* > */
  644. /* > \param[in,out] WERR */
  645. /* > \verbatim */
  646. /* > WERR is REAL array, dimension (N) */
  647. /* > The first M elements contain the semiwidth of the uncertainty */
  648. /* > interval of the corresponding eigenvalue in W */
  649. /* > \endverbatim */
  650. /* > */
  651. /* > \param[in,out] WGAP */
  652. /* > \verbatim */
  653. /* > WGAP is REAL array, dimension (N) */
  654. /* > The separation from the right neighbor eigenvalue in W. */
  655. /* > \endverbatim */
  656. /* > */
  657. /* > \param[in] IBLOCK */
  658. /* > \verbatim */
  659. /* > IBLOCK is INTEGER array, dimension (N) */
  660. /* > The indices of the blocks (submatrices) associated with the */
  661. /* > corresponding eigenvalues in W; IBLOCK(i)=1 if eigenvalue */
  662. /* > W(i) belongs to the first block from the top, =2 if W(i) */
  663. /* > belongs to the second block, etc. */
  664. /* > \endverbatim */
  665. /* > */
  666. /* > \param[in] INDEXW */
  667. /* > \verbatim */
  668. /* > INDEXW is INTEGER array, dimension (N) */
  669. /* > The indices of the eigenvalues within each block (submatrix); */
  670. /* > for example, INDEXW(i)= 10 and IBLOCK(i)=2 imply that the */
  671. /* > i-th eigenvalue W(i) is the 10-th eigenvalue in the second block. */
  672. /* > \endverbatim */
  673. /* > */
  674. /* > \param[in] GERS */
  675. /* > \verbatim */
  676. /* > GERS is REAL array, dimension (2*N) */
  677. /* > The N Gerschgorin intervals (the i-th Gerschgorin interval */
  678. /* > is (GERS(2*i-1), GERS(2*i)). The Gerschgorin intervals should */
  679. /* > be computed from the original UNshifted matrix. */
  680. /* > \endverbatim */
  681. /* > */
  682. /* > \param[out] Z */
  683. /* > \verbatim */
  684. /* > Z is REAL array, dimension (LDZ, f2cmax(1,M) ) */
  685. /* > If INFO = 0, the first M columns of Z contain the */
  686. /* > orthonormal eigenvectors of the matrix T */
  687. /* > corresponding to the input eigenvalues, with the i-th */
  688. /* > column of Z holding the eigenvector associated with W(i). */
  689. /* > Note: the user must ensure that at least f2cmax(1,M) columns are */
  690. /* > supplied in the array Z. */
  691. /* > \endverbatim */
  692. /* > */
  693. /* > \param[in] LDZ */
  694. /* > \verbatim */
  695. /* > LDZ is INTEGER */
  696. /* > The leading dimension of the array Z. LDZ >= 1, and if */
  697. /* > JOBZ = 'V', LDZ >= f2cmax(1,N). */
  698. /* > \endverbatim */
  699. /* > */
  700. /* > \param[out] ISUPPZ */
  701. /* > \verbatim */
  702. /* > ISUPPZ is INTEGER array, dimension ( 2*f2cmax(1,M) ) */
  703. /* > The support of the eigenvectors in Z, i.e., the indices */
  704. /* > indicating the nonzero elements in Z. The I-th eigenvector */
  705. /* > is nonzero only in elements ISUPPZ( 2*I-1 ) through */
  706. /* > ISUPPZ( 2*I ). */
  707. /* > \endverbatim */
  708. /* > */
  709. /* > \param[out] WORK */
  710. /* > \verbatim */
  711. /* > WORK is REAL array, dimension (12*N) */
  712. /* > \endverbatim */
  713. /* > */
  714. /* > \param[out] IWORK */
  715. /* > \verbatim */
  716. /* > IWORK is INTEGER array, dimension (7*N) */
  717. /* > \endverbatim */
  718. /* > */
  719. /* > \param[out] INFO */
  720. /* > \verbatim */
  721. /* > INFO is INTEGER */
  722. /* > = 0: successful exit */
  723. /* > */
  724. /* > > 0: A problem occurred in SLARRV. */
  725. /* > < 0: One of the called subroutines signaled an internal problem. */
  726. /* > Needs inspection of the corresponding parameter IINFO */
  727. /* > for further information. */
  728. /* > */
  729. /* > =-1: Problem in SLARRB when refining a child's eigenvalues. */
  730. /* > =-2: Problem in SLARRF when computing the RRR of a child. */
  731. /* > When a child is inside a tight cluster, it can be difficult */
  732. /* > to find an RRR. A partial remedy from the user's point of */
  733. /* > view is to make the parameter MINRGP smaller and recompile. */
  734. /* > However, as the orthogonality of the computed vectors is */
  735. /* > proportional to 1/MINRGP, the user should be aware that */
  736. /* > he might be trading in precision when he decreases MINRGP. */
  737. /* > =-3: Problem in SLARRB when refining a single eigenvalue */
  738. /* > after the Rayleigh correction was rejected. */
  739. /* > = 5: The Rayleigh Quotient Iteration failed to converge to */
  740. /* > full accuracy in MAXITR steps. */
  741. /* > \endverbatim */
  742. /* Authors: */
  743. /* ======== */
  744. /* > \author Univ. of Tennessee */
  745. /* > \author Univ. of California Berkeley */
  746. /* > \author Univ. of Colorado Denver */
  747. /* > \author NAG Ltd. */
  748. /* > \date June 2016 */
  749. /* > \ingroup realOTHERauxiliary */
  750. /* > \par Contributors: */
  751. /* ================== */
  752. /* > */
  753. /* > Beresford Parlett, University of California, Berkeley, USA \n */
  754. /* > Jim Demmel, University of California, Berkeley, USA \n */
  755. /* > Inderjit Dhillon, University of Texas, Austin, USA \n */
  756. /* > Osni Marques, LBNL/NERSC, USA \n */
  757. /* > Christof Voemel, University of California, Berkeley, USA */
  758. /* ===================================================================== */
  759. /* Subroutine */ void slarrv_(integer *n, real *vl, real *vu, real *d__, real *
  760. l, real *pivmin, integer *isplit, integer *m, integer *dol, integer *
  761. dou, real *minrgp, real *rtol1, real *rtol2, real *w, real *werr,
  762. real *wgap, integer *iblock, integer *indexw, real *gers, real *z__,
  763. integer *ldz, integer *isuppz, real *work, integer *iwork, integer *
  764. info)
  765. {
  766. /* System generated locals */
  767. integer z_dim1, z_offset, i__1, i__2, i__3, i__4, i__5;
  768. real r__1, r__2;
  769. logical L__1;
  770. /* Local variables */
  771. integer iend, jblk;
  772. real lgap;
  773. integer done;
  774. real rgap, left;
  775. integer wend, iter;
  776. real bstw;
  777. integer minwsize, itmp1, i__, j, k, p, q, indld;
  778. real fudge;
  779. integer idone;
  780. real sigma;
  781. integer iinfo, iindr;
  782. real resid;
  783. extern /* Subroutine */ void sscal_(integer *, real *, real *, integer *);
  784. logical eskip;
  785. real right;
  786. integer nclus, zfrom;
  787. extern /* Subroutine */ void scopy_(integer *, real *, integer *, real *,
  788. integer *);
  789. real rqtol;
  790. integer iindc1, iindc2, miniwsize;
  791. extern /* Subroutine */ void slar1v_(integer *, integer *, integer *, real
  792. *, real *, real *, real *, real *, real *, real *, real *,
  793. logical *, integer *, real *, real *, integer *, integer *, real *
  794. , real *, real *, real *);
  795. logical stp2ii;
  796. real lambda;
  797. integer ii;
  798. real gl;
  799. integer im, in;
  800. real gu;
  801. integer ibegin, indeig;
  802. logical needbs;
  803. integer indlld;
  804. real sgndef, mingma;
  805. extern real slamch_(char *);
  806. integer oldien, oldncl, wbegin, negcnt;
  807. real spdiam;
  808. integer oldcls;
  809. real savgap;
  810. integer ndepth;
  811. real ssigma;
  812. logical usedbs;
  813. integer iindwk, offset;
  814. real gaptol;
  815. extern /* Subroutine */ void slarrb_(integer *, real *, real *, integer *,
  816. integer *, real *, real *, integer *, real *, real *, real *,
  817. real *, integer *, real *, real *, integer *, integer *), slarrf_(
  818. integer *, real *, real *, real *, integer *, integer *, real *,
  819. real *, real *, real *, real *, real *, real *, real *, real *,
  820. real *, real *, integer *);
  821. integer newcls, oldfst, indwrk, windex, oldlst;
  822. logical usedrq;
  823. integer newfst, newftt, parity, windmn, isupmn, newlst, windpl, zusedl,
  824. newsiz, zusedu, zusedw;
  825. real bstres, nrminv;
  826. logical tryrqc;
  827. integer isupmx;
  828. real rqcorr;
  829. extern /* Subroutine */ void slaset_(char *, integer *, integer *, real *,
  830. real *, real *, integer *);
  831. real gap, eps, tau, tol, tmp;
  832. integer zto;
  833. real ztz;
  834. /* -- LAPACK auxiliary routine (version 3.8.0) -- */
  835. /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
  836. /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
  837. /* June 2016 */
  838. /* ===================================================================== */
  839. /* Parameter adjustments */
  840. --d__;
  841. --l;
  842. --isplit;
  843. --w;
  844. --werr;
  845. --wgap;
  846. --iblock;
  847. --indexw;
  848. --gers;
  849. z_dim1 = *ldz;
  850. z_offset = 1 + z_dim1 * 1;
  851. z__ -= z_offset;
  852. --isuppz;
  853. --work;
  854. --iwork;
  855. /* Function Body */
  856. *info = 0;
  857. /* Quick return if possible */
  858. if (*n <= 0 || *m <= 0) {
  859. return;
  860. }
  861. /* The first N entries of WORK are reserved for the eigenvalues */
  862. indld = *n + 1;
  863. indlld = (*n << 1) + 1;
  864. indwrk = *n * 3 + 1;
  865. minwsize = *n * 12;
  866. i__1 = minwsize;
  867. for (i__ = 1; i__ <= i__1; ++i__) {
  868. work[i__] = 0.f;
  869. /* L5: */
  870. }
  871. /* IWORK(IINDR+1:IINDR+N) hold the twist indices R for the */
  872. /* factorization used to compute the FP vector */
  873. iindr = 0;
  874. /* IWORK(IINDC1+1:IINC2+N) are used to store the clusters of the current */
  875. /* layer and the one above. */
  876. iindc1 = *n;
  877. iindc2 = *n << 1;
  878. iindwk = *n * 3 + 1;
  879. miniwsize = *n * 7;
  880. i__1 = miniwsize;
  881. for (i__ = 1; i__ <= i__1; ++i__) {
  882. iwork[i__] = 0;
  883. /* L10: */
  884. }
  885. zusedl = 1;
  886. if (*dol > 1) {
  887. /* Set lower bound for use of Z */
  888. zusedl = *dol - 1;
  889. }
  890. zusedu = *m;
  891. if (*dou < *m) {
  892. /* Set lower bound for use of Z */
  893. zusedu = *dou + 1;
  894. }
  895. /* The width of the part of Z that is used */
  896. zusedw = zusedu - zusedl + 1;
  897. slaset_("Full", n, &zusedw, &c_b5, &c_b5, &z__[zusedl * z_dim1 + 1], ldz);
  898. eps = slamch_("Precision");
  899. rqtol = eps * 2.f;
  900. /* Set expert flags for standard code. */
  901. tryrqc = TRUE_;
  902. if (*dol == 1 && *dou == *m) {
  903. } else {
  904. /* Only selected eigenpairs are computed. Since the other evalues */
  905. /* are not refined by RQ iteration, bisection has to compute to full */
  906. /* accuracy. */
  907. *rtol1 = eps * 4.f;
  908. *rtol2 = eps * 4.f;
  909. }
  910. /* The entries WBEGIN:WEND in W, WERR, WGAP correspond to the */
  911. /* desired eigenvalues. The support of the nonzero eigenvector */
  912. /* entries is contained in the interval IBEGIN:IEND. */
  913. /* Remark that if k eigenpairs are desired, then the eigenvectors */
  914. /* are stored in k contiguous columns of Z. */
  915. /* DONE is the number of eigenvectors already computed */
  916. done = 0;
  917. ibegin = 1;
  918. wbegin = 1;
  919. i__1 = iblock[*m];
  920. for (jblk = 1; jblk <= i__1; ++jblk) {
  921. iend = isplit[jblk];
  922. sigma = l[iend];
  923. /* Find the eigenvectors of the submatrix indexed IBEGIN */
  924. /* through IEND. */
  925. wend = wbegin - 1;
  926. L15:
  927. if (wend < *m) {
  928. if (iblock[wend + 1] == jblk) {
  929. ++wend;
  930. goto L15;
  931. }
  932. }
  933. if (wend < wbegin) {
  934. ibegin = iend + 1;
  935. goto L170;
  936. } else if (wend < *dol || wbegin > *dou) {
  937. ibegin = iend + 1;
  938. wbegin = wend + 1;
  939. goto L170;
  940. }
  941. /* Find local spectral diameter of the block */
  942. gl = gers[(ibegin << 1) - 1];
  943. gu = gers[ibegin * 2];
  944. i__2 = iend;
  945. for (i__ = ibegin + 1; i__ <= i__2; ++i__) {
  946. /* Computing MIN */
  947. r__1 = gers[(i__ << 1) - 1];
  948. gl = f2cmin(r__1,gl);
  949. /* Computing MAX */
  950. r__1 = gers[i__ * 2];
  951. gu = f2cmax(r__1,gu);
  952. /* L20: */
  953. }
  954. spdiam = gu - gl;
  955. /* OLDIEN is the last index of the previous block */
  956. oldien = ibegin - 1;
  957. /* Calculate the size of the current block */
  958. in = iend - ibegin + 1;
  959. /* The number of eigenvalues in the current block */
  960. im = wend - wbegin + 1;
  961. /* This is for a 1x1 block */
  962. if (ibegin == iend) {
  963. ++done;
  964. z__[ibegin + wbegin * z_dim1] = 1.f;
  965. isuppz[(wbegin << 1) - 1] = ibegin;
  966. isuppz[wbegin * 2] = ibegin;
  967. w[wbegin] += sigma;
  968. work[wbegin] = w[wbegin];
  969. ibegin = iend + 1;
  970. ++wbegin;
  971. goto L170;
  972. }
  973. /* The desired (shifted) eigenvalues are stored in W(WBEGIN:WEND) */
  974. /* Note that these can be approximations, in this case, the corresp. */
  975. /* entries of WERR give the size of the uncertainty interval. */
  976. /* The eigenvalue approximations will be refined when necessary as */
  977. /* high relative accuracy is required for the computation of the */
  978. /* corresponding eigenvectors. */
  979. scopy_(&im, &w[wbegin], &c__1, &work[wbegin], &c__1);
  980. /* We store in W the eigenvalue approximations w.r.t. the original */
  981. /* matrix T. */
  982. i__2 = im;
  983. for (i__ = 1; i__ <= i__2; ++i__) {
  984. w[wbegin + i__ - 1] += sigma;
  985. /* L30: */
  986. }
  987. /* NDEPTH is the current depth of the representation tree */
  988. ndepth = 0;
  989. /* PARITY is either 1 or 0 */
  990. parity = 1;
  991. /* NCLUS is the number of clusters for the next level of the */
  992. /* representation tree, we start with NCLUS = 1 for the root */
  993. nclus = 1;
  994. iwork[iindc1 + 1] = 1;
  995. iwork[iindc1 + 2] = im;
  996. /* IDONE is the number of eigenvectors already computed in the current */
  997. /* block */
  998. idone = 0;
  999. /* loop while( IDONE.LT.IM ) */
  1000. /* generate the representation tree for the current block and */
  1001. /* compute the eigenvectors */
  1002. L40:
  1003. if (idone < im) {
  1004. /* This is a crude protection against infinitely deep trees */
  1005. if (ndepth > *m) {
  1006. *info = -2;
  1007. return;
  1008. }
  1009. /* breadth first processing of the current level of the representation */
  1010. /* tree: OLDNCL = number of clusters on current level */
  1011. oldncl = nclus;
  1012. /* reset NCLUS to count the number of child clusters */
  1013. nclus = 0;
  1014. parity = 1 - parity;
  1015. if (parity == 0) {
  1016. oldcls = iindc1;
  1017. newcls = iindc2;
  1018. } else {
  1019. oldcls = iindc2;
  1020. newcls = iindc1;
  1021. }
  1022. /* Process the clusters on the current level */
  1023. i__2 = oldncl;
  1024. for (i__ = 1; i__ <= i__2; ++i__) {
  1025. j = oldcls + (i__ << 1);
  1026. /* OLDFST, OLDLST = first, last index of current cluster. */
  1027. /* cluster indices start with 1 and are relative */
  1028. /* to WBEGIN when accessing W, WGAP, WERR, Z */
  1029. oldfst = iwork[j - 1];
  1030. oldlst = iwork[j];
  1031. if (ndepth > 0) {
  1032. /* Retrieve relatively robust representation (RRR) of cluster */
  1033. /* that has been computed at the previous level */
  1034. /* The RRR is stored in Z and overwritten once the eigenvectors */
  1035. /* have been computed or when the cluster is refined */
  1036. if (*dol == 1 && *dou == *m) {
  1037. /* Get representation from location of the leftmost evalue */
  1038. /* of the cluster */
  1039. j = wbegin + oldfst - 1;
  1040. } else {
  1041. if (wbegin + oldfst - 1 < *dol) {
  1042. /* Get representation from the left end of Z array */
  1043. j = *dol - 1;
  1044. } else if (wbegin + oldfst - 1 > *dou) {
  1045. /* Get representation from the right end of Z array */
  1046. j = *dou;
  1047. } else {
  1048. j = wbegin + oldfst - 1;
  1049. }
  1050. }
  1051. scopy_(&in, &z__[ibegin + j * z_dim1], &c__1, &d__[ibegin]
  1052. , &c__1);
  1053. i__3 = in - 1;
  1054. scopy_(&i__3, &z__[ibegin + (j + 1) * z_dim1], &c__1, &l[
  1055. ibegin], &c__1);
  1056. sigma = z__[iend + (j + 1) * z_dim1];
  1057. /* Set the corresponding entries in Z to zero */
  1058. slaset_("Full", &in, &c__2, &c_b5, &c_b5, &z__[ibegin + j
  1059. * z_dim1], ldz);
  1060. }
  1061. /* Compute DL and DLL of current RRR */
  1062. i__3 = iend - 1;
  1063. for (j = ibegin; j <= i__3; ++j) {
  1064. tmp = d__[j] * l[j];
  1065. work[indld - 1 + j] = tmp;
  1066. work[indlld - 1 + j] = tmp * l[j];
  1067. /* L50: */
  1068. }
  1069. if (ndepth > 0) {
  1070. /* P and Q are index of the first and last eigenvalue to compute */
  1071. /* within the current block */
  1072. p = indexw[wbegin - 1 + oldfst];
  1073. q = indexw[wbegin - 1 + oldlst];
  1074. /* Offset for the arrays WORK, WGAP and WERR, i.e., the P-OFFSET */
  1075. /* through the Q-OFFSET elements of these arrays are to be used. */
  1076. /* OFFSET = P-OLDFST */
  1077. offset = indexw[wbegin] - 1;
  1078. /* perform limited bisection (if necessary) to get approximate */
  1079. /* eigenvalues to the precision needed. */
  1080. slarrb_(&in, &d__[ibegin], &work[indlld + ibegin - 1], &p,
  1081. &q, rtol1, rtol2, &offset, &work[wbegin], &wgap[
  1082. wbegin], &werr[wbegin], &work[indwrk], &iwork[
  1083. iindwk], pivmin, &spdiam, &in, &iinfo);
  1084. if (iinfo != 0) {
  1085. *info = -1;
  1086. return;
  1087. }
  1088. /* We also recompute the extremal gaps. W holds all eigenvalues */
  1089. /* of the unshifted matrix and must be used for computation */
  1090. /* of WGAP, the entries of WORK might stem from RRRs with */
  1091. /* different shifts. The gaps from WBEGIN-1+OLDFST to */
  1092. /* WBEGIN-1+OLDLST are correctly computed in SLARRB. */
  1093. /* However, we only allow the gaps to become greater since */
  1094. /* this is what should happen when we decrease WERR */
  1095. if (oldfst > 1) {
  1096. /* Computing MAX */
  1097. r__1 = wgap[wbegin + oldfst - 2], r__2 = w[wbegin +
  1098. oldfst - 1] - werr[wbegin + oldfst - 1] - w[
  1099. wbegin + oldfst - 2] - werr[wbegin + oldfst -
  1100. 2];
  1101. wgap[wbegin + oldfst - 2] = f2cmax(r__1,r__2);
  1102. }
  1103. if (wbegin + oldlst - 1 < wend) {
  1104. /* Computing MAX */
  1105. r__1 = wgap[wbegin + oldlst - 1], r__2 = w[wbegin +
  1106. oldlst] - werr[wbegin + oldlst] - w[wbegin +
  1107. oldlst - 1] - werr[wbegin + oldlst - 1];
  1108. wgap[wbegin + oldlst - 1] = f2cmax(r__1,r__2);
  1109. }
  1110. /* Each time the eigenvalues in WORK get refined, we store */
  1111. /* the newly found approximation with all shifts applied in W */
  1112. i__3 = oldlst;
  1113. for (j = oldfst; j <= i__3; ++j) {
  1114. w[wbegin + j - 1] = work[wbegin + j - 1] + sigma;
  1115. /* L53: */
  1116. }
  1117. }
  1118. /* Process the current node. */
  1119. newfst = oldfst;
  1120. i__3 = oldlst;
  1121. for (j = oldfst; j <= i__3; ++j) {
  1122. if (j == oldlst) {
  1123. /* we are at the right end of the cluster, this is also the */
  1124. /* boundary of the child cluster */
  1125. newlst = j;
  1126. } else if (wgap[wbegin + j - 1] >= *minrgp * (r__1 = work[
  1127. wbegin + j - 1], abs(r__1))) {
  1128. /* the right relative gap is big enough, the child cluster */
  1129. /* (NEWFST,..,NEWLST) is well separated from the following */
  1130. newlst = j;
  1131. } else {
  1132. /* inside a child cluster, the relative gap is not */
  1133. /* big enough. */
  1134. goto L140;
  1135. }
  1136. /* Compute size of child cluster found */
  1137. newsiz = newlst - newfst + 1;
  1138. /* NEWFTT is the place in Z where the new RRR or the computed */
  1139. /* eigenvector is to be stored */
  1140. if (*dol == 1 && *dou == *m) {
  1141. /* Store representation at location of the leftmost evalue */
  1142. /* of the cluster */
  1143. newftt = wbegin + newfst - 1;
  1144. } else {
  1145. if (wbegin + newfst - 1 < *dol) {
  1146. /* Store representation at the left end of Z array */
  1147. newftt = *dol - 1;
  1148. } else if (wbegin + newfst - 1 > *dou) {
  1149. /* Store representation at the right end of Z array */
  1150. newftt = *dou;
  1151. } else {
  1152. newftt = wbegin + newfst - 1;
  1153. }
  1154. }
  1155. if (newsiz > 1) {
  1156. /* Current child is not a singleton but a cluster. */
  1157. /* Compute and store new representation of child. */
  1158. /* Compute left and right cluster gap. */
  1159. /* LGAP and RGAP are not computed from WORK because */
  1160. /* the eigenvalue approximations may stem from RRRs */
  1161. /* different shifts. However, W hold all eigenvalues */
  1162. /* of the unshifted matrix. Still, the entries in WGAP */
  1163. /* have to be computed from WORK since the entries */
  1164. /* in W might be of the same order so that gaps are not */
  1165. /* exhibited correctly for very close eigenvalues. */
  1166. if (newfst == 1) {
  1167. /* Computing MAX */
  1168. r__1 = 0.f, r__2 = w[wbegin] - werr[wbegin] - *vl;
  1169. lgap = f2cmax(r__1,r__2);
  1170. } else {
  1171. lgap = wgap[wbegin + newfst - 2];
  1172. }
  1173. rgap = wgap[wbegin + newlst - 1];
  1174. /* Compute left- and rightmost eigenvalue of child */
  1175. /* to high precision in order to shift as close */
  1176. /* as possible and obtain as large relative gaps */
  1177. /* as possible */
  1178. for (k = 1; k <= 2; ++k) {
  1179. if (k == 1) {
  1180. p = indexw[wbegin - 1 + newfst];
  1181. } else {
  1182. p = indexw[wbegin - 1 + newlst];
  1183. }
  1184. offset = indexw[wbegin] - 1;
  1185. slarrb_(&in, &d__[ibegin], &work[indlld + ibegin
  1186. - 1], &p, &p, &rqtol, &rqtol, &offset, &
  1187. work[wbegin], &wgap[wbegin], &werr[wbegin]
  1188. , &work[indwrk], &iwork[iindwk], pivmin, &
  1189. spdiam, &in, &iinfo);
  1190. /* L55: */
  1191. }
  1192. if (wbegin + newlst - 1 < *dol || wbegin + newfst - 1
  1193. > *dou) {
  1194. /* if the cluster contains no desired eigenvalues */
  1195. /* skip the computation of that branch of the rep. tree */
  1196. /* We could skip before the refinement of the extremal */
  1197. /* eigenvalues of the child, but then the representation */
  1198. /* tree could be different from the one when nothing is */
  1199. /* skipped. For this reason we skip at this place. */
  1200. idone = idone + newlst - newfst + 1;
  1201. goto L139;
  1202. }
  1203. /* Compute RRR of child cluster. */
  1204. /* Note that the new RRR is stored in Z */
  1205. /* SLARRF needs LWORK = 2*N */
  1206. slarrf_(&in, &d__[ibegin], &l[ibegin], &work[indld +
  1207. ibegin - 1], &newfst, &newlst, &work[wbegin],
  1208. &wgap[wbegin], &werr[wbegin], &spdiam, &lgap,
  1209. &rgap, pivmin, &tau, &z__[ibegin + newftt *
  1210. z_dim1], &z__[ibegin + (newftt + 1) * z_dim1],
  1211. &work[indwrk], &iinfo);
  1212. if (iinfo == 0) {
  1213. /* a new RRR for the cluster was found by SLARRF */
  1214. /* update shift and store it */
  1215. ssigma = sigma + tau;
  1216. z__[iend + (newftt + 1) * z_dim1] = ssigma;
  1217. /* WORK() are the midpoints and WERR() the semi-width */
  1218. /* Note that the entries in W are unchanged. */
  1219. i__4 = newlst;
  1220. for (k = newfst; k <= i__4; ++k) {
  1221. fudge = eps * 3.f * (r__1 = work[wbegin + k -
  1222. 1], abs(r__1));
  1223. work[wbegin + k - 1] -= tau;
  1224. fudge += eps * 4.f * (r__1 = work[wbegin + k
  1225. - 1], abs(r__1));
  1226. /* Fudge errors */
  1227. werr[wbegin + k - 1] += fudge;
  1228. /* Gaps are not fudged. Provided that WERR is small */
  1229. /* when eigenvalues are close, a zero gap indicates */
  1230. /* that a new representation is needed for resolving */
  1231. /* the cluster. A fudge could lead to a wrong decision */
  1232. /* of judging eigenvalues 'separated' which in */
  1233. /* reality are not. This could have a negative impact */
  1234. /* on the orthogonality of the computed eigenvectors. */
  1235. /* L116: */
  1236. }
  1237. ++nclus;
  1238. k = newcls + (nclus << 1);
  1239. iwork[k - 1] = newfst;
  1240. iwork[k] = newlst;
  1241. } else {
  1242. *info = -2;
  1243. return;
  1244. }
  1245. } else {
  1246. /* Compute eigenvector of singleton */
  1247. iter = 0;
  1248. tol = log((real) in) * 4.f * eps;
  1249. k = newfst;
  1250. windex = wbegin + k - 1;
  1251. /* Computing MAX */
  1252. i__4 = windex - 1;
  1253. windmn = f2cmax(i__4,1);
  1254. /* Computing MIN */
  1255. i__4 = windex + 1;
  1256. windpl = f2cmin(i__4,*m);
  1257. lambda = work[windex];
  1258. ++done;
  1259. /* Check if eigenvector computation is to be skipped */
  1260. if (windex < *dol || windex > *dou) {
  1261. eskip = TRUE_;
  1262. goto L125;
  1263. } else {
  1264. eskip = FALSE_;
  1265. }
  1266. left = work[windex] - werr[windex];
  1267. right = work[windex] + werr[windex];
  1268. indeig = indexw[windex];
  1269. /* Note that since we compute the eigenpairs for a child, */
  1270. /* all eigenvalue approximations are w.r.t the same shift. */
  1271. /* In this case, the entries in WORK should be used for */
  1272. /* computing the gaps since they exhibit even very small */
  1273. /* differences in the eigenvalues, as opposed to the */
  1274. /* entries in W which might "look" the same. */
  1275. if (k == 1) {
  1276. /* In the case RANGE='I' and with not much initial */
  1277. /* accuracy in LAMBDA and VL, the formula */
  1278. /* LGAP = MAX( ZERO, (SIGMA - VL) + LAMBDA ) */
  1279. /* can lead to an overestimation of the left gap and */
  1280. /* thus to inadequately early RQI 'convergence'. */
  1281. /* Prevent this by forcing a small left gap. */
  1282. /* Computing MAX */
  1283. r__1 = abs(left), r__2 = abs(right);
  1284. lgap = eps * f2cmax(r__1,r__2);
  1285. } else {
  1286. lgap = wgap[windmn];
  1287. }
  1288. if (k == im) {
  1289. /* In the case RANGE='I' and with not much initial */
  1290. /* accuracy in LAMBDA and VU, the formula */
  1291. /* can lead to an overestimation of the right gap and */
  1292. /* thus to inadequately early RQI 'convergence'. */
  1293. /* Prevent this by forcing a small right gap. */
  1294. /* Computing MAX */
  1295. r__1 = abs(left), r__2 = abs(right);
  1296. rgap = eps * f2cmax(r__1,r__2);
  1297. } else {
  1298. rgap = wgap[windex];
  1299. }
  1300. gap = f2cmin(lgap,rgap);
  1301. if (k == 1 || k == im) {
  1302. /* The eigenvector support can become wrong */
  1303. /* because significant entries could be cut off due to a */
  1304. /* large GAPTOL parameter in LAR1V. Prevent this. */
  1305. gaptol = 0.f;
  1306. } else {
  1307. gaptol = gap * eps;
  1308. }
  1309. isupmn = in;
  1310. isupmx = 1;
  1311. /* Update WGAP so that it holds the minimum gap */
  1312. /* to the left or the right. This is crucial in the */
  1313. /* case where bisection is used to ensure that the */
  1314. /* eigenvalue is refined up to the required precision. */
  1315. /* The correct value is restored afterwards. */
  1316. savgap = wgap[windex];
  1317. wgap[windex] = gap;
  1318. /* We want to use the Rayleigh Quotient Correction */
  1319. /* as often as possible since it converges quadratically */
  1320. /* when we are close enough to the desired eigenvalue. */
  1321. /* However, the Rayleigh Quotient can have the wrong sign */
  1322. /* and lead us away from the desired eigenvalue. In this */
  1323. /* case, the best we can do is to use bisection. */
  1324. usedbs = FALSE_;
  1325. usedrq = FALSE_;
  1326. /* Bisection is initially turned off unless it is forced */
  1327. needbs = ! tryrqc;
  1328. L120:
  1329. /* Check if bisection should be used to refine eigenvalue */
  1330. if (needbs) {
  1331. /* Take the bisection as new iterate */
  1332. usedbs = TRUE_;
  1333. itmp1 = iwork[iindr + windex];
  1334. offset = indexw[wbegin] - 1;
  1335. r__1 = eps * 2.f;
  1336. slarrb_(&in, &d__[ibegin], &work[indlld + ibegin
  1337. - 1], &indeig, &indeig, &c_b5, &r__1, &
  1338. offset, &work[wbegin], &wgap[wbegin], &
  1339. werr[wbegin], &work[indwrk], &iwork[
  1340. iindwk], pivmin, &spdiam, &itmp1, &iinfo);
  1341. if (iinfo != 0) {
  1342. *info = -3;
  1343. return;
  1344. }
  1345. lambda = work[windex];
  1346. /* Reset twist index from inaccurate LAMBDA to */
  1347. /* force computation of true MINGMA */
  1348. iwork[iindr + windex] = 0;
  1349. }
  1350. /* Given LAMBDA, compute the eigenvector. */
  1351. L__1 = ! usedbs;
  1352. slar1v_(&in, &c__1, &in, &lambda, &d__[ibegin], &l[
  1353. ibegin], &work[indld + ibegin - 1], &work[
  1354. indlld + ibegin - 1], pivmin, &gaptol, &z__[
  1355. ibegin + windex * z_dim1], &L__1, &negcnt, &
  1356. ztz, &mingma, &iwork[iindr + windex], &isuppz[
  1357. (windex << 1) - 1], &nrminv, &resid, &rqcorr,
  1358. &work[indwrk]);
  1359. if (iter == 0) {
  1360. bstres = resid;
  1361. bstw = lambda;
  1362. } else if (resid < bstres) {
  1363. bstres = resid;
  1364. bstw = lambda;
  1365. }
  1366. /* Computing MIN */
  1367. i__4 = isupmn, i__5 = isuppz[(windex << 1) - 1];
  1368. isupmn = f2cmin(i__4,i__5);
  1369. /* Computing MAX */
  1370. i__4 = isupmx, i__5 = isuppz[windex * 2];
  1371. isupmx = f2cmax(i__4,i__5);
  1372. ++iter;
  1373. /* sin alpha <= |resid|/gap */
  1374. /* Note that both the residual and the gap are */
  1375. /* proportional to the matrix, so ||T|| doesn't play */
  1376. /* a role in the quotient */
  1377. /* Convergence test for Rayleigh-Quotient iteration */
  1378. /* (omitted when Bisection has been used) */
  1379. if (resid > tol * gap && abs(rqcorr) > rqtol * abs(
  1380. lambda) && ! usedbs) {
  1381. /* We need to check that the RQCORR update doesn't */
  1382. /* move the eigenvalue away from the desired one and */
  1383. /* towards a neighbor. -> protection with bisection */
  1384. if (indeig <= negcnt) {
  1385. /* The wanted eigenvalue lies to the left */
  1386. sgndef = -1.f;
  1387. } else {
  1388. /* The wanted eigenvalue lies to the right */
  1389. sgndef = 1.f;
  1390. }
  1391. /* We only use the RQCORR if it improves the */
  1392. /* the iterate reasonably. */
  1393. if (rqcorr * sgndef >= 0.f && lambda + rqcorr <=
  1394. right && lambda + rqcorr >= left) {
  1395. usedrq = TRUE_;
  1396. /* Store new midpoint of bisection interval in WORK */
  1397. if (sgndef == 1.f) {
  1398. /* The current LAMBDA is on the left of the true */
  1399. /* eigenvalue */
  1400. left = lambda;
  1401. /* We prefer to assume that the error estimate */
  1402. /* is correct. We could make the interval not */
  1403. /* as a bracket but to be modified if the RQCORR */
  1404. /* chooses to. In this case, the RIGHT side should */
  1405. /* be modified as follows: */
  1406. /* RIGHT = MAX(RIGHT, LAMBDA + RQCORR) */
  1407. } else {
  1408. /* The current LAMBDA is on the right of the true */
  1409. /* eigenvalue */
  1410. right = lambda;
  1411. /* See comment about assuming the error estimate is */
  1412. /* correct above. */
  1413. /* LEFT = MIN(LEFT, LAMBDA + RQCORR) */
  1414. }
  1415. work[windex] = (right + left) * .5f;
  1416. /* Take RQCORR since it has the correct sign and */
  1417. /* improves the iterate reasonably */
  1418. lambda += rqcorr;
  1419. /* Update width of error interval */
  1420. werr[windex] = (right - left) * .5f;
  1421. } else {
  1422. needbs = TRUE_;
  1423. }
  1424. if (right - left < rqtol * abs(lambda)) {
  1425. /* The eigenvalue is computed to bisection accuracy */
  1426. /* compute eigenvector and stop */
  1427. usedbs = TRUE_;
  1428. goto L120;
  1429. } else if (iter < 10) {
  1430. goto L120;
  1431. } else if (iter == 10) {
  1432. needbs = TRUE_;
  1433. goto L120;
  1434. } else {
  1435. *info = 5;
  1436. return;
  1437. }
  1438. } else {
  1439. stp2ii = FALSE_;
  1440. if (usedrq && usedbs && bstres <= resid) {
  1441. lambda = bstw;
  1442. stp2ii = TRUE_;
  1443. }
  1444. if (stp2ii) {
  1445. /* improve error angle by second step */
  1446. L__1 = ! usedbs;
  1447. slar1v_(&in, &c__1, &in, &lambda, &d__[ibegin]
  1448. , &l[ibegin], &work[indld + ibegin -
  1449. 1], &work[indlld + ibegin - 1],
  1450. pivmin, &gaptol, &z__[ibegin + windex
  1451. * z_dim1], &L__1, &negcnt, &ztz, &
  1452. mingma, &iwork[iindr + windex], &
  1453. isuppz[(windex << 1) - 1], &nrminv, &
  1454. resid, &rqcorr, &work[indwrk]);
  1455. }
  1456. work[windex] = lambda;
  1457. }
  1458. /* Compute FP-vector support w.r.t. whole matrix */
  1459. isuppz[(windex << 1) - 1] += oldien;
  1460. isuppz[windex * 2] += oldien;
  1461. zfrom = isuppz[(windex << 1) - 1];
  1462. zto = isuppz[windex * 2];
  1463. isupmn += oldien;
  1464. isupmx += oldien;
  1465. /* Ensure vector is ok if support in the RQI has changed */
  1466. if (isupmn < zfrom) {
  1467. i__4 = zfrom - 1;
  1468. for (ii = isupmn; ii <= i__4; ++ii) {
  1469. z__[ii + windex * z_dim1] = 0.f;
  1470. /* L122: */
  1471. }
  1472. }
  1473. if (isupmx > zto) {
  1474. i__4 = isupmx;
  1475. for (ii = zto + 1; ii <= i__4; ++ii) {
  1476. z__[ii + windex * z_dim1] = 0.f;
  1477. /* L123: */
  1478. }
  1479. }
  1480. i__4 = zto - zfrom + 1;
  1481. sscal_(&i__4, &nrminv, &z__[zfrom + windex * z_dim1],
  1482. &c__1);
  1483. L125:
  1484. /* Update W */
  1485. w[windex] = lambda + sigma;
  1486. /* Recompute the gaps on the left and right */
  1487. /* But only allow them to become larger and not */
  1488. /* smaller (which can only happen through "bad" */
  1489. /* cancellation and doesn't reflect the theory */
  1490. /* where the initial gaps are underestimated due */
  1491. /* to WERR being too crude.) */
  1492. if (! eskip) {
  1493. if (k > 1) {
  1494. /* Computing MAX */
  1495. r__1 = wgap[windmn], r__2 = w[windex] - werr[
  1496. windex] - w[windmn] - werr[windmn];
  1497. wgap[windmn] = f2cmax(r__1,r__2);
  1498. }
  1499. if (windex < wend) {
  1500. /* Computing MAX */
  1501. r__1 = savgap, r__2 = w[windpl] - werr[windpl]
  1502. - w[windex] - werr[windex];
  1503. wgap[windex] = f2cmax(r__1,r__2);
  1504. }
  1505. }
  1506. ++idone;
  1507. }
  1508. /* here ends the code for the current child */
  1509. L139:
  1510. /* Proceed to any remaining child nodes */
  1511. newfst = j + 1;
  1512. L140:
  1513. ;
  1514. }
  1515. /* L150: */
  1516. }
  1517. ++ndepth;
  1518. goto L40;
  1519. }
  1520. ibegin = iend + 1;
  1521. wbegin = wend + 1;
  1522. L170:
  1523. ;
  1524. }
  1525. return;
  1526. /* End of SLARRV */
  1527. } /* slarrv_ */