Re: [eigen] Matrix assignment |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Matrix assignment
- From: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>
- Date: Mon, 20 Oct 2008 21:26:22 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=DIgtCrszNyveK2plDQ3kwy3ooJty55n5AlhEniSGGvY=; b=rLr4+tMOixRs1gEH5S1PdFr3WHsDypSHnwH9PqMKYf1x3nE8FVw53ydmavhGPRs8vu A7G3BHagMLb3mONcDCf/p9G8Slg4yMuu7fIdBHPxw3K3eWSGx10i0WZgJqX6xvpAzE9w ejb5XiqcHAVZjryFsVsaaRIm+KCs6k1qWew6c=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=l/1Ou7Uj3xNjr4Exp5K1W30uQn7Oepuwl0TSwfUd10rjwCN9xZ+ALHXTTYkVRxJjP5 jEX+AaDhIH8Fv9XtE/lyC4UJbxIdV+n5BiJfu7A2/th/FV8bvtvAZn98/6PvGKpiwWa+ LB8CtYgFkDJzZtdUKMmYP1XeQ09aHmljm6xlg=
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;
m.sum();
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.
gael.
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
>
> ---
>
>