Sparse building seems slow
Ältere Kommentare anzeigen
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 Kommentare
Nick Henscheid
am 28 Jun. 2011
James
am 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?
Antworten (0)
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!