diff options
Diffstat (limited to 'unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h')
-rw-r--r-- | unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h b/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h index ef91da2da..70a6d30c3 100644 --- a/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h +++ b/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h @@ -8,7 +8,7 @@ void ei_r1mpyq(int m, int n, Scalar *a, int /* Local variables */ int i, j, nm1, nmj; - Scalar cos__, sin__, temp; + Scalar cos__=0., sin__=0., temp; /* Parameter adjustments */ --w; @@ -18,28 +18,18 @@ void ei_r1mpyq(int m, int n, Scalar *a, int a -= a_offset; /* Function Body */ - - /* apply the first set of givens rotations to a. */ - nm1 = n - 1; - if (nm1 < 1) { - /* goto L50; */ + if (nm1 < 1) return; - } + + /* apply the first set of givens rotations to a. */ for (nmj = 1; nmj <= nm1; ++nmj) { j = n - nmj; if (ei_abs(v[j]) > 1.) { cos__ = 1. / v[j]; - } - if (ei_abs(v[j]) > 1.) { - /* Computing 2nd power */ sin__ = ei_sqrt(1. - ei_abs2(cos__)); - } - if (ei_abs(v[j]) <= 1.) { + } else { sin__ = v[j]; - } - if (ei_abs(v[j]) <= 1.) { - /* Computing 2nd power */ cos__ = ei_sqrt(1. - ei_abs2(sin__)); } for (i = 1; i <= m; ++i) { @@ -47,26 +37,15 @@ void ei_r1mpyq(int m, int n, Scalar *a, int a[i + n * a_dim1] = sin__ * a[i + j * a_dim1] + cos__ * a[ i + n * a_dim1]; a[i + j * a_dim1] = temp; - /* L10: */ } - /* L20: */ } - /* apply the second set of givens rotations to a. */ - for (j = 1; j <= nm1; ++j) { if (ei_abs(w[j]) > 1.) { cos__ = 1. / w[j]; - } - if (ei_abs(w[j]) > 1.) { - /* Computing 2nd power */ sin__ = ei_sqrt(1. - ei_abs2(cos__)); - } - if (ei_abs(w[j]) <= 1.) { + } else { sin__ = w[j]; - } - if (ei_abs(w[j]) <= 1.) { - /* Computing 2nd power */ cos__ = ei_sqrt(1. - ei_abs2(sin__)); } for (i = 1; i <= m; ++i) { @@ -74,14 +53,8 @@ void ei_r1mpyq(int m, int n, Scalar *a, int a[i + n * a_dim1] = -sin__ * a[i + j * a_dim1] + cos__ * a[ i + n * a_dim1]; a[i + j * a_dim1] = temp; - /* L30: */ } - /* L40: */ } - /* L50: */ return; - - /* last card of subroutine r1mpyq. */ - } /* r1mpyq_ */ |