필터 지우기
필터 지우기

sparse function is intrisically slow?

조회 수: 4 (최근 30일)
Jiangtao Lu
Jiangtao Lu 2020년 5월 7일
댓글: Yingzhi Liu 2022년 3월 19일
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!
  댓글 수: 14
James Tursa
James Tursa 2020년 5월 12일
OK. Are the values in the double vector stored in the same memory order as the sparse matrix columns? Can you give a small example of your indexing and values vector? I'm asking all of these questions to see if a mex routine could work for you.
Jiangtao Lu
Jiangtao Lu 2020년 5월 12일
편집: Jiangtao Lu 2020년 5월 12일
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

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

답변 (1개)

Robert
Robert 2020년 12월 24일
I was able to speed my sparse matrix build for very large problems by using sparse2.m (mexFunction) from SuiteSparse.
  댓글 수: 1
Yingzhi Liu
Yingzhi Liu 2022년 3월 19일
I downloaded SuiteSparse, but I don't konw how sould I do to use sparse2.m in matlab. Can you help me list the steps after downloaded SuiteSparse? Thanks.

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

카테고리

Help CenterFile Exchange에서 Sparse Matrices에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by