I propose adding a viewAsReal() method, which returns for complex-valued matrices/vectors a matrix/vector of twice the size but with pure real values. I guess doubling the size in the direction of storage order would make most sense.
For real-valued matrices this would simply return itself.
Perhaps, the inverse of that would also make sense (this has to assert that the dimension is even, of course).
Bug 1018 could efficiently be solved by that.
I'm ok with that.
For expressions with direct access and no custom inner-stride, this can be efficiently implemented on top of MapBase.
For general expression, I'm afraid we need a new one (similar to Block).
A point which just came up in an IRC discussion:
For both viewAsReal() and viewAsComplex() it is often ambiguous in which direction to expand/contract -- especially when the expression uses mixed Majorness sub-expressions (e.g. A+A.transpose()).
Perhaps using viewAsReal<RowMajor>() could expand to the side and viewAsReal<ColMajor>() to the bottom.
-- GitLab Migration Automatic Message --
This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1019.