diff --git a/Eigen/src/Core/Dot.h b/Eigen/src/Core/Dot.h index bf28b9d7e..71e7030dc 100644 --- a/Eigen/src/Core/Dot.h +++ b/Eigen/src/Core/Dot.h @@ -143,12 +143,13 @@ struct ei_dot_vec_unroller template::Vectorization, - int Unrolling = ei_dot_traits::Unrolling + int Unrolling = ei_dot_traits::Unrolling, + int Storage = (ei_traits::Flags | ei_traits::Flags) & SparseBit > struct ei_dot_impl; template -struct ei_dot_impl +struct ei_dot_impl { typedef typename Derived1::Scalar Scalar; static Scalar run(const Derived1& v1, const Derived2& v2) @@ -163,12 +164,12 @@ struct ei_dot_impl }; template -struct ei_dot_impl +struct ei_dot_impl : public ei_dot_novec_unroller {}; template -struct ei_dot_impl +struct ei_dot_impl { typedef typename Derived1::Scalar Scalar; typedef typename ei_packet_traits::type PacketScalar; @@ -221,7 +222,7 @@ struct ei_dot_impl }; template -struct ei_dot_impl +struct ei_dot_impl { typedef typename Derived1::Scalar Scalar; typedef typename ei_packet_traits::type PacketScalar; @@ -258,20 +259,15 @@ template typename ei_traits::Scalar MatrixBase::dot(const MatrixBase& other) const { - typedef typename Derived::Nested Nested; - typedef typename OtherDerived::Nested OtherNested; - typedef typename ei_unref::type _Nested; - typedef typename ei_unref::type _OtherNested; - - EIGEN_STATIC_ASSERT_VECTOR_ONLY(_Nested) - EIGEN_STATIC_ASSERT_VECTOR_ONLY(_OtherNested) - EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(_Nested,_OtherNested) + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) + EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) EIGEN_STATIC_ASSERT((ei_is_same_type::ret), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) ei_assert(size() == other.size()); - return ei_dot_impl<_Nested, _OtherNested>::run(derived(), other.derived()); + return ei_dot_impl::run(derived(), other.derived()); } /** \returns the squared norm of *this, i.e. the dot product of *this with itself. @@ -287,7 +283,7 @@ MatrixBase::dot(const MatrixBase& other) const template EIGEN_DEPRECATED inline typename NumTraits::Scalar>::Real MatrixBase::norm2() const { - return ei_real(dot(*this)); + return ei_real((*this).cwise().abs2().sum()); } /** \returns the squared norm of *this, i.e. the dot product of *this with itself. @@ -299,7 +295,7 @@ EIGEN_DEPRECATED inline typename NumTraits::Scalar>: template inline typename NumTraits::Scalar>::Real MatrixBase::squaredNorm() const { - return ei_real(dot(*this)); + return ei_real((*this).cwise().abs2().sum()); } /** \returns the \em l2 norm of *this, i.e. the square root of the dot product of *this with itself. diff --git a/Eigen/src/Core/Sum.h b/Eigen/src/Core/Sum.h index 45ef62205..33aa60956 100644 --- a/Eigen/src/Core/Sum.h +++ b/Eigen/src/Core/Sum.h @@ -42,7 +42,6 @@ public: enum { Vectorization = (int(Derived::Flags)&ActualPacketAccessBit) && (int(Derived::Flags)&LinearAccessBit) - && (int(Derived::SizeAtCompileTime)>2*PacketSize) ? LinearVectorization : NoVectorization }; @@ -155,12 +154,13 @@ struct ei_sum_vec_unroller template::Vectorization, - int Unrolling = ei_sum_traits::Unrolling + int Unrolling = ei_sum_traits::Unrolling, + int Storage = ei_traits::Flags & SparseBit > struct ei_sum_impl; template -struct ei_sum_impl +struct ei_sum_impl { typedef typename Derived::Scalar Scalar; static Scalar run(const Derived& mat) @@ -178,12 +178,12 @@ struct ei_sum_impl }; template -struct ei_sum_impl +struct ei_sum_impl : public ei_sum_novec_unroller {}; template -struct ei_sum_impl +struct ei_sum_impl { typedef typename Derived::Scalar Scalar; typedef typename ei_packet_traits::type PacketScalar; @@ -228,7 +228,7 @@ struct ei_sum_impl }; template -struct ei_sum_impl +struct ei_sum_impl { typedef typename Derived::Scalar Scalar; static Scalar run(const Derived& mat) diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index f6e2dcb32..f31304d97 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -73,7 +73,7 @@ inline T* ei_aligned_malloc(size_t size) // and this type has a custom operator new, then we want to honor this operator new! // so when we use C functions to allocate memory, we must be careful to call manually the constructor using // the special placement-new syntax. - return new(void_result) T[size]; + return ::new(void_result) T[size]; } else return new T[size]; // here we really want a new, not a malloc. Justification: if the user uses Eigen on