From af3656d4cafd09223f459ab45c9ccd88dc4c07dd Mon Sep 17 00:00:00 2001 From: Alexey Frunze Date: Fri, 31 Aug 2018 14:11:10 -0700 Subject: [PATCH] Fix build failures in matrix_power and matrix_exponential tests. This fixes the static assertion complaining about double being used in place of long double. This happened on MIPS32, where double and long double have the same type representation. This can be simulated on x86 as well if we pass -mlong-double-64 to g++. (grafted from edeee16a16373dbd86ff0a1129e3d94e3c7e93a7 ) --- unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h index 85ab3d97c..e5ebbcf23 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h @@ -234,12 +234,13 @@ struct matrix_exp_computeUV template struct matrix_exp_computeUV { + typedef typename NumTraits::Scalar>::Real RealScalar; template static void run(const ArgType& arg, MatrixType& U, MatrixType& V, int& squarings) { using std::frexp; using std::pow; - const double l1norm = arg.cwiseAbs().colwise().sum().maxCoeff(); + const RealScalar l1norm = arg.cwiseAbs().colwise().sum().maxCoeff(); squarings = 0; if (l1norm < 1.495585217958292e-002) { matrix_exp_pade3(arg, U, V); @@ -250,10 +251,10 @@ struct matrix_exp_computeUV } else if (l1norm < 2.097847961257068e+000) { matrix_exp_pade9(arg, U, V); } else { - const double maxnorm = 5.371920351148152; + const RealScalar maxnorm = 5.371920351148152; frexp(l1norm / maxnorm, &squarings); if (squarings < 0) squarings = 0; - MatrixType A = arg.unaryExpr(MatrixExponentialScalingOp(squarings)); + MatrixType A = arg.unaryExpr(MatrixExponentialScalingOp(squarings)); matrix_exp_pade13(A, U, V); } }