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