diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index 17d2f2836..3cd7edfd6 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -25,6 +25,12 @@ #ifndef EIGEN_MATRIX_H #define EIGEN_MATRIX_H +#ifdef EIGEN_INITIALIZE_MATRICES_BY_ZERO +# define EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED setZero(); +#else +# define EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED +#endif + template (Derived::IsVectorAtCompileTime)> struct ei_conservative_resize_like_impl; /** \class Matrix @@ -427,13 +433,14 @@ class Matrix EIGEN_STRONG_INLINE explicit Matrix() : m_storage() { _check_template_params(); + EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED } #ifndef EIGEN_PARSED_BY_DOXYGEN /** \internal */ Matrix(ei_constructor_without_unaligned_array_assert) : m_storage(ei_constructor_without_unaligned_array_assert()) - { _check_template_params(); } + { _check_template_params(); EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED } #endif /** Constructs a vector or row-vector with given dimension. \only_for_vectors @@ -449,6 +456,7 @@ class Matrix EIGEN_STATIC_ASSERT_VECTOR_ONLY(Matrix) ei_assert(dim > 0); ei_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim); + EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED } #ifndef EIGEN_PARSED_BY_DOXYGEN @@ -692,6 +700,7 @@ class Matrix ei_assert(rows > 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) && cols > 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); m_storage.resize(rows*cols,rows,cols); + EIGEN_INITIALIZE_BY_ZERO_IF_THAT_OPTION_IS_ENABLED } template EIGEN_STRONG_INLINE void _init2(const Scalar& x, const Scalar& y, typename ei_enable_if::type* = 0) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index e373d3188..2d40e32ae 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,4 +1,3 @@ -configure_file(maketests.in ${CMAKE_BINARY_DIR}/maketests) configure_file(mctestr.in ${CMAKE_BINARY_DIR}/mctestr) configure_file(debug.in ${CMAKE_BINARY_DIR}/debug) configure_file(release.in ${CMAKE_BINARY_DIR}/release) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d0938302f..5cea1a582 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -162,3 +162,5 @@ if(CMAKE_COMPILER_IS_GNUCXX) endif(CMAKE_COMPILER_IS_GNUCXX) ei_add_property(EIGEN_TESTING_SUMMARY "CXX_FLAGS: ${CMAKE_CXX_FLAGS}\n") ei_add_property(EIGEN_TESTING_SUMMARY "Sparse lib flags: ${SPARSE_LIBS}\n") + +configure_file(maketests.in ${CMAKE_BINARY_DIR}/maketests) diff --git a/scripts/maketests.in b/test/maketests.in similarity index 100% rename from scripts/maketests.in rename to test/maketests.in