Sum over cell array of sparse matrices
1 回表示 (過去 30 日間)
古いコメントを表示
I have 100 sparse matrices of size N by N, where N=65536.
They have about 5500000 nonzero elements(0.13% of N^2) close to the diagonal.
They are stored in a cell array, S{1}, ... , S{100}, and I want to compute the sum S{1}+...+S{100}.
Sum=sparse(N,N);
for i=1:100
Sum=Sum+S{i};
end
The above for loop code took about 25 seconds. Is there any way to optimize this code?
0 件のコメント
回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!