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

Bug 1194

Summary: Improve det4x4
Product: Eigen Reporter: Marc Glisse <marc.glisse>
Component: LUAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: Optimization CC: chtz, gael.guennebaud
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 814    

Description Marc Glisse 2016-04-08 11:33:41 UTC
Hello,

in LU/Determinant.h, one can read

    // trick by Martin Costabel to compute 4x4 det with only 30 muls

If I compare with another project (CGAL/determinant.h), they have only 28 muls (and the same number of add+sub). The license is not compatible so I won't copy the code here, but they are using a simple algorithm: develop with respect to the last column, recursively, and notice the common sub-expressions. In other words
* compute the 6 2x2 subdeterminants of the first 2 columns (2 muls each)
* compute the 4 3x3 subdeterminants of the first 3 columns (3 muls each)
* conclude (4 muls)

(the same strategy is still profitable for dimension 5 IIRC)
Comment 1 Gael Guennebaud 2019-02-18 15:24:35 UTC
ok, done:

https://bitbucket.org/eigen/eigen/commits/e7fb55b0b186/

The new version is better vectorized by clang. GCC does not vectorize any of them.
Comment 2 Nobody 2019-12-04 15:37:52 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/1194.