Re: [eigen] inverse unit test

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




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

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.


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