I am interested in porting my Matlab implementation to C++ for speed improvement. I tried armadillo. It is perfect for porting code from Matlab because Armadillo's library functions names/syntax is very close to that of Matlab programming. However I realized that at some places Matlab out performed armadillo because my data is mainly sparse and armadillo does not give it any special treatment and simply treats it as dense matrices. Armadillo team is working on sparse matrices support but currently it is not available. So I am looking for a library which like Armadillo has syntax very close to Matlab (or is easy to use) and supports sparse matrices for speed and space optimization.
Asked
Active
Viewed 1,176 times
10
-
11Before porting your code to C++ you ought to convince yourself that it will be worth the effort. SO is littered with the sad tales of people who thought that they could do just this, write C++ code to outperform Matlab, and wondered why, despite tremendous efforts, they had failed. In many cases it's simply that they have not realised that for a lot of its core mathematical routines Matlab uses compiled code and what they have, in fact, tried to do, is write C++ code which outperforms the compiled code written by experts at the Mathworks. – High Performance Mark Jul 05 '12 at 12:10
-
2I agree with High Performance Mark. Matlab built-in functions are incredibely performant and optimized. They are built on old fortran or C code, which is highly effective. If you use vectorized code in your Matlab scripts, it is very probable that Matlab will outperform other linear algebra functions implementations. What exactly do you need to speed up? – reverse_engineer Jul 05 '12 at 13:35
-
1Have you considered GPU computing to speedup your code? Jacket is great and offers sparse functions for this. – Ben Stewart Jul 06 '12 at 02:33
-
1@HighPerformanceMark user1241315 and Ben Stewart, thanks for your replies. I did some speed comparisons and realized exactly what you people are saying. Ben Stewart, thanks for the idea. I will look for it too. – Haider Jul 09 '12 at 14:48
-
Thanks for coming back and updating us. – High Performance Mark Jul 09 '12 at 14:48