Re: [eigen] problem with operator() in development branch

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


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
>



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