My goal is to find such properties of a sparse matrix as the maximum / average number of elements other than zero per row.
The brute force way of doing it is by converting the scattered matrix into a normal one:
MaxSpar[matr_] : = Module[{curr, ms = 0},
Do[
curr = Length[Cases[matr[[k]], 0]];
Yes[curr > ms, ms = curr];
, {k, 1, length[matr]}
];
He came back[ms];
];
MaxSpar[Normal[SomeSparseMatrix]]
How can we do the same without using Normal[]
?