Update Eigen to commit:b3267f69362967c4a21dc97699f4ee6ec23557ae
CHANGELOG
=========
b3267f693 - Remove unused variable in test/svd_common.h.
211c5dfc6 - Add optional offset parameter to ploadu_partial and pstoreu_partial
44c20bbbe - rint round floor ceil
6ee86fd47 - delete deprecated function call in svd test
387175c25 - Fix safe_abs in int_pow
c6db610bc - Fix svd test
PiperOrigin-RevId: 543126929
Change-Id: I66bebe2290fbeb3bf89896e8a64bf7de427f74c1
diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h
index bfc7ae6..3d2f144 100644
--- a/Eigen/src/Core/GenericPacketMath.h
+++ b/Eigen/src/Core/GenericPacketMath.h
@@ -730,14 +730,14 @@
/** \internal \returns n elements of a packet version of \a *from, (un-aligned load)
* All elements after the last element loaded will initialized with zero */
template<typename Packet> EIGEN_DEVICE_FUNC inline Packet
-ploadu_partial(const typename unpacket_traits<Packet>::type* from, const Index n)
+ploadu_partial(const typename unpacket_traits<Packet>::type* from, const Index n, const Index offset = 0)
{
const Index packet_size = unpacket_traits<Packet>::size;
- eigen_assert(n <= packet_size && "number of elements will read past end of packet");
+ eigen_assert(n + offset <= packet_size && "number of elements plus offset will read past end of packet");
typedef typename unpacket_traits<Packet>::type Scalar;
EIGEN_ALIGN_MAX Scalar elements[packet_size] = { Scalar(0) };
- for (Index i = 0; i < numext::mini(n,packet_size); i++) {
- elements[i] = from[i];
+ for (Index i = offset; i < numext::mini(n+offset,packet_size); i++) {
+ elements[i] = from[i-offset];
}
return pload<Packet>(elements);
}
@@ -855,14 +855,14 @@
{ (*to) = from; }
/** \internal copy n elements of the packet \a from to \a *to, (un-aligned store) */
-template<typename Scalar, typename Packet> EIGEN_DEVICE_FUNC inline void pstoreu_partial(Scalar* to, const Packet& from, const Index n)
+template<typename Scalar, typename Packet> EIGEN_DEVICE_FUNC inline void pstoreu_partial(Scalar* to, const Packet& from, const Index n, const Index offset = 0)
{
const Index packet_size = unpacket_traits<Packet>::size;
- eigen_assert(n <= packet_size && "number of elements will write past end of packet");
+ eigen_assert(n + offset <= packet_size && "number of elements plus offset will write past end of packet");
EIGEN_ALIGN_MAX Scalar elements[packet_size];
pstore<Scalar>(elements, from);
- for (Index i = 0; i < numext::mini(n,packet_size); i++) {
- to[i] = elements[i];
+ for (Index i = 0; i < numext::mini(n,packet_size-offset); i++) {
+ to[i] = elements[i + offset];
}
}
@@ -1201,7 +1201,7 @@
if(Alignment >= unpacket_traits<Packet>::alignment)
return pload_partial<Packet>(from, n, offset);
else
- return ploadu_partial<Packet>(from, n);
+ return ploadu_partial<Packet>(from, n, offset);
}
/** \internal copy the packet \a from to \a *to.
@@ -1223,7 +1223,7 @@
if(Alignment >= unpacket_traits<Packet>::alignment)
pstore_partial(to, from, n, offset);
else
- pstoreu_partial(to, from, n);
+ pstoreu_partial(to, from, n, offset);
}
/** \internal \returns a packet version of \a *from.
diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h
index d7851e3..822701b 100644
--- a/Eigen/src/Core/MathFunctions.h
+++ b/Eigen/src/Core/MathFunctions.h
@@ -463,51 +463,6 @@
}
/****************************************************************************
-* Implementation of round *
-****************************************************************************/
-
-template<typename Scalar>
-struct round_impl
-{
- EIGEN_STATIC_ASSERT((!NumTraits<Scalar>::IsComplex), NUMERIC_TYPE_MUST_BE_REAL)
-
- EIGEN_DEVICE_FUNC
- static inline Scalar run(const Scalar& x)
- {
- EIGEN_USING_STD(round);
- return Scalar(round(x));
- }
-};
-
-template<typename Scalar>
-struct round_retval
-{
- typedef Scalar type;
-};
-
-/****************************************************************************
-* Implementation of rint *
-****************************************************************************/
-
-template<typename Scalar>
-struct rint_impl {
- EIGEN_STATIC_ASSERT((!NumTraits<Scalar>::IsComplex), NUMERIC_TYPE_MUST_BE_REAL)
-
- EIGEN_DEVICE_FUNC
- static inline Scalar run(const Scalar& x)
- {
- EIGEN_USING_STD(rint);
- return rint(x);
- }
-};
-
-template<typename Scalar>
-struct rint_retval
-{
- typedef Scalar type;
-};
-
-/****************************************************************************
* Implementation of arg *
****************************************************************************/
@@ -996,6 +951,22 @@
typedef Scalar type;
};
+
+template <typename Scalar, bool IsInteger = NumTraits<typename unpacket_traits<Scalar>::type>::IsInteger>
+struct nearest_integer_impl {
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_floor(const Scalar& x) { EIGEN_USING_STD(floor) return floor(x); }
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_ceil(const Scalar& x) { EIGEN_USING_STD(ceil) return ceil(x); }
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_rint(const Scalar& x) { EIGEN_USING_STD(rint) return rint(x); }
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_round(const Scalar& x) { EIGEN_USING_STD(round) return round(x); }
+};
+template <typename Scalar>
+struct nearest_integer_impl<Scalar, true> {
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_floor(const Scalar& x) { return x; }
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_ceil(const Scalar& x) { return x; }
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_rint(const Scalar& x) { return x; }
+ static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar run_round(const Scalar& x) { return x; }
+};
+
} // end namespace internal
/****************************************************************************
@@ -1317,29 +1288,28 @@
#endif
template<typename Scalar>
-EIGEN_DEVICE_FUNC
-inline EIGEN_MATHFUNC_RETVAL(rint, Scalar) rint(const Scalar& x)
+EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
+Scalar rint(const Scalar& x)
{
- return EIGEN_MATHFUNC_IMPL(rint, Scalar)::run(x);
+ return internal::nearest_integer_impl<Scalar>::run_rint(x);
}
template<typename Scalar>
-EIGEN_DEVICE_FUNC
-inline EIGEN_MATHFUNC_RETVAL(round, Scalar) round(const Scalar& x)
+EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
+Scalar round(const Scalar& x)
{
- return EIGEN_MATHFUNC_IMPL(round, Scalar)::run(x);
+ return internal::nearest_integer_impl<Scalar>::run_round(x);
}
#if defined(SYCL_DEVICE_ONLY)
SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(round, round)
#endif
-template<typename T>
-EIGEN_DEVICE_FUNC
-T (floor)(const T& x)
+template<typename Scalar>
+EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
+Scalar (floor)(const Scalar& x)
{
- EIGEN_USING_STD(floor)
- return floor(x);
+ return internal::nearest_integer_impl<Scalar>::run_floor(x);
}
#if defined(SYCL_DEVICE_ONLY)
@@ -1354,12 +1324,11 @@
double floor(const double &x) { return ::floor(x); }
#endif
-template<typename T>
-EIGEN_DEVICE_FUNC
-T (ceil)(const T& x)
+template<typename Scalar>
+EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
+Scalar (ceil)(const Scalar& x)
{
- EIGEN_USING_STD(ceil);
- return ceil(x);
+ return internal::nearest_integer_impl<Scalar>::run_ceil(x);
}
#if defined(SYCL_DEVICE_ONLY)
diff --git a/Eigen/src/Core/arch/AltiVec/Complex.h b/Eigen/src/Core/arch/AltiVec/Complex.h
index 69cc068..e24581f 100644
--- a/Eigen/src/Core/arch/AltiVec/Complex.h
+++ b/Eigen/src/Core/arch/AltiVec/Complex.h
@@ -136,16 +136,16 @@
{
return Packet2cf(pload_partial<Packet4f>((const float *) from, n * 2, offset * 2));
}
-template<> EIGEN_ALWAYS_INLINE Packet2cf ploadu_partial<Packet2cf>(const std::complex<float>* from, const Index n)
+template<> EIGEN_ALWAYS_INLINE Packet2cf ploadu_partial<Packet2cf>(const std::complex<float>* from, const Index n, const Index offset)
{
- return Packet2cf(ploadu_partial<Packet4f>((const float*) from, n * 2));
+ return Packet2cf(ploadu_partial<Packet4f>((const float*) from, n * 2, offset * 2));
}
template<> EIGEN_STRONG_INLINE Packet2cf ploaddup<Packet2cf>(const std::complex<float>* from) { return pset1<Packet2cf>(*from); }
template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { pstore((float*)to, from.v); }
template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { pstoreu((float*)to, from.v); }
template<> EIGEN_ALWAYS_INLINE void pstore_partial <std::complex<float> >(std::complex<float> * to, const Packet2cf& from, const Index n, const Index offset) { pstore_partial((float*)to, from.v, n * 2, offset * 2); }
-template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<std::complex<float> >(std::complex<float> * to, const Packet2cf& from, const Index n) { pstoreu_partial((float*)to, from.v, n * 2); }
+template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<std::complex<float> >(std::complex<float> * to, const Packet2cf& from, const Index n, const Index offset) { pstoreu_partial((float*)to, from.v, n * 2, offset * 2); }
EIGEN_STRONG_INLINE Packet2cf pload2(const std::complex<float>& from0, const std::complex<float>& from1)
{
@@ -382,14 +382,14 @@
{
return Packet1cd(pload_partial<Packet2d>((const double*)from, n * 2, offset * 2));
}
-template<> EIGEN_ALWAYS_INLINE Packet1cd ploadu_partial<Packet1cd>(const std::complex<double>* from, const Index n)
+template<> EIGEN_ALWAYS_INLINE Packet1cd ploadu_partial<Packet1cd>(const std::complex<double>* from, const Index n, const Index offset)
{
- return Packet1cd(ploadu_partial<Packet2d>((const double*)from, n * 2));
+ return Packet1cd(ploadu_partial<Packet2d>((const double*)from, n * 2, offset * 2));
}
template<> EIGEN_STRONG_INLINE void pstore <std::complex<double> >(std::complex<double> * to, const Packet1cd& from) { pstore((double*)to, from.v); }
template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<double> >(std::complex<double> * to, const Packet1cd& from) { pstoreu((double*)to, from.v); }
template<> EIGEN_ALWAYS_INLINE void pstore_partial <std::complex<double> >(std::complex<double> * to, const Packet1cd& from, const Index n, const Index offset) { pstore_partial((double*)to, from.v, n * 2, offset * 2); }
-template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<std::complex<double> >(std::complex<double> * to, const Packet1cd& from, const Index n) { pstoreu_partial((double*)to, from.v, n * 2); }
+template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<std::complex<double> >(std::complex<double> * to, const Packet1cd& from, const Index n, const Index offset) { pstoreu_partial((double*)to, from.v, n * 2, offset * 2); }
template<> EIGEN_STRONG_INLINE Packet1cd pset1<Packet1cd>(const std::complex<double>& from)
{ /* here we really have to use unaligned loads :( */ return ploadu<Packet1cd>(&from); }
diff --git a/Eigen/src/Core/arch/AltiVec/PacketMath.h b/Eigen/src/Core/arch/AltiVec/PacketMath.h
index 7e0c759..f12dc19 100644
--- a/Eigen/src/Core/arch/AltiVec/PacketMath.h
+++ b/Eigen/src/Core/arch/AltiVec/PacketMath.h
@@ -1260,26 +1260,36 @@
return ploadu_common<Packet16uc>(from);
}
-template<typename Packet> EIGEN_ALWAYS_INLINE Packet ploadu_partial_common(const __UNPACK_TYPE__(Packet)* from, const Index n)
+template<typename Packet> EIGEN_ALWAYS_INLINE Packet ploadu_partial_common(const __UNPACK_TYPE__(Packet)* from, const Index n, const Index offset)
{
const Index packet_size = unpacket_traits<Packet>::size;
- eigen_internal_assert(n <= packet_size && "number of elements will read past end of packet");
+ eigen_internal_assert(n + offset <= packet_size && "number of elements plus offset will read past end of packet");
const Index size = sizeof(__UNPACK_TYPE__(Packet));
#ifdef _ARCH_PWR9
EIGEN_UNUSED_VARIABLE(packet_size);
EIGEN_DEBUG_ALIGNED_LOAD
EIGEN_DEBUG_UNALIGNED_LOAD
- return vec_xl_len(const_cast<__UNPACK_TYPE__(Packet)*>(from), n * size);
+ Packet load = vec_xl_len(const_cast<__UNPACK_TYPE__(Packet)*>(from), n * size);
+ if (offset) {
+ Packet16uc shift = pset1<Packet16uc>(offset * 8 * size);
+#ifdef _BIG_ENDIAN
+ load = Packet(vec_sro(Packet16uc(load), shift));
+#else
+ load = Packet(vec_slo(Packet16uc(load), shift));
+#endif
+ }
+ return load;
#else
if (n) {
+ EIGEN_ALIGN16 __UNPACK_TYPE__(Packet) load[packet_size];
+ unsigned char* load2 = reinterpret_cast<unsigned char *>(load + offset);
+ unsigned char* from2 = reinterpret_cast<unsigned char *>(const_cast<__UNPACK_TYPE__(Packet)*>(from));
Index n2 = n * size;
if (16 <= n2) {
- return ploadu<Packet>(from);
+ pstoreu(load2, ploadu<Packet16uc>(from2));
+ } else {
+ memcpy((void *)load2, (void *)from2, n2);
}
- EIGEN_ALIGN16 __UNPACK_TYPE__(Packet) load[packet_size];
- unsigned char* load2 = reinterpret_cast<unsigned char *>(load);
- unsigned char* from2 = reinterpret_cast<unsigned char *>(const_cast<__UNPACK_TYPE__(Packet)*>(from));
- memcpy((void *)load2, (void *)from2, n2);
return pload_ignore<Packet>(load);
} else {
return Packet(pset1<Packet16uc>(0));
@@ -1287,33 +1297,33 @@
#endif
}
-template<> EIGEN_ALWAYS_INLINE Packet4f ploadu_partial<Packet4f>(const float* from, const Index n)
+template<> EIGEN_ALWAYS_INLINE Packet4f ploadu_partial<Packet4f>(const float* from, const Index n, const Index offset)
{
- return ploadu_partial_common<Packet4f>(from, n);
+ return ploadu_partial_common<Packet4f>(from, n, offset);
}
-template<> EIGEN_ALWAYS_INLINE Packet4i ploadu_partial<Packet4i>(const int* from, const Index n)
+template<> EIGEN_ALWAYS_INLINE Packet4i ploadu_partial<Packet4i>(const int* from, const Index n, const Index offset)
{
- return ploadu_partial_common<Packet4i>(from, n);
+ return ploadu_partial_common<Packet4i>(from, n, offset);
}
-template<> EIGEN_ALWAYS_INLINE Packet8s ploadu_partial<Packet8s>(const short int* from, const Index n)
+template<> EIGEN_ALWAYS_INLINE Packet8s ploadu_partial<Packet8s>(const short int* from, const Index n, const Index offset)
{
- return ploadu_partial_common<Packet8s>(from, n);
+ return ploadu_partial_common<Packet8s>(from, n, offset);
}
-template<> EIGEN_ALWAYS_INLINE Packet8us ploadu_partial<Packet8us>(const unsigned short int* from, const Index n)
+template<> EIGEN_ALWAYS_INLINE Packet8us ploadu_partial<Packet8us>(const unsigned short int* from, const Index n, const Index offset)
{
- return ploadu_partial_common<Packet8us>(from, n);
+ return ploadu_partial_common<Packet8us>(from, n, offset);
}
-template<> EIGEN_ALWAYS_INLINE Packet8bf ploadu_partial<Packet8bf>(const bfloat16* from, const Index n)
+template<> EIGEN_ALWAYS_INLINE Packet8bf ploadu_partial<Packet8bf>(const bfloat16* from, const Index n, const Index offset)
{
- return ploadu_partial_common<Packet8us>(reinterpret_cast<const unsigned short int*>(from), n);
+ return ploadu_partial_common<Packet8us>(reinterpret_cast<const unsigned short int*>(from), n, offset);
}
-template<> EIGEN_ALWAYS_INLINE Packet16c ploadu_partial<Packet16c>(const signed char* from, const Index n)
+template<> EIGEN_ALWAYS_INLINE Packet16c ploadu_partial<Packet16c>(const signed char* from, const Index n, const Index offset)
{
- return ploadu_partial_common<Packet16c>(from, n);
+ return ploadu_partial_common<Packet16c>(from, n, offset);
}
-template<> EIGEN_ALWAYS_INLINE Packet16uc ploadu_partial<Packet16uc>(const unsigned char* from, const Index n)
+template<> EIGEN_ALWAYS_INLINE Packet16uc ploadu_partial<Packet16uc>(const unsigned char* from, const Index n, const Index offset)
{
- return ploadu_partial_common<Packet16uc>(from, n);
+ return ploadu_partial_common<Packet16uc>(from, n, offset);
}
template<typename Packet> EIGEN_STRONG_INLINE Packet ploaddup_common(const __UNPACK_TYPE__(Packet)* from)
@@ -1436,57 +1446,67 @@
pstoreu_common<Packet16uc>(to, from);
}
-template<typename Packet> EIGEN_ALWAYS_INLINE void pstoreu_partial_common(__UNPACK_TYPE__(Packet)* to, const Packet& from, const Index n)
+template<typename Packet> EIGEN_ALWAYS_INLINE void pstoreu_partial_common(__UNPACK_TYPE__(Packet)* to, const Packet& from, const Index n, const Index offset)
{
const Index packet_size = unpacket_traits<Packet>::size;
- eigen_internal_assert(n <= packet_size && "number of elements will write past end of packet");
+ eigen_internal_assert(n + offset <= packet_size && "number of elements plus offset will write past end of packet");
const Index size = sizeof(__UNPACK_TYPE__(Packet));
#ifdef _ARCH_PWR9
EIGEN_UNUSED_VARIABLE(packet_size);
EIGEN_DEBUG_UNALIGNED_STORE
- vec_xst_len(from, to, n * size);
+ Packet store = from;
+ if (offset) {
+ Packet16uc shift = pset1<Packet16uc>(offset * 8 * size);
+#ifdef _BIG_ENDIAN
+ store = Packet(vec_slo(Packet16uc(store), shift));
+#else
+ store = Packet(vec_sro(Packet16uc(store), shift));
+#endif
+ }
+ vec_xst_len(store, to, n * size);
#else
if (n) {
- Index n2 = n * size;
- if (16 <= n2) {
- pstoreu(to, from);
- }
EIGEN_ALIGN16 __UNPACK_TYPE__(Packet) store[packet_size];
pstore(store, from);
- unsigned char* store2 = reinterpret_cast<unsigned char *>(store);
+ unsigned char* store2 = reinterpret_cast<unsigned char *>(store + offset);
unsigned char* to2 = reinterpret_cast<unsigned char *>(to);
- memcpy((void *)to2, (void *)store2, n2);
+ Index n2 = n * size;
+ if (16 <= n2) {
+ pstoreu(to2, ploadu<Packet16uc>(store2));
+ } else {
+ memcpy((void *)to2, (void *)store2, n2);
+ }
}
#endif
}
-template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<float>(float* to, const Packet4f& from, const Index n)
+template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<float>(float* to, const Packet4f& from, const Index n, const Index offset)
{
- pstoreu_partial_common<Packet4f>(to, from, n);
+ pstoreu_partial_common<Packet4f>(to, from, n, offset);
}
-template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<int>(int* to, const Packet4i& from, const Index n)
+template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<int>(int* to, const Packet4i& from, const Index n, const Index offset)
{
- pstoreu_partial_common<Packet4i>(to, from, n);
+ pstoreu_partial_common<Packet4i>(to, from, n, offset);
}
-template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<short int>(short int* to, const Packet8s& from, const Index n)
+template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<short int>(short int* to, const Packet8s& from, const Index n, const Index offset)
{
- pstoreu_partial_common<Packet8s>(to, from, n);
+ pstoreu_partial_common<Packet8s>(to, from, n, offset);
}
-template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<unsigned short int>(unsigned short int* to, const Packet8us& from, const Index n)
+template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<unsigned short int>(unsigned short int* to, const Packet8us& from, const Index n, const Index offset)
{
- pstoreu_partial_common<Packet8us>(to, from, n);
+ pstoreu_partial_common<Packet8us>(to, from, n, offset);
}
-template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<bfloat16>(bfloat16* to, const Packet8bf& from, const Index n)
+template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<bfloat16>(bfloat16* to, const Packet8bf& from, const Index n, const Index offset)
{
- pstoreu_partial_common<Packet8us>(reinterpret_cast<unsigned short int*>(to), from, n);
+ pstoreu_partial_common<Packet8us>(reinterpret_cast<unsigned short int*>(to), from, n, offset);
}
-template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<signed char>(signed char* to, const Packet16c& from, const Index n)
+template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<signed char>(signed char* to, const Packet16c& from, const Index n, const Index offset)
{
- pstoreu_partial_common<Packet16c>(to, from, n);
+ pstoreu_partial_common<Packet16c>(to, from, n, offset);
}
-template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<unsigned char>(unsigned char* to, const Packet16uc& from, const Index n)
+template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<unsigned char>(unsigned char* to, const Packet16uc& from, const Index n, const Index offset)
{
- pstoreu_partial_common<Packet16uc>(to, from, n);
+ pstoreu_partial_common<Packet16uc>(to, from, n, offset);
}
template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { EIGEN_PPC_PREFETCH(addr); }
@@ -2953,9 +2973,9 @@
return vec_xl(0, const_cast<double*>(from));
}
-template<> EIGEN_ALWAYS_INLINE Packet2d ploadu_partial<Packet2d>(const double* from, const Index n)
+template<> EIGEN_ALWAYS_INLINE Packet2d ploadu_partial<Packet2d>(const double* from, const Index n, const Index offset)
{
- return ploadu_partial_common<Packet2d>(from, n);
+ return ploadu_partial_common<Packet2d>(from, n, offset);
}
template<> EIGEN_STRONG_INLINE Packet2d ploaddup<Packet2d>(const double* from)
@@ -2972,9 +2992,9 @@
vec_xst(from, 0, to);
}
-template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<double>(double* to, const Packet2d& from, const Index n)
+template<> EIGEN_ALWAYS_INLINE void pstoreu_partial<double>(double* to, const Packet2d& from, const Index n, const Index offset)
{
- pstoreu_partial_common<Packet2d>(to, from, n);
+ pstoreu_partial_common<Packet2d>(to, from, n, offset);
}
template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { EIGEN_PPC_PREFETCH(addr); }
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
index 1bfee7d..2739d9a 100644
--- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
+++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
@@ -1997,9 +1997,9 @@
// consider the (rare) case where `exp` is an int32_t: abs(-2147483648) != 2147483648
using safe_abs_type = typename numext::get_integer_by_size<sizeof(ScalarExponent)>::unsigned_type;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE safe_abs_type safe_abs(const ScalarExponent& exp) {
- ScalarExponent mask = exp ^ numext::abs(exp);
- safe_abs_type result = static_cast<safe_abs_type>(exp);
- return result ^ mask;
+ ScalarExponent mask = numext::signbit(exp);
+ safe_abs_type result = safe_abs_type(exp ^ mask);
+ return result + safe_abs_type(ScalarExponent(1) & mask);
}
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool is_odd(const safe_abs_type& exp) {
return exp % safe_abs_type(2) != safe_abs_type(0);
diff --git a/Eigen/src/Core/functors/UnaryFunctors.h b/Eigen/src/Core/functors/UnaryFunctors.h
index 4760d9b..fcd81c1 100644
--- a/Eigen/src/Core/functors/UnaryFunctors.h
+++ b/Eigen/src/Core/functors/UnaryFunctors.h
@@ -809,7 +809,7 @@
{
enum {
Cost = NumTraits<Scalar>::MulCost,
- PacketAccess = packet_traits<Scalar>::HasRound
+ PacketAccess = packet_traits<Scalar>::HasRound || NumTraits<Scalar>::IsInteger
};
};
@@ -827,7 +827,7 @@
{
enum {
Cost = NumTraits<Scalar>::MulCost,
- PacketAccess = packet_traits<Scalar>::HasFloor
+ PacketAccess = packet_traits<Scalar>::HasFloor || NumTraits<Scalar>::IsInteger
};
};
@@ -845,7 +845,7 @@
{
enum {
Cost = NumTraits<Scalar>::MulCost,
- PacketAccess = packet_traits<Scalar>::HasRint
+ PacketAccess = packet_traits<Scalar>::HasRint || NumTraits<Scalar>::IsInteger
};
};
@@ -863,7 +863,7 @@
{
enum {
Cost = NumTraits<Scalar>::MulCost,
- PacketAccess = packet_traits<Scalar>::HasCeil
+ PacketAccess = packet_traits<Scalar>::HasCeil || NumTraits<Scalar>::IsInteger
};
};
diff --git a/test/bdcsvd.cpp b/test/bdcsvd.cpp
index b21479e..4752809 100644
--- a/test/bdcsvd.cpp
+++ b/test/bdcsvd.cpp
@@ -10,15 +10,6 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/
-// We explicitly disable deprecated declarations for this set of tests
-// because we purposely verify assertions for the deprecated SVD runtime
-// option behavior.
-#if defined(__GNUC__)
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#elif defined(_MSC_VER)
-#pragma warning( disable : 4996 )
-#endif
-
// discard stack allocation as that too bypasses malloc
#define EIGEN_STACK_ALLOCATION_LIMIT 0
#define EIGEN_RUNTIME_NO_MALLOC
@@ -41,22 +32,6 @@
VERIFY_IS_APPROX(m.bdcSvd().singularValues(), RealVecType::Ones());
VERIFY_RAISES_ASSERT(m.bdcSvd().matrixU());
VERIFY_RAISES_ASSERT(m.bdcSvd().matrixV());
-
- // Deprecated behavior.
- VERIFY_IS_APPROX(m.bdcSvd(ComputeFullU|ComputeFullV).solve(m), m);
- VERIFY_IS_APPROX(m.bdcSvd(ComputeFullU|ComputeFullV).transpose().solve(m), m);
- VERIFY_IS_APPROX(m.bdcSvd(ComputeFullU|ComputeFullV).adjoint().solve(m), m);
- VERIFY_IS_APPROX(m.template bdcSvd<DisableQRDecomposition>(ComputeFullU|ComputeFullV).solve(m), m);
- VERIFY_IS_APPROX(m.template bdcSvd<DisableQRDecomposition>(ComputeFullU|ComputeFullV).transpose().solve(m), m);
- VERIFY_IS_APPROX(m.template bdcSvd<DisableQRDecomposition>(ComputeFullU|ComputeFullV).adjoint().solve(m), m);
-
- VERIFY_IS_APPROX(m.template bdcSvd<ComputeFullU | ComputeFullV>().solve(m), m);
- VERIFY_IS_APPROX(m.template bdcSvd<ComputeFullU | ComputeFullV>().transpose().solve(m), m);
- VERIFY_IS_APPROX(m.template bdcSvd<ComputeFullU | ComputeFullV>().adjoint().solve(m), m);
-
- VERIFY_IS_APPROX(m.template bdcSvd<ComputeFullU | ComputeFullV | DisableQRDecomposition>().solve(m), m);
- VERIFY_IS_APPROX(m.template bdcSvd<ComputeFullU | ComputeFullV | DisableQRDecomposition>().transpose().solve(m), m);
- VERIFY_IS_APPROX(m.template bdcSvd<ComputeFullU | ComputeFullV | DisableQRDecomposition>().adjoint().solve(m), m);
}
// compare the Singular values returned with Jacobi and Bdc
diff --git a/test/jacobisvd.cpp b/test/jacobisvd.cpp
index 0c04235..3d6b630 100644
--- a/test/jacobisvd.cpp
+++ b/test/jacobisvd.cpp
@@ -8,15 +8,6 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-// We explicitly disable deprecated declarations for this set of tests
-// because we purposely verify assertions for the deprecated SVD runtime
-// option behavior.
-#if defined(__GNUC__)
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#elif defined(_MSC_VER)
-#pragma warning( disable : 4996 )
-#endif
-
// discard stack allocation as that too bypasses malloc
#define EIGEN_STACK_ALLOCATION_LIMIT 0
#define EIGEN_RUNTIME_NO_MALLOC
@@ -41,11 +32,6 @@
VERIFY_IS_APPROX(m.template jacobiSvd<ComputeFullU | ComputeFullV>().solve(m), m);
VERIFY_IS_APPROX(m.template jacobiSvd<ComputeFullU | ComputeFullV>().transpose().solve(m), m);
VERIFY_IS_APPROX(m.template jacobiSvd<ComputeFullU | ComputeFullV>().adjoint().solve(m), m);
-
- // Deprecated behavior.
- VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).solve(m), m);
- VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).transpose().solve(m), m);
- VERIFY_IS_APPROX(m.jacobiSvd(ComputeFullU|ComputeFullV).adjoint().solve(m), m);
}
template <typename MatrixType>
@@ -71,7 +57,7 @@
svd_verify_constructor_options_assert<JacobiSVD<MatrixType>>(m);
svd_verify_constructor_options_assert<JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>>(m);
svd_verify_constructor_options_assert<JacobiSVD<MatrixType, HouseholderQRPreconditioner>>(m);
- svd_verify_constructor_options_assert<JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>>(m, true);
+ svd_verify_constructor_options_assert<JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>>(m);
}
template <typename MatrixType>
diff --git a/test/svd_common.h b/test/svd_common.h
index 84551f3..6497470 100644
--- a/test/svd_common.h
+++ b/test/svd_common.h
@@ -278,9 +278,10 @@
svd.compute(m);
VERIFY(svd.info() == InvalidInput);
+ Scalar min = (std::numeric_limits<Scalar>::min)();
m.resize(4,4);
m << 1, 0, 0, 0,
- 0, 3, 1, 2e-308,
+ 0, 3, 1, min,
1, 0, 1, nan,
0, nan, nan, 0;
svd.compute(m);
@@ -482,35 +483,6 @@
}
}
-// Deprecated behavior.
-template <typename SvdType, typename MatrixType>
-void svd_check_runtime_options(const MatrixType& m, unsigned int computationOptions) {
- const bool fixedRowAndThinU = SvdType::RowsAtCompileTime != Dynamic && (computationOptions & ComputeThinU) != 0 && m.cols() < m.rows();
- const bool fixedColAndThinV = SvdType::ColsAtCompileTime != Dynamic && (computationOptions & ComputeThinV) != 0 && m.rows() < m.cols();
- if (fixedRowAndThinU || fixedColAndThinV) {
- VERIFY_RAISES_ASSERT(SvdType svd(m, computationOptions));
- return;
- }
-
- Index diagSize = (std::min)(m.rows(), m.cols());
-
- SvdType svd(m, computationOptions);
- if (svd.computeU()) {
- VERIFY(svd.matrixU().isUnitary());
- if (computationOptions & ComputeThinU) VERIFY(svd.matrixU().cols() == diagSize);
- }
-
- if (svd.computeV()) {
- VERIFY(svd.matrixV().isUnitary());
- if (computationOptions & ComputeThinV) VERIFY(svd.matrixV().cols() == diagSize);
- }
- if (svd.computeU() && svd.computeV()) {
- svd_test_solvers(m, svd);
- svd.matrixU().isUnitary();
- svd.matrixV().isUnitary();
- }
-}
-
template <typename MatrixType, int QRPreconditioner = 0>
void svd_option_checks(const MatrixType& input) {
MatrixType m(input.rows(), input.cols());
@@ -531,20 +503,6 @@
FullSvdType fullSvd(m);
svd_check_full(m, fullSvd);
svd_compare_to_full<MatrixType, FullSvdType, QRPreconditioner | ComputeFullU | ComputeFullV>(m, fullSvd);
-
- // Deprecated behavior.
- typedef SVD_STATIC_OPTIONS(MatrixType, QRPreconditioner) DynamicSvd;
- svd_check_runtime_options<DynamicSvd>(m, 0);
- svd_check_runtime_options<DynamicSvd>(m, ComputeThinU);
- svd_check_runtime_options<DynamicSvd>(m, ComputeThinV);
- svd_check_runtime_options<DynamicSvd>(m, ComputeThinU | ComputeThinV);
-
- svd_check_runtime_options<DynamicSvd>(m, ComputeFullU);
- svd_check_runtime_options<DynamicSvd>(m, ComputeFullV);
- svd_check_runtime_options<DynamicSvd>(m, ComputeFullU | ComputeFullV);
-
- svd_check_runtime_options<DynamicSvd>(m, ComputeThinU | ComputeFullV);
- svd_check_runtime_options<DynamicSvd>(m, ComputeFullU | ComputeThinV);
}
template <typename MatrixType, int QRPreconditioner = 0>
@@ -592,11 +550,10 @@
}
template <typename SvdType, typename MatrixType>
-void svd_verify_constructor_options_assert(const MatrixType& m, bool fullOnly = false) {
+void svd_verify_constructor_options_assert(const MatrixType& m) {
typedef typename MatrixType::Scalar Scalar;
Index rows = m.rows();
- Index cols = m.cols();
-
+
enum {
RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime
@@ -612,37 +569,6 @@
VERIFY_RAISES_ASSERT(svd.solve(rhs))
VERIFY_RAISES_ASSERT(svd.transpose().solve(rhs))
VERIFY_RAISES_ASSERT(svd.adjoint().solve(rhs))
-
- MatrixType a = MatrixType::Zero(rows, cols);
- SvdType svd2(a, 0);
- VERIFY_RAISES_ASSERT(svd2.matrixU())
- VERIFY_RAISES_ASSERT(svd2.matrixV())
- svd2.singularValues();
- VERIFY_RAISES_ASSERT(svd2.solve(rhs))
-
- // Deprecated behavior.
- SvdType svd3(a, ComputeFullU);
- svd3.matrixU();
- VERIFY_RAISES_ASSERT(svd3.matrixV())
- VERIFY_RAISES_ASSERT(svd3.solve(rhs))
-
- SvdType svd4(a, ComputeFullV);
- svd4.matrixV();
- VERIFY_RAISES_ASSERT(svd4.matrixU())
- VERIFY_RAISES_ASSERT(svd4.solve(rhs))
-
- if (!fullOnly && ColsAtCompileTime == Dynamic)
- {
- SvdType svd5(a, ComputeThinU);
- svd5.matrixU();
- VERIFY_RAISES_ASSERT(svd5.matrixV())
- VERIFY_RAISES_ASSERT(svd5.solve(rhs))
-
- SvdType svd6(a, ComputeThinV);
- svd6.matrixV();
- VERIFY_RAISES_ASSERT(svd6.matrixU())
- VERIFY_RAISES_ASSERT(svd6.solve(rhs))
- }
}
#undef SVD_DEFAULT