aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/src/MatrixFunctions
diff options
context:
space:
mode:
authorGravatar Alexey Frunze <afrunze@wavecomp.com>2018-08-31 14:11:10 -0700
committerGravatar Alexey Frunze <afrunze@wavecomp.com>2018-08-31 14:11:10 -0700
commitedeee16a16373dbd86ff0a1129e3d94e3c7e93a7 (patch)
treefad1e32a6ceb5aec69718f03b8fbc0c7db9c15d7 /unsupported/Eigen/src/MatrixFunctions
parentff4e835d6b974ff70bdf12288e58bc073eefe4fb (diff)
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++.
Diffstat (limited to 'unsupported/Eigen/src/MatrixFunctions')
-rw-r--r--unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
index 54037d58d..8aebcd67a 100644
--- a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
+++ b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
@@ -234,12 +234,13 @@ struct matrix_exp_computeUV<MatrixType, float>
template <typename MatrixType>
struct matrix_exp_computeUV<MatrixType, double>
{
+ typedef typename NumTraits<typename traits<MatrixType>::Scalar>::Real RealScalar;
template <typename ArgType>
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<MatrixType, double>
} 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<double>(squarings));
+ MatrixType A = arg.unaryExpr(MatrixExponentialScalingOp<RealScalar>(squarings));
matrix_exp_pade13(A, U, V);
}
}