This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 371

Summary: Automatically transforming a*b.transpose()*c into a*b.dot(c)
Product: Eigen Reporter: Rhys Ulerich <rhys.ulerich>
Component: Core - expression templatesAssignee: Nobody <eigen.nobody>
Status: CONFIRMED ---    
Severity: Optimization CC: chtz, gael.guennebaud, jacob.benoit.1
Priority: Normal    
Version: 3.0   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 99    
Bug Blocks:    

Description Rhys Ulerich 2011-10-31 15:48:41 UTC
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) a*b.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
Comment 1 Benoit Jacob 2011-10-31 15:51:26 UTC
The expression evaluator (bug 99) should make this kind of optimizations possible.
Comment 2 Nobody 2019-12-04 11:14:43 UTC
-- 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/371.