% take a n by n matrix Q. % count the number of entries larger than 10^{-10} in absolute value % count=0; for i=1:n for j=1:n if (abs(Q(i,j)) > 1.0e-10) count = count+1; end end end count