3 /* Table of constant values */
5 static integer c__1 = 1;
6 static integer c_n1 = -1;
8 /* Subroutine */ int dlaed1_(integer *n, doublereal *d__, doublereal *q,
9 integer *ldq, integer *indxq, doublereal *rho, integer *cutpnt,
10 doublereal *work, integer *iwork, integer *info)
12 /* System generated locals */
13 integer q_dim1, q_offset, i__1, i__2;
16 integer i__, k, n1, n2, is, iw, iz, iq2, zpp1, indx, indxc;
17 extern /* Subroutine */ int dcopy_(integer *, doublereal *, integer *,
18 doublereal *, integer *);
20 extern /* Subroutine */ int dlaed2_(integer *, integer *, integer *,
21 doublereal *, doublereal *, integer *, integer *, doublereal *,
22 doublereal *, doublereal *, doublereal *, doublereal *, integer *,
23 integer *, integer *, integer *, integer *), dlaed3_(integer *,
24 integer *, integer *, doublereal *, doublereal *, integer *,
25 doublereal *, doublereal *, doublereal *, integer *, integer *,
26 doublereal *, doublereal *, integer *);
28 extern /* Subroutine */ int dlamrg_(integer *, integer *, doublereal *,
29 integer *, integer *, integer *), xerbla_(char *, integer *);
33 /* -- LAPACK routine (version 3.1) -- */
34 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
37 /* .. Scalar Arguments .. */
39 /* .. Array Arguments .. */
45 /* DLAED1 computes the updated eigensystem of a diagonal */
46 /* matrix after modification by a rank-one symmetric matrix. This */
47 /* routine is used only for the eigenproblem which requires all */
48 /* eigenvalues and eigenvectors of a tridiagonal matrix. DLAED7 handles */
49 /* the case in which eigenvalues only or eigenvalues and eigenvectors */
50 /* of a full symmetric matrix (which was reduced to tridiagonal form) */
53 /* T = Q(in) ( D(in) + RHO * Z*Z' ) Q'(in) = Q(out) * D(out) * Q'(out) */
55 /* where Z = Q'u, u is a vector of length N with ones in the */
56 /* CUTPNT and CUTPNT + 1 th elements and zeros elsewhere. */
58 /* The eigenvectors of the original matrix are stored in Q, and the */
59 /* eigenvalues are in D. The algorithm consists of three stages: */
61 /* The first stage consists of deflating the size of the problem */
62 /* when there are multiple eigenvalues or if there is a zero in */
63 /* the Z vector. For each such occurence the dimension of the */
64 /* secular equation problem is reduced by one. This stage is */
65 /* performed by the routine DLAED2. */
67 /* The second stage consists of calculating the updated */
68 /* eigenvalues. This is done by finding the roots of the secular */
69 /* equation via the routine DLAED4 (as called by DLAED3). */
70 /* This routine also calculates the eigenvectors of the current */
73 /* The final stage consists of computing the updated eigenvectors */
74 /* directly using the updated eigenvalues. The eigenvectors for */
75 /* the current problem are multiplied with the eigenvectors from */
76 /* the overall problem. */
81 /* N (input) INTEGER */
82 /* The dimension of the symmetric tridiagonal matrix. N >= 0. */
84 /* D (input/output) DOUBLE PRECISION array, dimension (N) */
85 /* On entry, the eigenvalues of the rank-1-perturbed matrix. */
86 /* On exit, the eigenvalues of the repaired matrix. */
88 /* Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N) */
89 /* On entry, the eigenvectors of the rank-1-perturbed matrix. */
90 /* On exit, the eigenvectors of the repaired tridiagonal matrix. */
92 /* LDQ (input) INTEGER */
93 /* The leading dimension of the array Q. LDQ >= max(1,N). */
95 /* INDXQ (input/output) INTEGER array, dimension (N) */
96 /* On entry, the permutation which separately sorts the two */
97 /* subproblems in D into ascending order. */
98 /* On exit, the permutation which will reintegrate the */
99 /* subproblems back into sorted order, */
100 /* i.e. D( INDXQ( I = 1, N ) ) will be in ascending order. */
102 /* RHO (input) DOUBLE PRECISION */
103 /* The subdiagonal entry used to create the rank-1 modification. */
105 /* CUTPNT (input) INTEGER */
106 /* The location of the last eigenvalue in the leading sub-matrix. */
107 /* min(1,N) <= CUTPNT <= N/2. */
109 /* WORK (workspace) DOUBLE PRECISION array, dimension (4*N + N**2) */
111 /* IWORK (workspace) INTEGER array, dimension (4*N) */
113 /* INFO (output) INTEGER */
114 /* = 0: successful exit. */
115 /* < 0: if INFO = -i, the i-th argument had an illegal value. */
116 /* > 0: if INFO = 1, an eigenvalue did not converge */
118 /* Further Details */
119 /* =============== */
121 /* Based on contributions by */
122 /* Jeff Rutter, Computer Science Division, University of California */
123 /* at Berkeley, USA */
124 /* Modified by Francoise Tisseur, University of Tennessee. */
126 /* ===================================================================== */
128 /* .. Local Scalars .. */
130 /* .. External Subroutines .. */
132 /* .. Intrinsic Functions .. */
134 /* .. Executable Statements .. */
136 /* Test the input parameters. */
138 /* Parameter adjustments */
141 q_offset = 1 + q_dim1;
152 } else if (*ldq < max(1,*n)) {
154 } else /* if(complicated condition) */ {
156 i__1 = 1, i__2 = *n / 2;
157 if (min(i__1,i__2) > *cutpnt || *n / 2 < *cutpnt) {
163 xerbla_("DLAED1", &i__1);
167 /* Quick return if possible */
173 /* The following values are integer pointers which indicate */
174 /* the portion of the workspace */
175 /* used by a particular array in DLAED2 and DLAED3. */
188 /* Form the z-vector which consists of the last row of Q_1 and the */
189 /* first row of Q_2. */
191 dcopy_(cutpnt, &q[*cutpnt + q_dim1], ldq, &work[iz], &c__1);
194 dcopy_(&i__1, &q[zpp1 + zpp1 * q_dim1], ldq, &work[iz + *cutpnt], &c__1);
196 /* Deflate eigenvalues. */
198 dlaed2_(&k, n, cutpnt, &d__[1], &q[q_offset], ldq, &indxq[1], rho, &work[
199 iz], &work[idlmda], &work[iw], &work[iq2], &iwork[indx], &iwork[
200 indxc], &iwork[indxp], &iwork[coltyp], info);
206 /* Solve Secular Equation. */
209 is = (iwork[coltyp] + iwork[coltyp + 1]) * *cutpnt + (iwork[coltyp +
210 1] + iwork[coltyp + 2]) * (*n - *cutpnt) + iq2;
211 dlaed3_(&k, n, cutpnt, &d__[1], &q[q_offset], ldq, rho, &work[idlmda],
212 &work[iq2], &iwork[indxc], &iwork[coltyp], &work[iw], &work[
218 /* Prepare the INDXQ sorting permutation. */
222 dlamrg_(&n1, &n2, &d__[1], &c__1, &c_n1, &indxq[1]);
225 for (i__ = 1; i__ <= i__1; ++i__) {