Re: [eigen] Matrix assignment

[ Thread Index | Date Index | More Archives ]

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... 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 =). Then we only have to add some assertions.

Or should we allow, e.g.:

MatrixXd m;

to return 0 ?

or another (more realistic) example:  m.block(i,j, 0, j+2);  Currently
there is an assert in block which avoids that.


On Mon, Oct 20, 2008 at 8:54 PM, Benoît Jacob <jacob@xxxxxxxxxxxxxxx> wrote:
> On Monday 20 October 2008 20:48:15 Benoît Jacob wrote:
>> However, I understand that as long as we keep the policy that "as soon as
>> the number of rows and columns are >0, the array is allocated" then the
>> checks that we already have on the numbers of rows and columns check
>> implicitly that the arrays are allocated.
> Hmm no in fact, I wrote too fast.
> If we allow 0 size then we will have to add checks on rows()>0 at many places.
> I still support your idea, I  just want to underline that it's a quite massive
> change and we have to make sure we add this kind of checks everywhere it's
> needed. For example, one such place is in the coeff() method of Product
> expression, etc, in fact everywhere we loop over rows / columns.
> Cheers,
> Benoit
> ---

Mail converted by MHonArc 2.6.19+