I discovered that the row() method return type can be implicitly converted to a column vector, as in this example
A << 1, 2, 3, 4;
auto Arow = A.row(0);
std::cout << Arow << std::endl;
Eigen::Matrix<double,2,1> Acol = A.row(1);
std::cout << Acol << std::endl;
I think that the second operation should give an error, and explicitly require a call to transpose() to work in this way.
Why is this happening? Is there any design here that I am not aware of?
Auto-transposing compile-time vectors was a very early design choice and disallowing it would unfortunately break the API.
We could introduce a compile-time-flag like EIGEN_DONT_AUTO_TRANSPOSE which, when defined, would result in an error for your code. And we can completely disallow it in a 4.0 release in the (far) future.
I thought we had a discussion/bug entry about that already, but I was not able to find it.
A compile time flag would do it for me, thanks.
A would also like to see this properly described in the docs, I could not find any reference to it.