From 63de19c0004933c7b2b1e418292b9f2ae6c138f4 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 30 Jan 2017 13:55:27 +0100 Subject: [PATCH] bug #1380: fix matrix exponential with Map<> --- .../Eigen/src/MatrixFunctions/MatrixExponential.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h index 4bb1852b6..9ad2b9cc8 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h @@ -204,7 +204,8 @@ struct matrix_exp_computeUV template struct matrix_exp_computeUV { - static void run(const MatrixType& arg, MatrixType& U, MatrixType& V, int& squarings) + template + static void run(const ArgType& arg, MatrixType& U, MatrixType& V, int& squarings) { using std::frexp; using std::pow; @@ -227,7 +228,8 @@ struct matrix_exp_computeUV template struct matrix_exp_computeUV { - static void run(const MatrixType& arg, MatrixType& U, MatrixType& V, int& squarings) + template + static void run(const ArgType& arg, MatrixType& U, MatrixType& V, int& squarings) { using std::frexp; using std::pow; @@ -254,7 +256,8 @@ struct matrix_exp_computeUV template struct matrix_exp_computeUV { - static void run(const MatrixType& arg, MatrixType& U, MatrixType& V, int& squarings) + template + static void run(const ArgType& arg, MatrixType& U, MatrixType& V, int& squarings) { #if LDBL_MANT_DIG == 53 // double precision matrix_exp_computeUV::run(arg, U, V, squarings); @@ -351,11 +354,11 @@ void matrix_exp_compute(const MatrixType& arg, ResultType &result) return; } #endif - MatrixType U, V; + typename MatrixType::PlainObject U, V; int squarings; matrix_exp_computeUV::run(arg, U, V, squarings); // Pade approximant is (U+V) / (-U+V) - MatrixType numer = U + V; - MatrixType denom = -U + V; + typename MatrixType::PlainObject numer = U + V; + typename MatrixType::PlainObject denom = -U + V; result = denom.partialPivLu().solve(numer); for (int i=0; i