Re: smalleset() ( Re: [eigen] Householder.h: ::min() and operator<=) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: "eigen@xxxxxxxxxxxxxxxxxxx" <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: smalleset() ( Re: [eigen] Householder.h: ::min() and operator<=)
- From: Pavel Holoborodko <pavel@xxxxxxxxxxxxxxx>
- Date: Mon, 12 Sep 2016 23:37:28 +0900
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=holoborodko-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=qgdpKzOBQIwx75ODcDXnXVkDfGV8ShfaYxj73cp4uCY=; b=E4q++oLBRuaZtotXdMMNDQmCftbX+XWlWwKf0vGKxBTwFr3gv5kh+YYAVZFTIYMbhV G5Cvg9eyOx6G80KeZq+gGbHp1aHZlaxd7+nCq57hqzhD47VJ9bGL+a2a4fyx8yGNfT2B am247xxa9kqJRLjQD9WJqlKj2rDJ9LZyb0dXO5kzjxDnjvqA7Ygp/br59skxS6MM1HPN ZDLWLUIUVxRIVK46VEZSVQqqIIK5yRnc9FJbRmYIwQzXwFGNrinIdBngH3HZ+aRid1hI 8ih7/4F4CP1paWhBCxE7JViiq5ARUDD6ianLhGJZDK1uWY2+CAE8JZcWgTzcERYvWhDO tk8g==
> I'd rather stick with std::numeric_limits::min():
I second that.
It is good idea to specialize std::numeric_limits for custom numeric type.
Together with std::swap, which enables std algorithms to work with the
type efficiently.
And probably provide specialization of std::complex for the type.
On Mon, Sep 12, 2016 at 11:23 PM, Gael Guennebaud
<gael.guennebaud@xxxxxxxxx> wrote:
> I'd rather stick with std::numeric_limits::min():
>
> std::numeric_limits has to be specialized for custom types anyways (it is
> one of the rare cases where users are welcomed to enter in the std
> namespace), and I don't see reason for exposing a different value for
> std::numeric_limits::min() and NumTraits::smallest()? The only advantage I
> see could be a clearer name (not sure smallest is really clearer though).
>
> I know that we already have some aliases in NumTraits, but retrospectively I
> think this was a bad idea, it just make everything more confusing.
>
> gael
>
> On Mon, Sep 12, 2016 at 11:08 AM, Peter <list@xxxxxxxxxxxxxxxxx> wrote:
>>
>> Dear Christoph,
>>
>>
>> Am 12.09.2016 um 10:57 schrieb Christoph Hertzberg:
>>
>>> If nobody objects against that, I'll patch this into the dev-branch.
>>> Especially, are there objections against or alternative suggestions for the
>>> naming? `lowest()` probably would be a bad choice, since this is what std
>>> calls what
>>> we call `min()`.
>>>
>>
>> The problem with std::min() is, that it has to be understood historically.
>> The name is a bad choice,
>> since the behaviour is different for integer and floating point values .
>>
>> > N.B.: The 1 must be T(1) here (in case T is not implicitly constructible
>> > from int). And perhaps we should document it as "lowest non-denormalized
>> > positive value".
>>
>> Which would suggest lowest() as a name, which is however already used.
>>
>> Best regards,
>> Peter
>>
>>
>