Click here to Skip to main content
15,886,714 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have to demo a graph-based semi-supervised learning algorithm that need to compute an inverse of a square matrix with large size ( 2000 x 2000).

I used Matrix Decomposition to compute the inverse matrix but the elapsed-time is about more 200(s). I wonder if I used parallel code it took a half time (~ 100s).
Any idea to reduce the time to compute an inverse matrix ? (as MATLAB took ~20s)

P/S : I'm using Visual Studio 2012 C# compiler with a core i5 computer.
Posted
Updated 1-May-16 19:08pm
Comments
Sergey Alexandrovich Kryukov 15-May-15 16:27pm    
Time to work!
(Matrix inversion is inherently time-taking operation.)
—SA
Toan Pham Anh 15-May-15 16:36pm    
Could you tell me how matlab do this. I can't search this anymore

Sergey Alexandrovich Kryukov 15-May-15 17:08pm    
I'm not a Matlab author. Why would you like to know that? You should rather know how to do the calculation. You can find the algorithm in any book on computational mathematics, because matrix inversion operation has way too many applications. Besides, you could figure some algorithm through learning some linear algebra.
—SA
Toan Pham Anh 15-May-15 17:33pm    
Because Matlab make me ask this question. I wrote a program and it is too slow than matlab. I go to the internet and i found that if I have a dual-core cpu and using multi-threading program , it took at less a half time with same algorithm. Am I wrong ?
Sergey Alexandrovich Kryukov 15-May-15 21:30pm    
I see. It's hard to say, it depends how the algorithm works in parallel. Generally, if you double the number of cores, I don't think you can expect double performance. Performance depends on many random factors; and the actual timing shows remarkably high dispersion in statistics.
—SA

My only comment is why, unless this is a maths research thing :-)

Nobody would really invert a 2000x2000 matrix it would be faster to solve the equation and once solved about a million times faster to use that multiplying any input value by a 2000x2000 inverse matrix to get an answer.

So I am curious why anyone would do this.

Even on Matlab forums when people ask about large inverts they generally preface the answer with
C#
You should ask yourself whether you really need to do the matrix inversion or not.
 
Share this answer
 
v2
Depending on the method you use and on your code, the matrix is so big that you are trashing the CPU cache, and thus exploding the time to run.
You can be sure that Mathlab have been optimized and conduct the calculus in a way that minimize cache trashing.
If the problem is cache trashing, Parallelization may lead to even worse timings.

You will need to show your code for more explanations.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900