9 int qrevec(
double *ev,
double *evec,
double *dp,
int n)
11 double cc, sc = 0.0, d,
x, y, h, tzr = 1.e-15;
13 int i, j, k, m, mqr = 8 * n;
17 for (j = 0, m = n - 1;; ++j) {
22 if (fabs(dp[k]) <= fabs(ev[m]) * tzr)
25 x = (ev[k] - ev[m]) / 2.;
26 h = sqrt(
x *
x + dp[k] * dp[k]);
27 if (m > 1 && fabs(dp[m - 2]) > fabs(ev[k]) * tzr)
29 if ((cc = sqrt((1. +
x / h) / 2.)) != 0.)
30 sc = dp[k] / (2. * cc * h);
36 for (i = 0, p = evec + n * (m + 1); i < n; ++i, ++p) {
38 p[0] = cc * h + sc * p[n];
39 p[n] = cc * p[n] - sc * h;
52 for (k = 0; k < m; ++k) {
55 h = sqrt(
x *
x + dp[k] * dp[k]);
63 ev[k] = cc * (ev[k] + y) + ev[k + 1] * sc * sc + d;
64 for (i = 0, p = evec + n * k; i < n; ++i, ++p) {
66 p[0] = cc * h + sc * p[n];
67 p[n] = cc * p[n] - sc * h;
70 ev[k] = ev[k] * cc - y;
71 dp[k - 1] = ev[k] * sc;
72 ev[k] = ev[k] * cc + d;
int qrevec(double *ev, double *evec, double *dp, int n)