[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdesupport/eigen2
From: Gael Guennebaud <g.gael () free ! fr>
Date: 2009-01-23 12:26:34
Message-ID: 1232713594.007405.31741.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 915538 by ggael:
fix a few remaining warnings
and fix commainitializer unit test with MSVC
M +17 -5 Eigen/src/Sparse/RandomSetter.h
M +3 -0 test/commainitializer.cpp
M +8 -3 test/sparse.h
M +2 -2 test/sparse_basic.cpp
M +5 -4 test/submatrices.cpp
--- trunk/kdesupport/eigen2/Eigen/src/Sparse/RandomSetter.h #915537:915538
@@ -40,22 +40,34 @@
static void setInvalidKey(Type&, const KeyType&) {}
};
-#ifdef _HASH_MAP
-/** Represents a __gnu_cxx::hash_map
+#ifdef EIGEN_UNORDERED_MAP_SUPPORT
+/** Represents a std::unordered_map
*
+ * To use it you need to both define EIGEN_UNORDERED_MAP_SUPPORT and include the \
unordered_map header file + * yourself making sure that unordered_map is defined in \
the std namespace. + *
+ * For instance, with current version of gcc you can either enable C++0x standard \
(-std=c++0x) or do: + * \code
+ * #include <tr1/unordered_map>
+ * #define EIGEN_UNORDERED_MAP_SUPPORT
+ * namespace std {
+ * using std::tr1::unordered_map;
+ * }
+ * \endcode
+ *
* \see RandomSetter
*/
-template<typename Scalar> struct GnuHashMapTraits
+template<typename Scalar> struct StdUnorderedMapTraits
{
typedef int KeyType;
- typedef __gnu_cxx::hash_map<KeyType,Scalar> Type;
+ typedef std::unordered_map<KeyType,Scalar> Type;
enum {
IsSorted = 0
};
static void setInvalidKey(Type&, const KeyType&) {}
};
-#endif
+#endif // EIGEN_UNORDERED_MAP_SUPPORT
#ifdef _DENSE_HASH_MAP_H_
/** Represents a google::dense_hash_map
--- trunk/kdesupport/eigen2/test/commainitializer.cpp #915537:915538
@@ -30,7 +30,10 @@
Matrix4d m4;
VERIFY_RAISES_ASSERT( (m3 << 1, 2, 3, 4, 5, 6, 7, 8) );
+
+ #ifndef _MSC_VER
VERIFY_RAISES_ASSERT( (m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) );
+ #endif
double data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
Matrix3d ref = Map<Matrix<double,3,3,RowMajor> >(data);
--- trunk/kdesupport/eigen2/test/sparse.h #915537:915538
@@ -24,15 +24,20 @@
#ifndef EIGEN_TESTSPARSE_H
-#ifdef __GNUC__
-#include <ext/hash_map>
+#include "main.h"
+
+#if EIGEN_GNUC_AT_LEAST(4,0)
+#include <tr1/unordered_map>
+#define EIGEN_UNORDERED_MAP_SUPPORT
+namespace std {
+ using std::tr1::unordered_map;
+}
#endif
#ifdef EIGEN_GOOGLEHASH_SUPPORT
#include <google/sparse_hash_map>
#endif
-#include "main.h"
#include <Eigen/Cholesky>
#include <Eigen/LU>
#include <Eigen/Sparse>
--- trunk/kdesupport/eigen2/test/sparse_basic.cpp #915537:915538
@@ -167,8 +167,8 @@
// VERIFY_IS_APPROX(m, refMat);
VERIFY(( test_random_setter<RandomSetter<SparseMatrixType, StdMapTraits> \
>(m,refMat,nonzeroCoords) ));
- #ifdef _HASH_MAP
- VERIFY(( test_random_setter<RandomSetter<SparseMatrixType, GnuHashMapTraits> \
>(m,refMat,nonzeroCoords) )); + #ifdef EIGEN_UNORDERED_MAP_SUPPORT
+ VERIFY(( test_random_setter<RandomSetter<SparseMatrixType, \
StdUnorderedMapTraits> >(m,refMat,nonzeroCoords) )); #endif
#ifdef _DENSE_HASH_MAP_H_
VERIFY(( test_random_setter<RandomSetter<SparseMatrixType, \
GoogleDenseHashMapTraits> >(m,refMat,nonzeroCoords) ));
--- trunk/kdesupport/eigen2/test/submatrices.cpp #915537:915538
@@ -57,6 +57,7 @@
Row.h Column.h Block.h Minor.h DiagonalCoeffs.h
*/
typedef typename MatrixType::Scalar Scalar;
+ typedef typename MatrixType::RealScalar RealScalar;
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType;
int rows = m.rows();
@@ -140,11 +141,11 @@
}
// stress some basic stuffs with block matrices
- VERIFY(ones.col(c1).sum() == Scalar(rows));
- VERIFY(ones.row(r1).sum() == Scalar(cols));
+ VERIFY(ei_real(ones.col(c1).sum()) == RealScalar(rows));
+ VERIFY(ei_real(ones.row(r1).sum()) == RealScalar(cols));
- VERIFY(ones.col(c1).dot(ones.col(c2)) == Scalar(rows));
- VERIFY(ones.row(r1).dot(ones.row(r2)) == Scalar(cols));
+ VERIFY(ei_real(ones.col(c1).dot(ones.col(c2))) == RealScalar(rows));
+ VERIFY(ei_real(ones.row(r1).dot(ones.row(r2))) == RealScalar(cols));
}
void test_submatrices()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic