How do I find the average distance of nonzero diagonal to the main diagonal. I can get the main diagonal by diag(A), so I guess the real question is how do I get the nonzero diagonal(s) for a sparse matrix.
In the case shown in the image, the average distance of non zero diagonals is (1+3+2+3)/4 -> 2.25
Best Answer