diff options
author | David H. Bailey <anonymous@invalid.net> | 2011-05-23 11:20:13 +0200 |
---|---|---|
committer | David H. Bailey <anonymous@invalid.net> | 2011-05-23 11:20:13 +0200 |
commit | 074b067624e45c8e9f42f2347509d06d0d437226 (patch) | |
tree | e3c83271afbb175a05970b213aa841075a99cd4f /Eigen/src/Jacobi | |
parent | 7209d6a12610d4682c65a99f12b0d0278fbbe81d (diff) |
fix implicit scalar conversions (needed to support fancy scalar types, see bug #276)
Diffstat (limited to 'Eigen/src/Jacobi')
-rw-r--r-- | Eigen/src/Jacobi/Jacobi.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Eigen/src/Jacobi/Jacobi.h b/Eigen/src/Jacobi/Jacobi.h index fb5a2c717..27058a97e 100644 --- a/Eigen/src/Jacobi/Jacobi.h +++ b/Eigen/src/Jacobi/Jacobi.h @@ -104,9 +104,9 @@ bool JacobiRotation<Scalar>::makeJacobi(RealScalar x, Scalar y, RealScalar z) else { RealScalar tau = (x-z)/(RealScalar(2)*internal::abs(y)); - RealScalar w = internal::sqrt(internal::abs2(tau) + 1); + RealScalar w = internal::sqrt(internal::abs2(tau) + static_cast<RealScalar>(1)); RealScalar t; - if(tau>0) + if(tau>static_cast<RealScalar>(0)) { t = RealScalar(1) / (tau + w); } @@ -114,8 +114,8 @@ bool JacobiRotation<Scalar>::makeJacobi(RealScalar x, Scalar y, RealScalar z) { t = RealScalar(1) / (tau - w); } - RealScalar sign_t = t > 0 ? 1 : -1; - RealScalar n = RealScalar(1) / internal::sqrt(internal::abs2(t)+1); + RealScalar sign_t = t > static_cast<RealScalar>(0) ? static_cast<RealScalar>(1) : static_cast<RealScalar>(-1); + RealScalar n = RealScalar(1) / internal::sqrt(internal::abs2(t)+static_cast<RealScalar>(1)); m_s = - sign_t * (internal::conj(y) / internal::abs(y)) * internal::abs(t) * n; m_c = n; return true; @@ -221,15 +221,15 @@ template<typename Scalar> void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::false_type) { - if(q==0) + if(q==static_cast<Scalar>(0)) { m_c = p<Scalar(0) ? Scalar(-1) : Scalar(1); - m_s = 0; + m_s = Scalar(0); if(r) *r = internal::abs(p); } - else if(p==0) + else if(p==static_cast<Scalar>(0)) { - m_c = 0; + m_c = Scalar(0); m_s = q<Scalar(0) ? Scalar(1) : Scalar(-1); if(r) *r = internal::abs(q); } |