smalleset() ( Re: [eigen] Householder.h: ::min() and operator<=) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
Dear Christoph,
Am 08.09.2016 um 18:32 schrieb Christoph Hertzberg:
I guess it would be slightly better, if we provided something like a NumTraits::smallest(), ourselves.
I changed my local version of Eigen to
Eigen$ diff eigen-eigen-fbc536aef564/Eigen/src/Householder/Householder.h eigen-eigen-fbc536aef564-PS/Eigen/src/Householder/Householder.h
78c78
< const RealScalar tol = (std::numeric_limits<RealScalar>::min)();
---
> const RealScalar tol = NumTraits<RealScalar>::smallest() ;
Eigen$ diff eigen-eigen-fbc536aef564/Eigen/src/Core/NumTraits.h eigen-eigen-fbc536aef564-PS/Eigen/src/Core/NumTraits.h
82a83
> * \li smallest() returning the lowest strictly positive value.
136a138,142
> }
>
> EIGEN_DEVICE_FUNC
> static inline T smallest() {
> return IsInteger ? 1 : (numext::numeric_limits<T>::min)();
and
Eigen$ diff eigen-eigen-fbc536aef564/Eigen/src/Householder/Householder.h eigen-eigen-fbc536aef564-PS/Eigen/src/Householder/Householder.h
78c78
< const RealScalar tol = (std::numeric_limits<RealScalar>::min)();
---
> const RealScalar tol = NumTraits<RealScalar>::smallest() ;
Using
static inline Real smallest() { return TpRFloat( NumTraits<TpFloatBase>::smallest(), NumTraits<TpFloatBase>::smallest() ); }
in
template<> struct NumTraits<TpRFloat> : NumTraits<TpFloatBase>
works fine, i.e. giving me a correct tol parameter in Householder.h.
Best regards,
Peter