Re: [eigen] problem with operator() in development branch |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] problem with operator() in development branch
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Tue, 1 Jun 2010 21:09:56 -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=gAR7WOM9DzC32UW01G28UvizGkUfT51/i9JyWI8oBWI=; b=QbF3jy+XaIwQeGDSRzIME9v7/0tMsj7B1xPFhtP66jxFEhJtGr5vhn0KSOl9XSWdmT L0eeIW8a9BJG4kQxMRlxNfzdlIZI74nctlZLSdsTdW2kogzTawQ3AGYESE2xaCg5nWcB O2LlSnIUqHmno2XhQCnirRtEHHfgvYL5oJIeE=
- 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=OO/+gNNKDE1Mr0mJtnNU0xdIYIEH20+kHdzNNd1hDvkFlSevhFDuF51Hvo21KNBZrj 3kurz/OFTw7miVcBYQ43qdlgheZ0GJeezslG2JmhfUzQ5Na+jIIWk85OnhnU0s6Eampl wTUT3S6wN+vSjPEqSAhfLW33neYTL2etcc8vY=
2010/6/1 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
>
>
> On Tue, Jun 1, 2010 at 2:55 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
> wrote:
>>
>> oh, right ! Don't know why I didn't remember about that. By the way,
>> are you planning to allow 1x1 to scalar conversion ? I'm rather
>> favorable to that. There recently was an unanswered forum post about
>> doing that.
>
> ok I've a working version of that:
>
> Matrix<float,1,1> mat;
>
> mat = 1;
> float x = mat + 1
> std::sin(mat);
>
> but there is a quite big downside:
>
> mat * 2
>
> does not compile anymore because there is an ambiguity which has to be
> resolved by doing either:
>
> mat * Scalar(2);
> mat * 2.f;
> Scalar(mat) * 2;
>
> Maybe the worst thing is that such an ambiguity will show up for 1x1 objects
> only... so think about general template code which compile fine for all
> objects except 1x1. Since the later ones are likely not be well tested.....
Hm, good you thought about that, this is indeed not very rejoicing!
>
> I'm tempted to postpone this feature and/or enable this conversion for inner
> products only which are less likely to trigger such issues.
..... and moreover, is probably the most frequent use case. Yes, I'd
like that very much!
> Also for other
> use cases there is the class Array which is supposed to be explicitly fully
> compatible with scalars.
Right!
Benoit
>
> gael
>