Sparse building seems slow

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

Nick Henscheid
Nick Henscheid 2011년 6월 28일
I figured I'd give this a bump - any thoughts?
James
James 2011년 11월 15일
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?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

질문:

2011년 6월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by