Registered Member
|
Hi,
it seems that indexed-based access to a matrix wrapped in a Ref<> object leads to a compilation error ( "YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT"). This compiles: MatrixXd M = MatrixXd::Random(3, 3); Ref<MatrixXd> M_ref = M; double a1 = M(1, 5); double a2 = M(7); double b1 = M_ref(1, 5); Compilation fails if I add: double b2 = M_ref(7); I don't know if this is related to the error raised in viewtopic.php?f=74&t=121501? |
Moderator
|
Yes, this is because by default Ref<MatrixXd> accepts non trivial strides, meaning that the memory layout is not necessarily contiguous, and thus operator()(index) is disabled.
|
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]