Address several implicit scalar conversions.

This commit is contained in:
Gael Guennebaud 2016-08-23 18:44:33 +02:00
parent 0a6a50d1b0
commit ea2e968257

View File

@ -501,7 +501,7 @@ ComputationInfo computeFromTridiagonal_impl(DiagType& diag, SubDiagType& subdiag
subdiag[i] = 0; subdiag[i] = 0;
// find the largest unreduced block // find the largest unreduced block
while (end>0 && subdiag[end-1]==0) while (end>0 && subdiag[end-1]==RealScalar(0))
{ {
end--; end--;
} }
@ -569,8 +569,8 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
EIGEN_USING_STD_MATH(atan2) EIGEN_USING_STD_MATH(atan2)
EIGEN_USING_STD_MATH(cos) EIGEN_USING_STD_MATH(cos)
EIGEN_USING_STD_MATH(sin) EIGEN_USING_STD_MATH(sin)
const Scalar s_inv3 = Scalar(1.0)/Scalar(3.0); const Scalar s_inv3 = Scalar(1)/Scalar(3);
const Scalar s_sqrt3 = sqrt(Scalar(3.0)); const Scalar s_sqrt3 = sqrt(Scalar(3));
// The characteristic equation is x^3 - c2*x^2 + c1*x - c0 = 0. The // The characteristic equation is x^3 - c2*x^2 + c1*x - c0 = 0. The
// eigenvalues are the roots to this equation, all guaranteed to be // eigenvalues are the roots to this equation, all guaranteed to be
@ -815,14 +815,14 @@ static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index sta
// RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * sqrt(td*td + e2)); // RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * sqrt(td*td + e2));
// This explain the following, somewhat more complicated, version: // This explain the following, somewhat more complicated, version:
RealScalar mu = diag[end]; RealScalar mu = diag[end];
if(td==0) if(td==RealScalar(0))
mu -= abs(e); mu -= abs(e);
else else
{ {
RealScalar e2 = numext::abs2(subdiag[end-1]); RealScalar e2 = numext::abs2(subdiag[end-1]);
RealScalar h = numext::hypot(td,e); RealScalar h = numext::hypot(td,e);
if(e2==0) mu -= (e / (td + (td>0 ? 1 : -1))) * (e / h); if(e2==RealScalar(0)) mu -= (e / (td + (td>RealScalar(0) ? RealScalar(1) : RealScalar(-1)))) * (e / h);
else mu -= e2 / (td + (td>0 ? h : -h)); else mu -= e2 / (td + (td>RealScalar(0) ? h : -h));
} }
RealScalar x = diag[start] - mu; RealScalar x = diag[start] - mu;