3 /* Table of constant values */
5 static integer c__2 = 2;
6 static integer c__1 = 1;
7 static doublereal c_b24 = 1.;
8 static doublereal c_b26 = 0.;
10 /* Subroutine */ int dlaeda_(integer *n, integer *tlvls, integer *curlvl,
11 integer *curpbm, integer *prmptr, integer *perm, integer *givptr,
12 integer *givcol, doublereal *givnum, doublereal *q, integer *qptr,
13 doublereal *z__, doublereal *ztemp, integer *info)
15 /* System generated locals */
16 integer i__1, i__2, i__3;
18 /* Builtin functions */
19 integer pow_ii(integer *, integer *);
20 double sqrt(doublereal);
23 integer i__, k, mid, ptr;
24 extern /* Subroutine */ int drot_(integer *, doublereal *, integer *,
25 doublereal *, integer *, doublereal *, doublereal *);
26 integer curr, bsiz1, bsiz2, psiz1, psiz2, zptr1;
27 extern /* Subroutine */ int dgemv_(char *, integer *, integer *,
28 doublereal *, doublereal *, integer *, doublereal *, integer *,
29 doublereal *, doublereal *, integer *), dcopy_(integer *,
30 doublereal *, integer *, doublereal *, integer *), xerbla_(char *,
34 /* -- LAPACK routine (version 3.1) -- */
35 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
38 /* .. Scalar Arguments .. */
40 /* .. Array Arguments .. */
46 /* DLAEDA computes the Z vector corresponding to the merge step in the */
47 /* CURLVLth step of the merge process with TLVLS steps for the CURPBMth */
53 /* N (input) INTEGER */
54 /* The dimension of the symmetric tridiagonal matrix. N >= 0. */
56 /* TLVLS (input) INTEGER */
57 /* The total number of merging levels in the overall divide and */
60 /* CURLVL (input) INTEGER */
61 /* The current level in the overall merge routine, */
62 /* 0 <= curlvl <= tlvls. */
64 /* CURPBM (input) INTEGER */
65 /* The current problem in the current level in the overall */
66 /* merge routine (counting from upper left to lower right). */
68 /* PRMPTR (input) INTEGER array, dimension (N lg N) */
69 /* Contains a list of pointers which indicate where in PERM a */
70 /* level's permutation is stored. PRMPTR(i+1) - PRMPTR(i) */
71 /* indicates the size of the permutation and incidentally the */
72 /* size of the full, non-deflated problem. */
74 /* PERM (input) INTEGER array, dimension (N lg N) */
75 /* Contains the permutations (from deflation and sorting) to be */
76 /* applied to each eigenblock. */
78 /* GIVPTR (input) INTEGER array, dimension (N lg N) */
79 /* Contains a list of pointers which indicate where in GIVCOL a */
80 /* level's Givens rotations are stored. GIVPTR(i+1) - GIVPTR(i) */
81 /* indicates the number of Givens rotations. */
83 /* GIVCOL (input) INTEGER array, dimension (2, N lg N) */
84 /* Each pair of numbers indicates a pair of columns to take place */
85 /* in a Givens rotation. */
87 /* GIVNUM (input) DOUBLE PRECISION array, dimension (2, N lg N) */
88 /* Each number indicates the S value to be used in the */
89 /* corresponding Givens rotation. */
91 /* Q (input) DOUBLE PRECISION array, dimension (N**2) */
92 /* Contains the square eigenblocks from previous levels, the */
93 /* starting positions for blocks are given by QPTR. */
95 /* QPTR (input) INTEGER array, dimension (N+2) */
96 /* Contains a list of pointers which indicate where in Q an */
97 /* eigenblock is stored. SQRT( QPTR(i+1) - QPTR(i) ) indicates */
98 /* the size of the block. */
100 /* Z (output) DOUBLE PRECISION array, dimension (N) */
101 /* On output this vector contains the updating vector (the last */
102 /* row of the first sub-eigenvector matrix and the first row of */
103 /* the second sub-eigenvector matrix). */
105 /* ZTEMP (workspace) DOUBLE PRECISION array, dimension (N) */
107 /* INFO (output) INTEGER */
108 /* = 0: successful exit. */
109 /* < 0: if INFO = -i, the i-th argument had an illegal value. */
111 /* Further Details */
112 /* =============== */
114 /* Based on contributions by */
115 /* Jeff Rutter, Computer Science Division, University of California */
116 /* at Berkeley, USA */
118 /* ===================================================================== */
120 /* .. Parameters .. */
122 /* .. Local Scalars .. */
124 /* .. External Subroutines .. */
126 /* .. Intrinsic Functions .. */
128 /* .. Executable Statements .. */
130 /* Test the input parameters. */
132 /* Parameter adjustments */
151 xerbla_("DLAEDA", &i__1);
155 /* Quick return if possible */
161 /* Determine location of first number in second half. */
165 /* Gather last/first rows of appropriate eigenblocks into center of Z */
169 /* Determine location of lowest level subproblem in the full storage */
173 curr = ptr + *curpbm * pow_ii(&c__2, curlvl) + pow_ii(&c__2, &i__1) - 1;
175 /* Determine size of these matrices. We add HALF to the value of */
176 /* the SQRT in case the machine underestimates one of these square */
179 bsiz1 = (integer) (sqrt((doublereal) (qptr[curr + 1] - qptr[curr])) + .5);
180 bsiz2 = (integer) (sqrt((doublereal) (qptr[curr + 2] - qptr[curr + 1])) +
182 i__1 = mid - bsiz1 - 1;
183 for (k = 1; k <= i__1; ++k) {
187 dcopy_(&bsiz1, &q[qptr[curr] + bsiz1 - 1], &bsiz1, &z__[mid - bsiz1], &
189 dcopy_(&bsiz2, &q[qptr[curr + 1]], &bsiz2, &z__[mid], &c__1);
191 for (k = mid + bsiz2; k <= i__1; ++k) {
196 /* Loop thru remaining levels 1 -> CURLVL applying the Givens */
197 /* rotations and permutation and then multiplying the center matrices */
198 /* against the current Z. */
200 ptr = pow_ii(&c__2, tlvls) + 1;
202 for (k = 1; k <= i__1; ++k) {
204 i__3 = *curlvl - k - 1;
205 curr = ptr + *curpbm * pow_ii(&c__2, &i__2) + pow_ii(&c__2, &i__3) -
207 psiz1 = prmptr[curr + 1] - prmptr[curr];
208 psiz2 = prmptr[curr + 2] - prmptr[curr + 1];
211 /* Apply Givens at CURR and CURR+1 */
213 i__2 = givptr[curr + 1] - 1;
214 for (i__ = givptr[curr]; i__ <= i__2; ++i__) {
215 drot_(&c__1, &z__[zptr1 + givcol[(i__ << 1) + 1] - 1], &c__1, &
216 z__[zptr1 + givcol[(i__ << 1) + 2] - 1], &c__1, &givnum[(
217 i__ << 1) + 1], &givnum[(i__ << 1) + 2]);
220 i__2 = givptr[curr + 2] - 1;
221 for (i__ = givptr[curr + 1]; i__ <= i__2; ++i__) {
222 drot_(&c__1, &z__[mid - 1 + givcol[(i__ << 1) + 1]], &c__1, &z__[
223 mid - 1 + givcol[(i__ << 1) + 2]], &c__1, &givnum[(i__ <<
224 1) + 1], &givnum[(i__ << 1) + 2]);
227 psiz1 = prmptr[curr + 1] - prmptr[curr];
228 psiz2 = prmptr[curr + 2] - prmptr[curr + 1];
230 for (i__ = 0; i__ <= i__2; ++i__) {
231 ztemp[i__ + 1] = z__[zptr1 + perm[prmptr[curr] + i__] - 1];
235 for (i__ = 0; i__ <= i__2; ++i__) {
236 ztemp[psiz1 + i__ + 1] = z__[mid + perm[prmptr[curr + 1] + i__] -
241 /* Multiply Blocks at CURR and CURR+1 */
243 /* Determine size of these matrices. We add HALF to the value of */
244 /* the SQRT in case the machine underestimates one of these */
247 bsiz1 = (integer) (sqrt((doublereal) (qptr[curr + 1] - qptr[curr])) +
249 bsiz2 = (integer) (sqrt((doublereal) (qptr[curr + 2] - qptr[curr + 1])
252 dgemv_("T", &bsiz1, &bsiz1, &c_b24, &q[qptr[curr]], &bsiz1, &
253 ztemp[1], &c__1, &c_b26, &z__[zptr1], &c__1);
255 i__2 = psiz1 - bsiz1;
256 dcopy_(&i__2, &ztemp[bsiz1 + 1], &c__1, &z__[zptr1 + bsiz1], &c__1);
258 dgemv_("T", &bsiz2, &bsiz2, &c_b24, &q[qptr[curr + 1]], &bsiz2, &
259 ztemp[psiz1 + 1], &c__1, &c_b26, &z__[mid], &c__1);
261 i__2 = psiz2 - bsiz2;
262 dcopy_(&i__2, &ztemp[psiz1 + bsiz2 + 1], &c__1, &z__[mid + bsiz2], &
266 ptr += pow_ii(&c__2, &i__2);