Re: smalleset() ( Re: [eigen] Householder.h: ::min() and operator<=)

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi Peter,

generally this looks good. Of course, all other occurrences of numeric_limits<>::min should be replaced as well.

If nobody objects against that, I'll patch this into the dev-branch. Especially, are there objections against or alternative suggestions for the naming? `lowest()` probably would be a bad choice, since this is what std calls what we call `min()`.

On 2016-09-11 14:00, Peter wrote:
[...]

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)();

N.B.: The 1 must be T(1) here (in case T is not implicitly constructible from int). And perhaps we should document it as "lowest non-denormalized positive value".


Christoph




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





--
 Dipl. Inf., Dipl. Math. Christoph Hertzberg

 Universität Bremen
 FB 3 - Mathematik und Informatik
 AG Robotik
 Robert-Hooke-Straße 1
 28359 Bremen, Germany

 Zentrale: +49 421 178 45-6611

 Besuchsadresse der Nebengeschäftsstelle:
 Robert-Hooke-Straße 5
 28359 Bremen, Germany

 Tel.:    +49 421 178 45-4021
 Empfang: +49 421 178 45-6600
 Fax:     +49 421 178 45-4150
 E-Mail:  chtz@xxxxxxxxxxxxxxxxxxxxxxxx

 Weitere Informationen: http://www.informatik.uni-bremen.de/robotik



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/