aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/src/MatrixFunctions
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-05-07 18:11:49 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-05-07 18:11:49 +0000
commit159ab4a043cb82642a589a6c833d26e55d355a54 (patch)
tree82dfa9969c75f8883e42280888003387d6639f98 /unsupported/Eigen/src/MatrixFunctions
parent7080282a6ddb965ed1516ccc51f2605cd8fc2026 (diff)
CREDIT Hauke Heibel, windows compatibility fixes in MatrixExponential
Diffstat (limited to 'unsupported/Eigen/src/MatrixFunctions')
-rw-r--r--unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
index deb455f47..bc1bcceb2 100644
--- a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
+++ b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
@@ -25,6 +25,10 @@
#ifndef EIGEN_MATRIX_EXPONENTIAL
#define EIGEN_MATRIX_EXPONENTIAL
+#ifdef _MSC_VER
+template <typename Scalar> Scalar log2(Scalar v) { return std::log(v)/std::log(Scalar(2)); }
+#endif
+
/** Compute the matrix exponential.
*
* \param M matrix whose exponential is to be computed.
@@ -131,7 +135,7 @@ void ei_matrix_exponential(const MatrixBase<Derived> &M, typename ei_plain_matri
squarings = std::max(0, (int)ceil(log2(l1norm / maxnorm)));
PlainMatrixType A, A2, A4, A6;
- A = M / pow(2, squarings);
+ A = M / pow(Scalar(2), squarings);
A2 = (A * A).lazy();
A4 = (A2 * A2).lazy();
A6 = (A4 * A2).lazy();