mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-30 07:44:10 +08:00
Fix bugs to make min- and max reducers with correctly with IEEE infinities.
This commit is contained in:
parent
7ae819123c
commit
a1e092d1e8
@ -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 {
|
||||
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 {
|
||||
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