diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index 5932a9093..9d89b60cf 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h @@ -355,7 +355,7 @@ class BlockImpl_dense */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE BlockImpl_dense(XprType& xpr, Index i) - : Base(add_to_nullable_pointer(xpr.data(), + : Base((BlockRows == 0 || BlockCols == 0) ? NULL : add_to_nullable_pointer(xpr.data(), i * ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && (!XprTypeIsRowMajor)) || ((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && ( XprTypeIsRowMajor)) ? xpr.innerStride() : xpr.outerStride())), BlockRows==1 ? 1 : xpr.rows(), @@ -371,7 +371,7 @@ class BlockImpl_dense */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE BlockImpl_dense(XprType& xpr, Index startRow, Index startCol) - : Base(add_to_nullable_pointer(xpr.data(), + : Base((BlockRows == 0 || BlockCols == 0) ? NULL : add_to_nullable_pointer(xpr.data(), xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) + xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol))), m_xpr(xpr), m_startRow(startRow), m_startCol(startCol) { @@ -384,7 +384,7 @@ class BlockImpl_dense BlockImpl_dense(XprType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) - : Base(add_to_nullable_pointer(xpr.data(), + : Base((blockRows == 0 || blockCols == 0) ? NULL : add_to_nullable_pointer(xpr.data(), xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) + xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol)), blockRows, blockCols), m_xpr(xpr), m_startRow(startRow), m_startCol(startCol) diff --git a/Eigen/src/Core/StlIterators.h b/Eigen/src/Core/StlIterators.h index 5db3f605b..09041db1d 100644 --- a/Eigen/src/Core/StlIterators.h +++ b/Eigen/src/Core/StlIterators.h @@ -196,7 +196,6 @@ public: pointer_based_stl_iterator() EIGEN_NO_THROW : m_ptr(0) {} pointer_based_stl_iterator(XprType& xpr, Index index) EIGEN_NO_THROW : m_incr(xpr.innerStride()) { - eigen_assert(xpr.data() != NULL || index == 0 || m_incr.value() == 0); m_ptr = xpr.data() + index * m_incr.value(); } diff --git a/Eigen/src/SVD/UpperBidiagonalization.h b/Eigen/src/SVD/UpperBidiagonalization.h index 5afebef9e..a5b2f60d2 100644 --- a/Eigen/src/SVD/UpperBidiagonalization.h +++ b/Eigen/src/SVD/UpperBidiagonalization.h @@ -161,7 +161,8 @@ void upperbidiagonalization_blocked_helper(MatrixType& A, typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename NumTraits::Literal Literal; - enum { StorageOrder = (traits::Flags & RowMajorBit) ? RowMajor : ColMajor }; + static const int StorageOrder = + (traits::Flags & RowMajorBit) ? RowMajor : ColMajor; typedef InnerStride ColInnerStride; typedef InnerStride RowInnerStride; typedef Ref, 0, ColInnerStride> SubColumnType; diff --git a/test/AnnoyingScalar.h b/test/AnnoyingScalar.h index 7ace083c5..b62188727 100644 --- a/test/AnnoyingScalar.h +++ b/test/AnnoyingScalar.h @@ -126,7 +126,7 @@ template<> struct NumTraits : NumTraits { enum { - RequireInitialization = 1, + RequireInitialization = 1 }; typedef AnnoyingScalar Real; typedef AnnoyingScalar Nested; diff --git a/test/block.cpp b/test/block.cpp index 84124aba6..667a3be39 100644 --- a/test/block.cpp +++ b/test/block.cpp @@ -143,11 +143,12 @@ template void block(const MatrixType& m) // check that linear acccessors works on blocks m1 = m1_copy; - if((MatrixType::Flags&RowMajorBit)==0) - VERIFY_IS_EQUAL(m1.leftCols(c1).coeff(r1+c1*rows), m1(r1,c1)); - else - VERIFY_IS_EQUAL(m1.topRows(r1).coeff(c1+r1*cols), m1(r1,c1)); - + if (c1 > 0 && r1 > 0) { + if ((MatrixType::Flags & RowMajorBit) == 0) + VERIFY_IS_EQUAL(m1.leftCols(c1).coeff(r1 + c1 * rows), m1(r1, c1)); + else + VERIFY_IS_EQUAL(m1.topRows(r1).coeff(c1 + r1 * cols), m1(r1, c1)); + } // now test some block-inside-of-block. diff --git a/test/stdlist_overload.cpp b/test/stdlist_overload.cpp index a78516e24..843e28c3c 100644 --- a/test/stdlist_overload.cpp +++ b/test/stdlist_overload.cpp @@ -63,7 +63,7 @@ void check_stdlist_matrix(const MatrixType& m) ++itw; } - v.resize(21); + v.resize(21, MatrixType::Zero(rows, cols)); set(v, 20, x); VERIFY_IS_APPROX(*get(v, 20), x); v.resize(22,y); diff --git a/test/stdvector.cpp b/test/stdvector.cpp index 18de240c6..9c023d656 100644 --- a/test/stdvector.cpp +++ b/test/stdvector.cpp @@ -52,7 +52,7 @@ void check_stdvector_transform(const TransformType&) { typedef typename TransformType::MatrixType MatrixType; TransformType x(MatrixType::Random()), y(MatrixType::Random()); - std::vector > v(10), w(20, y); + std::vector > v(10, TransformType(MatrixType::Zero())), w(20, y); v[5] = x; w[6] = v[5]; VERIFY_IS_APPROX(w[6], v[5]); @@ -124,7 +124,7 @@ void std_vector_gcc_warning() { typedef Eigen::Vector3f T; std::vector > v; - v.push_back(T()); + v.push_back(T::Zero()); } EIGEN_DECLARE_TEST(stdvector) diff --git a/test/vectorization_logic.cpp b/test/vectorization_logic.cpp index b5464992e..19375191d 100644 --- a/test/vectorization_logic.cpp +++ b/test/vectorization_logic.cpp @@ -280,8 +280,8 @@ struct vectorization_logic_half // EIGEN_UNALIGNED_VECTORIZE is 0 (the matrix is assumed unaligned). // Adjust the matrix sizes to account for these alignment issues. enum { PacketBytes = sizeof(Scalar)*PacketSize }; - enum { MinVSize = EIGEN_UNALIGNED_VECTORIZE ? PacketSize - : PacketBytes >= EIGEN_MIN_ALIGN_BYTES ? PacketSize + enum { MinVSize = EIGEN_UNALIGNED_VECTORIZE ? int(PacketSize) + : int(PacketBytes) >= EIGEN_MIN_ALIGN_BYTES ? int(PacketSize) : (EIGEN_MIN_ALIGN_BYTES + sizeof(Scalar) - 1) / sizeof(Scalar) }; typedef Matrix Vector1; diff --git a/unsupported/Eigen/FFT b/unsupported/Eigen/FFT index c8c311a60..72cd52143 100644 --- a/unsupported/Eigen/FFT +++ b/unsupported/Eigen/FFT @@ -162,15 +162,16 @@ class FFT typedef typename impl_type::Scalar Scalar; typedef typename impl_type::Complex Complex; - enum Flag { - Default=0, // goof proof - Unscaled=1, - HalfSpectrum=2, - // SomeOtherSpeedOptimization=4 - Speedy=32767 - }; + typedef int Flag; + static const Flag Default = 0; + static const Flag Unscaled = 1; + static const Flag HalfSpectrum = 2; + static const Flag Speedy = 32767; - FFT( const impl_type & impl=impl_type() , Flag flags=Default ) :m_impl(impl),m_flag(flags) { } + FFT(const impl_type& impl = impl_type(), Flag flags = Default) : m_impl(impl), m_flag(flags) + { + eigen_assert((flags == Default || flags == Unscaled || flags == HalfSpectrum || flags == Speedy) && "invalid flags argument"); + } inline bool HasFlag(Flag f) const { return (m_flag & (int)f) == f;}