Track progress of large matrix muliplication

2 views (last 30 days)
I am trying to solve a simple Ax=b problem by using x = A \ b, but the A matrix and b vector are quite large (6300 x 6300 and 6300 x 1) respectively. The calculation thus takes quite a long time and I'm looking for a way to track its progress. I've read about the waitbar function, but this only seems relevant to situations where you have written your own code. Is there any way to step inside the MATLAB matrix multiplication function to use waitbar, or an alternative method that will let me know how much longer the multiplication is going to take?

Answers (1)

John D'Errico
John D'Errico on 13 Dec 2015
Edited: John D'Errico on 13 Dec 2015
First of all, this is NOT s matrix multiplication! It is the solution of a linear system of equations, a very different thing. Most of the time taken will be in the form of factoring the matrix A.
No, you cannot step inside compiled code to see how far it has progressed, nor can you use a waitbar here. Backslash is compiled code. Even if you could put some sort of waitbar on it, it would slow down the code.
Finally, a linear solve of that size is not that large of a problem anymore. You may be memory limited, so the best thing you might do is get some extra RAM.
A = rand(6300);
b = rand(6300,1);
tic,x = A\b;toc
Elapsed time is 5.216970 seconds.
That seems reasonable to me for a problem of that size, and my CPU is a few years old now. Newer machines would surely see that time cut by a significant percent, at least a factor of 2 without much effort.
Finally, you might consider if the matrix is a sparse one, or if it should be stored in that form. Sparse solves can be a HUGE improvement in time, when the matrix is truly sparse. For that to be viable however, don't bother if it is not seriously sparse. For example, if even 90% of your matrix is actually zero (so 10% non-zero), sparse form will not reduce the time required for a solve.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!