sparse function is intrisically slow?

6 views (last 30 days)
Jiangtao Lu
Jiangtao Lu on 7 May 2020
Answered: Robert on 24 Dec 2020
I am building the sparse matrix using the function sparse(I,J,V,N,N)
I, J and V are already a column vector. I checked previous questions, it seems already being the best way. But, it takes extreamely long time if the size goes to 1E5.
Any way out? Thanks!
Jiangtao Lu
Jiangtao Lu on 12 May 2020
I am not clear to that question. The calculation is like:
work.jacValueIndex = numC*(work.g(work.J)-1)+work.I;
jacValue = df(work.jacValueIndex)./dc(work.J);
jac = sparse(work.I,work.J,jacValue,numC,numC);
I attached an example of work and jacValue

Sign in to comment.

Answers (1)

Robert on 24 Dec 2020
I was able to speed my sparse matrix build for very large problems by using sparse2.m (mexFunction) from SuiteSparse.




Community Treasure Hunt

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

Start Hunting!