Re: [eigen] inverse unit test

[ Thread Index | Date Index | More Archives ]

well, if you do isMuchSmallerThan(x,0) then that clearly means you want to check the x equals 0.

Now let's consider isApproxZero(x); How can we decide whether x is close to zero without knowing the context, i.e.., without knowing the magnitude of your non zeros? This is why we really have to add a "reference value" parameter to this function. So isApproxZero(x) becomes isApproxZero(x,reference) == isZeroComparedTo(x,reference) == isMuchSmallerThan(x,reference).

The only purpose of the isMuchSmallerThan function is to check a value is nearly zero. Nothing else. So this is really what you want.


On Thu, Jun 10, 2010 at 9:42 AM, Manuel Yguel <manuel..yguel@xxxxxxxxx> wrote:
I hit the same problem several times and the implementation of
isMuchSmallerThan for float is:

inline bool ei_isMuchSmallerThan(float a, float b, float prec =
 return ei_abs(a) <= ei_abs(b) * prec;

if b is zero, then whatever prec is, it will failed if a is not zero,
so I do agree with Hauke that his implementation is needed.
So in fact in my own code I finally used the function he proposed.

- cheers,


Mail converted by MHonArc 2.6.19+