Eigen is not fast??

(Edit - OP has vanished: or been assisted to depart)


Well, dividing by 0 is quite fast ... if not very enlightening.


Matrix3d m2;
m2 << 1, 2, 3, 4, 5, 6, 7, 8, 9;



What do you think the determinant of the matrix
1 2 3
4 5 6
7 8 9

is?

And its "inverse"?


BTW, you would probably get an even faster routine (for 3x3 matrices) by:
- hard-coding all those array indices in working out the cofactors, rather than using the remainder (%) operation;
- using some of the cofactors already calculated to work out the determinant, rather than doing the same operations twice.

But your method has no obvious generalisation to anything other than 3x3 matrices. Whereas, Eigen's does.
Last edited on
The order that you measure can also make all the difference. And measuring a single call is probably more noise than signal.
you can probably code any algorithm for a 3x3 using shortcuts that you can't do for 1000x1000.
try to beat the library with something substantial. If you just want a 3x3 and you need that more instantly than instant, sure, you can probably do better.
with just a 3x3 you can unroll all the loops, its all in one little chunk of memory, the det is directly computable with a cheesy formula, and so on.
I guess the OP has vanished, but Eigen is likely to benefit substantially from the compiler optimizer. This is particularly true because it's a template library.
Topic archived. No new replies allowed.