aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hauke Heibel <hauke.heibel@gmail.com>2010-06-15 09:57:41 +0200
committerGravatar Hauke Heibel <hauke.heibel@gmail.com>2010-06-15 09:57:41 +0200
commite5aa6a466b609c07c51c55d929ca6f23201f9724 (patch)
tree826fc69c3beb62b7d04e14d6f4406f69ed857596
parent0afb1e80c7c3c924231cf8da15bf83213b60855b (diff)
Fixed 64bit/Index related warnings in the matrix functions module.
-rw-r--r--unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h16
-rw-r--r--unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h4
-rw-r--r--unsupported/test/matrix_exponential.cpp4
3 files changed, 13 insertions, 11 deletions
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h b/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
index c16341b17..8401363d7 100644
--- a/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
+++ b/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
@@ -39,7 +39,8 @@ class MatrixFunction
{
private:
- typedef typename ei_traits<MatrixType>::Scalar Scalar;
+ typedef typename ei_traits<MatrixType>::Index Index;
+ typedef typename ei_traits<MatrixType>::Scalar Scalar;
typedef typename ei_stem_function<Scalar>::type StemFunction;
public:
@@ -141,6 +142,7 @@ class MatrixFunction<MatrixType, 1>
typedef typename ei_stem_function<Scalar>::type StemFunction;
typedef Matrix<Scalar, Traits::RowsAtCompileTime, 1> VectorType;
typedef Matrix<Index, Traits::RowsAtCompileTime, 1> IntVectorType;
+ typedef Matrix<Index, Traits::RowsAtCompileTime, 1> DynamicIntVectorType;
typedef std::list<Scalar> Cluster;
typedef std::list<Cluster> ListOfClusters;
typedef Matrix<Scalar, Dynamic, Dynamic, Options, RowsAtCompileTime, ColsAtCompileTime> DynMatrixType;
@@ -171,9 +173,9 @@ class MatrixFunction<MatrixType, 1>
MatrixType m_U; /**< \brief Unitary part of Schur decomposition */
MatrixType m_fT; /**< \brief %Matrix function applied to #m_T */
ListOfClusters m_clusters; /**< \brief Partition of eigenvalues into clusters of ei'vals "close" to each other */
- VectorXi m_eivalToCluster; /**< \brief m_eivalToCluster[i] = j means i-th ei'val is in j-th cluster */
- VectorXi m_clusterSize; /**< \brief Number of eigenvalues in each clusters */
- VectorXi m_blockStart; /**< \brief Row index at which block corresponding to i-th cluster starts */
+ DynamicIntVectorType m_eivalToCluster; /**< \brief m_eivalToCluster[i] = j means i-th ei'val is in j-th cluster */
+ DynamicIntVectorType m_clusterSize; /**< \brief Number of eigenvalues in each clusters */
+ DynamicIntVectorType m_blockStart; /**< \brief Row index at which block corresponding to i-th cluster starts */
IntVectorType m_permutation; /**< \brief Permutation which groups ei'vals in the same cluster together */
/** \brief Maximum distance allowed between eigenvalues to be considered "close".
@@ -302,8 +304,8 @@ void MatrixFunction<MatrixType,1>::computeClusterSize()
for (typename ListOfClusters::const_iterator cluster = m_clusters.begin(); cluster != m_clusters.end(); ++cluster) {
for (Index i = 0; i < diag.rows(); ++i) {
if (std::find(cluster->begin(), cluster->end(), diag(i)) != cluster->end()) {
- ++m_clusterSize[clusterIndex];
- m_eivalToCluster[i] = clusterIndex;
+ ++m_clusterSize[clusterIndex];
+ m_eivalToCluster[i] = clusterIndex;
}
}
++clusterIndex;
@@ -325,7 +327,7 @@ void MatrixFunction<MatrixType,1>::computeBlockStart()
template <typename MatrixType>
void MatrixFunction<MatrixType,1>::constructPermutation()
{
- VectorXi indexNextEntry = m_blockStart;
+ DynamicIntVectorType indexNextEntry = m_blockStart;
m_permutation.resize(m_T.rows());
for (Index i = 0; i < m_T.rows(); i++) {
Index cluster = m_eivalToCluster[i];
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h b/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h
index b578c1301..ceb0a84f1 100644
--- a/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h
+++ b/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h
@@ -92,7 +92,7 @@ MatrixType MatrixFunctionAtomic<MatrixType>::compute(const MatrixType& A)
MatrixType P = m_Ashifted;
MatrixType Fincr;
for (Index s = 1; s < 1.1 * m_Arows + 10; s++) { // upper limit is fairly arbitrary
- Fincr = m_f(m_avgEival, s) * P;
+ Fincr = m_f(m_avgEival, static_cast<int>(s)) * P;
F += Fincr;
P = Scalar(RealScalar(1.0/(s + 1))) * P * m_Ashifted;
if (taylorConverged(s, F, Fincr, P)) {
@@ -127,7 +127,7 @@ bool MatrixFunctionAtomic<MatrixType>::taylorConverged(Index s, const MatrixType
for (Index r = 0; r < n; r++) {
RealScalar mx = 0;
for (Index i = 0; i < n; i++)
- mx = std::max(mx, std::abs(m_f(m_Ashifted(i, i) + m_avgEival, s+r)));
+ mx = std::max(mx, std::abs(m_f(m_Ashifted(i, i) + m_avgEival, static_cast<int>(s+r))));
if (r != 0)
rfactorial *= RealScalar(r);
delta = std::max(delta, mx / rfactorial);
diff --git a/unsupported/test/matrix_exponential.cpp b/unsupported/test/matrix_exponential.cpp
index 66e52e100..69f2af044 100644
--- a/unsupported/test/matrix_exponential.cpp
+++ b/unsupported/test/matrix_exponential.cpp
@@ -122,8 +122,8 @@ void randomTest(const MatrixType& m, double tol)
/* this test covers the following files:
Inverse.h
*/
- int rows = m.rows();
- int cols = m.cols();
+ MatrixType::Index rows = m.rows();
+ MatrixType::Index cols = m.cols();
MatrixType m1(rows, cols), m2(rows, cols), m3(rows, cols),
identity = MatrixType::Identity(rows, rows);