Re: [eigen] Matrix assignment

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


On Monday 20 October 2008 21:26:22 Gael Guennebaud wrote:
> hm, are you sure ?
>
> for (int j=0; j<m.cols(); ++j)
>
> if cols()==0, then there is no big deal. actually I don't see where
> this could be a pb since we already check that the sizes match....
> maybe I miss something ?
>
> ah, now I see, in some place we initialize an accumulation with the
> first coeff, assuming the size is >= 1...

Yes, that's the kind of thing I was thinking about...

> so the next  question is 
> whether a size equal to zero is valid or not ? We can still autorize
> empty matrices to live while stating it is forbidden to use it (except
> on the lhs of =).

Yes, if we allow 0-size matrices then that's the way I see things should be.

> Then we only have to add some assertions.

Yes.

>
> Or should we allow, e.g.:
>
> MatrixXd m;
> m.sum();
>
> to return 0 ?

Hmm I'm really not in favor of that. For sum it seems sort of natural to 
return 0 but for other operations there is no natural value to return. Like 
maximum, etc.

Cheers,
Benoit

---


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