3 /* Table of constant values */
5 static integer c__1 = 1;
6 static integer c_n1 = -1;
8 /* Subroutine */ int slaed1_(integer *n, real *d__, real *q, integer *ldq,
9 integer *indxq, real *rho, integer *cutpnt, real *work, integer *
12 /* System generated locals */
13 integer q_dim1, q_offset, i__1, i__2;
16 integer i__, k, n1, n2, is, iw, iz, iq2, cpp1, indx, indxc, indxp;
17 extern /* Subroutine */ int scopy_(integer *, real *, integer *, real *,
18 integer *), slaed2_(integer *, integer *, integer *, real *, real
19 *, integer *, integer *, real *, real *, real *, real *, real *,
20 integer *, integer *, integer *, integer *, integer *), slaed3_(
21 integer *, integer *, integer *, real *, real *, integer *, real *
22 , real *, real *, integer *, integer *, real *, real *, integer *)
25 extern /* Subroutine */ int xerbla_(char *, integer *), slamrg_(
26 integer *, integer *, real *, integer *, integer *, integer *);
30 /* -- LAPACK routine (version 3.1) -- */
31 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
34 /* .. Scalar Arguments .. */
36 /* .. Array Arguments .. */
42 /* SLAED1 computes the updated eigensystem of a diagonal */
43 /* matrix after modification by a rank-one symmetric matrix. This */
44 /* routine is used only for the eigenproblem which requires all */
45 /* eigenvalues and eigenvectors of a tridiagonal matrix. SLAED7 handles */
46 /* the case in which eigenvalues only or eigenvalues and eigenvectors */
47 /* of a full symmetric matrix (which was reduced to tridiagonal form) */
50 /* T = Q(in) ( D(in) + RHO * Z*Z' ) Q'(in) = Q(out) * D(out) * Q'(out) */
52 /* where Z = Q'u, u is a vector of length N with ones in the */
53 /* CUTPNT and CUTPNT + 1 th elements and zeros elsewhere. */
55 /* The eigenvectors of the original matrix are stored in Q, and the */
56 /* eigenvalues are in D. The algorithm consists of three stages: */
58 /* The first stage consists of deflating the size of the problem */
59 /* when there are multiple eigenvalues or if there is a zero in */
60 /* the Z vector. For each such occurence the dimension of the */
61 /* secular equation problem is reduced by one. This stage is */
62 /* performed by the routine SLAED2. */
64 /* The second stage consists of calculating the updated */
65 /* eigenvalues. This is done by finding the roots of the secular */
66 /* equation via the routine SLAED4 (as called by SLAED3). */
67 /* This routine also calculates the eigenvectors of the current */
70 /* The final stage consists of computing the updated eigenvectors */
71 /* directly using the updated eigenvalues. The eigenvectors for */
72 /* the current problem are multiplied with the eigenvectors from */
73 /* the overall problem. */
78 /* N (input) INTEGER */
79 /* The dimension of the symmetric tridiagonal matrix. N >= 0. */
81 /* D (input/output) REAL array, dimension (N) */
82 /* On entry, the eigenvalues of the rank-1-perturbed matrix. */
83 /* On exit, the eigenvalues of the repaired matrix. */
85 /* Q (input/output) REAL array, dimension (LDQ,N) */
86 /* On entry, the eigenvectors of the rank-1-perturbed matrix. */
87 /* On exit, the eigenvectors of the repaired tridiagonal matrix. */
89 /* LDQ (input) INTEGER */
90 /* The leading dimension of the array Q. LDQ >= max(1,N). */
92 /* INDXQ (input/output) INTEGER array, dimension (N) */
93 /* On entry, the permutation which separately sorts the two */
94 /* subproblems in D into ascending order. */
95 /* On exit, the permutation which will reintegrate the */
96 /* subproblems back into sorted order, */
97 /* i.e. D( INDXQ( I = 1, N ) ) will be in ascending order. */
99 /* RHO (input) REAL */
100 /* The subdiagonal entry used to create the rank-1 modification. */
102 /* CUTPNT (input) INTEGER */
103 /* The location of the last eigenvalue in the leading sub-matrix. */
104 /* min(1,N) <= CUTPNT <= N/2. */
106 /* WORK (workspace) REAL array, dimension (4*N + N**2) */
108 /* IWORK (workspace) INTEGER array, dimension (4*N) */
110 /* INFO (output) INTEGER */
111 /* = 0: successful exit. */
112 /* < 0: if INFO = -i, the i-th argument had an illegal value. */
113 /* > 0: if INFO = 1, an eigenvalue did not converge */
115 /* Further Details */
116 /* =============== */
118 /* Based on contributions by */
119 /* Jeff Rutter, Computer Science Division, University of California */
120 /* at Berkeley, USA */
121 /* Modified by Francoise Tisseur, University of Tennessee. */
123 /* ===================================================================== */
125 /* .. Local Scalars .. */
127 /* .. External Subroutines .. */
129 /* .. Intrinsic Functions .. */
131 /* .. Executable Statements .. */
133 /* Test the input parameters. */
135 /* Parameter adjustments */
138 q_offset = 1 + q_dim1;
149 } else if (*ldq < max(1,*n)) {
151 } else /* if(complicated condition) */ {
153 i__1 = 1, i__2 = *n / 2;
154 if (min(i__1,i__2) > *cutpnt || *n / 2 < *cutpnt) {
160 xerbla_("SLAED1", &i__1);
164 /* Quick return if possible */
170 /* The following values are integer pointers which indicate */
171 /* the portion of the workspace */
172 /* used by a particular array in SLAED2 and SLAED3. */
185 /* Form the z-vector which consists of the last row of Q_1 and the */
186 /* first row of Q_2. */
188 scopy_(cutpnt, &q[*cutpnt + q_dim1], ldq, &work[iz], &c__1);
191 scopy_(&i__1, &q[cpp1 + cpp1 * q_dim1], ldq, &work[iz + *cutpnt], &c__1);
193 /* Deflate eigenvalues. */
195 slaed2_(&k, n, cutpnt, &d__[1], &q[q_offset], ldq, &indxq[1], rho, &work[
196 iz], &work[idlmda], &work[iw], &work[iq2], &iwork[indx], &iwork[
197 indxc], &iwork[indxp], &iwork[coltyp], info);
203 /* Solve Secular Equation. */
206 is = (iwork[coltyp] + iwork[coltyp + 1]) * *cutpnt + (iwork[coltyp +
207 1] + iwork[coltyp + 2]) * (*n - *cutpnt) + iq2;
208 slaed3_(&k, n, cutpnt, &d__[1], &q[q_offset], ldq, rho, &work[idlmda],
209 &work[iq2], &iwork[indxc], &iwork[coltyp], &work[iw], &work[
215 /* Prepare the INDXQ sorting permutation. */
219 slamrg_(&n1, &n2, &d__[1], &c__1, &c_n1, &indxq[1]);
222 for (i__ = 1; i__ <= i__1; ++i__) {