function nz = nonzero(s)
% returns number of non-zero elements
%    nz = nonzero(s)

[m,n] = size(s);
nz = 0;
for i1 = 1:m
  for j1 = 1:n
    if s(i1,j1) ~= 0.0
      nz = nz+1;
    end
  end
end
