aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/src/NonLinear/r1updt.h
diff options
context:
space:
mode:
authorGravatar Thomas Capricelli <orzel@freehackers.org>2009-08-22 07:14:17 +0200
committerGravatar Thomas Capricelli <orzel@freehackers.org>2009-08-22 07:14:17 +0200
commita35586504ed2dae6d0c8ea76471efb52f6d74233 (patch)
tree1dc7ce2b7696ea5a26f4f1507538487846adf3d5 /unsupported/Eigen/src/NonLinear/r1updt.h
parent93fabbff5eca8802f57aeb97545e145357ab955f (diff)
cleaning f2c mess / trivial stuff
Diffstat (limited to 'unsupported/Eigen/src/NonLinear/r1updt.h')
-rw-r--r--unsupported/Eigen/src/NonLinear/r1updt.h64
1 files changed, 21 insertions, 43 deletions
diff --git a/unsupported/Eigen/src/NonLinear/r1updt.h b/unsupported/Eigen/src/NonLinear/r1updt.h
index 8df78321b..947a0e1e3 100644
--- a/unsupported/Eigen/src/NonLinear/r1updt.h
+++ b/unsupported/Eigen/src/NonLinear/r1updt.h
@@ -2,17 +2,8 @@
template <typename Scalar>
void ei_r1updt(int m, int n, Scalar *s, int /* ls */, const Scalar *u, Scalar *v, Scalar *w, int *sing)
{
- /* Initialized data */
-
-#define p5 .5
-#define p25 .25
-
- /* System generated locals */
- int i__1, i__2;
- Scalar d__1, d__2;
-
/* Local variables */
- int i__, j, l, jj, nm1;
+ int i, j, l, jj, nm1;
Scalar tan__;
int nmj;
Scalar cos__, sin__, tau, temp, giant, cotan;
@@ -36,9 +27,8 @@ void ei_r1updt(int m, int n, Scalar *s, int /* ls */, const Scalar *u, Scalar *v
/* move the nontrivial part of the last column of s into w. */
l = jj;
- i__1 = m;
- for (i__ = n; i__ <= i__1; ++i__) {
- w[i__] = s[l];
+ for (i = n; i <= m; ++i) {
+ w[i] = s[l];
++l;
/* L10: */
}
@@ -50,8 +40,7 @@ void ei_r1updt(int m, int n, Scalar *s, int /* ls */, const Scalar *u, Scalar *v
if (nm1 < 1) {
goto L70;
}
- i__1 = nm1;
- for (nmj = 1; nmj <= i__1; ++nmj) {
+ for (nmj = 1; nmj <= nm1; ++nmj) {
j = n - nmj;
jj -= m - j + 1;
w[j] = 0.;
@@ -62,13 +51,11 @@ void ei_r1updt(int m, int n, Scalar *s, int /* ls */, const Scalar *u, Scalar *v
/* determine a givens rotation which eliminates the */
/* j-th element of v. */
- if ((d__1 = v[n], ei_abs(d__1)) >= (d__2 = v[j], ei_abs(d__2))) {
+ if (ei_abs(v[n]) >= ei_abs(v[j]))
goto L20;
- }
cotan = v[n] / v[j];
/* Computing 2nd power */
- d__1 = cotan;
- sin__ = p5 / ei_sqrt(p25 + p25 * (d__1 * d__1));
+ sin__ = Scalar(.5) / ei_sqrt(Scalar(0.25) + Scalar(0.25) * ei_abs2(cotan));
cos__ = sin__ * cotan;
tau = 1.;
if (ei_abs(cos__) * giant > 1.) {
@@ -78,8 +65,7 @@ void ei_r1updt(int m, int n, Scalar *s, int /* ls */, const Scalar *u, Scalar *v
L20:
tan__ = v[j] / v[n];
/* Computing 2nd power */
- d__1 = tan__;
- cos__ = p5 / ei_sqrt(p25 + p25 * (d__1 * d__1));
+ cos__ = Scalar(.5) / ei_sqrt(Scalar(0.25) + Scalar(0.25) * ei_abs2(tan__));
sin__ = cos__ * tan__;
tau = sin__;
L30:
@@ -93,10 +79,9 @@ L30:
/* apply the transformation to s and extend the spike in w. */
l = jj;
- i__2 = m;
- for (i__ = j; i__ <= i__2; ++i__) {
- temp = cos__ * s[l] - sin__ * w[i__];
- w[i__] = sin__ * s[l] + cos__ * w[i__];
+ for (i = j; i <= m; ++i) {
+ temp = cos__ * s[l] - sin__ * w[i];
+ w[i] = sin__ * s[l] + cos__ * w[i];
s[l] = temp;
++l;
/* L40: */
@@ -109,9 +94,8 @@ L70:
/* add the spike from the rank 1 update to w. */
- i__1 = m;
- for (i__ = 1; i__ <= i__1; ++i__) {
- w[i__] += v[n] * u[i__];
+ for (i = 1; i <= m; ++i) {
+ w[i] += v[n] * u[i];
/* L80: */
}
@@ -121,8 +105,7 @@ L70:
if (nm1 < 1) {
goto L140;
}
- i__1 = nm1;
- for (j = 1; j <= i__1; ++j) {
+ for (j = 1; j <= nm1; ++j) {
if (w[j] == 0.) {
goto L120;
}
@@ -130,13 +113,11 @@ L70:
/* determine a givens rotation which eliminates the */
/* j-th element of the spike. */
- if ((d__1 = s[jj], ei_abs(d__1)) >= (d__2 = w[j], ei_abs(d__2))) {
+ if (ei_abs(s[jj]) >= ei_abs(w[j]))
goto L90;
- }
cotan = s[jj] / w[j];
/* Computing 2nd power */
- d__1 = cotan;
- sin__ = p5 / ei_sqrt(p25 + p25 * (d__1 * d__1));
+ sin__ = Scalar(.5) / ei_sqrt(Scalar(0.25) + Scalar(0.25) * ei_abs2(cotan));
cos__ = sin__ * cotan;
tau = 1.;
if (ei_abs(cos__) * giant > 1.) {
@@ -146,8 +127,7 @@ L70:
L90:
tan__ = w[j] / s[jj];
/* Computing 2nd power */
- d__1 = tan__;
- cos__ = p5 / ei_sqrt(p25 + p25 * (d__1 * d__1));
+ cos__ = Scalar(.5) / ei_sqrt(Scalar(0.25) + Scalar(0.25) * ei_abs2(tan__));
sin__ = cos__ * tan__;
tau = sin__;
L100:
@@ -155,10 +135,9 @@ L100:
/* apply the transformation to s and reduce the spike in w. */
l = jj;
- i__2 = m;
- for (i__ = j; i__ <= i__2; ++i__) {
- temp = cos__ * s[l] + sin__ * w[i__];
- w[i__] = -sin__ * s[l] + cos__ * w[i__];
+ for (i = j; i <= m; ++i) {
+ temp = cos__ * s[l] + sin__ * w[i];
+ w[i] = -sin__ * s[l] + cos__ * w[i];
s[l] = temp;
++l;
/* L110: */
@@ -183,9 +162,8 @@ L140:
/* move w back into the last column of the output s. */
l = jj;
- i__1 = m;
- for (i__ = n; i__ <= i__1; ++i__) {
- s[l] = w[i__];
+ for (i = n; i <= m; ++i) {
+ s[l] = w[i];
++l;
/* L150: */
}