[eigen] (vec1*vec2.transpose())*vec3 on 2.0.5/6

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


Hi all,

On 2.0.5 and 2.0.6 I've noticed that
   (vec1*vec2.transpose())*vec3
errors out at compile time while
   (vec1*vec2.transpose()).eval()*vec3
works just fine, but I found that out by blind trial-and-error.

Two questions:
1) Is the observed behavior legit?
2) If (1), then what piece of insight is escaping me for why the former doesn't compile?

Sample code attached.

- Rhys
#include <iostream>
#include <Eigen/Core>

int main(int argc, char **argv)
{
    Eigen::Vector3d a(1,2,3);
    Eigen::Vector3d b(4,5,6);
    Eigen::Vector3d c(7,8,9);

    // Desired computation
    Eigen::Matrix3d a_outer_b(a*b.transpose());
    std::cout << a_outer_b*c                << std::endl;

    // Attempts to express desired computation in one line
//  std::cout << (a*b.transpose())*c        << std::endl; /* breaks */
    std::cout << (a*b.transpose()).eval()*c << std::endl; /* works */
}


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