I want to find the number of non-zero elements in a sparse matrix. The non-zero elements can be any number, positive or negative. Is there any function to count them?
E.g.
In the following matrix, there are 6 non-zero elements.
[[ 1, 0, 2, 0],
[-11, 0, 0, 0],
[32, 1, 2, 0]]