Why can't I have a Row Major Column Vector
Submitted by brian
Assigned to Nobody
Link to original bugzilla bug (#416)
Version: 3.3 (current stable)
Description
Eigen fails to compile the following program
#include <eigen/Eigen>
int main(int, char**) {
Eigen::Array<double, Eigen::Dynamic, 1, Eigen::RowMajor> x;
return 0;
}
with output
In file included from [...]/eigen3/Eigen/Core:293:0,
from [...]/eigen3/Eigen/Dense:1,
from [...]/eigen3/Eigen/Eigen:1,
from test.cpp:1:
[...]/eigen3/Eigen/src/Core/PlainObjectBase.h: In static member function ‘static void Eigen::PlainObjectBase<Derived>::_check_template_params() [with Derived = Eigen::Array<double, -0x00000000000000001, 1, 1>]’:
[...]/eigen3/Eigen/src/Core/Array.h:125:7: instantiated from ‘Eigen::Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Array() [with _Scalar = double, int _Rows = -0x00000000000000001, int _Cols = 1, int _Options = 1, int _MaxRows = -0x00000000000000001, int _MaxCols = 1]’
test.cpp:4:60: instantiated from here
[...]/eigen3/Eigen/src/Core/PlainObjectBase.h:631:7: error: ‘INVALID_MATRIX_TEMPLATE_PARAMETERS’ is not a member of ‘Eigen::internal::static_assertion<false>’
In my opinion, RowMajor or ColMajor is meaningless for (Row- and Column-) Vectors, but not an error. I believe that the assertion
EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (Options&RowMajor)==RowMajor)
&& EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (Options&RowMajor)==0)
&& ((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0))
&& ((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0))
&& ((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0))
&& ((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0))
&& (MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime==Dynamic)
&& (MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime==Dynamic)
&& (Options & (DontAlign|RowMajor)) == Options),
INVALID_MATRIX_TEMPLATE_PARAMETERS)
should not apply to this case. I do not know the exact intent, but I believe that the first two rows simply should be removed.
Please correct me, if I am wrong, or if something wouldn't work in this case.
kind regards,
Brian