I have a very large SparseArray called A. What is the most efficient way to update say element {i,j} with value x to the value f[x] ? I worry about memory usage and code speed if I need to make like a very large number of updates. I've seen Leonid's comment here about a similar problem. But there is a lot of info scattered over old SO site and I am looking for function and a syntax something like f[A_, {i_,j_}, f_] that will do the job. I think it is a very essential question for recursive by-element updates to `SparseArrays' and would love to see a complete solution here.
Efficient by-element updates to SparseArrays
Vitaliy Kaurov
- 74.9k
- 9
- 212
- 380