Sparse building seems slow
Afficher commentaires plus anciens
Hi, I'm working with some large scale LP matrices, exactly two nonzero entries per row and 500k+ rows. I'm using sparse to generate the matrices but it seems slow, about 20min for ~500k rows, 1hr+ for ~1M rows. This accounts for about 80% of my overall run time, once it hits the LP solver things go quickly. Any ideas on how to speed things up? I'm hoping to increase my number of data points which would require a larger matrix (~5M rows). Code below:
%row indices%
i=[1:n_active,1:n_active];
%column indices%
j=[row,col+n];
%constraint ones%
s=ones(2*n_active,1);
%filling sparse matrix%
A=sparse(i,j,s,n_active,n+m,2*n_active);
I'm running on a modestly powered laptop (i5 dual core, 4g Ram). If I can provide any more info let me know, or feel free to tell me to just be patient =) Thanks! Nick
2 commentaires
Nick Henscheid
le 28 Juin 2011
James
le 15 Nov 2011
I am working on the finite element method and I have the same problem. sparse is very slow when the matrix is in the order of 1M*1M. For FEM, this kind of matrices is very normal. It seems that sparse is the best code that Matlab can give. Perheps c or fortran is better?
Réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!