Registered Member
|
H everybody,
I remember the discussion about allowing the construction of dynamic matrices of size 0x0. As I remember correctly, it is allowed in the development branch and should be in the latest 2.0.x release. I even use it and it works well using 2.0.12.Now it came to the first time when I compiled without any debug symbols. This time it did assert on constructing Matrix(0,0)!!!? Do you know any trick (for example #define-s) to allow 0x0 matrices in Eigen 2.0.x? What is the current state in the development branch? Is it finally allowed there? Or did the developer team decided against this feature? (That would mean we have to move from Eigen to somewhere else) Thanks in advance. Sebastian |
Registered Member
|
Ok, I browsed the source code and found that the options
EIGEN_NO_DEBUG and NDEBUG disable all asserts (sadly, no selective disabling possible?) I also checked the trunk and it seems that the assert has been gone, but I can be mistaken since Matrix creation is more sophisticated there. |
Registered Member
|
Yes, this is allowed in both 2.0 and the development branch, the syntax for that is to use the default constructor:
Yes, I re-checked, and with 2.0.12, as with the development branch, the above works, but passing explicitly the 0x0 size like this:
doesn't work. I believe that the reason was so we know at compile-time which matrices are 0x0. Is that OK with you (to have to use the first syntax above) ? Or is it important to allow also the 2nd one? Perhaps we should do that as it is a bit confusing, but it will result in one more if() at the creation of each dynamic-size matrix, resulting in a performance overhead. So, is it OK for you to use the first syntax above?
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
Sure it is ok. I was not sure about default constructors - I actually never use them. Thanks for the reply. One more question, though:
In Eigen 3.0, will it be allowed to create, say Matrix(0,0), Matrix(i,0), Matrix(0,j) ? The latter 2 cases are often used in timeseries analysis as starting values of the samples. |
Registered Member
|
At the moment it's not allowed, but you're not the only one to ask for it, and I'm looking at these things. And it's indeed not intuitive that Matrix(0,0) is not allowed whereas Matrix() is. On the other hand, as I said, it's not easy to allow it without incurring a constant overhead. In the worst case it should be possible to add a separate constructor to build zero-size matrices while making it clear at compile time, by passing a special parameter of a special type, e.g. Matrix(ZeroSized, i, 0). I'll look at it...
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
I could live with and love such a solution. I agree that efficiency comes first and that the standard method should be in place.
Thanks for listening, Benoit! |
Registered Member
|
No problem, actually I had a look at the code and at the moment I'm not sure I remember _why_ we didn't allow this. Improvements on this front may be coming...
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]