Many thanks Mauro for the explanation and guide.If I use the efficient iteration, is there a way to get the index of the nonzero element, i.e. the i of A[i] when A[i] is nonzero?
On 2014年10月17日 15:03, Mauro wrote:
However, if you just need to iterate over the non-zero values, it can be done much more efficiently: for nz in A.nzval if abs(nz)>1. val += (nz - s) * (x + y) end end We should probably add an iterator to sparsematrix.jl which does that.