Sparse matrix inversion in parallel

Is there a way to invert a sparse matrix using MATLAB's Parallel Computing Toolbox? For instance, if I type:
>> matlabpool open
>> matlabpool size
ans =
12
>> A = distributed.sprand(1000,1000,0.01) ;
>> b = distributed.rand(1000,1) ;
>> spmd; x = A\b; end
I get the error message:
Error stack:
mldivide.m at 51
Sparse input arguments are not yet supported.
Is this a fundamental limitation in MATLAB, or am I missing something? I would like to harness parallel computing to invert a large, sparse matrix.
Thanks for your time, Alex

Réponses (1)

Jill Reese
Jill Reese le 8 Juin 2012

0 votes

Hi Alex. Unfortunately, distributed/mldivide is currently limited to solving full linear systems. Thanks for pointing out that this limitation has not been explicitly stated in the help or documentation.
We are continually adding new features to distributed arrays, and we would like to expand our support for sparse linear algebra. Is the example shown in your question representative of the size and sparsity of the linear systems you want to solve? Are there are other linear algebra functions that you would want to use with sparse distributed arrays? We would appreciate any additional information that you might provide.
Best,
Jill

4 commentaires

Alex
Alex le 11 Juin 2012
Hi Jill,
Thank you for the reply. I want to invert matrices that are closer to 10,000 or even 100,000 on a side. This is possible in MATLAB with sparse matrices (density ~1e-4), although it takes me several minutes to compute. But the parallel toolbox only accepts full matrices. These require so many more computations to invert, and so much more memory to store, that it overwhelms any benefits of parallel computing. So distributed/mldivide would only be useful for me if it could accept sparse matrices. Otherwise it's much faster to use regular mldivide.
Alex
Jill Reese
Jill Reese le 20 Juin 2012
Alex, thanks for the additional information. I'm not sure if it will speed things up for you at all, but there is one workaround that you could try.
N = 10,000;
density = 1.0e-4;
A = sprand(N, N, density); % Your sparse matrix here. Do not distribute it.
SparseEye = distributed.speye(N); % distribute the sparse identity matrix
X = A\SparseEye; % explicitly compute the inverse
X will be a distributed array containing the inverse of your sparse matrix A. The important thing here is not to distribute the matrix you want to invert, but rather distribute the second input to mldivde. Again, I'm not sure if this will provide better performance than regular mldivide, but it is the only way that you can invert a sparse matrix in parallel right now.
Hope this helps,
Jill
Sid
Sid le 1 Août 2012
Jill, I have a similar problem. I can run Matlab with about N=200,000 and density about 1.0e-5 on my desktop. I would like to scale up to around N=1000,000 with density around the same or a bit less 1.0e-6. mldivide with sparse matrices in parallel would be the way to go short of writing my own MPI code.
Remington Reid
Remington Reid le 12 Oct 2016
I have run into the same issue. I'm simulating diffraction using the Finite Difference Frequency Domain method, and solving very large sparse systems. Parallel support for mldivide would be ideal. In my case the sparse matrix has N~10^6, with a density of 10^-6, is complex and not positive semi-definite.

Connectez-vous pour commenter.

Question posée :

le 7 Juin 2012

Commenté :

le 12 Oct 2016

Community Treasure Hunt

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

Start Hunting!

Translated by