Registered Member
|
I did a comparison between eigen and armadillo. Here is the code
Here is the output in VC 11: Square Euclidean Distance Computation Benchmark. Armadillo Matrix: 0.18 Armadillo Brute Force: 2.413 6.03961e-014 Eigen Matrix: 0.469 Eigen Brute Force: 0.291 8.52651e-014 In VC2010, the result is similar. The brute force method of Eigen is fast, however, directly computation by manipulate matrix using Eigen is slow (2~3 times compare to armadillo). What is the problem, or what is the right way to do. |
Registered Member
|
Hi sth4nth,
are you compiling in 32bit or 64bit mode? If you are compiling in 32bit mode, make sure you enabled SSE. If you have already enabled SSE or you are in 64bit mode, the problem could reside in the replicate statement. We may have a performance issue there regarding how statements are nested and evaluated. I would have to double check the problem if none of the above issue improve the runtime. - Hauke |
Moderator
|
thanks for this report, there is indeed an issue in Replicate which does not properly use our nesting rules. In clear, the nested expression is not evaluated into a temporary, and so it is evaluated multiple times. This is easy to fix, in the meantime, the workaround is to use .eval(), e.g.:
-> much faster! |
Registered Member
|
Thanks, ggael. Indeed, much much faster (5x faster than before, 2x faster than armadillo). Hope you fix the problem soon.
|
Registered Member
|
Eigen in VC is very fast, the matrix version of my test case runs about 0.8s. However, I tested again in Mac, under Apple llvm 3.1, it runs slow. Here are results
Armadillo Matrix: 0.548987 Armadillo Brute Force: 4.88918 7.81597e-14 Eigen Matrix: 1.75017 Eigen Brute Force: 6.24062 Here is the code
|
Moderator
|
I cannot reproduce with the default mac compiler (llvm-gcc)
can you be more specific about the version of your compiler, llvm+gcc ? llvm+clang ? the macport version ? anyway make sure you compiled with the optimization enabled (-O2 -DNDEBUG) |
Registered Member
|
Ignore my previous post. I was stupidly running in debug mode. Here is the result for release mode in xcode 4.3.1
Armadillo Matrix: 0.252057 Armadillo Brute Force: 0.245539 7.81597e-14 Eigen Matrix: 0.095675 Eigen Brute Force: 0.160599 Eigen performs extremelly well. |
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]