Efficient sparse matrix operation

1 view (last 30 days)
Esegboria Osarhemen
Esegboria Osarhemen on 5 Mar 2019
Answered: Stephan on 5 Mar 2019
I have a 900 x 900 sparse matrix 'S' which contains alot of zeros, when i perform the following operation
It takes too long because it is operating on the zeros too and resulting in alot of NaN values. Is there a more efficient way to do this

Answers (1)

Stephan on 5 Mar 2019
if you precalculate the sum and then calculate you can save some time:
N = sum(S,2);
I tried using sparse matrices of 900x900 with about 10k non zero elements, which was more time consuming then this operation.
Best regards


Find more on Sparse Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!