[eigen] Traits and MSVC

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Regarding the recent mentioning of the traits, some MSVC related findings.

Executing the attached file yields the following output on MSVC:

  struct Eigen::ei_eval<class Eigen::GeneralProduct<
      class Eigen::Block<class Eigen::Matrix<double,3,3,0,3,3>,2,2,32>,
      class Eigen::Matrix<double,2,33331,0,2,33331>,4
    >,
    struct Eigen::Dense>

  class Eigen::Matrix<double,2,33331,0,2,33331>

  class Eigen::Block<class Eigen::Matrix<double,3,3,0,3,3>,2,2,32>

This is obviously all wrong. The only correct output is the middle one
generated by

  print_type_info<Lhs::Nested>();

Patching the struct ei_nested to taking just 'ei_eval<T>' or something
'ei_plain_matrix_type<T>' resolves the issue partially and results in

  class Eigen::Matrix<double,2,33331,0,2,33331>
  class Eigen::Matrix<double,2,33331,0,2,33331>
  class Eigen::Block<class Eigen::Matrix<double,3,3,0,3,3>,2,2,32>

Way better though still broken. Somehow, the traits are not correctly
un-pealed. Strangely, adapting ei_traits<CwiseBinaryOp> from

  typedef typename Lhs::Nested LhsNested;
  typedef typename Rhs::Nested RhsNested;

to

  typedef typename ei_nested<Lhs>::type LhsNested;
  typedef typename ei_nested<Rhs>::type RhsNested;

does not remedy the situation and yields the same output. Help does
though the following change. I replaced (in CwiseBinaryOp)

  typedef typename ei_traits<CwiseBinaryOp>::LhsNested LhsNested;
  typedef typename ei_traits<CwiseBinaryOp>::RhsNested RhsNested;

by

  typedef typename ei_nested<Lhs>::type LhsNested;
  typedef typename ei_nested<Rhs>::type RhsNested;

The methodology is not yet clear but I think I am now able to fix #81.

- Hauke

Attachment: main.cpp
Description: Binary data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/