Registered Member
|
Hi,
I'm using Eigen to diagonalize complex self-adjoint matrices of size 500. To compare the speed of algorithms used for real and complex matrices, I diagonalized the same (real) matrix, first coding it as MatrixXd and then as MatrixXcd. The matrix entries are m(i,j) = 1.0*delta_ij - 0.5*delta_{i,j+1} - 0.5*delta_{i,j-1} where delta_ij is the Kronecker delta. Running it under Cygwin/g++, with optimization parameters -O3 -msse2, I obtained the following timings for 10 repetitions of diagonalization: real: around 4.5s complex: around 21-28s g++ version is 4.3.4. I am sure that Eigen is set up to vectorize the code because the macro EIGEN_VECTORIZE is defined, and switching off -msse2 increases the diagonalization time considerably. Is the big difference of timings to be expected? can I set up things differently, so that complex matrices are diagonalized faster? should I switch to a different library for this task (like LAPACK)? EDIT: I compared the timing with the performance of ZHEEVD routine in Cygwin's build of LAPACK. ZHEEVD takes 10.5s to run the complex matrix test (as compared to at least 21s for Eigen). Is it because ZHEEVD is less accurate? |
Moderator
|
yes a factor 4 is not surprising since the product of two complexes require 4 real products. It would be interesting to see how the double LAPACK respective routine performs compared to the complex one. Also, Eigen currently only offers a Jacobi algorithm which is slower than an algorithm based on Householder reflexions (as in Lapack) for large matrices but on the other hand it is also more accurate.
|
Registered Member
|
katastrofa, I'm interested that you are using cygwin and -msse2 with Eigen 3. I had a number of difficulties doing so reported in viewtopic.php?f=74&t=94917 and http://eigen.tuxfamily.org/bz/show_bug.cgi?id=277. You'll see that a number of unit tests (including LU and QR) fail with -msse2 on Cygwin. Have you had any problems, or are you just not using functions which would cause a problem?
Thanks. |
Registered Member
|
Which Lapack algorithm do you refer to? I used ZHEEVD. |
Registered Member
|
I was only using the diagonalziation. I used Eigen under Cygwin to compare it with Lapack. Normally I use Eigen with MS VS C++ 2010. |
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]