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

[ Thread Index | Date Index | More Archives ]

On 2016-09-12 17:05, Gael Guennebaud wrote:
Perhaps, another solution would be to always write Literal(0),  Literal(1)
instead of Scalar(x). By default, NumTraits<T>:: Literal is defined as T,
and as NumTraits<Scalar>::Real for std::complex.

This is not much more typing (one more typedef here and there), and this is
more efficient as this preserve the fact that the number is real.

This assumes that the following is fine for any T:

T r;
std::complex<T> c = r;

I guess this works as long as the default constructor of T exists and creates a zero element (which generally is a reasonable requirement).



 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:

Mail converted by MHonArc 2.6.19+