📄 dlaed5.c
字号:
#include "blaswrap.h"
/* -- translated by f2c (version 19990503).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
#include "f2c.h"
/* Common Block Declarations */
struct {
doublereal ops, itcnt;
} latime_;
#define latime_1 latime_
/* Subroutine */ int dlaed5_(integer *i__, doublereal *d__, doublereal *z__,
doublereal *delta, doublereal *rho, doublereal *dlam)
{
/* System generated locals */
doublereal d__1;
/* Builtin functions */
double sqrt(doublereal);
/* Local variables */
static doublereal temp, b, c__, w, del, tau;
/* -- LAPACK routine (instrumented to count operations, version 3.0) --
Univ. of Tennessee, Oak Ridge National Lab, Argonne National Lab,
Courant Institute, NAG Ltd., and Rice University
September 30, 1994
Common block to return operation count and iteration count
ITCNT is unchanged, OPS is only incremented
Purpose
=======
This subroutine computes the I-th eigenvalue of a symmetric rank-one
modification of a 2-by-2 diagonal matrix
diag( D ) + RHO * Z * transpose(Z) .
The diagonal elements in the array D are assumed to satisfy
D(i) < D(j) for i < j .
We also assume RHO > 0 and that the Euclidean norm of the vector
Z is one.
Arguments
=========
I (input) INTEGER
The index of the eigenvalue to be computed. I = 1 or I = 2.
D (input) DOUBLE PRECISION array, dimension (2)
The original eigenvalues. We assume D(1) < D(2).
Z (input) DOUBLE PRECISION array, dimension (2)
The components of the updating vector.
DELTA (output) DOUBLE PRECISION array, dimension (2)
The vector DELTA contains the information necessary
to construct the eigenvectors.
RHO (input) DOUBLE PRECISION
The scalar in the symmetric updating formula.
DLAM (output) DOUBLE PRECISION
The computed lambda_I, the I-th updated eigenvalue.
Further Details
===============
Based on contributions by
Ren-Cang Li, Computer Science Division, University of California
at Berkeley, USA
=====================================================================
Parameter adjustments */
--delta;
--z__;
--d__;
/* Function Body */
del = d__[2] - d__[1];
if (*i__ == 1) {
w = *rho * 2. * (z__[2] * z__[2] - z__[1] * z__[1]) / del + 1.;
if (w > 0.) {
latime_1.ops += 33;
b = del + *rho * (z__[1] * z__[1] + z__[2] * z__[2]);
c__ = *rho * z__[1] * z__[1] * del;
/* B > ZERO, always */
tau = c__ * 2. / (b + sqrt((d__1 = b * b - c__ * 4., abs(d__1))));
*dlam = d__[1] + tau;
delta[1] = -z__[1] / tau;
delta[2] = z__[2] / (del - tau);
} else {
latime_1.ops += 31;
b = -del + *rho * (z__[1] * z__[1] + z__[2] * z__[2]);
c__ = *rho * z__[2] * z__[2] * del;
if (b > 0.) {
tau = c__ * -2. / (b + sqrt(b * b + c__ * 4.));
} else {
tau = (b - sqrt(b * b + c__ * 4.)) / 2.;
}
*dlam = d__[2] + tau;
delta[1] = -z__[1] / (del + tau);
delta[2] = -z__[2] / tau;
}
temp = sqrt(delta[1] * delta[1] + delta[2] * delta[2]);
delta[1] /= temp;
delta[2] /= temp;
} else {
/* Now I=2 */
latime_1.ops += 24;
b = -del + *rho * (z__[1] * z__[1] + z__[2] * z__[2]);
c__ = *rho * z__[2] * z__[2] * del;
if (b > 0.) {
tau = (b + sqrt(b * b + c__ * 4.)) / 2.;
} else {
tau = c__ * 2. / (-b + sqrt(b * b + c__ * 4.));
}
*dlam = d__[2] + tau;
delta[1] = -z__[1] / (del + tau);
delta[2] = -z__[2] / tau;
temp = sqrt(delta[1] * delta[1] + delta[2] * delta[2]);
delta[1] /= temp;
delta[2] /= temp;
}
return 0;
/* End OF DLAED5 */
} /* dlaed5_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -