mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-29 23:34:12 +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 {
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reducePacket(const Packet& p, Packet* accum) const {
|
||||||
(*accum) = pmax<Packet>(*accum, p);
|
(*accum) = pmax<Packet>(*accum, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const {
|
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>
|
template <typename Packet>
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet initializePacket() const {
|
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 {
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reducePacket(const Packet& p, Packet* accum) const {
|
||||||
(*accum) = pmin<Packet>(*accum, p);
|
(*accum) = pmin<Packet>(*accum, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const {
|
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>
|
template <typename Packet>
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet initializePacket() const {
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet initializePacket() const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user