Re: [eigen] Assertion in DenseStorageBase.h:487: Nonnegativity of rows and cols sufficient?

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


Thanks, pushed.
Benoit

2010/7/20 Martin Senst <martin.senst@xxxxxx>:
> Am Dienstag 20 Juli 2010, 20:39:13 schrieb Benoit Jacob:
>> Yes, it's OK. Can you send us the patch?
>
> Sure, here it is.
>
> Cheers,
> Martin
>
>
>
>
>
>> http://eigen.tuxfamily.org/index.php?title=Developer%27s_Corner#Generating_
>> a_patch
>>
>> 2010/7/20 Martin Senst <martin.senst@xxxxxx>:
>> > Hi everyone,
>> >
>> > sorry to bother you again with the topic of zero-sized matrices, but as
>> > I've written in the thread about sum() of empty vectors, I need them to
>> > avoid ugly special-case-treatments.
>> >
>> >
>> > I'm wondering wheter it's okay to change the assertion in
>> > DenseStorageBase.h, lines 486 and 487, from
>> >
>> > ei_assert(rows > 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime
>> > == rows)
>> > && cols > 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime ==
>> > cols));
>> >
>> > to
>> >
>> > ei_assert(rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime
>> > == rows)
>> > && cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime ==
>> > cols));
>> >
>> >
>> >
>> > The issue is that currently, code like
>> >
>> > MatrixXd A(0, 0);
>> > MatrixXd B(0, N);
>> > MatrixXd C(N, 0);
>> >
>> > fails due to this assertion. If compiled with NDEBUG, this code works as
>> > expected, so I guess that the current assertion is overly strict.
>> >
>> > As a workaround, something like
>> > MatrixXd C = MatrixXd(N, 1).leftCols(0);
>> > works, but of course that's pretty ugly.
>> >
>> > Cheers
>> > Martin
>
>



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