フィルターのクリア

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 Center および File ExchangeSparse Matrices についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by