Registered Member
|
Hello, I am a new user of Eigen. Previously, I code in Matlab and now I want to port my code to C/C++. I am actually looking for a good library for computing extensive linear algebra in C/C++ and interested in Eigen.
I have just downloaded Eigen3 (ver3.0.2) and did a small test of the computation speed of SVD function for matrix with data type double and size 225x225. However, the computation speed is not satisfying. I am wondering if there is a mistake in my code since I haven't read the documentation of Eigen3 completely. Below are the code and the comparison if I am using built-in svd function from OpenCV:
The output:
Compared with the OpenCV svd:
The Output:
The compiler: i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00) Any comment or suggestion? Thank you. |
Moderator
|
Eigen's SVD implements the Jacobi method which is more reliable than more standard implementations based on Householder reflexion. On the other hand it is also slower for large matrices. That said, a factor 30 for a 225^2 matrix does not make sense. Make sure you compiled you program with optimizations -O2.
I also recommend you to switch to macport' gcc 4.5 or 4.6. Default macosx compiler has a lot of issues. |
Registered Member
|
Thank you for the reply. With the optimizations -O2, the speed improves alot:
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]