No public description PiperOrigin-RevId: 828189485 Change-Id: I2b46aabcbe0e77cda4cf3a65040b32af9e7d2763
diff --git a/Eigen/src/Core/CwiseNullaryOp.h b/Eigen/src/Core/CwiseNullaryOp.h index 084f503..e4c5fed 100644 --- a/Eigen/src/Core/CwiseNullaryOp.h +++ b/Eigen/src/Core/CwiseNullaryOp.h
@@ -94,7 +94,7 @@ * the returned matrix. Must be compatible with this MatrixBase type. * * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, - * it is redundant to pass \a rows and \a cols as arguments, so NullaryExpr(const CustomNullaryOp&) should be used + * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used * instead. * * The template parameter \a CustomNullaryOp is the type of the functor. @@ -121,7 +121,7 @@ * \only_for_vectors * * This variant is meant to be used for dynamic-size vector types. For fixed-size types, - * it is redundant to pass \a size as argument, so NullaryExpr(const CustomNullaryOp&) should be used + * it is redundant to pass \a size as argument, so Zero() should be used * instead. * * The template parameter \a CustomNullaryOp is the type of the functor. @@ -174,7 +174,7 @@ * the returned matrix. Must be compatible with this DenseBase type. * * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, - * it is redundant to pass \a rows and \a cols as arguments, so Constant(const Scalar&) should be used + * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used * instead. * * The template parameter \a CustomNullaryOp is the type of the functor. @@ -195,7 +195,7 @@ * \only_for_vectors * * This variant is meant to be used for dynamic-size vector types. For fixed-size types, - * it is redundant to pass \a size as argument, so Constant(const Scalar&) should be used + * it is redundant to pass \a size as argument, so Zero() should be used * instead. * * The template parameter \a CustomNullaryOp is the type of the functor.
diff --git a/Eigen/src/Core/DenseCoeffsBase.h b/Eigen/src/Core/DenseCoeffsBase.h index 86683fe..377df57 100644 --- a/Eigen/src/Core/DenseCoeffsBase.h +++ b/Eigen/src/Core/DenseCoeffsBase.h
@@ -113,16 +113,6 @@ return coeff(row, col); } -#if __cpp_multidimensional_subscript >= 202110L - /** \returns the coefficient at given the given row and column. - * - * \sa operator[](Index,Index), operator[](Index) - */ - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr CoeffReturnType operator[](Index row, Index col) const { - return operator()(row, col); - } -#endif - /** Short version: don't use this function, use * \link operator[](Index) const \endlink instead. * @@ -326,21 +316,12 @@ * * \sa operator[](Index) */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& operator()(Index row, Index col) { eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); return coeffRef(row, col); } -#if __cpp_multidimensional_subscript >= 202110L - /** \returns a reference to the coefficient at given the given row and column. - * - * \sa operator[](Index) - */ - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Scalar& operator[](Index row, Index col) { - return operator()(row, col); - } -#endif - /** Short version: don't use this function, use * \link operator[](Index) \endlink instead. *
diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index 5c8bbce..64e1123 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h
@@ -63,6 +63,7 @@ HasArg = 0, HasAbsDiff = 0, + HasBlend = 0, // This flag is used to indicate whether packet comparison is supported. // pcmp_eq and pcmp_lt should be defined for it to be true. HasCmp = 0, @@ -1481,6 +1482,21 @@ // Nothing to do in the scalar case, i.e. a 1x1 matrix. } +/*************************************************************************** + * Selector, i.e. vector of N boolean values used to select (i.e. blend) + * words from 2 packets. + ***************************************************************************/ +template <size_t N> +struct Selector { + bool select[N]; +}; + +template <typename Packet> +EIGEN_DEVICE_FUNC inline Packet pblend(const Selector<unpacket_traits<Packet>::size>& ifPacket, + const Packet& thenPacket, const Packet& elsePacket) { + return ifPacket.select[0] ? thenPacket : elsePacket; +} + /** \internal \returns 1 / a (coeff-wise) */ template <typename Packet> EIGEN_DEVICE_FUNC inline Packet preciprocal(const Packet& a) {
diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h index 910b504..27ad78e 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h
@@ -89,11 +89,6 @@ return coeffRef(row, col); } -#if __cpp_multidimensional_subscript >= 202110L - EIGEN_DEVICE_FUNC inline Scalar operator[](Index row, Index col) const { return operator()(row, col); } - EIGEN_DEVICE_FUNC inline Scalar& operator[](Index row, Index col) { return operator()(row, col); } -#endif - #ifndef EIGEN_PARSED_BY_DOXYGEN EIGEN_DEVICE_FUNC inline const Derived& derived() const { return *static_cast<const Derived*>(this); } EIGEN_DEVICE_FUNC inline Derived& derived() { return *static_cast<Derived*>(this); }
diff --git a/Eigen/src/Core/arch/AVX/MathFunctions.h b/Eigen/src/Core/arch/AVX/MathFunctions.h index 6c40ff9..5b7285f 100644 --- a/Eigen/src/Core/arch/AVX/MathFunctions.h +++ b/Eigen/src/Core/arch/AVX/MathFunctions.h
@@ -25,8 +25,8 @@ EIGEN_DOUBLE_PACKET_FUNCTION(atanh, Packet4d) EIGEN_DOUBLE_PACKET_FUNCTION(log, Packet4d) -EIGEN_DOUBLE_PACKET_FUNCTION(exp, Packet4d) EIGEN_DOUBLE_PACKET_FUNCTION(log2, Packet4d) +EIGEN_DOUBLE_PACKET_FUNCTION(exp, Packet4d) EIGEN_DOUBLE_PACKET_FUNCTION(tanh, Packet4d) EIGEN_DOUBLE_PACKET_FUNCTION(cbrt, Packet4d) #ifdef EIGEN_VECTORIZE_AVX2 @@ -35,8 +35,6 @@ #endif EIGEN_GENERIC_PACKET_FUNCTION(atan, Packet4d) EIGEN_GENERIC_PACKET_FUNCTION(exp2, Packet4d) -EIGEN_GENERIC_PACKET_FUNCTION(expm1, Packet4d) -EIGEN_GENERIC_PACKET_FUNCTION(log1p, Packet4d) // Notice that for newer processors, it is counterproductive to use Newton // iteration for square root. In particular, Skylake and Zen2 processors
diff --git a/Eigen/src/Core/arch/AVX/PacketMath.h b/Eigen/src/Core/arch/AVX/PacketMath.h index 82caebb..0cd9e6c 100644 --- a/Eigen/src/Core/arch/AVX/PacketMath.h +++ b/Eigen/src/Core/arch/AVX/PacketMath.h
@@ -115,9 +115,9 @@ HasATan = 1, HasATanh = 1, HasLog = 1, - HasExp = 1, HasLog1p = 1, HasExpm1 = 1, + HasExp = 1, HasPow = 1, HasNdtri = 1, HasBessel = 1, @@ -127,6 +127,7 @@ HasTanh = EIGEN_FAST_MATH, HasErf = EIGEN_FAST_MATH, HasErfc = EIGEN_FAST_MATH, + HasBlend = 1 }; }; template <> @@ -145,18 +146,17 @@ HasCos = EIGEN_FAST_MATH, #endif HasTanh = EIGEN_FAST_MATH, + HasLog = 1, HasErf = 1, HasErfc = 1, - HasLog = 1, HasExp = 1, - HasLog1p = 1, - HasExpm1 = 1, HasPow = 1, HasSqrt = 1, HasRsqrt = 1, HasCbrt = 1, HasATan = 1, HasATanh = 1, + HasBlend = 1 }; }; @@ -179,6 +179,7 @@ HasCos = EIGEN_FAST_MATH, HasNegate = 1, HasAbs = 1, + HasAbs2 = 0, HasMin = 1, HasMax = 1, HasConj = 1, @@ -191,6 +192,7 @@ HasRsqrt = 1, HasTanh = EIGEN_FAST_MATH, HasErf = EIGEN_FAST_MATH, + HasBlend = 0, HasBessel = 1, HasNdtri = 1 }; @@ -216,6 +218,7 @@ HasCos = EIGEN_FAST_MATH, HasNegate = 1, HasAbs = 1, + HasAbs2 = 0, HasMin = 1, HasMax = 1, HasConj = 1, @@ -228,6 +231,7 @@ HasRsqrt = 1, HasTanh = EIGEN_FAST_MATH, HasErf = EIGEN_FAST_MATH, + HasBlend = 0, HasBessel = 1, HasNdtri = 1 }; @@ -280,6 +284,7 @@ // HasMin = 0, // HasMax = 0, HasDiv = 0, + HasBlend = 0, HasTranspose = 0, HasNegate = 0, HasSqrt = 0, @@ -2065,6 +2070,31 @@ kernel.packet[2] = _mm256_permute2f128_pd(T1, T3, 49); } +EIGEN_STRONG_INLINE __m256i avx_blend_mask(const Selector<4>& ifPacket) { + return _mm256_set_epi64x(0 - ifPacket.select[3], 0 - ifPacket.select[2], 0 - ifPacket.select[1], + 0 - ifPacket.select[0]); +} + +EIGEN_STRONG_INLINE __m256i avx_blend_mask(const Selector<8>& ifPacket) { + return _mm256_set_epi32(0 - ifPacket.select[7], 0 - ifPacket.select[6], 0 - ifPacket.select[5], + 0 - ifPacket.select[4], 0 - ifPacket.select[3], 0 - ifPacket.select[2], + 0 - ifPacket.select[1], 0 - ifPacket.select[0]); +} + +template <> +EIGEN_STRONG_INLINE Packet8f pblend(const Selector<8>& ifPacket, const Packet8f& thenPacket, + const Packet8f& elsePacket) { + const __m256 true_mask = _mm256_castsi256_ps(avx_blend_mask(ifPacket)); + return pselect<Packet8f>(true_mask, thenPacket, elsePacket); +} + +template <> +EIGEN_STRONG_INLINE Packet4d pblend(const Selector<4>& ifPacket, const Packet4d& thenPacket, + const Packet4d& elsePacket) { + const __m256d true_mask = _mm256_castsi256_pd(avx_blend_mask(ifPacket)); + return pselect<Packet4d>(true_mask, thenPacket, elsePacket); +} + // Packet math for Eigen::half #ifndef EIGEN_VECTORIZE_AVX512FP16 template <> @@ -2801,7 +2831,7 @@ mask <<= CHAR_BIT * count; mask--; mask <<= CHAR_BIT * begin; -#if !EIGEN_ARCH_x86_64 +#if defined(_WIN32) && !defined(_WIN64) return _mm_loadl_epi64(reinterpret_cast<const __m128i*>(&mask)); #else return _mm_cvtsi64_si128(mask); @@ -2817,7 +2847,7 @@ mask <<= (CHAR_BIT / 2) * count; mask--; mask <<= CHAR_BIT * begin; -#if !EIGEN_ARCH_x86_64 +#if defined(_WIN32) && !defined(_WIN64) return _mm_loadl_epi64(reinterpret_cast<const __m128i*>(&mask)); #else return _mm_cvtsi64_si128(mask);
diff --git a/Eigen/src/Core/arch/AVX512/PacketMath.h b/Eigen/src/Core/arch/AVX512/PacketMath.h index b181053..b76c8a7 100644 --- a/Eigen/src/Core/arch/AVX512/PacketMath.h +++ b/Eigen/src/Core/arch/AVX512/PacketMath.h
@@ -84,6 +84,7 @@ HasDiv = 1, HasNegate = 1, HasAbs = 1, + HasAbs2 = 0, HasMin = 1, HasMax = 1, HasConj = 1, @@ -159,8 +160,6 @@ HasCos = EIGEN_FAST_MATH, HasLog = 1, HasExp = 1, - HasLog1p = 1, - HasExpm1 = 1, HasPow = 1, HasATan = 1, HasTanh = EIGEN_FAST_MATH, @@ -2058,6 +2057,27 @@ PACK_OUTPUT_I32_2(kernel.packet, tmp.packet, 3, 1); } +template <size_t N> +EIGEN_STRONG_INLINE int avx512_blend_mask(const Selector<N>& ifPacket) { + alignas(__m128i) uint8_t aux[sizeof(__m128i)]; + for (size_t i = 0; i < N; i++) aux[i] = static_cast<uint8_t>(ifPacket.select[i]); + __m128i paux = _mm_sub_epi8(_mm_setzero_si128(), _mm_load_si128(reinterpret_cast<const __m128i*>(aux))); + return _mm_movemask_epi8(paux); +} + +template <> +EIGEN_STRONG_INLINE Packet16f pblend(const Selector<16>& ifPacket, const Packet16f& thenPacket, + const Packet16f& elsePacket) { + __mmask16 m = avx512_blend_mask(ifPacket); + return _mm512_mask_blend_ps(m, elsePacket, thenPacket); +} +template <> +EIGEN_STRONG_INLINE Packet8d pblend(const Selector<8>& ifPacket, const Packet8d& thenPacket, + const Packet8d& elsePacket) { + __mmask8 m = avx512_blend_mask(ifPacket); + return _mm512_mask_blend_pd(m, elsePacket, thenPacket); +} + // Packet math for Eigen::half #ifndef EIGEN_VECTORIZE_AVX512FP16 template <>
diff --git a/Eigen/src/Core/arch/AVX512/PacketMathFP16.h b/Eigen/src/Core/arch/AVX512/PacketMathFP16.h index b8fa208..a040bbe 100644 --- a/Eigen/src/Core/arch/AVX512/PacketMathFP16.h +++ b/Eigen/src/Core/arch/AVX512/PacketMathFP16.h
@@ -42,6 +42,7 @@ HasDiv = 1, HasNegate = 1, HasAbs = 1, + HasAbs2 = 0, HasMin = 1, HasMax = 1, HasConj = 1,
diff --git a/Eigen/src/Core/arch/AltiVec/Complex.h b/Eigen/src/Core/arch/AltiVec/Complex.h index d49f136..d6df59a 100644 --- a/Eigen/src/Core/arch/AltiVec/Complex.h +++ b/Eigen/src/Core/arch/AltiVec/Complex.h
@@ -109,6 +109,9 @@ HasSqrt = 1, HasLog = 1, HasExp = 1, +#ifdef EIGEN_VECTORIZE_VSX + HasBlend = 1, +#endif HasSetLinear = 0 }; }; @@ -361,6 +364,17 @@ return Packet2cf(vec_and(eq, vec_perm(eq, eq, p16uc_COMPLEX32_REV))); } +#ifdef EIGEN_VECTORIZE_VSX +template <> +EIGEN_STRONG_INLINE Packet2cf pblend(const Selector<2>& ifPacket, const Packet2cf& thenPacket, + const Packet2cf& elsePacket) { + Packet2cf result; + result.v = reinterpret_cast<Packet4f>( + pblend<Packet2d>(ifPacket, reinterpret_cast<Packet2d>(thenPacket.v), reinterpret_cast<Packet2d>(elsePacket.v))); + return result; +} +#endif + template <> EIGEN_STRONG_INLINE Packet2cf psqrt<Packet2cf>(const Packet2cf& a) { return psqrt_complex<Packet2cf>(a);
diff --git a/Eigen/src/Core/arch/AltiVec/PacketMath.h b/Eigen/src/Core/arch/AltiVec/PacketMath.h index c98f217..eefe326 100644 --- a/Eigen/src/Core/arch/AltiVec/PacketMath.h +++ b/Eigen/src/Core/arch/AltiVec/PacketMath.h
@@ -184,8 +184,6 @@ HasATanh = 1, HasLog = 1, HasExp = 1, - HasLog1p = 1, - HasExpm1 = 1, #ifdef EIGEN_VECTORIZE_VSX HasCmp = 1, HasPow = 1, @@ -206,6 +204,7 @@ HasErf = 0, #endif HasNegate = 1, + HasBlend = 1 }; }; template <> @@ -242,6 +241,7 @@ HasTanh = 0, HasErf = 0, HasNegate = 1, + HasBlend = 1 }; }; @@ -263,6 +263,7 @@ #else HasDiv = 0, #endif + HasBlend = 1, HasCmp = 1 }; }; @@ -280,6 +281,7 @@ HasSub = 1, HasMul = 1, HasDiv = 0, + HasBlend = 1, HasCmp = 1 }; }; @@ -297,6 +299,7 @@ HasSub = 1, HasMul = 1, HasDiv = 0, + HasBlend = 1, HasCmp = 1 }; }; @@ -314,6 +317,7 @@ HasSub = 1, HasMul = 1, HasDiv = 0, + HasBlend = 1, HasCmp = 1 }; }; @@ -331,6 +335,7 @@ HasSub = 1, HasMul = 1, HasDiv = 0, + HasBlend = 1, HasCmp = 1 }; }; @@ -3048,6 +3053,74 @@ kernel.packet[15] = vec_mergel(step3[7], step3[15]); } +template <typename Packet> +EIGEN_STRONG_INLINE Packet pblend4(const Selector<4>& ifPacket, const Packet& thenPacket, const Packet& elsePacket) { + Packet4ui select = {ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3]}; + Packet4ui mask = reinterpret_cast<Packet4ui>(pnegate(reinterpret_cast<Packet4i>(select))); + return vec_sel(elsePacket, thenPacket, mask); +} + +template <> +EIGEN_STRONG_INLINE Packet4i pblend(const Selector<4>& ifPacket, const Packet4i& thenPacket, + const Packet4i& elsePacket) { + return pblend4<Packet4i>(ifPacket, thenPacket, elsePacket); +} + +template <> +EIGEN_STRONG_INLINE Packet4f pblend(const Selector<4>& ifPacket, const Packet4f& thenPacket, + const Packet4f& elsePacket) { + return pblend4<Packet4f>(ifPacket, thenPacket, elsePacket); +} + +template <> +EIGEN_STRONG_INLINE Packet8s pblend(const Selector<8>& ifPacket, const Packet8s& thenPacket, + const Packet8s& elsePacket) { + Packet8us select = {ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3], + ifPacket.select[4], ifPacket.select[5], ifPacket.select[6], ifPacket.select[7]}; + Packet8us mask = reinterpret_cast<Packet8us>(pnegate(reinterpret_cast<Packet8s>(select))); + Packet8s result = vec_sel(elsePacket, thenPacket, mask); + return result; +} + +template <> +EIGEN_STRONG_INLINE Packet8us pblend(const Selector<8>& ifPacket, const Packet8us& thenPacket, + const Packet8us& elsePacket) { + Packet8us select = {ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3], + ifPacket.select[4], ifPacket.select[5], ifPacket.select[6], ifPacket.select[7]}; + Packet8us mask = reinterpret_cast<Packet8us>(pnegate(reinterpret_cast<Packet8s>(select))); + return vec_sel(elsePacket, thenPacket, mask); +} + +template <> +EIGEN_STRONG_INLINE Packet8bf pblend(const Selector<8>& ifPacket, const Packet8bf& thenPacket, + const Packet8bf& elsePacket) { + return pblend<Packet8us>(ifPacket, thenPacket, elsePacket); +} + +template <> +EIGEN_STRONG_INLINE Packet16c pblend(const Selector<16>& ifPacket, const Packet16c& thenPacket, + const Packet16c& elsePacket) { + Packet16uc select = {ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3], + ifPacket.select[4], ifPacket.select[5], ifPacket.select[6], ifPacket.select[7], + ifPacket.select[8], ifPacket.select[9], ifPacket.select[10], ifPacket.select[11], + ifPacket.select[12], ifPacket.select[13], ifPacket.select[14], ifPacket.select[15]}; + + Packet16uc mask = reinterpret_cast<Packet16uc>(pnegate(reinterpret_cast<Packet16c>(select))); + return vec_sel(elsePacket, thenPacket, mask); +} + +template <> +EIGEN_STRONG_INLINE Packet16uc pblend(const Selector<16>& ifPacket, const Packet16uc& thenPacket, + const Packet16uc& elsePacket) { + Packet16uc select = {ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3], + ifPacket.select[4], ifPacket.select[5], ifPacket.select[6], ifPacket.select[7], + ifPacket.select[8], ifPacket.select[9], ifPacket.select[10], ifPacket.select[11], + ifPacket.select[12], ifPacket.select[13], ifPacket.select[14], ifPacket.select[15]}; + + Packet16uc mask = reinterpret_cast<Packet16uc>(pnegate(reinterpret_cast<Packet16c>(select))); + return vec_sel(elsePacket, thenPacket, mask); +} + //---------- double ---------- #ifdef EIGEN_VECTORIZE_VSX typedef __vector double Packet2d; @@ -3103,11 +3176,9 @@ HasErfc = EIGEN_FAST_MATH, HasATanh = 1, HasATan = 0, + HasLog = 0, HasCmp = 1, - HasLog = 1, HasExp = 1, - HasLog1p = 1, - HasExpm1 = 1, HasSqrt = 1, HasCbrt = 1, #if !EIGEN_COMP_CLANG @@ -3116,6 +3187,7 @@ HasRsqrt = 0, #endif HasNegate = 1, + HasBlend = 1 }; }; @@ -3641,6 +3713,14 @@ kernel.packet[1] = t1; } +template <> +EIGEN_STRONG_INLINE Packet2d pblend(const Selector<2>& ifPacket, const Packet2d& thenPacket, + const Packet2d& elsePacket) { + Packet2l select = {ifPacket.select[0], ifPacket.select[1]}; + Packet2ul mask = reinterpret_cast<Packet2ul>(pnegate(reinterpret_cast<Packet2l>(select))); + return vec_sel(elsePacket, thenPacket, mask); +} + #endif // __VSX__ } // end namespace internal
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h index de30bcb..673954e 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h
@@ -210,18 +210,16 @@ EIGEN_GENERIC_PACKET_FUNCTION(atan, PACKET) #define EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_DOUBLE(PACKET) \ + EIGEN_DOUBLE_PACKET_FUNCTION(atanh, PACKET) \ + EIGEN_DOUBLE_PACKET_FUNCTION(log, PACKET) \ EIGEN_DOUBLE_PACKET_FUNCTION(sin, PACKET) \ EIGEN_DOUBLE_PACKET_FUNCTION(cos, PACKET) \ - EIGEN_DOUBLE_PACKET_FUNCTION(log, PACKET) \ EIGEN_DOUBLE_PACKET_FUNCTION(log2, PACKET) \ EIGEN_DOUBLE_PACKET_FUNCTION(exp, PACKET) \ EIGEN_DOUBLE_PACKET_FUNCTION(tanh, PACKET) \ - EIGEN_DOUBLE_PACKET_FUNCTION(atanh, PACKET) \ EIGEN_DOUBLE_PACKET_FUNCTION(cbrt, PACKET) \ - EIGEN_GENERIC_PACKET_FUNCTION(expm1, PACKET) \ - EIGEN_GENERIC_PACKET_FUNCTION(exp2, PACKET) \ - EIGEN_GENERIC_PACKET_FUNCTION(log1p, PACKET) \ - EIGEN_GENERIC_PACKET_FUNCTION(atan, PACKET) + EIGEN_GENERIC_PACKET_FUNCTION(atan, PACKET) \ + EIGEN_GENERIC_PACKET_FUNCTION(exp2, PACKET) } // end namespace internal } // end namespace Eigen
diff --git a/Eigen/src/Core/arch/HVX/PacketMath.h b/Eigen/src/Core/arch/HVX/PacketMath.h index 36253c5..9b6ceb3 100644 --- a/Eigen/src/Core/arch/HVX/PacketMath.h +++ b/Eigen/src/Core/arch/HVX/PacketMath.h
@@ -152,6 +152,7 @@ HasNegate = 1, HasAbs = 1, HasArg = 0, + HasAbs2 = 0, HasAbsDiff = 0, HasMin = 1, HasMax = 1,
diff --git a/Eigen/src/Core/arch/LSX/PacketMath.h b/Eigen/src/Core/arch/LSX/PacketMath.h index 77ffdd1..87232aa 100644 --- a/Eigen/src/Core/arch/LSX/PacketMath.h +++ b/Eigen/src/Core/arch/LSX/PacketMath.h
@@ -169,8 +169,10 @@ AlignedOnScalar = 1, size = 16, + HasAbs2 = 0, HasSetLinear = 0, HasCmp = 1, + HasBlend = 0 }; }; @@ -183,9 +185,11 @@ AlignedOnScalar = 1, size = 8, + HasAbs2 = 0, HasSetLinear = 0, HasCmp = 1, HasDiv = 1, + HasBlend = 0 }; }; @@ -198,9 +202,11 @@ AlignedOnScalar = 1, size = 4, + HasAbs2 = 0, HasSetLinear = 0, HasCmp = 1, HasDiv = 1, + HasBlend = 0 }; }; @@ -213,9 +219,11 @@ AlignedOnScalar = 1, size = 2, + HasAbs2 = 0, HasSetLinear = 0, HasCmp = 1, HasDiv = 1, + HasBlend = 0 }; }; @@ -228,9 +236,11 @@ AlignedOnScalar = 1, size = 16, + HasAbs2 = 0, HasSetLinear = 0, HasNegate = 0, HasCmp = 1, + HasBlend = 0 }; }; @@ -243,10 +253,12 @@ AlignedOnScalar = 1, size = 8, + HasAbs2 = 0, HasSetLinear = 0, HasNegate = 0, HasCmp = 1, HasDiv = 1, + HasBlend = 0 }; }; @@ -259,10 +271,12 @@ AlignedOnScalar = 1, size = 4, + HasAbs2 = 0, HasSetLinear = 0, HasNegate = 0, HasCmp = 1, HasDiv = 1, + HasBlend = 0 }; }; @@ -275,10 +289,12 @@ AlignedOnScalar = 1, size = 2, + HasAbs2 = 0, HasSetLinear = 0, HasNegate = 0, HasCmp = 1, HasDiv = 1, + HasBlend = 0 }; }; @@ -291,7 +307,9 @@ AlignedOnScalar = 1, size = 4, + HasAbs2 = 0, HasSetLinear = 0, + HasBlend = 0, HasSign = 0, HasDiv = 1, HasExp = 1, @@ -310,7 +328,9 @@ AlignedOnScalar = 1, size = 2, + HasAbs2 = 0, HasSetLinear = 0, + HasBlend = 0, HasSign = 0, HasDiv = 1, HasSqrt = 1,
diff --git a/Eigen/src/Core/arch/MSA/Complex.h b/Eigen/src/Core/arch/MSA/Complex.h index fbba642..2d2fbbc 100644 --- a/Eigen/src/Core/arch/MSA/Complex.h +++ b/Eigen/src/Core/arch/MSA/Complex.h
@@ -105,6 +105,7 @@ HasMin = 0, HasMax = 0, HasSetLinear = 0, + HasBlend = 1 }; }; @@ -313,6 +314,12 @@ kernel.packet[1].v = tmp; } +template <> +EIGEN_STRONG_INLINE Packet2cf pblend(const Selector<2>& ifPacket, const Packet2cf& thenPacket, + const Packet2cf& elsePacket) { + return (Packet2cf)(Packet4f)pblend<Packet2d>(ifPacket, (Packet2d)thenPacket.v, (Packet2d)elsePacket.v); +} + //---------- double ---------- struct Packet1cd {
diff --git a/Eigen/src/Core/arch/MSA/PacketMath.h b/Eigen/src/Core/arch/MSA/PacketMath.h index 2d5032a..81da24f 100644 --- a/Eigen/src/Core/arch/MSA/PacketMath.h +++ b/Eigen/src/Core/arch/MSA/PacketMath.h
@@ -91,6 +91,7 @@ HasExp = 1, HasSqrt = 1, HasRsqrt = 1, + HasBlend = 1 }; }; @@ -104,6 +105,7 @@ size = 4, // FIXME check the Has* HasDiv = 1, + HasBlend = 1 }; }; @@ -800,6 +802,22 @@ return v; } +template <> +EIGEN_STRONG_INLINE Packet4f pblend(const Selector<4>& ifPacket, const Packet4f& thenPacket, + const Packet4f& elsePacket) { + Packet4ui select = {ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3]}; + Packet4i mask = __builtin_msa_ceqi_w((Packet4i)select, 0); + return (Packet4f)__builtin_msa_bsel_v((v16u8)mask, (v16u8)thenPacket, (v16u8)elsePacket); +} + +template <> +EIGEN_STRONG_INLINE Packet4i pblend(const Selector<4>& ifPacket, const Packet4i& thenPacket, + const Packet4i& elsePacket) { + Packet4ui select = {ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3]}; + Packet4i mask = __builtin_msa_ceqi_w((Packet4i)select, 0); + return (Packet4i)__builtin_msa_bsel_v((v16u8)mask, (v16u8)thenPacket, (v16u8)elsePacket); +} + //---------- double ---------- typedef v2f64 Packet2d; @@ -838,6 +856,7 @@ HasExp = 1, HasSqrt = 1, HasRsqrt = 1, + HasBlend = 1 }; }; @@ -1203,6 +1222,14 @@ return v; } +template <> +EIGEN_STRONG_INLINE Packet2d pblend(const Selector<2>& ifPacket, const Packet2d& thenPacket, + const Packet2d& elsePacket) { + Packet2ul select = {ifPacket.select[0], ifPacket.select[1]}; + Packet2l mask = __builtin_msa_ceqi_d((Packet2l)select, 0); + return (Packet2d)__builtin_msa_bsel_v((v16u8)mask, (v16u8)thenPacket, (v16u8)elsePacket); +} + } // end namespace internal } // end namespace Eigen
diff --git a/Eigen/src/Core/arch/NEON/Complex.h b/Eigen/src/Core/arch/NEON/Complex.h index b8655c8..f3f6a1a 100644 --- a/Eigen/src/Core/arch/NEON/Complex.h +++ b/Eigen/src/Core/arch/NEON/Complex.h
@@ -48,7 +48,7 @@ }; template <> -struct packet_traits<std::complex<float>> : default_packet_traits { +struct packet_traits<std::complex<float> > : default_packet_traits { typedef Packet2cf type; typedef Packet1cf half; enum { @@ -280,13 +280,13 @@ template <> EIGEN_STRONG_INLINE Packet1cf pload<Packet1cf>(const std::complex<float>* from) { - EIGEN_DEBUG_ALIGNED_LOAD return Packet1cf( - pload<Packet2f>(assume_aligned<unpacket_traits<Packet1cf>::alignment>(reinterpret_cast<const float*>(from)))); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet1cf>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return Packet1cf(pload<Packet2f>((const float*)from)); } template <> EIGEN_STRONG_INLINE Packet2cf pload<Packet2cf>(const std::complex<float>* from) { - EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf( - pload<Packet4f>(assume_aligned<unpacket_traits<Packet2cf>::alignment>(reinterpret_cast<const float*>(from)))); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2cf>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload<Packet4f>(reinterpret_cast<const float*>(from))); } template <> @@ -308,22 +308,22 @@ } template <> -EIGEN_STRONG_INLINE void pstore<std::complex<float>>(std::complex<float>* to, const Packet1cf& from) { - EIGEN_DEBUG_ALIGNED_STORE pstore(assume_aligned<unpacket_traits<Packet1cf>::alignment>(reinterpret_cast<float*>(to)), - from.v); +EIGEN_STRONG_INLINE void pstore<std::complex<float> >(std::complex<float>* to, const Packet1cf& from) { + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet1cf>::alignment); + EIGEN_DEBUG_ALIGNED_STORE pstore((float*)to, from.v); } template <> -EIGEN_STRONG_INLINE void pstore<std::complex<float>>(std::complex<float>* to, const Packet2cf& from) { - EIGEN_DEBUG_ALIGNED_STORE pstore(assume_aligned<unpacket_traits<Packet2cf>::alignment>(reinterpret_cast<float*>(to)), - from.v); +EIGEN_STRONG_INLINE void pstore<std::complex<float> >(std::complex<float>* to, const Packet2cf& from) { + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2cf>::alignment); + EIGEN_DEBUG_ALIGNED_STORE pstore(reinterpret_cast<float*>(to), from.v); } template <> -EIGEN_STRONG_INLINE void pstoreu<std::complex<float>>(std::complex<float>* to, const Packet1cf& from) { +EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float>* to, const Packet1cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((float*)to, from.v); } template <> -EIGEN_STRONG_INLINE void pstoreu<std::complex<float>>(std::complex<float>* to, const Packet2cf& from) { +EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float>* to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu(reinterpret_cast<float*>(to), from.v); } @@ -356,7 +356,7 @@ } template <> -EIGEN_STRONG_INLINE void prefetch<std::complex<float>>(const std::complex<float>* addr) { +EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float>* addr) { EIGEN_ARM_PREFETCH(reinterpret_cast<const float*>(addr)); } @@ -501,7 +501,7 @@ }; template <> -struct packet_traits<std::complex<double>> : default_packet_traits { +struct packet_traits<std::complex<double> > : default_packet_traits { typedef Packet1cd type; typedef Packet1cd half; enum { @@ -531,8 +531,8 @@ template <> EIGEN_STRONG_INLINE Packet1cd pload<Packet1cd>(const std::complex<double>* from) { - EIGEN_DEBUG_ALIGNED_LOAD return Packet1cd( - pload<Packet2d>(assume_aligned<unpacket_traits<Packet1cd>::alignment>(reinterpret_cast<const double*>(from)))); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet1cd>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return Packet1cd(pload<Packet2d>(reinterpret_cast<const double*>(from))); } template <> @@ -644,18 +644,18 @@ } template <> -EIGEN_STRONG_INLINE void pstore<std::complex<double>>(std::complex<double>* to, const Packet1cd& from) { - EIGEN_DEBUG_ALIGNED_STORE pstore(assume_aligned<unpacket_traits<Packet1cd>::alignment>(reinterpret_cast<double*>(to)), - from.v); +EIGEN_STRONG_INLINE void pstore<std::complex<double> >(std::complex<double>* to, const Packet1cd& from) { + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet1cd>::alignment); + EIGEN_DEBUG_ALIGNED_STORE pstore(reinterpret_cast<double*>(to), from.v); } template <> -EIGEN_STRONG_INLINE void pstoreu<std::complex<double>>(std::complex<double>* to, const Packet1cd& from) { +EIGEN_STRONG_INLINE void pstoreu<std::complex<double> >(std::complex<double>* to, const Packet1cd& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu(reinterpret_cast<double*>(to), from.v); } template <> -EIGEN_STRONG_INLINE void prefetch<std::complex<double>>(const std::complex<double>* addr) { +EIGEN_STRONG_INLINE void prefetch<std::complex<double> >(const std::complex<double>* addr) { EIGEN_ARM_PREFETCH(reinterpret_cast<const double*>(addr)); } @@ -677,7 +677,7 @@ template <> EIGEN_STRONG_INLINE std::complex<double> pfirst<Packet1cd>(const Packet1cd& a) { EIGEN_ALIGN16 std::complex<double> res; - pstore<std::complex<double>>(&res, a); + pstore<std::complex<double> >(&res, a); return res; }
diff --git a/Eigen/src/Core/arch/NEON/PacketMath.h b/Eigen/src/Core/arch/NEON/PacketMath.h index b9d0866..bea50a3 100644 --- a/Eigen/src/Core/arch/NEON/PacketMath.h +++ b/Eigen/src/Core/arch/NEON/PacketMath.h
@@ -189,11 +189,13 @@ HasNegate = 1, HasAbs = 1, HasArg = 0, + HasAbs2 = 1, HasAbsDiff = 1, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 1, + HasBlend = 0, HasDiv = 1, HasSin = EIGEN_FAST_MATH, HasCos = EIGEN_FAST_MATH, @@ -203,8 +205,6 @@ HasATanh = 1, HasLog = 1, HasExp = 1, - HasLog1p = 1, - HasExpm1 = 1, HasPow = 1, HasSqrt = 1, HasRsqrt = 1, @@ -235,10 +235,12 @@ HasAbs = 1, HasAbsDiff = 1, HasArg = 0, + HasAbs2 = 1, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 1, + HasBlend = 0 }; }; @@ -260,10 +262,12 @@ HasAbs = 1, HasAbsDiff = 1, HasArg = 0, + HasAbs2 = 1, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 1, + HasBlend = 0, HasSqrt = 1 }; @@ -287,10 +291,12 @@ HasAbs = 1, HasAbsDiff = 1, HasArg = 0, + HasAbs2 = 1, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 1, + HasBlend = 0 }; }; @@ -312,10 +318,12 @@ HasAbs = 1, HasAbsDiff = 1, HasArg = 0, + HasAbs2 = 1, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 1, + HasBlend = 0, HasSqrt = 1 }; }; @@ -337,11 +345,13 @@ HasNegate = 1, HasAbs = 1, HasArg = 0, + HasAbs2 = 1, HasAbsDiff = 1, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 1, + HasBlend = 0 }; }; @@ -362,11 +372,13 @@ HasNegate = 0, HasAbs = 1, HasArg = 0, + HasAbs2 = 1, HasAbsDiff = 1, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 1, + HasBlend = 0, HasSqrt = 1 }; @@ -389,11 +401,13 @@ HasNegate = 1, HasAbs = 1, HasArg = 0, + HasAbs2 = 1, HasAbsDiff = 1, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 1, + HasBlend = 0 }; }; @@ -414,11 +428,13 @@ HasNegate = 0, HasAbs = 1, HasArg = 0, + HasAbs2 = 1, HasAbsDiff = 1, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 1, + HasBlend = 0 }; }; @@ -2252,11 +2268,13 @@ template <> EIGEN_STRONG_INLINE Packet2f pload<Packet2f>(const float* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1_f32(assume_aligned<unpacket_traits<Packet2f>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2f>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1_f32(from); } template <> EIGEN_STRONG_INLINE Packet4f pload<Packet4f>(const float* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f32(assume_aligned<unpacket_traits<Packet4f>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4f>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f32(from); } template <> EIGEN_STRONG_INLINE Packet4c pload<Packet4c>(const int8_t* from) { @@ -2266,11 +2284,13 @@ } template <> EIGEN_STRONG_INLINE Packet8c pload<Packet8c>(const int8_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1_s8(assume_aligned<unpacket_traits<Packet8c>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet8c>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1_s8(from); } template <> EIGEN_STRONG_INLINE Packet16c pload<Packet16c>(const int8_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s8(assume_aligned<unpacket_traits<Packet16c>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet16c>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s8(from); } template <> EIGEN_STRONG_INLINE Packet4uc pload<Packet4uc>(const uint8_t* from) { @@ -2280,51 +2300,63 @@ } template <> EIGEN_STRONG_INLINE Packet8uc pload<Packet8uc>(const uint8_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1_u8(assume_aligned<unpacket_traits<Packet8uc>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet8uc>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1_u8(from); } template <> EIGEN_STRONG_INLINE Packet16uc pload<Packet16uc>(const uint8_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u8(assume_aligned<unpacket_traits<Packet16uc>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet16uc>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u8(from); } template <> EIGEN_STRONG_INLINE Packet4s pload<Packet4s>(const int16_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1_s16(assume_aligned<unpacket_traits<Packet4s>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4s>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1_s16(from); } template <> EIGEN_STRONG_INLINE Packet8s pload<Packet8s>(const int16_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s16(assume_aligned<unpacket_traits<Packet8s>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet8s>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s16(from); } template <> EIGEN_STRONG_INLINE Packet4us pload<Packet4us>(const uint16_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1_u16(assume_aligned<unpacket_traits<Packet4us>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4us>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1_u16(from); } template <> EIGEN_STRONG_INLINE Packet8us pload<Packet8us>(const uint16_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u16(assume_aligned<unpacket_traits<Packet8us>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet8us>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u16(from); } template <> EIGEN_STRONG_INLINE Packet2i pload<Packet2i>(const int32_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1_s32(assume_aligned<unpacket_traits<Packet2i>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2i>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1_s32(from); } template <> EIGEN_STRONG_INLINE Packet4i pload<Packet4i>(const int32_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s32(assume_aligned<unpacket_traits<Packet4i>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4i>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s32(from); } template <> EIGEN_STRONG_INLINE Packet2ui pload<Packet2ui>(const uint32_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1_u32(assume_aligned<unpacket_traits<Packet2ui>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2ui>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1_u32(from); } template <> EIGEN_STRONG_INLINE Packet4ui pload<Packet4ui>(const uint32_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u32(assume_aligned<unpacket_traits<Packet4ui>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4ui>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u32(from); } template <> EIGEN_STRONG_INLINE Packet2l pload<Packet2l>(const int64_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s64(assume_aligned<unpacket_traits<Packet2l>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2l>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1q_s64(from); } template <> EIGEN_STRONG_INLINE Packet2ul pload<Packet2ul>(const uint64_t* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u64(assume_aligned<unpacket_traits<Packet2ul>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2ul>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1q_u64(from); } template <> @@ -2548,11 +2580,13 @@ template <> EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet2f& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1_f32(assume_aligned<unpacket_traits<Packet2f>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2f>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1_f32(to, from); } template <> EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet4f& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1q_f32(assume_aligned<unpacket_traits<Packet4f>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4f>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1q_f32(to, from); } template <> EIGEN_STRONG_INLINE void pstore<int8_t>(int8_t* to, const Packet4c& from) { @@ -2560,11 +2594,13 @@ } template <> EIGEN_STRONG_INLINE void pstore<int8_t>(int8_t* to, const Packet8c& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1_s8(assume_aligned<unpacket_traits<Packet8c>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet8c>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1_s8(to, from); } template <> EIGEN_STRONG_INLINE void pstore<int8_t>(int8_t* to, const Packet16c& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1q_s8(assume_aligned<unpacket_traits<Packet16c>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet16c>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1q_s8(to, from); } template <> EIGEN_STRONG_INLINE void pstore<uint8_t>(uint8_t* to, const Packet4uc& from) { @@ -2572,51 +2608,63 @@ } template <> EIGEN_STRONG_INLINE void pstore<uint8_t>(uint8_t* to, const Packet8uc& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1_u8(assume_aligned<unpacket_traits<Packet8uc>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet8uc>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1_u8(to, from); } template <> EIGEN_STRONG_INLINE void pstore<uint8_t>(uint8_t* to, const Packet16uc& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1q_u8(assume_aligned<unpacket_traits<Packet16uc>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet16uc>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1q_u8(to, from); } template <> EIGEN_STRONG_INLINE void pstore<int16_t>(int16_t* to, const Packet4s& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1_s16(assume_aligned<unpacket_traits<Packet4s>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4s>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1_s16(to, from); } template <> EIGEN_STRONG_INLINE void pstore<int16_t>(int16_t* to, const Packet8s& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1q_s16(assume_aligned<unpacket_traits<Packet8s>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet8s>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1q_s16(to, from); } template <> EIGEN_STRONG_INLINE void pstore<uint16_t>(uint16_t* to, const Packet4us& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1_u16(assume_aligned<unpacket_traits<Packet4us>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4us>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1_u16(to, from); } template <> EIGEN_STRONG_INLINE void pstore<uint16_t>(uint16_t* to, const Packet8us& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1q_u16(assume_aligned<unpacket_traits<Packet8us>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet8us>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1q_u16(to, from); } template <> EIGEN_STRONG_INLINE void pstore<int32_t>(int32_t* to, const Packet2i& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1_s32(assume_aligned<unpacket_traits<Packet2i>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2i>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1_s32(to, from); } template <> EIGEN_STRONG_INLINE void pstore<int32_t>(int32_t* to, const Packet4i& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1q_s32(assume_aligned<unpacket_traits<Packet4i>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4i>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1q_s32(to, from); } template <> EIGEN_STRONG_INLINE void pstore<uint32_t>(uint32_t* to, const Packet2ui& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1_u32(assume_aligned<unpacket_traits<Packet2ui>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2ui>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1_u32(to, from); } template <> EIGEN_STRONG_INLINE void pstore<uint32_t>(uint32_t* to, const Packet4ui& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1q_u32(assume_aligned<unpacket_traits<Packet4ui>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4ui>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1q_u32(to, from); } template <> EIGEN_STRONG_INLINE void pstore<int64_t>(int64_t* to, const Packet2l& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1q_s64(assume_aligned<unpacket_traits<Packet2l>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2l>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1q_s64(to, from); } template <> EIGEN_STRONG_INLINE void pstore<uint64_t>(uint64_t* to, const Packet2ul& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1q_u64(assume_aligned<unpacket_traits<Packet2ul>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2ul>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1q_u64(to, from); } template <> @@ -4615,11 +4663,13 @@ HasNegate = 1, HasAbs = 1, HasArg = 0, + HasAbs2 = 1, HasAbsDiff = 1, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 1, + HasBlend = 0, HasDiv = 1, HasSin = EIGEN_FAST_MATH, HasCos = EIGEN_FAST_MATH, @@ -4689,8 +4739,8 @@ template <> EIGEN_STRONG_INLINE Packet4bf pload<Packet4bf>(const bfloat16* from) { - return Packet4bf( - pload<Packet4us>(reinterpret_cast<const uint16_t*>(assume_aligned<unpacket_traits<Packet4bf>::alignment>(from)))); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4bf>::alignment); + return Packet4bf(pload<Packet4us>(reinterpret_cast<const uint16_t*>(from))); } template <> @@ -4700,8 +4750,8 @@ template <> EIGEN_STRONG_INLINE void pstore<bfloat16>(bfloat16* to, const Packet4bf& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1_u16( - reinterpret_cast<uint16_t*>(assume_aligned<unpacket_traits<Packet4bf>::alignment>(to)), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4bf>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1_u16(reinterpret_cast<uint16_t*>(to), from); } template <> @@ -4998,19 +5048,19 @@ HasNegate = 1, HasAbs = 1, HasArg = 0, + HasAbs2 = 1, HasAbsDiff = 1, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 1, + HasBlend = 0, HasDiv = 1, #if EIGEN_ARCH_ARM64 && !EIGEN_APPLE_DOUBLE_NEON_BUG HasExp = 1, HasLog = 1, - HasLog1p = 1, - HasExpm1 = 1, HasPow = 1, HasATan = 1, HasATanh = 1, @@ -5190,7 +5240,8 @@ template <> EIGEN_STRONG_INLINE Packet2d pload<Packet2d>(const double* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f64(assume_aligned<unpacket_traits<Packet2d>::alignment>(from)); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet2d>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f64(from); } template <> @@ -5204,7 +5255,8 @@ } template <> EIGEN_STRONG_INLINE void pstore<double>(double* to, const Packet2d& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1q_f64(assume_aligned<unpacket_traits<Packet2d>::alignment>(to), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet2d>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1q_f64(to, from); } template <> @@ -5372,11 +5424,13 @@ HasNegate = 1, HasAbs = 1, HasArg = 0, + HasAbs2 = 1, HasAbsDiff = 0, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 1, + HasBlend = 0, HasInsert = 1, HasReduxp = 1, HasDiv = 1, @@ -5730,14 +5784,14 @@ template <> EIGEN_STRONG_INLINE Packet8hf pload<Packet8hf>(const Eigen::half* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f16( - reinterpret_cast<const float16_t*>(assume_aligned<unpacket_traits<Packet8hf>::alignment>(from))); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet8hf>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1q_f16(reinterpret_cast<const float16_t*>(from)); } template <> EIGEN_STRONG_INLINE Packet4hf pload<Packet4hf>(const Eigen::half* from) { - EIGEN_DEBUG_ALIGNED_LOAD return vld1_f16( - reinterpret_cast<const float16_t*>(assume_aligned<unpacket_traits<Packet4hf>::alignment>(from))); + EIGEN_ASSUME_ALIGNED(from, unpacket_traits<Packet4hf>::alignment); + EIGEN_DEBUG_ALIGNED_LOAD return vld1_f16(reinterpret_cast<const float16_t*>(from)); } template <> @@ -5812,14 +5866,14 @@ template <> EIGEN_STRONG_INLINE void pstore<Eigen::half>(Eigen::half* to, const Packet8hf& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1q_f16( - reinterpret_cast<float16_t*>(assume_aligned<unpacket_traits<Packet8hf>::alignment>(to)), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet8hf>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1q_f16(reinterpret_cast<float16_t*>(to), from); } template <> EIGEN_STRONG_INLINE void pstore<Eigen::half>(Eigen::half* to, const Packet4hf& from) { - EIGEN_DEBUG_ALIGNED_STORE vst1_f16( - reinterpret_cast<float16_t*>(assume_aligned<unpacket_traits<Packet4hf>::alignment>(to)), from); + EIGEN_ASSUME_ALIGNED(to, unpacket_traits<Packet4hf>::alignment); + EIGEN_DEBUG_ALIGNED_STORE vst1_f16(reinterpret_cast<float16_t*>(to), from); } template <>
diff --git a/Eigen/src/Core/arch/SSE/Complex.h b/Eigen/src/Core/arch/SSE/Complex.h index 9dfe334..f79da7b 100644 --- a/Eigen/src/Core/arch/SSE/Complex.h +++ b/Eigen/src/Core/arch/SSE/Complex.h
@@ -49,6 +49,7 @@ HasMin = 0, HasMax = 0, HasSetLinear = 0, + HasBlend = 1 }; }; #endif @@ -413,6 +414,13 @@ } template <> +EIGEN_STRONG_INLINE Packet2cf pblend(const Selector<2>& ifPacket, const Packet2cf& thenPacket, + const Packet2cf& elsePacket) { + __m128d result = pblend<Packet2d>(ifPacket, _mm_castps_pd(thenPacket.v), _mm_castps_pd(elsePacket.v)); + return Packet2cf(_mm_castpd_ps(result)); +} + +template <> EIGEN_STRONG_INLINE Packet1cd psqrt<Packet1cd>(const Packet1cd& a) { return psqrt_complex<Packet1cd>(a); }
diff --git a/Eigen/src/Core/arch/SSE/PacketMath.h b/Eigen/src/Core/arch/SSE/PacketMath.h index b8b1d9a..a5e4902 100644 --- a/Eigen/src/Core/arch/SSE/PacketMath.h +++ b/Eigen/src/Core/arch/SSE/PacketMath.h
@@ -218,12 +218,10 @@ HasSin = EIGEN_FAST_MATH, HasCos = EIGEN_FAST_MATH, HasTanh = EIGEN_FAST_MATH, + HasLog = 1, HasErf = EIGEN_FAST_MATH, HasErfc = EIGEN_FAST_MATH, - HasLog = 1, HasExp = 1, - HasLog1p = 1, - HasExpm1 = 1, HasPow = 1, HasSqrt = 1, HasRsqrt = 1, @@ -292,6 +290,7 @@ HasCmp = 1, HasShift = 0, HasAbs = 0, + HasAbs2 = 0, HasMin = 0, HasMax = 0, HasConj = 0, @@ -1999,6 +1998,44 @@ kernel.packet[15] = _mm_unpackhi_epi64(u7, uf); } +EIGEN_STRONG_INLINE __m128i sse_blend_mask(const Selector<2>& ifPacket) { + return _mm_set_epi64x(0 - ifPacket.select[1], 0 - ifPacket.select[0]); +} + +EIGEN_STRONG_INLINE __m128i sse_blend_mask(const Selector<4>& ifPacket) { + return _mm_set_epi32(0 - ifPacket.select[3], 0 - ifPacket.select[2], 0 - ifPacket.select[1], 0 - ifPacket.select[0]); +} + +template <> +EIGEN_STRONG_INLINE Packet2l pblend(const Selector<2>& ifPacket, const Packet2l& thenPacket, + const Packet2l& elsePacket) { + const __m128i true_mask = sse_blend_mask(ifPacket); + return pselect<Packet2l>(true_mask, thenPacket, elsePacket); +} +template <> +EIGEN_STRONG_INLINE Packet4i pblend(const Selector<4>& ifPacket, const Packet4i& thenPacket, + const Packet4i& elsePacket) { + const __m128i true_mask = sse_blend_mask(ifPacket); + return pselect<Packet4i>(true_mask, thenPacket, elsePacket); +} +template <> +EIGEN_STRONG_INLINE Packet4ui pblend(const Selector<4>& ifPacket, const Packet4ui& thenPacket, + const Packet4ui& elsePacket) { + return (Packet4ui)pblend(ifPacket, (Packet4i)thenPacket, (Packet4i)elsePacket); +} +template <> +EIGEN_STRONG_INLINE Packet4f pblend(const Selector<4>& ifPacket, const Packet4f& thenPacket, + const Packet4f& elsePacket) { + const __m128i true_mask = sse_blend_mask(ifPacket); + return pselect<Packet4f>(_mm_castsi128_ps(true_mask), thenPacket, elsePacket); +} +template <> +EIGEN_STRONG_INLINE Packet2d pblend(const Selector<2>& ifPacket, const Packet2d& thenPacket, + const Packet2d& elsePacket) { + const __m128i true_mask = sse_blend_mask(ifPacket); + return pselect<Packet2d>(_mm_castsi128_pd(true_mask), thenPacket, elsePacket); +} + // Scalar path for pmadd with FMA to ensure consistency with vectorized path. #if defined(EIGEN_VECTORIZE_FMA) template <> @@ -2157,6 +2194,7 @@ HasDiv = 1, HasNegate = 0, HasAbs = 0, + HasAbs2 = 0, HasMin = 0, HasMax = 0, HasConj = 0,
diff --git a/Eigen/src/Core/arch/SVE/PacketMath.h b/Eigen/src/Core/arch/SVE/PacketMath.h index 28fc62b..6115d1d 100644 --- a/Eigen/src/Core/arch/SVE/PacketMath.h +++ b/Eigen/src/Core/arch/SVE/PacketMath.h
@@ -49,10 +49,12 @@ HasNegate = 1, HasAbs = 1, HasArg = 0, + HasAbs2 = 1, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 0, + HasBlend = 0, HasReduxp = 0 // Not implemented in SVE }; }; @@ -342,10 +344,12 @@ HasNegate = 1, HasAbs = 1, HasArg = 0, + HasAbs2 = 1, HasMin = 1, HasMax = 1, HasConj = 1, HasSetLinear = 0, + HasBlend = 0, HasReduxp = 0, // Not implemented in SVE HasDiv = 1,
diff --git a/Eigen/src/Core/arch/SYCL/PacketMath.h b/Eigen/src/Core/arch/SYCL/PacketMath.h index e5dad3c..6b6bfe4 100644 --- a/Eigen/src/Core/arch/SYCL/PacketMath.h +++ b/Eigen/src/Core/arch/SYCL/PacketMath.h
@@ -542,6 +542,31 @@ kernel.packet[1].x() = tmp; } +template <> +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_half8 pblend( + const Selector<unpacket_traits<cl::sycl::cl_half8>::size>& ifPacket, const cl::sycl::cl_half8& thenPacket, + const cl::sycl::cl_half8& elsePacket) { + cl::sycl::cl_short8 condition(ifPacket.select[0] ? 0 : -1, ifPacket.select[1] ? 0 : -1, ifPacket.select[2] ? 0 : -1, + ifPacket.select[3] ? 0 : -1, ifPacket.select[4] ? 0 : -1, ifPacket.select[5] ? 0 : -1, + ifPacket.select[6] ? 0 : -1, ifPacket.select[7] ? 0 : -1); + return cl::sycl::select(thenPacket, elsePacket, condition); +} + +template <> +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4 pblend( + const Selector<unpacket_traits<cl::sycl::cl_float4>::size>& ifPacket, const cl::sycl::cl_float4& thenPacket, + const cl::sycl::cl_float4& elsePacket) { + cl::sycl::cl_int4 condition(ifPacket.select[0] ? 0 : -1, ifPacket.select[1] ? 0 : -1, ifPacket.select[2] ? 0 : -1, + ifPacket.select[3] ? 0 : -1); + return cl::sycl::select(thenPacket, elsePacket, condition); +} + +template <> +inline cl::sycl::cl_double2 pblend(const Selector<unpacket_traits<cl::sycl::cl_double2>::size>& ifPacket, + const cl::sycl::cl_double2& thenPacket, const cl::sycl::cl_double2& elsePacket) { + cl::sycl::cl_long2 condition(ifPacket.select[0] ? 0 : -1, ifPacket.select[1] ? 0 : -1); + return cl::sycl::select(thenPacket, elsePacket, condition); +} #endif // SYCL_DEVICE_ONLY } // end namespace internal
diff --git a/Eigen/src/Core/arch/ZVector/Complex.h b/Eigen/src/Core/arch/ZVector/Complex.h index dfcdcab..692f90f 100644 --- a/Eigen/src/Core/arch/ZVector/Complex.h +++ b/Eigen/src/Core/arch/ZVector/Complex.h
@@ -72,6 +72,7 @@ HasAbs2 = 0, HasMin = 0, HasMax = 0, + HasBlend = 1, HasSetLinear = 0 }; }; @@ -468,6 +469,14 @@ kernel.packet[1].cd[0] = tmp; } +template <> +EIGEN_STRONG_INLINE Packet2cf pblend(const Selector<2>& ifPacket, const Packet2cf& thenPacket, + const Packet2cf& elsePacket) { + Packet2cf result; + const Selector<4> ifPacket4 = {ifPacket.select[0], ifPacket.select[0], ifPacket.select[1], ifPacket.select[1]}; + result.v = pblend<Packet4f>(ifPacket4, thenPacket.v, elsePacket.v); + return result; +} #else template <> EIGEN_STRONG_INLINE Packet2cf pcmp_eq(const Packet2cf& a, const Packet2cf& b) { @@ -544,6 +553,14 @@ kernel.packet[0].v = tmp; } +template <> +EIGEN_STRONG_INLINE Packet2cf pblend(const Selector<2>& ifPacket, const Packet2cf& thenPacket, + const Packet2cf& elsePacket) { + Packet2cf result; + result.v = reinterpret_cast<Packet4f>( + pblend<Packet2d>(ifPacket, reinterpret_cast<Packet2d>(thenPacket.v), reinterpret_cast<Packet2d>(elsePacket.v))); + return result; +} #endif } // end namespace internal
diff --git a/Eigen/src/Core/arch/ZVector/PacketMath.h b/Eigen/src/Core/arch/ZVector/PacketMath.h index 4ccda87..39073ed 100644 --- a/Eigen/src/Core/arch/ZVector/PacketMath.h +++ b/Eigen/src/Core/arch/ZVector/PacketMath.h
@@ -167,6 +167,7 @@ HasSub = 1, HasMul = 1, HasDiv = 1, + HasBlend = 1 }; }; @@ -196,6 +197,7 @@ HasTanh = 1, HasErf = 1, HasNegate = 1, + HasBlend = 1 }; }; @@ -222,6 +224,7 @@ HasSqrt = 1, HasRsqrt = 1, HasNegate = 1, + HasBlend = 1 }; }; @@ -591,32 +594,41 @@ template <int N> EIGEN_STRONG_INLINE Packet2l parithmetic_shift_right(const Packet2l& a) { - return Packet2l{parithmetic_shift_right<N>(a[0]), parithmetic_shift_right<N>(a[1])}; + return Packet2l { parithmetic_shift_right<N>(a[0]), parithmetic_shift_right<N>(a[1]) }; } template <int N> EIGEN_STRONG_INLINE Packet4i parithmetic_shift_right(const Packet4i& a) { - return Packet4i{parithmetic_shift_right<N>(a[0]), parithmetic_shift_right<N>(a[1]), parithmetic_shift_right<N>(a[2]), - parithmetic_shift_right<N>(a[3])}; + return Packet4i { + parithmetic_shift_right<N>(a[0]), + parithmetic_shift_right<N>(a[1]), + parithmetic_shift_right<N>(a[2]), + parithmetic_shift_right<N>(a[3]) }; } template <int N> EIGEN_STRONG_INLINE Packet2l plogical_shift_right(const Packet2l& a) { - return Packet2l{plogical_shift_right<N>(a[0]), plogical_shift_right<N>(a[1])}; + return Packet2l { plogical_shift_right<N>(a[0]), plogical_shift_right<N>(a[1]) }; } template <int N> EIGEN_STRONG_INLINE Packet4i plogical_shift_right(const Packet4i& a) { - return Packet4i{plogical_shift_right<N>(a[0]), plogical_shift_right<N>(a[1]), plogical_shift_right<N>(a[2]), - plogical_shift_right<N>(a[3])}; + return Packet4i { + plogical_shift_right<N>(a[0]), + plogical_shift_right<N>(a[1]), + plogical_shift_right<N>(a[2]), + plogical_shift_right<N>(a[3]) }; } template <int N> EIGEN_STRONG_INLINE Packet2l plogical_shift_left(const Packet2l& a) { - return Packet2l{plogical_shift_left<N>(a[0]), plogical_shift_left<N>(a[1])}; + return Packet2l { plogical_shift_left<N>(a[0]), plogical_shift_left<N>(a[1]) }; } template <int N> EIGEN_STRONG_INLINE Packet4i plogical_shift_left(const Packet4i& a) { - return Packet4i{plogical_shift_left<N>(a[0]), plogical_shift_left<N>(a[1]), plogical_shift_left<N>(a[2]), - plogical_shift_left<N>(a[3])}; + return Packet4i { + plogical_shift_left<N>(a[0]), + plogical_shift_left<N>(a[1]), + plogical_shift_left<N>(a[2]), + plogical_shift_left<N>(a[3]) }; } template <> @@ -735,6 +747,22 @@ kernel.packet[1] = t1; } +template <> +EIGEN_STRONG_INLINE Packet4i pblend(const Selector<4>& ifPacket, const Packet4i& thenPacket, + const Packet4i& elsePacket) { + Packet4ui select = {ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3]}; + Packet4ui mask = vec_cmpeq(select, reinterpret_cast<Packet4ui>(p4i_ONE)); + return vec_sel(elsePacket, thenPacket, mask); +} + +template <> +EIGEN_STRONG_INLINE Packet2d pblend(const Selector<2>& ifPacket, const Packet2d& thenPacket, + const Packet2d& elsePacket) { + Packet2ul select = {ifPacket.select[0], ifPacket.select[1]}; + Packet2ul mask = vec_cmpeq(select, reinterpret_cast<Packet2ul>(p2l_ONE)); + return vec_sel(elsePacket, thenPacket, mask); +} + /* z13 has no vector float support so we emulate that with double z14 has proper vector float support. */ @@ -1041,6 +1069,19 @@ } template <> +EIGEN_STRONG_INLINE Packet4f pblend(const Selector<4>& ifPacket, const Packet4f& thenPacket, + const Packet4f& elsePacket) { + Packet2ul select_hi = {ifPacket.select[0], ifPacket.select[1]}; + Packet2ul select_lo = {ifPacket.select[2], ifPacket.select[3]}; + Packet2ul mask_hi = vec_cmpeq(select_hi, reinterpret_cast<Packet2ul>(p2l_ONE)); + Packet2ul mask_lo = vec_cmpeq(select_lo, reinterpret_cast<Packet2ul>(p2l_ONE)); + Packet4f result; + result.v4f[0] = vec_sel(elsePacket.v4f[0], thenPacket.v4f[0], mask_hi); + result.v4f[1] = vec_sel(elsePacket.v4f[1], thenPacket.v4f[1], mask_lo); + return result; +} + +template <> Packet4f EIGEN_STRONG_INLINE pcmp_le<Packet4f>(const Packet4f& a, const Packet4f& b) { Packet4f res; res.v4f[0] = pcmp_le(a.v4f[0], b.v4f[0]); @@ -1247,6 +1288,14 @@ kernel.packet[3] = vec_mergel(t1, t3); } +template <> +EIGEN_STRONG_INLINE Packet4f pblend(const Selector<4>& ifPacket, const Packet4f& thenPacket, + const Packet4f& elsePacket) { + Packet4ui select = {ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3]}; + Packet4ui mask = vec_cmpeq(select, reinterpret_cast<Packet4ui>(p4i_ONE)); + return vec_sel(elsePacket, thenPacket, mask); +} + #endif template <> @@ -1289,51 +1338,62 @@ } #if !defined(vec_float) || !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ < 13) -#pragma GCC warning "float->int and int->float conversion is simulated. compile for z15 for improved performance" +#pragma GCC warning \ + "float->int and int->float conversion is simulated. compile for z15 for improved performance" template <> struct cast_impl<Packet4i, Packet4f> { EIGEN_DEVICE_FUNC static inline Packet4f run(const Packet4i& a) { - return Packet4f{float(a[0]), float(a[1]), float(a[2]), float(a[3])}; + return Packet4f{float(a[0]), float(a[1]), float(a[2]), float(a[3]) }; } }; template <> struct cast_impl<Packet4f, Packet4i> { EIGEN_DEVICE_FUNC static inline Packet4i run(const Packet4f& a) { - return Packet4i{int(a[0]), int(a[1]), int(a[2]), int(a[3])}; + return Packet4i{int(a[0]), int(a[1]), int(a[2]), int(a[3]) }; } }; template <> struct cast_impl<Packet2l, Packet2d> { - EIGEN_DEVICE_FUNC static inline Packet2d run(const Packet2l& a) { return Packet2d{double(a[0]), double(a[1])}; } + EIGEN_DEVICE_FUNC static inline Packet2d run(const Packet2l& a) { + return Packet2d{double(a[0]), double(a[1]) }; + } }; template <> struct cast_impl<Packet2d, Packet2l> { EIGEN_DEVICE_FUNC static inline Packet2l run(const Packet2d& a) { - return Packet2l{(long long)(a[0]), (long long)(a[1])}; + return Packet2l{(long long)(a[0]), (long long)(a[1]) }; } }; #else template <> struct cast_impl<Packet4i, Packet4f> { - EIGEN_DEVICE_FUNC static inline Packet4f run(const Packet4i& a) { return vec_float(a); } + EIGEN_DEVICE_FUNC static inline Packet4f run(const Packet4i& a) { + return vec_float(a); + } }; template <> struct cast_impl<Packet4f, Packet4i> { - EIGEN_DEVICE_FUNC static inline Packet4i run(const Packet4f& a) { return vec_signed(a); } + EIGEN_DEVICE_FUNC static inline Packet4i run(const Packet4f& a) { + return vec_signed(a); + } }; template <> struct cast_impl<Packet2l, Packet2d> { - EIGEN_DEVICE_FUNC static inline Packet2d run(const Packet2l& a) { return vec_double(a); } + EIGEN_DEVICE_FUNC static inline Packet2d run(const Packet2l& a) { + return vec_double(a); + } }; template <> struct cast_impl<Packet2d, Packet2l> { - EIGEN_DEVICE_FUNC static inline Packet2l run(const Packet2d& a) { return vec_signed(a); } + EIGEN_DEVICE_FUNC static inline Packet2l run(const Packet2d& a) { + return vec_signed(a); + } }; #endif
diff --git a/Eigen/src/Core/functors/TernaryFunctors.h b/Eigen/src/Core/functors/TernaryFunctors.h index 82095f1..745779a 100644 --- a/Eigen/src/Core/functors/TernaryFunctors.h +++ b/Eigen/src/Core/functors/TernaryFunctors.h
@@ -21,8 +21,7 @@ template <typename ThenScalar, typename ElseScalar, typename ConditionScalar> struct scalar_boolean_select_op { - static constexpr bool ThenElseAreSame = - is_same<std::remove_const_t<ThenScalar>, std::remove_const_t<ElseScalar>>::value; + static constexpr bool ThenElseAreSame = is_same<ThenScalar, ElseScalar>::value; EIGEN_STATIC_ASSERT(ThenElseAreSame, THEN AND ELSE MUST BE SAME TYPE) using Scalar = ThenScalar; using result_type = Scalar;
diff --git a/Eigen/src/Core/functors/UnaryFunctors.h b/Eigen/src/Core/functors/UnaryFunctors.h index 202995f..ba7d97a 100644 --- a/Eigen/src/Core/functors/UnaryFunctors.h +++ b/Eigen/src/Core/functors/UnaryFunctors.h
@@ -100,10 +100,7 @@ }; template <typename Scalar> struct functor_traits<scalar_abs2_op<Scalar>> { - enum { - Cost = NumTraits<Scalar>::MulCost, - PacketAccess = packet_traits<Scalar>::HasMul && !NumTraits<Scalar>::IsComplex - }; + enum { Cost = NumTraits<Scalar>::MulCost, PacketAccess = packet_traits<Scalar>::HasAbs2 }; }; template <typename Scalar, bool IsComplex = NumTraits<Scalar>::IsComplex>
diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index 1492f72..d1f2bf3 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h
@@ -91,9 +91,6 @@ EIGEN_DEVICE_FUNC inline void check_that_malloc_is_allowed() { eigen_assert(false && "heap allocation is forbidden (EIGEN_NO_MALLOC is defined)"); } -EIGEN_DEVICE_FUNC inline void check_that_free_is_allowed() { - eigen_assert(false && "heap deallocation is forbidden (EIGEN_NO_MALLOC is defined)"); -} #elif defined EIGEN_RUNTIME_NO_MALLOC EIGEN_DEVICE_FUNC inline bool is_malloc_allowed_impl(bool update, bool new_value = false) { EIGEN_MALLOC_CHECK_THREAD_LOCAL static bool value = true; @@ -104,22 +101,10 @@ EIGEN_DEVICE_FUNC inline bool set_is_malloc_allowed(bool new_value) { return is_malloc_allowed_impl(true, new_value); } EIGEN_DEVICE_FUNC inline void check_that_malloc_is_allowed() { eigen_assert(is_malloc_allowed() && - "heap allocation is forbidden (EIGEN_RUNTIME_NO_MALLOC is defined and set_is_malloc_allowed is false)"); -} -EIGEN_DEVICE_FUNC inline bool is_free_allowed_impl(bool update, bool new_value = false) { - EIGEN_MALLOC_CHECK_THREAD_LOCAL static bool value = true; - if (update == 1) value = new_value; - return value; -} -EIGEN_DEVICE_FUNC inline bool is_free_allowed() { return is_free_allowed_impl(false); } -EIGEN_DEVICE_FUNC inline bool set_is_free_allowed(bool new_value) { return is_free_allowed_impl(true, new_value); } -EIGEN_DEVICE_FUNC inline void check_that_free_is_allowed() { - eigen_assert(is_malloc_allowed() && - "heap deallocation is forbidden (EIGEN_RUNTIME_NO_MALLOC is defined and set_is_free_allowed is false)"); + "heap allocation is forbidden (EIGEN_RUNTIME_NO_MALLOC is defined and g_is_malloc_allowed is false)"); } #else EIGEN_DEVICE_FUNC inline void check_that_malloc_is_allowed() {} -EIGEN_DEVICE_FUNC inline void check_that_free_is_allowed() {} #endif EIGEN_DEVICE_FUNC inline void throw_std_bad_alloc() { @@ -176,7 +161,7 @@ std::size_t offset = static_cast<std::size_t>(*(static_cast<uint8_t*>(ptr) - 1)) + 1; void* original = static_cast<void*>(static_cast<uint8_t*>(ptr) - offset); - check_that_free_is_allowed(); + check_that_malloc_is_allowed(); EIGEN_USING_STD(free) free(original); } @@ -242,7 +227,7 @@ #if (EIGEN_DEFAULT_ALIGN_BYTES == 0) || EIGEN_MALLOC_ALREADY_ALIGNED if (ptr != nullptr) { - check_that_free_is_allowed(); + check_that_malloc_is_allowed(); EIGEN_USING_STD(free) free(ptr); } @@ -314,7 +299,7 @@ template <> EIGEN_DEVICE_FUNC inline void conditional_aligned_free<false>(void* ptr) { if (ptr != nullptr) { - check_that_free_is_allowed(); + check_that_malloc_is_allowed(); EIGEN_USING_STD(free) free(ptr); } @@ -1354,28 +1339,19 @@ } #endif -// FIXME(rmlarsen): Work around missing linker symbol with msan on ARM. -#if !defined(EIGEN_DONT_ASSUME_ALIGNED) && __has_feature(memory_sanitizer) && \ - (EIGEN_ARCH_ARM || EIGEN_ARCH_ARM64) -#define EIGEN_DONT_ASSUME_ALIGNED -#endif - - -#if !defined(EIGEN_DONT_ASSUME_ALIGNED) && defined(__cpp_lib_assume_aligned) && (__cpp_lib_assume_aligned >= 201811L) -template <std::size_t N, typename T> -EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr T* assume_aligned(T* ptr) { - return std::assume_aligned<N, T>(ptr); -} -#elif !defined(EIGEN_DONT_ASSUME_ALIGNED) && EIGEN_HAS_BUILTIN(__builtin_assume_aligned) -template <std::size_t N, typename T> -EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC T* assume_aligned(T* ptr) { - return static_cast<T*>(__builtin_assume_aligned(ptr, N)); -} +/** \internal + * This informs the implementation that PTR is aligned to at least ALIGN_BYTES + */ +#ifndef EIGEN_ASSUME_ALIGNED +#if defined(__cpp_lib_assume_aligned) && (__cpp_lib_assume_aligned >= 201811L) +#define EIGEN_ASSUME_ALIGNED(PTR, ALIGN_BYTES) \ + { PTR = std::assume_aligned<ALIGN_BYTES>(PTR); } +#elif EIGEN_HAS_BUILTIN(__builtin_assume_aligned) +#define EIGEN_ASSUME_ALIGNED(PTR, ALIGN_BYTES) \ + { PTR = static_cast<decltype(PTR)>(__builtin_assume_aligned(PTR, ALIGN_BYTES)); } #else -template <std::size_t N, typename T> -EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr T* assume_aligned(T* ptr) { - return ptr; -} +#define EIGEN_ASSUME_ALIGNED(PTR, ALIGN_BYTES) /* do nothing */ +#endif #endif } // end namespace internal
diff --git a/Eigen/src/Eigenvalues/ComplexQZ.h b/Eigen/src/Eigenvalues/ComplexQZ.h index ed32ea3..de35698 100644 --- a/Eigen/src/Eigenvalues/ComplexQZ.h +++ b/Eigen/src/Eigenvalues/ComplexQZ.h
@@ -565,9 +565,7 @@ for (Index j = k + 1; j <= l; j++) { // Create a 0 at _T(j, j) J.makeGivens(m_T(j - 1, j), m_T(j, j), &m_T.coeffRef(j - 1, j)); - if (m_n - j - 1 > 0) { - m_T.rightCols(m_n - j - 1).applyOnTheLeft(j - 1, j, J.adjoint()); - } + m_T.rightCols(m_n - j - 1).applyOnTheLeft(j - 1, j, J.adjoint()); m_T.coeffRef(j, j) = Scalar(0); m_S.applyOnTheLeft(j - 1, j, J.adjoint());
diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index f767c8b..a5d7b60 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h
@@ -365,15 +365,6 @@ * \sa MatrixBase::operator(Index,Index) */ EIGEN_DEVICE_FUNC inline Scalar& operator()(Index row, Index col) { return m_matrix(row, col); } -#if __cpp_multidimensional_subscript >= 202110L - /** shortcut for m_matrix(row,col); - * \sa MatrixBase::operator(Index,Index) const */ - EIGEN_DEVICE_FUNC inline Scalar operator[](Index row, Index col) const { return m_matrix[row, col]; } - /** shortcut for m_matrix(row,col); - * \sa MatrixBase::operator(Index,Index) */ - EIGEN_DEVICE_FUNC inline Scalar& operator[](Index row, Index col) { return m_matrix[row, col]; } -#endif - /** \returns a read-only expression of the transformation matrix */ EIGEN_DEVICE_FUNC inline const MatrixType& matrix() const { return m_matrix; } /** \returns a writable expression of the transformation matrix */
diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index e5d2d4f..96b1daf 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h
@@ -65,6 +65,7 @@ EIGEN_DEVICE_FUNC void MatrixBase<Derived>::makeHouseholder(EssentialPart& essential, Scalar& tau, RealScalar& beta) const { using numext::conj; + using numext::sqrt; EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart) VectorBlock<const Derived, EssentialPart::SizeAtCompileTime> tail(derived(), 1, size() - 1); @@ -78,7 +79,7 @@ beta = numext::real(c0); essential.setZero(); } else { - beta = numext::sqrt(numext::abs2(c0) + tailSqNorm); + beta = sqrt(numext::abs2(c0) + tailSqNorm); if (numext::real(c0) >= RealScalar(0)) beta = -beta; essential = tail / (c0 - beta); tau = conj((beta - c0) / beta);
diff --git a/Eigen/src/SparseCore/SparseVector.h b/Eigen/src/SparseCore/SparseVector.h index c8d34e3..d19a00d 100644 --- a/Eigen/src/SparseCore/SparseVector.h +++ b/Eigen/src/SparseCore/SparseVector.h
@@ -140,7 +140,7 @@ return insertBack(inner); } inline Scalar& insertBack(Index i) { - m_data.append(Scalar(0), i); + m_data.append(0, i); return m_data.value(m_data.size() - 1); } @@ -150,7 +150,7 @@ return insertBackUnordered(inner); } inline Scalar& insertBackUnordered(Index i) { - m_data.append(Scalar(0), i); + m_data.append(0, i); return m_data.value(m_data.size() - 1); } @@ -177,7 +177,7 @@ --p; } m_data.index(p + 1) = convert_index(i); - m_data.value(p + 1) = Scalar(0); + m_data.value(p + 1) = 0; return m_data.value(p + 1); } @@ -367,7 +367,7 @@ /** \internal \deprecated use insertBack(Index) */ EIGEN_DEPRECATED_WITH_REASON("Use .insertBack() instead.") Scalar& fill(Index i) { - m_data.append(Scalar(0), i); + m_data.append(0, i); return m_data.value(m_data.size() - 1); }
diff --git a/cmake/EigenSmokeTestList.cmake b/cmake/EigenSmokeTestList.cmake index 247b2c4..db7d3ff 100644 --- a/cmake/EigenSmokeTestList.cmake +++ b/cmake/EigenSmokeTestList.cmake
@@ -91,7 +91,7 @@ qr_1 qr_colpivoting_7 qr_fullpivoting_4 - rand_1 + rand real_qz_1 redux_1 ref_1
diff --git a/doc/TopicCMakeGuide.dox b/doc/TopicCMakeGuide.dox index dc0d706..ebbc4a8 100644 --- a/doc/TopicCMakeGuide.dox +++ b/doc/TopicCMakeGuide.dox
@@ -36,9 +36,9 @@ ``` find_package(Eigen3 3.4 REQUIRED NO_MODULE) # Restricts to 3.4.z ``` -Starting with Eigen 3.4.1, we also support a range spanning major versions: +or to support a range of versions: ``` -find_package(Eigen3 3.4...5 REQUIRED NO_MODULE) # Any version >=3.4.1 but <6.0.0. +find_package(Eigen3 3.4...5 REQUIRED NO_MODULE) # Any version >=3.4.0 but <6.0.0. ``` Do not forget to set the <a href="https://cmake.org/cmake/help/v3.7/variable/CMAKE_PREFIX_PATH.html">\c CMAKE_PREFIX_PATH </a> variable if Eigen is not installed in a default location or if you want to pick a specific version. For instance:
diff --git a/test/complex_qz.cpp b/test/complex_qz.cpp index 28ab08e..a6b05dc 100644 --- a/test/complex_qz.cpp +++ b/test/complex_qz.cpp
@@ -18,9 +18,11 @@ template <typename MatrixType> void generate_random_matrix_pair(const Index dim, MatrixType& A, MatrixType& B) { - A.setRandom(dim, dim); - B.setRandom(dim, dim); - // Zero out each row of B to with a probability of 10%. + A.resize(dim, dim); + B.resize(dim, dim); + A.setRandom(); + B.setRandom(); + // Set each row of B with a probability of 10% to 0 for (int i = 0; i < dim; i++) { if (internal::random<int>(0, 10) == 0) B.row(i).setZero(); } @@ -57,6 +59,8 @@ } EIGEN_DECLARE_TEST(complex_qz) { + // const Index dim1 = 15; + // const Index dim2 = 80; for (int i = 0; i < g_repeat; i++) { // Check for very small, fixed-sized double- and float complex matrices Eigen::Matrix2cd A_2x2, B_2x2; @@ -67,18 +71,16 @@ A_3x3.setRandom(); B_3x3.setRandom(); B_3x3.col(i % 3).setRandom(); + // Test for small float complex matrices + Eigen::MatrixXcf A_float, B_float; + const Index dim1 = internal::random<Index>(15, 80), dim2 = internal::random<Index>(15, 80); + generate_random_matrix_pair(dim1, A_float, B_float); + // Test for a bit larger double complex matrices + Eigen::MatrixXcd A_double, B_double; + generate_random_matrix_pair(dim2, A_double, B_double); CALL_SUBTEST_1(complex_qz(A_2x2, B_2x2)); CALL_SUBTEST_2(complex_qz(A_3x3, B_3x3)); - - // Test for float complex matrices - const Index dim = internal::random<Index>(15, 80); - Eigen::MatrixXcf A_float, B_float; - generate_random_matrix_pair(dim, A_float, B_float); CALL_SUBTEST_3(complex_qz(A_float, B_float)); - - // Test for double complex matrices - Eigen::MatrixXcd A_double, B_double; - generate_random_matrix_pair(dim, A_double, B_double); CALL_SUBTEST_4(complex_qz(A_double, B_double)); } }
diff --git a/test/main.h b/test/main.h index fa7053e..db4d484 100644 --- a/test/main.h +++ b/test/main.h
@@ -186,7 +186,7 @@ namespace Eigen { static std::vector<std::string> g_test_stack; -// level == 0 <=> return 1 if test fail +// level == 0 <=> abort if test fail // level >= 1 <=> warning message to std::cerr if test fail static int g_test_level = 0; static int g_repeat = 1; @@ -356,7 +356,7 @@ const int test_stack_size = static_cast<int>(Eigen::g_test_stack.size()); for (int i = test_stack_size - 1; i >= 0; --i) std::cerr << " - " << Eigen::g_test_stack[i] << "\n"; std::cerr << "\n"; - if (Eigen::g_test_level == 0) exit(1); + if (Eigen::g_test_level == 0) abort(); } } @@ -858,12 +858,6 @@ g_has_set_seed = true; } -inline void set_seed_from_time() { - using namespace std::chrono; - long long ns = duration_cast<nanoseconds>(high_resolution_clock::now().time_since_epoch()).count(); - g_seed = static_cast<decltype(g_seed)>(ns); -} - int main(int argc, char* argv[]) { g_has_set_repeat = false; g_has_set_seed = false; @@ -902,7 +896,7 @@ char* env_EIGEN_SEED = getenv("EIGEN_SEED"); if (!g_has_set_seed && env_EIGEN_SEED) set_seed_from_string(env_EIGEN_SEED); - if (!g_has_set_seed) set_seed_from_time(); + if (!g_has_set_seed) g_seed = (unsigned int)time(NULL); if (!g_has_set_repeat) g_repeat = DEFAULT_REPEAT; std::cout << "Initializing random number generator with seed " << g_seed << std::endl;
diff --git a/test/packetmath.cpp b/test/packetmath.cpp index 18574d2..f21c726 100644 --- a/test/packetmath.cpp +++ b/test/packetmath.cpp
@@ -747,6 +747,22 @@ } } + if (PacketTraits::HasBlend) { + Packet thenPacket = internal::pload<Packet>(data1); + Packet elsePacket = internal::pload<Packet>(data2); + EIGEN_ALIGN_MAX internal::Selector<PacketSize> selector; + for (int i = 0; i < PacketSize; ++i) { + selector.select[i] = i; + } + + Packet blend = internal::pblend(selector, thenPacket, elsePacket); + EIGEN_ALIGN_MAX Scalar result[size]; + internal::pstore(result, blend); + for (int i = 0; i < PacketSize; ++i) { + VERIFY(test::isApproxAbs(result[i], (selector.select[i] ? data1[i] : data2[i]), refvalue)); + } + } + { for (int i = 0; i < PacketSize; ++i) { // "if" mask
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h index 7b672fa..6367db9 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h
@@ -117,10 +117,6 @@ return m_tensor.coeff(computeIndex(row, col)); } -#if __cpp_multidimensional_subscript >= 202110L - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator[](Index row, Index col) const { return operator()(row, col); } -#endif - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index computeIndex(Index row, Index col) const { const bool left = (side == Lhs); EIGEN_UNUSED_VARIABLE(left); // annoying bug in g++8.1: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85963
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h b/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h index 6c81d53..5544953 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h
@@ -691,9 +691,9 @@ static constexpr int Layout = TensorEvaluator<IfArgType, Device>::Layout; enum { IsAligned = TensorEvaluator<ThenArgType, Device>::IsAligned & TensorEvaluator<ElseArgType, Device>::IsAligned, - PacketAccess = - (TensorEvaluator<ThenArgType, Device>::PacketAccess && TensorEvaluator<ElseArgType, Device>::PacketAccess) || - TernaryPacketAccess, + PacketAccess = (TensorEvaluator<ThenArgType, Device>::PacketAccess && + TensorEvaluator<ElseArgType, Device>::PacketAccess && PacketType<Scalar, Device>::HasBlend) || + TernaryPacketAccess, BlockAccess = TensorEvaluator<IfArgType, Device>::BlockAccess && TensorEvaluator<ThenArgType, Device>::BlockAccess && TensorEvaluator<ElseArgType, Device>::BlockAccess, @@ -789,14 +789,13 @@ template <int LoadMode, bool UseTernary = TernaryPacketAccess, std::enable_if_t<!UseTernary, bool> = true> EIGEN_DEVICE_FUNC PacketReturnType packet(Index index) const { - std::remove_const_t<Scalar> arr[PacketSize]; + internal::Selector<PacketSize> select; EIGEN_UNROLL_LOOP for (Index i = 0; i < PacketSize; ++i) { - arr[i] = m_condImpl.coeff(index + i) ? Scalar(-1) : Scalar(0); + select.select[i] = m_condImpl.coeff(index + i); } - return TernarySelectOp().template packetOp<PacketReturnType>(m_thenImpl.template packet<LoadMode>(index), - m_elseImpl.template packet<LoadMode>(index), - internal::pload<PacketReturnType>(arr)); + return internal::pblend(select, m_thenImpl.template packet<LoadMode>(index), + m_elseImpl.template packet<LoadMode>(index)); } template <int LoadMode, bool UseTernary = TernaryPacketAccess, std::enable_if_t<UseTernary, bool> = true>
diff --git a/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h b/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h index bc21d94..54db9bf 100644 --- a/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h +++ b/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h
@@ -454,16 +454,8 @@ } } - if (!(mode == 1 && isBempty) && !(mode == 2 && isBempty) && OP.info() != Success) { - m_info = OP.info() delete[] v; - delete[] iparam; - delete[] ipntr; - delete[] workd; - delete[] workl; - delete[] resid; - m_isInitialized = false; - return *this; - } + if (!(mode == 1 && isBempty) && !(mode == 2 && isBempty) && OP.info() != Success) + std::cout << "Error factoring matrix" << std::endl; do { internal::arpack_wrapper<Scalar, RealScalar>::saupd(&ido, bmat, &n, whch, &nev, &tol, resid, &ncv, v, &ldv, iparam, @@ -580,7 +572,7 @@ delete[] workl; delete[] resid; - m_isInitialized = (m_info == Success); + m_isInitialized = true; return *this; }
diff --git a/unsupported/Eigen/src/Polynomials/Companion.h b/unsupported/Eigen/src/Polynomials/Companion.h index ea245a9..f080996 100644 --- a/unsupported/Eigen/src/Polynomials/Companion.h +++ b/unsupported/Eigen/src/Polynomials/Companion.h
@@ -63,10 +63,6 @@ } } -#if __cpp_multidimensional_subscript >= 202110L - EIGEN_STRONG_INLINE const Scalar_ operator[](Index row, Index col) const { return operator()(row, col); } -#endif - public: template <typename VectorType> void setPolynomial(const VectorType& poly) {
diff --git a/unsupported/Eigen/src/SparseExtra/RandomSetter.h b/unsupported/Eigen/src/SparseExtra/RandomSetter.h index 2ba6523..2889d82 100644 --- a/unsupported/Eigen/src/SparseExtra/RandomSetter.h +++ b/unsupported/Eigen/src/SparseExtra/RandomSetter.h
@@ -280,11 +280,6 @@ return m_hashmaps[outerMajor][key].value; } -#if __cpp_multidimensional_subscript >= 202110L - /** \returns a reference to the coefficient at given coordinates \a row, \a col */ - Scalar& operator[](Index row, Index col) { return operator()(row, col); } -#endif - /** \returns the number of non zero coefficients * * \note According to the underlying map/hash_map implementation,