Re: [eigen] inverse unit test |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] inverse unit test
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 10 Jun 2010 06:54:13 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=cIwcdGpAZIne2QAtQaA3B+sw1jNqDP7Sy+h2kdcTBSY=; b=MXg8ee59oSIFlT/h4CWv2aFmd87wWHCAeCN14zydqD2kQDwT98DSH6amoH/U/1cdKY a7xGQa/F2jRrfm3xwRwdj5QFSn6aYPI4EX9IhBj0sOQN5/4LUaMlZ8dh7+XDwzryjuw+ Fh382F9hlMjTj1G+Y9K+8mvJCE1ApqinvHgX0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=TUcChGgukYlQM/mS7Ps3s1sjqcwgsva2U6TuwuUHK65ffYonWJHZjk+7PPVYecqKEk vqI/aJwhvwXNCa20/e//7uJwBonFL3HWqv71bHaDmghbhX9CSvMp2Vh0N0uCSHAflaUV Qk4g1M+UKEbVY2hIKYFp8asHKJWOjhFtz6y4g=
2010/6/10 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
>
>
> 2010/6/10 Adolfo Rodríguez Tsouroukdissian
> <adolfo.rodriguez@xxxxxxxxxxxxxxxx>
>>
>>
>> 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 =
>>> NumTraits<float>::dummy_precision())
>>> {
>>> 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.
>>>
>>>
>>
>> Here's my 2 cents.
>>
>> The VectorBase and MatrixBase classes apart from implementing the
>> isApprox(...) method, implement the very convenient:
>>
>> bool isZero (const T & precision = Util::epsilon<T>()) const
>> bool isNegligible (const T & other, const T & precision =
>> Util::epsilon<T>()) const
>> bool isNegligible (const Derived & other, const T & precision =
>> Util::epsilon<T>()) const
>>
>
> Where did you find the isNegligible functions? Anyway isNegligible would be
> an alias for isMuchSmallerThan.
>
> Regarding isZero, yes we added it for "convenience" but I think it is more
> difficult to use than isMuchSmallerThan unless you are in the specific case
> where your values are in the order of 1. Otherwise you have to compute
> yourself what is the ideal epsilon matching your case, and this is more
> difficult than simply specifying a reference value of your non zeros because
> this "ideal" epsilon depends on the scalar type. In other word, with
> isMuchSmallerThan you only have to bother about the typical range of your
> non zeros, while with a isZero function you also have to take care at the
> scalar type.
>
> Now I acknowledge that in many cases, 1 is a good reference value, and so
> yes why not adding such a isZero for scalars as well nut with a big warning
> because it has to be used with care. Let's see what Benoit thinks about
> that.
>
> gael
Just confirming that I agree with everything Gael said here :)
I had forgotten about isZero and I think it's a bad idea that we have
it, I'd advocate removing it, forcing people to use
isMuchSmallerThan(ref). This forces people to think about which
reference to use to compare.
Benoit
>
>>
>> For convenience and parallelism with the Vector and Matrix types classes,
>> it would be nice to have the isZero(...) and isNegligible(...) functions
>> defined for Scalar types as well. Granted, isZero(val, prec) ==
>> isMuchSmallerThan(val,1.0, prec), but the former is less verbose and much
>> easier to understand.
>>
>> Adolfo
>>
>>> - cheers,
>>>
>>> Manu
>>>
>>>
>>
>>
>>
>> --
>> Adolfo Rodríguez Tsouroukdissian, Ph. D.
>>
>> Robotics engineer
>> PAL ROBOTICS S.L
>> http://www.pal-robotics.com
>> Tel. +34.93.414.53.47
>> Fax.+34.93.209.11.09
>> AVISO DE CONFIDENCIALIDAD: Este mensaje y sus documentos adjuntos, pueden
>> contener información privilegiada y/o confidencial que está dirigida
>> exclusivamente a su destinatario. Si usted recibe este mensaje y no es el
>> destinatario indicado, o el empleado encargado de su entrega a dicha
>> persona, por favor, notifíquelo inmediatamente y remita el mensaje original
>> a la dirección de correo electrónico indicada. Cualquier copia, uso o
>> distribución no autorizados de esta comunicación queda estrictamente
>> prohibida.
>>
>> CONFIDENTIALITY NOTICE: This e-mail and the accompanying document(s) may
>> contain confidential information which is privileged and intended only for
>> the individual or entity to whom they are addressed. If you are not the
>> intended recipient, you are hereby notified that any disclosure, copying,
>> distribution or use of this e-mail and/or accompanying document(s) is
>> strictly prohibited. If you have received this e-mail in error, please
>> immediately notify the sender at the above e-mail address.
>
>