3 /* Subroutine */ int slaed5_(integer *i__, real *d__, real *z__, real *delta,
6 /* System generated locals */
9 /* Builtin functions */
10 double sqrt(doublereal);
13 real b, c__, w, del, tau, temp;
16 /* -- LAPACK routine (version 3.1) -- */
17 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
20 /* .. Scalar Arguments .. */
22 /* .. Array Arguments .. */
28 /* This subroutine computes the I-th eigenvalue of a symmetric rank-one */
29 /* modification of a 2-by-2 diagonal matrix */
31 /* diag( D ) + RHO * Z * transpose(Z) . */
33 /* The diagonal elements in the array D are assumed to satisfy */
35 /* D(i) < D(j) for i < j . */
37 /* We also assume RHO > 0 and that the Euclidean norm of the vector */
43 /* I (input) INTEGER */
44 /* The index of the eigenvalue to be computed. I = 1 or I = 2. */
46 /* D (input) REAL array, dimension (2) */
47 /* The original eigenvalues. We assume D(1) < D(2). */
49 /* Z (input) REAL array, dimension (2) */
50 /* The components of the updating vector. */
52 /* DELTA (output) REAL array, dimension (2) */
53 /* The vector DELTA contains the information necessary */
54 /* to construct the eigenvectors. */
56 /* RHO (input) REAL */
57 /* The scalar in the symmetric updating formula. */
59 /* DLAM (output) REAL */
60 /* The computed lambda_I, the I-th updated eigenvalue. */
65 /* Based on contributions by */
66 /* Ren-Cang Li, Computer Science Division, University of California */
67 /* at Berkeley, USA */
69 /* ===================================================================== */
71 /* .. Parameters .. */
73 /* .. Local Scalars .. */
75 /* .. Intrinsic Functions .. */
77 /* .. Executable Statements .. */
79 /* Parameter adjustments */
85 del = d__[2] - d__[1];
87 w = *rho * 2.f * (z__[2] * z__[2] - z__[1] * z__[1]) / del + 1.f;
89 b = del + *rho * (z__[1] * z__[1] + z__[2] * z__[2]);
90 c__ = *rho * z__[1] * z__[1] * del;
92 /* B > ZERO, always */
94 tau = c__ * 2.f / (b + sqrt((r__1 = b * b - c__ * 4.f, dabs(r__1))
97 delta[1] = -z__[1] / tau;
98 delta[2] = z__[2] / (del - tau);
100 b = -del + *rho * (z__[1] * z__[1] + z__[2] * z__[2]);
101 c__ = *rho * z__[2] * z__[2] * del;
103 tau = c__ * -2.f / (b + sqrt(b * b + c__ * 4.f));
105 tau = (b - sqrt(b * b + c__ * 4.f)) / 2.f;
107 *dlam = d__[2] + tau;
108 delta[1] = -z__[1] / (del + tau);
109 delta[2] = -z__[2] / tau;
111 temp = sqrt(delta[1] * delta[1] + delta[2] * delta[2]);
118 b = -del + *rho * (z__[1] * z__[1] + z__[2] * z__[2]);
119 c__ = *rho * z__[2] * z__[2] * del;
121 tau = (b + sqrt(b * b + c__ * 4.f)) / 2.f;
123 tau = c__ * 2.f / (-b + sqrt(b * b + c__ * 4.f));
125 *dlam = d__[2] + tau;
126 delta[1] = -z__[1] / (del + tau);
127 delta[2] = -z__[2] / tau;
128 temp = sqrt(delta[1] * delta[1] + delta[2] * delta[2]);