Automatically transforming a*b.transpose()*c into a*b.dot(c)

Submitted by Rhys Ulerich

Assigned to Nobody

Link to original bugzilla bug (#371)
Version: 3.0

Description

Awhile back (http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2009/09/msg00280.html)there was some discussion of automatically transforming a*b.transpose()c into the equivalent (and faster) ab.dot(c).

A quick test 3.0.3 shows the latter expression being appreciably faster than the former at -O3 using the (admittedly lousy) benchmark

Eigen::Vector3d a, b, c, d;  

for (unsigned long i = 0; i < 1000000; ++i) {  
    grvy_timer_begin("Outer");  
    a.setRandom();  
    b.setRandom();  
    c.setRandom();  
    d = a*b.transpose()*c;  
    grvy_timer_end("Outer");  

    grvy_timer_begin("Dot");  
    a.setRandom();  
    b.setRandom();  
    c.setRandom();  
    d = a*b.dot(c);  
    grvy_timer_end("Dot");  
}  

Very, very low priority. Just wanted to capture it as an issue.

  • Rhys

Depends on

#99 (closed)

Edited by Eigen Bugzilla