Sparse building seems slow
Mostrar comentarios más antiguos
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 comentarios
Nick Henscheid
el 28 de Jun. de 2011
James
el 15 de Nov. de 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?
Respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!