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

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

*To*: eigen <eigen@xxxxxxxxxxxxxxxxxxx>*Subject*: Re: smalleset() ( Re: [eigen] Householder.h: ::min() and operator<=)*From*: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>*Date*: Mon, 12 Sep 2016 17:05:17 +0200*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=H1KlZgqUi5m7vrf1qjcdIV8qxPIh1YQpKitVPpTaU9U=; b=wfNo6oCaO1DBzlAgj2iljXWNyeVTH4HmLwFvk5Tisb3nFxynOwQJozpTQ2ZRcXXZxd eHXFFD0SbmD+eaZ57kMrMW1/A1rJp+t6D8Xxv1nYpwdGLlygOmPmjWI95Eri0dHP6U5Z m/Ml4GtuOVfdg4T69Zl3qHpJpuk+FqWQg7vnp2PLV7/pV47aePKhEIkOCMZUmqamBx0v MmDsB0Zuw6CcPBpbFC9vEbgB8aFltEXqFQ4zOub87JFzkDEtgNgZGgsXmJUZ8PHibMQl wKKX7aCjyladtmDvZsYYR6Yv6qEekc7QclsLeKZMfxEzVtYIAdH9o75AQ4BQqnIC9V3K nS/w==

On Mon, Sep 12, 2016 at 4:53 PM, Christoph Hertzberg <chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:

and CustomType does not have an implicit constructor from int

I guess that if CustomType has at least one implicit ctor from any primitive arithmetic types, then everything should be fine too. And it seems reasonable to me that any custom numeric type should provide such a ctor.

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;

gael

**Follow-Ups**:**Re: smalleset() ( Re: [eigen] Householder.h: ::min() and operator<=)***From:*Christoph Hertzberg

**References**:**[eigen] Householder.h: ::min() and operator<=***From:*Peter

**Re: [eigen] Householder.h: ::min() and operator<=***From:*Christoph Hertzberg

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

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

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

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

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

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

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: smalleset() ( Re: [eigen] Householder.h: ::min() and operator<=)** - Next by Date:
**Re: smalleset() ( Re: [eigen] Householder.h: ::min() and operator<=)** - Previous by thread:
**Re: smalleset() ( Re: [eigen] Householder.h: ::min() and operator<=)** - Next by thread:
**Re: smalleset() ( Re: [eigen] Householder.h: ::min() and operator<=)**

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