This bugzilla service is closed. All entries have been migrated to

Bug 1019

Summary: viewAsReal() method
Product: Eigen Reporter: Christoph Hertzberg <chtz>
Component: Core - generalAssignee: Nobody <eigen.nobody>
Status: DECISIONNEEDED ---    
Severity: Feature Request CC: chtz, gael.guennebaud, jacob.benoit.1
Priority: Normal    
Version: 3.4 (development)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 1018, 1712    

Description Christoph Hertzberg 2015-05-20 12:59:38 UTC
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.
Comment 1 Gael Guennebaud 2015-06-05 13:03:10 UTC
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).
Comment 2 Christoph Hertzberg 2016-03-22 18:15:11 UTC
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.
Comment 3 Nobody 2019-12-04 14:39:24 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to'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: