static assert for single column/row matrices
Thu Mar 26, 2015 5:07 pm
in Core/PlainObjectBase.h, line 654, there is:
These two EIGEN_IMPLIES make it impossible to use a single column matrix with RowMajor indexation or a single row matrix with ColMajor indexation. Why so?
I know that Matrix(float, 1 , 3, RowMajor) is equivalent to Matrix(float, 1, 3, ColMajor), so I can work with the first one. But why make the second one forbidden?
Is it a mistake or is it for optimization purpose?
Actually it is really annoying me. I have a templated algorithm, and in this algorithm I use jacobian matrices which sizes are defined by the template parameters. One template parameter is the size N_m of the measure and the other template parameter is the number N_p of parameters that the measure is depending on. The EIGEN_STATIC_ASSERT I'm talking about prevents me to implement one of these two cases: one dimensional measures, or measures that depend on only one parameter. The solution/hack would be to specialize my algorithm for the cases that do not work... but I think it is no good solution.
My proposition is to simply remove these two lines from the assert from eigen code !
Looking a bit further, I found that this had already been reported as a bug http://eigen.tuxfamily.org/bz/show_bug.cgi?id=416. It seems there is no official solution so far.
In my case I will be using traits, with the number of rows, cols and also the expected layout. This trait will deal with the special cases for me:
Re: static assert for single column/row matrices
Sat Mar 28, 2015 10:21 am
I've cross referenced your post from the bug entry. Feel free to add you in CC of the bug entry if you want to follow/participate the respective discussions.
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]