Re: [eigen] Assertion in DenseStorageBase.h:487: Nonnegativity of rows and cols sufficient? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Assertion in DenseStorageBase.h:487: Nonnegativity of rows and cols sufficient?
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Tue, 20 Jul 2010 14:39:13 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=L8ZjqQiSliMeTu1XXYYvWpCvpzdoPayhRE09yWk8ZqE=; b=MIbjdgw7FKY0ou4yt+/LrbQBjVnm5ewZgJIpsJ3SWGZHzAflcz5zLl7uYatfwnzBw8 Be7A4fRvNKGrU5A/OYHdreNAan3VDbiLyTtrHLU++D+s3SFBcqiHrym8Z+9oqGsAYUvA dRmeJgfClkvo7Dve1LmFcud+tZMFHGWH6HwpQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=TojDepmhV671Gx6B7rD6Bj6AfR2FC4J/LEIuPIMSs+UVs3WVIy5mzszk4H0gugss3s 4MTI1A8Q6ivsmzpmpx/41o4HN3afw2IOJC0hKQkhoeScrcoi5bpYEzYM5FMrUURrljFR bvBmygL70OqOo3Sss8D8F10j9X5PWK/lSd/9I=
Yes, it's OK. Can you send us the patch?
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
>
>
>