This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Empty matrices

Tags: None
(comma "," separated)
djp
Registered Member
Posts
7
Karma
0

Empty matrices

Thu May 28, 2009 3:22 pm
Hello,

I just stumbled upon the problem that VectorXd::Zero(0) triggers an assertion. I wanted to ask if there is a good reason for disallowing such an expression. In my particular case, I have something like VectorXd::Zero(N), and if N==0, returning an empty matrix would make perfect sense. Now I had to add a check for N==0 and treat this case separately.
When compiling with -DNDEBUG, everything runs fine, but it's quite inconvenient to not be able to run your stuff in debug mode.
Therefore I would like to encourage you to allow such expressions, unless there is a good reason not to that I have missed.

Anyway, thanks for this great library!
Best regards,
Martin
Seb
Registered Member
Posts
99
Karma
0

Re: Empty matrices

Mon Jul 13, 2009 4:15 pm
I fully agree with this post.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Empty matrices

Mon Jul 13, 2009 8:00 pm
The main reason is that we were afraid to have to add checks everywhere in the code. Finally it turns out that's probably not the case, and so in the devel branch we already started the necessary changes to allow null matrices. This will be available for the 2.1 release.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]