Reshaping a row major matrix by row major returns a vector whose iterator isn't `std::contiguous_iterator`.
Summary
Reshaping a row major matrix by row major returns a column major vector.
Environment
- Operating System : Linux
- Architecture : x64
- Eigen Version : 3.3.9
- Compiler Version : Gcc13.2.1
- Compile Flags : -O2 -march=x86-64-v3
- Vector Extension : AVX2
Minimal Example
#include <span>
#include "Eigen/Dense"
int main() {
Eigen::Matrix3f m;
std::span<const float, 9>(m.reshaped<Eigen::StorageOptions::RowMajor>().begin(), 9);
}
Steps to reproduce
- Open the above godbolt link.
What is the current bug behavior?
When I reshape a row major matrix by row major, the iterator category of the returned vector is random access even though it can be contiguous.
What is the expected correct behavior?
When I reshape a row major matrix by row major, the iterator category of the returned vector should be contiguous.
Anything else that might help
I think one of the causes is that the reshaped
member function always returns a column vector. Actually, I tried making reshaped
return a row vector, then no compile error appeared.
-
Have a plan to fix this issue.