14 typedef long long BLASLONG;
15 typedef unsigned long long BLASULONG;
17 typedef long BLASLONG;
18 typedef unsigned long BLASULONG;
22 typedef BLASLONG blasint;
24 #define blasabs(x) llabs(x)
26 #define blasabs(x) labs(x)
30 #define blasabs(x) abs(x)
33 typedef blasint integer;
35 typedef unsigned int uinteger;
36 typedef char *address;
37 typedef short int shortint;
39 typedef double doublereal;
40 typedef struct { real r, i; } complex;
41 typedef struct { doublereal r, i; } doublecomplex;
43 static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
44 static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
45 static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
46 static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
48 static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
49 static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
50 static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
51 static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
53 #define pCf(z) (*_pCf(z))
54 #define pCd(z) (*_pCd(z))
56 typedef short int shortlogical;
57 typedef char logical1;
58 typedef char integer1;
63 /* Extern is for use with -E */
74 /*external read, write*/
83 /*internal read, write*/
113 /*rewind, backspace, endfile*/
125 ftnint *inex; /*parameters in standard's order*/
151 union Multitype { /* for multiple entry points */
162 typedef union Multitype Multitype;
164 struct Vardesc { /* for Namelist */
170 typedef struct Vardesc Vardesc;
177 typedef struct Namelist Namelist;
179 #define abs(x) ((x) >= 0 ? (x) : -(x))
180 #define dabs(x) (fabs(x))
181 #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
182 #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
183 #define dmin(a,b) (f2cmin(a,b))
184 #define dmax(a,b) (f2cmax(a,b))
185 #define bit_test(a,b) ((a) >> (b) & 1)
186 #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
187 #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
189 #define abort_() { sig_die("Fortran abort routine called", 1); }
190 #define c_abs(z) (cabsf(Cf(z)))
191 #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
193 #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]);}
194 #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]/Cd(b)._Val[1]);}
196 #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
197 #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
199 #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
200 #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
201 #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
202 //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
203 #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
204 #define d_abs(x) (fabs(*(x)))
205 #define d_acos(x) (acos(*(x)))
206 #define d_asin(x) (asin(*(x)))
207 #define d_atan(x) (atan(*(x)))
208 #define d_atn2(x, y) (atan2(*(x),*(y)))
209 #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
210 #define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
211 #define d_cos(x) (cos(*(x)))
212 #define d_cosh(x) (cosh(*(x)))
213 #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
214 #define d_exp(x) (exp(*(x)))
215 #define d_imag(z) (cimag(Cd(z)))
216 #define r_imag(z) (cimagf(Cf(z)))
217 #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
218 #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
219 #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
220 #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
221 #define d_log(x) (log(*(x)))
222 #define d_mod(x, y) (fmod(*(x), *(y)))
223 #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
224 #define d_nint(x) u_nint(*(x))
225 #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
226 #define d_sign(a,b) u_sign(*(a),*(b))
227 #define r_sign(a,b) u_sign(*(a),*(b))
228 #define d_sin(x) (sin(*(x)))
229 #define d_sinh(x) (sinh(*(x)))
230 #define d_sqrt(x) (sqrt(*(x)))
231 #define d_tan(x) (tan(*(x)))
232 #define d_tanh(x) (tanh(*(x)))
233 #define i_abs(x) abs(*(x))
234 #define i_dnnt(x) ((integer)u_nint(*(x)))
235 #define i_len(s, n) (n)
236 #define i_nint(x) ((integer)u_nint(*(x)))
237 #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
238 #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
239 #define pow_si(B,E) spow_ui(*(B),*(E))
240 #define pow_ri(B,E) spow_ui(*(B),*(E))
241 #define pow_di(B,E) dpow_ui(*(B),*(E))
242 #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
243 #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
244 #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
245 #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++ = ' '; }
246 #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
247 #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]; }
248 #define sig_die(s, kill) { exit(1); }
249 #define s_stop(s, n) {exit(0);}
250 static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
251 #define z_abs(z) (cabs(Cd(z)))
252 #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
253 #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
254 #define myexit_() break;
255 #define mycycle() continue;
256 #define myceiling(w) {ceil(w)}
257 #define myhuge(w) {HUGE_VAL}
258 //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
259 #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
261 /* procedure parameter types for -A and -C++ */
263 #define F2C_proc_par_types 1
265 typedef logical (*L_fp)(...);
267 typedef logical (*L_fp)();
270 static float spow_ui(float x, integer n) {
271 float pow=1.0; unsigned long int u;
273 if(n < 0) n = -n, x = 1/x;
282 static double dpow_ui(double x, integer n) {
283 double pow=1.0; unsigned long int u;
285 if(n < 0) n = -n, x = 1/x;
295 static _Fcomplex cpow_ui(complex x, integer n) {
296 complex pow={1.0,0.0}; unsigned long int u;
298 if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
300 if(u & 01) pow.r *= x.r, pow.i *= x.i;
301 if(u >>= 1) x.r *= x.r, x.i *= x.i;
305 _Fcomplex p={pow.r, pow.i};
309 static _Complex float cpow_ui(_Complex float x, integer n) {
310 _Complex float pow=1.0; unsigned long int u;
312 if(n < 0) n = -n, x = 1/x;
323 static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
324 _Dcomplex pow={1.0,0.0}; unsigned long int u;
326 if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
328 if(u & 01) pow = _Cmulcc(pow, x);
329 if(u >>= 1) x = _Cmulcc(x, x);
336 static _Complex double zpow_ui(_Complex double x, integer n) {
337 _Complex double pow=1.0; unsigned long int u;
339 if(n < 0) n = -n, x = 1/x;
349 static integer pow_ii(integer x, integer n) {
350 integer pow; unsigned long int u;
352 if (n == 0 || x == 1) pow = 1;
353 else if (x != -1) pow = x == 0 ? 1/x : 0;
356 if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
366 static integer dmaxloc_(double *w, integer s, integer e, integer *n)
368 double m; integer i, mi;
369 for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
370 if (w[i-1]>m) mi=i ,m=w[i-1];
373 static integer smaxloc_(float *w, integer s, integer e, integer *n)
375 float m; integer i, mi;
376 for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
377 if (w[i-1]>m) mi=i ,m=w[i-1];
380 static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
381 integer n = *n_, incx = *incx_, incy = *incy_, i;
383 _Fcomplex zdotc = {0.0, 0.0};
384 if (incx == 1 && incy == 1) {
385 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
386 zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
387 zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
390 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
391 zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
392 zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
398 _Complex float zdotc = 0.0;
399 if (incx == 1 && incy == 1) {
400 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
401 zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
404 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
405 zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
411 static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
412 integer n = *n_, incx = *incx_, incy = *incy_, i;
414 _Dcomplex zdotc = {0.0, 0.0};
415 if (incx == 1 && incy == 1) {
416 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
417 zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
418 zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
421 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
422 zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
423 zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
429 _Complex double zdotc = 0.0;
430 if (incx == 1 && incy == 1) {
431 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
432 zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
435 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
436 zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
442 static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
443 integer n = *n_, incx = *incx_, incy = *incy_, i;
445 _Fcomplex zdotc = {0.0, 0.0};
446 if (incx == 1 && incy == 1) {
447 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
448 zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
449 zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
452 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
453 zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
454 zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
460 _Complex float zdotc = 0.0;
461 if (incx == 1 && incy == 1) {
462 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
463 zdotc += Cf(&x[i]) * Cf(&y[i]);
466 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
467 zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
473 static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
474 integer n = *n_, incx = *incx_, incy = *incy_, i;
476 _Dcomplex zdotc = {0.0, 0.0};
477 if (incx == 1 && incy == 1) {
478 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
479 zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
480 zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
483 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
484 zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
485 zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
491 _Complex double zdotc = 0.0;
492 if (incx == 1 && incy == 1) {
493 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
494 zdotc += Cd(&x[i]) * Cd(&y[i]);
497 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
498 zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
504 /* -- translated by f2c (version 20000121).
505 You must link the resulting object file with the libraries:
506 -lf2c -lm (in that order)
512 /* Table of constant values */
514 static integer c__9 = 9;
515 static integer c__0 = 0;
516 static integer c__2 = 2;
517 static integer c__1 = 1;
519 /* > \brief \b ZLAED0 used by sstedc. Computes all eigenvalues and corresponding eigenvectors of an unreduced
520 symmetric tridiagonal matrix using the divide and conquer method. */
522 /* =========== DOCUMENTATION =========== */
524 /* Online html documentation available at */
525 /* http://www.netlib.org/lapack/explore-html/ */
528 /* > Download ZLAED0 + dependencies */
529 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlaed0.
532 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlaed0.
535 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlaed0.
543 /* SUBROUTINE ZLAED0( QSIZ, N, D, E, Q, LDQ, QSTORE, LDQS, RWORK, */
546 /* INTEGER INFO, LDQ, LDQS, N, QSIZ */
547 /* INTEGER IWORK( * ) */
548 /* DOUBLE PRECISION D( * ), E( * ), RWORK( * ) */
549 /* COMPLEX*16 Q( LDQ, * ), QSTORE( LDQS, * ) */
552 /* > \par Purpose: */
557 /* > Using the divide and conquer method, ZLAED0 computes all eigenvalues */
558 /* > of a symmetric tridiagonal matrix which is one diagonal block of */
559 /* > those from reducing a dense or band Hermitian matrix and */
560 /* > corresponding eigenvectors of the dense or band matrix. */
566 /* > \param[in] QSIZ */
568 /* > QSIZ is INTEGER */
569 /* > The dimension of the unitary matrix used to reduce */
570 /* > the full matrix to tridiagonal form. QSIZ >= N if ICOMPQ = 1. */
576 /* > The dimension of the symmetric tridiagonal matrix. N >= 0. */
579 /* > \param[in,out] D */
581 /* > D is DOUBLE PRECISION array, dimension (N) */
582 /* > On entry, the diagonal elements of the tridiagonal matrix. */
583 /* > On exit, the eigenvalues in ascending order. */
586 /* > \param[in,out] E */
588 /* > E is DOUBLE PRECISION array, dimension (N-1) */
589 /* > On entry, the off-diagonal elements of the tridiagonal matrix. */
590 /* > On exit, E has been destroyed. */
593 /* > \param[in,out] Q */
595 /* > Q is COMPLEX*16 array, dimension (LDQ,N) */
596 /* > On entry, Q must contain an QSIZ x N matrix whose columns */
597 /* > unitarily orthonormal. It is a part of the unitary matrix */
598 /* > that reduces the full dense Hermitian matrix to a */
599 /* > (reducible) symmetric tridiagonal matrix. */
602 /* > \param[in] LDQ */
604 /* > LDQ is INTEGER */
605 /* > The leading dimension of the array Q. LDQ >= f2cmax(1,N). */
608 /* > \param[out] IWORK */
610 /* > IWORK is INTEGER array, */
611 /* > the dimension of IWORK must be at least */
612 /* > 6 + 6*N + 5*N*lg N */
613 /* > ( lg( N ) = smallest integer k */
614 /* > such that 2^k >= N ) */
617 /* > \param[out] RWORK */
619 /* > RWORK is DOUBLE PRECISION array, */
620 /* > dimension (1 + 3*N + 2*N*lg N + 3*N**2) */
621 /* > ( lg( N ) = smallest integer k */
622 /* > such that 2^k >= N ) */
625 /* > \param[out] QSTORE */
627 /* > QSTORE is COMPLEX*16 array, dimension (LDQS, N) */
628 /* > Used to store parts of */
629 /* > the eigenvector matrix when the updating matrix multiplies */
633 /* > \param[in] LDQS */
635 /* > LDQS is INTEGER */
636 /* > The leading dimension of the array QSTORE. */
637 /* > LDQS >= f2cmax(1,N). */
640 /* > \param[out] INFO */
642 /* > INFO is INTEGER */
643 /* > = 0: successful exit. */
644 /* > < 0: if INFO = -i, the i-th argument had an illegal value. */
645 /* > > 0: The algorithm failed to compute an eigenvalue while */
646 /* > working on the submatrix lying in rows and columns */
647 /* > INFO/(N+1) through mod(INFO,N+1). */
653 /* > \author Univ. of Tennessee */
654 /* > \author Univ. of California Berkeley */
655 /* > \author Univ. of Colorado Denver */
656 /* > \author NAG Ltd. */
658 /* > \date December 2016 */
660 /* > \ingroup complex16OTHERcomputational */
662 /* ===================================================================== */
663 /* Subroutine */ int zlaed0_(integer *qsiz, integer *n, doublereal *d__,
664 doublereal *e, doublecomplex *q, integer *ldq, doublecomplex *qstore,
665 integer *ldqs, doublereal *rwork, integer *iwork, integer *info)
667 /* System generated locals */
668 integer q_dim1, q_offset, qstore_dim1, qstore_offset, i__1, i__2;
671 /* Local variables */
673 integer curr, i__, j, k, iperm;
674 extern /* Subroutine */ int dcopy_(integer *, doublereal *, integer *,
675 doublereal *, integer *);
676 integer indxq, iwrem, iqptr, tlvls;
677 extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *,
678 doublecomplex *, integer *), zlaed7_(integer *, integer *,
679 integer *, integer *, integer *, integer *, doublereal *,
680 doublecomplex *, integer *, doublereal *, integer *, doublereal *,
681 integer *, integer *, integer *, integer *, integer *,
682 doublereal *, doublecomplex *, doublereal *, integer *, integer *)
684 integer ll, iq, igivcl;
685 extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);
686 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
687 integer *, integer *, ftnlen, ftnlen);
688 extern /* Subroutine */ int zlacrm_(integer *, integer *, doublecomplex *,
689 integer *, doublereal *, integer *, doublecomplex *, integer *,
691 integer igivnm, submat, curprb, subpbs, igivpt;
692 extern /* Subroutine */ int dsteqr_(char *, integer *, doublereal *,
693 doublereal *, doublereal *, integer *, doublereal *, integer *);
694 integer curlvl, matsiz, iprmpt, smlsiz, lgn, msd2, smm1, spm1, spm2;
697 /* -- LAPACK computational routine (version 3.7.0) -- */
698 /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
699 /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
703 /* ===================================================================== */
705 /* Warning: N could be as big as QSIZ! */
708 /* Test the input parameters. */
710 /* Parameter adjustments */
714 q_offset = 1 + q_dim1 * 1;
717 qstore_offset = 1 + qstore_dim1 * 1;
718 qstore -= qstore_offset;
725 /* IF( ICOMPQ .LT. 0 .OR. ICOMPQ .GT. 2 ) THEN */
727 /* ELSE IF( ( ICOMPQ .EQ. 1 ) .AND. ( QSIZ .LT. MAX( 0, N ) ) ) */
729 if (*qsiz < f2cmax(0,*n)) {
733 } else if (*ldq < f2cmax(1,*n)) {
735 } else if (*ldqs < f2cmax(1,*n)) {
740 xerbla_("ZLAED0", &i__1, (ftnlen)6);
744 /* Quick return if possible */
750 smlsiz = ilaenv_(&c__9, "ZLAED0", " ", &c__0, &c__0, &c__0, &c__0, (
751 ftnlen)6, (ftnlen)1);
753 /* Determine the size and placement of the submatrices, and save in */
754 /* the leading elements of IWORK. */
760 if (iwork[subpbs] > smlsiz) {
761 for (j = subpbs; j >= 1; --j) {
762 iwork[j * 2] = (iwork[j] + 1) / 2;
763 iwork[(j << 1) - 1] = iwork[j] / 2;
771 for (j = 2; j <= i__1; ++j) {
772 iwork[j] += iwork[j - 1];
776 /* Divide the matrix into SUBPBS submatrices of size at most SMLSIZ+1 */
777 /* using rank-1 modifications (cuts). */
781 for (i__ = 1; i__ <= i__1; ++i__) {
782 submat = iwork[i__] + 1;
784 d__[smm1] -= (d__1 = e[smm1], abs(d__1));
785 d__[submat] -= (d__1 = e[smm1], abs(d__1));
789 indxq = (*n << 2) + 3;
791 /* Set up workspaces for eigenvalues only/accumulate new vectors */
794 temp = log((doublereal) (*n)) / log(2.);
795 lgn = (integer) temp;
796 if (pow_ii(&c__2, &lgn) < *n) {
799 if (pow_ii(&c__2, &lgn) < *n) {
802 iprmpt = indxq + *n + 1;
803 iperm = iprmpt + *n * lgn;
804 iqptr = iperm + *n * lgn;
805 igivpt = iqptr + *n + 2;
806 igivcl = igivpt + *n * lgn;
809 iq = igivnm + (*n << 1) * lgn;
810 /* Computing 2nd power */
812 iwrem = iq + i__1 * i__1 + 1;
813 /* Initialize pointers */
815 for (i__ = 0; i__ <= i__1; ++i__) {
816 iwork[iprmpt + i__] = 1;
817 iwork[igivpt + i__] = 1;
822 /* Solve each submatrix eigenproblem at the bottom of the divide and */
827 for (i__ = 0; i__ <= i__1; ++i__) {
832 submat = iwork[i__] + 1;
833 matsiz = iwork[i__ + 1] - iwork[i__];
835 ll = iq - 1 + iwork[iqptr + curr];
836 dsteqr_("I", &matsiz, &d__[submat], &e[submat], &rwork[ll], &matsiz, &
838 zlacrm_(qsiz, &matsiz, &q[submat * q_dim1 + 1], ldq, &rwork[ll], &
839 matsiz, &qstore[submat * qstore_dim1 + 1], ldqs, &rwork[iwrem]
841 /* Computing 2nd power */
843 iwork[iqptr + curr + 1] = iwork[iqptr + curr] + i__2 * i__2;
846 *info = submat * (*n + 1) + submat + matsiz - 1;
850 i__2 = iwork[i__ + 1];
851 for (j = submat; j <= i__2; ++j) {
852 iwork[indxq + j] = k;
859 /* Successively merge eigensystems of adjacent submatrices */
860 /* into eigensystem for the corresponding larger matrix. */
862 /* while ( SUBPBS > 1 ) */
869 for (i__ = 0; i__ <= i__1; i__ += 2) {
876 submat = iwork[i__] + 1;
877 matsiz = iwork[i__ + 2] - iwork[i__];
882 /* Merge lower order eigensystems (of size MSD2 and MATSIZ - MSD2) */
883 /* into an eigensystem of size MATSIZ. ZLAED7 handles the case */
884 /* when the eigenvectors of a full or band Hermitian matrix (which */
885 /* was reduced to tridiagonal form) are desired. */
887 /* I am free to use Q as a valuable working space until Loop 150. */
889 zlaed7_(&matsiz, &msd2, qsiz, &tlvls, &curlvl, &curprb, &d__[
890 submat], &qstore[submat * qstore_dim1 + 1], ldqs, &e[
891 submat + msd2 - 1], &iwork[indxq + submat], &rwork[iq], &
892 iwork[iqptr], &iwork[iprmpt], &iwork[iperm], &iwork[
893 igivpt], &iwork[igivcl], &rwork[igivnm], &q[submat *
894 q_dim1 + 1], &rwork[iwrem], &iwork[subpbs + 1], info);
896 *info = submat * (*n + 1) + submat + matsiz - 1;
899 iwork[i__ / 2 + 1] = iwork[i__ + 2];
909 /* Re-merge the eigenvalues/vectors which were deflated at the final */
913 for (i__ = 1; i__ <= i__1; ++i__) {
914 j = iwork[indxq + i__];
916 zcopy_(qsiz, &qstore[j * qstore_dim1 + 1], &c__1, &q[i__ * q_dim1 + 1]
920 dcopy_(n, &rwork[1], &c__1, &d__[1], &c__1);