mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-29 15:24:51 +08:00
Merged in rmlarsen/eigen (pull request PR-221)
Fix bugs to make min- and max reducers work with correctly with IEEE infinities.
This commit is contained in:
commit
221f619bea
@ -200,9 +200,12 @@ template <typename T> struct MaxReducer
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reducePacket(const Packet& p, Packet* accum) const {
|
||||
(*accum) = pmax<Packet>(*accum, p);
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const {
|
||||
return Eigen::NumTraits<T>::lowest();
|
||||
if (Eigen::NumTraits<T>::IsInteger) {
|
||||
return Eigen::NumTraits<T>::lowest();
|
||||
} else {
|
||||
return -Eigen::NumTraits<T>::infinity();
|
||||
}
|
||||
}
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet initializePacket() const {
|
||||
@ -242,9 +245,12 @@ template <typename T> struct MinReducer
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reducePacket(const Packet& p, Packet* accum) const {
|
||||
(*accum) = pmin<Packet>(*accum, p);
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const {
|
||||
return Eigen::NumTraits<T>::highest();
|
||||
if (Eigen::NumTraits<T>::IsInteger) {
|
||||
return Eigen::NumTraits<T>::highest();
|
||||
} else {
|
||||
return Eigen::NumTraits<T>::infinity();
|
||||
}
|
||||
}
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet initializePacket() const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user