22 int mneigen(
double*
a,
unsigned int ndima,
unsigned int n,
unsigned int mits,
23 double* work,
double precis) {
27 unsigned int a_dim1, a_offset, i__1, i__2, i__3;
31 double b, c__,
f, h__;
32 unsigned int i__, j, k,
l,
m = 0;
34 unsigned int i0, i1, j1, m1, n1;
35 double hh, gl, pr,
pt;
41 a_offset = 1 + a_dim1 * 1;
50 for (i1 = 2; i1 <= i__1; ++i1) {
52 f = a[i__ + (i__ - 1) * a_dim1];
60 for (k = 1; k <= i__2; ++k) {
62 r__1 = a[i__ + k * a_dim1];
68 h__ = gl + r__1 * r__1;
70 if (gl > (
double)1e-35) {
82 if (f >= (
double)0.) {
88 a[i__ + (i__ - 1) * a_dim1] = f - gl;
91 for (j = 1; j <= i__2; ++j) {
92 a[j + i__ * a_dim1] = a[i__ + j * a_dim1] / h__;
95 for (k = 1; k <= i__3; ++k) {
96 gl += a[j + k * a_dim1] * a[i__ + k * a_dim1];
105 for (k = j1; k <= i__3; ++k) {
106 gl += a[k + j * a_dim1] * a[i__ + k * a_dim1];
109 work[n + j] = gl / h__;
110 f += gl * a[j + i__ * a_dim1];
112 hh = f / (h__ + h__);
114 for (j = 1; j <= i__2; ++j) {
115 f = a[i__ + j * a_dim1];
116 gl = work[n + j] - hh *
f;
119 for (k = 1; k <= i__3; ++k) {
120 a[j + k * a_dim1] = a[j + k * a_dim1] - f * work[n + k] - gl
121 * a[i__ + k * a_dim1];
131 for (i__ = 1; i__ <= i__1; ++i__) {
134 if (work[i__] == (
double)0. || l == 0) {
139 for (j = 1; j <= i__3; ++j) {
142 for (k = 1; k <= i__2; ++k) {
143 gl += a[i__ + k * a_dim1] * a[k + j * a_dim1];
146 for (k = 1; k <= i__2; ++k) {
147 a[k + j * a_dim1] -= gl * a[k + i__ * a_dim1];
151 work[i__] = a[i__ + i__ * a_dim1];
152 a[i__ + i__ * a_dim1] = (
double)1.;
159 for (j = 1; j <= i__2; ++j) {
160 a[i__ + j * a_dim1] = (
double)0.;
161 a[j + i__ * a_dim1] = (
double)0.;
170 for (i__ = 2; i__ <= i__1; ++i__) {
172 work[i0] = work[i0 + 1];
178 for (l = 1; l <= i__1; ++
l) {
180 h__ = precis * ((r__1 = work[
l],
fabs(r__1)) + (r__2 = work[n + l],
188 for (m1 = l; m1 <= i__2; ++m1) {
191 if ((r__1 = work[n + m],
fabs(r__1)) <= b) {
208 pt = (work[l + 1] - work[
l]) / (work[n + l] * (
double)2.);
209 r__ =
sqrt(pt * pt + (
double)1.);
212 if (pt < (
double)0.) {
216 h__ = work[
l] - work[n +
l] / pr;
218 for (i__ = l; i__ <= i__2; ++i__) {
228 for (i1 = l; i1 <= i__2; ++i1) {
231 gl = c__ * work[n + i__];
234 if (
fabs(pt) >= (r__1 = work[n + i__],
fabs(r__1))) {
238 c__ = pt / work[n + i__];
239 r__ =
sqrt(c__ * c__ + (
double)1.);
240 work[n + j] = s * work[n + i__] * r__;
245 c__ = work[n + i__] /
pt;
246 r__ =
sqrt(c__ * c__ + (
double)1.);
247 work[n + j] = s * pt * r__;
251 pt = c__ * work[i__] - s * gl;
252 work[j] = h__ + s * (c__ * gl + s * work[i__]);
254 for (k = 1; k <= i__3; ++k) {
255 h__ = a[k + j * a_dim1];
256 a[k + j * a_dim1] = s * a[k + i__ * a_dim1] + c__ * h__;
257 a[k + i__ * a_dim1] = c__ * a[k + i__ * a_dim1] - s * h__;
260 work[n +
l] = s *
pt;
263 if ((r__1 = work[n + l],
fabs(r__1)) > b) {
271 for (i__ = 1; i__ <= i__1; ++i__) {
276 for (j = i1; j <= i__3; ++j) {
295 for (j = 1; j <= i__3; ++j) {
296 pt = a[j + i__ * a_dim1];
297 a[j + i__ * a_dim1] = a[j + k * a_dim1];
298 a[j + k * a_dim1] =
pt;
int mneigen(double *, unsigned int, unsigned int, unsigned int, double *, double)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)